import{t as e}from"./6qfzuuhO.js";import{t}from"./NC6fXeo_.js";import{r as n}from"./b2R8Ad-3.js";function r(t,n,r){return e.buildTransportFromCredential(t,n,r)}function i(e){return{provider:e.provider,label:e.label??`default`,token:e.apiKey,authType:e.authType,expiresAt:null,refreshToken:null,extraHeaders:{},baseUrl:null,awsProfile:null}}var a=class{_defaultRetryPolicy;constructor(e){this._defaultRetryPolicy=e?.retryPolicy}async createForRole(e){return this.create({role:e})}async create(e){if(!e.role&&(!e.providerId||!e.model))throw Error(`DefaultLlmSessionFactory.create: must supply either role or (providerId + model)`);if(e.role){let a=await n(e.role);if(!a.sealedCredential||!a.credential)throw Error(`No credential available for role '${e.role}' / provider '${a.provider}'`);let o=(await a.sealedCredential.fetch()).value,s=i({provider:a.provider,apiKey:o,authType:a.credential.authType,label:a.credentialLabel});return new t({transport:r(a.provider,s),model:a.model,credential:s,retryPolicy:e.retryPolicy??this._defaultRetryPolicy})}throw Error(`DefaultLlmSessionFactory.create: providerId+model path requires a resolved credential. Use createForRole() or wire the explicit credential via ConcreteSession directly.`)}};export{a as DefaultLlmSessionFactory};