@lune_99/pi-subagent 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +25 -9
- package/docs/reference.md +62 -38
- package/package.json +6 -6
- package/skills/create-lune-subagent/SKILL.md +21 -17
- package/src/auto-model.ts +46 -37
- package/src/definition-file.ts +36 -1
- package/src/definitions.ts +6 -0
- package/src/dock/dock-contribution.ts +19 -9
- package/src/index.ts +36 -10
- package/src/inspector/details.ts +9 -3
- package/src/inspector/inspector.ts +67 -43
- package/src/models.ts +24 -9
- package/src/notify/notification-box.ts +42 -15
- package/src/notify/notifier.ts +23 -6
- package/src/run/guide.ts +5 -0
- package/src/run/run-file.ts +1 -0
- package/src/run/run-manager.ts +123 -26
- package/src/run/run.ts +130 -38
- package/src/run/types.ts +12 -4
- package/src/settings/agents-menu.ts +37 -24
- package/src/settings/panel.ts +50 -8
- package/src/settings/schema.ts +5 -1
- package/src/settings/thinking-choices.ts +92 -0
- package/src/tools/format.ts +65 -43
- package/src/tools/subagent-tools.ts +95 -207
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,39 @@ All notable changes follow [Keep a Changelog](https://keepachangelog.com/en/1.0.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.2.0] - 2026-11-28
|
|
8
|
+
|
|
9
|
+
> **⚠️ Breaking: `subagent_start` now requires `task` and starts one run per call.**
|
|
10
|
+
|
|
11
|
+
### Removed
|
|
12
|
+
|
|
13
|
+
- **Batch starts.** Remove the `tasks` parameter and batch-specific progress and results from `subagent_start`. Start independent runs with separate calls, which can run in parallel.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **Allowed subagent models.** Select multiple models from Pi's scoped models under `/lune-core-settings subagents`. A nonempty selection replaces the session's default allowed list for new runs, including explicit models and auto tiers; clear it to restore Pi's scope. Changes update the tool's model options immediately, without changing existing runs or main-model inheritance.
|
|
18
|
+
- **Run titles.** An optional `title` on `subagent_start` labels a run in the `/agents` inspector, the Dock and its end-of-turn notice. The subagent tools still take a run's ID, never its title or name, and the results and notices name the run only by that ID; passing a title or name fails, and the error lists the branch's run IDs.
|
|
19
|
+
- **Auto mode only.** A Subagents setting that removes the `model` and `thinking` parameters from `subagent_start`, so every inline run routes both automatically. An inline call that still names another model or supplies thinking starts nothing. Custom agents keep their definition's model.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- **Agent runs keep their definition.** A `subagent_start` call that names an agent takes only `task` and `title`, and the definition's model, thinking, tools and isolation always apply. A call that also sets one of them starts nothing. Edit the definition to change a role's settings.
|
|
24
|
+
- **Classifier model label.** The **Auto classifier** setting is now **Classifier model**, with copy that matches Compaction's classifier selection. Unavailable-classifier errors point to `/lune-core-settings → Subagents → Classifier model`; behavior is unchanged.
|
|
25
|
+
- **Turns without a report.** The Dock, notifications, `/agents` and `subagent_status` no longer label such a turn `unreported`, because the word suggested that its result never reached the main agent. A turn that ended normally shows as `done` in the Dock, notifications and `/agents`. A turn whose last reply hit the token limit or left no text shows no task status, only its state. The main agent still gets the run's last message, marked as having no task status. A turn now goes by its own last reply, even one that Pi dropped to recover, so a failed request shows as `failed` with its error, its message is never an older reply, and an earlier failure no longer carries into a later turn.
|
|
26
|
+
- **BREAKING: Auto routes model and thinking together.** Remove `thinking` from calls and definitions using `model: auto`; conflicting values now fail instead of overriding the router. Auto mode only hides both parameters, and selecting auto in Custom agents removes a saved thinking override while keeping its comments. Fixed or inherited models retain explicit thinking levels.
|
|
27
|
+
- **Your messages to a run reach the main agent.** When you write to a run in `/agents`, the main agent gets your message with that turn's report, and `subagent_status` shows it while the turn runs.
|
|
28
|
+
- **Clearer `/agents` selection.** The selected run has an accent `›` and a bold title, and reopening the inspector returns to that run for the rest of the session. Each row of the run list shows one whole status at the right and cuts only the title. Running runs come first in each branch group, and the selection stays on its run when the order changes.
|
|
29
|
+
- **Higher auto thinking for hard tasks.** The thinking rating starts at the least level that is clearly enough and rises for correctness that cannot be checked by running the result, so a demanding task uses the model's top level. A model whose levels stop below `max` gives its highest level to the tasks that a higher level would take.
|
|
30
|
+
- **Core 0.2.1 dependency.** Require `@lune_99/pi-lune-extensions-core@^0.2.1`, the same range as the other Lune packages, so an installation shares one Core copy. Publish Core 0.2.1 before Subagent.
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- **Full replies after truncation.** When a turn ends without a report and its last message exceeds 20,000 characters, save the complete reply as a Markdown file in the system temporary directory. The truncation hint in the notice and run status includes its path, so the main agent can read the omitted text.
|
|
35
|
+
- **Supported thinking choices.** Custom agents limit selectable levels to a fixed or inherited model's support, while auto models route thinking for each task. The automatic default is labeled correctly, invalid fixed model selections report errors, and unsupported saved levels stay visible as disabled entries.
|
|
36
|
+
- **Dock counts kept runs.** A run that you keep running when you leave its branch now counts in the Agents Dock while it works. Before, it appeared only when its finished turn waited for its branch.
|
|
37
|
+
|
|
38
|
+
## [0.1.0] - 2026-10-28
|
|
39
|
+
|
|
7
40
|
### Added
|
|
8
41
|
|
|
9
42
|
- **Subagent runs.** The main agent delegates a task with `subagent_start` and continues while the run works in its own Pi session with a fresh context. With `tasks`, one call starts several runs at the same time, and an entry that fails to start does not stop the others. `subagent_send`, `subagent_status` and `subagent_stop` steer, read and stop runs, and each ended turn reaches the main agent as a batched steer message with the run's report. When a message continues a turn after its report, the earlier reports reach the main agent with the turn's last report. Each report message is confirmed in the main session and sent again when it is missing; after you interrupt the main agent, it goes with your next message.
|
package/README.md
CHANGED
|
@@ -34,6 +34,8 @@ directly.
|
|
|
34
34
|
|
|
35
35
|
- **Work in parallel.** Start one run or several in one tool call. Each gets its own conversation
|
|
36
36
|
and only the task you delegate; reports arrive when turns end, without status polling.
|
|
37
|
+
- **Give each run a title.** A short title such as `Review retry policy` labels the run in
|
|
38
|
+
`/agents`, the Dock and its end-of-turn notice. The agent still addresses runs by ID.
|
|
37
39
|
- **Keep control of a run.** Read its live transcript, steer it while it works, or continue it after
|
|
38
40
|
a completed, failed or interrupted turn. Questions return to the main agent for coordination.
|
|
39
41
|
- **Choose where changes happen.** Share the current working directory or give a run a detached
|
|
@@ -50,10 +52,11 @@ directly.
|
|
|
50
52
|
|
|
51
53
|

|
|
52
54
|
|
|
53
|
-
The inspector puts runs on the left and the selected transcript on the right.
|
|
55
|
+
The inspector puts runs on the left and the selected transcript on the right. Running runs move to
|
|
56
|
+
the top of the list, and the selection stays on its run when the order changes. Tool calls and
|
|
54
57
|
finished thinking occupy compact rows; messages and reports remain readable in full. The heading
|
|
55
58
|
shows the run's state, model and thinking level. Press `d` for start values, token usage and workspace
|
|
56
|
-
details.
|
|
59
|
+
details. It reopens on the run you had selected.
|
|
57
60
|
|
|
58
61
|
| Action | Keys |
|
|
59
62
|
| ------------------------------ | ---------------------------------- |
|
|
@@ -91,6 +94,9 @@ This role follows the main agent's model. Add `model: provider/id` to choose one
|
|
|
91
94
|
to use task tiers. Add `isolation: worktree` for a role that should change files separately.
|
|
92
95
|
Run `/reload` after saving a definition.
|
|
93
96
|
|
|
97
|
+
The main agent starts a role with only a task and a title. The definition's model, thinking, tools
|
|
98
|
+
and isolation always apply; the main agent cannot change them in the call.
|
|
99
|
+
|
|
94
100
|
To create a role interactively:
|
|
95
101
|
|
|
96
102
|
```text
|
|
@@ -110,8 +116,16 @@ Install Core's Pi entry to use the settings command:
|
|
|
110
116
|
pi install npm:@lune_99/pi-lune-extensions-core
|
|
111
117
|
```
|
|
112
118
|
|
|
113
|
-
Then restart Pi and open `/lune-core-settings subagents`. **
|
|
114
|
-
|
|
119
|
+
Then restart Pi and open `/lune-core-settings subagents`. **Allowed models** is a multi-select
|
|
120
|
+
list from Pi's scoped models: Space toggles a model and Enter saves. A nonempty selection replaces
|
|
121
|
+
the session's default allowed model list for new runs; clear it to follow Pi's scope again. Saved
|
|
122
|
+
models remain allowed outside a later session's scope while available in Pi. Existing runs keep
|
|
123
|
+
their model, and inheriting the main agent's model is unchanged.
|
|
124
|
+
|
|
125
|
+
**Custom agents** edits saved definitions; **Classifier model** and **Auto tiers** configure runs
|
|
126
|
+
started with `model: auto`. **Auto mode only** removes the `model` and `thinking` parameters from
|
|
127
|
+
`subagent_start`, so every inline run routes both automatically; custom agents keep their own model.
|
|
128
|
+
Model choices in Custom agents and Auto tiers follow the subagent allowed list.
|
|
115
129
|
|
|
116
130
|
| Tier | Intended work |
|
|
117
131
|
| -------- | -------------------------------------------------- |
|
|
@@ -121,10 +135,10 @@ Then restart Pi and open `/lune-core-settings subagents`. **Custom agents** edit
|
|
|
121
135
|
| Deep | Design decisions, unclear failures and subtle bugs |
|
|
122
136
|
|
|
123
137
|
Automatic routing supports Pi's classifier models, including TypeSafe's **Jev**. The classifier
|
|
124
|
-
rates the task; you choose the models for the tiers. It also selects a thinking
|
|
125
|
-
|
|
126
|
-
next configured tier, then the main agent's model.
|
|
127
|
-
main agent's model and thinking.
|
|
138
|
+
rates the task; you choose the models for the tiers. It also selects a thinking level supported
|
|
139
|
+
by the chosen model. Auto calls and definitions must omit `thinking`; a fixed level requires a
|
|
140
|
+
fixed or inherited model. Empty tiers use the next configured tier, then the main agent's model.
|
|
141
|
+
With no classifier selected, `auto` uses the main agent's model and thinking.
|
|
128
142
|
|
|
129
143
|
The **High-risk floor** defaults to Deep and applies when the high-risk probability reaches the
|
|
130
144
|
configured threshold, initially 40%. It changes model selection; tool permissions and approvals
|
|
@@ -135,11 +149,13 @@ and the run uses the main agent's model. See the [full auto-model behavior](docs
|
|
|
135
149
|
|
|
136
150
|
| Tool | Purpose |
|
|
137
151
|
| ----------------- | ------------------------------------------------------- |
|
|
138
|
-
| `subagent_start` | Start
|
|
152
|
+
| `subagent_start` | Start one task in a new Pi session |
|
|
139
153
|
| `subagent_send` | Steer an active run or continue it with another message |
|
|
140
154
|
| `subagent_status` | Read states, usage and reports on the current branch |
|
|
141
155
|
| `subagent_stop` | Stop the turn while keeping its session and worktree |
|
|
142
156
|
|
|
157
|
+
Issue separate `subagent_start` calls to start independent runs in parallel. Each call requires `task`.
|
|
158
|
+
|
|
143
159
|
A run reports `done`, `blocked` or `needs_input`. Stopping it preserves its conversation. Closing
|
|
144
160
|
the main session interrupts active runs; resume the session and use `subagent_send` to continue.
|
|
145
161
|
|
package/docs/reference.md
CHANGED
|
@@ -13,14 +13,14 @@ When a project definition and a user definition have the same name, the project
|
|
|
13
13
|
|
|
14
14
|
Pi asks whether to trust a project only when the project has resources that Pi itself guards, such as `.pi/settings.json` or `.pi/extensions/`. A project whose only `.pi` content is `lune-subagents/` counts as trusted without a prompt, the same as its `AGENTS.md`. Read the definitions of a project you did not write before you use them.
|
|
15
15
|
|
|
16
|
-
| Field | Required | Meaning
|
|
17
|
-
| ------------- | -------- |
|
|
18
|
-
| `name` | Yes | Unique name. The main agent uses it to pick the agent.
|
|
19
|
-
| `description` | Yes | When to use the agent. Shown in the system prompt's agent list.
|
|
20
|
-
| `tools` | No | Tool names, extension tools included, as a comma-separated string or a list. Default: `defaultTools`.
|
|
21
|
-
| `model` | No | `provider/id`, or `auto` for the model of the task's tier. Default: the main agent's model.
|
|
22
|
-
| `thinking` | No | `off`, `minimal`, `low`, `medium`, `high`, `xhigh` or `max`. Default: the
|
|
23
|
-
| `isolation` | No | `shared` or `worktree`. `
|
|
16
|
+
| Field | Required | Meaning |
|
|
17
|
+
| ------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
18
|
+
| `name` | Yes | Unique name. The main agent uses it to pick the agent. |
|
|
19
|
+
| `description` | Yes | When to use the agent. Shown in the system prompt's agent list. |
|
|
20
|
+
| `tools` | No | Tool names, extension tools included, as a comma-separated string or a list. Default: `defaultTools`. |
|
|
21
|
+
| `model` | No | `provider/id`, or `auto` for the model of the task's tier. Default: the main agent's model. |
|
|
22
|
+
| `thinking` | No | `off`, `minimal`, `low`, `medium`, `high`, `xhigh` or `max`. Default: the main agent's level. Omit with `model: auto`, which routes both model and thinking. |
|
|
23
|
+
| `isolation` | No | `shared` or `worktree`. Default: `shared`. |
|
|
24
24
|
|
|
25
25
|
The body is added to the end of Pi's system prompt; it does not replace it. Definitions load when a session starts, so a new or changed file takes effect after `/new` or `/reload`. Edits in the [settings panel](#settings) are the exception: their model, thinking, tools and isolation apply to the next run at once. A file with invalid frontmatter, an unknown field, a missing field or a name that another file in the same folder uses is reported and not loaded.
|
|
26
26
|
|
|
@@ -98,18 +98,23 @@ the tests and report the commands, the results and the files you changed.
|
|
|
98
98
|
|
|
99
99
|
## Starting a run
|
|
100
100
|
|
|
101
|
-
`subagent_start`
|
|
101
|
+
`subagent_start` starts one run per call. It requires `task` and accepts an optional `title`, plus either an agent or the settings of an inline run. A call that names an agent gives only `task` and `title`: the agent runs with the model, thinking, tools and isolation of its definition, and the main agent cannot change them. A call that names an agent and sets `model`, `thinking`, `tools` or `isolation` starts nothing. To change a role's settings, edit its definition.
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
| --------- | ------------------------------------------------------------------------------------------ |
|
|
105
|
-
| Model | The call, the definition, the main agent's current model |
|
|
106
|
-
| Thinking | The call, the definition, the classifier for `model: auto`, the main agent's current level |
|
|
107
|
-
| Tools | The call, the definition, the `defaultTools` setting |
|
|
108
|
-
| Isolation | The call, the definition, `shared` |
|
|
103
|
+
With **Auto mode only** on in [settings](#settings), the schema has no `model` or `thinking` parameters, and every inline run routes both automatically through `model: auto`. An inline call that still sets another model or a thinking level starts nothing. Agent runs keep the model of their definition.
|
|
109
104
|
|
|
110
|
-
|
|
105
|
+
For fixed or inherited models, each value comes from the first source that sets it. With `model: auto`, the router owns both model and thinking, and explicit thinking is invalid:
|
|
106
|
+
|
|
107
|
+
| Value | Agent run | Inline run |
|
|
108
|
+
| --------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
|
109
|
+
| Model | The definition, the main agent's current model | The call, `auto` with Auto mode only, the main agent's current model |
|
|
110
|
+
| Thinking | The classifier for `auto`; otherwise the definition, then the main agent's level | The classifier for `auto`; otherwise the call, then the main agent's level |
|
|
111
|
+
| Tools | The definition, the `defaultTools` setting | The call, the `defaultTools` setting |
|
|
112
|
+
| Isolation | The definition, `shared` | The call, `shared` |
|
|
113
|
+
|
|
114
|
+
- The `model` parameter accepts the **Allowed models** selection in [settings](#settings), when nonempty, and `auto`. Otherwise, it accepts the models of your scope (`--models` or `enabledModels`), or every available model when no scope is set. The same allowed set checks explicit models in definitions and auto tiers; inheriting the main agent's current model remains allowed even outside that set.
|
|
111
115
|
- The run always gets the `report` tool as well. A selected tool that the run does not have fails the start; MCP tools are waited for until their server connects.
|
|
112
116
|
- A run started from a definition shows with the definition's name. Inline runs are named `run-1`, `run-2` and so on.
|
|
117
|
+
- The optional `title` labels a run in the `/agents` inspector, the Dock and its end-of-turn notice. The inspector and Dock show the title in place of the name.
|
|
113
118
|
- The task is the run's first message, unchanged. The run's system prompt is Pi's own, then the definition body, then a short fixed guide for subagents.
|
|
114
119
|
|
|
115
120
|
### Auto model
|
|
@@ -127,14 +132,13 @@ The classifier answers three separate questions: how difficult the task is, how
|
|
|
127
132
|
The tier and high-risk questions always go in the first request. The thinking options depend on the run's model, and the model depends on the tier. When every model that the tier can lead to supports the same levels, the first request also asks the thinking question. Otherwise, a second request asks it after the model is known. A model with only one level gets no thinking question.
|
|
128
133
|
|
|
129
134
|
- **Tier models.** A tier without a model uses the next tier up that has one. When no tier from the rated one up has a model, the run uses the main agent's model, so the main agent's model is the ceiling. With no tier set, every auto run uses the main agent's model with the rated thinking.
|
|
130
|
-
- **Thinking.**
|
|
135
|
+
- **Thinking.** Auto always selects a supported thinking level together with the model. Auto calls and definitions must omit `thinking`; specifying it fails before any classifier request. A model with only one supported level uses that level without a thinking question.
|
|
131
136
|
- **High risk.** A task is high risk when the classifier's probability reaches the High-risk threshold (default 0.4). The threshold is below one half because a missed high-risk task usually costs more than a false alarm; adjust it with your own tasks. A high-risk task gets at least the model of the High-risk floor tier (default Deep, which falls back to the main agent's model). The rated tier stays as it is, and a tier above the floor is not lowered. The risk does not change the thinking level. It is a model choice only: tool permissions, approvals and the other checks of a run stay the same.
|
|
132
137
|
- **Unsure answers.** When the classifier's confidence in an answer is below 50%, the run uses the next level up.
|
|
133
138
|
- **Long tasks.** The request must fit the classifier's context window, and the package does not know the classifier's tokenizer. It therefore counts UTF-8 bytes, because a token always has at least one byte. The request gets at most 32 KB, and at most the window less 512 tokens for the classifier's own prompt; Pi's llama.cpp classifier shows the request twice, so it gets half. When the task and the agent's instructions do not fit, the instructions get at most a quarter of the room, and each is cut in the middle: the start and the end stay, with a note of how many characters are left out. When less than 1 KB is left for them, the classifier is not called and the run falls back as when the classifier fails.
|
|
134
139
|
- **No classifier selected:** the run uses the main agent's model and thinking. This is the default.
|
|
135
|
-
- **Nothing to rate:** when no tier has a model and the thinking is set, the run uses the main agent's model without a classifier request.
|
|
136
140
|
|
|
137
|
-
When the classifier fails, the run uses the main agent's model
|
|
141
|
+
When the classifier fails, the run uses the main agent's model and thinking. This covers an unavailable classifier, a failed request, an invalid answer and a window that is too small. A cancelled start still stops. A tier model that the subagent allowed set no longer permits is a settings error and fails the start; select another model under Auto tiers. For an inline run, the main agent can name a model instead; an agent run takes its model only from its definition. The start values show the choice and any error, for example `Model: anthropic/claude-haiku-5-5 (auto from call: the classifier cls/judge rated the task complex (71%), not high risk (8%); the complex tier's model)` and `Thinking: high (auto: the classifier rated the thinking high (64%))`. The [inspector](#dock-and-agents) shows the rating at the top of the run's log.
|
|
138
142
|
|
|
139
143
|
### Extension tools
|
|
140
144
|
|
|
@@ -149,11 +153,9 @@ A run can select a tool that one of your user or project extensions registers in
|
|
|
149
153
|
- An extension that fails to load, or that does not register the selected tool in the run's working directory, fails the start.
|
|
150
154
|
- A run that continues after you resume the session loads the extensions of its tools again, as the main session has them at that time. When the main session no longer has one of its tools, the run cannot continue.
|
|
151
155
|
|
|
152
|
-
###
|
|
153
|
-
|
|
154
|
-
The main agent can give `tasks` instead of `task`: a list of entries, each with its own `task` and the same optional values as a single start. With `tasks`, the optional values go in each entry, not at the top level. A call that mixes them, or gives both `task` and `tasks`, starts nothing.
|
|
156
|
+
### Parallel starts
|
|
155
157
|
|
|
156
|
-
|
|
158
|
+
Issue a separate `subagent_start` call for each independent task. These calls can run in parallel, each with its own run ID, progress and result. A failed start does not stop another call or undo a run that started.
|
|
157
159
|
|
|
158
160
|
### Workspace isolation
|
|
159
161
|
|
|
@@ -164,12 +166,14 @@ The package never merges, commits or deletes a worktree. Its changes stay there
|
|
|
164
166
|
|
|
165
167
|
## Tools
|
|
166
168
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
|
170
|
-
|
|
|
171
|
-
| `
|
|
172
|
-
| `
|
|
169
|
+
Every tool that takes a run addresses it by the ID that `subagent_start` returned: eight hexadecimal characters, such as `8416992c`. A run's title and name identify it only in the inspector, the Dock and notices; a tool given either one fails, and the error lists the branch's run IDs.
|
|
170
|
+
|
|
171
|
+
| Tool | Parameters | Effect |
|
|
172
|
+
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
173
|
+
| `subagent_start` | required `task`; optional `agent`, `title`; for inline runs `model`, `thinking` (both absent with Auto mode only; `thinking` is invalid with `model: auto`), `tools`, `isolation` | Creates one run and returns its ID, workspace and start values. |
|
|
174
|
+
| `subagent_send` | `runId`, `message` | Steers a running run, or starts a new turn in an idle, failed or interrupted run. |
|
|
175
|
+
| `subagent_status` | optional `runId` | Reads one run, or every run on the current branch, with token usage and the last report. |
|
|
176
|
+
| `subagent_stop` | `runId` | Stops the current turn. The run becomes `interrupted`; its session and worktree stay. |
|
|
173
177
|
|
|
174
178
|
## Reports and states
|
|
175
179
|
|
|
@@ -181,7 +185,9 @@ A run ends each turn with the `report` tool:
|
|
|
181
185
|
| `blocked` | The run cannot finish, for example because it declined the task or finished only part. |
|
|
182
186
|
| `needs_input` | The run needs something before it can continue. Its question goes to the main agent. |
|
|
183
187
|
|
|
184
|
-
A turn without a report
|
|
188
|
+
A turn that ends normally without a report shows as `done` in the Dock, notifications and `/agents`. A turn whose last reply hit the token limit or left no text shows no task status, only its state, because its work may not be finished. The main agent still gets the run's last message, marked as having no task status. A run never asks you directly: the main agent answers a question when it can and asks you when only you can.
|
|
189
|
+
|
|
190
|
+
If that last message exceeds 20,000 characters, the notice and `subagent_status` for that run keep the first 20,000 and append the omitted count and the absolute path to a Markdown copy of the full reply. The main agent can read that file to recover the rest. Copies live in `pi-lune-subagent-responses/` under the system temporary directory, with a separate filename for each run and reply content; they remain available until the system cleans them up. If writing a copy fails, the truncation hint says the file is unavailable and the run records an error diagnostic.
|
|
185
191
|
|
|
186
192
|
A message that reaches a run while it reports, for example a steer message from the main agent or from you, continues the same turn, and the run reports again. The last report is the turn's report. The main agent also gets the earlier reports of the turn in the same message, and `subagent_status` shows them.
|
|
187
193
|
|
|
@@ -191,13 +197,13 @@ The run state describes the session, not the task: `running`, `idle`, `failed` (
|
|
|
191
197
|
|
|
192
198
|
## Dock and `/agents`
|
|
193
199
|
|
|
194
|
-
The Dock counts the runs of the current branch by status, for example `◐ Agents · 2 running · 1 needs input`. The statuses are `running`, `needs input`, `blocked`, `failed`, `interrupted`, `
|
|
200
|
+
The Dock counts the runs of the current branch by status, for example `◐ Agents · 2 running · 1 needs input`. The statuses are `running`, `needs input`, `blocked`, `failed`, `interrupted`, `done` and `idle`. A run of another branch counts too while it runs, for example after you kept it running when you left its branch, and while its report waits for that branch. The line says how many such runs there are. The full Dock level also names the run that changed last, for example `latest: reviewer done`. Without runs every level shows only `○ Agents`, as Shell and Ask do.
|
|
195
201
|
|
|
196
202
|
The Dock never cuts its line. When the cell is too narrow, it leaves out complete parts, the least urgent first, so the `failed`, `blocked` and `needs input` counts stay longest. Then only `◐ Agents` shows, then only the marker.
|
|
197
203
|
|
|
198
204
|
The marker shows the most urgent state: a red `✕` for a failed or blocked turn, `?` when a run needs input, `◐` while a run works, a gray `●` when runs are failed or blocked, a green `●` for other runs, and `○` without runs. The red `✕` shows for 10 seconds after the turn ends, or until you open the run in the inspector; a later failed turn shows it again. Without the Lune Dock host, the same line shows as a row below the editor, followed by `/agents to open`.
|
|
199
205
|
|
|
200
|
-
Run `/agents` to open the inspector. The current branch's runs are on the left, followed by dimmed runs of other branches. The selected run's live transcript is on the right, below the run's heading. The heading shows the run's name, ID, state and report. Below them, it shows the model and thinking level that the run's requests use, for example `Model anthropic/claude-opus-5-5 · high`. For a live run, the model and level come from its session, where Pi limits the level to what the model supports. Otherwise, they are the run's start values. A narrow pane leaves out heading parts or wraps the model; it never cuts them.
|
|
206
|
+
Run `/agents` to open the inspector. The current branch's runs are on the left, followed by dimmed runs of other branches. Each row shows the run's title and one status at the right, as the Dock counts it: the report of an idle run (`done`, `needs_input` or `blocked`), and otherwise its state. A narrow list cuts only the title. An accent `›` and a bold title mark the selected run. The inspector reopens on the run that was selected when it closed; a new session starts on the first run. The selected run's live transcript is on the right, below the run's heading. The heading shows the run's name, ID, state and report, and `read-only` for a run that cannot be continued. Below them, it shows the model and thinking level that the run's requests use, for example `Model anthropic/claude-opus-5-5 · high`. For a live run, the model and level come from its session, where Pi limits the level to what the model supports. Otherwise, they are the run's start values. A narrow pane leaves out heading parts or wraps the model; it never cuts them.
|
|
201
207
|
|
|
202
208
|
For a run with `model: auto`, the model row ends with the tier and its share, for example `Model anthropic/claude-haiku-5-5 · medium · auto complex 71%`. When the classifier was unsure and the run used a higher tier, the row shows that tier without a share. A task rated high risk adds `high risk` to the row. When the classifier failed, the row ends with `auto failed`, and the top of the log shows the error. The top of the run's log shows the classifier's answer: the share of each tier, the chosen tier and its model, the high-risk probability with its threshold and any floor it set, and the rated thinking level. This block scrolls with the log.
|
|
203
209
|
|
|
@@ -212,7 +218,7 @@ For a run with `model: auto`, the model row ends with the tier and its share, fo
|
|
|
212
218
|
| Copy a report from another branch | `c` |
|
|
213
219
|
| Close | `Esc` |
|
|
214
220
|
|
|
215
|
-
A message you write reaches the run marked as coming from you. A running run gets it as a steer message; otherwise it starts a new turn. The main agent's
|
|
221
|
+
A message you write reaches the run marked as coming from you. A running run gets it as a steer message; otherwise it starts a new turn. The main agent does not get your message when you send it. It gets your messages, in order, with that turn's report, so it can read the report as an answer to you. A message longer than 20,000 characters is cut in the middle there; the run itself gets all of it. Until the turn ends, `subagent_status` shows the messages of the turn in progress.
|
|
216
222
|
|
|
217
223
|
The details view shows the start values and where each came from, the workspace, the token usage and the run's diagnostics. A run's tokens are not added to the main session's totals.
|
|
218
224
|
|
|
@@ -224,14 +230,32 @@ With the Lune theme on, the report messages in the main transcript render as its
|
|
|
224
230
|
|
|
225
231
|
Run `/lune-core-settings subagents` to open the Subagents section of Lune settings. It needs Lune Core's extension; settings are saved per scope, global or project, like other Lune settings.
|
|
226
232
|
|
|
227
|
-
| Setting
|
|
228
|
-
|
|
|
229
|
-
|
|
|
230
|
-
|
|
|
231
|
-
|
|
|
233
|
+
| Setting | Meaning |
|
|
234
|
+
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
235
|
+
| Allowed models | A multi-select list from Pi's scoped models. A nonempty selection replaces the session's default allowed list for new runs; an empty list follows Pi's scope. |
|
|
236
|
+
| Classifier model | The Pi classifier for `model: auto`. None: auto runs use the main agent's model and thinking. |
|
|
237
|
+
| Auto mode only | Off by default. On: `subagent_start` has no `model` or `thinking` parameters, and inline runs route both automatically. Custom agents keep their definition's model. |
|
|
238
|
+
| Auto tiers | A menu with one model per task tier, Light, Standard, Complex and Deep, from the subagent allowed set. A tier without a model uses the next tier up, then the main agent's model. The menu also sets the High-risk floor (Off, Standard, Complex or Deep) and the High-risk threshold. |
|
|
239
|
+
| Custom agents | A menu of agent definitions: your user agents at global scope, the project's at project scope. |
|
|
240
|
+
|
|
241
|
+
In **Allowed models**, Space toggles a model and Enter saves. Changes update the `subagent_start`
|
|
242
|
+
model options for new runs immediately. A saved selection replaces the
|
|
243
|
+
session's list rather than intersecting it, so an available saved model remains allowed when a
|
|
244
|
+
later session has a different scope. Saved models outside the current scope or no longer available
|
|
245
|
+
stay listed for removal; unavailable models cannot start new runs, and a selection containing only
|
|
246
|
+
unavailable models does not fall back to Pi's list. Clear the selection to restore Pi's default.
|
|
247
|
+
The main agent's inherited model and the model of an existing or resumed run are unchanged.
|
|
232
248
|
|
|
233
249
|
In **Custom agents**, Enter opens an agent, and its page edits the name, description, model, thinking level, tools and isolation. Each change is written to the definition file at once; comments and the body stay. Ctrl+R removes an optional field, so the run's default applies again. Renaming an agent renames a file named after it. Model, thinking, tools and isolation apply to the next run; the name and description reach the main agent after `/reload`, because its agent list stays fixed for the session. MCP tools are not listed in the tools menu, but selected MCP tools stay in the file. A file that does not load is listed with its problem and must be fixed by hand.
|
|
234
250
|
|
|
251
|
+
The **Thinking** selector offers only levels supported by a fixed or inherited model. With
|
|
252
|
+
`model: auto`, only the automatic default is offered: the classifier chooses a supported level for
|
|
253
|
+
each task, or the run uses the main model and thinking when no classifier is selected. Selecting
|
|
254
|
+
**auto** in the Model field removes any saved `thinking` override in the same write. Definitions
|
|
255
|
+
edited by hand must also omit `thinking` with `model: auto`; otherwise they are reported as invalid.
|
|
256
|
+
For fixed or inherited models, saved thinking values remain intact when changing models; an
|
|
257
|
+
unsupported saved level stays visible as a disabled entry until replaced or reset.
|
|
258
|
+
|
|
235
259
|
## Sessions and branches
|
|
236
260
|
|
|
237
261
|
- **Shutdown.** When the main session ends, for any reason, running runs stop and become `interrupted`. `subagent_send` continues them later from their session file, in the same working directory. A missing worktree fails the continuation.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lune_99/pi-subagent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Subagent runs for pi: delegated tasks in separate sessions, a Dock entry and an /agents inspector",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"node": ">=22.19.0"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@lune_99/pi-lune-extensions-core": "^0.2.
|
|
52
|
+
"@lune_99/pi-lune-extensions-core": "^0.2.1",
|
|
53
53
|
"yaml": "^2.9.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@earendil-works/pi-agent-core": "1.
|
|
73
|
-
"@earendil-works/pi-ai": "1.
|
|
74
|
-
"@earendil-works/pi-coding-agent": "1.
|
|
75
|
-
"@earendil-works/pi-tui": "1.
|
|
72
|
+
"@earendil-works/pi-agent-core": "1.6.0",
|
|
73
|
+
"@earendil-works/pi-ai": "1.6.0",
|
|
74
|
+
"@earendil-works/pi-coding-agent": "1.6.0",
|
|
75
|
+
"@earendil-works/pi-tui": "1.6.0",
|
|
76
76
|
"@types/node": "^22.20.2",
|
|
77
77
|
"typebox": "1.3.27",
|
|
78
78
|
"typescript": "5.9.3"
|
|
@@ -52,8 +52,9 @@ repeat the same information.
|
|
|
52
52
|
the main agent's model**. Use the current `subagent_start` tool schema's model choices rather than
|
|
53
53
|
a hardcoded list. A fixed model must be available within the current model scope. Auto writes
|
|
54
54
|
`model: auto`: the classifier in the Subagents settings rates each task, and the run uses the
|
|
55
|
-
model set for the task's tier in those settings
|
|
56
|
-
then the main agent's model; without a selected classifier the run
|
|
55
|
+
model set for the task's tier in those settings and a supported thinking level. A tier without a
|
|
56
|
+
model uses the next tier up, then the main agent's model; without a selected classifier the run
|
|
57
|
+
uses the main agent's model and thinking. Auto definitions must omit `thinking`.
|
|
57
58
|
Following the main agent means omitting
|
|
58
59
|
`model`; explain that behavior instead of silently omitting the field.
|
|
59
60
|
|
|
@@ -75,18 +76,20 @@ already requested by the user; explain conflicts rather than changing them silen
|
|
|
75
76
|
|
|
76
77
|
### Thinking
|
|
77
78
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
For Auto, omit `thinking`: the router selects both model and a supported thinking level for each
|
|
80
|
+
task. A definition with `model: auto` and a fixed `thinking` is invalid. Explain the main model and
|
|
81
|
+
thinking fallback when no classifier is selected or classification fails, then continue with tools.
|
|
82
|
+
|
|
83
|
+
For a fixed or inherited model, check its current Pi metadata and supported thinking levels. Use
|
|
84
|
+
information already exposed by the session, or inspect the relevant local model configuration and
|
|
85
|
+
Pi support code on demand; do not install a runtime or start another Pi session to obtain it. The
|
|
86
|
+
definition format accepts `off`, `minimal`, `low`, `medium`, `high`, `xhigh` and `max`, but an
|
|
87
|
+
individual model does not necessarily support all of them. Do not infer support from the model
|
|
88
|
+
name or rely on Pi clamping an unsupported recommendation.
|
|
84
89
|
|
|
85
90
|
Recommend a supported level based on the reasoning required and the latency or cost tradeoff. Do
|
|
86
|
-
not always recommend the highest level. If the user chose to follow the main model
|
|
87
|
-
|
|
88
|
-
are suitable. For Auto, explain that omitting `thinking` lets the classifier set the level for each
|
|
89
|
-
task, and that a set level replaces the classifier's choice. If capability
|
|
91
|
+
not always recommend the highest level. If the user chose to follow the main model, analyze the
|
|
92
|
+
current model and explain that changing models can change which levels are suitable. If capability
|
|
90
93
|
information cannot be verified, say so and resolve that uncertainty with the user before finalizing
|
|
91
94
|
the recommendation. Do not change the parent's model or thinking level merely to inspect it.
|
|
92
95
|
|
|
@@ -161,12 +164,13 @@ Check the draft against the definition format:
|
|
|
161
164
|
only letters, digits, `.`, `_` or `-`, and is at most 64 characters. `run-<digits>` is reserved.
|
|
162
165
|
Use the approved name exactly; do not silently normalize or rename it.
|
|
163
166
|
- A fixed `model` is the approved `provider/id`, or `auto`. Quote YAML strings when necessary.
|
|
164
|
-
-
|
|
165
|
-
`shared` or `worktree`.
|
|
167
|
+
- With `model: auto`, `thinking` is omitted. Otherwise, any `thinking` value is supported by the
|
|
168
|
+
chosen model. Tool names are exact, and `isolation` is `shared` or `worktree`.
|
|
166
169
|
|
|
167
|
-
Explain any omitted optional fields: `model` follows the main model, `thinking`
|
|
168
|
-
|
|
169
|
-
`isolation` defaults to `shared`.
|
|
170
|
+
Explain any omitted optional fields: `model` follows the main model, `thinking` is routed with
|
|
171
|
+
`model: auto` and otherwise follows the main thinking level within model limits, `tools` inherits
|
|
172
|
+
`defaultTools`, and `isolation` defaults to `shared`. The main agent cannot change these values when
|
|
173
|
+
it starts the agent; it gives only the task and a title.
|
|
170
174
|
|
|
171
175
|
Show the chosen scope, exact destination path, recommendation summary, and complete Markdown file
|
|
172
176
|
including its frontmatter and body. Ask the user to approve this draft or request changes. A request
|