This commit is contained in:
David Blass
2026-01-10 12:48:02 -05:00
committed by Colin McDonnell
parent c335032c37
commit 89e93d3398
3 changed files with 5 additions and 23 deletions
+1 -1
View File
@@ -138360,7 +138360,7 @@ var Timer = class {
// main.ts
var Inputs = type({
prompt: "string",
effort: Effort
"effort?": Effort
});
async function main(inputs) {
var _stack2 = [];
+1 -1
View File
@@ -23,7 +23,7 @@ import { Timer } from "./utils/timer.ts";
export const Inputs = type({
prompt: "string",
effort: Effort,
"effort?": Effort,
});
export type Inputs = typeof Inputs.infer;
+3 -21
View File
@@ -3,10 +3,8 @@ import { existsSync, readFileSync } from "node:fs";
import { extname, join, resolve } from "node:path";
import { pathToFileURL } from "node:url";
import { fromHere } from "@ark/fs";
import { flatMorph } from "@ark/util";
import arg from "arg";
import { config } from "dotenv";
import { agents } from "./agents/index.ts";
import type { AgentResult } from "./agents/shared.ts";
import { type Inputs, main } from "./main.ts";
import { log } from "./utils/cli.ts";
@@ -25,26 +23,10 @@ export async function run(prompt: string): Promise<AgentResult> {
const originalCwd = process.cwd();
process.chdir(tempDir);
// check if prompt is a pullfrog payload and extract agent
// note: agent from payload will be used by determineAgent with highest precedence
// we don't need to extract it here since main() will parse the payload
const inputs = {
const inputs: Inputs = {
prompt,
...flatMorph(agents, (_, agent) => {
// for OpenCode, scan all API_KEY environment variables
if (agent.name === "opencode") {
const opencodeKeys: Array<[string, string | undefined]> = [];
for (const [key, value] of Object.entries(process.env)) {
if (value && typeof value === "string" && key.includes("API_KEY")) {
opencodeKeys.push([key.toLowerCase(), value]);
}
}
return opencodeKeys;
}
// for other agents, use apiKeyNames
return agent.apiKeyNames.map((inputKey) => [inputKey, process.env[inputKey.toUpperCase()]]);
}),
} as Required<Inputs>;
effort: "nothink",
};
const result = await main(inputs);