import { ContinuityManager, createContinuityContextMessage, } from "./continuity-manager.js";
export class ContinuityService {
    manager;
    constructor(options) {
        this.manager = new ContinuityManager(options);
    }
    isSlashCommand(text) {
        return /^\s*\/(?:init-cont|plan-cont|start-cont|end-cont|fin-cont)(?:\s|$)/i.test(text);
    }
    createContextProvider() {
        return async () => this.getContextMessages();
    }
    createLifecycleHooks() {
        return this.manager.createLifecycleHooks();
    }
    async getContextMessages() {
        const context = await this.manager.renderContext();
        return context ? [createContinuityContextMessage(context)] : [];
    }
    async handleSlashCommand(text) {
        return this.handleUserMessage(text);
    }
    async handleUserMessage(text) {
        return this.toServiceResult(await this.manager.handleUserMessage(text));
    }
    toServiceResult(result) {
        return {
            intent: result.intent,
            handled: result.handled,
            contextMessages: result.context ? [createContinuityContextMessage(result.context)] : [],
        };
    }
}
//# sourceMappingURL=continuity-service.js.map