@johnnywu/pi-subagents 2.2.0 → 2.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [2.2.1](https://github.com/jwu/pi-subagents/compare/v2.2.0...v2.2.1) (2026-08-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * support bundled pi CLI invocation ([0651956](https://github.com/jwu/pi-subagents/commit/065195604d1d3b54ea2810f10d20049c4023daf9))
7
+
1
8
  # [2.2.0](https://github.com/jwu/pi-subagents/compare/v2.1.1...v2.2.0) (2026-08-06)
2
9
 
3
10
 
@@ -6,8 +6,8 @@ import {
6
6
  import { spawn } from 'node:child_process';
7
7
  import * as fs from 'node:fs/promises';
8
8
  import * as os from 'node:os';
9
+ import { existsSync } from 'node:fs';
9
10
  import * as path from 'node:path';
10
- import { fileURLToPath } from 'node:url';
11
11
  import type { AgentConfig } from './agent-loader.ts';
12
12
  import { AUTO_RUNTIME_TOOLS_MARKER } from './subagent-prompt.ts';
13
13
  import { resolveSkills } from './skill-resolver.ts';
@@ -59,7 +59,13 @@ export interface AgentResult extends AgentProgress {
59
59
 
60
60
  export interface PiResolution {
61
61
  command: string;
62
- entryPoint: string;
62
+ entryPoint: string | null;
63
+ }
64
+
65
+ export interface PiRuntime {
66
+ currentScript?: string;
67
+ execPath: string;
68
+ fileExists(filePath: string): boolean;
63
69
  }
64
70
 
65
71
  export interface ProcessInvocation {
@@ -171,14 +177,25 @@ export function subagentSessionDir(
171
177
  return path.join(agentDir, 'sessions', safeProject, 'subagents');
172
178
  }
173
179
 
174
- export function resolvePiEntryPoint(): PiResolution {
175
- const packageEntryPoint = fileURLToPath(import.meta.resolve('@earendil-works/pi-coding-agent'));
176
- const packageRoot = path.dirname(path.dirname(packageEntryPoint));
180
+ export function resolvePiEntryPoint(
181
+ runtime: PiRuntime = {
182
+ currentScript: process.argv[1],
183
+ execPath: process.execPath,
184
+ fileExists: existsSync,
185
+ },
186
+ ): PiResolution {
187
+ const currentScript = runtime.currentScript;
188
+ const isBunVirtualScript = currentScript?.startsWith('/$bunfs/root/');
177
189
 
178
- return {
179
- command: process.execPath,
180
- entryPoint: path.join(packageRoot, 'dist', 'cli.js'),
181
- };
190
+ if (currentScript && !isBunVirtualScript && runtime.fileExists(currentScript)) {
191
+ return { command: runtime.execPath, entryPoint: currentScript };
192
+ }
193
+
194
+ const execName = path.basename(runtime.execPath).toLowerCase();
195
+ const isGenericRuntime = /^(node|bun)(\.exe)?$/.test(execName);
196
+ if (!isGenericRuntime) return { command: runtime.execPath, entryPoint: null };
197
+
198
+ return { command: 'pi', entryPoint: null };
182
199
  }
183
200
 
184
201
  export const defaultRunner: ProcessRunner = (invocation, handlers, signal) =>
@@ -483,7 +500,14 @@ export async function runSubagent(options: RunSubagentOptions): Promise<AgentRes
483
500
  modelsPath: options.agentDir ? path.join(options.agentDir, 'models.json') : undefined,
484
501
  });
485
502
  const modelRegistry = new ModelRegistry(runtime);
486
- const args = [pi.entryPoint, '--mode', 'json', '-p', '--no-skills', '--no-prompt-templates'];
503
+ const args = [
504
+ ...(pi.entryPoint ? [pi.entryPoint] : []),
505
+ '--mode',
506
+ 'json',
507
+ '-p',
508
+ '--no-skills',
509
+ '--no-prompt-templates',
510
+ ];
487
511
 
488
512
  if (options.agent.systemPromptMode === 'replace-all') args.push('--no-context-files');
489
513
  if (options.agent.model) args.push('--model', options.agent.model);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnnywu/pi-subagents",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Sub-agents extension for pi coding agent.",
5
5
  "homepage": "https://github.com/jwu/pi-subagents#readme",
6
6
  "repository": {
@@ -88,8 +88,8 @@
88
88
  },
89
89
  "devDependencies": {
90
90
  "@commitlint/cli": "^20.5.3",
91
- "@earendil-works/pi-coding-agent": "^0.83.0",
92
91
  "@commitlint/config-conventional": "^20.5.3",
92
+ "@earendil-works/pi-coding-agent": "0.84.3",
93
93
  "@semantic-release/changelog": "^6.0.3",
94
94
  "@semantic-release/commit-analyzer": "^13.0.1",
95
95
  "@semantic-release/git": "^10.0.1",