@graphrefly/graphrefly 0.46.0 → 0.47.0
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/base/composition/index.cjs +69 -15
- package/dist/base/composition/index.cjs.map +1 -1
- package/dist/base/composition/index.d.cts +1 -2
- package/dist/base/composition/index.d.ts +1 -2
- package/dist/base/composition/index.js +1 -1
- package/dist/base/index.cjs +69 -15
- package/dist/base/index.cjs.map +1 -1
- package/dist/base/index.d.cts +1 -2
- package/dist/base/index.d.ts +1 -2
- package/dist/base/index.js +1 -1
- package/dist/{chunk-WKSWLSCX.js → chunk-22SG74BD.js} +2 -2
- package/dist/{chunk-OO5BM6CJ.js → chunk-5IMMNARC.js} +2 -2
- package/dist/{chunk-KIIXR252.js → chunk-EHRRQ4IC.js} +2 -2
- package/dist/{chunk-HULCUY35.js → chunk-GWRNLJNW.js} +2 -2
- package/dist/{chunk-5THCXDWY.js → chunk-JKTC747G.js} +2 -2
- package/dist/{chunk-RGL53X5G.js → chunk-TNX5ZGDJ.js} +3 -3
- package/dist/{chunk-LBAJK24K.js → chunk-VLAGJZSL.js} +11 -3
- package/dist/chunk-VLAGJZSL.js.map +1 -0
- package/dist/chunk-Z65DVDEQ.js +146 -0
- package/dist/chunk-Z65DVDEQ.js.map +1 -0
- package/dist/{chunk-GBCENOLN.js → chunk-ZT4WMQW4.js} +3 -3
- package/dist/{chunk-FR6RGA3B.js → chunk-ZVXXDWIB.js} +19 -14
- package/dist/{chunk-FR6RGA3B.js.map → chunk-ZVXXDWIB.js.map} +1 -1
- package/dist/compat/index.cjs +156 -93
- package/dist/compat/index.cjs.map +1 -1
- package/dist/compat/index.d.cts +3 -3
- package/dist/compat/index.d.ts +3 -3
- package/dist/compat/index.js +2 -2
- package/dist/compat/nestjs/index.cjs +156 -93
- package/dist/compat/nestjs/index.cjs.map +1 -1
- package/dist/compat/nestjs/index.d.cts +4 -4
- package/dist/compat/nestjs/index.d.ts +4 -4
- package/dist/compat/nestjs/index.js +4 -5
- package/dist/{index-5SU_O78r.d.cts → index-B_p8tnvf.d.cts} +19 -3
- package/dist/{index-CEXCtYYJ.d.ts → index-_HDSmPyp.d.ts} +19 -3
- package/dist/index.cjs +77 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +9 -9
- package/dist/observable-B25XqCbZ.d.cts +59 -0
- package/dist/observable-B25XqCbZ.d.ts +59 -0
- package/dist/presets/ai/index.js +5 -5
- package/dist/presets/harness/index.js +7 -7
- package/dist/presets/index.js +8 -8
- package/dist/solutions/index.js +6 -6
- package/dist/utils/ai/index.js +3 -3
- package/dist/utils/index.cjs +8 -3
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js +3 -3
- package/dist/utils/memory/index.cjs +8 -3
- package/dist/utils/memory/index.cjs.map +1 -1
- package/dist/utils/memory/index.d.cts +78 -0
- package/dist/utils/memory/index.d.ts +78 -0
- package/dist/utils/memory/index.js +1 -1
- package/package.json +1 -5
- package/dist/chunk-3QZY5BI7.js +0 -92
- package/dist/chunk-3QZY5BI7.js.map +0 -1
- package/dist/chunk-LBAJK24K.js.map +0 -1
- package/dist/observable-BXQoW1P-.d.cts +0 -36
- package/dist/observable-BXQoW1P-.d.ts +0 -36
- /package/dist/{chunk-WKSWLSCX.js.map → chunk-22SG74BD.js.map} +0 -0
- /package/dist/{chunk-OO5BM6CJ.js.map → chunk-5IMMNARC.js.map} +0 -0
- /package/dist/{chunk-KIIXR252.js.map → chunk-EHRRQ4IC.js.map} +0 -0
- /package/dist/{chunk-HULCUY35.js.map → chunk-GWRNLJNW.js.map} +0 -0
- /package/dist/{chunk-5THCXDWY.js.map → chunk-JKTC747G.js.map} +0 -0
- /package/dist/{chunk-RGL53X5G.js.map → chunk-TNX5ZGDJ.js.map} +0 -0
- /package/dist/{chunk-GBCENOLN.js.map → chunk-ZT4WMQW4.js.map} +0 -0
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
} from "./chunk-BXGZFGZ4.js";
|
|
13
13
|
|
|
14
14
|
// src/utils/memory/index.ts
|
|
15
|
-
import { monotonicNs
|
|
15
|
+
import { monotonicNs, NodeImpl, node as node2, wallClockNs as wallClockNs2 } from "@graphrefly/pure-ts/core";
|
|
16
16
|
import { fromTimer, keepalive as keepalive2, reactiveMap } from "@graphrefly/pure-ts/extra";
|
|
17
17
|
import { Graph as Graph2 } from "@graphrefly/pure-ts/graph";
|
|
18
18
|
|
|
19
19
|
// src/utils/memory/fact-store.ts
|
|
20
|
-
import {
|
|
21
|
-
import { keepalive } from "@graphrefly/pure-ts/extra";
|
|
20
|
+
import { node, wallClockNs } from "@graphrefly/pure-ts/core";
|
|
21
|
+
import { keepalive, reactiveLog } from "@graphrefly/pure-ts/extra";
|
|
22
22
|
import { Graph } from "@graphrefly/pure-ts/graph";
|
|
23
23
|
var OVERFLOW_SAMPLE_SIZE = 8;
|
|
24
24
|
function factMeta(kind, extra) {
|
|
@@ -65,6 +65,8 @@ function reactiveFactStore(config) {
|
|
|
65
65
|
graph
|
|
66
66
|
});
|
|
67
67
|
const seqCursor = registerCursor(graph, "seq", 0);
|
|
68
|
+
const ingestLog = config.recordIngest ? reactiveLog([], { name: "ingest_log" }) : void 0;
|
|
69
|
+
if (ingestLog) graph.addDisposer(() => ingestLog.dispose());
|
|
68
70
|
const emptyStore = () => ({ byId: /* @__PURE__ */ new Map() });
|
|
69
71
|
const shards = [];
|
|
70
72
|
for (let s = 0; s < shardCount; s += 1) {
|
|
@@ -220,6 +222,8 @@ function reactiveFactStore(config) {
|
|
|
220
222
|
factId: dep,
|
|
221
223
|
rootFactId: f.id,
|
|
222
224
|
reason: "obsolete",
|
|
225
|
+
// `obsolete` guard above guarantees `f.validTo` is set.
|
|
226
|
+
rootValidTo: f.validTo,
|
|
223
227
|
iteration: cascadeIteration + 1,
|
|
224
228
|
causalReason: `dependentsIndex[${f.id}] \u2192 ${dep} (obsolete: validTo set)`
|
|
225
229
|
});
|
|
@@ -292,11 +296,10 @@ function reactiveFactStore(config) {
|
|
|
292
296
|
actions.emit([]);
|
|
293
297
|
return;
|
|
294
298
|
}
|
|
295
|
-
const
|
|
296
|
-
for (const [id] of byId) {
|
|
299
|
+
for (const [id, e] of byId) {
|
|
297
300
|
replaceFragment(
|
|
298
301
|
id,
|
|
299
|
-
(prev) => prev.validTo !== void 0 ? prev : { ...prev, validTo:
|
|
302
|
+
(prev) => prev.validTo !== void 0 ? prev : { ...prev, validTo: e.rootValidTo }
|
|
300
303
|
);
|
|
301
304
|
}
|
|
302
305
|
actions.emit([...byId.values()]);
|
|
@@ -454,6 +457,7 @@ function reactiveFactStore(config) {
|
|
|
454
457
|
t_ns: wallClockNs(),
|
|
455
458
|
seq: bumpCursor(seqCursor)
|
|
456
459
|
});
|
|
460
|
+
ingestLog?.append(f);
|
|
457
461
|
}
|
|
458
462
|
actions.emit(f ?? null);
|
|
459
463
|
},
|
|
@@ -490,6 +494,7 @@ function reactiveFactStore(config) {
|
|
|
490
494
|
review,
|
|
491
495
|
consolidated,
|
|
492
496
|
events,
|
|
497
|
+
...ingestLog ? { ingestLog } : {},
|
|
493
498
|
itemNode
|
|
494
499
|
});
|
|
495
500
|
return out;
|
|
@@ -562,7 +567,7 @@ function collection(name, opts = {}) {
|
|
|
562
567
|
return scoreInput;
|
|
563
568
|
};
|
|
564
569
|
const graph = new Graph2(name);
|
|
565
|
-
const retentionScore = (_k, v) => ranked ? decay(v.baseScore, ageSeconds(
|
|
570
|
+
const retentionScore = (_k, v) => ranked ? decay(v.baseScore, ageSeconds(monotonicNs(), v.lastAccessNs), decayRate, minScore) : v.lastAccessNs;
|
|
566
571
|
const items = reactiveMap({
|
|
567
572
|
name: "items",
|
|
568
573
|
...maxSize !== void 0 ? { retention: { score: retentionScore, maxSize } } : {}
|
|
@@ -575,12 +580,12 @@ function collection(name, opts = {}) {
|
|
|
575
580
|
refreshTick = node2(
|
|
576
581
|
[tickCounter],
|
|
577
582
|
(_batchData, actions) => {
|
|
578
|
-
actions.emit(
|
|
583
|
+
actions.emit(monotonicNs());
|
|
579
584
|
},
|
|
580
585
|
{
|
|
581
586
|
name: "refresh_tick_ns",
|
|
582
587
|
describeKind: "derived",
|
|
583
|
-
initial:
|
|
588
|
+
initial: monotonicNs(),
|
|
584
589
|
meta: memoryMeta("clock")
|
|
585
590
|
}
|
|
586
591
|
);
|
|
@@ -601,9 +606,9 @@ function collection(name, opts = {}) {
|
|
|
601
606
|
let now;
|
|
602
607
|
if (refreshTick) {
|
|
603
608
|
const tickValue = values[1];
|
|
604
|
-
now = typeof tickValue === "number" ? tickValue :
|
|
609
|
+
now = typeof tickValue === "number" ? tickValue : monotonicNs();
|
|
605
610
|
} else {
|
|
606
|
-
now =
|
|
611
|
+
now = monotonicNs();
|
|
607
612
|
}
|
|
608
613
|
if (!snapshot || snapshot.size === 0) {
|
|
609
614
|
actions.emit([]);
|
|
@@ -661,7 +666,7 @@ function collection(name, opts = {}) {
|
|
|
661
666
|
});
|
|
662
667
|
const seqCursor = registerCursor(graph, "seq", 0);
|
|
663
668
|
const upsertImpl = (id, value, _opts) => {
|
|
664
|
-
const now =
|
|
669
|
+
const now = monotonicNs();
|
|
665
670
|
const prev = items.get(id);
|
|
666
671
|
const baseScore = _opts?.score ?? readScoreFn()(value);
|
|
667
672
|
items.set(id, {
|
|
@@ -847,7 +852,7 @@ function vectorIndex(opts = {}) {
|
|
|
847
852
|
id,
|
|
848
853
|
vector: [...vector],
|
|
849
854
|
...copiedMeta !== void 0 ? { meta: copiedMeta } : {},
|
|
850
|
-
upsertedAtNs:
|
|
855
|
+
upsertedAtNs: monotonicNs()
|
|
851
856
|
};
|
|
852
857
|
entries.set(id, record);
|
|
853
858
|
};
|
|
@@ -1274,4 +1279,4 @@ export {
|
|
|
1274
1279
|
vectorIndex,
|
|
1275
1280
|
knowledgeGraph
|
|
1276
1281
|
};
|
|
1277
|
-
//# sourceMappingURL=chunk-
|
|
1282
|
+
//# sourceMappingURL=chunk-ZVXXDWIB.js.map
|