import { describe, expect, it } from "vitest";
import { parseRuntimeStopOptions, resolveRuntimeContextResetSupport, } from "./terminal.js";
describe("runtime stop options", () => {
    it("notifies stopped status for manual stop requests by default", () => {
        const options = parseRuntimeStopOptions({ sessionId: "session-1" });
        expect(options).toEqual({
            statusNotified: true,
            reason: undefined,
        });
    });
    it("suppresses stopped status for internal context reset requests", () => {
        const options = parseRuntimeStopOptions({
            sessionId: "session-1",
            suppressStatus: true,
            reason: "context_reset_after_task_submit",
        });
        expect(options).toEqual({
            statusNotified: false,
            reason: "context_reset_after_task_submit",
        });
    });
});
describe("runtime context reset support", () => {
    it("allows only ACode sessions whose adapter exposes resetContext", () => {
        expect(resolveRuntimeContextResetSupport("acode", true)).toEqual({
            supported: true,
        });
        expect(resolveRuntimeContextResetSupport("claude-code", false)).toEqual({
            supported: false,
            statusCode: 400,
            error: "context reset without restart is only supported by ACode",
        });
        expect(resolveRuntimeContextResetSupport("acode", false)).toEqual({
            supported: false,
            statusCode: 500,
            error: "ACode adapter does not expose resetContext",
        });
    });
});
