You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feat/pi deferred extension model resolution (#1509)
* feat(pi): support extension-registered provider models via deferred resolution
Extension providers (e.g. pi-provider-kiro) register their models on
the ModelRegistry during session.bindExtensions(), not during the
initial modelRegistry.find() call. The previous approach threw
immediately when find() returned undefined, blocking extension models.
New flow:
1. modelRegistry.find() checks static catalog + models.json (step 3)
2. If found: pass to createAgentSession, fail-fast auth as before
3. If not found: log info, skip auth (extension providers manage their
own credentials), create session without model
4. After bindExtensions() (step 4g): retry modelRegistry.find() — now
extension-registered models are discoverable — and call
session.setModel() to switch to the resolved model
5. If still not found after bindExtensions(): throw with a hint about
installing the provider extension with enableExtensions: true
This preserves all existing behavior for built-in providers and
models.json custom models while adding support for extension-registered
providers like pi-provider-kiro (Kiro API — 20 free models including
Claude, DeepSeek, Qwen, etc.).
Changes:
- provider.ts: deferred model resolution after bindExtensions();
conditional model arg to createAgentSession; conditional auth
fail-fast; session.setModel() for extension-resolved models
- provider.test.ts: add setModel mock; update model-not-found tests
for two-phase find() behavior
* test: add archon-test-pi example workflow for Kiro extension validation
Simple two-node workflow that verifies the Pi provider works with
extension-registered models (e.g. pi-provider-kiro). Node 1 asks a
factual question, node 2 validates the answer.
Tested with kiro/claude-sonnet-4-6 and kiro/minimax-m2-5.
* docs: add Pi/Kiro prerequisites and setup to examples README
* fix(pi): load models.json custom providers and surface SDK error messages
- Switch ModelRegistry.inMemory() to ModelRegistry.create() so custom
providers from ~/.pi/agent/models.json (ollama, LM Studio, etc.)
resolve correctly. Both return the same mutable class supporting
registerProvider() for extensions.
- Surface Pi's AssistantMessage.errorMessage in the result chunk errors
array so dag-executor shows actual errors instead of generic
'SDK returned error'.
- Add ollama/qwen3.5 node to archon-test-pi workflow to validate both
extension (kiro) and models.json (ollama) provider paths.
* fix(pi): address Wirasm PR review — comment clarity, session cleanup, test mock alignment
- event-bridge: document intentional design of yielding error chunks (isError:true
propagates in chunk, not via throw); fix event name to pi.result_chunk_error;
remove noisy model field from error log
- provider: replace verbose multi-paragraph step-numbered comments with concise
WHY explanations; fix stale ModelRegistry.inMemory() reference (code uses create());
add session.dispose() on model-not-found throw and setModel() failure to close
the session cleanup gap
- provider.test: align mock from ModelRegistry.inMemory → ModelRegistry.create to
match actual provider code (was already broken on the branch); update test
description and comments to describe behavior rather than step numbers
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test(pi): add happy-path test for deferred extension model resolution
Verifies that when find() returns undefined on the first call (static catalog miss)
and a model on the second call (after bindExtensions()), session.setModel() is
invoked with the resolved model and no error is returned.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: jhegeman-ds <joel.hegeman@deepseas.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments