Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/docs/src/content/docs/config/models.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ Warden mirrors these to the native `{PROVIDER}_API_KEY` expected by each SDK at
If you already have a native provider key set (e.g. `OPENAI_API_KEY`), Warden will use it
directly and the `WARDEN_`-prefixed form is not required.

### Pi Extensions

By default the Pi runtime loads **no** [Pi extensions](https://pi.dev/docs/extensions),
neither project-local nor global ones, so runs are hermetic. To load specific extension
files (for example an LLM proxy router or a tracing hook), set
`WARDEN_PI_EXTENSION_PATHS` to a comma-separated list of extension file paths:

```yaml title="GitHub Actions"
env:
WARDEN_PI_EXTENSION_PATHS: /home/runner/warden-extensions/tracing.ts
```

Only the listed files are loaded; extension auto-discovery stays disabled.

## Claude Runtime Models

When `runtime = "claude"`, use the model IDs accepted by Claude Code:
Expand Down
21 changes: 21 additions & 0 deletions packages/warden/src/sdk/runtimes/pi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,27 @@ describe('piRuntime.runSkill', () => {
});
});

it('loads no Pi extensions by default', async () => {
await piRuntime.runSkill(baseSkillRequest());

expect(piMocks.resourceLoaderOptions[0]).toEqual(expect.objectContaining({ noExtensions: true }));
expect(piMocks.resourceLoaderOptions[0]).not.toHaveProperty('additionalExtensionPaths');
});

it('threads WARDEN_PI_EXTENSION_PATHS into the resource loader', async () => {
vi.stubEnv('WARDEN_PI_EXTENSION_PATHS', '/ext/tracing.ts, /ext/routing.ts,');
try {
await piRuntime.runSkill(baseSkillRequest());
} finally {
vi.unstubAllEnvs();
}

expect(piMocks.resourceLoaderOptions[0]).toEqual(expect.objectContaining({
noExtensions: true,
additionalExtensionPaths: ['/ext/tracing.ts', '/ext/routing.ts'],
}));
});

it('records Pi tool execution spans when trace capture is active', async () => {
const toolResult = {
role: 'toolResult',
Expand Down
9 changes: 9 additions & 0 deletions packages/warden/src/sdk/runtimes/pi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,18 +343,27 @@ async function promptWithTimeout(
}
}

function piExtensionPathsFromEnv(env: NodeJS.ProcessEnv = process.env): string[] {
return (env['WARDEN_PI_EXTENSION_PATHS'] ?? '')
.split(',')
.map((path) => path.trim())
.filter((path) => path.length > 0);
}

async function runPiPrompt(options: PiPromptOptions): Promise<PiPromptResult> {
const warnings: string[] = [];
bridgeWardenProviderApiKeyEnv();
const modelRuntime = await createModelRuntime(options.model, options.legacyAnthropicApiKey);
const model = resolvePiModel(options.model, modelRuntime);
const settingsManager = buildSettingsManager(options.timeout, options.maxRetries);
const agentDir = getAgentDir();
const additionalExtensionPaths = piExtensionPathsFromEnv();
const resourceLoader = new DefaultResourceLoader({
cwd: options.cwd,
agentDir,
settingsManager,
noExtensions: true,
...(additionalExtensionPaths.length > 0 ? { additionalExtensionPaths } : {}),
noSkills: true,
noPromptTemplates: true,
noThemes: true,
Expand Down