oira666_pi-subagent 0.7.11 → 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/README.md CHANGED
@@ -6,7 +6,7 @@ Launches return immediately. Completion and worker messages arrive as steering t
6
6
 
7
7
  Requires Pi 1.4.0 or newer, using the `@earendil-works` SDK packages. Only the latest npm Pi release is tested.
8
8
 
9
- Tested against Pi 1.5.1 on Linux.
9
+ Tested against Pi 1.5.2 on Linux.
10
10
 
11
11
  ## Install
12
12
 
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 project configuration when trusted. */
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,
@@ -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. The nearest trusted project `.pi/` containing either filename, walking upward from the working directory
46
+ 3. Trusted project `.pi/` directories, from the filesystem root down to the working directory
47
47
 
48
- Later locations override earlier ones per setting. If both filenames exist at one location, only `pi-subagent.json` is read there. Use either name; no migration is needed.
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. 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.
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oira666_pi-subagent",
3
- "version": "0.7.11",
3
+ "version": "0.7.13",
4
4
  "description": "Subagent extension for Pi coding agent. Delegate tasks to specialized agents.",
5
5
  "type": "module",
6
6
  "main": "startup.js",
@@ -71,10 +71,10 @@
71
71
  "check": "npm test && npm run format:check && npm run check:size"
72
72
  },
73
73
  "devDependencies": {
74
- "@earendil-works/pi-agent-core": "^1.5.1",
75
- "@earendil-works/pi-ai": "^1.5.1",
76
- "@earendil-works/pi-coding-agent": "^1.5.1",
77
- "@earendil-works/pi-tui": "^1.5.1",
74
+ "@earendil-works/pi-agent-core": "^1.5.2",
75
+ "@earendil-works/pi-ai": "^1.5.2",
76
+ "@earendil-works/pi-coding-agent": "^1.5.2",
77
+ "@earendil-works/pi-tui": "^1.5.2",
78
78
  "@sinclair/typebox": ">=0.34.0",
79
79
  "@types/node": "^25.9.9",
80
80
  "esbuild": "^0.28.2",
@@ -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 findProjectConfig(cwd) {
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)) return candidate;
32
+ if (fs.existsSync(candidate)) yield candidate;
33
33
  const parent = path.dirname(dir);
34
- if (parent === dir) return null;
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 projectConfig = findProjectConfig(cwd);
42
- if (projectConfig) paths.push(projectConfig);
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
  }
@@ -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
- /** Find the nearest project-local config while walking up from cwd. */
33
- export function findProjectConfig(cwd: string): string | null {
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)) return candidate;
37
+ if (fs.existsSync(candidate)) yield candidate;
38
38
  const parent = path.dirname(dir);
39
- if (parent === dir) return null;
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 projectConfig = findProjectConfig(cwd);
49
- if (projectConfig) paths.push(projectConfig);
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
  }