pi-landstrip 0.15.2 → 0.15.3
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 +13 -6
- package/package.json +2 -2
package/index.ts
CHANGED
|
@@ -97,7 +97,7 @@ interface LandstripBashCallbacks {
|
|
|
97
97
|
onErrorFd?: (data: Buffer) => void;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
const LANDSTRIP_VERSION = [0, 15,
|
|
100
|
+
const LANDSTRIP_VERSION = [0, 15, 9] as const;
|
|
101
101
|
const REQUIRED_LANDSTRIP_VERSION = LANDSTRIP_VERSION.join('.');
|
|
102
102
|
const SUPPORTED_PLATFORMS = new Set<NodeJS.Platform>(['linux', 'darwin', 'win32']);
|
|
103
103
|
|
|
@@ -1238,7 +1238,7 @@ export function createLandstripIntegration(
|
|
|
1238
1238
|
for (const trap of traps) {
|
|
1239
1239
|
if (
|
|
1240
1240
|
trap.kind === 'filesystem' &&
|
|
1241
|
-
trap.operation === 'write' &&
|
|
1241
|
+
(trap.operation === 'write' || trap.operation === 'read') &&
|
|
1242
1242
|
'state' in trap &&
|
|
1243
1243
|
(trap as any).state === 'query' &&
|
|
1244
1244
|
'query_id' in trap
|
|
@@ -1246,23 +1246,30 @@ export function createLandstripIntegration(
|
|
|
1246
1246
|
const queryId = (trap as any).query_id as number;
|
|
1247
1247
|
if (!resolvedQueryIds.has(queryId)) {
|
|
1248
1248
|
resolvedQueryIds.add(queryId);
|
|
1249
|
-
|
|
1249
|
+
handleFsQuery(trapSocket, queryId, trap.operation, trap.file, cwd, ctx).catch(
|
|
1250
|
+
() => {},
|
|
1251
|
+
);
|
|
1250
1252
|
}
|
|
1251
1253
|
}
|
|
1252
1254
|
}
|
|
1253
1255
|
}
|
|
1254
1256
|
});
|
|
1255
1257
|
|
|
1256
|
-
async function
|
|
1258
|
+
async function handleFsQuery(
|
|
1257
1259
|
socket: NetSocket,
|
|
1258
1260
|
queryId: number,
|
|
1261
|
+
operation: 'read' | 'write',
|
|
1259
1262
|
file: string,
|
|
1260
1263
|
cwd: string,
|
|
1261
1264
|
ctx: ExtensionContext,
|
|
1262
1265
|
): Promise<void> {
|
|
1263
|
-
const choice =
|
|
1266
|
+
const choice =
|
|
1267
|
+
operation === 'read'
|
|
1268
|
+
? await promptReadBlock(ctx, file)
|
|
1269
|
+
: await promptWriteBlock(ctx, file);
|
|
1264
1270
|
if (choice !== 'abort') {
|
|
1265
|
-
await
|
|
1271
|
+
if (operation === 'read') await applyReadChoice(choice, file, cwd);
|
|
1272
|
+
else await applyWriteChoice(choice, file, cwd);
|
|
1266
1273
|
}
|
|
1267
1274
|
const action = choice === 'abort' ? 'deny' : 'allow';
|
|
1268
1275
|
const response = JSON.stringify({ query_id: queryId, action }) + '\n';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-landstrip",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.3",
|
|
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
|
-
"@landstrip/landstrip": "^0.15.
|
|
34
|
+
"@landstrip/landstrip": "^0.15.9"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@earendil-works/pi-coding-agent": "^0.79.6",
|