@vibe-agent-toolkit/cli 0.2.0-rc.8 → 0.2.0-rc.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.
- package/dist/commands/audit/provenance.d.ts.map +1 -1
- package/dist/commands/audit/provenance.js +4 -3
- package/dist/commands/audit/provenance.js.map +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +2 -1
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/cache/clear.d.ts +17 -3
- package/dist/commands/cache/clear.d.ts.map +1 -1
- package/dist/commands/cache/clear.js +17 -3
- package/dist/commands/cache/clear.js.map +1 -1
- package/dist/commands/cache/index.d.ts.map +1 -1
- package/dist/commands/cache/index.js +19 -10
- package/dist/commands/cache/index.js.map +1 -1
- package/dist/commands/claude/context.d.ts +2 -2
- package/dist/commands/claude/context.js +4 -4
- package/dist/commands/claude/context.js.map +1 -1
- package/dist/commands/claude/index.d.ts +12 -11
- package/dist/commands/claude/index.d.ts.map +1 -1
- package/dist/commands/claude/index.js +14 -16
- package/dist/commands/claude/index.js.map +1 -1
- package/dist/commands/claude/marketplace/git-publish.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/git-publish.js +19 -10
- package/dist/commands/claude/marketplace/git-publish.js.map +1 -1
- package/dist/commands/claude/marketplace/validate.js +2 -2
- package/dist/commands/claude/marketplace/validate.js.map +1 -1
- package/dist/commands/claude/org/skills.js +8 -8
- package/dist/commands/claude/org/skills.js.map +1 -1
- package/dist/commands/claude/plugin/build.d.ts.map +1 -1
- package/dist/commands/claude/plugin/build.js +11 -21
- package/dist/commands/claude/plugin/build.js.map +1 -1
- package/dist/commands/claude/plugin/plugin-files.js +3 -3
- package/dist/commands/claude/plugin/plugin-files.js.map +1 -1
- package/dist/commands/consistency-check.d.ts +11 -5
- package/dist/commands/consistency-check.d.ts.map +1 -1
- package/dist/commands/consistency-check.js +113 -78
- package/dist/commands/consistency-check.js.map +1 -1
- package/dist/commands/resources/check-progress.d.ts +6 -0
- package/dist/commands/resources/check-progress.d.ts.map +1 -1
- package/dist/commands/resources/check-progress.js +10 -2
- package/dist/commands/resources/check-progress.js.map +1 -1
- package/dist/commands/resources/check.d.ts +182 -203
- package/dist/commands/resources/check.d.ts.map +1 -1
- package/dist/commands/resources/check.js +272 -248
- package/dist/commands/resources/check.js.map +1 -1
- package/dist/commands/resources/index.d.ts.map +1 -1
- package/dist/commands/resources/index.js +140 -23
- package/dist/commands/resources/index.js.map +1 -1
- package/dist/commands/resources/query.d.ts +2 -2
- package/dist/commands/resources/query.d.ts.map +1 -1
- package/dist/commands/resources/query.js +20 -10
- package/dist/commands/resources/query.js.map +1 -1
- package/dist/commands/skill/test/run.js +3 -3
- package/dist/commands/skill/test/run.js.map +1 -1
- package/dist/commands/skills/build.d.ts +34 -21
- package/dist/commands/skills/build.d.ts.map +1 -1
- package/dist/commands/skills/build.js +99 -50
- package/dist/commands/skills/build.js.map +1 -1
- package/dist/commands/skills/skill-discovery.d.ts +15 -13
- package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
- package/dist/commands/skills/skill-discovery.js +23 -4
- package/dist/commands/skills/skill-discovery.js.map +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +31 -8
- package/dist/commands/validate.js.map +1 -1
- package/dist/commands/verify.d.ts +10 -4
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +92 -65
- package/dist/commands/verify.js.map +1 -1
- package/dist/report-schemas.d.ts.map +1 -1
- package/dist/report-schemas.js +0 -2
- package/dist/report-schemas.js.map +1 -1
- package/dist/skill-resolution/classify.js +2 -2
- package/dist/skill-resolution/classify.js.map +1 -1
- package/dist/skill-resolution/resolve-skill-reference.d.ts.map +1 -1
- package/dist/skill-resolution/resolve-skill-reference.js +48 -52
- package/dist/skill-resolution/resolve-skill-reference.js.map +1 -1
- package/dist/utils/claude-context-lens.d.ts +34 -0
- package/dist/utils/claude-context-lens.d.ts.map +1 -0
- package/dist/utils/claude-context-lens.js +39 -0
- package/dist/utils/claude-context-lens.js.map +1 -0
- package/dist/utils/projection-lenses.d.ts +98 -0
- package/dist/utils/projection-lenses.d.ts.map +1 -0
- package/dist/utils/projection-lenses.js +203 -0
- package/dist/utils/projection-lenses.js.map +1 -0
- package/dist/utils/projection-query.d.ts +38 -14
- package/dist/utils/projection-query.d.ts.map +1 -1
- package/dist/utils/projection-query.js +78 -17
- package/dist/utils/projection-query.js.map +1 -1
- package/dist/utils/projection-store.d.ts +61 -42
- package/dist/utils/projection-store.d.ts.map +1 -1
- package/dist/utils/projection-store.js +155 -59
- package/dist/utils/projection-store.js.map +1 -1
- package/dist/utils/relation-limits.d.ts +50 -0
- package/dist/utils/relation-limits.d.ts.map +1 -0
- package/dist/utils/relation-limits.js +50 -0
- package/dist/utils/relation-limits.js.map +1 -0
- package/dist/utils/skill-discovery.d.ts.map +1 -1
- package/dist/utils/skill-discovery.js +2 -1
- package/dist/utils/skill-discovery.js.map +1 -1
- package/dist/utils/skill-packaging-config.d.ts +38 -3
- package/dist/utils/skill-packaging-config.d.ts.map +1 -1
- package/dist/utils/skill-packaging-config.js +28 -3
- package/dist/utils/skill-packaging-config.js.map +1 -1
- package/package.json +16 -16
- package/schemas/resources-check.json +43 -0
- package/dist/commands/claude/budget.d.ts +0 -269
- package/dist/commands/claude/budget.d.ts.map +0 -1
- package/dist/commands/claude/budget.js +0 -507
- package/dist/commands/claude/budget.js.map +0 -1
- package/dist/utils/context-budget-issues.d.ts +0 -108
- package/dist/utils/context-budget-issues.d.ts.map +0 -1
- package/dist/utils/context-budget-issues.js +0 -280
- package/dist/utils/context-budget-issues.js.map +0 -1
- package/schemas/claude-budget.json +0 -197
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
import { performance } from 'node:perf_hooks';
|
|
49
49
|
import { allDerivedSpecs, buildResourceProjection, PROJECTION_TABLES, splitProjectionByScope, } from '@vibe-agent-toolkit/resources';
|
|
50
50
|
import { gitTrackerForProjectRoot } from '../commands/audit/distributed-tree.js';
|
|
51
|
-
import { evaluateAuthoredLenses } from './edge-lens-evaluation.js';
|
|
52
51
|
import { populationWiring } from './population-wiring.js';
|
|
53
|
-
import {
|
|
52
|
+
import { evaluateLens, lensesNamedBy } from './projection-lenses.js';
|
|
53
|
+
import { openCompileProbe, openEphemeralQueryStore, withPopulationCache } from './projection-store.js';
|
|
54
54
|
/**
|
|
55
55
|
* The tree hash an in-memory store's one population is filed under.
|
|
56
56
|
*
|
|
@@ -61,8 +61,10 @@ import { openEphemeralQueryStore, withPopulationCache } from './projection-store
|
|
|
61
61
|
* would invite the reader to believe the ephemeral store is shareable.
|
|
62
62
|
*/
|
|
63
63
|
const EPHEMERAL_TREE_HASH = 'ephemeral';
|
|
64
|
+
/** What SQLite says when a statement names a table the schema does not have. */
|
|
65
|
+
const TABLE_NOT_FOUND = 'no such table:';
|
|
64
66
|
/** What SQLite says when a statement names something the schema does not have. */
|
|
65
|
-
const NAME_NOT_FOUND = [
|
|
67
|
+
const NAME_NOT_FOUND = [TABLE_NOT_FOUND, 'no such column:'];
|
|
66
68
|
/**
|
|
67
69
|
* Compile every statement a run intends to ask, against the schema and NO rows,
|
|
68
70
|
* before anything is populated.
|
|
@@ -107,7 +109,11 @@ const NAME_NOT_FOUND = ['no such table:', 'no such column:'];
|
|
|
107
109
|
export async function assertQueriesCompile(statements) {
|
|
108
110
|
if (statements.length === 0)
|
|
109
111
|
return;
|
|
110
|
-
|
|
112
|
+
// 🔑 A compile PROBE, not the query store: this runs before any lens is
|
|
113
|
+
// evaluated, and the query store has no table for an unevaluated relation.
|
|
114
|
+
// The probe carries every derived relation and cannot answer a query, so its
|
|
115
|
+
// empty tables can never be read as a result.
|
|
116
|
+
const probe = await openCompileProbe();
|
|
111
117
|
try {
|
|
112
118
|
for (const { sql, parameters } of statements) {
|
|
113
119
|
try {
|
|
@@ -133,9 +139,13 @@ export async function assertQueriesCompile(statements) {
|
|
|
133
139
|
* @param options.preflight - Every statement this run intends to ask, compiled
|
|
134
140
|
* against the empty schema BEFORE the population starts. See
|
|
135
141
|
* {@link assertQueriesCompile}
|
|
136
|
-
* @param
|
|
137
|
-
*
|
|
138
|
-
* it
|
|
142
|
+
* @param options.statements - Every statement this run may ask, for LENS
|
|
143
|
+
* SELECTION only — never compiled, never bound, and deliberately separate from
|
|
144
|
+
* `preflight`. ⛔ Omitting it evaluates EVERY lens, which is the correct answer
|
|
145
|
+
* and the expensive one
|
|
146
|
+
* @param work - Given the asker, where its rows came from, how much of the tree
|
|
147
|
+
* they cover, and the ROWS THEMSELVES. The store is open for exactly this call
|
|
148
|
+
* and closed however it ends
|
|
139
149
|
* @returns Whatever `work` returned
|
|
140
150
|
*/
|
|
141
151
|
export async function withQueriedProjection(options, work) {
|
|
@@ -205,15 +215,25 @@ export async function withQueriedProjection(options, work) {
|
|
|
205
215
|
// prevent. Overlapping spans also made `populationSecs + lensSecs`
|
|
206
216
|
// over-count wall time for anyone who added them.
|
|
207
217
|
const populationMs = performance.now() - populationStart;
|
|
208
|
-
// The
|
|
209
|
-
//
|
|
210
|
-
//
|
|
211
|
-
//
|
|
212
|
-
//
|
|
213
|
-
//
|
|
214
|
-
//
|
|
218
|
+
// 🔑 The lenses this run's statements NAME, and no others — zones.md §2
|
|
219
|
+
// carries why. The relations are still not behind a flag: a surface that
|
|
220
|
+
// exists only when somebody remembered a flag is one nobody writes a check
|
|
221
|
+
// against. What decides is the statement, which cannot be forgotten.
|
|
222
|
+
//
|
|
223
|
+
// ⛔ The narrowing is safe ONLY because an unevaluated relation does not
|
|
224
|
+
// EXIST in `store`: the backend creates a derived table on the write that
|
|
225
|
+
// fills it, so a statement naming one no lens filled fails `no such table`
|
|
226
|
+
// in SQLite itself — whatever spelling slipped past the selector's scan —
|
|
227
|
+
// and {@link describeQueryFailure} says why. Create the relations up front
|
|
228
|
+
// and this becomes a silent wrong answer: an empty table selecting zero rows.
|
|
229
|
+
const lenses = lensesNamedBy(options.statements);
|
|
215
230
|
const lensStart = performance.now();
|
|
216
|
-
|
|
231
|
+
for (const lens of lenses) {
|
|
232
|
+
// Sequential, not `Promise.all`: a lens may populate, and two
|
|
233
|
+
// populations racing for one projection store is the concurrency this
|
|
234
|
+
// lane has no reason to invite.
|
|
235
|
+
await store.writeDerived(await evaluateLens(lens, { projection, root, logger, cache }));
|
|
236
|
+
}
|
|
217
237
|
const lensMs = performance.now() - lensStart;
|
|
218
238
|
// The shared setup is done. Everything after this line is the caller's.
|
|
219
239
|
const ask = (sql, ...parameters) => {
|
|
@@ -224,12 +244,17 @@ export async function withQueriedProjection(options, work) {
|
|
|
224
244
|
throw new Error(describeQueryFailure(sql, error instanceof Error ? error.message : String(error)));
|
|
225
245
|
}
|
|
226
246
|
};
|
|
227
|
-
return await work(ask, {
|
|
247
|
+
return await work(ask, {
|
|
248
|
+
population: contributorRecords === 0 ? 'store' : 'derived',
|
|
249
|
+
populationMs,
|
|
250
|
+
lensMs,
|
|
251
|
+
lensesEvaluated: lenses.map((lens) => lens.name),
|
|
252
|
+
},
|
|
228
253
|
// Read off the PROJECTION rather than counted back out of the store with
|
|
229
254
|
// a `SELECT COUNT(*)`: a count that travelled through the same `ask` the
|
|
230
255
|
// caller's statements do would be broken by the very schema drift it
|
|
231
256
|
// exists to survive, and it is the population's size either way.
|
|
232
|
-
{ membersEnumerated: projection.resourceRealizations.length });
|
|
257
|
+
{ membersEnumerated: projection.resourceRealizations.length }, projection);
|
|
233
258
|
}
|
|
234
259
|
finally {
|
|
235
260
|
// Closed however the work ends. An in-memory database is reclaimed with the
|
|
@@ -239,6 +264,25 @@ export async function withQueriedProjection(options, work) {
|
|
|
239
264
|
}
|
|
240
265
|
});
|
|
241
266
|
}
|
|
267
|
+
/**
|
|
268
|
+
* The derived relation a `no such table` failure names, if it names one.
|
|
269
|
+
*
|
|
270
|
+
* SQLite echoes the reference as written — `edges`, `EDGES`, `main.edges` — so
|
|
271
|
+
* the schema prefix is dropped and the comparison case-folds, as SQLite's own
|
|
272
|
+
* name resolution does. Names come from the relation registry, never a list
|
|
273
|
+
* kept here.
|
|
274
|
+
*
|
|
275
|
+
* @param message - What the engine said
|
|
276
|
+
* @returns The relation's registry spelling, or undefined
|
|
277
|
+
*/
|
|
278
|
+
function unevaluatedRelationIn(message) {
|
|
279
|
+
const at = message.indexOf(TABLE_NOT_FOUND);
|
|
280
|
+
if (at === -1)
|
|
281
|
+
return undefined;
|
|
282
|
+
const reference = message.slice(at + TABLE_NOT_FOUND.length).trim().split(/\s/u)[0] ?? '';
|
|
283
|
+
const bare = reference.slice(reference.lastIndexOf('.') + 1).toLowerCase();
|
|
284
|
+
return allDerivedSpecs().find((spec) => spec.name.toLowerCase() === bare)?.name;
|
|
285
|
+
}
|
|
242
286
|
/**
|
|
243
287
|
* Turn a rejected statement into a message that names the surface it missed.
|
|
244
288
|
*
|
|
@@ -276,6 +320,23 @@ export async function withQueriedProjection(options, work) {
|
|
|
276
320
|
export function describeQueryFailure(sql, message) {
|
|
277
321
|
if (!NAME_NOT_FOUND.some((prefix) => message.includes(prefix)))
|
|
278
322
|
return message;
|
|
323
|
+
// 🚨 A MISSING DERIVED RELATION IS NOT A TYPO — it is the refusal that makes
|
|
324
|
+
// lazy lens evaluation an optimisation. The run's database creates a derived
|
|
325
|
+
// relation only when a lens fills it, so one no lens was evaluated for is
|
|
326
|
+
// absent, and SQLite refuses it rather than answering `0` from an empty table
|
|
327
|
+
// (indistinguishable from a tree with no links, and for `vat resources check`
|
|
328
|
+
// a rule that could no longer fail). The refusal is the engine's, so it holds
|
|
329
|
+
// for any spelling the lens selector's scan missed; this only says why. For
|
|
330
|
+
// `check` it surfaces as a `RESOURCE_CHECK_BROKEN` finding naming the rule.
|
|
331
|
+
// The compile preflight never reaches here with one: its probe has them all.
|
|
332
|
+
const unevaluated = unevaluatedRelationIn(message);
|
|
333
|
+
if (unevaluated !== undefined) {
|
|
334
|
+
return `${message}\n\n`
|
|
335
|
+
+ `This statement reads ${unevaluated}, a derived relation that was not evaluated for this run:`
|
|
336
|
+
+ ' no statement the run DECLARED names it, so no lens producing it ran and there is no answer'
|
|
337
|
+
+ ' to give. Declare this statement (`vat resources query` passes the one it was given;'
|
|
338
|
+
+ ' `vat resources check` passes every statement in `resources.checks`).';
|
|
339
|
+
}
|
|
279
340
|
// 🪤 The derived relations belong in this listing even though they are not
|
|
280
341
|
// projection tables. A user who mistypes `edge_resolution` gets "no such
|
|
281
342
|
// table" and a list of everything they could have meant — and a list that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projection-query.js","sourceRoot":"","sources":["../../src/utils/projection-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"projection-query.js","sourceRoot":"","sources":["../../src/utils/projection-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,GAEvB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAGjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEvG;;;;;;;;GAQG;AACH,MAAM,mBAAmB,GAAG,WAAW,CAAC;AAExC,gFAAgF;AAChF,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAE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AAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC9E,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC;QAC9B,CAAC,CAAC,qDAAqD;QACvD,CAAC,CAAC,iDAAiD,CAAC;IAEtD,OAAO,GAAG,OAAO,OAAO,OAAO,KAAK,OAAO,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -47,7 +47,15 @@
|
|
|
47
47
|
import type * as ProjectionSqlite from '@vibe-agent-toolkit/projection-sqlite';
|
|
48
48
|
import type { PopulationCache } from '@vibe-agent-toolkit/resources';
|
|
49
49
|
/**
|
|
50
|
-
* The env var that selects a projection store for this
|
|
50
|
+
* The env var that selects — or now, DESELECTS — a projection store for this
|
|
51
|
+
* process.
|
|
52
|
+
*
|
|
53
|
+
* 🔑 **The store is on by default, so this is the escape hatch rather than the
|
|
54
|
+
* selector.** Same shape and same reason as `VAT_RESOURCES_CRAWL`: any value the
|
|
55
|
+
* off-parser does not read as false leaves the store selected, including the
|
|
56
|
+
* historical `sqlite`, so every script and lab arm that names it explicitly
|
|
57
|
+
* keeps working and keeps MEANING the same thing. See
|
|
58
|
+
* {@link PROJECTION_STORE_OFF} for the one way out.
|
|
51
59
|
*
|
|
52
60
|
* An environment switch rather than a config field, for the same reason
|
|
53
61
|
* `VAT_INVENTORY_CRAWL` and `VAT_RESOURCES_CRAWL` are: it selects which
|
|
@@ -57,40 +65,28 @@ import type { PopulationCache } from '@vibe-agent-toolkit/resources';
|
|
|
57
65
|
* edits the thing it measures.
|
|
58
66
|
*
|
|
59
67
|
* 🔑 It is read from the environment, and **every phase now runs in the process
|
|
60
|
-
* that read it
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* 🔑 **That sharing has a within-verb instance.** `vat build`'s two
|
|
66
|
-
* phases — `skills build` and `claude plugin build` — both reach the lane
|
|
67
|
-
* through `withResourcePopulationSource` (see `resource-loader.ts`), and both
|
|
68
|
-
* root their population at the same directory, so phase 2 reads the extent
|
|
69
|
-
* phase 1 wrote. Measured on `packages/vat-development-agents` with
|
|
70
|
-
* `VAT_CRAWL_TIMING`: with a cold store phase 1 files `builtin:filesystem`
|
|
71
|
-
* 39.2 ms and `projection-store:write` 10.1 ms, phase 2 files neither and its
|
|
72
|
-
* `resource-registry:enumerate` reads 3.6 ms against phase 1's 66.6 ms.
|
|
73
|
-
*
|
|
74
|
-
* It did NOT need the closure to emit reasons, which is what an earlier reading
|
|
75
|
-
* of this expected: the packaging lanes consume `resource_realizations` and let
|
|
76
|
-
* `walkLinkGraph` keep running on top of the registry, so the base extent alone
|
|
77
|
-
* answers them — the same shape `buildResourcePopulation` already had.
|
|
78
|
-
*
|
|
79
|
-
* The cross-INVOCATION win is unchanged and independent: `vat validate` and
|
|
80
|
-
* `vat verify` spawn a byte-identical `resources validate` child, so the second
|
|
81
|
-
* hits the store.
|
|
82
|
-
*
|
|
83
|
-
* ⚠️ One packaging enumeration is still on the walk: `vat claude plugin build`'s
|
|
84
|
-
* per-skill post-build validation, which reaches `crawlAndResolveRegistry` in
|
|
85
|
-
* `packaging-validator.ts` without a source — its `withResourcePopulationSource`
|
|
86
|
-
* bracket closes around `createProjectRegistry` and does not span the
|
|
87
|
-
* marketplace loop. `vat skills build` no longer does: it holds one bracket over
|
|
88
|
-
* the whole run, and the registry memo is keyed on the population source, so
|
|
89
|
-
* both of its registries source from the projection.
|
|
68
|
+
* that read it**, so `vat validate`'s phases cannot fail to see the selection
|
|
69
|
+
* their orchestrator did. Which lanes share a store within one verb and across
|
|
70
|
+
* invocations, with the measurements, and the ⚠️ one packaging enumeration still
|
|
71
|
+
* on the walk: `docs/architecture/resource-scanning-and-caching.md` §3.7.
|
|
90
72
|
*/
|
|
91
73
|
export declare const PROJECTION_STORE_ENV = "VAT_PROJECTION_STORE";
|
|
92
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* {@link PROJECTION_STORE_ENV}'s value that names the SQLite backend. Redundant
|
|
76
|
+
* with the default now, and kept — see
|
|
77
|
+
* `docs/architecture/resource-scanning-and-caching.md` §3.7.
|
|
78
|
+
*/
|
|
93
79
|
export declare const PROJECTION_STORE_SQLITE = "sqlite";
|
|
80
|
+
/**
|
|
81
|
+
* The value that turns the store OFF while leaving VAT's other caches on.
|
|
82
|
+
*
|
|
83
|
+
* Read through the same {@link parseEnvBoolean} as every other VAT switch, so
|
|
84
|
+
* `0`, `false`, `no` and `n` work too. The empty string joins them: unlike
|
|
85
|
+
* {@link PROJECTION_STORE_DIR_ENV}, where empty falls back to a default
|
|
86
|
+
* directory that means something, there is nothing else for a cleared selector
|
|
87
|
+
* to mean.
|
|
88
|
+
*/
|
|
89
|
+
export declare const PROJECTION_STORE_OFF = "off";
|
|
94
90
|
/**
|
|
95
91
|
* Where the projection store's database lives, overriding the default.
|
|
96
92
|
*
|
|
@@ -132,11 +128,9 @@ export declare const CACHE_ENV = "VAT_CACHE";
|
|
|
132
128
|
/**
|
|
133
129
|
* Whether this process should read and write a projection store.
|
|
134
130
|
*
|
|
135
|
-
* **
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* claim about cost, and a default flipped before the cost is measured on real
|
|
139
|
-
* corpora is a claim nobody checked.
|
|
131
|
+
* **On unless turned off.** It used to be the opposite; the measurement that
|
|
132
|
+
* paid for the flip, and the blob-tier bound that had to land first, are in
|
|
133
|
+
* `docs/architecture/resource-scanning-and-caching.md` §3.7.
|
|
140
134
|
*
|
|
141
135
|
* Read from the environment at each call rather than memoized at module load:
|
|
142
136
|
* `vitest.setup.js` deletes every `VAT_*` variable before any test module
|
|
@@ -145,7 +139,7 @@ export declare const CACHE_ENV = "VAT_CACHE";
|
|
|
145
139
|
*
|
|
146
140
|
* ## The two switches are AND-ed, and the second one is a veto
|
|
147
141
|
*
|
|
148
|
-
* {@link PROJECTION_STORE_ENV}
|
|
142
|
+
* {@link PROJECTION_STORE_ENV} turns off THIS cache; {@link CACHE_ENV} says
|
|
149
143
|
* whether this run caches at all. A store selected while `VAT_CACHE=0` was
|
|
150
144
|
* measured writing a 9.8 MB, 18,079-row store on this repository and hitting it
|
|
151
145
|
* on the next run — a user who asked for no cache silently got one, and
|
|
@@ -161,7 +155,9 @@ export declare const CACHE_ENV = "VAT_CACHE";
|
|
|
161
155
|
*
|
|
162
156
|
* Only an explicit `false` vetoes. `parseEnvBoolean` returns `undefined` for a
|
|
163
157
|
* value it cannot read, and an unreadable value is not something the operator
|
|
164
|
-
* said — the veto has to be a statement, not a shrug.
|
|
158
|
+
* said — the veto has to be a statement, not a shrug. That reading is why both
|
|
159
|
+
* variables can be read through ONE parser even though they now sit on
|
|
160
|
+
* opposite default sides: each asks only whether the operator SAID no.
|
|
165
161
|
*
|
|
166
162
|
* @returns `true` when a store is selected
|
|
167
163
|
*/
|
|
@@ -196,9 +192,9 @@ export interface OpenedPopulationCache {
|
|
|
196
192
|
*
|
|
197
193
|
* Returns `undefined` when no store is selected, and when the tree cannot be
|
|
198
194
|
* keyed — the two "carry on without a cache" answers. It does **not** return
|
|
199
|
-
* `undefined` for an uninstalled backend:
|
|
200
|
-
*
|
|
201
|
-
*
|
|
195
|
+
* `undefined` for an uninstalled backend: the store is on unless a user turned it
|
|
196
|
+
* off, and answering that by silently not having one is how a default-on cache
|
|
197
|
+
* becomes an unmeasured one.
|
|
202
198
|
*
|
|
203
199
|
* @param options - Where the corpus is
|
|
204
200
|
* @param options.root - The absolute corpus root. Used to find the repository;
|
|
@@ -224,6 +220,16 @@ export declare function openPopulationCache(options: {
|
|
|
224
220
|
* @returns An open, empty store; close it when done
|
|
225
221
|
*/
|
|
226
222
|
export declare function openEphemeralQueryStore(): Promise<ProjectionSqlite.SqlQueryableStore>;
|
|
223
|
+
/**
|
|
224
|
+
* Open a compile-only probe over the full queryable schema, derived relations
|
|
225
|
+
* included — for checking statements BEFORE any population or lens has run.
|
|
226
|
+
*
|
|
227
|
+
* ⚠️ Not {@link openEphemeralQueryStore}: that store has no table for a derived
|
|
228
|
+
* relation until a lens fills it, which is how an unevaluated one is refused.
|
|
229
|
+
*
|
|
230
|
+
* @returns An open probe; close it when done
|
|
231
|
+
*/
|
|
232
|
+
export declare function openCompileProbe(): Promise<ProjectionSqlite.ProjectionCompileProbe>;
|
|
227
233
|
/**
|
|
228
234
|
* The legible failure for "your Node is too old", or `undefined` when this is
|
|
229
235
|
* some other failure — including "the package is absent".
|
|
@@ -305,6 +311,19 @@ export declare function nodeSqliteFloorFailure(error: unknown): Error | undefine
|
|
|
305
311
|
* separate "opened handle" bracket for a caller wanting more than the cache,
|
|
306
312
|
* because there is nothing legitimate for such a caller to want.
|
|
307
313
|
*
|
|
314
|
+
* ## 🔑 It NESTS, and the outermost scope wins
|
|
315
|
+
*
|
|
316
|
+
* A scope opened inside another over the same repository **joins** it: same
|
|
317
|
+
* cache by identity, no second database, no second `git write-tree`, and the
|
|
318
|
+
* inner scope does not close what it did not open. That lets an orchestrator
|
|
319
|
+
* hold one bracket over a whole run (`vat validate` does) while each lane
|
|
320
|
+
* underneath keeps its own and stays correct run alone. Reuse is gated on the
|
|
321
|
+
* TREE HASH, never on "a scope is open" — see {@link joinableCache}.
|
|
322
|
+
*
|
|
323
|
+
* ⚠️ The whole nest shares ONE snapshot, so work that must see its own edits as
|
|
324
|
+
* they land must not run inside a single scope. That is why a hoist is a
|
|
325
|
+
* decision rather than a refactor.
|
|
326
|
+
*
|
|
308
327
|
* @param options - Where the corpus is
|
|
309
328
|
* @param options.root - The absolute corpus root
|
|
310
329
|
* @param work - Given the cache, or `undefined` when there is none to give
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projection-store.d.ts","sourceRoot":"","sources":["../../src/utils/projection-store.ts"],"names":[],"mappings":"AAAA;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