diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60c115c47..8967565e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: key: bun-${{ runner.os }}-${{ hashFiles('**/bun.lock') }} - run: bun install --frozen-lockfile - name: Generate WASM base64 - run: printf 'export default "%s";\n' "$(base64 -w0 packages/coding-agent/src/vendor/photon/photon_rs_bg.wasm)" > packages/coding-agent/src/vendor/photon/photon_rs_bg.wasm.b64.js + run: bun packages/coding-agent/scripts/generate-wasm-b64.ts - name: Build binaries run: | cd packages/coding-agent diff --git a/package.json b/package.json index 9ea64789c..e381c2941 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "packages/*" ], "scripts": { - "install:dev": "bun install && bun --cwd=packages/coding-agent link && bun --cwd=packages/ai link", + "install:dev": "bun install && bun packages/coding-agent/scripts/generate-wasm-b64.ts && bun --cwd=packages/coding-agent link && bun --cwd=packages/ai link", "dev": "bun packages/coding-agent/src/cli.ts", "stats": "bun --cwd=packages/coding-agent src/cli.ts stats", "check": "biome check --write . && bun --cwd=packages/coding-agent run check && bun --cwd=packages/omp-stats run check", diff --git a/packages/agent/CHANGELOG.md b/packages/agent/CHANGELOG.md index 7f1f85642..216d81ac1 100644 --- a/packages/agent/CHANGELOG.md +++ b/packages/agent/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased] +### Changed +- Updated TypeScript configuration for better publish-time configuration handling with tsconfig.publish.json ## [8.0.0] - 2026-01-23 ### Added diff --git a/packages/agent/package.json b/packages/agent/package.json index 789a9bdf9..25c056af2 100644 --- a/packages/agent/package.json +++ b/packages/agent/package.json @@ -5,12 +5,23 @@ "type": "module", "main": "./src/index.ts", "types": "./src/index.ts", + "exports": { + ".": { + "types": "./src/index.ts", + "import": "./src/index.ts" + }, + "./*": { + "types": "./src/*", + "import": "./src/*" + } + }, "files": [ "src", "README.md" ], "scripts": { - "test": "vitest --run" + "test": "vitest --run", + "prepublishOnly": "cp tsconfig.publish.json tsconfig.json" }, "dependencies": { "@oh-my-pi/pi-ai": "workspace:*", diff --git a/packages/agent/src/proxy.ts b/packages/agent/src/proxy.ts index 6382190bc..c75748abe 100644 --- a/packages/agent/src/proxy.ts +++ b/packages/agent/src/proxy.ts @@ -13,7 +13,7 @@ import { type StopReason, type ToolCall, } from "@oh-my-pi/pi-ai"; -import { parseStreamingJson } from "@oh-my-pi/pi-ai/src/utils/json-parse"; +import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse"; import { readSseEvents } from "@oh-my-pi/pi-utils"; // Create stream class matching ProxyMessageEventStream diff --git a/packages/agent/tsconfig.publish.json b/packages/agent/tsconfig.publish.json new file mode 100644 index 000000000..d3545e257 --- /dev/null +++ b/packages/agent/tsconfig.publish.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "noEmit": true, + "baseUrl": ".", + "paths": { + "@oh-my-pi/pi-agent-core": ["./src/index.ts"], + "@oh-my-pi/pi-agent-core/*": ["./src/*"] + } + }, + "include": ["src/**/*.ts"] +} diff --git a/packages/ai/CHANGELOG.md b/packages/ai/CHANGELOG.md index 2ce473367..464a3361e 100644 --- a/packages/ai/CHANGELOG.md +++ b/packages/ai/CHANGELOG.md @@ -2,8 +2,8 @@ ## [Unreleased] -### Added -- Added `isRetryableError` and `extractHttpStatusFromError` utility functions to identify transient errors suitable for retry (timeouts, 5xx, 408, 429, network failures) +### Changed +- Updated TypeScript configuration for better publish-time configuration handling with tsconfig.publish.json ## [8.0.0] - 2026-01-23 ### Fixed diff --git a/packages/ai/package.json b/packages/ai/package.json index caad0234b..053c76950 100644 --- a/packages/ai/package.json +++ b/packages/ai/package.json @@ -5,6 +5,20 @@ "type": "module", "main": "./src/index.ts", "types": "./src/index.ts", + "exports": { + ".": { + "types": "./src/index.ts", + "import": "./src/index.ts" + }, + "./utils/*": { + "types": "./src/utils/*.ts", + "import": "./src/utils/*.ts" + }, + "./*": { + "types": "./src/*", + "import": "./src/*" + } + }, "bin": { "pi-ai": "./src/cli.ts" }, @@ -14,7 +28,8 @@ ], "scripts": { "generate-models": "bun scripts/generate-models.ts", - "test": "bun test" + "test": "bun test", + "prepublishOnly": "cp tsconfig.publish.json tsconfig.json" }, "dependencies": { "@oh-my-pi/pi-utils": "workspace:*", diff --git a/packages/ai/src/models.generated.ts b/packages/ai/src/models.generated.ts index fcb137512..e8f5ff142 100644 --- a/packages/ai/src/models.generated.ts +++ b/packages/ai/src/models.generated.ts @@ -1726,7 +1726,7 @@ export const MODELS = { cacheRead: 0, cacheWrite: 0, }, - contextWindow: 128000, + contextWindow: 64000, maxTokens: 16384, } satisfies Model<"openai-completions">, "gpt-4o": { @@ -1766,24 +1766,6 @@ export const MODELS = { contextWindow: 128000, maxTokens: 128000, } satisfies Model<"openai-responses">, - "gpt-5-codex": { - id: "gpt-5-codex", - name: "GPT-5-Codex", - api: "openai-responses", - provider: "github-copilot", - baseUrl: "https://api.individual.githubcopilot.com", - headers: {"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"}, - reasoning: true, - input: ["text", "image"], - cost: { - input: 0, - output: 0, - cacheRead: 0, - cacheWrite: 0, - }, - contextWindow: 128000, - maxTokens: 128000, - } satisfies Model<"openai-responses">, "gpt-5-mini": { id: "gpt-5-mini", name: "GPT-5-mini", @@ -3641,7 +3623,7 @@ export const MODELS = { cost: { input: 1.25, output: 10, - cacheRead: 0.13, + cacheRead: 0.125, cacheWrite: 0, }, contextWindow: 400000, @@ -3692,7 +3674,7 @@ export const MODELS = { cost: { input: 0.25, output: 2, - cacheRead: 0.03, + cacheRead: 0.025, cacheWrite: 0, }, contextWindow: 400000, @@ -3709,7 +3691,7 @@ export const MODELS = { cost: { input: 0.05, output: 0.4, - cacheRead: 0.01, + cacheRead: 0.005, cacheWrite: 0, }, contextWindow: 400000, @@ -4314,6 +4296,23 @@ export const MODELS = { contextWindow: 204800, maxTokens: 131072, } satisfies Model<"openai-completions">, + "glm-4.7": { + id: "glm-4.7", + name: "GLM-4.7", + api: "openai-completions", + provider: "opencode", + baseUrl: "https://opencode.ai/zen/v1", + reasoning: true, + input: ["text"], + cost: { + input: 0.6, + output: 2.2, + cacheRead: 0.1, + cacheWrite: 0, + }, + contextWindow: 204800, + maxTokens: 131072, + } satisfies Model<"openai-completions">, "glm-4.7-free": { id: "glm-4.7-free", name: "GLM-4.7", @@ -4615,7 +4614,7 @@ export const MODELS = { input: ["text"], cost: { input: 0.09, - output: 0.39999999999999997, + output: 0.44999999999999996, cacheRead: 0, cacheWrite: 0, }, @@ -5028,7 +5027,7 @@ export const MODELS = { cacheWrite: 0, }, contextWindow: 262144, - maxTokens: 16384, + maxTokens: 32768, } satisfies Model<"openai-completions">, "cohere/command-r-08-2024": { id: "cohere/command-r-08-2024", @@ -5297,7 +5296,7 @@ export const MODELS = { input: 0.09999999999999999, output: 0.39999999999999997, cacheRead: 0.024999999999999998, - cacheWrite: 0.0833, + cacheWrite: 0.08333333333333333, }, contextWindow: 1048576, maxTokens: 8192, @@ -5311,10 +5310,10 @@ export const MODELS = { reasoning: false, input: ["text", "image"], cost: { - input: 0, - output: 0, - cacheRead: 0, - cacheWrite: 0, + input: 0.09999999999999999, + output: 0.39999999999999997, + cacheRead: 0.024999999999999998, + cacheWrite: 0.08333333333333333, }, contextWindow: 1048576, maxTokens: 8192, @@ -5348,7 +5347,7 @@ export const MODELS = { input: 0.3, output: 2.5, cacheRead: 0.03, - cacheWrite: 0.08333333333333334, + cacheWrite: 0.08333333333333333, }, contextWindow: 1048576, maxTokens: 65535, @@ -5365,7 +5364,7 @@ export const MODELS = { input: 0.09999999999999999, output: 0.39999999999999997, cacheRead: 0.01, - cacheWrite: 0.0833, + cacheWrite: 0.08333333333333333, }, contextWindow: 1048576, maxTokens: 65535, @@ -5382,10 +5381,10 @@ export const MODELS = { input: 0.09999999999999999, output: 0.39999999999999997, cacheRead: 0.01, - cacheWrite: 0.0833, + cacheWrite: 0.08333333333333333, }, contextWindow: 1048576, - maxTokens: 65536, + maxTokens: 65535, } satisfies Model<"openai-completions">, "google/gemini-2.5-flash-preview-09-2025": { id: "google/gemini-2.5-flash-preview-09-2025", @@ -5398,8 +5397,8 @@ export const MODELS = { cost: { input: 0.3, output: 2.5, - cacheRead: 0.075, - cacheWrite: 0.0833, + cacheRead: 0.03, + cacheWrite: 0.08333333333333333, }, contextWindow: 1048576, maxTokens: 65535, @@ -5432,7 +5431,7 @@ export const MODELS = { cost: { input: 1.25, output: 10, - cacheRead: 0.31, + cacheRead: 0.125, cacheWrite: 0.375, }, contextWindow: 1048576, @@ -5449,7 +5448,7 @@ export const MODELS = { cost: { input: 1.25, output: 10, - cacheRead: 0.31, + cacheRead: 0.125, cacheWrite: 0.375, }, contextWindow: 1048576, @@ -5467,7 +5466,7 @@ export const MODELS = { input: 0.5, output: 3, cacheRead: 0.049999999999999996, - cacheWrite: 0, + cacheWrite: 0.08333333333333333, }, contextWindow: 1048576, maxTokens: 65535, @@ -5754,12 +5753,12 @@ export const MODELS = { input: ["text"], cost: { input: 0.27, - output: 1.12, + output: 1.1, cacheRead: 0, cacheWrite: 0, }, contextWindow: 196608, - maxTokens: 65536, + maxTokens: 196608, } satisfies Model<"openai-completions">, "mistralai/codestral-2508": { id: "mistralai/codestral-2508", @@ -6048,7 +6047,7 @@ export const MODELS = { cacheWrite: 0, }, contextWindow: 131072, - maxTokens: 131072, + maxTokens: 16384, } satisfies Model<"openai-completions">, "mistralai/mistral-saba": { id: "mistralai/mistral-saba", @@ -7869,6 +7868,23 @@ export const MODELS = { contextWindow: 262144, maxTokens: 4096, } satisfies Model<"openai-completions">, + "qwen/qwen3-vl-235b-a22b-thinking": { + id: "qwen/qwen3-vl-235b-a22b-thinking", + name: "Qwen: Qwen3 VL 235B A22B Thinking", + api: "openai-completions", + provider: "openrouter", + baseUrl: "https://openrouter.ai/api/v1", + reasoning: true, + input: ["text", "image"], + cost: { + input: 0.44999999999999996, + output: 3.5, + cacheRead: 0, + cacheWrite: 0, + }, + contextWindow: 262144, + maxTokens: 262144, + } satisfies Model<"openai-completions">, "qwen/qwen3-vl-30b-a3b-instruct": { id: "qwen/qwen3-vl-30b-a3b-instruct", name: "Qwen: Qwen3 VL 30B A3B Instruct", @@ -8430,6 +8446,23 @@ export const MODELS = { contextWindow: 202752, maxTokens: 65535, } satisfies Model<"openai-completions">, + "z-ai/glm-4.7-flash": { + id: "z-ai/glm-4.7-flash", + name: "Z.AI: GLM 4.7 Flash", + api: "openai-completions", + provider: "openrouter", + baseUrl: "https://openrouter.ai/api/v1", + reasoning: true, + input: ["text"], + cost: { + input: 0.07, + output: 0.39999999999999997, + cacheRead: 0.01, + cacheWrite: 0, + }, + contextWindow: 200000, + maxTokens: 131072, + } satisfies Model<"openai-completions">, }, "vercel-ai-gateway": { "alibaba/qwen-3-14b": { @@ -8562,7 +8595,7 @@ export const MODELS = { cost: { input: 1, output: 5, - cacheRead: 0, + cacheRead: 0.19999999999999998, cacheWrite: 0, }, contextWindow: 1000000, @@ -8619,23 +8652,6 @@ export const MODELS = { contextWindow: 200000, maxTokens: 4096, } satisfies Model<"anthropic-messages">, - "anthropic/claude-3-opus": { - id: "anthropic/claude-3-opus", - name: "Claude 3 Opus", - api: "anthropic-messages", - provider: "vercel-ai-gateway", - baseUrl: "https://ai-gateway.vercel.sh", - reasoning: false, - input: ["text", "image"], - cost: { - input: 15, - output: 75, - cacheRead: 0, - cacheWrite: 0, - }, - contextWindow: 200000, - maxTokens: 8192, - } satisfies Model<"anthropic-messages">, "anthropic/claude-3.5-haiku": { id: "anthropic/claude-3.5-haiku", name: "Claude 3.5 Haiku", @@ -8786,7 +8802,7 @@ export const MODELS = { cacheRead: 0.3, cacheWrite: 3.75, }, - contextWindow: 200000, + contextWindow: 1000000, maxTokens: 64000, } satisfies Model<"anthropic-messages">, "anthropic/claude-sonnet-4.5": { @@ -8803,7 +8819,7 @@ export const MODELS = { cacheRead: 0.3, cacheWrite: 3.75, }, - contextWindow: 200000, + contextWindow: 1000000, maxTokens: 64000, } satisfies Model<"anthropic-messages">, "bytedance/seed-1.6": { @@ -8925,40 +8941,6 @@ export const MODELS = { contextWindow: 128000, maxTokens: 64000, } satisfies Model<"anthropic-messages">, - "google/gemini-2.0-flash": { - id: "google/gemini-2.0-flash", - name: "Gemini 2.0 Flash", - api: "anthropic-messages", - provider: "vercel-ai-gateway", - baseUrl: "https://ai-gateway.vercel.sh", - reasoning: false, - input: ["text", "image"], - cost: { - input: 0.09999999999999999, - output: 0.39999999999999997, - cacheRead: 0.024999999999999998, - cacheWrite: 0, - }, - contextWindow: 1000000, - maxTokens: 8192, - } satisfies Model<"anthropic-messages">, - "google/gemini-2.0-flash-lite": { - id: "google/gemini-2.0-flash-lite", - name: "Gemini 2.0 Flash Lite", - api: "anthropic-messages", - provider: "vercel-ai-gateway", - baseUrl: "https://ai-gateway.vercel.sh", - reasoning: false, - input: ["text", "image"], - cost: { - input: 0.075, - output: 0.3, - cacheRead: 0, - cacheWrite: 0, - }, - contextWindow: 1048576, - maxTokens: 8192, - } satisfies Model<"anthropic-messages">, "google/gemini-2.5-flash": { id: "google/gemini-2.5-flash", name: "Gemini 2.5 Flash", @@ -8966,15 +8948,15 @@ export const MODELS = { provider: "vercel-ai-gateway", baseUrl: "https://ai-gateway.vercel.sh", reasoning: true, - input: ["text", "image"], + input: ["text"], cost: { input: 0.3, output: 2.5, - cacheRead: 0.03, + cacheRead: 0, cacheWrite: 0, }, contextWindow: 1000000, - maxTokens: 64000, + maxTokens: 65536, } satisfies Model<"anthropic-messages">, "google/gemini-2.5-flash-lite": { id: "google/gemini-2.5-flash-lite", @@ -9034,11 +9016,11 @@ export const MODELS = { provider: "vercel-ai-gateway", baseUrl: "https://ai-gateway.vercel.sh", reasoning: true, - input: ["text", "image"], + input: ["text"], cost: { input: 1.25, output: 10, - cacheRead: 0.125, + cacheRead: 0, cacheWrite: 0, }, contextWindow: 1048576, @@ -10449,7 +10431,7 @@ export const MODELS = { cost: { input: 0.19999999999999998, output: 1.1, - cacheRead: 0, + cacheRead: 0.03, cacheWrite: 0, }, contextWindow: 128000, @@ -10540,6 +10522,23 @@ export const MODELS = { contextWindow: 202752, maxTokens: 120000, } satisfies Model<"anthropic-messages">, + "zai/glm-4.7-flashx": { + id: "zai/glm-4.7-flashx", + name: "GLM 4.7 FlashX", + api: "anthropic-messages", + provider: "vercel-ai-gateway", + baseUrl: "https://ai-gateway.vercel.sh", + reasoning: true, + input: ["text"], + cost: { + input: 0.06, + output: 0.39999999999999997, + cacheRead: 0.01, + cacheWrite: 0, + }, + contextWindow: 200000, + maxTokens: 128000, + } satisfies Model<"anthropic-messages">, }, "xai": { "grok-2": { diff --git a/packages/ai/src/providers/amazon-bedrock.ts b/packages/ai/src/providers/amazon-bedrock.ts index 6ae336cd8..acf3f35f6 100644 --- a/packages/ai/src/providers/amazon-bedrock.ts +++ b/packages/ai/src/providers/amazon-bedrock.ts @@ -18,7 +18,7 @@ import { ToolResultStatus, } from "@aws-sdk/client-bedrock-runtime"; -import { calculateCost } from "$ai/models"; +import { calculateCost } from "@oh-my-pi/pi-ai/models"; import type { Api, AssistantMessage, @@ -34,10 +34,10 @@ import type { Tool, ToolCall, ToolResultMessage, -} from "$ai/types"; -import { AssistantMessageEventStream } from "$ai/utils/event-stream"; -import { parseStreamingJson } from "$ai/utils/json-parse"; -import { sanitizeSurrogates } from "$ai/utils/sanitize-unicode"; +} from "@oh-my-pi/pi-ai/types"; +import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"; +import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse"; +import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode"; import { transformMessages } from "./transform-messages"; export interface BedrockOptions extends StreamOptions { diff --git a/packages/ai/src/providers/anthropic.ts b/packages/ai/src/providers/anthropic.ts index 3e32aba74..dbdad8890 100644 --- a/packages/ai/src/providers/anthropic.ts +++ b/packages/ai/src/providers/anthropic.ts @@ -4,8 +4,8 @@ import type { MessageCreateParamsStreaming, MessageParam, } from "@anthropic-ai/sdk/resources/messages"; -import { calculateCost } from "$ai/models"; -import { getEnvApiKey, OUTPUT_FALLBACK_BUFFER } from "$ai/stream"; +import { calculateCost } from "@oh-my-pi/pi-ai/models"; +import { getEnvApiKey, OUTPUT_FALLBACK_BUFFER } from "@oh-my-pi/pi-ai/stream"; import type { Api, AssistantMessage, @@ -21,11 +21,11 @@ import type { Tool, ToolCall, ToolResultMessage, -} from "$ai/types"; -import { AssistantMessageEventStream } from "$ai/utils/event-stream"; -import { parseStreamingJson } from "$ai/utils/json-parse"; -import { formatErrorMessageWithRetryAfter } from "$ai/utils/retry-after"; -import { sanitizeSurrogates } from "$ai/utils/sanitize-unicode"; +} from "@oh-my-pi/pi-ai/types"; +import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"; +import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse"; +import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after"; +import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode"; import { transformMessages } from "./transform-messages"; diff --git a/packages/ai/src/providers/cursor.ts b/packages/ai/src/providers/cursor.ts index 0b8faab0a..367f39fc7 100644 --- a/packages/ai/src/providers/cursor.ts +++ b/packages/ai/src/providers/cursor.ts @@ -3,8 +3,7 @@ import { appendFile } from "node:fs/promises"; import http2 from "node:http2"; import { create, fromBinary, fromJson, type JsonValue, toBinary, toJson } from "@bufbuild/protobuf"; import { ValueSchema } from "@bufbuild/protobuf/wkt"; -import JSON5 from "json5"; -import { calculateCost } from "$ai/models"; +import { calculateCost } from "@oh-my-pi/pi-ai/models"; import type { Api, AssistantMessage, @@ -23,10 +22,11 @@ import type { Tool, ToolCall, ToolResultMessage, -} from "$ai/types"; -import { AssistantMessageEventStream } from "$ai/utils/event-stream"; -import { parseStreamingJson } from "$ai/utils/json-parse"; -import { formatErrorMessageWithRetryAfter } from "$ai/utils/retry-after"; +} from "@oh-my-pi/pi-ai/types"; +import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"; +import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse"; +import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after"; +import JSON5 from "json5"; import type { McpToolDefinition } from "./cursor/gen/agent_pb"; import { AgentClientMessageSchema, diff --git a/packages/ai/src/providers/google-gemini-cli-usage.ts b/packages/ai/src/providers/google-gemini-cli-usage.ts index 1d658aaf0..89097df77 100644 --- a/packages/ai/src/providers/google-gemini-cli-usage.ts +++ b/packages/ai/src/providers/google-gemini-cli-usage.ts @@ -6,8 +6,8 @@ import type { UsageProvider, UsageReport, UsageWindow, -} from "$ai/usage"; -import { refreshGoogleCloudToken } from "$ai/utils/oauth/google-gemini-cli"; +} from "@oh-my-pi/pi-ai/usage"; +import { refreshGoogleCloudToken } from "@oh-my-pi/pi-ai/utils/oauth/google-gemini-cli"; const DEFAULT_ENDPOINT = "https://cloudcode-pa.googleapis.com"; const CACHE_TTL_MS = 60_000; diff --git a/packages/ai/src/providers/google-gemini-cli.ts b/packages/ai/src/providers/google-gemini-cli.ts index cfeb16cda..785a0d402 100644 --- a/packages/ai/src/providers/google-gemini-cli.ts +++ b/packages/ai/src/providers/google-gemini-cli.ts @@ -6,8 +6,7 @@ import { createHash } from "node:crypto"; import type { Content, ThinkingConfig } from "@google/genai"; -import { abortableSleep } from "@oh-my-pi/pi-utils"; -import { calculateCost } from "$ai/models"; +import { calculateCost } from "@oh-my-pi/pi-ai/models"; import type { Api, AssistantMessage, @@ -18,9 +17,10 @@ import type { TextContent, ThinkingContent, ToolCall, -} from "$ai/types"; -import { AssistantMessageEventStream } from "$ai/utils/event-stream"; -import { sanitizeSurrogates } from "$ai/utils/sanitize-unicode"; +} from "@oh-my-pi/pi-ai/types"; +import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"; +import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode"; +import { abortableSleep } from "@oh-my-pi/pi-utils"; import { convertMessages, convertTools, diff --git a/packages/ai/src/providers/google-shared.ts b/packages/ai/src/providers/google-shared.ts index f11d30659..f8b48aa0e 100644 --- a/packages/ai/src/providers/google-shared.ts +++ b/packages/ai/src/providers/google-shared.ts @@ -3,8 +3,8 @@ */ import { type Content, FinishReason, FunctionCallingConfigMode, type Part, type Schema } from "@google/genai"; -import type { Context, ImageContent, Model, StopReason, TextContent, Tool } from "$ai/types"; -import { sanitizeSurrogates } from "$ai/utils/sanitize-unicode"; +import type { Context, ImageContent, Model, StopReason, TextContent, Tool } from "@oh-my-pi/pi-ai/types"; +import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode"; import { transformMessages } from "./transform-messages"; type GoogleApiType = "google-generative-ai" | "google-gemini-cli" | "google-vertex"; diff --git a/packages/ai/src/providers/google-vertex.ts b/packages/ai/src/providers/google-vertex.ts index 3b1ea7dab..260080064 100644 --- a/packages/ai/src/providers/google-vertex.ts +++ b/packages/ai/src/providers/google-vertex.ts @@ -5,7 +5,7 @@ import { type ThinkingConfig, ThinkingLevel, } from "@google/genai"; -import { calculateCost } from "$ai/models"; +import { calculateCost } from "@oh-my-pi/pi-ai/models"; import type { Api, AssistantMessage, @@ -16,10 +16,10 @@ import type { TextContent, ThinkingContent, ToolCall, -} from "$ai/types"; -import { AssistantMessageEventStream } from "$ai/utils/event-stream"; -import { formatErrorMessageWithRetryAfter } from "$ai/utils/retry-after"; -import { sanitizeSurrogates } from "$ai/utils/sanitize-unicode"; +} from "@oh-my-pi/pi-ai/types"; +import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"; +import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after"; +import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode"; import type { GoogleThinkingLevel } from "./google-gemini-cli"; import { convertMessages, diff --git a/packages/ai/src/providers/google.ts b/packages/ai/src/providers/google.ts index 2cf62c2c2..f18566717 100644 --- a/packages/ai/src/providers/google.ts +++ b/packages/ai/src/providers/google.ts @@ -4,8 +4,8 @@ import { GoogleGenAI, type ThinkingConfig, } from "@google/genai"; -import { calculateCost } from "$ai/models"; -import { getEnvApiKey } from "$ai/stream"; +import { calculateCost } from "@oh-my-pi/pi-ai/models"; +import { getEnvApiKey } from "@oh-my-pi/pi-ai/stream"; import type { Api, AssistantMessage, @@ -16,10 +16,10 @@ import type { TextContent, ThinkingContent, ToolCall, -} from "$ai/types"; -import { AssistantMessageEventStream } from "$ai/utils/event-stream"; -import { formatErrorMessageWithRetryAfter } from "$ai/utils/retry-after"; -import { sanitizeSurrogates } from "$ai/utils/sanitize-unicode"; +} from "@oh-my-pi/pi-ai/types"; +import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"; +import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after"; +import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode"; import type { GoogleThinkingLevel } from "./google-gemini-cli"; import { convertMessages, diff --git a/packages/ai/src/providers/openai-codex-responses.ts b/packages/ai/src/providers/openai-codex-responses.ts index 1d932c364..d4e6e4533 100644 --- a/packages/ai/src/providers/openai-codex-responses.ts +++ b/packages/ai/src/providers/openai-codex-responses.ts @@ -1,16 +1,6 @@ import os from "node:os"; -import { abortableSleep } from "@oh-my-pi/pi-utils"; -import type { - ResponseFunctionToolCall, - ResponseInput, - ResponseInputContent, - ResponseInputImage, - ResponseInputText, - ResponseOutputMessage, - ResponseReasoningItem, -} from "openai/resources/responses/responses"; -import { calculateCost } from "$ai/models"; -import { getEnvApiKey } from "$ai/stream"; +import { calculateCost } from "@oh-my-pi/pi-ai/models"; +import { getEnvApiKey } from "@oh-my-pi/pi-ai/stream"; import type { Api, AssistantMessage, @@ -23,11 +13,21 @@ import type { ThinkingContent, Tool, ToolCall, -} from "$ai/types"; -import { AssistantMessageEventStream } from "$ai/utils/event-stream"; -import { parseStreamingJson } from "$ai/utils/json-parse"; -import { formatErrorMessageWithRetryAfter } from "$ai/utils/retry-after"; -import { sanitizeSurrogates } from "$ai/utils/sanitize-unicode"; +} from "@oh-my-pi/pi-ai/types"; +import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"; +import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse"; +import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after"; +import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode"; +import { abortableSleep } from "@oh-my-pi/pi-utils"; +import type { + ResponseFunctionToolCall, + ResponseInput, + ResponseInputContent, + ResponseInputImage, + ResponseInputText, + ResponseOutputMessage, + ResponseReasoningItem, +} from "openai/resources/responses/responses"; import packageJson from "../../package.json" with { type: "json" }; import { CODEX_BASE_URL, diff --git a/packages/ai/src/providers/openai-completions.ts b/packages/ai/src/providers/openai-completions.ts index 9cc568336..68d66f6b9 100644 --- a/packages/ai/src/providers/openai-completions.ts +++ b/packages/ai/src/providers/openai-completions.ts @@ -1,15 +1,5 @@ -import OpenAI from "openai"; -import type { - ChatCompletionAssistantMessageParam, - ChatCompletionChunk, - ChatCompletionContentPart, - ChatCompletionContentPartImage, - ChatCompletionContentPartText, - ChatCompletionMessageParam, - ChatCompletionToolMessageParam, -} from "openai/resources/chat/completions"; -import { calculateCost } from "$ai/models"; -import { getEnvApiKey } from "$ai/stream"; +import { calculateCost } from "@oh-my-pi/pi-ai/models"; +import { getEnvApiKey } from "@oh-my-pi/pi-ai/stream"; import type { AssistantMessage, Context, @@ -24,11 +14,21 @@ import type { Tool, ToolCall, ToolResultMessage, -} from "$ai/types"; -import { AssistantMessageEventStream } from "$ai/utils/event-stream"; -import { parseStreamingJson } from "$ai/utils/json-parse"; -import { formatErrorMessageWithRetryAfter } from "$ai/utils/retry-after"; -import { sanitizeSurrogates } from "$ai/utils/sanitize-unicode"; +} from "@oh-my-pi/pi-ai/types"; +import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"; +import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse"; +import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after"; +import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode"; +import OpenAI from "openai"; +import type { + ChatCompletionAssistantMessageParam, + ChatCompletionChunk, + ChatCompletionContentPart, + ChatCompletionContentPartImage, + ChatCompletionContentPartText, + ChatCompletionMessageParam, + ChatCompletionToolMessageParam, +} from "openai/resources/chat/completions"; import { transformMessages } from "./transform-messages"; /** diff --git a/packages/ai/src/providers/openai-responses.ts b/packages/ai/src/providers/openai-responses.ts index dba60c4e8..d70adbcb9 100644 --- a/packages/ai/src/providers/openai-responses.ts +++ b/packages/ai/src/providers/openai-responses.ts @@ -1,17 +1,5 @@ -import OpenAI from "openai"; -import type { - Tool as OpenAITool, - ResponseCreateParamsStreaming, - ResponseFunctionToolCall, - ResponseInput, - ResponseInputContent, - ResponseInputImage, - ResponseInputText, - ResponseOutputMessage, - ResponseReasoningItem, -} from "openai/resources/responses/responses"; -import { calculateCost } from "$ai/models"; -import { getEnvApiKey } from "$ai/stream"; +import { calculateCost } from "@oh-my-pi/pi-ai/models"; +import { getEnvApiKey } from "@oh-my-pi/pi-ai/stream"; import type { Api, AssistantMessage, @@ -24,11 +12,23 @@ import type { ThinkingContent, Tool, ToolCall, -} from "$ai/types"; -import { AssistantMessageEventStream } from "$ai/utils/event-stream"; -import { parseStreamingJson } from "$ai/utils/json-parse"; -import { formatErrorMessageWithRetryAfter } from "$ai/utils/retry-after"; -import { sanitizeSurrogates } from "$ai/utils/sanitize-unicode"; +} from "@oh-my-pi/pi-ai/types"; +import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream"; +import { parseStreamingJson } from "@oh-my-pi/pi-ai/utils/json-parse"; +import { formatErrorMessageWithRetryAfter } from "@oh-my-pi/pi-ai/utils/retry-after"; +import { sanitizeSurrogates } from "@oh-my-pi/pi-ai/utils/sanitize-unicode"; +import OpenAI from "openai"; +import type { + Tool as OpenAITool, + ResponseCreateParamsStreaming, + ResponseFunctionToolCall, + ResponseInput, + ResponseInputContent, + ResponseInputImage, + ResponseInputText, + ResponseOutputMessage, + ResponseReasoningItem, +} from "openai/resources/responses/responses"; import { transformMessages } from "./transform-messages"; /** Fast deterministic hash to shorten long strings */ diff --git a/packages/ai/src/providers/transform-messages.ts b/packages/ai/src/providers/transform-messages.ts index 053c15174..5d6b5bce2 100644 --- a/packages/ai/src/providers/transform-messages.ts +++ b/packages/ai/src/providers/transform-messages.ts @@ -1,4 +1,4 @@ -import type { Api, AssistantMessage, Message, Model, ToolCall, ToolResultMessage } from "$ai/types"; +import type { Api, AssistantMessage, Message, Model, ToolCall, ToolResultMessage } from "@oh-my-pi/pi-ai/types"; /** * Normalize tool call ID for cross-provider compatibility. diff --git a/packages/ai/src/usage/claude.ts b/packages/ai/src/usage/claude.ts index 977d26df0..aaa3234e9 100644 --- a/packages/ai/src/usage/claude.ts +++ b/packages/ai/src/usage/claude.ts @@ -7,7 +7,7 @@ import type { UsageReport, UsageStatus, UsageWindow, -} from "$ai/usage"; +} from "@oh-my-pi/pi-ai/usage"; const DEFAULT_ENDPOINT = "https://api.anthropic.com/api/oauth"; const DEFAULT_CACHE_TTL_MS = 60_000; diff --git a/packages/ai/src/usage/github-copilot.ts b/packages/ai/src/usage/github-copilot.ts index 0bebd08c6..c7ba5405d 100644 --- a/packages/ai/src/usage/github-copilot.ts +++ b/packages/ai/src/usage/github-copilot.ts @@ -14,7 +14,7 @@ import type { UsageReport, UsageStatus, UsageWindow, -} from "$ai/usage"; +} from "@oh-my-pi/pi-ai/usage"; const COPILOT_HEADERS = { "User-Agent": "GitHubCopilotChat/0.35.0", diff --git a/packages/ai/src/usage/google-antigravity.ts b/packages/ai/src/usage/google-antigravity.ts index 589a1b016..149d535e8 100644 --- a/packages/ai/src/usage/google-antigravity.ts +++ b/packages/ai/src/usage/google-antigravity.ts @@ -7,8 +7,8 @@ import type { UsageReport, UsageStatus, UsageWindow, -} from "$ai/usage"; -import { refreshAntigravityToken } from "$ai/utils/oauth/google-antigravity"; +} from "@oh-my-pi/pi-ai/usage"; +import { refreshAntigravityToken } from "@oh-my-pi/pi-ai/utils/oauth/google-antigravity"; interface AntigravityQuotaInfo { remainingFraction?: number; diff --git a/packages/ai/src/usage/openai-codex.ts b/packages/ai/src/usage/openai-codex.ts index 167104735..7b8ccd2f7 100644 --- a/packages/ai/src/usage/openai-codex.ts +++ b/packages/ai/src/usage/openai-codex.ts @@ -1,5 +1,5 @@ import { Buffer } from "node:buffer"; -import { CODEX_BASE_URL } from "$ai/providers/openai-codex/constants"; +import { CODEX_BASE_URL } from "@oh-my-pi/pi-ai/providers/openai-codex/constants"; import type { UsageAmount, UsageCache, @@ -9,7 +9,7 @@ import type { UsageProvider, UsageReport, UsageWindow, -} from "$ai/usage"; +} from "@oh-my-pi/pi-ai/usage"; const CODEX_USAGE_PATH = "wham/usage"; const DEFAULT_CACHE_TTL_MS = 60_000; diff --git a/packages/ai/src/usage/zai.ts b/packages/ai/src/usage/zai.ts index a5f102de9..16b5a78a9 100644 --- a/packages/ai/src/usage/zai.ts +++ b/packages/ai/src/usage/zai.ts @@ -7,7 +7,7 @@ import type { UsageReport, UsageStatus, UsageWindow, -} from "$ai/usage"; +} from "@oh-my-pi/pi-ai/usage"; const DEFAULT_ENDPOINT = "https://api.z.ai"; const QUOTA_PATH = "/api/monitor/usage/quota/limit"; diff --git a/packages/ai/src/utils/event-stream.ts b/packages/ai/src/utils/event-stream.ts index 42c0cc4d2..b7c69276f 100644 --- a/packages/ai/src/utils/event-stream.ts +++ b/packages/ai/src/utils/event-stream.ts @@ -1,4 +1,4 @@ -import type { AssistantMessage, AssistantMessageEvent } from "$ai/types"; +import type { AssistantMessage, AssistantMessageEvent } from "@oh-my-pi/pi-ai/types"; // Generic event stream class for async iteration export class EventStream implements AsyncIterable { diff --git a/packages/ai/src/utils/oauth/github-copilot.ts b/packages/ai/src/utils/oauth/github-copilot.ts index d69ae2c40..a48b75d1a 100644 --- a/packages/ai/src/utils/oauth/github-copilot.ts +++ b/packages/ai/src/utils/oauth/github-copilot.ts @@ -2,8 +2,8 @@ * GitHub Copilot OAuth flow */ +import { getModels } from "@oh-my-pi/pi-ai/models"; import { abortableSleep } from "@oh-my-pi/pi-utils"; -import { getModels } from "$ai/models"; import type { OAuthCredentials } from "./types"; const decode = (s: string) => atob(s); diff --git a/packages/ai/src/utils/overflow.ts b/packages/ai/src/utils/overflow.ts index a92ea4a16..8df44dbae 100644 --- a/packages/ai/src/utils/overflow.ts +++ b/packages/ai/src/utils/overflow.ts @@ -1,4 +1,4 @@ -import type { AssistantMessage } from "$ai/types"; +import type { AssistantMessage } from "@oh-my-pi/pi-ai/types"; /** * Regex patterns to detect context overflow errors from different providers. diff --git a/packages/ai/src/utils/validation.ts b/packages/ai/src/utils/validation.ts index 45927a85b..19b44bc2e 100644 --- a/packages/ai/src/utils/validation.ts +++ b/packages/ai/src/utils/validation.ts @@ -5,7 +5,7 @@ import addFormatsModule from "ajv-formats"; const Ajv = (AjvModule as any).default || AjvModule; const addFormats = (addFormatsModule as any).default || addFormatsModule; -import type { Tool, ToolCall } from "$ai/types"; +import type { Tool, ToolCall } from "@oh-my-pi/pi-ai/types"; // ============================================================================ // Type Coercion Utilities diff --git a/packages/ai/test/abort.test.ts b/packages/ai/test/abort.test.ts index a35537ab6..83256d1e6 100644 --- a/packages/ai/test/abort.test.ts +++ b/packages/ai/test/abort.test.ts @@ -1,7 +1,7 @@ +import { getModel } from "@oh-my-pi/pi-ai/models"; +import { complete, stream } from "@oh-my-pi/pi-ai/stream"; +import type { Api, Context, Model, OptionsForApi } from "@oh-my-pi/pi-ai/types"; import { describe, expect, it } from "vitest"; -import { getModel } from "$ai/models"; -import { complete, stream } from "$ai/stream"; -import type { Api, Context, Model, OptionsForApi } from "$ai/types"; import { resolveApiKey } from "./oauth"; // Resolve OAuth tokens at module level (async, runs before tests) diff --git a/packages/ai/test/context-overflow.test.ts b/packages/ai/test/context-overflow.test.ts index afca5c667..7a196317c 100644 --- a/packages/ai/test/context-overflow.test.ts +++ b/packages/ai/test/context-overflow.test.ts @@ -13,11 +13,11 @@ import type { ChildProcess } from "node:child_process"; import { execSync, spawn } from "node:child_process"; +import { getModel } from "@oh-my-pi/pi-ai/models"; +import { complete } from "@oh-my-pi/pi-ai/stream"; +import type { AssistantMessage, Context, Model, Usage } from "@oh-my-pi/pi-ai/types"; +import { isContextOverflow } from "@oh-my-pi/pi-ai/utils/overflow"; import { afterAll, beforeAll, describe, expect, it } from "vitest"; -import { getModel } from "$ai/models"; -import { complete } from "$ai/stream"; -import type { AssistantMessage, Context, Model, Usage } from "$ai/types"; -import { isContextOverflow } from "$ai/utils/overflow"; import { resolveApiKey } from "./oauth"; // Resolve OAuth tokens at module level (async, runs before tests) diff --git a/packages/ai/test/duplicate-tool-results.test.ts b/packages/ai/test/duplicate-tool-results.test.ts index 9d6cf0511..2c601ea48 100644 --- a/packages/ai/test/duplicate-tool-results.test.ts +++ b/packages/ai/test/duplicate-tool-results.test.ts @@ -1,6 +1,6 @@ +import { transformMessages } from "@oh-my-pi/pi-ai/providers/transform-messages"; +import type { AssistantMessage, Model, ToolResultMessage } from "@oh-my-pi/pi-ai/types"; import { describe, expect, it } from "vitest"; -import { transformMessages } from "$ai/providers/transform-messages"; -import type { AssistantMessage, Model, ToolResultMessage } from "$ai/types"; /** * Regression test for: "each tool_use must have a single result. Found multiple tool_result blocks with id" diff --git a/packages/ai/test/empty.test.ts b/packages/ai/test/empty.test.ts index 73accc4d3..c4e36cc5c 100644 --- a/packages/ai/test/empty.test.ts +++ b/packages/ai/test/empty.test.ts @@ -1,7 +1,7 @@ +import { getModel } from "@oh-my-pi/pi-ai/models"; +import { complete } from "@oh-my-pi/pi-ai/stream"; +import type { Api, AssistantMessage, Context, Model, OptionsForApi, UserMessage } from "@oh-my-pi/pi-ai/types"; import { describe, expect, it } from "vitest"; -import { getModel } from "$ai/models"; -import { complete } from "$ai/stream"; -import type { Api, AssistantMessage, Context, Model, OptionsForApi, UserMessage } from "$ai/types"; import { resolveApiKey } from "./oauth"; // Resolve OAuth tokens at module level (async, runs before tests) diff --git a/packages/ai/test/google-thinking-signature.test.ts b/packages/ai/test/google-thinking-signature.test.ts index ef30fca3e..ae4c1528e 100644 --- a/packages/ai/test/google-thinking-signature.test.ts +++ b/packages/ai/test/google-thinking-signature.test.ts @@ -1,5 +1,5 @@ +import { isThinkingPart, retainThoughtSignature } from "@oh-my-pi/pi-ai/providers/google-shared"; import { describe, expect, it } from "vitest"; -import { isThinkingPart, retainThoughtSignature } from "$ai/providers/google-shared"; describe("Google thinking detection (thoughtSignature)", () => { it("treats part.thought === true as thinking", () => { diff --git a/packages/ai/test/handoff.test.ts b/packages/ai/test/handoff.test.ts index c26c221a0..0abe7b23b 100644 --- a/packages/ai/test/handoff.test.ts +++ b/packages/ai/test/handoff.test.ts @@ -1,8 +1,8 @@ +import { getModel } from "@oh-my-pi/pi-ai/models"; +import { complete } from "@oh-my-pi/pi-ai/stream"; +import type { Api, AssistantMessage, Context, Message, Model, Tool, ToolResultMessage } from "@oh-my-pi/pi-ai/types"; import { Type } from "@sinclair/typebox"; import { describe, expect, it } from "vitest"; -import { getModel } from "$ai/models"; -import { complete } from "$ai/stream"; -import type { Api, AssistantMessage, Context, Message, Model, Tool, ToolResultMessage } from "$ai/types"; // Tool for testing const weatherSchema = Type.Object({ diff --git a/packages/ai/test/image-limits.test.ts b/packages/ai/test/image-limits.test.ts index 96d7437bc..edd4bd8fc 100644 --- a/packages/ai/test/image-limits.test.ts +++ b/packages/ai/test/image-limits.test.ts @@ -70,10 +70,10 @@ import { execSync } from "node:child_process"; import { mkdirSync, rmSync } from "node:fs"; import { join } from "node:path"; +import { getModel } from "@oh-my-pi/pi-ai/models"; +import { complete } from "@oh-my-pi/pi-ai/stream"; +import type { Api, Context, ImageContent, Model, OptionsForApi, UserMessage } from "@oh-my-pi/pi-ai/types"; import { afterAll, beforeAll, describe, expect, it } from "vitest"; -import { getModel } from "$ai/models"; -import { complete } from "$ai/stream"; -import type { Api, Context, ImageContent, Model, OptionsForApi, UserMessage } from "$ai/types"; const TEMP_DIR = join(import.meta.dir, ".temp-images"); diff --git a/packages/ai/test/image-tool-result.test.ts b/packages/ai/test/image-tool-result.test.ts index bc24c7e6d..ee20cc688 100644 --- a/packages/ai/test/image-tool-result.test.ts +++ b/packages/ai/test/image-tool-result.test.ts @@ -1,10 +1,10 @@ import { readFileSync } from "node:fs"; import { join } from "node:path"; +import type { Api, Context, Model, Tool, ToolResultMessage } from "@oh-my-pi/pi-ai/index"; +import { complete, getModel } from "@oh-my-pi/pi-ai/index"; +import type { OptionsForApi } from "@oh-my-pi/pi-ai/types"; import { Type } from "@sinclair/typebox"; import { describe, expect, it } from "vitest"; -import type { Api, Context, Model, Tool, ToolResultMessage } from "$ai/index"; -import { complete, getModel } from "$ai/index"; -import type { OptionsForApi } from "$ai/types"; import { resolveApiKey } from "./oauth"; // Resolve OAuth tokens at module level (async, runs before tests) diff --git a/packages/ai/test/oauth.ts b/packages/ai/test/oauth.ts index a5a740b47..2e0e55193 100644 --- a/packages/ai/test/oauth.ts +++ b/packages/ai/test/oauth.ts @@ -6,10 +6,10 @@ */ import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; +import { getOAuthApiKey } from "@oh-my-pi/pi-ai/utils/oauth/index"; +import type { OAuthCredentials, OAuthProvider } from "@oh-my-pi/pi-ai/utils/oauth/types"; import { homedir } from "os"; import { dirname, join } from "path"; -import { getOAuthApiKey } from "$ai/utils/oauth/index"; -import type { OAuthCredentials, OAuthProvider } from "$ai/utils/oauth/types"; const AUTH_PATH = join(homedir(), ".pi", "agent", "auth.json"); diff --git a/packages/ai/test/openai-codex-include.test.ts b/packages/ai/test/openai-codex-include.test.ts index 08b0f45da..0a129a06f 100644 --- a/packages/ai/test/openai-codex-include.test.ts +++ b/packages/ai/test/openai-codex-include.test.ts @@ -1,5 +1,5 @@ +import { type RequestBody, transformRequestBody } from "@oh-my-pi/pi-ai/providers/openai-codex/request-transformer"; import { describe, expect, it } from "vitest"; -import { type RequestBody, transformRequestBody } from "$ai/providers/openai-codex/request-transformer"; describe("openai-codex include handling", () => { it("always includes reasoning.encrypted_content when caller include is custom", async () => { diff --git a/packages/ai/test/openai-codex-stream.test.ts b/packages/ai/test/openai-codex-stream.test.ts index 03f64e108..eb504b344 100644 --- a/packages/ai/test/openai-codex-stream.test.ts +++ b/packages/ai/test/openai-codex-stream.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; +import { streamOpenAICodexResponses } from "@oh-my-pi/pi-ai/providers/openai-codex-responses"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; -import { streamOpenAICodexResponses } from "$ai/providers/openai-codex-responses"; -import type { Context, Model } from "$ai/types"; const originalFetch = global.fetch; const originalAgentDir = process.env.OMP_CODING_AGENT_DIR; diff --git a/packages/ai/test/openai-codex.test.ts b/packages/ai/test/openai-codex.test.ts index e15134675..960af9409 100644 --- a/packages/ai/test/openai-codex.test.ts +++ b/packages/ai/test/openai-codex.test.ts @@ -1,6 +1,6 @@ +import { type RequestBody, transformRequestBody } from "@oh-my-pi/pi-ai/providers/openai-codex/request-transformer"; +import { parseCodexError } from "@oh-my-pi/pi-ai/providers/openai-codex/response-handler"; import { describe, expect, it } from "vitest"; -import { type RequestBody, transformRequestBody } from "$ai/providers/openai-codex/request-transformer"; -import { parseCodexError } from "$ai/providers/openai-codex/response-handler"; const DEFAULT_PROMPT_PREFIX = "You are an expert coding assistant. You help users with coding tasks by reading files, executing commands"; diff --git a/packages/ai/test/openai-completions-tool-result-images.test.ts b/packages/ai/test/openai-completions-tool-result-images.test.ts index 2578e0a8b..3a9be5828 100644 --- a/packages/ai/test/openai-completions-tool-result-images.test.ts +++ b/packages/ai/test/openai-completions-tool-result-images.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { getModel } from "$ai/models"; -import { convertMessages } from "$ai/providers/openai-completions"; -import type { AssistantMessage, Context, Model, OpenAICompat, ToolResultMessage, Usage } from "$ai/types"; +import { getModel } from "@oh-my-pi/pi-ai/models"; +import { convertMessages } from "@oh-my-pi/pi-ai/providers/openai-completions"; +import type { AssistantMessage, Context, Model, OpenAICompat, ToolResultMessage, Usage } from "@oh-my-pi/pi-ai/types"; const emptyUsage: Usage = { input: 0, diff --git a/packages/ai/test/stream.test.ts b/packages/ai/test/stream.test.ts index 0ffe3d8f6..a33ae12f0 100644 --- a/packages/ai/test/stream.test.ts +++ b/packages/ai/test/stream.test.ts @@ -1,12 +1,12 @@ import { type ChildProcess, execSync, spawn } from "node:child_process"; import { readFileSync } from "node:fs"; +import { getModel } from "@oh-my-pi/pi-ai/models"; +import { complete, stream } from "@oh-my-pi/pi-ai/stream"; +import type { Api, Context, ImageContent, Model, OptionsForApi, Tool, ToolResultMessage } from "@oh-my-pi/pi-ai/types"; +import { StringEnum } from "@oh-my-pi/pi-ai/utils/typebox-helpers"; import { Type } from "@sinclair/typebox"; import { join } from "path"; import { afterAll, beforeAll, describe, expect, it } from "vitest"; -import { getModel } from "$ai/models"; -import { complete, stream } from "$ai/stream"; -import type { Api, Context, ImageContent, Model, OptionsForApi, Tool, ToolResultMessage } from "$ai/types"; -import { StringEnum } from "$ai/utils/typebox-helpers"; import { resolveApiKey } from "./oauth"; // Resolve OAuth tokens at module level (async, runs before tests) diff --git a/packages/ai/test/tokens.test.ts b/packages/ai/test/tokens.test.ts index 673d797c3..44bc4b0bb 100644 --- a/packages/ai/test/tokens.test.ts +++ b/packages/ai/test/tokens.test.ts @@ -1,7 +1,7 @@ +import { getModel } from "@oh-my-pi/pi-ai/models"; +import { stream } from "@oh-my-pi/pi-ai/stream"; +import type { Api, Context, Model, OptionsForApi } from "@oh-my-pi/pi-ai/types"; import { describe, expect, it } from "vitest"; -import { getModel } from "$ai/models"; -import { stream } from "$ai/stream"; -import type { Api, Context, Model, OptionsForApi } from "$ai/types"; import { resolveApiKey } from "./oauth"; // Resolve OAuth tokens at module level (async, runs before tests) diff --git a/packages/ai/test/tool-argument-coercion.test.ts b/packages/ai/test/tool-argument-coercion.test.ts index 6be06c1aa..103365f69 100644 --- a/packages/ai/test/tool-argument-coercion.test.ts +++ b/packages/ai/test/tool-argument-coercion.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; +import type { Tool, ToolCall } from "@oh-my-pi/pi-ai/types"; +import { validateToolArguments } from "@oh-my-pi/pi-ai/utils/validation"; import { Type } from "@sinclair/typebox"; -import type { Tool, ToolCall } from "$ai/types"; -import { validateToolArguments } from "$ai/utils/validation"; describe("Tool argument coercion", () => { it("coerces numeric strings when schema expects number", () => { diff --git a/packages/ai/test/tool-call-without-result.test.ts b/packages/ai/test/tool-call-without-result.test.ts index b5eacbf76..743775367 100644 --- a/packages/ai/test/tool-call-without-result.test.ts +++ b/packages/ai/test/tool-call-without-result.test.ts @@ -1,8 +1,8 @@ +import { getModel } from "@oh-my-pi/pi-ai/models"; +import { complete } from "@oh-my-pi/pi-ai/stream"; +import type { Api, Context, Model, OptionsForApi, Tool } from "@oh-my-pi/pi-ai/types"; import { Type } from "@sinclair/typebox"; import { describe, expect, it } from "vitest"; -import { getModel } from "$ai/models"; -import { complete } from "$ai/stream"; -import type { Api, Context, Model, OptionsForApi, Tool } from "$ai/types"; import { resolveApiKey } from "./oauth"; // Resolve OAuth tokens at module level (async, runs before tests) diff --git a/packages/ai/test/total-tokens.test.ts b/packages/ai/test/total-tokens.test.ts index ccfd7a61e..cc94ba3cd 100644 --- a/packages/ai/test/total-tokens.test.ts +++ b/packages/ai/test/total-tokens.test.ts @@ -12,10 +12,10 @@ * - Other OpenAI-compatible providers: Uses native total_tokens field */ +import { getModel } from "@oh-my-pi/pi-ai/models"; +import { complete } from "@oh-my-pi/pi-ai/stream"; +import type { Api, Context, Model, OptionsForApi, Usage } from "@oh-my-pi/pi-ai/types"; import { describe, expect, it } from "vitest"; -import { getModel } from "$ai/models"; -import { complete } from "$ai/stream"; -import type { Api, Context, Model, OptionsForApi, Usage } from "$ai/types"; import { resolveApiKey } from "./oauth"; // Resolve OAuth tokens at module level (async, runs before tests) diff --git a/packages/ai/test/unicode-surrogate.test.ts b/packages/ai/test/unicode-surrogate.test.ts index 9366c55dc..eda0a9a41 100644 --- a/packages/ai/test/unicode-surrogate.test.ts +++ b/packages/ai/test/unicode-surrogate.test.ts @@ -1,8 +1,8 @@ +import { getModel } from "@oh-my-pi/pi-ai/models"; +import { complete } from "@oh-my-pi/pi-ai/stream"; +import type { Api, Context, Model, OptionsForApi, ToolResultMessage } from "@oh-my-pi/pi-ai/types"; import { Type } from "@sinclair/typebox"; import { describe, expect, it } from "vitest"; -import { getModel } from "$ai/models"; -import { complete } from "$ai/stream"; -import type { Api, Context, Model, OptionsForApi, ToolResultMessage } from "$ai/types"; import { resolveApiKey } from "./oauth"; // Empty schema for test tools - must be proper OBJECT type for Cloud Code Assist diff --git a/packages/ai/test/xhigh.test.ts b/packages/ai/test/xhigh.test.ts index 94e783956..e9f320f57 100644 --- a/packages/ai/test/xhigh.test.ts +++ b/packages/ai/test/xhigh.test.ts @@ -1,7 +1,7 @@ +import { getModel } from "@oh-my-pi/pi-ai/models"; +import { stream } from "@oh-my-pi/pi-ai/stream"; +import type { Context, Model } from "@oh-my-pi/pi-ai/types"; import { describe, expect, it } from "vitest"; -import { getModel } from "$ai/models"; -import { stream } from "$ai/stream"; -import type { Context, Model } from "$ai/types"; function makeContext(): Context { return { diff --git a/packages/ai/test/zen.test.ts b/packages/ai/test/zen.test.ts index aeaba2ce1..c682ef281 100644 --- a/packages/ai/test/zen.test.ts +++ b/packages/ai/test/zen.test.ts @@ -1,7 +1,7 @@ +import { MODELS } from "@oh-my-pi/pi-ai/models.generated"; +import { complete } from "@oh-my-pi/pi-ai/stream"; +import type { Model } from "@oh-my-pi/pi-ai/types"; import { describe, expect, it } from "vitest"; -import { MODELS } from "$ai/models.generated"; -import { complete } from "$ai/stream"; -import type { Model } from "$ai/types"; describe.skipIf(!process.env.OPENCODE_API_KEY)("OpenCode Zen Models Smoke Test", () => { const zenModels = Object.values(MODELS.opencode); diff --git a/packages/ai/tsconfig.publish.json b/packages/ai/tsconfig.publish.json new file mode 100644 index 000000000..6404e7a24 --- /dev/null +++ b/packages/ai/tsconfig.publish.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "noEmit": true, + "baseUrl": ".", + "paths": { + "@oh-my-pi/pi-ai": ["./src/index.ts"], + "@oh-my-pi/pi-ai/*": ["./src/*"] + } + }, + "include": ["src/**/*.ts"] +} diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 6699c36b3..2e65edf6a 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -44,6 +44,7 @@ - Added two-level mermaid caching with pending deduplication to prevent redundant renders - Added Python kernel session pooling with MAX_KERNEL_SESSIONS limit and automatic eviction of oldest sessions - Added automatic idle kernel session cleanup timer (5-minute timeout, 30-second interval) +- Added WASM binary generation script for photon module distribution ### Changed - Changed changelog diff truncation limit to be configurable via settings @@ -96,6 +97,7 @@ - Changed commit agent prompt to remove pre-computed observations guidance and encourage direct analyze_files usage - Changed AuthStorage from constructor-based instantiation to async factory method (AuthStorage.create()) - Changed Python kernel resource management with gateway shutdown on session disposal +- Updated TypeScript configuration for better publish-time configuration handling with tsconfig.publish.json ### Fixed - Fixed database busy errors during concurrent access by adding retry logic with exponential backoff when opening storage diff --git a/packages/coding-agent/package.json b/packages/coding-agent/package.json index 82f532f84..e59521ce7 100644 --- a/packages/coding-agent/package.json +++ b/packages/coding-agent/package.json @@ -20,6 +20,11 @@ "./hooks": { "types": "./src/extensibility/hooks/index.ts", "import": "./src/extensibility/hooks/index.ts" + }, + "./prompts/*": "./src/prompts/*", + "./*": { + "types": "./src/*", + "import": "./src/*" } }, "files": [ @@ -35,10 +40,11 @@ "clean": "rm -rf dist", "build": "tsgo -p tsconfig.build.json && chmod +x dist/cli.js", "build:binary": "bun run generate-wasm-b64 && bun build --compile ./src/cli.ts --outfile dist/omp", + "generate-wasm-b64": "bun scripts/generate-wasm-b64.ts", "generate-template": "bun scripts/generate-template.ts", - "postinstall": "bun run generate-template || true", + "postinstall": "(bun run generate-wasm-b64 && bun run generate-template) || true", "test": "bun test", - "prepublishOnly": "bun run generate-template" + "prepublishOnly": "cp tsconfig.publish.json tsconfig.json && bun run generate-template" }, "dependencies": { "@oh-my-pi/omp-stats": "workspace:*", diff --git a/packages/coding-agent/scripts/generate-wasm-b64.ts b/packages/coding-agent/scripts/generate-wasm-b64.ts new file mode 100644 index 000000000..e836b5be1 --- /dev/null +++ b/packages/coding-agent/scripts/generate-wasm-b64.ts @@ -0,0 +1,24 @@ +#!/usr/bin/env bun +/** + * Generates a base64-encoded JavaScript module from the photon WASM file. + * This allows bundling the WASM binary inline for single-file distribution. + */ + +import { join } from "node:path"; + +const VENDOR_DIR = join(import.meta.dir, "../src/vendor/photon"); +const WASM_PATH = join(VENDOR_DIR, "photon_rs_bg.wasm"); +const OUTPUT_PATH = join(VENDOR_DIR, "photon_rs_bg.wasm.b64.js"); + +const wasmFile = Bun.file(WASM_PATH); +if (!(await wasmFile.exists())) { + console.error(`WASM file not found: ${WASM_PATH}`); + process.exit(1); +} + +const wasmBytes = await wasmFile.arrayBuffer(); +const base64 = Buffer.from(wasmBytes).toString("base64"); +const content = `export default "${base64}";\n`; + +await Bun.write(OUTPUT_PATH, content); +console.log(`Generated ${OUTPUT_PATH} (${Math.round(base64.length / 1024)}KB)`); diff --git a/packages/coding-agent/src/cli/args.ts b/packages/coding-agent/src/cli/args.ts index 7b944458e..d13975766 100644 --- a/packages/coding-agent/src/cli/args.ts +++ b/packages/coding-agent/src/cli/args.ts @@ -3,9 +3,9 @@ */ import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core"; +import { APP_NAME, CONFIG_DIR_NAME, ENV_AGENT_DIR } from "@oh-my-pi/pi-coding-agent/config"; +import { BUILTIN_TOOLS } from "@oh-my-pi/pi-coding-agent/tools/index"; import chalk from "chalk"; -import { APP_NAME, CONFIG_DIR_NAME, ENV_AGENT_DIR } from "$c/config"; -import { BUILTIN_TOOLS } from "$c/tools/index"; export type Mode = "text" | "json" | "rpc"; diff --git a/packages/coding-agent/src/cli/config-cli.ts b/packages/coding-agent/src/cli/config-cli.ts index 57326da62..bbe948ce5 100644 --- a/packages/coding-agent/src/cli/config-cli.ts +++ b/packages/coding-agent/src/cli/config-cli.ts @@ -5,11 +5,11 @@ * Uses SETTINGS_DEFS as the source of truth for available settings. */ +import { APP_NAME, getAgentDir } from "@oh-my-pi/pi-coding-agent/config"; +import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { SETTINGS_DEFS, type SettingDef } from "@oh-my-pi/pi-coding-agent/modes/components/settings-defs"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import chalk from "chalk"; -import { APP_NAME, getAgentDir } from "$c/config"; -import { SettingsManager } from "$c/config/settings-manager"; -import { SETTINGS_DEFS, type SettingDef } from "$c/modes/components/settings-defs"; -import { theme } from "$c/modes/theme/theme"; // ============================================================================= // Types diff --git a/packages/coding-agent/src/cli/file-processor.ts b/packages/coding-agent/src/cli/file-processor.ts index b5b8b960c..4a2a6e56c 100644 --- a/packages/coding-agent/src/cli/file-processor.ts +++ b/packages/coding-agent/src/cli/file-processor.ts @@ -5,10 +5,10 @@ import { existsSync, readFileSync, statSync } from "node:fs"; import { resolve } from "node:path"; import type { ImageContent } from "@oh-my-pi/pi-ai"; +import { resolveReadPath } from "@oh-my-pi/pi-coding-agent/tools/path-utils"; +import { formatDimensionNote, resizeImage } from "@oh-my-pi/pi-coding-agent/utils/image-resize"; +import { detectSupportedImageMimeTypeFromFile } from "@oh-my-pi/pi-coding-agent/utils/mime"; import chalk from "chalk"; -import { resolveReadPath } from "$c/tools/path-utils"; -import { formatDimensionNote, resizeImage } from "$c/utils/image-resize"; -import { detectSupportedImageMimeTypeFromFile } from "$c/utils/mime"; export interface ProcessedFiles { text: string; diff --git a/packages/coding-agent/src/cli/list-models.ts b/packages/coding-agent/src/cli/list-models.ts index aaf0be1c6..9450506af 100644 --- a/packages/coding-agent/src/cli/list-models.ts +++ b/packages/coding-agent/src/cli/list-models.ts @@ -3,8 +3,8 @@ */ import type { Api, Model } from "@oh-my-pi/pi-ai"; -import type { ModelRegistry } from "$c/config/model-registry"; -import { fuzzyFilter } from "$c/utils/fuzzy"; +import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { fuzzyFilter } from "@oh-my-pi/pi-coding-agent/utils/fuzzy"; /** * Format a number as human-readable (e.g., 200000 -> "200K", 1000000 -> "1M") diff --git a/packages/coding-agent/src/cli/plugin-cli.ts b/packages/coding-agent/src/cli/plugin-cli.ts index f33f78a6c..6fc4eaa13 100644 --- a/packages/coding-agent/src/cli/plugin-cli.ts +++ b/packages/coding-agent/src/cli/plugin-cli.ts @@ -4,10 +4,14 @@ * Handles `omp plugin ` subcommands for plugin lifecycle management. */ +import { APP_NAME } from "@oh-my-pi/pi-coding-agent/config"; +import { + PluginManager, + parseSettingValue, + validateSetting, +} from "@oh-my-pi/pi-coding-agent/extensibility/plugins/index"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import chalk from "chalk"; -import { APP_NAME } from "$c/config"; -import { PluginManager, parseSettingValue, validateSetting } from "$c/extensibility/plugins/index"; -import { theme } from "$c/modes/theme/theme"; // ============================================================================= // Types diff --git a/packages/coding-agent/src/cli/session-picker.ts b/packages/coding-agent/src/cli/session-picker.ts index d591d9f40..c3fc42a80 100644 --- a/packages/coding-agent/src/cli/session-picker.ts +++ b/packages/coding-agent/src/cli/session-picker.ts @@ -2,9 +2,9 @@ * TUI session selector for --resume flag */ +import { SessionSelectorComponent } from "@oh-my-pi/pi-coding-agent/modes/components/session-selector"; +import type { SessionInfo } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { ProcessTerminal, TUI } from "@oh-my-pi/pi-tui"; -import { SessionSelectorComponent } from "$c/modes/components/session-selector"; -import type { SessionInfo } from "$c/session/session-manager"; /** Show TUI session selector and return selected session path or null if cancelled */ export async function selectSession(sessions: SessionInfo[]): Promise { diff --git a/packages/coding-agent/src/cli/setup-cli.ts b/packages/coding-agent/src/cli/setup-cli.ts index e5e0765d0..4fd75691e 100644 --- a/packages/coding-agent/src/cli/setup-cli.ts +++ b/packages/coding-agent/src/cli/setup-cli.ts @@ -4,10 +4,10 @@ * Handles `omp setup ` to install dependencies for optional features. */ +import { APP_NAME } from "@oh-my-pi/pi-coding-agent/config"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { $ } from "bun"; import chalk from "chalk"; -import { APP_NAME } from "$c/config"; -import { theme } from "$c/modes/theme/theme"; export type SetupComponent = "python"; diff --git a/packages/coding-agent/src/cli/stats-cli.ts b/packages/coding-agent/src/cli/stats-cli.ts index f56591772..f4a32e8e8 100644 --- a/packages/coding-agent/src/cli/stats-cli.ts +++ b/packages/coding-agent/src/cli/stats-cli.ts @@ -4,8 +4,8 @@ * Handles `omp stats` subcommand for viewing AI usage statistics. */ +import { APP_NAME } from "@oh-my-pi/pi-coding-agent/config"; import chalk from "chalk"; -import { APP_NAME } from "$c/config"; // ============================================================================= // Types diff --git a/packages/coding-agent/src/cli/update-cli.ts b/packages/coding-agent/src/cli/update-cli.ts index 0d865ec4e..b4bd0e275 100644 --- a/packages/coding-agent/src/cli/update-cli.ts +++ b/packages/coding-agent/src/cli/update-cli.ts @@ -10,9 +10,9 @@ import { createWriteStream, existsSync, renameSync, unlinkSync } from "node:fs"; import { dirname } from "node:path"; import { Readable } from "node:stream"; import { pipeline } from "node:stream/promises"; +import { APP_NAME, VERSION } from "@oh-my-pi/pi-coding-agent/config"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import chalk from "chalk"; -import { APP_NAME, VERSION } from "$c/config"; -import { theme } from "$c/modes/theme/theme"; /** * Detect if we're running as a Bun compiled binary. diff --git a/packages/coding-agent/src/commit/agentic/agent.ts b/packages/coding-agent/src/commit/agentic/agent.ts index 20d2c3c60..345fc5b3d 100644 --- a/packages/coding-agent/src/commit/agentic/agent.ts +++ b/packages/coding-agent/src/commit/agentic/agent.ts @@ -1,19 +1,21 @@ import type { Api, Model } from "@oh-my-pi/pi-ai"; +import agentUserPrompt from "@oh-my-pi/pi-coding-agent/commit/agentic/prompts/session-user.md" with { type: "text" }; +import agentSystemPrompt from "@oh-my-pi/pi-coding-agent/commit/agentic/prompts/system.md" with { type: "text" }; +import type { CommitAgentState } from "@oh-my-pi/pi-coding-agent/commit/agentic/state"; +import { createCommitTools } from "@oh-my-pi/pi-coding-agent/commit/agentic/tools"; +import type { ControlledGit } from "@oh-my-pi/pi-coding-agent/commit/git"; +import typesDescriptionPrompt from "@oh-my-pi/pi-coding-agent/commit/prompts/types-description.md" with { + type: "text", +}; +import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import type { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { getMarkdownTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import { createAgentSession } from "@oh-my-pi/pi-coding-agent/sdk"; +import type { AgentSessionEvent } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import type { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; import { Markdown } from "@oh-my-pi/pi-tui"; import chalk from "chalk"; -import agentUserPrompt from "$c/commit/agentic/prompts/session-user.md" with { type: "text" }; -import agentSystemPrompt from "$c/commit/agentic/prompts/system.md" with { type: "text" }; -import type { CommitAgentState } from "$c/commit/agentic/state"; -import { createCommitTools } from "$c/commit/agentic/tools"; -import type { ControlledGit } from "$c/commit/git"; -import typesDescriptionPrompt from "$c/commit/prompts/types-description.md" with { type: "text" }; -import type { ModelRegistry } from "$c/config/model-registry"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import type { SettingsManager } from "$c/config/settings-manager"; -import { getMarkdownTheme } from "$c/modes/theme/theme"; -import { createAgentSession } from "$c/sdk"; -import type { AgentSessionEvent } from "$c/session/agent-session"; -import type { AuthStorage } from "$c/session/auth-storage"; export interface CommitAgentInput { cwd: string; @@ -66,7 +68,7 @@ export async function runCommitAgentSession(input: CommitAgentInput): Promise([ ["-c", "--context"], diff --git a/packages/coding-agent/src/commit/git/diff.ts b/packages/coding-agent/src/commit/git/diff.ts index da11d96d3..9d867a6a8 100644 --- a/packages/coding-agent/src/commit/git/diff.ts +++ b/packages/coding-agent/src/commit/git/diff.ts @@ -1,4 +1,4 @@ -import type { DiffHunk, FileDiff, FileHunks, NumstatEntry } from "$c/commit/types"; +import type { DiffHunk, FileDiff, FileHunks, NumstatEntry } from "@oh-my-pi/pi-coding-agent/commit/types"; export function parseNumstat(output: string): NumstatEntry[] { const entries: NumstatEntry[] = []; diff --git a/packages/coding-agent/src/commit/git/index.ts b/packages/coding-agent/src/commit/git/index.ts index 2dd7a33aa..1545afa65 100644 --- a/packages/coding-agent/src/commit/git/index.ts +++ b/packages/coding-agent/src/commit/git/index.ts @@ -2,11 +2,16 @@ import { randomUUID } from "node:crypto"; import { rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; +import { + parseDiffHunks, + parseFileDiffs, + parseFileHunks, + parseNumstat, +} from "@oh-my-pi/pi-coding-agent/commit/git/diff"; +import { GitError } from "@oh-my-pi/pi-coding-agent/commit/git/errors"; +import { commit, push, resetStaging, runGitCommand, stageFiles } from "@oh-my-pi/pi-coding-agent/commit/git/operations"; +import type { FileDiff, FileHunks, NumstatEntry } from "@oh-my-pi/pi-coding-agent/commit/types"; import { logger } from "@oh-my-pi/pi-utils"; -import { parseDiffHunks, parseFileDiffs, parseFileHunks, parseNumstat } from "$c/commit/git/diff"; -import { GitError } from "$c/commit/git/errors"; -import { commit, push, resetStaging, runGitCommand, stageFiles } from "$c/commit/git/operations"; -import type { FileDiff, FileHunks, NumstatEntry } from "$c/commit/types"; export type HunkSelection = { path: string; diff --git a/packages/coding-agent/src/commit/index.ts b/packages/coding-agent/src/commit/index.ts index a09d0a885..437dc94c2 100644 --- a/packages/coding-agent/src/commit/index.ts +++ b/packages/coding-agent/src/commit/index.ts @@ -2,4 +2,4 @@ * Entry points for the omp commit command. */ -export { runCommitCommand } from "$c/commit/pipeline"; +export { runCommitCommand } from "@oh-my-pi/pi-coding-agent/commit/pipeline"; diff --git a/packages/coding-agent/src/commit/map-reduce/index.ts b/packages/coding-agent/src/commit/map-reduce/index.ts index 0a4519220..54ebda81d 100644 --- a/packages/coding-agent/src/commit/map-reduce/index.ts +++ b/packages/coding-agent/src/commit/map-reduce/index.ts @@ -1,10 +1,10 @@ import type { Api, Model } from "@oh-my-pi/pi-ai"; -import { parseFileDiffs } from "$c/commit/git/diff"; -import { runMapPhase } from "$c/commit/map-reduce/map-phase"; -import { runReducePhase } from "$c/commit/map-reduce/reduce-phase"; -import { estimateTokens } from "$c/commit/map-reduce/utils"; -import type { ConventionalAnalysis } from "$c/commit/types"; -import { isExcludedFile } from "$c/commit/utils/exclusions"; +import { parseFileDiffs } from "@oh-my-pi/pi-coding-agent/commit/git/diff"; +import { runMapPhase } from "@oh-my-pi/pi-coding-agent/commit/map-reduce/map-phase"; +import { runReducePhase } from "@oh-my-pi/pi-coding-agent/commit/map-reduce/reduce-phase"; +import { estimateTokens } from "@oh-my-pi/pi-coding-agent/commit/map-reduce/utils"; +import type { ConventionalAnalysis } from "@oh-my-pi/pi-coding-agent/commit/types"; +import { isExcludedFile } from "@oh-my-pi/pi-coding-agent/commit/utils/exclusions"; const MIN_FILES_FOR_MAP_REDUCE = 4; const MAX_FILE_TOKENS = 50_000; diff --git a/packages/coding-agent/src/commit/map-reduce/map-phase.ts b/packages/coding-agent/src/commit/map-reduce/map-phase.ts index 8625e9a06..07e4b97c9 100644 --- a/packages/coding-agent/src/commit/map-reduce/map-phase.ts +++ b/packages/coding-agent/src/commit/map-reduce/map-phase.ts @@ -1,11 +1,15 @@ import type { Api, AssistantMessage, Model } from "@oh-my-pi/pi-ai"; import { completeSimple } from "@oh-my-pi/pi-ai"; -import { truncateToTokenLimit } from "$c/commit/map-reduce/utils"; -import fileObserverSystemPrompt from "$c/commit/prompts/file-observer-system.md" with { type: "text" }; -import fileObserverUserPrompt from "$c/commit/prompts/file-observer-user.md" with { type: "text" }; -import type { FileDiff, FileObservation } from "$c/commit/types"; -import { isExcludedFile } from "$c/commit/utils/exclusions"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; +import { truncateToTokenLimit } from "@oh-my-pi/pi-coding-agent/commit/map-reduce/utils"; +import fileObserverSystemPrompt from "@oh-my-pi/pi-coding-agent/commit/prompts/file-observer-system.md" with { + type: "text", +}; +import fileObserverUserPrompt from "@oh-my-pi/pi-coding-agent/commit/prompts/file-observer-user.md" with { + type: "text", +}; +import type { FileDiff, FileObservation } from "@oh-my-pi/pi-coding-agent/commit/types"; +import { isExcludedFile } from "@oh-my-pi/pi-coding-agent/commit/utils/exclusions"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; const MAX_FILE_TOKENS = 50_000; const MAX_CONTEXT_FILES = 20; diff --git a/packages/coding-agent/src/commit/map-reduce/reduce-phase.ts b/packages/coding-agent/src/commit/map-reduce/reduce-phase.ts index 801774075..b8aff9ff1 100644 --- a/packages/coding-agent/src/commit/map-reduce/reduce-phase.ts +++ b/packages/coding-agent/src/commit/map-reduce/reduce-phase.ts @@ -1,10 +1,10 @@ import type { Api, AssistantMessage, Model, ToolCall } from "@oh-my-pi/pi-ai"; import { completeSimple, validateToolCall } from "@oh-my-pi/pi-ai"; +import reduceSystemPrompt from "@oh-my-pi/pi-coding-agent/commit/prompts/reduce-system.md" with { type: "text" }; +import reduceUserPrompt from "@oh-my-pi/pi-coding-agent/commit/prompts/reduce-user.md" with { type: "text" }; +import type { ChangelogCategory, ConventionalAnalysis, FileObservation } from "@oh-my-pi/pi-coding-agent/commit/types"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; import { Type } from "@sinclair/typebox"; -import reduceSystemPrompt from "$c/commit/prompts/reduce-system.md" with { type: "text" }; -import reduceUserPrompt from "$c/commit/prompts/reduce-user.md" with { type: "text" }; -import type { ChangelogCategory, ConventionalAnalysis, FileObservation } from "$c/commit/types"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; const ReduceTool = { name: "create_conventional_analysis", diff --git a/packages/coding-agent/src/commit/message.ts b/packages/coding-agent/src/commit/message.ts index e9f2b928d..ca0fc678b 100644 --- a/packages/coding-agent/src/commit/message.ts +++ b/packages/coding-agent/src/commit/message.ts @@ -1,4 +1,4 @@ -import type { ConventionalAnalysis } from "$c/commit/types"; +import type { ConventionalAnalysis } from "@oh-my-pi/pi-coding-agent/commit/types"; export function formatCommitMessage(analysis: ConventionalAnalysis, summary: string): string { const scopePart = analysis.scope ? `(${analysis.scope})` : ""; diff --git a/packages/coding-agent/src/commit/model-selection.ts b/packages/coding-agent/src/commit/model-selection.ts index 4a5bffa1e..478651259 100644 --- a/packages/coding-agent/src/commit/model-selection.ts +++ b/packages/coding-agent/src/commit/model-selection.ts @@ -1,6 +1,10 @@ import type { Api, Model } from "@oh-my-pi/pi-ai"; -import { parseModelPattern, parseModelString, SMOL_MODEL_PRIORITY } from "$c/config/model-resolver"; -import type { SettingsManager } from "$c/config/settings-manager"; +import { + parseModelPattern, + parseModelString, + SMOL_MODEL_PRIORITY, +} from "@oh-my-pi/pi-coding-agent/config/model-resolver"; +import type { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; export async function resolvePrimaryModel( override: string | undefined, @@ -12,7 +16,7 @@ export async function resolvePrimaryModel( ): Promise<{ model: Model; apiKey: string }> { const available = modelRegistry.getAvailable(); const model = override - ? resolveModelFromString(override, available) + ? resolveModelFromString(expandRoleAlias(override, settingsManager), available) : resolveModelFromSettings(settingsManager, available); if (!model) { throw new Error("No model available for commit generation"); @@ -52,9 +56,14 @@ export async function resolveSmolModel( } function resolveModelFromSettings(settingsManager: SettingsManager, available: Model[]): Model | undefined { - const configured = settingsManager.getModelRole("default"); - if (!configured) return available[0]; - return resolveModelFromString(configured, available) ?? available[0]; + const roles = ["commit", "smol", "default"]; + for (const role of roles) { + const configured = settingsManager.getModelRole(role); + if (!configured) continue; + const resolved = resolveModelFromString(expandRoleAlias(configured, settingsManager), available); + if (resolved) return resolved; + } + return available[0]; } function resolveModelFromString(value: string, available: Model[]): Model | undefined { @@ -64,3 +73,12 @@ function resolveModelFromString(value: string, available: Model[]): Model diff --git a/packages/coding-agent/src/extensibility/extensions/loader.ts b/packages/coding-agent/src/extensibility/extensions/loader.ts index 5150841ee..34bd8cae9 100644 --- a/packages/coding-agent/src/extensibility/extensions/loader.ts +++ b/packages/coding-agent/src/extensibility/extensions/loader.ts @@ -6,18 +6,18 @@ import { existsSync, readdirSync, readFileSync, statSync } from "node:fs"; import * as path from "node:path"; import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, Model, TextContent } from "@oh-my-pi/pi-ai"; +import { type ExtensionModule, extensionModuleCapability } from "@oh-my-pi/pi-coding-agent/capability/extension-module"; +import { loadCapability } from "@oh-my-pi/pi-coding-agent/discovery"; +import { expandPath, getExtensionNameFromPath } from "@oh-my-pi/pi-coding-agent/discovery/helpers"; +import type { ExecOptions } from "@oh-my-pi/pi-coding-agent/exec/exec"; +import { execCommand } from "@oh-my-pi/pi-coding-agent/exec/exec"; +import * as piCodingAgent from "@oh-my-pi/pi-coding-agent/index"; +import type { CustomMessage } from "@oh-my-pi/pi-coding-agent/session/messages"; +import { EventBus } from "@oh-my-pi/pi-coding-agent/utils/event-bus"; import type { KeyId } from "@oh-my-pi/pi-tui"; import { logger } from "@oh-my-pi/pi-utils"; import type { TSchema } from "@sinclair/typebox"; import * as TypeBox from "@sinclair/typebox"; -import { type ExtensionModule, extensionModuleCapability } from "$c/capability/extension-module"; -import { loadCapability } from "$c/discovery"; -import { expandPath, getExtensionNameFromPath } from "$c/discovery/helpers"; -import type { ExecOptions } from "$c/exec/exec"; -import { execCommand } from "$c/exec/exec"; -import * as piCodingAgent from "$c/index"; -import type { CustomMessage } from "$c/session/messages"; -import { EventBus } from "$c/utils/event-bus"; import type { Extension, ExtensionAPI, diff --git a/packages/coding-agent/src/extensibility/extensions/runner.ts b/packages/coding-agent/src/extensibility/extensions/runner.ts index a6f3bb121..8a0aa1afa 100644 --- a/packages/coding-agent/src/extensibility/extensions/runner.ts +++ b/packages/coding-agent/src/extensibility/extensions/runner.ts @@ -4,11 +4,11 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, Model } from "@oh-my-pi/pi-ai"; +import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { type Theme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import type { KeyId } from "@oh-my-pi/pi-tui"; import { logger } from "@oh-my-pi/pi-utils"; -import type { ModelRegistry } from "$c/config/model-registry"; -import { type Theme, theme } from "$c/modes/theme/theme"; -import type { SessionManager } from "$c/session/session-manager"; import type { BeforeAgentStartEvent, BeforeAgentStartEventResult, diff --git a/packages/coding-agent/src/extensibility/extensions/types.ts b/packages/coding-agent/src/extensibility/extensions/types.ts index f4db1f5b2..eb4cc4a17 100644 --- a/packages/coding-agent/src/extensibility/extensions/types.ts +++ b/packages/coding-agent/src/extensibility/extensions/types.ts @@ -10,30 +10,36 @@ import type { AgentMessage, AgentToolResult, AgentToolUpdateCallback, ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, Model, TextContent, ToolResultMessage } from "@oh-my-pi/pi-ai"; -import type { AutocompleteItem, Component, EditorComponent, EditorTheme, KeyId, TUI } from "@oh-my-pi/pi-tui"; -import type { Static, TSchema } from "@sinclair/typebox"; -import type { KeybindingsManager } from "$c/config/keybindings"; -import type { ModelRegistry } from "$c/config/model-registry"; -import type { BashResult } from "$c/exec/bash-executor"; -import type { ExecOptions, ExecResult } from "$c/exec/exec"; -import type * as piCodingAgent from "$c/index"; -import type { PythonResult } from "$c/ipy/executor"; -import type { Theme } from "$c/modes/theme/theme"; -import type { EditToolDetails } from "$c/patch"; -import type { CompactionPreparation, CompactionResult } from "$c/session/compaction"; -import type { CustomMessage } from "$c/session/messages"; +import type { KeybindingsManager } from "@oh-my-pi/pi-coding-agent/config/keybindings"; +import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import type { BashResult } from "@oh-my-pi/pi-coding-agent/exec/bash-executor"; +import type { ExecOptions, ExecResult } from "@oh-my-pi/pi-coding-agent/exec/exec"; +import type * as piCodingAgent from "@oh-my-pi/pi-coding-agent/index"; +import type { PythonResult } from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { EditToolDetails } from "@oh-my-pi/pi-coding-agent/patch"; +import type { CompactionPreparation, CompactionResult } from "@oh-my-pi/pi-coding-agent/session/compaction"; +import type { CustomMessage } from "@oh-my-pi/pi-coding-agent/session/messages"; import type { BranchSummaryEntry, CompactionEntry, ReadonlySessionManager, SessionEntry, SessionManager, -} from "$c/session/session-manager"; -import type { BashToolDetails, FindToolDetails, GrepToolDetails, LsToolDetails, ReadToolDetails } from "$c/tools"; -import type { EventBus } from "$c/utils/event-bus"; +} from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import type { + BashToolDetails, + FindToolDetails, + GrepToolDetails, + LsToolDetails, + ReadToolDetails, +} from "@oh-my-pi/pi-coding-agent/tools"; +import type { EventBus } from "@oh-my-pi/pi-coding-agent/utils/event-bus"; +import type { AutocompleteItem, Component, EditorComponent, EditorTheme, KeyId, TUI } from "@oh-my-pi/pi-tui"; +import type { Static, TSchema } from "@sinclair/typebox"; -export type { AppAction, KeybindingsManager } from "$c/config/keybindings"; -export type { ExecOptions, ExecResult } from "$c/exec/exec"; +export type { AppAction, KeybindingsManager } from "@oh-my-pi/pi-coding-agent/config/keybindings"; +export type { ExecOptions, ExecResult } from "@oh-my-pi/pi-coding-agent/exec/exec"; export type { AgentToolResult, AgentToolUpdateCallback }; // ============================================================================ diff --git a/packages/coding-agent/src/extensibility/extensions/wrapper.ts b/packages/coding-agent/src/extensibility/extensions/wrapper.ts index 0f09d311b..70fbd6dc7 100644 --- a/packages/coding-agent/src/extensibility/extensions/wrapper.ts +++ b/packages/coding-agent/src/extensibility/extensions/wrapper.ts @@ -4,8 +4,8 @@ import type { AgentTool, AgentToolContext, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, TextContent } from "@oh-my-pi/pi-ai"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import type { Static, TSchema } from "@sinclair/typebox"; -import type { Theme } from "$c/modes/theme/theme"; import type { ExtensionRunner } from "./runner"; import type { RegisteredTool, ToolCallEventResult, ToolResultEventResult } from "./types"; diff --git a/packages/coding-agent/src/extensibility/hooks/index.ts b/packages/coding-agent/src/extensibility/hooks/index.ts index 3dc809e26..1b6fa900d 100644 --- a/packages/coding-agent/src/extensibility/hooks/index.ts +++ b/packages/coding-agent/src/extensibility/hooks/index.ts @@ -1,5 +1,5 @@ // biome-ignore assist/source/organizeImports: biome is not smart -export type { ReadonlySessionManager, UsageStatistics } from "$c/session/session-manager"; +export type { ReadonlySessionManager, UsageStatistics } from "@oh-my-pi/pi-coding-agent/session/session-manager"; export { discoverAndLoadHooks, loadHooks, diff --git a/packages/coding-agent/src/extensibility/hooks/loader.ts b/packages/coding-agent/src/extensibility/hooks/loader.ts index 06078699a..1f87f5448 100644 --- a/packages/coding-agent/src/extensibility/hooks/loader.ts +++ b/packages/coding-agent/src/extensibility/hooks/loader.ts @@ -3,15 +3,15 @@ */ import * as path from "node:path"; +import { hookCapability } from "@oh-my-pi/pi-coding-agent/capability/hook"; +import type { Hook } from "@oh-my-pi/pi-coding-agent/discovery"; +import { loadCapability } from "@oh-my-pi/pi-coding-agent/discovery"; +import { expandPath } from "@oh-my-pi/pi-coding-agent/discovery/helpers"; +import * as piCodingAgent from "@oh-my-pi/pi-coding-agent/index"; +import type { HookMessage } from "@oh-my-pi/pi-coding-agent/session/messages"; +import type { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { logger } from "@oh-my-pi/pi-utils"; import * as typebox from "@sinclair/typebox"; -import { hookCapability } from "$c/capability/hook"; -import type { Hook } from "$c/discovery"; -import { loadCapability } from "$c/discovery"; -import { expandPath } from "$c/discovery/helpers"; -import * as piCodingAgent from "$c/index"; -import type { HookMessage } from "$c/session/messages"; -import type { SessionManager } from "$c/session/session-manager"; import { execCommand } from "./runner"; import type { ExecOptions, HookAPI, HookFactory, HookMessageRenderer, RegisteredCommand } from "./types"; diff --git a/packages/coding-agent/src/extensibility/hooks/runner.ts b/packages/coding-agent/src/extensibility/hooks/runner.ts index f1ae1676c..658c08764 100644 --- a/packages/coding-agent/src/extensibility/hooks/runner.ts +++ b/packages/coding-agent/src/extensibility/hooks/runner.ts @@ -4,9 +4,9 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { Model } from "@oh-my-pi/pi-ai"; -import type { ModelRegistry } from "$c/config/model-registry"; -import { theme } from "$c/modes/theme/theme"; -import type { SessionManager } from "$c/session/session-manager"; +import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import type { AppendEntryHandler, BranchHandler, @@ -40,7 +40,7 @@ import type { export type HookErrorListener = (error: HookError) => void; // Re-export execCommand for backward compatibility -export { execCommand } from "$c/exec/exec"; +export { execCommand } from "@oh-my-pi/pi-coding-agent/exec/exec"; /** No-op UI context used when no UI is available */ const noOpUIContext: HookUIContext = { diff --git a/packages/coding-agent/src/extensibility/hooks/types.ts b/packages/coding-agent/src/extensibility/hooks/types.ts index 45d5f1976..bd27d2041 100644 --- a/packages/coding-agent/src/extensibility/hooks/types.ts +++ b/packages/coding-agent/src/extensibility/hooks/types.ts @@ -7,24 +7,30 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, Message, Model, TextContent, ToolResultMessage } from "@oh-my-pi/pi-ai"; -import type { Component, TUI } from "@oh-my-pi/pi-tui"; -import type { ModelRegistry } from "$c/config/model-registry"; -import type { ExecOptions, ExecResult } from "$c/exec/exec"; -import type { Theme } from "$c/modes/theme/theme"; -import type { EditToolDetails } from "$c/patch"; -import type { CompactionPreparation, CompactionResult } from "$c/session/compaction/index"; -import type { HookMessage } from "$c/session/messages"; +import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import type { ExecOptions, ExecResult } from "@oh-my-pi/pi-coding-agent/exec/exec"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { EditToolDetails } from "@oh-my-pi/pi-coding-agent/patch"; +import type { CompactionPreparation, CompactionResult } from "@oh-my-pi/pi-coding-agent/session/compaction/index"; +import type { HookMessage } from "@oh-my-pi/pi-coding-agent/session/messages"; import type { BranchSummaryEntry, CompactionEntry, ReadonlySessionManager, SessionEntry, SessionManager, -} from "$c/session/session-manager"; -import type { BashToolDetails, FindToolDetails, GrepToolDetails, LsToolDetails, ReadToolDetails } from "$c/tools/index"; +} from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import type { + BashToolDetails, + FindToolDetails, + GrepToolDetails, + LsToolDetails, + ReadToolDetails, +} from "@oh-my-pi/pi-coding-agent/tools/index"; +import type { Component, TUI } from "@oh-my-pi/pi-tui"; // Re-export for backward compatibility -export type { ExecOptions, ExecResult } from "$c/exec/exec"; +export type { ExecOptions, ExecResult } from "@oh-my-pi/pi-coding-agent/exec/exec"; /** * UI context for hooks to request interactive UI from the harness. diff --git a/packages/coding-agent/src/extensibility/plugins/doctor.ts b/packages/coding-agent/src/extensibility/plugins/doctor.ts index 9280ef612..a3571e184 100644 --- a/packages/coding-agent/src/extensibility/plugins/doctor.ts +++ b/packages/coding-agent/src/extensibility/plugins/doctor.ts @@ -1,4 +1,4 @@ -import { theme } from "$c/modes/theme/theme"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import type { DoctorCheck } from "./types"; export async function runDoctorChecks(): Promise { diff --git a/packages/coding-agent/src/extensibility/plugins/installer.ts b/packages/coding-agent/src/extensibility/plugins/installer.ts index f4e57d132..cb7afb3fd 100644 --- a/packages/coding-agent/src/extensibility/plugins/installer.ts +++ b/packages/coding-agent/src/extensibility/plugins/installer.ts @@ -1,7 +1,7 @@ import { lstatSync, symlinkSync, unlinkSync } from "node:fs"; import { mkdir } from "node:fs/promises"; import { join, resolve } from "node:path"; -import { getAgentDir } from "$c/config"; +import { getAgentDir } from "@oh-my-pi/pi-coding-agent/config"; import type { InstalledPlugin } from "./types"; const PLUGINS_DIR = join(getAgentDir(), "plugins"); diff --git a/packages/coding-agent/src/extensibility/plugins/paths.ts b/packages/coding-agent/src/extensibility/plugins/paths.ts index 1fa638b0e..3fa594e42 100644 --- a/packages/coding-agent/src/extensibility/plugins/paths.ts +++ b/packages/coding-agent/src/extensibility/plugins/paths.ts @@ -1,6 +1,6 @@ import { homedir } from "node:os"; import { join } from "node:path"; -import { CONFIG_DIR_NAME, getConfigDirPaths } from "$c/config"; +import { CONFIG_DIR_NAME, getConfigDirPaths } from "@oh-my-pi/pi-coding-agent/config"; // ============================================================================= // Plugin Directory Paths diff --git a/packages/coding-agent/src/extensibility/skills.ts b/packages/coding-agent/src/extensibility/skills.ts index 50831c562..f382b98df 100644 --- a/packages/coding-agent/src/extensibility/skills.ts +++ b/packages/coding-agent/src/extensibility/skills.ts @@ -1,13 +1,16 @@ import { readdirSync, readFileSync, statSync } from "node:fs"; import { realpath } from "node:fs/promises"; import { basename, join } from "node:path"; +import { skillCapability } from "@oh-my-pi/pi-coding-agent/capability/skill"; +import type { SourceMeta } from "@oh-my-pi/pi-coding-agent/capability/types"; +import type { SkillsSettings } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import type { + Skill as CapabilitySkill, + SkillFrontmatter as ImportedSkillFrontmatter, +} from "@oh-my-pi/pi-coding-agent/discovery"; +import { loadCapability } from "@oh-my-pi/pi-coding-agent/discovery"; +import { parseFrontmatter } from "@oh-my-pi/pi-coding-agent/utils/frontmatter"; import { logger } from "@oh-my-pi/pi-utils"; -import { skillCapability } from "$c/capability/skill"; -import type { SourceMeta } from "$c/capability/types"; -import type { SkillsSettings } from "$c/config/settings-manager"; -import type { Skill as CapabilitySkill, SkillFrontmatter as ImportedSkillFrontmatter } from "$c/discovery"; -import { loadCapability } from "$c/discovery"; -import { parseFrontmatter } from "$c/utils/frontmatter"; // Re-export SkillFrontmatter for backward compatibility export type { ImportedSkillFrontmatter as SkillFrontmatter }; diff --git a/packages/coding-agent/src/extensibility/slash-commands.ts b/packages/coding-agent/src/extensibility/slash-commands.ts index 47049aed7..c4f0dc055 100644 --- a/packages/coding-agent/src/extensibility/slash-commands.ts +++ b/packages/coding-agent/src/extensibility/slash-commands.ts @@ -1,9 +1,9 @@ -import { slashCommandCapability } from "$c/capability/slash-command"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import type { SlashCommand } from "$c/discovery"; -import { loadCapability } from "$c/discovery"; -import { EMBEDDED_COMMAND_TEMPLATES } from "$c/task/commands"; -import { parseFrontmatter } from "$c/utils/frontmatter"; +import { slashCommandCapability } from "@oh-my-pi/pi-coding-agent/capability/slash-command"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import type { SlashCommand } from "@oh-my-pi/pi-coding-agent/discovery"; +import { loadCapability } from "@oh-my-pi/pi-coding-agent/discovery"; +import { EMBEDDED_COMMAND_TEMPLATES } from "@oh-my-pi/pi-coding-agent/task/commands"; +import { parseFrontmatter } from "@oh-my-pi/pi-coding-agent/utils/frontmatter"; /** * Represents a custom slash command loaded from a file diff --git a/packages/coding-agent/src/index.ts b/packages/coding-agent/src/index.ts index b1f9562a8..785082349 100644 --- a/packages/coding-agent/src/index.ts +++ b/packages/coding-agent/src/index.ts @@ -3,11 +3,7 @@ // TypeBox helper for string enums (convenience for custom tools) // Re-export from pi-ai which uses the correct enum-based schema format export { StringEnum } from "@oh-my-pi/pi-ai"; -// Re-export TUI components for custom tool rendering -export { Container, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui"; -// Logging -export { logger } from "@oh-my-pi/pi-utils"; -export type { FileDiagnosticsResult } from "$c/lsp/index"; +export type { FileDiagnosticsResult } from "@oh-my-pi/pi-coding-agent/lsp/index"; // UI components for extensions export { ArminComponent, @@ -41,7 +37,7 @@ export { UserMessageComponent, UserMessageSelectorComponent, type VisualTruncateResult, -} from "$c/modes/components/index"; +} from "@oh-my-pi/pi-coding-agent/modes/components/index"; // Theme utilities for custom tools export { getLanguageFromPath, @@ -52,7 +48,11 @@ export { initTheme, Theme, type ThemeColor, -} from "$c/modes/theme/theme"; +} from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +// Re-export TUI components for custom tool rendering +export { Container, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui"; +// Logging +export { logger } from "@oh-my-pi/pi-utils"; export { getAgentDir, VERSION } from "./config"; export { formatKeyHint, formatKeyHints } from "./config/keybindings"; export { ModelRegistry } from "./config/model-registry"; diff --git a/packages/coding-agent/src/internal-urls/rule-protocol.ts b/packages/coding-agent/src/internal-urls/rule-protocol.ts index 5101f9ed6..aea5bff2a 100644 --- a/packages/coding-agent/src/internal-urls/rule-protocol.ts +++ b/packages/coding-agent/src/internal-urls/rule-protocol.ts @@ -7,7 +7,7 @@ * - rule:// - Reads rule content */ -import type { Rule } from "$c/capability/rule"; +import type { Rule } from "@oh-my-pi/pi-coding-agent/capability/rule"; import type { InternalResource, InternalUrl, ProtocolHandler } from "./types"; export interface RuleProtocolOptions { diff --git a/packages/coding-agent/src/internal-urls/skill-protocol.ts b/packages/coding-agent/src/internal-urls/skill-protocol.ts index c3bc37a96..ac028ce6e 100644 --- a/packages/coding-agent/src/internal-urls/skill-protocol.ts +++ b/packages/coding-agent/src/internal-urls/skill-protocol.ts @@ -9,7 +9,7 @@ */ import * as path from "node:path"; -import type { Skill } from "$c/extensibility/skills"; +import type { Skill } from "@oh-my-pi/pi-coding-agent/extensibility/skills"; import type { InternalResource, InternalUrl, ProtocolHandler } from "./types"; export interface SkillProtocolOptions { diff --git a/packages/coding-agent/src/ipy/executor.ts b/packages/coding-agent/src/ipy/executor.ts index f21c88de2..d1f1faadc 100644 --- a/packages/coding-agent/src/ipy/executor.ts +++ b/packages/coding-agent/src/ipy/executor.ts @@ -1,5 +1,4 @@ -import { logger } from "@oh-my-pi/pi-utils"; -import { shutdownSharedGateway } from "$c/ipy/gateway-coordinator"; +import { shutdownSharedGateway } from "@oh-my-pi/pi-coding-agent/ipy/gateway-coordinator"; import { checkPythonKernelAvailability, type KernelDisplayOutput, @@ -7,8 +6,9 @@ import { type KernelExecuteResult, type PreludeHelper, PythonKernel, -} from "$c/ipy/kernel"; -import { OutputSink } from "$c/session/streaming-output"; +} from "@oh-my-pi/pi-coding-agent/ipy/kernel"; +import { OutputSink } from "@oh-my-pi/pi-coding-agent/session/streaming-output"; +import { logger } from "@oh-my-pi/pi-utils"; const IDLE_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes const MAX_KERNEL_SESSIONS = 4; diff --git a/packages/coding-agent/src/ipy/gateway-coordinator.ts b/packages/coding-agent/src/ipy/gateway-coordinator.ts index 7800c33ac..9f15401ad 100644 --- a/packages/coding-agent/src/ipy/gateway-coordinator.ts +++ b/packages/coding-agent/src/ipy/gateway-coordinator.ts @@ -12,11 +12,11 @@ import { } from "node:fs"; import { createServer } from "node:net"; import { delimiter, join } from "node:path"; +import { getAgentDir } from "@oh-my-pi/pi-coding-agent/config"; +import { getShellConfig, killProcessTree } from "@oh-my-pi/pi-coding-agent/utils/shell"; +import { getOrCreateSnapshot } from "@oh-my-pi/pi-coding-agent/utils/shell-snapshot"; import { logger } from "@oh-my-pi/pi-utils"; import type { Subprocess } from "bun"; -import { getAgentDir } from "$c/config"; -import { getShellConfig, killProcessTree } from "$c/utils/shell"; -import { getOrCreateSnapshot } from "$c/utils/shell-snapshot"; const GATEWAY_DIR_NAME = "python-gateway"; const GATEWAY_INFO_FILE = "gateway.json"; diff --git a/packages/coding-agent/src/ipy/kernel.ts b/packages/coding-agent/src/ipy/kernel.ts index 53b05dbd7..059a68a47 100644 --- a/packages/coding-agent/src/ipy/kernel.ts +++ b/packages/coding-agent/src/ipy/kernel.ts @@ -1,11 +1,11 @@ import { createServer } from "node:net"; import { delimiter, join } from "node:path"; +import { getShellConfig, killProcessTree } from "@oh-my-pi/pi-coding-agent/utils/shell"; +import { getOrCreateSnapshot } from "@oh-my-pi/pi-coding-agent/utils/shell-snapshot"; +import { htmlToBasicMarkdown } from "@oh-my-pi/pi-coding-agent/web/scrapers/types"; import { logger } from "@oh-my-pi/pi-utils"; import { $, type Subprocess } from "bun"; import { nanoid } from "nanoid"; -import { getShellConfig, killProcessTree } from "$c/utils/shell"; -import { getOrCreateSnapshot } from "$c/utils/shell-snapshot"; -import { htmlToBasicMarkdown } from "$c/web/scrapers/types"; import { acquireSharedGateway, releaseSharedGateway } from "./gateway-coordinator"; import { loadPythonModules } from "./modules"; import { PYTHON_PRELUDE } from "./prelude"; diff --git a/packages/coding-agent/src/lsp/client.ts b/packages/coding-agent/src/lsp/client.ts index 6fd7eca64..673327048 100644 --- a/packages/coding-agent/src/lsp/client.ts +++ b/packages/coding-agent/src/lsp/client.ts @@ -1,6 +1,6 @@ import * as fs from "node:fs"; +import { ToolAbortError, throwIfAborted } from "@oh-my-pi/pi-coding-agent/tools/tool-errors"; import { logger } from "@oh-my-pi/pi-utils"; -import { ToolAbortError, throwIfAborted } from "$c/tools/tool-errors"; import { applyWorkspaceEdit } from "./edits"; import { getLspmuxCommand, isLspmuxSupported } from "./lspmux"; import type { diff --git a/packages/coding-agent/src/lsp/clients/biome-client.ts b/packages/coding-agent/src/lsp/clients/biome-client.ts index 69dd56d96..bb5dc8dbe 100644 --- a/packages/coding-agent/src/lsp/clients/biome-client.ts +++ b/packages/coding-agent/src/lsp/clients/biome-client.ts @@ -4,7 +4,7 @@ */ import path from "node:path"; -import type { Diagnostic, DiagnosticSeverity, LinterClient, ServerConfig } from "$c/lsp/types"; +import type { Diagnostic, DiagnosticSeverity, LinterClient, ServerConfig } from "@oh-my-pi/pi-coding-agent/lsp/types"; // ============================================================================= // Biome JSON Output Types diff --git a/packages/coding-agent/src/lsp/clients/index.ts b/packages/coding-agent/src/lsp/clients/index.ts index 7b66e2375..020f962a6 100644 --- a/packages/coding-agent/src/lsp/clients/index.ts +++ b/packages/coding-agent/src/lsp/clients/index.ts @@ -8,7 +8,7 @@ export { BiomeClient } from "./biome-client"; export { LspLinterClient } from "./lsp-linter-client"; -import type { LinterClient, ServerConfig } from "$c/lsp/types"; +import type { LinterClient, ServerConfig } from "@oh-my-pi/pi-coding-agent/lsp/types"; import { LspLinterClient } from "./lsp-linter-client"; // Cache of linter clients by server name + cwd diff --git a/packages/coding-agent/src/lsp/clients/lsp-linter-client.ts b/packages/coding-agent/src/lsp/clients/lsp-linter-client.ts index 409d88d16..aaaa8576a 100644 --- a/packages/coding-agent/src/lsp/clients/lsp-linter-client.ts +++ b/packages/coding-agent/src/lsp/clients/lsp-linter-client.ts @@ -3,10 +3,10 @@ * Uses the Language Server Protocol for formatting and diagnostics. */ -import { getOrCreateClient, notifySaved, sendRequest, syncContent } from "$c/lsp/client"; -import { applyTextEditsToString } from "$c/lsp/edits"; -import type { Diagnostic, LinterClient, LspClient, ServerConfig, TextEdit } from "$c/lsp/types"; -import { fileToUri } from "$c/lsp/utils"; +import { getOrCreateClient, notifySaved, sendRequest, syncContent } from "@oh-my-pi/pi-coding-agent/lsp/client"; +import { applyTextEditsToString } from "@oh-my-pi/pi-coding-agent/lsp/edits"; +import type { Diagnostic, LinterClient, LspClient, ServerConfig, TextEdit } from "@oh-my-pi/pi-coding-agent/lsp/types"; +import { fileToUri } from "@oh-my-pi/pi-coding-agent/lsp/utils"; /** Default formatting options for LSP */ const DEFAULT_FORMAT_OPTIONS = { diff --git a/packages/coding-agent/src/lsp/config.ts b/packages/coding-agent/src/lsp/config.ts index 2e592d5d2..67dbffaec 100644 --- a/packages/coding-agent/src/lsp/config.ts +++ b/packages/coding-agent/src/lsp/config.ts @@ -1,9 +1,9 @@ import { homedir } from "node:os"; import { basename, extname, join } from "node:path"; +import { getConfigDirPaths } from "@oh-my-pi/pi-coding-agent/config"; import { logger } from "@oh-my-pi/pi-utils"; import { YAML } from "bun"; import { globSync } from "glob"; -import { getConfigDirPaths } from "$c/config"; import { BiomeClient } from "./clients/biome-client"; import DEFAULTS from "./defaults.json" with { type: "json" }; import type { ServerConfig } from "./types"; diff --git a/packages/coding-agent/src/lsp/index.ts b/packages/coding-agent/src/lsp/index.ts index 32d3bd12f..ea732bed9 100644 --- a/packages/coding-agent/src/lsp/index.ts +++ b/packages/coding-agent/src/lsp/index.ts @@ -2,14 +2,14 @@ import type { Dirent } from "node:fs"; import { existsSync, statSync } from "node:fs"; import path from "node:path"; import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import { type Theme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import lspDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/lsp.md" with { type: "text" }; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { resolveToCwd } from "@oh-my-pi/pi-coding-agent/tools/path-utils"; +import { throwIfAborted } from "@oh-my-pi/pi-coding-agent/tools/tool-errors"; import { logger, once, untilAborted } from "@oh-my-pi/pi-utils"; import type { BunFile } from "bun"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import { type Theme, theme } from "$c/modes/theme/theme"; -import lspDescription from "$c/prompts/tools/lsp.md" with { type: "text" }; -import type { ToolSession } from "$c/tools/index"; -import { resolveToCwd } from "$c/tools/path-utils"; -import { throwIfAborted } from "$c/tools/tool-errors"; import { ensureFileOpen, getActiveClients, diff --git a/packages/coding-agent/src/lsp/render.ts b/packages/coding-agent/src/lsp/render.ts index fdee1516b..c8b6eb117 100644 --- a/packages/coding-agent/src/lsp/render.ts +++ b/packages/coding-agent/src/lsp/render.ts @@ -9,11 +9,16 @@ */ import type { AgentToolResult, RenderResultOptions } from "@oh-my-pi/pi-agent-core"; +import { getLanguageFromPath, type Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import { + formatExpandHint, + formatMoreItems, + TRUNCATE_LENGTHS, + truncate, +} from "@oh-my-pi/pi-coding-agent/tools/render-utils"; +import { renderOutputBlock, renderStatusLine } from "@oh-my-pi/pi-coding-agent/tui"; import { type Component, Text } from "@oh-my-pi/pi-tui"; import { highlight, supportsLanguage } from "cli-highlight"; -import { getLanguageFromPath, type Theme } from "$c/modes/theme/theme"; -import { formatExpandHint, formatMoreItems, TRUNCATE_LENGTHS, truncate } from "$c/tools/render-utils"; -import { renderOutputBlock, renderStatusLine } from "$c/tui"; import type { LspParams, LspToolDetails } from "./types"; // ============================================================================= diff --git a/packages/coding-agent/src/lsp/utils.ts b/packages/coding-agent/src/lsp/utils.ts index 46cfbbc08..af9d3e080 100644 --- a/packages/coding-agent/src/lsp/utils.ts +++ b/packages/coding-agent/src/lsp/utils.ts @@ -1,5 +1,5 @@ import path from "node:path"; -import { type Theme, theme } from "$c/modes/theme/theme"; +import { type Theme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import type { Diagnostic, DiagnosticSeverity, diff --git a/packages/coding-agent/src/main.ts b/packages/coding-agent/src/main.ts index 2337aad54..1c6e7a7c7 100644 --- a/packages/coding-agent/src/main.ts +++ b/packages/coding-agent/src/main.ts @@ -9,9 +9,9 @@ import { homedir, tmpdir } from "node:os"; import { join, resolve } from "node:path"; import { createInterface } from "node:readline/promises"; import { type ImageContent, supportsXhigh } from "@oh-my-pi/pi-ai"; +import { initTheme, stopThemeWatcher } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { postmortem } from "@oh-my-pi/pi-utils"; import chalk from "chalk"; -import { initTheme, stopThemeWatcher } from "$c/modes/theme/theme"; import { type Args, parseArgs, printHelp } from "./cli/args"; import { parseConfigArgs, printConfigHelp, runConfigCommand } from "./cli/config-cli"; import { processFileArguments } from "./cli/file-processor"; diff --git a/packages/coding-agent/src/mcp/config.ts b/packages/coding-agent/src/mcp/config.ts index 225325af0..0199a53ee 100644 --- a/packages/coding-agent/src/mcp/config.ts +++ b/packages/coding-agent/src/mcp/config.ts @@ -4,9 +4,9 @@ * Uses the capability system to load MCP servers from multiple sources. */ -import { mcpCapability } from "$c/capability/mcp"; -import type { MCPServer } from "$c/discovery"; -import { loadCapability } from "$c/discovery"; +import { mcpCapability } from "@oh-my-pi/pi-coding-agent/capability/mcp"; +import type { MCPServer } from "@oh-my-pi/pi-coding-agent/discovery"; +import { loadCapability } from "@oh-my-pi/pi-coding-agent/discovery"; import type { MCPServerConfig } from "./types"; /** Options for loading MCP configs */ diff --git a/packages/coding-agent/src/mcp/loader.ts b/packages/coding-agent/src/mcp/loader.ts index 84e6a4255..60f164391 100644 --- a/packages/coding-agent/src/mcp/loader.ts +++ b/packages/coding-agent/src/mcp/loader.ts @@ -4,9 +4,9 @@ * Integrates MCP tool discovery with the custom tools system. */ +import type { LoadedCustomTool } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import { AgentStorage } from "@oh-my-pi/pi-coding-agent/session/agent-storage"; import { logger } from "@oh-my-pi/pi-utils"; -import type { LoadedCustomTool } from "$c/extensibility/custom-tools/types"; -import { AgentStorage } from "$c/session/agent-storage"; import { type MCPLoadResult, MCPManager } from "./manager"; import { MCPToolCache } from "./tool-cache"; diff --git a/packages/coding-agent/src/mcp/manager.ts b/packages/coding-agent/src/mcp/manager.ts index 4332b8a55..22326a2da 100644 --- a/packages/coding-agent/src/mcp/manager.ts +++ b/packages/coding-agent/src/mcp/manager.ts @@ -5,9 +5,9 @@ * Handles tool loading and lifecycle. */ +import type { CustomTool } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; import { logger } from "@oh-my-pi/pi-utils"; import type { TSchema } from "@sinclair/typebox"; -import type { CustomTool } from "$c/extensibility/custom-tools/types"; import { connectToServer, disconnectServer, listTools } from "./client"; import { loadAllMCPConfigs, validateServerConfig } from "./config"; import type { MCPToolDetails } from "./tool-bridge"; diff --git a/packages/coding-agent/src/mcp/tool-bridge.ts b/packages/coding-agent/src/mcp/tool-bridge.ts index 9326b9131..6b6e9bc75 100644 --- a/packages/coding-agent/src/mcp/tool-bridge.ts +++ b/packages/coding-agent/src/mcp/tool-bridge.ts @@ -5,9 +5,13 @@ */ import type { AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; +import type { SourceMeta } from "@oh-my-pi/pi-coding-agent/capability/types"; +import type { + CustomTool, + CustomToolContext, + CustomToolResult, +} from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; import type { TSchema } from "@sinclair/typebox"; -import type { SourceMeta } from "$c/capability/types"; -import type { CustomTool, CustomToolContext, CustomToolResult } from "$c/extensibility/custom-tools/types"; import { callTool } from "./client"; import type { MCPContent, MCPServerConnection, MCPToolDefinition } from "./types"; diff --git a/packages/coding-agent/src/mcp/tool-cache.ts b/packages/coding-agent/src/mcp/tool-cache.ts index fd476b04d..094d11878 100644 --- a/packages/coding-agent/src/mcp/tool-cache.ts +++ b/packages/coding-agent/src/mcp/tool-cache.ts @@ -4,8 +4,8 @@ * Stores tool definitions per server in agent.db for fast startup. */ +import type { AgentStorage } from "@oh-my-pi/pi-coding-agent/session/agent-storage"; import { logger } from "@oh-my-pi/pi-utils"; -import type { AgentStorage } from "$c/session/agent-storage"; import type { MCPServerConfig, MCPToolDefinition } from "./types"; const CACHE_VERSION = 1; diff --git a/packages/coding-agent/src/mcp/transports/http.ts b/packages/coding-agent/src/mcp/transports/http.ts index 892f1b782..b14732cc9 100644 --- a/packages/coding-agent/src/mcp/transports/http.ts +++ b/packages/coding-agent/src/mcp/transports/http.ts @@ -11,7 +11,7 @@ import type { MCPHttpServerConfig, MCPSseServerConfig, MCPTransport, -} from "$c/mcp/types"; +} from "@oh-my-pi/pi-coding-agent/mcp/types"; /** Generate unique request ID */ function generateId(): string { diff --git a/packages/coding-agent/src/mcp/transports/stdio.ts b/packages/coding-agent/src/mcp/transports/stdio.ts index 88b77394c..df28d0b25 100644 --- a/packages/coding-agent/src/mcp/transports/stdio.ts +++ b/packages/coding-agent/src/mcp/transports/stdio.ts @@ -5,8 +5,8 @@ * Messages are newline-delimited JSON. */ +import type { JsonRpcResponse, MCPStdioServerConfig, MCPTransport } from "@oh-my-pi/pi-coding-agent/mcp/types"; import { type Subprocess, spawn } from "bun"; -import type { JsonRpcResponse, MCPStdioServerConfig, MCPTransport } from "$c/mcp/types"; /** Generate unique request ID */ function generateId(): string { diff --git a/packages/coding-agent/src/migrations.ts b/packages/coding-agent/src/migrations.ts index 7988400a3..0b3a8e5cf 100644 --- a/packages/coding-agent/src/migrations.ts +++ b/packages/coding-agent/src/migrations.ts @@ -4,10 +4,10 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs"; import { join } from "node:path"; +import { AgentStorage } from "@oh-my-pi/pi-coding-agent/session/agent-storage"; +import type { AuthCredential } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; import { logger } from "@oh-my-pi/pi-utils"; import chalk from "chalk"; -import { AgentStorage } from "$c/session/agent-storage"; -import type { AuthCredential } from "$c/session/auth-storage"; import { getAgentDbPath, getAgentDir, getBinDir } from "./config"; /** diff --git a/packages/coding-agent/src/modes/components/armin.ts b/packages/coding-agent/src/modes/components/armin.ts index d27c37480..2a0d72403 100644 --- a/packages/coding-agent/src/modes/components/armin.ts +++ b/packages/coding-agent/src/modes/components/armin.ts @@ -2,8 +2,8 @@ * Armin says hi! A fun easter egg with animated XBM art. */ +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import type { Component, TUI } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/theme/theme"; // XBM image: 31x36 pixels, LSB first, 1=background, 0=foreground const WIDTH = 31; diff --git a/packages/coding-agent/src/modes/components/assistant-message.ts b/packages/coding-agent/src/modes/components/assistant-message.ts index 198918279..8e83cc5eb 100644 --- a/packages/coding-agent/src/modes/components/assistant-message.ts +++ b/packages/coding-agent/src/modes/components/assistant-message.ts @@ -1,7 +1,7 @@ import type { AssistantMessage } from "@oh-my-pi/pi-ai"; +import { hasPendingMermaid, prerenderMermaid } from "@oh-my-pi/pi-coding-agent/modes/theme/mermaid-cache"; +import { getMarkdownTheme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { Container, getCapabilities, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui"; -import { hasPendingMermaid, prerenderMermaid } from "$c/modes/theme/mermaid-cache"; -import { getMarkdownTheme, theme } from "$c/modes/theme/theme"; /** * Component that renders a complete assistant message diff --git a/packages/coding-agent/src/modes/components/bash-execution.ts b/packages/coding-agent/src/modes/components/bash-execution.ts index cc945ff06..c1ffd30bf 100644 --- a/packages/coding-agent/src/modes/components/bash-execution.ts +++ b/packages/coding-agent/src/modes/components/bash-execution.ts @@ -2,11 +2,11 @@ * Component for displaying bash command execution with streaming output. */ +import { getSymbolTheme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { TruncationMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { formatSize } from "@oh-my-pi/pi-coding-agent/tools/truncate"; import { Container, Loader, Spacer, Text, type TUI } from "@oh-my-pi/pi-tui"; import stripAnsi from "strip-ansi"; -import { getSymbolTheme, theme } from "$c/modes/theme/theme"; -import type { TruncationMeta } from "$c/tools/output-meta"; -import { formatSize } from "$c/tools/truncate"; import { DynamicBorder } from "./dynamic-border"; import { truncateToVisualLines } from "./visual-truncate"; diff --git a/packages/coding-agent/src/modes/components/bordered-loader.ts b/packages/coding-agent/src/modes/components/bordered-loader.ts index 00e2d6346..8434de2c5 100644 --- a/packages/coding-agent/src/modes/components/bordered-loader.ts +++ b/packages/coding-agent/src/modes/components/bordered-loader.ts @@ -1,5 +1,5 @@ +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { CancellableLoader, Container, Spacer, Text, type TUI } from "@oh-my-pi/pi-tui"; -import type { Theme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; /** Loader wrapped with borders for hook UI */ diff --git a/packages/coding-agent/src/modes/components/branch-summary-message.ts b/packages/coding-agent/src/modes/components/branch-summary-message.ts index 9142856ce..3a5ffb580 100644 --- a/packages/coding-agent/src/modes/components/branch-summary-message.ts +++ b/packages/coding-agent/src/modes/components/branch-summary-message.ts @@ -1,6 +1,6 @@ +import { getMarkdownTheme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { BranchSummaryMessage } from "@oh-my-pi/pi-coding-agent/session/messages"; import { Box, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui"; -import { getMarkdownTheme, theme } from "$c/modes/theme/theme"; -import type { BranchSummaryMessage } from "$c/session/messages"; /** * Component that renders a branch summary message with collapsed/expanded state. diff --git a/packages/coding-agent/src/modes/components/compaction-summary-message.ts b/packages/coding-agent/src/modes/components/compaction-summary-message.ts index 1c1104329..ea13a97c6 100644 --- a/packages/coding-agent/src/modes/components/compaction-summary-message.ts +++ b/packages/coding-agent/src/modes/components/compaction-summary-message.ts @@ -1,6 +1,6 @@ +import { getMarkdownTheme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { CompactionSummaryMessage } from "@oh-my-pi/pi-coding-agent/session/messages"; import { Box, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui"; -import { getMarkdownTheme, theme } from "$c/modes/theme/theme"; -import type { CompactionSummaryMessage } from "$c/session/messages"; /** * Component that renders a compaction message with collapsed/expanded state. diff --git a/packages/coding-agent/src/modes/components/custom-message.ts b/packages/coding-agent/src/modes/components/custom-message.ts index 30f76c7d7..d3f1455e3 100644 --- a/packages/coding-agent/src/modes/components/custom-message.ts +++ b/packages/coding-agent/src/modes/components/custom-message.ts @@ -1,9 +1,9 @@ import type { TextContent } from "@oh-my-pi/pi-ai"; +import type { MessageRenderer } from "@oh-my-pi/pi-coding-agent/extensibility/extensions/types"; +import { getMarkdownTheme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { CustomMessage } from "@oh-my-pi/pi-coding-agent/session/messages"; import type { Component } from "@oh-my-pi/pi-tui"; import { Box, Container, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui"; -import type { MessageRenderer } from "$c/extensibility/extensions/types"; -import { getMarkdownTheme, theme } from "$c/modes/theme/theme"; -import type { CustomMessage } from "$c/session/messages"; /** * Component that renders a custom message entry from extensions. diff --git a/packages/coding-agent/src/modes/components/diff.ts b/packages/coding-agent/src/modes/components/diff.ts index 0f02ecf86..8ceeafd93 100644 --- a/packages/coding-agent/src/modes/components/diff.ts +++ b/packages/coding-agent/src/modes/components/diff.ts @@ -1,5 +1,5 @@ +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import * as Diff from "diff"; -import { theme } from "$c/modes/theme/theme"; /** * Parse diff line to extract prefix, line number, and content. diff --git a/packages/coding-agent/src/modes/components/dynamic-border.ts b/packages/coding-agent/src/modes/components/dynamic-border.ts index e84e36081..fe480e8f6 100644 --- a/packages/coding-agent/src/modes/components/dynamic-border.ts +++ b/packages/coding-agent/src/modes/components/dynamic-border.ts @@ -1,5 +1,5 @@ +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import type { Component } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/theme/theme"; /** * Dynamic border component that adjusts to viewport width. diff --git a/packages/coding-agent/src/modes/components/extensions/extension-dashboard.ts b/packages/coding-agent/src/modes/components/extensions/extension-dashboard.ts index e3690577f..99298852b 100644 --- a/packages/coding-agent/src/modes/components/extensions/extension-dashboard.ts +++ b/packages/coding-agent/src/modes/components/extensions/extension-dashboard.ts @@ -12,10 +12,10 @@ * - Esc: Close dashboard (clears search first if active) */ +import type { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { DynamicBorder } from "@oh-my-pi/pi-coding-agent/modes/components/dynamic-border"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { type Component, Container, matchesKey, Spacer, Text, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui"; -import type { SettingsManager } from "$c/config/settings-manager"; -import { DynamicBorder } from "$c/modes/components/dynamic-border"; -import { theme } from "$c/modes/theme/theme"; import { ExtensionList } from "./extension-list"; import { InspectorPanel } from "./inspector-panel"; import { applyFilter, createInitialState, filterByProvider, refreshState, toggleProvider } from "./state-manager"; diff --git a/packages/coding-agent/src/modes/components/extensions/extension-list.ts b/packages/coding-agent/src/modes/components/extensions/extension-list.ts index dc2befece..05b2a1cbd 100644 --- a/packages/coding-agent/src/modes/components/extensions/extension-list.ts +++ b/packages/coding-agent/src/modes/components/extensions/extension-list.ts @@ -6,9 +6,9 @@ * master switch is off. */ +import { isProviderEnabled } from "@oh-my-pi/pi-coding-agent/discovery"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { type Component, matchesKey, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui"; -import { isProviderEnabled } from "$c/discovery"; -import { theme } from "$c/modes/theme/theme"; import { applyFilter } from "./state-manager"; import type { Extension, ExtensionKind, ExtensionState } from "./types"; diff --git a/packages/coding-agent/src/modes/components/extensions/inspector-panel.ts b/packages/coding-agent/src/modes/components/extensions/inspector-panel.ts index 3a8ffc7ea..1b6562937 100644 --- a/packages/coding-agent/src/modes/components/extensions/inspector-panel.ts +++ b/packages/coding-agent/src/modes/components/extensions/inspector-panel.ts @@ -5,8 +5,8 @@ */ import { homedir } from "node:os"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { type Component, truncateToWidth, wrapTextWithAnsi } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/theme/theme"; import type { Extension, ExtensionState } from "./types"; export class InspectorPanel implements Component { diff --git a/packages/coding-agent/src/modes/components/extensions/state-manager.ts b/packages/coding-agent/src/modes/components/extensions/state-manager.ts index 5151778f8..0fc1b04db 100644 --- a/packages/coding-agent/src/modes/components/extensions/state-manager.ts +++ b/packages/coding-agent/src/modes/components/extensions/state-manager.ts @@ -3,18 +3,24 @@ * Handles data loading, tree building, filtering, and toggle persistence. */ +import type { ContextFile } from "@oh-my-pi/pi-coding-agent/capability/context-file"; +import type { ExtensionModule } from "@oh-my-pi/pi-coding-agent/capability/extension-module"; +import type { Hook } from "@oh-my-pi/pi-coding-agent/capability/hook"; +import type { MCPServer } from "@oh-my-pi/pi-coding-agent/capability/mcp"; +import type { Prompt } from "@oh-my-pi/pi-coding-agent/capability/prompt"; +import type { Rule } from "@oh-my-pi/pi-coding-agent/capability/rule"; +import type { Skill } from "@oh-my-pi/pi-coding-agent/capability/skill"; +import type { SlashCommand } from "@oh-my-pi/pi-coding-agent/capability/slash-command"; +import type { CustomTool } from "@oh-my-pi/pi-coding-agent/capability/tool"; +import type { SourceMeta } from "@oh-my-pi/pi-coding-agent/capability/types"; +import { + disableProvider, + enableProvider, + getAllProvidersInfo, + isProviderEnabled, + loadCapability, +} from "@oh-my-pi/pi-coding-agent/discovery"; import { logger } from "@oh-my-pi/pi-utils"; -import type { ContextFile } from "$c/capability/context-file"; -import type { ExtensionModule } from "$c/capability/extension-module"; -import type { Hook } from "$c/capability/hook"; -import type { MCPServer } from "$c/capability/mcp"; -import type { Prompt } from "$c/capability/prompt"; -import type { Rule } from "$c/capability/rule"; -import type { Skill } from "$c/capability/skill"; -import type { SlashCommand } from "$c/capability/slash-command"; -import type { CustomTool } from "$c/capability/tool"; -import type { SourceMeta } from "$c/capability/types"; -import { disableProvider, enableProvider, getAllProvidersInfo, isProviderEnabled, loadCapability } from "$c/discovery"; import type { DashboardState, Extension, diff --git a/packages/coding-agent/src/modes/components/extensions/types.ts b/packages/coding-agent/src/modes/components/extensions/types.ts index 8ae64fdf1..f2a872ce5 100644 --- a/packages/coding-agent/src/modes/components/extensions/types.ts +++ b/packages/coding-agent/src/modes/components/extensions/types.ts @@ -2,7 +2,7 @@ * Types for the Extension Control Center dashboard. */ -import type { SourceMeta } from "$c/capability/types"; +import type { SourceMeta } from "@oh-my-pi/pi-coding-agent/capability/types"; /** * Extension kinds matching capability types. diff --git a/packages/coding-agent/src/modes/components/footer.ts b/packages/coding-agent/src/modes/components/footer.ts index 1b59e73d7..10688835f 100644 --- a/packages/coding-agent/src/modes/components/footer.ts +++ b/packages/coding-agent/src/modes/components/footer.ts @@ -1,10 +1,10 @@ import { existsSync, type FSWatcher, readFileSync, watch } from "node:fs"; import type { AssistantMessage } from "@oh-my-pi/pi-ai"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { shortenPath } from "@oh-my-pi/pi-coding-agent/tools/render-utils"; import { type Component, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui"; import { dirname, join } from "path"; -import { theme } from "$c/modes/theme/theme"; -import type { AgentSession } from "$c/session/agent-session"; -import { shortenPath } from "$c/tools/render-utils"; /** * Sanitize text for display in a single-line status. diff --git a/packages/coding-agent/src/modes/components/history-search.ts b/packages/coding-agent/src/modes/components/history-search.ts index 753004f20..4220584d7 100644 --- a/packages/coding-agent/src/modes/components/history-search.ts +++ b/packages/coding-agent/src/modes/components/history-search.ts @@ -1,3 +1,5 @@ +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { HistoryEntry, HistoryStorage } from "@oh-my-pi/pi-coding-agent/session/history-storage"; import { type Component, Container, @@ -8,8 +10,6 @@ import { truncateToWidth, visibleWidth, } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/theme/theme"; -import type { HistoryEntry, HistoryStorage } from "$c/session/history-storage"; import { DynamicBorder } from "./dynamic-border"; class HistoryResultsList implements Component { diff --git a/packages/coding-agent/src/modes/components/hook-editor.ts b/packages/coding-agent/src/modes/components/hook-editor.ts index 6f41010d0..be0464546 100644 --- a/packages/coding-agent/src/modes/components/hook-editor.ts +++ b/packages/coding-agent/src/modes/components/hook-editor.ts @@ -6,9 +6,9 @@ import { rm } from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; +import { getEditorTheme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { Container, Editor, matchesKey, Spacer, Text, type TUI } from "@oh-my-pi/pi-tui"; import { nanoid } from "nanoid"; -import { getEditorTheme, theme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; export class HookEditorComponent extends Container { diff --git a/packages/coding-agent/src/modes/components/hook-input.ts b/packages/coding-agent/src/modes/components/hook-input.ts index a8f88c0b0..a5d1573ca 100644 --- a/packages/coding-agent/src/modes/components/hook-input.ts +++ b/packages/coding-agent/src/modes/components/hook-input.ts @@ -2,8 +2,8 @@ * Simple text input component for hooks. */ +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { Container, Input, matchesKey, Spacer, Text, type TUI } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/theme/theme"; import { CountdownTimer } from "./countdown-timer"; import { DynamicBorder } from "./dynamic-border"; diff --git a/packages/coding-agent/src/modes/components/hook-message.ts b/packages/coding-agent/src/modes/components/hook-message.ts index 7c4f04e0c..1514cdc76 100644 --- a/packages/coding-agent/src/modes/components/hook-message.ts +++ b/packages/coding-agent/src/modes/components/hook-message.ts @@ -1,9 +1,9 @@ import type { TextContent } from "@oh-my-pi/pi-ai"; +import type { HookMessageRenderer } from "@oh-my-pi/pi-coding-agent/extensibility/hooks/types"; +import { getMarkdownTheme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { HookMessage } from "@oh-my-pi/pi-coding-agent/session/messages"; import type { Component } from "@oh-my-pi/pi-tui"; import { Box, Container, Markdown, Spacer, Text } from "@oh-my-pi/pi-tui"; -import type { HookMessageRenderer } from "$c/extensibility/hooks/types"; -import { getMarkdownTheme, theme } from "$c/modes/theme/theme"; -import type { HookMessage } from "$c/session/messages"; /** * Component that renders a custom message entry from hooks. diff --git a/packages/coding-agent/src/modes/components/hook-selector.ts b/packages/coding-agent/src/modes/components/hook-selector.ts index 483670d06..b8e7ff3ab 100644 --- a/packages/coding-agent/src/modes/components/hook-selector.ts +++ b/packages/coding-agent/src/modes/components/hook-selector.ts @@ -3,8 +3,8 @@ * Displays a list of string options with keyboard navigation. */ +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { Container, matchesKey, Spacer, Text, type TUI } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/theme/theme"; import { CountdownTimer } from "./countdown-timer"; import { DynamicBorder } from "./dynamic-border"; diff --git a/packages/coding-agent/src/modes/components/keybinding-hints.ts b/packages/coding-agent/src/modes/components/keybinding-hints.ts index fcee38c93..4aba88e89 100644 --- a/packages/coding-agent/src/modes/components/keybinding-hints.ts +++ b/packages/coding-agent/src/modes/components/keybinding-hints.ts @@ -2,9 +2,9 @@ * Utilities for formatting keybinding hints in the UI. */ +import type { AppAction, KeybindingsManager } from "@oh-my-pi/pi-coding-agent/config/keybindings"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { type EditorAction, getEditorKeybindings, type KeyId } from "@oh-my-pi/pi-tui"; -import type { AppAction, KeybindingsManager } from "$c/config/keybindings"; -import { theme } from "$c/modes/theme/theme"; /** * Format keys array as display string (e.g., ["ctrl+c", "escape"] -> "ctrl+c/escape"). diff --git a/packages/coding-agent/src/modes/components/login-dialog.ts b/packages/coding-agent/src/modes/components/login-dialog.ts index c6663acc6..dfcbaad39 100644 --- a/packages/coding-agent/src/modes/components/login-dialog.ts +++ b/packages/coding-agent/src/modes/components/login-dialog.ts @@ -1,7 +1,7 @@ import { getOAuthProviders } from "@oh-my-pi/pi-ai"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { Container, getEditorKeybindings, Input, Spacer, Text, type TUI } from "@oh-my-pi/pi-tui"; import { $ } from "bun"; -import { theme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; /** diff --git a/packages/coding-agent/src/modes/components/model-selector.ts b/packages/coding-agent/src/modes/components/model-selector.ts index 23da6d3a7..6503b272c 100644 --- a/packages/coding-agent/src/modes/components/model-selector.ts +++ b/packages/coding-agent/src/modes/components/model-selector.ts @@ -1,4 +1,9 @@ import { type Model, modelsAreEqual } from "@oh-my-pi/pi-ai"; +import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { parseModelString } from "@oh-my-pi/pi-coding-agent/config/model-resolver"; +import type { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { type ThemeColor, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import { fuzzyFilter } from "@oh-my-pi/pi-coding-agent/utils/fuzzy"; import { Container, Input, @@ -11,11 +16,6 @@ import { type TUI, visibleWidth, } from "@oh-my-pi/pi-tui"; -import type { ModelRegistry } from "$c/config/model-registry"; -import { parseModelString } from "$c/config/model-resolver"; -import type { SettingsManager } from "$c/config/settings-manager"; -import { type ThemeColor, theme } from "$c/modes/theme/theme"; -import { fuzzyFilter } from "$c/utils/fuzzy"; import { DynamicBorder } from "./dynamic-border"; function makeInvertedBadge(label: string, color: ThemeColor): string { diff --git a/packages/coding-agent/src/modes/components/oauth-selector.ts b/packages/coding-agent/src/modes/components/oauth-selector.ts index ddca37765..ac23ecf50 100644 --- a/packages/coding-agent/src/modes/components/oauth-selector.ts +++ b/packages/coding-agent/src/modes/components/oauth-selector.ts @@ -1,7 +1,7 @@ import { getOAuthProviders, type OAuthProviderInfo } from "@oh-my-pi/pi-ai"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; import { Container, matchesKey, Spacer, TruncatedText } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/theme/theme"; -import type { AuthStorage } from "$c/session/auth-storage"; import { DynamicBorder } from "./dynamic-border"; /** diff --git a/packages/coding-agent/src/modes/components/plugin-settings.ts b/packages/coding-agent/src/modes/components/plugin-settings.ts index c7880acce..e64cb264d 100644 --- a/packages/coding-agent/src/modes/components/plugin-settings.ts +++ b/packages/coding-agent/src/modes/components/plugin-settings.ts @@ -8,6 +8,9 @@ * - Config value editor */ +import { PluginManager } from "@oh-my-pi/pi-coding-agent/extensibility/plugins/manager"; +import type { InstalledPlugin, PluginSettingSchema } from "@oh-my-pi/pi-coding-agent/extensibility/plugins/types"; +import { getSelectListTheme, getSettingsListTheme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { Container, Input, @@ -18,9 +21,6 @@ import { Spacer, Text, } from "@oh-my-pi/pi-tui"; -import { PluginManager } from "$c/extensibility/plugins/manager"; -import type { InstalledPlugin, PluginSettingSchema } from "$c/extensibility/plugins/types"; -import { getSelectListTheme, getSettingsListTheme, theme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; // ============================================================================= diff --git a/packages/coding-agent/src/modes/components/python-execution.ts b/packages/coding-agent/src/modes/components/python-execution.ts index 24667200f..d7c7fac90 100644 --- a/packages/coding-agent/src/modes/components/python-execution.ts +++ b/packages/coding-agent/src/modes/components/python-execution.ts @@ -3,11 +3,11 @@ * Shares the same kernel session as the agent's Python tool. */ +import { getSymbolTheme, highlightCode, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { TruncationMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { formatSize } from "@oh-my-pi/pi-coding-agent/tools/truncate"; import { Container, Loader, Spacer, Text, type TUI } from "@oh-my-pi/pi-tui"; import stripAnsi from "strip-ansi"; -import { getSymbolTheme, highlightCode, theme } from "$c/modes/theme/theme"; -import type { TruncationMeta } from "$c/tools/output-meta"; -import { formatSize } from "$c/tools/truncate"; import { DynamicBorder } from "./dynamic-border"; import { truncateToVisualLines } from "./visual-truncate"; diff --git a/packages/coding-agent/src/modes/components/queue-mode-selector.ts b/packages/coding-agent/src/modes/components/queue-mode-selector.ts index 6e47360fd..08d31963b 100644 --- a/packages/coding-agent/src/modes/components/queue-mode-selector.ts +++ b/packages/coding-agent/src/modes/components/queue-mode-selector.ts @@ -1,5 +1,5 @@ +import { getSelectListTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { Container, type SelectItem, SelectList } from "@oh-my-pi/pi-tui"; -import { getSelectListTheme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; /** diff --git a/packages/coding-agent/src/modes/components/read-tool-group.ts b/packages/coding-agent/src/modes/components/read-tool-group.ts index 190979c58..4d96641b6 100644 --- a/packages/coding-agent/src/modes/components/read-tool-group.ts +++ b/packages/coding-agent/src/modes/components/read-tool-group.ts @@ -1,7 +1,7 @@ +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import { shortenPath } from "@oh-my-pi/pi-coding-agent/tools/render-utils"; import type { Component } from "@oh-my-pi/pi-tui"; import { Container, Text } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/theme/theme"; -import { shortenPath } from "$c/tools/render-utils"; import type { ToolExecutionHandle } from "./tool-execution"; type ReadRenderArgs = { diff --git a/packages/coding-agent/src/modes/components/session-selector.ts b/packages/coding-agent/src/modes/components/session-selector.ts index b24f67c58..87e1a7666 100644 --- a/packages/coding-agent/src/modes/components/session-selector.ts +++ b/packages/coding-agent/src/modes/components/session-selector.ts @@ -1,3 +1,6 @@ +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { SessionInfo } from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import { fuzzyFilter } from "@oh-my-pi/pi-coding-agent/utils/fuzzy"; import { type Component, Container, @@ -8,9 +11,6 @@ import { truncateToWidth, visibleWidth, } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/theme/theme"; -import type { SessionInfo } from "$c/session/session-manager"; -import { fuzzyFilter } from "$c/utils/fuzzy"; import { DynamicBorder } from "./dynamic-border"; /** diff --git a/packages/coding-agent/src/modes/components/settings-defs.ts b/packages/coding-agent/src/modes/components/settings-defs.ts index 2f3bea185..238a78fdf 100644 --- a/packages/coding-agent/src/modes/components/settings-defs.ts +++ b/packages/coding-agent/src/modes/components/settings-defs.ts @@ -9,7 +9,6 @@ */ import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core"; -import { getCapabilities } from "@oh-my-pi/pi-tui"; import type { ImageProviderOption, NotificationMethod, @@ -20,7 +19,8 @@ import type { StatusLineSeparatorStyle, SymbolPreset, WebSearchProviderOption, -} from "$c/config/settings-manager"; +} from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { getCapabilities } from "@oh-my-pi/pi-tui"; import { getPreset } from "./status-line/presets"; // Setting value types diff --git a/packages/coding-agent/src/modes/components/settings-selector.ts b/packages/coding-agent/src/modes/components/settings-selector.ts index 698bd5b6b..68f98f805 100644 --- a/packages/coding-agent/src/modes/components/settings-selector.ts +++ b/packages/coding-agent/src/modes/components/settings-selector.ts @@ -1,4 +1,6 @@ import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core"; +import type { SettingsManager, StatusLineSettings } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { getSelectListTheme, getSettingsListTheme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { Container, matchesKey, @@ -12,8 +14,6 @@ import { type TabBarTheme, Text, } from "@oh-my-pi/pi-tui"; -import type { SettingsManager, StatusLineSettings } from "$c/config/settings-manager"; -import { getSelectListTheme, getSettingsListTheme, theme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; import { PluginSettingsComponent } from "./plugin-settings"; import { getSettingsForTab, type SettingDef } from "./settings-defs"; diff --git a/packages/coding-agent/src/modes/components/show-images-selector.ts b/packages/coding-agent/src/modes/components/show-images-selector.ts index 543621446..8356918b1 100644 --- a/packages/coding-agent/src/modes/components/show-images-selector.ts +++ b/packages/coding-agent/src/modes/components/show-images-selector.ts @@ -1,5 +1,5 @@ +import { getSelectListTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { Container, type SelectItem, SelectList } from "@oh-my-pi/pi-tui"; -import { getSelectListTheme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; /** diff --git a/packages/coding-agent/src/modes/components/status-line-segment-editor.ts b/packages/coding-agent/src/modes/components/status-line-segment-editor.ts index 49e6fe151..55d91ef4d 100644 --- a/packages/coding-agent/src/modes/components/status-line-segment-editor.ts +++ b/packages/coding-agent/src/modes/components/status-line-segment-editor.ts @@ -9,9 +9,9 @@ * - Live preview shown in the actual status line above */ +import type { StatusLineSegmentId } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { Container, matchesKey } from "@oh-my-pi/pi-tui"; -import type { StatusLineSegmentId } from "$c/config/settings-manager"; -import { theme } from "$c/modes/theme/theme"; import { ALL_SEGMENT_IDS } from "./status-line/segments"; // Segment display names and short descriptions diff --git a/packages/coding-agent/src/modes/components/status-line.ts b/packages/coding-agent/src/modes/components/status-line.ts index eaee2a9ad..21eebda72 100644 --- a/packages/coding-agent/src/modes/components/status-line.ts +++ b/packages/coding-agent/src/modes/components/status-line.ts @@ -1,11 +1,11 @@ import type { AssistantMessage } from "@oh-my-pi/pi-ai"; +import type { StatusLineSegmentOptions, StatusLineSettings } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; import { type Component, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui"; import { $ } from "bun"; import { type FSWatcher, watch } from "fs"; import { dirname, join } from "path"; -import type { StatusLineSegmentOptions, StatusLineSettings } from "$c/config/settings-manager"; -import { theme } from "$c/modes/theme/theme"; -import type { AgentSession } from "$c/session/agent-session"; import { getPreset } from "./status-line/presets"; import { renderSegment, type SegmentContext } from "./status-line/segments"; import { getSeparator } from "./status-line/separators"; diff --git a/packages/coding-agent/src/modes/components/status-line/segments.ts b/packages/coding-agent/src/modes/components/status-line/segments.ts index 4688b6315..36c1b7b0e 100644 --- a/packages/coding-agent/src/modes/components/status-line/segments.ts +++ b/packages/coding-agent/src/modes/components/status-line/segments.ts @@ -1,6 +1,6 @@ import { hostname as osHostname } from "node:os"; -import { theme } from "$c/modes/theme/theme"; -import { shortenPath } from "$c/tools/render-utils"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import { shortenPath } from "@oh-my-pi/pi-coding-agent/tools/render-utils"; import type { RenderedSegment, SegmentContext, StatusLineSegment, StatusLineSegmentId } from "./types"; export type { SegmentContext } from "./types"; diff --git a/packages/coding-agent/src/modes/components/status-line/separators.ts b/packages/coding-agent/src/modes/components/status-line/separators.ts index c1a68e026..c227db015 100644 --- a/packages/coding-agent/src/modes/components/status-line/separators.ts +++ b/packages/coding-agent/src/modes/components/status-line/separators.ts @@ -1,4 +1,4 @@ -import type { Theme } from "$c/modes/theme/theme"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import type { SeparatorDef, StatusLineSeparatorStyle } from "./types"; function trimSep(value: string): string { diff --git a/packages/coding-agent/src/modes/components/status-line/types.ts b/packages/coding-agent/src/modes/components/status-line/types.ts index 9c0a72e39..ca8e9ba5a 100644 --- a/packages/coding-agent/src/modes/components/status-line/types.ts +++ b/packages/coding-agent/src/modes/components/status-line/types.ts @@ -4,8 +4,8 @@ import type { StatusLineSegmentOptions, StatusLineSeparatorStyle, StatusLineSettings, -} from "$c/config/settings-manager"; -import type { AgentSession } from "$c/session/agent-session"; +} from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import type { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; // Re-export types from settings-manager (single source of truth) export type { diff --git a/packages/coding-agent/src/modes/components/theme-selector.ts b/packages/coding-agent/src/modes/components/theme-selector.ts index 24f2e78dc..9bb9b9337 100644 --- a/packages/coding-agent/src/modes/components/theme-selector.ts +++ b/packages/coding-agent/src/modes/components/theme-selector.ts @@ -1,5 +1,5 @@ +import { getAvailableThemes, getSelectListTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { Container, type SelectItem, SelectList } from "@oh-my-pi/pi-tui"; -import { getAvailableThemes, getSelectListTheme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; /** diff --git a/packages/coding-agent/src/modes/components/thinking-selector.ts b/packages/coding-agent/src/modes/components/thinking-selector.ts index 4348aacf4..233b5b9bc 100644 --- a/packages/coding-agent/src/modes/components/thinking-selector.ts +++ b/packages/coding-agent/src/modes/components/thinking-selector.ts @@ -1,6 +1,6 @@ import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core"; +import { getSelectListTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { Container, type SelectItem, SelectList } from "@oh-my-pi/pi-tui"; -import { getSelectListTheme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; const LEVEL_DESCRIPTIONS: Record = { diff --git a/packages/coding-agent/src/modes/components/todo-display.ts b/packages/coding-agent/src/modes/components/todo-display.ts index 54fbd5947..a3db53ba1 100644 --- a/packages/coding-agent/src/modes/components/todo-display.ts +++ b/packages/coding-agent/src/modes/components/todo-display.ts @@ -1,8 +1,8 @@ import * as path from "node:path"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { TodoItem } from "@oh-my-pi/pi-coding-agent/modes/types"; import { Text } from "@oh-my-pi/pi-tui"; import { logger } from "@oh-my-pi/pi-utils"; -import { theme } from "$c/modes/theme/theme"; -import type { TodoItem } from "$c/modes/types"; const TODO_FILE_NAME = "todos.json"; diff --git a/packages/coding-agent/src/modes/components/todo-reminder.ts b/packages/coding-agent/src/modes/components/todo-reminder.ts index 7a79a8b5c..384350963 100644 --- a/packages/coding-agent/src/modes/components/todo-reminder.ts +++ b/packages/coding-agent/src/modes/components/todo-reminder.ts @@ -1,6 +1,6 @@ +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { TodoItem } from "@oh-my-pi/pi-coding-agent/tools/todo-write"; import { Box, Container, Spacer, Text } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/theme/theme"; -import type { TodoItem } from "$c/tools/todo-write"; /** * Component that renders a todo completion reminder notification. diff --git a/packages/coding-agent/src/modes/components/tool-execution.ts b/packages/coding-agent/src/modes/components/tool-execution.ts index 8e391ba82..29cd060fe 100644 --- a/packages/coding-agent/src/modes/components/tool-execution.ts +++ b/packages/coding-agent/src/modes/components/tool-execution.ts @@ -1,4 +1,15 @@ import type { AgentTool } from "@oh-my-pi/pi-agent-core"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import { + computeEditDiff, + computePatchDiff, + type EditDiffError, + type EditDiffResult, +} from "@oh-my-pi/pi-coding-agent/patch"; +import { BASH_DEFAULT_PREVIEW_LINES } from "@oh-my-pi/pi-coding-agent/tools/bash"; +import { PYTHON_DEFAULT_PREVIEW_LINES } from "@oh-my-pi/pi-coding-agent/tools/python"; +import { toolRenderers } from "@oh-my-pi/pi-coding-agent/tools/renderers"; +import { convertToPng } from "@oh-my-pi/pi-coding-agent/utils/image-convert"; import { Box, Container, @@ -11,12 +22,6 @@ import { type TUI, } from "@oh-my-pi/pi-tui"; import { sanitizeText } from "@oh-my-pi/pi-utils"; -import { theme } from "$c/modes/theme/theme"; -import { computeEditDiff, computePatchDiff, type EditDiffError, type EditDiffResult } from "$c/patch"; -import { BASH_DEFAULT_PREVIEW_LINES } from "$c/tools/bash"; -import { PYTHON_DEFAULT_PREVIEW_LINES } from "$c/tools/python"; -import { toolRenderers } from "$c/tools/renderers"; -import { convertToPng } from "$c/utils/image-convert"; import { renderDiff } from "./diff"; // Preview line limit for bash when not expanded diff --git a/packages/coding-agent/src/modes/components/tree-selector.ts b/packages/coding-agent/src/modes/components/tree-selector.ts index 8e6a2dc07..444a5c9ee 100644 --- a/packages/coding-agent/src/modes/components/tree-selector.ts +++ b/packages/coding-agent/src/modes/components/tree-selector.ts @@ -1,3 +1,6 @@ +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { SessionTreeNode } from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import { shortenPath } from "@oh-my-pi/pi-coding-agent/tools/render-utils"; import { type Component, Container, @@ -8,9 +11,6 @@ import { TruncatedText, truncateToWidth, } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/theme/theme"; -import type { SessionTreeNode } from "$c/session/session-manager"; -import { shortenPath } from "$c/tools/render-utils"; import { DynamicBorder } from "./dynamic-border"; /** Gutter info: position (displayIndent where connector was) and whether to show │ */ diff --git a/packages/coding-agent/src/modes/components/ttsr-notification.ts b/packages/coding-agent/src/modes/components/ttsr-notification.ts index 78416628b..20257cb8f 100644 --- a/packages/coding-agent/src/modes/components/ttsr-notification.ts +++ b/packages/coding-agent/src/modes/components/ttsr-notification.ts @@ -1,6 +1,6 @@ +import type { Rule } from "@oh-my-pi/pi-coding-agent/capability/rule"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { Box, Container, Spacer, Text } from "@oh-my-pi/pi-tui"; -import type { Rule } from "$c/capability/rule"; -import { theme } from "$c/modes/theme/theme"; /** * Component that renders a TTSR (Time Traveling Stream Rules) notification. diff --git a/packages/coding-agent/src/modes/components/user-message-selector.ts b/packages/coding-agent/src/modes/components/user-message-selector.ts index 68f2f1914..77c93c23d 100644 --- a/packages/coding-agent/src/modes/components/user-message-selector.ts +++ b/packages/coding-agent/src/modes/components/user-message-selector.ts @@ -1,5 +1,5 @@ +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { type Component, Container, matchesKey, Spacer, Text, truncateToWidth } from "@oh-my-pi/pi-tui"; -import { theme } from "$c/modes/theme/theme"; import { DynamicBorder } from "./dynamic-border"; interface UserMessageItem { diff --git a/packages/coding-agent/src/modes/components/user-message.ts b/packages/coding-agent/src/modes/components/user-message.ts index 3bc5f40df..3e44a7bc9 100644 --- a/packages/coding-agent/src/modes/components/user-message.ts +++ b/packages/coding-agent/src/modes/components/user-message.ts @@ -1,5 +1,5 @@ +import { getMarkdownTheme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { Container, Markdown, Spacer } from "@oh-my-pi/pi-tui"; -import { getMarkdownTheme, theme } from "$c/modes/theme/theme"; /** * Component that renders a user message diff --git a/packages/coding-agent/src/modes/components/welcome.ts b/packages/coding-agent/src/modes/components/welcome.ts index 55ea7805c..08638606e 100644 --- a/packages/coding-agent/src/modes/components/welcome.ts +++ b/packages/coding-agent/src/modes/components/welcome.ts @@ -1,6 +1,6 @@ +import { APP_NAME } from "@oh-my-pi/pi-coding-agent/config"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { type Component, truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui"; -import { APP_NAME } from "$c/config"; -import { theme } from "$c/modes/theme/theme"; export interface RecentSession { name: string; diff --git a/packages/coding-agent/src/modes/controllers/command-controller.ts b/packages/coding-agent/src/modes/controllers/command-controller.ts index 22fcd337e..f7355fbcc 100644 --- a/packages/coding-agent/src/modes/controllers/command-controller.ts +++ b/packages/coding-agent/src/modes/controllers/command-controller.ts @@ -2,24 +2,24 @@ import { mkdir, rm } from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; import type { UsageLimit, UsageReport } from "@oh-my-pi/pi-ai"; +import { getDebugLogPath } from "@oh-my-pi/pi-coding-agent/config"; +import { loadCustomShare } from "@oh-my-pi/pi-coding-agent/export/custom-share"; +import type { CompactOptions } from "@oh-my-pi/pi-coding-agent/extensibility/extensions/types"; +import { getGatewayStatus } from "@oh-my-pi/pi-coding-agent/ipy/gateway-coordinator"; +import { ArminComponent } from "@oh-my-pi/pi-coding-agent/modes/components/armin"; +import { BashExecutionComponent } from "@oh-my-pi/pi-coding-agent/modes/components/bash-execution"; +import { BorderedLoader } from "@oh-my-pi/pi-coding-agent/modes/components/bordered-loader"; +import { DynamicBorder } from "@oh-my-pi/pi-coding-agent/modes/components/dynamic-border"; +import { PythonExecutionComponent } from "@oh-my-pi/pi-coding-agent/modes/components/python-execution"; +import { getMarkdownTheme, getSymbolTheme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { InteractiveModeContext } from "@oh-my-pi/pi-coding-agent/modes/types"; +import { createCompactionSummaryMessage } from "@oh-my-pi/pi-coding-agent/session/messages"; +import { outputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { getChangelogPath, parseChangelog } from "@oh-my-pi/pi-coding-agent/utils/changelog"; +import { copyToClipboard } from "@oh-my-pi/pi-coding-agent/utils/clipboard"; import { Loader, Markdown, Spacer, Text, visibleWidth } from "@oh-my-pi/pi-tui"; import { $ } from "bun"; import { nanoid } from "nanoid"; -import { getDebugLogPath } from "$c/config"; -import { loadCustomShare } from "$c/export/custom-share"; -import type { CompactOptions } from "$c/extensibility/extensions/types"; -import { getGatewayStatus } from "$c/ipy/gateway-coordinator"; -import { ArminComponent } from "$c/modes/components/armin"; -import { BashExecutionComponent } from "$c/modes/components/bash-execution"; -import { BorderedLoader } from "$c/modes/components/bordered-loader"; -import { DynamicBorder } from "$c/modes/components/dynamic-border"; -import { PythonExecutionComponent } from "$c/modes/components/python-execution"; -import { getMarkdownTheme, getSymbolTheme, theme } from "$c/modes/theme/theme"; -import type { InteractiveModeContext } from "$c/modes/types"; -import { createCompactionSummaryMessage } from "$c/session/messages"; -import { outputMeta } from "$c/tools/output-meta"; -import { getChangelogPath, parseChangelog } from "$c/utils/changelog"; -import { copyToClipboard } from "$c/utils/clipboard"; export class CommandController { constructor(private readonly ctx: InteractiveModeContext) {} diff --git a/packages/coding-agent/src/modes/controllers/event-controller.ts b/packages/coding-agent/src/modes/controllers/event-controller.ts index d0e5819bb..af440c9fe 100644 --- a/packages/coding-agent/src/modes/controllers/event-controller.ts +++ b/packages/coding-agent/src/modes/controllers/event-controller.ts @@ -1,13 +1,17 @@ +import { AssistantMessageComponent } from "@oh-my-pi/pi-coding-agent/modes/components/assistant-message"; +import { ReadToolGroupComponent } from "@oh-my-pi/pi-coding-agent/modes/components/read-tool-group"; +import { TodoReminderComponent } from "@oh-my-pi/pi-coding-agent/modes/components/todo-reminder"; +import { ToolExecutionComponent } from "@oh-my-pi/pi-coding-agent/modes/components/tool-execution"; +import { TtsrNotificationComponent } from "@oh-my-pi/pi-coding-agent/modes/components/ttsr-notification"; +import { getSymbolTheme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { InteractiveModeContext, TodoItem } from "@oh-my-pi/pi-coding-agent/modes/types"; +import type { AgentSessionEvent } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { + detectNotificationProtocol, + isNotificationSuppressed, + sendNotification, +} from "@oh-my-pi/pi-coding-agent/utils/terminal-notify"; import { Loader, Text } from "@oh-my-pi/pi-tui"; -import { AssistantMessageComponent } from "$c/modes/components/assistant-message"; -import { ReadToolGroupComponent } from "$c/modes/components/read-tool-group"; -import { TodoReminderComponent } from "$c/modes/components/todo-reminder"; -import { ToolExecutionComponent } from "$c/modes/components/tool-execution"; -import { TtsrNotificationComponent } from "$c/modes/components/ttsr-notification"; -import { getSymbolTheme, theme } from "$c/modes/theme/theme"; -import type { InteractiveModeContext, TodoItem } from "$c/modes/types"; -import type { AgentSessionEvent } from "$c/session/agent-session"; -import { detectNotificationProtocol, isNotificationSuppressed, sendNotification } from "$c/utils/terminal-notify"; export class EventController { private lastReadGroup: ReadToolGroupComponent | undefined = undefined; diff --git a/packages/coding-agent/src/modes/controllers/extension-ui-controller.ts b/packages/coding-agent/src/modes/controllers/extension-ui-controller.ts index 2f58276e9..f8cfc3973 100644 --- a/packages/coding-agent/src/modes/controllers/extension-ui-controller.ts +++ b/packages/coding-agent/src/modes/controllers/extension-ui-controller.ts @@ -1,20 +1,26 @@ -import type { Component, TUI } from "@oh-my-pi/pi-tui"; -import { Spacer, Text } from "@oh-my-pi/pi-tui"; -import { logger } from "@oh-my-pi/pi-utils"; -import { KeybindingsManager } from "$c/config/keybindings"; +import { KeybindingsManager } from "@oh-my-pi/pi-coding-agent/config/keybindings"; import type { ExtensionActions, ExtensionCommandContextActions, ExtensionContextActions, ExtensionError, ExtensionUIContext, -} from "$c/extensibility/extensions/index"; -import { HookEditorComponent } from "$c/modes/components/hook-editor"; -import { HookInputComponent } from "$c/modes/components/hook-input"; -import { HookSelectorComponent } from "$c/modes/components/hook-selector"; -import { getAvailableThemesWithPaths, getThemeByName, setTheme, type Theme, theme } from "$c/modes/theme/theme"; -import type { InteractiveModeContext } from "$c/modes/types"; -import { setTerminalTitle } from "$c/utils/title-generator"; +} from "@oh-my-pi/pi-coding-agent/extensibility/extensions/index"; +import { HookEditorComponent } from "@oh-my-pi/pi-coding-agent/modes/components/hook-editor"; +import { HookInputComponent } from "@oh-my-pi/pi-coding-agent/modes/components/hook-input"; +import { HookSelectorComponent } from "@oh-my-pi/pi-coding-agent/modes/components/hook-selector"; +import { + getAvailableThemesWithPaths, + getThemeByName, + setTheme, + type Theme, + theme, +} from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { InteractiveModeContext } from "@oh-my-pi/pi-coding-agent/modes/types"; +import { setTerminalTitle } from "@oh-my-pi/pi-coding-agent/utils/title-generator"; +import type { Component, TUI } from "@oh-my-pi/pi-tui"; +import { Spacer, Text } from "@oh-my-pi/pi-tui"; +import { logger } from "@oh-my-pi/pi-utils"; export class ExtensionUiController { constructor(private ctx: InteractiveModeContext) {} diff --git a/packages/coding-agent/src/modes/controllers/input-controller.ts b/packages/coding-agent/src/modes/controllers/input-controller.ts index d8dba39e6..8d0b01a74 100644 --- a/packages/coding-agent/src/modes/controllers/input-controller.ts +++ b/packages/coding-agent/src/modes/controllers/input-controller.ts @@ -4,13 +4,13 @@ import { open, rm } from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { InteractiveModeContext } from "@oh-my-pi/pi-coding-agent/modes/types"; +import type { AgentSessionEvent } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { readImageFromClipboard } from "@oh-my-pi/pi-coding-agent/utils/clipboard"; +import { resizeImage } from "@oh-my-pi/pi-coding-agent/utils/image-resize"; +import { generateSessionTitle, setTerminalTitle } from "@oh-my-pi/pi-coding-agent/utils/title-generator"; import { nanoid } from "nanoid"; -import { theme } from "$c/modes/theme/theme"; -import type { InteractiveModeContext } from "$c/modes/types"; -import type { AgentSessionEvent } from "$c/session/agent-session"; -import { readImageFromClipboard } from "$c/utils/clipboard"; -import { resizeImage } from "$c/utils/image-resize"; -import { generateSessionTitle, setTerminalTitle } from "$c/utils/title-generator"; interface Expandable { setExpanded(expanded: boolean): void; diff --git a/packages/coding-agent/src/modes/controllers/selector-controller.ts b/packages/coding-agent/src/modes/controllers/selector-controller.ts index dd38aac14..a6e025db4 100644 --- a/packages/coding-agent/src/modes/controllers/selector-controller.ts +++ b/packages/coding-agent/src/modes/controllers/selector-controller.ts @@ -1,23 +1,29 @@ import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import type { OAuthProvider } from "@oh-my-pi/pi-ai"; +import { getAgentDbPath } from "@oh-my-pi/pi-coding-agent/config"; +import { disableProvider, enableProvider } from "@oh-my-pi/pi-coding-agent/discovery"; +import { AssistantMessageComponent } from "@oh-my-pi/pi-coding-agent/modes/components/assistant-message"; +import { ExtensionDashboard } from "@oh-my-pi/pi-coding-agent/modes/components/extensions"; +import { HistorySearchComponent } from "@oh-my-pi/pi-coding-agent/modes/components/history-search"; +import { ModelSelectorComponent } from "@oh-my-pi/pi-coding-agent/modes/components/model-selector"; +import { OAuthSelectorComponent } from "@oh-my-pi/pi-coding-agent/modes/components/oauth-selector"; +import { SessionSelectorComponent } from "@oh-my-pi/pi-coding-agent/modes/components/session-selector"; +import { SettingsSelectorComponent } from "@oh-my-pi/pi-coding-agent/modes/components/settings-selector"; +import { ToolExecutionComponent } from "@oh-my-pi/pi-coding-agent/modes/components/tool-execution"; +import { TreeSelectorComponent } from "@oh-my-pi/pi-coding-agent/modes/components/tree-selector"; +import { UserMessageSelectorComponent } from "@oh-my-pi/pi-coding-agent/modes/components/user-message-selector"; +import { + getAvailableThemes, + getSymbolTheme, + setSymbolPreset, + setTheme, + theme, +} from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { InteractiveModeContext } from "@oh-my-pi/pi-coding-agent/modes/types"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import { setPreferredImageProvider, setPreferredWebSearchProvider } from "@oh-my-pi/pi-coding-agent/tools/index"; import type { Component } from "@oh-my-pi/pi-tui"; import { Input, Loader, Spacer, Text } from "@oh-my-pi/pi-tui"; -import { getAgentDbPath } from "$c/config"; -import { disableProvider, enableProvider } from "$c/discovery"; -import { AssistantMessageComponent } from "$c/modes/components/assistant-message"; -import { ExtensionDashboard } from "$c/modes/components/extensions"; -import { HistorySearchComponent } from "$c/modes/components/history-search"; -import { ModelSelectorComponent } from "$c/modes/components/model-selector"; -import { OAuthSelectorComponent } from "$c/modes/components/oauth-selector"; -import { SessionSelectorComponent } from "$c/modes/components/session-selector"; -import { SettingsSelectorComponent } from "$c/modes/components/settings-selector"; -import { ToolExecutionComponent } from "$c/modes/components/tool-execution"; -import { TreeSelectorComponent } from "$c/modes/components/tree-selector"; -import { UserMessageSelectorComponent } from "$c/modes/components/user-message-selector"; -import { getAvailableThemes, getSymbolTheme, setSymbolPreset, setTheme, theme } from "$c/modes/theme/theme"; -import type { InteractiveModeContext } from "$c/modes/types"; -import { SessionManager } from "$c/session/session-manager"; -import { setPreferredImageProvider, setPreferredWebSearchProvider } from "$c/tools/index"; export class SelectorController { constructor(private ctx: InteractiveModeContext) {} diff --git a/packages/coding-agent/src/modes/interactive-mode.ts b/packages/coding-agent/src/modes/interactive-mode.ts index d7e0c168f..1b55d0896 100644 --- a/packages/coding-agent/src/modes/interactive-mode.ts +++ b/packages/coding-agent/src/modes/interactive-mode.ts @@ -6,6 +6,16 @@ import * as path from "node:path"; import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { AssistantMessage, ImageContent, Message, UsageReport } from "@oh-my-pi/pi-ai"; +import { KeybindingsManager } from "@oh-my-pi/pi-coding-agent/config/keybindings"; +import type { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import type { ExtensionUIContext } from "@oh-my-pi/pi-coding-agent/extensibility/extensions/index"; +import type { CompactOptions } from "@oh-my-pi/pi-coding-agent/extensibility/extensions/types"; +import { loadSlashCommands } from "@oh-my-pi/pi-coding-agent/extensibility/slash-commands"; +import type { AgentSession, AgentSessionEvent } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { HistoryStorage } from "@oh-my-pi/pi-coding-agent/session/history-storage"; +import type { SessionContext, SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import { getRecentSessions } from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import { setTerminalTitle } from "@oh-my-pi/pi-coding-agent/utils/title-generator"; import type { Component, Loader, SlashCommand } from "@oh-my-pi/pi-tui"; import { CombinedAutocompleteProvider, @@ -18,16 +28,6 @@ import { } from "@oh-my-pi/pi-tui"; import { logger, postmortem } from "@oh-my-pi/pi-utils"; import chalk from "chalk"; -import { KeybindingsManager } from "$c/config/keybindings"; -import type { SettingsManager } from "$c/config/settings-manager"; -import type { ExtensionUIContext } from "$c/extensibility/extensions/index"; -import type { CompactOptions } from "$c/extensibility/extensions/types"; -import { loadSlashCommands } from "$c/extensibility/slash-commands"; -import type { AgentSession, AgentSessionEvent } from "$c/session/agent-session"; -import { HistoryStorage } from "$c/session/history-storage"; -import type { SessionContext, SessionManager } from "$c/session/session-manager"; -import { getRecentSessions } from "$c/session/session-manager"; -import { setTerminalTitle } from "$c/utils/title-generator"; import type { AssistantMessageComponent } from "./components/assistant-message"; import type { BashExecutionComponent } from "./components/bash-execution"; import { CustomEditor } from "./components/custom-editor"; @@ -125,7 +125,7 @@ export class InteractiveMode implements InteractiveModeContext { private readonly changelogMarkdown: string | undefined; public readonly lspServers: Array<{ name: string; status: "ready" | "error"; fileTypes: string[] }> | undefined = undefined; - public mcpManager?: import("$c/mcp/index").MCPManager; + public mcpManager?: import("@oh-my-pi/pi-coding-agent/mcp/index").MCPManager; private readonly toolUiContextSetter: (uiContext: ExtensionUIContext, hasUI: boolean) => void; private readonly commandController: CommandController; @@ -141,7 +141,7 @@ export class InteractiveMode implements InteractiveModeContext { changelogMarkdown: string | undefined = undefined, setToolUIContext: (uiContext: ExtensionUIContext, hasUI: boolean) => void = () => {}, lspServers: Array<{ name: string; status: "ready" | "error"; fileTypes: string[] }> | undefined = undefined, - mcpManager?: import("$c/mcp/index").MCPManager, + mcpManager?: import("@oh-my-pi/pi-coding-agent/mcp/index").MCPManager, ) { this.session = session; this.sessionManager = session.sessionManager; diff --git a/packages/coding-agent/src/modes/print-mode.ts b/packages/coding-agent/src/modes/print-mode.ts index e1561d2be..40509a6df 100644 --- a/packages/coding-agent/src/modes/print-mode.ts +++ b/packages/coding-agent/src/modes/print-mode.ts @@ -7,7 +7,7 @@ */ import type { AssistantMessage, ImageContent } from "@oh-my-pi/pi-ai"; -import type { AgentSession } from "$c/session/agent-session"; +import type { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; /** * Options for print mode. diff --git a/packages/coding-agent/src/modes/rpc/rpc-client.ts b/packages/coding-agent/src/modes/rpc/rpc-client.ts index 0a9d8e289..e118f55cb 100644 --- a/packages/coding-agent/src/modes/rpc/rpc-client.ts +++ b/packages/coding-agent/src/modes/rpc/rpc-client.ts @@ -6,10 +6,10 @@ import type { AgentEvent, AgentMessage, ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import type { ImageContent } from "@oh-my-pi/pi-ai"; +import type { BashResult } from "@oh-my-pi/pi-coding-agent/exec/bash-executor"; +import type { SessionStats } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import type { CompactionResult } from "@oh-my-pi/pi-coding-agent/session/compaction/index"; import { createSanitizerStream, createSplitterStream, createTextDecoderStream, ptree } from "@oh-my-pi/pi-utils"; -import type { BashResult } from "$c/exec/bash-executor"; -import type { SessionStats } from "$c/session/agent-session"; -import type { CompactionResult } from "$c/session/compaction/index"; import type { RpcCommand, RpcResponse, RpcSessionState } from "./rpc-types"; /** Distributive Omit that works with union types */ diff --git a/packages/coding-agent/src/modes/rpc/rpc-mode.ts b/packages/coding-agent/src/modes/rpc/rpc-mode.ts index bfa6cdaab..fc921f010 100644 --- a/packages/coding-agent/src/modes/rpc/rpc-mode.ts +++ b/packages/coding-agent/src/modes/rpc/rpc-mode.ts @@ -11,11 +11,14 @@ * - Extension UI: Extension UI requests are emitted, client responds with extension_ui_response */ +import type { + ExtensionUIContext, + ExtensionUIDialogOptions, +} from "@oh-my-pi/pi-coding-agent/extensibility/extensions/index"; +import { type Theme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; import { readLines } from "@oh-my-pi/pi-utils"; import { nanoid } from "nanoid"; -import type { ExtensionUIContext, ExtensionUIDialogOptions } from "$c/extensibility/extensions/index"; -import { type Theme, theme } from "$c/modes/theme/theme"; -import type { AgentSession } from "$c/session/agent-session"; import type { RpcCommand, RpcExtensionUIRequest, diff --git a/packages/coding-agent/src/modes/rpc/rpc-types.ts b/packages/coding-agent/src/modes/rpc/rpc-types.ts index ee37f46da..7a84df275 100644 --- a/packages/coding-agent/src/modes/rpc/rpc-types.ts +++ b/packages/coding-agent/src/modes/rpc/rpc-types.ts @@ -7,9 +7,9 @@ import type { AgentMessage, ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, Model } from "@oh-my-pi/pi-ai"; -import type { BashResult } from "$c/exec/bash-executor"; -import type { SessionStats } from "$c/session/agent-session"; -import type { CompactionResult } from "$c/session/compaction/index"; +import type { BashResult } from "@oh-my-pi/pi-coding-agent/exec/bash-executor"; +import type { SessionStats } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import type { CompactionResult } from "@oh-my-pi/pi-coding-agent/session/compaction/index"; // ============================================================================ // RPC Commands (stdin) diff --git a/packages/coding-agent/src/modes/theme/theme.ts b/packages/coding-agent/src/modes/theme/theme.ts index c908dd432..882d56ea9 100644 --- a/packages/coding-agent/src/modes/theme/theme.ts +++ b/packages/coding-agent/src/modes/theme/theme.ts @@ -1,12 +1,12 @@ import * as fs from "node:fs"; import * as path from "node:path"; +import { getCustomThemesDir } from "@oh-my-pi/pi-coding-agent/config"; import type { EditorTheme, MarkdownTheme, SelectListTheme, SymbolTheme } from "@oh-my-pi/pi-tui"; import { logger } from "@oh-my-pi/pi-utils"; import { type Static, Type } from "@sinclair/typebox"; import { TypeCompiler } from "@sinclair/typebox/compiler"; import chalk from "chalk"; import { highlight, supportsLanguage } from "cli-highlight"; -import { getCustomThemesDir } from "$c/config"; // Embed theme JSON files at build time import darkThemeJson from "./dark.json" with { type: "json" }; import { defaultThemes } from "./defaults"; diff --git a/packages/coding-agent/src/modes/types.ts b/packages/coding-agent/src/modes/types.ts index b717c5697..a6e2c4856 100644 --- a/packages/coding-agent/src/modes/types.ts +++ b/packages/coding-agent/src/modes/types.ts @@ -1,14 +1,14 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { AssistantMessage, ImageContent, Message, UsageReport } from "@oh-my-pi/pi-ai"; +import type { KeybindingsManager } from "@oh-my-pi/pi-coding-agent/config/keybindings"; +import type { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import type { ExtensionUIContext } from "@oh-my-pi/pi-coding-agent/extensibility/extensions/index"; +import type { CompactOptions } from "@oh-my-pi/pi-coding-agent/extensibility/extensions/types"; +import type { MCPManager } from "@oh-my-pi/pi-coding-agent/mcp/index"; +import type { AgentSession, AgentSessionEvent } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import type { HistoryStorage } from "@oh-my-pi/pi-coding-agent/session/history-storage"; +import type { SessionContext, SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import type { Component, Container, Loader, Spacer, Text, TUI } from "@oh-my-pi/pi-tui"; -import type { KeybindingsManager } from "$c/config/keybindings"; -import type { SettingsManager } from "$c/config/settings-manager"; -import type { ExtensionUIContext } from "$c/extensibility/extensions/index"; -import type { CompactOptions } from "$c/extensibility/extensions/types"; -import type { MCPManager } from "$c/mcp/index"; -import type { AgentSession, AgentSessionEvent } from "$c/session/agent-session"; -import type { HistoryStorage } from "$c/session/history-storage"; -import type { SessionContext, SessionManager } from "$c/session/session-manager"; import type { AssistantMessageComponent } from "./components/assistant-message"; import type { BashExecutionComponent } from "./components/bash-execution"; import type { CustomEditor } from "./components/custom-editor"; diff --git a/packages/coding-agent/src/modes/utils/ui-helpers.ts b/packages/coding-agent/src/modes/utils/ui-helpers.ts index 27fbb17a6..0eab7710e 100644 --- a/packages/coding-agent/src/modes/utils/ui-helpers.ts +++ b/packages/coding-agent/src/modes/utils/ui-helpers.ts @@ -1,20 +1,20 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { AssistantMessage, Message } from "@oh-my-pi/pi-ai"; +import { AssistantMessageComponent } from "@oh-my-pi/pi-coding-agent/modes/components/assistant-message"; +import { BashExecutionComponent } from "@oh-my-pi/pi-coding-agent/modes/components/bash-execution"; +import { BranchSummaryMessageComponent } from "@oh-my-pi/pi-coding-agent/modes/components/branch-summary-message"; +import { CompactionSummaryMessageComponent } from "@oh-my-pi/pi-coding-agent/modes/components/compaction-summary-message"; +import { CustomMessageComponent } from "@oh-my-pi/pi-coding-agent/modes/components/custom-message"; +import { DynamicBorder } from "@oh-my-pi/pi-coding-agent/modes/components/dynamic-border"; +import { PythonExecutionComponent } from "@oh-my-pi/pi-coding-agent/modes/components/python-execution"; +import { ReadToolGroupComponent } from "@oh-my-pi/pi-coding-agent/modes/components/read-tool-group"; +import { ToolExecutionComponent } from "@oh-my-pi/pi-coding-agent/modes/components/tool-execution"; +import { UserMessageComponent } from "@oh-my-pi/pi-coding-agent/modes/components/user-message"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { CompactionQueuedMessage, InteractiveModeContext } from "@oh-my-pi/pi-coding-agent/modes/types"; +import type { CustomMessage } from "@oh-my-pi/pi-coding-agent/session/messages"; +import type { SessionContext } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { Spacer, Text, TruncatedText } from "@oh-my-pi/pi-tui"; -import { AssistantMessageComponent } from "$c/modes/components/assistant-message"; -import { BashExecutionComponent } from "$c/modes/components/bash-execution"; -import { BranchSummaryMessageComponent } from "$c/modes/components/branch-summary-message"; -import { CompactionSummaryMessageComponent } from "$c/modes/components/compaction-summary-message"; -import { CustomMessageComponent } from "$c/modes/components/custom-message"; -import { DynamicBorder } from "$c/modes/components/dynamic-border"; -import { PythonExecutionComponent } from "$c/modes/components/python-execution"; -import { ReadToolGroupComponent } from "$c/modes/components/read-tool-group"; -import { ToolExecutionComponent } from "$c/modes/components/tool-execution"; -import { UserMessageComponent } from "$c/modes/components/user-message"; -import { theme } from "$c/modes/theme/theme"; -import type { CompactionQueuedMessage, InteractiveModeContext } from "$c/modes/types"; -import type { CustomMessage } from "$c/session/messages"; -import type { SessionContext } from "$c/session/session-manager"; type TextBlock = { type: "text"; text: string }; diff --git a/packages/coding-agent/src/patch/applicator.ts b/packages/coding-agent/src/patch/applicator.ts index 5f0bbd525..3d4d4ce64 100644 --- a/packages/coding-agent/src/patch/applicator.ts +++ b/packages/coding-agent/src/patch/applicator.ts @@ -7,7 +7,7 @@ import { mkdirSync, unlinkSync } from "node:fs"; import { dirname } from "node:path"; -import { resolveToCwd } from "$c/tools/path-utils"; +import { resolveToCwd } from "@oh-my-pi/pi-coding-agent/tools/path-utils"; import { DEFAULT_FUZZY_THRESHOLD, findContextLine, findMatch, seekSequence } from "./fuzzy"; import { adjustIndentation, diff --git a/packages/coding-agent/src/patch/diff.ts b/packages/coding-agent/src/patch/diff.ts index 431fecea5..0b8da3470 100644 --- a/packages/coding-agent/src/patch/diff.ts +++ b/packages/coding-agent/src/patch/diff.ts @@ -5,8 +5,8 @@ * used when not in patch mode. */ +import { resolveToCwd } from "@oh-my-pi/pi-coding-agent/tools/path-utils"; import * as Diff from "diff"; -import { resolveToCwd } from "$c/tools/path-utils"; import { previewPatch } from "./applicator"; import { DEFAULT_FUZZY_THRESHOLD, findMatch } from "./fuzzy"; import { adjustIndentation, normalizeToLF, stripBom } from "./normalize"; diff --git a/packages/coding-agent/src/patch/index.ts b/packages/coding-agent/src/patch/index.ts index 6ebad5845..273a7a4f1 100644 --- a/packages/coding-agent/src/patch/index.ts +++ b/packages/coding-agent/src/patch/index.ts @@ -11,20 +11,20 @@ import { mkdir } from "node:fs/promises"; import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import { StringEnum } from "@oh-my-pi/pi-ai"; -import { Type } from "@sinclair/typebox"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; import { createLspWritethrough, type FileDiagnosticsResult, flushLspWritethroughBatch, type WritethroughCallback, writethroughNoop, -} from "$c/lsp/index"; -import patchDescription from "$c/prompts/tools/patch.md" with { type: "text" }; -import replaceDescription from "$c/prompts/tools/replace.md" with { type: "text" }; -import type { ToolSession } from "$c/tools/index"; -import { outputMeta } from "$c/tools/output-meta"; -import { resolveToCwd } from "$c/tools/path-utils"; +} from "@oh-my-pi/pi-coding-agent/lsp/index"; +import patchDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/patch.md" with { type: "text" }; +import replaceDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/replace.md" with { type: "text" }; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { outputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { resolveToCwd } from "@oh-my-pi/pi-coding-agent/tools/path-utils"; +import { Type } from "@sinclair/typebox"; import { applyPatch } from "./applicator"; import { generateDiffString, generateUnifiedDiffString, replaceText } from "./diff"; import { DEFAULT_FUZZY_THRESHOLD, findMatch } from "./fuzzy"; diff --git a/packages/coding-agent/src/patch/shared.ts b/packages/coding-agent/src/patch/shared.ts index ad030f92c..30cb02196 100644 --- a/packages/coding-agent/src/patch/shared.ts +++ b/packages/coding-agent/src/patch/shared.ts @@ -3,13 +3,11 @@ */ import type { ToolCallContext } from "@oh-my-pi/pi-agent-core"; -import type { Component } from "@oh-my-pi/pi-tui"; -import { Text } from "@oh-my-pi/pi-tui"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import type { FileDiagnosticsResult } from "$c/lsp/index"; -import { renderDiff as renderDiffColored } from "$c/modes/components/diff"; -import { getLanguageFromPath, type Theme } from "$c/modes/theme/theme"; -import type { OutputMeta } from "$c/tools/output-meta"; +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import type { FileDiagnosticsResult } from "@oh-my-pi/pi-coding-agent/lsp/index"; +import { renderDiff as renderDiffColored } from "@oh-my-pi/pi-coding-agent/modes/components/diff"; +import { getLanguageFromPath, type Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { OutputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; import { formatExpandHint, formatStatusIcon, @@ -17,9 +15,11 @@ import { shortenPath, ToolUIKit, truncateDiffByHunk, -} from "$c/tools/render-utils"; -import type { RenderCallOptions } from "$c/tools/renderers"; -import { renderStatusLine } from "$c/tui"; +} from "@oh-my-pi/pi-coding-agent/tools/render-utils"; +import type { RenderCallOptions } from "@oh-my-pi/pi-coding-agent/tools/renderers"; +import { renderStatusLine } from "@oh-my-pi/pi-coding-agent/tui"; +import type { Component } from "@oh-my-pi/pi-tui"; +import { Text } from "@oh-my-pi/pi-tui"; import type { DiffError, DiffResult, Operation } from "./types"; // ═══════════════════════════════════════════════════════════════════════════ diff --git a/packages/coding-agent/src/sdk.ts b/packages/coding-agent/src/sdk.ts index 783381704..12c415c0f 100644 --- a/packages/coding-agent/src/sdk.ts +++ b/packages/coding-agent/src/sdk.ts @@ -31,20 +31,20 @@ import { rename } from "node:fs/promises"; import { join } from "node:path"; import { Agent, type AgentEvent, type AgentMessage, type AgentTool, type ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import { type Message, type Model, supportsXhigh } from "@oh-my-pi/pi-ai"; +// Import discovery to register all providers on startup +import { loadCapability } from "@oh-my-pi/pi-coding-agent/capability/index"; +import { type Rule, ruleCapability } from "@oh-my-pi/pi-coding-agent/capability/rule"; +import { getAgentDir, getConfigDirPaths } from "@oh-my-pi/pi-coding-agent/config"; +import { CursorExecHandlers } from "@oh-my-pi/pi-coding-agent/cursor"; +import { initializeWithSettings } from "@oh-my-pi/pi-coding-agent/discovery"; +import { TtsrManager } from "@oh-my-pi/pi-coding-agent/export/ttsr"; +import { disposeAllKernelSessions } from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import { closeAllConnections } from "@oh-my-pi/pi-coding-agent/ssh/connection-manager"; +import { unmountAll } from "@oh-my-pi/pi-coding-agent/ssh/sshfs-mount"; import type { Component } from "@oh-my-pi/pi-tui"; import { logger, postmortem } from "@oh-my-pi/pi-utils"; import { YAML } from "bun"; import chalk from "chalk"; -// Import discovery to register all providers on startup -import { loadCapability } from "$c/capability/index"; -import { type Rule, ruleCapability } from "$c/capability/rule"; -import { getAgentDir, getConfigDirPaths } from "$c/config"; -import { CursorExecHandlers } from "$c/cursor"; -import { initializeWithSettings } from "$c/discovery"; -import { TtsrManager } from "$c/export/ttsr"; -import { disposeAllKernelSessions } from "$c/ipy/executor"; -import { closeAllConnections } from "$c/ssh/connection-manager"; -import { unmountAll } from "$c/ssh/sshfs-mount"; import { ModelRegistry } from "./config/model-registry"; import { formatModelString, parseModelString } from "./config/model-resolver"; import { loadPromptTemplates as loadPromptTemplatesInternal, type PromptTemplate } from "./config/prompt-templates"; @@ -205,19 +205,22 @@ export interface CreateAgentSessionResult { // Re-exports -export type { PromptTemplate } from "$c/config/prompt-templates"; -export type { Settings, SkillsSettings } from "$c/config/settings-manager"; -export type { CustomCommand, CustomCommandFactory } from "$c/extensibility/custom-commands/types"; -export type { CustomTool, CustomToolFactory } from "$c/extensibility/custom-tools/types"; +export type { PromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +export type { Settings, SkillsSettings } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +export type { + CustomCommand, + CustomCommandFactory, +} from "@oh-my-pi/pi-coding-agent/extensibility/custom-commands/types"; +export type { CustomTool, CustomToolFactory } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; export type { ExtensionAPI, ExtensionCommandContext, ExtensionContext, ExtensionFactory, ToolDefinition, -} from "$c/extensibility/extensions/index"; -export type { Skill } from "$c/extensibility/skills"; -export type { FileSlashCommand } from "$c/extensibility/slash-commands"; +} from "@oh-my-pi/pi-coding-agent/extensibility/extensions/index"; +export type { Skill } from "@oh-my-pi/pi-coding-agent/extensibility/skills"; +export type { FileSlashCommand } from "@oh-my-pi/pi-coding-agent/extensibility/slash-commands"; export type { MCPManager, MCPServerConfig, MCPServerConnection, MCPToolsLoadResult } from "./mcp/index"; export type { Tool } from "./tools/index"; diff --git a/packages/coding-agent/src/session/agent-session.ts b/packages/coding-agent/src/session/agent-session.ts index c2254b231..b2177dc53 100644 --- a/packages/coding-agent/src/session/agent-session.ts +++ b/packages/coding-agent/src/session/agent-session.ts @@ -26,23 +26,21 @@ import type { UsageReport, } from "@oh-my-pi/pi-ai"; import { isContextOverflow, modelsAreEqual, supportsXhigh } from "@oh-my-pi/pi-ai"; -import { abortableSleep, logger } from "@oh-my-pi/pi-utils"; -import { YAML } from "bun"; -import type { Rule } from "$c/capability/rule"; -import { getAgentDbPath } from "$c/config"; -import type { ModelRegistry } from "$c/config/model-registry"; -import { parseModelString } from "$c/config/model-resolver"; +import type { Rule } from "@oh-my-pi/pi-coding-agent/capability/rule"; +import { getAgentDbPath } from "@oh-my-pi/pi-coding-agent/config"; +import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { parseModelString } from "@oh-my-pi/pi-coding-agent/config/model-resolver"; import { expandPromptTemplate, type PromptTemplate, parseCommandArgs, renderPromptTemplate, -} from "$c/config/prompt-templates"; -import type { SettingsManager, SkillsSettings } from "$c/config/settings-manager"; -import { type BashResult, executeBash as executeBashCommand } from "$c/exec/bash-executor"; -import { exportSessionToHtml } from "$c/export/html/index"; -import type { TtsrManager } from "$c/export/ttsr"; -import type { LoadedCustomCommand } from "$c/extensibility/custom-commands/index"; +} from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import type { SettingsManager, SkillsSettings } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { type BashResult, executeBash as executeBashCommand } from "@oh-my-pi/pi-coding-agent/exec/bash-executor"; +import { exportSessionToHtml } from "@oh-my-pi/pi-coding-agent/export/html/index"; +import type { TtsrManager } from "@oh-my-pi/pi-coding-agent/export/ttsr"; +import type { LoadedCustomCommand } from "@oh-my-pi/pi-coding-agent/extensibility/custom-commands/index"; import type { ExtensionCommandContext, ExtensionRunner, @@ -54,21 +52,23 @@ import type { TreePreparation, TurnEndEvent, TurnStartEvent, -} from "$c/extensibility/extensions"; -import type { CompactOptions, ContextUsage } from "$c/extensibility/extensions/types"; -import type { HookCommandContext } from "$c/extensibility/hooks/types"; -import type { Skill, SkillWarning } from "$c/extensibility/skills"; -import { expandSlashCommand, type FileSlashCommand } from "$c/extensibility/slash-commands"; -import { executePython as executePythonCommand, type PythonResult } from "$c/ipy/executor"; -import { theme } from "$c/modes/theme/theme"; -import { normalizeDiff, normalizeToLF, ParseError, previewPatch, stripBom } from "$c/patch"; -import ttsrInterruptTemplate from "$c/prompts/system/ttsr-interrupt.md" with { type: "text" }; -import { closeAllConnections } from "$c/ssh/connection-manager"; -import { unmountAll } from "$c/ssh/sshfs-mount"; -import { outputMeta } from "$c/tools/output-meta"; -import { resolveToCwd } from "$c/tools/path-utils"; -import type { TodoItem } from "$c/tools/todo-write"; -import { extractFileMentions, generateFileMentionMessages } from "$c/utils/file-mentions"; +} from "@oh-my-pi/pi-coding-agent/extensibility/extensions"; +import type { CompactOptions, ContextUsage } from "@oh-my-pi/pi-coding-agent/extensibility/extensions/types"; +import type { HookCommandContext } from "@oh-my-pi/pi-coding-agent/extensibility/hooks/types"; +import type { Skill, SkillWarning } from "@oh-my-pi/pi-coding-agent/extensibility/skills"; +import { expandSlashCommand, type FileSlashCommand } from "@oh-my-pi/pi-coding-agent/extensibility/slash-commands"; +import { executePython as executePythonCommand, type PythonResult } from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import { normalizeDiff, normalizeToLF, ParseError, previewPatch, stripBom } from "@oh-my-pi/pi-coding-agent/patch"; +import ttsrInterruptTemplate from "@oh-my-pi/pi-coding-agent/prompts/system/ttsr-interrupt.md" with { type: "text" }; +import { closeAllConnections } from "@oh-my-pi/pi-coding-agent/ssh/connection-manager"; +import { unmountAll } from "@oh-my-pi/pi-coding-agent/ssh/sshfs-mount"; +import { outputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { resolveToCwd } from "@oh-my-pi/pi-coding-agent/tools/path-utils"; +import type { TodoItem } from "@oh-my-pi/pi-coding-agent/tools/todo-write"; +import { extractFileMentions, generateFileMentionMessages } from "@oh-my-pi/pi-coding-agent/utils/file-mentions"; +import { abortableSleep, logger } from "@oh-my-pi/pi-utils"; +import { YAML } from "bun"; import { type CompactionResult, calculateContextTokens, diff --git a/packages/coding-agent/src/session/agent-storage.ts b/packages/coding-agent/src/session/agent-storage.ts index ce8732a55..81e020b63 100644 --- a/packages/coding-agent/src/session/agent-storage.ts +++ b/packages/coding-agent/src/session/agent-storage.ts @@ -1,9 +1,9 @@ import { Database } from "bun:sqlite"; import { chmodSync, existsSync, mkdirSync } from "node:fs"; import { dirname } from "node:path"; +import { getAgentDbPath } from "@oh-my-pi/pi-coding-agent/config"; +import type { Settings } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; import { logger } from "@oh-my-pi/pi-utils"; -import { getAgentDbPath } from "$c/config"; -import type { Settings } from "$c/config/settings-manager"; import type { AuthCredential } from "./auth-storage"; /** Prepared SQLite statement type from bun:sqlite */ diff --git a/packages/coding-agent/src/session/auth-storage.ts b/packages/coding-agent/src/session/auth-storage.ts index 6f81bcd7d..1d1adcbb9 100644 --- a/packages/coding-agent/src/session/auth-storage.ts +++ b/packages/coding-agent/src/session/auth-storage.ts @@ -32,8 +32,8 @@ import { type UsageReport, zaiUsageProvider, } from "@oh-my-pi/pi-ai"; +import { getAgentDbPath, getAuthPath } from "@oh-my-pi/pi-coding-agent/config"; import { logger } from "@oh-my-pi/pi-utils"; -import { getAgentDbPath, getAuthPath } from "$c/config"; import { AgentStorage } from "./agent-storage"; import { migrateJsonStorage } from "./storage-migration"; diff --git a/packages/coding-agent/src/session/compaction/branch-summarization.ts b/packages/coding-agent/src/session/compaction/branch-summarization.ts index 666255e2c..540cef111 100644 --- a/packages/coding-agent/src/session/compaction/branch-summarization.ts +++ b/packages/coding-agent/src/session/compaction/branch-summarization.ts @@ -8,16 +8,18 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { Model } from "@oh-my-pi/pi-ai"; import { completeSimple } from "@oh-my-pi/pi-ai"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import branchSummaryPrompt from "$c/prompts/compaction/branch-summary.md" with { type: "text" }; -import branchSummaryPreamble from "$c/prompts/compaction/branch-summary-preamble.md" with { type: "text" }; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import branchSummaryPrompt from "@oh-my-pi/pi-coding-agent/prompts/compaction/branch-summary.md" with { type: "text" }; +import branchSummaryPreamble from "@oh-my-pi/pi-coding-agent/prompts/compaction/branch-summary-preamble.md" with { + type: "text", +}; import { convertToLlm, createBranchSummaryMessage, createCompactionSummaryMessage, createCustomMessage, -} from "$c/session/messages"; -import type { ReadonlySessionManager, SessionEntry } from "$c/session/session-manager"; +} from "@oh-my-pi/pi-coding-agent/session/messages"; +import type { ReadonlySessionManager, SessionEntry } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { estimateTokens } from "./compaction"; import { computeFileLists, diff --git a/packages/coding-agent/src/session/compaction/compaction.ts b/packages/coding-agent/src/session/compaction/compaction.ts index 8227c042a..93c456460 100644 --- a/packages/coding-agent/src/session/compaction/compaction.ts +++ b/packages/coding-agent/src/session/compaction/compaction.ts @@ -8,12 +8,22 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { AssistantMessage, Model, Usage } from "@oh-my-pi/pi-ai"; import { completeSimple } from "@oh-my-pi/pi-ai"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import compactionSummaryPrompt from "$c/prompts/compaction/compaction-summary.md" with { type: "text" }; -import compactionTurnPrefixPrompt from "$c/prompts/compaction/compaction-turn-prefix.md" with { type: "text" }; -import compactionUpdateSummaryPrompt from "$c/prompts/compaction/compaction-update-summary.md" with { type: "text" }; -import { convertToLlm, createBranchSummaryMessage, createCustomMessage } from "$c/session/messages"; -import type { CompactionEntry, SessionEntry } from "$c/session/session-manager"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import compactionSummaryPrompt from "@oh-my-pi/pi-coding-agent/prompts/compaction/compaction-summary.md" with { + type: "text", +}; +import compactionTurnPrefixPrompt from "@oh-my-pi/pi-coding-agent/prompts/compaction/compaction-turn-prefix.md" with { + type: "text", +}; +import compactionUpdateSummaryPrompt from "@oh-my-pi/pi-coding-agent/prompts/compaction/compaction-update-summary.md" with { + type: "text", +}; +import { + convertToLlm, + createBranchSummaryMessage, + createCustomMessage, +} from "@oh-my-pi/pi-coding-agent/session/messages"; +import type { CompactionEntry, SessionEntry } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { computeFileLists, createFileOps, diff --git a/packages/coding-agent/src/session/compaction/utils.ts b/packages/coding-agent/src/session/compaction/utils.ts index b4ba6faa9..8188fde35 100644 --- a/packages/coding-agent/src/session/compaction/utils.ts +++ b/packages/coding-agent/src/session/compaction/utils.ts @@ -4,9 +4,11 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { Message } from "@oh-my-pi/pi-ai"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import fileOperationsTemplate from "$c/prompts/system/file-operations.md" with { type: "text" }; -import summarizationSystemPrompt from "$c/prompts/system/summarization-system.md" with { type: "text" }; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import fileOperationsTemplate from "@oh-my-pi/pi-coding-agent/prompts/system/file-operations.md" with { type: "text" }; +import summarizationSystemPrompt from "@oh-my-pi/pi-coding-agent/prompts/system/summarization-system.md" with { + type: "text", +}; // ============================================================================ // File Operation Tracking diff --git a/packages/coding-agent/src/session/history-storage.ts b/packages/coding-agent/src/session/history-storage.ts index b06f3772d..665299d97 100644 --- a/packages/coding-agent/src/session/history-storage.ts +++ b/packages/coding-agent/src/session/history-storage.ts @@ -1,8 +1,8 @@ import { Database } from "bun:sqlite"; import { mkdirSync } from "node:fs"; import { dirname, join } from "node:path"; +import { getAgentDir } from "@oh-my-pi/pi-coding-agent/config"; import { logger } from "@oh-my-pi/pi-utils"; -import { getAgentDir } from "$c/config"; export interface HistoryEntry { id: number; diff --git a/packages/coding-agent/src/session/messages.ts b/packages/coding-agent/src/session/messages.ts index b3eb3d305..dd37843a3 100644 --- a/packages/coding-agent/src/session/messages.ts +++ b/packages/coding-agent/src/session/messages.ts @@ -7,8 +7,8 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, Message, TextContent } from "@oh-my-pi/pi-ai"; -import type { OutputMeta } from "$c/tools/output-meta"; -import { formatOutputNotice } from "$c/tools/output-meta"; +import type { OutputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { formatOutputNotice } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; export const COMPACTION_SUMMARY_PREFIX = `The conversation history before this point was compacted into the following summary: diff --git a/packages/coding-agent/src/session/session-manager.ts b/packages/coding-agent/src/session/session-manager.ts index c2bcff827..240dfd4ec 100644 --- a/packages/coding-agent/src/session/session-manager.ts +++ b/packages/coding-agent/src/session/session-manager.ts @@ -1,10 +1,10 @@ import { basename, join, resolve } from "node:path"; import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, Message, TextContent, Usage } from "@oh-my-pi/pi-ai"; +import { getAgentDir as getDefaultAgentDir } from "@oh-my-pi/pi-coding-agent/config"; +import { resizeImage } from "@oh-my-pi/pi-coding-agent/utils/image-resize"; import { logger } from "@oh-my-pi/pi-utils"; import { nanoid } from "nanoid"; -import { getAgentDir as getDefaultAgentDir } from "$c/config"; -import { resizeImage } from "$c/utils/image-resize"; import { type BashExecutionMessage, type CustomMessage, diff --git a/packages/coding-agent/src/session/storage-migration.ts b/packages/coding-agent/src/session/storage-migration.ts index 9da85656d..314489e94 100644 --- a/packages/coding-agent/src/session/storage-migration.ts +++ b/packages/coding-agent/src/session/storage-migration.ts @@ -7,8 +7,8 @@ * which migrates from both settings.json and agent.db to config.yaml. */ +import { getAgentDbPath } from "@oh-my-pi/pi-coding-agent/config"; import { logger } from "@oh-my-pi/pi-utils"; -import { getAgentDbPath } from "$c/config"; import { AgentStorage } from "./agent-storage"; import type { AuthCredential, AuthCredentialEntry, AuthStorageData } from "./auth-storage"; diff --git a/packages/coding-agent/src/session/streaming-output.ts b/packages/coding-agent/src/session/streaming-output.ts index 89abe0977..7611dc3fc 100644 --- a/packages/coding-agent/src/session/streaming-output.ts +++ b/packages/coding-agent/src/session/streaming-output.ts @@ -1,5 +1,5 @@ +import { DEFAULT_MAX_BYTES } from "@oh-my-pi/pi-coding-agent/tools/truncate"; import { sanitizeText } from "@oh-my-pi/pi-utils"; -import { DEFAULT_MAX_BYTES } from "$c/tools/truncate"; export interface OutputSummary { output: string; diff --git a/packages/coding-agent/src/ssh/connection-manager.ts b/packages/coding-agent/src/ssh/connection-manager.ts index 069899612..453cbf0a3 100644 --- a/packages/coding-agent/src/ssh/connection-manager.ts +++ b/packages/coding-agent/src/ssh/connection-manager.ts @@ -1,9 +1,9 @@ import { chmodSync, existsSync, mkdirSync, readFileSync, statSync } from "node:fs"; import { homedir } from "node:os"; import { join } from "node:path"; +import { CONFIG_DIR_NAME } from "@oh-my-pi/pi-coding-agent/config"; import { logger } from "@oh-my-pi/pi-utils"; import { $ } from "bun"; -import { CONFIG_DIR_NAME } from "$c/config"; export interface SSHConnectionTarget { name: string; diff --git a/packages/coding-agent/src/ssh/ssh-executor.ts b/packages/coding-agent/src/ssh/ssh-executor.ts index 195ead3ad..86afd7db4 100644 --- a/packages/coding-agent/src/ssh/ssh-executor.ts +++ b/packages/coding-agent/src/ssh/ssh-executor.ts @@ -1,5 +1,5 @@ +import { OutputSink } from "@oh-my-pi/pi-coding-agent/session/streaming-output"; import { cspawn, logger, ptree } from "@oh-my-pi/pi-utils"; -import { OutputSink } from "$c/session/streaming-output"; import { buildRemoteCommand, ensureConnection, ensureHostInfo, type SSHConnectionTarget } from "./connection-manager"; import { hasSshfs, mountRemote } from "./sshfs-mount"; diff --git a/packages/coding-agent/src/ssh/sshfs-mount.ts b/packages/coding-agent/src/ssh/sshfs-mount.ts index 15f2f1e00..784777265 100644 --- a/packages/coding-agent/src/ssh/sshfs-mount.ts +++ b/packages/coding-agent/src/ssh/sshfs-mount.ts @@ -1,9 +1,9 @@ import { chmodSync, existsSync, mkdirSync } from "node:fs"; import { homedir } from "node:os"; import { join } from "node:path"; +import { CONFIG_DIR_NAME } from "@oh-my-pi/pi-coding-agent/config"; import { logger } from "@oh-my-pi/pi-utils"; import { $ } from "bun"; -import { CONFIG_DIR_NAME } from "$c/config"; import { getControlDir, getControlPathTemplate, type SSHConnectionTarget } from "./connection-manager"; const REMOTE_DIR = join(homedir(), CONFIG_DIR_NAME, "remote"); diff --git a/packages/coding-agent/src/system-prompt.ts b/packages/coding-agent/src/system-prompt.ts index 9bb522c72..f0eab6605 100644 --- a/packages/coding-agent/src/system-prompt.ts +++ b/packages/coding-agent/src/system-prompt.ts @@ -5,16 +5,22 @@ import { existsSync } from "node:fs"; import { homedir } from "node:os"; import { join } from "node:path"; +import { contextFileCapability } from "@oh-my-pi/pi-coding-agent/capability/context-file"; +import { systemPromptCapability } from "@oh-my-pi/pi-coding-agent/capability/system-prompt"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import type { SkillsSettings } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { + type ContextFile, + loadCapability, + type SystemPrompt as SystemPromptFile, +} from "@oh-my-pi/pi-coding-agent/discovery/index"; +import { loadSkills, type Skill } from "@oh-my-pi/pi-coding-agent/extensibility/skills"; +import customSystemPromptTemplate from "@oh-my-pi/pi-coding-agent/prompts/system/custom-system-prompt.md" with { + type: "text", +}; +import systemPromptTemplate from "@oh-my-pi/pi-coding-agent/prompts/system/system-prompt.md" with { type: "text" }; import { $ } from "bun"; import chalk from "chalk"; -import { contextFileCapability } from "$c/capability/context-file"; -import { systemPromptCapability } from "$c/capability/system-prompt"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import type { SkillsSettings } from "$c/config/settings-manager"; -import { type ContextFile, loadCapability, type SystemPrompt as SystemPromptFile } from "$c/discovery/index"; -import { loadSkills, type Skill } from "$c/extensibility/skills"; -import customSystemPromptTemplate from "$c/prompts/system/custom-system-prompt.md" with { type: "text" }; -import systemPromptTemplate from "$c/prompts/system/system-prompt.md" with { type: "text" }; import type { ToolName } from "./tools/index"; interface GitContext { diff --git a/packages/coding-agent/src/task/agents.ts b/packages/coding-agent/src/task/agents.ts index f7c9f0836..f0ab56c7c 100644 --- a/packages/coding-agent/src/task/agents.ts +++ b/packages/coding-agent/src/task/agents.ts @@ -4,15 +4,15 @@ * Agents are embedded at build time via Bun's import with { type: "text" }. */ -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import { parseAgentFields } from "$c/discovery/helpers"; -import exploreMd from "$c/prompts/agents/explore.md" with { type: "text" }; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import { parseAgentFields } from "@oh-my-pi/pi-coding-agent/discovery/helpers"; +import exploreMd from "@oh-my-pi/pi-coding-agent/prompts/agents/explore.md" with { type: "text" }; // Embed agent markdown files at build time -import agentFrontmatterTemplate from "$c/prompts/agents/frontmatter.md" with { type: "text" }; -import planMd from "$c/prompts/agents/plan.md" with { type: "text" }; -import reviewerMd from "$c/prompts/agents/reviewer.md" with { type: "text" }; -import taskMd from "$c/prompts/agents/task.md" with { type: "text" }; -import { parseFrontmatter } from "$c/utils/frontmatter"; +import agentFrontmatterTemplate from "@oh-my-pi/pi-coding-agent/prompts/agents/frontmatter.md" with { type: "text" }; +import planMd from "@oh-my-pi/pi-coding-agent/prompts/agents/plan.md" with { type: "text" }; +import reviewerMd from "@oh-my-pi/pi-coding-agent/prompts/agents/reviewer.md" with { type: "text" }; +import taskMd from "@oh-my-pi/pi-coding-agent/prompts/agents/task.md" with { type: "text" }; +import { parseFrontmatter } from "@oh-my-pi/pi-coding-agent/utils/frontmatter"; import type { AgentDefinition, AgentSource } from "./types"; interface AgentFrontmatter { diff --git a/packages/coding-agent/src/task/commands.ts b/packages/coding-agent/src/task/commands.ts index ee52cb7c5..9e4ae19dc 100644 --- a/packages/coding-agent/src/task/commands.ts +++ b/packages/coding-agent/src/task/commands.ts @@ -5,12 +5,12 @@ */ import * as path from "node:path"; -import { type SlashCommand, slashCommandCapability } from "$c/capability/slash-command"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import { loadCapability } from "$c/discovery"; +import { type SlashCommand, slashCommandCapability } from "@oh-my-pi/pi-coding-agent/capability/slash-command"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import { loadCapability } from "@oh-my-pi/pi-coding-agent/discovery"; // Embed command markdown files at build time -import initMd from "$c/prompts/agents/init.md" with { type: "text" }; -import { parseFrontmatter } from "$c/utils/frontmatter"; +import initMd from "@oh-my-pi/pi-coding-agent/prompts/agents/init.md" with { type: "text" }; +import { parseFrontmatter } from "@oh-my-pi/pi-coding-agent/utils/frontmatter"; const EMBEDDED_COMMANDS: { name: string; content: string }[] = [ { name: "init.md", content: renderPromptTemplate(initMd) }, diff --git a/packages/coding-agent/src/task/discovery.ts b/packages/coding-agent/src/task/discovery.ts index 0e3968df3..8424122e7 100644 --- a/packages/coding-agent/src/task/discovery.ts +++ b/packages/coding-agent/src/task/discovery.ts @@ -14,9 +14,9 @@ import * as fs from "node:fs"; import * as path from "node:path"; -import { findAllNearestProjectConfigDirs, getConfigDirs } from "$c/config"; -import { parseAgentFields } from "$c/discovery/helpers"; -import { parseFrontmatter } from "$c/utils/frontmatter"; +import { findAllNearestProjectConfigDirs, getConfigDirs } from "@oh-my-pi/pi-coding-agent/config"; +import { parseAgentFields } from "@oh-my-pi/pi-coding-agent/discovery/helpers"; +import { parseFrontmatter } from "@oh-my-pi/pi-coding-agent/utils/frontmatter"; import { loadBundledAgents } from "./agents"; import type { AgentDefinition, AgentSource } from "./types"; diff --git a/packages/coding-agent/src/task/executor.ts b/packages/coding-agent/src/task/executor.ts index 0771def99..0cad7f7ff 100644 --- a/packages/coding-agent/src/task/executor.ts +++ b/packages/coding-agent/src/task/executor.ts @@ -6,16 +6,16 @@ import path from "node:path"; import type { AgentEvent, ThinkingLevel } from "@oh-my-pi/pi-agent-core"; -import type { ModelRegistry } from "$c/config/model-registry"; -import { formatModelString, parseModelPattern } from "$c/config/model-resolver"; -import { checkPythonKernelAvailability } from "$c/ipy/kernel"; -import { LspTool } from "$c/lsp/index"; -import type { LspParams } from "$c/lsp/types"; -import { callTool } from "$c/mcp/client"; -import type { MCPManager } from "$c/mcp/manager"; -import type { AuthStorage } from "$c/session/auth-storage"; -import { PythonTool, type PythonToolParams } from "$c/tools/python"; -import type { EventBus } from "$c/utils/event-bus"; +import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { formatModelString, parseModelPattern } from "@oh-my-pi/pi-coding-agent/config/model-resolver"; +import { checkPythonKernelAvailability } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; +import { LspTool } from "@oh-my-pi/pi-coding-agent/lsp/index"; +import type { LspParams } from "@oh-my-pi/pi-coding-agent/lsp/types"; +import { callTool } from "@oh-my-pi/pi-coding-agent/mcp/client"; +import type { MCPManager } from "@oh-my-pi/pi-coding-agent/mcp/manager"; +import type { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; +import { PythonTool, type PythonToolParams } from "@oh-my-pi/pi-coding-agent/tools/python"; +import type { EventBus } from "@oh-my-pi/pi-coding-agent/utils/event-bus"; import type { ToolSession } from ".."; import { subprocessToolRegistry } from "./subprocess-tool-registry"; import { @@ -62,7 +62,7 @@ export interface ExecutorOptions { authStorage?: AuthStorage; modelRegistry?: ModelRegistry; settingsManager?: { - serialize: () => import("$c/config/settings-manager").Settings; + serialize: () => import("@oh-my-pi/pi-coding-agent/config/settings-manager").Settings; getPythonToolMode?: () => "ipy-only" | "bash-only" | "both"; getPythonKernelMode?: () => "session" | "per-call"; getPythonSharedGateway?: () => boolean; diff --git a/packages/coding-agent/src/task/index.ts b/packages/coding-agent/src/task/index.ts index ff1c80d72..1a15d91b9 100644 --- a/packages/coding-agent/src/task/index.ts +++ b/packages/coding-agent/src/task/index.ts @@ -18,13 +18,13 @@ import { tmpdir } from "node:os"; import path from "node:path"; import type { AgentTool, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import type { Usage } from "@oh-my-pi/pi-ai"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import taskDescriptionTemplate from "@oh-my-pi/pi-coding-agent/prompts/tools/task.md" with { type: "text" }; +import { AgentOutputManager } from "@oh-my-pi/pi-coding-agent/task/output-manager"; +import { formatDuration } from "@oh-my-pi/pi-coding-agent/tools/render-utils"; import { $ } from "bun"; import { nanoid } from "nanoid"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import type { Theme } from "$c/modes/theme/theme"; -import taskDescriptionTemplate from "$c/prompts/tools/task.md" with { type: "text" }; -import { AgentOutputManager } from "$c/task/output-manager"; -import { formatDuration } from "$c/tools/render-utils"; import type { ToolSession } from ".."; import { discoverAgents, getAgent } from "./discovery"; import { runSubprocess } from "./executor"; diff --git a/packages/coding-agent/src/task/render.ts b/packages/coding-agent/src/task/render.ts index ddd5d35d4..22626c507 100644 --- a/packages/coding-agent/src/task/render.ts +++ b/packages/coding-agent/src/task/render.ts @@ -6,10 +6,8 @@ */ import path from "node:path"; -import type { Component } from "@oh-my-pi/pi-tui"; -import { Container, Text } from "@oh-my-pi/pi-tui"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import type { Theme } from "$c/modes/theme/theme"; +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { formatBadge, formatDuration, @@ -17,15 +15,17 @@ import { formatStatusIcon, formatTokens, truncate, -} from "$c/tools/render-utils"; +} from "@oh-my-pi/pi-coding-agent/tools/render-utils"; import { type FindingPriority, getPriorityInfo, PRIORITY_LABELS, type ReportFindingDetails, type SubmitReviewDetails, -} from "$c/tools/review"; -import { renderStatusLine } from "$c/tui"; +} from "@oh-my-pi/pi-coding-agent/tools/review"; +import { renderStatusLine } from "@oh-my-pi/pi-coding-agent/tui"; +import type { Component } from "@oh-my-pi/pi-tui"; +import { Container, Text } from "@oh-my-pi/pi-tui"; import { subprocessToolRegistry } from "./subprocess-tool-registry"; import type { AgentProgress, SingleResult, TaskParams, TaskToolDetails } from "./types"; diff --git a/packages/coding-agent/src/task/subprocess-tool-registry.ts b/packages/coding-agent/src/task/subprocess-tool-registry.ts index 751f1d918..7c7680168 100644 --- a/packages/coding-agent/src/task/subprocess-tool-registry.ts +++ b/packages/coding-agent/src/task/subprocess-tool-registry.ts @@ -7,8 +7,8 @@ * - Provide custom rendering for realtime/final display */ +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import type { Component } from "@oh-my-pi/pi-tui"; -import type { Theme } from "$c/modes/theme/theme"; /** Event from subprocess tool execution (parsed from JSONL) */ export interface SubprocessToolEvent { diff --git a/packages/coding-agent/src/task/worker-protocol.ts b/packages/coding-agent/src/task/worker-protocol.ts index af2cc089b..e07388ab8 100644 --- a/packages/coding-agent/src/task/worker-protocol.ts +++ b/packages/coding-agent/src/task/worker-protocol.ts @@ -1,7 +1,7 @@ import type { AgentEvent, ThinkingLevel } from "@oh-my-pi/pi-agent-core"; -import type { SerializedModelRegistry } from "$c/config/model-registry"; -import type { Settings } from "$c/config/settings-manager"; -import type { SerializedAuthStorage } from "$c/session/auth-storage"; +import type { SerializedModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import type { Settings } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import type { SerializedAuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; /** * MCP tool metadata passed from parent to worker for proxy tool creation. diff --git a/packages/coding-agent/src/task/worker.ts b/packages/coding-agent/src/task/worker.ts index 350f7f362..817e2e354 100644 --- a/packages/coding-agent/src/task/worker.ts +++ b/packages/coding-agent/src/task/worker.ts @@ -15,21 +15,26 @@ import type { AgentEvent, ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import type { Api, Model } from "@oh-my-pi/pi-ai"; +import { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { parseModelPattern, parseModelString } from "@oh-my-pi/pi-coding-agent/config/model-resolver"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import type { CustomTool } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import { type LspToolDetails, lspSchema } from "@oh-my-pi/pi-coding-agent/lsp/types"; +import lspDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/lsp.md" with { type: "text" }; +import { createAgentSession, discoverAuthStorage, discoverModels } from "@oh-my-pi/pi-coding-agent/sdk"; +import type { AgentSessionEvent } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import { + getPythonToolDescription, + type PythonToolDetails, + type PythonToolParams, + pythonSchema, +} from "@oh-my-pi/pi-coding-agent/tools/python"; +import { ToolAbortError } from "@oh-my-pi/pi-coding-agent/tools/tool-errors"; import { logger, postmortem, untilAborted } from "@oh-my-pi/pi-utils"; import type { TSchema } from "@sinclair/typebox"; -import { ModelRegistry } from "$c/config/model-registry"; -import { parseModelPattern, parseModelString } from "$c/config/model-resolver"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import { SettingsManager } from "$c/config/settings-manager"; -import type { CustomTool } from "$c/extensibility/custom-tools/types"; -import { type LspToolDetails, lspSchema } from "$c/lsp/types"; -import lspDescription from "$c/prompts/tools/lsp.md" with { type: "text" }; -import { createAgentSession, discoverAuthStorage, discoverModels } from "$c/sdk"; -import type { AgentSessionEvent } from "$c/session/agent-session"; -import { AuthStorage } from "$c/session/auth-storage"; -import { SessionManager } from "$c/session/session-manager"; -import { getPythonToolDescription, type PythonToolDetails, type PythonToolParams, pythonSchema } from "$c/tools/python"; -import { ToolAbortError } from "$c/tools/tool-errors"; import type { LspToolCallResponse, MCPToolCallResponse, diff --git a/packages/coding-agent/src/tools/ask.ts b/packages/coding-agent/src/tools/ask.ts index 52eaa359a..5fe8816ac 100644 --- a/packages/coding-agent/src/tools/ask.ts +++ b/packages/coding-agent/src/tools/ask.ts @@ -16,14 +16,14 @@ */ import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import { type Theme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import askDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/ask.md" with { type: "text" }; +import { renderStatusLine } from "@oh-my-pi/pi-coding-agent/tui"; import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { Type } from "@sinclair/typebox"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import { type Theme, theme } from "$c/modes/theme/theme"; -import askDescription from "$c/prompts/tools/ask.md" with { type: "text" }; -import { renderStatusLine } from "$c/tui"; import type { ToolSession } from "./index"; import { ToolUIKit } from "./render-utils"; diff --git a/packages/coding-agent/src/tools/bash-interceptor.ts b/packages/coding-agent/src/tools/bash-interceptor.ts index a228f0232..6fa274475 100644 --- a/packages/coding-agent/src/tools/bash-interceptor.ts +++ b/packages/coding-agent/src/tools/bash-interceptor.ts @@ -6,7 +6,10 @@ * the specialized tools instead. */ -import { type BashInterceptorRule, DEFAULT_BASH_INTERCEPTOR_RULES } from "$c/config/settings-manager"; +import { + type BashInterceptorRule, + DEFAULT_BASH_INTERCEPTOR_RULES, +} from "@oh-my-pi/pi-coding-agent/config/settings-manager"; export interface InterceptionResult { /** If true, the bash command should be blocked */ diff --git a/packages/coding-agent/src/tools/bash.ts b/packages/coding-agent/src/tools/bash.ts index b2b34f621..0b6e58519 100644 --- a/packages/coding-agent/src/tools/bash.ts +++ b/packages/coding-agent/src/tools/bash.ts @@ -1,17 +1,17 @@ import { relative, resolve, sep } from "node:path"; import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import { type BashExecutorOptions, executeBash } from "@oh-my-pi/pi-coding-agent/exec/bash-executor"; +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import { truncateToVisualLines } from "@oh-my-pi/pi-coding-agent/modes/components/visual-truncate"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import bashDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/bash.md" with { type: "text" }; +import type { OutputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { ToolError } from "@oh-my-pi/pi-coding-agent/tools/tool-errors"; +import { renderOutputBlock, renderStatusLine } from "@oh-my-pi/pi-coding-agent/tui"; import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { Type } from "@sinclair/typebox"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import { type BashExecutorOptions, executeBash } from "$c/exec/bash-executor"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import { truncateToVisualLines } from "$c/modes/components/visual-truncate"; -import type { Theme } from "$c/modes/theme/theme"; -import bashDescription from "$c/prompts/tools/bash.md" with { type: "text" }; -import type { OutputMeta } from "$c/tools/output-meta"; -import { ToolError } from "$c/tools/tool-errors"; -import { renderOutputBlock, renderStatusLine } from "$c/tui"; import { checkBashInterception, checkSimpleLsInterception } from "./bash-interceptor"; import type { ToolSession } from "./index"; diff --git a/packages/coding-agent/src/tools/calculator.ts b/packages/coding-agent/src/tools/calculator.ts index 69a8e2691..99adfadff 100644 --- a/packages/coding-agent/src/tools/calculator.ts +++ b/packages/coding-agent/src/tools/calculator.ts @@ -1,13 +1,13 @@ import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import calculatorDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/calculator.md" with { type: "text" }; +import { renderStatusLine, renderTreeList } from "@oh-my-pi/pi-coding-agent/tui"; import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { untilAborted } from "@oh-my-pi/pi-utils"; import { Type } from "@sinclair/typebox"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import type { Theme } from "$c/modes/theme/theme"; -import calculatorDescription from "$c/prompts/tools/calculator.md" with { type: "text" }; -import { renderStatusLine, renderTreeList } from "$c/tui"; import type { ToolSession } from "./index"; import { formatCount, diff --git a/packages/coding-agent/src/tools/complete.ts b/packages/coding-agent/src/tools/complete.ts index c6c575f59..257f8e7b3 100644 --- a/packages/coding-agent/src/tools/complete.ts +++ b/packages/coding-agent/src/tools/complete.ts @@ -6,10 +6,10 @@ import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import { StringEnum } from "@oh-my-pi/pi-ai"; +import { subprocessToolRegistry } from "@oh-my-pi/pi-coding-agent/task/subprocess-tool-registry"; import type { Static, TObject } from "@sinclair/typebox"; import { Type } from "@sinclair/typebox"; import Ajv, { type ErrorObject, type ValidateFunction } from "ajv"; -import { subprocessToolRegistry } from "$c/task/subprocess-tool-registry"; import type { ToolSession } from "./index"; import { jtdToJsonSchema } from "./jtd-to-json-schema"; diff --git a/packages/coding-agent/src/tools/context.ts b/packages/coding-agent/src/tools/context.ts index d0a440bf7..659f9a059 100644 --- a/packages/coding-agent/src/tools/context.ts +++ b/packages/coding-agent/src/tools/context.ts @@ -1,6 +1,6 @@ import type { AgentToolContext, ToolCallContext } from "@oh-my-pi/pi-agent-core"; -import type { CustomToolContext } from "$c/extensibility/custom-tools/types"; -import type { ExtensionUIContext } from "$c/extensibility/extensions/types"; +import type { CustomToolContext } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import type { ExtensionUIContext } from "@oh-my-pi/pi-coding-agent/extensibility/extensions/types"; declare module "@oh-my-pi/pi-agent-core" { interface AgentToolContext extends CustomToolContext { diff --git a/packages/coding-agent/src/tools/fetch.ts b/packages/coding-agent/src/tools/fetch.ts index 79c57d5ab..7d7a82ea3 100644 --- a/packages/coding-agent/src/tools/fetch.ts +++ b/packages/coding-agent/src/tools/fetch.ts @@ -1,24 +1,24 @@ import { mkdir, rm } from "node:fs/promises"; import * as path from "node:path"; import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import { type Theme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import fetchDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/fetch.md" with { type: "text" }; +import type { OutputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { ToolAbortError } from "@oh-my-pi/pi-coding-agent/tools/tool-errors"; +import { renderOutputBlock, renderStatusLine } from "@oh-my-pi/pi-coding-agent/tui"; +import { ensureTool } from "@oh-my-pi/pi-coding-agent/utils/tools-manager"; +import { specialHandlers } from "@oh-my-pi/pi-coding-agent/web/scrapers/index"; +import type { RenderResult } from "@oh-my-pi/pi-coding-agent/web/scrapers/types"; +import { finalizeOutput, loadPage, MAX_OUTPUT_CHARS } from "@oh-my-pi/pi-coding-agent/web/scrapers/types"; +import { convertWithMarkitdown, fetchBinary } from "@oh-my-pi/pi-coding-agent/web/scrapers/utils"; import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { ptree } from "@oh-my-pi/pi-utils"; import { type Static, Type } from "@sinclair/typebox"; import { nanoid } from "nanoid"; import { parse as parseHtml } from "node-html-parser"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import { type Theme, theme } from "$c/modes/theme/theme"; -import fetchDescription from "$c/prompts/tools/fetch.md" with { type: "text" }; -import type { OutputMeta } from "$c/tools/output-meta"; -import { ToolAbortError } from "$c/tools/tool-errors"; -import { renderOutputBlock, renderStatusLine } from "$c/tui"; -import { ensureTool } from "$c/utils/tools-manager"; -import { specialHandlers } from "$c/web/scrapers/index"; -import type { RenderResult } from "$c/web/scrapers/types"; -import { finalizeOutput, loadPage, MAX_OUTPUT_CHARS } from "$c/web/scrapers/types"; -import { convertWithMarkitdown, fetchBinary } from "$c/web/scrapers/utils"; import type { ToolSession } from "./index"; import { applyListLimit } from "./list-limit"; import { formatExpandHint } from "./render-utils"; diff --git a/packages/coding-agent/src/tools/find.ts b/packages/coding-agent/src/tools/find.ts index 61b6f2ca8..1e00cc32c 100644 --- a/packages/coding-agent/src/tools/find.ts +++ b/packages/coding-agent/src/tools/find.ts @@ -1,19 +1,19 @@ import path from "node:path"; import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import { StringEnum } from "@oh-my-pi/pi-ai"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import findDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/find.md" with { type: "text" }; +import type { OutputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { ToolAbortError, ToolError, throwIfAborted } from "@oh-my-pi/pi-coding-agent/tools/tool-errors"; +import { renderFileList, renderStatusLine, renderTreeList } from "@oh-my-pi/pi-coding-agent/tui"; +import { ensureTool } from "@oh-my-pi/pi-coding-agent/utils/tools-manager"; import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { ptree, untilAborted } from "@oh-my-pi/pi-utils"; import type { Static } from "@sinclair/typebox"; import { Type } from "@sinclair/typebox"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import type { Theme } from "$c/modes/theme/theme"; -import findDescription from "$c/prompts/tools/find.md" with { type: "text" }; -import type { OutputMeta } from "$c/tools/output-meta"; -import { ToolAbortError, ToolError, throwIfAborted } from "$c/tools/tool-errors"; -import { renderFileList, renderStatusLine, renderTreeList } from "$c/tui"; -import { ensureTool } from "$c/utils/tools-manager"; import type { ToolSession } from "./index"; import { applyListLimit } from "./list-limit"; diff --git a/packages/coding-agent/src/tools/gemini-image.ts b/packages/coding-agent/src/tools/gemini-image.ts index 64fb1faa1..1cce00be8 100644 --- a/packages/coding-agent/src/tools/gemini-image.ts +++ b/packages/coding-agent/src/tools/gemini-image.ts @@ -1,15 +1,15 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import { StringEnum } from "@oh-my-pi/pi-ai"; +import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import type { CustomTool } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import geminiImageDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/gemini-image.md" with { type: "text" }; +import { detectSupportedImageMimeTypeFromFile } from "@oh-my-pi/pi-coding-agent/utils/mime"; +import { getEnv } from "@oh-my-pi/pi-coding-agent/web/search/auth"; import { untilAborted } from "@oh-my-pi/pi-utils"; import { type Static, Type } from "@sinclair/typebox"; import { nanoid } from "nanoid"; -import type { ModelRegistry } from "$c/config/model-registry"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import type { CustomTool } from "$c/extensibility/custom-tools/types"; -import geminiImageDescription from "$c/prompts/tools/gemini-image.md" with { type: "text" }; -import { detectSupportedImageMimeTypeFromFile } from "$c/utils/mime"; -import { getEnv } from "$c/web/search/auth"; import { resolveReadPath } from "./path-utils"; const DEFAULT_MODEL = "gemini-3-pro-image-preview"; diff --git a/packages/coding-agent/src/tools/grep.ts b/packages/coding-agent/src/tools/grep.ts index 787938793..af692b3bc 100644 --- a/packages/coding-agent/src/tools/grep.ts +++ b/packages/coding-agent/src/tools/grep.ts @@ -1,20 +1,20 @@ import nodePath from "node:path"; import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import { StringEnum } from "@oh-my-pi/pi-ai"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import grepDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/grep.md" with { type: "text" }; +import type { OutputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { ToolAbortError, ToolError } from "@oh-my-pi/pi-coding-agent/tools/tool-errors"; +import { renderFileList, renderStatusLine, renderTreeList } from "@oh-my-pi/pi-coding-agent/tui"; +import { ensureTool } from "@oh-my-pi/pi-coding-agent/utils/tools-manager"; +import { untilAborted } from "@oh-my-pi/pi-coding-agent/utils/utils"; import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { ptree, readLines } from "@oh-my-pi/pi-utils"; import { Type } from "@sinclair/typebox"; import { $ } from "bun"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import type { Theme } from "$c/modes/theme/theme"; -import grepDescription from "$c/prompts/tools/grep.md" with { type: "text" }; -import type { OutputMeta } from "$c/tools/output-meta"; -import { ToolAbortError, ToolError } from "$c/tools/tool-errors"; -import { renderFileList, renderStatusLine, renderTreeList } from "$c/tui"; -import { ensureTool } from "$c/utils/tools-manager"; -import { untilAborted } from "$c/utils/utils"; import type { ToolSession } from "./index"; import { applyListLimit } from "./list-limit"; import { resolveToCwd } from "./path-utils"; diff --git a/packages/coding-agent/src/tools/index.ts b/packages/coding-agent/src/tools/index.ts index 0ce95d30f..53c540f80 100644 --- a/packages/coding-agent/src/tools/index.ts +++ b/packages/coding-agent/src/tools/index.ts @@ -1,6 +1,6 @@ // Exa MCP tools (22 tools) -export { exaTools } from "$c/exa/index"; -export type { ExaRenderDetails, ExaSearchResponse, ExaSearchResult } from "$c/exa/types"; +export { exaTools } from "@oh-my-pi/pi-coding-agent/exa/index"; +export type { ExaRenderDetails, ExaSearchResponse, ExaSearchResult } from "@oh-my-pi/pi-coding-agent/exa/types"; export { type FileDiagnosticsResult, type FileFormatResult, @@ -11,9 +11,9 @@ export { type LspWarmupOptions, type LspWarmupResult, warmupLspServers, -} from "$c/lsp/index"; -export { EditTool, type EditToolDetails } from "$c/patch"; -export { BUNDLED_AGENTS, TaskTool } from "$c/task/index"; +} from "@oh-my-pi/pi-coding-agent/lsp/index"; +export { EditTool, type EditToolDetails } from "@oh-my-pi/pi-coding-agent/patch"; +export { BUNDLED_AGENTS, TaskTool } from "@oh-my-pi/pi-coding-agent/task/index"; export { companyWebSearchTools, exaWebSearchTools, @@ -31,7 +31,7 @@ export { webSearchCustomTool, webSearchDeepTool, webSearchLinkedinTool, -} from "$c/web/search/index"; +} from "@oh-my-pi/pi-coding-agent/web/search/index"; export { AskTool, type AskToolDetails } from "./ask"; export { BashTool, type BashToolDetails, type BashToolOptions } from "./bash"; export { CalculatorTool, type CalculatorToolDetails } from "./calculator"; @@ -60,18 +60,18 @@ export { export { WriteTool, type WriteToolDetails } from "./write"; import type { AgentTool } from "@oh-my-pi/pi-agent-core"; +import type { BashInterceptorRule } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import type { InternalUrlRouter } from "@oh-my-pi/pi-coding-agent/internal-urls"; +import { getPreludeDocs, warmPythonEnvironment } from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import { checkPythonKernelAvailability } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; +import { LspTool } from "@oh-my-pi/pi-coding-agent/lsp/index"; +import { EditTool } from "@oh-my-pi/pi-coding-agent/patch"; +import type { ArtifactManager } from "@oh-my-pi/pi-coding-agent/session/artifacts"; +import { TaskTool } from "@oh-my-pi/pi-coding-agent/task/index"; +import type { AgentOutputManager } from "@oh-my-pi/pi-coding-agent/task/output-manager"; +import type { EventBus } from "@oh-my-pi/pi-coding-agent/utils/event-bus"; +import { WebSearchTool } from "@oh-my-pi/pi-coding-agent/web/search/index"; import { logger } from "@oh-my-pi/pi-utils"; -import type { BashInterceptorRule } from "$c/config/settings-manager"; -import type { InternalUrlRouter } from "$c/internal-urls"; -import { getPreludeDocs, warmPythonEnvironment } from "$c/ipy/executor"; -import { checkPythonKernelAvailability } from "$c/ipy/kernel"; -import { LspTool } from "$c/lsp/index"; -import { EditTool } from "$c/patch"; -import type { ArtifactManager } from "$c/session/artifacts"; -import { TaskTool } from "$c/task/index"; -import type { AgentOutputManager } from "$c/task/output-manager"; -import type { EventBus } from "$c/utils/event-bus"; -import { WebSearchTool } from "$c/web/search/index"; import { AskTool } from "./ask"; import { BashTool } from "./bash"; import { CalculatorTool } from "./calculator"; @@ -119,9 +119,9 @@ export interface ToolSession { /** Get the current session model string, regardless of how it was chosen */ getActiveModelString?: () => string | undefined; /** Auth storage for passing to subagents (avoids re-discovery) */ - authStorage?: import("$c/session/auth-storage").AuthStorage; + authStorage?: import("@oh-my-pi/pi-coding-agent/session/auth-storage").AuthStorage; /** Model registry for passing to subagents (avoids re-discovery) */ - modelRegistry?: import("$c/config/model-registry").ModelRegistry; + modelRegistry?: import("@oh-my-pi/pi-coding-agent/config/model-registry").ModelRegistry; /** MCP manager for proxying MCP calls through parent */ mcpManager?: import("../mcp/manager").MCPManager; /** Internal URL router for agent:// and skill:// URLs */ @@ -129,7 +129,7 @@ export interface ToolSession { /** Agent output manager for unique agent:// IDs across task invocations */ agentOutputManager?: AgentOutputManager; /** Settings manager for passing to subagents (avoids SQLite access in workers) */ - settingsManager?: { serialize: () => import("$c/config/settings-manager").Settings }; + settingsManager?: { serialize: () => import("@oh-my-pi/pi-coding-agent/config/settings-manager").Settings }; /** Settings manager (optional) */ settings?: { getImageAutoResize(): boolean; diff --git a/packages/coding-agent/src/tools/list-limit.ts b/packages/coding-agent/src/tools/list-limit.ts index 2b0faf6a6..5bdcfd15b 100644 --- a/packages/coding-agent/src/tools/list-limit.ts +++ b/packages/coding-agent/src/tools/list-limit.ts @@ -1,4 +1,4 @@ -import type { LimitsMeta } from "$c/tools/output-meta"; +import type { LimitsMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; export interface ListLimitResult { items: T[]; diff --git a/packages/coding-agent/src/tools/ls.ts b/packages/coding-agent/src/tools/ls.ts index 20a0ce00b..bfa1b2166 100644 --- a/packages/coding-agent/src/tools/ls.ts +++ b/packages/coding-agent/src/tools/ls.ts @@ -1,13 +1,13 @@ import nodePath from "node:path"; import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core"; +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { OutputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { ToolError, throwIfAborted } from "@oh-my-pi/pi-coding-agent/tools/tool-errors"; +import { renderFileList, renderStatusLine } from "@oh-my-pi/pi-coding-agent/tui"; import { type Component, Text } from "@oh-my-pi/pi-tui"; import { untilAborted } from "@oh-my-pi/pi-utils"; import { Type } from "@sinclair/typebox"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import type { Theme } from "$c/modes/theme/theme"; -import type { OutputMeta } from "$c/tools/output-meta"; -import { ToolError, throwIfAborted } from "$c/tools/tool-errors"; -import { renderFileList, renderStatusLine } from "$c/tui"; import type { ToolSession } from "./index"; import { applyListLimit } from "./list-limit"; import { resolveToCwd } from "./path-utils"; diff --git a/packages/coding-agent/src/tools/notebook.ts b/packages/coding-agent/src/tools/notebook.ts index 3218a5ae7..6764eeaa1 100644 --- a/packages/coding-agent/src/tools/notebook.ts +++ b/packages/coding-agent/src/tools/notebook.ts @@ -1,13 +1,13 @@ import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import { StringEnum } from "@oh-my-pi/pi-ai"; +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/sdk"; +import { renderCodeCell, renderStatusLine } from "@oh-my-pi/pi-coding-agent/tui"; import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { untilAborted } from "@oh-my-pi/pi-utils"; import { type Static, Type } from "@sinclair/typebox"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import type { Theme } from "$c/modes/theme/theme"; -import type { ToolSession } from "$c/sdk"; -import { renderCodeCell, renderStatusLine } from "$c/tui"; import { resolveToCwd } from "./path-utils"; import { formatCount, formatErrorMessage, PREVIEW_LIMITS } from "./render-utils"; diff --git a/packages/coding-agent/src/tools/output-meta.ts b/packages/coding-agent/src/tools/output-meta.ts index 5d072bd07..d24c489ef 100644 --- a/packages/coding-agent/src/tools/output-meta.ts +++ b/packages/coding-agent/src/tools/output-meta.ts @@ -7,9 +7,9 @@ import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, TextContent } from "@oh-my-pi/pi-ai"; -import type { OutputSummary } from "$c/session/streaming-output"; -import type { TruncationResult } from "$c/tools/truncate"; -import { formatSize } from "$c/tools/truncate"; +import type { OutputSummary } from "@oh-my-pi/pi-coding-agent/session/streaming-output"; +import type { TruncationResult } from "@oh-my-pi/pi-coding-agent/tools/truncate"; +import { formatSize } from "@oh-my-pi/pi-coding-agent/tools/truncate"; import { renderError } from "./tool-errors"; /** diff --git a/packages/coding-agent/src/tools/output-utils.ts b/packages/coding-agent/src/tools/output-utils.ts index 249a7b359..fac106db8 100644 --- a/packages/coding-agent/src/tools/output-utils.ts +++ b/packages/coding-agent/src/tools/output-utils.ts @@ -1,4 +1,4 @@ -import { ArtifactManager } from "$c/session/artifacts"; +import { ArtifactManager } from "@oh-my-pi/pi-coding-agent/session/artifacts"; import type { ToolSession } from "./index"; export interface TailBuffer { diff --git a/packages/coding-agent/src/tools/python.ts b/packages/coding-agent/src/tools/python.ts index a19044c75..81aeb2f25 100644 --- a/packages/coding-agent/src/tools/python.ts +++ b/packages/coding-agent/src/tools/python.ts @@ -1,20 +1,20 @@ import { relative, resolve, sep } from "node:path"; import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import type { ImageContent } from "@oh-my-pi/pi-ai"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import { executePython, getPreludeDocs, type PythonExecutorOptions } from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import type { PreludeHelper, PythonStatusEvent } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; +import { truncateToVisualLines } from "@oh-my-pi/pi-coding-agent/modes/components/visual-truncate"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import pythonDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/python.md" with { type: "text" }; +import { OutputSink, type OutputSummary } from "@oh-my-pi/pi-coding-agent/session/streaming-output"; +import type { OutputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { ToolAbortError, ToolError } from "@oh-my-pi/pi-coding-agent/tools/tool-errors"; +import { getTreeBranch, getTreeContinuePrefix, renderCodeCell } from "@oh-my-pi/pi-coding-agent/tui"; import type { Component } from "@oh-my-pi/pi-tui"; import { Text, truncateToWidth } from "@oh-my-pi/pi-tui"; import { type Static, Type } from "@sinclair/typebox"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import { executePython, getPreludeDocs, type PythonExecutorOptions } from "$c/ipy/executor"; -import type { PreludeHelper, PythonStatusEvent } from "$c/ipy/kernel"; -import { truncateToVisualLines } from "$c/modes/components/visual-truncate"; -import type { Theme } from "$c/modes/theme/theme"; -import pythonDescription from "$c/prompts/tools/python.md" with { type: "text" }; -import { OutputSink, type OutputSummary } from "$c/session/streaming-output"; -import type { OutputMeta } from "$c/tools/output-meta"; -import { ToolAbortError, ToolError } from "$c/tools/tool-errors"; -import { getTreeBranch, getTreeContinuePrefix, renderCodeCell } from "$c/tui"; import type { ToolSession } from "./index"; import { allocateOutputArtifact, createTailBuffer } from "./output-utils"; import { resolveToCwd } from "./path-utils"; @@ -900,7 +900,7 @@ export const pythonToolRenderer = { spinnerFrame: options.spinnerFrame, duration: cell.durationMs, output: outputLines.length > 0 ? outputLines.join("\n") : undefined, - outputMaxLines: previewLines, + outputMaxLines: outputLines.length, codeMaxLines: expanded ? Number.POSITIVE_INFINITY : PYTHON_DEFAULT_PREVIEW_LINES, expanded, width, diff --git a/packages/coding-agent/src/tools/read.ts b/packages/coding-agent/src/tools/read.ts index a709a977c..61800eadf 100644 --- a/packages/coding-agent/src/tools/read.ts +++ b/packages/coding-agent/src/tools/read.ts @@ -2,22 +2,22 @@ import { homedir } from "node:os"; import path from "node:path"; import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, TextContent } from "@oh-my-pi/pi-ai"; +import { CONFIG_DIR_NAME } from "@oh-my-pi/pi-coding-agent/config"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import { getLanguageFromPath, type Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import readDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/read.md" with { type: "text" }; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/sdk"; +import type { OutputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { ToolAbortError, ToolError, throwIfAborted } from "@oh-my-pi/pi-coding-agent/tools/tool-errors"; +import { renderCodeCell, renderOutputBlock, renderStatusLine } from "@oh-my-pi/pi-coding-agent/tui"; +import { formatDimensionNote, resizeImage } from "@oh-my-pi/pi-coding-agent/utils/image-resize"; +import { detectSupportedImageMimeTypeFromFile } from "@oh-my-pi/pi-coding-agent/utils/mime"; +import { ensureTool } from "@oh-my-pi/pi-coding-agent/utils/tools-manager"; import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { ptree } from "@oh-my-pi/pi-utils"; import { Type } from "@sinclair/typebox"; -import { CONFIG_DIR_NAME } from "$c/config"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import { getLanguageFromPath, type Theme } from "$c/modes/theme/theme"; -import readDescription from "$c/prompts/tools/read.md" with { type: "text" }; -import type { ToolSession } from "$c/sdk"; -import type { OutputMeta } from "$c/tools/output-meta"; -import { ToolAbortError, ToolError, throwIfAborted } from "$c/tools/tool-errors"; -import { renderCodeCell, renderOutputBlock, renderStatusLine } from "$c/tui"; -import { formatDimensionNote, resizeImage } from "$c/utils/image-resize"; -import { detectSupportedImageMimeTypeFromFile } from "$c/utils/mime"; -import { ensureTool } from "$c/utils/tools-manager"; import { runFd } from "./find"; import { applyListLimit } from "./list-limit"; import { LsTool } from "./ls"; diff --git a/packages/coding-agent/src/tools/render-utils.ts b/packages/coding-agent/src/tools/render-utils.ts index 24650fbcf..f0b562392 100644 --- a/packages/coding-agent/src/tools/render-utils.ts +++ b/packages/coding-agent/src/tools/render-utils.ts @@ -6,8 +6,8 @@ */ import { homedir } from "node:os"; -import type { Theme } from "$c/modes/theme/theme"; -import { getTreeBranch } from "$c/tui/utils"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import { getTreeBranch } from "@oh-my-pi/pi-coding-agent/tui/utils"; // ============================================================================= // Standardized Display Constants diff --git a/packages/coding-agent/src/tools/renderers.ts b/packages/coding-agent/src/tools/renderers.ts index eecab8144..f73e40d2a 100644 --- a/packages/coding-agent/src/tools/renderers.ts +++ b/packages/coding-agent/src/tools/renderers.ts @@ -4,13 +4,13 @@ * These provide rich visualization for tool calls and results in the TUI. */ +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import { lspToolRenderer } from "@oh-my-pi/pi-coding-agent/lsp/render"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import { editToolRenderer } from "@oh-my-pi/pi-coding-agent/patch"; +import { taskToolRenderer } from "@oh-my-pi/pi-coding-agent/task/render"; +import { webSearchToolRenderer } from "@oh-my-pi/pi-coding-agent/web/search/render"; import type { Component } from "@oh-my-pi/pi-tui"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import { lspToolRenderer } from "$c/lsp/render"; -import type { Theme } from "$c/modes/theme/theme"; -import { editToolRenderer } from "$c/patch"; -import { taskToolRenderer } from "$c/task/render"; -import { webSearchToolRenderer } from "$c/web/search/render"; import { askToolRenderer } from "./ask"; import { bashToolRenderer } from "./bash"; import { calculatorToolRenderer } from "./calculator"; diff --git a/packages/coding-agent/src/tools/review.ts b/packages/coding-agent/src/tools/review.ts index 764e2a0b5..d52dd95de 100644 --- a/packages/coding-agent/src/tools/review.ts +++ b/packages/coding-agent/src/tools/review.ts @@ -7,10 +7,10 @@ */ import type { AgentTool } from "@oh-my-pi/pi-agent-core"; +import type { Theme, ThemeColor } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import type { Component } from "@oh-my-pi/pi-tui"; import { Container, Text } from "@oh-my-pi/pi-tui"; import { Type } from "@sinclair/typebox"; -import type { Theme, ThemeColor } from "$c/modes/theme/theme"; export type FindingPriority = "P0" | "P1" | "P2" | "P3"; @@ -151,7 +151,7 @@ export type { ReportFindingDetails }; import path from "node:path"; import { StringEnum } from "@oh-my-pi/pi-ai"; -import { subprocessToolRegistry } from "$c/task/subprocess-tool-registry"; +import { subprocessToolRegistry } from "@oh-my-pi/pi-coding-agent/task/subprocess-tool-registry"; // Register report_finding handler subprocessToolRegistry.register("report_finding", { diff --git a/packages/coding-agent/src/tools/ssh.ts b/packages/coding-agent/src/tools/ssh.ts index 929f95459..28fe8b231 100644 --- a/packages/coding-agent/src/tools/ssh.ts +++ b/packages/coding-agent/src/tools/ssh.ts @@ -1,20 +1,20 @@ import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; +import type { SSHHost } from "@oh-my-pi/pi-coding-agent/capability/ssh"; +import { sshCapability } from "@oh-my-pi/pi-coding-agent/capability/ssh"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import { loadCapability } from "@oh-my-pi/pi-coding-agent/discovery/index"; +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import sshDescriptionBase from "@oh-my-pi/pi-coding-agent/prompts/tools/ssh.md" with { type: "text" }; +import type { SSHHostInfo } from "@oh-my-pi/pi-coding-agent/ssh/connection-manager"; +import { ensureHostInfo, getHostInfoForHost } from "@oh-my-pi/pi-coding-agent/ssh/connection-manager"; +import { executeSSH } from "@oh-my-pi/pi-coding-agent/ssh/ssh-executor"; +import type { OutputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { ToolError } from "@oh-my-pi/pi-coding-agent/tools/tool-errors"; +import { renderOutputBlock, renderStatusLine } from "@oh-my-pi/pi-coding-agent/tui"; import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { Type } from "@sinclair/typebox"; -import type { SSHHost } from "$c/capability/ssh"; -import { sshCapability } from "$c/capability/ssh"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import { loadCapability } from "$c/discovery/index"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import type { Theme } from "$c/modes/theme/theme"; -import sshDescriptionBase from "$c/prompts/tools/ssh.md" with { type: "text" }; -import type { SSHHostInfo } from "$c/ssh/connection-manager"; -import { ensureHostInfo, getHostInfoForHost } from "$c/ssh/connection-manager"; -import { executeSSH } from "$c/ssh/ssh-executor"; -import type { OutputMeta } from "$c/tools/output-meta"; -import { ToolError } from "$c/tools/tool-errors"; -import { renderOutputBlock, renderStatusLine } from "$c/tui"; import type { ToolSession } from "./index"; import { allocateOutputArtifact, createTailBuffer } from "./output-utils"; import { formatBytes, wrapBrackets } from "./render-utils"; diff --git a/packages/coding-agent/src/tools/todo-write.ts b/packages/coding-agent/src/tools/todo-write.ts index 9b9a8d5ff..73a15a482 100644 --- a/packages/coding-agent/src/tools/todo-write.ts +++ b/packages/coding-agent/src/tools/todo-write.ts @@ -2,17 +2,17 @@ import { randomUUID } from "node:crypto"; import path from "node:path"; import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import { StringEnum } from "@oh-my-pi/pi-ai"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import todoWriteDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/todo-write.md" with { type: "text" }; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/sdk"; +import { renderStatusLine, renderTreeList } from "@oh-my-pi/pi-coding-agent/tui"; import type { Component } from "@oh-my-pi/pi-tui"; import { Text } from "@oh-my-pi/pi-tui"; import { logger } from "@oh-my-pi/pi-utils"; import { Type } from "@sinclair/typebox"; import chalk from "chalk"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import type { Theme } from "$c/modes/theme/theme"; -import todoWriteDescription from "$c/prompts/tools/todo-write.md" with { type: "text" }; -import type { ToolSession } from "$c/sdk"; -import { renderStatusLine, renderTreeList } from "$c/tui"; import { PREVIEW_LIMITS } from "./render-utils"; const todoWriteSchema = Type.Object({ diff --git a/packages/coding-agent/src/tools/tool-result.ts b/packages/coding-agent/src/tools/tool-result.ts index fecaf0ce1..f67babe5d 100644 --- a/packages/coding-agent/src/tools/tool-result.ts +++ b/packages/coding-agent/src/tools/tool-result.ts @@ -1,13 +1,13 @@ import type { AgentToolResult } from "@oh-my-pi/pi-agent-core"; import type { ImageContent, TextContent } from "@oh-my-pi/pi-ai"; -import type { OutputSummary } from "$c/session/streaming-output"; +import type { OutputSummary } from "@oh-my-pi/pi-coding-agent/session/streaming-output"; import type { OutputMeta, TruncationOptions, TruncationSummaryOptions, TruncationTextOptions, -} from "$c/tools/output-meta"; -import { outputMeta } from "$c/tools/output-meta"; +} from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { outputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; import type { TruncationResult } from "./truncate"; type ToolContent = Array; diff --git a/packages/coding-agent/src/tools/write.ts b/packages/coding-agent/src/tools/write.ts index 6e578fa14..72a16e7e4 100644 --- a/packages/coding-agent/src/tools/write.ts +++ b/packages/coding-agent/src/tools/write.ts @@ -5,23 +5,23 @@ import type { AgentToolUpdateCallback, ToolCallContext, } from "@oh-my-pi/pi-agent-core"; -import type { Component } from "@oh-my-pi/pi-tui"; -import { Text } from "@oh-my-pi/pi-tui"; -import { untilAborted } from "@oh-my-pi/pi-utils"; -import { Type } from "@sinclair/typebox"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; import { createLspWritethrough, type FileDiagnosticsResult, type WritethroughCallback, writethroughNoop, -} from "$c/lsp/index"; -import { getLanguageFromPath, type Theme } from "$c/modes/theme/theme"; -import writeDescription from "$c/prompts/tools/write.md" with { type: "text" }; -import type { ToolSession } from "$c/sdk"; -import { type OutputMeta, outputMeta } from "$c/tools/output-meta"; -import { renderCodeCell, renderStatusLine } from "$c/tui"; +} from "@oh-my-pi/pi-coding-agent/lsp/index"; +import { getLanguageFromPath, type Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import writeDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/write.md" with { type: "text" }; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/sdk"; +import { type OutputMeta, outputMeta } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { renderCodeCell, renderStatusLine } from "@oh-my-pi/pi-coding-agent/tui"; +import type { Component } from "@oh-my-pi/pi-tui"; +import { Text } from "@oh-my-pi/pi-tui"; +import { untilAborted } from "@oh-my-pi/pi-utils"; +import { Type } from "@sinclair/typebox"; import { resolveToCwd } from "./path-utils"; import { formatDiagnostics, shortenPath } from "./render-utils"; import type { RenderCallOptions } from "./renderers"; diff --git a/packages/coding-agent/src/tui/code-cell.ts b/packages/coding-agent/src/tui/code-cell.ts index 43a1f6d73..b13d1d076 100644 --- a/packages/coding-agent/src/tui/code-cell.ts +++ b/packages/coding-agent/src/tui/code-cell.ts @@ -2,8 +2,13 @@ * Render a code cell with optional output section. */ -import { highlightCode, type Theme } from "$c/modes/theme/theme"; -import { formatDuration, formatExpandHint, formatMoreItems, replaceTabs } from "$c/tools/render-utils"; +import { highlightCode, type Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import { + formatDuration, + formatExpandHint, + formatMoreItems, + replaceTabs, +} from "@oh-my-pi/pi-coding-agent/tools/render-utils"; import { renderOutputBlock } from "./output-block"; import type { State } from "./types"; import { getStateIcon } from "./utils"; diff --git a/packages/coding-agent/src/tui/file-list.ts b/packages/coding-agent/src/tui/file-list.ts index f6d715299..3edd296b0 100644 --- a/packages/coding-agent/src/tui/file-list.ts +++ b/packages/coding-agent/src/tui/file-list.ts @@ -2,8 +2,8 @@ * Render file listings with optional icons and metadata. */ -import type { Theme } from "$c/modes/theme/theme"; -import { getLanguageFromPath } from "$c/modes/theme/theme"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import { getLanguageFromPath } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { renderTreeList } from "./tree-list"; export interface FileEntry { diff --git a/packages/coding-agent/src/tui/output-block.ts b/packages/coding-agent/src/tui/output-block.ts index 79d130d80..82d541436 100644 --- a/packages/coding-agent/src/tui/output-block.ts +++ b/packages/coding-agent/src/tui/output-block.ts @@ -2,8 +2,8 @@ * Bordered output container with optional header and sections. */ +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { visibleWidth } from "@oh-my-pi/pi-tui"; -import type { Theme } from "$c/modes/theme/theme"; import type { State } from "./types"; import { getStateBgColor, padToWidth, truncateToWidth } from "./utils"; diff --git a/packages/coding-agent/src/tui/status-line.ts b/packages/coding-agent/src/tui/status-line.ts index 99438db25..061cc5135 100644 --- a/packages/coding-agent/src/tui/status-line.ts +++ b/packages/coding-agent/src/tui/status-line.ts @@ -2,7 +2,7 @@ * Standardized status header rendering for tool output. */ -import type { Theme, ThemeColor } from "$c/modes/theme/theme"; +import type { Theme, ThemeColor } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import type { IconType } from "./types"; import { getStateIcon } from "./utils"; diff --git a/packages/coding-agent/src/tui/tree-list.ts b/packages/coding-agent/src/tui/tree-list.ts index 44a5e79f0..464461e45 100644 --- a/packages/coding-agent/src/tui/tree-list.ts +++ b/packages/coding-agent/src/tui/tree-list.ts @@ -2,8 +2,8 @@ * Hierarchical tree list rendering helper. */ -import type { Theme } from "$c/modes/theme/theme"; -import { formatMoreItems } from "$c/tools/render-utils"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import { formatMoreItems } from "@oh-my-pi/pi-coding-agent/tools/render-utils"; import type { TreeContext } from "./types"; import { getTreeBranch, getTreeContinuePrefix } from "./utils"; diff --git a/packages/coding-agent/src/tui/types.ts b/packages/coding-agent/src/tui/types.ts index 29ca95033..ee983dc03 100644 --- a/packages/coding-agent/src/tui/types.ts +++ b/packages/coding-agent/src/tui/types.ts @@ -2,7 +2,7 @@ * Shared types for TUI rendering components. */ -import type { Theme } from "$c/modes/theme/theme"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; export type State = "pending" | "running" | "success" | "error" | "warning"; export type IconType = "success" | "error" | "running" | "pending" | "warning" | "info"; diff --git a/packages/coding-agent/src/tui/utils.ts b/packages/coding-agent/src/tui/utils.ts index 35ff46127..a297bc02a 100644 --- a/packages/coding-agent/src/tui/utils.ts +++ b/packages/coding-agent/src/tui/utils.ts @@ -2,8 +2,8 @@ * Shared helpers for tool-rendered UI components. */ +import type { Theme, ThemeBg } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { truncateToWidth as truncateToWidthBase, visibleWidth } from "@oh-my-pi/pi-tui"; -import type { Theme, ThemeBg } from "$c/modes/theme/theme"; import type { IconType, State } from "./types"; export function buildTreePrefix(ancestors: boolean[], theme: Theme): string { diff --git a/packages/coding-agent/src/utils/changelog.ts b/packages/coding-agent/src/utils/changelog.ts index a420cf626..1589ca8e6 100644 --- a/packages/coding-agent/src/utils/changelog.ts +++ b/packages/coding-agent/src/utils/changelog.ts @@ -96,4 +96,4 @@ export function getNewEntries(entries: ChangelogEntry[], lastVersion: string): C } // Re-export getChangelogPath from paths.ts for convenience -export { getChangelogPath } from "$c/config"; +export { getChangelogPath } from "@oh-my-pi/pi-coding-agent/config"; diff --git a/packages/coding-agent/src/utils/file-mentions.ts b/packages/coding-agent/src/utils/file-mentions.ts index 48828683f..04694f60a 100644 --- a/packages/coding-agent/src/utils/file-mentions.ts +++ b/packages/coding-agent/src/utils/file-mentions.ts @@ -8,10 +8,15 @@ import path from "node:path"; import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; -import type { FileMentionMessage } from "$c/session/messages"; -import { resolveReadPath } from "$c/tools/path-utils"; -import { formatAge } from "$c/tools/render-utils"; -import { DEFAULT_MAX_BYTES, formatSize, truncateHead, truncateStringToBytesFromStart } from "$c/tools/truncate"; +import type { FileMentionMessage } from "@oh-my-pi/pi-coding-agent/session/messages"; +import { resolveReadPath } from "@oh-my-pi/pi-coding-agent/tools/path-utils"; +import { formatAge } from "@oh-my-pi/pi-coding-agent/tools/render-utils"; +import { + DEFAULT_MAX_BYTES, + formatSize, + truncateHead, + truncateStringToBytesFromStart, +} from "@oh-my-pi/pi-coding-agent/tools/truncate"; /** Regex to match @filepath patterns in text */ const FILE_MENTION_REGEX = /@([^\s@]+)/g; diff --git a/packages/coding-agent/src/utils/image-convert.ts b/packages/coding-agent/src/utils/image-convert.ts index 014564017..d5ddb0e86 100644 --- a/packages/coding-agent/src/utils/image-convert.ts +++ b/packages/coding-agent/src/utils/image-convert.ts @@ -1,4 +1,4 @@ -import * as photon from "$c/vendor/photon"; +import * as photon from "@oh-my-pi/pi-coding-agent/vendor/photon"; /** * Convert image to PNG format for terminal display. diff --git a/packages/coding-agent/src/utils/image-resize.ts b/packages/coding-agent/src/utils/image-resize.ts index 725a6dd34..bb7d1e2e5 100644 --- a/packages/coding-agent/src/utils/image-resize.ts +++ b/packages/coding-agent/src/utils/image-resize.ts @@ -1,5 +1,5 @@ import type { ImageContent } from "@oh-my-pi/pi-ai"; -import * as photon from "$c/vendor/photon"; +import * as photon from "@oh-my-pi/pi-coding-agent/vendor/photon"; export interface ImageResizeOptions { maxWidth?: number; // Default: 2000 diff --git a/packages/coding-agent/src/utils/shell.ts b/packages/coding-agent/src/utils/shell.ts index a5309ea40..c43b5632d 100644 --- a/packages/coding-agent/src/utils/shell.ts +++ b/packages/coding-agent/src/utils/shell.ts @@ -1,7 +1,7 @@ import { constants } from "node:fs"; import { access } from "node:fs/promises"; +import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; import { $ } from "bun"; -import { SettingsManager } from "$c/config/settings-manager"; export interface ShellConfig { shell: string; diff --git a/packages/coding-agent/src/utils/title-generator.ts b/packages/coding-agent/src/utils/title-generator.ts index 408e4bcc1..8c7c8e3f9 100644 --- a/packages/coding-agent/src/utils/title-generator.ts +++ b/packages/coding-agent/src/utils/title-generator.ts @@ -4,11 +4,11 @@ import type { Api, Model } from "@oh-my-pi/pi-ai"; import { completeSimple } from "@oh-my-pi/pi-ai"; +import type { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { parseModelString, SMOL_MODEL_PRIORITY } from "@oh-my-pi/pi-coding-agent/config/model-resolver"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import titleSystemPrompt from "@oh-my-pi/pi-coding-agent/prompts/system/title-system.md" with { type: "text" }; import { logger } from "@oh-my-pi/pi-utils"; -import type { ModelRegistry } from "$c/config/model-registry"; -import { parseModelString, SMOL_MODEL_PRIORITY } from "$c/config/model-resolver"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import titleSystemPrompt from "$c/prompts/system/title-system.md" with { type: "text" }; const TITLE_SYSTEM_PROMPT = renderPromptTemplate(titleSystemPrompt); diff --git a/packages/coding-agent/src/utils/tools-manager.ts b/packages/coding-agent/src/utils/tools-manager.ts index 8c194f745..bc2453b8f 100644 --- a/packages/coding-agent/src/utils/tools-manager.ts +++ b/packages/coding-agent/src/utils/tools-manager.ts @@ -1,9 +1,9 @@ import { chmod, mkdir, rename, rm } from "node:fs/promises"; import { arch, platform } from "node:os"; import { join } from "node:path"; +import { APP_NAME, getBinDir } from "@oh-my-pi/pi-coding-agent/config"; import { createTempDir, logger } from "@oh-my-pi/pi-utils"; import { $ } from "bun"; -import { APP_NAME, getBinDir } from "$c/config"; const TOOLS_DIR = getBinDir(); diff --git a/packages/coding-agent/src/web/scrapers/choosealicense.ts b/packages/coding-agent/src/web/scrapers/choosealicense.ts index 07944af0f..ca3875e27 100644 --- a/packages/coding-agent/src/web/scrapers/choosealicense.ts +++ b/packages/coding-agent/src/web/scrapers/choosealicense.ts @@ -1,4 +1,4 @@ -import { parseFrontmatter } from "$c/utils/frontmatter"; +import { parseFrontmatter } from "@oh-my-pi/pi-coding-agent/utils/frontmatter"; import type { RenderResult, SpecialHandler } from "./types"; import { finalizeOutput, loadPage } from "./types"; diff --git a/packages/coding-agent/src/web/scrapers/twitter.ts b/packages/coding-agent/src/web/scrapers/twitter.ts index c422e6b74..90e689e6d 100644 --- a/packages/coding-agent/src/web/scrapers/twitter.ts +++ b/packages/coding-agent/src/web/scrapers/twitter.ts @@ -1,5 +1,5 @@ +import { ToolAbortError } from "@oh-my-pi/pi-coding-agent/tools/tool-errors"; import { parse as parseHtml } from "node-html-parser"; -import { ToolAbortError } from "$c/tools/tool-errors"; import type { RenderResult, SpecialHandler } from "./types"; import { finalizeOutput, loadPage } from "./types"; diff --git a/packages/coding-agent/src/web/scrapers/types.ts b/packages/coding-agent/src/web/scrapers/types.ts index a298c1ece..8eaf95d27 100644 --- a/packages/coding-agent/src/web/scrapers/types.ts +++ b/packages/coding-agent/src/web/scrapers/types.ts @@ -2,7 +2,7 @@ * Shared types and utilities for web-fetch handlers */ -import { ToolAbortError } from "$c/tools/tool-errors"; +import { ToolAbortError } from "@oh-my-pi/pi-coding-agent/tools/tool-errors"; export interface RenderResult { url: string; diff --git a/packages/coding-agent/src/web/scrapers/utils.ts b/packages/coding-agent/src/web/scrapers/utils.ts index 6acaf9fca..5c19baa2e 100644 --- a/packages/coding-agent/src/web/scrapers/utils.ts +++ b/packages/coding-agent/src/web/scrapers/utils.ts @@ -1,9 +1,9 @@ import { rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import * as path from "node:path"; +import { ensureTool } from "@oh-my-pi/pi-coding-agent/utils/tools-manager"; import { ptree } from "@oh-my-pi/pi-utils"; import { nanoid } from "nanoid"; -import { ensureTool } from "$c/utils/tools-manager"; import { createRequestSignal } from "./types"; const MAX_BYTES = 50 * 1024 * 1024; // 50MB for binary files diff --git a/packages/coding-agent/src/web/scrapers/youtube.ts b/packages/coding-agent/src/web/scrapers/youtube.ts index aa310660f..97b4d4e45 100644 --- a/packages/coding-agent/src/web/scrapers/youtube.ts +++ b/packages/coding-agent/src/web/scrapers/youtube.ts @@ -1,10 +1,10 @@ import { unlinkSync } from "node:fs"; import { tmpdir } from "node:os"; import path from "node:path"; +import { throwIfAborted } from "@oh-my-pi/pi-coding-agent/tools/tool-errors"; +import { ensureTool } from "@oh-my-pi/pi-coding-agent/utils/tools-manager"; import { cspawn } from "@oh-my-pi/pi-utils"; import { nanoid } from "nanoid"; -import { throwIfAborted } from "$c/tools/tool-errors"; -import { ensureTool } from "$c/utils/tools-manager"; import type { RenderResult, SpecialHandler } from "./types"; import { finalizeOutput } from "./types"; diff --git a/packages/coding-agent/src/web/search/auth.ts b/packages/coding-agent/src/web/search/auth.ts index 5a4626bd2..4b71e9353 100644 --- a/packages/coding-agent/src/web/search/auth.ts +++ b/packages/coding-agent/src/web/search/auth.ts @@ -11,11 +11,15 @@ import * as os from "node:os"; import * as path from "node:path"; import { buildAnthropicHeaders as buildProviderAnthropicHeaders } from "@oh-my-pi/pi-ai"; +import { getAgentDbPath, getConfigDirPaths } from "@oh-my-pi/pi-coding-agent/config"; +import { AgentStorage } from "@oh-my-pi/pi-coding-agent/session/agent-storage"; +import type { + AuthCredential, + AuthCredentialEntry, + AuthStorageData, +} from "@oh-my-pi/pi-coding-agent/session/auth-storage"; +import { migrateJsonStorage } from "@oh-my-pi/pi-coding-agent/session/storage-migration"; import { logger } from "@oh-my-pi/pi-utils"; -import { getAgentDbPath, getConfigDirPaths } from "$c/config"; -import { AgentStorage } from "$c/session/agent-storage"; -import type { AuthCredential, AuthCredentialEntry, AuthStorageData } from "$c/session/auth-storage"; -import { migrateJsonStorage } from "$c/session/storage-migration"; import type { AnthropicAuthConfig, AnthropicOAuthCredential, ModelsJson } from "./types"; const DEFAULT_BASE_URL = "https://api.anthropic.com"; diff --git a/packages/coding-agent/src/web/search/index.ts b/packages/coding-agent/src/web/search/index.ts index 2363dc11a..e91f8c239 100644 --- a/packages/coding-agent/src/web/search/index.ts +++ b/packages/coding-agent/src/web/search/index.ts @@ -14,17 +14,26 @@ import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import { StringEnum } from "@oh-my-pi/pi-ai"; +import { renderPromptTemplate } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; +import { + callExaTool, + findApiKey as findExaKey, + formatSearchResults, + isSearchResponse, +} from "@oh-my-pi/pi-coding-agent/exa/mcp-client"; +import { renderExaCall, renderExaResult } from "@oh-my-pi/pi-coding-agent/exa/render"; +import type { ExaRenderDetails } from "@oh-my-pi/pi-coding-agent/exa/types"; +import type { + CustomTool, + CustomToolContext, + RenderResultOptions, +} from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import webSearchSystemPrompt from "@oh-my-pi/pi-coding-agent/prompts/system/web-search.md" with { type: "text" }; +import webSearchDescription from "@oh-my-pi/pi-coding-agent/prompts/tools/web-search.md" with { type: "text" }; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { formatAge } from "@oh-my-pi/pi-coding-agent/tools/render-utils"; import { Type } from "@sinclair/typebox"; -import { renderPromptTemplate } from "$c/config/prompt-templates"; -import { callExaTool, findApiKey as findExaKey, formatSearchResults, isSearchResponse } from "$c/exa/mcp-client"; -import { renderExaCall, renderExaResult } from "$c/exa/render"; -import type { ExaRenderDetails } from "$c/exa/types"; -import type { CustomTool, CustomToolContext, RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import type { Theme } from "$c/modes/theme/theme"; -import webSearchSystemPrompt from "$c/prompts/system/web-search.md" with { type: "text" }; -import webSearchDescription from "$c/prompts/tools/web-search.md" with { type: "text" }; -import type { ToolSession } from "$c/tools/index"; -import { formatAge } from "$c/tools/render-utils"; import { findAnthropicAuth } from "./auth"; import { searchAnthropic } from "./providers/anthropic"; import { searchExa } from "./providers/exa"; diff --git a/packages/coding-agent/src/web/search/providers/anthropic.ts b/packages/coding-agent/src/web/search/providers/anthropic.ts index 259384aae..435eaceb8 100644 --- a/packages/coding-agent/src/web/search/providers/anthropic.ts +++ b/packages/coding-agent/src/web/search/providers/anthropic.ts @@ -6,7 +6,12 @@ */ import { applyClaudeToolPrefix, buildAnthropicSystemBlocks, stripClaudeToolPrefix } from "@oh-my-pi/pi-ai"; -import { buildAnthropicHeaders, buildAnthropicUrl, findAnthropicAuth, getEnv } from "$c/web/search/auth"; +import { + buildAnthropicHeaders, + buildAnthropicUrl, + findAnthropicAuth, + getEnv, +} from "@oh-my-pi/pi-coding-agent/web/search/auth"; import type { AnthropicApiResponse, AnthropicAuthConfig, @@ -14,8 +19,8 @@ import type { WebSearchCitation, WebSearchResponse, WebSearchSource, -} from "$c/web/search/types"; -import { WebSearchProviderError } from "$c/web/search/types"; +} from "@oh-my-pi/pi-coding-agent/web/search/types"; +import { WebSearchProviderError } from "@oh-my-pi/pi-coding-agent/web/search/types"; const DEFAULT_MODEL = "claude-haiku-4-5"; const DEFAULT_MAX_TOKENS = 4096; diff --git a/packages/coding-agent/src/web/search/providers/exa.ts b/packages/coding-agent/src/web/search/providers/exa.ts index 35ce12d0e..09177097d 100644 --- a/packages/coding-agent/src/web/search/providers/exa.ts +++ b/packages/coding-agent/src/web/search/providers/exa.ts @@ -7,8 +7,8 @@ import { existsSync, readFileSync } from "node:fs"; import { homedir } from "node:os"; -import type { WebSearchResponse, WebSearchSource } from "$c/web/search/types"; -import { WebSearchProviderError } from "$c/web/search/types"; +import type { WebSearchResponse, WebSearchSource } from "@oh-my-pi/pi-coding-agent/web/search/types"; +import { WebSearchProviderError } from "@oh-my-pi/pi-coding-agent/web/search/types"; const EXA_API_URL = "https://api.exa.ai/search"; diff --git a/packages/coding-agent/src/web/search/providers/perplexity.ts b/packages/coding-agent/src/web/search/providers/perplexity.ts index 00c7542f0..505573a73 100644 --- a/packages/coding-agent/src/web/search/providers/perplexity.ts +++ b/packages/coding-agent/src/web/search/providers/perplexity.ts @@ -12,8 +12,8 @@ import type { WebSearchCitation, WebSearchResponse, WebSearchSource, -} from "$c/web/search/types"; -import { WebSearchProviderError } from "$c/web/search/types"; +} from "@oh-my-pi/pi-coding-agent/web/search/types"; +import { WebSearchProviderError } from "@oh-my-pi/pi-coding-agent/web/search/types"; const PERPLEXITY_API_URL = "https://api.perplexity.ai/chat/completions"; diff --git a/packages/coding-agent/src/web/search/render.ts b/packages/coding-agent/src/web/search/render.ts index c10520345..64a4f245c 100644 --- a/packages/coding-agent/src/web/search/render.ts +++ b/packages/coding-agent/src/web/search/render.ts @@ -4,10 +4,8 @@ * Tree-based rendering with collapsed/expanded states for web search results. */ -import type { Component } from "@oh-my-pi/pi-tui"; -import { Text } from "@oh-my-pi/pi-tui"; -import type { RenderResultOptions } from "$c/extensibility/custom-tools/types"; -import type { Theme } from "$c/modes/theme/theme"; +import type { RenderResultOptions } from "@oh-my-pi/pi-coding-agent/extensibility/custom-tools/types"; +import type { Theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { formatAge, formatCount, @@ -19,8 +17,10 @@ import { PREVIEW_LIMITS, TRUNCATE_LENGTHS, truncate, -} from "$c/tools/render-utils"; -import { renderOutputBlock, renderStatusLine, renderTreeList } from "$c/tui"; +} from "@oh-my-pi/pi-coding-agent/tools/render-utils"; +import { renderOutputBlock, renderStatusLine, renderTreeList } from "@oh-my-pi/pi-coding-agent/tui"; +import type { Component } from "@oh-my-pi/pi-tui"; +import { Text } from "@oh-my-pi/pi-tui"; import type { WebSearchResponse } from "./types"; const MAX_COLLAPSED_ANSWER_LINES = PREVIEW_LIMITS.COLLAPSED_LINES; diff --git a/packages/coding-agent/test/agent-session-branching.test.ts b/packages/coding-agent/test/agent-session-branching.test.ts index 94042c8e8..e1016899d 100644 --- a/packages/coding-agent/test/agent-session-branching.test.ts +++ b/packages/coding-agent/test/agent-session-branching.test.ts @@ -13,13 +13,13 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import { Agent } from "@oh-my-pi/pi-agent-core"; import { getModel } from "@oh-my-pi/pi-ai"; +import { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; import { nanoid } from "nanoid"; -import { ModelRegistry } from "$c/config/model-registry"; -import { SettingsManager } from "$c/config/settings-manager"; -import { AgentSession } from "$c/session/agent-session"; -import { AuthStorage } from "$c/session/auth-storage"; -import { SessionManager } from "$c/session/session-manager"; -import { createTools, type ToolSession } from "$c/tools/index"; import { API_KEY } from "./utilities"; describe.skipIf(!API_KEY)("AgentSession branching", () => { diff --git a/packages/coding-agent/test/agent-session-compaction.test.ts b/packages/coding-agent/test/agent-session-compaction.test.ts index 560bbfe84..994053d4c 100644 --- a/packages/coding-agent/test/agent-session-compaction.test.ts +++ b/packages/coding-agent/test/agent-session-compaction.test.ts @@ -13,13 +13,13 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import { Agent } from "@oh-my-pi/pi-agent-core"; import { getModel } from "@oh-my-pi/pi-ai"; +import { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { AgentSession, type AgentSessionEvent } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; import { nanoid } from "nanoid"; -import { ModelRegistry } from "$c/config/model-registry"; -import { SettingsManager } from "$c/config/settings-manager"; -import { AgentSession, type AgentSessionEvent } from "$c/session/agent-session"; -import { AuthStorage } from "$c/session/auth-storage"; -import { SessionManager } from "$c/session/session-manager"; -import { createTools, type ToolSession } from "$c/tools/index"; import { API_KEY } from "./utilities"; describe.skipIf(!API_KEY)("AgentSession compaction e2e", () => { diff --git a/packages/coding-agent/test/agent-session-concurrent.test.ts b/packages/coding-agent/test/agent-session-concurrent.test.ts index 84e9e4f7a..91b7ae4d9 100644 --- a/packages/coding-agent/test/agent-session-concurrent.test.ts +++ b/packages/coding-agent/test/agent-session-concurrent.test.ts @@ -8,12 +8,12 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import { Agent } from "@oh-my-pi/pi-agent-core"; import { type AssistantMessage, type AssistantMessageEvent, EventStream, getModel } from "@oh-my-pi/pi-ai"; +import { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { nanoid } from "nanoid"; -import { ModelRegistry } from "$c/config/model-registry"; -import { SettingsManager } from "$c/config/settings-manager"; -import { AgentSession } from "$c/session/agent-session"; -import { AuthStorage } from "$c/session/auth-storage"; -import { SessionManager } from "$c/session/session-manager"; // Mock stream that mimics AssistantMessageEventStream class MockAssistantStream extends EventStream { diff --git a/packages/coding-agent/test/args.test.ts b/packages/coding-agent/test/args.test.ts index 87bcee8de..bcadb645e 100644 --- a/packages/coding-agent/test/args.test.ts +++ b/packages/coding-agent/test/args.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test"; -import { parseArgs } from "$c/cli/args"; +import { parseArgs } from "@oh-my-pi/pi-coding-agent/cli/args"; describe("parseArgs", () => { describe("--version flag", () => { diff --git a/packages/coding-agent/test/block-images.test.ts b/packages/coding-agent/test/block-images.test.ts index 7ca8a44ad..6e96649dd 100644 --- a/packages/coding-agent/test/block-images.test.ts +++ b/packages/coding-agent/test/block-images.test.ts @@ -2,10 +2,10 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; import { mkdirSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { processFileArguments } from "$c/cli/file-processor"; -import { SettingsManager } from "$c/config/settings-manager"; -import type { ToolSession } from "$c/tools/index"; -import { ReadTool } from "$c/tools/read"; +import { processFileArguments } from "@oh-my-pi/pi-coding-agent/cli/file-processor"; +import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { ReadTool } from "@oh-my-pi/pi-coding-agent/tools/read"; // 1x1 red PNG image as base64 (smallest valid PNG) const TINY_PNG_BASE64 = diff --git a/packages/coding-agent/test/compaction-hooks-example.test.ts b/packages/coding-agent/test/compaction-hooks-example.test.ts index 75ffeb4d1..f007db321 100644 --- a/packages/coding-agent/test/compaction-hooks-example.test.ts +++ b/packages/coding-agent/test/compaction-hooks-example.test.ts @@ -3,7 +3,11 @@ */ import { describe, expect, it } from "bun:test"; -import type { HookAPI, SessionBeforeCompactEvent, SessionCompactEvent } from "$c/extensibility/hooks/index"; +import type { + HookAPI, + SessionBeforeCompactEvent, + SessionCompactEvent, +} from "@oh-my-pi/pi-coding-agent/extensibility/hooks/index"; describe("Documentation example", () => { it("custom compaction example should type-check correctly", () => { diff --git a/packages/coding-agent/test/compaction-hooks.test.ts b/packages/coding-agent/test/compaction-hooks.test.ts index bf9f0620a..6443032f2 100644 --- a/packages/coding-agent/test/compaction-hooks.test.ts +++ b/packages/coding-agent/test/compaction-hooks.test.ts @@ -8,21 +8,21 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import { Agent } from "@oh-my-pi/pi-agent-core"; import { getModel } from "@oh-my-pi/pi-ai"; -import { nanoid } from "nanoid"; -import { ModelRegistry } from "$c/config/model-registry"; -import { SettingsManager } from "$c/config/settings-manager"; +import { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; import { HookRunner, type LoadedHook, type SessionBeforeCompactEvent, type SessionCompactEvent, type SessionEvent, -} from "$c/extensibility/hooks/index"; -import { theme } from "$c/modes/theme/theme"; -import { AgentSession } from "$c/session/agent-session"; -import { AuthStorage } from "$c/session/auth-storage"; -import { SessionManager } from "$c/session/session-manager"; -import { createTools, type ToolSession } from "$c/tools/index"; +} from "@oh-my-pi/pi-coding-agent/extensibility/hooks/index"; +import { theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { nanoid } from "nanoid"; const API_KEY = process.env.ANTHROPIC_OAUTH_TOKEN || process.env.ANTHROPIC_API_KEY; diff --git a/packages/coding-agent/test/compaction-thinking-model.test.ts b/packages/coding-agent/test/compaction-thinking-model.test.ts index 151fda739..00cf6a6ed 100644 --- a/packages/coding-agent/test/compaction-thinking-model.test.ts +++ b/packages/coding-agent/test/compaction-thinking-model.test.ts @@ -14,13 +14,13 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import { Agent, type ThinkingLevel } from "@oh-my-pi/pi-agent-core"; import { getModel, type Model } from "@oh-my-pi/pi-ai"; +import { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; import { nanoid } from "nanoid"; -import { ModelRegistry } from "$c/config/model-registry"; -import { SettingsManager } from "$c/config/settings-manager"; -import { AgentSession } from "$c/session/agent-session"; -import { AuthStorage } from "$c/session/auth-storage"; -import { SessionManager } from "$c/session/session-manager"; -import { createTools, type ToolSession } from "$c/tools/index"; import { API_KEY } from "./utilities"; // Check for auth diff --git a/packages/coding-agent/test/compaction.test.ts b/packages/coding-agent/test/compaction.test.ts index 37367dc8d..05fe5804b 100644 --- a/packages/coding-agent/test/compaction.test.ts +++ b/packages/coding-agent/test/compaction.test.ts @@ -13,7 +13,7 @@ import { getLastAssistantUsage, prepareCompaction, shouldCompact, -} from "$c/session/compaction/index"; +} from "@oh-my-pi/pi-coding-agent/session/compaction/index"; import { buildSessionContext, type CompactionEntry, @@ -23,7 +23,7 @@ import { type SessionEntry, type SessionMessageEntry, type ThinkingLevelChangeEntry, -} from "$c/session/session-manager"; +} from "@oh-my-pi/pi-coding-agent/session/session-manager"; // ============================================================================ // Test fixtures diff --git a/packages/coding-agent/test/core/apply-patch-adverserial.test.ts b/packages/coding-agent/test/core/apply-patch-adverserial.test.ts index 542eb8dde..4a41abedf 100644 --- a/packages/coding-agent/test/core/apply-patch-adverserial.test.ts +++ b/packages/coding-agent/test/core/apply-patch-adverserial.test.ts @@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, test } from "bun:test"; import { mkdirSync, readFileSync, rmSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { ApplyPatchError, applyPatch } from "$c/patch"; +import { ApplyPatchError, applyPatch } from "@oh-my-pi/pi-coding-agent/patch"; describe("applyPatch adversarial inputs", () => { let tempDir: string; diff --git a/packages/coding-agent/test/core/apply-patch-regression.test.ts b/packages/coding-agent/test/core/apply-patch-regression.test.ts index 3b0643ee3..b7dffcbc9 100644 --- a/packages/coding-agent/test/core/apply-patch-regression.test.ts +++ b/packages/coding-agent/test/core/apply-patch-regression.test.ts @@ -10,7 +10,7 @@ import { afterEach, beforeEach, describe, expect, test } from "bun:test"; import { mkdirSync, readFileSync, rmSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { applyPatch, findContextLine, seekSequence } from "$c/patch"; +import { applyPatch, findContextLine, seekSequence } from "@oh-my-pi/pi-coding-agent/patch"; describe("regression: indentation adjustment for line-based replacements (2B)", () => { let tempDir: string; diff --git a/packages/coding-agent/test/core/apply-patch.test.ts b/packages/coding-agent/test/core/apply-patch.test.ts index 06444922d..dfc3f6d3b 100644 --- a/packages/coding-agent/test/core/apply-patch.test.ts +++ b/packages/coding-agent/test/core/apply-patch.test.ts @@ -2,7 +2,14 @@ import { afterEach, beforeEach, describe, expect, test } from "bun:test"; import { cpSync, mkdirSync, readdirSync, readFileSync, rmSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { ApplyPatchError, applyPatch, ParseError, type PatchInput, parseDiffHunks, seekSequence } from "$c/patch"; +import { + ApplyPatchError, + applyPatch, + ParseError, + type PatchInput, + parseDiffHunks, + seekSequence, +} from "@oh-my-pi/pi-coding-agent/patch"; // ═══════════════════════════════════════════════════════════════════════════ // Legacy parser for test fixtures (*** Begin Patch format) diff --git a/packages/coding-agent/test/core/python-executor-display.test.ts b/packages/coding-agent/test/core/python-executor-display.test.ts index e3b593129..93aa85913 100644 --- a/packages/coding-agent/test/core/python-executor-display.test.ts +++ b/packages/coding-agent/test/core/python-executor-display.test.ts @@ -1,6 +1,10 @@ import { describe, expect, it } from "bun:test"; -import { executePythonWithKernel, type PythonKernelExecutor } from "$c/ipy/executor"; -import type { KernelDisplayOutput, KernelExecuteOptions, KernelExecuteResult } from "$c/ipy/kernel"; +import { executePythonWithKernel, type PythonKernelExecutor } from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import type { + KernelDisplayOutput, + KernelExecuteOptions, + KernelExecuteResult, +} from "@oh-my-pi/pi-coding-agent/ipy/kernel"; class FakeKernel implements PythonKernelExecutor { private result: KernelExecuteResult; diff --git a/packages/coding-agent/test/core/python-executor-lifecycle.test.ts b/packages/coding-agent/test/core/python-executor-lifecycle.test.ts index 5bbaa9f5a..59b05d4bb 100644 --- a/packages/coding-agent/test/core/python-executor-lifecycle.test.ts +++ b/packages/coding-agent/test/core/python-executor-lifecycle.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { disposeAllKernelSessions, executePython } from "$c/ipy/executor"; -import type { KernelExecuteResult } from "$c/ipy/kernel"; -import * as pythonKernel from "$c/ipy/kernel"; +import { disposeAllKernelSessions, executePython } from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import type { KernelExecuteResult } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; +import * as pythonKernel from "@oh-my-pi/pi-coding-agent/ipy/kernel"; class FakeKernel { execute = vi.fn(async () => this.result); diff --git a/packages/coding-agent/test/core/python-executor-mapping.test.ts b/packages/coding-agent/test/core/python-executor-mapping.test.ts index 87101a4f5..5d0053b9b 100644 --- a/packages/coding-agent/test/core/python-executor-mapping.test.ts +++ b/packages/coding-agent/test/core/python-executor-mapping.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { executePythonWithKernel, type PythonKernelExecutor } from "$c/ipy/executor"; -import type { KernelExecuteOptions, KernelExecuteResult } from "$c/ipy/kernel"; +import { executePythonWithKernel, type PythonKernelExecutor } from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import type { KernelExecuteOptions, KernelExecuteResult } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; class FakeKernel implements PythonKernelExecutor { constructor( diff --git a/packages/coding-agent/test/core/python-executor-per-call.test.ts b/packages/coding-agent/test/core/python-executor-per-call.test.ts index 0caafba5b..6e72ca243 100644 --- a/packages/coding-agent/test/core/python-executor-per-call.test.ts +++ b/packages/coding-agent/test/core/python-executor-per-call.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "bun:test"; +import { executePython } from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import type { KernelExecuteOptions, KernelExecuteResult } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; +import { PythonKernel } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; -import { executePython } from "$c/ipy/executor"; -import type { KernelExecuteOptions, KernelExecuteResult } from "$c/ipy/kernel"; -import { PythonKernel } from "$c/ipy/kernel"; interface KernelStub { execute: (code: string, options?: KernelExecuteOptions) => Promise; diff --git a/packages/coding-agent/test/core/python-executor-session.test.ts b/packages/coding-agent/test/core/python-executor-session.test.ts index e0118d381..ba8bb6b1b 100644 --- a/packages/coding-agent/test/core/python-executor-session.test.ts +++ b/packages/coding-agent/test/core/python-executor-session.test.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; -import { disposeAllKernelSessions, executePython } from "$c/ipy/executor"; -import * as pythonKernel from "$c/ipy/kernel"; +import { disposeAllKernelSessions, executePython } from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import * as pythonKernel from "@oh-my-pi/pi-coding-agent/ipy/kernel"; class FakeKernel { executeCalls = 0; diff --git a/packages/coding-agent/test/core/python-executor-streaming.test.ts b/packages/coding-agent/test/core/python-executor-streaming.test.ts index 130c3f432..b79e96d75 100644 --- a/packages/coding-agent/test/core/python-executor-streaming.test.ts +++ b/packages/coding-agent/test/core/python-executor-streaming.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { executePythonWithKernel, type PythonKernelExecutor } from "$c/ipy/executor"; -import type { KernelExecuteOptions, KernelExecuteResult } from "$c/ipy/kernel"; -import { DEFAULT_MAX_BYTES } from "$c/tools/truncate"; +import { executePythonWithKernel, type PythonKernelExecutor } from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import type { KernelExecuteOptions, KernelExecuteResult } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; +import { DEFAULT_MAX_BYTES } from "@oh-my-pi/pi-coding-agent/tools/truncate"; class FakeKernel implements PythonKernelExecutor { private result: KernelExecuteResult; diff --git a/packages/coding-agent/test/core/python-executor-timeout.test.ts b/packages/coding-agent/test/core/python-executor-timeout.test.ts index 1ac2f399f..6dbad2b73 100644 --- a/packages/coding-agent/test/core/python-executor-timeout.test.ts +++ b/packages/coding-agent/test/core/python-executor-timeout.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { executePythonWithKernel, type PythonKernelExecutor } from "$c/ipy/executor"; -import type { KernelExecuteOptions, KernelExecuteResult } from "$c/ipy/kernel"; +import { executePythonWithKernel, type PythonKernelExecutor } from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import type { KernelExecuteOptions, KernelExecuteResult } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; class FakeKernel implements PythonKernelExecutor { private result: KernelExecuteResult; diff --git a/packages/coding-agent/test/core/python-executor.lifecycle.test.ts b/packages/coding-agent/test/core/python-executor.lifecycle.test.ts index 18f10a9b2..abbcc1ce9 100644 --- a/packages/coding-agent/test/core/python-executor.lifecycle.test.ts +++ b/packages/coding-agent/test/core/python-executor.lifecycle.test.ts @@ -1,6 +1,10 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { disposeAllKernelSessions, executePython } from "$c/ipy/executor"; -import { type KernelExecuteOptions, type KernelExecuteResult, PythonKernel } from "$c/ipy/kernel"; +import { disposeAllKernelSessions, executePython } from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import { + type KernelExecuteOptions, + type KernelExecuteResult, + PythonKernel, +} from "@oh-my-pi/pi-coding-agent/ipy/kernel"; process.env.OMP_PYTHON_SKIP_CHECK = "1"; diff --git a/packages/coding-agent/test/core/python-executor.result.test.ts b/packages/coding-agent/test/core/python-executor.result.test.ts index 032e47d3f..608d0fd66 100644 --- a/packages/coding-agent/test/core/python-executor.result.test.ts +++ b/packages/coding-agent/test/core/python-executor.result.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { executePythonWithKernel, type PythonKernelExecutor } from "$c/ipy/executor"; -import type { KernelExecuteOptions, KernelExecuteResult } from "$c/ipy/kernel"; +import { executePythonWithKernel, type PythonKernelExecutor } from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import type { KernelExecuteOptions, KernelExecuteResult } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; class FakeKernel implements PythonKernelExecutor { private result: KernelExecuteResult; diff --git a/packages/coding-agent/test/core/python-executor.test.ts b/packages/coding-agent/test/core/python-executor.test.ts index a74c0e642..58ad1452f 100644 --- a/packages/coding-agent/test/core/python-executor.test.ts +++ b/packages/coding-agent/test/core/python-executor.test.ts @@ -1,6 +1,5 @@ import { afterEach, describe, expect, it, vi } from "bun:test"; import { join } from "node:path"; -import { createTempDirSync } from "@oh-my-pi/pi-utils"; import { disposeAllKernelSessions, executePythonWithKernel, @@ -8,9 +7,15 @@ import { type PythonKernelExecutor, resetPreludeDocsCache, warmPythonEnvironment, -} from "$c/ipy/executor"; -import { type KernelExecuteOptions, type KernelExecuteResult, type PreludeHelper, PythonKernel } from "$c/ipy/kernel"; -import { DEFAULT_MAX_BYTES } from "$c/tools/truncate"; +} from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import { + type KernelExecuteOptions, + type KernelExecuteResult, + type PreludeHelper, + PythonKernel, +} from "@oh-my-pi/pi-coding-agent/ipy/kernel"; +import { DEFAULT_MAX_BYTES } from "@oh-my-pi/pi-coding-agent/tools/truncate"; +import { createTempDirSync } from "@oh-my-pi/pi-utils"; class FakeKernel implements PythonKernelExecutor { private result: KernelExecuteResult; diff --git a/packages/coding-agent/test/core/python-kernel-display.test.ts b/packages/coding-agent/test/core/python-kernel-display.test.ts index 9cbb9af16..86ff190fc 100644 --- a/packages/coding-agent/test/core/python-kernel-display.test.ts +++ b/packages/coding-agent/test/core/python-kernel-display.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { type KernelDisplayOutput, PythonKernel } from "$c/ipy/kernel"; +import { type KernelDisplayOutput, PythonKernel } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; const renderDisplay = ( PythonKernel as unknown as { diff --git a/packages/coding-agent/test/core/python-kernel-env.test.ts b/packages/coding-agent/test/core/python-kernel-env.test.ts index 77485f1bd..edb574af1 100644 --- a/packages/coding-agent/test/core/python-kernel-env.test.ts +++ b/packages/coding-agent/test/core/python-kernel-env.test.ts @@ -1,9 +1,9 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; +import { PythonKernel } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; +import { PYTHON_PRELUDE } from "@oh-my-pi/pi-coding-agent/ipy/prelude"; +import * as shell from "@oh-my-pi/pi-coding-agent/utils/shell"; +import * as shellSnapshot from "@oh-my-pi/pi-coding-agent/utils/shell-snapshot"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; -import { PythonKernel } from "$c/ipy/kernel"; -import { PYTHON_PRELUDE } from "$c/ipy/prelude"; -import * as shell from "$c/utils/shell"; -import * as shellSnapshot from "$c/utils/shell-snapshot"; class FakeWebSocket { static OPEN = 1; diff --git a/packages/coding-agent/test/core/python-kernel-session.test.ts b/packages/coding-agent/test/core/python-kernel-session.test.ts index b8d691e46..a52a54179 100644 --- a/packages/coding-agent/test/core/python-kernel-session.test.ts +++ b/packages/coding-agent/test/core/python-kernel-session.test.ts @@ -1,8 +1,8 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; +import { disposeAllKernelSessions, executePython } from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import type { KernelExecuteOptions, KernelExecuteResult } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; +import { PythonKernel } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; -import { disposeAllKernelSessions, executePython } from "$c/ipy/executor"; -import type { KernelExecuteOptions, KernelExecuteResult } from "$c/ipy/kernel"; -import { PythonKernel } from "$c/ipy/kernel"; class FakeKernel { executeCalls = 0; diff --git a/packages/coding-agent/test/core/python-kernel-ws.test.ts b/packages/coding-agent/test/core/python-kernel-ws.test.ts index 69c719efc..2ea67776f 100644 --- a/packages/coding-agent/test/core/python-kernel-ws.test.ts +++ b/packages/coding-agent/test/core/python-kernel-ws.test.ts @@ -1,5 +1,9 @@ import { describe, expect, it } from "bun:test"; -import { deserializeWebSocketMessage, type JupyterMessage, serializeWebSocketMessage } from "$c/ipy/kernel"; +import { + deserializeWebSocketMessage, + type JupyterMessage, + serializeWebSocketMessage, +} from "@oh-my-pi/pi-coding-agent/ipy/kernel"; const encoder = new TextEncoder(); diff --git a/packages/coding-agent/test/core/python-kernel.lifecycle.test.ts b/packages/coding-agent/test/core/python-kernel.lifecycle.test.ts index 814285e7d..c9fa5dae3 100644 --- a/packages/coding-agent/test/core/python-kernel.lifecycle.test.ts +++ b/packages/coding-agent/test/core/python-kernel.lifecycle.test.ts @@ -1,8 +1,8 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; import { rmSync } from "node:fs"; +import { PythonKernel } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; import { createTempDirSync, type SyncTempDir } from "@oh-my-pi/pi-utils"; import type { Subprocess } from "bun"; -import { PythonKernel } from "$c/ipy/kernel"; type SpawnOptions = Parameters[1]; diff --git a/packages/coding-agent/test/core/python-kernel.test.ts b/packages/coding-agent/test/core/python-kernel.test.ts index d67a14a11..49e926758 100644 --- a/packages/coding-agent/test/core/python-kernel.test.ts +++ b/packages/coding-agent/test/core/python-kernel.test.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; -import { type KernelDisplayOutput, PythonKernel } from "$c/ipy/kernel"; -import { PYTHON_PRELUDE } from "$c/ipy/prelude"; +import { type KernelDisplayOutput, PythonKernel } from "@oh-my-pi/pi-coding-agent/ipy/kernel"; +import { PYTHON_PRELUDE } from "@oh-my-pi/pi-coding-agent/ipy/prelude"; type JupyterMessage = { channel: string; diff --git a/packages/coding-agent/test/core/python-modules.test.ts b/packages/coding-agent/test/core/python-modules.test.ts index decb53aae..503274516 100644 --- a/packages/coding-agent/test/core/python-modules.test.ts +++ b/packages/coding-agent/test/core/python-modules.test.ts @@ -1,8 +1,12 @@ import { afterEach, describe, expect, it } from "bun:test"; import { mkdirSync, readFileSync, writeFileSync } from "node:fs"; import { basename, join, resolve } from "node:path"; +import { + discoverPythonModules, + loadPythonModules, + type PythonModuleExecutor, +} from "@oh-my-pi/pi-coding-agent/ipy/modules"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; -import { discoverPythonModules, loadPythonModules, type PythonModuleExecutor } from "$c/ipy/modules"; const fixturesDir = resolve(import.meta.dir, "../../test/fixtures/python-modules"); diff --git a/packages/coding-agent/test/core/python-prelude.test.ts b/packages/coding-agent/test/core/python-prelude.test.ts index 910a7c1ba..62be2a6e6 100644 --- a/packages/coding-agent/test/core/python-prelude.test.ts +++ b/packages/coding-agent/test/core/python-prelude.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "bun:test"; import { existsSync } from "node:fs"; import { join } from "node:path"; -import { resetPreludeDocsCache, warmPythonEnvironment } from "$c/ipy/executor"; -import { getPythonToolDescription, PythonTool } from "$c/tools/python"; +import { resetPreludeDocsCache, warmPythonEnvironment } from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import { getPythonToolDescription, PythonTool } from "@oh-my-pi/pi-coding-agent/tools/python"; const resolvePythonPath = (): string | null => { const venvPath = process.env.VIRTUAL_ENV; diff --git a/packages/coding-agent/test/core/settings-manager-python.test.ts b/packages/coding-agent/test/core/settings-manager-python.test.ts index a6b58b58c..f73372ffe 100644 --- a/packages/coding-agent/test/core/settings-manager-python.test.ts +++ b/packages/coding-agent/test/core/settings-manager-python.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { SettingsManager } from "$c/config/settings-manager"; +import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; describe("SettingsManager python settings", () => { it("defaults to both and session", () => { diff --git a/packages/coding-agent/test/core/system-prompt.python.test.ts b/packages/coding-agent/test/core/system-prompt.python.test.ts index 618a3f244..d50e37465 100644 --- a/packages/coding-agent/test/core/system-prompt.python.test.ts +++ b/packages/coding-agent/test/core/system-prompt.python.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { buildSystemPrompt } from "$c/system-prompt"; +import { buildSystemPrompt } from "@oh-my-pi/pi-coding-agent/system-prompt"; describe("buildSystemPrompt", () => { it("includes python tool details when enabled", async () => { diff --git a/packages/coding-agent/test/discovery/helpers.test.ts b/packages/coding-agent/test/discovery/helpers.test.ts index 4ed210665..79fa76d81 100644 --- a/packages/coding-agent/test/discovery/helpers.test.ts +++ b/packages/coding-agent/test/discovery/helpers.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test"; -import { parseFrontmatter } from "$c/utils/frontmatter"; +import { parseFrontmatter } from "@oh-my-pi/pi-coding-agent/utils/frontmatter"; describe("parseFrontmatter", () => { const parse = (content: string) => parseFrontmatter(content, { source: "tests:frontmatter", level: "off" }); diff --git a/packages/coding-agent/test/edit-diff.test.ts b/packages/coding-agent/test/edit-diff.test.ts index 755b0dea6..3b75f4f54 100644 --- a/packages/coding-agent/test/edit-diff.test.ts +++ b/packages/coding-agent/test/edit-diff.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test"; -import { adjustIndentation, DEFAULT_FUZZY_THRESHOLD, findEditMatch } from "$c/patch"; +import { adjustIndentation, DEFAULT_FUZZY_THRESHOLD, findEditMatch } from "@oh-my-pi/pi-coding-agent/patch"; describe("findEditMatch", () => { describe("exact matching", () => { diff --git a/packages/coding-agent/test/extensions-discovery.test.ts b/packages/coding-agent/test/extensions-discovery.test.ts index 32402a5e2..76ae5ebe2 100644 --- a/packages/coding-agent/test/extensions-discovery.test.ts +++ b/packages/coding-agent/test/extensions-discovery.test.ts @@ -2,8 +2,8 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; import * as fs from "node:fs"; import * as path from "node:path"; import { fileURLToPath } from "node:url"; +import { discoverAndLoadExtensions, loadExtensions } from "@oh-my-pi/pi-coding-agent/extensibility/extensions/loader"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; -import { discoverAndLoadExtensions, loadExtensions } from "$c/extensibility/extensions/loader"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); diff --git a/packages/coding-agent/test/extensions-runner.test.ts b/packages/coding-agent/test/extensions-runner.test.ts index 0c4c2da04..9dc200e53 100644 --- a/packages/coding-agent/test/extensions-runner.test.ts +++ b/packages/coding-agent/test/extensions-runner.test.ts @@ -5,12 +5,12 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; import { mkdirSync, writeFileSync } from "node:fs"; import { join } from "node:path"; +import { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { discoverAndLoadExtensions } from "@oh-my-pi/pi-coding-agent/extensibility/extensions/loader"; +import { ExtensionRunner } from "@oh-my-pi/pi-coding-agent/extensibility/extensions/runner"; +import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { createTempDirSync, logger } from "@oh-my-pi/pi-utils"; -import { ModelRegistry } from "$c/config/model-registry"; -import { discoverAndLoadExtensions } from "$c/extensibility/extensions/loader"; -import { ExtensionRunner } from "$c/extensibility/extensions/runner"; -import { AuthStorage } from "$c/session/auth-storage"; -import { SessionManager } from "$c/session/session-manager"; describe("ExtensionRunner", () => { let tempDir: ReturnType; diff --git a/packages/coding-agent/test/fuzzy.test.ts b/packages/coding-agent/test/fuzzy.test.ts index ebf8f3e18..e81a98db2 100644 --- a/packages/coding-agent/test/fuzzy.test.ts +++ b/packages/coding-agent/test/fuzzy.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test"; -import { fuzzyFilter, fuzzyMatch } from "$c/utils/fuzzy"; +import { fuzzyFilter, fuzzyMatch } from "@oh-my-pi/pi-coding-agent/utils/fuzzy"; describe("fuzzyMatch", () => { test("empty query matches everything with score 0", () => { diff --git a/packages/coding-agent/test/interactive-mode-status.test.ts b/packages/coding-agent/test/interactive-mode-status.test.ts index 2bd83649c..910c7bdc3 100644 --- a/packages/coding-agent/test/interactive-mode-status.test.ts +++ b/packages/coding-agent/test/interactive-mode-status.test.ts @@ -1,8 +1,8 @@ import { beforeAll, describe, expect, test, vi } from "bun:test"; +import { InteractiveMode } from "@oh-my-pi/pi-coding-agent/modes/interactive-mode"; +import { initTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import { UiHelpers } from "@oh-my-pi/pi-coding-agent/modes/utils/ui-helpers"; import { Container } from "@oh-my-pi/pi-tui"; -import { InteractiveMode } from "$c/modes/interactive-mode"; -import { initTheme } from "$c/modes/theme/theme"; -import { UiHelpers } from "$c/modes/utils/ui-helpers"; function renderLastLine(container: Container, width = 120): string { const last = container.children[container.children.length - 1]; diff --git a/packages/coding-agent/test/model-registry.test.ts b/packages/coding-agent/test/model-registry.test.ts index 6757dbc52..6003f5dfb 100644 --- a/packages/coding-agent/test/model-registry.test.ts +++ b/packages/coding-agent/test/model-registry.test.ts @@ -2,9 +2,9 @@ import { afterEach, beforeEach, describe, expect, test } from "bun:test"; import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; +import { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; import { nanoid } from "nanoid"; -import { ModelRegistry } from "$c/config/model-registry"; -import { AuthStorage } from "$c/session/auth-storage"; describe("ModelRegistry", () => { let tempDir: string; diff --git a/packages/coding-agent/test/model-resolver.test.ts b/packages/coding-agent/test/model-resolver.test.ts index a8a6dc966..d3297f6fd 100644 --- a/packages/coding-agent/test/model-resolver.test.ts +++ b/packages/coding-agent/test/model-resolver.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from "bun:test"; import type { Model } from "@oh-my-pi/pi-ai"; -import { parseModelPattern } from "$c/config/model-resolver"; +import { parseModelPattern } from "@oh-my-pi/pi-coding-agent/config/model-resolver"; // Mock models for testing const mockModels: Model<"anthropic-messages">[] = [ diff --git a/packages/coding-agent/test/prompt-templates.test.ts b/packages/coding-agent/test/prompt-templates.test.ts index 0f9fc5bd3..3db9e0653 100644 --- a/packages/coding-agent/test/prompt-templates.test.ts +++ b/packages/coding-agent/test/prompt-templates.test.ts @@ -9,7 +9,7 @@ */ import { describe, expect, test } from "bun:test"; -import { parseCommandArgs, substituteArgs } from "$c/config/prompt-templates"; +import { parseCommandArgs, substituteArgs } from "@oh-my-pi/pi-coding-agent/config/prompt-templates"; // ============================================================================ // substituteArgs diff --git a/packages/coding-agent/test/python-tool-settings.test.ts b/packages/coding-agent/test/python-tool-settings.test.ts index 84731368a..599abd187 100644 --- a/packages/coding-agent/test/python-tool-settings.test.ts +++ b/packages/coding-agent/test/python-tool-settings.test.ts @@ -2,10 +2,10 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; import { mkdirSync, rmSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import * as pythonExecutor from "$c/ipy/executor"; -import * as pythonKernel from "$c/ipy/kernel"; -import { createTools, type ToolSession } from "$c/tools/index"; -import { PythonTool } from "$c/tools/python"; +import * as pythonExecutor from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import * as pythonKernel from "@oh-my-pi/pi-coding-agent/ipy/kernel"; +import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { PythonTool } from "@oh-my-pi/pi-coding-agent/tools/python"; function createSettings(overrides?: Partial): ToolSession["settings"] { return { diff --git a/packages/coding-agent/test/rpc-example.ts b/packages/coding-agent/test/rpc-example.ts index 1920a0b81..34ff50b1f 100644 --- a/packages/coding-agent/test/rpc-example.ts +++ b/packages/coding-agent/test/rpc-example.ts @@ -1,6 +1,6 @@ import { join } from "node:path"; import * as readline from "node:readline"; -import { RpcClient } from "$c/modes/rpc/rpc-client"; +import { RpcClient } from "@oh-my-pi/pi-coding-agent/modes/rpc/rpc-client"; /** * Interactive example of using coding-agent via RpcClient. diff --git a/packages/coding-agent/test/rpc.test.ts b/packages/coding-agent/test/rpc.test.ts index 9c60a6657..f7d5897d6 100644 --- a/packages/coding-agent/test/rpc.test.ts +++ b/packages/coding-agent/test/rpc.test.ts @@ -3,8 +3,8 @@ import { existsSync, readdirSync, readFileSync, rmSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; import type { AgentEvent } from "@oh-my-pi/pi-agent-core"; +import { RpcClient } from "@oh-my-pi/pi-coding-agent/modes/rpc/rpc-client"; import { nanoid } from "nanoid"; -import { RpcClient } from "$c/modes/rpc/rpc-client"; /** * RPC mode tests. diff --git a/packages/coding-agent/test/sdk-skills.test.ts b/packages/coding-agent/test/sdk-skills.test.ts index a901872e3..3b649b869 100644 --- a/packages/coding-agent/test/sdk-skills.test.ts +++ b/packages/coding-agent/test/sdk-skills.test.ts @@ -2,9 +2,9 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; import { mkdirSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import type { Skill } from "$c/sdk"; -import { createAgentSession } from "$c/sdk"; -import { SessionManager } from "$c/session/session-manager"; +import type { Skill } from "@oh-my-pi/pi-coding-agent/sdk"; +import { createAgentSession } from "@oh-my-pi/pi-coding-agent/sdk"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; describe("createAgentSession skills option", () => { let tempDir: string; diff --git a/packages/coding-agent/test/session-manager/build-context.test.ts b/packages/coding-agent/test/session-manager/build-context.test.ts index fde13a22b..d8b6c8680 100644 --- a/packages/coding-agent/test/session-manager/build-context.test.ts +++ b/packages/coding-agent/test/session-manager/build-context.test.ts @@ -7,7 +7,7 @@ import { type SessionEntry, type SessionMessageEntry, type ThinkingLevelChangeEntry, -} from "$c/session/session-manager"; +} from "@oh-my-pi/pi-coding-agent/session/session-manager"; function msg(id: string, parentId: string | null, role: "user" | "assistant", text: string): SessionMessageEntry { const base = { type: "message" as const, id, parentId, timestamp: "2025-01-01T00:00:00Z" }; diff --git a/packages/coding-agent/test/session-manager/file-operations.test.ts b/packages/coding-agent/test/session-manager/file-operations.test.ts index 522bf059e..38b215a4f 100644 --- a/packages/coding-agent/test/session-manager/file-operations.test.ts +++ b/packages/coding-agent/test/session-manager/file-operations.test.ts @@ -2,8 +2,8 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; import { mkdirSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; +import { findMostRecentSession, loadEntriesFromFile } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { nanoid } from "nanoid"; -import { findMostRecentSession, loadEntriesFromFile } from "$c/session/session-manager"; describe("loadEntriesFromFile", () => { let tempDir: string; diff --git a/packages/coding-agent/test/session-manager/labels.test.ts b/packages/coding-agent/test/session-manager/labels.test.ts index 24588ee8a..ca8b7413f 100644 --- a/packages/coding-agent/test/session-manager/labels.test.ts +++ b/packages/coding-agent/test/session-manager/labels.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { type LabelEntry, SessionManager } from "$c/session/session-manager"; +import { type LabelEntry, SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; describe("SessionManager labels", () => { it("sets and gets labels", () => { diff --git a/packages/coding-agent/test/session-manager/migration.test.ts b/packages/coding-agent/test/session-manager/migration.test.ts index 01bbce065..a9fc9f6d3 100644 --- a/packages/coding-agent/test/session-manager/migration.test.ts +++ b/packages/coding-agent/test/session-manager/migration.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { type FileEntry, migrateSessionEntries } from "$c/session/session-manager"; +import { type FileEntry, migrateSessionEntries } from "@oh-my-pi/pi-coding-agent/session/session-manager"; describe("migrateSessionEntries", () => { it("should add id/parentId to v1 entries", () => { diff --git a/packages/coding-agent/test/session-manager/rewrite-tool-call.test.ts b/packages/coding-agent/test/session-manager/rewrite-tool-call.test.ts index 50a4aeca9..c4112e144 100644 --- a/packages/coding-agent/test/session-manager/rewrite-tool-call.test.ts +++ b/packages/coding-agent/test/session-manager/rewrite-tool-call.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; import type { AssistantMessage, ToolCall } from "@oh-my-pi/pi-ai"; -import { SessionManager } from "$c/session/session-manager"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; function buildAssistantMessage(content: AssistantMessage["content"]): AssistantMessage { return { diff --git a/packages/coding-agent/test/session-manager/save-entry.test.ts b/packages/coding-agent/test/session-manager/save-entry.test.ts index 6a1d8254f..e068bd664 100644 --- a/packages/coding-agent/test/session-manager/save-entry.test.ts +++ b/packages/coding-agent/test/session-manager/save-entry.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { type CustomEntry, SessionManager } from "$c/session/session-manager"; +import { type CustomEntry, SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; describe("SessionManager.saveCustomEntry", () => { it("saves custom entries and includes them in tree traversal", () => { diff --git a/packages/coding-agent/test/session-manager/tree-traversal.test.ts b/packages/coding-agent/test/session-manager/tree-traversal.test.ts index 502ff7dcb..4753c4dcb 100644 --- a/packages/coding-agent/test/session-manager/tree-traversal.test.ts +++ b/packages/coding-agent/test/session-manager/tree-traversal.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { type CustomEntry, SessionManager } from "$c/session/session-manager"; +import { type CustomEntry, SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { assistantMsg, userMsg } from "../utilities"; describe("SessionManager append and tree traversal", () => { diff --git a/packages/coding-agent/test/settings-manager.test.ts b/packages/coding-agent/test/settings-manager.test.ts index 5867085d1..075393029 100644 --- a/packages/coding-agent/test/settings-manager.test.ts +++ b/packages/coding-agent/test/settings-manager.test.ts @@ -1,9 +1,9 @@ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; import { existsSync, mkdirSync, rmSync } from "node:fs"; import { join } from "node:path"; -import { getAgentDbPath } from "$c/config"; -import { SettingsManager } from "$c/config/settings-manager"; -import { AgentStorage } from "$c/session/agent-storage"; +import { getAgentDbPath } from "@oh-my-pi/pi-coding-agent/config"; +import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { AgentStorage } from "@oh-my-pi/pi-coding-agent/session/agent-storage"; describe("SettingsManager", () => { let testDir: string; diff --git a/packages/coding-agent/test/skills.test.ts b/packages/coding-agent/test/skills.test.ts index ab1adcc98..9ef050c46 100644 --- a/packages/coding-agent/test/skills.test.ts +++ b/packages/coding-agent/test/skills.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; import { homedir } from "node:os"; import { join, resolve } from "node:path"; -import { loadSkills, loadSkillsFromDir, type Skill } from "$c/extensibility/skills"; +import { loadSkills, loadSkillsFromDir, type Skill } from "@oh-my-pi/pi-coding-agent/extensibility/skills"; const fixturesDir = resolve(__dirname, "fixtures/skills"); const collisionFixturesDir = resolve(__dirname, "fixtures/skills-collision"); diff --git a/packages/coding-agent/test/streaming-edit-abort.test.ts b/packages/coding-agent/test/streaming-edit-abort.test.ts index 6244c0ac6..ecf24be61 100644 --- a/packages/coding-agent/test/streaming-edit-abort.test.ts +++ b/packages/coding-agent/test/streaming-edit-abort.test.ts @@ -15,13 +15,13 @@ import { type StopReason, type ToolCall, } from "@oh-my-pi/pi-ai"; +import { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; import { Type } from "@sinclair/typebox"; import { nanoid } from "nanoid"; -import { ModelRegistry } from "$c/config/model-registry"; -import { SettingsManager } from "$c/config/settings-manager"; -import { AgentSession } from "$c/session/agent-session"; -import { AuthStorage } from "$c/session/auth-storage"; -import { SessionManager } from "$c/session/session-manager"; class MockAssistantStream extends EventStream { constructor() { diff --git a/packages/coding-agent/test/streaming-render-debug.ts b/packages/coding-agent/test/streaming-render-debug.ts index b7cca3ae9..f233ffc75 100644 --- a/packages/coding-agent/test/streaming-render-debug.ts +++ b/packages/coding-agent/test/streaming-render-debug.ts @@ -7,10 +7,10 @@ import { readFileSync } from "node:fs"; import { join } from "node:path"; import type { AssistantMessage } from "@oh-my-pi/pi-ai"; +import { AssistantMessageComponent } from "@oh-my-pi/pi-coding-agent/modes/components/assistant-message"; +import { initTheme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; import { ProcessTerminal, TUI } from "@oh-my-pi/pi-tui"; import { sleep } from "bun"; -import { AssistantMessageComponent } from "$c/modes/components/assistant-message"; -import { initTheme } from "$c/modes/theme/theme"; // Initialize dark theme with full color support process.env.COLORTERM = "truecolor"; diff --git a/packages/coding-agent/test/system-prompt.test.ts b/packages/coding-agent/test/system-prompt.test.ts index 8658c6558..3ee7b0dd4 100644 --- a/packages/coding-agent/test/system-prompt.test.ts +++ b/packages/coding-agent/test/system-prompt.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test"; -import { buildSystemPrompt } from "$c/system-prompt"; +import { buildSystemPrompt } from "@oh-my-pi/pi-coding-agent/system-prompt"; describe("buildSystemPrompt", () => { describe("empty tools", () => { diff --git a/packages/coding-agent/test/test-theme-colors.ts b/packages/coding-agent/test/test-theme-colors.ts index 6f1238612..b86ae2e76 100644 --- a/packages/coding-agent/test/test-theme-colors.ts +++ b/packages/coding-agent/test/test-theme-colors.ts @@ -1,4 +1,4 @@ -import { initTheme, theme } from "$c/modes/theme/theme"; +import { initTheme, theme } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; // Initialize with dark theme explicitly process.env.COLORTERM = "truecolor"; diff --git a/packages/coding-agent/test/tools.test.ts b/packages/coding-agent/test/tools.test.ts index ce36f29d4..7714536c4 100644 --- a/packages/coding-agent/test/tools.test.ts +++ b/packages/coding-agent/test/tools.test.ts @@ -2,17 +2,17 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; +import { EditTool } from "@oh-my-pi/pi-coding-agent/patch"; +import { BashTool } from "@oh-my-pi/pi-coding-agent/tools/bash"; +import { FindTool } from "@oh-my-pi/pi-coding-agent/tools/find"; +import { GrepTool } from "@oh-my-pi/pi-coding-agent/tools/grep"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { LsTool } from "@oh-my-pi/pi-coding-agent/tools/ls"; +import { wrapToolWithMetaNotice } from "@oh-my-pi/pi-coding-agent/tools/output-meta"; +import { ReadTool } from "@oh-my-pi/pi-coding-agent/tools/read"; +import { WriteTool } from "@oh-my-pi/pi-coding-agent/tools/write"; +import * as shellModule from "@oh-my-pi/pi-coding-agent/utils/shell"; import { nanoid } from "nanoid"; -import { EditTool } from "$c/patch"; -import { BashTool } from "$c/tools/bash"; -import { FindTool } from "$c/tools/find"; -import { GrepTool } from "$c/tools/grep"; -import type { ToolSession } from "$c/tools/index"; -import { LsTool } from "$c/tools/ls"; -import { wrapToolWithMetaNotice } from "$c/tools/output-meta"; -import { ReadTool } from "$c/tools/read"; -import { WriteTool } from "$c/tools/write"; -import * as shellModule from "$c/utils/shell"; // Helper to extract text from content blocks function getTextOutput(result: any): string { diff --git a/packages/coding-agent/test/tools/index.test.ts b/packages/coding-agent/test/tools/index.test.ts index 2edcf0760..93b2277ea 100644 --- a/packages/coding-agent/test/tools/index.test.ts +++ b/packages/coding-agent/test/tools/index.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { BUILTIN_TOOLS, createTools, HIDDEN_TOOLS, type ToolSession } from "$c/tools/index"; +import { BUILTIN_TOOLS, createTools, HIDDEN_TOOLS, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; process.env.OMP_PYTHON_SKIP_CHECK = "1"; diff --git a/packages/coding-agent/test/tools/lsp-batching.test.ts b/packages/coding-agent/test/tools/lsp-batching.test.ts index 9461c71b1..0301a96a0 100644 --- a/packages/coding-agent/test/tools/lsp-batching.test.ts +++ b/packages/coding-agent/test/tools/lsp-batching.test.ts @@ -1,8 +1,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; import { join } from "node:path"; +import * as lspConfig from "@oh-my-pi/pi-coding-agent/lsp/config"; +import { createLspWritethrough } from "@oh-my-pi/pi-coding-agent/lsp/index"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; -import * as lspConfig from "$c/lsp/config"; -import { createLspWritethrough } from "$c/lsp/index"; describe("createLspWritethrough batching", () => { let tempDir: ReturnType; diff --git a/packages/coding-agent/test/tools/python-execution.test.ts b/packages/coding-agent/test/tools/python-execution.test.ts index 34fccd756..76fe9c419 100644 --- a/packages/coding-agent/test/tools/python-execution.test.ts +++ b/packages/coding-agent/test/tools/python-execution.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it, vi } from "bun:test"; +import * as pythonExecutor from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { PythonTool } from "@oh-my-pi/pi-coding-agent/tools/python"; import { createTempDirSync } from "@oh-my-pi/pi-utils"; -import * as pythonExecutor from "$c/ipy/executor"; -import type { ToolSession } from "$c/tools/index"; -import { PythonTool } from "$c/tools/python"; function createSession(cwd: string): ToolSession { return { diff --git a/packages/coding-agent/test/tools/python-fallback.test.ts b/packages/coding-agent/test/tools/python-fallback.test.ts index a9618e3b1..8784ad0f3 100644 --- a/packages/coding-agent/test/tools/python-fallback.test.ts +++ b/packages/coding-agent/test/tools/python-fallback.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it, vi } from "bun:test"; -import * as pythonKernelModule from "$c/ipy/kernel"; -import type { ToolSession } from "$c/tools/index"; -import { createTools } from "$c/tools/index"; +import * as pythonKernelModule from "@oh-my-pi/pi-coding-agent/ipy/kernel"; +import type { ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { createTools } from "@oh-my-pi/pi-coding-agent/tools/index"; function createTestSession(overrides: Partial = {}): ToolSession { return { diff --git a/packages/coding-agent/test/tools/python-renderer.test.ts b/packages/coding-agent/test/tools/python-renderer.test.ts index fd23ed65d..fcf4f3f5d 100644 --- a/packages/coding-agent/test/tools/python-renderer.test.ts +++ b/packages/coding-agent/test/tools/python-renderer.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; +import { getThemeByName } from "@oh-my-pi/pi-coding-agent/modes/theme/theme"; +import { pythonToolRenderer } from "@oh-my-pi/pi-coding-agent/tools/python"; import stripAnsi from "strip-ansi"; -import { getThemeByName } from "$c/modes/theme/theme"; -import { pythonToolRenderer } from "$c/tools/python"; describe("pythonToolRenderer", () => { it("renders truncated output when collapsed and full output when expanded", () => { diff --git a/packages/coding-agent/test/tools/python-tool-mode.test.ts b/packages/coding-agent/test/tools/python-tool-mode.test.ts index ad110afc5..3dc7bd72f 100644 --- a/packages/coding-agent/test/tools/python-tool-mode.test.ts +++ b/packages/coding-agent/test/tools/python-tool-mode.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { createTools, type ToolSession } from "$c/tools/index"; +import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; function createSession(overrides: Partial = {}): ToolSession { return { diff --git a/packages/coding-agent/test/tools/python.test.ts b/packages/coding-agent/test/tools/python.test.ts index 975a4a26b..53de4c428 100644 --- a/packages/coding-agent/test/tools/python.test.ts +++ b/packages/coding-agent/test/tools/python.test.ts @@ -1,8 +1,8 @@ import { afterAll, beforeAll, describe, expect, it, vi } from "bun:test"; +import * as pythonExecutor from "@oh-my-pi/pi-coding-agent/ipy/executor"; +import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; +import { PythonTool } from "@oh-my-pi/pi-coding-agent/tools/python"; import { createTempDirSync, type SyncTempDir } from "@oh-my-pi/pi-utils"; -import * as pythonExecutor from "$c/ipy/executor"; -import { createTools, type ToolSession } from "$c/tools/index"; -import { PythonTool } from "$c/tools/python"; let previousSkipCheck: string | undefined; let tempDir: SyncTempDir; diff --git a/packages/coding-agent/test/tools/schema-validation.test.ts b/packages/coding-agent/test/tools/schema-validation.test.ts index d557d567c..c21130af7 100644 --- a/packages/coding-agent/test/tools/schema-validation.test.ts +++ b/packages/coding-agent/test/tools/schema-validation.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; import { sanitizeSchemaForGoogle } from "@oh-my-pi/pi-ai"; -import { BUILTIN_TOOLS, createTools, HIDDEN_TOOLS, type ToolSession } from "$c/tools/index"; +import { BUILTIN_TOOLS, createTools, HIDDEN_TOOLS, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; /** * Problematic JSON Schema features that cause issues with various providers. diff --git a/packages/coding-agent/test/tools/task-template.test.ts b/packages/coding-agent/test/tools/task-template.test.ts index 07578f39e..13ee742df 100644 --- a/packages/coding-agent/test/tools/task-template.test.ts +++ b/packages/coding-agent/test/tools/task-template.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test"; -import { renderTemplate } from "$c/task/template"; +import { renderTemplate } from "@oh-my-pi/pi-coding-agent/task/template"; describe("renderTemplate", () => { test("renders explicit args", () => { diff --git a/packages/coding-agent/test/tools/web-scrapers/academic.test.ts b/packages/coding-agent/test/tools/web-scrapers/academic.test.ts index cde10147c..6c1a8a97c 100644 --- a/packages/coding-agent/test/tools/web-scrapers/academic.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/academic.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "bun:test"; -import { handleArxiv } from "$c/web/scrapers/arxiv"; -import { handleIacr } from "$c/web/scrapers/iacr"; -import { handlePubMed } from "$c/web/scrapers/pubmed"; -import { handleSemanticScholar } from "$c/web/scrapers/semantic-scholar"; +import { handleArxiv } from "@oh-my-pi/pi-coding-agent/web/scrapers/arxiv"; +import { handleIacr } from "@oh-my-pi/pi-coding-agent/web/scrapers/iacr"; +import { handlePubMed } from "@oh-my-pi/pi-coding-agent/web/scrapers/pubmed"; +import { handleSemanticScholar } from "@oh-my-pi/pi-coding-agent/web/scrapers/semantic-scholar"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/business.test.ts b/packages/coding-agent/test/tools/web-scrapers/business.test.ts index 183c904d2..d6886e7ae 100644 --- a/packages/coding-agent/test/tools/web-scrapers/business.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/business.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { handleOpenCorporates } from "$c/web/scrapers/opencorporates"; -import { handleSecEdgar } from "$c/web/scrapers/sec-edgar"; +import { handleOpenCorporates } from "@oh-my-pi/pi-coding-agent/web/scrapers/opencorporates"; +import { handleSecEdgar } from "@oh-my-pi/pi-coding-agent/web/scrapers/sec-edgar"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/dev-platforms.test.ts b/packages/coding-agent/test/tools/web-scrapers/dev-platforms.test.ts index 4061cb8a1..e273c41f5 100644 --- a/packages/coding-agent/test/tools/web-scrapers/dev-platforms.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/dev-platforms.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "bun:test"; -import { handleDevTo } from "$c/web/scrapers/devto"; -import { handleGitLab } from "$c/web/scrapers/gitlab"; -import { handleHackerNews } from "$c/web/scrapers/hackernews"; -import { handleLobsters } from "$c/web/scrapers/lobsters"; +import { handleDevTo } from "@oh-my-pi/pi-coding-agent/web/scrapers/devto"; +import { handleGitLab } from "@oh-my-pi/pi-coding-agent/web/scrapers/gitlab"; +import { handleHackerNews } from "@oh-my-pi/pi-coding-agent/web/scrapers/hackernews"; +import { handleLobsters } from "@oh-my-pi/pi-coding-agent/web/scrapers/lobsters"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/documentation.test.ts b/packages/coding-agent/test/tools/web-scrapers/documentation.test.ts index 8d0541050..2ae9f3182 100644 --- a/packages/coding-agent/test/tools/web-scrapers/documentation.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/documentation.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { handleMDN } from "$c/web/scrapers/mdn"; -import { handleReadTheDocs } from "$c/web/scrapers/readthedocs"; +import { handleMDN } from "@oh-my-pi/pi-coding-agent/web/scrapers/mdn"; +import { handleReadTheDocs } from "@oh-my-pi/pi-coding-agent/web/scrapers/readthedocs"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/finance-media.test.ts b/packages/coding-agent/test/tools/web-scrapers/finance-media.test.ts index 51fce596c..3c15bc8b3 100644 --- a/packages/coding-agent/test/tools/web-scrapers/finance-media.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/finance-media.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { handleArtifactHub } from "$c/web/scrapers/artifacthub"; -import { handleCoinGecko } from "$c/web/scrapers/coingecko"; -import { handleDiscogs } from "$c/web/scrapers/discogs"; +import { handleArtifactHub } from "@oh-my-pi/pi-coding-agent/web/scrapers/artifacthub"; +import { handleCoinGecko } from "@oh-my-pi/pi-coding-agent/web/scrapers/coingecko"; +import { handleDiscogs } from "@oh-my-pi/pi-coding-agent/web/scrapers/discogs"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/git-hosting.test.ts b/packages/coding-agent/test/tools/web-scrapers/git-hosting.test.ts index 5755c4cb6..8a1f27151 100644 --- a/packages/coding-agent/test/tools/web-scrapers/git-hosting.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/git-hosting.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { handleGitHub } from "$c/web/scrapers/github"; -import { handleGitHubGist } from "$c/web/scrapers/github-gist"; +import { handleGitHub } from "@oh-my-pi/pi-coding-agent/web/scrapers/github"; +import { handleGitHubGist } from "@oh-my-pi/pi-coding-agent/web/scrapers/github-gist"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/media.test.ts b/packages/coding-agent/test/tools/web-scrapers/media.test.ts index 426f6c56e..1ba594dd4 100644 --- a/packages/coding-agent/test/tools/web-scrapers/media.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/media.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { handleHuggingFace } from "$c/web/scrapers/huggingface"; -import { handleSpotify } from "$c/web/scrapers/spotify"; -import { handleVimeo } from "$c/web/scrapers/vimeo"; +import { handleHuggingFace } from "@oh-my-pi/pi-coding-agent/web/scrapers/huggingface"; +import { handleSpotify } from "@oh-my-pi/pi-coding-agent/web/scrapers/spotify"; +import { handleVimeo } from "@oh-my-pi/pi-coding-agent/web/scrapers/vimeo"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/package-managers-2.test.ts b/packages/coding-agent/test/tools/web-scrapers/package-managers-2.test.ts index f27ac23dd..a875995e6 100644 --- a/packages/coding-agent/test/tools/web-scrapers/package-managers-2.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/package-managers-2.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from "bun:test"; -import { handleChocolatey } from "$c/web/scrapers/chocolatey"; -import { handleDockerHub } from "$c/web/scrapers/dockerhub"; -import { handleHackage } from "$c/web/scrapers/hackage"; -import { handleMetaCPAN } from "$c/web/scrapers/metacpan"; -import { handleRepology } from "$c/web/scrapers/repology"; -import { handleTerraform } from "$c/web/scrapers/terraform"; +import { handleChocolatey } from "@oh-my-pi/pi-coding-agent/web/scrapers/chocolatey"; +import { handleDockerHub } from "@oh-my-pi/pi-coding-agent/web/scrapers/dockerhub"; +import { handleHackage } from "@oh-my-pi/pi-coding-agent/web/scrapers/hackage"; +import { handleMetaCPAN } from "@oh-my-pi/pi-coding-agent/web/scrapers/metacpan"; +import { handleRepology } from "@oh-my-pi/pi-coding-agent/web/scrapers/repology"; +import { handleTerraform } from "@oh-my-pi/pi-coding-agent/web/scrapers/terraform"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/package-managers.test.ts b/packages/coding-agent/test/tools/web-scrapers/package-managers.test.ts index 3da5c6f5a..d7072a303 100644 --- a/packages/coding-agent/test/tools/web-scrapers/package-managers.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/package-managers.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from "bun:test"; -import { handleAur } from "$c/web/scrapers/aur"; -import { handleBrew } from "$c/web/scrapers/brew"; -import { handleMaven } from "$c/web/scrapers/maven"; -import { handleNuGet } from "$c/web/scrapers/nuget"; -import { handlePackagist } from "$c/web/scrapers/packagist"; -import { handleRubyGems } from "$c/web/scrapers/rubygems"; +import { handleAur } from "@oh-my-pi/pi-coding-agent/web/scrapers/aur"; +import { handleBrew } from "@oh-my-pi/pi-coding-agent/web/scrapers/brew"; +import { handleMaven } from "@oh-my-pi/pi-coding-agent/web/scrapers/maven"; +import { handleNuGet } from "@oh-my-pi/pi-coding-agent/web/scrapers/nuget"; +import { handlePackagist } from "@oh-my-pi/pi-coding-agent/web/scrapers/packagist"; +import { handleRubyGems } from "@oh-my-pi/pi-coding-agent/web/scrapers/rubygems"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/package-registries.test.ts b/packages/coding-agent/test/tools/web-scrapers/package-registries.test.ts index ae1f8564e..090346b74 100644 --- a/packages/coding-agent/test/tools/web-scrapers/package-registries.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/package-registries.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from "bun:test"; -import { handleCratesIo } from "$c/web/scrapers/crates-io"; -import { handleGoPkg } from "$c/web/scrapers/go-pkg"; -import { handleHex } from "$c/web/scrapers/hex"; -import { handleNpm } from "$c/web/scrapers/npm"; -import { handlePubDev } from "$c/web/scrapers/pub-dev"; -import { handlePyPI } from "$c/web/scrapers/pypi"; +import { handleCratesIo } from "@oh-my-pi/pi-coding-agent/web/scrapers/crates-io"; +import { handleGoPkg } from "@oh-my-pi/pi-coding-agent/web/scrapers/go-pkg"; +import { handleHex } from "@oh-my-pi/pi-coding-agent/web/scrapers/hex"; +import { handleNpm } from "@oh-my-pi/pi-coding-agent/web/scrapers/npm"; +import { handlePubDev } from "@oh-my-pi/pi-coding-agent/web/scrapers/pub-dev"; +import { handlePyPI } from "@oh-my-pi/pi-coding-agent/web/scrapers/pypi"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/research.test.ts b/packages/coding-agent/test/tools/web-scrapers/research.test.ts index 2df1cbdda..e9f75a4a8 100644 --- a/packages/coding-agent/test/tools/web-scrapers/research.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/research.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { handleBiorxiv } from "$c/web/scrapers/biorxiv"; -import { handleOpenLibrary } from "$c/web/scrapers/openlibrary"; -import { handleWikidata } from "$c/web/scrapers/wikidata"; +import { handleBiorxiv } from "@oh-my-pi/pi-coding-agent/web/scrapers/biorxiv"; +import { handleOpenLibrary } from "@oh-my-pi/pi-coding-agent/web/scrapers/openlibrary"; +import { handleWikidata } from "@oh-my-pi/pi-coding-agent/web/scrapers/wikidata"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/security.test.ts b/packages/coding-agent/test/tools/web-scrapers/security.test.ts index 3d61756bd..59eba8bd9 100644 --- a/packages/coding-agent/test/tools/web-scrapers/security.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/security.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { handleNvd } from "$c/web/scrapers/nvd"; -import { handleOsv } from "$c/web/scrapers/osv"; +import { handleNvd } from "@oh-my-pi/pi-coding-agent/web/scrapers/nvd"; +import { handleOsv } from "@oh-my-pi/pi-coding-agent/web/scrapers/osv"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/social-extended.test.ts b/packages/coding-agent/test/tools/web-scrapers/social-extended.test.ts index e66a240f8..35607814a 100644 --- a/packages/coding-agent/test/tools/web-scrapers/social-extended.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/social-extended.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { handleBluesky } from "$c/web/scrapers/bluesky"; -import { handleMastodon } from "$c/web/scrapers/mastodon"; +import { handleBluesky } from "@oh-my-pi/pi-coding-agent/web/scrapers/bluesky"; +import { handleMastodon } from "@oh-my-pi/pi-coding-agent/web/scrapers/mastodon"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/social.test.ts b/packages/coding-agent/test/tools/web-scrapers/social.test.ts index 7b8067f4e..1bc33266b 100644 --- a/packages/coding-agent/test/tools/web-scrapers/social.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/social.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { handleReddit } from "$c/web/scrapers/reddit"; -import { handleStackOverflow } from "$c/web/scrapers/stackoverflow"; -import { handleTwitter } from "$c/web/scrapers/twitter"; +import { handleReddit } from "@oh-my-pi/pi-coding-agent/web/scrapers/reddit"; +import { handleStackOverflow } from "@oh-my-pi/pi-coding-agent/web/scrapers/stackoverflow"; +import { handleTwitter } from "@oh-my-pi/pi-coding-agent/web/scrapers/twitter"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/stackexchange.test.ts b/packages/coding-agent/test/tools/web-scrapers/stackexchange.test.ts index 9351b2fc7..0fda920c6 100644 --- a/packages/coding-agent/test/tools/web-scrapers/stackexchange.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/stackexchange.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { handleStackOverflow } from "$c/web/scrapers/stackoverflow"; +import { handleStackOverflow } from "@oh-my-pi/pi-coding-agent/web/scrapers/stackoverflow"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/standards.test.ts b/packages/coding-agent/test/tools/web-scrapers/standards.test.ts index 523799acb..0cb90bcd5 100644 --- a/packages/coding-agent/test/tools/web-scrapers/standards.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/standards.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; -import { handleCheatSh } from "$c/web/scrapers/cheatsh"; -import { handleRfc } from "$c/web/scrapers/rfc"; -import { handleTldr } from "$c/web/scrapers/tldr"; +import { handleCheatSh } from "@oh-my-pi/pi-coding-agent/web/scrapers/cheatsh"; +import { handleRfc } from "@oh-my-pi/pi-coding-agent/web/scrapers/rfc"; +import { handleTldr } from "@oh-my-pi/pi-coding-agent/web/scrapers/tldr"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/wikipedia.test.ts b/packages/coding-agent/test/tools/web-scrapers/wikipedia.test.ts index 96f5ce891..b29bd1de1 100644 --- a/packages/coding-agent/test/tools/web-scrapers/wikipedia.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/wikipedia.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { handleWikipedia } from "$c/web/scrapers/wikipedia"; +import { handleWikipedia } from "@oh-my-pi/pi-coding-agent/web/scrapers/wikipedia"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/tools/web-scrapers/youtube.test.ts b/packages/coding-agent/test/tools/web-scrapers/youtube.test.ts index a98f342ce..e570b6a4a 100644 --- a/packages/coding-agent/test/tools/web-scrapers/youtube.test.ts +++ b/packages/coding-agent/test/tools/web-scrapers/youtube.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { handleYouTube } from "$c/web/scrapers/youtube"; +import { handleYouTube } from "@oh-my-pi/pi-coding-agent/web/scrapers/youtube"; const SKIP = !process.env.WEB_FETCH_INTEGRATION; diff --git a/packages/coding-agent/test/utilities.ts b/packages/coding-agent/test/utilities.ts index 232a466e3..4b77ef3bf 100644 --- a/packages/coding-agent/test/utilities.ts +++ b/packages/coding-agent/test/utilities.ts @@ -7,13 +7,13 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import { Agent } from "@oh-my-pi/pi-agent-core"; import { getModel } from "@oh-my-pi/pi-ai"; +import { ModelRegistry } from "@oh-my-pi/pi-coding-agent/config/model-registry"; +import { SettingsManager } from "@oh-my-pi/pi-coding-agent/config/settings-manager"; +import { AgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session"; +import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage"; +import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager"; +import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools/index"; import { nanoid } from "nanoid"; -import { ModelRegistry } from "$c/config/model-registry"; -import { SettingsManager } from "$c/config/settings-manager"; -import { AgentSession } from "$c/session/agent-session"; -import { AuthStorage } from "$c/session/auth-storage"; -import { SessionManager } from "$c/session/session-manager"; -import { createTools, type ToolSession } from "$c/tools/index"; /** * API key for authenticated tests. Tests using this should be wrapped in diff --git a/packages/coding-agent/tsconfig.publish.json b/packages/coding-agent/tsconfig.publish.json new file mode 100644 index 000000000..c32362384 --- /dev/null +++ b/packages/coding-agent/tsconfig.publish.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "noEmit": true, + "baseUrl": ".", + "paths": { + "@oh-my-pi/pi-coding-agent": ["./src/index.ts"], + "@oh-my-pi/pi-coding-agent/hooks": ["./src/extensibility/hooks/index.ts"], + "@oh-my-pi/pi-coding-agent/*": ["./src/*"] + } + }, + "include": ["src/**/*.ts", "src/bun-imports.d.ts"] +} diff --git a/packages/omp-stats/package.json b/packages/omp-stats/package.json index 917affb5b..303ab3994 100644 --- a/packages/omp-stats/package.json +++ b/packages/omp-stats/package.json @@ -38,7 +38,8 @@ "scripts": { "dev": "bun run src/index.ts", "check": "tsgo --noEmit && tsgo --noEmit -p tsconfig.client.json", - "build": "bun run build.ts && tsgo -p tsconfig.build.json" + "build": "bun run build.ts && tsgo -p tsconfig.build.json", + "prepublishOnly": "cp tsconfig.publish.json tsconfig.json" }, "author": "Can Bölük", "license": "MIT", diff --git a/packages/omp-stats/tsconfig.publish.json b/packages/omp-stats/tsconfig.publish.json new file mode 100644 index 000000000..2f918c94a --- /dev/null +++ b/packages/omp-stats/tsconfig.publish.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "noEmit": true, + "baseUrl": ".", + "paths": { + "@oh-my-pi/omp-stats": ["./src/index.ts"], + "@oh-my-pi/omp-stats/*": ["./src/*"] + } + }, + "include": ["src/**/*.ts", "src/**/*.tsx"] +} diff --git a/packages/pi-utils/package.json b/packages/pi-utils/package.json index 3b2ab6923..305cb656b 100644 --- a/packages/pi-utils/package.json +++ b/packages/pi-utils/package.json @@ -18,7 +18,8 @@ "scripts": { "check": "tsgo --noEmit", "build": "tsgo -p tsconfig.build.json", - "test": "vitest --run" + "test": "vitest --run", + "prepublishOnly": "cp tsconfig.publish.json tsconfig.json" }, "author": "Can Bölük", "license": "MIT", diff --git a/packages/pi-utils/tsconfig.publish.json b/packages/pi-utils/tsconfig.publish.json new file mode 100644 index 000000000..6f0defa2b --- /dev/null +++ b/packages/pi-utils/tsconfig.publish.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "noEmit": true, + "baseUrl": ".", + "paths": { + "@oh-my-pi/pi-utils": ["./src/index.ts"], + "@oh-my-pi/pi-utils/*": ["./src/*"] + } + }, + "include": ["src/**/*.ts"] +} diff --git a/packages/tui/CHANGELOG.md b/packages/tui/CHANGELOG.md index a87b09d64..2ae7c9e6b 100644 --- a/packages/tui/CHANGELOG.md +++ b/packages/tui/CHANGELOG.md @@ -7,6 +7,9 @@ - Added terminal graphics encoding (iTerm2/Kitty) for mermaid diagrams with automatic width scaling - Added mermaid block extraction and deduplication utilities (extractMermaidBlocks) +### Changed +- Updated TypeScript configuration for better publish-time configuration handling with tsconfig.publish.json + ### Fixed - Fixed crash when terminal becomes unavailable (EIO errors) by exiting gracefully instead of throwing - Fixed potential errors during emergency terminal restore when terminal is already dead diff --git a/packages/tui/package.json b/packages/tui/package.json index f09356331..a02fc8f6e 100644 --- a/packages/tui/package.json +++ b/packages/tui/package.json @@ -5,7 +5,8 @@ "type": "module", "main": "src/index.ts", "scripts": { - "test": "bun test test/*.test.ts" + "test": "bun test test/*.test.ts", + "prepublishOnly": "cp tsconfig.publish.json tsconfig.json" }, "files": [ "src/**/*", diff --git a/packages/tui/tsconfig.publish.json b/packages/tui/tsconfig.publish.json new file mode 100644 index 000000000..e69ed6f31 --- /dev/null +++ b/packages/tui/tsconfig.publish.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "noEmit": true, + "baseUrl": ".", + "paths": { + "@oh-my-pi/pi-tui": ["./src/index.ts"], + "@oh-my-pi/pi-tui/*": ["./src/*"] + } + }, + "include": ["src/**/*.ts"] +} diff --git a/tsconfig.json b/tsconfig.json index 0178bb14b..00172c6b2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,6 +18,9 @@ "@oh-my-pi/pi-coding-agent": ["./packages/coding-agent/src/index.ts"], "@oh-my-pi/pi-coding-agent/hooks": ["./packages/coding-agent/src/extensibility/hooks/index.ts"], "@oh-my-pi/pi-coding-agent/*": ["./packages/coding-agent/src/*"], + "@oh-my-pi/omp-stats": ["./packages/omp-stats/src/index.ts"], + "@oh-my-pi/omp-stats/src/*": ["./packages/omp-stats/src/*"], + "@oh-my-pi/omp-stats/*": ["./packages/omp-stats/src/*"], "@sinclair/typebox": ["./node_modules/@sinclair/typebox"], "@oh-my-pi/pi-tui": ["./packages/tui/src/index.ts"], "@oh-my-pi/pi-tui/*": ["./packages/tui/src/*"]