import { runInteractiveGateway } from './interactive-ui.js';
import { extractLastAiMessage } from './langgraph-events.js';
import { getYagrDeepAgentSessionsDir, getYagrMemoriesDir } from '../config/yagr-home.js';
import { SessionService } from '../session/index.js';
export async function runCliGateway(handle, options = {}) {
    if (options.prompt && !options.interactive) {
        const sessions = new SessionService({
            sessionsDir: getYagrDeepAgentSessionsDir(),
            memoriesDir: getYagrMemoriesDir(),
        });
        sessions.setCheckpointer(handle.checkpointer);
        const session = sessions.create({ title: 'CLI prompt' });
        const result = await handle.agent.invoke({ messages: [{ role: 'user', content: options.prompt }] }, sessions.buildSessionConfig(session.id));
        process.stdout.write(`${extractLastAiMessage(result)}\n`);
        return;
    }
    await runInteractiveGateway(handle, options);
}
//# sourceMappingURL=cli.js.map