diff --git a/packages/coding-agent/src/system-prompt.ts b/packages/coding-agent/src/system-prompt.ts index 556095b02..d07befdd4 100644 --- a/packages/coding-agent/src/system-prompt.ts +++ b/packages/coding-agent/src/system-prompt.ts @@ -11,12 +11,12 @@ import { $ } from "bun"; import { contextFileCapability } from "./capability/context-file"; import { systemPromptCapability } from "./capability/system-prompt"; import { renderPromptTemplate } from "./config/prompt-templates"; -import { formatPromptContent } from "./utils/prompt-format"; import type { SkillsSettings } from "./config/settings"; import { type ContextFile, loadCapability, type SystemPrompt as SystemPromptFile } from "./discovery"; import { loadSkills, type Skill } from "./extensibility/skills"; import customSystemPromptTemplate from "./prompts/system/custom-system-prompt.md" with { type: "text" }; import systemPromptTemplate from "./prompts/system/system-prompt.md" with { type: "text" }; +import { formatPromptContent } from "./utils/prompt-format"; interface AlwaysApplyRule { name: string; @@ -56,7 +56,9 @@ function dedupeAlwaysApplyRules( ): AlwaysApplyRule[] { if (!alwaysApplyRules || alwaysApplyRules.length === 0) return []; - return alwaysApplyRules.filter(rule => !promptSources.some(source => promptSourceContainsRule(source, rule.content))); + return alwaysApplyRules.filter( + rule => !promptSources.some(source => promptSourceContainsRule(source, rule.content)), + ); } function firstNonEmpty(...values: (string | undefined | null)[]): string | null { diff --git a/packages/coding-agent/src/tools/browser.ts b/packages/coding-agent/src/tools/browser.ts index 914655564..3516093e2 100644 --- a/packages/coding-agent/src/tools/browser.ts +++ b/packages/coding-agent/src/tools/browser.ts @@ -23,7 +23,6 @@ import { formatDimensionNote, resizeImage } from "../utils/image-resize"; import { htmlToBasicMarkdown } from "../web/scrapers/types"; import type { OutputMeta } from "./output-meta"; import { expandPath } from "./path-utils"; -import { formatSavedScreenshotLine } from "./render-utils"; import stealthTamperingScript from "./puppeteer/00_stealth_tampering.txt" with { type: "text" }; import stealthActivityScript from "./puppeteer/01_stealth_activity.txt" with { type: "text" }; import stealthHairlineScript from "./puppeteer/02_stealth_hairline.txt" with { type: "text" }; @@ -38,6 +37,7 @@ import stealthPluginsScript from "./puppeteer/10_stealth_plugins.txt" with { typ import stealthHardwareScript from "./puppeteer/11_stealth_hardware.txt" with { type: "text" }; import stealthCodecsScript from "./puppeteer/12_stealth_codecs.txt" with { type: "text" }; import stealthWorkerScript from "./puppeteer/13_stealth_worker.txt" with { type: "text" }; +import { formatSavedScreenshotLine } from "./render-utils"; import { ToolAbortError, ToolError, throwIfAborted } from "./tool-errors"; import { toolResult } from "./tool-result"; import { clampTimeout } from "./tool-timeouts"; diff --git a/packages/coding-agent/test/model-selector-role-badge-thinking.test.ts b/packages/coding-agent/test/model-selector-role-badge-thinking.test.ts index 6f3d69b37..071e1bdef 100644 --- a/packages/coding-agent/test/model-selector-role-badge-thinking.test.ts +++ b/packages/coding-agent/test/model-selector-role-badge-thinking.test.ts @@ -39,16 +39,14 @@ function createSelector(model: Model, settings: Settings): ModelSelectorComponen describe("ModelSelector role badge thinking display", () => { beforeAll(() => { - setThemeInstance( - { - fg: (_color: string, text: string) => text, - bg: (_color: string, text: string) => text, - bold: (text: string) => text, - getFgAnsi: () => "\x1b[38;5;1m", - nav: { cursor: ">" }, - boxSharp: { horizontal: "-" }, - } as never, - ); + setThemeInstance({ + fg: (_color: string, text: string) => text, + bg: (_color: string, text: string) => text, + bold: (text: string) => text, + getFgAnsi: () => "\x1b[38;5;1m", + nav: { cursor: ">" }, + boxSharp: { horizontal: "-" }, + } as never); }); test("renders per-role thinking labels with inherit mode to avoid badge ambiguity", async () => { diff --git a/packages/coding-agent/test/system-prompt-templates.test.ts b/packages/coding-agent/test/system-prompt-templates.test.ts index ef01f7540..f7f079b7f 100644 --- a/packages/coding-agent/test/system-prompt-templates.test.ts +++ b/packages/coding-agent/test/system-prompt-templates.test.ts @@ -188,7 +188,10 @@ describe("system Handlebars prompt templates", () => { await withTempDir(async dir => { const configDir = path.join(dir, ".agent"); await fs.mkdir(configDir, { recursive: true }); - await fs.writeFile(path.join(configDir, "SYSTEM.md"), ["Project instructions", "", duplicateRule, "", "Trailing note"].join("\n")); + await fs.writeFile( + path.join(configDir, "SYSTEM.md"), + ["Project instructions", "", duplicateRule, "", "Trailing note"].join("\n"), + ); const prompt = await buildSystemPrompt({ cwd: dir, diff --git a/packages/coding-agent/test/tools/grep-renderer.test.ts b/packages/coding-agent/test/tools/grep-renderer.test.ts index 785090961..3ae8ce1d0 100644 --- a/packages/coding-agent/test/tools/grep-renderer.test.ts +++ b/packages/coding-agent/test/tools/grep-renderer.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; +import { sanitizeText } from "@oh-my-pi/pi-natives"; import { getThemeByName } from "../../src/modes/theme/theme"; import { grepToolRenderer } from "../../src/tools/grep"; -import { sanitizeText } from "@oh-my-pi/pi-natives"; describe("grepToolRenderer", () => { it("keeps summary and truncation rows inside the collapsed line budget", async () => { @@ -27,12 +27,9 @@ describe("grepToolRenderer", () => { }, }; - const collapsed = grepToolRenderer.renderResult( - result as never, - { expanded: false, isPartial: false }, - uiTheme, - { pattern: "needle" }, - ); + const collapsed = grepToolRenderer.renderResult(result as never, { expanded: false, isPartial: false }, uiTheme, { + pattern: "needle", + }); const renderedLines = sanitizeText(collapsed.render(200).join("\n")).split("\n"); const bodyLines = renderedLines.slice(1); diff --git a/packages/coding-agent/test/tools/render-utils.test.ts b/packages/coding-agent/test/tools/render-utils.test.ts index a0bd85f46..5f9e17c1a 100644 --- a/packages/coding-agent/test/tools/render-utils.test.ts +++ b/packages/coding-agent/test/tools/render-utils.test.ts @@ -1,7 +1,11 @@ import { describe, expect, it } from "bun:test"; import * as os from "node:os"; import * as path from "node:path"; -import { dedupeParseErrors, formatParseErrors, formatSavedScreenshotLine } from "@oh-my-pi/pi-coding-agent/tools/render-utils"; +import { + dedupeParseErrors, + formatParseErrors, + formatSavedScreenshotLine, +} from "@oh-my-pi/pi-coding-agent/tools/render-utils"; describe("parse error formatting", () => { it("deduplicates parse errors while preserving order", () => { diff --git a/packages/tui/src/tui.ts b/packages/tui/src/tui.ts index 7a7ac0f14..c127c3039 100644 --- a/packages/tui/src/tui.ts +++ b/packages/tui/src/tui.ts @@ -1030,10 +1030,12 @@ export class TUI extends Container { this.#terminalStateTrusted = true; }; - const previousVisibleRows = Math.max(0, Math.min(this.#previousHeight, this.#previousLines.length - prevViewportTop)); + const previousVisibleRows = Math.max( + 0, + Math.min(this.#previousHeight, this.#previousLines.length - prevViewportTop), + ); const seedScrollRows = previousVisibleRows > 0 ? previousVisibleRows : height; - // First paint: no prior trusted TUI frame exists. Preserve whatever is currently // visible by scrolling only the rows we know are occupied; otherwise fall back to // the full viewport for the initial shell->TUI takeover path. diff --git a/packages/tui/test/render-regressions.test.ts b/packages/tui/test/render-regressions.test.ts index 368ec86e5..d71be7745 100644 --- a/packages/tui/test/render-regressions.test.ts +++ b/packages/tui/test/render-regressions.test.ts @@ -66,7 +66,8 @@ function trailingBlanks(lines: string[]): number { } function activeBuffer(term: VirtualTerminal): { baseY: number; cursorY: number } { - return (term as unknown as { xterm: { buffer: { active: { baseY: number; cursorY: number } } } }).xterm.buffer.active; + return (term as unknown as { xterm: { buffer: { active: { baseY: number; cursorY: number } } } }).xterm.buffer + .active; } describe("TUI terminal-state regressions", () => {