@vibgrate/cli 2026.818.1 → 2026.818.2
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/{agent-CUK24AWF.js → agent-X6VYCE63.js} +13 -13
- package/dist/{agent-CUK24AWF.js.map → agent-X6VYCE63.js.map} +1 -1
- package/dist/{approvals-YFOU6GVB.js → approvals-TPQFQSWG.js} +5 -5
- package/dist/{approvals-YFOU6GVB.js.map → approvals-TPQFQSWG.js.map} +1 -1
- package/dist/attach-G5JUIWIT.js +10 -0
- package/dist/{attach-6S3XS7VO.js.map → attach-G5JUIWIT.js.map} +1 -1
- package/dist/{baseline-OBZJRCCP.js → baseline-DXI64VLW.js} +3 -3
- package/dist/{baseline-OBZJRCCP.js.map → baseline-DXI64VLW.js.map} +1 -1
- package/dist/{chunk-WVTGF2MP.js → chunk-2C33WR5O.js} +3 -3
- package/dist/{chunk-WVTGF2MP.js.map → chunk-2C33WR5O.js.map} +1 -1
- package/dist/chunk-4NTNMT6T.js +6 -0
- package/dist/{chunk-SUD54UGN.js.map → chunk-4NTNMT6T.js.map} +1 -1
- package/dist/chunk-5IQBIXHS.js +23 -0
- package/dist/chunk-5IQBIXHS.js.map +1 -0
- package/dist/{chunk-43ESHUM5.js → chunk-6PFHDHOL.js} +8 -8
- package/dist/{chunk-43ESHUM5.js.map → chunk-6PFHDHOL.js.map} +1 -1
- package/dist/{chunk-LHQYYBCH.js → chunk-AEJYA6HZ.js} +5 -5
- package/dist/{chunk-LHQYYBCH.js.map → chunk-AEJYA6HZ.js.map} +1 -1
- package/dist/{chunk-J7CVFTLG.js → chunk-B4EXD5LK.js} +5 -5
- package/dist/{chunk-J7CVFTLG.js.map → chunk-B4EXD5LK.js.map} +1 -1
- package/dist/{chunk-E7RVA2ZI.js → chunk-BMOFJIMG.js} +3 -3
- package/dist/{chunk-E7RVA2ZI.js.map → chunk-BMOFJIMG.js.map} +1 -1
- package/dist/{chunk-ZWFMJUXC.js → chunk-E3O5UKNA.js} +7 -7
- package/dist/{chunk-ZWFMJUXC.js.map → chunk-E3O5UKNA.js.map} +1 -1
- package/dist/{chunk-NO4BMW7M.js → chunk-E53WBVUQ.js} +6 -3
- package/dist/chunk-E53WBVUQ.js.map +1 -0
- package/dist/{chunk-FFYO7G3T.js → chunk-FFXGWFAE.js} +3 -3
- package/dist/{chunk-FFYO7G3T.js.map → chunk-FFXGWFAE.js.map} +1 -1
- package/dist/{chunk-H6RV2OAX.js → chunk-HF6R73UC.js} +78 -10
- package/dist/chunk-HF6R73UC.js.map +1 -0
- package/dist/{chunk-4QAMUBAC.js → chunk-JGA63RGF.js} +11 -11
- package/dist/{chunk-4QAMUBAC.js.map → chunk-JGA63RGF.js.map} +1 -1
- package/dist/{chunk-SBHK4ECM.js → chunk-KU7FI5EV.js} +3 -3
- package/dist/{chunk-SBHK4ECM.js.map → chunk-KU7FI5EV.js.map} +1 -1
- package/dist/{chunk-DM6MJ7IF.js → chunk-L2OS4WHT.js} +4 -4
- package/dist/{chunk-DM6MJ7IF.js.map → chunk-L2OS4WHT.js.map} +1 -1
- package/dist/chunk-LJSJX6U4.js +38 -0
- package/dist/chunk-LJSJX6U4.js.map +1 -0
- package/dist/{chunk-DUCEKH7Q.js → chunk-MRZHNUN7.js} +4 -4
- package/dist/{chunk-DUCEKH7Q.js.map → chunk-MRZHNUN7.js.map} +1 -1
- package/dist/{chunk-G7ZFSH5J.js → chunk-NJQZRM55.js} +6 -38
- package/dist/chunk-NJQZRM55.js.map +1 -0
- package/dist/{chunk-OS4YFOFJ.js → chunk-NKLYDSB7.js} +7 -7
- package/dist/{chunk-OS4YFOFJ.js.map → chunk-NKLYDSB7.js.map} +1 -1
- package/dist/{chunk-X4DECFUG.js → chunk-O5IJDMTB.js} +4 -4
- package/dist/{chunk-X4DECFUG.js.map → chunk-O5IJDMTB.js.map} +1 -1
- package/dist/{chunk-J3A3O4IA.js → chunk-PRHH4DVO.js} +3 -3
- package/dist/{chunk-J3A3O4IA.js.map → chunk-PRHH4DVO.js.map} +1 -1
- package/dist/{chunk-OVUZWR67.js → chunk-RHKOUPWT.js} +3 -3
- package/dist/{chunk-OVUZWR67.js.map → chunk-RHKOUPWT.js.map} +1 -1
- package/dist/{chunk-I3PKYYRP.js → chunk-V6WONSIK.js} +4 -4
- package/dist/{chunk-I3PKYYRP.js.map → chunk-V6WONSIK.js.map} +1 -1
- package/dist/{chunk-Q7TWHJJ6.js → chunk-VMAIDM4K.js} +3 -3
- package/dist/{chunk-Q7TWHJJ6.js.map → chunk-VMAIDM4K.js.map} +1 -1
- package/dist/{chunk-MHJBIGWV.js → chunk-VQ5KMHW6.js} +117 -23
- package/dist/chunk-VQ5KMHW6.js.map +1 -0
- package/dist/{chunk-GKZU6MII.js → chunk-X2MQ7UFL.js} +109 -23
- package/dist/chunk-X2MQ7UFL.js.map +1 -0
- package/dist/{chunk-6LY3JH6S.js → chunk-YF54UMOU.js} +3 -3
- package/dist/{chunk-6LY3JH6S.js.map → chunk-YF54UMOU.js.map} +1 -1
- package/dist/{chunk-DH6EDSQP.js → chunk-ZUOBPKVK.js} +3 -3
- package/dist/{chunk-DH6EDSQP.js.map → chunk-ZUOBPKVK.js.map} +1 -1
- package/dist/cli.js +234 -108
- package/dist/cli.js.map +1 -1
- package/dist/client-UQIELEEZ.js +8 -0
- package/dist/client-UQIELEEZ.js.map +1 -0
- package/dist/{daemon-4Q5QBBAF.js → daemon-GUMWMKCA.js} +11 -11
- package/dist/{daemon-4Q5QBBAF.js.map → daemon-GUMWMKCA.js.map} +1 -1
- package/dist/embed-worker-main.js +3 -3
- package/dist/{ensure-map-B2PS5ALS.js → ensure-map-FHDJTO7Y.js} +20 -19
- package/dist/{ensure-map-B2PS5ALS.js.map → ensure-map-FHDJTO7Y.js.map} +1 -1
- package/dist/{graph-backend-EEXMD6XY.js → graph-backend-W2D3HRRD.js} +8 -8
- package/dist/{graph-backend-EEXMD6XY.js.map → graph-backend-W2D3HRRD.js.map} +1 -1
- package/dist/index.d.ts +29 -2
- package/dist/index.js +20 -18
- package/dist/index.js.map +1 -1
- package/dist/{interactive-KEPGE5HD.js → interactive-2MK4TLRD.js} +32 -31
- package/dist/interactive-2MK4TLRD.js.map +1 -0
- package/dist/load-4R4HYMBB.js +11 -0
- package/dist/{load-H5HAME25.js.map → load-4R4HYMBB.js.map} +1 -1
- package/dist/parse-worker.js +2 -2
- package/dist/publish-7YHRTBRA.js +9 -0
- package/dist/publish-7YHRTBRA.js.map +1 -0
- package/dist/{run-outcome-V3L4GAN4.js → run-outcome-H5GVDDZJ.js} +5 -5
- package/dist/{run-outcome-V3L4GAN4.js.map → run-outcome-H5GVDDZJ.js.map} +1 -1
- package/dist/{runtime-session-M2FRGTDS.js → runtime-session-JBIHHH5N.js} +11 -11
- package/dist/{runtime-session-M2FRGTDS.js.map → runtime-session-JBIHHH5N.js.map} +1 -1
- package/dist/semantic-status-2JFLIQQJ.js +4 -0
- package/dist/semantic-status-2JFLIQQJ.js.map +1 -0
- package/dist/{session-77YXFUC7.js → session-N5IU4K5Q.js} +8 -8
- package/dist/{session-77YXFUC7.js.map → session-N5IU4K5Q.js.map} +1 -1
- package/dist/{stream-json-S6E3W2US.js → stream-json-4WLSUF6I.js} +13 -13
- package/dist/{stream-json-S6E3W2US.js.map → stream-json-4WLSUF6I.js.map} +1 -1
- package/dist/version-DTEU3SQD.js +4 -0
- package/dist/{version-VRZT5G4T.js.map → version-DTEU3SQD.js.map} +1 -1
- package/dist/{vg-mcp-bridge-HCPJWJKJ.js → vg-mcp-bridge-KDVYIMFX.js} +9 -9
- package/dist/{vg-mcp-bridge-HCPJWJKJ.js.map → vg-mcp-bridge-KDVYIMFX.js.map} +1 -1
- package/dist/{vgd-R2PNIDEP.js → vgd-M7UOPWLB.js} +10 -10
- package/dist/vgd-M7UOPWLB.js.map +1 -0
- package/package.json +1 -1
- package/dist/attach-6S3XS7VO.js +0 -9
- package/dist/chunk-G7ZFSH5J.js.map +0 -1
- package/dist/chunk-GKZU6MII.js.map +0 -1
- package/dist/chunk-H6RV2OAX.js.map +0 -1
- package/dist/chunk-MHJBIGWV.js.map +0 -1
- package/dist/chunk-NO4BMW7M.js.map +0 -1
- package/dist/chunk-SUD54UGN.js +0 -6
- package/dist/interactive-KEPGE5HD.js.map +0 -1
- package/dist/load-H5HAME25.js +0 -11
- package/dist/version-VRZT5G4T.js +0 -4
- package/dist/vgd-R2PNIDEP.js.map +0 -1
|
@@ -3,13 +3,13 @@ import { isRelevantChange } from './chunk-DBX3DL27.js';
|
|
|
3
3
|
import { isSkippedDirName, SKIP_FILES } from './chunk-POOL355F.js';
|
|
4
4
|
import { inventory } from './chunk-6BEBJCK4.js';
|
|
5
5
|
import { resolveOne } from './chunk-J7LKEB2R.js';
|
|
6
|
-
import { impactOf, queryGraph, queryGraphSemantic } from './chunk-
|
|
7
|
-
import { loadGraph } from './chunk-
|
|
6
|
+
import { impactOf, queryGraph, queryGraphSemantic } from './chunk-MRZHNUN7.js';
|
|
7
|
+
import { loadGraph } from './chunk-KU7FI5EV.js';
|
|
8
8
|
import { vgdSocketPath, vgdPidPath } from './chunk-NDNNOAS6.js';
|
|
9
|
-
import { embedTargets, readCachedVectors, cosine } from './chunk-
|
|
9
|
+
import { embedTargets, readCachedVectors, cosine } from './chunk-2C33WR5O.js';
|
|
10
10
|
import { cacheDir } from './chunk-MVPRPSXU.js';
|
|
11
11
|
import { stableStringify } from './chunk-O3LABX6I.js';
|
|
12
|
-
import { VERSION } from './chunk-
|
|
12
|
+
import { VERSION } from './chunk-4NTNMT6T.js';
|
|
13
13
|
import { repositoryIdFromRoot, globalGraphPathForRef, globalGraphPath } from './chunk-BWPBB45M.js';
|
|
14
14
|
import { hashString, canonicalize, hashBytes } from './chunk-JFGYT6BI.js';
|
|
15
15
|
import { activeGraphSlotKey, detectGitRef, clearDetectGitRefCache } from './chunk-BPF3YX2U.js';
|
|
@@ -85,7 +85,8 @@ function parseRequest(line) {
|
|
|
85
85
|
return {
|
|
86
86
|
op: "embed-index",
|
|
87
87
|
repositoryId: repositoryId.trim(),
|
|
88
|
-
gitRef: typeof gitRef === "string" && gitRef.trim() ? gitRef.trim() : void 0
|
|
88
|
+
gitRef: typeof gitRef === "string" && gitRef.trim() ? gitRef.trim() : void 0,
|
|
89
|
+
wait: raw.wait === false ? false : void 0
|
|
89
90
|
};
|
|
90
91
|
}
|
|
91
92
|
if (op === "embed-rank") {
|
|
@@ -649,8 +650,10 @@ var EmbedBroker = class {
|
|
|
649
650
|
buffer = "";
|
|
650
651
|
pending = /* @__PURE__ */ new Map();
|
|
651
652
|
indexes = /* @__PURE__ */ new Map();
|
|
652
|
-
/**
|
|
653
|
-
|
|
653
|
+
/** In-flight builds, so a second caller waits for the same work instead of seeing an empty slot. */
|
|
654
|
+
inflight = /* @__PURE__ */ new Map();
|
|
655
|
+
/** One deferred retry per slot after standing down for an on-disk writer. */
|
|
656
|
+
rewarmTimers = /* @__PURE__ */ new Map();
|
|
654
657
|
/** The slot most recently made current — logged on change. */
|
|
655
658
|
currentKey;
|
|
656
659
|
graphProvider;
|
|
@@ -661,6 +664,7 @@ var EmbedBroker = class {
|
|
|
661
664
|
requestTimeoutMs;
|
|
662
665
|
batchSize;
|
|
663
666
|
now;
|
|
667
|
+
sleepImpl;
|
|
664
668
|
constructor(options = {}) {
|
|
665
669
|
this.log = options.log ?? (() => {
|
|
666
670
|
});
|
|
@@ -669,6 +673,7 @@ var EmbedBroker = class {
|
|
|
669
673
|
this.requestTimeoutMs = options.requestTimeoutMs ?? 12e4;
|
|
670
674
|
this.batchSize = options.batchSize ?? 256;
|
|
671
675
|
this.now = options.now ?? (() => Date.now());
|
|
676
|
+
this.sleepImpl = options.sleep ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms)));
|
|
672
677
|
}
|
|
673
678
|
status() {
|
|
674
679
|
return {
|
|
@@ -715,14 +720,15 @@ var EmbedBroker = class {
|
|
|
715
720
|
const key = activeGraphSlotKey(repositoryId, gitRef);
|
|
716
721
|
const existing = this.indexes.get(key);
|
|
717
722
|
const nodeCount = graph.nodes?.length ?? 0;
|
|
718
|
-
|
|
719
|
-
|
|
723
|
+
const kept = existing?.vectors.size ? new Map(existing.vectors) : /* @__PURE__ */ new Map();
|
|
724
|
+
if (existing && existing.vectors.size > 0) {
|
|
725
|
+
this.log(`semantic: ${repositoryId}@${gitRef} graph republished \u2014 index stale (${existing.vectors.size} vectors kept until rebuild)`);
|
|
720
726
|
}
|
|
721
727
|
this.indexes.set(key, {
|
|
722
728
|
repositoryId,
|
|
723
729
|
gitRef,
|
|
724
730
|
state: "stale",
|
|
725
|
-
vectors:
|
|
731
|
+
vectors: kept,
|
|
726
732
|
nodeCount
|
|
727
733
|
});
|
|
728
734
|
}
|
|
@@ -758,7 +764,7 @@ var EmbedBroker = class {
|
|
|
758
764
|
}
|
|
759
765
|
if (this.gaveUp) return;
|
|
760
766
|
const idx = this.indexes.get(key);
|
|
761
|
-
if (idx?.state === "ready" || this.
|
|
767
|
+
if (idx?.state === "ready" || this.inflight.has(key)) return;
|
|
762
768
|
const graph = this.graphProvider?.(repositoryId, gitRef);
|
|
763
769
|
if (!graph) return;
|
|
764
770
|
void this.ensureIndex(repositoryId, gitRef, graph);
|
|
@@ -769,18 +775,26 @@ var EmbedBroker = class {
|
|
|
769
775
|
const idx = this.indexes.get(key);
|
|
770
776
|
if (!idx) return;
|
|
771
777
|
this.indexes.delete(key);
|
|
778
|
+
this.clearRewarm(key);
|
|
772
779
|
this.log(`semantic: ${repositoryId}@${gitRef} index evicted with its graph slot (${idx.vectors.size} vectors freed)`);
|
|
773
780
|
}
|
|
774
781
|
/** Drop everything (daemon shutdown / registry clear). */
|
|
775
782
|
clear() {
|
|
776
783
|
this.indexes.clear();
|
|
777
|
-
this.
|
|
784
|
+
this.inflight.clear();
|
|
785
|
+
for (const timer of this.rewarmTimers.values()) clearTimeout(timer);
|
|
786
|
+
this.rewarmTimers.clear();
|
|
778
787
|
}
|
|
779
788
|
/**
|
|
780
789
|
* Ensure the slot has vectors, building them if needed. Resolves when the
|
|
781
790
|
* index is ready or has definitively failed; never throws.
|
|
791
|
+
*
|
|
792
|
+
* A second caller for the same slot waits for the in-flight build instead of
|
|
793
|
+
* returning the empty placeholder — that empty return is what made `vg ask`
|
|
794
|
+
* re-embed tens of thousands of nodes in-process while vgd was already doing
|
|
795
|
+
* the same work.
|
|
782
796
|
*/
|
|
783
|
-
async ensureIndex(repositoryId, gitRef, graph) {
|
|
797
|
+
async ensureIndex(repositoryId, gitRef, graph, options) {
|
|
784
798
|
const key = activeGraphSlotKey(repositoryId, gitRef);
|
|
785
799
|
let idx = this.indexes.get(key);
|
|
786
800
|
if (!idx) {
|
|
@@ -793,11 +807,23 @@ var EmbedBroker = class {
|
|
|
793
807
|
idx.error = this.reason ?? "embedding worker unavailable";
|
|
794
808
|
return idx;
|
|
795
809
|
}
|
|
796
|
-
|
|
797
|
-
|
|
810
|
+
const pending = this.inflight.get(key);
|
|
811
|
+
if (pending) return pending;
|
|
812
|
+
const work = this.buildIndex(key, idx, repositoryId, gitRef, graph, options).finally(() => {
|
|
813
|
+
if (this.inflight.get(key) === work) this.inflight.delete(key);
|
|
814
|
+
});
|
|
815
|
+
this.inflight.set(key, work);
|
|
816
|
+
return work;
|
|
817
|
+
}
|
|
818
|
+
async buildIndex(key, idx, repositoryId, gitRef, graph, options) {
|
|
798
819
|
idx.state = "building";
|
|
799
820
|
const started = this.now();
|
|
800
|
-
|
|
821
|
+
let seeded = this.seedFromDisk(repositoryId, graph);
|
|
822
|
+
if (seeded?.writerBusy && seeded.pending.length && options?.waitForWriter) {
|
|
823
|
+
this.log(`semantic: ${repositoryId}@${gitRef} waiting for another process to finish the on-disk index\u2026`);
|
|
824
|
+
await this.waitWhileWriterBusy(repositoryId, graph, options.waitForWriterMs ?? 3e5);
|
|
825
|
+
seeded = this.seedFromDisk(repositoryId, graph);
|
|
826
|
+
}
|
|
801
827
|
const targets = seeded?.pending ?? embedTargets(graph);
|
|
802
828
|
const vectors = seeded ? seeded.vectors : /* @__PURE__ */ new Map();
|
|
803
829
|
const nodeCount = seeded ? seeded.vectors.size + seeded.pending.length : targets.length;
|
|
@@ -811,10 +837,10 @@ var EmbedBroker = class {
|
|
|
811
837
|
idx.vectors = vectors;
|
|
812
838
|
idx.pending = targets.length;
|
|
813
839
|
idx.state = vectors.size ? "stale" : "absent";
|
|
814
|
-
this.building.delete(key);
|
|
815
840
|
this.log(
|
|
816
841
|
`semantic: ${repositoryId}@${gitRef} left at ${targets.length} pending \u2014 another process is writing the on-disk index; re-warming when it reports in`
|
|
817
842
|
);
|
|
843
|
+
this.scheduleRewarm(repositoryId, gitRef);
|
|
818
844
|
return idx;
|
|
819
845
|
}
|
|
820
846
|
this.log(`semantic: building index for ${repositoryId}@${gitRef} (${targets.length} of ${nodeCount} nodes)\u2026`);
|
|
@@ -826,9 +852,16 @@ var EmbedBroker = class {
|
|
|
826
852
|
const v = out[j];
|
|
827
853
|
if (v) vectors.set(t.id, v);
|
|
828
854
|
});
|
|
855
|
+
if (idx.vectors.size === 0 || idx.vectors === vectors) idx.vectors = vectors;
|
|
856
|
+
idx.pending = Math.max(0, nodeCount - vectors.size);
|
|
829
857
|
const live = this.indexes.get(key);
|
|
830
858
|
if (!live || live !== idx) {
|
|
831
859
|
this.log(`semantic: index build for ${repositoryId}@${gitRef} abandoned \u2014 slot changed underneath it`);
|
|
860
|
+
this.inflight.delete(key);
|
|
861
|
+
if (live && live !== idx) {
|
|
862
|
+
const nextGraph = this.graphProvider?.(repositoryId, gitRef) ?? graph;
|
|
863
|
+
return this.ensureIndex(repositoryId, gitRef, nextGraph, options);
|
|
864
|
+
}
|
|
832
865
|
return idx;
|
|
833
866
|
}
|
|
834
867
|
}
|
|
@@ -838,6 +871,7 @@ var EmbedBroker = class {
|
|
|
838
871
|
idx.builtAt = this.now();
|
|
839
872
|
idx.buildMs = idx.builtAt - started;
|
|
840
873
|
idx.error = void 0;
|
|
874
|
+
this.clearRewarm(key);
|
|
841
875
|
this.log(`semantic: index ready for ${repositoryId}@${gitRef} \u2014 ${vectors.size} vectors in ${idx.buildMs}ms`);
|
|
842
876
|
} catch (err) {
|
|
843
877
|
idx.vectors = vectors;
|
|
@@ -845,11 +879,39 @@ var EmbedBroker = class {
|
|
|
845
879
|
idx.state = "failed";
|
|
846
880
|
idx.error = err instanceof Error ? err.message : String(err);
|
|
847
881
|
this.log(`semantic: index build failed for ${repositoryId}@${gitRef} \u2014 ${idx.error}; callers fall back to lexical`);
|
|
848
|
-
} finally {
|
|
849
|
-
this.building.delete(key);
|
|
850
882
|
}
|
|
851
883
|
return idx;
|
|
852
884
|
}
|
|
885
|
+
/** Poll the on-disk lock until the writer is gone or `timeoutMs` elapses. */
|
|
886
|
+
async waitWhileWriterBusy(repositoryId, graph, timeoutMs) {
|
|
887
|
+
const deadline = Date.now() + timeoutMs;
|
|
888
|
+
while (Date.now() < deadline) {
|
|
889
|
+
const read = this.seedFromDisk(repositoryId, graph);
|
|
890
|
+
if (!read?.writerBusy) return;
|
|
891
|
+
await this.sleepImpl(250);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
/** Retry a slot that stood down for an on-disk writer, once the writer should have moved. */
|
|
895
|
+
scheduleRewarm(repositoryId, gitRef) {
|
|
896
|
+
const key = activeGraphSlotKey(repositoryId, gitRef);
|
|
897
|
+
if (this.rewarmTimers.has(key)) return;
|
|
898
|
+
const timer = setTimeout(() => {
|
|
899
|
+
this.rewarmTimers.delete(key);
|
|
900
|
+
const idx = this.indexes.get(key);
|
|
901
|
+
if (!idx || idx.state === "ready" || this.inflight.has(key)) return;
|
|
902
|
+
const graph = this.graphProvider?.(repositoryId, gitRef);
|
|
903
|
+
if (!graph) return;
|
|
904
|
+
void this.ensureIndex(repositoryId, gitRef, graph);
|
|
905
|
+
}, 2e3);
|
|
906
|
+
timer.unref?.();
|
|
907
|
+
this.rewarmTimers.set(key, timer);
|
|
908
|
+
}
|
|
909
|
+
clearRewarm(key) {
|
|
910
|
+
const timer = this.rewarmTimers.get(key);
|
|
911
|
+
if (!timer) return;
|
|
912
|
+
clearTimeout(timer);
|
|
913
|
+
this.rewarmTimers.delete(key);
|
|
914
|
+
}
|
|
853
915
|
/**
|
|
854
916
|
* Read this slot's vectors out of the repo's on-disk cache. Needs the repo
|
|
855
917
|
* root from the registry; a repository the daemon has no root for (a
|
|
@@ -908,6 +970,8 @@ var EmbedBroker = class {
|
|
|
908
970
|
}
|
|
909
971
|
/** Stop the worker (daemon shutdown). Safe to call when already stopped. */
|
|
910
972
|
stop() {
|
|
973
|
+
for (const timer of this.rewarmTimers.values()) clearTimeout(timer);
|
|
974
|
+
this.rewarmTimers.clear();
|
|
911
975
|
const child = this.child;
|
|
912
976
|
this.child = null;
|
|
913
977
|
this.starting = false;
|
|
@@ -1666,7 +1730,20 @@ async function handleLine(line, ctx) {
|
|
|
1666
1730
|
if (!slot) {
|
|
1667
1731
|
return { ok: false, error: `no graph slot for ${req.repositoryId}@${gitRef} \u2014 publish the map first`, code: "no_slot" };
|
|
1668
1732
|
}
|
|
1669
|
-
|
|
1733
|
+
if (req.wait === false) {
|
|
1734
|
+
void ctx.embedBroker.ensureIndex(req.repositoryId, gitRef, slot.graph, { waitForWriter: true });
|
|
1735
|
+
const kicked = ctx.embedBroker.slot(req.repositoryId, gitRef);
|
|
1736
|
+
return {
|
|
1737
|
+
ok: true,
|
|
1738
|
+
indexed: true,
|
|
1739
|
+
repositoryId: req.repositoryId,
|
|
1740
|
+
gitRef,
|
|
1741
|
+
state: kicked?.state ?? "building",
|
|
1742
|
+
vectors: kicked?.vectors.size ?? 0,
|
|
1743
|
+
buildMs: kicked?.buildMs
|
|
1744
|
+
};
|
|
1745
|
+
}
|
|
1746
|
+
const idx = await ctx.embedBroker.ensureIndex(req.repositoryId, gitRef, slot.graph, { waitForWriter: true });
|
|
1670
1747
|
return {
|
|
1671
1748
|
ok: true,
|
|
1672
1749
|
indexed: true,
|
|
@@ -1684,7 +1761,24 @@ async function handleLine(line, ctx) {
|
|
|
1684
1761
|
if (!slot) {
|
|
1685
1762
|
return { ok: false, error: `no graph slot for ${req.repositoryId}@${gitRef} \u2014 publish the map first`, code: "no_slot" };
|
|
1686
1763
|
}
|
|
1687
|
-
|
|
1764
|
+
const existing = ctx.embedBroker.slot(req.repositoryId, gitRef);
|
|
1765
|
+
if (existing && existing.vectors.size > 0) {
|
|
1766
|
+
if (existing.state !== "ready") {
|
|
1767
|
+
void ctx.embedBroker.ensureIndex(req.repositoryId, gitRef, slot.graph);
|
|
1768
|
+
}
|
|
1769
|
+
} else {
|
|
1770
|
+
void ctx.embedBroker.ensureIndex(req.repositoryId, gitRef, slot.graph, { waitForWriter: true });
|
|
1771
|
+
const warming = ctx.embedBroker.slot(req.repositoryId, gitRef);
|
|
1772
|
+
return {
|
|
1773
|
+
ok: false,
|
|
1774
|
+
error: "semantic index is warming \u2014 retry shortly",
|
|
1775
|
+
code: "semantic_warming",
|
|
1776
|
+
state: warming?.state ?? "building",
|
|
1777
|
+
vectors: warming?.vectors.size ?? 0,
|
|
1778
|
+
pending: warming?.pending,
|
|
1779
|
+
nodeCount: warming?.nodeCount
|
|
1780
|
+
};
|
|
1781
|
+
}
|
|
1688
1782
|
const started = Date.now();
|
|
1689
1783
|
const result = await ctx.embedBroker.rank(req.repositoryId, gitRef, req.text, req.limit);
|
|
1690
1784
|
if (!result) {
|
|
@@ -2017,5 +2111,5 @@ var BranchGraphSession = class {
|
|
|
2017
2111
|
};
|
|
2018
2112
|
|
|
2019
2113
|
export { ActiveGraphCache, BranchGraphSession, DEFAULT_ACTIVE_GRAPH_IDLE_MS, VGD_PROTOCOL_VERSION, WorkspaceRegistry, endOfLine, findPackageLine, findRuntimeLine, isDependencyFile, isManifest, loadScanCache, manifestHash, manifestKind, parseRequest, startVgdServer, writeScanCache };
|
|
2020
|
-
//# sourceMappingURL=chunk-
|
|
2021
|
-
//# sourceMappingURL=chunk-
|
|
2114
|
+
//# sourceMappingURL=chunk-VQ5KMHW6.js.map
|
|
2115
|
+
//# sourceMappingURL=chunk-VQ5KMHW6.js.map
|