pi-subagent-in-memory 0.2.2 → 0.2.4
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 -2
- package/extensions/index.ts +16 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@ Spawns an in-process subagent session using pi's `createAgentSession` SDK. The s
|
|
|
22
22
|
| `title` | string | | Display title for the card widget |
|
|
23
23
|
| `provider` | string | | LLM provider (e.g. `anthropic`, `google`, `openai`) |
|
|
24
24
|
| `model` | string | | Model ID. Supports `provider/model` format (e.g. `openai/gpt-4o-mini`) |
|
|
25
|
+
| `thinkingLevel` | string | | Reasoning effort: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max`. Defaults to `off` |
|
|
25
26
|
| `cwd` | string | | Working directory for the subagent |
|
|
26
27
|
| `timeout` | number | | Timeout in seconds. Aborts the subagent if exceeded. Defaults to the configured default timeout (300s, see `/saim-timeout`) |
|
|
27
28
|
| `columnWidthPercent` | number | | Card width as % of terminal (33–100). Controls card grid layout |
|
|
@@ -143,8 +144,8 @@ Once installed, the LLM will discover the `subagent_create` tool from its schema
|
|
|
143
144
|
# Parallel subagents
|
|
144
145
|
"Run 2 subagents in parallel: one to summarize src/ and another to summarize tests/"
|
|
145
146
|
|
|
146
|
-
# Different models
|
|
147
|
-
"Use a subagent with openai/gpt-4o-mini to review the README"
|
|
147
|
+
# Different models and reasoning effort
|
|
148
|
+
"Use a subagent with openai/gpt-4o-mini and medium thinking to review the README"
|
|
148
149
|
|
|
149
150
|
# With timeout
|
|
150
151
|
"Spawn a subagent with a 60-second timeout to count lines of code"
|
package/extensions/index.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* /saim-clear-tui-overlay — clear all cards & close any overlay
|
|
20
20
|
* - Runtime limits (each also available as a CLI flag):
|
|
21
21
|
* /saim-max-depth [n] — max subagent nesting depth (default 2)
|
|
22
|
-
* /saim-timeout [seconds] — default subagent timeout (default
|
|
22
|
+
* /saim-timeout [seconds] — default subagent timeout (default 900s,
|
|
23
23
|
* 0 = unlimited)
|
|
24
24
|
* - Parent aborts/timeouts do NOT kill running children: the child detaches,
|
|
25
25
|
* keeps running under its own timeout, and still writes result.md /
|
|
@@ -153,7 +153,7 @@ let activeDetailDone: ((result: void) => void) | null = null;
|
|
|
153
153
|
// ── Runtime limits (commands & flags) ───────────────────────────
|
|
154
154
|
const DEFAULT_MAX_DEPTH = 2;
|
|
155
155
|
const MAX_DEPTH_HARD_LIMIT = 10;
|
|
156
|
-
const DEFAULT_TIMEOUT_SECS =
|
|
156
|
+
const DEFAULT_TIMEOUT_SECS = 900;
|
|
157
157
|
// Max nesting depth: 1 = only the main agent may spawn subagents,
|
|
158
158
|
// 2 = subagents may spawn one further level, etc. Prevents runaway forks.
|
|
159
159
|
let maxSubagentDepth = DEFAULT_MAX_DEPTH;
|
|
@@ -505,6 +505,13 @@ const SubagentParams = Type.Object({
|
|
|
505
505
|
model: Type.Optional(
|
|
506
506
|
Type.String({ description: "Model ID (e.g. 'claude-sonnet-4-5'). Defaults to the main agent's model." })
|
|
507
507
|
),
|
|
508
|
+
thinkingLevel: Type.Optional(
|
|
509
|
+
Type.Unsafe<"off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max">({
|
|
510
|
+
type: "string",
|
|
511
|
+
enum: ["off", "minimal", "low", "medium", "high", "xhigh", "max"],
|
|
512
|
+
description: "Reasoning effort for the subagent. Defaults to 'off'.",
|
|
513
|
+
})
|
|
514
|
+
),
|
|
508
515
|
cwd: Type.Optional(
|
|
509
516
|
Type.String({ description: "Working directory for the subagent. Defaults to the main agent's cwd." })
|
|
510
517
|
),
|
|
@@ -513,7 +520,7 @@ const SubagentParams = Type.Object({
|
|
|
513
520
|
description:
|
|
514
521
|
"Timeout in seconds for the subagent execution. If exceeded, the subagent is aborted " +
|
|
515
522
|
"(its own in-flight nested subagents keep running and still write their results). " +
|
|
516
|
-
"Defaults to the configured default timeout (
|
|
523
|
+
"Defaults to the configured default timeout (900s unless changed via --saim-timeout or /saim-timeout).",
|
|
517
524
|
minimum: 1,
|
|
518
525
|
})
|
|
519
526
|
),
|
|
@@ -573,15 +580,14 @@ async function executeSubagent(
|
|
|
573
580
|
|
|
574
581
|
// Create pi's normal cwd-bound services first. This loads packages from
|
|
575
582
|
// ~/.pi/agent/settings.json and <cwd>/.pi/settings.json, then applies any
|
|
576
|
-
// extension-provided registerProvider() calls to the model
|
|
583
|
+
// extension-provided registerProvider() calls to the model runtime. Resolving
|
|
577
584
|
// the requested model after this step is what makes package-provided models
|
|
578
585
|
// such as openai-codex/gpt-5.5 visible to subagents.
|
|
579
586
|
const services = await createAgentSessionServices({ cwd });
|
|
580
|
-
const resolvedModel = services.
|
|
587
|
+
const resolvedModel = services.modelRuntime.getModel(providerName, modelId);
|
|
581
588
|
if (!resolvedModel) {
|
|
582
|
-
const providerModels = services.
|
|
583
|
-
.
|
|
584
|
-
.filter((model) => model.provider === providerName)
|
|
589
|
+
const providerModels = services.modelRuntime
|
|
590
|
+
.getModels(providerName)
|
|
585
591
|
.map((model) => model.id)
|
|
586
592
|
.sort();
|
|
587
593
|
const diagnostics = services.diagnostics
|
|
@@ -603,7 +609,7 @@ async function executeSubagent(
|
|
|
603
609
|
services,
|
|
604
610
|
sessionManager: SessionManager.inMemory(),
|
|
605
611
|
model: resolvedModel,
|
|
606
|
-
thinkingLevel: "off",
|
|
612
|
+
thinkingLevel: params.thinkingLevel ?? "off",
|
|
607
613
|
// Keep subagent context/tool surface intentionally small: built-in coding
|
|
608
614
|
// tools plus nested subagent support. Package extensions are still loaded
|
|
609
615
|
// above so provider registrations are available, but their tools are not
|
|
@@ -625,6 +631,7 @@ async function executeSubagent(
|
|
|
625
631
|
cwd,
|
|
626
632
|
provider: providerName,
|
|
627
633
|
model: modelId,
|
|
634
|
+
thinkingLevel: params.thinkingLevel ?? "off",
|
|
628
635
|
task: params.task,
|
|
629
636
|
title: params.title,
|
|
630
637
|
depth,
|
package/package.json
CHANGED