@oai404iao/pi-subagent 0.5.0 → 0.6.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
@@ -5,7 +5,7 @@ The design independently adapts the
5
5
  [DeepSeek Harness subagent seam](https://github.com/deepseek-ai/deepseek-harness/tree/4d03472cd098dc48a630e526ca620f4f37f18a0e/docs/subsystems)
6
6
  to Pi's extension and SDK APIs.
7
7
 
8
- Peer floor: Pi 0.86.1; tested against 0.86.1.
8
+ Peer floor: Pi 0.87.0; development target: 0.87.1.
9
9
 
10
10
  > npm identity: `@oai404iao/pi-subagent`. Once the selected version is
11
11
  > available on npm, install it from npm; use a local checkout before its
@@ -67,7 +67,10 @@ For a temporary test:
67
67
  pi -e /absolute/path/to/pi-extensions/pi-subagent
68
68
  ```
69
69
 
70
- Development and the supported compatibility floor are pinned to Pi `0.86.1`.
70
+ The supported compatibility floor is Pi `0.87.0`; development targets `0.87.1`.
71
+ Inherited context uses the parent's canonical projection, including omissions and
72
+ content replacements, before selecting completed turns. Parent system authority
73
+ is not inherited. Completion comes from finalized events, not context-array offsets.
71
74
 
72
75
  ## Model-facing tools
73
76
 
@@ -288,6 +291,8 @@ Frontmatter:
288
291
  | `thinking` | no | `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max`. |
289
292
 
290
293
  For continuable children, `report` is retained even when the agent has a tool allowlist.
294
+ One-shot children exclude `report` through Pi's native `excludeTools`, including
295
+ late registrations by inherited extensions, even when `tools` is omitted.
291
296
 
292
297
  ### Tool policy and inherited extensions
293
298
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oai404iao/pi-subagent",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Durable, continuable subagents for Pi with spawn/fork providers and lifecycle controls.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,20 +31,20 @@
31
31
  ]
32
32
  },
33
33
  "peerDependencies": {
34
- "@earendil-works/pi-agent-core": ">=0.86.1",
35
- "@earendil-works/pi-ai": ">=0.86.1",
36
- "@earendil-works/pi-coding-agent": ">=0.86.1",
37
- "@earendil-works/pi-tui": ">=0.86.1",
34
+ "@earendil-works/pi-agent-core": ">=0.87.0",
35
+ "@earendil-works/pi-ai": ">=0.87.0",
36
+ "@earendil-works/pi-coding-agent": ">=0.87.0",
37
+ "@earendil-works/pi-tui": ">=0.87.0",
38
38
  "typebox": "*"
39
39
  },
40
40
  "optionalDependencies": {
41
- "@oai404iao/pi-codex-minimal-tools": "3.0.0"
41
+ "@oai404iao/pi-codex-minimal-tools": "4.0.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@earendil-works/pi-agent-core": "0.86.1",
45
- "@earendil-works/pi-ai": "0.86.1",
46
- "@earendil-works/pi-coding-agent": "0.86.1",
47
- "@earendil-works/pi-tui": "0.86.1",
44
+ "@earendil-works/pi-agent-core": "0.87.1",
45
+ "@earendil-works/pi-ai": "0.87.1",
46
+ "@earendil-works/pi-coding-agent": "0.87.1",
47
+ "@earendil-works/pi-tui": "0.87.1",
48
48
  "@types/node": "^26.2.0",
49
49
  "tsx": "^4.20.6",
50
50
  "typebox": "^1.1.24",
@@ -88,5 +88,5 @@
88
88
  "optional": true
89
89
  }
90
90
  },
91
- "gitHead": "b02484cecad9081886797bf9b4438135aaae1e07"
91
+ "gitHead": "351c1943c7402b56f36abbe22fe45bb639bf5f81"
92
92
  }
@@ -226,7 +226,7 @@ interface Activation {
226
226
  parent: ParentRef;
227
227
  runtime: AgentSessionRuntime;
228
228
  seedMessageCount: number;
229
- epochMessageStart: number;
229
+ turnMessages: AgentSessionRuntime["session"]["messages"];
230
230
  controlState: AgentControlState;
231
231
  trace: TraceItem[];
232
232
  streamedText: string;
@@ -2097,6 +2097,7 @@ export class SubagentCoordinator {
2097
2097
  model,
2098
2098
  thinkingLevel: descriptor.thinkingLevel,
2099
2099
  customTools,
2100
+ excludeTools: deniedTools,
2100
2101
  ...(toolCeiling !== undefined ? { tools: toolCeiling } : {}),
2101
2102
  });
2102
2103
  return {
@@ -2187,7 +2188,7 @@ export class SubagentCoordinator {
2187
2188
  parent: options.parent,
2188
2189
  runtime,
2189
2190
  seedMessageCount: options.prepared.seedMessageCount,
2190
- epochMessageStart: runtime.session.messages.length,
2191
+ turnMessages: [],
2191
2192
  controlState: createAgentControlState(),
2192
2193
  trace: [],
2193
2194
  streamedText: "",
@@ -2543,7 +2544,7 @@ export class SubagentCoordinator {
2543
2544
  }
2544
2545
 
2545
2546
  private resetTurnCapture(activation: Activation): void {
2546
- activation.epochMessageStart = activation.runtime.session.messages.length;
2547
+ activation.turnMessages = [];
2547
2548
  activation.streamedText = "";
2548
2549
  activation.usage = emptyUsage();
2549
2550
  }
@@ -2553,9 +2554,8 @@ export class SubagentCoordinator {
2553
2554
  turnId: string,
2554
2555
  fallback: SubagentStopReason,
2555
2556
  ): SubagentRunResult {
2556
- const messages = activation.runtime.session.messages;
2557
- const output = finalAssistantText(messages, activation.epochMessageStart, activation.streamedText);
2558
- const stopReason = finalStopReason(messages, activation.epochMessageStart, fallback);
2557
+ const output = finalAssistantText(activation.turnMessages, 0, activation.streamedText);
2558
+ const stopReason = finalStopReason(activation.turnMessages, 0, fallback);
2559
2559
  const truncated = truncateUtf8(output, activation.descriptor.runtime.maxOutputBytes);
2560
2560
  const sessionFile = activation.runtime.session.sessionFile;
2561
2561
  return {
@@ -2634,6 +2634,7 @@ export class SubagentCoordinator {
2634
2634
  return;
2635
2635
  }
2636
2636
  if (event.message.role !== "assistant") return;
2637
+ activation.turnMessages.push(event.message);
2637
2638
  activation.persistenceGate.resolve();
2638
2639
  addUsage(activation.usage, event.message.usage);
2639
2640
  const text = event.message.content
package/src/providers.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { rm } from "node:fs/promises";
2
2
  import type { SessionEntry } from "@earendil-works/pi-coding-agent";
3
- import { SessionManager } from "@earendil-works/pi-coding-agent";
3
+ import { buildSessionProjection, SessionManager } from "@earendil-works/pi-coding-agent";
4
4
  import type {
5
5
  ContextInheritance,
6
6
  SubagentMode,
@@ -262,7 +262,15 @@ function forkedSession(
262
262
  ): PreparedChildSession {
263
263
  const parentFile = parent.sessionManager.getSessionFile();
264
264
  const inherited = completedContextEntries(
265
- parent.sessionManager.buildContextEntries(),
265
+ buildSessionProjection(parent.sessionManager.getBranch()).entries.flatMap(
266
+ ({ sourceEntry, messages }) => messages.map((message): SessionEntry => ({
267
+ type: "message",
268
+ id: sourceEntry.id,
269
+ parentId: sourceEntry.parentId,
270
+ timestamp: sourceEntry.timestamp,
271
+ message,
272
+ })),
273
+ ),
266
274
  context,
267
275
  );
268
276
  if (inherited.length === 0) return freshSession(parent);