WIP
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
* Other files in action/ re-export from this file for backward compatibility.
|
* Other files in action/ re-export from this file for backward compatibility.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { type } from "arktype";
|
||||||
import type { Mode } from "./modes.ts";
|
import type { Mode } from "./modes.ts";
|
||||||
|
|
||||||
// mcp name constant
|
// mcp name constant
|
||||||
@@ -41,6 +42,7 @@ export const agentsManifest = {
|
|||||||
|
|
||||||
// agent name type - union of agent slugs
|
// agent name type - union of agent slugs
|
||||||
export type AgentName = keyof typeof agentsManifest;
|
export type AgentName = keyof typeof agentsManifest;
|
||||||
|
export const AgentName = type.enumerated(...Object.keys(agentsManifest));
|
||||||
|
|
||||||
export type AgentApiKeyName = (typeof agentsManifest)[AgentName]["apiKeyNames"][number];
|
export type AgentApiKeyName = (typeof agentsManifest)[AgentName]["apiKeyNames"][number];
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { join } from "node:path";
|
|||||||
import { flatMorph } from "@ark/util";
|
import { flatMorph } from "@ark/util";
|
||||||
import { type } from "arktype";
|
import { type } from "arktype";
|
||||||
import { agents } from "./agents/index.ts";
|
import { agents } from "./agents/index.ts";
|
||||||
import type { AgentName as AgentNameType, Payload } from "./external.ts";
|
import type { AgentName, AgentName as AgentNameType, Payload } from "./external.ts";
|
||||||
import { createMcpConfigs } from "./mcp/config.ts";
|
import { createMcpConfigs } from "./mcp/config.ts";
|
||||||
import { modes } from "./modes.ts";
|
import { modes } from "./modes.ts";
|
||||||
import packageJson from "./package.json" with { type: "json" };
|
import packageJson from "./package.json" with { type: "json" };
|
||||||
@@ -21,8 +21,8 @@ import { setupGitAuth, setupGitBranch, setupGitConfig } from "./utils/setup.ts";
|
|||||||
|
|
||||||
// runtime validation using agents (needed for ArkType)
|
// runtime validation using agents (needed for ArkType)
|
||||||
// Note: The AgentName type is defined in external.ts, this is the runtime validator
|
// Note: The AgentName type is defined in external.ts, this is the runtime validator
|
||||||
export const AgentName = type.enumerated(...Object.values(agents).map((agent) => agent.name));
|
|
||||||
|
|
||||||
|
const AGENT_OVERRIDE: AgentName | null = "cursor";
|
||||||
export const AgentInputKey = type.enumerated(
|
export const AgentInputKey = type.enumerated(
|
||||||
...Object.values(agents).flatMap((agent) => agent.apiKeyNames)
|
...Object.values(agents).flatMap((agent) => agent.apiKeyNames)
|
||||||
);
|
);
|
||||||
@@ -177,9 +177,13 @@ async function determineAgent(
|
|||||||
repoContext: ctx.repoContext,
|
repoContext: ctx.repoContext,
|
||||||
});
|
});
|
||||||
|
|
||||||
// precedence: payload.agent > inputs.defaultAgent > repoSettings.defaultAgent > "claude"
|
// precedence: override agent > payload.agent > inputs.defaultAgent > repoSettings.defaultAgent > "claude"
|
||||||
ctx.agentName =
|
ctx.agentName =
|
||||||
ctx.payload.agent || ctx.inputs.defaultAgent || repoSettings.defaultAgent || "claude";
|
(process.env.NODE_ENV === "development" && AGENT_OVERRIDE) ||
|
||||||
|
ctx.payload.agent ||
|
||||||
|
ctx.inputs.defaultAgent ||
|
||||||
|
repoSettings.defaultAgent ||
|
||||||
|
"claude"; // TODO: look at env vars
|
||||||
ctx.agent = agents[ctx.agentName];
|
ctx.agent = agents[ctx.agentName];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user