pi-teams 0.9.8 → 0.9.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.
@@ -15,6 +15,29 @@ import * as fs from "node:fs";
15
15
  import * as os from "node:os";
16
16
  import { spawnSync } from "node:child_process";
17
17
 
18
+ /**
19
+ * Build the command used to relaunch pi for teammate processes.
20
+ *
21
+ * In Bun-compiled pi binaries, process.argv[1] points at a virtual $bunfs path
22
+ * like /$bunfs/root/pi, which is not a real file and breaks when prefixed with
23
+ * `node`. process.execPath points at the actual executable in both compiled and
24
+ * regular environments, so prefer that when available.
25
+ */
26
+ function getPiLaunchCommand(): string {
27
+ // If we have an execPath, use it directly (works for both compiled binaries and node scripts)
28
+ if (process.execPath) {
29
+ return JSON.stringify(process.execPath);
30
+ }
31
+
32
+ // Fallback: try argv[1] with node prefix for regular node environments
33
+ if (process.argv[1]) {
34
+ return `node ${JSON.stringify(process.argv[1])}`;
35
+ }
36
+
37
+ // Last resort: just use "pi" and hope it's on PATH
38
+ return "pi";
39
+ }
40
+
18
41
  // Cache for available models
19
42
  let availableModelsCache: Array<{ provider: string; model: string }> | null = null;
20
43
  let modelsCacheTime = 0;
@@ -553,7 +576,7 @@ export default function (pi: ExtensionAPI) {
553
576
  await teams.addMember(safeTeamName, member);
554
577
  await messaging.sendPlainMessage(safeTeamName, "team-lead", safeName, params.prompt, "Initial prompt");
555
578
 
556
- const piBinary = process.argv[1] ? `node ${process.argv[1]}` : "pi";
579
+ const piBinary = getPiLaunchCommand();
557
580
  let piCmd = piBinary;
558
581
 
559
582
  if (chosenModel) {
@@ -638,7 +661,7 @@ export default function (pi: ExtensionAPI) {
638
661
 
639
662
  const teamConfig = await teams.readConfig(safeTeamName);
640
663
  const cwd = params.cwd || process.cwd();
641
- const piBinary = process.argv[1] ? `node ${process.argv[1]}` : "pi";
664
+ const piBinary = getPiLaunchCommand();
642
665
  let piCmd = piBinary;
643
666
  if (teamConfig.defaultModel) {
644
667
  // Use the combined --model provider/model format
@@ -1105,7 +1128,7 @@ export default function (pi: ExtensionAPI) {
1105
1128
  await teams.addMember(safeTeamName, member);
1106
1129
  await messaging.sendPlainMessage(safeTeamName, "team-lead", safeName, agentDef.prompt, "Initial prompt from predefined team");
1107
1130
 
1108
- const piBinary = process.argv[1] ? `node ${process.argv[1]}` : "pi";
1131
+ const piBinary = getPiLaunchCommand();
1109
1132
  let piCmd = piBinary;
1110
1133
 
1111
1134
  if (chosenModel) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-teams",
3
- "version": "0.9.8",
3
+ "version": "0.9.9",
4
4
  "description": "Agent teams for pi, ported from claude-code-teams-mcp",
5
5
  "repository": {
6
6
  "type": "git",