From d16a251777c561e750308a46805540674bbfa550 Mon Sep 17 00:00:00 2001 From: can1357 Date: Mon, 27 Jul 2026 16:43:53 +0200 Subject: [PATCH] chore: reorg tests --- .../providers}/google-auth.test.ts | 4 +- .../providers}/keyless-auth-header.test.ts | 2 +- .../providers}/kimi-code-thinking.test.ts | 14 +++---- .../providers}/openai-codex-error.test.ts | 5 ++- .../registry/oauth}/xai-oauth.test.ts | 2 +- .../advisor}/advisor.test.ts | 22 +++++------ .../__tests__ => test/advisor}/config.test.ts | 2 +- .../advisor}/emission-guard.test.ts | 2 +- .../cli}/auth-gateway-catalog.test.ts | 4 +- .../{src => test}/cli/update-cli.test.ts | 2 +- .../config}/model-registry.test.ts | 2 +- .../eval/agent-bridge-policy.test.ts} | 38 +++++++++---------- .../eval}/bridge-timeout.test.ts | 8 ++-- .../eval}/budget-bridge.test.ts | 8 ++-- .../eval}/completion-bridge.test.ts | 28 +++++++------- .../eval}/helpers-local-roots.test.ts | 2 +- .../eval}/idle-timeout.test.ts | 2 +- .../eval}/js-context-manager.test.ts | 12 +++--- .../eval}/julia-prelude.test.ts | 2 +- .../eval}/kernel-spawn.test.ts | 2 +- .../eval}/prelude-agent.test.ts | 2 +- .../eval}/process-entry-import.test.ts | 12 +++--- .../eval/py}/prelude.test.ts | 2 +- .../eval/py}/runner-shell-output.test.ts | 4 +- .../{src => test}/hindsight/client.test.ts | 2 +- .../agent-protocol-nested.test.ts | 10 ++--- .../internal-urls}/ssh-protocol.test.ts | 12 +++--- .../launch/broker-list-order.test.ts | 4 +- .../launch/broker-output-snapshot.test.ts | 8 ++-- .../{src => test}/launch/protocol.test.ts | 2 +- .../launch/spawn-options.test.ts | 2 +- .../launch/terminal-output.test.ts | 2 +- .../{src => test}/live/protocol.test.ts | 2 +- .../{src => test}/mcp/config-writer.test.ts | 2 +- .../{src => test}/mcp/smithery-auth.test.ts | 2 +- .../mcp/smithery-registry.test.ts | 2 +- .../mcp/transports/stdio.test.ts | 2 +- .../custom-editor-plugin-ctor.test.ts | 4 +- .../modes/components/custom-editor.test.ts | 8 ++-- .../modes/components}/dynamic-border.test.ts | 6 +-- .../login-dialog-manual-code.test.ts} | 4 +- .../modes/components}/move-overlay.test.ts | 11 ++++-- .../modes/components}/pause-screen.test.ts | 11 ++++-- .../modes/components}/skill-message.test.ts | 8 ++-- .../status-line/component.jj-cache.test.ts | 12 +++--- .../components/status-line/component.test.ts | 8 ++-- .../modes/components/tool-execution.test.ts | 10 ++--- .../extension-ui-controller.test.ts | 14 +++---- .../modes/noninteractive-dispose.test.ts | 6 +-- .../{src => test}/modes/print-mode.test.ts | 4 +- .../modes/session-teardown.test.ts | 2 +- .../modes/theme/mermaid-rendering.test.ts | 11 ++++-- .../utils/transcript-render-helpers.test.ts | 2 +- .../{src => test}/modes/warp-events.test.ts | 6 +-- .../plan-mode/approved-plan-prompt.test.ts | 6 +-- .../plan-mode/model-transition.test.ts | 6 +-- .../plan-mode/reentry-prompt.test.ts | 2 +- .../session/agent-session-error-log.test.ts | 2 +- .../blob-store-ref-validation.test.ts} | 8 +++- .../{src => test}/session/messages.test.ts | 2 +- .../session/session-context.test.ts | 6 +-- .../ssh}/connection-manager-args.test.ts | 4 +- .../ssh}/connection-manager-timeout.test.ts | 2 +- .../ssh}/file-transfer-posix-guard.test.ts | 6 +-- .../ssh}/sshfs-mount.test.ts | 2 +- .../{src => test}/system-prompt.test.ts | 4 +- .../{src => test}/task/render.test.ts | 10 ++--- .../{src => test}/task/spawn-policy.test.ts | 12 +++--- .../eval-description-spawn-default.test.ts} | 2 +- .../__tests__ => test/tools}/glob.test.ts | 8 ++-- .../tools/hub/launch-compat.test.ts | 10 ++--- .../tools}/json-tree.test.ts | 2 +- .../tools}/vibe-render.test.ts | 8 ++-- .../vibe}/token-rate.test.ts | 6 +-- .../{src => test}/benchmarks.test.ts | 2 +- .../{src => test}/experiments.test.ts | 4 +- .../metaharness/{src => test}/manager.test.ts | 6 +-- .../metaharness/{src => test}/runner.test.ts | 2 +- .../__tests__ => test/swarm}/executor.test.ts | 4 +- scripts/ci-test-ts.ts | 6 +-- 80 files changed, 258 insertions(+), 236 deletions(-) rename packages/ai/{src/providers/__tests__ => test/providers}/google-auth.test.ts (98%) rename packages/ai/{src/providers/__tests__ => test/providers}/keyless-auth-header.test.ts (97%) rename packages/ai/{src/providers/__tests__ => test/providers}/kimi-code-thinking.test.ts (97%) rename packages/ai/{src/providers/__tests__ => test/providers}/openai-codex-error.test.ts (96%) rename packages/ai/{src/registry/oauth/__tests__ => test/registry/oauth}/xai-oauth.test.ts (99%) rename packages/coding-agent/{src/advisor/__tests__ => test/advisor}/advisor.test.ts (99%) rename packages/coding-agent/{src/advisor/__tests__ => test/advisor}/config.test.ts (99%) rename packages/coding-agent/{src/advisor/__tests__ => test/advisor}/emission-guard.test.ts (98%) rename packages/coding-agent/{src/cli/__tests__ => test/cli}/auth-gateway-catalog.test.ts (97%) rename packages/coding-agent/{src => test}/cli/update-cli.test.ts (93%) rename packages/coding-agent/{src/config/__tests__ => test/config}/model-registry.test.ts (98%) rename packages/coding-agent/{src/eval/__tests__/agent-bridge.test.ts => test/eval/agent-bridge-policy.test.ts} (97%) rename packages/coding-agent/{src/eval/__tests__ => test/eval}/bridge-timeout.test.ts (95%) rename packages/coding-agent/{src/eval/__tests__ => test/eval}/budget-bridge.test.ts (92%) rename packages/coding-agent/{src/eval/__tests__ => test/eval}/completion-bridge.test.ts (94%) rename packages/coding-agent/{src/eval/__tests__ => test/eval}/helpers-local-roots.test.ts (96%) rename packages/coding-agent/{src/eval/__tests__ => test/eval}/idle-timeout.test.ts (97%) rename packages/coding-agent/{src/eval/__tests__ => test/eval}/js-context-manager.test.ts (97%) rename packages/coding-agent/{src/eval/__tests__ => test/eval}/julia-prelude.test.ts (98%) rename packages/coding-agent/{src/eval/__tests__ => test/eval}/kernel-spawn.test.ts (99%) rename packages/coding-agent/{src/eval/__tests__ => test/eval}/prelude-agent.test.ts (98%) rename packages/coding-agent/{src/eval/__tests__ => test/eval}/process-entry-import.test.ts (90%) rename packages/coding-agent/{src/eval/py/__tests__ => test/eval/py}/prelude.test.ts (98%) rename packages/coding-agent/{src/eval/py/__tests__ => test/eval/py}/runner-shell-output.test.ts (96%) rename packages/coding-agent/{src => test}/hindsight/client.test.ts (97%) rename packages/coding-agent/{src/internal-urls/__tests__ => test/internal-urls}/agent-protocol-nested.test.ts (93%) rename packages/coding-agent/{src/internal-urls/__tests__ => test/internal-urls}/ssh-protocol.test.ts (97%) rename packages/coding-agent/{src => test}/launch/broker-list-order.test.ts (96%) rename packages/coding-agent/{src => test}/launch/broker-output-snapshot.test.ts (94%) rename packages/coding-agent/{src => test}/launch/protocol.test.ts (97%) rename packages/coding-agent/{src => test}/launch/spawn-options.test.ts (91%) rename packages/coding-agent/{src => test}/launch/terminal-output.test.ts (97%) rename packages/coding-agent/{src => test}/live/protocol.test.ts (99%) rename packages/coding-agent/{src => test}/mcp/config-writer.test.ts (96%) rename packages/coding-agent/{src => test}/mcp/smithery-auth.test.ts (92%) rename packages/coding-agent/{src => test}/mcp/smithery-registry.test.ts (95%) rename packages/coding-agent/{src => test}/mcp/transports/stdio.test.ts (99%) rename packages/coding-agent/{src => test}/modes/components/custom-editor-plugin-ctor.test.ts (90%) rename packages/coding-agent/{src => test}/modes/components/custom-editor.test.ts (98%) rename packages/coding-agent/{src/modes/components/__tests__ => test/modes/components}/dynamic-border.test.ts (89%) rename packages/coding-agent/{src/modes/components/login-dialog.test.ts => test/modes/components/login-dialog-manual-code.test.ts} (93%) rename packages/coding-agent/{src/modes/components/__tests__ => test/modes/components}/move-overlay.test.ts (97%) rename packages/coding-agent/{src/modes/components/__tests__ => test/modes/components}/pause-screen.test.ts (94%) rename packages/coding-agent/{src/modes/components/__tests__ => test/modes/components}/skill-message.test.ts (94%) rename packages/coding-agent/{src => test}/modes/components/status-line/component.jj-cache.test.ts (95%) rename packages/coding-agent/{src => test}/modes/components/status-line/component.test.ts (92%) rename packages/coding-agent/{src => test}/modes/components/tool-execution.test.ts (92%) rename packages/coding-agent/{src => test}/modes/controllers/extension-ui-controller.test.ts (94%) rename packages/coding-agent/{src => test}/modes/noninteractive-dispose.test.ts (92%) rename packages/coding-agent/{src => test}/modes/print-mode.test.ts (95%) rename packages/coding-agent/{src => test}/modes/session-teardown.test.ts (98%) rename packages/coding-agent/{src => test}/modes/theme/mermaid-rendering.test.ts (83%) rename packages/coding-agent/{src => test}/modes/utils/transcript-render-helpers.test.ts (94%) rename packages/coding-agent/{src => test}/modes/warp-events.test.ts (99%) rename packages/coding-agent/{src => test}/plan-mode/approved-plan-prompt.test.ts (77%) rename packages/coding-agent/{src => test}/plan-mode/model-transition.test.ts (92%) rename packages/coding-agent/{src => test}/plan-mode/reentry-prompt.test.ts (94%) rename packages/coding-agent/{src => test}/session/agent-session-error-log.test.ts (96%) rename packages/coding-agent/{src/session/blob-store.test.ts => test/session/blob-store-ref-validation.test.ts} (93%) rename packages/coding-agent/{src => test}/session/messages.test.ts (99%) rename packages/coding-agent/{src => test}/session/session-context.test.ts (98%) rename packages/coding-agent/{src/ssh/__tests__ => test/ssh}/connection-manager-args.test.ts (98%) rename packages/coding-agent/{src/ssh/__tests__ => test/ssh}/connection-manager-timeout.test.ts (97%) rename packages/coding-agent/{src/ssh/__tests__ => test/ssh}/file-transfer-posix-guard.test.ts (96%) rename packages/coding-agent/{src/ssh/__tests__ => test/ssh}/sshfs-mount.test.ts (89%) rename packages/coding-agent/{src => test}/system-prompt.test.ts (98%) rename packages/coding-agent/{src => test}/task/render.test.ts (97%) rename packages/coding-agent/{src => test}/task/spawn-policy.test.ts (82%) rename packages/coding-agent/{src/tools/__tests__/eval-description.test.ts => test/tools/eval-description-spawn-default.test.ts} (91%) rename packages/coding-agent/{src/tools/__tests__ => test/tools}/glob.test.ts (81%) rename packages/coding-agent/{src => test}/tools/hub/launch-compat.test.ts (74%) rename packages/coding-agent/{src/tools/__tests__ => test/tools}/json-tree.test.ts (96%) rename packages/coding-agent/{src/tools/__tests__ => test/tools}/vibe-render.test.ts (97%) rename packages/coding-agent/{src/vibe/__tests__ => test/vibe}/token-rate.test.ts (95%) rename packages/metaharness/{src => test}/benchmarks.test.ts (96%) rename packages/metaharness/{src => test}/experiments.test.ts (98%) rename packages/metaharness/{src => test}/manager.test.ts (99%) rename packages/metaharness/{src => test}/runner.test.ts (99%) rename packages/swarm-extension/{src/swarm/__tests__ => test/swarm}/executor.test.ts (93%) diff --git a/packages/ai/src/providers/__tests__/google-auth.test.ts b/packages/ai/test/providers/google-auth.test.ts similarity index 98% rename from packages/ai/src/providers/__tests__/google-auth.test.ts rename to packages/ai/test/providers/google-auth.test.ts index 8b72ffcc4..87beec269 100644 --- a/packages/ai/src/providers/__tests__/google-auth.test.ts +++ b/packages/ai/test/providers/google-auth.test.ts @@ -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"; diff --git a/packages/ai/src/providers/__tests__/keyless-auth-header.test.ts b/packages/ai/test/providers/keyless-auth-header.test.ts similarity index 97% rename from packages/ai/src/providers/__tests__/keyless-auth-header.test.ts rename to packages/ai/test/providers/keyless-auth-header.test.ts index 862803630..c32aa2410 100644 --- a/packages/ai/src/providers/__tests__/keyless-auth-header.test.ts +++ b/packages/ai/test/providers/keyless-auth-header.test.ts @@ -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", () => { diff --git a/packages/ai/src/providers/__tests__/kimi-code-thinking.test.ts b/packages/ai/test/providers/kimi-code-thinking.test.ts similarity index 97% rename from packages/ai/src/providers/__tests__/kimi-code-thinking.test.ts rename to packages/ai/test/providers/kimi-code-thinking.test.ts index 6c0350d8c..25c9344c2 100644 --- a/packages/ai/src/providers/__tests__/kimi-code-thinking.test.ts +++ b/packages/ai/test/providers/kimi-code-thinking.test.ts @@ -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({ diff --git a/packages/ai/src/providers/__tests__/openai-codex-error.test.ts b/packages/ai/test/providers/openai-codex-error.test.ts similarity index 96% rename from packages/ai/src/providers/__tests__/openai-codex-error.test.ts rename to packages/ai/test/providers/openai-codex-error.test.ts index d0c58b0e8..f9a2a5fdf 100644 --- a/packages/ai/src/providers/__tests__/openai-codex-error.test.ts +++ b/packages/ai/test/providers/openai-codex-error.test.ts @@ -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", () => { diff --git a/packages/ai/src/registry/oauth/__tests__/xai-oauth.test.ts b/packages/ai/test/registry/oauth/xai-oauth.test.ts similarity index 99% rename from packages/ai/src/registry/oauth/__tests__/xai-oauth.test.ts rename to packages/ai/test/registry/oauth/xai-oauth.test.ts index a1c182bed..e6596e2ff 100644 --- a/packages/ai/src/registry/oauth/__tests__/xai-oauth.test.ts +++ b/packages/ai/test/registry/oauth/xai-oauth.test.ts @@ -10,7 +10,7 @@ import { refreshXAIOAuthToken, validateXAIBillingEndpoint, validateXAIEndpoint, -} from "../xai-oauth"; +} from "../../../src/registry/oauth/xai-oauth"; afterEach(() => { vi.restoreAllMocks(); diff --git a/packages/coding-agent/src/advisor/__tests__/advisor.test.ts b/packages/coding-agent/test/advisor/advisor.test.ts similarity index 99% rename from packages/coding-agent/src/advisor/__tests__/advisor.test.ts rename to packages/coding-agent/test/advisor/advisor.test.ts index 05d272104..acad5f2d9 100644 --- a/packages/coding-agent/src/advisor/__tests__/advisor.test.ts +++ b/packages/coding-agent/test/advisor/advisor.test.ts @@ -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 diff --git a/packages/coding-agent/src/advisor/__tests__/config.test.ts b/packages/coding-agent/test/advisor/config.test.ts similarity index 99% rename from packages/coding-agent/src/advisor/__tests__/config.test.ts rename to packages/coding-agent/test/advisor/config.test.ts index 92d334ca0..85fdab797 100644 --- a/packages/coding-agent/src/advisor/__tests__/config.test.ts +++ b/packages/coding-agent/test/advisor/config.test.ts @@ -12,7 +12,7 @@ import { serializeWatchdogConfig, slugifyAdvisorName, type WatchdogConfigDoc, -} from "../config"; +} from "../../src/advisor/config"; describe("discoverAdvisorConfigs", () => { let tmp: string; diff --git a/packages/coding-agent/src/advisor/__tests__/emission-guard.test.ts b/packages/coding-agent/test/advisor/emission-guard.test.ts similarity index 98% rename from packages/coding-agent/src/advisor/__tests__/emission-guard.test.ts rename to packages/coding-agent/test/advisor/emission-guard.test.ts index 5c6928263..18cf2a495 100644 --- a/packages/coding-agent/src/advisor/__tests__/emission-guard.test.ts +++ b/packages/coding-agent/test/advisor/emission-guard.test.ts @@ -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", () => { diff --git a/packages/coding-agent/src/cli/__tests__/auth-gateway-catalog.test.ts b/packages/coding-agent/test/cli/auth-gateway-catalog.test.ts similarity index 97% rename from packages/coding-agent/src/cli/__tests__/auth-gateway-catalog.test.ts rename to packages/coding-agent/test/cli/auth-gateway-catalog.test.ts index f780fac5e..6a1ead1dc 100644 --- a/packages/coding-agent/src/cli/__tests__/auth-gateway-catalog.test.ts +++ b/packages/coding-agent/test/cli/auth-gateway-catalog.test.ts @@ -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 = { diff --git a/packages/coding-agent/src/cli/update-cli.test.ts b/packages/coding-agent/test/cli/update-cli.test.ts similarity index 93% rename from packages/coding-agent/src/cli/update-cli.test.ts rename to packages/coding-agent/test/cli/update-cli.test.ts index e48b71ceb..f07d1786d 100644 --- a/packages/coding-agent/src/cli/update-cli.test.ts +++ b/packages/coding-agent/test/cli/update-cli.test.ts @@ -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; diff --git a/packages/coding-agent/src/config/__tests__/model-registry.test.ts b/packages/coding-agent/test/config/model-registry.test.ts similarity index 98% rename from packages/coding-agent/src/config/__tests__/model-registry.test.ts rename to packages/coding-agent/test/config/model-registry.test.ts index 878e7dabf..63157673a 100644 --- a/packages/coding-agent/src/config/__tests__/model-registry.test.ts +++ b/packages/coding-agent/test/config/model-registry.test.ts @@ -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 { diff --git a/packages/coding-agent/src/eval/__tests__/agent-bridge.test.ts b/packages/coding-agent/test/eval/agent-bridge-policy.test.ts similarity index 97% rename from packages/coding-agent/src/eval/__tests__/agent-bridge.test.ts rename to packages/coding-agent/test/eval/agent-bridge-policy.test.ts index 5b45fe14b..65f27e474 100644 --- a/packages/coding-agent/src/eval/__tests__/agent-bridge.test.ts +++ b/packages/coding-agent/test/eval/agent-bridge-policy.test.ts @@ -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", diff --git a/packages/coding-agent/src/eval/__tests__/bridge-timeout.test.ts b/packages/coding-agent/test/eval/bridge-timeout.test.ts similarity index 95% rename from packages/coding-agent/src/eval/__tests__/bridge-timeout.test.ts rename to packages/coding-agent/test/eval/bridge-timeout.test.ts index aa6fb9be0..76137f1dd 100644 --- a/packages/coding-agent/src/eval/__tests__/bridge-timeout.test.ts +++ b/packages/coding-agent/test/eval/bridge-timeout.test.ts @@ -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 () => { diff --git a/packages/coding-agent/src/eval/__tests__/budget-bridge.test.ts b/packages/coding-agent/test/eval/budget-bridge.test.ts similarity index 92% rename from packages/coding-agent/src/eval/__tests__/budget-bridge.test.ts rename to packages/coding-agent/test/eval/budget-bridge.test.ts index 37e773779..c20800925 100644 --- a/packages/coding-agent/src/eval/__tests__/budget-bridge.test.ts +++ b/packages/coding-agent/test/eval/budget-bridge.test.ts @@ -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 }; diff --git a/packages/coding-agent/src/eval/__tests__/completion-bridge.test.ts b/packages/coding-agent/test/eval/completion-bridge.test.ts similarity index 94% rename from packages/coding-agent/src/eval/__tests__/completion-bridge.test.ts rename to packages/coding-agent/test/eval/completion-bridge.test.ts index 59ad6c844..2d8a6d66c 100644 --- a/packages/coding-agent/src/eval/__tests__/completion-bridge.test.ts +++ b/packages/coding-agent/test/eval/completion-bridge.test.ts @@ -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 { return { @@ -102,12 +102,12 @@ async function runPythonCompletionInSubprocess(options: { structured: boolean; tempDir: TempDir; }): Promise { - 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"))'; diff --git a/packages/coding-agent/src/eval/__tests__/helpers-local-roots.test.ts b/packages/coding-agent/test/eval/helpers-local-roots.test.ts similarity index 96% rename from packages/coding-agent/src/eval/__tests__/helpers-local-roots.test.ts rename to packages/coding-agent/test/eval/helpers-local-roots.test.ts index a225ad506..fc7aee2b4 100644 --- a/packages/coding-agent/src/eval/__tests__/helpers-local-roots.test.ts +++ b/packages/coding-agent/test/eval/helpers-local-roots.test.ts @@ -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 diff --git a/packages/coding-agent/src/eval/__tests__/idle-timeout.test.ts b/packages/coding-agent/test/eval/idle-timeout.test.ts similarity index 97% rename from packages/coding-agent/src/eval/__tests__/idle-timeout.test.ts rename to packages/coding-agent/test/eval/idle-timeout.test.ts index e4b7185da..9f43d244f 100644 --- a/packages/coding-agent/src/eval/__tests__/idle-timeout.test.ts +++ b/packages/coding-agent/test/eval/idle-timeout.test.ts @@ -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 { diff --git a/packages/coding-agent/src/eval/__tests__/js-context-manager.test.ts b/packages/coding-agent/test/eval/js-context-manager.test.ts similarity index 97% rename from packages/coding-agent/src/eval/__tests__/js-context-manager.test.ts rename to packages/coding-agent/test/eval/js-context-manager.test.ts index c931093e1..e127781b8 100644 --- a/packages/coding-agent/src/eval/__tests__/js-context-manager.test.ts +++ b/packages/coding-agent/test/eval/js-context-manager.test.ts @@ -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(promise: Promise, ms: number, label: string): P } async function waitForRealWorkerExitAfterClose(cwd: string): Promise { - 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(); const runComplete = Promise.withResolvers(); const closedAck = Promise.withResolvers(); diff --git a/packages/coding-agent/src/eval/__tests__/julia-prelude.test.ts b/packages/coding-agent/test/eval/julia-prelude.test.ts similarity index 98% rename from packages/coding-agent/src/eval/__tests__/julia-prelude.test.ts rename to packages/coding-agent/test/eval/julia-prelude.test.ts index 8af6f5678..5f643c018 100644 --- a/packages/coding-agent/src/eval/__tests__/julia-prelude.test.ts +++ b/packages/coding-agent/test/eval/julia-prelude.test.ts @@ -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"; diff --git a/packages/coding-agent/src/eval/__tests__/kernel-spawn.test.ts b/packages/coding-agent/test/eval/kernel-spawn.test.ts similarity index 99% rename from packages/coding-agent/src/eval/__tests__/kernel-spawn.test.ts rename to packages/coding-agent/test/eval/kernel-spawn.test.ts index 5e58efaf0..7fc4f6760 100644 --- a/packages/coding-agent/src/eval/__tests__/kernel-spawn.test.ts +++ b/packages/coding-agent/test/eval/kernel-spawn.test.ts @@ -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", () => { diff --git a/packages/coding-agent/src/eval/__tests__/prelude-agent.test.ts b/packages/coding-agent/test/eval/prelude-agent.test.ts similarity index 98% rename from packages/coding-agent/src/eval/__tests__/prelude-agent.test.ts rename to packages/coding-agent/test/eval/prelude-agent.test.ts index 747c1d8ab..4aa4019aa 100644 --- a/packages/coding-agent/src/eval/__tests__/prelude-agent.test.ts +++ b/packages/coding-agent/test/eval/prelude-agent.test.ts @@ -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 diff --git a/packages/coding-agent/src/eval/__tests__/process-entry-import.test.ts b/packages/coding-agent/test/eval/process-entry-import.test.ts similarity index 90% rename from packages/coding-agent/src/eval/__tests__/process-entry-import.test.ts rename to packages/coding-agent/test/eval/process-entry-import.test.ts index fd27dfaab..cb322d593 100644 --- a/packages/coding-agent/src/eval/__tests__/process-entry-import.test.ts +++ b/packages/coding-agent/test/eval/process-entry-import.test.ts @@ -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( [ diff --git a/packages/coding-agent/src/eval/py/__tests__/prelude.test.ts b/packages/coding-agent/test/eval/py/prelude.test.ts similarity index 98% rename from packages/coding-agent/src/eval/py/__tests__/prelude.test.ts rename to packages/coding-agent/test/eval/py/prelude.test.ts index 8163961fa..ab54cf35e 100644 --- a/packages/coding-agent/src/eval/py/__tests__/prelude.test.ts +++ b/packages/coding-agent/test/eval/py/prelude.test.ts @@ -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"; diff --git a/packages/coding-agent/src/eval/py/__tests__/runner-shell-output.test.ts b/packages/coding-agent/test/eval/py/runner-shell-output.test.ts similarity index 96% rename from packages/coding-agent/src/eval/py/__tests__/runner-shell-output.test.ts rename to packages/coding-agent/test/eval/py/runner-shell-output.test.ts index f62ba98af..8fc0d2978 100644 --- a/packages/coding-agent/src/eval/py/__tests__/runner-shell-output.test.ts +++ b/packages/coding-agent/test/eval/py/runner-shell-output.test.ts @@ -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 { diff --git a/packages/coding-agent/src/hindsight/client.test.ts b/packages/coding-agent/test/hindsight/client.test.ts similarity index 97% rename from packages/coding-agent/src/hindsight/client.test.ts rename to packages/coding-agent/test/hindsight/client.test.ts index 05fcef89b..5fdc69cec 100644 --- a/packages/coding-agent/src/hindsight/client.test.ts +++ b/packages/coding-agent/test/hindsight/client.test.ts @@ -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; diff --git a/packages/coding-agent/src/internal-urls/__tests__/agent-protocol-nested.test.ts b/packages/coding-agent/test/internal-urls/agent-protocol-nested.test.ts similarity index 93% rename from packages/coding-agent/src/internal-urls/__tests__/agent-protocol-nested.test.ts rename to packages/coding-agent/test/internal-urls/agent-protocol-nested.test.ts index 120497ae1..bcd08f630 100644 --- a/packages/coding-agent/src/internal-urls/__tests__/agent-protocol-nested.test.ts +++ b/packages/coding-agent/test/internal-urls/agent-protocol-nested.test.ts @@ -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(() => { diff --git a/packages/coding-agent/src/internal-urls/__tests__/ssh-protocol.test.ts b/packages/coding-agent/test/internal-urls/ssh-protocol.test.ts similarity index 97% rename from packages/coding-agent/src/internal-urls/__tests__/ssh-protocol.test.ts rename to packages/coding-agent/test/internal-urls/ssh-protocol.test.ts index f69c1f421..81e4a28ec 100644 --- a/packages/coding-agent/src/internal-urls/__tests__/ssh-protocol.test.ts +++ b/packages/coding-agent/test/internal-urls/ssh-protocol.test.ts @@ -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", diff --git a/packages/coding-agent/src/launch/broker-list-order.test.ts b/packages/coding-agent/test/launch/broker-list-order.test.ts similarity index 96% rename from packages/coding-agent/src/launch/broker-list-order.test.ts rename to packages/coding-agent/test/launch/broker-list-order.test.ts index 71a18ca21..7963b033a 100644 --- a/packages/coding-agent/src/launch/broker-list-order.test.ts +++ b/packages/coding-agent/test/launch/broker-list-order.test.ts @@ -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; diff --git a/packages/coding-agent/src/launch/broker-output-snapshot.test.ts b/packages/coding-agent/test/launch/broker-output-snapshot.test.ts similarity index 94% rename from packages/coding-agent/src/launch/broker-output-snapshot.test.ts rename to packages/coding-agent/test/launch/broker-output-snapshot.test.ts index 3616aa613..821b24f80 100644 --- a/packages/coding-agent/src/launch/broker-output-snapshot.test.ts +++ b/packages/coding-agent/test/launch/broker-output-snapshot.test.ts @@ -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]; diff --git a/packages/coding-agent/src/launch/protocol.test.ts b/packages/coding-agent/test/launch/protocol.test.ts similarity index 97% rename from packages/coding-agent/src/launch/protocol.test.ts rename to packages/coding-agent/test/launch/protocol.test.ts index b854ebf74..e0beb85a7 100644 --- a/packages/coding-agent/src/launch/protocol.test.ts +++ b/packages/coding-agent/test/launch/protocol.test.ts @@ -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 = { op: "logs", diff --git a/packages/coding-agent/src/launch/spawn-options.test.ts b/packages/coding-agent/test/launch/spawn-options.test.ts similarity index 91% rename from packages/coding-agent/src/launch/spawn-options.test.ts rename to packages/coding-agent/test/launch/spawn-options.test.ts index 31addece6..c8580c873 100644 --- a/packages/coding-agent/src/launch/spawn-options.test.ts +++ b/packages/coding-agent/test/launch/spawn-options.test.ts @@ -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", () => { diff --git a/packages/coding-agent/src/launch/terminal-output.test.ts b/packages/coding-agent/test/launch/terminal-output.test.ts similarity index 97% rename from packages/coding-agent/src/launch/terminal-output.test.ts rename to packages/coding-agent/test/launch/terminal-output.test.ts index 5bde84e75..b46aa66b0 100644 --- a/packages/coding-agent/src/launch/terminal-output.test.ts +++ b/packages/coding-agent/test/launch/terminal-output.test.ts @@ -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"; diff --git a/packages/coding-agent/src/live/protocol.test.ts b/packages/coding-agent/test/live/protocol.test.ts similarity index 99% rename from packages/coding-agent/src/live/protocol.test.ts rename to packages/coding-agent/test/live/protocol.test.ts index 2511de9a0..39575c015 100644 --- a/packages/coding-agent/src/live/protocol.test.ts +++ b/packages/coding-agent/test/live/protocol.test.ts @@ -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", () => { diff --git a/packages/coding-agent/src/mcp/config-writer.test.ts b/packages/coding-agent/test/mcp/config-writer.test.ts similarity index 96% rename from packages/coding-agent/src/mcp/config-writer.test.ts rename to packages/coding-agent/test/mcp/config-writer.test.ts index 330f73f27..e3df70695 100644 --- a/packages/coding-agent/src/mcp/config-writer.test.ts +++ b/packages/coding-agent/test/mcp/config-writer.test.ts @@ -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; diff --git a/packages/coding-agent/src/mcp/smithery-auth.test.ts b/packages/coding-agent/test/mcp/smithery-auth.test.ts similarity index 92% rename from packages/coding-agent/src/mcp/smithery-auth.test.ts rename to packages/coding-agent/test/mcp/smithery-auth.test.ts index ccee396b2..cb177fd1d 100644 --- a/packages/coding-agent/src/mcp/smithery-auth.test.ts +++ b/packages/coding-agent/test/mcp/smithery-auth.test.ts @@ -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; diff --git a/packages/coding-agent/src/mcp/smithery-registry.test.ts b/packages/coding-agent/test/mcp/smithery-registry.test.ts similarity index 95% rename from packages/coding-agent/src/mcp/smithery-registry.test.ts rename to packages/coding-agent/test/mcp/smithery-registry.test.ts index 2ac607157..693166d58 100644 --- a/packages/coding-agent/src/mcp/smithery-registry.test.ts +++ b/packages/coding-agent/test/mcp/smithery-registry.test.ts @@ -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; diff --git a/packages/coding-agent/src/mcp/transports/stdio.test.ts b/packages/coding-agent/test/mcp/transports/stdio.test.ts similarity index 99% rename from packages/coding-agent/src/mcp/transports/stdio.test.ts rename to packages/coding-agent/test/mcp/transports/stdio.test.ts index 9c2d60f86..5959076a4 100644 --- a/packages/coding-agent/src/mcp/transports/stdio.test.ts +++ b/packages/coding-agent/test/mcp/transports/stdio.test.ts @@ -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 () => { diff --git a/packages/coding-agent/src/modes/components/custom-editor-plugin-ctor.test.ts b/packages/coding-agent/test/modes/components/custom-editor-plugin-ctor.test.ts similarity index 90% rename from packages/coding-agent/src/modes/components/custom-editor-plugin-ctor.test.ts rename to packages/coding-agent/test/modes/components/custom-editor-plugin-ctor.test.ts index 6b92ef628..615e7d4f1 100644 --- a/packages/coding-agent/src/modes/components/custom-editor-plugin-ctor.test.ts +++ b/packages/coding-agent/test/modes/components/custom-editor-plugin-ctor.test.ts @@ -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 diff --git a/packages/coding-agent/src/modes/components/custom-editor.test.ts b/packages/coding-agent/test/modes/components/custom-editor.test.ts similarity index 98% rename from packages/coding-agent/src/modes/components/custom-editor.test.ts rename to packages/coding-agent/test/modes/components/custom-editor.test.ts index 94580291a..742031718 100644 --- a/packages/coding-agent/src/modes/components/custom-editor.test.ts +++ b/packages/coding-agent/test/modes/components/custom-editor.test.ts @@ -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 { - 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({}); diff --git a/packages/coding-agent/src/modes/components/__tests__/dynamic-border.test.ts b/packages/coding-agent/test/modes/components/dynamic-border.test.ts similarity index 89% rename from packages/coding-agent/src/modes/components/__tests__/dynamic-border.test.ts rename to packages/coding-agent/test/modes/components/dynamic-border.test.ts index 18d54c66a..e89534ae3 100644 --- a/packages/coding-agent/src/modes/components/__tests__/dynamic-border.test.ts +++ b/packages/coding-agent/test/modes/components/dynamic-border.test.ts @@ -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 diff --git a/packages/coding-agent/src/modes/components/login-dialog.test.ts b/packages/coding-agent/test/modes/components/login-dialog-manual-code.test.ts similarity index 93% rename from packages/coding-agent/src/modes/components/login-dialog.test.ts rename to packages/coding-agent/test/modes/components/login-dialog-manual-code.test.ts index ea2e36cb4..76d260995 100644 --- a/packages/coding-agent/src/modes/components/login-dialog.test.ts +++ b/packages/coding-agent/test/modes/components/login-dialog-manual-code.test.ts @@ -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 { diff --git a/packages/coding-agent/src/modes/components/__tests__/move-overlay.test.ts b/packages/coding-agent/test/modes/components/move-overlay.test.ts similarity index 97% rename from packages/coding-agent/src/modes/components/__tests__/move-overlay.test.ts rename to packages/coding-agent/test/modes/components/move-overlay.test.ts index eb5c19f1f..2771697ac 100644 --- a/packages/coding-agent/src/modes/components/__tests__/move-overlay.test.ts +++ b/packages/coding-agent/test/modes/components/move-overlay.test.ts @@ -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, ""); diff --git a/packages/coding-agent/src/modes/components/__tests__/pause-screen.test.ts b/packages/coding-agent/test/modes/components/pause-screen.test.ts similarity index 94% rename from packages/coding-agent/src/modes/components/__tests__/pause-screen.test.ts rename to packages/coding-agent/test/modes/components/pause-screen.test.ts index c8876c37c..36adc5c93 100644 --- a/packages/coding-agent/src/modes/components/__tests__/pause-screen.test.ts +++ b/packages/coding-agent/test/modes/components/pause-screen.test.ts @@ -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, ""); diff --git a/packages/coding-agent/src/modes/components/__tests__/skill-message.test.ts b/packages/coding-agent/test/modes/components/skill-message.test.ts similarity index 94% rename from packages/coding-agent/src/modes/components/__tests__/skill-message.test.ts rename to packages/coding-agent/test/modes/components/skill-message.test.ts index 57b5005e3..6a6fcecb1 100644 --- a/packages/coding-agent/src/modes/components/__tests__/skill-message.test.ts +++ b/packages/coding-agent/test/modes/components/skill-message.test.ts @@ -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 => diff --git a/packages/coding-agent/src/modes/components/status-line/component.jj-cache.test.ts b/packages/coding-agent/test/modes/components/status-line/component.jj-cache.test.ts similarity index 95% rename from packages/coding-agent/src/modes/components/status-line/component.jj-cache.test.ts rename to packages/coding-agent/test/modes/components/status-line/component.jj-cache.test.ts index 6d2d7a027..d4341c2fd 100644 --- a/packages/coding-agent/src/modes/components/status-line/component.jj-cache.test.ts +++ b/packages/coding-agent/test/modes/components/status-line/component.jj-cache.test.ts @@ -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. diff --git a/packages/coding-agent/src/modes/components/status-line/component.test.ts b/packages/coding-agent/test/modes/components/status-line/component.test.ts similarity index 92% rename from packages/coding-agent/src/modes/components/status-line/component.test.ts rename to packages/coding-agent/test/modes/components/status-line/component.test.ts index 070b852c3..a2f3392f9 100644 --- a/packages/coding-agent/src/modes/components/status-line/component.test.ts +++ b/packages/coding-agent/test/modes/components/status-line/component.test.ts @@ -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, diff --git a/packages/coding-agent/src/modes/components/tool-execution.test.ts b/packages/coding-agent/test/modes/components/tool-execution.test.ts similarity index 92% rename from packages/coding-agent/src/modes/components/tool-execution.test.ts rename to packages/coding-agent/test/modes/components/tool-execution.test.ts index 96079e540..c95fe2360 100644 --- a/packages/coding-agent/src/modes/components/tool-execution.test.ts +++ b/packages/coding-agent/test/modes/components/tool-execution.test.ts @@ -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[] { diff --git a/packages/coding-agent/src/modes/controllers/extension-ui-controller.test.ts b/packages/coding-agent/test/modes/controllers/extension-ui-controller.test.ts similarity index 94% rename from packages/coding-agent/src/modes/controllers/extension-ui-controller.test.ts rename to packages/coding-agent/test/modes/controllers/extension-ui-controller.test.ts index a66faa1f3..0576fedf8 100644 --- a/packages/coding-agent/src/modes/controllers/extension-ui-controller.test.ts +++ b/packages/coding-agent/test/modes/controllers/extension-ui-controller.test.ts @@ -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()); diff --git a/packages/coding-agent/src/modes/noninteractive-dispose.test.ts b/packages/coding-agent/test/modes/noninteractive-dispose.test.ts similarity index 92% rename from packages/coding-agent/src/modes/noninteractive-dispose.test.ts rename to packages/coding-agent/test/modes/noninteractive-dispose.test.ts index bc5c4ebe7..918ecb201 100644 --- a/packages/coding-agent/src/modes/noninteractive-dispose.test.ts +++ b/packages/coding-agent/test/modes/noninteractive-dispose.test.ts @@ -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 { diff --git a/packages/coding-agent/src/modes/print-mode.test.ts b/packages/coding-agent/test/modes/print-mode.test.ts similarity index 95% rename from packages/coding-agent/src/modes/print-mode.test.ts rename to packages/coding-agent/test/modes/print-mode.test.ts index 0a5242f22..141066534 100644 --- a/packages/coding-agent/src/modes/print-mode.test.ts +++ b/packages/coding-agent/test/modes/print-mode.test.ts @@ -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", diff --git a/packages/coding-agent/src/modes/session-teardown.test.ts b/packages/coding-agent/test/modes/session-teardown.test.ts similarity index 98% rename from packages/coding-agent/src/modes/session-teardown.test.ts rename to packages/coding-agent/test/modes/session-teardown.test.ts index 8c07235eb..cd8885088 100644 --- a/packages/coding-agent/src/modes/session-teardown.test.ts +++ b/packages/coding-agent/test/modes/session-teardown.test.ts @@ -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 diff --git a/packages/coding-agent/src/modes/theme/mermaid-rendering.test.ts b/packages/coding-agent/test/modes/theme/mermaid-rendering.test.ts similarity index 83% rename from packages/coding-agent/src/modes/theme/mermaid-rendering.test.ts rename to packages/coding-agent/test/modes/theme/mermaid-rendering.test.ts index 715b40844..373491bc7 100644 --- a/packages/coding-agent/src/modes/theme/mermaid-rendering.test.ts +++ b/packages/coding-agent/test/modes/theme/mermaid-rendering.test.ts @@ -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", diff --git a/packages/coding-agent/src/modes/utils/transcript-render-helpers.test.ts b/packages/coding-agent/test/modes/utils/transcript-render-helpers.test.ts similarity index 94% rename from packages/coding-agent/src/modes/utils/transcript-render-helpers.test.ts rename to packages/coding-agent/test/modes/utils/transcript-render-helpers.test.ts index 601f61678..18337996a 100644 --- a/packages/coding-agent/src/modes/utils/transcript-render-helpers.test.ts +++ b/packages/coding-agent/test/modes/utils/transcript-render-helpers.test.ts @@ -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 { return { diff --git a/packages/coding-agent/src/modes/warp-events.test.ts b/packages/coding-agent/test/modes/warp-events.test.ts similarity index 99% rename from packages/coding-agent/src/modes/warp-events.test.ts rename to packages/coding-agent/test/modes/warp-events.test.ts index 23e4923f6..df1eb824d 100644 --- a/packages/coding-agent/src/modes/warp-events.test.ts +++ b/packages/coding-agent/test/modes/warp-events.test.ts @@ -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; diff --git a/packages/coding-agent/src/plan-mode/approved-plan-prompt.test.ts b/packages/coding-agent/test/plan-mode/approved-plan-prompt.test.ts similarity index 77% rename from packages/coding-agent/src/plan-mode/approved-plan-prompt.test.ts rename to packages/coding-agent/test/plan-mode/approved-plan-prompt.test.ts index c76fa4341..2ffc82390 100644 --- a/packages/coding-agent/src/plan-mode/approved-plan-prompt.test.ts +++ b/packages/coding-agent/test/plan-mode/approved-plan-prompt.test.ts @@ -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"; diff --git a/packages/coding-agent/src/plan-mode/model-transition.test.ts b/packages/coding-agent/test/plan-mode/model-transition.test.ts similarity index 92% rename from packages/coding-agent/src/plan-mode/model-transition.test.ts rename to packages/coding-agent/test/plan-mode/model-transition.test.ts index 3a888174c..a08485d2c 100644 --- a/packages/coding-agent/src/plan-mode/model-transition.test.ts +++ b/packages/coding-agent/test/plan-mode/model-transition.test.ts @@ -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 diff --git a/packages/coding-agent/src/plan-mode/reentry-prompt.test.ts b/packages/coding-agent/test/plan-mode/reentry-prompt.test.ts similarity index 94% rename from packages/coding-agent/src/plan-mode/reentry-prompt.test.ts rename to packages/coding-agent/test/plan-mode/reentry-prompt.test.ts index 2566c799e..925e99f09 100644 --- a/packages/coding-agent/src/plan-mode/reentry-prompt.test.ts +++ b/packages/coding-agent/test/plan-mode/reentry-prompt.test.ts @@ -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", diff --git a/packages/coding-agent/src/session/agent-session-error-log.test.ts b/packages/coding-agent/test/session/agent-session-error-log.test.ts similarity index 96% rename from packages/coding-agent/src/session/agent-session-error-log.test.ts rename to packages/coding-agent/test/session/agent-session-error-log.test.ts index 6a5c42716..c473f31a0 100644 --- a/packages/coding-agent/src/session/agent-session-error-log.test.ts +++ b/packages/coding-agent/test/session/agent-session-error-log.test.ts @@ -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 { return { diff --git a/packages/coding-agent/src/session/blob-store.test.ts b/packages/coding-agent/test/session/blob-store-ref-validation.test.ts similarity index 93% rename from packages/coding-agent/src/session/blob-store.test.ts rename to packages/coding-agent/test/session/blob-store-ref-validation.test.ts index 78109c36e..353c48684 100644 --- a/packages/coding-agent/src/session/blob-store.test.ts +++ b/packages/coding-agent/test/session/blob-store-ref-validation.test.ts @@ -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"); diff --git a/packages/coding-agent/src/session/messages.test.ts b/packages/coding-agent/test/session/messages.test.ts similarity index 99% rename from packages/coding-agent/src/session/messages.test.ts rename to packages/coding-agent/test/session/messages.test.ts index 5d6680047..b2b14b63c 100644 --- a/packages/coding-agent/src/session/messages.test.ts +++ b/packages/coding-agent/test/session/messages.test.ts @@ -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 { return { diff --git a/packages/coding-agent/src/session/session-context.test.ts b/packages/coding-agent/test/session/session-context.test.ts similarity index 98% rename from packages/coding-agent/src/session/session-context.test.ts rename to packages/coding-agent/test/session/session-context.test.ts index d03d6c1c2..58698fce7 100644 --- a/packages/coding-agent/src/session/session-context.test.ts +++ b/packages/coding-agent/test/session/session-context.test.ts @@ -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"; diff --git a/packages/coding-agent/src/ssh/__tests__/connection-manager-args.test.ts b/packages/coding-agent/test/ssh/connection-manager-args.test.ts similarity index 98% rename from packages/coding-agent/src/ssh/__tests__/connection-manager-args.test.ts rename to packages/coding-agent/test/ssh/connection-manager-args.test.ts index b12f080a6..b8d49d376 100644 --- a/packages/coding-agent/src/ssh/__tests__/connection-manager-args.test.ts +++ b/packages/coding-agent/test/ssh/connection-manager-args.test.ts @@ -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" }; diff --git a/packages/coding-agent/src/ssh/__tests__/connection-manager-timeout.test.ts b/packages/coding-agent/test/ssh/connection-manager-timeout.test.ts similarity index 97% rename from packages/coding-agent/src/ssh/__tests__/connection-manager-timeout.test.ts rename to packages/coding-agent/test/ssh/connection-manager-timeout.test.ts index 37f343519..4e6bb6d4c 100644 --- a/packages/coding-agent/src/ssh/__tests__/connection-manager-timeout.test.ts +++ b/packages/coding-agent/test/ssh/connection-manager-timeout.test.ts @@ -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; diff --git a/packages/coding-agent/src/ssh/__tests__/file-transfer-posix-guard.test.ts b/packages/coding-agent/test/ssh/file-transfer-posix-guard.test.ts similarity index 96% rename from packages/coding-agent/src/ssh/__tests__/file-transfer-posix-guard.test.ts rename to packages/coding-agent/test/ssh/file-transfer-posix-guard.test.ts index f0dbd8e7e..6c07650c0 100644 --- a/packages/coding-agent/src/ssh/__tests__/file-transfer-posix-guard.test.ts +++ b/packages/coding-agent/test/ssh/file-transfer-posix-guard.test.ts @@ -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(() => { diff --git a/packages/coding-agent/src/ssh/__tests__/sshfs-mount.test.ts b/packages/coding-agent/test/ssh/sshfs-mount.test.ts similarity index 89% rename from packages/coding-agent/src/ssh/__tests__/sshfs-mount.test.ts rename to packages/coding-agent/test/ssh/sshfs-mount.test.ts index a9c6f778e..56084a228 100644 --- a/packages/coding-agent/src/ssh/__tests__/sshfs-mount.test.ts +++ b/packages/coding-agent/test/ssh/sshfs-mount.test.ts @@ -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 () => { diff --git a/packages/coding-agent/src/system-prompt.test.ts b/packages/coding-agent/test/system-prompt.test.ts similarity index 98% rename from packages/coding-agent/src/system-prompt.test.ts rename to packages/coding-agent/test/system-prompt.test.ts index 14b818345..46daae478 100644 --- a/packages/coding-agent/src/system-prompt.test.ts +++ b/packages/coding-agent/test/system-prompt.test.ts @@ -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 = { diff --git a/packages/coding-agent/src/task/render.test.ts b/packages/coding-agent/test/task/render.test.ts similarity index 97% rename from packages/coding-agent/src/task/render.test.ts rename to packages/coding-agent/test/task/render.test.ts index 2dcfa2e92..a760c935d 100644 --- a/packages/coding-agent/src/task/render.test.ts +++ b/packages/coding-agent/test/task/render.test.ts @@ -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 diff --git a/packages/coding-agent/src/task/spawn-policy.test.ts b/packages/coding-agent/test/task/spawn-policy.test.ts similarity index 82% rename from packages/coding-agent/src/task/spawn-policy.test.ts rename to packages/coding-agent/test/task/spawn-policy.test.ts index 7a647b43c..5c8399b15 100644 --- a/packages/coding-agent/src/task/spawn-policy.test.ts +++ b/packages/coding-agent/test/task/spawn-policy.test.ts @@ -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", diff --git a/packages/coding-agent/src/tools/__tests__/eval-description.test.ts b/packages/coding-agent/test/tools/eval-description-spawn-default.test.ts similarity index 91% rename from packages/coding-agent/src/tools/__tests__/eval-description.test.ts rename to packages/coding-agent/test/tools/eval-description-spawn-default.test.ts index d62140cb1..37fa00601 100644 --- a/packages/coding-agent/src/tools/__tests__/eval-description.test.ts +++ b/packages/coding-agent/test/tools/eval-description-spawn-default.test.ts @@ -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", () => { diff --git a/packages/coding-agent/src/tools/__tests__/glob.test.ts b/packages/coding-agent/test/tools/glob.test.ts similarity index 81% rename from packages/coding-agent/src/tools/__tests__/glob.test.ts rename to packages/coding-agent/test/tools/glob.test.ts index dbec83a0a..2e402d155 100644 --- a/packages/coding-agent/src/tools/__tests__/glob.test.ts +++ b/packages/coding-agent/test/tools/glob.test.ts @@ -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"; diff --git a/packages/coding-agent/src/tools/hub/launch-compat.test.ts b/packages/coding-agent/test/tools/hub/launch-compat.test.ts similarity index 74% rename from packages/coding-agent/src/tools/hub/launch-compat.test.ts rename to packages/coding-agent/test/tools/hub/launch-compat.test.ts index 5d91c84ca..832e1d1ef 100644 --- a/packages/coding-agent/src/tools/hub/launch-compat.test.ts +++ b/packages/coding-agent/test/tools/hub/launch-compat.test.ts @@ -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(); diff --git a/packages/coding-agent/src/tools/__tests__/json-tree.test.ts b/packages/coding-agent/test/tools/json-tree.test.ts similarity index 96% rename from packages/coding-agent/src/tools/__tests__/json-tree.test.ts rename to packages/coding-agent/test/tools/json-tree.test.ts index 1d0c1e4bc..4d14bb5cf 100644 --- a/packages/coding-agent/src/tools/__tests__/json-tree.test.ts +++ b/packages/coding-agent/test/tools/json-tree.test.ts @@ -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", () => { diff --git a/packages/coding-agent/src/tools/__tests__/vibe-render.test.ts b/packages/coding-agent/test/tools/vibe-render.test.ts similarity index 97% rename from packages/coding-agent/src/tools/__tests__/vibe-render.test.ts rename to packages/coding-agent/test/tools/vibe-render.test.ts index 9794ec0eb..51e036c87 100644 --- a/packages/coding-agent/src/tools/__tests__/vibe-render.test.ts +++ b/packages/coding-agent/test/tools/vibe-render.test.ts @@ -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, "")); diff --git a/packages/coding-agent/src/vibe/__tests__/token-rate.test.ts b/packages/coding-agent/test/vibe/token-rate.test.ts similarity index 95% rename from packages/coding-agent/src/vibe/__tests__/token-rate.test.ts rename to packages/coding-agent/test/vibe/token-rate.test.ts index b17313855..83a58173a 100644 --- a/packages/coding-agent/src/vibe/__tests__/token-rate.test.ts +++ b/packages/coding-agent/test/vibe/token-rate.test.ts @@ -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"; diff --git a/packages/metaharness/src/benchmarks.test.ts b/packages/metaharness/test/benchmarks.test.ts similarity index 96% rename from packages/metaharness/src/benchmarks.test.ts rename to packages/metaharness/test/benchmarks.test.ts index d7a00018a..1c13825e7 100644 --- a/packages/metaharness/src/benchmarks.test.ts +++ b/packages/metaharness/test/benchmarks.test.ts @@ -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[] = []; diff --git a/packages/metaharness/src/experiments.test.ts b/packages/metaharness/test/experiments.test.ts similarity index 98% rename from packages/metaharness/src/experiments.test.ts rename to packages/metaharness/test/experiments.test.ts index 053f068cc..8f1aba003 100644 --- a/packages/metaharness/src/experiments.test.ts +++ b/packages/metaharness/test/experiments.test.ts @@ -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: diff --git a/packages/metaharness/src/manager.test.ts b/packages/metaharness/test/manager.test.ts similarity index 99% rename from packages/metaharness/src/manager.test.ts rename to packages/metaharness/test/manager.test.ts index 70044461e..623fe2dd7 100644 --- a/packages/metaharness/src/manager.test.ts +++ b/packages/metaharness/test/manager.test.ts @@ -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: diff --git a/packages/metaharness/src/runner.test.ts b/packages/metaharness/test/runner.test.ts similarity index 99% rename from packages/metaharness/src/runner.test.ts rename to packages/metaharness/test/runner.test.ts index 4194a8da2..d8e03e030 100644 --- a/packages/metaharness/src/runner.test.ts +++ b/packages/metaharness/test/runner.test.ts @@ -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", () => { diff --git a/packages/swarm-extension/src/swarm/__tests__/executor.test.ts b/packages/swarm-extension/test/swarm/executor.test.ts similarity index 93% rename from packages/swarm-extension/src/swarm/__tests__/executor.test.ts rename to packages/swarm-extension/test/swarm/executor.test.ts index c848b5219..dc7782d7c 100644 --- a/packages/swarm-extension/src/swarm/__tests__/executor.test.ts +++ b/packages/swarm-extension/test/swarm/executor.test.ts @@ -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, diff --git a/scripts/ci-test-ts.ts b/scripts/ci-test-ts.ts index b44a2f433..dda6c0dd3 100755 --- a/scripts/ci-test-ts.ts +++ b/scripts/ci-test-ts.ts @@ -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 { 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: [],