Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
import { describe, expect, it, vi } from "vitest";
import { restorePersistedBindings } from "../../../src/agent/bootstrap/binding-restore.js";
import type { AgentLogger } from "../../../src/agent/observability/agent-log.js";
const logger: AgentLogger = {
log: vi.fn(),
child() {
return logger;
},
};
describe("restorePersistedBindings first attempt", () => {
it("reports the first attempt once when it succeeds", async () => {
const onFirstAttemptSettled = vi.fn();
const restore = vi.fn(async () => undefined);
await restorePersistedBindings(
{ restore },
new AbortController().signal,
logger,
{ onFirstAttemptSettled },
);
expect(onFirstAttemptSettled).toHaveBeenCalledTimes(1);
expect(restore).toHaveBeenCalledTimes(1);
});
it("reports the first attempt once when it fails without retry", async () => {
const onFirstAttemptSettled = vi.fn();
const restore = vi.fn(async () => {
throw new Error("corrupt binding");
});
await restorePersistedBindings(
{ restore },
new AbortController().signal,
logger,
{ onFirstAttemptSettled },
);
expect(onFirstAttemptSettled).toHaveBeenCalledTimes(1);
expect(restore).toHaveBeenCalledTimes(1);
});
});