@trim21/personal-pi-extensions 0.0.427 → 0.0.428
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/package.json
CHANGED
package/src/bwrap/core.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type ChildProcess, spawn } from "node:child_process";
|
|
2
|
-
import {
|
|
2
|
+
import { constants, type Dirent, existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import { access as fsAccess, readdir, stat } from "node:fs/promises";
|
|
4
4
|
import { delimiter, join } from "node:path";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
5
|
|
|
7
6
|
import { StringEnum } from "@earendil-works/pi-ai";
|
|
8
7
|
import { type BashOperations, getAgentDir, getShellConfig } from "@earendil-works/pi-coding-agent";
|
|
@@ -362,22 +361,6 @@ export async function buildBwrapArgs(resolved: ResolvedBwrap, cwd: string): Prom
|
|
|
362
361
|
return args;
|
|
363
362
|
}
|
|
364
363
|
|
|
365
|
-
const SECCOMP_BPF_FILE = (() => {
|
|
366
|
-
const directory = fileURLToPath(new URL(".", import.meta.url));
|
|
367
|
-
if (process.arch === "x64") return join(directory, "seccomp-x86_64.bpf");
|
|
368
|
-
if (process.arch === "arm64") return join(directory, "seccomp-aarch64.bpf");
|
|
369
|
-
return "";
|
|
370
|
-
})();
|
|
371
|
-
|
|
372
|
-
function getSeccompFd(): number | undefined {
|
|
373
|
-
if (!SECCOMP_BPF_FILE) return undefined;
|
|
374
|
-
try {
|
|
375
|
-
return openSync(SECCOMP_BPF_FILE, "r");
|
|
376
|
-
} catch {
|
|
377
|
-
return undefined;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
364
|
function killChild(child: ChildProcess): void {
|
|
382
365
|
if (!child.pid) return;
|
|
383
366
|
try {
|
|
@@ -460,19 +443,13 @@ export function createBwrapBashOperations(
|
|
|
460
443
|
});
|
|
461
444
|
}
|
|
462
445
|
|
|
463
|
-
const seccompFd = resolved.network ? undefined : getSeccompFd();
|
|
464
446
|
const child = spawn(
|
|
465
447
|
findBwrap(resolved.bwrapPath),
|
|
466
|
-
|
|
467
|
-
? [...baseArgs, "--", shell, "-lc", command]
|
|
468
|
-
: [...baseArgs, "--seccomp", "3", "--", shell, "-lc", command],
|
|
448
|
+
[...baseArgs, "--", shell, "-lc", command],
|
|
469
449
|
{
|
|
470
450
|
cwd,
|
|
471
451
|
detached: true,
|
|
472
|
-
stdio:
|
|
473
|
-
seccompFd === undefined
|
|
474
|
-
? ["ignore", "pipe", "pipe"]
|
|
475
|
-
: ["ignore", "pipe", "pipe", seccompFd],
|
|
452
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
476
453
|
env,
|
|
477
454
|
},
|
|
478
455
|
);
|
|
@@ -493,7 +470,6 @@ export function createBwrapBashOperations(
|
|
|
493
470
|
child.once("close", (exitCode) => {
|
|
494
471
|
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
495
472
|
signal?.removeEventListener("abort", onAbort);
|
|
496
|
-
if (seccompFd !== undefined) closeSync(seccompFd);
|
|
497
473
|
if (signal?.aborted) reject(new Error("aborted"));
|
|
498
474
|
else if (timedOut) reject(new Error(`timeout:${timeout}`));
|
|
499
475
|
else resolve({ exitCode });
|
package/src/claude-code/files.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { Type } from "typebox";
|
|
|
17
17
|
import { appendLspDiagnosticText } from "../lib/lsp/diagnostic.js";
|
|
18
18
|
import { type LspService, registerLsp } from "../lib/lsp/lsp.js";
|
|
19
19
|
import { formatSubtitlePath } from "../lib/path.js";
|
|
20
|
+
import type { ToolPendant } from "../lib/pendant.ts";
|
|
20
21
|
import { guardWriteAccess } from "../lib/write-guard.js";
|
|
21
22
|
import {
|
|
22
23
|
type ClaudeCodeState,
|
|
@@ -302,7 +303,10 @@ export function registerFileTools(
|
|
|
302
303
|
content,
|
|
303
304
|
details: {
|
|
304
305
|
reads: { [key]: snapshot },
|
|
305
|
-
pendant: {
|
|
306
|
+
pendant: {
|
|
307
|
+
subtitle: formatSubtitlePath(ctx.cwd, filePath),
|
|
308
|
+
title: "Read",
|
|
309
|
+
} satisfies ToolPendant,
|
|
306
310
|
},
|
|
307
311
|
};
|
|
308
312
|
}
|
|
@@ -354,7 +358,10 @@ export function registerFileTools(
|
|
|
354
358
|
content: [{ type: "text", text: formatted.text }],
|
|
355
359
|
details: {
|
|
356
360
|
reads: { [key]: snapshot },
|
|
357
|
-
pendant: {
|
|
361
|
+
pendant: {
|
|
362
|
+
subtitle: formatSubtitlePath(ctx.cwd, filePath),
|
|
363
|
+
title: "Read",
|
|
364
|
+
} satisfies ToolPendant,
|
|
358
365
|
},
|
|
359
366
|
};
|
|
360
367
|
},
|
|
@@ -566,7 +573,10 @@ export function registerFileTools(
|
|
|
566
573
|
content: [{ type: "text" as const, text }],
|
|
567
574
|
details: {
|
|
568
575
|
...details,
|
|
569
|
-
pendant: {
|
|
576
|
+
pendant: {
|
|
577
|
+
subtitle: formatSubtitlePath(ctx.cwd, filePath, errorCount, warningCount),
|
|
578
|
+
title: "Edit",
|
|
579
|
+
} satisfies ToolPendant,
|
|
570
580
|
},
|
|
571
581
|
};
|
|
572
582
|
},
|
|
Binary file
|
|
Binary file
|