pi-landstrip 0.18.39 → 0.18.41
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/dist/index.ts +35 -20
- package/package.json +2 -2
package/dist/index.ts
CHANGED
|
@@ -2084,25 +2084,37 @@ function isSupportedPiVersion(version) {
|
|
|
2084
2084
|
}
|
|
2085
2085
|
return true;
|
|
2086
2086
|
}
|
|
2087
|
+
function findPiPackage(entry) {
|
|
2088
|
+
let dir = dirname3(realpathSync(entry));
|
|
2089
|
+
for (;; ) {
|
|
2090
|
+
const pkgPath = join6(dir, "package.json");
|
|
2091
|
+
if (existsSync4(pkgPath)) {
|
|
2092
|
+
const pkg = readPiPackage(pkgPath);
|
|
2093
|
+
if (pkg)
|
|
2094
|
+
return pkg;
|
|
2095
|
+
}
|
|
2096
|
+
const parent = dirname3(dir);
|
|
2097
|
+
if (parent === dir)
|
|
2098
|
+
return;
|
|
2099
|
+
dir = parent;
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2087
2102
|
function resolvePiPackage() {
|
|
2088
2103
|
if (piPackageResolved)
|
|
2089
2104
|
return cachedPiPackage;
|
|
2090
2105
|
piPackageResolved = true;
|
|
2106
|
+
const argvEntry = process.argv[1];
|
|
2107
|
+
if (argvEntry) {
|
|
2108
|
+
try {
|
|
2109
|
+
const pkg = findPiPackage(argvEntry);
|
|
2110
|
+
if (pkg)
|
|
2111
|
+
return pkg;
|
|
2112
|
+
} catch {}
|
|
2113
|
+
}
|
|
2091
2114
|
try {
|
|
2092
|
-
const
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
const pkgPath = join6(dir2, "package.json");
|
|
2096
|
-
if (existsSync4(pkgPath)) {
|
|
2097
|
-
const pkg = readPiPackage(pkgPath);
|
|
2098
|
-
if (pkg)
|
|
2099
|
-
return pkg;
|
|
2100
|
-
}
|
|
2101
|
-
const parent = dirname3(dir2);
|
|
2102
|
-
if (parent === dir2)
|
|
2103
|
-
break;
|
|
2104
|
-
dir2 = parent;
|
|
2105
|
-
}
|
|
2115
|
+
const pkg = findPiPackage(fileURLToPath(import.meta.resolve("@earendil-works/pi-coding-agent")));
|
|
2116
|
+
if (pkg)
|
|
2117
|
+
return pkg;
|
|
2106
2118
|
} catch {}
|
|
2107
2119
|
let dir = packageDir;
|
|
2108
2120
|
for (;; ) {
|
|
@@ -4281,6 +4293,7 @@ ${catalog.diagnostics.join(`
|
|
|
4281
4293
|
throw new Error("Task cancelled");
|
|
4282
4294
|
let turns = 0;
|
|
4283
4295
|
let streamedText = "";
|
|
4296
|
+
let workerError;
|
|
4284
4297
|
worker.rpc.onEvent((event) => {
|
|
4285
4298
|
if (event.type === "message_update" && isRecord2(event.assistantMessageEvent)) {
|
|
4286
4299
|
const messageEvent = event.assistantMessageEvent;
|
|
@@ -4289,7 +4302,10 @@ ${catalog.diagnostics.join(`
|
|
|
4289
4302
|
update(streamedText);
|
|
4290
4303
|
}
|
|
4291
4304
|
}
|
|
4292
|
-
if (event.type === "message_end") {
|
|
4305
|
+
if (event.type === "message_end" && isRecord2(event.message)) {
|
|
4306
|
+
if (event.message.role === "assistant") {
|
|
4307
|
+
workerError = event.message.stopReason === "error" ? typeof event.message.errorMessage === "string" ? event.message.errorMessage : "Subagent model request failed" : undefined;
|
|
4308
|
+
}
|
|
4293
4309
|
const usage = taskUsageFromMessage(event.message);
|
|
4294
4310
|
if (usage) {
|
|
4295
4311
|
task.usage = addTaskUsage(task.usage, usage);
|
|
@@ -4350,6 +4366,8 @@ ${catalog.diagnostics.join(`
|
|
|
4350
4366
|
await worker.rpc.request("follow_up", { message: pendingPrompt });
|
|
4351
4367
|
}
|
|
4352
4368
|
const output = await promise;
|
|
4369
|
+
if (workerError)
|
|
4370
|
+
throw new Error(workerError);
|
|
4353
4371
|
if (signal.aborted)
|
|
4354
4372
|
throw new Error("Task cancelled");
|
|
4355
4373
|
task.state = "completed";
|
|
@@ -4446,6 +4464,7 @@ ${catalog.diagnostics.join(`
|
|
|
4446
4464
|
if (!sessionWritePath)
|
|
4447
4465
|
throw new Error("Subagent task has no session directory or file");
|
|
4448
4466
|
const authPath = join6(agentDir, "auth.json");
|
|
4467
|
+
const settingsPath = join6(agentDir, "settings.json");
|
|
4449
4468
|
const cliEntry = invocation.args[0] ?? invocation.command;
|
|
4450
4469
|
const cliRoot = dependencyRoot(cliEntry) ?? dirname3(dirname3(cliEntry));
|
|
4451
4470
|
const extensionRoot = dependencyRoot(packageDir);
|
|
@@ -4483,7 +4502,7 @@ ${catalog.diagnostics.join(`
|
|
|
4483
4502
|
temp
|
|
4484
4503
|
].filter((path) => path !== undefined))
|
|
4485
4504
|
],
|
|
4486
|
-
writePaths: [sessionWritePath, temp, authPath, `${authPath}.lock`],
|
|
4505
|
+
writePaths: [sessionWritePath, temp, authPath, `${authPath}.lock`, `${settingsPath}.lock`],
|
|
4487
4506
|
signal
|
|
4488
4507
|
});
|
|
4489
4508
|
if (signal.aborted)
|
|
@@ -4563,10 +4582,6 @@ ${catalog.diagnostics.join(`
|
|
|
4563
4582
|
return { ...context, agent: this.primaryAgent?.name };
|
|
4564
4583
|
}
|
|
4565
4584
|
piInvocation() {
|
|
4566
|
-
const argvEntry = process.argv[1];
|
|
4567
|
-
if (argvEntry && /(?:^|[/\\])cli\.(?:js|mjs|cjs|ts)$/.test(argvEntry)) {
|
|
4568
|
-
return { command: process.execPath, args: [argvEntry] };
|
|
4569
|
-
}
|
|
4570
4585
|
const pkg = resolvePiPackage();
|
|
4571
4586
|
if (!pkg) {
|
|
4572
4587
|
throw new Error("Unable to determine the running Pi CLI entry; process-backed subagents are unavailable");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-landstrip",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.41",
|
|
4
4
|
"description": "Sandboxed Bash and process-backed agents for Pi",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"landstrip",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"ci:test": "npm run test"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@landstrip/landstrip-api": "^0.18.
|
|
42
|
+
"@landstrip/landstrip-api": "^0.18.41",
|
|
43
43
|
"jsonc-parser": "^3.3.1",
|
|
44
44
|
"minimatch": "^10.2.5",
|
|
45
45
|
"yaml": "^2.9.0"
|