opencode-landstrip 0.19.11 → 0.19.13
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 +5 -18
- package/package.json +2 -2
- package/shared.ts +2 -0
- package/tui.ts +4 -2
package/index.ts
CHANGED
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
allowsAllDomains,
|
|
22
22
|
canonicalizePath,
|
|
23
23
|
controlResponseLine,
|
|
24
|
-
decodeLandstripTrap,
|
|
25
24
|
evaluateDomainAccess,
|
|
26
25
|
evaluateReadAccess,
|
|
27
26
|
evaluateWriteAccess,
|
|
@@ -31,11 +30,13 @@ import {
|
|
|
31
30
|
getConfigPaths,
|
|
32
31
|
isDomainAllowed,
|
|
33
32
|
isRecord,
|
|
33
|
+
isQueryTrap,
|
|
34
34
|
buildLandstripPolicy,
|
|
35
35
|
landstripBinaryPath,
|
|
36
36
|
loadConfig,
|
|
37
37
|
normalizeOptions,
|
|
38
38
|
parseLandstripTraps,
|
|
39
|
+
parseTrapLine,
|
|
39
40
|
readDiscoveryPort,
|
|
40
41
|
writeLandstripPolicyFile,
|
|
41
42
|
trapSessionHelloLine,
|
|
@@ -262,17 +263,8 @@ function startTrapServer(
|
|
|
262
263
|
buffer = buffer.slice(nl + 1);
|
|
263
264
|
nl = buffer.indexOf('\n');
|
|
264
265
|
if (line.length === 0) continue;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
trap = decodeLandstripTrap(JSON.parse(line));
|
|
268
|
-
} catch {
|
|
269
|
-
trap = null;
|
|
270
|
-
}
|
|
271
|
-
if (
|
|
272
|
-
(trap?.kind === 'filesystem' || trap?.kind === 'network') &&
|
|
273
|
-
trap.state === 'query' &&
|
|
274
|
-
trap.query_id
|
|
275
|
-
) {
|
|
266
|
+
const trap = parseTrapLine(line);
|
|
267
|
+
if (trap && isQueryTrap(trap)) {
|
|
276
268
|
const queryId = trap.query_id;
|
|
277
269
|
if (trap.kind === 'filesystem') {
|
|
278
270
|
const path = canonicalizePath(trap.path, baseDirectory);
|
|
@@ -295,13 +287,8 @@ function startTrapServer(
|
|
|
295
287
|
trapSocket.write(controlResponseLine(queryId, 'deny'));
|
|
296
288
|
trapLines.push(line);
|
|
297
289
|
}
|
|
298
|
-
} else if (
|
|
299
|
-
trap.kind === 'network' &&
|
|
300
|
-
(trap.operation === 'connect' || trap.operation === 'bind')
|
|
301
|
-
) {
|
|
302
|
-
trapSocket.write(controlResponseLine(queryId, 'deny'));
|
|
303
|
-
trapLines.push(line);
|
|
304
290
|
} else {
|
|
291
|
+
trapSocket.write(controlResponseLine(queryId, 'deny'));
|
|
305
292
|
trapLines.push(line);
|
|
306
293
|
}
|
|
307
294
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-landstrip",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.13",
|
|
4
4
|
"description": "OS-level AI command sandboxing for OpenCode with Landstrip",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"landlock",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"ci:test": "npm test"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@landstrip/landstrip-api": "^0.19.
|
|
51
|
+
"@landstrip/landstrip-api": "^0.19.13",
|
|
52
52
|
"@opentui/core": ">=0.5.12",
|
|
53
53
|
"@opentui/solid": ">=0.5.12",
|
|
54
54
|
"solid-js": "1.9.12"
|
package/shared.ts
CHANGED
package/tui.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
controlResponseLine,
|
|
17
17
|
decodeTrapSessionHello,
|
|
18
18
|
getConfigPaths,
|
|
19
|
+
isQueryTrap,
|
|
19
20
|
loadConfig,
|
|
20
21
|
normalizeOptions,
|
|
21
22
|
nextSandboxPermissionIndex,
|
|
@@ -576,8 +577,7 @@ const tui: TuiPlugin.Definition = {
|
|
|
576
577
|
|
|
577
578
|
const allowances = sessionAllowancesFor(sessionAllowances, routeSessionID);
|
|
578
579
|
for (const trap of parseLandstripTraps(line)) {
|
|
579
|
-
if (trap
|
|
580
|
-
if (trap.state !== 'query') continue;
|
|
580
|
+
if (!isQueryTrap(trap)) continue;
|
|
581
581
|
if (seen.has(trap.query_id)) continue;
|
|
582
582
|
seen.add(trap.query_id);
|
|
583
583
|
|
|
@@ -730,6 +730,7 @@ const tui: TuiPlugin.Definition = {
|
|
|
730
730
|
const dimensions = useTerminalDimensions();
|
|
731
731
|
|
|
732
732
|
context.keymap.layer(() => ({
|
|
733
|
+
mode: 'modal',
|
|
733
734
|
enabled: () => landstripOpen(),
|
|
734
735
|
priority: 1000,
|
|
735
736
|
commands: [
|
|
@@ -835,6 +836,7 @@ const tui: TuiPlugin.Definition = {
|
|
|
835
836
|
};
|
|
836
837
|
|
|
837
838
|
context.keymap.layer(() => ({
|
|
839
|
+
mode: 'global',
|
|
838
840
|
commands: [
|
|
839
841
|
{
|
|
840
842
|
id: 'landstrip',
|