feat(sessions): optional model for spawn tools and # model completion in composer

spawn_session and spawn_subsession accept an optional model parameter as
an exact provider/model-id (strict matching; unknown specs fail listing
available models; omitting it keeps the inherited model). The chat
composer opens a model completion menu on # and inserts a
#provider/model-id reference into the draft, which agents forward as
the model parameter.
This commit is contained in:
Federico Jaramillo Martinez
2026-07-29 23:58:38 +02:00
parent 9b8728a5d6
commit 5f4d81352f
18 changed files with 656 additions and 38 deletions
+29
View File
@@ -103,6 +103,7 @@
<a href="#catalog-refresh">Model catalog refresh</a>
<a href="#session-tools">Session tools</a>
<a href="#extension-dialogs">Extension dialogs</a>
<a href="#prompt-completions">Prompt completions</a>
<a href="#completion-tools">Completion tools</a>
</aside>
@@ -805,6 +806,15 @@
available when the child stops. Included output and transcripts follow a labeled marker and come last,
after PI WEB guidance.
</p>
<p>
Both <code>spawn_session</code> and <code>spawn_subsession</code> accept an optional
<code>model</code> parameter, given as an exact <code>provider/model-id</code> such as
<code>anthropic/claude-sonnet-4-5</code>. When set, the new session starts on that model instead of
inheriting the dispatching session's model. The match is strict: an unknown or malformed value is
rejected with an error. A <code>#provider/model-id</code> reference in the prompt (see
<a href="#prompt-completions">Prompt completions</a>) is how users ask for a specific model; agents
forward that reference as this parameter.
</p>
<p>
In <strong>Settings → Session daemon</strong>, these keys are saved on the selected machine. Restart the
session daemon on that machine after changing them.
@@ -879,6 +889,25 @@
</section>
<section id="prompt-completions">
<h2>Prompt completions</h2>
<p>The chat composer opens completion menus on three trigger characters:</p>
<ul>
<li><code>/</code> at the very start of the draft completes session commands.</li>
<li>
<code>@</code> completes file paths: <code>@</code> for tracked files, <code>@ </code> (at, then
space) or <code>!@</code> for all files. Picking one inserts an <code>@path</code> reference into the
draft, quoted automatically when the path contains spaces.
</li>
<li>
<code>#</code> completes the models available to the session, filtered case-insensitively as you type
(at most 12 entries). Picking one inserts a <code>#provider/model-id</code> reference into the draft,
which tells agents the request should run on that model — for example as the <code>model</code>
parameter of <code>spawn_session</code>.
</li>
</ul>
</section>
<section id="completion-tools">
<h2>Optional completion tools</h2>
<p>
+10
View File
@@ -273,6 +273,8 @@ A completion notice wakes an idle parent or queues behind in-flight work. Each n
`list_subsessions`, `check_subsession`, and `read_subsession` never yield or change control flow. They are for deliberate inspection or recovery, not completion polling. While a child works, agent-facing `check_subsession` and `read_subsession` withhold partial output and direct the parent to continue independent work or yield at the join point. Output becomes available when the child stops. Included output and transcripts follow a labeled marker and come last, after PI WEB guidance.
Both `spawn_session` and `spawn_subsession` accept an optional `model` parameter, given as an exact `provider/model-id` such as `anthropic/claude-sonnet-4-5`. When set, the new session starts on that model instead of inheriting the dispatching session's model. The match is strict: an unknown or malformed value is rejected with an error. A `#provider/model-id` reference in the prompt (see [Prompt completions](#prompt-completions)) is how users ask for a specific model; agents forward that reference as this parameter.
In **Settings → Session daemon**, these keys are saved on the selected machine. Restart the session daemon on that machine after changing them.
#### `askUser` and `ask_user`
@@ -331,6 +333,14 @@ Shortcut values are keyed by action id. Values are shortcut strings such as `mod
Prefer Settings → Keyboard for editing shortcuts interactively.
## Prompt completions
The chat composer opens completion menus on three trigger characters:
- `/` at the very start of the draft completes session commands.
- `@` completes file paths: `@` for tracked files, `@ ` (at, then space) or `!@` for all files. Picking one inserts an `@path` reference into the draft, quoted automatically when the path contains spaces.
- `#` completes the models available to the session, filtered case-insensitively as you type (at most 12 entries). Picking one inserts a `#provider/model-id` reference into the draft, which tells agents the request should run on that model — for example as the `model` parameter of `spawn_session`.
## Optional completion tools
File and path `@` completions work without extra tools. If `fzf` is available on the PI WEB server's `PATH`, PI WEB uses it to improve completion filtering/ranking; otherwise it falls back to built-in ranking.