style: format merged PR fixes
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user