npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mondaydotcomorg/atp-compiler

v0.22.1

Published

Production-ready compiler for transforming async iteration patterns into resumable operations with checkpoint-based state management

Maintainers

yairfeyairfeavivdaavivdasaararsaarartomramutomramuyonaharelyonahareljoshpe-mondayjoshpe-mondayalonbehaimalonbehaimsergeyroytsergeyroytantonru92antonru92laviomrilaviomrishanibenaderetmondayshanibenaderetmondayvitalimvitalimadarmondayadarmondayaviel_mondayaviel_mondayhadaspehadasperotemtarotemtashayelmodnayshayelmodnaychristopher-nowakchristopher-nowakvladmondayvladmondayella-miella-miliorkeliorkeomermondayomermondayrutikeveshrutikeveshaf8811af8811avihayavavihayavcsalomancsalomaneran.hubermaneran.hubermandanielabdanielabmoshikmoshikaviv_go_npmaviv_go_npmdanielb-bladepopdanielb-bladepoporibaoribaoronmelleroronmelleryglaubachyglaubachayelet-mondayayelet-mondaydanielle.ahdanielle.ahidohayidohaynavecohennavecohensaharbsaharbtombogtombogbarakbebarakbeidoyana-mondayidoyana-mondaylorin-totahlorin-totahoronmondayoronmondaynik-savchenkonik-savchenkotomerfriedmantomerfriedmanyosefwyosefwigor_budiigor_budimatanyaw2matanyaw2nirlachmannirlachmanorrgottlorrgottlsebastian-curland-mndysebastian-curland-mndyyuly-robermanyuly-robermanamirbardugoamirbardugobarcohen2barcohen2illyayuillyayutootmorantootmoranfreak4pcfreak4pcmateuszwomateuszwoamit_hanochamit_hanochdorhasondorhasongal_libermangal_libermannoamn3knoamn3kronachmany-mondayronachmany-mondayshahafmelamedshahafmelamedyuvalbyuvalbbenpibenpidorshakeddorshakedmickael_firstmickael_firstitaycohenitaycohenmayaheilbrunmayaheilbrunventuramdventuramdudidoronudidorongoralthgoralthshaietshaieturi-shmueliuri-shmuelianatkatzanatkatzshalomsteinbachshalomsteinbachannasoannasoboazjboazjofirmonsingoofirmonsingoshaneeshaneeavifreegeavifreegeliorrabinliorrabinvirtservirtserssddnodessddnodepablo-mdcpablo-mdcamitbiranamitbiranorelhazorelhazroyna-devroyna-devsergeybrsergeybrofirc-mondayofirc-mondaynizanshnizansharavasharavashavnerhaavnerhaidanklingeridanklingeraxelstaxelstdanielkheyfetsdanielkheyfetscarloscr.mondaycarloscr.mondaylorenzo.palorenzo.paaviv_goaviv_gogiuliofigiuliofilahav_p_mondaylahav_p_mondayheshamgoheshamgotaniasilvataniasilvabenymondaybenymondaydanielokanindanielokaninneomi_shavitneomi_shavitshaikatzzshaikatzzarielmondayarielmondayguywaguywatomsap-mondaytomsap-mondaylukaszf-mondaylukaszf-mondayliranrorlichliranrorlicheran-coheneran-cohenmaya-assayagmaya-assayagrami-mondayrami-mondayalonbrimeralonbrimerethans-mondayethans-mondaywitoldtkwitoldtkerlich75erlich75adamflooradamfloorlahavplahavpomernave1omernave1rankupmondayrankupmondaybuzagloidanbuzagloidanjeandavidjeandavidmeromcomeromcoarnonrgoarnonrgodanapodanapoannasolomonikannasolomonikmitzafon-mondaymitzafon-mondayyoavgayoavgalueranlueranshiranbirenbaumshiranbirenbaumnirro.mondaynirro.mondaynicole_kezliknicole_kezlikmichalsz-mondaymichalsz-mondaymickey_mondaymickey_mondayitamarteitamartedor-cohendor-cohenliranbinliranbinasif_mondayasif_mondaylotemkirshlotemkirshorihassid2507orihassid2507itaymndyitaymndyeyalmueyalmuarekze-mondayarekze-mondayibmondayibmondayvikas-mondayvikas-mondayalonmualonmulukaszfiszer-mondaylukaszfiszer-mondaymarszelun-mondaymarszelun-mondayarnonguarnongumarekpemarekpeharelcohenharelcohenameerdoameerdokamiekamiedekelabedekelabehadascohadascoalonsadanalonsadanrama-ronrama-rongilby1gilby1galor-mondaygalor-mondayran-haveshush-mondayran-haveshush-mondaymichaelsimkinmichaelsimkinbarakbsbarakbsedenhayatedenhayatrachelikarachelikaliorfrliorfranyatchernishovanyatchernishovnadavavnadavavthierryguythierryguynirarazi.mondaynirarazi.mondayedenberdugoedenberdugoneilmonneilmonalonzialonzirongabbayrongabbayetgarmonetgarmonronniemironniemimoshe-samsonmoshe-samsonadamru-mondayadamru-mondaygauravsh-mondaygauravsh-mondayshlomiatmondayshlomiatmondayandrey-palmanandrey-palmanleonidkrleonidkrtomzohtomzohshirsharshirsharmonday-grahamlamonday-grahamlayoni-alalufyoni-alaluftomer-gillmoretomer-gillmorerobertdarobertdasaarbasaarbatalsoffertalsofferalonlealonlestasshwstasshwataliareataliareidanmondayidanmondayraneldanraneldanbarosenbarosenrotemda10rotemda10vladislavmovladislavmoyardendvyardendvchensarchensaryuvalgryuvalgrjohhh_mondayjohhh_mondayandreihryhoryeuandreihryhoryeuinbaldginbaldgjosephsamondayjosephsamondaykubakolybaczkubakolybaczbanueldobanueldomoriatmoriatmatanlamatanlaavivgiavivgialonschatzalonschatzidanoridanordanamumondaydanamumondaymichallormichallorsrdjan-mondaysrdjan-mondayggaallggaallshanmondayshanmondaytomerzlotomerzloophirdoophirdojohnny-morjohnny-morfilip-daca-mondayfilip-daca-mondayurielwasyngurielwasyngchrisbamondaychrisbamondayamitmazor37amitmazor37jakubmojakubmoflistflistoded_by_mondayoded_by_mondaymichaljamichaljanovronovroamitcoamitcogalspmondaygalspmondayyaaraweyaaraweinbaltainbaltaorelco2orelco2eyalleeyallealexjalbaalexjalbaamithadarramithadarradva-gonshadva-gonshrotemserotemseaviyaselaaviyaselarichardmarichardmaorcomondayorcomondayronov1ronov1shoshanyshoshanynaamayanaamayagalko_mondaygalko_mondaynadavshteinbergnadavshteinbergelenalielenaliyovelnayovelnaroteminbarroteminbarmayanraficmayanraficalisadaalisadanivsanivsatalbe197talbe197dave-rosebergerdave-rosebergernadavgunadavguhosannaouhosannaougregra81gregra81bernardpo-mondaybernardpo-mondayeviatharmeviatharmnoaraponoaraposhayalshayalhadarzahadarzaronavmondayronavmondaytaniasitaniasigal_finger_mondaygal_finger_mondaylirondolirondolihibmlihibmmichaelimasmichaelimasyoavteyoavtekangankanganmarta-mondaymarta-mondayarielklarielklmichalbelmichalbeldyh1213dyh1213dvirpedvirpeshaharshakishaharshakitomasztarczynskitomasztarczynskisimonshsimonshshalevkeshalevkemaor-barazanimaor-barazanimarcinko-mondaymarcinko-mondaydanielga-mondaydanielga-mondayeliyapleliyaplsapir_barsapir_baryavgenypayavgenypaomergrinomergrinigorczigorczmayaismayaisyoavstyoavsttim-mondaytim-mondaygalbrgalbralonagealonagegil_zilbermangil_zilbermanleimoniomndleimoniomndadirhadirhgrzegorzrojekgrzegorzrojekorilaorilatomhousmantomhousmantomkochtomkochromkadriaromkadrialiorshwliorshwnivyahnivyahyotamhermesyotamhermesroni-ben-aharonroni-ben-aharontomnisimtomnisimmoro256moro256litalwlitalwshirazbehar2shirazbehar2cezarylacezarylavasilyklvasilyklaviel_hershkovitzaviel_hershkovitzanyakhanyakhmayabarkanmayabarkanmatanmamanmatanmamanbenmamondaybenmamondaydoron.brikmandoron.brikmanliorl-mondayliorl-mondaytalhararitalhararitalshetalshetsemachlitsemachlilotanyuranlotanyuranramhillelramhillelidangaidangaadam_scottadam_scottpiotrdu-mondaypiotrdu-mondayephraimgrephraimgrjakubso2749jakubso2749yevgeniliyevgenilidorsimmdorsimmmichaelvamondaymichaelvamondaynettazinettazigioraguatmondaygioraguatmondayyahorzhyahorzhshaharzishaharzianastasiyakhanastasiyakhomrialomrialpolinanapolinanadongwhiatmondaydongwhiatmondayjonathanbibasjonathanbibasofir-efraimofir-efraimmiloszpi-mondaymiloszpi-mondaykarolszmndykarolszmndyyardengavyardengavdanielmo-mondaydanielmo-mondayorly_spivakorly_spivaktalketalketalibl.mondaytalibl.mondaysandeepkmondaysandeepkmondayorfriorfriwaseemabwaseemabnoy-diamantnoy-diamantamirkeamirkeantonigmantonigmashb22ashb22neyemaawneyemaawmeirawislovskymeirawislovskyrzmndrzmndrangr-mondayrangr-mondayyossisaadi.mondayyossisaadi.mondayjonathansejonathansetheidotheidoguyhadasguyhadasdoryehudadoryehudaronco99ronco99olegsh_mondayolegsh_mondayjr-mondayjr-mondayomerraomerradaniel_barashdaniel_barashitaimondayitaimondayirawiirawironaperonapeitamarshitamarshsergeilisergeiliamichaymondayamichaymondaydord2dord2ronenmoronenmoyuvalbatashyuvalbatashgiladar-mondaygiladar-mondaygiladscgiladscjonmathewsmondayjonmathewsmondaymiritwomiritwodavidgohbergdavidgohbergmaor-kamaor-kaitamarchitamarchdanimanidanimaniamiteyamiteysivansolsivansolmagnus_gabormagnus_gabornofarmonofarmooliviadaoliviadayuliagoldbergyuliagoldbergarielgrarielgrgalfagalfaalexpoalexpoalonaavalonaavnuriel_mondaynuriel_mondaypiotrkopiotrkoronifischlimronifischlimyonatanbi-mondayyonatanbi-mondaylauremolauremoben_levben_levyehuda_npm2yehuda_npm2lidornitzanlidornitzanaranweb-mondayaranweb-mondayhananmahananmaeladna-mondayeladna-mondaydorsimm2dorsimm2naorsnaorssamwisamwilukaszmichlukaszmichuziabuziabasafswasafswadmonsaadmonsatalkortalkorv0vs-mondayv0vs-mondayliran-brimer-mondayliran-brimer-mondayavivzafraniavivzafraniyoniho_myoniho_mnatalyranatalyrapinizopinizovickyhivickyhitiagopi-mondaytiagopi-mondaydanielepdanielepidanmoralidanmoraladirmonadirmonidohaidohatomergatomerganegevmanegevmayosia1990yosia1990rivkaungarrivkaungarnogakrilnogakrilmaornakashmaornakasheliyahumanymondayeliyahumanymondayadirhaziz2adirhaziz2iamichaltiamichaltori-mondayori-mondayalongoloalongolokrzysztoffikrzysztoffishalevhadshalevhadkuzalekskuzaleksnatanrolnik_mndnatanrolnik_mndkapusjkapusjdoronsidoronsiavileviavileviliranroliranroorizvidamondayorizvidamondayalexpealexpekamalwo-mondaykamalwo-mondayasaf472mondayasaf472mondaymia-hmia-hlaurazajdnerlaurazajdnermeirav_ronmeirav_ronboazanaboazanaeviatarsaeviatarsayaairalyaairalnoamco-mondaynoamco-mondaymia_newmanmia_newmannurkiewicznurkiewicznoamst-mondaynoamst-mondaymichael-azimovmichael-azimovnitzanshinitzanshisaridansaridandavidcooperdavidcoopertomreedtomreedeschanlereschanlerhilineemanhilineemanyuvalseyuvalseidanpedidanpedronilaronilaitaykalitaykalmoshiko_ben_avimoshiko_ben_avimondayshpiglifymondayshpiglifynoamagoodmannoamagoodmandimaaldimaalgadshgadshrotemdurotemdushirakohavishirakohavimaxime.mondaymaxime.mondaydanielvadanielvagabriel.amramgabriel.amraminbalziinbalzitomasz-fijalkowski-mondaytomasz-fijalkowski-mondayalmogrualmogrudaniilvodaniilvomondayjohnmondayjohnbashanyebashanyeroni_adarroni_adarthomasjo25thomasjo25tomaszlamondaytomaszlamondayeden-eitanieden-eitanitom-katztom-katzdoniawadoniawaedogr1edogr1yonatanelyonataneleladdoeladdolukasz-dudzinskilukasz-dudzinskitom_shlomitom_shlomiodedsandakodedsandakhodayaishodayaiseinatboeinatboalexandrzhalexandrzhmichalpl-mondaymichalpl-mondayiradcoiradconitzanholmes718nitzanholmes718eliasgaeliasgaidoagidoagitaysimitaysimjacksnettjacksnettyoniho_mondayyoniho_mondayroiatiasroiatiaseladmondayeladmondaytomasfeldertomasfelderibgudmanibgudmanitcerbyitcerbytadlamtadlamdaniellevertmandaniellevertmanartemch-extartemch-exttslilbutslilbuyaelliyaellirachelskrachelskbrittdabrittdalilach.kimhi.rossmanlilach.kimhi.rossmanaliciareidyaliciareidyshahargmndshahargmndkevinmondaykevinmondayronilevitronilevitlaurefelaurefeamirmatalon87amirmatalon87yoniarvivyoniarvivannapalganannapalgandanielwedanielweshaipa-uxrshaipa-uxrmarcin-gabmarcin-gabalonedelmanmonday1alonedelmanmonday1mulhamhamulhamhamaslomonday2maslomonday2talbamatalbamakuba_niemieckuba_niemiecyoavroyoavronitai-monday-npmnitai-monday-npmshiraweshirawegrzegorzswgrzegorzswcoralincoralinamitbenmoramitbenmorlaver_mondaylaver_mondaysimohanounasimohanounaohad-katzavohad-katzavguykorenguykorenmeytalfremeytalfredavidbr1davidbr1donia2610donia2610nicole_kezlik2nicole_kezlik2awallace327awallace327kamieshamischnitzer1kamieshamischnitzer1galbenoziliomdygalbenoziliomdymortzmondaymortzmondayyonatanleyonatanlemahmoudna-mondaymahmoudna-mondayromanshapromanshapransarusiransarusiliorla13liorla13liors619liors619dh94dh94adamyahidadamyahidhagaiwehagaiweyoni-mondayyoni-mondayshirlyrashirlyraomerfoxomerfoxrivkapelegrivkapelegjakubrohlederjakubrohledermaslomaslo5maslomaslo5mohamedigmohamedigtomaszjackowiaktomaszjackowiakshayo-arshayo-arraphaelouraphaeloufabiotaatmondayfabiotaatmondayishandua-mondayishandua-mondayhadarahhadarahtomreztomrezmatthewtomatthewtoilyamezilyamezidozitidozitdamianmarek-mondaydamianmarek-mondaysheenanasheenananurenbergvovanurenbergvovaetaymondayetaymondayrangr1-mondayrangr1-mondayandrewlo-mondayandrewlo-mondaynaormondaynaormondaymaxdv-4016maxdv-4016katedubouskayakatedubouskayaliortalmondayliortalmondaymaor-karomaor-karohadargevahadargevadominikko-mondaydominikko-mondaynovrosenamnnovrosenamnharveyr-mondayharveyr-mondayramimonday90ramimonday90ranku_mondayranku_mondayedenbeedenbenegevma2negevma2eyalmondayeyalmondaychenbeturchenbeturdorbi_mondaydorbi_mondayidanpeduiemidanpeduiemst_tomerst_tomerthibaudduthibaudduavilevi768988avilevi768988tomersttomerstrivkasc2rivkasc2naorsmondaynaorsmondayyuval-moshe-mndyyuval-moshe-mndyyardenliyardenlicarmeldahancarmeldahanofekkiofekkisagilinshitssagilinshitsjohnnpmman2025johnnpmman2025shaygrshaygrjeremybarnejeremybarneidoziidozibarakzabarakzashamilgshamilgibukun-mondayibukun-mondaysagibarkol89sagibarkol89alonsegalalonsegalofrichenofrichenyuvallev-mondayyuvallev-mondayshannon-mondayshannon-mondayjoel-mondayjoel-mondaymichaelozmondaymichaelozmondaybenlivnibenlivniapeslinapeslinnaorsolmondaynaorsolmondaysergeytsibulnik3sergeytsibulnik3jonathanadlerjonathanadlerliatyaliatyaalonmorgenalonmorgenellaportnovellaportnovadelebeadelebemichaelarmichaelaritamarhiitamarhileahorlinleahorlinruthiedarruthiedaramirfeamirferonykrishtalronykrishtalitaypa777itaypa777reutlevyreutlevyeithanhollandermondayeithanhollandermondaybenhabenhagiladomgiladomyuriisrohyiyuriisrohyiamirnajjaramirnajjarmohamedig1mohamedig1raunaq-mondayraunaq-mondayodedgoodedgonuri-mondaynuri-mondaynavelenavelelironamlironamzivha-mondayzivha-mondayshirzashirzazvimintszvimintsasif_d_dromiasif_d_dromihilakislevhilakislevtommattommateran_zidkiyaeran_zidkiyastavrastavraozkamaozkamaofirstofirstdordvdordvalonadaalonadadvirshdvirshtamarshetamarshemark-watkin-mondaymark-watkin-mondayshimony-urielshimony-urieltzvico-mondaytzvico-mondayasafbashiriasafbashiriohadleshnoohadleshnoor-mondayor-mondayaviramashkenazi-monaviramashkenazi-monjihyunum-mondayjihyunum-mondaydanielkorichdanielkorichguymarushchenkoguymarushchenkobruchim_mondaybruchim_mondaytomda-mondaytomda-mondaymiroslawwomiroslawwonickday-mondaynickday-mondayyuvalpadanyuvalpadanamalpiamalpiroeiyaroeiyaiddoaliddoalmichaldamichaldayuvalezyuvalezkerensokerensoyaarmaypazyaarmaypazroiemondayroiemondayhadarlibmanhadarlibmannetaezra1netaezra1guybe-mondayguybe-mondayamitsabag1amitsabag1lorengolorengomusayedahmusayedahamitreamitreedendoron-mondayedendoron-mondayfranekmondayfranekmondaylinoymarganlinoymargannoam-yehudanoam-yehudasergeisasergeisamatanmematanmeyoavkulayoavkularoniavroniavmonadavmonadavsofivasofivaprzemyslawbprzemyslawbadiknafoadiknafoalekseiilalekseiilandreiyuandreiyubargaldbargaldtbreuerweiltbreuerweilyanivridelyanivridelmichalbudziakmichalbudziakurasmuurasmulayanhalayanhamoshe1100moshe1100moranossmoranosssergeym-mondaysergeym-mondaylevkomondaylevkomondayyonatanc163yonatanc163matkotmatkotolegkaplunolegkaplunohad-mondayohad-mondayandreyolandreyolnetta-snetta-schezkibotwinickchezkibotwinickwitoswitosguysimaimondayguysimaimonday

Readme

@mondaydotcomorg/atp-compiler

Production-ready compiler for transforming async iteration patterns into resumable operations with checkpoint-based state management.

Overview

The ATP compiler automatically transforms async loops and array methods into resumable operations, enabling true pause/resume from any iteration point. Includes batch parallel execution optimization for 100x speedups on concurrent operations.

Installation

npm install @mondaydotcomorg/atp-compiler

Architecture

graph TB
    Compiler[ATPCompiler] --> Detect[Pattern Detection]
    Compiler --> Transform[Code Transformation]

    Detect --> ForLoop[for...of with await]
    Detect --> ArrayMethods[map/filter/reduce]
    Detect --> PromiseAll[Promise.all batch]

    Transform --> Sequential[Sequential + Checkpoints]
    Transform --> Parallel[Batch Parallel]

    Sequential --> State[Checkpoint State]
    State --> Cache[Cache Provider]

    Parallel --> Concurrent[Concurrent Execution]

Features

  • Automatic transformation of async loops and array methods
  • Batch parallel execution for concurrent LLM/approval requests (up to 100x faster)
  • Checkpoint-based state for true pause/resume from any iteration
  • Zero syntax changes - works with standard JavaScript/TypeScript
  • Production-ready with extensive testing and error handling

Quick Start

import { ATPCompiler, initializeRuntime } from '@mondaydotcomorg/atp-compiler';
import { cacheProvider } from '@mondaydotcomorg/atp-protocol';

// Initialize runtime
initializeRuntime({
	executionId: 'exec-123',
	cache: cacheProvider,
});

// Create compiler
const compiler = new ATPCompiler({
	enableBatchParallel: true,
});

// Transform code
const userCode = `
  const items = [1, 2, 3, 4, 5];
  const results = [];
  
  for (const item of items) {
    const response = await atp.llm.call({ prompt: \`Process \${item}\` });
    results.push(response);
  }
  
  return results;
`;

const result = compiler.transform(userCode);
// result.code now contains resumable version

Batch Optimization

The compiler automatically detects simple patterns and optimizes for batch parallel execution - achieving up to 100x speedup!

Automatic Batching

// Your code (no changes needed):
const results = await items.map(async (item) => {
	return await atp.llm.call({ prompt: item });
});

// ✅ Automatically batched! All LLM calls execute in parallel
// 🚀 100 items = ~2 seconds instead of ~200 seconds

Complex Patterns = Sequential

const results = await items.map(async (item) => {
	if (item.priority > 5) {
		// ← Conditional = sequential
		return await atp.llm.call({ prompt: item });
	}
});

// ✅ Still fully resumable with checkpoints
// Sequential execution with state saving

Supported Patterns

For Loops

// Original code
for (const item of items) {
	await atp.llm.call({ prompt: item });
}

// Automatically transformed to resumable version
// Pauses can occur during iteration and resume from exact point

Array Methods

// map, forEach, filter, reduce, find, some, every, flatMap
const results = await items.map(async (item) => {
	return await atp.llm.call({ prompt: item });
});

// Each iteration checkpointed - resumes from where it paused

Batch Parallel

// Original code
const results = await Promise.all([
	atp.llm.call({ prompt: 'Q1' }),
	atp.llm.call({ prompt: 'Q2' }),
	atp.llm.call({ prompt: 'Q3' }),
]);

// All 3 LLM calls execute concurrently on client
// 3x faster than sequential execution

API Reference

ATPCompiler

const compiler = new ATPCompiler({
	enableBatchParallel: true, // Enable batch parallel execution
	maxLoopNesting: 10, // Maximum loop nesting depth
	debugMode: false, // Enable debug logging
});

// Detect if code needs transformation
const detection = compiler.detect(code);
// { needsTransform: true, patterns: ['for-of-await', 'map-async'] }

// Transform code
const result = compiler.transform(code);
// { code: string, transformed: boolean, patterns: [], metadata: {...} }

Runtime Initialization

import { initializeRuntime } from '@mondaydotcomorg/atp-compiler';

initializeRuntime({
	executionId: 'unique-exec-id',
	cache: cacheProvider,
	checkpointPrefix: 'checkpoint', // Optional prefix for cache keys
});

Checkpoint System

The compiler uses checkpoints to save loop state:

  • Every iteration is checkpointed
  • State includes: current index, results, accumulator
  • TTL: 1 hour (configurable via cache provider)
  • Storage: Uses ATP cache provider (Redis recommended)
// Checkpoint structure
interface Checkpoint {
	index: number;
	results: unknown[];
	accumulator?: unknown;
	timestamp: number;
}

Batch Parallel Execution

When enabled, direct pausable calls in Promise.all execute concurrently:

// ✅ Batchable (all pausable calls are direct)
await Promise.all([atp.llm.call({ prompt: 'Q1' }), atp.llm.call({ prompt: 'Q2' })]);

// ❌ Not batchable (complex logic, falls back to sequential)
await Promise.all(
	items.map(async (item) => {
		const step1 = await atp.llm.call({ prompt: item });
		return await process(step1);
	})
);

Performance Comparison

| Pattern | Without Compiler | With Compiler | Speedup | | --------------------------- | ---------------- | -------------------- | -------- | | Sequential loop (100 items) | 200s | 200s + checkpointing | ~200s | | Batch parallel (100 items) | 200s | 2s | 100x | | Promise.all (10 items) | 20s | 2s | 10x |

Error Handling

import {
	isBatchPauseError,
	isCheckpointError,
	isTransformationError,
} from '@mondaydotcomorg/atp-compiler';

try {
	const result = compiler.transform(code);
} catch (error) {
	if (isTransformationError(error)) {
		console.error('Transformation failed:', error.message);
		console.error('Pattern:', error.pattern);
		console.error('Location:', error.location);
	}
}

Limitations

Not supported:

  • Recursive functions with await
  • for await...of with async iterators
  • Dynamic code generation (eval, new Function)
  • Non-serializable objects in checkpoints

Supported:

  • All standard array methods with async callbacks
  • Nested loops up to 10 levels
  • Try/catch around iterations
  • Break/continue statements
  • Early returns

Integration with ATP Server

// In executor.ts
import { ATPCompiler, initializeRuntime } from '@mondaydotcomorg/atp-compiler';

const compiler = new ATPCompiler();

// Before execution
if (cacheProvider) {
	initializeRuntime({
		executionId,
		cache: cacheProvider,
	});

	const detection = compiler.detect(code);
	if (detection.needsTransform) {
		const transformed = compiler.transform(code);
		codeToExecute = transformed.code;
	}
}

Example: Transform and Execute

import { ATPCompiler, initializeRuntime } from '@mondaydotcomorg/atp-compiler';
import { RedisCache } from '@mondaydotcomorg/atp-providers';
import Redis from 'ioredis';

const redis = new Redis();
const cache = new RedisCache({ redis });

const compiler = new ATPCompiler({
	enableBatchParallel: true,
});

// User code
const code = `
  const urls = [
    'https://api.example.com/users/1',
    'https://api.example.com/users/2',
    'https://api.example.com/users/3',
  ];
  
  const users = await Promise.all(
    urls.map(url => atp.llm.call({ prompt: 'Summarize: ' + url }))
  );
  
  return users;
`;

// Initialize runtime
initializeRuntime({
	executionId: 'exec-456',
	cache,
});

// Transform
const result = compiler.transform(code);

// Execute (with ATP server)
const executionResult = await executor.execute(result.code);
// All 3 LLM calls execute in parallel! ⚡

Transformation Examples

Before (Sequential)

const items = ['a', 'b', 'c'];
const results = [];

for (const item of items) {
	const response = await atp.llm.call({ prompt: item });
	results.push(response);
}

After (Resumable)

const items = ['a', 'b', 'c'];
const results = [];
const checkpointKey = 'checkpoint:exec-123:loop-1';

let startIndex = 0;
const checkpoint = await cache.get(checkpointKey);
if (checkpoint) {
	startIndex = checkpoint.index;
	results.push(...checkpoint.results);
}

for (let i = startIndex; i < items.length; i++) {
	const item = items[i];
	const response = await atp.llm.call({ prompt: item });
	results.push(response);

	// Save checkpoint
	await cache.set(checkpointKey, { index: i + 1, results }, 3600);
}

Testing

# Run tests
npm test

# Watch mode
npm run test:watch

# Coverage
npm run test:coverage

TypeScript Support

Full TypeScript definitions with strict typing.

License

MIT