@vzn/vx 0.0.594 → 0.0.596

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 (80) hide show
  1. package/README.md +1 -1
  2. package/package.json +5 -5
  3. package/src/bin.ts +26 -11
  4. package/src/cache/archive.ts +2 -2
  5. package/src/cache/cache.ts +235 -174
  6. package/src/cache/chained-cache.ts +25 -7
  7. package/src/cache/config-evals.ts +19 -4
  8. package/src/cache/git-inputs.ts +19 -8
  9. package/src/cache/index.ts +1 -0
  10. package/src/cache/inputs.ts +122 -49
  11. package/src/cache/layer.ts +7 -5
  12. package/src/cache/layered-cache.ts +25 -2
  13. package/src/cache/policy.ts +5 -0
  14. package/src/cache/tar-stream.ts +1 -1
  15. package/src/cache/zstd.ts +10 -4
  16. package/src/cli/cache.ts +11 -15
  17. package/src/cli/completions.ts +42 -6
  18. package/src/cli/foreign-flags.ts +26 -5
  19. package/src/cli/help.ts +5 -3
  20. package/src/cli/init.ts +1 -1
  21. package/src/cli/last.ts +4 -1
  22. package/src/cli/plan-format.ts +9 -0
  23. package/src/cli/plugin-templates.ts +2 -2
  24. package/src/cli/run.ts +60 -42
  25. package/src/cli/select.ts +30 -3
  26. package/src/cli/show.ts +42 -3
  27. package/src/cli/watch-filter.ts +77 -13
  28. package/src/cli/watch-fs.ts +15 -7
  29. package/src/cli/watch-judge.ts +16 -9
  30. package/src/cli/watch.ts +22 -15
  31. package/src/config.ts +26 -26
  32. package/src/exec/env.ts +5 -0
  33. package/src/exec/index.ts +1 -0
  34. package/src/exec/proc-sample.ts +6 -2
  35. package/src/exec/runner.ts +98 -40
  36. package/src/exec/sandbox-paths.ts +12 -6
  37. package/src/exec/sandbox-runtime.ts +136 -44
  38. package/src/exec/sandbox-violations.ts +58 -11
  39. package/src/graph/index.ts +1 -0
  40. package/src/graph/scheduler.ts +29 -13
  41. package/src/graph/task-graph.ts +134 -25
  42. package/src/index.ts +6 -0
  43. package/src/orchestrator/admission.ts +12 -3
  44. package/src/orchestrator/events.ts +10 -1
  45. package/src/orchestrator/execute-task.ts +65 -20
  46. package/src/orchestrator/failure-mode.ts +8 -2
  47. package/src/orchestrator/framed-output.ts +3 -3
  48. package/src/orchestrator/hit-restore.ts +6 -3
  49. package/src/orchestrator/local-shortcircuit.ts +4 -1
  50. package/src/orchestrator/lockfile-claim.ts +43 -46
  51. package/src/orchestrator/logger.ts +11 -6
  52. package/src/orchestrator/metrics.ts +19 -8
  53. package/src/orchestrator/miss-save.ts +2 -2
  54. package/src/orchestrator/options.ts +7 -0
  55. package/src/orchestrator/plan.ts +28 -4
  56. package/src/orchestrator/plugin-host.ts +25 -3
  57. package/src/orchestrator/plugin.ts +39 -17
  58. package/src/orchestrator/prepare.ts +13 -4
  59. package/src/orchestrator/run-artifacts.ts +2 -1
  60. package/src/orchestrator/run.ts +72 -12
  61. package/src/orchestrator/sandbox-request.ts +65 -9
  62. package/src/orchestrator/save-lane.ts +5 -5
  63. package/src/orchestrator/signals.ts +5 -2
  64. package/src/orchestrator/summary.ts +16 -5
  65. package/src/orchestrator/telemetry.ts +16 -7
  66. package/src/util/index.ts +7 -1
  67. package/src/util/paths.ts +23 -3
  68. package/src/util/secret-mask.ts +36 -0
  69. package/src/util/settle.ts +15 -0
  70. package/src/workspace/affected.ts +30 -8
  71. package/src/workspace/config-cache.ts +25 -4
  72. package/src/workspace/config-imports.ts +8 -6
  73. package/src/workspace/config-schema.ts +74 -9
  74. package/src/workspace/filter.ts +19 -0
  75. package/src/workspace/migrate-scripts.ts +5 -3
  76. package/src/workspace/migration.ts +1 -1
  77. package/src/workspace/package-graph.ts +15 -3
  78. package/src/workspace/project-loader.ts +76 -2
  79. package/src/workspace/repo-id.ts +42 -4
  80. package/src/workspace/workspace.ts +98 -20
package/README.md CHANGED
@@ -98,7 +98,7 @@ More: [Quickstart](https://vznjs.github.io/vx/quickstart/) ·
98
98
  Beside `turbo.json` or `nx.json`, `vx init` writes only a
99
99
  `vx.workspace.ts` that maps the old config until then: a temporary
100
100
  start, not a way to run the repo. The numbers above are native vx
101
- config. `@vzn/vx-migrate`'s first npm publish is pending.
101
+ config.
102
102
  [Migration guide](https://vznjs.github.io/vx/guides/migrate/).
103
103
 
104
104
  ## Why it is faster
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vzn/vx",
3
- "version": "0.0.594",
3
+ "version": "0.0.596",
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.594",
25
- "@vzn/vx-linux-arm64": "0.0.594",
26
- "@vzn/vx-darwin-x64": "0.0.594",
27
- "@vzn/vx-darwin-arm64": "0.0.594"
24
+ "@vzn/vx-linux-x64": "0.0.596",
25
+ "@vzn/vx-linux-arm64": "0.0.596",
26
+ "@vzn/vx-darwin-x64": "0.0.596",
27
+ "@vzn/vx-darwin-arm64": "0.0.596"
28
28
  },
29
29
  "dependencies": {
30
30
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
package/src/bin.ts CHANGED
@@ -24,17 +24,10 @@ async function main(): Promise<void> {
24
24
  // costs). Registered before any verb runs; the façade loads on first use.
25
25
  registerCoreAlias(() => import('./index.js') as Promise<Record<string, unknown>>)
26
26
  const code = await run(argv)
27
- // NOTHING calls `process.exit` here, and that is the fix rather than a
28
- // simplification. Bun drops what a pipe has not yet taken when
29
- // `process.exit` follows a large write: 300 KB written then exit
30
- // delivered 64 KiB (128 KiB after a tick), and `vx history --format
31
- // json` on a 300-project workspace was cut mid-string (2026-09-15).
32
- // `stdout.end(cb)` fixed that on 1.4.2 — and on 1.3.11 the callback
33
- // still fires early: 2 MiB written, 214 KB delivered (2026-09-20).
34
- // Setting the code and letting the loop drain is the one form that
35
- // does not depend on when a runtime decides a pipe is flushed; it
36
- // costs a hang if a verb leaves a handle open, which the suite's
37
- // several hundred spawns of this binary would show at once.
27
+ // Not `process.exit` here: Bun drops what a pipe has not yet taken
28
+ // when it follows a large write (300 KB written, 64 KiB delivered;
29
+ // `vx history --format json` was cut mid-string, 2026-09-15). The code
30
+ // is set, and `exitOnceFlushed` exits after both streams have ended.
38
31
  process.exitCode = code
39
32
  } catch (err) {
40
33
  const { fsRefusalHint, isFsRefusal, isOutOfFds, isUserError, OUT_OF_FDS_HINT } =
@@ -65,6 +58,28 @@ async function main(): Promise<void> {
65
58
  process.exitCode = 1
66
59
  }
67
60
  settled = true
61
+ await exitOnceFlushed()
62
+ }
63
+
64
+ /**
65
+ * Exit once stdout and stderr have ended, with the code the verb set. A
66
+ * config can leave a timer behind (a top-level `setInterval`, an await that
67
+ * hit its evaluation budget), and the loop it holds never drained: vx
68
+ * printed its verdict and hung for good. Only after `main` has settled, so
69
+ * `vx watch`, `vx mcp` and a run's kept-alive tasks end when their verb
70
+ * does. `end(cb)` delivers a large write whole on Bun 1.4.2 (4 MiB under a
71
+ * slow reader; `write('', cb)` delivered 450 KB), the floor `engines.bun`
72
+ * holds. A stream whose end never calls back leaves the loop to drain. A
73
+ * signal's handler exits by itself, with the signal's code.
74
+ */
75
+ async function exitOnceFlushed(): Promise<void> {
76
+ if ((await import('./util/index.js')).exitClaimedBySignal()) return
77
+ let open = 2
78
+ const ended = (): void => {
79
+ if (--open === 0) process.exit()
80
+ }
81
+ process.stdout.end(ended)
82
+ process.stderr.end(ended)
68
83
  }
69
84
 
70
85
  // The loop drained while the verb was still pending: something it awaits
@@ -168,7 +168,7 @@ export interface ExecUsage {
168
168
  }
169
169
 
170
170
  /** One regular file in an artifact, with its restore metadata resolved. */
171
- export interface ArchiveEntry {
171
+ interface ArchiveEntry {
172
172
  /** Full archive-relative name, e.g. `outputs/dist/index.js`. */
173
173
  name: string
174
174
  size: number
@@ -192,7 +192,7 @@ export class ArchiveSecurityError extends Error {
192
192
  }
193
193
 
194
194
  /** What `packArtifactStream` packs: stdout plus archive name → absolute source path. */
195
- export interface PackArgs {
195
+ interface PackArgs {
196
196
  /** The cache key, recorded in the sidecar (item 943); ingest refuses an artifact without it. */
197
197
  key?: string
198
198
  stdout: string