opencode-landstrip 0.17.24 → 0.17.29

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.
Files changed (2) hide show
  1. package/index.ts +22 -16
  2. package/package.json +2 -2
package/index.ts CHANGED
@@ -27,6 +27,7 @@ import {
27
27
  permissionPatterns,
28
28
  permissionType,
29
29
  sandboxSummary,
30
+ readDiscoveryPort,
30
31
  sessionScopeFor,
31
32
  } from './shared.js';
32
33
 
@@ -1223,24 +1224,29 @@ const plugin: Plugin = async ({ client, directory }: PluginInput, options?: Plug
1223
1224
 
1224
1225
  const originalCommand = args.command as string;
1225
1226
 
1226
- // Start a local trap server so landstrip's query traps are answered
1227
- // in-process instead of relying on the TUI plugin's discovery port.
1228
- const trapServer = await startTrapServer(
1229
- effectiveConfig.filesystem.allowRead,
1230
- effectiveConfig.filesystem.allowWrite,
1231
- effectiveConfig.filesystem.denyRead,
1232
- effectiveConfig.filesystem.denyWrite,
1233
- directory,
1234
- sessionAllowedReadPaths,
1235
- sessionAllowedWritePaths,
1236
- sessionAllowedTargets,
1237
- );
1227
+ // The TUI owns interactive query handling. Fall back to an in-process
1228
+ // broker when no TUI endpoint is available (for example, in headless mode).
1229
+ const tuiTrapPort = process.platform === 'linux' ? readDiscoveryPort(directory) : null;
1230
+ const trapServer =
1231
+ tuiTrapPort === null
1232
+ ? await startTrapServer(
1233
+ effectiveConfig.filesystem.allowRead,
1234
+ effectiveConfig.filesystem.allowWrite,
1235
+ effectiveConfig.filesystem.denyRead,
1236
+ effectiveConfig.filesystem.denyWrite,
1237
+ directory,
1238
+ sessionAllowedReadPaths,
1239
+ sessionAllowedWritePaths,
1240
+ sessionAllowedTargets,
1241
+ )
1242
+ : null;
1243
+ const trapPort = tuiTrapPort ?? trapServer?.port ?? null;
1238
1244
 
1239
1245
  const wrappedCommand = buildWrappedCommand(
1240
1246
  policy.path,
1241
1247
  configuredShell ?? process.env.SHELL ?? '/bin/sh',
1242
1248
  originalCommand,
1243
- trapServer.port,
1249
+ trapPort,
1244
1250
  );
1245
1251
 
1246
1252
  activeBash.set(callID, {
@@ -1249,9 +1255,9 @@ const plugin: Plugin = async ({ client, directory }: PluginInput, options?: Plug
1249
1255
  policyDir: policy.dir,
1250
1256
  port: proxyPort,
1251
1257
  stop: proxy ? proxy.stop : null,
1252
- trapServer: trapServer.server,
1253
- trapServerPort: trapServer.port,
1254
- trapLines: trapServer.trapLines,
1258
+ trapServer: trapServer?.server ?? null,
1259
+ trapServerPort: trapPort,
1260
+ trapLines: trapServer?.trapLines ?? [],
1255
1261
  });
1256
1262
 
1257
1263
  args.command = wrappedCommand;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-landstrip",
3
- "version": "0.17.24",
3
+ "version": "0.17.29",
4
4
  "description": "Landlock-based 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": "^0.17.24",
51
+ "@landstrip/landstrip": "^0.17.29",
52
52
  "@opentui/solid": ">=0.3.4",
53
53
  "solid-js": "1.9.12"
54
54
  },