oira666_pi-subagent 0.7.12 → 0.7.14
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/config.ts +1 -1
- package/docs/configuration.md +18 -4
- package/extension/settings-commands.ts +7 -6
- package/package.json +1 -1
- package/runner/protocol.ts +1 -2
- package/startup.js +14 -11
- package/storage/config-files.ts +11 -6
package/config.ts
CHANGED
|
@@ -32,7 +32,7 @@ function readToolPrompts(config: Record<string, unknown>, filePath: string): Rec
|
|
|
32
32
|
return result;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
/** Load personal settings, then the nearest
|
|
35
|
+
/** Load personal settings, then trusted ancestor configs with the nearest taking priority. */
|
|
36
36
|
export function loadPiSubagentsConfig(
|
|
37
37
|
cwd?: string,
|
|
38
38
|
includeProject = false,
|
package/docs/configuration.md
CHANGED
|
@@ -43,9 +43,11 @@ At maximum depth 1, combining `first-layer: only` with `last-layer: disabled` bl
|
|
|
43
43
|
|
|
44
44
|
1. `~/.pi/`
|
|
45
45
|
2. `$PI_CODING_AGENT_DIR/`, normally `~/.pi/agent/`
|
|
46
|
-
3.
|
|
46
|
+
3. Trusted project `.pi/` directories, from the filesystem root down to the working directory
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
For each setting, the current project takes priority, then its parent, then that parent's parent, continuing to the filesystem root. Missing settings fall back to the global locations above. A nearby config file does not stop this search for settings it omits. Project files are read only when Pi trusts the current project.
|
|
49
|
+
|
|
50
|
+
If both filenames exist at one location, only `pi-subagent.json` is read there. Use either name; no migration is needed.
|
|
49
51
|
|
|
50
52
|
For each setting, an explicitly set environment variable wins over JSON, then the built-in default applies. Empty or invalid environment values still take precedence and use that variable's existing parsing rules. Explicit `false`, `0`, and empty arrays in JSON are not treated as missing. CLI delegation flags retain their existing priority; children cannot loosen inherited delegation limits. Existing session budgets are not reset by configuration changes.
|
|
51
53
|
|
|
@@ -117,7 +119,9 @@ Waiting parents park instead of rejecting blocked descendants or exceeding the c
|
|
|
117
119
|
|
|
118
120
|
Preset definitions, the fallback model, extension exclusions, runner executables, retry counts and timeouts remain file settings.
|
|
119
121
|
|
|
120
|
-
Commands apply to the main session.
|
|
122
|
+
Commands apply to the main session. Enable/disable, limits, delegation and recovery controls, inspection, and saving settings remain available while the main agent is busy. Changing `intelligence` requires an idle main agent because in-flight calls retain the previous preset schema. Changes affect subsequent launches and resumes; they do not stop or reconfigure existing workers. Tool availability and schemas update for subsequent model requests, but an already-running request cannot see the updated tool list. Disabling also rejects launch or resume calls from that request if execution has not started. Calls already preparing, including those waiting for project-agent approval, may finish admission. Concurrency changes update the live queue immediately.
|
|
123
|
+
|
|
124
|
+
Session commands override startup environment values and CLI delegation flags without changing `process.env`. A startup environment disable prevents the entire extension from loading, so commands are unavailable in that case. Child sessions cannot use commands to change inherited grants.
|
|
121
125
|
|
|
122
126
|
Changes are session-only and clear on session replacement, resume or reload. The concurrency cap is shared across processes, not saved to configuration unless explicitly requested. Lowering the live cap does not stop active workers. Queued work waits until the live-worker count falls below the new cap. Raising the cap admits queued work immediately. Changing the tasks-per-call limit affects new submissions only, not already accepted batches. Budget changes preserve all spent and reserved slots, cannot go below that spending, and cannot enlarge a child's grant. Temporary budget increases disappear when the session ends, but any slots used under them remain spent.
|
|
123
127
|
|
|
@@ -197,7 +201,17 @@ Tool result rows show the selected preset, for example `Nicolas (Junior/code-wri
|
|
|
197
201
|
|
|
198
202
|
`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 workers still retain their original settings when messaged or resumed. 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.
|
|
199
203
|
|
|
200
|
-
Configuration follows the trust checks and file order above.
|
|
204
|
+
Configuration follows the trust checks and file order above. The nearest `subagents-models` block replaces the entire inherited block. An empty list disables selection. Invalid blocks warn and disable selection rather than using a partial list.
|
|
205
|
+
|
|
206
|
+
To disable inherited intelligence presets in a project, put this in its `.pi/pi-subagent.json`:
|
|
207
|
+
|
|
208
|
+
```json
|
|
209
|
+
{
|
|
210
|
+
"models": { "intelligence": false }
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
This disables presets from parents and global files without disabling other inherited settings. Alternatively, `"subagents-models": []` clears the inherited list. Explicit disabling is not treated as missing, so it does not trigger fallback. Environment variables and session commands still take priority. Nested workers load configuration using the same rules. Reload Pi after changing settings.
|
|
201
215
|
|
|
202
216
|
The old `smart-decision` block is ignored. Remove it and its router credentials when migrating. Configuration files are no longer modified at runtime.
|
|
203
217
|
|
|
@@ -154,15 +154,11 @@ function applySettings(state: ExtensionState, ctx: ExtensionCommandContext): voi
|
|
|
154
154
|
updateCombinedUsageStatus(state, ctx);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
function editable(state: ExtensionState, ctx: ExtensionCommandContext
|
|
157
|
+
function editable(state: ExtensionState, ctx: ExtensionCommandContext): boolean {
|
|
158
158
|
if (state.currentDepth > 0) {
|
|
159
159
|
ctx.ui.notify("Change session settings in the main session, not in a child with an inherited grant.", "warning");
|
|
160
160
|
return false;
|
|
161
161
|
}
|
|
162
|
-
if (!allowBusy && !ctx.isIdle()) {
|
|
163
|
-
ctx.ui.notify("Wait for the current assistant turn to finish before changing settings.", "warning");
|
|
164
|
-
return false;
|
|
165
|
-
}
|
|
166
162
|
return true;
|
|
167
163
|
}
|
|
168
164
|
|
|
@@ -217,7 +213,12 @@ export function registerSettingsCommands(state: ExtensionState): void {
|
|
|
217
213
|
return;
|
|
218
214
|
}
|
|
219
215
|
const liveLimit = control.name === "max-concurency" || control.name === "max-total";
|
|
220
|
-
if (!editable(state, ctx
|
|
216
|
+
if (!editable(state, ctx)) return;
|
|
217
|
+
// In-flight calls retain the old schema but read the current preset settings.
|
|
218
|
+
if (control.name === "intelligence" && !ctx.isIdle()) {
|
|
219
|
+
ctx.ui.notify("Wait for the current assistant turn to finish before changing intelligence.", "warning");
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
221
222
|
const value = parseValue(control, raw);
|
|
222
223
|
if (control.name === "max-total" && state.currentBudget)
|
|
223
224
|
setSessionBudgetLimit(state.currentBudget, Number(value));
|
package/package.json
CHANGED
package/runner/protocol.ts
CHANGED
|
@@ -68,8 +68,7 @@ export function createSteeringHandle(
|
|
|
68
68
|
|
|
69
69
|
/** Interpret run boundaries and semantic activity independently of JSONL framing. */
|
|
70
70
|
export function createProtocolHandler(options: ProtocolOptions): (line: string) => void {
|
|
71
|
-
const { state, result, promptRequestId, emitUpdate, stopChild, doResolve, forceStopAndSettle } =
|
|
72
|
-
options;
|
|
71
|
+
const { state, result, promptRequestId, emitUpdate, stopChild, doResolve, forceStopAndSettle } = options;
|
|
73
72
|
// One bounded digest per active nested call, not a retained serialized tree.
|
|
74
73
|
const nestedSignatures = new Map<string, string>();
|
|
75
74
|
return (line: string) => {
|
package/startup.js
CHANGED
|
@@ -25,21 +25,24 @@ function configAtLocation(dir) {
|
|
|
25
25
|
const singular = path.join(dir, PI_SUBAGENT_CONFIG_FILE);
|
|
26
26
|
return fs.existsSync(singular) ? singular : path.join(dir, PI_SUBAGENTS_CONFIG_FILE);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function* projectConfigs(cwd) {
|
|
29
29
|
let dir = path.resolve(cwd);
|
|
30
30
|
while (true) {
|
|
31
31
|
const candidate = configAtLocation(path.join(dir, ".pi"));
|
|
32
|
-
if (fs.existsSync(candidate))
|
|
32
|
+
if (fs.existsSync(candidate)) yield candidate;
|
|
33
33
|
const parent = path.dirname(dir);
|
|
34
|
-
if (parent === dir) return
|
|
34
|
+
if (parent === dir) return;
|
|
35
35
|
dir = parent;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
+
function findProjectConfig(cwd) {
|
|
39
|
+
return projectConfigs(cwd).next().value ?? null;
|
|
40
|
+
}
|
|
38
41
|
function configPaths(cwd, includeProject = false) {
|
|
39
42
|
const paths = [configAtLocation(path.join(os.homedir(), ".pi")), configAtLocation(getAgentDir())];
|
|
40
43
|
if (cwd && includeProject) {
|
|
41
|
-
const
|
|
42
|
-
|
|
44
|
+
const personalPaths = new Set(paths);
|
|
45
|
+
paths.push(...[...projectConfigs(cwd)].reverse().filter((file) => !personalPaths.has(file)));
|
|
43
46
|
}
|
|
44
47
|
return [...new Set(paths)];
|
|
45
48
|
}
|
|
@@ -11497,15 +11500,11 @@ function applySettings(state, ctx) {
|
|
|
11497
11500
|
if (state.canDelegate) ensureSubagentToolActive(state.pi);
|
|
11498
11501
|
updateCombinedUsageStatus(state, ctx);
|
|
11499
11502
|
}
|
|
11500
|
-
function editable(state, ctx
|
|
11503
|
+
function editable(state, ctx) {
|
|
11501
11504
|
if (state.currentDepth > 0) {
|
|
11502
11505
|
ctx.ui.notify("Change session settings in the main session, not in a child with an inherited grant.", "warning");
|
|
11503
11506
|
return false;
|
|
11504
11507
|
}
|
|
11505
|
-
if (!allowBusy && !ctx.isIdle()) {
|
|
11506
|
-
ctx.ui.notify("Wait for the current assistant turn to finish before changing settings.", "warning");
|
|
11507
|
-
return false;
|
|
11508
|
-
}
|
|
11509
11508
|
return true;
|
|
11510
11509
|
}
|
|
11511
11510
|
function registerSettingsCommands(state) {
|
|
@@ -11552,7 +11551,11 @@ function registerSettingsCommands(state) {
|
|
|
11552
11551
|
return;
|
|
11553
11552
|
}
|
|
11554
11553
|
const liveLimit = control.name === "max-concurency" || control.name === "max-total";
|
|
11555
|
-
if (!editable(state, ctx
|
|
11554
|
+
if (!editable(state, ctx)) return;
|
|
11555
|
+
if (control.name === "intelligence" && !ctx.isIdle()) {
|
|
11556
|
+
ctx.ui.notify("Wait for the current assistant turn to finish before changing intelligence.", "warning");
|
|
11557
|
+
return;
|
|
11558
|
+
}
|
|
11556
11559
|
const value = parseValue(control, raw);
|
|
11557
11560
|
if (control.name === "max-total" && state.currentBudget)
|
|
11558
11561
|
setSessionBudgetLimit(state.currentBudget, Number(value));
|
package/storage/config-files.ts
CHANGED
|
@@ -29,24 +29,29 @@ function configAtLocation(dir: string): string {
|
|
|
29
29
|
return fs.existsSync(singular) ? singular : path.join(dir, PI_SUBAGENTS_CONFIG_FILE);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
/**
|
|
33
|
-
|
|
32
|
+
/** Existing project configs, nearest first, up to the filesystem root. */
|
|
33
|
+
function* projectConfigs(cwd: string): Generator<string> {
|
|
34
34
|
let dir = path.resolve(cwd);
|
|
35
35
|
while (true) {
|
|
36
36
|
const candidate = configAtLocation(path.join(dir, ".pi"));
|
|
37
|
-
if (fs.existsSync(candidate))
|
|
37
|
+
if (fs.existsSync(candidate)) yield candidate;
|
|
38
38
|
const parent = path.dirname(dir);
|
|
39
|
-
if (parent === dir) return
|
|
39
|
+
if (parent === dir) return;
|
|
40
40
|
dir = parent;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/** Find the nearest project-local config while walking up from cwd. */
|
|
45
|
+
export function findProjectConfig(cwd: string): string | null {
|
|
46
|
+
return projectConfigs(cwd).next().value ?? null;
|
|
47
|
+
}
|
|
48
|
+
|
|
44
49
|
/** Both filenames are permanent. Singular wins when both exist at one location. */
|
|
45
50
|
export function configPaths(cwd?: string, includeProject = false): string[] {
|
|
46
51
|
const paths = [configAtLocation(path.join(os.homedir(), ".pi")), configAtLocation(getAgentDir())];
|
|
47
52
|
if (cwd && includeProject) {
|
|
48
|
-
const
|
|
49
|
-
|
|
53
|
+
const personalPaths = new Set(paths);
|
|
54
|
+
paths.push(...[...projectConfigs(cwd)].reverse().filter((file) => !personalPaths.has(file)));
|
|
50
55
|
}
|
|
51
56
|
return [...new Set(paths)];
|
|
52
57
|
}
|