export const INVALID_TOOL_NAME = "invalid";
export const TRACE_TOOL_OUTPUT_LIMIT = 4_000;
export const TRACE_ERROR_OUTPUT_LIMIT = 1_200;
export const TRACE_PREVIEW_LIMIT = 1_000;
export const THREAD_ERROR_TRACE_RELATIVE_PATH = "diagnostics/errors.jsonl";
export const RUN_ATTEMPT_HEARTBEAT_INTERVAL_MS = 5_000;
export const RUN_ATTEMPT_STALE_AFTER_MS = 30_000;
export const TOOL_USE_HOOK_TIMEOUT_MS = 5_000;
export const WORKER_LEASE_HEARTBEAT_INTERVAL_MS = 100;
export const HOST_HEARTBEAT_INTERVAL_MS = 10_000;
export const HOST_WATCHDOG_INTERVAL_MS = 15_000;
export const MAX_ADVANCED_PHASE_REOPENS = 2;
export const MAX_ADVANCED_PHASE_TRANSITIONS = 8;
export const RESEARCH_ROOT_NODE_ID = "research-root";
export const WORKFLOW_ROOT_NODE_ID = "workflow-root";
export const MAX_PROVIDER_TOOL_STEPS = 64;
export const MAX_IN_TURN_REPAIR_ATTEMPTS = 4;
export const MAX_PROVIDER_TURNS = 16;
export const DOOM_LOOP_TOOL_REPEAT_THRESHOLD = 3;
export const DEFAULT_PROVIDER_DECISION_NO_ACTION_TIMEOUT_MS = 120_000;
export const MAX_RETRYABLE_CHILD_THREAD_ATTEMPTS = 2;
export const MAX_CHILD_TASK_REPLACEMENT_ATTEMPTS = 1;
export const MAX_RECOVERABLE_ROOT_TURN_ATTEMPTS = 2;
export const ADVANCED_PHASE_TOOL_STEP_BUDGETS = {
    inspect: 6,
    plan: 4,
    change: 24,
    verify: 8,
    summarize: 1,
};
export const ADVANCED_PHASE_WALL_CLOCK_BUDGET_MS = {
    inspect: 60_000,
    plan: 45_000,
    change: 10 * 60_000,
    verify: 3 * 60_000,
    summarize: 30_000,
};
export function advancedPhaseToolStepBudget(currentPhase, profile) {
    return profile.maxToolSteps ?? ADVANCED_PHASE_TOOL_STEP_BUDGETS[currentPhase];
}
export function advancedPhaseWallClockBudgetMs(currentPhase) {
    return ADVANCED_PHASE_WALL_CLOCK_BUDGET_MS[currentPhase];
}
export function maxProviderTurnsForProfile(profile) {
    return Math.max(1, profile.maxProviderTurns ?? MAX_PROVIDER_TURNS);
}
export function providerDecisionNoActionTimeoutMs(raw = process.env.BEST_AGENT_PROVIDER_NO_ACTION_TIMEOUT_MS) {
    if (!raw) {
        return DEFAULT_PROVIDER_DECISION_NO_ACTION_TIMEOUT_MS;
    }
    const parsed = Number(raw);
    return Number.isFinite(parsed) && parsed > 0
        ? parsed
        : DEFAULT_PROVIDER_DECISION_NO_ACTION_TIMEOUT_MS;
}
//# sourceMappingURL=runtime-limits.js.map