/**
 * @license
 * Copyright 2025 Vybestack LLC
 * SPDX-License-Identifier: Apache-2.0
 */
/**
 * Service to track which todo item is currently active in a session and agent scope.
 * This allows associating tool calls with the active todo.
 */
import { DEFAULT_AGENT_ID } from '../core/turn.js';
export class TodoContextTracker {
    _sessionId;
    _agentId;
    static instances = new Map();
    activeTodoId = null;
    constructor(_sessionId, _agentId) {
        this._sessionId = _sessionId;
        this._agentId = _agentId;
        // Session and agent IDs reserved for future scope-specific functionality
        void this._sessionId;
        void this._agentId;
    }
    /**
     * Get or create a tracker instance for a session/agent combination.
     */
    static forAgent(sessionId, agentId) {
        const scopedAgentId = agentId ?? DEFAULT_AGENT_ID;
        if (!this.instances.has(sessionId)) {
            this.instances.set(sessionId, new Map());
        }
        const agentMap = this.instances.get(sessionId);
        if (!agentMap.has(scopedAgentId)) {
            agentMap.set(scopedAgentId, new TodoContextTracker(sessionId, scopedAgentId));
        }
        return agentMap.get(scopedAgentId);
    }
    /**
     * Get or create a tracker instance for a session in the default agent scope.
     * This preserves backward compatibility with existing callers.
     */
    static forSession(sessionId) {
        return this.forAgent(sessionId, DEFAULT_AGENT_ID);
    }
    /**
     * Set the active todo for this session/agent scope.
     */
    setActiveTodo(todoId) {
        this.activeTodoId = todoId;
    }
    /**
     * Get the active todo ID for this session/agent scope.
     */
    getActiveTodoId() {
        return this.activeTodoId;
    }
    /**
     * Clear the active todo for this session/agent scope.
     */
    clearActiveTodo() {
        this.activeTodoId = null;
    }
}
//# sourceMappingURL=todo-context-tracker.js.map