pi-landstrip 0.3.3 → 0.4.0
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 +30 -17
- package/package.json +2 -2
package/index.ts
CHANGED
|
@@ -80,7 +80,7 @@ interface LandstripErrorResponse {
|
|
|
80
80
|
message: string;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
const LANDSTRIP_VERSION = [0,
|
|
83
|
+
const LANDSTRIP_VERSION = [0, 10, 1] as const;
|
|
84
84
|
const SUPPORTED_PLATFORMS = new Set<NodeJS.Platform>(['linux', 'darwin', 'win32']);
|
|
85
85
|
|
|
86
86
|
const DEFAULT_CONFIG: SandboxConfig = {
|
|
@@ -348,25 +348,38 @@ function extractBlockedWritePath(output: string, cwd: string): string | null {
|
|
|
348
348
|
function parseLandstripErrors(output: string): LandstripErrorResponse[] {
|
|
349
349
|
const errors: LandstripErrorResponse[] = [];
|
|
350
350
|
|
|
351
|
-
for (const
|
|
352
|
-
|
|
353
|
-
|
|
351
|
+
for (const block of output.trim().split(/\n\n+/)) {
|
|
352
|
+
const fields: Record<string, string> = {};
|
|
353
|
+
|
|
354
|
+
for (const line of block.split('\n')) {
|
|
355
|
+
const colonIndex = line.indexOf(':');
|
|
356
|
+
if (colonIndex === -1) continue;
|
|
357
|
+
const key = line.slice(0, colonIndex).trim();
|
|
358
|
+
const value = line.slice(colonIndex + 1).trim();
|
|
359
|
+
if (key.length > 0 && value.length > 0) fields[key] = value;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
if (
|
|
363
|
+
fields.category &&
|
|
364
|
+
['policy', 'tool', 'platform', 'system'].includes(fields.category) &&
|
|
365
|
+
fields.message
|
|
366
|
+
) {
|
|
367
|
+
const error: LandstripErrorResponse = {
|
|
368
|
+
category: fields.category as LandstripErrorResponse['category'],
|
|
369
|
+
message: fields.message,
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
if (fields.file) error.file = fields.file;
|
|
373
|
+
if (fields.program) error.program = fields.program;
|
|
354
374
|
|
|
355
375
|
if (
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
typeof parsed.category === 'string' &&
|
|
359
|
-
['policy', 'tool', 'platform', 'system'].includes(parsed.category) &&
|
|
360
|
-
(parsed.type === undefined ||
|
|
361
|
-
(typeof parsed.type === 'string' &&
|
|
362
|
-
['filesystem', 'network', 'platform', 'launch', 'encoding'].includes(parsed.type))) &&
|
|
363
|
-
typeof parsed.message === 'string' &&
|
|
364
|
-
parsed.message.length > 0
|
|
376
|
+
fields.type &&
|
|
377
|
+
['filesystem', 'network', 'platform', 'launch', 'encoding'].includes(fields.type)
|
|
365
378
|
) {
|
|
366
|
-
|
|
379
|
+
error.type = fields.type as LandstripErrorResponse['type'];
|
|
367
380
|
}
|
|
368
|
-
|
|
369
|
-
|
|
381
|
+
|
|
382
|
+
errors.push(error);
|
|
370
383
|
}
|
|
371
384
|
}
|
|
372
385
|
|
|
@@ -1062,7 +1075,7 @@ export function createLandstripIntegration(
|
|
|
1062
1075
|
if (!hasMinimumVersion(version, LANDSTRIP_VERSION)) {
|
|
1063
1076
|
sandboxEnabled = false;
|
|
1064
1077
|
sandboxReady = false;
|
|
1065
|
-
ctx.ui.notify(`landstrip 0.
|
|
1078
|
+
ctx.ui.notify(`landstrip 0.10.1 or newer is required; found: ${version}`, 'error');
|
|
1066
1079
|
return false;
|
|
1067
1080
|
}
|
|
1068
1081
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-landstrip",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Landlock-based sandboxing for pi with interactive permission prompts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"landstrip",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@earendil-works/pi-tui": "^0.78.0",
|
|
34
|
-
"@jarkkojs/landstrip": "^0.
|
|
34
|
+
"@jarkkojs/landstrip": "^0.10.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@earendil-works/pi-coding-agent": "^0.78.0",
|