From 09941fe36aefd34c3581f02fe533b64ec8f2c354 Mon Sep 17 00:00:00 2001 From: Sawyer Cutler Date: Wed, 19 Aug 2026 01:05:47 -0700 Subject: [PATCH] Move external adapters under the adapters layer Relocate provider, auth, cost, telemetry, perf, logging, upgrade, changelog, crash, and inference helpers under src/adapters/. Colocate list-dir.test.ts with its module under src/util/. Import path updates only; no behavior change. Linear CL-6301. --- scripts/perf-report.ts | 4 +- src/{ => adapters}/auth/callback-page.test.ts | 2 +- src/{ => adapters}/auth/callback-page.ts | 2 +- .../auth/codex/callback-server.ts | 0 src/{ => adapters}/auth/codex/constants.ts | 0 src/{ => adapters}/auth/codex/index.ts | 0 src/{ => adapters}/auth/codex/instructions.ts | 2 +- src/{ => adapters}/auth/codex/login.ts | 0 src/{ => adapters}/auth/codex/oauth.ts | 0 src/{ => adapters}/auth/codex/pkce.ts | 0 .../auth/codex/prompts/gpt-5-codex.ts | 0 src/{ => adapters}/auth/codex/session.ts | 0 src/{ => adapters}/auth/codex/store.ts | 0 .../auth/codex/usage-limit-error.test.ts | 0 .../auth/codex/usage-limit-error.ts | 0 src/{ => adapters}/auth/codex/usage.ts | 2 +- src/{ => adapters}/auth/oauth/browser.ts | 0 .../auth/oauth/callback-server.ts | 0 src/{ => adapters}/auth/oauth/client.ts | 0 src/{ => adapters}/auth/oauth/index.ts | 0 src/{ => adapters}/auth/oauth/login.ts | 0 src/{ => adapters}/auth/oauth/oauth.test.ts | 0 src/{ => adapters}/auth/oauth/pkce.ts | 0 src/{ => adapters}/auth/oauth/session.ts | 0 src/{ => adapters}/auth/oauth/store.ts | 2 +- .../auth/xai/callback-server.test.ts | 0 .../auth/xai/callback-server.ts | 0 src/{ => adapters}/auth/xai/constants.ts | 0 src/{ => adapters}/auth/xai/index.ts | 0 src/{ => adapters}/auth/xai/login.ts | 0 src/{ => adapters}/auth/xai/oauth.test.ts | 0 src/{ => adapters}/auth/xai/oauth.ts | 0 src/{ => adapters}/auth/xai/pkce.ts | 0 src/{ => adapters}/auth/xai/session.ts | 0 src/{ => adapters}/auth/xai/store.ts | 0 src/{ => adapters}/auth/xai/usage.ts | 0 src/{ => adapters}/changelog/index.test.ts | 0 src/{ => adapters}/changelog/index.ts | 0 src/{ => adapters}/cost/cost-summary.test.ts | 0 src/{ => adapters}/cost/cost-summary.ts | 0 .../cost/cost-visibility.test.ts | 0 src/{ => adapters}/cost/cost-visibility.ts | 0 src/{ => adapters}/cost/faremeter.ts | 0 .../cost}/pricing-fetcher.test.ts | 2 +- src/{ => adapters}/cost/pricing-fetcher.ts | 2 +- .../cost}/pricing-metadata.test.ts | 10 ++--- src/{ => adapters}/cost/pricing-metadata.ts | 0 src/{ => adapters}/crash/report.test.ts | 2 +- src/{ => adapters}/crash/report.ts | 4 +- src/{ => adapters}/inference-abort.test.ts | 0 src/{ => adapters}/inference-abort.ts | 0 .../inference-error-message.test.ts | 0 src/{ => adapters}/inference-error-message.ts | 2 +- .../inference-gateway-error.test.ts | 0 src/{ => adapters}/inference-gateway-error.ts | 4 +- src/{ => adapters}/logging/sink.test.ts | 0 src/{ => adapters}/logging/sink.ts | 2 +- src/{ => adapters}/perf/active-turn.ts | 0 src/{ => adapters}/perf/assert-spans.test.ts | 0 src/{ => adapters}/perf/assert-spans.ts | 0 .../perf/attribution-report.test.ts | 0 src/{ => adapters}/perf/attribution-report.ts | 0 src/{ => adapters}/perf/dump.ts | 0 .../perf/fixtures/multi-tool-turn.ts | 0 src/{ => adapters}/perf/index.test.ts | 0 src/{ => adapters}/perf/index.ts | 2 +- src/{ => adapters}/perf/otel-config.test.ts | 2 +- src/{ => adapters}/perf/otel-config.ts | 2 +- src/{ => adapters}/perf/otel-sink.test.ts | 2 +- src/{ => adapters}/perf/otel-sink.ts | 4 +- .../perf/permission-subagent-spans.test.ts | 4 +- src/{ => adapters}/perf/reactor-spans.test.ts | 2 +- src/{ => adapters}/perf/reactor-spans.ts | 2 +- src/{ => adapters}/perf/rollup.test.ts | 0 src/{ => adapters}/perf/rollup.ts | 0 src/{ => adapters}/perf/sanitize.ts | 0 .../provider/bifrost-adapter.test.ts | 0 .../provider/bifrost-adapter.ts | 0 .../provider/billing-product.test.ts | 0 .../provider/billing-product.ts | 2 +- .../provider/codex-responses-adapter.test.ts | 0 .../provider/codex-responses-adapter.ts | 2 +- .../provider/context-window.test.ts | 0 src/{ => adapters}/provider/context-window.ts | 0 .../provider/grok-responses-adapter.test.ts | 0 .../provider/grok-responses-adapter.ts | 0 .../provider/inference-dependencies.ts | 0 .../provider/models-endpoint.ts | 2 +- .../openai-compatible-adapter.test.ts | 0 .../provider/openai-compatible-adapter.ts | 0 .../provider/openai-responses-adapter.ts | 0 .../provider/reasoning-effort.test.ts | 0 .../provider/reasoning-effort.ts | 2 +- .../provider/validate-connection.test.ts | 0 .../provider/validate-connection.ts | 0 .../telemetry/ai-observability.test.ts | 2 +- .../telemetry/ai-observability.ts | 2 +- src/{ => adapters}/telemetry/classify.ts | 2 +- src/{ => adapters}/telemetry/feedback.test.ts | 0 src/{ => adapters}/telemetry/feedback.ts | 0 src/{ => adapters}/telemetry/first-run.ts | 4 +- src/{ => adapters}/telemetry/index.ts | 6 +-- .../telemetry/product-events.ts | 0 src/{ => adapters}/telemetry/singleton.ts | 0 src/{ => adapters}/telemetry/toggle.ts | 4 +- src/{ => adapters}/upgrade/index.test.ts | 0 src/{ => adapters}/upgrade/index.ts | 4 +- src/agent/compaction.test.ts | 2 +- src/agent/compaction.ts | 2 +- src/agent/director.ts | 2 +- src/agent/renderer.ts | 6 +-- src/agent/retry-policy.ts | 2 +- src/agent/tools.ts | 2 +- src/agent/use-skill.ts | 2 +- src/config/bifrost.ts | 2 +- src/config/codex-providers.ts | 4 +- src/config/index.ts | 24 +++++------ src/config/inference-sources.ts | 2 +- src/config/oauth-providers.test.ts | 4 +- src/config/settings.ts | 2 +- src/config/xai-providers.test.ts | 4 +- src/config/xai-providers.ts | 4 +- src/director.test.ts | 2 +- src/exec/runner.ts | 12 +++--- src/index.ts | 12 +++--- src/mcp/callback-server.ts | 2 +- src/permission/gate.ts | 8 ++-- src/plugins/loader.ts | 2 +- src/session/run-sink.ts | 2 +- src/session/runtime-assembly.ts | 4 +- src/subagent/index.test.ts | 2 +- src/subagent/inference-auth-failure.test.ts | 4 +- src/subagent/inference-auth-failure.ts | 4 +- src/subagent/provider-family.ts | 2 +- src/subagent/refresh-inference-source.test.ts | 4 +- src/subagent/refresh-inference-source.ts | 4 +- src/subagent/run.ts | 8 ++-- src/subagent/task-tool.ts | 10 ++--- src/subagent/types.ts | 2 +- src/tui/commands/built-in.test.ts | 2 +- src/tui/commands/built-in.ts | 6 +-- src/tui/commands/registry.ts | 2 +- src/tui/log-sink.test.ts | 2 +- src/tui/model-catalog.ts | 10 ++--- src/tui/onboarding.ts | 2 +- src/tui/prompt-border.ts | 2 +- src/tui/provider-setup-submit.ts | 2 +- src/tui/provider-setup.ts | 14 +++---- src/tui/runner-host.test.ts | 2 +- src/tui/runner-host.ts | 2 +- src/tui/runner.ts | 42 +++++++++---------- src/tui/session-chrome.ts | 2 +- src/tui/stream-event-map.ts | 2 +- src/tui/submit-handler.test.ts | 4 +- src/{ => util}/list-dir.test.ts | 2 +- tests/unit/codex-auth.test.ts | 8 ++-- tests/unit/codex-callback-server.test.ts | 4 +- tests/unit/codex-instructions.test.ts | 4 +- tests/unit/codex-providers.test.ts | 4 +- tests/unit/codex-responses-adapter.test.ts | 4 +- tests/unit/codex-session.test.ts | 4 +- tests/unit/codex-sse-fixtures.test.ts | 2 +- tests/unit/codex-usage.test.ts | 2 +- tests/unit/config.test.ts | 2 +- tests/unit/context-window.test.ts | 2 +- tests/unit/faremeter.test.ts | 2 +- tests/unit/grok-responses-adapter.test.ts | 2 +- tests/unit/index.test.ts | 2 +- tests/unit/inference-abort.test.ts | 2 +- tests/unit/inference-response-kind.test.ts | 8 ++-- tests/unit/pricing-fetcher.test.ts | 2 +- tests/unit/telemetry-first-run.test.ts | 4 +- tests/unit/telemetry-product-events.test.ts | 6 +-- tests/unit/telemetry-singleton.test.ts | 4 +- tests/unit/telemetry-toggle.test.ts | 6 +-- tests/unit/telemetry.test.ts | 2 +- tests/unit/xai-usage.test.ts | 2 +- 177 files changed, 209 insertions(+), 209 deletions(-) rename src/{ => adapters}/auth/callback-page.test.ts (99%) rename src/{ => adapters}/auth/callback-page.ts (99%) rename src/{ => adapters}/auth/codex/callback-server.ts (100%) rename src/{ => adapters}/auth/codex/constants.ts (100%) rename src/{ => adapters}/auth/codex/index.ts (100%) rename src/{ => adapters}/auth/codex/instructions.ts (97%) rename src/{ => adapters}/auth/codex/login.ts (100%) rename src/{ => adapters}/auth/codex/oauth.ts (100%) rename src/{ => adapters}/auth/codex/pkce.ts (100%) rename src/{ => adapters}/auth/codex/prompts/gpt-5-codex.ts (100%) rename src/{ => adapters}/auth/codex/session.ts (100%) rename src/{ => adapters}/auth/codex/store.ts (100%) rename src/{ => adapters}/auth/codex/usage-limit-error.test.ts (100%) rename src/{ => adapters}/auth/codex/usage-limit-error.ts (100%) rename src/{ => adapters}/auth/codex/usage.ts (99%) rename src/{ => adapters}/auth/oauth/browser.ts (100%) rename src/{ => adapters}/auth/oauth/callback-server.ts (100%) rename src/{ => adapters}/auth/oauth/client.ts (100%) rename src/{ => adapters}/auth/oauth/index.ts (100%) rename src/{ => adapters}/auth/oauth/login.ts (100%) rename src/{ => adapters}/auth/oauth/oauth.test.ts (100%) rename src/{ => adapters}/auth/oauth/pkce.ts (100%) rename src/{ => adapters}/auth/oauth/session.ts (100%) rename src/{ => adapters}/auth/oauth/store.ts (98%) rename src/{ => adapters}/auth/xai/callback-server.test.ts (100%) rename src/{ => adapters}/auth/xai/callback-server.ts (100%) rename src/{ => adapters}/auth/xai/constants.ts (100%) rename src/{ => adapters}/auth/xai/index.ts (100%) rename src/{ => adapters}/auth/xai/login.ts (100%) rename src/{ => adapters}/auth/xai/oauth.test.ts (100%) rename src/{ => adapters}/auth/xai/oauth.ts (100%) rename src/{ => adapters}/auth/xai/pkce.ts (100%) rename src/{ => adapters}/auth/xai/session.ts (100%) rename src/{ => adapters}/auth/xai/store.ts (100%) rename src/{ => adapters}/auth/xai/usage.ts (100%) rename src/{ => adapters}/changelog/index.test.ts (100%) rename src/{ => adapters}/changelog/index.ts (100%) rename src/{ => adapters}/cost/cost-summary.test.ts (100%) rename src/{ => adapters}/cost/cost-summary.ts (100%) rename src/{ => adapters}/cost/cost-visibility.test.ts (100%) rename src/{ => adapters}/cost/cost-visibility.ts (100%) rename src/{ => adapters}/cost/faremeter.ts (100%) rename src/{ => adapters/cost}/pricing-fetcher.test.ts (99%) rename src/{ => adapters}/cost/pricing-fetcher.ts (99%) rename src/{ => adapters/cost}/pricing-metadata.test.ts (89%) rename src/{ => adapters}/cost/pricing-metadata.ts (100%) rename src/{ => adapters}/crash/report.test.ts (97%) rename src/{ => adapters}/crash/report.ts (94%) rename src/{ => adapters}/inference-abort.test.ts (100%) rename src/{ => adapters}/inference-abort.ts (100%) rename src/{ => adapters}/inference-error-message.test.ts (100%) rename src/{ => adapters}/inference-error-message.ts (99%) rename src/{ => adapters}/inference-gateway-error.test.ts (100%) rename src/{ => adapters}/inference-gateway-error.ts (99%) rename src/{ => adapters}/logging/sink.test.ts (100%) rename src/{ => adapters}/logging/sink.ts (97%) rename src/{ => adapters}/perf/active-turn.ts (100%) rename src/{ => adapters}/perf/assert-spans.test.ts (100%) rename src/{ => adapters}/perf/assert-spans.ts (100%) rename src/{ => adapters}/perf/attribution-report.test.ts (100%) rename src/{ => adapters}/perf/attribution-report.ts (100%) rename src/{ => adapters}/perf/dump.ts (100%) rename src/{ => adapters}/perf/fixtures/multi-tool-turn.ts (100%) rename src/{ => adapters}/perf/index.test.ts (100%) rename src/{ => adapters}/perf/index.ts (99%) rename src/{ => adapters}/perf/otel-config.test.ts (99%) rename src/{ => adapters}/perf/otel-config.ts (99%) rename src/{ => adapters}/perf/otel-sink.test.ts (99%) rename src/{ => adapters}/perf/otel-sink.ts (98%) rename src/{ => adapters}/perf/permission-subagent-spans.test.ts (98%) rename src/{ => adapters}/perf/reactor-spans.test.ts (99%) rename src/{ => adapters}/perf/reactor-spans.ts (99%) rename src/{ => adapters}/perf/rollup.test.ts (100%) rename src/{ => adapters}/perf/rollup.ts (100%) rename src/{ => adapters}/perf/sanitize.ts (100%) rename src/{ => adapters}/provider/bifrost-adapter.test.ts (100%) rename src/{ => adapters}/provider/bifrost-adapter.ts (100%) rename src/{ => adapters}/provider/billing-product.test.ts (100%) rename src/{ => adapters}/provider/billing-product.ts (97%) rename src/{ => adapters}/provider/codex-responses-adapter.test.ts (100%) rename src/{ => adapters}/provider/codex-responses-adapter.ts (99%) rename src/{ => adapters}/provider/context-window.test.ts (100%) rename src/{ => adapters}/provider/context-window.ts (100%) rename src/{ => adapters}/provider/grok-responses-adapter.test.ts (100%) rename src/{ => adapters}/provider/grok-responses-adapter.ts (100%) rename src/{ => adapters}/provider/inference-dependencies.ts (100%) rename src/{ => adapters}/provider/models-endpoint.ts (90%) rename src/{ => adapters}/provider/openai-compatible-adapter.test.ts (100%) rename src/{ => adapters}/provider/openai-compatible-adapter.ts (100%) rename src/{ => adapters}/provider/openai-responses-adapter.ts (100%) rename src/{ => adapters}/provider/reasoning-effort.test.ts (100%) rename src/{ => adapters}/provider/reasoning-effort.ts (99%) rename src/{ => adapters}/provider/validate-connection.test.ts (100%) rename src/{ => adapters}/provider/validate-connection.ts (100%) rename src/{ => adapters}/telemetry/ai-observability.test.ts (99%) rename src/{ => adapters}/telemetry/ai-observability.ts (99%) rename src/{ => adapters}/telemetry/classify.ts (98%) rename src/{ => adapters}/telemetry/feedback.test.ts (100%) rename src/{ => adapters}/telemetry/feedback.ts (100%) rename src/{ => adapters}/telemetry/first-run.ts (97%) rename src/{ => adapters}/telemetry/index.ts (99%) rename src/{ => adapters}/telemetry/product-events.ts (100%) rename src/{ => adapters}/telemetry/singleton.ts (100%) rename src/{ => adapters}/telemetry/toggle.ts (98%) rename src/{ => adapters}/upgrade/index.test.ts (100%) rename src/{ => adapters}/upgrade/index.ts (98%) rename src/{ => util}/list-dir.test.ts (98%) diff --git a/scripts/perf-report.ts b/scripts/perf-report.ts index a9b670d6f..c6e65bdec 100644 --- a/scripts/perf-report.ts +++ b/scripts/perf-report.ts @@ -19,8 +19,8 @@ import { attributionFromSpans, formatAttributionReport, type AttributionReport, -} from "../src/perf/attribution-report.js"; -import { multiToolTurnFixture } from "../src/perf/fixtures/multi-tool-turn.js"; +} from "../src/adapters/perf/attribution-report.js"; +import { multiToolTurnFixture } from "../src/adapters/perf/fixtures/multi-tool-turn.js"; function printUsage(): void { console.error(`Usage: diff --git a/src/auth/callback-page.test.ts b/src/adapters/auth/callback-page.test.ts similarity index 99% rename from src/auth/callback-page.test.ts rename to src/adapters/auth/callback-page.test.ts index 15f68b1f3..972496b5e 100644 --- a/src/auth/callback-page.test.ts +++ b/src/adapters/auth/callback-page.test.ts @@ -5,7 +5,7 @@ import { PRODUCT_GITHUB_URL, PRODUCT_SITE_LABEL, PRODUCT_SITE_URL, -} from "../branding.js"; +} from "../../branding.js"; import { callbackPageHtml, humanizeIdentifier } from "./callback-page.js"; describe("humanizeIdentifier", () => { diff --git a/src/auth/callback-page.ts b/src/adapters/auth/callback-page.ts similarity index 99% rename from src/auth/callback-page.ts rename to src/adapters/auth/callback-page.ts index 2902fe4e4..a816ab539 100644 --- a/src/auth/callback-page.ts +++ b/src/adapters/auth/callback-page.ts @@ -20,7 +20,7 @@ import { PRODUCT_NAME, PRODUCT_SITE_LABEL, PRODUCT_SITE_URL, -} from "../branding.js"; +} from "../../branding.js"; /** Corbits wordmark, background layers stripped so it inherits `currentColor`. */ const WORDMARK = ` `; diff --git a/src/auth/codex/callback-server.ts b/src/adapters/auth/codex/callback-server.ts similarity index 100% rename from src/auth/codex/callback-server.ts rename to src/adapters/auth/codex/callback-server.ts diff --git a/src/auth/codex/constants.ts b/src/adapters/auth/codex/constants.ts similarity index 100% rename from src/auth/codex/constants.ts rename to src/adapters/auth/codex/constants.ts diff --git a/src/auth/codex/index.ts b/src/adapters/auth/codex/index.ts similarity index 100% rename from src/auth/codex/index.ts rename to src/adapters/auth/codex/index.ts diff --git a/src/auth/codex/instructions.ts b/src/adapters/auth/codex/instructions.ts similarity index 97% rename from src/auth/codex/instructions.ts rename to src/adapters/auth/codex/instructions.ts index 2b8f385e3..cc07d01e0 100644 --- a/src/auth/codex/instructions.ts +++ b/src/adapters/auth/codex/instructions.ts @@ -2,7 +2,7 @@ import { readFileSync, writeFileSync, mkdirSync } from "node:fs"; import { homedir } from "node:os"; import { join } from "node:path"; import { GPT_5_CODEX_PROMPT } from "./prompts/gpt-5-codex.js"; -import { SETTINGS_DIR_NAME } from "../../branding.js"; +import { SETTINGS_DIR_NAME } from "../../../branding.js"; // The Codex backend pins the Responses `instructions` field to the official // prompt and 400s on anything else, so a stale bundled copy breaks once the diff --git a/src/auth/codex/login.ts b/src/adapters/auth/codex/login.ts similarity index 100% rename from src/auth/codex/login.ts rename to src/adapters/auth/codex/login.ts diff --git a/src/auth/codex/oauth.ts b/src/adapters/auth/codex/oauth.ts similarity index 100% rename from src/auth/codex/oauth.ts rename to src/adapters/auth/codex/oauth.ts diff --git a/src/auth/codex/pkce.ts b/src/adapters/auth/codex/pkce.ts similarity index 100% rename from src/auth/codex/pkce.ts rename to src/adapters/auth/codex/pkce.ts diff --git a/src/auth/codex/prompts/gpt-5-codex.ts b/src/adapters/auth/codex/prompts/gpt-5-codex.ts similarity index 100% rename from src/auth/codex/prompts/gpt-5-codex.ts rename to src/adapters/auth/codex/prompts/gpt-5-codex.ts diff --git a/src/auth/codex/session.ts b/src/adapters/auth/codex/session.ts similarity index 100% rename from src/auth/codex/session.ts rename to src/adapters/auth/codex/session.ts diff --git a/src/auth/codex/store.ts b/src/adapters/auth/codex/store.ts similarity index 100% rename from src/auth/codex/store.ts rename to src/adapters/auth/codex/store.ts diff --git a/src/auth/codex/usage-limit-error.test.ts b/src/adapters/auth/codex/usage-limit-error.test.ts similarity index 100% rename from src/auth/codex/usage-limit-error.test.ts rename to src/adapters/auth/codex/usage-limit-error.test.ts diff --git a/src/auth/codex/usage-limit-error.ts b/src/adapters/auth/codex/usage-limit-error.ts similarity index 100% rename from src/auth/codex/usage-limit-error.ts rename to src/adapters/auth/codex/usage-limit-error.ts diff --git a/src/auth/codex/usage.ts b/src/adapters/auth/codex/usage.ts similarity index 99% rename from src/auth/codex/usage.ts rename to src/adapters/auth/codex/usage.ts index 722b3450f..e62c0fd62 100644 --- a/src/auth/codex/usage.ts +++ b/src/adapters/auth/codex/usage.ts @@ -6,7 +6,7 @@ import { CODEX_AUTHORIZE_EXTRA_PARAMS, } from "./constants.js"; import { getValidCodexToken } from "./session.js"; -import { COMMAND_NAME } from "../../branding.js"; +import { COMMAND_NAME } from "../../../branding.js"; // Live usage/quota for a prepaid Codex plan. Since the subscription is not // billed per token, dollar cost is meaningless — what matters is how much of diff --git a/src/auth/oauth/browser.ts b/src/adapters/auth/oauth/browser.ts similarity index 100% rename from src/auth/oauth/browser.ts rename to src/adapters/auth/oauth/browser.ts diff --git a/src/auth/oauth/callback-server.ts b/src/adapters/auth/oauth/callback-server.ts similarity index 100% rename from src/auth/oauth/callback-server.ts rename to src/adapters/auth/oauth/callback-server.ts diff --git a/src/auth/oauth/client.ts b/src/adapters/auth/oauth/client.ts similarity index 100% rename from src/auth/oauth/client.ts rename to src/adapters/auth/oauth/client.ts diff --git a/src/auth/oauth/index.ts b/src/adapters/auth/oauth/index.ts similarity index 100% rename from src/auth/oauth/index.ts rename to src/adapters/auth/oauth/index.ts diff --git a/src/auth/oauth/login.ts b/src/adapters/auth/oauth/login.ts similarity index 100% rename from src/auth/oauth/login.ts rename to src/adapters/auth/oauth/login.ts diff --git a/src/auth/oauth/oauth.test.ts b/src/adapters/auth/oauth/oauth.test.ts similarity index 100% rename from src/auth/oauth/oauth.test.ts rename to src/adapters/auth/oauth/oauth.test.ts diff --git a/src/auth/oauth/pkce.ts b/src/adapters/auth/oauth/pkce.ts similarity index 100% rename from src/auth/oauth/pkce.ts rename to src/adapters/auth/oauth/pkce.ts diff --git a/src/auth/oauth/session.ts b/src/adapters/auth/oauth/session.ts similarity index 100% rename from src/auth/oauth/session.ts rename to src/adapters/auth/oauth/session.ts diff --git a/src/auth/oauth/store.ts b/src/adapters/auth/oauth/store.ts similarity index 98% rename from src/auth/oauth/store.ts rename to src/adapters/auth/oauth/store.ts index 848c1fb3a..5df967a32 100644 --- a/src/auth/oauth/store.ts +++ b/src/adapters/auth/oauth/store.ts @@ -1,7 +1,7 @@ import { mkdir, readFile, rename, writeFile } from "node:fs/promises"; import { homedir } from "node:os"; import { dirname, join } from "node:path"; -import { SETTINGS_DIR_NAME } from "../../branding.js"; +import { SETTINGS_DIR_NAME } from "../../../branding.js"; // On-disk store for named OAuth profiles. A user may hold multiple subscriptions // for the same provider, so credentials are keyed by a user-chosen profile name diff --git a/src/auth/xai/callback-server.test.ts b/src/adapters/auth/xai/callback-server.test.ts similarity index 100% rename from src/auth/xai/callback-server.test.ts rename to src/adapters/auth/xai/callback-server.test.ts diff --git a/src/auth/xai/callback-server.ts b/src/adapters/auth/xai/callback-server.ts similarity index 100% rename from src/auth/xai/callback-server.ts rename to src/adapters/auth/xai/callback-server.ts diff --git a/src/auth/xai/constants.ts b/src/adapters/auth/xai/constants.ts similarity index 100% rename from src/auth/xai/constants.ts rename to src/adapters/auth/xai/constants.ts diff --git a/src/auth/xai/index.ts b/src/adapters/auth/xai/index.ts similarity index 100% rename from src/auth/xai/index.ts rename to src/adapters/auth/xai/index.ts diff --git a/src/auth/xai/login.ts b/src/adapters/auth/xai/login.ts similarity index 100% rename from src/auth/xai/login.ts rename to src/adapters/auth/xai/login.ts diff --git a/src/auth/xai/oauth.test.ts b/src/adapters/auth/xai/oauth.test.ts similarity index 100% rename from src/auth/xai/oauth.test.ts rename to src/adapters/auth/xai/oauth.test.ts diff --git a/src/auth/xai/oauth.ts b/src/adapters/auth/xai/oauth.ts similarity index 100% rename from src/auth/xai/oauth.ts rename to src/adapters/auth/xai/oauth.ts diff --git a/src/auth/xai/pkce.ts b/src/adapters/auth/xai/pkce.ts similarity index 100% rename from src/auth/xai/pkce.ts rename to src/adapters/auth/xai/pkce.ts diff --git a/src/auth/xai/session.ts b/src/adapters/auth/xai/session.ts similarity index 100% rename from src/auth/xai/session.ts rename to src/adapters/auth/xai/session.ts diff --git a/src/auth/xai/store.ts b/src/adapters/auth/xai/store.ts similarity index 100% rename from src/auth/xai/store.ts rename to src/adapters/auth/xai/store.ts diff --git a/src/auth/xai/usage.ts b/src/adapters/auth/xai/usage.ts similarity index 100% rename from src/auth/xai/usage.ts rename to src/adapters/auth/xai/usage.ts diff --git a/src/changelog/index.test.ts b/src/adapters/changelog/index.test.ts similarity index 100% rename from src/changelog/index.test.ts rename to src/adapters/changelog/index.test.ts diff --git a/src/changelog/index.ts b/src/adapters/changelog/index.ts similarity index 100% rename from src/changelog/index.ts rename to src/adapters/changelog/index.ts diff --git a/src/cost/cost-summary.test.ts b/src/adapters/cost/cost-summary.test.ts similarity index 100% rename from src/cost/cost-summary.test.ts rename to src/adapters/cost/cost-summary.test.ts diff --git a/src/cost/cost-summary.ts b/src/adapters/cost/cost-summary.ts similarity index 100% rename from src/cost/cost-summary.ts rename to src/adapters/cost/cost-summary.ts diff --git a/src/cost/cost-visibility.test.ts b/src/adapters/cost/cost-visibility.test.ts similarity index 100% rename from src/cost/cost-visibility.test.ts rename to src/adapters/cost/cost-visibility.test.ts diff --git a/src/cost/cost-visibility.ts b/src/adapters/cost/cost-visibility.ts similarity index 100% rename from src/cost/cost-visibility.ts rename to src/adapters/cost/cost-visibility.ts diff --git a/src/cost/faremeter.ts b/src/adapters/cost/faremeter.ts similarity index 100% rename from src/cost/faremeter.ts rename to src/adapters/cost/faremeter.ts diff --git a/src/pricing-fetcher.test.ts b/src/adapters/cost/pricing-fetcher.test.ts similarity index 99% rename from src/pricing-fetcher.test.ts rename to src/adapters/cost/pricing-fetcher.test.ts index 08b46e4f6..8712eaf49 100644 --- a/src/pricing-fetcher.test.ts +++ b/src/adapters/cost/pricing-fetcher.test.ts @@ -12,7 +12,7 @@ import { startPricingRefresh, defaultPricingCachePath, type PricingCache, -} from "./cost/pricing-fetcher.js"; +} from "./pricing-fetcher.js"; // --------------------------------------------------------------------------- // defaultPricingCachePath diff --git a/src/cost/pricing-fetcher.ts b/src/adapters/cost/pricing-fetcher.ts similarity index 99% rename from src/cost/pricing-fetcher.ts rename to src/adapters/cost/pricing-fetcher.ts index a9f357125..662cc0c98 100644 --- a/src/cost/pricing-fetcher.ts +++ b/src/adapters/cost/pricing-fetcher.ts @@ -3,7 +3,7 @@ import { homedir } from "node:os"; import { dirname, join } from "node:path"; import { type } from "arktype"; -import { SETTINGS_DIR_NAME } from "../branding.js"; +import { SETTINGS_DIR_NAME } from "../../branding.js"; export type ModelPricing = { inputPricePerToken: number; diff --git a/src/pricing-metadata.test.ts b/src/adapters/cost/pricing-metadata.test.ts similarity index 89% rename from src/pricing-metadata.test.ts rename to src/adapters/cost/pricing-metadata.test.ts index e0f46e011..7f0a8b133 100644 --- a/src/pricing-metadata.test.ts +++ b/src/adapters/cost/pricing-metadata.test.ts @@ -3,16 +3,16 @@ import { mkdtemp, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { getActivePricingCache } from "./cost/cost-visibility.js"; +import { getActivePricingCache } from "./cost-visibility.js"; import { applyPricingCacheMetadata, resetPricingMetadataRefreshForTests, schedulePricingMetadataRefresh, seedPricingMetadataFromCache, -} from "./cost/pricing-metadata.js"; -import { modelReasoningCapability } from "./provider/reasoning-effort.js"; -import { contextWindowFor } from "./provider/context-window.js"; -import { writePricingCache } from "./cost/pricing-fetcher.js"; +} from "./pricing-metadata.js"; +import { modelReasoningCapability } from "../provider/reasoning-effort.js"; +import { contextWindowFor } from "../provider/context-window.js"; +import { writePricingCache } from "./pricing-fetcher.js"; describe("pricing-metadata", () => { // refreshScheduled is a module-level one-shot latch shared with every other diff --git a/src/cost/pricing-metadata.ts b/src/adapters/cost/pricing-metadata.ts similarity index 100% rename from src/cost/pricing-metadata.ts rename to src/adapters/cost/pricing-metadata.ts diff --git a/src/crash/report.test.ts b/src/adapters/crash/report.test.ts similarity index 97% rename from src/crash/report.test.ts rename to src/adapters/crash/report.test.ts index 23c029f54..e7fed56bb 100644 --- a/src/crash/report.test.ts +++ b/src/adapters/crash/report.test.ts @@ -3,7 +3,7 @@ import { mkdtemp, readFile, readdir, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { projectSessionsRoot } from "../session/project-key.js"; +import { projectSessionsRoot } from "../../session/project-key.js"; import { crashReportDir, primeCrashReporting, writeCrashReport } from "./report.js"; let home: string | undefined; diff --git a/src/crash/report.ts b/src/adapters/crash/report.ts similarity index 94% rename from src/crash/report.ts rename to src/adapters/crash/report.ts index 60cb6d59d..11edb4374 100644 --- a/src/crash/report.ts +++ b/src/adapters/crash/report.ts @@ -2,8 +2,8 @@ import { mkdir, writeFile } from "node:fs/promises"; import { homedir } from "node:os"; import { join } from "node:path"; -import { SETTINGS_DIR_NAME } from "../branding.js"; -import { projectSessionsRoot } from "../session/project-key.js"; +import { SETTINGS_DIR_NAME } from "../../branding.js"; +import { projectSessionsRoot } from "../../session/project-key.js"; export type CrashKind = "uncaughtException" | "unhandledRejection"; diff --git a/src/inference-abort.test.ts b/src/adapters/inference-abort.test.ts similarity index 100% rename from src/inference-abort.test.ts rename to src/adapters/inference-abort.test.ts diff --git a/src/inference-abort.ts b/src/adapters/inference-abort.ts similarity index 100% rename from src/inference-abort.ts rename to src/adapters/inference-abort.ts diff --git a/src/inference-error-message.test.ts b/src/adapters/inference-error-message.test.ts similarity index 100% rename from src/inference-error-message.test.ts rename to src/adapters/inference-error-message.test.ts diff --git a/src/inference-error-message.ts b/src/adapters/inference-error-message.ts similarity index 99% rename from src/inference-error-message.ts rename to src/adapters/inference-error-message.ts index ef831151d..f383124ac 100644 --- a/src/inference-error-message.ts +++ b/src/adapters/inference-error-message.ts @@ -10,7 +10,7 @@ import { formatCodexUsageLimitMessage, parseCodexUsageLimitError, } from "./auth/codex/usage-limit-error.js"; -import { codexProfileFromProviderName, isCodexProviderName } from "./config/codex-providers.js"; +import { codexProfileFromProviderName, isCodexProviderName } from "../config/codex-providers.js"; import { gatewayOverloadUserMessage, isGatewayOverloadInferenceError, diff --git a/src/inference-gateway-error.test.ts b/src/adapters/inference-gateway-error.test.ts similarity index 100% rename from src/inference-gateway-error.test.ts rename to src/adapters/inference-gateway-error.test.ts diff --git a/src/inference-gateway-error.ts b/src/adapters/inference-gateway-error.ts similarity index 99% rename from src/inference-gateway-error.ts rename to src/adapters/inference-gateway-error.ts index acbbe9c02..5b555f42f 100644 --- a/src/inference-gateway-error.ts +++ b/src/adapters/inference-gateway-error.ts @@ -3,13 +3,13 @@ import { isOpenCodeGoProviderId, isOpenCodeGoURL, parseGoAPIError, -} from "../packages/opencode-go/src/index.js"; +} from "../../packages/opencode-go/src/index.js"; import { codexUsageLimitRetryAfterMs, formatCodexUsageLimitMessage, parseCodexUsageLimitError, } from "./auth/codex/usage-limit-error.js"; -import { codexProfileFromProviderName, isCodexProviderName } from "./config/codex-providers.js"; +import { codexProfileFromProviderName, isCodexProviderName } from "../config/codex-providers.js"; export type InferenceErrorLike = { category: string; diff --git a/src/logging/sink.test.ts b/src/adapters/logging/sink.test.ts similarity index 100% rename from src/logging/sink.test.ts rename to src/adapters/logging/sink.test.ts diff --git a/src/logging/sink.ts b/src/adapters/logging/sink.ts similarity index 97% rename from src/logging/sink.ts rename to src/adapters/logging/sink.ts index 45bb9d045..dcb282b04 100644 --- a/src/logging/sink.ts +++ b/src/adapters/logging/sink.ts @@ -4,7 +4,7 @@ import { dirname, join } from "node:path"; import { configureSync } from "@intx/log"; -import { SETTINGS_DIR_NAME } from "../branding.js"; +import { SETTINGS_DIR_NAME } from "../../branding.js"; // Matches LogTape's Sink shape structurally (see @logtape/logtape's // sink.d.ts); not imported directly since only @intx/log is a declared diff --git a/src/perf/active-turn.ts b/src/adapters/perf/active-turn.ts similarity index 100% rename from src/perf/active-turn.ts rename to src/adapters/perf/active-turn.ts diff --git a/src/perf/assert-spans.test.ts b/src/adapters/perf/assert-spans.test.ts similarity index 100% rename from src/perf/assert-spans.test.ts rename to src/adapters/perf/assert-spans.test.ts diff --git a/src/perf/assert-spans.ts b/src/adapters/perf/assert-spans.ts similarity index 100% rename from src/perf/assert-spans.ts rename to src/adapters/perf/assert-spans.ts diff --git a/src/perf/attribution-report.test.ts b/src/adapters/perf/attribution-report.test.ts similarity index 100% rename from src/perf/attribution-report.test.ts rename to src/adapters/perf/attribution-report.test.ts diff --git a/src/perf/attribution-report.ts b/src/adapters/perf/attribution-report.ts similarity index 100% rename from src/perf/attribution-report.ts rename to src/adapters/perf/attribution-report.ts diff --git a/src/perf/dump.ts b/src/adapters/perf/dump.ts similarity index 100% rename from src/perf/dump.ts rename to src/adapters/perf/dump.ts diff --git a/src/perf/fixtures/multi-tool-turn.ts b/src/adapters/perf/fixtures/multi-tool-turn.ts similarity index 100% rename from src/perf/fixtures/multi-tool-turn.ts rename to src/adapters/perf/fixtures/multi-tool-turn.ts diff --git a/src/perf/index.test.ts b/src/adapters/perf/index.test.ts similarity index 100% rename from src/perf/index.test.ts rename to src/adapters/perf/index.test.ts diff --git a/src/perf/index.ts b/src/adapters/perf/index.ts similarity index 99% rename from src/perf/index.ts rename to src/adapters/perf/index.ts index 694f44e52..d950a71c0 100644 --- a/src/perf/index.ts +++ b/src/adapters/perf/index.ts @@ -57,7 +57,7 @@ export { type OtlpSpan, } from "./otel-sink.js"; -import type { Settings } from "../config/settings.js"; +import type { Settings } from "../../config/settings.js"; import { flushPerfToOtel as flushPerfToOtelImpl, type FlushPerfToOtelOptions, diff --git a/src/perf/otel-config.test.ts b/src/adapters/perf/otel-config.test.ts similarity index 99% rename from src/perf/otel-config.test.ts rename to src/adapters/perf/otel-config.test.ts index 168de61ca..63cc74b8e 100644 --- a/src/perf/otel-config.test.ts +++ b/src/adapters/perf/otel-config.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from "bun:test"; -import type { Settings } from "../config/settings.js"; +import type { Settings } from "../../config/settings.js"; import { DEFAULT_OTEL_SERVICE_NAME, OTEL_CONFIG_INVALID, diff --git a/src/perf/otel-config.ts b/src/adapters/perf/otel-config.ts similarity index 99% rename from src/perf/otel-config.ts rename to src/adapters/perf/otel-config.ts index a3a702473..e09d4c6cc 100644 --- a/src/perf/otel-config.ts +++ b/src/adapters/perf/otel-config.ts @@ -8,7 +8,7 @@ * half-enable export. Secrets (headers) must never enter privacy-strict dumps. */ -import type { Settings } from "../config/settings.js"; +import type { Settings } from "../../config/settings.js"; /** Stable operator-facing error code for invalid OTEL export config. */ export const OTEL_CONFIG_INVALID = "OTEL_CONFIG_INVALID" as const; diff --git a/src/perf/otel-sink.test.ts b/src/adapters/perf/otel-sink.test.ts similarity index 99% rename from src/perf/otel-sink.test.ts rename to src/adapters/perf/otel-sink.test.ts index 1aefedf1e..a4e3373f3 100644 --- a/src/perf/otel-sink.test.ts +++ b/src/adapters/perf/otel-sink.test.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, describe, expect, test } from "bun:test"; -import type { Settings } from "../config/settings.js"; +import type { Settings } from "../../config/settings.js"; import { clear, end, snapshot, start, type PerfSpan } from "./index.js"; import { buildOtlpPayload, diff --git a/src/perf/otel-sink.ts b/src/adapters/perf/otel-sink.ts similarity index 98% rename from src/perf/otel-sink.ts rename to src/adapters/perf/otel-sink.ts index 4c273b746..6c0c8d8d8 100644 --- a/src/perf/otel-sink.ts +++ b/src/adapters/perf/otel-sink.ts @@ -11,8 +11,8 @@ import { createHash, randomBytes } from "node:crypto"; import { getLogger } from "@intx/log"; -import { LOG_NAMESPACE_ROOT } from "../branding.js"; -import type { Settings } from "../config/settings.js"; +import { LOG_NAMESPACE_ROOT } from "../../branding.js"; +import type { Settings } from "../../config/settings.js"; import type { PerfSpan } from "./index.js"; import { resolveOtelExportConfig, diff --git a/src/perf/permission-subagent-spans.test.ts b/src/adapters/perf/permission-subagent-spans.test.ts similarity index 98% rename from src/perf/permission-subagent-spans.test.ts rename to src/adapters/perf/permission-subagent-spans.test.ts index 760ea62a9..9ee633262 100644 --- a/src/perf/permission-subagent-spans.test.ts +++ b/src/adapters/perf/permission-subagent-spans.test.ts @@ -3,8 +3,8 @@ */ import { afterEach, beforeEach, describe, expect, test } from "bun:test"; import type { ReactorEmittedEvent } from "@intx/inference"; -import { createPermissionGate } from "../permission/gate.js"; -import { createTaskTool } from "../subagent/task-tool.js"; +import { createPermissionGate } from "../../permission/gate.js"; +import { createTaskTool } from "../../subagent/task-tool.js"; import { clear, snapshot, type PerfSpan } from "./index.js"; import { createPerfReactorObserver, currentTurnId } from "./reactor-spans.js"; diff --git a/src/perf/reactor-spans.test.ts b/src/adapters/perf/reactor-spans.test.ts similarity index 99% rename from src/perf/reactor-spans.test.ts rename to src/adapters/perf/reactor-spans.test.ts index d9c3689c9..5c9985def 100644 --- a/src/perf/reactor-spans.test.ts +++ b/src/adapters/perf/reactor-spans.test.ts @@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, test } from "bun:test"; import type { ReactorEmittedEvent } from "@intx/inference"; import { clear, snapshot, type PerfSpan } from "./index.js"; import { createPerfReactorObserver } from "./reactor-spans.js"; -import { createTurnContextCollector } from "../session/hooks.js"; +import { createTurnContextCollector } from "../../session/hooks.js"; // The span store is process-wide, so a perf test cannot assume the tests that // ran before it in this process left it empty. Reset on both edges. diff --git a/src/perf/reactor-spans.ts b/src/adapters/perf/reactor-spans.ts similarity index 99% rename from src/perf/reactor-spans.ts rename to src/adapters/perf/reactor-spans.ts index 4fef21126..398a5f199 100644 --- a/src/perf/reactor-spans.ts +++ b/src/adapters/perf/reactor-spans.ts @@ -20,7 +20,7 @@ */ import type { ReactorEmittedEvent } from "@intx/inference"; -import { onTurnBoundary } from "../agent/reactor-events.js"; +import { onTurnBoundary } from "../../agent/reactor-events.js"; import { end, start } from "./index.js"; import { getActiveTurnId, diff --git a/src/perf/rollup.test.ts b/src/adapters/perf/rollup.test.ts similarity index 100% rename from src/perf/rollup.test.ts rename to src/adapters/perf/rollup.test.ts diff --git a/src/perf/rollup.ts b/src/adapters/perf/rollup.ts similarity index 100% rename from src/perf/rollup.ts rename to src/adapters/perf/rollup.ts diff --git a/src/perf/sanitize.ts b/src/adapters/perf/sanitize.ts similarity index 100% rename from src/perf/sanitize.ts rename to src/adapters/perf/sanitize.ts diff --git a/src/provider/bifrost-adapter.test.ts b/src/adapters/provider/bifrost-adapter.test.ts similarity index 100% rename from src/provider/bifrost-adapter.test.ts rename to src/adapters/provider/bifrost-adapter.test.ts diff --git a/src/provider/bifrost-adapter.ts b/src/adapters/provider/bifrost-adapter.ts similarity index 100% rename from src/provider/bifrost-adapter.ts rename to src/adapters/provider/bifrost-adapter.ts diff --git a/src/provider/billing-product.test.ts b/src/adapters/provider/billing-product.test.ts similarity index 100% rename from src/provider/billing-product.test.ts rename to src/adapters/provider/billing-product.test.ts diff --git a/src/provider/billing-product.ts b/src/adapters/provider/billing-product.ts similarity index 97% rename from src/provider/billing-product.ts rename to src/adapters/provider/billing-product.ts index 62e353cb5..265bf0b9b 100644 --- a/src/provider/billing-product.ts +++ b/src/adapters/provider/billing-product.ts @@ -1,7 +1,7 @@ import { isKnownGoModel, isOpenCodeGoProvider, -} from "../../packages/opencode-go/src/index.js"; +} from "../../../packages/opencode-go/src/index.js"; /** How the provider is billed when known (Go subscription vs Zen PAYG credits). */ export type BillingProduct = "subscription" | "credits"; diff --git a/src/provider/codex-responses-adapter.test.ts b/src/adapters/provider/codex-responses-adapter.test.ts similarity index 100% rename from src/provider/codex-responses-adapter.test.ts rename to src/adapters/provider/codex-responses-adapter.test.ts diff --git a/src/provider/codex-responses-adapter.ts b/src/adapters/provider/codex-responses-adapter.ts similarity index 99% rename from src/provider/codex-responses-adapter.ts rename to src/adapters/provider/codex-responses-adapter.ts index aa50b0832..8235050c4 100644 --- a/src/provider/codex-responses-adapter.ts +++ b/src/adapters/provider/codex-responses-adapter.ts @@ -18,7 +18,7 @@ import { CODEX_AUTHORIZE_EXTRA_PARAMS, } from "../auth/codex/constants.js"; import { codexInstructions } from "../auth/codex/instructions.js"; -import { PRODUCT_NAME, ENVIRONMENT_TAG_NAME } from "../branding.js"; +import { PRODUCT_NAME, ENVIRONMENT_TAG_NAME } from "../../branding.js"; // Adapter for the OpenAI Responses API as served by the Codex backend // (chatgpt.com/backend-api/codex/responses). The Codex backend does NOT speak diff --git a/src/provider/context-window.test.ts b/src/adapters/provider/context-window.test.ts similarity index 100% rename from src/provider/context-window.test.ts rename to src/adapters/provider/context-window.test.ts diff --git a/src/provider/context-window.ts b/src/adapters/provider/context-window.ts similarity index 100% rename from src/provider/context-window.ts rename to src/adapters/provider/context-window.ts diff --git a/src/provider/grok-responses-adapter.test.ts b/src/adapters/provider/grok-responses-adapter.test.ts similarity index 100% rename from src/provider/grok-responses-adapter.test.ts rename to src/adapters/provider/grok-responses-adapter.test.ts diff --git a/src/provider/grok-responses-adapter.ts b/src/adapters/provider/grok-responses-adapter.ts similarity index 100% rename from src/provider/grok-responses-adapter.ts rename to src/adapters/provider/grok-responses-adapter.ts diff --git a/src/provider/inference-dependencies.ts b/src/adapters/provider/inference-dependencies.ts similarity index 100% rename from src/provider/inference-dependencies.ts rename to src/adapters/provider/inference-dependencies.ts diff --git a/src/provider/models-endpoint.ts b/src/adapters/provider/models-endpoint.ts similarity index 90% rename from src/provider/models-endpoint.ts rename to src/adapters/provider/models-endpoint.ts index 86f4fb284..216e8ae34 100644 --- a/src/provider/models-endpoint.ts +++ b/src/adapters/provider/models-endpoint.ts @@ -1,4 +1,4 @@ -import { normalizeOpenAICompatibleBaseURL } from "../config/settings.js"; +import { normalizeOpenAICompatibleBaseURL } from "../../config/settings.js"; export const DEFAULT_MODELS_REQUEST_TIMEOUT_MS = 10_000; diff --git a/src/provider/openai-compatible-adapter.test.ts b/src/adapters/provider/openai-compatible-adapter.test.ts similarity index 100% rename from src/provider/openai-compatible-adapter.test.ts rename to src/adapters/provider/openai-compatible-adapter.test.ts diff --git a/src/provider/openai-compatible-adapter.ts b/src/adapters/provider/openai-compatible-adapter.ts similarity index 100% rename from src/provider/openai-compatible-adapter.ts rename to src/adapters/provider/openai-compatible-adapter.ts diff --git a/src/provider/openai-responses-adapter.ts b/src/adapters/provider/openai-responses-adapter.ts similarity index 100% rename from src/provider/openai-responses-adapter.ts rename to src/adapters/provider/openai-responses-adapter.ts diff --git a/src/provider/reasoning-effort.test.ts b/src/adapters/provider/reasoning-effort.test.ts similarity index 100% rename from src/provider/reasoning-effort.test.ts rename to src/adapters/provider/reasoning-effort.test.ts diff --git a/src/provider/reasoning-effort.ts b/src/adapters/provider/reasoning-effort.ts similarity index 99% rename from src/provider/reasoning-effort.ts rename to src/adapters/provider/reasoning-effort.ts index bf742530e..6ddd8778a 100644 --- a/src/provider/reasoning-effort.ts +++ b/src/adapters/provider/reasoning-effort.ts @@ -6,7 +6,7 @@ // The canonical literal set lives in the agent profile contract so the // profile schema and the runtime cannot drift. Re-exported here for callers // that already import from this module. -import { REASONING_EFFORTS as CANONICAL_EFFORTS } from "../agent/profile-types.js"; +import { REASONING_EFFORTS as CANONICAL_EFFORTS } from "../../agent/profile-types.js"; export const REASONING_EFFORTS = CANONICAL_EFFORTS; export type ReasoningEffort = (typeof REASONING_EFFORTS)[number]; diff --git a/src/provider/validate-connection.test.ts b/src/adapters/provider/validate-connection.test.ts similarity index 100% rename from src/provider/validate-connection.test.ts rename to src/adapters/provider/validate-connection.test.ts diff --git a/src/provider/validate-connection.ts b/src/adapters/provider/validate-connection.ts similarity index 100% rename from src/provider/validate-connection.ts rename to src/adapters/provider/validate-connection.ts diff --git a/src/telemetry/ai-observability.test.ts b/src/adapters/telemetry/ai-observability.test.ts similarity index 99% rename from src/telemetry/ai-observability.test.ts rename to src/adapters/telemetry/ai-observability.test.ts index fa4a0df0f..5dfc442ee 100644 --- a/src/telemetry/ai-observability.test.ts +++ b/src/adapters/telemetry/ai-observability.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from "bun:test"; import type { ToolCall, ToolResult } from "@intx/types/runtime"; import type { Telemetry } from "./index.js"; -import type { TurnContext } from "../session/hooks.js"; +import type { TurnContext } from "../../session/hooks.js"; import { classifyErrorKind, classifySpanKind, diff --git a/src/telemetry/ai-observability.ts b/src/adapters/telemetry/ai-observability.ts similarity index 99% rename from src/telemetry/ai-observability.ts rename to src/adapters/telemetry/ai-observability.ts index c5e3a3701..fc1ccd012 100644 --- a/src/telemetry/ai-observability.ts +++ b/src/adapters/telemetry/ai-observability.ts @@ -4,7 +4,7 @@ // call arguments and results for lifecycle hooks — this module reads only // the scalar/id fields off it and never the content fields. -import type { TurnContext } from "../session/hooks.js"; +import type { TurnContext } from "../../session/hooks.js"; import { noteLastTurnTraceId } from "./feedback.js"; import type { AiErrorKind, AiSpanKind, Telemetry } from "./index.js"; diff --git a/src/telemetry/classify.ts b/src/adapters/telemetry/classify.ts similarity index 98% rename from src/telemetry/classify.ts rename to src/adapters/telemetry/classify.ts index 5c08598a0..3a54c83ba 100644 --- a/src/telemetry/classify.ts +++ b/src/adapters/telemetry/classify.ts @@ -10,7 +10,7 @@ // it matches nothing. What leaves the process is a first-party enum: the fact // that something unrecognised was used, never what it was called. -import { isMcpToolName } from "../mcp/tool-name.js"; +import { isMcpToolName } from "../../mcp/tool-name.js"; const CUSTOM = "custom"; diff --git a/src/telemetry/feedback.test.ts b/src/adapters/telemetry/feedback.test.ts similarity index 100% rename from src/telemetry/feedback.test.ts rename to src/adapters/telemetry/feedback.test.ts diff --git a/src/telemetry/feedback.ts b/src/adapters/telemetry/feedback.ts similarity index 100% rename from src/telemetry/feedback.ts rename to src/adapters/telemetry/feedback.ts diff --git a/src/telemetry/first-run.ts b/src/adapters/telemetry/first-run.ts similarity index 97% rename from src/telemetry/first-run.ts rename to src/adapters/telemetry/first-run.ts index ce5c6258f..492d69038 100644 --- a/src/telemetry/first-run.ts +++ b/src/adapters/telemetry/first-run.ts @@ -1,6 +1,6 @@ import { getLogger } from "@intx/log"; -import { LOG_NAMESPACE_ROOT } from "../branding.js"; -import { loadSettings, markTelemetryNoticeShown, type Settings } from "../config/settings.js"; +import { LOG_NAMESPACE_ROOT } from "../../branding.js"; +import { loadSettings, markTelemetryNoticeShown, type Settings } from "../../config/settings.js"; import { createTelemetry, resolveTelemetryEnabled, diff --git a/src/telemetry/index.ts b/src/adapters/telemetry/index.ts similarity index 99% rename from src/telemetry/index.ts rename to src/adapters/telemetry/index.ts index 85d0379ca..be4d5d7a5 100644 --- a/src/telemetry/index.ts +++ b/src/adapters/telemetry/index.ts @@ -1,8 +1,8 @@ import { randomUUID } from "node:crypto"; -import pkg from "../../package.json" with { type: "json" }; -import { ENV_PREFIX } from "../branding.js"; -import type { Settings } from "../config/settings.js"; +import pkg from "../../../package.json" with { type: "json" }; +import { ENV_PREFIX } from "../../branding.js"; +import type { Settings } from "../../config/settings.js"; // Compiled-in defaults, overridable via env for testing. An empty API key // disables export entirely regardless of the enabled flag. diff --git a/src/telemetry/product-events.ts b/src/adapters/telemetry/product-events.ts similarity index 100% rename from src/telemetry/product-events.ts rename to src/adapters/telemetry/product-events.ts diff --git a/src/telemetry/singleton.ts b/src/adapters/telemetry/singleton.ts similarity index 100% rename from src/telemetry/singleton.ts rename to src/adapters/telemetry/singleton.ts diff --git a/src/telemetry/toggle.ts b/src/adapters/telemetry/toggle.ts similarity index 98% rename from src/telemetry/toggle.ts rename to src/adapters/telemetry/toggle.ts index 53e483bcf..e75f838a8 100644 --- a/src/telemetry/toggle.ts +++ b/src/adapters/telemetry/toggle.ts @@ -1,11 +1,11 @@ import { getLogger } from "@intx/log"; -import { LOG_NAMESPACE_ROOT } from "../branding.js"; +import { LOG_NAMESPACE_ROOT } from "../../branding.js"; import { ensureTelemetrySettings, loadSettings, saveGlobalSettings, type Settings, -} from "../config/settings.js"; +} from "../../config/settings.js"; import { createTelemetry, TELEMETRY_ENV, diff --git a/src/upgrade/index.test.ts b/src/adapters/upgrade/index.test.ts similarity index 100% rename from src/upgrade/index.test.ts rename to src/adapters/upgrade/index.test.ts diff --git a/src/upgrade/index.ts b/src/adapters/upgrade/index.ts similarity index 98% rename from src/upgrade/index.ts rename to src/adapters/upgrade/index.ts index ced855bd6..04207d95e 100644 --- a/src/upgrade/index.ts +++ b/src/adapters/upgrade/index.ts @@ -14,8 +14,8 @@ import { compareVersions, parseVersionString, } from "../changelog/index.js"; -import { COMMAND_NAME, PRODUCT_NAME } from "../branding.js"; -import pkg from "../../package.json" with { type: "json" }; +import { COMMAND_NAME, PRODUCT_NAME } from "../../branding.js"; +import pkg from "../../../package.json" with { type: "json" }; /** Public releases page (human-facing). */ export const RELEASES_URL = diff --git a/src/agent/compaction.test.ts b/src/agent/compaction.test.ts index ce7427c70..27edada20 100644 --- a/src/agent/compaction.test.ts +++ b/src/agent/compaction.test.ts @@ -7,7 +7,7 @@ import type { TokenUsage, } from "@intx/types/runtime"; import { createCompactionGovernor } from "./compaction.js"; -import { compactionThresholdFor } from "../provider/context-window.js"; +import { compactionThresholdFor } from "../adapters/provider/context-window.js"; import { COMPACTOR_KEEP_RECENT_TURNS, compactorNoOpFloor } from "../session/compactor.js"; const capabilities = { diff --git a/src/agent/compaction.ts b/src/agent/compaction.ts index c5da0f979..c9fb79d39 100644 --- a/src/agent/compaction.ts +++ b/src/agent/compaction.ts @@ -5,7 +5,7 @@ import type { ReactorInboundEvent, ToolDefinition, } from "@intx/types/runtime"; -import { compactionThresholdFor, contextTokensFromUsage } from "../provider/context-window.js"; +import { compactionThresholdFor, contextTokensFromUsage } from "../adapters/provider/context-window.js"; import { COMPACTOR_KEEP_RECENT_TURNS, compactorNoOpFloor } from "../session/compactor.js"; import { createContextEstimate, estimateOverheadTokens } from "./context-estimate.js"; import { onTurnBoundary } from "./reactor-events.js"; diff --git a/src/agent/director.ts b/src/agent/director.ts index 40a4a5bfc..b537823a7 100644 --- a/src/agent/director.ts +++ b/src/agent/director.ts @@ -19,7 +19,7 @@ import { onTurnBoundary } from "./reactor-events.js"; import { type } from "arktype"; import { applyManageTasks, hasActiveTasks, parseManageTasksArgs, type Task } from "./tasks.js"; import { createCorbitsRetryPolicy } from "./retry-policy.js"; -import { isInternalRecoveryAbortRaw } from "../inference-abort.js"; +import { isInternalRecoveryAbortRaw } from "../adapters/inference-abort.js"; import { LOG_NAMESPACE_ROOT } from "../branding.js"; import { resolveModelFamilyPolicy, type ModelFamilyPolicy } from "./model-family-policy.js"; import { diff --git a/src/agent/renderer.ts b/src/agent/renderer.ts index 3befa448d..fd918b7b9 100644 --- a/src/agent/renderer.ts +++ b/src/agent/renderer.ts @@ -1,8 +1,8 @@ import type { ReactorEmittedEvent } from "@intx/inference"; -import { createFaremeter, formatCost } from "../cost/faremeter.js"; -import type { PricingCache } from "../cost/pricing-fetcher.js"; -import { inferenceErrorMessage } from "../inference-error-message.js"; +import { createFaremeter, formatCost } from "../adapters/cost/faremeter.js"; +import type { PricingCache } from "../adapters/cost/pricing-fetcher.js"; +import { inferenceErrorMessage } from "../adapters/inference-error-message.js"; export type Renderer = { render(event: ReactorEmittedEvent): void; diff --git a/src/agent/retry-policy.ts b/src/agent/retry-policy.ts index ecfd67ae5..f64795799 100644 --- a/src/agent/retry-policy.ts +++ b/src/agent/retry-policy.ts @@ -1,6 +1,6 @@ import { createDefaultRetryPolicy } from "@intx/inference"; import type { RetryDecision, RetryPolicy, RetrySituation } from "@intx/types/runtime"; -import { normalizeInferenceErrorForRetry } from "../inference-gateway-error.js"; +import { normalizeInferenceErrorForRetry } from "../adapters/inference-gateway-error.js"; // Providers that enforce long-window quotas (e.g. monthly limits) set // Retry-After to days or weeks. The default policy trusts that value and diff --git a/src/agent/tools.ts b/src/agent/tools.ts index dc297f77f..2d12d0317 100644 --- a/src/agent/tools.ts +++ b/src/agent/tools.ts @@ -16,7 +16,7 @@ import { type ShellTimeoutConfig, } from "../plugins/shell-guard-plugin.js"; import { advertiseEditFileLineRange } from "../plugins/edit-file-line-range.js"; -import type { Telemetry } from "../telemetry/index.js"; +import type { Telemetry } from "../adapters/telemetry/index.js"; import type { PermissionGate } from "../permission/gate.js"; import { buildCorePosixToolPlugins } from "./posix-tool-plugins.js"; import { createLazyBlobReader } from "./lazy-blob-reader.js"; diff --git a/src/agent/use-skill.ts b/src/agent/use-skill.ts index e942c65ac..3be905091 100644 --- a/src/agent/use-skill.ts +++ b/src/agent/use-skill.ts @@ -4,7 +4,7 @@ import type { ToolDefinition } from "@intx/types/runtime"; import { type } from "arktype"; import { resolveSkillBody } from "../extensions/skills.js"; -import { NOOP_TELEMETRY, type Telemetry } from "../telemetry/index.js"; +import { NOOP_TELEMETRY, type Telemetry } from "../adapters/telemetry/index.js"; // Lazy skill loading: the available skills are listed by name + description in // the system prompt, but their full instructions are pulled into context only diff --git a/src/config/bifrost.ts b/src/config/bifrost.ts index 1524280fa..a392b7df4 100644 --- a/src/config/bifrost.ts +++ b/src/config/bifrost.ts @@ -1,4 +1,4 @@ -import { requestModelsEndpoint } from "../provider/models-endpoint.js"; +import { requestModelsEndpoint } from "../adapters/provider/models-endpoint.js"; /** * Fetch the model list from a Bifrost gateway for the given virtual key. diff --git a/src/config/codex-providers.ts b/src/config/codex-providers.ts index 784275a0b..17abc5f5d 100644 --- a/src/config/codex-providers.ts +++ b/src/config/codex-providers.ts @@ -1,5 +1,5 @@ -import { CODEX_BASE_URL, CODEX_DEFAULT_MODELS } from "../auth/codex/constants.js"; -import type { CodexProfile } from "../auth/codex/store.js"; +import { CODEX_BASE_URL, CODEX_DEFAULT_MODELS } from "../adapters/auth/codex/constants.js"; +import type { CodexProfile } from "../adapters/auth/codex/store.js"; import { createOAuthProviderProjection } from "./oauth-providers.js"; export const CODEX_PROVIDER_PREFIX = "codex/"; diff --git a/src/config/index.ts b/src/config/index.ts index 37f295742..d67c57d06 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -5,11 +5,11 @@ import { generateSessionId, isSessionId, migrateLegacySessionIfNeeded, resolveLa import { loadState } from "../session/state.js"; -import { validateEffort, type ReasoningEffort } from "../provider/reasoning-effort.js"; -import { bootstrapPricingMetadata } from "../cost/pricing-metadata.js"; -import { defaultPricingCachePath, type PricingFetcherOptions } from "../cost/pricing-fetcher.js"; -import { listCodexProfiles, type CodexProfile } from "../auth/codex/store.js"; -import { listXaiProfiles, type XaiProfile } from "../auth/xai/store.js"; +import { validateEffort, type ReasoningEffort } from "../adapters/provider/reasoning-effort.js"; +import { bootstrapPricingMetadata } from "../adapters/cost/pricing-metadata.js"; +import { defaultPricingCachePath, type PricingFetcherOptions } from "../adapters/cost/pricing-fetcher.js"; +import { listCodexProfiles, type CodexProfile } from "../adapters/auth/codex/store.js"; +import { listXaiProfiles, type XaiProfile } from "../adapters/auth/xai/store.js"; import { codexProfilesToCatalogEntries, codexProvidersAsSettings, @@ -23,17 +23,17 @@ import { import { fetchBifrostModels } from "./bifrost.js"; export { fetchBifrostModels }; -import { CODEX_BASE_URL } from "../auth/codex/constants.js"; -import { XAI_BASE_URL } from "../auth/xai/constants.js"; +import { CODEX_BASE_URL } from "../adapters/auth/codex/constants.js"; +import { XAI_BASE_URL } from "../adapters/auth/xai/constants.js"; import { CODEX_RESPONSES_PROVIDER, CODEX_ACCOUNT_ID_OPTION, CODEX_SESSION_ID_OPTION, -} from "../provider/codex-responses-adapter.js"; -import { GROK_RESPONSES_PROVIDER, GROK_USER_ID_OPTION } from "../provider/grok-responses-adapter.js"; -import { BIFROST_PROVIDER } from "../provider/bifrost-adapter.js"; -import { OPENAI_RESPONSES_PROVIDER } from "../provider/openai-responses-adapter.js"; -import { xaiUserIdFromAccessToken } from "../auth/xai/session.js"; +} from "../adapters/provider/codex-responses-adapter.js"; +import { GROK_RESPONSES_PROVIDER, GROK_USER_ID_OPTION } from "../adapters/provider/grok-responses-adapter.js"; +import { BIFROST_PROVIDER } from "../adapters/provider/bifrost-adapter.js"; +import { OPENAI_RESPONSES_PROVIDER } from "../adapters/provider/openai-responses-adapter.js"; +import { xaiUserIdFromAccessToken } from "../adapters/auth/xai/session.js"; import { OPENCODE_GO_BASE_URL, isOpenCodeGoProvider, diff --git a/src/config/inference-sources.ts b/src/config/inference-sources.ts index 9a378d29d..ebff4ab0b 100644 --- a/src/config/inference-sources.ts +++ b/src/config/inference-sources.ts @@ -10,7 +10,7 @@ import { type ProviderCatalogEntry, } from "./index.js"; import type { Settings } from "./settings.js"; -import type { ReasoningEffort } from "../provider/reasoning-effort.js"; +import type { ReasoningEffort } from "../adapters/provider/reasoning-effort.js"; import { SOURCE_MAX_TOKENS } from "./index.js"; import { isOpenCodeGoProvider } from "../../packages/opencode-go/src/index.js"; import { resolveDefaultModel } from "./providers.js"; diff --git a/src/config/oauth-providers.test.ts b/src/config/oauth-providers.test.ts index dd7a4a7cb..befbaba9b 100644 --- a/src/config/oauth-providers.test.ts +++ b/src/config/oauth-providers.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from "bun:test"; -import type { CodexProfile } from "../auth/codex/store.js"; -import type { XaiProfile } from "../auth/xai/store.js"; +import type { CodexProfile } from "../adapters/auth/codex/store.js"; +import type { XaiProfile } from "../adapters/auth/xai/store.js"; import { codexProfileFromProviderName, codexProfilesToCatalogEntries, diff --git a/src/config/settings.ts b/src/config/settings.ts index 3ffff889b..699446106 100644 --- a/src/config/settings.ts +++ b/src/config/settings.ts @@ -6,7 +6,7 @@ import { dirname, join } from "node:path"; import { type } from "arktype"; import { SETTINGS_DIR_NAME } from "../branding.js"; -import { REASONING_EFFORTS, isReasoningEffort, type ReasoningEffort } from "../provider/reasoning-effort.js"; +import { REASONING_EFFORTS, isReasoningEffort, type ReasoningEffort } from "../adapters/provider/reasoning-effort.js"; import { isSessionMode, type SessionMode } from "./session-mode.js"; import { resolveDefaultModel } from "./providers.js"; import { diff --git a/src/config/xai-providers.test.ts b/src/config/xai-providers.test.ts index 6fc1b782a..29bffd16b 100644 --- a/src/config/xai-providers.test.ts +++ b/src/config/xai-providers.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from "bun:test"; -import { XAI_BASE_URL, XAI_DEFAULT_MODELS } from "../auth/xai/constants.js"; -import type { XaiProfile } from "../auth/xai/store.js"; +import { XAI_BASE_URL, XAI_DEFAULT_MODELS } from "../adapters/auth/xai/constants.js"; +import type { XaiProfile } from "../adapters/auth/xai/store.js"; import { providerCatalogToSettings } from "./index.js"; import { isXaiProviderName, diff --git a/src/config/xai-providers.ts b/src/config/xai-providers.ts index ec166c0c8..1e79d51bf 100644 --- a/src/config/xai-providers.ts +++ b/src/config/xai-providers.ts @@ -1,5 +1,5 @@ -import { XAI_BASE_URL, XAI_DEFAULT_MODELS } from "../auth/xai/constants.js"; -import type { XaiProfile } from "../auth/xai/store.js"; +import { XAI_BASE_URL, XAI_DEFAULT_MODELS } from "../adapters/auth/xai/constants.js"; +import type { XaiProfile } from "../adapters/auth/xai/store.js"; import { createOAuthProviderProjection } from "./oauth-providers.js"; export const XAI_PROVIDER_PREFIX = "xai/"; diff --git a/src/director.test.ts b/src/director.test.ts index ad009043e..8da9af641 100644 --- a/src/director.test.ts +++ b/src/director.test.ts @@ -10,7 +10,7 @@ import type { ReactorState, ReactorCapabilities, ReactorAction, ReactorInboundEv import { INFERENCE_ABORT_INTERNAL_RECOVERY, INFERENCE_ABORT_USER_STOP, -} from "./inference-abort.js"; +} from "./adapters/inference-abort.js"; const mockState: ReactorState = {} as unknown as ReactorState; diff --git a/src/exec/runner.ts b/src/exec/runner.ts index 8e92447f1..08c2270ab 100644 --- a/src/exec/runner.ts +++ b/src/exec/runner.ts @@ -28,11 +28,11 @@ import { } from "../config/settings.js"; import { codexProfileFromProviderName } from "../config/codex-providers.js"; import { xaiProfileFromProviderName } from "../config/xai-providers.js"; -import { createInferenceDependencies } from "../provider/inference-dependencies.js"; -import { getValidCodexToken } from "../auth/codex/session.js"; -import { getValidXaiToken } from "../auth/xai/session.js"; -import { seedPricingMetadataFromCache } from "../cost/pricing-metadata.js"; -import { defaultPricingCachePath } from "../cost/pricing-fetcher.js"; +import { createInferenceDependencies } from "../adapters/provider/inference-dependencies.js"; +import { getValidCodexToken } from "../adapters/auth/codex/session.js"; +import { getValidXaiToken } from "../adapters/auth/xai/session.js"; +import { seedPricingMetadataFromCache } from "../adapters/cost/pricing-metadata.js"; +import { defaultPricingCachePath } from "../adapters/cost/pricing-fetcher.js"; import { advertisedToolNamesForSessionMode, advertisedTools, @@ -54,7 +54,7 @@ import type { PermissionRequest, } from "../permission/types.js"; import { createAgentToolset, type AgentToolset, type OperatorResult } from "../agent/tools.js"; -import { liveTelemetry } from "../telemetry/singleton.js"; +import { liveTelemetry } from "../adapters/telemetry/singleton.js"; import { collectToolPlugins, resolveToolPlugins } from "../plugins/tool-plugins.js"; import { expandExistingPluginMembers, diff --git a/src/index.ts b/src/index.ts index 417c7e44e..6c1311165 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,16 +1,16 @@ import { getLogger } from "@intx/log"; import { LOG_NAMESPACE_ROOT } from "./branding.js"; -import { primeCrashReporting, writeCrashReport, type CrashKind } from "./crash/report.js"; +import { primeCrashReporting, writeCrashReport, type CrashKind } from "./adapters/crash/report.js"; import { getActiveRun, markCrashed } from "./session/active-run.js"; import { getActiveDisposeHost } from "./session/active-host.js"; import { saveCrashState } from "./session/state.js"; import { loadConfig, CliHelpError } from "./config/index.js"; import { ensureTelemetrySettings, globalSettingsPath } from "./config/settings.js"; -import { installFileLogSink } from "./logging/sink.js"; -import { flushPerfToOtel } from "./perf/index.js"; -import { createTelemetry, telemetryDisabledByEnv } from "./telemetry/index.js"; -import { classifyErrorClass } from "./telemetry/classify.js"; -import { getTelemetry, setTelemetry } from "./telemetry/singleton.js"; +import { installFileLogSink } from "./adapters/logging/sink.js"; +import { flushPerfToOtel } from "./adapters/perf/index.js"; +import { createTelemetry, telemetryDisabledByEnv } from "./adapters/telemetry/index.js"; +import { classifyErrorClass } from "./adapters/telemetry/classify.js"; +import { getTelemetry, setTelemetry } from "./adapters/telemetry/singleton.js"; import { runExec } from "./exec/runner.js"; import { runOnboarding } from "./tui/onboarding.js"; import { runTUI } from "./tui/runner.js"; diff --git a/src/mcp/callback-server.ts b/src/mcp/callback-server.ts index ea52651af..7bb0d9378 100644 --- a/src/mcp/callback-server.ts +++ b/src/mcp/callback-server.ts @@ -1,6 +1,6 @@ import { createServer, type Server } from "node:http"; import type { AddressInfo } from "node:net"; -import { callbackPageHtml } from "../auth/callback-page.js"; +import { callbackPageHtml } from "../adapters/auth/callback-page.js"; export type CallbackServer = { // The redirect_uri to register with the authorization server. diff --git a/src/permission/gate.ts b/src/permission/gate.ts index af0592ace..0093baaa1 100644 --- a/src/permission/gate.ts +++ b/src/permission/gate.ts @@ -26,10 +26,10 @@ import { type McpToolPermissionRegistry, } from "../mcp/tool-permissions.js"; import type { MCPClient } from "../mcp/client.js"; -import { end, start } from "../perf/index.js"; -import { currentTurnId } from "../perf/reactor-spans.js"; -import { classifyPermissionKind } from "../telemetry/classify.js"; -import { NOOP_TELEMETRY, type Telemetry } from "../telemetry/index.js"; +import { end, start } from "../adapters/perf/index.js"; +import { currentTurnId } from "../adapters/perf/reactor-spans.js"; +import { classifyPermissionKind } from "../adapters/telemetry/classify.js"; +import { NOOP_TELEMETRY, type Telemetry } from "../adapters/telemetry/index.js"; // Closes out an operator prompt: ends the wait span and records the outcome. // buildRequests yields at most one request per tool call, and the two prompt diff --git a/src/plugins/loader.ts b/src/plugins/loader.ts index 3d5f463f1..124db908e 100644 --- a/src/plugins/loader.ts +++ b/src/plugins/loader.ts @@ -7,7 +7,7 @@ import { SETTINGS_DIR_NAME } from "../branding.js"; import type { CommandPlugin } from "../tui/commands/registry.js"; import { pathIsInsideOrEqual } from "../util/path-contain.js"; import { parsePluginManifest, type PluginManifest } from "./manifest.js"; -import { NOOP_TELEMETRY, type Telemetry } from "../telemetry/index.js"; +import { NOOP_TELEMETRY, type Telemetry } from "../adapters/telemetry/index.js"; import { loadDataOnlyPlugin } from "./data-only.js"; import { resolvePluginWarningHandler, diff --git a/src/session/run-sink.ts b/src/session/run-sink.ts index ced6c40d6..3d38d5a3c 100644 --- a/src/session/run-sink.ts +++ b/src/session/run-sink.ts @@ -1,7 +1,7 @@ import type { EventEmitter } from "node:events"; import type { ReactorEmittedEvent } from "@intx/inference"; import type { TokenUsage } from "@intx/types/runtime"; -import { createPerfReactorObserver } from "../perf/reactor-spans.js"; +import { createPerfReactorObserver } from "../adapters/perf/reactor-spans.js"; import { onTurnBoundary } from "../agent/reactor-events.js"; import { createTurnContextCollector, diff --git a/src/session/runtime-assembly.ts b/src/session/runtime-assembly.ts index cc97c1a53..cfb7e6a97 100644 --- a/src/session/runtime-assembly.ts +++ b/src/session/runtime-assembly.ts @@ -37,10 +37,10 @@ import { saveProviderModelApproval, } from "../permission/store.js"; import type { Approval, GrantScope } from "../permission/types.js"; -import type { ReasoningEffort } from "../provider/reasoning-effort.js"; +import type { ReasoningEffort } from "../adapters/provider/reasoning-effort.js"; import type { SubAgentProvider } from "../subagent/index.js"; import { COMPACTOR_KEEP_RECENT_TURNS, createPruningCompactor } from "./compactor.js"; -import { NOOP_TELEMETRY, type Telemetry } from "../telemetry/index.js"; +import { NOOP_TELEMETRY, type Telemetry } from "../adapters/telemetry/index.js"; // --------------------------------------------------------------------------- // 1. Sub-agent provider literal diff --git a/src/subagent/index.test.ts b/src/subagent/index.test.ts index cc7c60aef..21a02aa01 100644 --- a/src/subagent/index.test.ts +++ b/src/subagent/index.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from "bun:test"; -import { CodexAuthError } from "../auth/codex/session.js"; +import { CodexAuthError } from "../adapters/auth/codex/session.js"; import { createPermissionGate } from "../permission/gate.js"; import { createDynamicToolRunner } from "../tui/dynamic-tool-runner.js"; import { diff --git a/src/subagent/inference-auth-failure.test.ts b/src/subagent/inference-auth-failure.test.ts index 2da0f8b96..7f70950b9 100644 --- a/src/subagent/inference-auth-failure.test.ts +++ b/src/subagent/inference-auth-failure.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from "bun:test"; -import { CodexAuthError } from "../auth/codex/session.js"; -import { XaiAuthError } from "../auth/xai/session.js"; +import { CodexAuthError } from "../adapters/auth/codex/session.js"; +import { XaiAuthError } from "../adapters/auth/xai/session.js"; import { classifySubAgentInferenceAuthFailure, formatSubAgentTaskAuthFailureMessage, diff --git a/src/subagent/inference-auth-failure.ts b/src/subagent/inference-auth-failure.ts index 951cb7057..faceb08ca 100644 --- a/src/subagent/inference-auth-failure.ts +++ b/src/subagent/inference-auth-failure.ts @@ -1,5 +1,5 @@ -import { CodexAuthError } from "../auth/codex/session.js"; -import { XaiAuthError } from "../auth/xai/session.js"; +import { CodexAuthError } from "../adapters/auth/codex/session.js"; +import { XaiAuthError } from "../adapters/auth/xai/session.js"; export type SubAgentAuthFailureKind = "codex" | "xai"; diff --git a/src/subagent/provider-family.ts b/src/subagent/provider-family.ts index 59a8b162f..61b03eb99 100644 --- a/src/subagent/provider-family.ts +++ b/src/subagent/provider-family.ts @@ -1,4 +1,4 @@ -import { GROK_RESPONSES_PROVIDER } from "../provider/grok-responses-adapter.js"; +import { GROK_RESPONSES_PROVIDER } from "../adapters/provider/grok-responses-adapter.js"; import { isXaiProviderName } from "../config/xai-providers.js"; /** diff --git a/src/subagent/refresh-inference-source.test.ts b/src/subagent/refresh-inference-source.test.ts index f01d2752f..5a261122d 100644 --- a/src/subagent/refresh-inference-source.test.ts +++ b/src/subagent/refresh-inference-source.test.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, spyOn, test } from "bun:test"; -import * as codexSession from "../auth/codex/session.js"; -import * as xaiSession from "../auth/xai/session.js"; +import * as codexSession from "../adapters/auth/codex/session.js"; +import * as xaiSession from "../adapters/auth/xai/session.js"; import type { InferenceSource } from "@intx/types/runtime"; diff --git a/src/subagent/refresh-inference-source.ts b/src/subagent/refresh-inference-source.ts index 3db9a130e..2dca2ff4a 100644 --- a/src/subagent/refresh-inference-source.ts +++ b/src/subagent/refresh-inference-source.ts @@ -1,7 +1,7 @@ import type { InferenceSource } from "@intx/types/runtime"; -import { getValidCodexToken } from "../auth/codex/session.js"; -import { getValidXaiToken } from "../auth/xai/session.js"; +import { getValidCodexToken } from "../adapters/auth/codex/session.js"; +import { getValidXaiToken } from "../adapters/auth/xai/session.js"; import type { ProviderCatalogEntry } from "../config/index.js"; import { codexProfileFromProviderName } from "../config/codex-providers.js"; import { xaiProfileFromProviderName } from "../config/xai-providers.js"; diff --git a/src/subagent/run.ts b/src/subagent/run.ts index 0dd4853f8..2fa531a52 100644 --- a/src/subagent/run.ts +++ b/src/subagent/run.ts @@ -4,7 +4,7 @@ import { mkdir } from "node:fs/promises"; -import { liveTelemetry } from "../telemetry/singleton.js"; +import { liveTelemetry } from "../adapters/telemetry/singleton.js"; import { join } from "node:path"; import { @@ -25,11 +25,11 @@ import { createDynamicToolRunner } from "../tui/dynamic-tool-runner.js"; import type { ReactorEmittedEvent } from "@intx/inference"; import type { BlobReader, InboundMessage } from "@intx/types/runtime"; -import { seedPricingMetadataFromCache } from "../cost/pricing-metadata.js"; -import { defaultPricingCachePath } from "../cost/pricing-fetcher.js"; +import { seedPricingMetadataFromCache } from "../adapters/cost/pricing-metadata.js"; +import { defaultPricingCachePath } from "../adapters/cost/pricing-fetcher.js"; import { buildBifrostSource, buildOpenAISource, type ProviderCatalogEntry } from "../config/index.js"; import { buildInferenceSourceForRef, buildSubagentSources } from "../config/inference-sources.js"; -import { createInferenceDependencies } from "../provider/inference-dependencies.js"; +import { createInferenceDependencies } from "../adapters/provider/inference-dependencies.js"; import { advertiseShellGuardTimeout } from "../plugins/shell-guard-plugin.js"; import { advertiseEditFileLineRange } from "../plugins/edit-file-line-range.js"; import { createWebFetchTool } from "../tools/web-fetch.js"; diff --git a/src/subagent/task-tool.ts b/src/subagent/task-tool.ts index b9f2df055..784433a45 100644 --- a/src/subagent/task-tool.ts +++ b/src/subagent/task-tool.ts @@ -24,7 +24,7 @@ import { resolveEffortForRole, validateEffort, type ReasoningEffort, -} from "../provider/reasoning-effort.js"; +} from "../adapters/provider/reasoning-effort.js"; import { isCodexProviderName } from "../config/codex-providers.js"; import type { SubAgentSessionStore } from "./session-store.js"; import { @@ -41,10 +41,10 @@ import { import { isSubAgentCancelError } from "./dispose.js"; import { cleanupSubAgentWorktree, createSubAgentWorktree, WorktreeError } from "./worktree.js"; import { generateSessionId } from "../session/index.js"; -import { end, start } from "../perf/index.js"; -import { currentTurnId } from "../perf/reactor-spans.js"; -import { classifyAgentName } from "../telemetry/classify.js"; -import { NOOP_TELEMETRY, type Telemetry } from "../telemetry/index.js"; +import { end, start } from "../adapters/perf/index.js"; +import { currentTurnId } from "../adapters/perf/reactor-spans.js"; +import { classifyAgentName } from "../adapters/telemetry/classify.js"; +import { NOOP_TELEMETRY, type Telemetry } from "../adapters/telemetry/index.js"; import { join } from "node:path"; import type { NestedDispatchDeps, diff --git a/src/subagent/types.ts b/src/subagent/types.ts index 2599842e0..c0dd70d5a 100644 --- a/src/subagent/types.ts +++ b/src/subagent/types.ts @@ -13,7 +13,7 @@ import type { ProviderCatalogEntry } from "../config/index.js"; import type { Settings } from "../config/settings.js"; import type { ShellTimeoutConfig } from "../plugins/shell-guard-plugin.js"; import type { PermissionGate } from "../permission/gate.js"; -import type { ReasoningEffort } from "../provider/reasoning-effort.js"; +import type { ReasoningEffort } from "../adapters/provider/reasoning-effort.js"; import type { SubAgentSessionStore } from "./session-store.js"; import type { TaskIntent } from "./report.js"; diff --git a/src/tui/commands/built-in.test.ts b/src/tui/commands/built-in.test.ts index 67e3894af..e022befb5 100644 --- a/src/tui/commands/built-in.test.ts +++ b/src/tui/commands/built-in.test.ts @@ -2,7 +2,7 @@ import { describe, it, expect } from "bun:test"; import { getCommand } from "./registry.js"; import type { CommandContext } from "./registry.js"; import { registerBuiltInCommands } from "./built-in.js"; -import { buildCostSummary } from "../../cost/cost-summary.js"; +import { buildCostSummary } from "../../adapters/cost/cost-summary.js"; registerBuiltInCommands(); diff --git a/src/tui/commands/built-in.ts b/src/tui/commands/built-in.ts index 54c9355db..397063c4e 100644 --- a/src/tui/commands/built-in.ts +++ b/src/tui/commands/built-in.ts @@ -1,11 +1,11 @@ import { registerCommand } from "./registry.js"; -import { formatCostCommandOutput } from "../../cost/cost-summary.js"; +import { formatCostCommandOutput } from "../../adapters/cost/cost-summary.js"; import { formatStartupChangelog, parseChangelog, resolveChangelogPath, -} from "../../changelog/index.js"; -import { FEEDBACK_PROMPT, isFeedbackConfigured } from "../../telemetry/feedback.js"; +} from "../../adapters/changelog/index.js"; +import { FEEDBACK_PROMPT, isFeedbackConfigured } from "../../adapters/telemetry/feedback.js"; /** * Register every built-in slash command. diff --git a/src/tui/commands/registry.ts b/src/tui/commands/registry.ts index c9e23d4ea..d8f920f3f 100644 --- a/src/tui/commands/registry.ts +++ b/src/tui/commands/registry.ts @@ -1,4 +1,4 @@ -import type { CostSummary } from "../../cost/cost-summary.js"; +import type { CostSummary } from "../../adapters/cost/cost-summary.js"; export type CommandContext = { signalClear: () => void; diff --git a/src/tui/log-sink.test.ts b/src/tui/log-sink.test.ts index b9f77a0e0..c728dbe0f 100644 --- a/src/tui/log-sink.test.ts +++ b/src/tui/log-sink.test.ts @@ -12,7 +12,7 @@ import { tmpdir } from "node:os" import { join } from "node:path" import { getLogger } from "@intx/log" -import { installFileLogSink } from "../logging/sink.js" +import { installFileLogSink } from "../adapters/logging/sink.js" import { createAppShell } from "./shell.js" import { withTestRenderer } from "./harness.js" diff --git a/src/tui/model-catalog.ts b/src/tui/model-catalog.ts index 57fa718d9..0b803d2d2 100644 --- a/src/tui/model-catalog.ts +++ b/src/tui/model-catalog.ts @@ -9,11 +9,11 @@ * Identity is `provider:model` (matches runner active-model string). */ -import { isGoModelOnZenPath as defaultIsGoModelOnZenPath } from "../provider/billing-product.js" -import { getActivePricingCache } from "../cost/cost-visibility.js" -import { lookupModelPricing, type PricingCache } from "../cost/pricing-fetcher.js" -import { contextWindowFor, hasContextWindowFor } from "../provider/context-window.js" -import { modelReasoningCapability } from "../provider/reasoning-effort.js" +import { isGoModelOnZenPath as defaultIsGoModelOnZenPath } from "../adapters/provider/billing-product.js" +import { getActivePricingCache } from "../adapters/cost/cost-visibility.js" +import { lookupModelPricing, type PricingCache } from "../adapters/cost/pricing-fetcher.js" +import { contextWindowFor, hasContextWindowFor } from "../adapters/provider/context-window.js" +import { modelReasoningCapability } from "../adapters/provider/reasoning-effort.js" import type { ItemDescription } from "./shell.js" export type ModelCatalogSection = "recent" | "favorites" | "provider" diff --git a/src/tui/onboarding.ts b/src/tui/onboarding.ts index 71a5f828a..5a4f935a2 100644 --- a/src/tui/onboarding.ts +++ b/src/tui/onboarding.ts @@ -2,7 +2,7 @@ import { runTUI } from "./runner.js"; import { buildProviderSubmitHandler } from "./provider-setup-submit.js"; import { loadConfig, type UnconfiguredConfig } from "../config/index.js"; import { globalSettingsPath, loadSettings, localSettingsPath } from "../config/settings.js"; -import { activateHeldTelemetry, telemetryFirstRunPending } from "../telemetry/first-run.js"; +import { activateHeldTelemetry, telemetryFirstRunPending } from "../adapters/telemetry/first-run.js"; import { runProviderSetup } from "./provider-setup.js"; export async function runOnboarding(config: UnconfiguredConfig): Promise { diff --git a/src/tui/prompt-border.ts b/src/tui/prompt-border.ts index 27ac13537..1a887f78a 100644 --- a/src/tui/prompt-border.ts +++ b/src/tui/prompt-border.ts @@ -14,7 +14,7 @@ import { stringWidth } from "./view/height.js" import { renderRamp } from "./ramp.js" -import { formatContextPercentLabel } from "../cost/cost-summary.js" +import { formatContextPercentLabel } from "../adapters/cost/cost-summary.js" /** Rounded box drawing, all single-cell. */ export const BORDER = { diff --git a/src/tui/provider-setup-submit.ts b/src/tui/provider-setup-submit.ts index 27e7f2948..4a6f5a578 100644 --- a/src/tui/provider-setup-submit.ts +++ b/src/tui/provider-setup-submit.ts @@ -4,7 +4,7 @@ import { saveLocalSettings, type Settings, } from "../config/settings.js"; -import { validateProviderConnection } from "../provider/validate-connection.js"; +import { validateProviderConnection } from "../adapters/provider/validate-connection.js"; import type { ProviderSetupSubmit } from "./provider-setup.js"; /** diff --git a/src/tui/provider-setup.ts b/src/tui/provider-setup.ts index ca66bdb9a..7cb24f24c 100644 --- a/src/tui/provider-setup.ts +++ b/src/tui/provider-setup.ts @@ -26,12 +26,12 @@ import { type FirstClassOAuthProvider, type FirstClassProviderDef, } from "../../packages/first-class-providers/src/index.js" -import { CODEX_BASE_URL, CODEX_DEFAULT_MODELS } from "../auth/codex/constants.js" -import { XAI_BASE_URL, XAI_DEFAULT_MODELS } from "../auth/xai/constants.js" +import { CODEX_BASE_URL, CODEX_DEFAULT_MODELS } from "../adapters/auth/codex/constants.js" +import { XAI_BASE_URL, XAI_DEFAULT_MODELS } from "../adapters/auth/xai/constants.js" import { PRODUCT_NAME } from "../branding.js" import { codexProviderName } from "../config/codex-providers.js" import { xaiProviderName } from "../config/xai-providers.js" -import { TELEMETRY_NOTICE } from "../telemetry/index.js" +import { TELEMETRY_NOTICE } from "../adapters/telemetry/index.js" import { wrapLines } from "./view/height.js" import { resolveSideMargin } from "./geometry/margins.js" import { @@ -262,10 +262,10 @@ export type OAuthProfileLister = (kind: OAuthKind) => Promise */ const defaultProfileLister: OAuthProfileLister = async (kind) => { if (kind === "codex") { - const { listCodexProfiles } = await import("../auth/codex/store.js") + const { listCodexProfiles } = await import("../adapters/auth/codex/store.js") return (await listCodexProfiles()).map((p) => p.name) } - const { listXaiProfiles } = await import("../auth/xai/store.js") + const { listXaiProfiles } = await import("../adapters/auth/xai/store.js") return (await listXaiProfiles()).map((p) => p.name) } @@ -708,10 +708,10 @@ const defaultLoginStarter: OAuthLoginStarter = async ({ signal, }) => { if (kind === "codex") { - const { startCodexLogin } = await import("../auth/codex/login.js") + const { startCodexLogin } = await import("../adapters/auth/codex/login.js") return startCodexLogin({ profile, signal }) } - const { startXaiLogin } = await import("../auth/xai/login.js") + const { startXaiLogin } = await import("../adapters/auth/xai/login.js") return startXaiLogin({ profile, signal }) } diff --git a/src/tui/runner-host.test.ts b/src/tui/runner-host.test.ts index 1d09aea09..fffc0a2a5 100644 --- a/src/tui/runner-host.test.ts +++ b/src/tui/runner-host.test.ts @@ -3,7 +3,7 @@ import { describe, expect, test } from "bun:test" import type { KeyEvent } from "@opentui/core" -import type { CostSummary } from "../cost/cost-summary.js" +import type { CostSummary } from "../adapters/cost/cost-summary.js" import type { SubAgentSession } from "../subagent/session-store.js" import { createHarness } from "./harness.js" import { acceptOverlaySelection, closeInsetOverlay, runOverlayAction } from "./shell.js" diff --git a/src/tui/runner-host.ts b/src/tui/runner-host.ts index 45b381f55..99200d635 100644 --- a/src/tui/runner-host.ts +++ b/src/tui/runner-host.ts @@ -41,7 +41,7 @@ import { setShellExitHandler, surfaceSystemNotice, } from "./shell.js" -import type { CostSummary } from "../cost/cost-summary.js" +import type { CostSummary } from "../adapters/cost/cost-summary.js" import { watchGitBranch, type FetchBranch } from "./workspace-watch.js" import type { PromptActionBarModelLabelInput } from "./components/prompt-action-bar-label.js" import type { ObserveSession } from "./residuals.js" diff --git a/src/tui/runner.ts b/src/tui/runner.ts index 666525c7d..1f0c721a4 100644 --- a/src/tui/runner.ts +++ b/src/tui/runner.ts @@ -52,11 +52,11 @@ import { codexProfileFromProviderName, isCodexProviderName } from "../config/cod import { xaiProfileFromProviderName } from "../config/xai-providers.js"; import type { PluginsAdmin, PluginDescriptor } from "../plugins/admin.js"; import type { PluginManifest } from "../plugins/manifest.js"; -import { createInferenceDependencies } from "../provider/inference-dependencies.js"; -import { cycleReasoningEffort } from "../provider/reasoning-effort.js"; -import { getValidCodexToken } from "../auth/codex/session.js"; -import { getValidXaiToken } from "../auth/xai/session.js"; -import { refreshCodexInstructions } from "../auth/codex/instructions.js"; +import { createInferenceDependencies } from "../adapters/provider/inference-dependencies.js"; +import { cycleReasoningEffort } from "../adapters/provider/reasoning-effort.js"; +import { getValidCodexToken } from "../adapters/auth/codex/session.js"; +import { getValidXaiToken } from "../adapters/auth/xai/session.js"; +import { refreshCodexInstructions } from "../adapters/auth/codex/instructions.js"; import { expandExistingPluginMembers, expandPluginPath, @@ -95,7 +95,7 @@ import { } from "./commands/registry.js"; import { registerBuiltInCommands } from "./commands/built-in.js"; import type { PluginModule } from "../plugins/loader.js"; -import { createTurnObserver } from "../telemetry/ai-observability.js"; +import { createTurnObserver } from "../adapters/telemetry/ai-observability.js"; import { armFeedbackCapture, cancelFeedbackCapture, @@ -104,25 +104,25 @@ import { getLastTurnTraceId, isFeedbackCapturePending, takeFeedbackCapture, -} from "../telemetry/feedback.js"; -import { activateHeldTelemetry, telemetryFirstRunPending } from "../telemetry/first-run.js"; -import { TELEMETRY_NOTICE } from "../telemetry/index.js"; -import { captureSlashCommand } from "../telemetry/product-events.js"; -import { getTelemetry, liveTelemetry, setTelemetry } from "../telemetry/singleton.js"; -import { createTelemetryToggleHandler } from "../telemetry/toggle.js"; +} from "../adapters/telemetry/feedback.js"; +import { activateHeldTelemetry, telemetryFirstRunPending } from "../adapters/telemetry/first-run.js"; +import { TELEMETRY_NOTICE } from "../adapters/telemetry/index.js"; +import { captureSlashCommand } from "../adapters/telemetry/product-events.js"; +import { getTelemetry, liveTelemetry, setTelemetry } from "../adapters/telemetry/singleton.js"; +import { createTelemetryToggleHandler } from "../adapters/telemetry/toggle.js"; import { loadStartupChangelogMarkdown, stampVersionAfterStartup, -} from "../changelog/index.js"; -import { scheduleUpgradeNotice } from "../upgrade/index.js"; +} from "../adapters/changelog/index.js"; +import { scheduleUpgradeNotice } from "../adapters/upgrade/index.js"; import pkg from "../../package.json" with { type: "json" }; -import { seedPricingMetadataFromCache } from "../cost/pricing-metadata.js"; -import { defaultPricingCachePath } from "../cost/pricing-fetcher.js"; -import { getActivePricingCache } from "../cost/cost-visibility.js"; -import { createFaremeter, formatCost } from "../cost/faremeter.js"; -import { buildCostSummary, type CostSummary } from "../cost/cost-summary.js"; -import { contextTokensFromUsage } from "../provider/context-window.js"; +import { seedPricingMetadataFromCache } from "../adapters/cost/pricing-metadata.js"; +import { defaultPricingCachePath } from "../adapters/cost/pricing-fetcher.js"; +import { getActivePricingCache } from "../adapters/cost/cost-visibility.js"; +import { createFaremeter, formatCost } from "../adapters/cost/faremeter.js"; +import { buildCostSummary, type CostSummary } from "../adapters/cost/cost-summary.js"; +import { contextTokensFromUsage } from "../adapters/provider/context-window.js"; import { advertisedToolNamesForSessionMode, advertisedTools, @@ -202,7 +202,7 @@ import { resolveSessionLabel, truncateSessionLabel } from "../session/session-la import { finalizeRunState, loadState, saveState, type ConnectedMcpServer, type RunState } from "../session/state.js"; import { setActiveRun, clearActiveRun, type RunStateHandle } from "../session/active-run.js"; import { setActiveDisposeHost, clearActiveDisposeHost } from "../session/active-host.js"; -import { openInBrowser } from "../auth/oauth/browser.js"; +import { openInBrowser } from "../adapters/auth/oauth/browser.js"; import { pickSession } from "./pick-session.js"; import { RESUME_TRANSCRIPT_BLOCK_LIMIT, turnsToContentBlocks } from "./turns-to-blocks.js"; import { WorkflowController } from "./workflow-controller.js"; diff --git a/src/tui/session-chrome.ts b/src/tui/session-chrome.ts index 9fd05375b..d33f3bf5a 100644 --- a/src/tui/session-chrome.ts +++ b/src/tui/session-chrome.ts @@ -5,7 +5,7 @@ * duplicating the state machine that produces it. */ -import type { Telemetry } from "../telemetry/index.js" +import type { Telemetry } from "../adapters/telemetry/index.js" import type { FleetProgress } from "./agent-progress.js" import type { RampPhase } from "./ramp.js" diff --git a/src/tui/stream-event-map.ts b/src/tui/stream-event-map.ts index d622668a7..d67dde5ff 100644 --- a/src/tui/stream-event-map.ts +++ b/src/tui/stream-event-map.ts @@ -9,7 +9,7 @@ import { splitPendingControlTail, stripTerminalControlSequences, } from "../util/control-char-strip.js" -import { inferenceErrorMessage } from "../inference-error-message.js" +import { inferenceErrorMessage } from "../adapters/inference-error-message.js" import type { RunState } from "./session-queue.js" /** Canonical inbound events the bridge understands (fixtures + mapped reactor). */ diff --git a/src/tui/submit-handler.test.ts b/src/tui/submit-handler.test.ts index d31d3d45c..5a6ba7a87 100644 --- a/src/tui/submit-handler.test.ts +++ b/src/tui/submit-handler.test.ts @@ -8,13 +8,13 @@ import { userInboundMessage, } from "./runner.js"; import type { PendingImageAttachment } from "./image-attachments.js"; -import { TELEMETRY_NOTICE } from "../telemetry/index.js"; +import { TELEMETRY_NOTICE } from "../adapters/telemetry/index.js"; import { armFeedbackCapture, cancelFeedbackCapture, isFeedbackCapturePending, resetFeedbackStateForTests, -} from "../telemetry/feedback.js"; +} from "../adapters/telemetry/feedback.js"; afterEach(() => { resetFeedbackStateForTests(); diff --git a/src/list-dir.test.ts b/src/util/list-dir.test.ts similarity index 98% rename from src/list-dir.test.ts rename to src/util/list-dir.test.ts index 493b02a3f..f8827c37d 100644 --- a/src/list-dir.test.ts +++ b/src/util/list-dir.test.ts @@ -2,7 +2,7 @@ import { test, expect, describe } from "bun:test"; import { mkdtemp, mkdir, writeFile, symlink } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { listDirectory } from "./util/list-dir.js"; +import { listDirectory } from "./list-dir.js"; async function fixture(): Promise { const dir = await mkdtemp(join(tmpdir(), "list-dir-")); diff --git a/tests/unit/codex-auth.test.ts b/tests/unit/codex-auth.test.ts index a3e69604d..852c938d0 100644 --- a/tests/unit/codex-auth.test.ts +++ b/tests/unit/codex-auth.test.ts @@ -3,8 +3,8 @@ import { mkdtemp, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { createHash } from "node:crypto"; -import { generatePkce, generateState } from "../../src/auth/codex/pkce.js"; -import { accountIdFromIdToken, buildAuthorizeUrl, tokensFromResponse } from "../../src/auth/codex/oauth.js"; +import { generatePkce, generateState } from "../../src/adapters/auth/codex/pkce.js"; +import { accountIdFromIdToken, buildAuthorizeUrl, tokensFromResponse } from "../../src/adapters/auth/codex/oauth.js"; import { listCodexProfiles, loadCodexProfile, @@ -12,8 +12,8 @@ import { saveCodexProfile, updateCodexTokens, type CodexProfile, -} from "../../src/auth/codex/store.js"; -import { CODEX_CLIENT_ID, CODEX_REDIRECT_URI } from "../../src/auth/codex/constants.js"; +} from "../../src/adapters/auth/codex/store.js"; +import { CODEX_CLIENT_ID, CODEX_REDIRECT_URI } from "../../src/adapters/auth/codex/constants.js"; function base64url(buf: Buffer): string { return buf.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""); diff --git a/tests/unit/codex-callback-server.test.ts b/tests/unit/codex-callback-server.test.ts index b851e39e0..3bc30413c 100644 --- a/tests/unit/codex-callback-server.test.ts +++ b/tests/unit/codex-callback-server.test.ts @@ -1,6 +1,6 @@ import { test, expect, describe, afterEach } from "bun:test"; -import { startCodexCallbackServer } from "../../src/auth/codex/callback-server.js"; -import { CODEX_CALLBACK_PORT, CODEX_CALLBACK_PATH } from "../../src/auth/codex/constants.js"; +import { startCodexCallbackServer } from "../../src/adapters/auth/codex/callback-server.js"; +import { CODEX_CALLBACK_PORT, CODEX_CALLBACK_PATH } from "../../src/adapters/auth/codex/constants.js"; // These tests bind the fixed Codex callback port (1455). Each closes its server // in afterEach so the port is free for the next case. diff --git a/tests/unit/codex-instructions.test.ts b/tests/unit/codex-instructions.test.ts index fc9fb58ae..80d6475f6 100644 --- a/tests/unit/codex-instructions.test.ts +++ b/tests/unit/codex-instructions.test.ts @@ -1,6 +1,6 @@ import { test, expect, describe } from "bun:test"; -import { isValidCodexPrompt, codexInstructions } from "../../src/auth/codex/instructions.js"; -import { GPT_5_CODEX_PROMPT } from "../../src/auth/codex/prompts/gpt-5-codex.js"; +import { isValidCodexPrompt, codexInstructions } from "../../src/adapters/auth/codex/instructions.js"; +import { GPT_5_CODEX_PROMPT } from "../../src/adapters/auth/codex/prompts/gpt-5-codex.js"; describe("isValidCodexPrompt", () => { test("accepts the bundled prompt", () => { diff --git a/tests/unit/codex-providers.test.ts b/tests/unit/codex-providers.test.ts index c0d30fa51..6d06d4d73 100644 --- a/tests/unit/codex-providers.test.ts +++ b/tests/unit/codex-providers.test.ts @@ -6,8 +6,8 @@ import { isCodexProviderName, } from "../../src/config/codex-providers.js"; import { providerCatalogToSettings, type ProviderCatalogEntry } from "../../src/config/index.js"; -import { CODEX_BASE_URL, CODEX_DEFAULT_MODELS } from "../../src/auth/codex/constants.js"; -import type { CodexProfile } from "../../src/auth/codex/store.js"; +import { CODEX_BASE_URL, CODEX_DEFAULT_MODELS } from "../../src/adapters/auth/codex/constants.js"; +import type { CodexProfile } from "../../src/adapters/auth/codex/store.js"; describe("codex provider naming", () => { test("round-trips profile name through the codex/ prefix", () => { diff --git a/tests/unit/codex-responses-adapter.test.ts b/tests/unit/codex-responses-adapter.test.ts index 2e9073812..7c220800e 100644 --- a/tests/unit/codex-responses-adapter.test.ts +++ b/tests/unit/codex-responses-adapter.test.ts @@ -6,8 +6,8 @@ import { CODEX_ACCOUNT_ID_OPTION, CODEX_SESSION_ID_OPTION, CODEX_RESPONSES_PROVIDER, -} from "../../src/provider/codex-responses-adapter.js"; -import { GROK_RESPONSES_PROVIDER } from "../../src/provider/grok-responses-adapter.js"; +} from "../../src/adapters/provider/codex-responses-adapter.js"; +import { GROK_RESPONSES_PROVIDER } from "../../src/adapters/provider/grok-responses-adapter.js"; import { BEARER_CREDENTIAL_SENTINEL } from "@intx/inference"; import type { ConversationTurn, InferenceOptions, LastCycleSource } from "@intx/types/runtime"; diff --git a/tests/unit/codex-session.test.ts b/tests/unit/codex-session.test.ts index dbcf45f32..83860e8b5 100644 --- a/tests/unit/codex-session.test.ts +++ b/tests/unit/codex-session.test.ts @@ -2,8 +2,8 @@ import { test, expect, describe, beforeEach, afterEach } from "bun:test"; import { mkdtemp, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { isCodexTokenExpired, getValidCodexToken, CodexAuthError } from "../../src/auth/codex/session.js"; -import { loadCodexProfile, saveCodexProfile } from "../../src/auth/codex/store.js"; +import { isCodexTokenExpired, getValidCodexToken, CodexAuthError } from "../../src/adapters/auth/codex/session.js"; +import { loadCodexProfile, saveCodexProfile } from "../../src/adapters/auth/codex/store.js"; describe("isCodexTokenExpired", () => { test("not expired well before expiry", () => { diff --git a/tests/unit/codex-sse-fixtures.test.ts b/tests/unit/codex-sse-fixtures.test.ts index c6649a922..43590468b 100644 --- a/tests/unit/codex-sse-fixtures.test.ts +++ b/tests/unit/codex-sse-fixtures.test.ts @@ -11,7 +11,7 @@ import { createCodexResponsesAdapter, isResponsesStreamTerminal, tagSignature, -} from "../../src/provider/codex-responses-adapter.js"; +} from "../../src/adapters/provider/codex-responses-adapter.js"; import type { InferenceEvent, LastCycleSource } from "@intx/types/runtime"; import { ProtocolMismatchError } from "@intx/inference"; diff --git a/tests/unit/codex-usage.test.ts b/tests/unit/codex-usage.test.ts index 99f19ab39..6265786c7 100644 --- a/tests/unit/codex-usage.test.ts +++ b/tests/unit/codex-usage.test.ts @@ -3,7 +3,7 @@ import { formatCodexUsage, formatCodexUsageCompact, type CodexUsage, -} from "../../src/auth/codex/usage.js"; +} from "../../src/adapters/auth/codex/usage.js"; describe("formatCodexUsage", () => { test("renders both windows with percent and reset, no dollar figures", () => { diff --git a/tests/unit/config.test.ts b/tests/unit/config.test.ts index 671517759..3059383c8 100644 --- a/tests/unit/config.test.ts +++ b/tests/unit/config.test.ts @@ -10,7 +10,7 @@ const realNodeOs = { ...nodeOs }; import { tmpdir } from "node:os"; import { join } from "node:path"; import { loadConfig } from "../../src/config/index.js"; -import { resetPricingMetadataRefreshForTests } from "../../src/cost/pricing-metadata.js"; +import { resetPricingMetadataRefreshForTests } from "../../src/adapters/cost/pricing-metadata.js"; // Rejects immediately instead of touching the network. loadConfig's pricing // refresh is fire-and-forget, so a resolved run proves only that the injected diff --git a/tests/unit/context-window.test.ts b/tests/unit/context-window.test.ts index faf0423f7..f3904ba27 100644 --- a/tests/unit/context-window.test.ts +++ b/tests/unit/context-window.test.ts @@ -7,7 +7,7 @@ import { COMPACTION_WINDOW_FRACTION, CONTEXT_METER_DANGER_FRACTION, setModelContextWindows, -} from "../../src/provider/context-window.js"; +} from "../../src/adapters/provider/context-window.js"; function usage(overrides: Partial): TokenUsage { return { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, thinking: 0, ...overrides }; diff --git a/tests/unit/faremeter.test.ts b/tests/unit/faremeter.test.ts index 280b56ae8..840281072 100644 --- a/tests/unit/faremeter.test.ts +++ b/tests/unit/faremeter.test.ts @@ -1,5 +1,5 @@ import { test, expect } from "bun:test"; -import { createFaremeter, formatCost } from "../../src/cost/faremeter.js"; +import { createFaremeter, formatCost } from "../../src/adapters/cost/faremeter.js"; test("createFaremeter starts at zero", () => { const faremeter = createFaremeter(); diff --git a/tests/unit/grok-responses-adapter.test.ts b/tests/unit/grok-responses-adapter.test.ts index a2b0412cf..8015ecb1d 100644 --- a/tests/unit/grok-responses-adapter.test.ts +++ b/tests/unit/grok-responses-adapter.test.ts @@ -2,7 +2,7 @@ import { test, expect, describe } from "bun:test"; import { createGrokResponsesAdapter, GROK_USER_ID_OPTION, -} from "../../src/provider/grok-responses-adapter.js"; +} from "../../src/adapters/provider/grok-responses-adapter.js"; import { BEARER_CREDENTIAL_SENTINEL } from "@intx/inference"; import type { ConversationTurn, InferenceOptions, LastCycleSource } from "@intx/types/runtime"; diff --git a/tests/unit/index.test.ts b/tests/unit/index.test.ts index 2e97c8544..891517002 100644 --- a/tests/unit/index.test.ts +++ b/tests/unit/index.test.ts @@ -6,7 +6,7 @@ import type { Config } from "../../src/config/index.js"; import { resetPricingMetadataRefreshForTests, schedulePricingMetadataRefresh, -} from "../../src/cost/pricing-metadata.js"; +} from "../../src/adapters/cost/pricing-metadata.js"; import { mainWithRunners } from "../../src/index.js"; const envVars = { diff --git a/tests/unit/inference-abort.test.ts b/tests/unit/inference-abort.test.ts index 263d4ee1b..ff61b4774 100644 --- a/tests/unit/inference-abort.test.ts +++ b/tests/unit/inference-abort.test.ts @@ -4,7 +4,7 @@ import { INFERENCE_ABORT_USER_STOP, isInternalRecoveryAbortRaw, isNonTerminalInferenceError, -} from "../../src/inference-abort.js"; +} from "../../src/adapters/inference-abort.js"; test("isInternalRecoveryAbortRaw matches internal-recovery origin", () => { expect(isInternalRecoveryAbortRaw({ origin: INFERENCE_ABORT_INTERNAL_RECOVERY })).toBe(true); diff --git a/tests/unit/inference-response-kind.test.ts b/tests/unit/inference-response-kind.test.ts index 07798f0f1..0b08a4334 100644 --- a/tests/unit/inference-response-kind.test.ts +++ b/tests/unit/inference-response-kind.test.ts @@ -18,12 +18,12 @@ import type { InferenceEvent, InferenceSource, } from "@intx/types/runtime"; -import { createInferenceDependencies } from "../../src/provider/inference-dependencies.js"; +import { createInferenceDependencies } from "../../src/adapters/provider/inference-dependencies.js"; import { CODEX_RESPONSES_PROVIDER, withCodexContentTypeRepair, -} from "../../src/provider/codex-responses-adapter.js"; -import { CODEX_RESPONSES_PATH } from "../../src/auth/codex/constants.js"; +} from "../../src/adapters/provider/codex-responses-adapter.js"; +import { CODEX_RESPONSES_PATH } from "../../src/adapters/auth/codex/constants.js"; const CODEX_URL = `https://chatgpt.com/backend-api${CODEX_RESPONSES_PATH}`; @@ -194,7 +194,7 @@ describe("withCodexContentTypeRepair boundaries", () => { ) as typeof globalThis.fetch; try { const specifier = - "../../src/provider/inference-dependencies.js" + "?wiring-regression"; + "../../src/adapters/provider/inference-dependencies.js" + "?wiring-regression"; const mod = (await import(specifier)) as { createInferenceDependencies: () => Promise; }; diff --git a/tests/unit/pricing-fetcher.test.ts b/tests/unit/pricing-fetcher.test.ts index a73398a9a..2270c7d8b 100644 --- a/tests/unit/pricing-fetcher.test.ts +++ b/tests/unit/pricing-fetcher.test.ts @@ -4,7 +4,7 @@ import { tmpdir } from "node:os"; import { expect, test } from "bun:test"; -import { fetchPricing, loadPricing, parseModelsDevPricing, parseModelsDevContextWindows, readPricingCache, writePricingCache } from "../../src/cost/pricing-fetcher.js"; +import { fetchPricing, loadPricing, parseModelsDevPricing, parseModelsDevContextWindows, readPricingCache, writePricingCache } from "../../src/adapters/cost/pricing-fetcher.js"; test("parseModelsDevContextWindows reads limit.context per model", () => { const windows = parseModelsDevContextWindows({ diff --git a/tests/unit/telemetry-first-run.test.ts b/tests/unit/telemetry-first-run.test.ts index 92cfac2c0..7d8c1df46 100644 --- a/tests/unit/telemetry-first-run.test.ts +++ b/tests/unit/telemetry-first-run.test.ts @@ -3,8 +3,8 @@ import { activateHeldTelemetry, telemetryFirstRunPending, type FirstRunDeps, -} from "../../src/telemetry/first-run.js"; -import { createTelemetry, type Telemetry } from "../../src/telemetry/index.js"; +} from "../../src/adapters/telemetry/first-run.js"; +import { createTelemetry, type Telemetry } from "../../src/adapters/telemetry/index.js"; import type { Settings } from "../../src/config/settings.js"; function settingsWith(overrides: Settings["telemetry"] = {}): Settings { diff --git a/tests/unit/telemetry-product-events.test.ts b/tests/unit/telemetry-product-events.test.ts index 522ce8aee..54ef91eeb 100644 --- a/tests/unit/telemetry-product-events.test.ts +++ b/tests/unit/telemetry-product-events.test.ts @@ -20,10 +20,10 @@ import { classifyAgentName, classifyErrorClass, classifyPermissionKind, -} from "../../src/telemetry/classify.js"; +} from "../../src/adapters/telemetry/classify.js"; -import { createTelemetry, type Telemetry } from "../../src/telemetry/index.js"; -import { captureSlashCommand } from "../../src/telemetry/product-events.js"; +import { createTelemetry, type Telemetry } from "../../src/adapters/telemetry/index.js"; +import { captureSlashCommand } from "../../src/adapters/telemetry/product-events.js"; import { captureAuthFailure, classifyAgentSendFailure, diff --git a/tests/unit/telemetry-singleton.test.ts b/tests/unit/telemetry-singleton.test.ts index 61477a263..9df9c5f97 100644 --- a/tests/unit/telemetry-singleton.test.ts +++ b/tests/unit/telemetry-singleton.test.ts @@ -1,6 +1,6 @@ import { test, expect } from "bun:test"; -import { getTelemetry, setTelemetry } from "../../src/telemetry/singleton.js"; -import { NOOP_TELEMETRY } from "../../src/telemetry/index.js"; +import { getTelemetry, setTelemetry } from "../../src/adapters/telemetry/singleton.js"; +import { NOOP_TELEMETRY } from "../../src/adapters/telemetry/index.js"; test("getTelemetry defaults to a disabled no-op that never throws", () => { const telemetry = getTelemetry(); diff --git a/tests/unit/telemetry-toggle.test.ts b/tests/unit/telemetry-toggle.test.ts index 2e85af68c..47bc4900e 100644 --- a/tests/unit/telemetry-toggle.test.ts +++ b/tests/unit/telemetry-toggle.test.ts @@ -1,8 +1,8 @@ import { test, expect } from "bun:test"; -import { createTelemetryToggleHandler, type TelemetryToggleDeps } from "../../src/telemetry/toggle.js"; -import { createTelemetry, getSessionId } from "../../src/telemetry/index.js"; +import { createTelemetryToggleHandler, type TelemetryToggleDeps } from "../../src/adapters/telemetry/toggle.js"; +import { createTelemetry, getSessionId } from "../../src/adapters/telemetry/index.js"; import type { Settings } from "../../src/config/settings.js"; -import type { Telemetry } from "../../src/telemetry/index.js"; +import type { Telemetry } from "../../src/adapters/telemetry/index.js"; function fakeDeps(overrides: Partial = {}): { deps: TelemetryToggleDeps; diff --git a/tests/unit/telemetry.test.ts b/tests/unit/telemetry.test.ts index 1d7c621d9..28efce39a 100644 --- a/tests/unit/telemetry.test.ts +++ b/tests/unit/telemetry.test.ts @@ -7,7 +7,7 @@ import { getSessionId, resolveTelemetryEnabled, telemetryDisabledByEnv, -} from "../../src/telemetry/index.js"; +} from "../../src/adapters/telemetry/index.js"; import { ensureTelemetrySettings } from "../../src/config/settings.js"; import type { Settings } from "../../src/config/settings.js"; diff --git a/tests/unit/xai-usage.test.ts b/tests/unit/xai-usage.test.ts index ed29d7e81..9cf7d50c6 100644 --- a/tests/unit/xai-usage.test.ts +++ b/tests/unit/xai-usage.test.ts @@ -3,7 +3,7 @@ import { formatXaiUsage, formatXaiUsageCompact, type XaiUsage, -} from "../../src/auth/xai/usage.js"; +} from "../../src/adapters/auth/xai/usage.js"; describe("formatXaiUsage", () => { test("renders tier and credit percent, no dollar figures", () => {