From a20c6df291fe713a4cab07f97f0094f52a24390b Mon Sep 17 00:00:00 2001 From: Jeremy Felder Date: Mon, 26 Oct 2026 16:48:15 +0200 Subject: [PATCH] Support Prime Agent 0.10.1 --- CHANGELOG.md | 5 +++++ scripts/ci/check-live.mjs | 4 ++-- src/engine/tools/prime.ts | 12 +++++----- tests/prime.test.ts | 47 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 tests/prime.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index c2d4646..f189296 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## [Unreleased] +### Fixed + +- Prime Agent 0.10.1 launches now use its `settings.json` MCP format and no longer pass the + removed `--extension` or `--no-tools` flags. + ## [0.3.0] - 2026-10-05 ### Highlights diff --git a/scripts/ci/check-live.mjs b/scripts/ci/check-live.mjs index 5f88da8..6a1a914 100644 --- a/scripts/ci/check-live.mjs +++ b/scripts/ci/check-live.mjs @@ -423,7 +423,7 @@ async function checkPrime() { const prompt = `Live cache probe ${runId}. Reply with exactly ${marker}.`; const cacheArgs = [ "launch", "prime", "--model", liveModel, "--", "--print", "--mode", "json", - "--no-tools", "--no-session", "--thinking", liveLevels.offPi, prompt + "--no-session", "--thinking", liveLevels.offPi, prompt ]; await cleanupPrime(); @@ -447,7 +447,7 @@ async function checkPrime() { await cleanupPrime(); const turn = primeTurn(await runZro([ "launch", "prime", "--model", liveModel, "--", "--print", "--mode", "json", - "--no-tools", "--no-session", "--thinking", liveLevels.maxPi, + "--no-session", "--thinking", liveLevels.maxPi, `Think briefly, then include ${reasoningMarker} in the answer.` ], "Prime Agent max reasoning", REASONING_TIMEOUT_MS), reasoningMarker, { expectThinking: true }); assert.ok(turn.hasThinking, "Prime Agent max effort returned no thinking content"); diff --git a/src/engine/tools/prime.ts b/src/engine/tools/prime.ts index 6e83383..10d1a65 100644 --- a/src/engine/tools/prime.ts +++ b/src/engine/tools/prime.ts @@ -6,7 +6,6 @@ import type { ToolModule } from "../types.js"; import { asPlainObject, objectAt } from "./helpers.js"; const PRIME_AGENT_DIR_ENV_KEY = "PRIME_AGENT_CODING_AGENT_DIR"; -const PRIME_MCP_EXTENSION = "npm:pi-mcp-extension@1.5.0"; const PRIME_THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh"] as const; const PRIME_SUBCOMMANDS = new Set([ @@ -18,7 +17,7 @@ function primeArgs(model: string, extraArgs: string[]): string[] { if (extraArgs[0] && PRIME_SUBCOMMANDS.has(extraArgs[0])) { return extraArgs; } - return ["--provider", PROVIDER_ID, "--model", model, "--extension", PRIME_MCP_EXTENSION, ...extraArgs]; + return ["--provider", PROVIDER_ID, "--model", model, ...extraArgs]; } export const primeTool: ToolModule = { @@ -29,7 +28,7 @@ export const primeTool: ToolModule = { const tempHome = path.join(ctx.tempDir, "prime", "home"); const tempAgentDir = path.join(tempHome, ".prime", "agent"); const filePath = path.join(tempAgentDir, "models.json"); - const mcpConfigPath = path.join(tempAgentDir, "mcp.json"); + const settingsPath = path.join(tempAgentDir, "settings.json"); const existing = await readConfig(path.join(existingAgentDir, "models.json"), jsonSerializer); const nextConfig = buildPrimeModelsConfig(existing, ctx.models); return { @@ -49,14 +48,13 @@ export const primeTool: ToolModule = { contents: jsonSerializer.stringify(nextConfig) }, { - path: mcpConfigPath, + path: settingsPath, contents: jsonSerializer.stringify({ mcpServers: { zro: { - transport: "streamable-http", + type: "http", url: MCP_URL, - lifecycle: "eager", - headers: { Authorization: `Bearer ${ctx.apiKey}` } + bearer_token_env_var: ZRO_ENV_KEY } } }) diff --git a/tests/prime.test.ts b/tests/prime.test.ts new file mode 100644 index 0000000..4508b13 --- /dev/null +++ b/tests/prime.test.ts @@ -0,0 +1,47 @@ +import fs from "node:fs/promises"; +import os from "node:os"; +import path from "node:path"; +import { PassThrough } from "node:stream"; +import { describe, expect, it } from "vitest"; +import { primeTool } from "../src/engine/tools/prime.js"; +import { TEST_MODELS } from "./fixtures.js"; +import type { LaunchContext } from "../src/engine/types.js"; + +describe("prime agent launch", () => { + it("writes the current settings.json MCP format without the removed --extension flag", async () => { + const home = await fs.mkdtemp(path.join(os.tmpdir(), "zro-prime-settings-")); + const plan = await primeTool.launch(context(home)); + + expect(plan.args).not.toContain("--extension"); + const settings = plan.files?.find((file) => file.path.endsWith("settings.json")); + expect(settings).toBeDefined(); + expect(JSON.parse(String(settings?.contents))).toEqual({ + mcpServers: { + zro: { + type: "http", + url: "https://zro.moonmath.ai/mcp/zro", + bearer_token_env_var: "ZRO_API_KEY" + } + } + }); + expect(plan.files?.some((file) => file.path.endsWith("mcp.json"))).toBe(false); + }); +}); + +function context(homeDir: string): LaunchContext { + return { + apiKey: "sk-prime-secret", + apiKeySource: "env", + env: {}, + model: "glm-5.3", + models: TEST_MODELS, + extraArgs: [], + homeDir, + cwd: homeDir, + tempDir: path.join(homeDir, "session"), + platform: "linux", + stdin: new PassThrough(), + stdout: new PassThrough(), + stderr: new PassThrough() + }; +}