@growthagent/ci 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +24 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -452,6 +452,20 @@ async function openSession() {
|
|
|
452
452
|
};
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
|
+
function writeGoogleProviderConfig(piDir, model, runToken) {
|
|
456
|
+
const gateway = (process.env.GX_GATEWAY_URL ?? "").replace(/\/$/, "");
|
|
457
|
+
const config = {
|
|
458
|
+
providers: {
|
|
459
|
+
"growthagent-google": {
|
|
460
|
+
baseUrl: `${gateway}/v1beta`,
|
|
461
|
+
api: "google-generative-ai",
|
|
462
|
+
apiKey: runToken,
|
|
463
|
+
models: [{ id: model, name: model, input: ["text"], contextWindow: 1e6 }]
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
writeFileSync(path4.join(piDir, "..", "models.json"), JSON.stringify(config, null, 2));
|
|
468
|
+
}
|
|
455
469
|
async function implement() {
|
|
456
470
|
const issue = readIssue();
|
|
457
471
|
const refusal = refuseUntrustedAuthor(issue);
|
|
@@ -477,22 +491,21 @@ async function implement() {
|
|
|
477
491
|
const prompt = buildPrompt(meta, extractBriefing(issue.body));
|
|
478
492
|
const provider = process.env.GX_CI_PROVIDER ?? "anthropic";
|
|
479
493
|
const model = process.env.GX_CI_MODEL ?? (provider === "google" ? "gemini-3.7-flash" : "claude-opus-5");
|
|
480
|
-
if (provider === "google") {
|
|
481
|
-
console.log(
|
|
482
|
-
"\u25B8 NOTE: GX_CI_PROVIDER=google routes model traffic directly to Google on your own GEMINI_API_KEY. It is billed by Google to you and is not metered by Growth Agent."
|
|
483
|
-
);
|
|
484
|
-
}
|
|
485
494
|
const session = await openSession();
|
|
486
495
|
if (!session.ok) {
|
|
487
496
|
console.error(`Refusing to run the model: ${session.reason}`);
|
|
488
497
|
return 1;
|
|
489
498
|
}
|
|
490
|
-
|
|
499
|
+
const piProvider = provider === "google" ? "growthagent-google" : provider;
|
|
500
|
+
if (provider === "google") {
|
|
501
|
+
writeGoogleProviderConfig(skillsDir, model, session.token);
|
|
502
|
+
}
|
|
503
|
+
console.log(`\u25B8 running pi (${piProvider}/${model})`);
|
|
491
504
|
let piStatus;
|
|
492
505
|
try {
|
|
493
506
|
const pi = spawnSync(
|
|
494
507
|
"pi",
|
|
495
|
-
["-p", prompt, "--provider",
|
|
508
|
+
["-p", prompt, "--provider", piProvider, "--model", model, "--thinking", "high"],
|
|
496
509
|
{
|
|
497
510
|
stdio: ["ignore", "inherit", "inherit"],
|
|
498
511
|
env: {
|
|
@@ -501,8 +514,10 @@ async function implement() {
|
|
|
501
514
|
ANTHROPIC_BASE_URL: process.env.GX_GATEWAY_URL ?? process.env.ANTHROPIC_BASE_URL,
|
|
502
515
|
ANTHROPIC_API_KEY: session.token,
|
|
503
516
|
// The long-lived credential must not survive into the model's
|
|
504
|
-
// environment, whatever else it might read there.
|
|
505
|
-
|
|
517
|
+
// environment, whatever else it might read there. Nor may a raw
|
|
518
|
+
// provider key: everything is spent through the run token.
|
|
519
|
+
GROWTH_AGENT_TOKEN: "",
|
|
520
|
+
GEMINI_API_KEY: ""
|
|
506
521
|
}
|
|
507
522
|
}
|
|
508
523
|
);
|