Skip to content

feat(pi): a fourth harness, and the endpoint it has no variable for - #6

Merged
klNuno merged 2 commits into
mainfrom
feat/pi-harness
Aug 10, 2026
Merged

klNuno merged 2 commits into
mainfrom
feat/pi-harness

Conversation

@klNuno

@klNuno klNuno commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Adds Pi as a fourth harness kind, with its adapter, an example block in config.example.toml and tests beside the other three.

Pi has no lever for a custom endpoint at launch. It bundles the Anthropic SDK, which does read ANTHROPIC_BASE_URL, and then hands it an explicit baseUrl from a provider that carries its own, so the variable never applies. Its other surface is models.json, which lives inside pi's own config directory, and PI_CODING_AGENT_DIR moves that whole directory, taking the user's stored credentials, settings and sessions with it.

So a binding with a base_url is written as a pi.registerProvider extension under fastpick's own config directory, one file per route, rewritten at every launch including --dry-run, and loaded with --extension. A binding without one changes nothing and lets pi use the provider it already knows by that id. The key is a $FASTPICK_PROVIDER_KEY reference resolved by pi per request, so nothing generated holds a secret, and the whole document is built through serde_json so a name or a url holding a quote cannot escape into code.

Two config fields come with it. api on a binding names which of pi's streaming implementations speaks the endpoint, and a base_url declared without one is refused at load rather than at launch, mirroring the OpenCode npm rule. max_tokens on a model is optional and emitted only when declared: pi asks for an output cap and defaults it low, and inventing one here would truncate answers.

Model metadata follows the config and nothing else: reasoning is true only when the model declares effort levels, cost fields are zeros, and contextWindow and maxTokens are left out when unset.

cargo test and cargo clippy --all-targets pass.

klNuno added 2 commits August 10, 2026 15:34
Pi ships no lever for a custom endpoint: its Anthropic provider hardcodes
api.anthropic.com and hands it to the SDK explicitly, so ANTHROPIC_BASE_URL is
read by nothing, and its models.json lives inside the config directory this
program never writes to. PI_CODING_AGENT_DIR would move that whole directory,
taking the user's logins and sessions with it.

So a binding with a base_url is generated as a pi.registerProvider extension
under fastpick's own config directory, one file per route, and loaded with
--extension. That needs the endpoint's dialect, which is the new `api` field on
the binding, refused at load when a base_url comes without one. The key stays a
$FASTPICK_PROVIDER_KEY reference resolved at request time, so nothing generated
holds a secret.

`max_tokens` on a model is new for the same reason: pi asks for an output cap it
would otherwise default low, and inventing one here would truncate answers with
nobody to blame.
@klNuno
klNuno merged commit 9e743d3 into main Aug 10, 2026
5 checks passed
@klNuno
klNuno deleted the feat/pi-harness branch August 10, 2026 13:43
@klNuno
klNuno restored the feat/pi-harness branch November 22, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant