@yandy0725/pi-subagents 0.11.6 → 1.0.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/README.md CHANGED
@@ -194,7 +194,7 @@ Settings set via `/subagents:settings` persist in `<cwd>/.pi/subagents.json` (pr
194
194
 
195
195
  ## Events
196
196
 
197
- Events emitted via `pi.events` for other extensions to consume:
197
+ Lifecycle events emitted via `pi.events` for other extensions to consume:
198
198
 
199
199
  | Event | When |
200
200
  |-------|------|
@@ -206,7 +206,6 @@ Events emitted via `pi.events` for other extensions to consume:
206
206
  | `subagents:compacted` | Agent session compacted |
207
207
  | `subagents:settings_loaded` | Persisted settings applied |
208
208
  | `subagents:settings_changed` | Settings mutation applied |
209
- | `notify:non-blocking-prompt` | Immediately before a TUI sessions/settings UI call that does not block the agent loop |
210
209
 
211
210
  ## Development
212
211
 
@@ -232,8 +231,6 @@ Both slash commands and the running-agents widget call host UI primitives direct
232
231
  | `select` (`/subagents:sessions`) | none | Forwarded; no timeout |
233
232
  | `custom` (transcript overlay) | none | RPC returns `undefined` immediately: picking a session shows nothing. Same in print / json |
234
233
 
235
- The sessions picker, read-only transcript overlay, and every settings menu/input are operator-driven and do not block the agent loop. In TUI, each of these UI calls is immediately preceded by a `notify:non-blocking-prompt` declaration. RPC/print/json do not declare: nested or overlapping dialogs have no separate outermost prompt start, so an undeclared default is safer than leaving an unmatched declaration.
236
-
237
234
  ## License
238
235
 
239
236
  MIT
package/README.zh.md CHANGED
@@ -186,7 +186,7 @@ timeout: 300
186
186
 
187
187
  ## 事件
188
188
 
189
- 通过 `pi.events` 发出的事件,供其他扩展消费:
189
+ 通过 `pi.events` 发出的生命周期事件,供其他扩展消费:
190
190
 
191
191
  | 事件 | 触发时机 |
192
192
  |------|----------|
@@ -198,7 +198,6 @@ timeout: 300
198
198
  | `subagents:compacted` | 代理会话已压缩 |
199
199
  | `subagents:settings_loaded` | 持久化设置已应用 |
200
200
  | `subagents:settings_changed` | 设置变更已生效 |
201
- | `notify:non-blocking-prompt` | 即将打开不阻塞 agent loop 的 TUI sessions/settings UI |
202
201
 
203
202
  ## 开发
204
203
 
@@ -224,8 +223,6 @@ npm test # vitest run
224
223
  | `select`(`/subagents:sessions`) | 无 | 会转发;没有超时 |
225
224
  | `custom`(会话记录浮层) | 无 | RPC 直接返回 `undefined`:选中一个会话后什么都不显示;print / json 同理 |
226
225
 
227
- 会话 picker、只读会话浮层以及每级 settings 菜单/输入都由操作员主动打开,不会阻塞 agent loop。TUI 中,每次调用这些 UI 前都会同步发出 `notify:non-blocking-prompt` 声明。RPC/print/json 不声明:嵌套或重叠对话框没有各自的最外层 start,保留未声明的默认行为比留下未配对声明更安全。
228
-
229
226
  ## 许可证
230
227
 
231
228
  MIT
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.11.6",
6
+ "version": "1.0.0",
7
7
  "description": "Focused, in-process sub-agent core for pi — autonomous agents plus a typed API and lifecycle events",
8
8
  "license": "MIT",
9
9
  "repository": {
package/src/index.ts CHANGED
@@ -15,7 +15,6 @@ import {
15
15
  createAgentSession,
16
16
  DefaultResourceLoader,
17
17
  type ExtensionAPI,
18
- type ExtensionCommandContext,
19
18
  getAgentDir,
20
19
  SettingsManager as SdkSettingsManager,
21
20
  SessionManager,
@@ -158,13 +157,6 @@ export default function (pi: ExtensionAPI) {
158
157
 
159
158
  pi.registerTool(new SteerTool(manager, pi.events).toToolDefinition());
160
159
 
161
- // TUI serializes operator prompts, so each declaration has an outermost start.
162
- // RPC clients can nest or overlap dialogs, while the host emits only the outermost
163
- // start; declaring there could leave a count that silences a later blocking prompt.
164
- const announceNonBlockingPrompt = (ctx: ExtensionCommandContext): void => {
165
- if (ctx.mode === "tui") pi.events.emit("notify:non-blocking-prompt", {});
166
- };
167
-
168
160
  // ---- /subagents:settings command ----
169
161
 
170
162
  const subagentsSettings = new SubagentsSettingsHandler(settings);
@@ -172,10 +164,7 @@ export default function (pi: ExtensionAPI) {
172
164
  pi.registerCommand("subagents:settings", {
173
165
  description: "Configure subagent settings (concurrency, turn limits, timeouts)",
174
166
  handler: async (_args, ctx) => {
175
- await subagentsSettings.handle({
176
- ui: ctx.ui,
177
- announceNonBlockingPrompt: () => announceNonBlockingPrompt(ctx),
178
- });
167
+ await subagentsSettings.handle({ ui: ctx.ui });
179
168
  },
180
169
  });
181
170
 
@@ -193,7 +182,6 @@ export default function (pi: ExtensionAPI) {
193
182
  registry,
194
183
  cwd: ctx.cwd,
195
184
  readFile: (path) => readFileSync(path, "utf8"),
196
- announceNonBlockingPrompt: () => announceNonBlockingPrompt(ctx),
197
185
  });
198
186
  },
199
187
  });
@@ -70,8 +70,6 @@ export interface SessionNavigatorParams {
70
70
  cwd: string;
71
71
  /** Reads a persisted session file for the file-snapshot source. */
72
72
  readFile: (path: string) => string;
73
- /** Declares operator-driven UI as non-blocking immediately before it opens. */
74
- announceNonBlockingPrompt: () => void;
75
73
  }
76
74
 
77
75
  /** Options for the read-only transcript overlay. */
@@ -98,22 +96,13 @@ export interface TranscriptOverlayOptions {
98
96
  * manager, so it stays a reactive consumer with no inbound call into the core.
99
97
  */
100
98
  export class SessionNavigatorHandler {
101
- async handle({
102
- ui,
103
- agents,
104
- evicted,
105
- registry,
106
- cwd,
107
- readFile,
108
- announceNonBlockingPrompt,
109
- }: SessionNavigatorParams): Promise<void> {
99
+ async handle({ ui, agents, evicted, registry, cwd, readFile }: SessionNavigatorParams): Promise<void> {
110
100
  const entries = listNavigableAgents(agents, evicted, registry);
111
101
  if (entries.length === 0) {
112
102
  ui.notify("No subagent sessions to view.", "info");
113
103
  return;
114
104
  }
115
105
 
116
- announceNonBlockingPrompt();
117
106
  const choice = await ui.select(
118
107
  "Subagent sessions",
119
108
  entries.map((entry) => entry.label),
@@ -139,7 +128,6 @@ export class SessionNavigatorHandler {
139
128
  return;
140
129
  }
141
130
  const markdownTheme = getMarkdownTheme();
142
- announceNonBlockingPrompt();
143
131
  await ui.custom<undefined>(
144
132
  (tui, theme, _keybindings, done) =>
145
133
  new TranscriptOverlay({
@@ -30,14 +30,7 @@ export interface SubagentsSettingsUI {
30
30
  export class SubagentsSettingsHandler {
31
31
  constructor(private readonly settings: SubagentsSettingsManager) {}
32
32
 
33
- async handle({
34
- ui,
35
- announceNonBlockingPrompt,
36
- }: {
37
- ui: SubagentsSettingsUI;
38
- announceNonBlockingPrompt: () => void;
39
- }): Promise<void> {
40
- announceNonBlockingPrompt();
33
+ async handle({ ui }: { ui: SubagentsSettingsUI }): Promise<void> {
41
34
  const choice = await ui.select("Settings", [
42
35
  `Max concurrency (current: ${this.settings.maxConcurrent})`,
43
36
  `Default max turns (current: ${this.settings.defaultMaxTurns ?? "unlimited"})`,
@@ -47,7 +40,6 @@ export class SubagentsSettingsHandler {
47
40
  if (!choice) return;
48
41
 
49
42
  if (choice.startsWith("Max concurrency")) {
50
- announceNonBlockingPrompt();
51
43
  const val = await ui.input("Max concurrent background agents", String(this.settings.maxConcurrent));
52
44
  if (val) {
53
45
  const n = parseInt(val, 10);
@@ -59,7 +51,6 @@ export class SubagentsSettingsHandler {
59
51
  }
60
52
  }
61
53
  } else if (choice.startsWith("Default max turns")) {
62
- announceNonBlockingPrompt();
63
54
  const val = await ui.input(
64
55
  "Default max turns before wrap-up (0 = unlimited)",
65
56
  String(this.settings.defaultMaxTurns ?? 0),
@@ -74,7 +65,6 @@ export class SubagentsSettingsHandler {
74
65
  }
75
66
  }
76
67
  } else if (choice.startsWith("Default timeout")) {
77
- announceNonBlockingPrompt();
78
68
  const val = await ui.input(
79
69
  "Default timeout in seconds (0 = unlimited)",
80
70
  String(this.settings.defaultTimeoutSeconds ?? 0),
@@ -89,7 +79,6 @@ export class SubagentsSettingsHandler {
89
79
  }
90
80
  }
91
81
  } else if (choice.startsWith("Grace turns")) {
92
- announceNonBlockingPrompt();
93
82
  const val = await ui.input("Grace turns after wrap-up steer", String(this.settings.graceTurns));
94
83
  if (val) {
95
84
  const n = parseInt(val, 10);