@jopqior/pi-subagents-model-selector

Pi extension that asks for model and thinking before every new pi-subagents run.

Packages

Package details

extension

Install @jopqior/pi-subagents-model-selector from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@jopqior/pi-subagents-model-selector
Package
@jopqior/pi-subagents-model-selector
Version
1.0.3
Published
Sep 19, 2026
Downloads
451/mo · 451/wk
Author
jopqior
License
MIT
Types
extension
Size
36.7 KB
Dependencies
1 dependency · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@jopqior/pi-subagents-model-selector

npm version CI License: MIT TypeScript pnpm Pi Package

Ask for model and thinking before every new in-process @jopqior/pi-subagents child session.

Installing or upgrading the core alone does not change selection.

Source history: the repository's git history was restored to the original upstream merge graph. Already-published npm artifacts are unchanged, and artifacts published after that restoration are built from the restored history. See History restoration for what this means for old commit links and existing clones.

Install

Load after @jopqior/pi-subagents. Pi loads packages in the order they are listed in .pi/settings.json, and this extension registers its provider with the subagents service at load time — so the core must load first.

pi install npm:@jopqior/pi-subagents
pi install npm:@jopqior/pi-subagents-model-selector

Then list those two npm: sources in that order:

{
  "packages": [
    "npm:@jopqior/pi-subagents",
    "npm:@jopqior/pi-subagents-model-selector"
  ]
}

Or load from a checkout:

{
  "packages": [
    "../packages/pi-subagents",
    "../packages/pi-subagents-model-selector"
  ]
}

If the core is missing, failed to load, or lacks registerSpawnSelectionProvider, this extension throws a configuration error at initialization and does not activate.

Upgrading across a core major

Upgrade both packages together when the core changes major version. The published selector declares a caret dependency on the core version it was packaged against; that range does not admit the next major, even when the spawn-selection API remains compatible. In this workspace the dependency is workspace:^: pnpm converts it to the core's version range when packing, so a coordinated release must version both packages before packing the selector. Maintainers should verify the packed dependency range against the derived core version and name both packages in the release dispatch.

Behavior

Every new run in an enabled root's in-process tree opens one /model-style form: model, thinking, and Submit. Foreground tool calls, background tool calls, and SubagentsService.spawn() all go through the same gate.

The operator's pair is applied after ordinary call and config resolution. It overrides defaults, explicit model/thinking arguments, and locked: values for those two fields only. Other locked fields are unchanged.

The all-tab catalogue is every authenticated available model of the session whose manager is spawning — not a process-global list. The scoped tab is ctx.scopedModels intersected with that catalogue, and is hidden when the intersection is empty. Ctrl+S toggles all/scoped when the scoped tab exists. A model that supports only off still shows off and requires an explicit choice on the thinking tab.

Concurrent requests are FIFO at the root chooser. A queued run does not open the form until it is admitted. Cancel the form stops that run without creating a workspace or child session.

A missing TUI, a UI that is not yet attached, an empty catalogue, or an invalid selection fails that run explicitly. Print, JSON, and RPC sessions fail closed — there is no ui.select fallback. There is no default, timeout, remembered choice, or retry.

Nested children still route to the root UI, including when this package is excluded from them. A child that also loads this package receives an inherited registration and installs no second queue.

resume does not re-ask. The parent's active model, thinking level, agent files, and tool-call arguments are not rewritten to carry the choice.

Lifecycle

The extension captures getSubagentsService() once during initialization and registers the provider immediately, before any session_start handler can spawn. It attaches ctx.ui.custom at session_start when ctx.mode is tui, and closes the chooser at session_shutdown. A request that arrives before the UI is attached fails closed rather than waiting for a later sequential handler.

Limitations

  • Out-of-process children and third-party session factories are not covered.
  • The form rebuilds the /model experience without mounting Pi's ModelSelectorComponent (no type-to-filter on the thinking tab, no set-as-default).
  • Public task status stays running while waiting. Pending selection is private widget, foreground, and background wording.

License

MIT