@cad0p/pi-subagents-tintinweb 0.22.0-20261026.0 → 0.22.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 +3 -3
- package/docs/fork-differences.md +1 -1
- package/package.json +1 -1
- package/src/agent-runner.ts +3 -16
package/README.md
CHANGED
|
@@ -230,7 +230,7 @@ All fields are optional — sensible defaults for everything.
|
|
|
230
230
|
| `max_turns` | unlimited | Max agentic turns before graceful shutdown. `0` or omit for unlimited |
|
|
231
231
|
| `persist_session` | `false` | Keep this subagent's pi session file after it settles. Every run writes a session file while it runs (so a crashed run stays recoverable); without this flag the file is deleted when the agent record is removed — the 10-minute eviction or a session switch. The subagent's `.output` transcript is a separate knob, still written unless `output_transcript: false`. See [Session Persistence](#session-persistence) |
|
|
232
232
|
| `output_transcript` | `true` (or `subagents.json` `outputTranscript`) | Write this subagent's `.output` transcript; when set, overrides the `subagents.json` `outputTranscript` default. Set `false` to write no transcript file or path. Governs only the transcript — independent of `persist_session`, `isolation: worktree`, and `memory:` |
|
|
233
|
-
| `session_dir` |
|
|
233
|
+
| `session_dir` | pi default | Directory for this agent's pi session file (written during the run; retained after it only with `persist_session: true`). Omitted uses pi's normal session location, and relative paths resolve from the agent cwd |
|
|
234
234
|
| `prompt_mode` | `replace` | `replace`: body is the full system prompt (no AGENTS.md / CLAUDE.md inheritance). `append`: body appended to parent's prompt (agent acts as a "parent twin" — inherits parent's AGENTS.md / CLAUDE.md) |
|
|
235
235
|
| `inherit_context` | `false` | Fork parent conversation into agent |
|
|
236
236
|
| `isolated` | `false` | Hermetic specialist mode: forces `extensions: false` + `skills: false` + drops `ext:` selectors. Only built-in tools. Distinct from `isolation: worktree` (filesystem) |
|
|
@@ -380,7 +380,7 @@ Resumed runs (`resume`) are exempt: a resume starts immediately, occupies a pool
|
|
|
380
380
|
|
|
381
381
|
## Session Persistence
|
|
382
382
|
|
|
383
|
-
Every subagent run is written to a normal pi session file while it runs — default agents included — so a crashed, killed, or interrupted run leaves a transcript pi's `/resume` can recover. The child's session header records the parent session file as `parentSession`, so subagent sessions nest under the run that spawned them in pi's `/resume` picker.
|
|
383
|
+
Every subagent run is written to a normal pi session file while it runs — default agents included — so a crashed, killed, or interrupted run leaves a transcript pi's `/resume` can recover. The child's session header records the parent session file as `parentSession`, so subagent sessions nest under the run that spawned them in pi's `/resume` picker.
|
|
384
384
|
|
|
385
385
|
Retention is decided when the run settles, not when the session is created:
|
|
386
386
|
|
|
@@ -389,7 +389,7 @@ Retention is decided when the run settles, not when the session is created:
|
|
|
389
389
|
| `false` (default) | The session file is deleted when the agent record is removed: the 10-minute eviction after completion, `clearCompleted()` on session switch, or a clean shutdown once the run has settled. Until then the completed record can still `resume` the agent, which is why the file outlives the run itself. |
|
|
390
390
|
| `true` | The session file is kept indefinitely. |
|
|
391
391
|
|
|
392
|
-
Shutdown keeps an in-flight run's file — a run killed mid-flight is the case this exists for — and deletes a settled one's, because the manager's map is discarded and nothing would ever revisit it. `session_dir:` picks the directory the file is written to
|
|
392
|
+
Shutdown keeps an in-flight run's file — a run killed mid-flight is the case this exists for — and deletes a settled one's, because the manager's map is discarded and nothing would ever revisit it. `session_dir:` picks the directory the file is written to. On a host session with no file of its own (`--no-session`, or an SDK host using an in-memory session) subagent sessions are in-memory too and explicitly not recoverable. A resumed agent keeps the same session file and the same retention decision as its first run.
|
|
393
393
|
|
|
394
394
|
> **Migration — `persist_session` changed meaning.** It used to mean "persist this subagent at all" (without it, the run used an in-memory session and left nothing behind). It now means "retain this subagent's session file after it settles". An agent with `persist_session: false` — or no `persist_session` at all — now writes a session file *during* the run; that file is deleted when the agent record is removed, so completed runs still leave nothing behind unless pi crashes mid-run (which is the point). Agents with `persist_session: true` behave as before, plus the parent link.
|
|
395
395
|
|
package/docs/fork-differences.md
CHANGED
|
@@ -14,7 +14,7 @@ Each of these is a guarantee. A port that breaks one is a regression, not a reba
|
|
|
14
14
|
|
|
15
15
|
**`checkpoint`.** A separate tool a subagent calls at milestones to record a progress note — what it just did, what it is doing next — which the parent sees in the result report. It is not a resume marker: resume replays the session. Upstream has no equivalent.
|
|
16
16
|
|
|
17
|
-
**Session retention model.** Every run writes a pi session file *while it runs*, so a crashed or killed run stays recoverable; retention is decided when the agent record is removed, and `persist_session: true` means "keep this file after the run settles". Upstream persists by default behind `rememberAgents` and lets `persist_session: false` keep an agent in memory. There is no `rememberAgents` here: one behaviour to reason about instead of two settings that interact.
|
|
17
|
+
**Session retention model.** Every run writes a pi session file *while it runs*, so a crashed or killed run stays recoverable; retention is decided when the agent record is removed, and `persist_session: true` means "keep this file after the run settles". Upstream persists by default behind `rememberAgents` and lets `persist_session: false` keep an agent in memory. There is no `rememberAgents` here: one behaviour to reason about instead of two settings that interact.
|
|
18
18
|
|
|
19
19
|
**Parent-mirrored built-in activation.** Subagents load pi's built-in extensions (`codemode`, `tool-search`, `mcp`), but a `defaultActive: false` tool is declared in the child only when the parent session has it active or the agent names its extension with `ext:`. "As in the main session" means the main session's actual tool set, not everything that happens to be loaded.
|
|
20
20
|
|
package/package.json
CHANGED
package/src/agent-runner.ts
CHANGED
|
@@ -993,15 +993,8 @@ export async function runAgent(
|
|
|
993
993
|
!disallowed?.(name) &&
|
|
994
994
|
(toolNames.includes(name) || nestedToolNames.has(name) || scopedExtensionTools(loader.getExtensions()).has(name)));
|
|
995
995
|
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
// `worktree.parentCwd` is that cwd: agent-manager sets it to the same
|
|
999
|
-
// `baseCwd` it uses for the worktree copy. Without a worktree it is unset and
|
|
1000
|
-
// `effectiveCwd` is already the agent's cwd.
|
|
1001
|
-
const configuredSessionDir = resolveConfiguredSessionDir(
|
|
1002
|
-
agentConfig?.sessionDir,
|
|
1003
|
-
options.worktree?.parentCwd ?? effectiveCwd,
|
|
1004
|
-
);
|
|
996
|
+
const configuredSessionDir = resolveConfiguredSessionDir(agentConfig?.sessionDir, effectiveCwd);
|
|
997
|
+
const defaultSessionDir = process.env.PI_CODING_AGENT_SESSION_DIR ?? settingsManager.getSessionDir?.();
|
|
1005
998
|
// A subagent session is ALWAYS written to disk while it runs: a crashed or
|
|
1006
999
|
// killed run must leave a transcript pi's /resume can recover. Retention
|
|
1007
1000
|
// after the run settles is the manager's decision (`persist_session`), never a
|
|
@@ -1012,18 +1005,12 @@ export async function runAgent(
|
|
|
1012
1005
|
// absence of a session file is the exact signal — an argv scan would miss the
|
|
1013
1006
|
// SDK host and let an ephemeral session leave children on disk.
|
|
1014
1007
|
// The same path is `parentSession`, which nests the child under its spawner.
|
|
1015
|
-
//
|
|
1016
|
-
// Without `session_dir`, the file goes in the parent session's own directory.
|
|
1017
|
-
// pi already resolved `--session-dir`, `PI_CODING_AGENT_SESSION_DIR`, the
|
|
1018
|
-
// `sessionDir` setting or `--session <file>` when it opened the parent, so the
|
|
1019
|
-
// parent is asked rather than those sources being re-read here. A nested
|
|
1020
|
-
// agent's parent is its spawner, so its child follows the spawner's directory.
|
|
1021
1008
|
const parentSession = ctx.sessionManager.getSessionFile();
|
|
1022
1009
|
const sessionManager = parentSession === undefined
|
|
1023
1010
|
? SessionManager.inMemory(effectiveCwd)
|
|
1024
1011
|
: SessionManager.create(
|
|
1025
1012
|
effectiveCwd,
|
|
1026
|
-
configuredSessionDir ??
|
|
1013
|
+
configuredSessionDir ?? defaultSessionDir,
|
|
1027
1014
|
{ parentSession },
|
|
1028
1015
|
);
|
|
1029
1016
|
|