opencode-landstrip 0.17.13 → 0.17.14

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 (3) hide show
  1. package/index.ts +12 -2
  2. package/package.json +4 -3
  3. package/tui.ts +6 -0
package/index.ts CHANGED
@@ -100,6 +100,16 @@ function canonicalizePath(filePath: string, baseDirectory: string): string {
100
100
  }
101
101
  }
102
102
 
103
+ function canonicalizeGlobPath(pattern: string, baseDirectory: string): string {
104
+ const abs = expandPath(pattern, baseDirectory);
105
+ const wildcardIndex = abs.indexOf('*');
106
+ if (wildcardIndex === -1) return canonicalizePath(abs, baseDirectory);
107
+
108
+ const prefixEnd = abs.lastIndexOf('/', wildcardIndex);
109
+ const prefix = prefixEnd === 0 ? '/' : abs.slice(0, prefixEnd);
110
+ return canonicalizePath(prefix, baseDirectory) + abs.slice(prefixEnd);
111
+ }
112
+
103
113
  const globRegExpCache = new Map<string, RegExp>();
104
114
 
105
115
  /**
@@ -154,7 +164,7 @@ function matchDepth(filePath: string, patterns: string[], baseDirectory: string)
154
164
 
155
165
  for (const pattern of patterns) {
156
166
  if (pattern.includes('*')) {
157
- const absPattern = expandPath(pattern, baseDirectory);
167
+ const absPattern = canonicalizeGlobPath(pattern, baseDirectory);
158
168
  if (globToRegExp(absPattern).test(abs)) depth = Math.max(depth, pathDepth(abs));
159
169
  } else {
160
170
  const absPattern = canonicalizePath(pattern, baseDirectory);
@@ -171,7 +181,7 @@ function matchDepth(filePath: string, patterns: string[], baseDirectory: string)
171
181
  function resolveFilesystemPatterns(patterns: string[], baseDirectory: string): string[] {
172
182
  return patterns.map((pattern) =>
173
183
  pattern.includes('*')
174
- ? expandPath(pattern, baseDirectory)
184
+ ? canonicalizeGlobPath(pattern, baseDirectory)
175
185
  : canonicalizePath(pattern, baseDirectory),
176
186
  );
177
187
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-landstrip",
3
- "version": "0.17.13",
3
+ "version": "0.17.14",
4
4
  "description": "Landlock-based sandboxing for opencode with landstrip",
5
5
  "keywords": [
6
6
  "landlock",
@@ -48,8 +48,9 @@
48
48
  "ci:test": "npm test"
49
49
  },
50
50
  "dependencies": {
51
- "@landstrip/landstrip": "^0.17.13",
52
- "@opentui/solid": ">=0.3.4"
51
+ "@landstrip/landstrip": "^0.17.14",
52
+ "@opentui/solid": ">=0.3.4",
53
+ "solid-js": "1.9.12"
53
54
  },
54
55
  "devDependencies": {
55
56
  "@opencode-ai/plugin": "^1.17.7",
package/tui.ts CHANGED
@@ -96,6 +96,7 @@ const tui: TuiPlugin = async (api, options, meta) => {
96
96
  const resolved = new Set<string>();
97
97
  const queue: QueueEntry[] = [];
98
98
  let activeId: string | undefined;
99
+ let refreshSandboxStatus: (() => void) | undefined;
99
100
 
100
101
  // Paths the user approved "for session": later queries for the same path are
101
102
  // auto-allowed without a dialog. This lives only in the TUI process — the
@@ -580,6 +581,7 @@ const tui: TuiPlugin = async (api, options, meta) => {
580
581
  message,
581
582
  onConfirm: () => {
582
583
  const scope = setSandboxConfigEnabled(directory, next);
584
+ refreshSandboxStatus?.();
583
585
  api.ui.toast({
584
586
  title: 'Sandbox',
585
587
  message: `Sandbox ${next ? 'enabled' : 'disabled'} (${scope} config)`,
@@ -623,7 +625,10 @@ const tui: TuiPlugin = async (api, options, meta) => {
623
625
  // differently still loads the plugin — the badge just stays absent there.
624
626
  try {
625
627
  const { jsx } = await import('@opentui/solid/jsx-runtime');
628
+ const { createSignal } = await import('solid-js');
629
+ const [sandboxRevision, setSandboxRevision] = createSignal(0);
626
630
  const statusBadge = (ctx: TuiSlotContext) => {
631
+ sandboxRevision();
627
632
  const directory = api.state.path.directory || process.cwd();
628
633
  const config = loadConfig(directory, optionOverrides);
629
634
  const theme = ctx.theme.current;
@@ -644,6 +649,7 @@ const tui: TuiPlugin = async (api, options, meta) => {
644
649
  },
645
650
  };
646
651
  api.slots.register(statusSlot);
652
+ refreshSandboxStatus = () => setSandboxRevision((revision) => revision + 1);
647
653
  } catch {
648
654
  // Solid runtime unavailable on this host — skip the status badge.
649
655
  }