@vzn/vx 0.0.401 → 0.0.403

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vzn/vx",
3
- "version": "0.0.401",
3
+ "version": "0.0.403",
4
4
  "description": "The fastest task runner and build cache for JavaScript monorepos.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -21,10 +21,10 @@
21
21
  "node": ">=18"
22
22
  },
23
23
  "optionalDependencies": {
24
- "@vzn/vx-linux-x64": "0.0.401",
25
- "@vzn/vx-linux-arm64": "0.0.401",
26
- "@vzn/vx-darwin-x64": "0.0.401",
27
- "@vzn/vx-darwin-arm64": "0.0.401"
24
+ "@vzn/vx-linux-x64": "0.0.403",
25
+ "@vzn/vx-linux-arm64": "0.0.403",
26
+ "@vzn/vx-darwin-x64": "0.0.403",
27
+ "@vzn/vx-darwin-arm64": "0.0.403"
28
28
  },
29
29
  "dependencies": {
30
30
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
@@ -1891,7 +1891,8 @@ async function runSandboxedOnce(
1891
1891
  config: args.config,
1892
1892
  skip: [taskTmpRoot(), ...srtDefaultWritePaths()],
1893
1893
  })
1894
- if (outside.length > 0) violations.push(outsideWritesHint(outside, baselines.denyRead))
1894
+ if (outside.length > 0)
1895
+ violations.push(outsideWritesHint(outside, baselines.denyRead, args.reportWithin))
1895
1896
  }
1896
1897
 
1897
1898
  // The one denial macOS never logs. MEASURED 2026-09-05, same machine, two
@@ -1959,12 +1960,22 @@ async function runSandboxedOnce(
1959
1960
  }
1960
1961
 
1961
1962
  /** The hint for writes refused outside the project, a few paths named. */
1962
- function outsideWritesHint(paths: readonly string[], walled: readonly string[]): SandboxViolation {
1963
+ function outsideWritesHint(
1964
+ paths: readonly string[],
1965
+ walled: readonly string[],
1966
+ within: string,
1967
+ ): SandboxViolation {
1963
1968
  const shown = paths.slice(0, 5).join(', ')
1964
1969
  const more = paths.length > 5 ? ` and ${paths.length - 5} more` : ''
1965
1970
  const home = toRealPath(os.homedir())
1966
1971
  const dir = path.dirname(paths[0]!)
1967
- const spelled = atOrUnder(dir, home) ? `~${dir.slice(home.length)}` : dir
1972
+ // In the workspace, from the project, as a committed config spells it:
1973
+ // the absolute path held only on the machine that printed it.
1974
+ const spelled = walled.some((w) => atOrUnder(dir, toRealPath(w)))
1975
+ ? path.relative(toRealPath(within), dir) || '.'
1976
+ : atOrUnder(dir, home)
1977
+ ? `~${dir.slice(home.length)}`
1978
+ : dir
1968
1979
  const refused =
1969
1980
  `vx: the sandbox refused writes outside the project, which are not reported as ` +
1970
1981
  `violations: ${shown}${more}.`
@@ -1979,10 +1990,13 @@ function outsideWritesHint(paths: readonly string[], walled: readonly string[]):
1979
1990
  ? `${refused} The task has its own temp directory, empty at its start: write under ` +
1980
1991
  `$TMPDIR (os.tmpdir() in Node and Bun) instead of a fixed path.`
1981
1992
  : `${refused} If the task needs one, grant its directory, e.g. ` +
1982
- `\`allow: { write: ['${spelled}/'] }\`.`
1993
+ `\`allow: { write: [${jsString(`${spelled}/`)}] }\`.`
1983
1994
  return { timestamp: new Date(), hint: true, line }
1984
1995
  }
1985
1996
 
1997
+ /** A path as a JS string literal a config can take: a quote in it is escaped. */
1998
+ const jsString = (p: string): string => (p.includes("'") ? JSON.stringify(p) : `'${p}'`)
1999
+
1986
2000
  /** The host's shared temp directories, canonical: what a fixed temp path in a tool names. */
1987
2001
  function hostTempRoots(): string[] {
1988
2002
  return [...new Set(['/tmp', '/var/tmp', os.tmpdir()].map(toRealPath))]
@@ -1997,7 +2011,7 @@ function hiddenReadsHint(paths: readonly string[], within: string): SandboxViola
1997
2011
  line:
1998
2012
  `vx: the sandbox hid paths outside the project that exist on this machine, which are ` +
1999
2013
  `not reported as violations: ${shown}${more}. If the task reads one, grant it, e.g. ` +
2000
- `\`allow: { read: ['${path.relative(toRealPath(within), paths[0]!)}'] }\`.`,
2014
+ `\`allow: { read: [${jsString(path.relative(toRealPath(within), paths[0]!))}] }\`.`,
2001
2015
  }
2002
2016
  }
2003
2017