@oai404iao/pi-subagent 0.5.1 → 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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oai404iao/pi-subagent",
3
- "version": "0.5.1",
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.1"
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": "c791e1192d0547834c3e2f2bae7853fb214f9808"
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;
@@ -2188,7 +2188,7 @@ export class SubagentCoordinator {
2188
2188
  parent: options.parent,
2189
2189
  runtime,
2190
2190
  seedMessageCount: options.prepared.seedMessageCount,
2191
- epochMessageStart: runtime.session.messages.length,
2191
+ turnMessages: [],
2192
2192
  controlState: createAgentControlState(),
2193
2193
  trace: [],
2194
2194
  streamedText: "",
@@ -2544,7 +2544,7 @@ export class SubagentCoordinator {
2544
2544
  }
2545
2545
 
2546
2546
  private resetTurnCapture(activation: Activation): void {
2547
- activation.epochMessageStart = activation.runtime.session.messages.length;
2547
+ activation.turnMessages = [];
2548
2548
  activation.streamedText = "";
2549
2549
  activation.usage = emptyUsage();
2550
2550
  }
@@ -2554,9 +2554,8 @@ export class SubagentCoordinator {
2554
2554
  turnId: string,
2555
2555
  fallback: SubagentStopReason,
2556
2556
  ): SubagentRunResult {
2557
- const messages = activation.runtime.session.messages;
2558
- const output = finalAssistantText(messages, activation.epochMessageStart, activation.streamedText);
2559
- const stopReason = finalStopReason(messages, activation.epochMessageStart, fallback);
2557
+ const output = finalAssistantText(activation.turnMessages, 0, activation.streamedText);
2558
+ const stopReason = finalStopReason(activation.turnMessages, 0, fallback);
2560
2559
  const truncated = truncateUtf8(output, activation.descriptor.runtime.maxOutputBytes);
2561
2560
  const sessionFile = activation.runtime.session.sessionFile;
2562
2561
  return {
@@ -2635,6 +2634,7 @@ export class SubagentCoordinator {
2635
2634
  return;
2636
2635
  }
2637
2636
  if (event.message.role !== "assistant") return;
2637
+ activation.turnMessages.push(event.message);
2638
2638
  activation.persistenceGate.resolve();
2639
2639
  addUsage(activation.usage, event.message.usage);
2640
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);