Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat: add Pi coding agent providers and review runner (#6350)
[._.]/ Adam Eivye066b3a77236
diff --git a/client/src/components/cos/constants.js b/client/src/components/cos/constants.jsindex c178e95cdd..cdd57a59da 100644--- a/client/src/components/cos/constants.js+++ b/client/src/components/cos/constants.js@@ -288,6 +288,7 @@ export function pinnedPrCompletion(metadata) {// Copy only — the ROSTER is `REVIEWER_VALUES` in `client/src/lib/reviewerPins.js`,// which the server suite pins against the server's own enum.const REVIEWER_COPY = {+ pi: { label: 'Pi', description: 'Pi Coding Agent CLI reviews the supplied diff without tools' },copilot: { label: 'Copilot', description: 'GitHub Copilot (GitHub-only)' },claude: { label: 'Claude', description: 'Claude CLI reviews the PR diff (optional model on Models → Code Reviewers; supports an Ollama-backed Claude for local-only setups)' },antigravity: { label: 'Antigravity', description: 'Antigravity CLI (agy) reviews the PR diff' },diff --git a/client/src/lib/reviewerPins.js b/client/src/lib/reviewerPins.jsindex f7c233fe71..ec153e9418 100644--- a/client/src/lib/reviewerPins.js+++ b/client/src/lib/reviewerPins.js@@ -37,7 +37,7 @@ import {// EFFORT_SELECTABLE_REVIEWERS below: `grok`/`opencode`/`kimi` take a model but no// pickable effort, and Cursor takes both while carrying its effort INSIDE the// model id rather than as a separate flag.-export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude', 'antigravity', 'grok', 'cursor', 'opencode', 'kimi'];+export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude', 'antigravity', 'grok', 'cursor', 'pi', 'opencode', 'kimi'];// The local-LLM backends, which take both a model and an effort.export const LOCAL_LLM_REVIEWERS = ['lmstudio', 'ollama', 'mtplx'];@@ -71,6 +71,7 @@ export const REVIEWER_EFFORT_LEVELS = Object.freeze({codex: CODEX_EFFORT_LEVELS,antigravity: ANTIGRAVITY_EFFORT_LEVELS,cursor: CURSOR_EFFORT_LEVELS,+ pi: ['low', 'medium', 'high', 'xhigh', 'max'],grok: GROK_EFFORT_LEVELS,lmstudio: LOCAL_LLM_EFFORT_LEVELS,ollama: LOCAL_LLM_EFFORT_LEVELS,@@ -132,7 +133,7 @@ export const sanitizeReviewerModelInput = (raw) =>// never offer a slug the server's enum would reject. Mirror of REVIEWER_VALUES —// a reviewer listed here but unknown to the server leaves the user configuring a// review-loop reviewer that never runs; the reverse hides one their install has.-export const REVIEWER_VALUES = ['copilot', 'claude', 'antigravity', 'codex', 'grok', 'cursor', 'opencode', 'kimi', 'lmstudio', 'ollama', 'mtplx'];+export const REVIEWER_VALUES = ['copilot', 'claude', 'antigravity', 'codex', 'grok', 'cursor', 'pi', 'opencode', 'kimi', 'lmstudio', 'ollama', 'mtplx'];// The reviewer a task falls back to when none is configured. Mirror of// DEFAULT_REVIEWER / DEFAULT_REVIEWERS.diff --git a/client/src/utils/providers.js b/client/src/utils/providers.jsindex 532b1c4cbf..9725a743d3 100644--- a/client/src/utils/providers.js+++ b/client/src/utils/providers.js@@ -733,6 +733,7 @@ export const effortLevelsForProvider = (provider, model = null) => {return perModel.length ? perModel : null;}if (isCursorProvider(provider)) return CURSOR_EFFORT_LEVELS;+ if (commandBasename(provider.command) === 'pi') return ['low', 'medium', 'high', 'xhigh', 'max'];if (isGrokProvider(provider)) return GROK_EFFORT_LEVELS;const id = String(provider.id || '').toLowerCase();if (id.startsWith('claude-code') || commandBasename(provider.command) === 'claude') return CLAUDE_EFFORT_LEVELS;diff --git a/client/src/utils/providers.test.js b/client/src/utils/providers.test.jsindex b36d2671f5..389ddacdbd 100644--- a/client/src/utils/providers.test.js+++ b/client/src/utils/providers.test.js@@ -1226,7 +1226,7 @@ describe('supportsModelRefresh', () => {// provider — nothing here can enumerate that, and Models → Harnesses// ("Refresh models") is where their catalog comes from instead.'opencode-zen',- 'openrouter', 'orcarouter', 'slotstream',+ 'openrouter', 'orcarouter', 'pi-cli', 'pi-tui', 'slotstream',]);});});diff --git a/data.reference/providers.json b/data.reference/providers.jsonindex 8b886b8d23..2658ee884a 100644--- a/data.reference/providers.json+++ b/data.reference/providers.json@@ -1,6 +1,37 @@{"activeProvider": "claude-code-tui","providers": {+ "pi-cli": {+ "id": "pi-cli",+ "name": "Pi Coding Agent CLI",+ "type": "cli",+ "command": "pi",+ "args": [+ "--print",+ "--approve"+ ],+ "models": [],+ "defaultModel": null,+ "timeout": 600000,+ "enabled": false,+ "envVars": {},+ "secretEnvVars": []+ },+ "pi-tui": {+ "id": "pi-tui",+ "name": "Pi Coding Agent TUI",+ "type": "tui",+ "command": "pi",+ "args": [+ "--approve"+ ],+ "models": [],+ "defaultModel": null,+ "timeout": 600000,+ "enabled": false,+ "envVars": {},+ "secretEnvVars": []+ },"claude-code": {"id": "claude-code","name": "Claude Code CLI",diff --git a/scripts/migrations/354-pi-provider.js b/scripts/migrations/354-pi-provider.jsnew file mode 100644index 0000000000..e31cfaf6f3--- /dev/null+++ b/scripts/migrations/354-pi-provider.js@@ -0,0 +1,39 @@+/** Add disabled Pi presets without changing configured providers or starting work. */+import { makeProviderSeedMigration } from './_lib.js';++export default makeProviderSeedMigration({+ label: 'Pi Coding Agent',+ defs: [+ {+ "id": "pi-cli",+ "name": "Pi Coding Agent CLI",+ "type": "cli",+ "command": "pi",+ "args": [+ "--print",+ "--approve"+ ],+ "models": [],+ "defaultModel": null,+ "timeout": 600000,+ "enabled": false,+ "envVars": {},+ "secretEnvVars": []+ },+ {+ "id": "pi-tui",+ "name": "Pi Coding Agent TUI",+ "type": "tui",+ "command": "pi",+ "args": [+ "--approve"+ ],+ "models": [],+ "defaultModel": null,+ "timeout": 600000,+ "enabled": false,+ "envVars": {},+ "secretEnvVars": []+ }+],+});diff --git a/scripts/migrations/354-pi-provider.test.js b/scripts/migrations/354-pi-provider.test.jsnew file mode 100644index 0000000000..c9570bd266--- /dev/null+++ b/scripts/migrations/354-pi-provider.test.js@@ -0,0 +1,22 @@+import { it, expect } from 'vitest';+import { mkdtemp, mkdir, writeFile, readFile, rm } from 'node:fs/promises';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import migration from './354-pi-provider.js';++it('adds disabled Pi presets idempotently without replacing local configuration', async () => {+ const rootDir = await mkdtemp(join(tmpdir(), 'pi-seed-'));+ await mkdir(join(rootDir, 'data'));+ const path = join(rootDir, 'data/providers.json');+ const custom = { id: 'pi-cli', command: '/opt/bin/pi', enabled: true };+ await writeFile(path, JSON.stringify({ activeProvider: 'pi-cli', providers: { 'pi-cli': custom } }));+ await migration.up({ rootDir });+ const once = await readFile(path, 'utf8');+ await migration.up({ rootDir });+ expect(await readFile(path, 'utf8')).toBe(once);+ const state = JSON.parse(once);+ expect(state.activeProvider).toBe('pi-cli');+ expect(state.providers['pi-cli']).toEqual(custom);+ expect(state.providers['pi-tui']).toMatchObject({ enabled: false, models: [], defaultModel: null, command: 'pi' });+ await rm(rootDir, { recursive: true });+});diff --git a/server/lib/README.md b/server/lib/README.mdindex b379e80784..fdad37329c 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -552,3 +552,5 @@ pm` default, `NPM_CONFIG_PREFIX`, nvm/Volta) installed `codex` successfully and| `eidoverseCityLayout.js` | Native halls, rooftop landmark clearance and plinths, curated furniture, visitor chambers, and ordered signal bays for PortOS Commons. || `eidoverseCitySurface.js` | Deterministic GLB island scenery, pedestrian paths, gathering terraces, and physical district signs, stored through Eidoverse's content-addressed upload API. || `eidoverseIslandLandscape.js` | `appendEidoverseIslandLandscape` appends deterministic coastline, ocean, and distant mountain-island geometry to the Commons asset. |++| `pi.js` | Pi command identity, headless/TUI arguments, and positional prompt delivery. |diff --git a/server/lib/aiToolkit/defaults/providers.sample.json b/server/lib/aiToolkit/defaults/providers.sample.jsonindex f49a300653..ec0658411e 100644--- a/server/lib/aiToolkit/defaults/providers.sample.json+++ b/server/lib/aiToolkit/defaults/providers.sample.json@@ -1,6 +1,37 @@{"activeProvider": "claude-code-tui","providers": {+ "pi-cli": {+ "id": "pi-cli",+ "name": "Pi Coding Agent CLI",+ "type": "cli",+ "command": "pi",+ "args": [+ "--print",+ "--approve"+ ],+ "models": [],+ "defaultModel": null,+ "timeout": 600000,+ "enabled": false,+ "envVars": {},+ "secretEnvVars": []+ },+ "pi-tui": {+ "id": "pi-tui",+ "name": "Pi Coding Agent TUI",+ "type": "tui",+ "command": "pi",+ "args": [+ "--approve"+ ],+ "models": [],+ "defaultModel": null,+ "timeout": 600000,+ "enabled": false,+ "envVars": {},+ "secretEnvVars": []+ },"claude-code": {"id": "claude-code","name": "Claude Code CLI",diff --git a/server/lib/aiToolkit/internal/modelFetchers.js b/server/lib/aiToolkit/internal/modelFetchers.jsindex 2264f62734..eb09a93f3c 100644--- a/server/lib/aiToolkit/internal/modelFetchers.js+++ b/server/lib/aiToolkit/internal/modelFetchers.js@@ -1,3 +1,4 @@+import { isPiCommand } from './pi.js';/*** The single per-vendor table behind model refresh.*@@ -54,6 +55,10 @@ const displayName = (provider) => String(provider?.name || '').toLowerCase();* gemini) exactly as the old chain did.*/export const MODEL_FETCHERS = [+ {+ key: 'pi', cliMatch: (p) => isPiCommand(p?.command),+ tuiMatch: (p) => isPiCommand(p?.command), fetch: '_fetchPiModels',+ },{key: 'ollama',// Not a command test: the marker can be `ollamaBacked`, an id, or andiff --git a/server/lib/aiToolkit/internal/modelFetchers.test.js b/server/lib/aiToolkit/internal/modelFetchers.test.jsindex 47e414be27..a6189af874 100644--- a/server/lib/aiToolkit/internal/modelFetchers.test.js+++ b/server/lib/aiToolkit/internal/modelFetchers.test.js@@ -15,6 +15,7 @@ const SHIPPED = JSON.parse(readFileSync(resolve(__dirname, '../../../../data.ref// failure mode is silent in both directions (a button that 404s, or a feature// that vanishes with no error at all).const SHIPPED_REFRESHABLE = [+ 'pi-cli', 'pi-tui','antigravity-cli', 'antigravity-tui', 'cerebras', 'claude-code','claude-code-bedrock', 'claude-ollama', 'claude-ollama-tui', 'cursor-cli','cursor-tui', 'grok', 'lmstudio', 'mtplx', 'nvidia-kimi', 'ollama',diff --git a/server/lib/aiToolkit/internal/pi.js b/server/lib/aiToolkit/internal/pi.jsnew file mode 100644index 0000000000..c97a7b253f--- /dev/null+++ b/server/lib/aiToolkit/internal/pi.js@@ -0,0 +1,17 @@+/** Toolkit-local Pi identity and model table parser. */+import { commandBasename } from './commandBasename.js';+export const PI_COMMAND = 'pi';+export const isPiCommand = (command) => commandBasename(command) === PI_COMMAND;++/** Pi lists provider, model, context, max output, thinking, and image columns. */+export function parsePiModelList(stdout) {+ const ids = [];+ for (const line of String(stdout || '').split(/\r?\n/)) {+ const columns = line.trim().split(/\s+/);+ if (columns.length >= 4 && /^[\d.,]+[kKmM]?$/.test(columns[2])+ && /^[a-zA-Z0-9._-]+$/.test(columns[0]) && /^[a-zA-Z0-9._:/-]+$/.test(columns[1])) {+ ids.push(`${columns[0]}/${columns[1]}`);+ }+ }+ return [...new Set(ids)];+}diff --git a/server/lib/aiToolkit/providers.js b/server/lib/aiToolkit/providers.jsindex 2e39364009..861e01acbe 100644--- a/server/lib/aiToolkit/providers.js+++ b/server/lib/aiToolkit/providers.js@@ -1,3 +1,4 @@+import { PI_COMMAND, parsePiModelList } from './internal/pi.js';import { readFile, rename } from 'fs/promises';import { existsSync } from 'fs';import { join, dirname, delimiter, isAbsolute } from 'path';@@ -1321,11 +1322,13 @@ export function createProviderService(config = {}) {* @param {object} provider* @param {string} defaultBin - binary to use when the provider pins no command* @param {(stdout: string) => string[]} parse - vendor's stdout → ids parser- * @returns {Promise<string[]>} a non-empty id list+ * @param {string[]} [listArgs] - catalog command arguments+ * @param {(stdout: string) => boolean} [isEmptyCatalog] - explicit empty-catalog response+ * @returns {Promise<string[]>} parsed ids; empty only when explicitly recognized*/- async _execCliModelList(provider, defaultBin, parse) {+ async _execCliModelList(provider, defaultBin, parse, listArgs = ['models'], isEmptyCatalog = () => false) {const bin = provider?.command || defaultBin;- const { command, args } = prepareWindowsSafeSpawn(bin, ['models']);+ const { command, args } = prepareWindowsSafeSpawn(bin, listArgs);const pending = execFileAsync(command, args, {timeout: 15000,env: { ...process.env, ...provider?.envVars },@@ -1340,16 +1343,23 @@ export function createProviderService(config = {}) {// or not a given binary has the behavior.pending.child?.stdin?.end();const { stdout } = await pending.catch((err) => {+ const output = `${err.stdout || ''}\n${err.stderr || ''}`;+ if (!err.killed && isEmptyCatalog(output)) return { stdout: output };throw new Error(`'${bin} models' failed: ${err?.message || 'could not run the binary'}`);});const listed = parse(stdout);- if (listed.length === 0) {+ if (listed.length === 0 && !isEmptyCatalog(stdout)) {throw new Error(`'${bin} models' returned no model ids`);}return listed;},+ async _fetchPiModels(provider) {+ return this._execCliModelList(provider, PI_COMMAND, parsePiModelList, ['--list-models'],+ (stdout) => /No models available/i.test(stdout) && /\/login/.test(stdout));+ },+/*** cursor-agent ships a `models` subcommand that prints the authoritative* catalog for THIS account and binary version — 177 ids at time of writing,diff --git a/server/lib/aiToolkit/providers.test.js b/server/lib/aiToolkit/providers.test.jsindex 8efdbe022e..9f28001c7e 100644--- a/server/lib/aiToolkit/providers.test.js+++ b/server/lib/aiToolkit/providers.test.js@@ -23,6 +23,25 @@ describe('Provider Service', () => {if (TEST_DATA_DIR) await rm(TEST_DATA_DIR, { recursive: true, force: true });});+ it.skipIf(process.platform === 'win32')('refreshes Pi models and distinguishes authentication from probe failure', async () => {+ const command = join(TEST_DATA_DIR, 'pi');+ const emit = async (text, code = 0) => {+ await writeFile(command, `#!/usr/bin/env node\nif (process.argv[2] !== '--list-models') process.exit(9);\nconsole.log(${JSON.stringify(text)}); process.exit(${code});\n`);+ await chmod(command, 0o755);+ };+ await emit('provider model context max-out thinking images\nexample model-a 200K 32K yes yes');+ const provider = await providerService.createProvider({ name: 'Pi test', type: 'cli', command, models: [] });+ const refreshed = await providerService.refreshProviderModels(provider.id);+ expect(refreshed.models).toEqual(['example/model-a']);+ await emit('Temporary transport failure', 1);+ await expect(providerService.refreshProviderModels(provider.id)).rejects.toThrow('failed');+ expect((await providerService.getProviderById(provider.id)).models).toEqual(['example/model-a']);+ await emit('No models available. Use /login to authenticate.');+ expect(await providerService._fetchPiModels({ command })).toEqual([]);+ await emit('No models available. Use /login to authenticate.', 1);+ expect(await providerService._fetchPiModels({ command })).toEqual([]);+ });+it('should create a provider', async () => {const provider = await providerService.createProvider({name: 'Test Provider',diff --git a/server/lib/cliProviderArgs.js b/server/lib/cliProviderArgs.jsindex e0b0560dc9..0ccddc329b 100644--- a/server/lib/cliProviderArgs.js+++ b/server/lib/cliProviderArgs.js@@ -1,3 +1,4 @@+/** Pi uses --print --approve, --thinking, and a trailing argv prompt (not stdin). *//*** Per-CLI argv conventions for stdin-based prompt delivery.*diff --git a/server/lib/harnessOutput.js b/server/lib/harnessOutput.jsindex 2e0cea6e0a..ce3679a7ea 100644--- a/server/lib/harnessOutput.js+++ b/server/lib/harnessOutput.js@@ -1,3 +1,4 @@+import { parsePiModelList } from './aiToolkit/internal/pi.js';/*** Parsers for what a coding-agent HARNESS prints about itself — its version* banner and its model catalog.@@ -112,6 +113,7 @@ const parseGrokModels = (lines) => lines* `providerRuntimeInstaller.test.js`.*/const MODEL_PARSERS = {+ pi: (lines) => parsePiModelList(lines.join('\n')),opencode: parseOpencodeModels,grok: parseGrokModels,// Delegated — these two vendors' stdout shapes are already owned elsewhere.diff --git a/server/lib/index.js b/server/lib/index.jsindex 213b24d2db..df73fa8ba4 100644--- a/server/lib/index.js+++ b/server/lib/index.js@@ -527,3 +527,4 @@ export * from './eidoverseCityLayout.js';export * from './eidoverseCitySurface.js';export * from './fableLoomShots.js';export * from './eidoverseIslandLandscape.js';+export * from './pi.js';diff --git a/server/lib/pi.js b/server/lib/pi.jsnew file mode 100644index 0000000000..d9eec5a0a7--- /dev/null+++ b/server/lib/pi.js@@ -0,0 +1,25 @@+/** Pi CLI argv conventions. See https://pi.dev/docs/latest/usage. */+import { argvHasFlag, commandBasename, hasModelFlag, buildEffortArgs } from './providerModels.js';++export const PI_COMMAND = 'pi';+export const isPiCommand = (command) => commandBasename(command) === PI_COMMAND;++export function ensurePiTuiArgs(baseArgs = []) {+ const args = [...baseArgs];+ if (!argvHasFlag(args, ['--approve', '-a', '--no-approve', '-na'])) args.push('--approve');+ return args;+}++export function ensurePiHeadlessArgs(baseArgs = [], model, effort) {+ const args = ensurePiTuiArgs(baseArgs);+ if (!argvHasFlag(args, ['--print', '-p'])) args.push('--print');+ if (model && !hasModelFlag(args)) args.push('--model', model);+ args.push(...buildEffortArgs(effort, { command: PI_COMMAND }, args));+ return args;+}++export function preparePiPrompt(args = [], prompt = '') {+ // Prefix prevents pi interpreting a leading @ as a file attachment; -- ends+ // option parsing so a prompt cannot inject CLI flags.+ return { args: [...args, '--', `Task:\n${prompt}`], useStdin: false, cleanup: () => {} };+}diff --git a/server/lib/pi.test.js b/server/lib/pi.test.jsnew file mode 100644index 0000000000..02b2ccd821--- /dev/null+++ b/server/lib/pi.test.js@@ -0,0 +1,38 @@+import { describe, it, expect } from 'vitest';+import { buildCliArgs, prepareCliPrompt } from './cliProviderArgs.js';+import { isPiCommand, ensurePiHeadlessArgs } from './pi.js';+import { PROVIDER_VENDORS, publicReviewRecipe, PUBLIC_REVIEW_NO_TOOL_POSTURE, PUBLIC_REVIEW_ACTIONS_POSTURE } from './providerVendors.js';+import { parseHarnessModels } from './harnessOutput.js';+import { reviewerEffortArgs } from './reviewerConfig.js';++describe('Pi provider boundaries', () => {+ it('constructs headless arguments and delivers option-like prompts as text', () => {+ const provider = { id: 'pi-cli', type: 'cli', command: 'pi', args: [], defaultModel: 'example/model', effort: 'high' };+ const args = buildCliArgs(provider);+ expect(args).toEqual(expect.arrayContaining(['--print', '--approve', '--model', 'example/model', '--thinking', 'high']));+ expect(ensurePiHeadlessArgs(args, null, 'high')).toEqual(expect.arrayContaining(['--thinking', 'high']));+ const prepared = prepareCliPrompt('pi', args, '@private --approve');+ expect(prepared.useStdin).toBe(false);+ expect(prepared.args.slice(-2)).toEqual(['--', 'Task:\n@private --approve']);+ expect(reviewerEffortArgs('pi', 'high')).toEqual(['--thinking', 'high']);+ });+ it('preserves explicitly configured flags and identifies exact binary names', () => {+ const args = ['-p', '-na', '--model=example/custom', '--thinking=low'];+ expect(ensurePiHeadlessArgs(args, 'example/other', 'high')).toEqual(args);+ expect(isPiCommand('/opt/bin/pi.exe')).toBe(true);+ expect(isPiCommand('pipeline')).toBe(false);+ expect(PROVIDER_VENDORS.slice(-2).map(v => v.id)).toEqual(['pi', 'claude']);+ });+ it('discards unsafe saved arguments in the no-tool posture and refuses action review', () => {+ const provider = { type: 'cli', command: 'pi', args: ['--approve', '-e', 'untrusted.js', '--tools', 'bash'] };+ const recipe = publicReviewRecipe(provider, PUBLIC_REVIEW_NO_TOOL_POSTURE);+ const { args } = recipe.spawnArgs(provider, {});+ expect(args).toEqual(expect.arrayContaining(['--no-approve', '--no-tools', '--no-extensions', '--no-context-files']));+ expect(args).not.toContain('--approve');+ expect(args).not.toContain('untrusted.js');+ expect(publicReviewRecipe(provider, PUBLIC_REVIEW_ACTIONS_POSTURE)).toBeNull();+ });+ it('parses qualified model IDs without treating login instructions as a model', () => {+ expect(parseHarnessModels('pi', 'provider model context max-out thinking images\nexample model-a 200K 32K yes yes\nexample model-a 200K 32K yes yes\nUse /login to authenticate')).toEqual(['example/model-a']);+ });+});diff --git a/server/lib/providerModels.js b/server/lib/providerModels.jsindex 44654fa147..218b4e639c 100644--- a/server/lib/providerModels.js+++ b/server/lib/providerModels.js@@ -386,6 +386,7 @@ export function effortLevelsForProvider(provider, model = null) {if (perModel === null) return ANTIGRAVITY_EFFORT_LEVELS;return perModel.length ? perModel : null;}+ if (commandBasename(provider.command) === 'pi') return ['low', 'medium', 'high', 'xhigh', 'max'];if (isCursorProvider(provider)) return CURSOR_EFFORT_LEVELS;if (isGrokProvider(provider)) return GROK_EFFORT_LEVELS;if (isClaudeProvider(provider)) return CLAUDE_EFFORT_LEVELS;@@ -438,7 +439,7 @@ export const CODEX_EFFORT_KEY = 'model_reasoning_effort';// provider args gets a SECOND, injected `--effort <level>` appended. Grok's// parser accepts the duplicate and takes the last one, so their explicit pin// would be silently overridden — the exact opposite of the contract below.-const EFFORT_FLAG_NAMES = Object.freeze(['--effort', '--reasoning-effort']);+const EFFORT_FLAG_NAMES = Object.freeze(['--effort', '--reasoning-effort', '--thinking']);/*** True when the user has already baked an effort override into the provider's@@ -485,6 +486,7 @@ export function hasEffortFlag(args) {export function buildEffortArgs(effort, provider, existingArgs = [], model = null) {const effectiveEffort = resolveCliEffort(effort, provider, model);if (!effectiveEffort || hasEffortFlag(existingArgs)) return [];+ if (commandBasename(provider?.command) === 'pi') return ['--thinking', effectiveEffort];if (isCursorProvider(provider)) return []; // rides `--model`, not a flag — see abovereturn isCodexProvider(provider)? ['-c', `${CODEX_EFFORT_KEY}=${effectiveEffort}`]diff --git a/server/lib/providerVendors.js b/server/lib/providerVendors.jsindex fe50d61b81..b704936d9c 100644--- a/server/lib/providerVendors.js+++ b/server/lib/providerVendors.js@@ -106,6 +106,7 @@ import {ensureCursorTuiArgs,ensureCursorHeadlessArgs,} from './cursor.js';+import { PI_COMMAND, isPiCommand, ensurePiTuiArgs, ensurePiHeadlessArgs, preparePiPrompt } from './pi.js';import { PROVIDER_TYPES } from './aiToolkit/constants.js';import {publicReviewPostureForProfile,@@ -547,6 +548,33 @@ const GEMINI_LEGACY = {// is deliberately incomplete.};+// Pi public review discards configured args and disables every tool/resource+// discovery surface. --no-builtin-tools alone leaves extension tools enabled.+const piCliArgs = (args, { model, effort }) => ensurePiHeadlessArgs(args, model, effort);+const PI = {+ id: 'pi',+ idFragment: 'pi-',+ inferredCommand: PI_COMMAND,+ matchCommand: isPiCommand,+ tuiArgs: ensurePiTuiArgs,+ cliArgs: piCliArgs,+ preparePrompt: preparePiPrompt,+ spawnArgs: defaultSpawnArgs(piCliArgs, PI_COMMAND),+ publicReview: {+ [PUBLIC_REVIEW_NO_TOOL_POSTURE]: {+ matchProvider: (provider) => isDirectBinaryProvider(provider) && isPiCommand(provider?.command),+ spawnArgs: (provider, { effectiveModel, effort } = {}) => ({+ command: provider.command,+ args: ensurePiHeadlessArgs([+ '--no-approve', '--no-tools', '--no-builtin-tools', '--no-extensions',+ '--no-skills', '--no-prompt-templates', '--no-themes', '--no-context-files', '--no-session',+ ], effectiveModel, effort),+ stdinMode: 'prompt',+ }),+ },+ },+};+// ─── claude (default fallback — MUST stay last) ────────────────────────────function claudeCliArgs(baseArgs, { model, effort, provider }) {@@ -753,7 +781,7 @@ const CLAUDE = {* exclusive by construction (distinct binary basenames, or a provider-id* check that doesn't overlap with a command-basename check).*/-export const PROVIDER_VENDORS = [CODEX, ANTIGRAVITY, CURSOR, GEMINI_LEGACY, KIMI, GROK, OPENCODE, CLAUDE];+export const PROVIDER_VENDORS = [CODEX, ANTIGRAVITY, CURSOR, GEMINI_LEGACY, KIMI, GROK, OPENCODE, PI, CLAUDE];/*** A row's `matchCliProvider` may be absent when it's identical todiff --git a/server/lib/reviewerConfig.js b/server/lib/reviewerConfig.jsindex 24069b97e4..1b29f77d7a 100644--- a/server/lib/reviewerConfig.js+++ b/server/lib/reviewerConfig.js@@ -30,7 +30,7 @@ import { CURSOR_COMMAND } from './cursor.js';// `opencode`/`kimi`/`mtplx` — like `lmstudio` — have no slashdo counterpart, so// they are PORTOS_ONLY_REVIEWERS.// Mirrored in client/src/components/cos/constants.js → REVIEWER_OPTIONS.-export const REVIEWER_VALUES = ['copilot', 'claude', 'antigravity', 'codex', 'grok', 'cursor', 'opencode', 'kimi', 'lmstudio', 'ollama', 'mtplx'];+export const REVIEWER_VALUES = ['copilot', 'claude', 'antigravity', 'codex', 'grok', 'cursor', 'pi', 'opencode', 'kimi', 'lmstudio', 'ollama', 'mtplx'];export const REVIEWER_ALIASES = { gemini: 'antigravity', 'cursor-agent': 'cursor' };export const DEFAULT_REVIEWER = 'copilot';export const DEFAULT_REVIEWERS = ['copilot'];@@ -71,7 +71,7 @@ export const PORTOS_ONLY_REVIEWERS = ['lmstudio', 'mtplx', 'opencode', 'kimi'];// get their model injected server-side by `POST /api/code-review/local`. Add a// reviewer here when its CLI gains model selection; the `<reviewer>Model`// settings scalar is generated from this roster (codeReviewSettingsSchema).-export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude', 'antigravity', 'grok', 'cursor', 'opencode', 'kimi'];+export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude', 'antigravity', 'grok', 'cursor', 'pi', 'opencode', 'kimi'];// Every reviewer whose model the user can PICK in the UI: the model-capable CLIs// above (threaded into the follow-up prompt as `<reviewer> --model <id>`) plus the// local-LLM backends (whose id is injected server-side by@@ -96,6 +96,7 @@ export const REVIEWER_CLI_BINARIES = {codex: 'codex',grok: 'grok',cursor: CURSOR_COMMAND,+ pi: 'pi',opencode: 'opencode',kimi: 'kimi',};diff --git a/server/lib/reviewerConfig.test.js b/server/lib/reviewerConfig.test.jsindex 8be39203cc..be999627e8 100644--- a/server/lib/reviewerConfig.test.js+++ b/server/lib/reviewerConfig.test.js@@ -184,7 +184,7 @@ describe('per-reviewer reasoning effort (reviewerEfforts)', () => {it('EFFORT_SELECTABLE_REVIEWERS is exactly the reviewers with a non-empty ladder', () => {expect([...EFFORT_SELECTABLE_REVIEWERS].sort())- .toEqual(['antigravity', 'claude', 'codex', 'cursor', 'grok', 'lmstudio', 'mtplx', 'ollama']);+ .toEqual(['antigravity', 'claude', 'codex', 'cursor', 'grok', 'lmstudio', 'mtplx', 'ollama', 'pi']);for (const reviewer of REVIEWER_VALUES) {expect(EFFORT_SELECTABLE_REVIEWERS.includes(reviewer)).toBe((reviewerEffortLevels(reviewer) || []).length > 0);diff --git a/server/lib/slashdoInvocation.js b/server/lib/slashdoInvocation.jsindex 65fd82b555..3d4daf577b 100644--- a/server/lib/slashdoInvocation.js+++ b/server/lib/slashdoInvocation.js@@ -73,7 +73,7 @@ export const SLASHDO_REVIEWER_INCLUDE_NAMES = Object.freeze(Object.values(SLASHD* (whose keys are the same roster); a reviewer added to one and not the other* is a drift the test catches.*/-export const LOCAL_AGENT_REVIEWERS = new Set(['claude', 'codex', 'antigravity', 'grok', 'cursor', 'opencode', 'kimi']);+export const LOCAL_AGENT_REVIEWERS = new Set(['claude', 'codex', 'antigravity', 'grok', 'cursor', 'pi', 'opencode', 'kimi']);/** Reviewer slugs that drive slashdo's local-model (Ollama-style) loop. */const LOCAL_MODEL_REVIEWERS = new Set(['ollama', 'lmstudio', 'mtplx']);/**@@ -98,6 +98,7 @@ const SLASHDO_REVIEWER_SLUGS = Object.freeze({claude: 'claude',grok: 'grok',cursor: 'cursor',+ pi: 'pi','cursor-agent': 'cursor',agy: 'antigravity',gemini: 'antigravity',diff --git a/server/services/providerRuntimeInstaller.js b/server/services/providerRuntimeInstaller.jsindex 08f18c39c5..9295f23be0 100644--- a/server/services/providerRuntimeInstaller.js+++ b/server/services/providerRuntimeInstaller.js@@ -94,6 +94,11 @@ const PROBE_TIMEOUT_MS = 15_000;/** One row per installable provider runtime, keyed by its vendor row. */const RUNTIME_ROWS = [+ {+ vendor: 'pi', label: 'Pi Coding Agent CLI',+ install: { kind: 'npm', package: '@earendil-works/pi-coding-agent@latest' },+ selfUpdate: ['update'], modelsArgs: ['--list-models'], docsUrl: 'https://pi.dev/docs',+ },{vendor: 'claude',label: 'Claude Code CLI',