diff --git a/packages/coding-agent/src/core/custom-tools/loader.ts b/packages/coding-agent/src/core/custom-tools/loader.ts index 7af81acd..a56b3443 100644 --- a/packages/coding-agent/src/core/custom-tools/loader.ts +++ b/packages/coding-agent/src/core/custom-tools/loader.ts @@ -317,9 +317,8 @@ export async function discoverAndLoadCustomTools( configuredPaths: string[], cwd: string, builtInToolNames: string[], - agentDir?: string, + agentDir: string = getAgentDir(), ): Promise { - const resolvedAgentDir = agentDir ?? getAgentDir(); const allPaths: string[] = []; const seen = new Set(); @@ -335,7 +334,7 @@ export async function discoverAndLoadCustomTools( }; // 1. Global tools: agentDir/tools/ - const globalToolsDir = path.join(resolvedAgentDir, "tools"); + const globalToolsDir = path.join(agentDir, "tools"); addPaths(discoverToolsInDir(globalToolsDir)); // 2. Project-local tools: cwd/.pi/tools/ diff --git a/packages/coding-agent/src/core/hooks/loader.ts b/packages/coding-agent/src/core/hooks/loader.ts index 4f5273c0..1fdd8ffa 100644 --- a/packages/coding-agent/src/core/hooks/loader.ts +++ b/packages/coding-agent/src/core/hooks/loader.ts @@ -215,15 +215,6 @@ function discoverHooksInDir(dir: string): string[] { } } -export interface DiscoverAndLoadHooksOptions { - /** Explicit paths from settings.json or CLI */ - configuredPaths?: string[]; - /** Current working directory */ - cwd?: string; - /** Agent config directory. Default: from getAgentDir() */ - agentDir?: string; -} - /** * Discover and load hooks from standard locations: * 1. agentDir/hooks/*.ts (global) @@ -234,9 +225,8 @@ export interface DiscoverAndLoadHooksOptions { export async function discoverAndLoadHooks( configuredPaths: string[], cwd: string, - agentDir?: string, + agentDir: string = getAgentDir(), ): Promise { - const resolvedAgentDir = agentDir ?? getAgentDir(); const allPaths: string[] = []; const seen = new Set(); @@ -252,7 +242,7 @@ export async function discoverAndLoadHooks( }; // 1. Global hooks: agentDir/hooks/ - const globalHooksDir = path.join(resolvedAgentDir, "hooks"); + const globalHooksDir = path.join(agentDir, "hooks"); addPaths(discoverHooksInDir(globalHooksDir)); // 2. Project-local hooks: cwd/.pi/hooks/ diff --git a/packages/coding-agent/src/core/model-config.ts b/packages/coding-agent/src/core/model-config.ts index d9b82260..04933e91 100644 --- a/packages/coding-agent/src/core/model-config.ts +++ b/packages/coding-agent/src/core/model-config.ts @@ -369,18 +369,7 @@ export async function getAvailableModels( } const availableModels: Model[] = []; - const copilotCreds = loadOAuthCredentials("github-copilot"); - const hasCopilotEnv = !!(process.env.COPILOT_GITHUB_TOKEN || process.env.GH_TOKEN || process.env.GITHUB_TOKEN); - const hasCopilot = !!copilotCreds || hasCopilotEnv; - for (const model of allModels) { - if (model.provider === "github-copilot") { - if (hasCopilot) { - availableModels.push(model); - } - continue; - } - const apiKey = await getApiKeyForModel(model); if (apiKey) { availableModels.push(model);