oira666_pi-subagent 0.5.8 → 0.5.9
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 +1 -1
- package/docs/configuration.md +5 -3
- package/extension/execution.ts +6 -1
- package/extension/launch-tool.ts +6 -4
- package/extension/resume-tool.ts +16 -18
- package/extension/schemas.ts +9 -19
- package/names.ts +8 -1
- package/package.json +1 -1
- package/runner/arguments.ts +50 -14
- package/runner/options.ts +3 -1
- package/runner/parallel.ts +5 -1
- package/runner/single.ts +29 -6
- package/storage/name-records.ts +8 -5
- package/storage/names-registry.ts +3 -1
- package/storage/session-settings.ts +66 -0
- package/types/contracts.ts +2 -1
- package/types/details.ts +1 -0
- package/ui/detail-model.ts +2 -0
- package/ui/detail-transcript.ts +7 -2
- package/ui/pager-view.ts +5 -1
package/README.md
CHANGED
|
@@ -105,7 +105,7 @@ Collapsed results show each child's name, task, status, and most recent activity
|
|
|
105
105
|
|
|
106
106
|
`/subagent-expand <name>` opens a saved worker transcript. With no name, it opens a searchable picker. Name completion is fuzzy. Each task or resume shows its actual provider/model and thinking level from the worker's session, not the parent's settings. Selected presets also appear as an intelligence label, kept separately for each run. Missing historical model/thinking metadata appears as `unknown`.
|
|
107
107
|
|
|
108
|
-
[Model presets](docs/configuration.md#caller-selected-intelligence) show labels such as `Nicolas (Junior/code-writer)` in regular tool results. One enabled preset applies automatically to
|
|
108
|
+
[Model presets](docs/configuration.md#caller-selected-intelligence) show labels such as `Nicolas (Junior/code-writer)` in regular tool results. One enabled preset applies automatically to new launches without exposing an `intelligence` argument. Two or more require an explicit `intelligence` choice on every launch item. Omitted or `null` choices reject the whole launch batch before any worker starts. Zero or disabled presets keep the existing launch defaults and show no intelligence label. Named resumes do not accept `intelligence`; they retain the original effective model, thinking, and label, even after configuration or parent settings change.
|
|
109
109
|
|
|
110
110
|
| Key | Action |
|
|
111
111
|
| --- | --- |
|
package/docs/configuration.md
CHANGED
|
@@ -58,7 +58,7 @@ Missing descriptions retain their defaults. Overrides change written guidance, n
|
|
|
58
58
|
|
|
59
59
|
## Caller-selected intelligence
|
|
60
60
|
|
|
61
|
-
Define named model presets in `pi-subagent.json`. With two or more enabled presets, the calling model must choose a configured `intelligence` preset for every launch
|
|
61
|
+
Define named model presets in `pi-subagent.json`. With two or more enabled presets, the calling model must choose a configured `intelligence` preset for every launch item. With exactly one enabled preset, the launch tool hides the argument and automatically uses that preset. With no presets, the argument is absent and existing model/thinking defaults apply to launches. Named resumes never offer or accept an intelligence choice. No router or separate model-selection request is used.
|
|
62
62
|
|
|
63
63
|
```json
|
|
64
64
|
{
|
|
@@ -98,11 +98,13 @@ Use models available in your Pi installation. Names are arbitrary, unique, non-e
|
|
|
98
98
|
}
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
A selected or automatic preset overrides the parent model and agent model/thinking settings for a launch. The parent's explicit `--provider` and `--api-key` are not forwarded when a preset is selected. Named resumes use their saved provider and retain a CLI `--api-key` only when that provider matches the parent's explicit `--provider`; otherwise they drop the key. Worker providers use their configured Pi credentials. With multiple presets, omitted or `null` choices reject the entire launch batch before any worker starts or budget changes.
|
|
102
|
+
|
|
103
|
+
`resume_subagents` retains the original effective model, thinking level, and intelligence label. This also applies to private forks and after restart, preset changes, disabling intelligence, changing the parent model, or editing/deleting the agent definition. A worker launched without a preset remains unlabelled. Pass only `{ subagent, task }` and an optional `max_subagents_allowed`; any `intelligence` argument, including `null`, rejects the resume batch.
|
|
102
104
|
|
|
103
105
|
Tool result rows show the selected preset, for example `Nicolas (Junior/code-writer)`. Display names capitalize only the first character; configured spelling and argument values otherwise stay unchanged. Runs without a preset show `Nicolas (code-writer)`. Durable results retain their own preset name, and the name registry retains the initial choice. The `/subagent-expand` picker shows the initial preset beside each agent type and lets you search by preset name. Its transcript view shows each task's or resume's recorded intelligence alongside its actual transcript model and thinking level. Later resumes do not relabel earlier work. Missing model or thinking metadata remains `unknown`, even when a preset name is known.
|
|
104
106
|
|
|
105
|
-
`PI_SUBAGENT_INTELLIGENCE=true` enables presets when they exist, which is the default. Set it to `false` or `0` to treat the configuration as having no presets:
|
|
107
|
+
`PI_SUBAGENT_INTELLIGENCE=true` enables presets when they exist, which is the default. Set it to `false` or `0` to treat the configuration as having no presets for new launches: the launch tool hides the argument and no automatic preset applies. Named resumes still retain their original settings. Unknown choices or attempts to pass a named hidden argument fail before launching workers. When the argument is hidden, omission or `null` still uses the automatic sole preset or existing defaults.
|
|
106
108
|
|
|
107
109
|
Configuration follows the trust checks and file order above. A later `subagents-models` block replaces the entire earlier block. An empty list disables selection. Invalid blocks warn and disable selection rather than using a partial list. Nested workers load configuration using the same rules. Reload Pi after changing settings.
|
|
108
110
|
|
package/extension/execution.ts
CHANGED
|
@@ -119,7 +119,12 @@ export async function executeParallel(
|
|
|
119
119
|
resumeExistingSessions: boolean,
|
|
120
120
|
fallbackModel: string | undefined,
|
|
121
121
|
topLevelBaseId: number,
|
|
122
|
-
extras?: {
|
|
122
|
+
extras?: {
|
|
123
|
+
names?: Array<string | undefined>;
|
|
124
|
+
rawPrompts?: boolean;
|
|
125
|
+
budgets?: Array<SubagentBudget | undefined>;
|
|
126
|
+
resumeSettings?: Array<import("../storage/name-records.js").SubagentModelSettings>;
|
|
127
|
+
},
|
|
123
128
|
) {
|
|
124
129
|
const taskIds = new Map<number, number>();
|
|
125
130
|
try {
|
package/extension/launch-tool.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createIntelligenceSchemas, validatePreparedArguments } from "./schemas.js";
|
|
2
2
|
import { selectIntelligence } from "../intelligence.js";
|
|
3
|
+
import { resolveLaunchModelSettings } from "../runner/arguments.js";
|
|
3
4
|
import * as path from "node:path";
|
|
4
5
|
import { discoverAgents } from "../agents.js";
|
|
5
6
|
import {
|
|
@@ -218,10 +219,11 @@ export function registerSubagentsTool(state: ExtensionState) {
|
|
|
218
219
|
agent: task.agent,
|
|
219
220
|
task: task.task,
|
|
220
221
|
budget: budgets[index],
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
...resolveLaunchModelSettings(
|
|
223
|
+
agentConfig ?? {},
|
|
224
|
+
formatModelFlag(getParentModelForSubagent(state, ctx)),
|
|
225
|
+
preset,
|
|
226
|
+
),
|
|
225
227
|
tools: agentConfig?.tools,
|
|
226
228
|
sessionDir:
|
|
227
229
|
resumePlan?.details?.results[index]?.sessionDir ??
|
package/extension/resume-tool.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ResumeSubagentsParams, validatePreparedArguments } from "./schemas.js";
|
|
2
|
+
import { originalModelSettings } from "../storage/session-settings.js";
|
|
3
|
+
import type { SubagentModelSettings } from "../storage/name-records.js";
|
|
3
4
|
import * as fs from "node:fs";
|
|
4
5
|
import * as path from "node:path";
|
|
5
6
|
import { discoverAgents, isAgentEnabledAtLayer, type AgentConfig } from "../agents.js";
|
|
@@ -23,32 +24,28 @@ import {
|
|
|
23
24
|
import { updateLatestBroadcastTargets } from "./broadcast.js";
|
|
24
25
|
import { makeDetailsFactory } from "./details.js";
|
|
25
26
|
import { executeParallel } from "./execution.js";
|
|
26
|
-
import { formatModelFlag } from "./models.js";
|
|
27
27
|
import { resumableSubagentsDisabled } from "./policy.js";
|
|
28
28
|
import { trackProgress } from "./progress.js";
|
|
29
|
-
import { ensureBudget
|
|
30
|
-
import { normalizeResumes
|
|
29
|
+
import { ensureBudget } from "./runtime.js";
|
|
30
|
+
import { normalizeResumes } from "./schemas.js";
|
|
31
31
|
import type { ExtensionState } from "./state.js";
|
|
32
32
|
|
|
33
33
|
export function registerResumeSubagentsTool(state: ExtensionState) {
|
|
34
34
|
if (resumableSubagentsDisabled()) return;
|
|
35
|
-
const parameters =
|
|
35
|
+
const parameters = ResumeSubagentsParams;
|
|
36
36
|
state.pi.registerTool({
|
|
37
37
|
name: RESUME_SUBAGENTS_TOOL_NAME,
|
|
38
38
|
label: "Resume subagents",
|
|
39
39
|
description:
|
|
40
40
|
state.configuredToolPrompts[RESUME_SUBAGENTS_TOOL_NAME] ??
|
|
41
41
|
[
|
|
42
|
-
"Continue agents by their returned names, keeping their previous context.",
|
|
42
|
+
"Continue agents by their returned names, keeping their previous context and original model, thinking, and intelligence label. Resume does not accept an intelligence choice.",
|
|
43
43
|
"Optional max_subagents_allowed replaces the lifetime descendant cap, excluding the resumed agent. Past launches and assigned slots still count. Increases reserve extra slots from the original launcher; omitting it keeps the current allowance.",
|
|
44
44
|
"Pass { resumes: [{ subagent, task }] }. Resumes in one call run in parallel; wait between dependent tasks.",
|
|
45
45
|
].join("\n"),
|
|
46
46
|
parameters,
|
|
47
47
|
prepareArguments(args) {
|
|
48
|
-
return validatePreparedArguments(
|
|
49
|
-
parameters,
|
|
50
|
-
prepareIntelligenceArguments(prepareResumeArguments(args), "resumes"),
|
|
51
|
-
);
|
|
48
|
+
return validatePreparedArguments(parameters, prepareResumeArguments(args));
|
|
52
49
|
},
|
|
53
50
|
|
|
54
51
|
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
@@ -73,8 +70,6 @@ export function registerResumeSubagentsTool(state: ExtensionState) {
|
|
|
73
70
|
);
|
|
74
71
|
}
|
|
75
72
|
|
|
76
|
-
for (const resume of resumes) selectIntelligence(state.intelligencePresets, resume.intelligence);
|
|
77
|
-
|
|
78
73
|
const duplicates = resumes
|
|
79
74
|
.map((resume) => resume.name)
|
|
80
75
|
.filter((name, index, all) => all.indexOf(name) !== index);
|
|
@@ -124,7 +119,7 @@ export function registerResumeSubagentsTool(state: ExtensionState) {
|
|
|
124
119
|
tools?: string[];
|
|
125
120
|
budget: SubagentBudget;
|
|
126
121
|
max_subagents_allowed?: number;
|
|
127
|
-
|
|
122
|
+
settings: SubagentModelSettings;
|
|
128
123
|
}> = [];
|
|
129
124
|
const hasSessionFiles = (dir: string): boolean => {
|
|
130
125
|
try {
|
|
@@ -174,7 +169,7 @@ export function registerResumeSubagentsTool(state: ExtensionState) {
|
|
|
174
169
|
budget:
|
|
175
170
|
resolution.record.budget ?? createBudget(path.join(resolution.record.sessionDir, "legacy-budget"), 0),
|
|
176
171
|
max_subagents_allowed: resume.max_subagents_allowed,
|
|
177
|
-
|
|
172
|
+
settings: originalModelSettings(resolution.record),
|
|
178
173
|
});
|
|
179
174
|
}
|
|
180
175
|
if (errors.length > 0) {
|
|
@@ -213,7 +208,10 @@ export function registerResumeSubagentsTool(state: ExtensionState) {
|
|
|
213
208
|
overrideResumeBudgets(ensureBudget(state), overrides, state.currentDepth === 0 ? "main" : "subagent");
|
|
214
209
|
}
|
|
215
210
|
for (const target of targets) {
|
|
216
|
-
await updateNameRecord(state.currentNamesFile, target.name, {
|
|
211
|
+
await updateNameRecord(state.currentNamesFile, target.name, {
|
|
212
|
+
lastResumePrompt: target.task,
|
|
213
|
+
...target.settings,
|
|
214
|
+
});
|
|
217
215
|
}
|
|
218
216
|
|
|
219
217
|
// Resumed agents may reference agent types whose definition files no
|
|
@@ -237,7 +235,6 @@ export function registerResumeSubagentsTool(state: ExtensionState) {
|
|
|
237
235
|
const tasks = targets.map((target) => ({
|
|
238
236
|
agent: target.agent,
|
|
239
237
|
task: target.task,
|
|
240
|
-
intelligence: target.intelligence,
|
|
241
238
|
}));
|
|
242
239
|
const topLevelBaseId = state.nextActiveSubagentId;
|
|
243
240
|
state.nextActiveSubagentId += tasks.length;
|
|
@@ -254,12 +251,13 @@ export function registerResumeSubagentsTool(state: ExtensionState) {
|
|
|
254
251
|
undefined,
|
|
255
252
|
(index) => targets[index].sessionDir,
|
|
256
253
|
true,
|
|
257
|
-
|
|
254
|
+
undefined,
|
|
258
255
|
topLevelBaseId,
|
|
259
256
|
{
|
|
260
257
|
names: targets.map((target) => target.name),
|
|
261
258
|
budgets: targets.map((target) => target.budget),
|
|
262
259
|
rawPrompts: true,
|
|
260
|
+
resumeSettings: targets.map((target) => target.settings),
|
|
263
261
|
},
|
|
264
262
|
);
|
|
265
263
|
} finally {
|
package/extension/schemas.ts
CHANGED
|
@@ -77,26 +77,19 @@ export function createIntelligenceSchemas(presets: IntelligencePreset[] = []) {
|
|
|
77
77
|
{
|
|
78
78
|
enum: presets.map((preset) => preset.name),
|
|
79
79
|
description: [
|
|
80
|
-
"Required named model/provider/reasoning preset. Choose a configured preset for every launch
|
|
80
|
+
"Required named model/provider/reasoning preset. Choose a configured preset for every launch.",
|
|
81
|
+
"Use the cheapest capable preset; juniors suit simple repetitive work, pricier models suit complex tasks.",
|
|
81
82
|
...presets.map((preset) => `${preset.name}${preset.description ? `: ${preset.description}` : ""}`),
|
|
82
83
|
].join("\n"),
|
|
83
84
|
},
|
|
84
85
|
),
|
|
85
86
|
};
|
|
86
87
|
const task = Type.Object({ ...TaskItem.properties, ...intelligence }, { additionalProperties: false });
|
|
87
|
-
const resume = Type.Object({ ...ResumeItem.properties, ...intelligence }, { additionalProperties: false });
|
|
88
88
|
const subagents = Type.Object(
|
|
89
89
|
{ tasks: Type.Array(task, { minItems: 1, description: SubagentParams.properties.tasks.description }) },
|
|
90
90
|
{ additionalProperties: false },
|
|
91
91
|
);
|
|
92
|
-
const resumes =
|
|
93
|
-
{
|
|
94
|
-
resumes: Type.Union([Type.Array(resume, { minItems: 1 }), resume], {
|
|
95
|
-
description: ResumeSubagentsParams.properties.resumes.description,
|
|
96
|
-
}),
|
|
97
|
-
},
|
|
98
|
-
{ additionalProperties: false },
|
|
99
|
-
);
|
|
92
|
+
const resumes = ResumeSubagentsParams;
|
|
100
93
|
return presets.length >= 2 && intelligenceEnabled(presets)
|
|
101
94
|
? { subagents, resumes }
|
|
102
95
|
: {
|
|
@@ -105,18 +98,16 @@ export function createIntelligenceSchemas(presets: IntelligencePreset[] = []) {
|
|
|
105
98
|
};
|
|
106
99
|
}
|
|
107
100
|
|
|
108
|
-
export function normalizeResumes(
|
|
109
|
-
raw: unknown,
|
|
110
|
-
): Array<{ name: string; task: string; intelligence?: string; max_subagents_allowed?: number }> {
|
|
101
|
+
export function normalizeResumes(raw: unknown): Array<{ name: string; task: string; max_subagents_allowed?: number }> {
|
|
111
102
|
const items = Array.isArray(raw) ? raw : raw && typeof raw === "object" ? [raw] : [];
|
|
112
|
-
const normalized: Array<{ name: string; task: string;
|
|
103
|
+
const normalized: Array<{ name: string; task: string; max_subagents_allowed?: number }> = [];
|
|
113
104
|
for (const item of items) {
|
|
114
105
|
if (!isRecord(item)) continue;
|
|
115
106
|
const name =
|
|
116
107
|
typeof item.subagent === "string" ? item.subagent : typeof item.name === "string" ? item.name : undefined;
|
|
117
108
|
const task = typeof item.task === "string" ? item.task : typeof item.prompt === "string" ? item.prompt : undefined;
|
|
118
|
-
if (
|
|
119
|
-
throw new Error("Resume intelligence
|
|
109
|
+
if (Object.hasOwn(item, "intelligence")) {
|
|
110
|
+
throw new Error("Resume does not accept intelligence; it retains the original run settings.");
|
|
120
111
|
}
|
|
121
112
|
if (item.max_subagents_allowed !== undefined && !isBranchBudgetAmount(item.max_subagents_allowed)) {
|
|
122
113
|
throw new SubagentBudgetError(
|
|
@@ -127,16 +118,15 @@ export function normalizeResumes(
|
|
|
127
118
|
normalized.push({
|
|
128
119
|
name,
|
|
129
120
|
task,
|
|
130
|
-
...(item.intelligence !== undefined ? { intelligence: item.intelligence } : {}),
|
|
131
121
|
...(item.max_subagents_allowed !== undefined ? { max_subagents_allowed: item.max_subagents_allowed } : {}),
|
|
132
122
|
});
|
|
133
123
|
}
|
|
134
124
|
return normalized;
|
|
135
125
|
}
|
|
136
126
|
|
|
137
|
-
/** Normalize provider nulls to omission.
|
|
127
|
+
/** Normalize launch provider nulls to omission. Named resumes never accept intelligence. */
|
|
138
128
|
export function prepareIntelligenceArguments(args: unknown, key: "tasks" | "resumes"): unknown {
|
|
139
|
-
if (!isRecord(args) || !Object.hasOwn(args, key)) return args;
|
|
129
|
+
if (key === "resumes" || !isRecord(args) || !Object.hasOwn(args, key)) return args;
|
|
140
130
|
const omitNull = (item: unknown): unknown => {
|
|
141
131
|
if (!isRecord(item) || item.intelligence !== null) return item;
|
|
142
132
|
const { intelligence: _intelligence, ...rest } = item;
|
package/names.ts
CHANGED
|
@@ -22,6 +22,7 @@ export interface AllocateNameRequest {
|
|
|
22
22
|
task: string;
|
|
23
23
|
sessionDir: string;
|
|
24
24
|
model?: string;
|
|
25
|
+
thinking?: string;
|
|
25
26
|
intelligence?: string;
|
|
26
27
|
tools?: string[];
|
|
27
28
|
}
|
|
@@ -52,6 +53,7 @@ export async function allocateSubagentNames(
|
|
|
52
53
|
agent: request.agent,
|
|
53
54
|
task: request.task,
|
|
54
55
|
...(request.model !== undefined ? { model: request.model } : {}),
|
|
56
|
+
...(request.thinking !== undefined ? { thinking: request.thinking } : {}),
|
|
55
57
|
...(request.intelligence !== undefined ? { intelligence: request.intelligence } : {}),
|
|
56
58
|
...(request.budget !== undefined ? { budget: request.budget } : {}),
|
|
57
59
|
...(request.tools !== undefined ? { tools: request.tools } : {}),
|
|
@@ -70,7 +72,9 @@ export async function allocateSubagentNames(
|
|
|
70
72
|
export async function updateNameRecord(
|
|
71
73
|
file: string,
|
|
72
74
|
name: string,
|
|
73
|
-
patch: Partial<
|
|
75
|
+
patch: Partial<
|
|
76
|
+
Pick<SubagentNameRecord, "sessionDir" | "task" | "lastResumePrompt" | "model" | "thinking" | "intelligence">
|
|
77
|
+
>,
|
|
74
78
|
): Promise<void> {
|
|
75
79
|
await updateNamesRegistry(file, (registry) => {
|
|
76
80
|
const record = registry.agents[name];
|
|
@@ -78,6 +82,9 @@ export async function updateNameRecord(
|
|
|
78
82
|
if (patch.sessionDir !== undefined) record.sessionDir = patch.sessionDir;
|
|
79
83
|
if (patch.task !== undefined) record.task = patch.task;
|
|
80
84
|
if (patch.lastResumePrompt !== undefined) record.lastResumePrompt = patch.lastResumePrompt;
|
|
85
|
+
if (patch.model !== undefined) record.model = patch.model;
|
|
86
|
+
if (patch.thinking !== undefined) record.thinking = patch.thinking;
|
|
87
|
+
if (patch.intelligence !== undefined) record.intelligence = patch.intelligence;
|
|
81
88
|
});
|
|
82
89
|
}
|
|
83
90
|
|
package/package.json
CHANGED
package/runner/arguments.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import * as os from "node:os";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import type { AgentConfig } from "../agents.js";
|
|
5
|
+
import type { SubagentModelSettings } from "../storage/name-records.js";
|
|
5
6
|
import { SUBAGENT_FALLBACK_MODEL_ENV } from "./constants.js";
|
|
6
7
|
import { childExtensionArgs, excludedExtensions } from "./extension-policy.js";
|
|
7
8
|
function resolveExtensionArg(value: string): string {
|
|
@@ -19,6 +20,8 @@ interface InheritedCliArgs {
|
|
|
19
20
|
extensionArgs: string[];
|
|
20
21
|
/** All other non-blocked flags to forward verbatim to every child */
|
|
21
22
|
alwaysProxy: string[];
|
|
23
|
+
/** Explicit CLI provider associated with a forwarded --api-key. */
|
|
24
|
+
explicitProvider: string | undefined;
|
|
22
25
|
/** Parent --model value; used only when agent config doesn't specify model */
|
|
23
26
|
fallbackModel: string | undefined;
|
|
24
27
|
/** Parent --thinking value; used only when agent config doesn't specify thinking */
|
|
@@ -45,6 +48,7 @@ interface InheritedCliArgs {
|
|
|
45
48
|
function parseInheritedCliArgs(argv: string[]): InheritedCliArgs {
|
|
46
49
|
const extensionArgs: string[] = [];
|
|
47
50
|
const alwaysProxy: string[] = [];
|
|
51
|
+
let explicitProvider: string | undefined;
|
|
48
52
|
let fallbackModel: string | undefined;
|
|
49
53
|
let fallbackThinking: string | undefined;
|
|
50
54
|
let fallbackTools: string | undefined;
|
|
@@ -144,7 +148,10 @@ function parseInheritedCliArgs(argv: string[]): InheritedCliArgs {
|
|
|
144
148
|
)
|
|
145
149
|
) {
|
|
146
150
|
const [value, skip] = getVal();
|
|
147
|
-
if (value !== undefined)
|
|
151
|
+
if (value !== undefined) {
|
|
152
|
+
alwaysProxy.push(flagName, value);
|
|
153
|
+
if (flagName === "--provider") explicitProvider = value;
|
|
154
|
+
}
|
|
148
155
|
i += skip;
|
|
149
156
|
continue;
|
|
150
157
|
}
|
|
@@ -197,7 +204,15 @@ function parseInheritedCliArgs(argv: string[]): InheritedCliArgs {
|
|
|
197
204
|
i++;
|
|
198
205
|
}
|
|
199
206
|
|
|
200
|
-
return {
|
|
207
|
+
return {
|
|
208
|
+
extensionArgs,
|
|
209
|
+
alwaysProxy,
|
|
210
|
+
explicitProvider,
|
|
211
|
+
fallbackModel,
|
|
212
|
+
fallbackThinking,
|
|
213
|
+
fallbackTools,
|
|
214
|
+
fallbackNoTools,
|
|
215
|
+
};
|
|
201
216
|
}
|
|
202
217
|
|
|
203
218
|
/** Cached once — process.argv is immutable at runtime */
|
|
@@ -217,6 +232,18 @@ export function resolveSubagentModel(agentModel?: string, currentParentModel?: s
|
|
|
217
232
|
);
|
|
218
233
|
}
|
|
219
234
|
|
|
235
|
+
export function resolveLaunchModelSettings(
|
|
236
|
+
agent: Pick<AgentConfig, "model" | "thinking">,
|
|
237
|
+
fallbackModel?: string,
|
|
238
|
+
selection?: { name: string; provider: string; model: string; thinking: string },
|
|
239
|
+
): SubagentModelSettings {
|
|
240
|
+
return {
|
|
241
|
+
model: selection ? `${selection.provider}/${selection.model}` : resolveSubagentModel(agent.model, fallbackModel),
|
|
242
|
+
thinking: selection?.thinking ?? agent.thinking ?? _inheritedCliArgs.fallbackThinking,
|
|
243
|
+
intelligence: selection?.name,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
220
247
|
export function buildPiArgs(
|
|
221
248
|
agent: AgentConfig,
|
|
222
249
|
systemPromptPath: string | null,
|
|
@@ -227,14 +254,18 @@ export function buildPiArgs(
|
|
|
227
254
|
rawPrompt = false,
|
|
228
255
|
selection?: { provider: string; model: string; thinking: string },
|
|
229
256
|
extensionArgsOverride?: string[],
|
|
257
|
+
resumeSettings?: SubagentModelSettings,
|
|
230
258
|
): { args: string[]; prompt: string } {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
259
|
+
const provider = resumeSettings?.model?.includes("/") ? resumeSettings.model.split("/", 1)[0] : selection?.provider;
|
|
260
|
+
// Named resumes can reuse CLI-only auth, but only for the explicitly matching provider.
|
|
261
|
+
const keepResumeApiKey = !!resumeSettings && !!provider && provider === _inheritedCliArgs.explicitProvider;
|
|
262
|
+
const blocked = keepResumeApiKey ? ["--provider"] : ["--provider", "--api-key"];
|
|
263
|
+
const proxyArgs =
|
|
264
|
+
selection || resumeSettings
|
|
265
|
+
? _inheritedCliArgs.alwaysProxy.filter(
|
|
266
|
+
(arg, index, args) => !blocked.includes(arg) && !blocked.includes(args[index - 1]),
|
|
267
|
+
)
|
|
268
|
+
: _inheritedCliArgs.alwaysProxy;
|
|
238
269
|
const args: string[] = [
|
|
239
270
|
"--mode",
|
|
240
271
|
"rpc",
|
|
@@ -248,12 +279,17 @@ export function buildPiArgs(
|
|
|
248
279
|
if (sessionDir) args.push("--session-dir", sessionDir);
|
|
249
280
|
if (resumeSession) args.push("--continue");
|
|
250
281
|
|
|
251
|
-
//
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
282
|
+
// Named resumes bypass today's parent, agent definition, CLI defaults, and presets.
|
|
283
|
+
// Missing legacy settings are left to --continue rather than replaced with current defaults.
|
|
284
|
+
const model = resumeSettings
|
|
285
|
+
? resumeSettings.model
|
|
286
|
+
: (selection?.model ?? resolveSubagentModel(agent.model, fallbackModelOverride));
|
|
287
|
+
if (provider) args.push("--provider", provider);
|
|
288
|
+
if (model) args.push("--model", resumeSettings && provider ? model.slice(provider.length + 1) : model);
|
|
255
289
|
|
|
256
|
-
const thinking =
|
|
290
|
+
const thinking = resumeSettings
|
|
291
|
+
? resumeSettings.thinking
|
|
292
|
+
: (selection?.thinking ?? agent.thinking ?? _inheritedCliArgs.fallbackThinking);
|
|
257
293
|
if (thinking) args.push("--thinking", thinking);
|
|
258
294
|
|
|
259
295
|
// agent.tools is set only when the agent file specifies tools (length > 0)
|
package/runner/options.ts
CHANGED
|
@@ -62,7 +62,9 @@ export interface RunAgentOptions {
|
|
|
62
62
|
initialResult?: SingleResult;
|
|
63
63
|
/** Fallback model to use when the agent config does not pin one. */
|
|
64
64
|
fallbackModel?: string;
|
|
65
|
-
/**
|
|
65
|
+
/** Original settings for a named resume. Even an empty object bypasses current presets/defaults. */
|
|
66
|
+
resumeSettings?: import("../storage/name-records.js").SubagentModelSettings;
|
|
67
|
+
/** Caller-selected preset for a launch. Omission keeps existing defaults. */
|
|
66
68
|
intelligence?: string;
|
|
67
69
|
/** Valid presets loaded from trusted configuration. */
|
|
68
70
|
intelligencePresets?: IntelligencePreset[];
|
package/runner/parallel.ts
CHANGED
|
@@ -41,6 +41,7 @@ export async function executeParallelSubprocess(
|
|
|
41
41
|
namesFile?: string;
|
|
42
42
|
budgets?: Array<SubagentBudget | undefined>;
|
|
43
43
|
intelligencePresets?: RunAgentOptions["intelligencePresets"];
|
|
44
|
+
resumeSettings?: Array<NonNullable<RunAgentOptions["resumeSettings"]>>;
|
|
44
45
|
projectTrusted?: boolean;
|
|
45
46
|
},
|
|
46
47
|
): Promise<{
|
|
@@ -69,7 +70,9 @@ export async function executeParallelSubprocess(
|
|
|
69
70
|
if (previous && isResultSuccess(previous)) return previous;
|
|
70
71
|
let intelligence: string | undefined;
|
|
71
72
|
try {
|
|
72
|
-
intelligence =
|
|
73
|
+
intelligence = extras?.resumeSettings
|
|
74
|
+
? extras.resumeSettings[index].intelligence
|
|
75
|
+
: selectIntelligence(extras?.intelligencePresets, t.intelligence)?.name;
|
|
73
76
|
} catch {
|
|
74
77
|
// Let the single runner report invalid selections as aligned task failures.
|
|
75
78
|
}
|
|
@@ -155,6 +158,7 @@ export async function executeParallelSubprocess(
|
|
|
155
158
|
fallbackModel,
|
|
156
159
|
intelligence: t.intelligence,
|
|
157
160
|
intelligencePresets: extras?.intelligencePresets,
|
|
161
|
+
resumeSettings: extras?.resumeSettings?.[index],
|
|
158
162
|
onHandle: (handle) => onHandleForTask?.(index, t, handle),
|
|
159
163
|
onUpdate: (partial) => {
|
|
160
164
|
if (partial.details?.results[0]) {
|
package/runner/single.ts
CHANGED
|
@@ -7,7 +7,9 @@ import {
|
|
|
7
7
|
STARTUP_RETRY_BASE_BACKOFF_MS,
|
|
8
8
|
} from "./constants.js";
|
|
9
9
|
import type { RunAgentOptions } from "./options.js";
|
|
10
|
-
import { buildPiArgs, resolveChildExtensionArgs } from "./arguments.js";
|
|
10
|
+
import { buildPiArgs, resolveChildExtensionArgs, resolveLaunchModelSettings } from "./arguments.js";
|
|
11
|
+
import { readOriginalSessionSettings } from "../storage/session-settings.js";
|
|
12
|
+
import { updateNameRecord } from "../names.js";
|
|
11
13
|
import { writePromptToTempFile, cleanupTempDir, sessionDirExists } from "./files.js";
|
|
12
14
|
import { appendBoundedStderr, priorDescendantUsage, endedWithSyntheticResumeFailure } from "./result.js";
|
|
13
15
|
import { runAttempt } from "./attempt.js";
|
|
@@ -65,7 +67,9 @@ export async function runAgentSubprocess(opts: RunAgentOptions): Promise<SingleR
|
|
|
65
67
|
stderr: initialResult?.stderr ?? "",
|
|
66
68
|
usage: initialResult?.usage ? { ...initialResult.usage } : emptyUsage(),
|
|
67
69
|
toolCalls: initialResult?.toolCalls ? { ...initialResult.toolCalls } : {},
|
|
68
|
-
model: initialResult?.model ?? agent.model,
|
|
70
|
+
model: opts.resumeSettings?.model ?? initialResult?.model ?? agent.model,
|
|
71
|
+
thinking: opts.resumeSettings?.thinking,
|
|
72
|
+
intelligence: opts.resumeSettings?.intelligence,
|
|
69
73
|
completedTurns: initialResult?.completedTurns ?? 0,
|
|
70
74
|
turnInProgress: false,
|
|
71
75
|
liveToolExecutions: initialResult?.liveToolExecutions,
|
|
@@ -118,9 +122,11 @@ export async function runAgentSubprocess(opts: RunAgentOptions): Promise<SingleR
|
|
|
118
122
|
emitUpdate();
|
|
119
123
|
return result;
|
|
120
124
|
}
|
|
121
|
-
const selection = selectIntelligence(opts.intelligencePresets, opts.intelligence);
|
|
122
|
-
|
|
123
|
-
|
|
125
|
+
const selection = opts.resumeSettings ? undefined : selectIntelligence(opts.intelligencePresets, opts.intelligence);
|
|
126
|
+
const settings = opts.resumeSettings ?? resolveLaunchModelSettings(agent, fallbackModel, selection);
|
|
127
|
+
result.intelligence = settings.intelligence;
|
|
128
|
+
result.model = settings.model;
|
|
129
|
+
result.thinking = settings.thinking;
|
|
124
130
|
emitUpdate();
|
|
125
131
|
const { args: piArgs, prompt: taskPrompt } = buildPiArgs(
|
|
126
132
|
agent,
|
|
@@ -132,6 +138,7 @@ export async function runAgentSubprocess(opts: RunAgentOptions): Promise<SingleR
|
|
|
132
138
|
opts.rawPrompt === true,
|
|
133
139
|
selection,
|
|
134
140
|
extensionArgs,
|
|
141
|
+
opts.resumeSettings,
|
|
135
142
|
);
|
|
136
143
|
const prompt =
|
|
137
144
|
result.budget && readBudget(result.budget).limit > 0
|
|
@@ -144,7 +151,14 @@ export async function runAgentSubprocess(opts: RunAgentOptions): Promise<SingleR
|
|
|
144
151
|
|
|
145
152
|
for (let attempt = 0; ; attempt++) {
|
|
146
153
|
startupTimedOut = false;
|
|
147
|
-
const outcome = await runAttempt(
|
|
154
|
+
const outcome = await runAttempt(
|
|
155
|
+
opts.resumeSettings ? { ...opts, fallbackModel: settings.model } : opts,
|
|
156
|
+
result,
|
|
157
|
+
piArgs,
|
|
158
|
+
prompt,
|
|
159
|
+
attempt,
|
|
160
|
+
emitUpdate,
|
|
161
|
+
);
|
|
148
162
|
exitCode = outcome.exitCode;
|
|
149
163
|
startupTimedOut = outcome.startupTimedOut;
|
|
150
164
|
wasAborted = outcome.wasAborted;
|
|
@@ -214,5 +228,14 @@ export async function runAgentSubprocess(opts: RunAgentOptions): Promise<SingleR
|
|
|
214
228
|
return result;
|
|
215
229
|
} finally {
|
|
216
230
|
cleanupTempDir(promptTmpDir);
|
|
231
|
+
if (!resumeSession && opts.namesFile && opts.subagentName && sessionDir) {
|
|
232
|
+
const original = readOriginalSessionSettings(sessionDir);
|
|
233
|
+
result.thinking = original.thinking ?? result.thinking;
|
|
234
|
+
await updateNameRecord(opts.namesFile, opts.subagentName, {
|
|
235
|
+
model: original.model ?? result.model,
|
|
236
|
+
thinking: result.thinking,
|
|
237
|
+
intelligence: result.intelligence,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
217
240
|
}
|
|
218
241
|
}
|
package/storage/name-records.ts
CHANGED
|
@@ -4,7 +4,14 @@ export interface SubagentForkRecord {
|
|
|
4
4
|
createdAt: number;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/** Original effective settings, independent of current presets and parent settings. */
|
|
8
|
+
export interface SubagentModelSettings {
|
|
9
|
+
model?: string;
|
|
10
|
+
thinking?: string;
|
|
11
|
+
intelligence?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface SubagentNameRecord extends SubagentModelSettings {
|
|
8
15
|
name: string;
|
|
9
16
|
/** Agent type this name was generated from (e.g. "code-writer"). */
|
|
10
17
|
agent: string;
|
|
@@ -12,10 +19,6 @@ export interface SubagentNameRecord {
|
|
|
12
19
|
task: string;
|
|
13
20
|
/** Original branch budget. Resumes and private forks share it. */
|
|
14
21
|
budget?: import("../budget.js").SubagentBudget;
|
|
15
|
-
/** Model pinned by the agent config at spawn time, if any. */
|
|
16
|
-
model?: string;
|
|
17
|
-
/** Preset selected for the initial task only. Resume labels live in their transcripts. */
|
|
18
|
-
intelligence?: string;
|
|
19
22
|
/** Tool restriction from the agent config at spawn time, if any. */
|
|
20
23
|
tools?: string[];
|
|
21
24
|
/** Session id of the pi process that spawned this subagent (its owner). */
|
|
@@ -30,7 +30,9 @@ function isNameRecord(value: unknown): value is SubagentNameRecord {
|
|
|
30
30
|
(!Array.isArray(value.tools) || !value.tools.every((tool) => typeof tool === "string"))
|
|
31
31
|
)
|
|
32
32
|
return false;
|
|
33
|
-
return ["model", "lastResumePrompt"].every(
|
|
33
|
+
return ["model", "thinking", "intelligence", "lastResumePrompt"].every(
|
|
34
|
+
(key) => value[key] === undefined || typeof value[key] === "string",
|
|
35
|
+
);
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
function isNamesRegistry(value: unknown): value is NamesRegistry {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { SUBAGENT_INTELLIGENCE_CUSTOM_TYPE } from "../intelligence.js";
|
|
4
|
+
import type { SubagentModelSettings, SubagentNameRecord } from "./name-records.js";
|
|
5
|
+
import { isRecord } from "./values.js";
|
|
6
|
+
|
|
7
|
+
/** Read the first task's settings, never those appended by a later resume. */
|
|
8
|
+
export function readOriginalSessionSettings(sessionDir: string): SubagentModelSettings {
|
|
9
|
+
const settings: SubagentModelSettings = {};
|
|
10
|
+
try {
|
|
11
|
+
const files = fs
|
|
12
|
+
.readdirSync(sessionDir)
|
|
13
|
+
.filter((name) => name.endsWith(".jsonl"))
|
|
14
|
+
.map((name) => ({ file: path.join(sessionDir, name), at: fs.statSync(path.join(sessionDir, name)).mtimeMs }))
|
|
15
|
+
.sort((a, b) => b.at - a.at);
|
|
16
|
+
if (!files[0]) return settings;
|
|
17
|
+
let started = false;
|
|
18
|
+
for (const line of fs.readFileSync(files[0].file, "utf8").split("\n")) {
|
|
19
|
+
let entry: unknown;
|
|
20
|
+
try {
|
|
21
|
+
entry = JSON.parse(line);
|
|
22
|
+
} catch {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (!isRecord(entry)) continue;
|
|
26
|
+
if (!started && entry.type === "model_change" && typeof entry.modelId === "string") {
|
|
27
|
+
settings.model = typeof entry.provider === "string" ? `${entry.provider}/${entry.modelId}` : entry.modelId;
|
|
28
|
+
}
|
|
29
|
+
if (!started && entry.type === "thinking_level_change" && typeof entry.thinkingLevel === "string") {
|
|
30
|
+
settings.thinking = entry.thinkingLevel;
|
|
31
|
+
}
|
|
32
|
+
if (!started && entry.type === "custom" && entry.customType === SUBAGENT_INTELLIGENCE_CUSTOM_TYPE) {
|
|
33
|
+
const label = isRecord(entry.data) ? entry.data.intelligence : undefined;
|
|
34
|
+
if (typeof label === "string") settings.intelligence = label;
|
|
35
|
+
else if (label === null) delete settings.intelligence;
|
|
36
|
+
}
|
|
37
|
+
const message = entry.type === "message" && isRecord(entry.message) ? entry.message : undefined;
|
|
38
|
+
if (message?.role === "user") {
|
|
39
|
+
if (started) break;
|
|
40
|
+
started = true;
|
|
41
|
+
}
|
|
42
|
+
if (message?.role === "assistant" && message.provider !== "pi-subagent-resume") {
|
|
43
|
+
if (typeof message.model === "string" && message.model !== "synthetic-tool-call") {
|
|
44
|
+
settings.model =
|
|
45
|
+
typeof message.provider === "string" ? `${message.provider}/${message.model}` : message.model;
|
|
46
|
+
}
|
|
47
|
+
if (typeof message.thinkingLevel === "string") settings.thinking = message.thinkingLevel;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
// Missing/partial transcripts can still use the settings saved before spawning.
|
|
53
|
+
}
|
|
54
|
+
return settings;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Recover actual settings from the original, not a private fork. This also covers interrupted launches
|
|
58
|
+
* whose registry still contains requested settings before Pi clamped thinking or resolved a model alias. */
|
|
59
|
+
export function originalModelSettings(record: SubagentNameRecord): SubagentModelSettings {
|
|
60
|
+
const recorded = {
|
|
61
|
+
model: record.model,
|
|
62
|
+
thinking: record.thinking,
|
|
63
|
+
intelligence: record.intelligence,
|
|
64
|
+
};
|
|
65
|
+
return { ...recorded, ...readOriginalSessionSettings(record.sessionDir) };
|
|
66
|
+
}
|
package/types/contracts.ts
CHANGED
|
@@ -68,7 +68,7 @@ export interface SingleResult {
|
|
|
68
68
|
task: string;
|
|
69
69
|
/** Unique resumable human name within the delegation tree (e.g. "John"). */
|
|
70
70
|
name?: string;
|
|
71
|
-
/**
|
|
71
|
+
/** Original configured preset label, retained by named resumes. */
|
|
72
72
|
intelligence?: string;
|
|
73
73
|
/** Durable branch allowance, shared by this agent's resumes and session forks. */
|
|
74
74
|
budget?: import("../budget.js").SubagentBudget;
|
|
@@ -82,6 +82,7 @@ export interface SingleResult {
|
|
|
82
82
|
usage: UsageStats;
|
|
83
83
|
toolCalls: ToolCallCounts;
|
|
84
84
|
model?: string;
|
|
85
|
+
thinking?: string;
|
|
85
86
|
stopReason?: string;
|
|
86
87
|
errorMessage?: string;
|
|
87
88
|
/** Cached final assistant text so durable details can omit full transcripts. */
|
package/types/details.ts
CHANGED
|
@@ -80,6 +80,7 @@ export function compactSingleResultForDurableDetails(result: SingleResult): Sing
|
|
|
80
80
|
...(result.stopReason !== undefined ? { stopReason: result.stopReason } : {}),
|
|
81
81
|
...(result.errorMessage !== undefined ? { errorMessage: result.errorMessage } : {}),
|
|
82
82
|
...(result.model !== undefined ? { model: result.model } : {}),
|
|
83
|
+
...(result.thinking !== undefined ? { thinking: result.thinking } : {}),
|
|
83
84
|
...(result.sessionDir !== undefined ? { sessionDir: result.sessionDir } : {}),
|
|
84
85
|
...(result.budget !== undefined ? { budget: result.budget } : {}),
|
|
85
86
|
...(result.sessionId !== undefined ? { sessionId: result.sessionId } : {}),
|
package/ui/detail-model.ts
CHANGED
|
@@ -36,6 +36,8 @@ export interface DetailUsage {
|
|
|
36
36
|
export interface SubagentDetail {
|
|
37
37
|
name: string;
|
|
38
38
|
agent: string;
|
|
39
|
+
/** Original preset label from the name registry or first task's session metadata. */
|
|
40
|
+
intelligence?: string;
|
|
39
41
|
model?: string;
|
|
40
42
|
thinkingLevel?: string;
|
|
41
43
|
tools?: string[];
|
package/ui/detail-transcript.ts
CHANGED
|
@@ -90,6 +90,7 @@ export function findNameRecord(registry: NamesRegistry, name: string): SubagentN
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
export interface ParsedTranscript {
|
|
93
|
+
intelligence?: string;
|
|
93
94
|
blocks: DetailBlock[];
|
|
94
95
|
usage: DetailUsage;
|
|
95
96
|
toolCallCount: number;
|
|
@@ -231,11 +232,13 @@ export function parseTranscriptMessages(messages: unknown[]): ParsedTranscript {
|
|
|
231
232
|
}
|
|
232
233
|
}
|
|
233
234
|
|
|
234
|
-
|
|
235
|
+
const intelligence = blocks.length ? blocks[0].intelligence : pendingIntelligence;
|
|
236
|
+
return { blocks, usage, toolCallCount, model, thinkingLevel, intelligence };
|
|
235
237
|
}
|
|
236
238
|
|
|
237
239
|
export function buildSubagentDetail(record: SubagentNameRecord, options: { sessionDir?: string } = {}): SubagentDetail {
|
|
238
240
|
const sessionDir = options.sessionDir ?? record.sessionDir;
|
|
241
|
+
let intelligence = record.intelligence;
|
|
239
242
|
const notes: string[] = [];
|
|
240
243
|
const files = sessionFilesIn(sessionDir);
|
|
241
244
|
const sessionFile = files[files.length - 1];
|
|
@@ -250,6 +253,7 @@ export function buildSubagentDetail(record: SubagentNameRecord, options: { sessi
|
|
|
250
253
|
notes.push(`No session transcript found in ${shortenPath(sessionDir)}`);
|
|
251
254
|
} else {
|
|
252
255
|
const parsed = parseTranscriptMessages(readSessionEntries(sessionFile));
|
|
256
|
+
intelligence ??= parsed.intelligence;
|
|
253
257
|
model = parsed.model;
|
|
254
258
|
thinkingLevel = parsed.thinkingLevel;
|
|
255
259
|
blocks = parsed.blocks;
|
|
@@ -269,7 +273,7 @@ export function buildSubagentDetail(record: SubagentNameRecord, options: { sessi
|
|
|
269
273
|
at: record.createdAt,
|
|
270
274
|
model,
|
|
271
275
|
thinkingLevel,
|
|
272
|
-
intelligence
|
|
276
|
+
intelligence,
|
|
273
277
|
events: [],
|
|
274
278
|
},
|
|
275
279
|
];
|
|
@@ -281,6 +285,7 @@ export function buildSubagentDetail(record: SubagentNameRecord, options: { sessi
|
|
|
281
285
|
return {
|
|
282
286
|
name: record.name,
|
|
283
287
|
agent: record.agent,
|
|
288
|
+
intelligence,
|
|
284
289
|
model,
|
|
285
290
|
thinkingLevel,
|
|
286
291
|
tools: record.tools,
|
package/ui/pager-view.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { overlayFrame } from "./frame.js";
|
|
2
|
+
import { displayIntelligence } from "../intelligence.js";
|
|
2
3
|
import { stripTerminalSequences } from "@earendil-works/pi-tui";
|
|
3
4
|
import {
|
|
4
5
|
TOOL_LIST_HEADER_LINES,
|
|
@@ -183,7 +184,10 @@ export class PagerView {
|
|
|
183
184
|
: this.mode === "children"
|
|
184
185
|
? "children"
|
|
185
186
|
: `${turn} • tool ${this.selectedToolIndex() + 1}`;
|
|
186
|
-
|
|
187
|
+
const agent = this.detail.intelligence
|
|
188
|
+
? `${displayIntelligence(this.detail.intelligence)}/${this.detail.agent}`
|
|
189
|
+
: this.detail.agent;
|
|
190
|
+
return `${this.detail.name} (${agent}) • ${suffix}`;
|
|
187
191
|
}
|
|
188
192
|
|
|
189
193
|
protected footer(): string {
|