Skip to content

Upgrade Pi SDK 0.80.6 → 0.85.1 - #11

Merged
limboinf merged 5 commits into
mainfrom
chore/upgrade-pi-sdk-0.85.1
Sep 11, 2026
Merged

limboinf merged 5 commits into
mainfrom
chore/upgrade-pi-sdk-0.85.1

Conversation

@limboinf

Copy link
Copy Markdown
Owner

Summary

Moves @earendil-works/pi-ai, pi-coding-agent and pi-agent-core from 0.80.6 to 0.85.1 across all four manifests, and adapts the credential layer to the SDK's new ModelRuntime / CredentialStore API.

Why now: the 0.80.6 catalog predates Claude Opus 5, GPT-6 and GPT-5.6 — users could not select current flagship models. 0.85.1 adds ~300 models and 4 providers.

What changed

  • AuthStorage family removed upstream → OAuthSyncCredentialStore extends InMemoryCredentialStore, overriding modify() (the SDK's only write path) to mirror OAuth rotations back to the main process.
  • ModelRegistry.inMemory() → new ModelRegistry(await ModelRuntime.create(...)); createAuthenticatedRegistry() is async and memoizes the runtime.
  • CreateAgentSessionOptions.authStorage/modelRegistry → modelRuntime.
  • ResourceLoader gained two methods (delegated); Agent.streamFn → streamFunction; KnownProvider/BuiltinProvider divergence narrowed.
  • Regression fix: OAuth flows are loaded via a bundler-opaque dynamic import; registerBunOAuthFlows() is now called at startup so ChatGPT sign-in works in the packaged agent.
  • Skill-catalog gate widened to read or bash to match upstream.
  • Docs: removed the Claude Pro/Max subscription claim (never implemented).

Full record with file:line links: docs/pi-sdk-upgrade.md.

Verification

  • bun run validate:dev and bun run test: 3784 pass / 0 fail, incl. the Pi session integration harness (real subprocess + SSE fixture).
  • bun run lint, i18n parity/usage/sorted: clean.
  • Subprocess smoke: api_key and OAuth credential paths both reach the provider through the new runtime.
  • MCP proven end-to-end on 0.85.1 against a real stdio server (pi-mcp-adapter's ^0.84.1 peer range is stale metadata).
  • WebUI end-to-end on an isolated config: Claude Opus 5 appears in the model picker and persists to config.

Not covered

  • Live ChatGPT Plus sign-in against a real account (the OAuth flow now loads; the token exchange itself needs a real subscription).
  • One log line from a desktop run — MCP initialization failed: This extension ctx is stale after session replacement — is not addressed here and is tracked separately.

🤖 Generated with Claude Code

limboinf and others added 5 commits September 10, 2026 23:35
The three @earendil-works packages move together across all four manifests.
The break lands in the credential layer, which type checking does not cover
end to end:

- AuthStorage / AuthStorageBackend / AuthCredential are no longer exported
  (removed in 0.80.8). OAuthSyncAuthStorageBackend is replaced by
  OAuthSyncCredentialStore, which extends pi-ai's InMemoryCredentialStore and
  overrides modify() — the SDK's only write path — to diff and emit
  oauth_credential_update. Injected credentials go straight to the base class
  so they are not mirrored back to the main process.
- ModelRegistry.inMemory(authStorage) is gone; the registry is now a facade
  over ModelRuntime. createAuthenticatedRegistry() became async and memoizes
  the runtime at module scope, resetting it on re-init.
- CreateAgentSessionOptions.authStorage / .modelRegistry collapse into
  modelRuntime.
- ResourceLoader gained getSystemPromptSource() and
  getAppendSystemPromptSources(), implemented by delegation.
- Agent.streamFn is now Agent.streamFunction.
- pi-ai's KnownProvider and the compat catalog's BuiltinProvider have
  diverged; models-pi.ts narrows to BuiltinProvider.

Verified: validate:dev passes, the pi-agent-server bundle builds, and a
subprocess smoke run reaches a live session through the new credential chain.
The OAuth subscription paths still need the manual checklist in
docs/pi-sdk-upgrade.md.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0.85.1's system-prompt builder resolves the skill-file-read tool as
["read", "bash"].find(...) instead of requiring `read`, and emits
<available_skills> with bash-flavoured wording when `read` is absent.
PiSkillBridge.assertCatalogVisible() mirrored the old read-only rule and
over-reported, so it now matches upstream.

No behavioural effect on Bitlab: the built-in tool set always includes
`read`, and no production caller withholds it.

Also records the upgrade's verification results in docs/pi-sdk-upgrade.md —
full suite, Pi session integration, MCP on 0.85.1, and a WebUI end-to-end
run confirming Claude Opus 5 reaches the model picker and persists.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The docs said Bitlab supports a Claude Pro/Max OAuth subscription flow
(including a `claude-max` connection example). No such code exists: the
only subscription flow is ChatGPT Plus via `openai-codex`, and the
codebase has no `claude-max` slug, no Anthropic OAuth module, and no
onboarding option for it. The claim was inherited from Craft upstream
and never implemented.

Corrects README, features, connections and the Bitlab-vs-Craft
comparison (now ❌ for Bitlab), in both languages, plus the upgrade
verification checklist.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…dling

pi-ai 0.85.x loads each OAuth flow (Codex, Anthropic, Copilot, …) through
a variable-specifier dynamic import so bundlers cannot follow it. After
bun collapses the SDK into dist/index.js the import target no longer
exists, and every OAuth-backed request fails with:

  OAuth auth derivation failed for openai-codex: Cannot find module
  './openai-codex.js' from '.../pi-agent-server/dist/index.js'

The SDK ships `registerBunOAuthFlows()` (`pi-ai/bun-oauth`) for exactly
this case; call it at startup next to the Bedrock pre-registration, which
solves the same problem for a different lazy module.

Verified with a subprocess smoke that injects an openai-codex OAuth
credential and sends a prompt: before, module-resolution error; after,
the flow runs and rejects the fake token ("Failed to extract accountId").

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@limboinf
limboinf merged commit d15c54b into main Sep 11, 2026
4 checks passed
@limboinf
limboinf deleted the chore/upgrade-pi-sdk-0.85.1 branch September 11, 2026 06:57
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