@giladbarnea/pi-simple-team 1.0.28 → 1.0.29
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/index.ts +9 -4
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -75,6 +75,7 @@ interface TeammateState {
|
|
|
75
75
|
interface TeamState {
|
|
76
76
|
owner: symbol;
|
|
77
77
|
ownerPi: ExtensionAPI;
|
|
78
|
+
parentPiExecutable: string;
|
|
78
79
|
id?: string;
|
|
79
80
|
name: string;
|
|
80
81
|
projectDirectory?: string;
|
|
@@ -396,7 +397,7 @@ function attachRpcTeammate(team: TeamState, teammate: TeammateState, participant
|
|
|
396
397
|
"--system-prompt",
|
|
397
398
|
composeSystemPrompt(team.name, team.teamPrompt, teammate.name, teammate.prompt, participants, teammate.canOverseeOwnTeams),
|
|
398
399
|
];
|
|
399
|
-
const proc = childProcess.spawn(
|
|
400
|
+
const proc = childProcess.spawn(team.parentPiExecutable, args, {
|
|
400
401
|
cwd: team.projectDirectory ?? process.cwd(),
|
|
401
402
|
stdio: ["pipe", "ignore", "pipe"],
|
|
402
403
|
env: { ...process.env, ...childEnvironmentOverrides(team, teammate, participants) },
|
|
@@ -446,7 +447,7 @@ async function attachHerdrTeammate(
|
|
|
446
447
|
}
|
|
447
448
|
args.push(
|
|
448
449
|
"--",
|
|
449
|
-
|
|
450
|
+
team.parentPiExecutable,
|
|
450
451
|
...sessionArgs,
|
|
451
452
|
"--no-extensions",
|
|
452
453
|
"-e",
|
|
@@ -777,10 +778,11 @@ function teammateSchema(modelGuidance: string) {
|
|
|
777
778
|
});
|
|
778
779
|
}
|
|
779
780
|
|
|
780
|
-
function restoreTeamState(owner: symbol, ownerPi: ExtensionAPI, manifest: TeamManifest, lease: TeamLease): TeamState {
|
|
781
|
+
function restoreTeamState(owner: symbol, ownerPi: ExtensionAPI, parentPiExecutable: string, manifest: TeamManifest, lease: TeamLease): TeamState {
|
|
781
782
|
const team: TeamState = {
|
|
782
783
|
owner,
|
|
783
784
|
ownerPi,
|
|
785
|
+
parentPiExecutable,
|
|
784
786
|
id: manifest.id,
|
|
785
787
|
name: manifest.name,
|
|
786
788
|
projectDirectory: manifest.projectDirectory,
|
|
@@ -839,6 +841,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
839
841
|
if (!childRuntimeConfig.canOverseeOwnTeams) return;
|
|
840
842
|
}
|
|
841
843
|
|
|
844
|
+
const parentPiExecutable = process.argv[1];
|
|
845
|
+
if (!parentPiExecutable) throw new Error("pi-simple-team could not locate the parent Pi executable");
|
|
842
846
|
const owner = Symbol("pi-simple-team-owner");
|
|
843
847
|
const sessionTeammateRoster = childRuntimeConfig?.participants ?? [];
|
|
844
848
|
pi.registerMessageRenderer(teamMessageType, (message, _options, theme) => renderTeamMessage(message, theme, getMarkdownTheme(), sessionTeammateRoster));
|
|
@@ -912,6 +916,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
912
916
|
const team: TeamState = {
|
|
913
917
|
owner,
|
|
914
918
|
ownerPi: pi,
|
|
919
|
+
parentPiExecutable,
|
|
915
920
|
id: teamId,
|
|
916
921
|
name: teamName,
|
|
917
922
|
projectDirectory,
|
|
@@ -1063,7 +1068,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1063
1068
|
const lease = claimTeamLease(manifest.id, mainSessionId);
|
|
1064
1069
|
try {
|
|
1065
1070
|
await ensureCallbackServer();
|
|
1066
|
-
team = restoreTeamState(owner, pi, manifest, lease);
|
|
1071
|
+
team = restoreTeamState(owner, pi, parentPiExecutable, manifest, lease);
|
|
1067
1072
|
teams.set(team.id!, team);
|
|
1068
1073
|
} catch (error) {
|
|
1069
1074
|
releaseTeamLease(lease);
|