{"version":3,"file":"pi.cjs","names":["definePiExtension","rootSession","composeRootHooks","commandSkills","hookBeforeAgentStart","hookInput","hookSessionStart","resourceHelp"],"sources":["../../generated/pi.ts"],"sourcesContent":["// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { definePiExtension, type PiPluginContext, type PiPluginContributions } from '@agimon-ai/doompi-core/pi-extension';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extension-file';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.cli';\nimport commandSkills from '../src/extensions/workspaces/sessions/(backend)/command/skills.cli';\nimport hookBeforeAgentStart from '../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.cli';\nimport hookInput from '../src/extensions/workspaces/sessions/(backend)/hook/input.cli';\nimport hookSessionStart from '../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.cli';\nimport resourceHelp from '../src/extensions/workspaces/sessions/(backend)/resource/help.cli';\n\ntype OptionsOf<T> = T extends (context: PiPluginContext<infer Options>) => unknown ? Options : never;\ntype InferredOptions = Exclude<OptionsOf<typeof rootSession> | OptionsOf<typeof commandSkills> | OptionsOf<typeof hookBeforeAgentStart> | OptionsOf<typeof hookInput> | OptionsOf<typeof hookSessionStart> | OptionsOf<typeof resourceHelp>, undefined>;\ntype Intersect<Union> =\n  (Union extends unknown ? (value: Union) => void : never) extends (value: infer Value) => void ? Value : never;\ntype ExtensionOptions = [InferredOptions] extends [never] ? undefined : Intersect<InferredOptions>;\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n  typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n\nexport const extension = definePiExtension<ExtensionOptions>('@agimon-ai/doompi-skill', async (context) => {\n  const scopeSession = await rootSession(context);\n  const contextSession = { ...context, root: scopeSession.value };\n  return {\n    ...composeRootHooks(scopeSession),\n    get commands(): PiPluginContributions['commands'] { return [at(commandSkills, contextSession)]; },\n    events: {\n      before_agent_start: at(hookBeforeAgentStart, contextSession) as NonNullable<PiPluginContributions['events']>['before_agent_start'],\n      input: at(hookInput, contextSession) as NonNullable<PiPluginContributions['events']>['input'],\n      session_start: at(hookSessionStart, contextSession) as NonNullable<PiPluginContributions['events']>['session_start'],\n    },\n    get resources(): PiPluginContributions['resources'] { return [at(resourceHelp, contextSession)]; },\n    services: [...(scopeSession.services ?? [])],\n  };\n});\n\nexport default extension;\n"],"mappings":";;;;;;;;;;;;;AAkBA,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AAEpE,MAAa,aAAA,GAAYA,oCAAAA,kBAAAA,CAAoC,2BAA2B,OAAO,YAAY;CACzG,MAAM,eAAe,MAAMC,iBAAAA,QAAY,OAAO;CAC9C,MAAM,iBAAiB;EAAE,GAAG;EAAS,MAAM,aAAa;CAAM;CAC9D,OAAO;EACL,IAAA,GAAGC,sCAAAA,iBAAAA,CAAiB,YAAY;EAChC,IAAI,WAA8C;GAAE,OAAO,CAAC,GAAGC,mBAAAA,SAAe,cAAc,CAAC;EAAG;EAChG,QAAQ;GACN,oBAAoB,GAAGC,6BAAAA,SAAsB,cAAc;GAC3D,OAAO,GAAGC,kBAAAA,SAAW,cAAc;GACnC,eAAe,GAAGC,yBAAAA,SAAkB,cAAc;EACpD;EACA,IAAI,YAAgD;GAAE,OAAO,CAAC,GAAGC,iBAAAA,SAAc,cAAc,CAAC;EAAG;EACjG,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;CAC7C;AACF,CAAC"}