const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.js');
let __credo_ts_core = require("@credo-ts/core");
__credo_ts_core = require_rolldown_runtime.__toESM(__credo_ts_core);

//#region ../tenants/src/TenantAgent.ts
var TenantAgent = class extends __credo_ts_core.BaseAgent {
	constructor(agentContext) {
		super(agentContext.config, agentContext.dependencyManager);
		this.sessionHasEnded = false;
	}
	async initialize() {
		if (this.sessionHasEnded) throw new __credo_ts_core.CredoError("Can't initialize agent after tenant sessions has been ended.");
		this._isInitialized = true;
	}
	async endSession() {
		this.logger.trace(`Ending session for agent context with contextCorrelationId '${this.agentContext.contextCorrelationId}'`);
		await this.agentContext.endSession();
		this._isInitialized = false;
		this.sessionHasEnded = true;
	}
};

//#endregion
exports.TenantAgent = TenantAgent;