@vzn/vx 0.0.636 → 0.0.637
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/README.md +39 -11
- package/docs/caching.md +213 -207
- package/docs/cli.md +699 -655
- package/docs/execution.md +67 -75
- package/docs/features.md +44 -40
- package/docs/patterns.md +26 -25
- package/docs/schema.md +376 -198
- package/docs/security.md +76 -39
- package/launcher.sh +43 -0
- package/package.json +5 -5
- package/schemas/cache.json +41 -19
- package/schemas/info.json +23 -11
- package/schemas/last.json +48 -2
- package/schemas/lock.json +1 -1
- package/schemas/plan.json +2 -2
- package/schemas/show.json +5 -3
- package/schemas/why.json +15 -1
- package/skills/vx/SKILL.md +16 -12
- package/src/bin.ts +17 -2
- package/src/cache/archive.ts +11 -0
- package/src/cache/cache.ts +105 -53
- package/src/cache/git-inputs.ts +277 -63
- package/src/cache/index.ts +7 -1
- package/src/cache/inputs.ts +125 -35
- package/src/cache/key-fold.ts +8 -7
- package/src/cache/layer.ts +8 -17
- package/src/cache/layered-cache.ts +16 -102
- package/src/cache/policy.ts +25 -29
- package/src/cache/run-history.ts +36 -14
- package/src/cache/schema.ts +21 -23
- package/src/cache/scoped-cache.ts +224 -0
- package/src/cli/cache.ts +150 -28
- package/src/cli/completions.ts +2 -2
- package/src/cli/core-alias.ts +1 -1
- package/src/cli/foreign-flags.ts +13 -12
- package/src/cli/help.ts +94 -63
- package/src/cli/index.ts +42 -13
- package/src/cli/info.ts +38 -23
- package/src/cli/init.ts +115 -406
- package/src/cli/last.ts +145 -4
- package/src/cli/lock.ts +333 -111
- package/src/cli/plan-format.ts +2 -2
- package/src/cli/plugin-commands.ts +5 -9
- package/src/cli/plugin-templates.ts +10 -10
- package/src/cli/run.ts +103 -149
- package/src/cli/select.ts +33 -39
- package/src/cli/show.ts +17 -19
- package/src/cli/task-verb.ts +2 -9
- package/src/cli/upgrade.ts +402 -145
- package/src/cli/watch-cycle.ts +9 -2
- package/src/cli/watch-filter.ts +33 -60
- package/src/cli/watch-fs.ts +29 -16
- package/src/cli/watch-judge.ts +12 -3
- package/src/cli/watch-set.ts +16 -42
- package/src/cli/watch.ts +188 -215
- package/src/cli/why.ts +28 -17
- package/src/cli/workspace-config.ts +31 -68
- package/src/config.ts +169 -70
- package/src/exec/env.ts +1 -31
- package/src/exec/executor.ts +1 -5
- package/src/exec/kill-tree.ts +2 -1
- package/src/exec/sandbox-runtime.ts +12 -1
- package/src/exec/sandbox-violations.ts +9 -1
- package/src/graph/dependency-spec.ts +1 -1
- package/src/graph/index.ts +1 -0
- package/src/graph/priorities.ts +1 -1
- package/src/graph/scheduler.ts +19 -7
- package/src/graph/task-graph.ts +44 -20
- package/src/handoff.ts +169 -0
- package/src/index.ts +24 -57
- package/src/orchestrator/affected-tasks.ts +7 -5
- package/src/orchestrator/command-windows.ts +44 -0
- package/src/orchestrator/deferred-outputs.ts +12 -10
- package/src/orchestrator/doctor.ts +98 -110
- package/src/orchestrator/download-policy.ts +3 -3
- package/src/orchestrator/events.ts +19 -3
- package/src/orchestrator/excluded-keys.ts +0 -2
- package/src/orchestrator/execute-task.ts +158 -63
- package/src/orchestrator/fingerprint-watch.ts +18 -15
- package/src/orchestrator/forecast.ts +10 -2
- package/src/orchestrator/framed-output.ts +8 -3
- package/src/orchestrator/graph-stage.ts +5 -5
- package/src/orchestrator/history.ts +70 -30
- package/src/orchestrator/hit-restore.ts +15 -3
- package/src/orchestrator/index.ts +18 -4
- package/src/orchestrator/local-shortcircuit.ts +2 -1
- package/src/orchestrator/lockfile-claim.ts +79 -20
- package/src/orchestrator/logger.ts +71 -39
- package/src/orchestrator/metrics.ts +71 -6
- package/src/orchestrator/miss-save.ts +3 -0
- package/src/orchestrator/options.ts +42 -29
- package/src/orchestrator/output-host.ts +72 -0
- package/src/orchestrator/plan.ts +6 -8
- package/src/orchestrator/plugin-host.ts +87 -63
- package/src/orchestrator/plugin.ts +94 -60
- package/src/orchestrator/prepare.ts +113 -72
- package/src/orchestrator/projects.ts +102 -99
- package/src/orchestrator/remote-prefetch.ts +2 -1
- package/src/orchestrator/run-context.ts +25 -6
- package/src/orchestrator/run-failures.ts +17 -8
- package/src/orchestrator/run-lock.ts +1 -1
- package/src/orchestrator/run-report.ts +9 -9
- package/src/orchestrator/run-settings.ts +48 -0
- package/src/orchestrator/run.ts +121 -95
- package/src/orchestrator/sandbox-fix.ts +39 -20
- package/src/orchestrator/sandbox-request.ts +84 -13
- package/src/orchestrator/signals.ts +1 -1
- package/src/orchestrator/stable-keys.ts +13 -11
- package/src/orchestrator/status-line.ts +48 -6
- package/src/orchestrator/summary.ts +46 -62
- package/src/orchestrator/task-hash.ts +12 -83
- package/src/orchestrator/telemetry.ts +3 -3
- package/src/settings.ts +417 -0
- package/src/util/errors.ts +1 -1
- package/src/util/essential-env.ts +31 -0
- package/src/util/hide-env.ts +107 -0
- package/src/util/index.ts +8 -2
- package/src/util/paths.ts +10 -0
- package/src/util/settle.ts +49 -30
- package/src/util/size.ts +23 -4
- package/src/util/timing.ts +3 -2
- package/src/util/ulid.ts +1 -1
- package/src/util/verbs.ts +0 -15
- package/src/workspace/affected.ts +77 -222
- package/src/workspace/config-eval.ts +15 -20
- package/src/workspace/config-imports.ts +78 -3
- package/src/workspace/config-schema.ts +209 -268
- package/src/workspace/dependency-rules.ts +57 -0
- package/src/workspace/filter.ts +2 -2
- package/src/workspace/fingerprint.ts +11 -121
- package/src/workspace/index.ts +20 -27
- package/src/workspace/load-reads.ts +4 -4
- package/src/workspace/lockfile.ts +96 -140
- package/src/workspace/migration.ts +242 -146
- package/src/workspace/package-graph.ts +30 -216
- package/src/workspace/project-loader.ts +80 -285
- package/src/workspace/repo-id.ts +2 -1
- package/src/workspace/workspace.ts +362 -831
- package/src/cache/config-evals.ts +0 -130
- package/src/workspace/config-cache.ts +0 -661
- package/src/workspace/migrate-scripts.ts +0 -1121
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
// The config-evaluation cache tables (`config_evals`, `config_closures`):
|
|
2
|
-
// what `workspace/config-cache.ts` reads and writes through the
|
|
3
|
-
// `ConfigEvalStore` contract, honouring the run's local read/write axes.
|
|
4
|
-
// Owns its statements over the store's handle; `Cache` delegates.
|
|
5
|
-
|
|
6
|
-
import type { Database, SQLQueryBindings } from 'bun:sqlite'
|
|
7
|
-
import { lazyStatement } from './schema.js'
|
|
8
|
-
|
|
9
|
-
const CONFIG_EVALS_SWEPT_AT = 'config_evals_swept_at'
|
|
10
|
-
const DAY_MS = 24 * 60 * 60 * 1000
|
|
11
|
-
|
|
12
|
-
export class ConfigEvalTable {
|
|
13
|
-
private readonly selectConfigEval: ReturnType<Database['prepare']>
|
|
14
|
-
private readonly insertConfigEval: ReturnType<Database['prepare']>
|
|
15
|
-
private readonly upsertConfigClosure: ReturnType<Database['prepare']>
|
|
16
|
-
private readonly read: boolean
|
|
17
|
-
private readonly write: boolean
|
|
18
|
-
|
|
19
|
-
constructor(
|
|
20
|
-
private readonly db: Database,
|
|
21
|
-
policy: { read: boolean; write: boolean },
|
|
22
|
-
) {
|
|
23
|
-
this.read = policy.read
|
|
24
|
-
this.write = policy.write
|
|
25
|
-
this.selectConfigEval = lazyStatement(this.db, 'SELECT json FROM config_evals WHERE key = ?')
|
|
26
|
-
this.insertConfigEval = lazyStatement(
|
|
27
|
-
this.db,
|
|
28
|
-
'INSERT OR REPLACE INTO config_evals(key, json, created_at) VALUES (?, ?, ?)',
|
|
29
|
-
)
|
|
30
|
-
this.upsertConfigClosure = lazyStatement(
|
|
31
|
-
this.db,
|
|
32
|
-
'INSERT INTO config_closures(config_path, files_json, created_at) VALUES (?, ?, ?) ON CONFLICT(config_path) DO UPDATE SET files_json = excluded.files_json, created_at = excluded.created_at',
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** `ConfigEvalStore`: a cached config evaluation, honouring the local READ axis. */
|
|
37
|
-
getConfigEval(key: string): string | null {
|
|
38
|
-
if (!this.read) return null
|
|
39
|
-
const row = this.selectConfigEval.get(key) as { json: string } | null
|
|
40
|
-
return row?.json ?? null
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** `ConfigEvalStore`: each config's ordered closure, one `IN` query per 900 paths. */
|
|
44
|
-
getConfigClosures(configPaths: readonly string[]): Map<string, string[]> {
|
|
45
|
-
const out = new Map<string, string[]>()
|
|
46
|
-
if (!this.read || configPaths.length === 0) return out
|
|
47
|
-
for (let i = 0; i < configPaths.length; i += 900) {
|
|
48
|
-
const chunk = configPaths.slice(i, i + 900)
|
|
49
|
-
const rows = this.db
|
|
50
|
-
.query(
|
|
51
|
-
`SELECT config_path, files_json FROM config_closures WHERE config_path IN (${chunk.map(() => '?').join(',')})`,
|
|
52
|
-
)
|
|
53
|
-
.all(...(chunk as readonly SQLQueryBindings[])) as Array<{
|
|
54
|
-
config_path: string
|
|
55
|
-
files_json: string
|
|
56
|
-
}>
|
|
57
|
-
for (const r of rows) out.set(r.config_path, JSON.parse(r.files_json) as string[])
|
|
58
|
-
}
|
|
59
|
-
return out
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/** `ConfigEvalStore`: remember a config's ordered closure, honouring the local WRITE axis. */
|
|
63
|
-
putConfigClosure(configPath: string, files: readonly string[]): void {
|
|
64
|
-
if (!this.write) return
|
|
65
|
-
this.upsertConfigClosure.run(configPath, JSON.stringify(files), Date.now())
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/** `ConfigEvalStore`: a round's closures in ONE transaction (each upsert was its own, item 615). */
|
|
69
|
-
putConfigClosures(entries: ReadonlyArray<readonly [string, readonly string[]]>): void {
|
|
70
|
-
if (!this.write || entries.length === 0) return
|
|
71
|
-
const now = Date.now()
|
|
72
|
-
this.db.transaction(() => {
|
|
73
|
-
for (const [configPath, files] of entries)
|
|
74
|
-
this.upsertConfigClosure.run(configPath, JSON.stringify(files), now)
|
|
75
|
-
})()
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** `ConfigEvalStore`: the batched read — one `IN` query per 900 keys, honouring the local READ axis. */
|
|
79
|
-
getConfigEvals(keys: readonly string[]): Map<string, string> {
|
|
80
|
-
const out = new Map<string, string>()
|
|
81
|
-
if (!this.read || keys.length === 0) return out
|
|
82
|
-
for (let i = 0; i < keys.length; i += 900) {
|
|
83
|
-
const chunk = keys.slice(i, i + 900)
|
|
84
|
-
const rows = this.db
|
|
85
|
-
.query(
|
|
86
|
-
`SELECT key, json FROM config_evals WHERE key IN (${chunk.map(() => '?').join(',')})`,
|
|
87
|
-
)
|
|
88
|
-
.all(...(chunk as readonly SQLQueryBindings[])) as Array<{ key: string; json: string }>
|
|
89
|
-
for (const r of rows) out.set(r.key, r.json)
|
|
90
|
-
}
|
|
91
|
-
return out
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/** `ConfigEvalStore`: remember a validated evaluation, honouring the local WRITE axis. */
|
|
95
|
-
putConfigEval(key: string, json: string): void {
|
|
96
|
-
if (!this.write) return
|
|
97
|
-
this.insertConfigEval.run(key, json, Date.now())
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/** `ConfigEvalStore`: a round's evaluations in ONE transaction. */
|
|
101
|
-
putConfigEvals(entries: ReadonlyArray<readonly [string, string]>): void {
|
|
102
|
-
if (!this.write || entries.length === 0) return
|
|
103
|
-
const now = Date.now()
|
|
104
|
-
this.db.transaction(() => {
|
|
105
|
-
for (const [key, json] of entries) this.insertConfigEval.run(key, json, now)
|
|
106
|
-
})()
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Retention: a row not WRITTEN since `cutoff`. A hit does not refresh it
|
|
111
|
-
* (that would be a write per config on every warm run), so a config that
|
|
112
|
-
* hit for thirty days is evaluated once more and stored again. No index
|
|
113
|
-
* covers `created_at`, so each sweep reads every row with its JSON (1–6 ms
|
|
114
|
-
* at 8,000 rows, 2 MB); it runs once a day, on its own clock in
|
|
115
|
-
* `schema_meta`, as the file-hash sweep does.
|
|
116
|
-
*/
|
|
117
|
-
pruneOlderThan(cutoff: number, now: number = Date.now()): void {
|
|
118
|
-
const last = this.db
|
|
119
|
-
.prepare('SELECT value FROM schema_meta WHERE key = ?')
|
|
120
|
-
.get(CONFIG_EVALS_SWEPT_AT) as { value: string } | null
|
|
121
|
-
if (last !== null && now - Number(last.value) < DAY_MS) return
|
|
122
|
-
this.db.transaction(() => {
|
|
123
|
-
this.db.prepare('DELETE FROM config_evals WHERE created_at < ?').run(cutoff)
|
|
124
|
-
this.db.prepare('DELETE FROM config_closures WHERE created_at < ?').run(cutoff)
|
|
125
|
-
this.db
|
|
126
|
-
.prepare('INSERT OR REPLACE INTO schema_meta(key, value) VALUES (?, ?)')
|
|
127
|
-
.run(CONFIG_EVALS_SWEPT_AT, String(now))
|
|
128
|
-
})()
|
|
129
|
-
}
|
|
130
|
-
}
|