{"version":3,"file":"compositionState.cjs","names":["DOOMPI_COMPOSED_ENV","DOOMPI_EXTENSIONS_PROVIDED_ENV"],"sources":["../../../src/builders/cli/compositionState.ts"],"sourcesContent":["import { DOOMPI_COMPOSED_ENV, DOOMPI_EXTENSIONS_PROVIDED_ENV } from '@agimon-ai/doompi-core/child-process';\n\n/** Marks a process whose extensions this module composed. */\nexport const COMPOSED_ENV = DOOMPI_COMPOSED_ENV;\n/** Set by the launcher when it passes one precomposed aggregate to Pi. */\nexport const EXTERNAL_EXTENSIONS_ENV = DOOMPI_EXTENSIONS_PROVIDED_ENV;\n/** Survives reload, where argv is re-read but the startup flags must not be. */\nexport const MUTE_ENV = 'DOOMPI_MUTE';\n\nconst COMPOSITION_CLAIM_KEY = Symbol.for('@agimon-ai/doompi:composition-claim');\n\nexport type ReleaseCompositionClaim = () => void;\n\n/**\n * Owns composition until Pi starts the freshly loaded extension runner.\n *\n * Pi resolves project resources before user resources, so the first DoomPi\n * factory is the repository-local one when both scopes register the package.\n * A process-global symbol survives distinct installed module URLs and lets that\n * first factory own the load cycle. Releasing on `session_start` leaves a later\n * `/reload` free to compose a new runner.\n */\nexport function acquireCompositionClaim(): ReleaseCompositionClaim | undefined {\n  if (Reflect.get(globalThis, COMPOSITION_CLAIM_KEY) !== undefined) return undefined;\n\n  const claim = Symbol('doompi-composition');\n  Reflect.set(globalThis, COMPOSITION_CLAIM_KEY, claim);\n  return () => {\n    if (Reflect.get(globalThis, COMPOSITION_CLAIM_KEY) === claim) {\n      Reflect.deleteProperty(globalThis, COMPOSITION_CLAIM_KEY);\n    }\n  };\n}\n"],"mappings":";;;AAGA,MAAa,eAAeA,qCAAAA;;AAE5B,MAAa,0BAA0BC,qCAAAA;;AAEvC,MAAa,WAAW;AAExB,MAAM,wBAAwB,OAAO,IAAI,qCAAqC;;;;;;;;;;AAa9E,SAAgB,0BAA+D;CAC7E,IAAI,QAAQ,IAAI,YAAY,qBAAqB,MAAM,KAAA,GAAW,OAAO,KAAA;CAEzE,MAAM,QAAQ,OAAO,oBAAoB;CACzC,QAAQ,IAAI,YAAY,uBAAuB,KAAK;CACpD,aAAa;EACX,IAAI,QAAQ,IAAI,YAAY,qBAAqB,MAAM,OACrD,QAAQ,eAAe,YAAY,qBAAqB;CAE5D;AACF"}