Merge branch 'main' of https://github.com/pullfrog/action
This commit is contained in:
@@ -6,7 +6,6 @@ import { agent, installFromNpmTarball } from "./shared.ts";
|
||||
|
||||
export const claude = agent({
|
||||
name: "claude",
|
||||
inputKeys: ["anthropic_api_key"],
|
||||
install: async () => {
|
||||
const versionRange = packageJson.dependencies["@anthropic-ai/claude-agent-sdk"] || "latest";
|
||||
return await installFromNpmTarball({
|
||||
|
||||
@@ -6,7 +6,6 @@ import { agent, type ConfigureMcpServersParams, installFromNpmTarball } from "./
|
||||
|
||||
export const codex = agent({
|
||||
name: "codex",
|
||||
inputKeys: ["openai_api_key"],
|
||||
install: async () => {
|
||||
return await installFromNpmTarball({
|
||||
packageName: "@openai/codex",
|
||||
|
||||
@@ -7,7 +7,6 @@ import { agent, type ConfigureMcpServersParams, installFromCurl } from "./shared
|
||||
|
||||
export const cursor = agent({
|
||||
name: "cursor",
|
||||
inputKeys: ["cursor_api_key"],
|
||||
install: async () => {
|
||||
return await installFromCurl({
|
||||
installUrl: "https://cursor.com/install",
|
||||
|
||||
@@ -6,7 +6,6 @@ import { agent, type ConfigureMcpServersParams, installFromGithub } from "./shar
|
||||
|
||||
export const gemini = agent({
|
||||
name: "gemini",
|
||||
inputKeys: ["google_api_key", "gemini_api_key"],
|
||||
install: async () => {
|
||||
return await installFromGithub({
|
||||
owner: "google-gemini",
|
||||
|
||||
@@ -11,5 +11,3 @@ export const agents = {
|
||||
cursor,
|
||||
gemini,
|
||||
} satisfies Record<AgentName, Agent>;
|
||||
|
||||
export type AgentInputKey = (typeof agents)[keyof typeof agents]["inputKeys"][number];
|
||||
|
||||
+13
-7
@@ -5,7 +5,8 @@ import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { pipeline } from "node:stream/promises";
|
||||
import type { McpStdioServerConfig } from "@anthropic-ai/claude-agent-sdk";
|
||||
import type { Payload } from "../external.ts";
|
||||
import type { show } from "@ark/util";
|
||||
import { type AgentManifest, type AgentName, agentsManifest, type Payload } from "../external.ts";
|
||||
import { log } from "../utils/cli.ts";
|
||||
|
||||
/**
|
||||
@@ -330,13 +331,18 @@ export async function installFromCurl({
|
||||
return cliPath;
|
||||
}
|
||||
|
||||
export const agent = <const agent extends Agent>(agent: agent): agent => {
|
||||
return agent;
|
||||
export const agent = <const input extends AgentInput>(input: input): defineAgent<input> => {
|
||||
return { ...input, ...agentsManifest[input.name] } as never;
|
||||
};
|
||||
|
||||
export type Agent = {
|
||||
name: string;
|
||||
inputKeys: string[];
|
||||
export interface AgentInput {
|
||||
name: AgentName;
|
||||
install: () => Promise<string>;
|
||||
run: (config: AgentConfig) => Promise<AgentResult>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface Agent extends AgentInput, AgentManifest {}
|
||||
|
||||
type agentManifest<name extends AgentName> = (typeof agentsManifest)[name];
|
||||
|
||||
type defineAgent<input extends AgentInput> = show<input & agentManifest<input["name"]>>;
|
||||
|
||||
Reference in New Issue
Block a user