pi-subagent-manager 1.2.0 → 1.2.1
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 +4 -4
- package/agents/architect.md +1 -1
- package/agents/coder.md +1 -1
- package/agents/researcher.md +1 -1
- package/agents/reviewer.md +1 -1
- package/agents/tasker.md +1 -1
- package/agents/writer.md +1 -1
- package/docs/default-agents.md +24 -24
- package/package.json +10 -5
- package/src/index.ts +15 -4
- package/src/orch/checklist-integration.ts +33 -9
- package/src/orch/diagnostics.ts +3 -1
- package/src/orch/housekeeping.ts +1 -4
- package/src/orch/inherited-tools.ts +2 -2
- package/src/orch/manager.ts +8 -3
- package/src/orch/prompt.ts +3 -1
- package/src/orch/runtime.ts +28 -15
- package/src/prefs/config.ts +47 -149
- package/src/prefs/models.ts +2 -5
- package/src/prefs/settings.ts +121 -55
- package/src/ui/agent-navigation-editor.ts +20 -10
- package/src/ui/cost-footer.ts +5 -2
- package/src/ui/dialog.ts +44 -58
- package/src/ui/model-picker.ts +17 -5
- package/src/ui/settings-ui.ts +360 -216
- package/src/ui/status-ui.ts +14 -11
- package/src/ui/ui.ts +32 -24
package/README.md
CHANGED
|
@@ -40,11 +40,11 @@ The **Agents** widget above the input shows what's running. Open `/agents tree`,
|
|
|
40
40
|
|
|
41
41
|
| Agent | Use it for |
|
|
42
42
|
| ------------ | --------------------------------------- |
|
|
43
|
-
| `architect` | Plans, tradeoffs, coordinating helpers
|
|
43
|
+
| `architect` | Plans, tradeoffs, coordinating helpers |
|
|
44
44
|
| `coder` | Implementation and debugging |
|
|
45
|
-
| `researcher` | Codebase and web research
|
|
46
|
-
| `reviewer` | Finding correctness and security issues
|
|
47
|
-
| `tasker` | Small jobs and quick lookups
|
|
45
|
+
| `researcher` | Codebase and web research |
|
|
46
|
+
| `reviewer` | Finding correctness and security issues |
|
|
47
|
+
| `tasker` | Small jobs and quick lookups |
|
|
48
48
|
| `writer` | Drafting and editing prose |
|
|
49
49
|
|
|
50
50
|
They use your current model until you configure preferences. Open `/agents types` to change a role's model, tools, or instructions, or [add your own agent](docs/custom-agents.md).
|
package/agents/architect.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: architect
|
|
3
|
-
icon:
|
|
3
|
+
icon: ""
|
|
4
4
|
description: Design architecture, weigh tradeoffs, and decompose ambiguous work into verifiable plans. Ground external claims in dated primary evidence when retrieval is actually available. Coordinate specialists only when delegation or execution is explicitly authorized.
|
|
5
5
|
color: mdLink
|
|
6
6
|
thinkingLevel: high
|
package/agents/coder.md
CHANGED
package/agents/researcher.md
CHANGED
package/agents/reviewer.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: reviewer
|
|
3
|
-
icon:
|
|
3
|
+
icon: ""
|
|
4
4
|
description: Non-mutating review of scoped changes or existing code for demonstrable correctness and security defects, with severity, location, impact, and the smallest local repair or removal. Not for implementing fixes, style quotas, or speculative abstractions.
|
|
5
5
|
thinkingLevel: high
|
|
6
6
|
color: warning
|
package/agents/tasker.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: tasker
|
|
3
|
-
icon:
|
|
3
|
+
icon: ""
|
|
4
4
|
description: Complete short, bounded jobs with clear acceptance criteria, including diagnostics, extraction, mechanical edits, a few tool steps, or a targeted repository lookup. Not for ambiguous features, sustained implementation, or complex code understanding.
|
|
5
5
|
thinkingLevel: low
|
|
6
6
|
color: success
|
package/agents/writer.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: writer
|
|
3
|
-
icon:
|
|
3
|
+
icon: ""
|
|
4
4
|
description: Draft or revise original long-form prose for a stated audience and voice. Not for source changes, code review, or UI design, and not for inventing facts, citations, or testimonials.
|
|
5
5
|
thinkingLevel: medium
|
|
6
6
|
color: thinkingXhigh
|
package/docs/default-agents.md
CHANGED
|
@@ -6,14 +6,14 @@ The model shortlist was audited **October 4, 2026 local time (October 3 UTC)**.
|
|
|
6
6
|
|
|
7
7
|
## Role routing
|
|
8
8
|
|
|
9
|
-
| Role
|
|
10
|
-
|
|
|
11
|
-
| `architect`
|
|
12
|
-
| `coder`
|
|
13
|
-
| `researcher` | Source-backed local/remote codebase, library/API, and internet research; verification and synthesis. No implementation edits or delegation.
|
|
14
|
-
| `reviewer`
|
|
15
|
-
| `tasker`
|
|
16
|
-
| `writer`
|
|
9
|
+
| Role | Work and boundaries | Thinking |
|
|
10
|
+
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
|
|
11
|
+
| `architect` | Design, ambiguity, tradeoffs, verifiable plans, and explicitly authorized coordination. Not an implementation mandate or an unlimited research job. | `high` |
|
|
12
|
+
| `coder` | Iterative implementation, refactoring, debugging, and frontend UI through a checked patch. Not lookup-only work or independent review. | `high` |
|
|
13
|
+
| `researcher` | Source-backed local/remote codebase, library/API, and internet research; verification and synthesis. No implementation edits or delegation. | `high` |
|
|
14
|
+
| `reviewer` | Scoped, non-mutating correctness/security review with demonstrable defects and minimal local repair suggestions. No implementation or comment quota. | `high` |
|
|
15
|
+
| `tasker` | Short bounded diagnostics, extraction, mechanical changes, and targeted repository lookup. Escalate ambiguity or sustained implementation. | `low` |
|
|
16
|
+
| `writer` | Original or revised prose for a stated audience and voice, using supplied/local evidence. No invented facts or live evidence gathering. | `medium` |
|
|
17
17
|
|
|
18
18
|
Use tasker for one symbol or a few facts already in the repository; use researcher for tracing behavior across a codebase, versioned API evidence, outside sources, or contradictory claims. Researcher gathers what is true; architect decides what to build. Writer turns verified material into prose.
|
|
19
19
|
|
|
@@ -23,14 +23,14 @@ Existing user/project `researcher` overrides still win over the new packaged def
|
|
|
23
23
|
|
|
24
24
|
The optional **[labs] Nerd Font icons** [setting](settings.md#labs-nerd-font-icons-nerdfonticons) is off by default and requires a Nerd Font in your terminal. Each default has a distinct literal `icon` in its frontmatter:
|
|
25
25
|
|
|
26
|
-
| Role
|
|
27
|
-
|
|
|
28
|
-
| `architect`
|
|
29
|
-
| `coder`
|
|
30
|
-
| `researcher` | `nf-fa-search`
|
|
31
|
-
| `reviewer`
|
|
32
|
-
| `tasker`
|
|
33
|
-
| `writer`
|
|
26
|
+
| Role | Nerd Fonts identifier | Codepoint | Why this icon |
|
|
27
|
+
| ------------ | --------------------- | --------- | --------------------------------------------- |
|
|
28
|
+
| `architect` | `nf-md-floor_plan` | `U+F0821` | Structure, layout, and architecture planning. |
|
|
29
|
+
| `coder` | `nf-fa-code` | `U+F121` | Implementation and source code. |
|
|
30
|
+
| `researcher` | `nf-fa-search` | `U+F002` | Evidence gathering and investigation. |
|
|
31
|
+
| `reviewer` | `nf-cod-inspect` | `U+EBD1` | Inspecting code for concrete defects. |
|
|
32
|
+
| `tasker` | `nf-oct-checklist` | `U+F45E` | Bounded tasks and checklist-style execution. |
|
|
33
|
+
| `writer` | `nf-fa-pencil` | `U+F040` | Writing and editorial work. |
|
|
34
34
|
|
|
35
35
|
Names and codepoints were checked against the [official Nerd Fonts glyph mapping](https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/glyphnames.json); the [cheat sheet](https://www.nerdfonts.com/cheat-sheet) offers previews and character copying. These are role-based design choices, not font-detected fallbacks. User/project overrides may choose another icon or omit it entirely. See [custom icons](custom-agents.md#icons-labs).
|
|
36
36
|
|
|
@@ -40,14 +40,14 @@ Suggestions are chosen by task capability, quality, cost, and speed. API formats
|
|
|
40
40
|
|
|
41
41
|
Every `modelSuggestions` entry is a single plain model-name string suitable for fuzzy search—no parentheticals, tier labels, benchmark scores, or provider paths. Those belong in this guide and the audit. Suggestions are advisory: they **do not select a runtime model**. Defaults inherit the parent/default model until configured. Actual runtime preferences belong in `models` as eligible `provider/model-id` identities and are subject to scoped-model filtering.
|
|
42
42
|
|
|
43
|
-
| Role
|
|
44
|
-
|
|
|
45
|
-
| architect
|
|
46
|
-
| coder
|
|
47
|
-
| researcher | `gemini-4-argon`, `gpt-5.6-sol`, `muse-spark-1.3`, `sonnet-5.5`
|
|
48
|
-
| reviewer
|
|
49
|
-
| tasker
|
|
50
|
-
| writer
|
|
43
|
+
| Role | Suggested names, in order | Rationale |
|
|
44
|
+
| ---------- | ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
45
|
+
| architect | `opus-5.5`, `gpt-6-astra`, `fable-5.1`, `kimi-k3` | Heavyweight, quality-first reasoning for ambiguous architecture, difficult constraints, and consequential plans; Kimi is the user-selected long-context alternative. |
|
|
46
|
+
| coder | `sonnet-5.5`, `gpt-6.1-sol`, `muse-spark-1.3`, `mimo-v2.6-pro`, `glm-5.3`, `grok-4.7` | Reliable iterative tool use first, then quality/price and additional user-selected implementation alternatives. |
|
|
47
|
+
| researcher | `gemini-4-argon`, `gpt-5.6-sol`, `muse-spark-1.3`, `sonnet-5.5` | Compact calibration/research shortlist with a user-selected GPT-5.6 Sol alternative. Hallucination and accuracy scores are in the audit; GPT-6.1 Sol's scores must not be transferred to GPT-5.6 Sol. No matched research-citation tournament is claimed. |
|
|
48
|
+
| reviewer | `gpt-6.1-sol`, `sonnet-5.5`, `opus-5.5`, `glm-5.3` | Reasoning and code evidence, without treating premium Astra as necessary for every review. |
|
|
49
|
+
| tasker | `gpt-6-luna`, `deepseek-v4.1-flash`, `gemini-3.5-flash-lite`, `gemini-3.8-flash` | Cheap/fast first; stronger Flash only when reliability warrants it. Sonnet is no longer a routine bounded-task suggestion. |
|
|
50
|
+
| writer | `opus-5.5`, `gemini-4-argon`, `gemini-3.8-flash`, `fable-5.1`, `muse-spark-1.3` | Quality-sensitive editorial work, creative-writing Arena candidates, low-cost drafting, and a user-selected Muse alternative. |
|
|
51
51
|
|
|
52
52
|
These are choices, not an automatic fallback/escalation chain or a universal quality ranking. Gemini 4 Argon is included for its uncertainty calibration and creative-writing evidence despite gated access; preliminary results and source-specific pricing remain disclosed. Haiku 5.5 has no inspected post-release task measurements yet, so it is not added merely on announcement. Deep-research product results are not automatically results for their underlying base models.
|
|
53
53
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-subagent-manager",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Hierarchical, steerable subagent threads for pi",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"typebox": "*"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@earendil-works/pi-agent-core": "
|
|
62
|
-
"@earendil-works/pi-ai": "
|
|
63
|
-
"@earendil-works/pi-coding-agent": "0.
|
|
64
|
-
"@earendil-works/pi-tui": "
|
|
61
|
+
"@earendil-works/pi-agent-core": "1.0.4",
|
|
62
|
+
"@earendil-works/pi-ai": "1.0.4",
|
|
63
|
+
"@earendil-works/pi-coding-agent": "1.0.4",
|
|
64
|
+
"@earendil-works/pi-tui": "1.0.4",
|
|
65
65
|
"@types/node": "^22.0.0",
|
|
66
66
|
"@types/semver": "^7.8.0",
|
|
67
67
|
"@types/shell-quote": "^1.7.5",
|
|
@@ -70,5 +70,10 @@
|
|
|
70
70
|
"tsx": "^4.20.0",
|
|
71
71
|
"typebox": "1.3.27",
|
|
72
72
|
"typescript": "^5.9.0"
|
|
73
|
+
},
|
|
74
|
+
"overrides": {
|
|
75
|
+
"@earendil-works/pi-codemode": "1.0.4",
|
|
76
|
+
"brace-expansion": "5.0.12",
|
|
77
|
+
"undici": "8.12.2"
|
|
73
78
|
}
|
|
74
79
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
CAPABILITY_PROBE_CHANNEL,
|
|
3
|
+
respondDiagnosticCapability,
|
|
4
|
+
diagnosticAgentText,
|
|
5
|
+
} from "./orch/diagnostics.ts";
|
|
2
6
|
import { randomUUID } from "node:crypto";
|
|
3
7
|
import { buildSessionContext, getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
4
8
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
@@ -117,7 +121,8 @@ export default function piSubagent(pi: ExtensionAPI): void {
|
|
|
117
121
|
return loaded.diagnostics;
|
|
118
122
|
};
|
|
119
123
|
const checklistMirror = new ChecklistMetaMirror(() => getAgentDir());
|
|
120
|
-
const currentChecklistStatus = (ctx: ExtensionContext) =>
|
|
124
|
+
const currentChecklistStatus = (ctx: ExtensionContext) =>
|
|
125
|
+
checklistStatus(pi, checklistMirror, ctx);
|
|
121
126
|
let generation = 0;
|
|
122
127
|
let rootTurnEnded = false;
|
|
123
128
|
const hiddenWidgetThreads = new Set<string>();
|
|
@@ -367,7 +372,11 @@ export default function piSubagent(pi: ExtensionAPI): void {
|
|
|
367
372
|
// compacting, which does not necessarily produce an agent_settled event.
|
|
368
373
|
if (
|
|
369
374
|
!wakeRequested &&
|
|
370
|
-
!(
|
|
375
|
+
!(
|
|
376
|
+
limits.finalRecap &&
|
|
377
|
+
(manager?.outstandingAsync() ?? 0) === 0 &&
|
|
378
|
+
pendingSummaries(ctx).length > 0
|
|
379
|
+
) &&
|
|
371
380
|
!pendingRootNotifications(ctx).some((notification) => notification.trigger === true)
|
|
372
381
|
)
|
|
373
382
|
return;
|
|
@@ -588,7 +597,9 @@ export default function piSubagent(pi: ExtensionAPI): void {
|
|
|
588
597
|
// Re-verify on every turn: the Labs opt-in AND live checklist eligibility must both hold.
|
|
589
598
|
const prompt = subagentPrompt(
|
|
590
599
|
limits,
|
|
591
|
-
limits.checklistIntegration &&
|
|
600
|
+
limits.checklistIntegration &&
|
|
601
|
+
limits.subagentMode !== "off" &&
|
|
602
|
+
currentChecklistStatus(ctx).eligible,
|
|
592
603
|
);
|
|
593
604
|
if (!prompt) return;
|
|
594
605
|
if (
|
|
@@ -15,7 +15,11 @@ import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-a
|
|
|
15
15
|
|
|
16
16
|
export const CHECKLIST_PACKAGE = "pi-checklist";
|
|
17
17
|
export const CHECKLIST_MIN_MAJOR = 3;
|
|
18
|
-
export const CHECKLIST_TOOL_NAMES = [
|
|
18
|
+
export const CHECKLIST_TOOL_NAMES = [
|
|
19
|
+
"checklist_create",
|
|
20
|
+
"checklist_read",
|
|
21
|
+
"checklist_update",
|
|
22
|
+
] as const;
|
|
19
23
|
/** Session entry type pi-checklist appends for every snapshot (src/index.ts CUSTOM_TYPE). */
|
|
20
24
|
const CHECKLIST_ENTRY_TYPE = "pi-checklist";
|
|
21
25
|
const PREFS_FILE = "pi-checklist.json";
|
|
@@ -32,7 +36,10 @@ export interface ChecklistStatus {
|
|
|
32
36
|
/** Strict `x.y.z`: prereleases/build metadata fail closed. */
|
|
33
37
|
export function checklistVersionSupported(version: unknown): boolean {
|
|
34
38
|
if (typeof version !== "string") return false;
|
|
35
|
-
const match =
|
|
39
|
+
const match =
|
|
40
|
+
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.exec(
|
|
41
|
+
version.trim(),
|
|
42
|
+
);
|
|
36
43
|
return match !== null && Number(match[1]) >= CHECKLIST_MIN_MAJOR;
|
|
37
44
|
}
|
|
38
45
|
|
|
@@ -42,7 +49,9 @@ function owningPackage(file: string): { name?: unknown; version?: unknown } | un
|
|
|
42
49
|
const manifest = join(directory, "package.json");
|
|
43
50
|
if (existsSync(manifest)) {
|
|
44
51
|
const parsed: unknown = JSON.parse(readFileSync(manifest, "utf8"));
|
|
45
|
-
return typeof parsed === "object" && parsed !== null
|
|
52
|
+
return typeof parsed === "object" && parsed !== null
|
|
53
|
+
? (parsed as { name?: unknown; version?: unknown })
|
|
54
|
+
: undefined;
|
|
46
55
|
}
|
|
47
56
|
const parent = dirname(directory);
|
|
48
57
|
if (parent === directory) return undefined;
|
|
@@ -51,7 +60,9 @@ function owningPackage(file: string): { name?: unknown; version?: unknown } | un
|
|
|
51
60
|
}
|
|
52
61
|
|
|
53
62
|
/** Identity/version/reachability of the loaded checklist tools; metadata state is separate. */
|
|
54
|
-
export function detectChecklistPackage(
|
|
63
|
+
export function detectChecklistPackage(
|
|
64
|
+
pi: Pick<ExtensionAPI, "getAllTools" | "getActiveTools">,
|
|
65
|
+
): ChecklistStatus {
|
|
55
66
|
try {
|
|
56
67
|
const all = pi.getAllTools();
|
|
57
68
|
const active = new Set(pi.getActiveTools());
|
|
@@ -62,14 +73,20 @@ export function detectChecklistPackage(pi: Pick<ExtensionAPI, "getAllTools" | "g
|
|
|
62
73
|
return { eligible: false, reason: `pi-checklist tool ${name} is not loaded and active` };
|
|
63
74
|
const path = tool.sourceInfo?.path;
|
|
64
75
|
if (typeof path !== "string" || !isAbsolute(path))
|
|
65
|
-
return {
|
|
76
|
+
return {
|
|
77
|
+
eligible: false,
|
|
78
|
+
reason: `${name} does not come from a pi-checklist package file`,
|
|
79
|
+
};
|
|
66
80
|
sources.add(realpathSync(path));
|
|
67
81
|
}
|
|
68
82
|
if (sources.size !== 1)
|
|
69
83
|
return { eligible: false, reason: "checklist tools come from different extensions" };
|
|
70
84
|
const pkg = owningPackage([...sources][0]!);
|
|
71
85
|
if (pkg?.name !== CHECKLIST_PACKAGE)
|
|
72
|
-
return {
|
|
86
|
+
return {
|
|
87
|
+
eligible: false,
|
|
88
|
+
reason: "checklist tools are not provided by the pi-checklist package",
|
|
89
|
+
};
|
|
73
90
|
if (!checklistVersionSupported(pkg.version))
|
|
74
91
|
return {
|
|
75
92
|
eligible: false,
|
|
@@ -77,7 +94,10 @@ export function detectChecklistPackage(pi: Pick<ExtensionAPI, "getAllTools" | "g
|
|
|
77
94
|
};
|
|
78
95
|
return { eligible: true };
|
|
79
96
|
} catch (error) {
|
|
80
|
-
return {
|
|
97
|
+
return {
|
|
98
|
+
eligible: false,
|
|
99
|
+
reason: `could not verify pi-checklist: ${error instanceof Error ? error.message : String(error)}`,
|
|
100
|
+
};
|
|
81
101
|
}
|
|
82
102
|
}
|
|
83
103
|
|
|
@@ -98,7 +118,8 @@ function snapshotOf(value: unknown): { metaEnabled?: unknown } | undefined {
|
|
|
98
118
|
|
|
99
119
|
/** The snapshot an entry carries, using pi-checklist's loadFromBranch() rules. */
|
|
100
120
|
function entrySnapshot(entry: BranchEntry): { metaEnabled?: unknown } | undefined {
|
|
101
|
-
if (entry.type === "custom" && entry.customType === CHECKLIST_ENTRY_TYPE)
|
|
121
|
+
if (entry.type === "custom" && entry.customType === CHECKLIST_ENTRY_TYPE)
|
|
122
|
+
return snapshotOf(entry.data);
|
|
102
123
|
if (
|
|
103
124
|
entry.type === "message" &&
|
|
104
125
|
entry.message?.role === "toolResult" &&
|
|
@@ -188,7 +209,10 @@ export function checklistStatus(
|
|
|
188
209
|
const installed = detectChecklistPackage(pi);
|
|
189
210
|
if (!installed.eligible) return installed;
|
|
190
211
|
if (!mirror.metaEnabled(ctx))
|
|
191
|
-
return {
|
|
212
|
+
return {
|
|
213
|
+
eligible: false,
|
|
214
|
+
reason: "pi-checklist task meta is disabled; run /checklist settings meta",
|
|
215
|
+
};
|
|
192
216
|
return { eligible: true };
|
|
193
217
|
}
|
|
194
218
|
|
package/src/orch/diagnostics.ts
CHANGED
|
@@ -12,7 +12,9 @@ export function respondDiagnosticCapability(payload: unknown): void {
|
|
|
12
12
|
if (!payload || typeof payload !== "object") return;
|
|
13
13
|
const respond = (payload as { respond?: unknown }).respond;
|
|
14
14
|
if (typeof respond === "function") respond({ version: packageVersion, protocol: 1 });
|
|
15
|
-
} catch {
|
|
15
|
+
} catch {
|
|
16
|
+
/* Discovery callbacks must not escape into EventBus stderr. */
|
|
17
|
+
}
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
function clean(value: string, limit: number): string {
|
package/src/orch/housekeeping.ts
CHANGED
|
@@ -3,10 +3,7 @@ import { stripTerminalSequences } from "@earendil-works/pi-tui";
|
|
|
3
3
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
4
4
|
import type { ThreadActivity } from "../types.ts";
|
|
5
5
|
import { modelIdentity } from "../prefs/models.ts";
|
|
6
|
-
import {
|
|
7
|
-
captureHousekeepingUsageSession,
|
|
8
|
-
reportHousekeepingUsage,
|
|
9
|
-
} from "./housekeeping-usage.ts";
|
|
6
|
+
import { captureHousekeepingUsageSession, reportHousekeepingUsage } from "./housekeeping-usage.ts";
|
|
10
7
|
|
|
11
8
|
/**
|
|
12
9
|
* [labs] Housekeeping: a user-chosen model names each active agent's current work in one line.
|
|
@@ -63,14 +63,14 @@ export function createInheritedToolSource(pi: ExtensionAPI) {
|
|
|
63
63
|
// SDK orchestrators are instead recreated locally by runtime.
|
|
64
64
|
throw new Error(
|
|
65
65
|
`Cannot safely inherit model-only tool ${tool.name}: the SDK does not ` +
|
|
66
|
-
|
|
66
|
+
"provide a hook-preserving execution bridge. Run it in the main session.",
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
const bridge = rootContext ?? context;
|
|
70
70
|
if (!bridge) {
|
|
71
71
|
throw new Error(
|
|
72
72
|
"Inherited tool execution needs a main-session agent_* tool call first. " +
|
|
73
|
-
|
|
73
|
+
"Use agent_steer to resume this child instead of the thread dialog.",
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
const outcome = await bridge.executeTool(tool.name, args, { signal, onUpdate });
|
package/src/orch/manager.ts
CHANGED
|
@@ -734,7 +734,8 @@ export class ThreadManager {
|
|
|
734
734
|
this.disposed ||
|
|
735
735
|
this.records.get(record.view.path) !== record ||
|
|
736
736
|
(diagnosticDriver ? record.driver !== diagnosticDriver : signal.aborted)
|
|
737
|
-
)
|
|
737
|
+
)
|
|
738
|
+
return;
|
|
738
739
|
record.view.diagnostics = [
|
|
739
740
|
...(record.view.diagnostics ?? []),
|
|
740
741
|
event.diagnostic,
|
|
@@ -769,7 +770,10 @@ export class ThreadManager {
|
|
|
769
770
|
if (active(record.view) && !record.pauseRequested) {
|
|
770
771
|
record.view.status = event.text;
|
|
771
772
|
this.touch(record);
|
|
772
|
-
this.recordActivity(
|
|
773
|
+
this.recordActivity(
|
|
774
|
+
record,
|
|
775
|
+
event.detail ? `${event.text} ${event.detail}` : event.text,
|
|
776
|
+
);
|
|
773
777
|
}
|
|
774
778
|
},
|
|
775
779
|
...(parentSessionFile ? { parentSessionFile } : {}),
|
|
@@ -850,7 +854,8 @@ export class ThreadManager {
|
|
|
850
854
|
private recordActivity(record: Record, line: string): void {
|
|
851
855
|
const recent = (record.recentActivity ??= []);
|
|
852
856
|
recent.push(line.slice(0, 600));
|
|
853
|
-
if (recent.length > RECENT_ACTIVITY_LIMIT)
|
|
857
|
+
if (recent.length > RECENT_ACTIVITY_LIMIT)
|
|
858
|
+
recent.splice(0, recent.length - RECENT_ACTIVITY_LIMIT);
|
|
854
859
|
if (!this.options.onActivity || this.disposed) return;
|
|
855
860
|
try {
|
|
856
861
|
this.options.onActivity({
|
package/src/orch/prompt.ts
CHANGED
|
@@ -25,6 +25,8 @@ export function subagentPrompt(
|
|
|
25
25
|
'Use agent_status to inspect and agent_output for full results. Completion, failure or stop of a wait:false agent is delivered to you as a message event that starts a new turn when you are idle (with Final Recap on, once after all outstanding async agents have finished). Pass timeoutMs to agent_spawn to get a status event if a child runs long; the child is not killed. Valid range 30000–300000 ms; omit for no timeout. To extend a running background agent\'s reporting timer, before or after a timeout event, call agent_steer({path: "/root/task", timeoutMs: 120000}) with message omitted entirely. This resets the timer from now (replacing any pending timer), without sending input, interrupting or resuming the agent; it requires the agent to still be running. After re-arming, end your turn to remain available while it works. For other timeout responses, follow the waiting policy above, send steering input or stop the agent.',
|
|
26
26
|
"Use agent_steer to send input or resume retained sessions. Paused agents have no final answer; completed agents hand back results. Both retain their session.",
|
|
27
27
|
`Maximum depth: ${settings.maxLevels} levels including L1. Shared concurrency: ${settings.maxConcurrent} active threads; waiting parents count.`,
|
|
28
|
-
...(settings.checklistIntegration && checklistEligible
|
|
28
|
+
...(settings.checklistIntegration && checklistEligible
|
|
29
|
+
? [checklistGuidance(settings.subagentMode)]
|
|
30
|
+
: []),
|
|
29
31
|
].join("\n");
|
|
30
32
|
}
|
package/src/orch/runtime.ts
CHANGED
|
@@ -30,7 +30,11 @@ import { selectTools } from "../prefs/config.ts";
|
|
|
30
30
|
import { TranscriptChannel } from "./transcript.ts";
|
|
31
31
|
import { discoverSubagentExtensions, selectSubagentExtensions } from "./extensions.ts";
|
|
32
32
|
import type { InheritedToolSource } from "./inherited-tools.ts";
|
|
33
|
-
import type {
|
|
33
|
+
import type {
|
|
34
|
+
ModelSelectionMode,
|
|
35
|
+
SubagentExtensionSelection,
|
|
36
|
+
ToolFilteringMode,
|
|
37
|
+
} from "../prefs/settings.ts";
|
|
34
38
|
import {
|
|
35
39
|
modelIdentity,
|
|
36
40
|
getModelPreferences,
|
|
@@ -157,7 +161,16 @@ async function assertAcceptedSessionFile(
|
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
163
|
|
|
160
|
-
const SNIPPET_KEYS = [
|
|
164
|
+
const SNIPPET_KEYS = [
|
|
165
|
+
"command",
|
|
166
|
+
"path",
|
|
167
|
+
"file_path",
|
|
168
|
+
"filePath",
|
|
169
|
+
"pattern",
|
|
170
|
+
"query",
|
|
171
|
+
"url",
|
|
172
|
+
"description",
|
|
173
|
+
];
|
|
161
174
|
/** Short single-line argument hint for housekeeping summaries; never shown verbatim as status. */
|
|
162
175
|
export function toolArgumentSnippet(args: unknown): string | undefined {
|
|
163
176
|
if (args === null || args === undefined) return undefined;
|
|
@@ -175,7 +188,10 @@ export function toolArgumentSnippet(args: unknown): string | undefined {
|
|
|
175
188
|
}
|
|
176
189
|
}
|
|
177
190
|
}
|
|
178
|
-
const clean = text
|
|
191
|
+
const clean = text
|
|
192
|
+
?.replace(/[\x00-\x1f\x7f-\x9f]+/g, " ")
|
|
193
|
+
.replace(/\s+/g, " ")
|
|
194
|
+
.trim();
|
|
179
195
|
return clean ? clean.slice(0, 160) : undefined;
|
|
180
196
|
}
|
|
181
197
|
|
|
@@ -432,12 +448,14 @@ export function createDriverFactory(
|
|
|
432
448
|
(options.type.tools?.allow?.includes(name) && toolFiltering === "allowed"),
|
|
433
449
|
);
|
|
434
450
|
const projectTrusted = ctx.isProjectTrusted?.() ?? false;
|
|
435
|
-
const extensionPaths =
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
451
|
+
const extensionPaths =
|
|
452
|
+
extensionSelection === false ||
|
|
453
|
+
(Array.isArray(extensionSelection) && !extensionSelection.length)
|
|
454
|
+
? []
|
|
455
|
+
: selectSubagentExtensions(
|
|
456
|
+
await discoverSubagentExtensions({ cwd: ctx.cwd, agentDir, projectTrusted }),
|
|
457
|
+
extensionSelection,
|
|
458
|
+
);
|
|
441
459
|
const subagentExtensions = extensionPaths.length > 0;
|
|
442
460
|
// Keep discovery settings OUT of this loader: reload() resolves packages with
|
|
443
461
|
// auto-install enabled. An empty in-memory package/resource list ensures it
|
|
@@ -459,12 +477,7 @@ export function createDriverFactory(
|
|
|
459
477
|
if (subagentExtensions)
|
|
460
478
|
childEvents.on(DIAGNOSTIC_PROBE_CHANNEL, (payload) => {
|
|
461
479
|
try {
|
|
462
|
-
if (
|
|
463
|
-
diagnosticsUnavailable() ||
|
|
464
|
-
!payload ||
|
|
465
|
-
typeof payload !== "object"
|
|
466
|
-
)
|
|
467
|
-
return;
|
|
480
|
+
if (diagnosticsUnavailable() || !payload || typeof payload !== "object") return;
|
|
468
481
|
respondDiagnosticCapability(payload);
|
|
469
482
|
} catch {
|
|
470
483
|
/* Untrusted callbacks cannot escape into EventBus's stderr handler. */
|