oira666_pi-subagent 0.7.12 → 0.7.13
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 +15 -3
- package/package.json +1 -1
- package/runner/protocol.ts +1 -2
- package/startup.js +8 -5
- 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
|
|
|
@@ -197,7 +199,17 @@ Tool result rows show the selected preset, for example `Nicolas (Junior/code-wri
|
|
|
197
199
|
|
|
198
200
|
`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
201
|
|
|
200
|
-
Configuration follows the trust checks and file order above.
|
|
202
|
+
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.
|
|
203
|
+
|
|
204
|
+
To disable inherited intelligence presets in a project, put this in its `.pi/pi-subagent.json`:
|
|
205
|
+
|
|
206
|
+
```json
|
|
207
|
+
{
|
|
208
|
+
"models": { "intelligence": false }
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
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
213
|
|
|
202
214
|
The old `smart-decision` block is ignored. Remove it and its router credentials when migrating. Configuration files are no longer modified at runtime.
|
|
203
215
|
|
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
|
}
|
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
|
}
|