refactor(build): migrated imports to path aliases with per-package tsconfig support
- converted relative imports to path aliases ($c/*, $ai/*, $tui/*, etc.) across all packages - added per-package tsconfig.json with complete path mappings for runtime resolution - set importModuleSpecifier to non-relative for IDE auto-import preferences - updated dev script to run from monorepo root for consistent path resolution
This commit is contained in:
+2
-2
@@ -6,8 +6,8 @@
|
||||
"packages/*"
|
||||
],
|
||||
"scripts": {
|
||||
"install:dev": "bun install && bun --cwd=packages/coding-agent link && bun --cwd=packages/ai link && bun --cwd=packages/mom link",
|
||||
"dev": "bun --cwd=packages/coding-agent src/cli.ts",
|
||||
"install:dev": "bun install && 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",
|
||||
"fix": "biome check --write --unsafe . && bun --cwd=packages/coding-agent run format-prompts",
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
} from "@oh-my-pi/pi-ai";
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { agentLoop, agentLoopContinue } from "../src/agent-loop";
|
||||
import { agentLoop, agentLoopContinue } from "$agent/agent-loop";
|
||||
import type {
|
||||
AgentContext,
|
||||
AgentEvent,
|
||||
@@ -17,7 +17,7 @@ import type {
|
||||
AgentTool,
|
||||
AgentToolContext,
|
||||
ToolCallContext,
|
||||
} from "../src/types";
|
||||
} from "$agent/types";
|
||||
|
||||
// Mock stream for testing - mimics MockAssistantStream
|
||||
class MockAssistantStream extends EventStream<AssistantMessageEvent, AssistantMessage> {
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
type Usage,
|
||||
} from "@oh-my-pi/pi-ai";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { Agent } from "../src/index";
|
||||
import { Agent } from "$agent/index";
|
||||
|
||||
class MockAssistantStream extends EventStream<AssistantMessageEvent, AssistantMessage> {
|
||||
constructor() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { AssistantMessage, Model, ToolResultMessage, UserMessage } from "@oh-my-pi/pi-ai";
|
||||
import { getModel } from "@oh-my-pi/pi-ai";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { Agent } from "../src/index";
|
||||
import { Agent } from "$agent/index";
|
||||
import { calculateTool } from "./utils/calculate";
|
||||
|
||||
async function basicPrompt(model: Model<any>) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { type Static, Type } from "@sinclair/typebox";
|
||||
import type { AgentTool, AgentToolResult } from "../../src/types";
|
||||
import type { AgentTool, AgentToolResult } from "$agent/types";
|
||||
|
||||
export interface CalculateResult extends AgentToolResult<undefined> {
|
||||
content: Array<{ type: "text"; text: string }>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { type Static, Type } from "@sinclair/typebox";
|
||||
import type { AgentTool, AgentToolResult } from "../../src/types";
|
||||
import type { AgentTool, AgentToolResult } from "$agent/types";
|
||||
|
||||
export interface GetCurrentTimeResult extends AgentToolResult<{ utcTimestamp: number }> {}
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"$agent/*": ["./src/*"],
|
||||
"$ai/*": ["../ai/src/*"],
|
||||
"$c/*": ["../coding-agent/src/*"],
|
||||
"$tui/*": ["../tui/src/*"],
|
||||
"$stats/*": ["../omp-stats/src/*"],
|
||||
"@oh-my-pi/pi-agent-core": ["./src/index.ts"],
|
||||
"@oh-my-pi/pi-agent-core/*": ["./src/*"],
|
||||
"@oh-my-pi/pi-ai": ["../ai/src/index.ts"],
|
||||
"@oh-my-pi/pi-ai/*": ["../ai/src/*"],
|
||||
"@oh-my-pi/pi-utils": ["../pi-utils/src/index.ts"],
|
||||
"@oh-my-pi/pi-utils/*": ["../pi-utils/src/*"],
|
||||
"@oh-my-pi/pi-coding-agent": ["../coding-agent/src/index.ts"],
|
||||
"@oh-my-pi/pi-coding-agent/*": ["../coding-agent/src/*"],
|
||||
"@oh-my-pi/pi-tui": ["../tui/src/index.ts"],
|
||||
"@oh-my-pi/pi-tui/*": ["../tui/src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
ToolResultStatus,
|
||||
} from "@aws-sdk/client-bedrock-runtime";
|
||||
|
||||
import { calculateCost } from "../models";
|
||||
import { calculateCost } from "$ai/models";
|
||||
import type {
|
||||
Api,
|
||||
AssistantMessage,
|
||||
@@ -34,10 +34,10 @@ import type {
|
||||
Tool,
|
||||
ToolCall,
|
||||
ToolResultMessage,
|
||||
} from "../types";
|
||||
import { AssistantMessageEventStream } from "../utils/event-stream";
|
||||
import { parseStreamingJson } from "../utils/json-parse";
|
||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode";
|
||||
} from "$ai/types";
|
||||
import { AssistantMessageEventStream } from "$ai/utils/event-stream";
|
||||
import { parseStreamingJson } from "$ai/utils/json-parse";
|
||||
import { sanitizeSurrogates } from "$ai/utils/sanitize-unicode";
|
||||
import { transformMessages } from "./transform-messages";
|
||||
|
||||
export interface BedrockOptions extends StreamOptions {
|
||||
|
||||
@@ -4,8 +4,8 @@ import type {
|
||||
MessageCreateParamsStreaming,
|
||||
MessageParam,
|
||||
} from "@anthropic-ai/sdk/resources/messages";
|
||||
import { calculateCost } from "../models";
|
||||
import { getEnvApiKey, OUTPUT_FALLBACK_BUFFER } from "../stream";
|
||||
import { calculateCost } from "$ai/models";
|
||||
import { getEnvApiKey, OUTPUT_FALLBACK_BUFFER } from "$ai/stream";
|
||||
import type {
|
||||
Api,
|
||||
AssistantMessage,
|
||||
@@ -21,11 +21,11 @@ import type {
|
||||
Tool,
|
||||
ToolCall,
|
||||
ToolResultMessage,
|
||||
} from "../types";
|
||||
import { AssistantMessageEventStream } from "../utils/event-stream";
|
||||
import { parseStreamingJson } from "../utils/json-parse";
|
||||
import { formatErrorMessageWithRetryAfter } from "../utils/retry-after";
|
||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode";
|
||||
} 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";
|
||||
|
||||
import { transformMessages } from "./transform-messages";
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ 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 "../models";
|
||||
import { calculateCost } from "$ai/models";
|
||||
import type {
|
||||
Api,
|
||||
AssistantMessage,
|
||||
@@ -23,10 +23,10 @@ import type {
|
||||
Tool,
|
||||
ToolCall,
|
||||
ToolResultMessage,
|
||||
} from "../types";
|
||||
import { AssistantMessageEventStream } from "../utils/event-stream";
|
||||
import { parseStreamingJson } from "../utils/json-parse";
|
||||
import { formatErrorMessageWithRetryAfter } from "../utils/retry-after";
|
||||
} 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 type { McpToolDefinition } from "./cursor/gen/agent_pb";
|
||||
import {
|
||||
AgentClientMessageSchema,
|
||||
|
||||
@@ -6,8 +6,8 @@ import type {
|
||||
UsageProvider,
|
||||
UsageReport,
|
||||
UsageWindow,
|
||||
} from "../usage";
|
||||
import { refreshGoogleCloudToken } from "../utils/oauth/google-gemini-cli";
|
||||
} from "$ai/usage";
|
||||
import { refreshGoogleCloudToken } from "$ai/utils/oauth/google-gemini-cli";
|
||||
|
||||
const DEFAULT_ENDPOINT = "https://cloudcode-pa.googleapis.com";
|
||||
const CACHE_TTL_MS = 60_000;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { createHash } from "node:crypto";
|
||||
import type { Content, ThinkingConfig } from "@google/genai";
|
||||
import { abortableSleep } from "@oh-my-pi/pi-utils";
|
||||
import { calculateCost } from "../models";
|
||||
import { calculateCost } from "$ai/models";
|
||||
import type {
|
||||
Api,
|
||||
AssistantMessage,
|
||||
@@ -18,9 +18,9 @@ import type {
|
||||
TextContent,
|
||||
ThinkingContent,
|
||||
ToolCall,
|
||||
} from "../types";
|
||||
import { AssistantMessageEventStream } from "../utils/event-stream";
|
||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode";
|
||||
} from "$ai/types";
|
||||
import { AssistantMessageEventStream } from "$ai/utils/event-stream";
|
||||
import { sanitizeSurrogates } from "$ai/utils/sanitize-unicode";
|
||||
import {
|
||||
convertMessages,
|
||||
convertTools,
|
||||
|
||||
@@ -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 "../types";
|
||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode";
|
||||
import type { Context, ImageContent, Model, StopReason, TextContent, Tool } from "$ai/types";
|
||||
import { sanitizeSurrogates } from "$ai/utils/sanitize-unicode";
|
||||
import { transformMessages } from "./transform-messages";
|
||||
|
||||
type GoogleApiType = "google-generative-ai" | "google-gemini-cli" | "google-vertex";
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
type ThinkingConfig,
|
||||
ThinkingLevel,
|
||||
} from "@google/genai";
|
||||
import { calculateCost } from "../models";
|
||||
import { calculateCost } from "$ai/models";
|
||||
import type {
|
||||
Api,
|
||||
AssistantMessage,
|
||||
@@ -16,10 +16,10 @@ import type {
|
||||
TextContent,
|
||||
ThinkingContent,
|
||||
ToolCall,
|
||||
} from "../types";
|
||||
import { AssistantMessageEventStream } from "../utils/event-stream";
|
||||
import { formatErrorMessageWithRetryAfter } from "../utils/retry-after";
|
||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode";
|
||||
} from "$ai/types";
|
||||
import { AssistantMessageEventStream } from "$ai/utils/event-stream";
|
||||
import { formatErrorMessageWithRetryAfter } from "$ai/utils/retry-after";
|
||||
import { sanitizeSurrogates } from "$ai/utils/sanitize-unicode";
|
||||
import type { GoogleThinkingLevel } from "./google-gemini-cli";
|
||||
import {
|
||||
convertMessages,
|
||||
|
||||
@@ -4,8 +4,8 @@ import {
|
||||
GoogleGenAI,
|
||||
type ThinkingConfig,
|
||||
} from "@google/genai";
|
||||
import { calculateCost } from "../models";
|
||||
import { getEnvApiKey } from "../stream";
|
||||
import { calculateCost } from "$ai/models";
|
||||
import { getEnvApiKey } from "$ai/stream";
|
||||
import type {
|
||||
Api,
|
||||
AssistantMessage,
|
||||
@@ -16,10 +16,10 @@ import type {
|
||||
TextContent,
|
||||
ThinkingContent,
|
||||
ToolCall,
|
||||
} from "../types";
|
||||
import { AssistantMessageEventStream } from "../utils/event-stream";
|
||||
import { formatErrorMessageWithRetryAfter } from "../utils/retry-after";
|
||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode";
|
||||
} from "$ai/types";
|
||||
import { AssistantMessageEventStream } from "$ai/utils/event-stream";
|
||||
import { formatErrorMessageWithRetryAfter } from "$ai/utils/retry-after";
|
||||
import { sanitizeSurrogates } from "$ai/utils/sanitize-unicode";
|
||||
import type { GoogleThinkingLevel } from "./google-gemini-cli";
|
||||
import {
|
||||
convertMessages,
|
||||
|
||||
@@ -9,9 +9,8 @@ import type {
|
||||
ResponseOutputMessage,
|
||||
ResponseReasoningItem,
|
||||
} from "openai/resources/responses/responses";
|
||||
import packageJson from "../../package.json" with { type: "json" };
|
||||
import { calculateCost } from "../models";
|
||||
import { getEnvApiKey } from "../stream";
|
||||
import { calculateCost } from "$ai/models";
|
||||
import { getEnvApiKey } from "$ai/stream";
|
||||
import type {
|
||||
Api,
|
||||
AssistantMessage,
|
||||
@@ -24,11 +23,12 @@ import type {
|
||||
ThinkingContent,
|
||||
Tool,
|
||||
ToolCall,
|
||||
} from "../types";
|
||||
import { AssistantMessageEventStream } from "../utils/event-stream";
|
||||
import { parseStreamingJson } from "../utils/json-parse";
|
||||
import { formatErrorMessageWithRetryAfter } from "../utils/retry-after";
|
||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode";
|
||||
} 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";
|
||||
import packageJson from "../../package.json" with { type: "json" };
|
||||
import {
|
||||
CODEX_BASE_URL,
|
||||
JWT_CLAIM_PATH,
|
||||
|
||||
@@ -8,8 +8,8 @@ import type {
|
||||
ChatCompletionMessageParam,
|
||||
ChatCompletionToolMessageParam,
|
||||
} from "openai/resources/chat/completions";
|
||||
import { calculateCost } from "../models";
|
||||
import { getEnvApiKey } from "../stream";
|
||||
import { calculateCost } from "$ai/models";
|
||||
import { getEnvApiKey } from "$ai/stream";
|
||||
import type {
|
||||
AssistantMessage,
|
||||
Context,
|
||||
@@ -23,11 +23,11 @@ import type {
|
||||
ThinkingContent,
|
||||
Tool,
|
||||
ToolCall,
|
||||
} from "../types";
|
||||
import { AssistantMessageEventStream } from "../utils/event-stream";
|
||||
import { parseStreamingJson } from "../utils/json-parse";
|
||||
import { formatErrorMessageWithRetryAfter } from "../utils/retry-after";
|
||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode";
|
||||
} 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";
|
||||
import { transformMessages } from "./transform-messages";
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,8 +10,8 @@ import type {
|
||||
ResponseOutputMessage,
|
||||
ResponseReasoningItem,
|
||||
} from "openai/resources/responses/responses";
|
||||
import { calculateCost } from "../models";
|
||||
import { getEnvApiKey } from "../stream";
|
||||
import { calculateCost } from "$ai/models";
|
||||
import { getEnvApiKey } from "$ai/stream";
|
||||
import type {
|
||||
Api,
|
||||
AssistantMessage,
|
||||
@@ -24,11 +24,11 @@ import type {
|
||||
ThinkingContent,
|
||||
Tool,
|
||||
ToolCall,
|
||||
} from "../types";
|
||||
import { AssistantMessageEventStream } from "../utils/event-stream";
|
||||
import { parseStreamingJson } from "../utils/json-parse";
|
||||
import { formatErrorMessageWithRetryAfter } from "../utils/retry-after";
|
||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode";
|
||||
} 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";
|
||||
import { transformMessages } from "./transform-messages";
|
||||
|
||||
/** Fast deterministic hash to shorten long strings */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Api, AssistantMessage, Message, Model, ToolCall, ToolResultMessage } from "../types";
|
||||
import type { Api, AssistantMessage, Message, Model, ToolCall, ToolResultMessage } from "$ai/types";
|
||||
|
||||
/**
|
||||
* Normalize tool call ID for cross-provider compatibility.
|
||||
|
||||
@@ -7,7 +7,7 @@ import type {
|
||||
UsageReport,
|
||||
UsageStatus,
|
||||
UsageWindow,
|
||||
} from "../usage";
|
||||
} from "$ai/usage";
|
||||
|
||||
const DEFAULT_ENDPOINT = "https://api.anthropic.com/api/oauth";
|
||||
const DEFAULT_CACHE_TTL_MS = 60_000;
|
||||
|
||||
@@ -14,7 +14,7 @@ import type {
|
||||
UsageReport,
|
||||
UsageStatus,
|
||||
UsageWindow,
|
||||
} from "../usage";
|
||||
} from "$ai/usage";
|
||||
|
||||
const COPILOT_HEADERS = {
|
||||
"User-Agent": "GitHubCopilotChat/0.35.0",
|
||||
|
||||
@@ -7,8 +7,8 @@ import type {
|
||||
UsageReport,
|
||||
UsageStatus,
|
||||
UsageWindow,
|
||||
} from "../usage";
|
||||
import { refreshAntigravityToken } from "../utils/oauth/google-antigravity";
|
||||
} from "$ai/usage";
|
||||
import { refreshAntigravityToken } from "$ai/utils/oauth/google-antigravity";
|
||||
|
||||
interface AntigravityQuotaInfo {
|
||||
remainingFraction?: number;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Buffer } from "node:buffer";
|
||||
import { CODEX_BASE_URL } from "../providers/openai-codex/constants";
|
||||
import { CODEX_BASE_URL } from "$ai/providers/openai-codex/constants";
|
||||
import type {
|
||||
UsageAmount,
|
||||
UsageCache,
|
||||
@@ -9,7 +9,7 @@ import type {
|
||||
UsageProvider,
|
||||
UsageReport,
|
||||
UsageWindow,
|
||||
} from "../usage";
|
||||
} from "$ai/usage";
|
||||
|
||||
const CODEX_USAGE_PATH = "wham/usage";
|
||||
const DEFAULT_CACHE_TTL_MS = 60_000;
|
||||
|
||||
@@ -7,7 +7,7 @@ import type {
|
||||
UsageReport,
|
||||
UsageStatus,
|
||||
UsageWindow,
|
||||
} from "../usage";
|
||||
} from "$ai/usage";
|
||||
|
||||
const DEFAULT_ENDPOINT = "https://api.z.ai";
|
||||
const QUOTA_PATH = "/api/monitor/usage/quota/limit";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { AssistantMessage, AssistantMessageEvent } from "../types";
|
||||
import type { AssistantMessage, AssistantMessageEvent } from "$ai/types";
|
||||
|
||||
// Generic event stream class for async iteration
|
||||
export class EventStream<T, R = T> implements AsyncIterable<T> {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
import { abortableSleep } from "@oh-my-pi/pi-utils";
|
||||
import { getModels } from "../../models";
|
||||
import { getModels } from "$ai/models";
|
||||
import type { OAuthCredentials } from "./types";
|
||||
|
||||
const decode = (s: string) => atob(s);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { AssistantMessage } from "../types";
|
||||
import type { AssistantMessage } from "$ai/types";
|
||||
|
||||
/**
|
||||
* Regex patterns to detect context overflow errors from different providers.
|
||||
|
||||
@@ -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 "../types";
|
||||
import type { Tool, ToolCall } from "$ai/types";
|
||||
|
||||
// ============================================================================
|
||||
// Type Coercion Utilities
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getModel } from "../src/models";
|
||||
import { complete, stream } from "../src/stream";
|
||||
import type { Api, Context, Model, OptionsForApi } from "../src/types";
|
||||
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)
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
import type { ChildProcess } from "node:child_process";
|
||||
import { execSync, spawn } from "node:child_process";
|
||||
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
||||
import { getModel } from "../src/models";
|
||||
import { complete } from "../src/stream";
|
||||
import type { AssistantMessage, Context, Model, Usage } from "../src/types";
|
||||
import { isContextOverflow } from "../src/utils/overflow";
|
||||
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)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { transformMessages } from "../src/providers/transform-messages";
|
||||
import type { AssistantMessage, Model, ToolResultMessage } from "../src/types";
|
||||
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"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getModel } from "../src/models";
|
||||
import { complete } from "../src/stream";
|
||||
import type { Api, AssistantMessage, Context, Model, OptionsForApi, UserMessage } from "../src/types";
|
||||
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)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { isThinkingPart, retainThoughtSignature } from "../src/providers/google-shared";
|
||||
import { isThinkingPart, retainThoughtSignature } from "$ai/providers/google-shared";
|
||||
|
||||
describe("Google thinking detection (thoughtSignature)", () => {
|
||||
it("treats part.thought === true as thinking", () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getModel } from "../src/models";
|
||||
import { complete } from "../src/stream";
|
||||
import type { Api, AssistantMessage, Context, Message, Model, Tool, ToolResultMessage } from "../src/types";
|
||||
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({
|
||||
|
||||
@@ -71,9 +71,9 @@ import { execSync } from "node:child_process";
|
||||
import { mkdirSync, rmSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
||||
import { getModel } from "../src/models";
|
||||
import { complete } from "../src/stream";
|
||||
import type { Api, Context, ImageContent, Model, OptionsForApi, UserMessage } from "../src/types";
|
||||
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");
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { Api, Context, Model, Tool, ToolResultMessage } from "../src/index";
|
||||
import { complete, getModel } from "../src/index";
|
||||
import type { OptionsForApi } from "../src/types";
|
||||
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)
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { homedir } from "os";
|
||||
import { dirname, join } from "path";
|
||||
import { getOAuthApiKey } from "../src/utils/oauth/index";
|
||||
import type { OAuthCredentials, OAuthProvider } from "../src/utils/oauth/types";
|
||||
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");
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { type RequestBody, transformRequestBody } from "../src/providers/openai-codex/request-transformer";
|
||||
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 () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { afterEach, describe, expect, it, vi } from "bun:test";
|
||||
import { createTempDirSync } from "@oh-my-pi/pi-utils";
|
||||
import { streamOpenAICodexResponses } from "../src/providers/openai-codex-responses";
|
||||
import type { Context, Model } from "../src/types";
|
||||
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;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { type RequestBody, transformRequestBody } from "../src/providers/openai-codex/request-transformer";
|
||||
import { parseCodexError } from "../src/providers/openai-codex/response-handler";
|
||||
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";
|
||||
|
||||
@@ -3,10 +3,10 @@ import { readFileSync } from "node:fs";
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { join } from "path";
|
||||
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
||||
import { getModel } from "../src/models";
|
||||
import { complete, stream } from "../src/stream";
|
||||
import type { Api, Context, ImageContent, Model, OptionsForApi, Tool, ToolResultMessage } from "../src/types";
|
||||
import { StringEnum } from "../src/utils/typebox-helpers";
|
||||
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)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getModel } from "../src/models";
|
||||
import { stream } from "../src/stream";
|
||||
import type { Api, Context, Model, OptionsForApi } from "../src/types";
|
||||
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)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import type { Tool, ToolCall } from "../src/types";
|
||||
import { validateToolArguments } from "../src/utils/validation";
|
||||
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", () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getModel } from "../src/models";
|
||||
import { complete } from "../src/stream";
|
||||
import type { Api, Context, Model, OptionsForApi, Tool } from "../src/types";
|
||||
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)
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
*/
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getModel } from "../src/models";
|
||||
import { complete } from "../src/stream";
|
||||
import type { Api, Context, Model, OptionsForApi, Usage } from "../src/types";
|
||||
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)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getModel } from "../src/models";
|
||||
import { complete } from "../src/stream";
|
||||
import type { Api, Context, Model, OptionsForApi, ToolResultMessage } from "../src/types";
|
||||
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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getModel } from "../src/models";
|
||||
import { stream } from "../src/stream";
|
||||
import type { Context, Model } from "../src/types";
|
||||
import { getModel } from "$ai/models";
|
||||
import { stream } from "$ai/stream";
|
||||
import type { Context, Model } from "$ai/types";
|
||||
|
||||
function makeContext(): Context {
|
||||
return {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { MODELS } from "../src/models.generated";
|
||||
import { complete } from "../src/stream";
|
||||
import type { Model } from "../src/types";
|
||||
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);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"$ai/*": ["./src/*"],
|
||||
"$c/*": ["../coding-agent/src/*"],
|
||||
"$tui/*": ["../tui/src/*"],
|
||||
"$agent/*": ["../agent/src/*"],
|
||||
"$stats/*": ["../omp-stats/src/*"],
|
||||
"@oh-my-pi/pi-ai": ["./src/index.ts"],
|
||||
"@oh-my-pi/pi-ai/*": ["./src/*"],
|
||||
"@oh-my-pi/pi-agent-core": ["../agent/src/index.ts"],
|
||||
"@oh-my-pi/pi-agent-core/*": ["../agent/src/*"],
|
||||
"@oh-my-pi/pi-utils": ["../pi-utils/src/index.ts"],
|
||||
"@oh-my-pi/pi-utils/*": ["../pi-utils/src/*"],
|
||||
"@oh-my-pi/pi-coding-agent": ["../coding-agent/src/index.ts"],
|
||||
"@oh-my-pi/pi-coding-agent/*": ["../coding-agent/src/*"],
|
||||
"@oh-my-pi/pi-tui": ["../tui/src/index.ts"],
|
||||
"@oh-my-pi/pi-tui/*": ["../tui/src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
||||
import chalk from "chalk";
|
||||
import { APP_NAME, CONFIG_DIR_NAME, ENV_AGENT_DIR } from "../config";
|
||||
import { BUILTIN_TOOLS } from "../core/tools/index";
|
||||
import { APP_NAME, CONFIG_DIR_NAME, ENV_AGENT_DIR } from "$c/config";
|
||||
import { BUILTIN_TOOLS } from "$c/core/tools/index";
|
||||
|
||||
export type Mode = "text" | "json" | "rpc";
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
*/
|
||||
|
||||
import chalk from "chalk";
|
||||
import { APP_NAME, getAgentDir } from "../config";
|
||||
import { SettingsManager } from "../core/settings-manager";
|
||||
import { SETTINGS_DEFS, type SettingDef } from "../modes/interactive/components/settings-defs";
|
||||
import { theme } from "../modes/interactive/theme/theme";
|
||||
import { APP_NAME, getAgentDir } from "$c/config";
|
||||
import { SettingsManager } from "$c/core/settings-manager";
|
||||
import { SETTINGS_DEFS, type SettingDef } from "$c/modes/interactive/components/settings-defs";
|
||||
import { theme } from "$c/modes/interactive/theme/theme";
|
||||
|
||||
// =============================================================================
|
||||
// Types
|
||||
|
||||
@@ -6,9 +6,9 @@ import { existsSync, readFileSync, statSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import type { ImageContent } from "@oh-my-pi/pi-ai";
|
||||
import chalk from "chalk";
|
||||
import { resolveReadPath } from "../core/tools/path-utils";
|
||||
import { formatDimensionNote, resizeImage } from "../utils/image-resize";
|
||||
import { detectSupportedImageMimeTypeFromFile } from "../utils/mime";
|
||||
import { resolveReadPath } from "$c/core/tools/path-utils";
|
||||
import { formatDimensionNote, resizeImage } from "$c/utils/image-resize";
|
||||
import { detectSupportedImageMimeTypeFromFile } from "$c/utils/mime";
|
||||
|
||||
export interface ProcessedFiles {
|
||||
text: string;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
*/
|
||||
|
||||
import type { Api, Model } from "@oh-my-pi/pi-ai";
|
||||
import type { ModelRegistry } from "../core/model-registry";
|
||||
import { fuzzyFilter } from "../utils/fuzzy";
|
||||
import type { ModelRegistry } from "$c/core/model-registry";
|
||||
import { fuzzyFilter } from "$c/utils/fuzzy";
|
||||
|
||||
/**
|
||||
* Format a number as human-readable (e.g., 200000 -> "200K", 1000000 -> "1M")
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
*/
|
||||
|
||||
import chalk from "chalk";
|
||||
import { APP_NAME } from "../config";
|
||||
import { PluginManager, parseSettingValue, validateSetting } from "../core/plugins/index";
|
||||
import { theme } from "../modes/interactive/theme/theme";
|
||||
import { APP_NAME } from "$c/config";
|
||||
import { PluginManager, parseSettingValue, validateSetting } from "$c/core/plugins/index";
|
||||
import { theme } from "$c/modes/interactive/theme/theme";
|
||||
|
||||
// =============================================================================
|
||||
// Types
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
*/
|
||||
|
||||
import { ProcessTerminal, TUI } from "@oh-my-pi/pi-tui";
|
||||
import type { SessionInfo } from "../core/session-manager";
|
||||
import { SessionSelectorComponent } from "../modes/interactive/components/session-selector";
|
||||
import type { SessionInfo } from "$c/core/session-manager";
|
||||
import { SessionSelectorComponent } from "$c/modes/interactive/components/session-selector";
|
||||
|
||||
/** Show TUI session selector and return selected session path or null if cancelled */
|
||||
export async function selectSession(sessions: SessionInfo[]): Promise<string | null> {
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
import { $ } from "bun";
|
||||
import chalk from "chalk";
|
||||
import { APP_NAME } from "../config";
|
||||
import { theme } from "../modes/interactive/theme/theme";
|
||||
import { APP_NAME } from "$c/config";
|
||||
import { theme } from "$c/modes/interactive/theme/theme";
|
||||
|
||||
export type SetupComponent = "python";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import chalk from "chalk";
|
||||
import { APP_NAME } from "../config";
|
||||
import { APP_NAME } from "$c/config";
|
||||
|
||||
// =============================================================================
|
||||
// Types
|
||||
|
||||
@@ -11,8 +11,8 @@ import { dirname } from "node:path";
|
||||
import { Readable } from "node:stream";
|
||||
import { pipeline } from "node:stream/promises";
|
||||
import chalk from "chalk";
|
||||
import { APP_NAME, VERSION } from "../config";
|
||||
import { theme } from "../modes/interactive/theme/theme";
|
||||
import { APP_NAME, VERSION } from "$c/config";
|
||||
import { theme } from "$c/modes/interactive/theme/theme";
|
||||
|
||||
/**
|
||||
* Detect if we're running as a Bun compiled binary.
|
||||
|
||||
@@ -28,10 +28,10 @@ import type {
|
||||
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 "../capability/rule";
|
||||
import { getAgentDbPath } from "../config";
|
||||
import { theme } from "../modes/interactive/theme/theme";
|
||||
import ttsrInterruptTemplate from "../prompts/system/ttsr-interrupt.md" with { type: "text" };
|
||||
import type { Rule } from "$c/capability/rule";
|
||||
import { getAgentDbPath } from "$c/config";
|
||||
import { theme } from "$c/modes/interactive/theme/theme";
|
||||
import ttsrInterruptTemplate from "$c/prompts/system/ttsr-interrupt.md" with { type: "text" };
|
||||
import { type BashResult, executeBash as executeBashCommand } from "./bash-executor";
|
||||
import {
|
||||
type CompactionResult,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Database } from "bun:sqlite";
|
||||
import { chmodSync, existsSync, mkdirSync } from "node:fs";
|
||||
import { dirname } from "node:path";
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import { getAgentDbPath } from "../config";
|
||||
import { getAgentDbPath } from "$c/config";
|
||||
import type { AuthCredential } from "./auth-storage";
|
||||
import type { Settings } from "./settings-manager";
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import {
|
||||
zaiUsageProvider,
|
||||
} from "@oh-my-pi/pi-ai";
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import { getAgentDbPath, getAuthPath } from "../config";
|
||||
import { getAgentDbPath, getAuthPath } from "$c/config";
|
||||
import { AgentStorage } from "./agent-storage";
|
||||
import { migrateJsonStorage } from "./storage-migration";
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
*/
|
||||
|
||||
import { cspawn, Exception, ptree } from "@oh-my-pi/pi-utils";
|
||||
import { getShellConfig } from "../utils/shell";
|
||||
import { getOrCreateSnapshot, getSnapshotSourceCommand } from "../utils/shell-snapshot";
|
||||
import { getShellConfig } from "$c/utils/shell";
|
||||
import { getOrCreateSnapshot, getSnapshotSourceCommand } from "$c/utils/shell-snapshot";
|
||||
import { OutputSink } from "./streaming-output";
|
||||
|
||||
export interface BashExecutorOptions {
|
||||
|
||||
@@ -8,16 +8,16 @@
|
||||
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 branchSummaryPrompt from "../../prompts/compaction/branch-summary.md" with { type: "text" };
|
||||
import branchSummaryPreamble from "../../prompts/compaction/branch-summary-preamble.md" with { type: "text" };
|
||||
import {
|
||||
convertToLlm,
|
||||
createBranchSummaryMessage,
|
||||
createCompactionSummaryMessage,
|
||||
createCustomMessage,
|
||||
} from "../messages";
|
||||
import { renderPromptTemplate } from "../prompt-templates";
|
||||
import type { ReadonlySessionManager, SessionEntry } from "../session-manager";
|
||||
} from "$c/core/messages";
|
||||
import { renderPromptTemplate } from "$c/core/prompt-templates";
|
||||
import type { ReadonlySessionManager, SessionEntry } from "$c/core/session-manager";
|
||||
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 { estimateTokens } from "./compaction";
|
||||
import {
|
||||
computeFileLists,
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
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 compactionSummaryPrompt from "../../prompts/compaction/compaction-summary.md" with { type: "text" };
|
||||
import compactionTurnPrefixPrompt from "../../prompts/compaction/compaction-turn-prefix.md" with { type: "text" };
|
||||
import compactionUpdateSummaryPrompt from "../../prompts/compaction/compaction-update-summary.md" with { type: "text" };
|
||||
import { convertToLlm, createBranchSummaryMessage, createCustomMessage } from "../messages";
|
||||
import { renderPromptTemplate } from "../prompt-templates";
|
||||
import type { CompactionEntry, SessionEntry } from "../session-manager";
|
||||
import { convertToLlm, createBranchSummaryMessage, createCustomMessage } from "$c/core/messages";
|
||||
import { renderPromptTemplate } from "$c/core/prompt-templates";
|
||||
import type { CompactionEntry, SessionEntry } from "$c/core/session-manager";
|
||||
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 {
|
||||
computeFileLists,
|
||||
createFileOps,
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
||||
import type { Message } from "@oh-my-pi/pi-ai";
|
||||
import fileOperationsTemplate from "../../prompts/system/file-operations.md" with { type: "text" };
|
||||
import summarizationSystemPrompt from "../../prompts/system/summarization-system.md" with { type: "text" };
|
||||
import { renderPromptTemplate } from "../prompt-templates";
|
||||
import { renderPromptTemplate } from "$c/core/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" };
|
||||
|
||||
// ============================================================================
|
||||
// File Operation Tracking
|
||||
|
||||
@@ -8,7 +8,7 @@ import type {
|
||||
AgentToolUpdateCallback,
|
||||
} from "@oh-my-pi/pi-agent-core";
|
||||
import type { CursorMcpCall, CursorExecHandlers as ICursorExecHandlers, ToolResultMessage } from "@oh-my-pi/pi-ai";
|
||||
import { resolveToCwd } from "../tools/path-utils";
|
||||
import { resolveToCwd } from "$c/core/tools/path-utils";
|
||||
|
||||
interface CursorExecBridgeOptions {
|
||||
cwd: string;
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
* multiple reviewer agents based on diff weight and locality.
|
||||
*/
|
||||
|
||||
import reviewRequestTemplate from "../../../../prompts/review-request.md" with { type: "text" };
|
||||
import type { HookCommandContext } from "../../../hooks/types";
|
||||
import { renderPromptTemplate } from "../../../prompt-templates";
|
||||
import type { CustomCommand, CustomCommandAPI } from "../../types";
|
||||
import type { CustomCommand, CustomCommandAPI } from "$c/core/custom-commands/types";
|
||||
import type { HookCommandContext } from "$c/core/hooks/types";
|
||||
import { renderPromptTemplate } from "$c/core/prompt-templates";
|
||||
import reviewRequestTemplate from "$c/prompts/review-request.md" with { type: "text" };
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Types
|
||||
|
||||
@@ -9,9 +9,9 @@ import { type Dirent, existsSync, readdirSync } from "node:fs";
|
||||
import * as path from "node:path";
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import * as typebox from "@sinclair/typebox";
|
||||
import { getAgentDir, getConfigDirs } from "../../config";
|
||||
import * as piCodingAgent from "../../index";
|
||||
import { execCommand } from "../exec";
|
||||
import { getAgentDir, getConfigDirs } from "$c/config";
|
||||
import { execCommand } from "$c/core/exec";
|
||||
import * as piCodingAgent from "$c/index";
|
||||
import { ReviewCommand } from "./bundled/review";
|
||||
import type {
|
||||
CustomCommand,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* arbitrary logic with full access to the hook context.
|
||||
*/
|
||||
|
||||
import type { ExecOptions, ExecResult, HookCommandContext } from "../hooks/types";
|
||||
import type { ExecOptions, ExecResult, HookCommandContext } from "$c/core/hooks/types";
|
||||
|
||||
// Re-export for custom commands to use
|
||||
export type { ExecOptions, ExecResult, HookCommandContext };
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import { existsSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { getAgentDir } from "../config";
|
||||
import { getAgentDir } from "$c/config";
|
||||
|
||||
export interface CustomShareResult {
|
||||
/** URL to display/open (optional - script may handle everything itself) */
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
import * as path from "node:path";
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import * as typebox from "@sinclair/typebox";
|
||||
import { toolCapability } from "../../capability/tool";
|
||||
import { type CustomTool, loadCapability } from "../../discovery";
|
||||
import { expandPath } from "../../discovery/helpers";
|
||||
import * as piCodingAgent from "../../index";
|
||||
import { theme } from "../../modes/interactive/theme/theme";
|
||||
import type { ExecOptions } from "../exec";
|
||||
import { execCommand } from "../exec";
|
||||
import type { HookUIContext } from "../hooks/types";
|
||||
import { getAllPluginToolPaths } from "../plugins/loader";
|
||||
import { toolCapability } from "$c/capability/tool";
|
||||
import type { ExecOptions } from "$c/core/exec";
|
||||
import { execCommand } from "$c/core/exec";
|
||||
import type { HookUIContext } from "$c/core/hooks/types";
|
||||
import { getAllPluginToolPaths } from "$c/core/plugins/loader";
|
||||
import { type CustomTool, loadCapability } from "$c/discovery";
|
||||
import { expandPath } from "$c/discovery/helpers";
|
||||
import * as piCodingAgent from "$c/index";
|
||||
import { theme } from "$c/modes/interactive/theme/theme";
|
||||
import type { CustomToolAPI, CustomToolFactory, LoadedCustomTool, ToolLoadError } from "./types";
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,11 +9,11 @@ import type { AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agen
|
||||
import type { Model } from "@oh-my-pi/pi-ai";
|
||||
import type { Component } from "@oh-my-pi/pi-tui";
|
||||
import type { Static, TSchema } from "@sinclair/typebox";
|
||||
import type { Theme } from "../../modes/interactive/theme/theme";
|
||||
import type { ExecOptions, ExecResult } from "../exec";
|
||||
import type { HookUIContext } from "../hooks/types";
|
||||
import type { ModelRegistry } from "../model-registry";
|
||||
import type { ReadonlySessionManager } from "../session-manager";
|
||||
import type { ExecOptions, ExecResult } from "$c/core/exec";
|
||||
import type { HookUIContext } from "$c/core/hooks/types";
|
||||
import type { ModelRegistry } from "$c/core/model-registry";
|
||||
import type { ReadonlySessionManager } from "$c/core/session-manager";
|
||||
import type { Theme } from "$c/modes/interactive/theme/theme";
|
||||
|
||||
/** Alias for clarity */
|
||||
export type CustomToolUIContext = HookUIContext;
|
||||
@@ -22,7 +22,7 @@ export type CustomToolUIContext = HookUIContext;
|
||||
export type { AgentToolResult, AgentToolUpdateCallback };
|
||||
|
||||
// Re-export for backward compatibility
|
||||
export type { ExecOptions, ExecResult } from "../exec";
|
||||
export type { ExecOptions, ExecResult } from "$c/core/exec";
|
||||
|
||||
/** API passed to custom tool factory (stable across session changes) */
|
||||
export interface CustomToolAPI {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import type { AgentTool, AgentToolResult, AgentToolUpdateCallback, RenderResultOptions } from "@oh-my-pi/pi-agent-core";
|
||||
import type { Component } from "@oh-my-pi/pi-tui";
|
||||
import type { Static, TSchema } from "@sinclair/typebox";
|
||||
import type { Theme } from "../../modes/interactive/theme/theme";
|
||||
import type { Theme } from "$c/modes/interactive/theme/theme";
|
||||
import type { CustomTool, CustomToolContext, LoadedCustomTool } from "./types";
|
||||
|
||||
export class CustomToolAdapter<TParams extends TSchema = TSchema, TDetails = any, TTheme extends Theme = Theme>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { existsSync, writeFileSync } from "node:fs";
|
||||
import { basename } from "node:path";
|
||||
import type { AgentState } from "@oh-my-pi/pi-agent-core";
|
||||
import { APP_NAME } from "../../config";
|
||||
import { getResolvedThemeColors, getThemeExportColors } from "../../modes/interactive/theme/theme";
|
||||
import { SessionManager } from "../session-manager";
|
||||
import { APP_NAME } from "$c/config";
|
||||
import { SessionManager } from "$c/core/session-manager";
|
||||
import { getResolvedThemeColors, getThemeExportColors } from "$c/modes/interactive/theme/theme";
|
||||
|
||||
// Pre-generated template (created by scripts/generate-template.ts at publish time)
|
||||
import { TEMPLATE } from "./template.generated";
|
||||
|
||||
@@ -10,14 +10,14 @@ 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 "../../capability/extension-module";
|
||||
import { loadCapability } from "../../discovery";
|
||||
import { expandPath, getExtensionNameFromPath } from "../../discovery/helpers";
|
||||
import * as piCodingAgent from "../../index";
|
||||
import { EventBus } from "../event-bus";
|
||||
import type { ExecOptions } from "../exec";
|
||||
import { execCommand } from "../exec";
|
||||
import type { CustomMessage } from "../messages";
|
||||
import { type ExtensionModule, extensionModuleCapability } from "$c/capability/extension-module";
|
||||
import { EventBus } from "$c/core/event-bus";
|
||||
import type { ExecOptions } from "$c/core/exec";
|
||||
import { execCommand } from "$c/core/exec";
|
||||
import type { CustomMessage } from "$c/core/messages";
|
||||
import { loadCapability } from "$c/discovery";
|
||||
import { expandPath, getExtensionNameFromPath } from "$c/discovery/helpers";
|
||||
import * as piCodingAgent from "$c/index";
|
||||
import type {
|
||||
Extension,
|
||||
ExtensionAPI,
|
||||
|
||||
@@ -6,9 +6,9 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
||||
import type { ImageContent, Model } from "@oh-my-pi/pi-ai";
|
||||
import type { KeyId } from "@oh-my-pi/pi-tui";
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import { type Theme, theme } from "../../modes/interactive/theme/theme";
|
||||
import type { ModelRegistry } from "../model-registry";
|
||||
import type { SessionManager } from "../session-manager";
|
||||
import type { ModelRegistry } from "$c/core/model-registry";
|
||||
import type { SessionManager } from "$c/core/session-manager";
|
||||
import { type Theme, theme } from "$c/modes/interactive/theme/theme";
|
||||
import type {
|
||||
BeforeAgentStartEvent,
|
||||
BeforeAgentStartEventResult,
|
||||
|
||||
@@ -12,28 +12,28 @@ import type { AgentMessage, AgentToolResult, AgentToolUpdateCallback, ThinkingLe
|
||||
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 * as piCodingAgent from "../../index";
|
||||
import type { Theme } from "../../modes/interactive/theme/theme";
|
||||
import type { BashResult } from "../bash-executor";
|
||||
import type { CompactionPreparation, CompactionResult } from "../compaction";
|
||||
import type { EventBus } from "../event-bus";
|
||||
import type { ExecOptions, ExecResult } from "../exec";
|
||||
import type { KeybindingsManager } from "../keybindings";
|
||||
import type { CustomMessage } from "../messages";
|
||||
import type { ModelRegistry } from "../model-registry";
|
||||
import type { PythonResult } from "../python-executor";
|
||||
import type { BashResult } from "$c/core/bash-executor";
|
||||
import type { CompactionPreparation, CompactionResult } from "$c/core/compaction";
|
||||
import type { EventBus } from "$c/core/event-bus";
|
||||
import type { ExecOptions, ExecResult } from "$c/core/exec";
|
||||
import type { KeybindingsManager } from "$c/core/keybindings";
|
||||
import type { CustomMessage } from "$c/core/messages";
|
||||
import type { ModelRegistry } from "$c/core/model-registry";
|
||||
import type { PythonResult } from "$c/core/python-executor";
|
||||
import type {
|
||||
BranchSummaryEntry,
|
||||
CompactionEntry,
|
||||
ReadonlySessionManager,
|
||||
SessionEntry,
|
||||
SessionManager,
|
||||
} from "../session-manager";
|
||||
import type { BashToolDetails, FindToolDetails, GrepToolDetails, LsToolDetails, ReadToolDetails } from "../tools";
|
||||
import type { EditToolDetails } from "../tools/patch";
|
||||
} from "$c/core/session-manager";
|
||||
import type { BashToolDetails, FindToolDetails, GrepToolDetails, LsToolDetails, ReadToolDetails } from "$c/core/tools";
|
||||
import type { EditToolDetails } from "$c/core/tools/patch";
|
||||
import type * as piCodingAgent from "$c/index";
|
||||
import type { Theme } from "$c/modes/interactive/theme/theme";
|
||||
|
||||
export type { ExecOptions, ExecResult } from "../exec";
|
||||
export type { AppAction, KeybindingsManager } from "../keybindings";
|
||||
export type { ExecOptions, ExecResult } from "$c/core/exec";
|
||||
export type { AppAction, KeybindingsManager } from "$c/core/keybindings";
|
||||
export type { AgentToolResult, AgentToolUpdateCallback };
|
||||
|
||||
// ============================================================================
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import type { AgentTool, AgentToolContext, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
||||
import type { ImageContent, TextContent } from "@oh-my-pi/pi-ai";
|
||||
import type { Static, TSchema } from "@sinclair/typebox";
|
||||
import type { Theme } from "../../modes/interactive/theme/theme";
|
||||
import type { Theme } from "$c/modes/interactive/theme/theme";
|
||||
import type { ExtensionRunner } from "./runner";
|
||||
import type { RegisteredTool, ToolCallEventResult, ToolResultEventResult } from "./types";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Database } from "bun:sqlite";
|
||||
import { mkdirSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import { getAgentDir } from "../config";
|
||||
import { getAgentDir } from "$c/config";
|
||||
|
||||
export interface HistoryEntry {
|
||||
id: number;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// biome-ignore assist/source/organizeImports: biome is not smart
|
||||
export type { ReadonlySessionManager, UsageStatistics } from "../session-manager";
|
||||
export type { ReadonlySessionManager, UsageStatistics } from "$c/core/session-manager";
|
||||
export {
|
||||
discoverAndLoadHooks,
|
||||
loadHooks,
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
import * as path from "node:path";
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import * as typebox from "@sinclair/typebox";
|
||||
import { hookCapability } from "../../capability/hook";
|
||||
import type { Hook } from "../../discovery";
|
||||
import { loadCapability } from "../../discovery";
|
||||
import { expandPath } from "../../discovery/helpers";
|
||||
import * as piCodingAgent from "../../index";
|
||||
import type { HookMessage } from "../messages";
|
||||
import type { SessionManager } from "../session-manager";
|
||||
import { hookCapability } from "$c/capability/hook";
|
||||
import type { HookMessage } from "$c/core/messages";
|
||||
import type { SessionManager } from "$c/core/session-manager";
|
||||
import type { Hook } from "$c/discovery";
|
||||
import { loadCapability } from "$c/discovery";
|
||||
import { expandPath } from "$c/discovery/helpers";
|
||||
import * as piCodingAgent from "$c/index";
|
||||
import { execCommand } from "./runner";
|
||||
import type { ExecOptions, HookAPI, HookFactory, HookMessageRenderer, RegisteredCommand } from "./types";
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
||||
import type { Model } from "@oh-my-pi/pi-ai";
|
||||
import { theme } from "../../modes/interactive/theme/theme";
|
||||
import type { ModelRegistry } from "../model-registry";
|
||||
import type { SessionManager } from "../session-manager";
|
||||
import type { ModelRegistry } from "$c/core/model-registry";
|
||||
import type { SessionManager } from "$c/core/session-manager";
|
||||
import { theme } from "$c/modes/interactive/theme/theme";
|
||||
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 "../exec";
|
||||
export { execCommand } from "$c/core/exec";
|
||||
|
||||
/** No-op UI context used when no UI is available */
|
||||
const noOpUIContext: HookUIContext = {
|
||||
|
||||
@@ -8,23 +8,29 @@
|
||||
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 { Theme } from "../../modes/interactive/theme/theme";
|
||||
import type { CompactionPreparation, CompactionResult } from "../compaction/index";
|
||||
import type { ExecOptions, ExecResult } from "../exec";
|
||||
import type { HookMessage } from "../messages";
|
||||
import type { ModelRegistry } from "../model-registry";
|
||||
import type { CompactionPreparation, CompactionResult } from "$c/core/compaction/index";
|
||||
import type { ExecOptions, ExecResult } from "$c/core/exec";
|
||||
import type { HookMessage } from "$c/core/messages";
|
||||
import type { ModelRegistry } from "$c/core/model-registry";
|
||||
import type {
|
||||
BranchSummaryEntry,
|
||||
CompactionEntry,
|
||||
ReadonlySessionManager,
|
||||
SessionEntry,
|
||||
SessionManager,
|
||||
} from "../session-manager";
|
||||
import type { BashToolDetails, FindToolDetails, GrepToolDetails, LsToolDetails, ReadToolDetails } from "../tools/index";
|
||||
import type { EditToolDetails } from "../tools/patch";
|
||||
} from "$c/core/session-manager";
|
||||
import type {
|
||||
BashToolDetails,
|
||||
FindToolDetails,
|
||||
GrepToolDetails,
|
||||
LsToolDetails,
|
||||
ReadToolDetails,
|
||||
} from "$c/core/tools/index";
|
||||
import type { EditToolDetails } from "$c/core/tools/patch";
|
||||
import type { Theme } from "$c/modes/interactive/theme/theme";
|
||||
|
||||
// Re-export for backward compatibility
|
||||
export type { ExecOptions, ExecResult } from "../exec";
|
||||
export type { ExecOptions, ExecResult } from "$c/core/exec";
|
||||
|
||||
/**
|
||||
* UI context for hooks to request interactive UI from the harness.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* - rule://<name> - Reads rule content
|
||||
*/
|
||||
|
||||
import type { Rule } from "../../capability/rule";
|
||||
import type { Rule } from "$c/capability/rule";
|
||||
import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
|
||||
|
||||
export interface RuleProtocolOptions {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
import * as path from "node:path";
|
||||
import type { Skill } from "../skills";
|
||||
import type { Skill } from "$c/core/skills";
|
||||
import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
|
||||
|
||||
export interface SkillProtocolOptions {
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
setEditorKeybindings,
|
||||
} from "@oh-my-pi/pi-tui";
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import { getAgentDir } from "../config";
|
||||
import { getAgentDir } from "$c/config";
|
||||
|
||||
/**
|
||||
* Application-level actions (coding agent specific).
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* Uses the capability system to load MCP servers from multiple sources.
|
||||
*/
|
||||
|
||||
import { mcpCapability } from "../../capability/mcp";
|
||||
import type { MCPServer } from "../../discovery";
|
||||
import { loadCapability } from "../../discovery";
|
||||
import { mcpCapability } from "$c/capability/mcp";
|
||||
import type { MCPServer } from "$c/discovery";
|
||||
import { loadCapability } from "$c/discovery";
|
||||
import type { MCPServerConfig } from "./types";
|
||||
|
||||
/** Options for loading MCP configs */
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
*/
|
||||
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import { AgentStorage } from "../agent-storage";
|
||||
import type { LoadedCustomTool } from "../custom-tools/types";
|
||||
import { AgentStorage } from "$c/core/agent-storage";
|
||||
import type { LoadedCustomTool } from "$c/core/custom-tools/types";
|
||||
import { type MCPLoadResult, MCPManager } from "./manager";
|
||||
import { MCPToolCache } from "./tool-cache";
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import type { TSchema } from "@sinclair/typebox";
|
||||
import type { CustomTool } from "../custom-tools/types";
|
||||
import type { CustomTool } from "$c/core/custom-tools/types";
|
||||
import { connectToServer, disconnectServer, listTools } from "./client";
|
||||
import { loadAllMCPConfigs, validateServerConfig } from "./config";
|
||||
import type { MCPToolDetails } from "./tool-bridge";
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
import type { AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
||||
import type { TSchema } from "@sinclair/typebox";
|
||||
import type { SourceMeta } from "../../capability/types";
|
||||
import type { CustomTool, CustomToolContext, CustomToolResult } from "../custom-tools/types";
|
||||
import type { SourceMeta } from "$c/capability/types";
|
||||
import type { CustomTool, CustomToolContext, CustomToolResult } from "$c/core/custom-tools/types";
|
||||
import { callTool } from "./client";
|
||||
import type { MCPContent, MCPServerConnection, MCPToolDefinition } from "./types";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import type { AgentStorage } from "../agent-storage";
|
||||
import type { AgentStorage } from "$c/core/agent-storage";
|
||||
import type { MCPServerConfig, MCPToolDefinition } from "./types";
|
||||
|
||||
const CACHE_VERSION = 1;
|
||||
|
||||
@@ -5,7 +5,13 @@
|
||||
* Based on MCP spec 2025-03-26.
|
||||
*/
|
||||
|
||||
import type { JsonRpcMessage, JsonRpcResponse, MCPHttpServerConfig, MCPSseServerConfig, MCPTransport } from "../types";
|
||||
import type {
|
||||
JsonRpcMessage,
|
||||
JsonRpcResponse,
|
||||
MCPHttpServerConfig,
|
||||
MCPSseServerConfig,
|
||||
MCPTransport,
|
||||
} from "$c/core/mcp/types";
|
||||
|
||||
/** Generate unique request ID */
|
||||
function generateId(): string {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import { type Subprocess, spawn } from "bun";
|
||||
import type { JsonRpcResponse, MCPStdioServerConfig, MCPTransport } from "../types";
|
||||
import type { JsonRpcResponse, MCPStdioServerConfig, MCPTransport } from "$c/core/mcp/types";
|
||||
|
||||
/** Generate unique request ID */
|
||||
function generateId(): string {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
||||
import { type Api, type KnownProvider, type Model, modelsAreEqual } from "@oh-my-pi/pi-ai";
|
||||
import chalk from "chalk";
|
||||
import { isValidThinkingLevel } from "../cli/args";
|
||||
import { isValidThinkingLevel } from "$c/cli/args";
|
||||
import type { ModelRegistry } from "./model-registry";
|
||||
|
||||
/** Default model IDs for each known provider */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { theme } from "../../modes/interactive/theme/theme";
|
||||
import { theme } from "$c/modes/interactive/theme/theme";
|
||||
import type { DoctorCheck } from "./types";
|
||||
|
||||
export async function runDoctorChecks(): Promise<DoctorCheck[]> {
|
||||
|
||||
@@ -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 "../../config";
|
||||
import { getAgentDir } from "$c/config";
|
||||
import type { InstalledPlugin } from "./types";
|
||||
|
||||
const PLUGINS_DIR = join(getAgentDir(), "plugins");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { homedir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { CONFIG_DIR_NAME, getConfigDirPaths } from "../../config";
|
||||
import { CONFIG_DIR_NAME, getConfigDirPaths } from "$c/config";
|
||||
|
||||
// =============================================================================
|
||||
// Plugin Directory Paths
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { join, resolve } from "node:path";
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import Handlebars from "handlebars";
|
||||
import { CONFIG_DIR_NAME, getPromptsDir } from "../config";
|
||||
import { CONFIG_DIR_NAME, getPromptsDir } from "$c/config";
|
||||
import { parseFrontmatter } from "./frontmatter";
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,9 +14,9 @@ import { createServer } from "node:net";
|
||||
import { delimiter, join } from "node:path";
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import type { Subprocess } from "bun";
|
||||
import { getAgentDir } from "../config";
|
||||
import { getShellConfig, killProcessTree } from "../utils/shell";
|
||||
import { getOrCreateSnapshot } from "../utils/shell-snapshot";
|
||||
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";
|
||||
|
||||
@@ -3,8 +3,8 @@ import { delimiter, join } from "node:path";
|
||||
import { logger } from "@oh-my-pi/pi-utils";
|
||||
import { $, type Subprocess } from "bun";
|
||||
import { nanoid } from "nanoid";
|
||||
import { getShellConfig, killProcessTree } from "../utils/shell";
|
||||
import { getOrCreateSnapshot } from "../utils/shell-snapshot";
|
||||
import { getShellConfig, killProcessTree } from "$c/utils/shell";
|
||||
import { getOrCreateSnapshot } from "$c/utils/shell-snapshot";
|
||||
import { acquireSharedGateway, releaseSharedGateway } from "./python-gateway-coordinator";
|
||||
import { loadPythonModules } from "./python-modules";
|
||||
import { PYTHON_PRELUDE } from "./python-prelude";
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user