style: bun run fix

This commit is contained in:
roboomp
2026-06-28 21:12:03 +00:00
parent 9599689af3
commit fe00a9f3c4
@@ -21,10 +21,15 @@
*/ */
import { afterEach, describe, expect, it, vi } from "bun:test"; import { afterEach, describe, expect, it, vi } from "bun:test";
import type { StreamFn } from "@oh-my-pi/pi-agent-core"; import type { StreamFn } from "@oh-my-pi/pi-agent-core";
import { compact, type CompactionPreparation, createFileOps, DEFAULT_COMPACTION_SETTINGS } from "@oh-my-pi/pi-agent-core/compaction"; import {
type CompactionPreparation,
compact,
createFileOps,
DEFAULT_COMPACTION_SETTINGS,
} from "@oh-my-pi/pi-agent-core/compaction";
import type { AgentMessage } from "@oh-my-pi/pi-agent-core/types"; import type { AgentMessage } from "@oh-my-pi/pi-agent-core/types";
import * as ai from "@oh-my-pi/pi-ai";
import type { AssistantMessage, Model } from "@oh-my-pi/pi-ai"; import type { AssistantMessage, Model } from "@oh-my-pi/pi-ai";
import * as ai from "@oh-my-pi/pi-ai";
import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"; import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream";
import { getBundledModel } from "@oh-my-pi/pi-catalog/models"; import { getBundledModel } from "@oh-my-pi/pi-catalog/models";
import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings";
@@ -66,16 +71,12 @@ function makeAssistantMessage(text: string, model: Model): AssistantMessage {
}; };
} }
function makePreparation(): CompactionPreparation { function makePreparation(model: Model): CompactionPreparation {
return { return {
firstKeptEntryId: "kept-1", firstKeptEntryId: "kept-1",
messagesToSummarize: [ messagesToSummarize: [
{ role: "user", content: "history msg", timestamp: 1 } satisfies AgentMessage, { role: "user", content: "history msg", timestamp: 1 } satisfies AgentMessage,
{ makeAssistantMessage("history reply", model),
role: "assistant",
content: [{ type: "text", text: "history reply" }],
timestamp: 2,
} satisfies AgentMessage,
], ],
turnPrefixMessages: [{ role: "user", content: "turn prefix msg", timestamp: 3 } satisfies AgentMessage], turnPrefixMessages: [{ role: "user", content: "turn prefix msg", timestamp: 3 } satisfies AgentMessage],
recentMessages: [{ role: "user", content: "recent msg", timestamp: 4 } satisfies AgentMessage], recentMessages: [{ role: "user", content: "recent msg", timestamp: 4 } satisfies AgentMessage],
@@ -110,7 +111,7 @@ describe("issue #3751: compaction summaries respect provider concurrency cap", (
return makeAssistantMessage("summary text", requestModel); return makeAssistantMessage("summary text", requestModel);
}; };
await compact(makePreparation(), model, "test-key", undefined, undefined, { await compact(makePreparation(model), model, "test-key", undefined, undefined, {
completeImpl: override, completeImpl: override,
}); });
@@ -163,7 +164,7 @@ describe("issue #3751: compaction summaries respect provider concurrency cap", (
.mockResolvedValue(makeAssistantMessage("default transport must not run", model)); .mockResolvedValue(makeAssistantMessage("default transport must not run", model));
// Kick off compaction; it must immediately try to acquire the slot. // Kick off compaction; it must immediately try to acquire the slot.
const compaction = compact(makePreparation(), model, "test-key", undefined, undefined, { const compaction = compact(makePreparation(model), model, "test-key", undefined, undefined, {
completeImpl, completeImpl,
}); });
await waitFor(() => gates.length === 1, "first compaction summarizer in flight"); await waitFor(() => gates.length === 1, "first compaction summarizer in flight");