merge main
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ import { agent, installFromNpmTarball } from "./shared.ts";
|
||||
|
||||
export const claude = agent({
|
||||
name: "claude",
|
||||
inputKey: "anthropic_api_key",
|
||||
inputKeys: ["anthropic_api_key"],
|
||||
install: async () => {
|
||||
const versionRange = packageJson.dependencies["@anthropic-ai/claude-agent-sdk"] || "latest";
|
||||
return await installFromNpmTarball({
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import { agent, installFromNpmTarball } from "./shared.ts";
|
||||
|
||||
export const codex = agent({
|
||||
name: "codex",
|
||||
inputKey: "openai_api_key",
|
||||
inputKeys: ["openai_api_key"],
|
||||
install: async () => {
|
||||
return await installFromNpmTarball({
|
||||
packageName: "@openai/codex",
|
||||
|
||||
+1
-1
@@ -10,4 +10,4 @@ export const agents = {
|
||||
jules,
|
||||
} as const;
|
||||
|
||||
export type AgentInputKey = (typeof agents)[keyof typeof agents]["inputKey"];
|
||||
export type AgentInputKey = (typeof agents)[keyof typeof agents]["inputKeys"][number];
|
||||
|
||||
+2
-18
@@ -6,7 +6,7 @@ import { agent, installFromNpmTarball } from "./shared.ts";
|
||||
|
||||
export const jules = agent({
|
||||
name: "jules",
|
||||
inputKey: "google_api_key",
|
||||
inputKeys: ["google_api_key", "gemini_api_key"],
|
||||
install: async () => {
|
||||
return await installFromNpmTarball({
|
||||
packageName: "@google/jules",
|
||||
@@ -24,26 +24,13 @@ export const jules = agent({
|
||||
if (!apiKey) {
|
||||
throw new Error("google_api_key is required for jules agent");
|
||||
}
|
||||
process.env.GOOGLE_API_KEY = apiKey;
|
||||
|
||||
const repoContext = parseRepoContext();
|
||||
const repoName = `${repoContext.owner}/${repoContext.name}`;
|
||||
|
||||
log.info(`Creating Jules session for ${repoName}...`);
|
||||
|
||||
// Set API key as environment variable for CLI authentication
|
||||
// Note: The CLI may require browser-based auth via 'jules login' in interactive mode
|
||||
// In CI, we rely on the API key being set as an environment variable
|
||||
const env: Record<string, string> = {
|
||||
GOOGLE_API_KEY: apiKey,
|
||||
JULES_API_KEY: apiKey,
|
||||
};
|
||||
// Copy over existing env vars, filtering out undefined values
|
||||
for (const [key, value] of Object.entries(process.env)) {
|
||||
if (value !== undefined) {
|
||||
env[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new remote session
|
||||
const sessionPrompt = addInstructions(prompt);
|
||||
log.info(`Starting session with prompt: ${prompt.substring(0, 100)}...`);
|
||||
@@ -53,7 +40,6 @@ export const jules = agent({
|
||||
const createResult = await spawn({
|
||||
cmd: "node",
|
||||
args: [cliPath, "remote", "new", "--repo", repoName, "--session", sessionPrompt],
|
||||
env,
|
||||
onStdout: (chunk) => {
|
||||
log.info(chunk.trim());
|
||||
// Try to extract session ID from output
|
||||
@@ -114,7 +100,6 @@ export const jules = agent({
|
||||
const listResult = await spawn({
|
||||
cmd: "node",
|
||||
args: [cliPath, "remote", "list", "--session"],
|
||||
env,
|
||||
onStdout: (chunk) => {
|
||||
// Log session updates
|
||||
const trimmed = chunk.trim();
|
||||
@@ -155,7 +140,6 @@ export const jules = agent({
|
||||
const pullResult = await spawn({
|
||||
cmd: "node",
|
||||
args: [cliPath, "remote", "pull", "--session", sessionId],
|
||||
env,
|
||||
onStdout: (chunk) => {
|
||||
log.info(chunk.trim());
|
||||
},
|
||||
|
||||
+1
-1
@@ -207,7 +207,7 @@ export const agent = <const agent extends Agent>(agent: agent): agent => {
|
||||
|
||||
export type Agent = {
|
||||
name: string;
|
||||
inputKey: string;
|
||||
inputKeys: string[];
|
||||
install: () => Promise<string>;
|
||||
run: (config: AgentConfig) => Promise<AgentResult>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user