style: biome format/organize-imports across integrated PRs

This commit is contained in:
can1357
2026-06-27 01:51:19 +02:00
parent b82b6d90aa
commit 577d2a8eb8
22 changed files with 47 additions and 41 deletions
-1
View File
@@ -482,7 +482,6 @@ export const __providerInFlightForTesting = {
return null;
}
},
};
function withProviderInFlightLimit<TOptions extends Pick<StreamOptions, "signal" | "maxInFlightRequests">>(
+1 -2
View File
@@ -1,5 +1,4 @@
import { Buffer } from "node:buffer";
import { normalizeCodexBaseUrl } from "./openai-codex-base-url";
import type {
CredentialRankingStrategy,
UsageAmount,
@@ -12,6 +11,7 @@ import type {
UsageWindow,
} from "../usage";
import { isRecord } from "../utils";
import { normalizeCodexBaseUrl } from "./openai-codex-base-url";
import { listCodexResetCredits } from "./openai-codex-reset";
import { toNumber } from "./shared";
@@ -201,7 +201,6 @@ function parseResetCredits(payload: unknown): UsageResetCredits | undefined {
return { availableCount: Math.max(0, Math.trunc(availableCount)) };
}
function buildCodexUsageUrl(baseUrl: string): string {
const normalized = baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`;
return `${normalized}${CODEX_USAGE_PATH}`;
@@ -212,16 +212,7 @@ describe("GitLab Duo Workflow provider protocol", () => {
// Bare names: the server binds the model schema and matches tool calls under the
// exact wire name (no prefix stripping), so the registered name must equal the
// bare name OMP's own tool docs use.
expect(mcpTools.map(tool => tool.name)).toEqual([
"read",
"write",
"grep",
"glob",
"bash",
"lsp",
"todo",
"edit",
]);
expect(mcpTools.map(tool => tool.name)).toEqual(["read", "write", "grep", "glob", "bash", "lsp", "todo", "edit"]);
expect(mcpTools[0]).toMatchObject({
name: "read",
originalToolName: "read",
+1 -1
View File
@@ -10,8 +10,8 @@ import type { Api, Context, ImageContent, Model, OptionsForApi, Tool, ToolResult
import { buildModel } from "@oh-my-pi/pi-catalog/build";
import { getBundledModel } from "@oh-my-pi/pi-catalog/models";
import { $which } from "@oh-my-pi/pi-utils";
import { removeWithRetries } from "../../utils/src/temp";
import { type } from "arktype";
import { removeWithRetries } from "../../utils/src/temp";
import { e2eApiKey, resolveApiKey } from "./oauth";
// Resolve OAuth tokens at module level (async, runs before tests)
+1 -2
View File
@@ -21,8 +21,8 @@ import type { AgentSessionEvent } from "../session/agent-session";
import { stripImagesFromMessage, USER_INTERRUPT_LABEL } from "../session/messages";
import type { SessionEntry as StoredSessionEntry } from "../session/session-entries";
import { TASK_SUBAGENT_LIFECYCLE_CHANNEL, TASK_SUBAGENT_PROGRESS_CHANNEL } from "../task/types";
import { collabDisplayName } from "./display-name";
import { generateRoomKey, generateWriteToken, importRoomKey } from "./crypto";
import { collabDisplayName } from "./display-name";
import {
type AgentSnapshot,
COLLAB_PROMPT_MESSAGE_TYPE,
@@ -102,7 +102,6 @@ const TRANSCRIPT_READ_CAP = 4 * 1024 * 1024;
*/
const SNAPSHOT_CHUNK_BYTES = 512 * 1024;
export class CollabHost {
#ctx: InteractiveModeContext;
#socket: CollabSocket | null = null;
@@ -160,7 +160,10 @@ export function mergeDiscoveredModel<TApi extends Api>(
baseUrl: providerOverride.baseUrl ?? model.baseUrl,
headers: providerOverride.headers ? { ...model.headers, ...providerOverride.headers } : model.headers,
...(providerOverride.transport !== undefined ? { transport: providerOverride.transport } : {}),
remoteCompaction: mergeProviderRemoteCompactionConfig(model.remoteCompaction, providerOverride.remoteCompaction),
remoteCompaction: mergeProviderRemoteCompactionConfig(
model.remoteCompaction,
providerOverride.remoteCompaction,
),
compat: model.compatConfig,
} as ModelSpec<TApi>);
}
@@ -1192,7 +1192,9 @@ describe("runEvalAgent isolation", () => {
},
{ session: isolatedSession() },
),
).rejects.toThrow(/nested patch apply failed.*Some nested repository patches failed to apply.*nested-0-sub_nested\.patch/s);
).rejects.toThrow(
/nested patch apply failed.*Some nested repository patches failed to apply.*nested-0-sub_nested\.patch/s,
);
});
it("skips the merge phase when apply=false and surfaces the patch artifact instead", async () => {
@@ -86,11 +86,7 @@ import planModeApprovedPrompt from "../prompts/system/plan-mode-approved.md" wit
import planModeCompactInstructionsPrompt from "../prompts/system/plan-mode-compact-instructions.md" with {
type: "text",
};
import { AgentRegistry } from "../registry/agent-registry";
import {
countRunningSubagentBadgeAgents,
getRunningSubagentBadgeRegistry,
} from "./running-subagent-badge";
import type { AgentRegistry } from "../registry/agent-registry";
import type { AgentSession, AgentSessionEvent, ResolvedRoleModel } from "../session/agent-session";
import type { CompactMode } from "../session/compact-modes";
import { HistoryStorage } from "../session/history-storage";
@@ -164,6 +160,7 @@ import {
parseLoopLimitArgs,
} from "./loop-limit";
import { OAuthManualInputManager } from "./oauth-manual-input";
import { countRunningSubagentBadgeAgents, getRunningSubagentBadgeRegistry } from "./running-subagent-badge";
import type { ObservableSession } from "./session-observer-registry";
import { SessionObserverRegistry } from "./session-observer-registry";
import { runProviderSetupWizard } from "./setup-wizard/lazy";
@@ -4,9 +4,7 @@ export interface RunningSubagentRegistrySource {
agentRegistry: AgentRegistry;
}
export function getRunningSubagentBadgeRegistry(
collabGuest: RunningSubagentRegistrySource | undefined,
): AgentRegistry {
export function getRunningSubagentBadgeRegistry(collabGuest: RunningSubagentRegistrySource | undefined): AgentRegistry {
return collabGuest?.agentRegistry ?? AgentRegistry.global();
}
@@ -13909,4 +13909,3 @@ export class AgentSession {
return this.#extensionRunner;
}
}
+4 -1
View File
@@ -187,7 +187,10 @@ function parseDiffGitLinePaths(line: string): string[] {
const quoted = rest.match(/^("(?:\\.|[^"])+"|\/dev\/null) ("(?:\\.|[^"])+"|\/dev\/null)$/);
const parts = quoted ? [quoted[1], quoted[2]] : rest.split(" ");
if (parts.length < 2) return [];
const paths = parts.slice(0, 2).map(unquoteGitDiffPath).filter(file => file && file !== "/dev/null");
const paths = parts
.slice(0, 2)
.map(unquoteGitDiffPath)
.filter(file => file && file !== "/dev/null");
return [...new Set(paths)];
}
+3 -1
View File
@@ -755,7 +755,9 @@ function isMultiRange(parsed: ParsedSelector): boolean {
function selectorChunkLooksReadLike(chunk: string): boolean {
const lower = chunk.toLowerCase();
return lower === "raw" || lower === "conflicts" || /^-\d+(?:[-+]\d+)?$/.test(chunk) || parseLineRanges(chunk) !== null;
return (
lower === "raw" || lower === "conflicts" || /^-\d+(?:[-+]\d+)?$/.test(chunk) || parseLineRanges(chunk) !== null
);
}
function invalidSelector(sel: string): ToolError {
@@ -21,7 +21,10 @@ function formatUtcDate(date: Date): string {
return date.toISOString().slice(0, 10);
}
function buildRecencyDateBounds(recency: NonNullable<SearchParams["recency"]>, now = new Date()): {
function buildRecencyDateBounds(
recency: NonNullable<SearchParams["recency"]>,
now = new Date(),
): {
from_date: string;
to_date: string;
} {
@@ -86,7 +89,11 @@ function buildRequestBody(params: SearchParams): Record<string, unknown> {
const requestedSearchResults = params.numSearchResults ?? params.limit;
const searchParameters: Record<string, unknown> = {};
if (requestedSearchResults !== undefined) {
searchParameters.max_search_results = clampNumResults(requestedSearchResults, DEFAULT_NUM_RESULTS, MAX_NUM_RESULTS);
searchParameters.max_search_results = clampNumResults(
requestedSearchResults,
DEFAULT_NUM_RESULTS,
MAX_NUM_RESULTS,
);
}
if (params.recency) {
Object.assign(searchParameters, buildRecencyDateBounds(params.recency));
@@ -2,8 +2,8 @@ import { afterEach, beforeEach, describe, expect, it, spyOn } from "bun:test";
import { generateRoomKey, importRoomKey } from "@oh-my-pi/pi-coding-agent/collab/crypto";
import { CollabGuestLink } from "@oh-my-pi/pi-coding-agent/collab/guest";
import {
COLLAB_PROTO,
type AgentSnapshot,
COLLAB_PROTO,
type CollabFrame,
formatCollabLink,
rewriteEnvelopePeer,
@@ -2196,7 +2196,9 @@ describe("ModelRegistry", () => {
});
test("applies provider remoteCompaction to cached configured discovery models", () => {
expect(cachedDiscoverableRemoteCompaction.find("cached-compact-proxy", "cached-compact-model")?.remoteCompaction).toEqual({
expect(
cachedDiscoverableRemoteCompaction.find("cached-compact-proxy", "cached-compact-model")?.remoteCompaction,
).toEqual({
enabled: true,
api: "openai-responses",
endpoint: "https://compact-proxy.example.com/v1/responses/provider-compact",
@@ -2,8 +2,8 @@ import { beforeAll, describe, expect, it } from "bun:test";
import * as os from "node:os";
import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings";
import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools";
import { ReadTool } from "@oh-my-pi/pi-coding-agent/tools/read";
import { GrepTool } from "@oh-my-pi/pi-coding-agent/tools/grep";
import { ReadTool } from "@oh-my-pi/pi-coding-agent/tools/read";
import { WriteTool } from "@oh-my-pi/pi-coding-agent/tools/write";
// Minimal ToolSession stub (block-images.test.ts shape). Approval functions are
@@ -8,8 +8,8 @@ import { parseInternalUrl } from "@oh-my-pi/pi-coding-agent/internal-urls/parse"
import { InternalUrlRouter } from "@oh-my-pi/pi-coding-agent/internal-urls/router";
import { SshProtocolHandler } from "@oh-my-pi/pi-coding-agent/internal-urls/ssh-protocol";
import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools";
import { ReadTool } from "@oh-my-pi/pi-coding-agent/tools/read";
import { GrepTool } from "@oh-my-pi/pi-coding-agent/tools/grep";
import { ReadTool } from "@oh-my-pi/pi-coding-agent/tools/read";
import { WriteTool } from "@oh-my-pi/pi-coding-agent/tools/write";
// Live integration against `ssh localhost`. Skips automatically where key-based
@@ -224,4 +224,3 @@ function GainTimeSeriesPanel({ timeSeries }: { timeSeries: GainTimeSeriesPoint[]
</Panel>
);
}
+8 -2
View File
@@ -185,7 +185,10 @@ async function readSnapcompactRecords(cutoff: number | null, project: string | n
for (const sessionProject of sessionProjects) projects.add(sessionProject);
}
if (project !== null) {
if (!sessionProjects || !Array.from(sessionProjects).some(sessionProject => matchesProject(sessionProject, project))) {
if (
!sessionProjects ||
!Array.from(sessionProjects).some(sessionProject => matchesProject(sessionProject, project))
) {
continue;
}
}
@@ -219,7 +222,10 @@ function toDateBucket(epochMs: number): string {
// Main aggregation function
// ---------------------------------------------------------------------------
export async function getGainDashboardStats(range?: string | null, project?: string | null): Promise<GainDashboardStats> {
export async function getGainDashboardStats(
range?: string | null,
project?: string | null,
): Promise<GainDashboardStats> {
const { cutoff: effectiveCutoff } = getTimeRangeConfig(range);
const effectiveProject: string | null = project?.trim() || null;
+1 -1
View File
@@ -2,8 +2,8 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test";
import * as fs from "node:fs/promises";
import * as os from "node:os";
import * as path from "node:path";
import { dedupeProjects, getGainDashboardStats, normalizeProjectPath } from "@oh-my-pi/omp-stats/gain-aggregator";
import { closeDb, initDb, insertMessageStats } from "@oh-my-pi/omp-stats/db";
import { dedupeProjects, getGainDashboardStats, normalizeProjectPath } from "@oh-my-pi/omp-stats/gain-aggregator";
import type { MessageStats } from "@oh-my-pi/omp-stats/types";
import { getAgentDir, getStatsDbPath, setAgentDir, TempDir } from "@oh-my-pi/pi-utils";
+2 -1
View File
@@ -393,7 +393,8 @@ export function resolveWarpImageProtocol(
platform: NodeJS.Platform = process.platform,
env: NodeJS.ProcessEnv = Bun.env,
): ImageProtocol | null {
const windowsHost = platform === "win32" || (platform === "linux" && Boolean(env.WSL_DISTRO_NAME || env.WSL_INTEROP));
const windowsHost =
platform === "win32" || (platform === "linux" && Boolean(env.WSL_DISTRO_NAME || env.WSL_INTEROP));
return windowsHost ? null : ImageProtocol.Kitty;
}
@@ -360,4 +360,3 @@ describe("shouldEnableHyperlinksByDefault", () => {
expect(shouldEnableHyperlinksByDefault({ PI_FORCE_HYPERLINKS: "1", STY: "1.pts-0" }, "kitty")).toBe(true);
});
});