opencode-landstrip 0.16.8 → 0.16.9

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 +10 -5
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -665,12 +665,17 @@ function buildWrappedCommand(
665
665
  if (trapPort === null) return plain;
666
666
 
667
667
  // Connect fd 3 to the TUI's query-response socket BEFORE landstrip applies the
668
- // sandbox, so a denied write can be approved live instead of forcing a re-run.
669
- // The `&&`/`||` guard falls back to the plain (no --trap-fd) invocation when the
670
- // redirect fails — a dead port, a non-bash outer shell without /dev/tcp, or an
671
- // outer `set -e`so a failed connect never hands the broker a dead fd 3.
668
+ // sandbox, so a denied filesystem access can be approved live instead of
669
+ // forcing a re-run.
670
+ //
671
+ // /dev/tcp is a bash/ksh built-init does not work in zsh, dash, or fish.
672
+ // We try the native redirect first (fast path when the host shell supports it)
673
+ // and fall back to an explicit bash invocation that always speaks /dev/tcp.
674
+ // If both fail (no bash, dead port, set -e in the outer shell) landstrip runs
675
+ // without --trap-fd so the toast-notify path still works.
672
676
  const trapped = [landstripBinaryPath(), '--trap-fd', '3', ...baseArgs].map(shellQuote).join(' ');
673
- return `{ exec 3<>/dev/tcp/127.0.0.1/${trapPort} ; } 2>/dev/null && ${trapped} || ${plain}`;
677
+ const bashTrap = `bash -c ${shellQuote(`exec 3<>/dev/tcp/127.0.0.1/${trapPort} && exec "$@"`)} bash ${trapped}`;
678
+ return `{ exec 3<>/dev/tcp/127.0.0.1/${trapPort} ; } 2>/dev/null && ${trapped} || ${bashTrap} 2>/dev/null || ${plain}`;
674
679
  }
675
680
 
676
681
  function isGeneratedWrappedCommand(command: string): boolean {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-landstrip",
3
- "version": "0.16.8",
3
+ "version": "0.16.9",
4
4
  "description": "Landlock-based sandboxing for opencode with landstrip",
5
5
  "keywords": [
6
6
  "landlock",