chore: reorg tests
This commit is contained in:
+2
-2
@@ -3,8 +3,8 @@ import { Buffer } from "node:buffer";
|
||||
import * as fs from "node:fs/promises";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import type { FetchImpl } from "../../types";
|
||||
import { __resetVertexTokenCache, getVertexAccessToken } from "../google-auth";
|
||||
import { __resetVertexTokenCache, getVertexAccessToken } from "../../src/providers/google-auth";
|
||||
import type { FetchImpl } from "../../src/types";
|
||||
|
||||
const CLOUD_PLATFORM_SCOPE = "https://www.googleapis.com/auth/cloud-platform";
|
||||
const JWT_BEARER_GRANT = "urn:ietf:params:oauth:grant-type:jwt-bearer";
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { NO_AUTH_SENTINEL, resolveOpenAIRequestSetup } from "../openai-shared";
|
||||
import { NO_AUTH_SENTINEL, resolveOpenAIRequestSetup } from "../../src/providers/openai-shared";
|
||||
|
||||
describe("resolveOpenAIRequestSetup keyless auth", () => {
|
||||
test("omits Authorization for the keyless (auth: none) sentinel, keeping custom headers", () => {
|
||||
+7
-7
@@ -3,17 +3,17 @@ import { getBundledModel } from "@oh-my-pi/pi-catalog";
|
||||
import { buildModel } from "@oh-my-pi/pi-catalog/build";
|
||||
import { Effort } from "@oh-my-pi/pi-catalog/effort";
|
||||
import type { ModelSpec } from "@oh-my-pi/pi-catalog/types";
|
||||
import * as kimiOauth from "../../registry/oauth/kimi";
|
||||
import { streamSimple } from "../../stream";
|
||||
import type { Context, Model } from "../../types";
|
||||
import type { MessageCreateParamsStreaming } from "../anthropic-wire";
|
||||
import { type KimiApiFormat, type KimiOptions, streamKimi } from "../kimi";
|
||||
import { streamOpenAIAnthropicShim } from "../openai-anthropic-shim";
|
||||
import type { MessageCreateParamsStreaming } from "../../src/providers/anthropic-wire";
|
||||
import { type KimiApiFormat, type KimiOptions, streamKimi } from "../../src/providers/kimi";
|
||||
import { streamOpenAIAnthropicShim } from "../../src/providers/openai-anthropic-shim";
|
||||
import {
|
||||
applyChatCompletionsCompatPolicy,
|
||||
type OpenAICompletionsParams,
|
||||
resolveOpenAICompatPolicy,
|
||||
} from "../openai-shared";
|
||||
} from "../../src/providers/openai-shared";
|
||||
import * as kimiOauth from "../../src/registry/oauth/kimi";
|
||||
import { streamSimple } from "../../src/stream";
|
||||
import type { Context, Model } from "../../src/types";
|
||||
|
||||
const BASE_CHAT_COMPLETIONS_PARAMS: OpenAICompletionsParams = { messages: [], model: "unused", stream: true };
|
||||
const KIMI_HEADERS = Object.freeze({
|
||||
+4
-1
@@ -1,5 +1,8 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { createCodexProviderStreamError, isRetryableCodexFailureEvent } from "../openai-codex-responses";
|
||||
import {
|
||||
createCodexProviderStreamError,
|
||||
isRetryableCodexFailureEvent,
|
||||
} from "../../src/providers/openai-codex-responses";
|
||||
|
||||
describe("isRetryableCodexFailureEvent", () => {
|
||||
it("classifies retryable codes from nested error.code, error.type, then rawEvent.code", () => {
|
||||
+1
-1
@@ -10,7 +10,7 @@ import {
|
||||
refreshXAIOAuthToken,
|
||||
validateXAIBillingEndpoint,
|
||||
validateXAIEndpoint,
|
||||
} from "../xai-oauth";
|
||||
} from "../../../src/registry/oauth/xai-oauth";
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
+11
-11
@@ -5,16 +5,6 @@ import * as AIError from "@oh-my-pi/pi-ai/error";
|
||||
import { kCursorExecResolved } from "@oh-my-pi/pi-ai/utils/block-symbols";
|
||||
import type { TUI } from "@oh-my-pi/pi-tui";
|
||||
import { type } from "arktype";
|
||||
import type { ModelRegistry } from "../../config/model-registry";
|
||||
import type { Settings } from "../../config/settings";
|
||||
import { type AdvisorConfigDeps, AdvisorConfigOverlayComponent } from "../../modes/components/advisor-config";
|
||||
import { createAdvisorMessageCard } from "../../modes/components/advisor-message";
|
||||
import { getThemeByName, setThemeInstance } from "../../modes/theme/theme";
|
||||
import advisorSystemPrompt from "../../prompts/advisor/system.md" with { type: "text" };
|
||||
import { SecretObfuscator } from "../../secrets/obfuscator";
|
||||
import { formatSessionHistoryMarkdown } from "../../session/session-history-format";
|
||||
import { YieldQueue } from "../../session/yield-queue";
|
||||
import { BUILTIN_TOOL_NAMES } from "../../tools/builtin-names";
|
||||
import {
|
||||
ADVISOR_DEFAULT_TOOL_NAMES,
|
||||
AdviseTool,
|
||||
@@ -35,7 +25,17 @@ import {
|
||||
quarantineAdvisorUnsafeOutput,
|
||||
resolveAdvisorDeliveryChannel,
|
||||
type WatchdogConfigDoc,
|
||||
} from "..";
|
||||
} from "../../src/advisor";
|
||||
import type { ModelRegistry } from "../../src/config/model-registry";
|
||||
import type { Settings } from "../../src/config/settings";
|
||||
import { type AdvisorConfigDeps, AdvisorConfigOverlayComponent } from "../../src/modes/components/advisor-config";
|
||||
import { createAdvisorMessageCard } from "../../src/modes/components/advisor-message";
|
||||
import { getThemeByName, setThemeInstance } from "../../src/modes/theme/theme";
|
||||
import advisorSystemPrompt from "../../src/prompts/advisor/system.md" with { type: "text" };
|
||||
import { SecretObfuscator } from "../../src/secrets/obfuscator";
|
||||
import { formatSessionHistoryMarkdown } from "../../src/session/session-history-format";
|
||||
import { YieldQueue } from "../../src/session/yield-queue";
|
||||
import { BUILTIN_TOOL_NAMES } from "../../src/tools/builtin-names";
|
||||
|
||||
/** Poll until the drain loop reaches the asserted state — waitForCatchup
|
||||
* releases IMMEDIATELY on advisor failure (the primary must never park on a
|
||||
+1
-1
@@ -12,7 +12,7 @@ import {
|
||||
serializeWatchdogConfig,
|
||||
slugifyAdvisorName,
|
||||
type WatchdogConfigDoc,
|
||||
} from "../config";
|
||||
} from "../../src/advisor/config";
|
||||
|
||||
describe("discoverAdvisorConfigs", () => {
|
||||
let tmp: string;
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { AdvisorEmissionGuard, normalizeAdvisorNote } from "../emission-guard";
|
||||
import { AdvisorEmissionGuard, normalizeAdvisorNote } from "../../src/advisor/emission-guard";
|
||||
|
||||
describe("normalizeAdvisorNote", () => {
|
||||
it("collapses punctuation, casing, and surrounding whitespace into one canonical key", () => {
|
||||
+2
-2
@@ -2,8 +2,8 @@ import { describe, expect, test } from "bun:test";
|
||||
import type { AuthStorage } from "@oh-my-pi/pi-ai";
|
||||
import { getBundledModels } from "@oh-my-pi/pi-catalog/models";
|
||||
import { TempDir } from "@oh-my-pi/pi-utils";
|
||||
import { ModelRegistry } from "../../config/model-registry";
|
||||
import { indexModelsByRequestId } from "../auth-gateway-cli";
|
||||
import { indexModelsByRequestId } from "../../src/cli/auth-gateway-cli";
|
||||
import { ModelRegistry } from "../../src/config/model-registry";
|
||||
|
||||
function stubAuthStorage(configKeys?: string[]): AuthStorage {
|
||||
const stub = {
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { afterEach, describe, expect, it, vi } from "bun:test";
|
||||
import { runUpdateCommand } from "./update-cli";
|
||||
import { runUpdateCommand } from "../../src/cli/update-cli";
|
||||
|
||||
type FetchInput = string | URL | Request;
|
||||
type FetchInit = RequestInit | BunFetchRequestInit;
|
||||
+1
-1
@@ -4,7 +4,7 @@ import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import type { AuthStorage } from "@oh-my-pi/pi-ai";
|
||||
import { buildModel } from "@oh-my-pi/pi-catalog/build";
|
||||
import { ModelRegistry } from "../model-registry";
|
||||
import { ModelRegistry } from "../../src/config/model-registry";
|
||||
|
||||
/** Stub auth storage for registry lifecycle and missing-credential coverage. */
|
||||
function createStubAuthStorage(): AuthStorage {
|
||||
+19
-19
@@ -2,25 +2,25 @@ import { afterAll, afterEach, describe, expect, it, vi } from "bun:test";
|
||||
import * as fs from "node:fs/promises";
|
||||
import * as path from "node:path";
|
||||
import { TempDir } from "@oh-my-pi/pi-utils";
|
||||
import { Settings } from "../../config/settings";
|
||||
import { AgentProtocolHandler } from "../../internal-urls/agent-protocol";
|
||||
import { resetRegisteredArtifactDirsForTests } from "../../internal-urls/registry-helpers";
|
||||
import type { PlanModeState } from "../../plan-mode/state";
|
||||
import { AgentRegistry } from "../../registry/agent-registry";
|
||||
import type { AgentSession } from "../../session/agent-session";
|
||||
import * as taskDiscovery from "../../task/discovery";
|
||||
import type { ExecutorOptions } from "../../task/executor";
|
||||
import * as taskExecutor from "../../task/executor";
|
||||
import * as isolationRunner from "../../task/isolation-runner";
|
||||
import { AgentOutputManager } from "../../task/output-manager";
|
||||
import type { AgentDefinition, AgentProgress, SingleResult, StructuredSubagentOutput } from "../../task/types";
|
||||
import type { ToolSession } from "../../tools";
|
||||
import { runEvalAgent } from "../agent-bridge";
|
||||
import { EVAL_TIMEOUT_PAUSE_OP, EVAL_TIMEOUT_RESUME_OP } from "../bridge-timeout";
|
||||
import { IdleTimeout } from "../idle-timeout";
|
||||
import { disposeAllVmContexts } from "../js/context-manager";
|
||||
import { executeJs } from "../js/executor";
|
||||
import { disposeAllKernelSessions, executePython } from "../py/executor";
|
||||
import { Settings } from "../../src/config/settings";
|
||||
import { runEvalAgent } from "../../src/eval/agent-bridge";
|
||||
import { EVAL_TIMEOUT_PAUSE_OP, EVAL_TIMEOUT_RESUME_OP } from "../../src/eval/bridge-timeout";
|
||||
import { IdleTimeout } from "../../src/eval/idle-timeout";
|
||||
import { disposeAllVmContexts } from "../../src/eval/js/context-manager";
|
||||
import { executeJs } from "../../src/eval/js/executor";
|
||||
import { disposeAllKernelSessions, executePython } from "../../src/eval/py/executor";
|
||||
import { AgentProtocolHandler } from "../../src/internal-urls/agent-protocol";
|
||||
import { resetRegisteredArtifactDirsForTests } from "../../src/internal-urls/registry-helpers";
|
||||
import type { PlanModeState } from "../../src/plan-mode/state";
|
||||
import { AgentRegistry } from "../../src/registry/agent-registry";
|
||||
import type { AgentSession } from "../../src/session/agent-session";
|
||||
import * as taskDiscovery from "../../src/task/discovery";
|
||||
import type { ExecutorOptions } from "../../src/task/executor";
|
||||
import * as taskExecutor from "../../src/task/executor";
|
||||
import * as isolationRunner from "../../src/task/isolation-runner";
|
||||
import { AgentOutputManager } from "../../src/task/output-manager";
|
||||
import type { AgentDefinition, AgentProgress, SingleResult, StructuredSubagentOutput } from "../../src/task/types";
|
||||
import type { ToolSession } from "../../src/tools";
|
||||
|
||||
const taskAgent = {
|
||||
name: "task",
|
||||
+4
-4
@@ -4,10 +4,10 @@ import {
|
||||
EVAL_TIMEOUT_RESUME_OP,
|
||||
isEvalTimeoutControlEvent,
|
||||
withBridgeTimeoutPause,
|
||||
} from "../bridge-timeout";
|
||||
import { executeWithKernelBase, type GenericKernel } from "../executor-base";
|
||||
import type { JsStatusEvent } from "../js/shared/types";
|
||||
import type { KernelDisplayOutput } from "../py/display";
|
||||
} from "../../src/eval/bridge-timeout";
|
||||
import { executeWithKernelBase, type GenericKernel } from "../../src/eval/executor-base";
|
||||
import type { JsStatusEvent } from "../../src/eval/js/shared/types";
|
||||
import type { KernelDisplayOutput } from "../../src/eval/py/display";
|
||||
|
||||
describe("withBridgeTimeoutPause", () => {
|
||||
it("emits one pause before the operation and one resume after it settles", async () => {
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import type { GoalModeState } from "../../goals/state";
|
||||
import type { UsageStatistics } from "../../session/session-entries";
|
||||
import type { ToolSession } from "../../tools";
|
||||
import { runEvalBudget } from "../budget-bridge";
|
||||
import { runEvalBudget } from "../../src/eval/budget-bridge";
|
||||
import type { GoalModeState } from "../../src/goals/state";
|
||||
import type { UsageStatistics } from "../../src/session/session-entries";
|
||||
import type { ToolSession } from "../../src/tools";
|
||||
|
||||
type TurnBudget = { total: number | null; spent: number; hard: boolean };
|
||||
|
||||
+14
-14
@@ -5,16 +5,16 @@ import * as ai from "@oh-my-pi/pi-ai";
|
||||
import { Effort } from "@oh-my-pi/pi-ai";
|
||||
import { TempDir } from "@oh-my-pi/pi-utils";
|
||||
import { $ } from "bun";
|
||||
import type { ModelRegistry } from "../../config/model-registry";
|
||||
import { Settings } from "../../config/settings";
|
||||
import type { ToolSession } from "../../tools";
|
||||
import { ToolError } from "../../tools/tool-errors";
|
||||
import { EVAL_TIMEOUT_PAUSE_OP, EVAL_TIMEOUT_RESUME_OP } from "../bridge-timeout";
|
||||
import { runEvalCompletion } from "../completion-bridge";
|
||||
import { IdleTimeout } from "../idle-timeout";
|
||||
import { disposeAllVmContexts } from "../js/context-manager";
|
||||
import { executeJs } from "../js/executor";
|
||||
import { disposeAllKernelSessions, type PythonResult } from "../py/executor";
|
||||
import type { ModelRegistry } from "../../src/config/model-registry";
|
||||
import { Settings } from "../../src/config/settings";
|
||||
import { EVAL_TIMEOUT_PAUSE_OP, EVAL_TIMEOUT_RESUME_OP } from "../../src/eval/bridge-timeout";
|
||||
import { runEvalCompletion } from "../../src/eval/completion-bridge";
|
||||
import { IdleTimeout } from "../../src/eval/idle-timeout";
|
||||
import { disposeAllVmContexts } from "../../src/eval/js/context-manager";
|
||||
import { executeJs } from "../../src/eval/js/executor";
|
||||
import { disposeAllKernelSessions, type PythonResult } from "../../src/eval/py/executor";
|
||||
import type { ToolSession } from "../../src/tools";
|
||||
import { ToolError } from "../../src/tools/tool-errors";
|
||||
|
||||
function makeModel(provider: string, id: string, extra: Partial<Model<Api>> = {}): Model<Api> {
|
||||
return {
|
||||
@@ -102,12 +102,12 @@ async function runPythonCompletionInSubprocess(options: {
|
||||
structured: boolean;
|
||||
tempDir: TempDir;
|
||||
}): Promise<PythonResult> {
|
||||
const repoRoot = path.resolve(import.meta.dir, "../../../..");
|
||||
const repoRoot = path.resolve(import.meta.dir, "../../..");
|
||||
const scriptPath = path.join(options.tempDir.path(), "run-python-completion.ts");
|
||||
const resultPath = path.join(options.tempDir.path(), "python-completion-result.json");
|
||||
const aiPath = path.resolve(import.meta.dir, "../../../../ai/src/index.ts");
|
||||
const executorPath = path.resolve(import.meta.dir, "../py/executor.ts");
|
||||
const settingsPath = path.resolve(import.meta.dir, "../../config/settings.ts");
|
||||
const aiPath = path.resolve(import.meta.dir, "../../../ai/src/index.ts");
|
||||
const executorPath = path.resolve(import.meta.dir, "../../src/eval/py/executor.ts");
|
||||
const settingsPath = path.resolve(import.meta.dir, "../../src/config/settings.ts");
|
||||
const code = options.structured
|
||||
? 'import json\nprint(json.dumps(completion("hi", schema={"type": "object"})))'
|
||||
: 'print(completion("hi", model="smol"))';
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import * as path from "node:path";
|
||||
import { TempDir } from "@oh-my-pi/pi-utils/temp";
|
||||
import { createHelpers, type HelperContext } from "../js/shared/helpers";
|
||||
import { createHelpers, type HelperContext } from "../../src/eval/js/shared/helpers";
|
||||
|
||||
/**
|
||||
* The eval helpers (`read`/`write`) must substitute injected on-disk
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { IdleTimeout } from "../idle-timeout";
|
||||
import { IdleTimeout } from "../../src/eval/idle-timeout";
|
||||
|
||||
/** Resolve true if `signal` aborts within `ms`, false if the window elapses first. */
|
||||
function abortedWithin(signal: AbortSignal, ms: number): Promise<boolean> {
|
||||
+7
-5
@@ -2,14 +2,14 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test";
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
import { TempDir } from "@oh-my-pi/pi-utils";
|
||||
import { Settings } from "../../config/settings";
|
||||
import type { ToolSession } from "../../tools";
|
||||
import { Settings } from "../../src/config/settings";
|
||||
import {
|
||||
disposeAllVmContexts,
|
||||
setJsEvalWorkerThreadForTests,
|
||||
setWorkerCloseTimeoutMsForTests,
|
||||
} from "../js/context-manager";
|
||||
import { executeJs } from "../js/executor";
|
||||
} from "../../src/eval/js/context-manager";
|
||||
import { executeJs } from "../../src/eval/js/executor";
|
||||
import type { ToolSession } from "../../src/tools";
|
||||
|
||||
const originalWorker = globalThis.Worker;
|
||||
|
||||
@@ -60,7 +60,9 @@ async function withTimeout<T>(promise: Promise<T>, ms: number, label: string): P
|
||||
}
|
||||
|
||||
async function waitForRealWorkerExitAfterClose(cwd: string): Promise<void> {
|
||||
const worker = new originalWorker(new URL("../js/worker-entry.ts", import.meta.url).href, { type: "module" });
|
||||
const worker = new originalWorker(new URL("../../src/eval/js/worker-entry.ts", import.meta.url).href, {
|
||||
type: "module",
|
||||
});
|
||||
const ready = Promise.withResolvers<void>();
|
||||
const runComplete = Promise.withResolvers<void>();
|
||||
const closedAck = Promise.withResolvers<void>();
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { afterEach, describe, expect, it } from "bun:test";
|
||||
import * as path from "node:path";
|
||||
import { $which, TempDir } from "@oh-my-pi/pi-utils";
|
||||
import { disposeJuliaKernelSessionsByOwner, executeJulia } from "../jl/executor";
|
||||
import { disposeJuliaKernelSessionsByOwner, executeJulia } from "../../src/eval/jl/executor";
|
||||
|
||||
const HAS_JULIA = Boolean($which("julia"));
|
||||
const OWNER_ID = "julia-prelude-tests";
|
||||
+1
-1
@@ -5,7 +5,7 @@ import {
|
||||
hostHasInheritableConsole,
|
||||
shouldDetachKernel,
|
||||
shouldHideKernelWindow,
|
||||
} from "../py/spawn-options";
|
||||
} from "../../src/eval/py/spawn-options";
|
||||
|
||||
describe("shouldDetachKernel", () => {
|
||||
it("starts POSIX kernels in a new session", () => {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import * as vm from "node:vm";
|
||||
import { JAVASCRIPT_PRELUDE_SOURCE } from "../js/shared/prelude";
|
||||
import { JAVASCRIPT_PRELUDE_SOURCE } from "../../src/eval/js/shared/prelude";
|
||||
|
||||
/**
|
||||
* The eval `agent()` helper grows a `handle` option that turns its bare
|
||||
+6
-6
@@ -11,7 +11,7 @@ it("imports the CLI entry graph without loading dotenv before profile bootstrap"
|
||||
);
|
||||
delete env.OMP_PROCESS_ENTRY_ENV_PROBE;
|
||||
env.HOME = tempDir.path();
|
||||
const fixture = path.resolve(import.meta.dir, "../../../test/fixtures/js-process-entry-import.ts");
|
||||
const fixture = path.resolve(import.meta.dir, "../fixtures/js-process-entry-import.ts");
|
||||
const proc = Bun.spawn([process.execPath, fixture], {
|
||||
env,
|
||||
stdout: "pipe",
|
||||
@@ -48,7 +48,7 @@ async function pingComputerWorker(
|
||||
}
|
||||
|
||||
it("starts ordinary CLI paths without loading the native computer addon", async () => {
|
||||
const cliPath = path.resolve(import.meta.dir, "../../cli.ts");
|
||||
const cliPath = path.resolve(import.meta.dir, "../../src/cli.ts");
|
||||
for (const args of [
|
||||
["--no-addons", cliPath, "--version"],
|
||||
[cliPath, "--help"],
|
||||
@@ -63,7 +63,7 @@ it("starts ordinary CLI paths without loading the native computer addon", async
|
||||
});
|
||||
|
||||
it("dispatches the computer worker through the CLI host selector in a child process", async () => {
|
||||
const fixture = path.resolve(import.meta.dir, "../../../test/fixtures/computer-worker-cli-selector.ts");
|
||||
const fixture = path.resolve(import.meta.dir, "../fixtures/computer-worker-cli-selector.ts");
|
||||
const proc = Bun.spawn([process.execPath, "--no-addons", fixture], {
|
||||
stdout: "pipe",
|
||||
stderr: "pipe",
|
||||
@@ -78,13 +78,13 @@ it("dispatches the computer worker through the CLI host selector in a child proc
|
||||
});
|
||||
|
||||
it("loads the computer worker module directly outside a declared CLI host", async () => {
|
||||
const entry = new URL("../../tools/computer/worker-entry.ts", import.meta.url).href;
|
||||
const entry = new URL("../../src/tools/computer/worker-entry.ts", import.meta.url).href;
|
||||
const response = await pingComputerWorker(entry, "computer-direct-module", []);
|
||||
expect(response).toEqual({ type: "pong", id: "computer-direct-module" });
|
||||
});
|
||||
|
||||
it("dispatches the computer worker from a single npm-style host bundle", async () => {
|
||||
const packageDir = path.resolve(import.meta.dir, "../../..");
|
||||
const packageDir = path.resolve(import.meta.dir, "../..");
|
||||
const outDir = fs.mkdtempSync(path.join(packageDir, ".computer-worker-bundle-"));
|
||||
try {
|
||||
const output = await Bun.build({
|
||||
@@ -107,7 +107,7 @@ it("dispatches the computer worker from a single npm-style host bundle", async (
|
||||
|
||||
it("keeps non-computer selectors isolated in a compiled single-entry worker host", async () => {
|
||||
using tempDir = TempDir.createSync("@omp-compiled-worker-selector-");
|
||||
const packageDir = path.resolve(import.meta.dir, "../../..");
|
||||
const packageDir = path.resolve(import.meta.dir, "../..");
|
||||
const outfile = path.join(tempDir.path(), process.platform === "win32" ? "worker-host.exe" : "worker-host");
|
||||
const build = Bun.spawn(
|
||||
[
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { PYTHON_PRELUDE } from "../prelude";
|
||||
import { PYTHON_PRELUDE } from "../../../src/eval/py/prelude";
|
||||
|
||||
const pythonPath = Bun.env.PYTHON ?? "python3";
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ interface RunnerFrame {
|
||||
}
|
||||
|
||||
const pythonPath = Bun.env.PYTHON ?? "python3";
|
||||
const runnerPath = path.resolve(import.meta.dir, "..", "runner.py");
|
||||
const repoRoot = path.resolve(import.meta.dir, "../../../../../..");
|
||||
const runnerPath = path.resolve(import.meta.dir, "../../../src/eval/py/runner.py");
|
||||
const repoRoot = path.resolve(import.meta.dir, "../../../../..");
|
||||
const encoder = new TextEncoder();
|
||||
|
||||
function shellQuote(value: string): string {
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { afterEach, describe, expect, it, vi } from "bun:test";
|
||||
import { HindsightApi } from "./client";
|
||||
import { HindsightApi } from "../../src/hindsight/client";
|
||||
|
||||
type FetchInput = string | URL | Request;
|
||||
type FetchInit = RequestInit | BunFetchRequestInit;
|
||||
+5
-5
@@ -2,11 +2,11 @@ import { afterAll, afterEach, expect, it } from "bun:test";
|
||||
import * as fs from "node:fs/promises";
|
||||
import * as path from "node:path";
|
||||
import { TempDir } from "@oh-my-pi/pi-utils";
|
||||
import { AgentRegistry } from "../../registry/agent-registry";
|
||||
import type { AgentSession } from "../../session/agent-session";
|
||||
import { ArtifactManager } from "../../session/artifacts";
|
||||
import { AgentProtocolHandler } from "../agent-protocol";
|
||||
import { resetRegisteredArtifactDirsForTests } from "../registry-helpers";
|
||||
import { AgentProtocolHandler } from "../../src/internal-urls/agent-protocol";
|
||||
import { resetRegisteredArtifactDirsForTests } from "../../src/internal-urls/registry-helpers";
|
||||
import { AgentRegistry } from "../../src/registry/agent-registry";
|
||||
import type { AgentSession } from "../../src/session/agent-session";
|
||||
import { ArtifactManager } from "../../src/session/artifacts";
|
||||
|
||||
const tempDir = TempDir.createSync("omp-nested-agent-repro-");
|
||||
afterEach(() => {
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
import { afterEach, describe, expect, it, vi } from "bun:test";
|
||||
import * as capability from "../../capability";
|
||||
import type { SSHHost } from "../../capability/ssh";
|
||||
import type { CapabilityResult, SourceMeta } from "../../capability/types";
|
||||
import * as fileTransfer from "../../ssh/file-transfer";
|
||||
import { parseInternalUrl } from "../parse";
|
||||
import { SshProtocolHandler } from "../ssh-protocol";
|
||||
import * as capability from "../../src/capability";
|
||||
import type { SSHHost } from "../../src/capability/ssh";
|
||||
import type { CapabilityResult, SourceMeta } from "../../src/capability/types";
|
||||
import { parseInternalUrl } from "../../src/internal-urls/parse";
|
||||
import { SshProtocolHandler } from "../../src/internal-urls/ssh-protocol";
|
||||
import * as fileTransfer from "../../src/ssh/file-transfer";
|
||||
|
||||
const SOURCE: SourceMeta = {
|
||||
provider: "ssh-json",
|
||||
+2
-2
@@ -2,8 +2,8 @@ import { describe, expect, it } from "bun:test";
|
||||
import * as fs from "node:fs/promises";
|
||||
import * as path from "node:path";
|
||||
import { TempDir } from "@oh-my-pi/pi-utils";
|
||||
import { createDaemonBrokerClient, type DaemonBrokerClient } from "./client";
|
||||
import type { DaemonSnapshot, DaemonSpec } from "./protocol";
|
||||
import { createDaemonBrokerClient, type DaemonBrokerClient } from "../../src/launch/client";
|
||||
import type { DaemonSnapshot, DaemonSpec } from "../../src/launch/protocol";
|
||||
|
||||
const TERMINAL_HISTORY_LIMIT = 10;
|
||||
|
||||
+4
-4
@@ -2,15 +2,15 @@ import { describe, expect, it, vi } from "bun:test";
|
||||
import * as fs from "node:fs/promises";
|
||||
import * as path from "node:path";
|
||||
import { TempDir } from "@oh-my-pi/pi-utils";
|
||||
import { startDaemonBrokerFromEnvironment } from "./broker";
|
||||
import { createDaemonBrokerClient } from "./client";
|
||||
import { startDaemonBrokerFromEnvironment } from "../../src/launch/broker";
|
||||
import { createDaemonBrokerClient } from "../../src/launch/client";
|
||||
import {
|
||||
DAEMON_IDLE_GRACE_ENV,
|
||||
DAEMON_PROJECT_DIR_ENV,
|
||||
DAEMON_RUNTIME_DIR_ENV,
|
||||
type DaemonOperation,
|
||||
} from "./protocol";
|
||||
import * as terminalOutput from "./terminal-output";
|
||||
} from "../../src/launch/protocol";
|
||||
import * as terminalOutput from "../../src/launch/terminal-output";
|
||||
|
||||
function restoreEnv(name: string, value: string | undefined): void {
|
||||
if (value === undefined) delete process.env[name];
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { type DaemonOperation, parseDaemonRpcResult, parseDaemonWireRequest } from "./protocol";
|
||||
import { type DaemonOperation, parseDaemonRpcResult, parseDaemonWireRequest } from "../../src/launch/protocol";
|
||||
|
||||
const operation: Extract<DaemonOperation, { op: "logs" }> = {
|
||||
op: "logs",
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { resolveDaemonSpawnOptions } from "./spawn-options";
|
||||
import { resolveDaemonSpawnOptions } from "../../src/launch/spawn-options";
|
||||
|
||||
describe("resolveDaemonSpawnOptions", () => {
|
||||
it("hides Windows daemons when the host has no console", () => {
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { renderTerminalOutput } from "./terminal-output";
|
||||
import { renderTerminalOutput } from "../../src/launch/terminal-output";
|
||||
|
||||
const RESET = "\x1b[0m";
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import {
|
||||
chunkLiveContext,
|
||||
LIVE_MODEL,
|
||||
parseLiveServerEvent,
|
||||
} from "./protocol";
|
||||
} from "../../src/live/protocol";
|
||||
|
||||
describe("Frameless Bidi server events", () => {
|
||||
test("parses a client delegation and keeps only input text content", () => {
|
||||
+1
-1
@@ -2,7 +2,7 @@ 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 { addMCPServer, readDisabledServers, readMCPConfigFile, setServerDisabled } from "./config-writer";
|
||||
import { addMCPServer, readDisabledServers, readMCPConfigFile, setServerDisabled } from "../../src/mcp/config-writer";
|
||||
|
||||
describe("config-writer concurrent mutations", () => {
|
||||
let dir: string;
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { afterEach, describe, expect, it, vi } from "bun:test";
|
||||
import { pollSmitheryCliAuthSession } from "./smithery-auth";
|
||||
import { pollSmitheryCliAuthSession } from "../../src/mcp/smithery-auth";
|
||||
|
||||
type FetchInput = string | URL | Request;
|
||||
type FetchInit = RequestInit | BunFetchRequestInit;
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { afterEach, describe, expect, it, vi } from "bun:test";
|
||||
import { searchSmitheryRegistry } from "./smithery-registry";
|
||||
import { searchSmitheryRegistry } from "../../src/mcp/smithery-registry";
|
||||
|
||||
type FetchInput = string | URL | Request;
|
||||
type FetchInit = RequestInit | BunFetchRequestInit;
|
||||
+1
-1
@@ -3,7 +3,7 @@ import * as fs from "node:fs/promises";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
|
||||
import { resolveStdioSpawnCommand, StdioTransport, terminateStdioProcess } from "./stdio";
|
||||
import { resolveStdioSpawnCommand, StdioTransport, terminateStdioProcess } from "../../../src/mcp/transports/stdio";
|
||||
|
||||
describe("resolveStdioSpawnCommand", () => {
|
||||
it("hides Windows executable MCP servers when the host has no console", async () => {
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { ProcessTerminal, TUI } from "@oh-my-pi/pi-tui";
|
||||
import { getEditorTheme, initTheme } from "../theme/theme";
|
||||
import { CustomEditor } from "./custom-editor";
|
||||
import { CustomEditor } from "../../../src/modes/components/custom-editor";
|
||||
import { getEditorTheme, initTheme } from "../../../src/modes/theme/theme";
|
||||
|
||||
/**
|
||||
* Regression for issue #4766: plugins written against upstream pi subclass
|
||||
+4
-4
@@ -2,8 +2,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "bun:
|
||||
import { CURSOR_MARKER } from "@oh-my-pi/pi-tui";
|
||||
import { setKittyProtocolActive } from "@oh-my-pi/pi-tui/keys";
|
||||
import { $ } from "bun";
|
||||
import { getDefaultPasteImageKeys } from "../../config/keybindings";
|
||||
import { getEditorTheme, initTheme, theme } from "../theme/theme";
|
||||
import { getDefaultPasteImageKeys } from "../../../src/config/keybindings";
|
||||
import {
|
||||
CustomEditor,
|
||||
extractBracketedImagePastePaths,
|
||||
@@ -14,7 +13,8 @@ import {
|
||||
SPACE_HOLD_MECHANICAL_RUN,
|
||||
SPACE_HOLD_RELEASE_MS,
|
||||
SPACE_REPEAT_MAX_GAP_MS,
|
||||
} from "./custom-editor";
|
||||
} from "../../../src/modes/components/custom-editor";
|
||||
import { getEditorTheme, initTheme, theme } from "../../../src/modes/theme/theme";
|
||||
|
||||
function makeEditor() {
|
||||
const editor = new CustomEditor(getEditorTheme());
|
||||
@@ -54,7 +54,7 @@ function feedGaps(editor: CustomEditor, gaps: number[]): void {
|
||||
}
|
||||
|
||||
async function decorateInFreshProcess(text: string, imageLinks?: readonly string[]): Promise<string> {
|
||||
const customEditorUrl = new URL("./custom-editor.ts", import.meta.url).href;
|
||||
const customEditorUrl = new URL("../../../src/modes/components/custom-editor.ts", import.meta.url).href;
|
||||
const script = `
|
||||
import { CustomEditor } from ${JSON.stringify(customEditorUrl)};
|
||||
const editor = new CustomEditor({});
|
||||
+3
-3
@@ -2,10 +2,10 @@ import { 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 { getThemeByName, setThemeInstance, theme } from "../../theme/theme";
|
||||
import { DynamicBorder } from "../dynamic-border";
|
||||
import { DynamicBorder } from "../../../src/modes/components/dynamic-border";
|
||||
import { getThemeByName, setThemeInstance, theme } from "../../../src/modes/theme/theme";
|
||||
|
||||
const componentPath = path.resolve(import.meta.dir, "../dynamic-border.ts");
|
||||
const componentPath = path.resolve(import.meta.dir, "../../../src/modes/components/dynamic-border.ts");
|
||||
|
||||
describe("DynamicBorder", () => {
|
||||
// Regression for #5366: extensions importing legacy pi UI components get a
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { beforeAll, describe, expect, it } from "bun:test";
|
||||
import type { TUI } from "@oh-my-pi/pi-tui";
|
||||
import { initTheme } from "../theme/theme";
|
||||
import { LoginDialogComponent } from "./login-dialog";
|
||||
import { LoginDialogComponent } from "../../../src/modes/components/login-dialog";
|
||||
import { initTheme } from "../../../src/modes/theme/theme";
|
||||
|
||||
/** Minimal TUI stub — the dialog only calls requestRender/setFocus. */
|
||||
function makeDialog(): LoginDialogComponent {
|
||||
+8
-3
@@ -4,9 +4,14 @@ import * as fsp from "node:fs/promises";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { visibleWidth } from "@oh-my-pi/pi-tui";
|
||||
import { Settings } from "../../../config/settings";
|
||||
import { getThemeByName, setThemeInstance, type Theme } from "../../theme/theme";
|
||||
import { MoveOverlay, type MoveOverlayResult, resolveExistingDirectory, resolveMovePath } from "../move-overlay";
|
||||
import { Settings } from "../../../src/config/settings";
|
||||
import {
|
||||
MoveOverlay,
|
||||
type MoveOverlayResult,
|
||||
resolveExistingDirectory,
|
||||
resolveMovePath,
|
||||
} from "../../../src/modes/components/move-overlay";
|
||||
import { getThemeByName, setThemeInstance, type Theme } from "../../../src/modes/theme/theme";
|
||||
|
||||
// Strip SGR colors so assertions see visible text only.
|
||||
const stripAnsi = (text: string): string => text.replace(/\x1b\[[0-9;]*m/g, "");
|
||||
+8
-3
@@ -1,9 +1,14 @@
|
||||
import { afterEach, beforeAll, describe, expect, it } from "bun:test";
|
||||
import { agentPauseGate } from "@oh-my-pi/pi-agent-core";
|
||||
import type { Component } from "@oh-my-pi/pi-tui";
|
||||
import { Settings } from "../../../config/settings";
|
||||
import { getThemeByName, setThemeInstance } from "../../theme/theme";
|
||||
import { PauseScreenComponent, type PauseScreenHost, renderPauseScreen, runPauseScreen } from "../pause-screen";
|
||||
import { Settings } from "../../../src/config/settings";
|
||||
import {
|
||||
PauseScreenComponent,
|
||||
type PauseScreenHost,
|
||||
renderPauseScreen,
|
||||
runPauseScreen,
|
||||
} from "../../../src/modes/components/pause-screen";
|
||||
import { getThemeByName, setThemeInstance } from "../../../src/modes/theme/theme";
|
||||
|
||||
// Strip SGR colors so assertions see visible text only.
|
||||
const stripAnsi = (text: string): string => text.replace(/\x1b\[[0-9;]*m/g, "");
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
import { beforeAll, describe, expect, it } from "bun:test";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { Settings } from "../../../config/settings";
|
||||
import type { CustomMessage, SkillPromptDetails } from "../../../session/messages";
|
||||
import { getThemeByName, setThemeInstance, type Theme } from "../../theme/theme";
|
||||
import { SkillMessageComponent } from "../skill-message";
|
||||
import { Settings } from "../../../src/config/settings";
|
||||
import { SkillMessageComponent } from "../../../src/modes/components/skill-message";
|
||||
import { getThemeByName, setThemeInstance, type Theme } from "../../../src/modes/theme/theme";
|
||||
import type { CustomMessage, SkillPromptDetails } from "../../../src/session/messages";
|
||||
|
||||
// Drop SGR colors and OSC 8 hyperlink wrappers so assertions see the visible text only.
|
||||
const strip = (lines: readonly string[]): string =>
|
||||
+6
-6
@@ -3,12 +3,12 @@ import * as fs from "node:fs";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { getProjectDir, setProjectDir } from "@oh-my-pi/pi-utils";
|
||||
import { Settings, settings } from "../../../config/settings";
|
||||
import type { AgentSession } from "../../../session/agent-session";
|
||||
import * as git from "../../../utils/git";
|
||||
import * as jj from "../../../utils/jj";
|
||||
import { getThemeByName, setThemeInstance } from "../../theme/theme";
|
||||
import { StatusLineComponent } from "./component";
|
||||
import { Settings, settings } from "../../../../src/config/settings";
|
||||
import { StatusLineComponent } from "../../../../src/modes/components/status-line/component";
|
||||
import { getThemeByName, setThemeInstance } from "../../../../src/modes/theme/theme";
|
||||
import type { AgentSession } from "../../../../src/session/agent-session";
|
||||
import * as git from "../../../../src/utils/git";
|
||||
import * as jj from "../../../../src/utils/jj";
|
||||
|
||||
// Minimal session the git-only status line render path touches: state.messages
|
||||
// (token-rate scan), model window, streaming flag, and the async-job snapshot.
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
import { beforeAll, describe, expect, it } from "bun:test";
|
||||
import { Settings } from "../../../config/settings";
|
||||
import type { AgentSession } from "../../../session/agent-session";
|
||||
import { getThemeByName, setThemeInstance } from "../../theme/theme";
|
||||
import { StatusLineComponent } from "./component";
|
||||
import { Settings } from "../../../../src/config/settings";
|
||||
import { StatusLineComponent } from "../../../../src/modes/components/status-line/component";
|
||||
import { getThemeByName, setThemeInstance } from "../../../../src/modes/theme/theme";
|
||||
import type { AgentSession } from "../../../../src/session/agent-session";
|
||||
|
||||
function makeSessionWithLastMessage(
|
||||
lastMessage: unknown,
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
import { afterEach, beforeAll, describe, expect, it } from "bun:test";
|
||||
import type { AgentTool } from "@oh-my-pi/pi-agent-core";
|
||||
import { type Component, Text } from "@oh-my-pi/pi-tui";
|
||||
import { Settings, settings } from "../../config/settings";
|
||||
import { renderMCPResult } from "../../mcp/render";
|
||||
import type { MCPToolDetails } from "../../mcp/tool-bridge";
|
||||
import { getThemeByName, setThemeInstance, theme } from "../theme/theme";
|
||||
import { ToolExecutionComponent, type ToolExecutionUi } from "./tool-execution";
|
||||
import { Settings, settings } from "../../../src/config/settings";
|
||||
import { renderMCPResult } from "../../../src/mcp/render";
|
||||
import type { MCPToolDetails } from "../../../src/mcp/tool-bridge";
|
||||
import { ToolExecutionComponent, type ToolExecutionUi } from "../../../src/modes/components/tool-execution";
|
||||
import { getThemeByName, setThemeInstance, theme } from "../../../src/modes/theme/theme";
|
||||
|
||||
class BoldTypeErrorComponent implements Component {
|
||||
render(_width: number): readonly string[] {
|
||||
+7
-7
@@ -1,12 +1,12 @@
|
||||
import { afterEach, beforeAll, describe, expect, it, vi } from "bun:test";
|
||||
import { Container, setKeybindings } from "@oh-my-pi/pi-tui";
|
||||
import { KeybindingsManager } from "../../config/keybindings";
|
||||
import type { ExtensionAskDialogQuestion, ExtensionUIContext } from "../../extensibility/extensions";
|
||||
import { AskDialogComponent } from "../components/ask-dialog";
|
||||
import { CustomEditor } from "../components/custom-editor";
|
||||
import { getEditorTheme, getThemeByName, setThemeInstance } from "../theme/theme";
|
||||
import type { InteractiveModeContext } from "../types";
|
||||
import { ExtensionUiController } from "./extension-ui-controller";
|
||||
import { KeybindingsManager } from "../../../src/config/keybindings";
|
||||
import type { ExtensionAskDialogQuestion, ExtensionUIContext } from "../../../src/extensibility/extensions";
|
||||
import { AskDialogComponent } from "../../../src/modes/components/ask-dialog";
|
||||
import { CustomEditor } from "../../../src/modes/components/custom-editor";
|
||||
import { ExtensionUiController } from "../../../src/modes/controllers/extension-ui-controller";
|
||||
import { getEditorTheme, getThemeByName, setThemeInstance } from "../../../src/modes/theme/theme";
|
||||
import type { InteractiveModeContext } from "../../../src/modes/types";
|
||||
|
||||
afterEach(() => {
|
||||
setKeybindings(KeybindingsManager.inMemory());
|
||||
+3
-3
@@ -7,9 +7,9 @@
|
||||
*/
|
||||
import { describe, expect, it, spyOn } from "bun:test";
|
||||
import type { AssistantMessage } from "@oh-my-pi/pi-ai";
|
||||
import type { AgentSession } from "../session/agent-session";
|
||||
import * as telemetryExport from "../telemetry-export";
|
||||
import { runPrintMode } from "./print-mode";
|
||||
import { runPrintMode } from "../../src/modes/print-mode";
|
||||
import type { AgentSession } from "../../src/session/agent-session";
|
||||
import * as telemetryExport from "../../src/telemetry-export";
|
||||
|
||||
/** Stand-in for `process.exit`: it terminates, so nothing after it should run. */
|
||||
class ProcessExit extends Error {
|
||||
+2
-2
@@ -6,8 +6,8 @@
|
||||
*/
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import type { AssistantMessage } from "@oh-my-pi/pi-ai";
|
||||
import type { AgentSessionEvent } from "../session/agent-session";
|
||||
import { printableEvent } from "./print-mode";
|
||||
import { printableEvent } from "../../src/modes/print-mode";
|
||||
import type { AgentSessionEvent } from "../../src/session/agent-session";
|
||||
|
||||
const assistant: AssistantMessage = {
|
||||
role: "assistant",
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { postmortem } from "@oh-my-pi/pi-utils";
|
||||
import { createSessionTeardown } from "./session-teardown";
|
||||
import { createSessionTeardown } from "../../src/modes/session-teardown";
|
||||
|
||||
/**
|
||||
* Signal-safe session teardown contract (issue #4080). The callback body
|
||||
+8
-3
@@ -1,8 +1,13 @@
|
||||
import { afterEach, beforeAll, describe, expect, it } from "bun:test";
|
||||
import { Markdown } from "@oh-my-pi/pi-tui";
|
||||
import { Settings } from "../../config/settings";
|
||||
import { buildSystemPrompt } from "../../system-prompt";
|
||||
import { getMarkdownTheme, getThemeByName, setMarkdownMermaidRendering, setThemeInstance } from "./theme";
|
||||
import { Settings } from "../../../src/config/settings";
|
||||
import {
|
||||
getMarkdownTheme,
|
||||
getThemeByName,
|
||||
setMarkdownMermaidRendering,
|
||||
setThemeInstance,
|
||||
} from "../../../src/modes/theme/theme";
|
||||
import { buildSystemPrompt } from "../../../src/system-prompt";
|
||||
|
||||
const workspaceTree = {
|
||||
rootPath: "/tmp/project",
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import type { AssistantMessage, Usage } from "@oh-my-pi/pi-ai";
|
||||
import { assistantUsageIsBilled } from "./transcript-render-helpers";
|
||||
import { assistantUsageIsBilled } from "../../../src/modes/utils/transcript-render-helpers";
|
||||
|
||||
function usage(overrides: Partial<Usage> = {}): Usage {
|
||||
return {
|
||||
+3
-3
@@ -13,9 +13,9 @@ import type {
|
||||
SessionStartEvent,
|
||||
SessionSwitchEvent,
|
||||
ToolApprovalRequestedEvent,
|
||||
} from "../extensibility/extensions/types";
|
||||
import { SILENT_ABORT_MARKER, SKILL_PROMPT_MESSAGE_TYPE, USER_INTERRUPT_LABEL } from "../session/messages";
|
||||
import { createWarpEventBridgeExtension, createWarpEventEmitter } from "./warp-events";
|
||||
} from "../../src/extensibility/extensions/types";
|
||||
import { createWarpEventBridgeExtension, createWarpEventEmitter } from "../../src/modes/warp-events";
|
||||
import { SILENT_ABORT_MARKER, SKILL_PROMPT_MESSAGE_TYPE, USER_INTERRUPT_LABEL } from "../../src/session/messages";
|
||||
|
||||
const originalTerminalId = terminalCapabilities.TERMINAL.id;
|
||||
const originalProtocolVersion = process.env.WARP_CLI_AGENT_PROTOCOL_VERSION;
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { prompt } from "@oh-my-pi/pi-utils";
|
||||
import planModeApprovedPrompt from "../prompts/system/plan-mode-approved.md" with { type: "text" };
|
||||
import planModeCompactInstructionsPrompt from "../prompts/system/plan-mode-compact-instructions.md" with {
|
||||
import planModeApprovedPrompt from "../../src/prompts/system/plan-mode-approved.md" with { type: "text" };
|
||||
import planModeCompactInstructionsPrompt from "../../src/prompts/system/plan-mode-compact-instructions.md" with {
|
||||
type: "text",
|
||||
};
|
||||
import planModeReferencePrompt from "../prompts/system/plan-mode-reference.md" with { type: "text" };
|
||||
import planModeReferencePrompt from "../../src/prompts/system/plan-mode-reference.md" with { type: "text" };
|
||||
|
||||
const PLAN_FILE_PATH = "local://durable-plan.md";
|
||||
const PLAN_SENTINEL = "SENTINEL_HEADROOM_COMPRESSED_PLAN_CONTENT";
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
||||
import type { Model } from "@oh-my-pi/pi-ai";
|
||||
import type { ResolvedModelRoleValue } from "../config/model-resolver";
|
||||
import { AUTO_THINKING } from "../thinking";
|
||||
import { resolvePlanModelTransition } from "./model-transition";
|
||||
import type { ResolvedModelRoleValue } from "../../src/config/model-resolver";
|
||||
import { resolvePlanModelTransition } from "../../src/plan-mode/model-transition";
|
||||
import { AUTO_THINKING } from "../../src/thinking";
|
||||
|
||||
/**
|
||||
* Plan-mode model transition policy (issue #5657). The active model in plan
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { prompt } from "@oh-my-pi/pi-utils";
|
||||
import planModeActivePrompt from "../prompts/system/plan-mode-active.md" with { type: "text" };
|
||||
import planModeActivePrompt from "../../src/prompts/system/plan-mode-active.md" with { type: "text" };
|
||||
|
||||
const BASE = {
|
||||
planFilePath: "local://old-feature-plan.md",
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
import { afterAll, afterEach, describe, expect, it } from "bun:test";
|
||||
import type { AssistantMessage } from "@oh-my-pi/pi-ai";
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import { logProviderTurnError } from "./messages";
|
||||
import { logProviderTurnError } from "../../src/session/messages";
|
||||
|
||||
function makeMessage(overrides: Partial<AssistantMessage>): AssistantMessage {
|
||||
return {
|
||||
+7
-1
@@ -2,7 +2,13 @@ import { afterAll, describe, expect, it } from "bun:test";
|
||||
import * as fs from "node:fs";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { BlobStore, parseBlobRef, resolveImageData, resolveImageDataSync, resolveImageDataUrl } from "./blob-store";
|
||||
import {
|
||||
BlobStore,
|
||||
parseBlobRef,
|
||||
resolveImageData,
|
||||
resolveImageDataSync,
|
||||
resolveImageDataUrl,
|
||||
} from "../../src/session/blob-store";
|
||||
|
||||
const base = fs.mkdtempSync(path.join(os.tmpdir(), "blob-store-test-"));
|
||||
const blobDir = path.join(base, "agent", "blobs", "data");
|
||||
+1
-1
@@ -9,7 +9,7 @@ import {
|
||||
SKILL_PROMPT_MESSAGE_TYPE,
|
||||
type SkillPromptDetails,
|
||||
stripImagesFromMessage,
|
||||
} from "./messages";
|
||||
} from "../../src/session/messages";
|
||||
|
||||
function customMessage(customType: string, attribution: "agent" | "user"): CustomMessage<SkillPromptDetails> {
|
||||
return {
|
||||
+3
-3
@@ -2,9 +2,9 @@ import { describe, expect, it } from "bun:test";
|
||||
import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
||||
import type { AssistantMessage } from "@oh-my-pi/pi-ai";
|
||||
import * as snapcompact from "@oh-my-pi/snapcompact";
|
||||
import { type CompactionSummaryMessage, INTERRUPTED_THINKING_MESSAGE_TYPE } from "./messages";
|
||||
import { buildSessionContext, type StrippedToolCallsMarker } from "./session-context";
|
||||
import type { SessionEntry } from "./session-entries";
|
||||
import { type CompactionSummaryMessage, INTERRUPTED_THINKING_MESSAGE_TYPE } from "../../src/session/messages";
|
||||
import { buildSessionContext, type StrippedToolCallsMarker } from "../../src/session/session-context";
|
||||
import type { SessionEntry } from "../../src/session/session-entries";
|
||||
|
||||
const timestamp = "2026-07-09T00:00:00.000Z";
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@ import {
|
||||
type SSHConnectionTarget,
|
||||
type SSHHostShell,
|
||||
TRANSFER_PROBE_MARKER,
|
||||
} from "../connection-manager";
|
||||
import { buildSshTarget, sanitizeHostName } from "../utils";
|
||||
} from "../../src/ssh/connection-manager";
|
||||
import { buildSshTarget, sanitizeHostName } from "../../src/ssh/utils";
|
||||
|
||||
const TARGET: SSHConnectionTarget = { name: "h", host: "h" };
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import { afterAll, beforeAll, 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 { _sshHelpersForTests } from "../connection-manager";
|
||||
import { _sshHelpersForTests } from "../../src/ssh/connection-manager";
|
||||
|
||||
const { runSshSync, runSshCaptureSync } = _sshHelpersForTests;
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import { afterEach, describe, expect, it, vi } from "bun:test";
|
||||
import type { SSHConnectionTarget } from "../connection-manager";
|
||||
import * as connectionManager from "../connection-manager";
|
||||
import { listRemoteDir, readRemoteFile, statRemotePath, writeRemoteFile } from "../file-transfer";
|
||||
import type { SSHConnectionTarget } from "../../src/ssh/connection-manager";
|
||||
import * as connectionManager from "../../src/ssh/connection-manager";
|
||||
import { listRemoteDir, readRemoteFile, statRemotePath, writeRemoteFile } from "../../src/ssh/file-transfer";
|
||||
|
||||
describe("ssh file-transfer POSIX guard", () => {
|
||||
afterEach(() => {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import * as path from "node:path";
|
||||
import { isMounted } from "../sshfs-mount";
|
||||
import { isMounted } from "../../src/ssh/sshfs-mount";
|
||||
|
||||
describe("isMounted", () => {
|
||||
it("detects a macOS mount point when mountpoint is unavailable", async () => {
|
||||
+2
-2
@@ -2,7 +2,7 @@ import { describe, expect, it, spyOn } from "bun:test";
|
||||
import * as fs from "node:fs/promises";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { buildSystemPrompt } from "./system-prompt";
|
||||
import { buildSystemPrompt } from "../src/system-prompt";
|
||||
|
||||
interface ProbeRunResult {
|
||||
elapsedMs: number;
|
||||
@@ -36,7 +36,7 @@ async function runProbeScenario(options: {
|
||||
await Bun.write(
|
||||
scenarioPath,
|
||||
`import { getGpuCachePath, refreshDirsFromEnv } from ${JSON.stringify(path.resolve(import.meta.dir, "../../utils/src/index.ts"))};
|
||||
import { buildSystemPrompt } from ${JSON.stringify(path.join(import.meta.dir, "system-prompt.ts"))};
|
||||
import { buildSystemPrompt } from ${JSON.stringify(path.join(import.meta.dir, "../src/system-prompt.ts"))};
|
||||
|
||||
refreshDirsFromEnv();
|
||||
const buildOptions = {
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
import { afterEach, beforeAll, describe, expect, it } from "bun:test";
|
||||
import { Settings } from "../config/settings";
|
||||
import { getThemeByName, setThemeInstance, type Theme } from "../modes/theme/theme";
|
||||
import { renderResult } from "./render";
|
||||
import { taskToolRenderer } from "./renderer";
|
||||
import type { AgentProgress, SingleResult, TaskToolDetails } from "./types";
|
||||
import { Settings } from "../../src/config/settings";
|
||||
import { getThemeByName, setThemeInstance, type Theme } from "../../src/modes/theme/theme";
|
||||
import { renderResult } from "../../src/task/render";
|
||||
import { taskToolRenderer } from "../../src/task/renderer";
|
||||
import type { AgentProgress, SingleResult, TaskToolDetails } from "../../src/task/types";
|
||||
|
||||
const strip = (lines: readonly string[]): string =>
|
||||
lines
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
import { afterEach, describe, expect, it, vi } from "bun:test";
|
||||
import { Settings } from "../config/settings";
|
||||
import type { ToolSession } from "../tools";
|
||||
import * as taskDiscovery from "./discovery";
|
||||
import { TaskTool } from "./index";
|
||||
import type { AgentDefinition } from "./types";
|
||||
import { getTaskSchema } from "./types";
|
||||
import { Settings } from "../../src/config/settings";
|
||||
import * as taskDiscovery from "../../src/task/discovery";
|
||||
import { TaskTool } from "../../src/task/index";
|
||||
import type { AgentDefinition } from "../../src/task/types";
|
||||
import { getTaskSchema } from "../../src/task/types";
|
||||
import type { ToolSession } from "../../src/tools";
|
||||
|
||||
const factFinderAgent = {
|
||||
name: "fact-finder",
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { getEvalToolDescription } from "../eval";
|
||||
import { getEvalToolDescription } from "../../src/tools/eval";
|
||||
|
||||
describe("eval tool description", () => {
|
||||
it("advertises the first allowed spawn as the agent() default", () => {
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { Settings } from "../../config/settings";
|
||||
import type { ToolSession } from "..";
|
||||
import { GlobTool } from "../glob";
|
||||
import { ToolError } from "../tool-errors";
|
||||
import { Settings } from "../../src/config/settings";
|
||||
import type { ToolSession } from "../../src/tools";
|
||||
import { GlobTool } from "../../src/tools/glob";
|
||||
import { ToolError } from "../../src/tools/tool-errors";
|
||||
|
||||
const ROOT_SEARCH_ERROR = "Searching from root directory '/' is not allowed";
|
||||
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
import { afterEach, describe, expect, it, vi } from "bun:test";
|
||||
import type { DaemonBrokerClient } from "../../launch/client";
|
||||
import * as daemonClient from "../../launch/client";
|
||||
import type { DaemonRpcResult } from "../../launch/protocol";
|
||||
import type { ToolSession } from "..";
|
||||
import { executeLaunch } from "./launch";
|
||||
import type { DaemonBrokerClient } from "../../../src/launch/client";
|
||||
import * as daemonClient from "../../../src/launch/client";
|
||||
import type { DaemonRpcResult } from "../../../src/launch/protocol";
|
||||
import type { ToolSession } from "../../../src/tools";
|
||||
import { executeLaunch } from "../../../src/tools/hub/launch";
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { INTENT_FIELD } from "@oh-my-pi/pi-wire";
|
||||
import { formatArgsInline } from "../json-tree";
|
||||
import { formatArgsInline } from "../../src/tools/json-tree";
|
||||
|
||||
describe("formatArgsInline", () => {
|
||||
test("a trailing scalar grows into the available width instead of a fixed cap", () => {
|
||||
+4
-4
@@ -13,10 +13,10 @@
|
||||
* 4. Every emitted line respects the render width (sanitized, truncated).
|
||||
*/
|
||||
import { beforeAll, describe, expect, it } from "bun:test";
|
||||
import { Settings } from "../../config/settings";
|
||||
import { getThemeByName, setThemeInstance, type Theme } from "../../modes/theme/theme";
|
||||
import type { VibeScreenSnapshot } from "../../vibe/runtime";
|
||||
import { createVibeToolRenderer, type VibeToolDetails } from "../vibe";
|
||||
import { Settings } from "../../src/config/settings";
|
||||
import { getThemeByName, setThemeInstance, type Theme } from "../../src/modes/theme/theme";
|
||||
import { createVibeToolRenderer, type VibeToolDetails } from "../../src/tools/vibe";
|
||||
import type { VibeScreenSnapshot } from "../../src/vibe/runtime";
|
||||
|
||||
const strip = (lines: readonly string[]): string[] =>
|
||||
lines.map(line => line.replace(/\x1b\]8;[^\x1b\x07]*(?:\x07|\x1b\\)/g, "").replace(/\x1b\[[0-9;]*m/g, ""));
|
||||
+3
-3
@@ -11,9 +11,9 @@
|
||||
* so a stale roster entry can't contribute a phantom zero.
|
||||
*/
|
||||
import { afterEach, describe, expect, it } from "bun:test";
|
||||
import { AgentRegistry, MAIN_AGENT_ID } from "../../registry/agent-registry";
|
||||
import type { AgentSession } from "../../session/agent-session";
|
||||
import { aggregateVibeWorkerTokensPerSecond, VibeSessionRegistry } from "../runtime";
|
||||
import { AgentRegistry, MAIN_AGENT_ID } from "../../src/registry/agent-registry";
|
||||
import type { AgentSession } from "../../src/session/agent-session";
|
||||
import { aggregateVibeWorkerTokensPerSecond, VibeSessionRegistry } from "../../src/vibe/runtime";
|
||||
|
||||
const OWNER = "test-owner";
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import { afterEach, describe, expect, it } from "bun:test";
|
||||
import * as fs from "node:fs";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { BENCHMARK_DEFINITIONS, readBenchmarkSnapshot } from "./benchmarks";
|
||||
import { BENCHMARK_DEFINITIONS, readBenchmarkSnapshot } from "../src/benchmarks";
|
||||
|
||||
const cleanups: string[] = [];
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@ import {
|
||||
experimentOf,
|
||||
pickMergedTrials,
|
||||
summarizeArm,
|
||||
} from "./experiments";
|
||||
import type { RunRow, TraceRow } from "./store";
|
||||
} from "../src/experiments";
|
||||
import type { RunRow, TraceRow } from "../src/store";
|
||||
|
||||
/**
|
||||
* Contracts under test:
|
||||
+3
-3
@@ -2,9 +2,9 @@ import { afterEach, describe, expect, it } from "bun:test";
|
||||
import * as fs from "node:fs";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { experimentDetail } from "./experiments";
|
||||
import { ManagerServer, resolveArmLaunch } from "./server";
|
||||
import { RunStore } from "./store";
|
||||
import { experimentDetail } from "../src/experiments";
|
||||
import { ManagerServer, resolveArmLaunch } from "../src/server";
|
||||
import { RunStore } from "../src/store";
|
||||
|
||||
/**
|
||||
* Contracts under test:
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
parseArgs,
|
||||
readTrials,
|
||||
resolveResumeConfig,
|
||||
} from "./runner";
|
||||
} from "../src/runner";
|
||||
|
||||
describe("generic agent-arg / env passthrough", () => {
|
||||
it("forwards repeated --agent-arg as a JSON array the in-container agent can parse", () => {
|
||||
+2
-2
@@ -4,8 +4,8 @@ import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import type { ModelRegistry, SingleResult } from "@oh-my-pi/pi-coding-agent";
|
||||
import * as taskExecutor from "@oh-my-pi/pi-coding-agent";
|
||||
import { executeSwarmAgent } from "../executor";
|
||||
import { StateTracker } from "../state";
|
||||
import { executeSwarmAgent } from "../../src/swarm/executor";
|
||||
import { StateTracker } from "../../src/swarm/state";
|
||||
|
||||
const mockResult = {
|
||||
index: 0,
|
||||
@@ -146,7 +146,6 @@ const codingAgentSingletonPathPatterns = [
|
||||
const codingAgentUiPathPatterns = [
|
||||
/^test\/modes\//,
|
||||
/^test\/(interactive-mode|main-interactive|input-controller|streaming|status-line|keybindings|editor|hook|theme|setup-wizard|job-renderer|tool-args-reveal|tool-execution)[^/]*\.test\.ts$/,
|
||||
/^src\/modes\/components\//,
|
||||
];
|
||||
|
||||
const codingAgentRuntimePathPatterns = [
|
||||
@@ -298,10 +297,7 @@ function classifyCodingAgentTest(testFile: string, content: string): CodingAgent
|
||||
async function getCodingAgentTestPartition(): Promise<CodingAgentTestPartition> {
|
||||
codingAgentTestPartitionPromise ??= (async () => {
|
||||
const codingAgentDir = path.join(repoRoot, "packages/coding-agent");
|
||||
const testFiles = [
|
||||
...(await collectTestsUnder(path.join(codingAgentDir, "test"), codingAgentDir)),
|
||||
...(await collectTestsUnder(path.join(codingAgentDir, "src"), codingAgentDir)),
|
||||
].sort();
|
||||
const testFiles = (await collectTestsUnder(path.join(codingAgentDir, "test"), codingAgentDir)).sort();
|
||||
const partition: CodingAgentTestPartition = {
|
||||
singleton: [],
|
||||
ui: [],
|
||||
|
||||
Reference in New Issue
Block a user