@zqagent/core 0.3.22 → 0.3.25
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/index.cjs +33 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -9
- package/dist/index.js.map +1 -1
- package/dist/internal/update/controller.cjs +1 -1
- package/dist/internal/update/controller.js +1 -1
- package/dist/internal/update/platform.cjs +1 -1
- package/dist/internal/update/platform.js +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -9148,6 +9148,7 @@ function markLoaded(langId) {
|
|
|
9148
9148
|
failedAt.delete(langId);
|
|
9149
9149
|
}
|
|
9150
9150
|
var inflight = /* @__PURE__ */ new Map();
|
|
9151
|
+
var readyCache = /* @__PURE__ */ new Map();
|
|
9151
9152
|
function grammarDir() {
|
|
9152
9153
|
const explicit = process.env.ZQAGENT_REPOMAP_GRAMMAR_DIR?.trim();
|
|
9153
9154
|
if (explicit) return explicit;
|
|
@@ -9171,10 +9172,7 @@ function verify(spec, buf) {
|
|
|
9171
9172
|
return sha256Hex(buf) === spec.sha256;
|
|
9172
9173
|
}
|
|
9173
9174
|
function readLocal(spec) {
|
|
9174
|
-
const
|
|
9175
|
-
const explicit = process.env.ZQAGENT_REPOMAP_GRAMMAR_DIR?.trim();
|
|
9176
|
-
if (explicit) candidates.push(path13.join(explicit, `${spec.id}.wasm`));
|
|
9177
|
-
for (const file of candidates) {
|
|
9175
|
+
for (const file of localCandidates(spec)) {
|
|
9178
9176
|
try {
|
|
9179
9177
|
const buf = fs11.readFileSync(file);
|
|
9180
9178
|
if (verify(spec, buf)) return new Uint8Array(buf);
|
|
@@ -9183,6 +9181,24 @@ function readLocal(spec) {
|
|
|
9183
9181
|
}
|
|
9184
9182
|
return null;
|
|
9185
9183
|
}
|
|
9184
|
+
function localCandidates(spec) {
|
|
9185
|
+
const candidates = [cachePath(spec)];
|
|
9186
|
+
const explicit = process.env.ZQAGENT_REPOMAP_GRAMMAR_DIR?.trim();
|
|
9187
|
+
if (explicit) candidates.push(path13.join(explicit, `${spec.id}.wasm`));
|
|
9188
|
+
return candidates;
|
|
9189
|
+
}
|
|
9190
|
+
function localSignature(spec) {
|
|
9191
|
+
const parts = [];
|
|
9192
|
+
for (const file of localCandidates(spec)) {
|
|
9193
|
+
try {
|
|
9194
|
+
const st = fs11.statSync(file);
|
|
9195
|
+
parts.push(`${st.mtimeMs}:${st.size}`);
|
|
9196
|
+
} catch {
|
|
9197
|
+
parts.push("-");
|
|
9198
|
+
}
|
|
9199
|
+
}
|
|
9200
|
+
return parts.join("|");
|
|
9201
|
+
}
|
|
9186
9202
|
async function download(spec) {
|
|
9187
9203
|
if (offline()) return null;
|
|
9188
9204
|
for (const build of CDN_TEMPLATES) {
|
|
@@ -9241,7 +9257,13 @@ async function loadGrammar(langId) {
|
|
|
9241
9257
|
function grammarReady(langId) {
|
|
9242
9258
|
if (resolved.get(langId)) return true;
|
|
9243
9259
|
const spec = GRAMMARS[langId];
|
|
9244
|
-
|
|
9260
|
+
if (!spec) return false;
|
|
9261
|
+
const sig = localSignature(spec);
|
|
9262
|
+
const hit = readyCache.get(langId);
|
|
9263
|
+
if (hit && hit.sig === sig) return hit.ready;
|
|
9264
|
+
const ready = readLocal(spec) !== null;
|
|
9265
|
+
readyCache.set(langId, { sig, ready });
|
|
9266
|
+
return ready;
|
|
9245
9267
|
}
|
|
9246
9268
|
|
|
9247
9269
|
// src/repomap/extract/index.ts
|
|
@@ -10093,10 +10115,12 @@ function attachRepoMap(engine, opts) {
|
|
|
10093
10115
|
const original = spec.func;
|
|
10094
10116
|
engine.registry.register(
|
|
10095
10117
|
async (args, ctx) => {
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10118
|
+
try {
|
|
10119
|
+
return await original(args, ctx);
|
|
10120
|
+
} finally {
|
|
10121
|
+
invalidateRepoMap(workspace);
|
|
10122
|
+
schedule();
|
|
10123
|
+
}
|
|
10100
10124
|
},
|
|
10101
10125
|
spec.metadata,
|
|
10102
10126
|
spec.schema,
|