pi-suite 0.3.1 → 0.3.5

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.
Files changed (42) hide show
  1. package/README.md +76 -29
  2. package/README.zh-CN.md +79 -32
  3. package/package.json +1 -1
  4. package/src/agents/index.ts +8 -6
  5. package/src/agents/render.ts +18 -8
  6. package/src/agents/schedules/menu.ts +2 -1
  7. package/src/agents/tools.ts +7 -6
  8. package/src/agents/ui/runs.ts +6 -7
  9. package/src/agents/ui/types.ts +5 -11
  10. package/src/agents/viewer-info.ts +12 -10
  11. package/src/agents/viewer.ts +4 -2
  12. package/src/agents/workflow/ui/progress.ts +5 -5
  13. package/src/ask/index.ts +4 -2
  14. package/src/ask/view.ts +13 -5
  15. package/src/goal/manager.ts +8 -0
  16. package/src/jobs/index.ts +6 -2
  17. package/src/jobs/output.ts +19 -7
  18. package/src/jobs/query.ts +27 -20
  19. package/src/jobs/render.ts +13 -4
  20. package/src/jobs/terminal/session.ts +73 -27
  21. package/src/jobs/tools.ts +9 -6
  22. package/src/jobs/viewer/component.ts +3 -1
  23. package/src/notify/index.ts +85 -0
  24. package/src/runtime/config.ts +5 -0
  25. package/src/runtime/notifications.ts +6 -1
  26. package/src/runtime/read.ts +163 -25
  27. package/src/runtime/responses/index.ts +19 -23
  28. package/src/runtime/responses/payload.ts +10 -7
  29. package/src/runtime/suite.ts +17 -6
  30. package/src/runtime/tools.ts +7 -2
  31. package/src/tasks/presentation.ts +5 -0
  32. package/src/tasks/query.ts +16 -8
  33. package/src/tasks/render.ts +14 -5
  34. package/src/tasks/tools.ts +5 -2
  35. package/src/tasks/viewer.ts +18 -9
  36. package/src/ui/browser.ts +14 -10
  37. package/src/ui/details.ts +22 -7
  38. package/src/ui/dock.ts +6 -1
  39. package/src/ui/rendering/read-page.ts +2 -1
  40. package/src/ui/structured-details.ts +57 -11
  41. package/src/ui/working.ts +11 -0
  42. package/third-party/UPSTREAM.md +17 -66
package/README.md CHANGED
@@ -2,54 +2,100 @@
2
2
 
3
3
  [中文](README.zh-CN.md) · [Documentation](docs/en/index.md)
4
4
 
5
- Pi Suite is an extension package for [Pi](https://github.com/earendil-works/pi), the terminal coding agent. It aims to cover most of what day-to-day development with Pi needs in one install: the model can ask you questions, keep a task list, run and supervise background commands, work toward a goal across turns, and delegate to subagents.
5
+ An all-in-one extension bundle for [Pi](https://github.com/earendil-works/pi), the terminal coding agent, that integrates six standalone extensions into five modules: goals, subagents, user questions, background jobs and task lists. The modules share one storage layer, one notification queue and one panel above the editor (the Dock).
6
6
 
7
- These capabilities usually come from six separate extensions: `pi-ask-user`, `@tintinweb/pi-tasks`, `pi-interactive-shell`, `pi-background-jobs`, `@narumitw/pi-goal` and `@tintinweb/pi-subagents`. Pi Suite builds on them as modules of one extension that share a single UI, storage layer and notification queue, so the modules know about each other and work together instead of side by side.
7
+ ## Install
8
8
 
9
- ## How the modules work together
9
+ ```sh
10
+ pi install npm:pi-suite
11
+ pi list
12
+ ```
10
13
 
11
- - **Tasks track the work that runs elsewhere.** `job_start` and `agent_start` take a `taskId`, and the job or agent ID is recorded on that task. A subagent started for a task can read and update that task.
12
- - **A goal waits for the work it started.** `goal_wait` holds the goal until the listed jobs, subagents or workflows settle, and resumes early on a job monitor event or a subagent question.
13
- - **Subagents ask their parent.** When a subagent calls `ask_user`, the question goes to the session that started it, which answers with `agent_send`. Questions to you and results of background work never interrupt each other.
14
- - **One `wait` for everything.** The model waits for any mix of jobs, subagents and workflows with a single call, which also returns when one of them asks a question or a monitor fires.
15
- - **One notification queue.** Results from all modules are merged into one message per wake-up and delivered only to the session that owns the work. They hold back while a question or browser is open, and while a goal is paused because you cancelled a question.
16
- - **One Dock.** Goal, tasks, subagents, jobs and workflows share one panel above the editor. Press ← in an empty editor to select a row and open it in the shared browsers: `/tasks`, `/jobs` and `/subagents`, for filtering, reading transcripts and logs, and controlling runs.
17
- - **Workflows build on the rest.** A workflow script fans out subagents, and each of them can use jobs, tasks and questions like any other subagent.
14
+ Run `/reload` in an open session or restart Pi. All modules are enabled by default. Updates are covered in [Installation](docs/en/installation.md).
18
15
 
19
- ## Features
16
+ The package ships two skills: `pi-suite-jobs` teaches the model to run commands and coding-agent CLIs as jobs, and `pi-suite-workflow` teaches it to write and resume workflow scripts.
20
17
 
21
- | Module | Replaces | What it gives you |
22
- | --- | --- | --- |
23
- | [Ask](docs/en/modules/ask.md) | `pi-ask-user` | `ask_user`: the model asks you one question or a batch of 2–4, with options, defaults, multi-select, free-text answers and an idle timeout. |
24
- | [Goal](docs/en/modules/goal.md) | `@narumitw/pi-goal` | `/goal <objective>`: the model keeps working across turns until it completes the goal with evidence, reports a blocker, or you pause it. Optional token budget. |
25
- | [Tasks](docs/en/modules/tasks.md) | `@tintinweb/pi-tasks` | A two-level task list (groups and child tasks) that the model maintains and the Dock displays, with dependencies and atomic batch edits. |
26
- | [Jobs](docs/en/modules/jobs/index.md) | `pi-background-jobs`, `pi-interactive-shell` | Background commands in pipe or PTY mode: bounded log reading, input, output monitors, coding-agent CLI presets, supervised terminals, and stops that check every captured process has exited and report `unconfirmed` when they cannot. |
27
- | [Agents](docs/en/modules/agents/index.md) | `@tintinweb/pi-subagents` | Subagents as child Pi sessions in the same process: custom types, per-type models and thinking, `@handle` mentions, questions to the parent, automatic resume after network or upstream errors, schedules, scripted [workflows](docs/en/modules/agents/workflows.md) and an [RPC API](docs/en/modules/agents/rpc.md) for other extensions. |
18
+ ## Modules
28
19
 
29
- The package also includes the `oh-my-pi` dark theme and the `pi-suite-jobs` and `pi-suite-workflow` skills. Remove the standalone extensions after installing; see [Replace standalone extensions](docs/en/installation.md#replace-standalone-extensions).
20
+ | Module | Upstream |
21
+ | --- | --- |
22
+ | [Goal](docs/en/modules/goal.md) | `@narumitw/pi-goal` |
23
+ | [Agents](docs/en/modules/agents/index.md) | `@tintinweb/pi-subagents` |
24
+ | [Ask](docs/en/modules/ask.md) | `pi-ask-user` |
25
+ | [Jobs](docs/en/modules/jobs/index.md) | `pi-background-jobs`, `pi-interactive-shell` |
26
+ | [Tasks](docs/en/modules/tasks.md) | `@tintinweb/pi-tasks` |
30
27
 
31
- ## Install
28
+ ### Goal
32
29
 
33
- ```sh
34
- pi install npm:pi-suite
35
- pi list
36
- ```
30
+ `/goal <objective>` sets one objective for the session. The model keeps working across turns until it completes the goal with evidence (`goal_complete`), reports a blocker (`goal_blocked`), or you pause it. `--tokens 100k` sets an optional token budget. `goal_wait` waits for jobs, subagents and workflows in the same way as `wait` (see [Agents](#agents)).
31
+
32
+ ### Agents
33
+
34
+ Subagents are child Pi sessions that run in the same process, in the foreground or background.
35
+
36
+ - **Types**: the built-in `general-purpose`, `Explore` and `Plan`, plus custom types defined by a Markdown file in `~/.pi/agent/agents/` (user) or `.pi/agents/` (project). A type sets the system prompt, tools, model, thinking level, turn limit, skills and persistent memory; `agents.types` overrides the model and thinking of any type. See [Agent types, models and resources](docs/en/modules/agents/types-and-models.md).
37
+ - **Mentions**: `@<type> <message>` in the editor, for example `@explore where is the config loaded?`, hands the message to a subagent of that type.
38
+ - **Questions**: a subagent's `ask_user` question goes to the session that started it.
39
+ - **Recovery**: a subagent stopped by a network or upstream error is resumed in the same session.
40
+ - **Waiting**: `wait` waits for any mix of jobs, subagents and workflows, and returns early when a monitor fires or a subagent asks a question.
41
+
42
+ Subagents can also run on a [schedule](docs/en/modules/agents/schedules.md). A [workflow](docs/en/modules/agents/workflows.md) script fans out many subagents and can resume from an earlier run. Other extensions start and control subagents through the [RPC API](docs/en/modules/agents/rpc.md).
43
+
44
+ ### Ask
45
+
46
+ `ask_user` lets the model ask you one question or a batch of 2–4, with options, defaults, multi-select, free-text answers and an idle timeout (`ask.timeout`).
37
47
 
38
- Then run `/reload` in an open session, or restart Pi. All modules are enabled by default. See [Installation](docs/en/installation.md) for updates.
48
+ ### Jobs
49
+
50
+ Jobs run commands in the background in pipe or PTY mode. The model reads bounded log slices, sends input, and sets output monitors that wake it on a literal, regex or numeric threshold match. In `/jobs` you can read the logs or take over a PTY with `i`.
51
+
52
+ Presets start coding-agent CLIs in a PTY. The model supervises them hands-free, and you can take over the terminal at any time. See [CLI presets and PTY supervision](docs/en/modules/jobs/cli-and-hands-free.md).
53
+
54
+ Stopping a job checks that every captured process has exited, and reports `unconfirmed` when it cannot.
55
+
56
+ ### Tasks
57
+
58
+ A two-level task list (groups and child tasks) that the model maintains and the Dock displays, with dependencies and atomic batch edits. A job or subagent can be linked to a task, and a subagent started for a task can update it.
59
+
60
+ ## Interface
61
+
62
+ The Dock shows the goal, tasks, subagents, jobs and workflows; press ← in an empty editor to select a row. `/tasks`, `/jobs` and `/subagents` share one browser layout, whose detail pane colors names, IDs, states and errors.
63
+
64
+ | The Dock | `/subagents` | Subagent transcript |
65
+ | :---: | :---: | :---: |
66
+ | ![The Dock shows the task tree above running subagents](docs/img/dock.png) | ![The /subagents browser with the run list on the left and details on the right](docs/img/subagent_list.png) | ![A subagent transcript with tool calls and their output](docs/img/subagent_page.png) |
67
+ | A task tree with group progress, and the subagents running for it. | Runs on the left; model, tokens, runtime, input and output on the right. | View the subagent's tool calls and their output. |
68
+
69
+ The package also includes the `oh-my-pi` dark theme, and makes Pi's copy work inside tmux through OSC 52. See [Interface](docs/en/interface.md).
70
+
71
+ ## OpenAI Responses recovery
72
+
73
+ Some OpenAI Responses endpoints, typically behind a gateway that switches between upstream accounts, reject a request because the history was created under another account. Without help, the session keeps failing on the same history.
74
+
75
+ Off by default. Set `runtime.openAIResponsesAutoRecovery` to `true` (or toggle it in `/suite`) and run `/reload`. The suite then repairs the history and continues automatically in two cases:
76
+
77
+ - **Item IDs from another resource.** The endpoint reports a resource, ownership or missing-dependency error. The suite removes the upstream `id` from the history items that the failed request carried.
78
+ - **Encrypted reasoning that can't be decrypted.** The suite drops the reasoning items that the new account cannot verify and removes the upstream IDs from the other items. Reasoning produced afterwards is replayed as usual.
79
+
80
+ Messages, tool calls and tool outputs stay intact. The original history stays on disk; the failed message is only hidden from the model's context. The main session and subagents are both covered, and an active goal keeps its progress while the repair runs.
81
+
82
+ Recovery is conservative: it only acts on `openai-responses` models, only when the failed request can be replayed on its own, and never when the response already produced content or tool calls, so side effects are not repeated. Rate limits, auth and quota errors, context overflow and ordinary schema errors are left alone. Retries use Pi's own retry budget. Details are in [OpenAI Responses recovery](docs/en/configuration.md#openai-responses-recovery).
83
+
84
+ ## Reminders
85
+
86
+ When an agent finishes its work and the terminal is not in the foreground, a reminder notification is sent automatically. How it appears depends on the terminal, and you can turn it off in the settings (`/suite`).
39
87
 
40
88
  ## Commands
41
89
 
42
90
  | Command | What it does |
43
91
  | --- | --- |
44
- | `/goal [--tokens 100k] <objective>` | Starts a goal; the model keeps working across turns until it is done. `/goal status`, `edit`, `pause`, `resume` and `clear` show, change, pause, resume or clear it. |
92
+ | `/goal [--tokens 100k] <objective>` | Starts a goal. `/goal status`, `edit`, `pause`, `resume` and `clear` show, change, pause, resume or clear it. |
45
93
  | `/tasks [group ID]` | Browse the task list, optionally opening one group. |
46
94
  | `/jobs [finished\|all] [workspace]` | Browse jobs, read logs, or take over a PTY with `i`. Lists active jobs of this session by default. |
47
95
  | `/subagents [queued\|finished\|all\|types\|schedules\|workflows]` | Browse subagent runs, transcripts, types, schedules and workflows; `/subagents workspace [...]` covers the whole workspace. |
48
96
  | `/suite` | View and edit settings one by one. |
49
97
  | `/exit` | Quit Pi after stopping jobs and subagents and waiting for cleanup, up to 10 seconds for jobs. |
50
98
 
51
- Type `@<type>` in the editor (for example `@explore where is the config loaded?`) to hand the message to a subagent of that type.
52
-
53
99
  ## Settings
54
100
 
55
101
  No configuration is required. Optional settings live in `~/.pi/agent/pi-suite.json` (user) and `.pi/pi-suite.json` (project); the project file overrides the user file field by field. Common settings:
@@ -63,12 +109,13 @@ No configuration is required. Optional settings live in `~/.pi/agent/pi-suite.js
63
109
  | `ask.timeout` | `600000` | Default `ask_user` idle timeout in ms; `0` waits forever. |
64
110
  | `goal.display`, `agents.display`, `jobs.display` | `status` | Show the summary in the footer status, the Dock, or nowhere. |
65
111
  | `tasks.reminders` | `true` | Remind the model when it has not updated tasks for several turns. |
112
+ | `notify.enabled` | `true` | Enable notifications. |
66
113
  | `agents.maxConcurrent` | `10` | Background subagent concurrency limit. |
67
114
  | `agents.maxDepth` | `3` | Maximum session depth, including the main session. |
68
115
  | `agents.defaultModel`, `agents.types` | unset | Default subagent model; per-type model, thinking and enabled overrides. |
69
116
  | `agents.mentions`, `agents.scheduling`, `agents.workflows` | `true` | `@handle` mentions, schedules and workflows. |
70
117
  | `jobs.detachKey`, `jobs.returnKey`, `jobs.transferKey` | `ctrl+]`, `ctrl+g`, `ctrl+t` | Leave the terminal view, hand input back to the model, send the screen. |
71
- | `runtime.openAIResponsesAutoRecovery` | `false` | Recover from one class of OpenAI Responses item ID errors. |
118
+ | `runtime.openAIResponsesAutoRecovery` | `false` | When an OpenAI Responses endpoint rejects history created under another upstream account (for example behind a gateway), drop the rejected item IDs or encrypted reasoning and continue. See [OpenAI Responses recovery](docs/en/configuration.md#openai-responses-recovery). |
72
119
 
73
120
  ```json
74
121
  {
package/README.zh-CN.md CHANGED
@@ -2,54 +2,100 @@
2
2
 
3
3
  [English](README.md) · [文档](docs/zh/index.md)
4
4
 
5
- Pi Suite 是 [Pi](https://github.com/earendil-works/pi)(终端编码 agent)的扩展包,目标是装一个扩展就能满足用 Pi 做日常开发的大部分需要:模型可以向你提问、维护任务清单、运行并监督后台命令、跨轮次朝一个目标持续工作,以及把工作交给子代理。
5
+ [Pi](https://github.com/earendil-works/pi)(终端编码 agent)的扩展整合包,把六个独立扩展整合为五个模块:目标、子代理、用户提问、后台任务和任务清单。各模块共用一套存储层、通知队列和编辑器上方的面板(Dock)。
6
6
 
7
- 这些能力原本分散在六个独立扩展里:`pi-ask-user`、`@tintinweb/pi-tasks`、`pi-interactive-shell`、`pi-background-jobs`、`@narumitw/pi-goal` 和 `@tintinweb/pi-subagents`。Pi Suite 在它们的基础上把这些能力做成同一个扩展的模块,共用一套界面、存储层和通知队列,模块之间互相知道对方的存在,能够联动,而不只是并排安装。
7
+ ## 安装
8
8
 
9
- ## 模块如何联动
9
+ ```sh
10
+ pi install npm:pi-suite
11
+ pi list
12
+ ```
10
13
 
11
- - **任务记录在别处运行的工作。** `job_start` 和 `agent_start` 可以带 `taskId`,job 或子代理的 ID 会记到该任务上。为某个任务启动的子代理可以读取并更新这个任务。
12
- - **目标等待自己发起的工作。** `goal_wait` 让目标停下,直到列出的 job、子代理或 workflow 全部结束;job 监视器触发或子代理提问时会提前恢复。
13
- - **子代理向父级提问。** 子代理调用 `ask_user` 时,问题发给启动它的会话,由该会话用 `agent_send` 回答。向你的提问和后台工作的结果互不打断。
14
- - **一个 `wait` 等待所有对象。** 模型一次调用就能等待任意组合的 job、子代理和 workflow;其中有对象提问或监视器触发时也会返回。
15
- - **一条通知队列。** 各模块的结果每次唤醒合并为一条消息,只投递给拥有该工作的会话。有提问或浏览器打开时会暂缓投递;因你取消提问而暂停的目标也会暂缓,等你发下一条消息时一起送达。
16
- - **一个 Dock。** 目标、任务、子代理、job 和 workflow 共用编辑器上方的一个面板。在空编辑器中按 ← 可选择某一行,并在共用的浏览器中打开:`/tasks`、`/jobs` 和 `/subagents`,用于筛选、阅读对话记录和日志,以及控制运行。
17
- - **Workflow 建立在其他模块之上。** Workflow 脚本批量派出子代理,每个子代理都能像普通子代理一样使用 job、任务和提问。
14
+ 在已打开的会话中执行 `/reload`,或重启 Pi。所有模块默认启用。更新方式见[安装](docs/zh/installation.md)。
18
15
 
19
- ## 功能
16
+ 扩展包附带两个技能:`pi-suite-jobs` 指导模型以 job 形式运行命令和编码 agent CLI,`pi-suite-workflow` 指导模型编写和续跑 workflow 脚本。
20
17
 
21
- | 模块 | 替代 | 提供的能力 |
22
- | --- | --- | --- |
23
- | [Ask](docs/zh/modules/ask.md) | `pi-ask-user` | `ask_user`:模型向你提出单个问题或 2–4 个批量问题,支持选项、默认值、多选、自由文字回答和空闲超时。 |
24
- | [Goal](docs/zh/modules/goal.md) | `@narumitw/pi-goal` | `/goal <目标>`:模型跨轮次持续工作,直到附证据完成目标、报告阻塞,或由你暂停。可设置 token 预算。 |
25
- | [Tasks](docs/zh/modules/tasks.md) | `@tintinweb/pi-tasks` | 两级任务清单(分组与子任务),由模型维护、在 Dock 中显示,支持依赖和原子批量编辑。 |
26
- | [Jobs](docs/zh/modules/jobs/index.md) | `pi-background-jobs`、`pi-interactive-shell` | pipe 或 PTY 模式的后台命令:有界日志读取、输入、输出监视器、编码 agent CLI 预设、受监督终端;停止时逐一检查已捕获的进程是否退出,无法确认时报告 `unconfirmed`。 |
27
- | [Agents](docs/zh/modules/agents/index.md) | `@tintinweb/pi-subagents` | 在同一进程中以 Pi 子会话运行的子代理:自定义类型、按类型配置模型与 thinking、`@handle` 提及、向父级提问、网络或上游错误后自动恢复、定时调度、脚本化 [Workflow](docs/zh/modules/agents/workflows.md),以及供其他扩展使用的 [RPC 接口](docs/zh/modules/agents/rpc.md)。 |
18
+ ## 模块
28
19
 
29
- 本包还附带深色主题 `oh-my-pi`,以及 `pi-suite-jobs` 和 `pi-suite-workflow` 两个技能。安装后请移除对应的独立扩展,见[替换独立扩展](docs/zh/installation.md#替换独立扩展)。
20
+ | 模块 | 上游来源 |
21
+ | --- | --- |
22
+ | [Goal](docs/zh/modules/goal.md) | `@narumitw/pi-goal` |
23
+ | [Agents](docs/zh/modules/agents/index.md) | `@tintinweb/pi-subagents` |
24
+ | [Ask](docs/zh/modules/ask.md) | `pi-ask-user` |
25
+ | [Jobs](docs/zh/modules/jobs/index.md) | `pi-background-jobs`、`pi-interactive-shell` |
26
+ | [Tasks](docs/zh/modules/tasks.md) | `@tintinweb/pi-tasks` |
30
27
 
31
- ## 安装
28
+ ### Goal
32
29
 
33
- ```sh
34
- pi install npm:pi-suite
35
- pi list
36
- ```
30
+ `/goal <目标>` 为当前会话设定一个目标。模型跨轮次持续工作,直到附证据完成目标(`goal_complete`)、报告阻塞(`goal_blocked`),或由你暂停。`--tokens 100k` 可设置 token 预算。`goal_wait` 等待 job、子代理和 workflow 的方式与 `wait` 相同(见 [Agents](#agents))。
31
+
32
+ ### Agents
33
+
34
+ 子代理是在同一进程中运行的 Pi 子会话,可在前台或后台运行。
35
+
36
+ - **类型**:内置 `general-purpose`、`Explore` 和 `Plan`,也可以在 `~/.pi/agent/agents/`(用户级)或 `.pi/agents/`(项目级)用 Markdown 文件定义自定义类型。类型决定系统提示、工具、模型、thinking 级别、轮次上限、技能和持久记忆;`agents.types` 可覆盖任意类型的模型和 thinking。见 [Agent 类型、模型与资源](docs/zh/modules/agents/types-and-models.md)。
37
+ - **提及**:在输入框中输入 `@<类型> <消息>`,例如 `@explore 配置是在哪里加载的?`,消息会交给该类型的子代理。
38
+ - **提问**:子代理的 `ask_user` 问题发给启动它的会话。
39
+ - **恢复**:子代理因网络或上游错误中断后,会在同一会话中继续。
40
+ - **等待**:`wait` 可等待任意组合的 job、子代理和 workflow,监视器触发或子代理提问时提前返回。
41
+
42
+ 子代理还可以按[定时调度](docs/zh/modules/agents/schedules.md)运行。[Workflow](docs/zh/modules/agents/workflows.md) 脚本批量派出子代理,并可从之前的运行继续。其他扩展可通过 [RPC 接口](docs/zh/modules/agents/rpc.md)启动和控制子代理。
43
+
44
+ ### Ask
45
+
46
+ `ask_user` 让模型向你提出单个问题或 2–4 个批量问题,支持选项、默认值、多选、自由文字回答和空闲超时(`ask.timeout`)。
37
47
 
38
- 然后在已打开的会话中执行 `/reload`,或重启 Pi。所有模块默认启用。更新见 [安装](docs/zh/installation.md)。
48
+ ### Jobs
49
+
50
+ job 以 pipe 或 PTY 模式在后台运行命令。模型可以分段读取有界日志、发送输入,并设置输出监视器,在匹配字面量、正则或数值阈值时被唤醒。在 `/jobs` 中可以阅读日志,或按 `i` 接管 PTY。
51
+
52
+ 预设可在 PTY 中启动编码 agent CLI,由模型免手动监督,你也可以随时接管终端。见 [CLI 预设与 PTY 监督](docs/zh/modules/jobs/cli-and-hands-free.md)。
53
+
54
+ 停止 job 时会逐一检查已捕获的进程是否退出,无法确认时报告 `unconfirmed`。
55
+
56
+ ### Tasks
57
+
58
+ 两级任务清单(分组与子任务),由模型维护、在 Dock 中显示,支持依赖和原子批量编辑。job 或子代理可以关联到任务,为某个任务启动的子代理可以更新该任务。
59
+
60
+ ## 界面
61
+
62
+ Dock 显示目标、任务、子代理、job 和 workflow;在空编辑器中按 ← 可选择某一行。`/tasks`、`/jobs` 和 `/subagents` 使用同一种浏览布局,详情面板为名称、ID、状态和错误着色。
63
+
64
+ | Dock | `/subagents` | 子代理会话 |
65
+ | :---: | :---: | :---: |
66
+ | ![Dock 显示任务树和运行中的子代理](docs/img/dock.png) | ![/subagents 浏览器,左侧是运行列表,右侧是详情](docs/img/subagent_list.png) | ![子代理会话,包含工具调用及其输出](docs/img/subagent_page.png) |
67
+ | 带分组进度的任务树,以及为任务运行的子代理。 | 左侧是运行列表,右侧是模型、token、运行时间、输入和输出。 | 可查看子代理的工具调用及其输出。 |
68
+
69
+ 扩展包还提供深色主题 `oh-my-pi`,并使 Pi 的复制在 tmux 中经 OSC 52 转发到本地终端。见[界面](docs/zh/interface.md)。
70
+
71
+ ## OpenAI Responses 故障自动恢复
72
+
73
+ 部分 OpenAI Responses 端点(通常是会在多个上游账号之间切换的网关)会因为历史由另一个账号创建而拒绝请求。不处理的话,会话会一直在同一段历史上失败。
74
+
75
+ 默认关闭。把 `runtime.openAIResponsesAutoRecovery` 设为 `true`(也可在 `/suite` 中切换)并执行 `/reload` 后,套件会在以下两种情况自动修复历史并继续:
76
+
77
+ - **来自其他资源的 item ID。** 端点返回资源、归属或依赖缺失错误时,移除失败请求所带历史项的上游 `id`。
78
+ - **无法解密的加密 reasoning。** 丢弃新账号无法验证的 reasoning 项,并移除其余历史项的上游 ID;之后产生的新 reasoning 照常重放。
79
+
80
+ 正文、工具调用和工具输出保持原样。原始历史仍保留在磁盘上,失败消息只是不再进入模型上下文。主会话和子代理都受保护,修复期间进行中的 goal 保留进度。
81
+
82
+ 恢复策略偏保守:只作用于 `openai-responses` 模型,只在失败请求可独立重放时进行,响应已产生正文或工具调用时不重试,避免重复副作用。限流、认证、额度、上下文超限和普通 schema 错误不处理。重试沿用 Pi 自身的重试预算。详见 [OpenAI Responses 恢复](docs/zh/configuration.md#openai-responses-恢复)。
83
+
84
+ ## 提醒
85
+
86
+ 在agent完成工作且终端没有位于前台时,会自动发送提醒通知,具体通知形式因不同终端而异,可在设置(`/suite`)中取消通知。
39
87
 
40
88
  ## 命令
41
89
 
42
90
  | 命令 | 作用 |
43
91
  | --- | --- |
44
- | `/goal [--tokens 100k] <目标>` | 建立目标,模型跨轮次持续工作直到完成。`/goal status`、`edit`、`pause`、`resume`、`clear` 查看、修改、暂停、恢复或清除目标。 |
92
+ | `/goal [--tokens 100k] <目标>` | 建立目标。`/goal status`、`edit`、`pause`、`resume`、`clear` 查看、修改、暂停、恢复或清除目标。 |
45
93
  | `/tasks [组 ID]` | 浏览任务清单,可直接定位到某个组。 |
46
- | `/jobs [finished\|all] [workspace]` | 浏览 job、阅读日志,或按 `i` 接管 PTY。默认只列活动 job 和当前会话。 |
94
+ | `/jobs [finished\|all] [workspace]` | 浏览 job、阅读日志,或按 `i` 接管 PTY。默认只列当前会话的活动 job。 |
47
95
  | `/subagents [queued\|finished\|all\|types\|schedules\|workflows]` | 浏览子代理运行、对话记录、类型、定时调度和 workflow;`/subagents workspace [...]` 查看整个工作区。 |
48
96
  | `/suite` | 逐项查看和编辑设置。 |
49
97
  | `/exit` | 退出 Pi,先停止 job 和子代理并等待清理,job 最多等待 10 秒。 |
50
98
 
51
- 在输入框中输入 `@<类型>`(例如 `@explore 配置是在哪里加载的?`)可把消息交给对应类型的子代理。
52
-
53
99
  ## 设置项
54
100
 
55
101
  无需任何配置。可选设置位于 `~/.pi/agent/pi-suite.json`(用户级)和 `.pi/pi-suite.json`(项目级);项目文件按字段覆盖用户文件。常用设置:
@@ -63,12 +109,13 @@ pi list
63
109
  | `ask.timeout` | `600000` | `ask_user` 的默认空闲超时(毫秒),`0` 为一直等待。 |
64
110
  | `goal.display`、`agents.display`、`jobs.display` | `status` | 摘要显示在 footer 状态、Dock 还是隐藏。 |
65
111
  | `tasks.reminders` | `true` | 模型多轮未更新任务时附加提醒。 |
112
+ | `notify.enabled` | `true` | 启用通知。 |
66
113
  | `agents.maxConcurrent` | `10` | 后台子代理并发上限。 |
67
114
  | `agents.maxDepth` | `3` | 子代理最大嵌套层数(含主会话)。 |
68
115
  | `agents.defaultModel`、`agents.types` | 未设置 | 子代理默认模型;按类型覆盖模型、thinking 和启用状态。 |
69
116
  | `agents.mentions`、`agents.scheduling`、`agents.workflows` | `true` | `@handle` 提及、定时调度和 workflow。 |
70
117
  | `jobs.detachKey`、`jobs.returnKey`、`jobs.transferKey` | `ctrl+]`、`ctrl+g`、`ctrl+t` | 终端视图的离开、交还模型和发送屏幕按键。 |
71
- | `runtime.openAIResponsesAutoRecovery` | `false` | 自动修复一类 OpenAI Responses item ID 错误。 |
118
+ | `runtime.openAIResponsesAutoRecovery` | `false` | OpenAI Responses 端点因历史来自其他上游账号(例如经过网关)而拒绝请求时,移除被拒的 item ID 或加密 reasoning 后继续。见 [OpenAI Responses 恢复](docs/zh/configuration.md#openai-responses-恢复)。 |
72
119
 
73
120
  ```json
74
121
  {
@@ -77,7 +124,7 @@ pi list
77
124
  }
78
125
  ```
79
126
 
80
- 全部字段见 [配置](docs/zh/configuration.md),也可以用 `/suite` 编辑。
127
+ 全部字段见[配置](docs/zh/configuration.md),也可以用 `/suite` 编辑。
81
128
 
82
129
  ## 文档
83
130
 
@@ -92,7 +139,7 @@ pnpm typecheck
92
139
  pnpm test
93
140
  ```
94
141
 
95
- 源码结构和项目规则见 [开发](docs/zh/development.md)。
142
+ 源码结构和项目规则见[开发](docs/zh/development.md)。
96
143
 
97
144
  ## 致谢与许可证
98
145
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-suite",
3
- "version": "0.3.1",
3
+ "version": "0.3.5",
4
4
  "description": "Custom modular Pi extension suite",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -27,15 +27,17 @@ export function agentSummary(record: AgentRecord) {
27
27
  const { prompt, result, ...summary } = record;
28
28
  return { ...summary, promptSummary: boundedText(prompt, 200), resultSummary: result === undefined ? undefined : boundedText(result, 500) };
29
29
  }
30
- export function usageText(record: AgentRecord): string | undefined {
31
- const usage = record.usage;
32
- return usage && `usage: input ${usage.tokens.input} · output ${usage.tokens.output} · cacheRead ${usage.tokens.cacheRead} · cacheWrite ${usage.tokens.cacheWrite} · total ${usage.tokens.total} · cost $${usage.cost.toFixed(6)}`;
30
+ export function usageText({ usage }: Pick<AgentRecord, 'usage'>, prefix = 'usage: '): string | undefined {
31
+ return usage && `${prefix}input ${usage.tokens.input} · output ${usage.tokens.output} · cacheRead ${usage.tokens.cacheRead} · cacheWrite ${usage.tokens.cacheWrite} · total ${usage.tokens.total} · cost $${usage.cost.toFixed(6)}`;
33
32
  }
34
- function resultLines(record: AgentRecord, error = record.error): string[] {
35
- return [record.error ? usageText(record) : undefined, record.error ? `error: ${error}` : undefined,
36
- record.result === undefined ? undefined : boundedText(record.result, 2048),
33
+ /** Final result text, bounded to 2048 bytes, with the agent_read call that returns all of it. */
34
+ export function resultBody(record: AgentRecord): string[] {
35
+ return [record.result === undefined ? undefined : boundedText(record.result, 2048),
37
36
  record.result && Buffer.byteLength(record.result) > 2048 ? `full: agent_read({"id":"${record.id}","runId":"${record.runId}","stream":"result","offset":0})` : undefined].filter(value => value !== undefined);
38
37
  }
38
+ function resultLines(record: AgentRecord, error = record.error): string[] {
39
+ return [record.error ? usageText(record) : undefined, record.error ? `error: ${error}` : undefined, ...resultBody(record)].filter(value => value !== undefined);
40
+ }
39
41
  function resultSummary(record: AgentRecord): string { return [summaryLine(record), ...resultLines(record)].join('\n'); }
40
42
  function providerErrorMessage(error: string): string {
41
43
  // Provider errors may be plain text or a JSON envelope prefixed with the HTTP status.
@@ -6,13 +6,15 @@ import type { ReadPage } from '../runtime/read.ts';
6
6
  import type { StopOutcome } from '../runtime/tools.ts';
7
7
  import type { JobSummary } from '../jobs/types.ts';
8
8
  import type { ScheduledAgent } from './schedules/store.ts';
9
- import type { agentSummary } from './index.ts';
9
+ import type { AskParams } from '../ask/schema.ts';
10
+ import { usageText, type agentSummary } from './index.ts';
10
11
 
11
12
  type Summary = ReturnType<typeof agentSummary>;
12
- type Details = { agent: Summary; backgrounded?: boolean; question?: unknown };
13
+ type Details = { agent: Summary; backgrounded?: boolean; question?: AskParams };
13
14
  type Args = { id: string; runId?: string };
14
15
  type StartArgs = { type?: string; name?: string; prompt: string; schedule?: string; background?: boolean };
15
16
  function agentFields(agent: Summary): ToolExpandedRow[] {
17
+ const usage = usageText(agent, '');
16
18
  return [
17
19
  { label: 'id', value: agent.id }, { label: 'runId', value: agent.runId },
18
20
  { label: 'state', value: agent.state, tone: stateLine(agent.state).tone },
@@ -22,10 +24,14 @@ function agentFields(agent: Summary): ToolExpandedRow[] {
22
24
  ...agent.taskId ? [{ label: 'taskId', value: agent.taskId }] : [],
23
25
  ...agent.taskGeneration ? [{ label: 'taskGeneration', value: agent.taskGeneration }] : [],
24
26
  ...agent.activity ? [{ label: 'activity', value: agent.activity }] : [],
25
- ...agent.usage ? [{ code: JSON.stringify(agent.usage, null, 2), language: 'json' as const, label: 'usage' }] : [],
27
+ ...usage !== undefined ? [{ label: 'usage', value: usage }] : [],
26
28
  ...agent.error ? [{ label: 'error', value: agent.error, tone: 'error' as const }] : [],
27
29
  ];
28
30
  }
31
+ function scheduleFields({ request, ...schedule }: ScheduledAgent): ToolExpandedRow[] {
32
+ return [...Object.entries(schedule), ...Object.entries(request).map(([key, value]) => [`request.${key}`, value] as const)]
33
+ .flatMap(([key, value]) => value === undefined ? [] : [{ label: key.toLowerCase(), value: String(value) }]);
34
+ }
29
35
  export const startRenderers = toolRenderers<StartArgs, Details | { schedule: ScheduledAgent }>({
30
36
  call: args => args.schedule
31
37
  ? { icon: '⏲', tone: 'accent', title: 'Agent schedule', summary: args.schedule }
@@ -39,7 +45,7 @@ export const startRenderers = toolRenderers<StartArgs, Details | { schedule: Sch
39
45
  expanded: data => 'agent' in data ? [...agentFields(data.agent),
40
46
  { label: 'promptSummary', value: data.agent.promptSummary },
41
47
  ...data.agent.resultSummary !== undefined ? [{ label: 'resultSummary', value: data.agent.resultSummary }] : []]
42
- : [{ code: JSON.stringify(data.schedule, null, 2), language: 'json', label: 'schedule' }],
48
+ : scheduleFields(data.schedule),
43
49
  });
44
50
  export const listRenderers = toolRenderers<{ agentId?: string; state?: string; scope?: string }, { agents: Summary[]; nextCursor?: string }>({
45
51
  call: args => ({ icon: '⟳', tone: 'accent', title: 'Agents', summary: args.agentId ? agentDisplayName(args.agentId) : undefined }),
@@ -54,10 +60,13 @@ export const getRenderers = toolRenderers<Args & { detail?: boolean }, Details &
54
60
  collapsed: data => ({ ...stateLine(data.question ? 'waiting(parent)' : data.agent.state), title: data.agent.name,
55
61
  meta: [{ text: data.question ? 'question pending' : data.agent.state, tone: stateLine(data.question ? 'waiting(parent)' : data.agent.state).tone! }] }),
56
62
  expanded: ({ agent, question, jobs, jobsUnavailable }, args) => [...agentFields(agent),
57
- ...question ? [{ code: JSON.stringify(question, null, 2), language: 'json' as const, label: 'question' }] : [],
63
+ ...question ? (question.questions ?? [question]).flatMap(item => [
64
+ ...item.question !== undefined ? [{ label: 'question', value: item.question }] : [],
65
+ ...item.options ? [{ label: 'options', value: item.options.map(option => typeof option === 'string' ? option : option.title).join(', ') }] : [],
66
+ ]) : [],
58
67
  ...args.detail ? [
59
68
  { label: 'modelSource', value: agent.modelSource }, { label: 'thinkingSource', value: agent.thinkingSource },
60
- ...agent.contextUsage ? [{ code: JSON.stringify(agent.contextUsage, null, 2), language: 'json' as const, label: 'contextUsage' }] : [],
69
+ ...agent.contextUsage ? [{ label: 'contextUsage', value: `${agent.contextUsage.tokens ?? 'unknown'}/${agent.contextUsage.contextWindow} tokens${agent.contextUsage.percent === null ? '' : ` · ${agent.contextUsage.percent.toFixed(1)}%`}` }] : [],
61
70
  ...agent.lastUpdateAt ? [{ label: 'lastUpdateAt', value: agent.lastUpdateAt }] : [],
62
71
  ] : [],
63
72
  ...jobsUnavailable ? [{ label: 'jobsUnavailable', value: jobsUnavailable, tone: 'warning' as const }] : [],
@@ -65,7 +74,8 @@ export const getRenderers = toolRenderers<Args & { detail?: boolean }, Details &
65
74
  });
66
75
  export const readRenderers = toolRenderers<Args & { stream?: string }, Details & ReadPage & { stream: string }>({
67
76
  call: args => ({ icon: '⟳', tone: 'accent', title: 'Agent read', summary: agentDisplayName(args.id, args.runId), meta: args.stream ? [args.stream] : [] }),
68
- collapsed: data => ({ icon: '', title: data.agent.name, summary: `read · ${data.stream} ${data.offset}–${data.nextOffset} / ${data.totalBytes} B` }),
77
+ collapsed: data => ({ icon: '', title: data.agent.name, summary: `read · ${data.stream} ${data.offset}–${data.nextOffset} / ${data.totalBytes} B`,
78
+ meta: data.firstLine !== undefined && data.lastLine !== undefined ? [`lines ${data.firstLine}–${data.lastLine}`] : [] }),
69
79
  expanded: data => [...readPageFields(data), data.text], // Transcript and log text are literal, never Markdown or inferred code.
70
80
  });
71
81
  export const sendRenderers = toolRenderers<Args, Details & { action: string }>({
@@ -81,5 +91,5 @@ export const stopRenderers = toolRenderers<Args, StopOutcome & { runId: string;
81
91
  ...data.affected.length > 1 ? [`+${data.affected.length - 1} affected`] : []] }),
82
92
  expanded: data => [{ label: 'runId', value: data.runId }, { label: 'requested', value: String(data.requested) },
83
93
  { label: 'cleanup', value: data.cleanup, tone: ['pending', 'unconfirmed'].includes(data.cleanup) ? 'warning' : 'dim' },
84
- { code: JSON.stringify(data.affected, null, 2), language: 'json', label: 'affected' }],
94
+ { label: 'affected', value: data.affected.map(item => `${item.id}: ${item.state}${item.cleanup ? ` (cleanup ${item.cleanup})` : ''}`).join('\n') }],
85
95
  });
@@ -14,7 +14,8 @@ const details = (job: ScheduledAgent): StructuredDetails => ({rows: [
14
14
  field('Next:', part(job.nextRun ?? '—', 'meta')),
15
15
  field('Last:', part(job.lastRun ?? '—', 'meta'), part(' ('), statePart(job.lastStatus ?? '—'), part(')')),
16
16
  field('Runs:', part(job.runCount, 'number')), field('Agent:', part(job.lastAgentId ?? '—', 'id')),
17
- ...(job.lastError !== undefined ? [null, [part(job.lastError, 'error')]] : []), section('Input'), job.request.prompt,
17
+ job.lastError !== undefined ? field('Error:', part(job.lastError, 'error')) : undefined, null,
18
+ section('Input'), job.request.prompt,
18
19
  ]});
19
20
 
20
21
  export async function showSchedules(ctx: ExtensionContext, scheduler: AgentScheduler, dock: Dock, page: BrowsePage): Promise<void> {
@@ -2,14 +2,14 @@ import type { ExtensionAPI, ToolDefinition } from '@earendil-works/pi-coding-age
2
2
  import { Type } from 'typebox';
3
3
  import type { SuiteConfig } from '../runtime/config.ts';
4
4
  import { ToolError } from '../runtime/errors.ts';
5
- import { readBounded, readContinuation, textSource } from '../runtime/read.ts';
5
+ import { pageNote, readBounded, readContinuation, textSource } from '../runtime/read.ts';
6
6
  import { sanitizeText } from '../runtime/text.ts';
7
7
  import { checkedArguments, LIST_LIMITS, listFields, objectId, paginate, readFields, registerBoundTool, rejectContextWithoutSearch, textResult as text } from '../runtime/tools.ts';
8
8
  import type { WaitRegistry } from '../runtime/wait.ts';
9
9
  import { childId, generationSchema } from '../tasks/types.ts';
10
10
  import { thinkingSchema } from './schema.ts';
11
11
  import { questionText } from './questions.ts';
12
- import { AgentsModule, agentSummary, summaryLine, usageText } from './index.ts';
12
+ import { AgentsModule, agentSummary, resultBody, summaryLine, usageText } from './index.ts';
13
13
  import { active, executing, recordWorkspace } from './types.ts';
14
14
  import { transcript, transcriptText } from './records.ts';
15
15
  import type { AgentScheduler } from './schedules/index.ts';
@@ -109,14 +109,15 @@ export function registerAgentTools(pi: ExtensionAPI, agents: AgentsModule, waits
109
109
  nextCursor ? `more: agent_list(${JSON.stringify({ ...params, cursor: nextCursor })})` : undefined], { agents: page.map(agentSummary), nextCursor });
110
110
  } }, 'initial');
111
111
  registerBoundTool(pi, { name: 'agent_get', ...getRenderers, label: 'Agent',
112
- description: 'Inspect the current run or a specific runId, including pending questions. Set detail:true for model sources, context, usage, and active jobs. Find run IDs with agent_list; read output with agent_read.',
112
+ description: 'Inspect the current run or a specific runId, including pending questions and, once it has ended, its result (up to 2 KiB; more with agent_read). Set detail:true for model sources, context, usage, and active jobs. Find run IDs with agent_list; read output with agent_read.',
113
113
  parameters: getSchema, prepareArguments: checkedArguments(getSchema, queryHint),
114
114
  async execute(_id, params, signal, _update, ctx) {
115
115
  const scope = agents.scope(ctx), { record, run } = await agents.manager.lookup(params.id, scope, config(), params.runId, signal);
116
116
  const lines = [summaryLine(record) + (!agents.manager.visible(record, scope) ? ' · read-only' : ''),
117
117
  `model: ${record.model} · thinking: ${record.thinking} · turns ${record.turns ?? 0} · tools ${record.toolUses ?? 0}${record.taskId ? ` · task ${record.taskId} @ ${record.taskGeneration ?? 'unavailable (assignment expired)'}` : ''}`,
118
118
  record.activity ? `activity: ${record.activity}` : undefined, record.error,
119
- run?.question ? questionText(run) : undefined];
119
+ run?.question ? questionText(run) : undefined,
120
+ ...!active(record.state) && record.result ? ['result (untrusted data):', ...resultBody(record)] : []];
120
121
  let created: JobSummary[] = [], jobsUnavailable: string | undefined;
121
122
  if (params.detail) {
122
123
  lines.push(`sources: model ${record.modelSource} · thinking ${record.thinkingSource}`, usageText(record),
@@ -134,7 +135,7 @@ export function registerAgentTools(pi: ExtensionAPI, agents: AgentsModule, waits
134
135
  waitingFor: run?.question ? 'parent' : undefined });
135
136
  } }, 'initial');
136
137
  registerBoundTool(pi, { name: 'agent_read', ...readRenderers, label: 'Read agent',
137
- description: 'Read output without resuming. stream defaults to transcript until the run ends, then result. Pass runId for an earlier run. Byte paging and regex search work like job_read.',
138
+ description: 'Read output without resuming. stream defaults to transcript until the run ends, then result. Pass runId for an earlier run. Line paging (line, lines; negative line counts from the end), byte offset and regex search work like job_read.',
138
139
  parameters: Type.Object({ id, runId: Type.Optional(runId), stream: Type.Optional(Type.Union([Type.Literal('result'), Type.Literal('transcript')])), ...readFields }, { additionalProperties: false }),
139
140
  async execute(_id, params, signal, _update, ctx) {
140
141
  rejectContextWithoutSearch(params);
@@ -142,7 +143,7 @@ export function registerAgentTools(pi: ExtensionAPI, agents: AgentsModule, waits
142
143
  const output = stream === 'transcript' ? transcriptText(transcript(record, run)) : [record.error, record.result].filter(Boolean).join('\n');
143
144
  const page = await readBounded(textSource(output), params, sanitizeText);
144
145
  if (!active(record.state)) agents.consume({ id: record.id, runId: record.runId, state: record.state, summary: summaryLine(record), settled: true });
145
- return text([`${summaryLine(record)} · ${stream} bytes ${page.offset}-${page.nextOffset} of ${page.totalBytes}`, page.text,
146
+ return text([`${summaryLine(record)} · ${stream} bytes ${page.offset}-${page.nextOffset} of ${page.totalBytes}${pageNote(page)}`, page.text,
146
147
  page.truncated ? `full: agent_read(${JSON.stringify({ id: record.id, runId: record.runId, stream, ...readContinuation(params, 0) })})` : undefined,
147
148
  page.endOfStream ? undefined : `more: agent_read(${JSON.stringify({ id: record.id, runId: record.runId, stream, ...readContinuation(params, page.nextOffset) })})`], { ...page, stream, agent: agentSummary(record) });
148
149
  } }, 'initial');
@@ -46,12 +46,11 @@ export async function showRuns(ctx: ExtensionContext, deps: SubagentsDeps, state
46
46
  return !agents.manager.visible(record, scope) && (!run || run.settled === true);
47
47
  };
48
48
  const status = (record: AgentRecord) => agents.manager.runs.get(record.runId)?.question ? 'waiting(parent)' : record.state;
49
- const suffix = (record: AgentRecord, count: number) => {
49
+ const suffix = (record: AgentRecord) => {
50
50
  const state = status(record), retry = retrySuffix(agents.manager.runs.get(record.runId));
51
51
  const head: DisplayField[] = [{text: state, state}, ...retry ? [{text: retry, tone: 'muted' as const}] : []];
52
- const runs: DisplayField[] = count > 1 ? [{text: ` · ${count} runs`, tone: 'muted'}] : [];
53
- const full: DisplayField[] = [...head, {text: ` · ${duration(record)}`, tone: 'muted'}, ...runs];
54
- return { full, compact: runs.length ? [[...head, ...runs], head] : [head] };
52
+ const full: DisplayField[] = [...head, {text: ` · ${duration(record)}`, tone: 'muted'}];
53
+ return { full, compact: [head] };
55
54
  };
56
55
  const name = (record: AgentRecord) => history ? record.runId : record.name;
57
56
  for (; !exit.closed;) {
@@ -69,8 +68,8 @@ export async function showRuns(ctx: ExtensionContext, deps: SubagentsDeps, state
69
68
  selected: () => state.filter, select: (value, done) => { changed = true; change(value as RunFilter, state.workspace, done); } }],
70
69
  subscribe: refresh => agents.manager.subscribe(refresh), ticking: () => [...displayed.values()].some(([record]) => active(record.state)),
71
70
  layout: { truncatePrimary: ({item, maxWidth, theme}) => {
72
- const runs = displayed.get(item.value)!, [record] = runs;
73
- const { full, compact } = suffix(record, runs.length);
71
+ const [record] = displayed.get(item.value)!;
72
+ const { full, compact } = suffix(record);
74
73
  return executionRow(sanitizeText(name(record)).replace(/[\r\n\t]/g, ' '), full, compact, maxWidth, theme);
75
74
  } },
76
75
  items: () => {
@@ -83,7 +82,7 @@ export async function showRuns(ctx: ExtensionContext, deps: SubagentsDeps, state
83
82
  .sort(([, [a]], [, [b]]) => compareActivity(a, b, record => active(record.state))));
84
83
  return Array.from(displayed, ([value, runs]) => {
85
84
  const [record] = runs;
86
- const display: DisplayField[] = [{text: name(record)}, {text: ' · ', tone: 'muted'}, ...suffix(record, runs.length).full];
85
+ const display: DisplayField[] = [{text: name(record)}, {text: ' · ', tone: 'muted'}, ...suffix(record).full];
87
86
  return { value, status: status(record), label: displayText(display), display,
88
87
  search: `${record.id} ${runs.map(run => run.runId).join(' ')} ${record.name} ${record.type} ${record.state} ${record.model} ${record.prompt}`,
89
88
  details: () => agentDetails(record, undefined, readonly(record)) };
@@ -9,7 +9,7 @@ import { resolveSettings } from '../models.ts';
9
9
  import { editTypeModel } from '../model-editor.ts';
10
10
  import { truncateToWidth, visibleWidth } from '@earendil-works/pi-tui';
11
11
  import { sanitizeText } from '../../runtime/text.ts';
12
- import { field, part, statePart, type DetailRow, type StructuredDetails } from '../../ui/structured-details.ts';
12
+ import { field, part, section, statePart, type DetailRow, type StructuredDetails } from '../../ui/structured-details.ts';
13
13
 
14
14
  export async function showAgentTypes(ctx: ExtensionContext, dock: Dock, config: () => SuiteConfig, reload: (cwd: string) => void, page: BrowsePage): Promise<void> {
15
15
  for (; !page.navigation?.closed;) {
@@ -22,12 +22,7 @@ export async function showAgentTypes(ctx: ExtensionContext, dock: Dock, config:
22
22
  // Inheritance is a runtime choice, not a type default; never preview the parent's live value as a pin.
23
23
  model = resolved.modelSource === 'inherited' ? 'not configured' : `${resolved.model.provider}/${resolved.model.id}`;
24
24
  thinking = resolved.thinkingSource === 'inherited' ? 'not configured' : clampThinkingLevel(resolved.model, resolved.thinking);
25
- settings = [
26
- field('Model:', model, part(` (${resolved.modelSource})`, 'meta'),
27
- part(resolved.modelSource === 'inherited' ? ' · inherit from parent at start' : '')),
28
- field('Thinking:', thinking, part(` (${resolved.thinkingSource})`, 'meta'),
29
- part(resolved.thinkingSource === 'inherited' ? ' · inherit from parent at start, adjusted to model capabilities' : '')),
30
- ];
25
+ settings = [field('Model:', `${model} · ${thinking}`)];
31
26
  } catch (error) {
32
27
  // Invalid model pins remain visible and editable; report the exact failure in details.
33
28
  settings = [field('Configuration error:', part(error instanceof Error ? error.message : String(error), 'error'))];
@@ -36,9 +31,8 @@ export async function showAgentTypes(ctx: ExtensionContext, dock: Dock, config:
36
31
  return { value: type.name, status: type.enabled === false ? 'disabled' : 'enabled', modelId: model.slice(model.indexOf('/') + 1), thinking, enabled: type.enabled !== false,
37
32
  label: `${type.name} · ${type.enabled === false ? 'disabled' : 'enabled'} · ${model} · ${thinking}`,
38
33
  search: `${type.name} ${type.description} ${model} ${thinking}`, details: (): StructuredDetails => ({rows: [
39
- [part(type.name, 'heading')], type.description,
40
- field('Enabled:', statePart(type.enabled !== false, type.enabled === false ? 'disabled' : 'enabled'),
41
- part(` (${current.agents.types[type.name]?.enabled === undefined ? 'definition' : 'configuration'})`, 'meta')), null,
34
+ [part(type.name, 'heading')],
35
+ field('Enabled:', statePart(type.enabled !== false, type.enabled === false ? 'disabled' : 'enabled')), null,
42
36
  ...settings, null, field('Definition:', part(type.sourcePath ?? 'built-in', 'meta')),
43
37
  field('Model settings:', part(locations.model, 'meta')), field('Thinking settings:', part(locations.thinking, 'meta')), null,
44
38
  field('Tools:', type.tools?.join(', ') ?? 'inherited'), field('Excluded tools:', type.excludeTools?.join(', ') ?? 'none'),
@@ -48,7 +42,7 @@ export async function showAgentTypes(ctx: ExtensionContext, dock: Dock, config:
48
42
  Isolated: type.isolated, Memory: type.memory, Extensions: type.extensions, 'Excluded extensions': type.excludeExtensions,
49
43
  Skills: type.skills, Color: type.color }).map(([label, value]) => value === undefined ? undefined
50
44
  : field(`${label}:`, part(Array.isArray(value) ? value.join(', ') : String(value), typeof value === 'number' ? 'number' : label === 'Session directory' ? 'meta' : undefined))),
51
- '', type.systemPrompt]}) };
45
+ null, section('Description'), type.description, section('System prompt'), type.systemPrompt]}) };
52
46
  });
53
47
  let action = 'model';
54
48
  const selected = await browse(ctx, dock, { title: 'Subagents', state: page.state, pages: page.pages, navigation: page.navigation, items: () => items,