@graphrefly/graphrefly 0.15.0 → 0.16.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/{chunk-2ZICUAUJ.js → chunk-26A4E7J7.js} +10 -12
- package/dist/chunk-26A4E7J7.js.map +1 -0
- package/dist/{chunk-CRACCCJY.js → chunk-3BLRREFM.js} +29 -5
- package/dist/chunk-3BLRREFM.js.map +1 -0
- package/dist/{chunk-XQ4UMAU7.js → chunk-ITDVOCFO.js} +2 -2
- package/dist/{chunk-YW6LFCFS.js → chunk-LKP7IWRV.js} +3 -3
- package/dist/{chunk-4APC3AFN.js → chunk-RLVFZDCE.js} +22 -49
- package/dist/chunk-RLVFZDCE.js.map +1 -0
- package/dist/{chunk-GKRKDYNT.js → chunk-RZSQ7P2C.js} +3 -3
- package/dist/{chunk-ZHTHUX5D.js → chunk-SHRJH2DN.js} +3 -3
- package/dist/{chunk-H243FWYP.js → chunk-VZY2B2LU.js} +1 -1
- package/dist/{chunk-H243FWYP.js.map → chunk-VZY2B2LU.js.map} +1 -1
- package/dist/{chunk-QVYZD65U.js → chunk-YX263TXI.js} +10 -38
- package/dist/chunk-YX263TXI.js.map +1 -0
- package/dist/compat/nestjs/index.cjs +38 -41
- 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 +7 -7
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +3 -3
- package/dist/extra/index.cjs +27 -78
- package/dist/extra/index.cjs.map +1 -1
- package/dist/extra/index.d.cts +4 -4
- package/dist/extra/index.d.ts +4 -4
- package/dist/extra/index.js +3 -3
- package/dist/graph/index.cjs +26 -2
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +3 -3
- package/dist/graph/index.d.ts +3 -3
- package/dist/graph/index.js +4 -4
- package/dist/{graph-BXIK5Dq5.d.ts → graph-Dc-P9BVm.d.ts} +15 -3
- package/dist/{graph-BhADtuFU.d.cts → graph-fCsaaVIa.d.cts} +15 -3
- package/dist/{index-DSp5R3Xq.d.ts → index-BBVBYPxr.d.cts} +4 -4
- package/dist/{index-BkToATim.d.ts → index-BR19vQME.d.ts} +1 -1
- package/dist/{index-BNB0KjKe.d.ts → index-BmoUvOGN.d.ts} +1 -1
- package/dist/{index-DBhLjWSV.d.cts → index-ClaKZFPl.d.cts} +100 -31
- package/dist/{index-Dqemj9q0.d.cts → index-DWq0P9T6.d.ts} +4 -4
- package/dist/{index-Wa8jXne6.d.cts → index-Db27z6Ki.d.cts} +1 -1
- package/dist/{index-fYObbpUw.d.ts → index-DhXznWyH.d.ts} +2 -2
- package/dist/{index-DANO9Gg7.d.cts → index-DlGMf_Qe.d.cts} +2 -2
- package/dist/{index-CKyYg4IP.d.ts → index-N704txAA.d.ts} +100 -31
- package/dist/{index-DKIyo4Bq.d.cts → index-YlOH1Gw6.d.cts} +1 -1
- package/dist/index.cjs +109 -186
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -35
- package/dist/index.d.ts +22 -35
- package/dist/index.js +63 -111
- package/dist/index.js.map +1 -1
- package/dist/{meta-CrZUQAJ6.d.cts → meta-BV4pj9ML.d.cts} +6 -0
- package/dist/{meta-CrZUQAJ6.d.ts → meta-BV4pj9ML.d.ts} +6 -0
- package/dist/observable-Cz-AWhwR.d.cts +42 -0
- package/dist/observable-DCqlwGyl.d.ts +42 -0
- package/dist/patterns/reactive-layout/index.cjs +26 -2
- package/dist/patterns/reactive-layout/index.cjs.map +1 -1
- package/dist/patterns/reactive-layout/index.d.cts +3 -3
- package/dist/patterns/reactive-layout/index.d.ts +3 -3
- package/dist/patterns/reactive-layout/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-2ZICUAUJ.js.map +0 -1
- package/dist/chunk-4APC3AFN.js.map +0 -1
- package/dist/chunk-CRACCCJY.js.map +0 -1
- package/dist/chunk-QVYZD65U.js.map +0 -1
- package/dist/reactive-log-ChbpUrY2.d.cts +0 -137
- package/dist/reactive-log-DV--7BWd.d.ts +0 -137
- /package/dist/{chunk-XQ4UMAU7.js.map → chunk-ITDVOCFO.js.map} +0 -0
- /package/dist/{chunk-YW6LFCFS.js.map → chunk-LKP7IWRV.js.map} +0 -0
- /package/dist/{chunk-GKRKDYNT.js.map → chunk-RZSQ7P2C.js.map} +0 -0
- /package/dist/{chunk-ZHTHUX5D.js.map → chunk-SHRJH2DN.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -137,11 +137,16 @@ import {
|
|
|
137
137
|
workerBridge,
|
|
138
138
|
workerSelf,
|
|
139
139
|
zip
|
|
140
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-RLVFZDCE.js";
|
|
141
141
|
import {
|
|
142
142
|
cqrs_exports,
|
|
143
143
|
nestjs_exports
|
|
144
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-26A4E7J7.js";
|
|
145
|
+
import {
|
|
146
|
+
DEFAULT_DOWN,
|
|
147
|
+
bridge,
|
|
148
|
+
core_exports
|
|
149
|
+
} from "./chunk-LKP7IWRV.js";
|
|
145
150
|
import {
|
|
146
151
|
JsonCodec,
|
|
147
152
|
createDagCborCodec,
|
|
@@ -149,12 +154,7 @@ import {
|
|
|
149
154
|
graph_exports,
|
|
150
155
|
negotiateCodec,
|
|
151
156
|
replayWAL
|
|
152
|
-
} from "./chunk-
|
|
153
|
-
import {
|
|
154
|
-
DEFAULT_DOWN,
|
|
155
|
-
bridge,
|
|
156
|
-
core_exports
|
|
157
|
-
} from "./chunk-YW6LFCFS.js";
|
|
157
|
+
} from "./chunk-SHRJH2DN.js";
|
|
158
158
|
import {
|
|
159
159
|
cached,
|
|
160
160
|
createWatermarkController,
|
|
@@ -187,7 +187,7 @@ import {
|
|
|
187
187
|
toArray,
|
|
188
188
|
toMessages$,
|
|
189
189
|
toObservable
|
|
190
|
-
} from "./chunk-
|
|
190
|
+
} from "./chunk-YX263TXI.js";
|
|
191
191
|
import {
|
|
192
192
|
ResettableTimer
|
|
193
193
|
} from "./chunk-WZ2Z2CRV.js";
|
|
@@ -195,17 +195,17 @@ import {
|
|
|
195
195
|
analyzeAndMeasure,
|
|
196
196
|
computeLineBreaks,
|
|
197
197
|
reactive_layout_exports
|
|
198
|
-
} from "./chunk-
|
|
198
|
+
} from "./chunk-RZSQ7P2C.js";
|
|
199
199
|
import {
|
|
200
200
|
GRAPH_META_SEGMENT,
|
|
201
201
|
Graph,
|
|
202
202
|
reachable
|
|
203
|
-
} from "./chunk-
|
|
203
|
+
} from "./chunk-3BLRREFM.js";
|
|
204
204
|
import {
|
|
205
205
|
describeNode,
|
|
206
206
|
metaSnapshot,
|
|
207
207
|
resolveDescribeFields
|
|
208
|
-
} from "./chunk-
|
|
208
|
+
} from "./chunk-ITDVOCFO.js";
|
|
209
209
|
import {
|
|
210
210
|
CLEANUP_RESULT,
|
|
211
211
|
COMPLETE,
|
|
@@ -249,7 +249,7 @@ import {
|
|
|
249
249
|
propagatesToMeta,
|
|
250
250
|
state,
|
|
251
251
|
wallClockNs
|
|
252
|
-
} from "./chunk-
|
|
252
|
+
} from "./chunk-VZY2B2LU.js";
|
|
253
253
|
|
|
254
254
|
// src/compat/index.ts
|
|
255
255
|
var compat_exports = {};
|
|
@@ -1665,7 +1665,6 @@ function promptNode(adapter, deps, prompt, opts) {
|
|
|
1665
1665
|
}
|
|
1666
1666
|
var ChatStreamGraph = class extends Graph {
|
|
1667
1667
|
_log;
|
|
1668
|
-
_keepaliveSubs = [];
|
|
1669
1668
|
messages;
|
|
1670
1669
|
latest;
|
|
1671
1670
|
messageCount;
|
|
@@ -1680,7 +1679,7 @@ var ChatStreamGraph = class extends Graph {
|
|
|
1680
1679
|
this.latest = derived(
|
|
1681
1680
|
[this.messages],
|
|
1682
1681
|
([snapshot]) => {
|
|
1683
|
-
const entries = snapshot
|
|
1682
|
+
const entries = snapshot;
|
|
1684
1683
|
return entries.length === 0 ? void 0 : entries[entries.length - 1];
|
|
1685
1684
|
},
|
|
1686
1685
|
{
|
|
@@ -1692,10 +1691,10 @@ var ChatStreamGraph = class extends Graph {
|
|
|
1692
1691
|
);
|
|
1693
1692
|
this.add("latest", this.latest);
|
|
1694
1693
|
this.connect("messages", "latest");
|
|
1695
|
-
this.
|
|
1694
|
+
this.addDisposer(keepalive(this.latest));
|
|
1696
1695
|
this.messageCount = derived(
|
|
1697
1696
|
[this.messages],
|
|
1698
|
-
([snapshot]) => snapshot.
|
|
1697
|
+
([snapshot]) => snapshot.length,
|
|
1699
1698
|
{
|
|
1700
1699
|
name: "messageCount",
|
|
1701
1700
|
describeKind: "derived",
|
|
@@ -1705,7 +1704,7 @@ var ChatStreamGraph = class extends Graph {
|
|
|
1705
1704
|
);
|
|
1706
1705
|
this.add("messageCount", this.messageCount);
|
|
1707
1706
|
this.connect("messages", "messageCount");
|
|
1708
|
-
this.
|
|
1707
|
+
this.addDisposer(keepalive(this.messageCount));
|
|
1709
1708
|
}
|
|
1710
1709
|
append(role, content, extra) {
|
|
1711
1710
|
this._log.append({ role, content, ...extra });
|
|
@@ -1717,12 +1716,7 @@ var ChatStreamGraph = class extends Graph {
|
|
|
1717
1716
|
this._log.clear();
|
|
1718
1717
|
}
|
|
1719
1718
|
allMessages() {
|
|
1720
|
-
return this.messages.get()
|
|
1721
|
-
}
|
|
1722
|
-
destroy() {
|
|
1723
|
-
for (const unsub of this._keepaliveSubs) unsub();
|
|
1724
|
-
this._keepaliveSubs.length = 0;
|
|
1725
|
-
super.destroy();
|
|
1719
|
+
return this.messages.get();
|
|
1726
1720
|
}
|
|
1727
1721
|
};
|
|
1728
1722
|
function chatStream(name, opts) {
|
|
@@ -1731,7 +1725,6 @@ function chatStream(name, opts) {
|
|
|
1731
1725
|
var ToolRegistryGraph = class extends Graph {
|
|
1732
1726
|
definitions;
|
|
1733
1727
|
schemas;
|
|
1734
|
-
_keepaliveSubs = [];
|
|
1735
1728
|
constructor(name, opts = {}) {
|
|
1736
1729
|
super(name, opts.graph);
|
|
1737
1730
|
this.definitions = state(/* @__PURE__ */ new Map(), {
|
|
@@ -1752,7 +1745,7 @@ var ToolRegistryGraph = class extends Graph {
|
|
|
1752
1745
|
);
|
|
1753
1746
|
this.add("schemas", this.schemas);
|
|
1754
1747
|
this.connect("definitions", "schemas");
|
|
1755
|
-
this.
|
|
1748
|
+
this.addDisposer(keepalive(this.schemas));
|
|
1756
1749
|
}
|
|
1757
1750
|
register(tool) {
|
|
1758
1751
|
const current = this.definitions.get();
|
|
@@ -1777,11 +1770,6 @@ var ToolRegistryGraph = class extends Graph {
|
|
|
1777
1770
|
getDefinition(name) {
|
|
1778
1771
|
return this.definitions.get().get(name);
|
|
1779
1772
|
}
|
|
1780
|
-
destroy() {
|
|
1781
|
-
for (const unsub of this._keepaliveSubs) unsub();
|
|
1782
|
-
this._keepaliveSubs.length = 0;
|
|
1783
|
-
super.destroy();
|
|
1784
|
-
}
|
|
1785
1773
|
};
|
|
1786
1774
|
function toolRegistry(name, opts) {
|
|
1787
1775
|
return new ToolRegistryGraph(name, opts);
|
|
@@ -1926,9 +1914,7 @@ function admissionFilter3D(opts = {}) {
|
|
|
1926
1914
|
}
|
|
1927
1915
|
var DEFAULT_DECAY_RATE = Math.LN2 / (7 * 86400);
|
|
1928
1916
|
function extractStoreMap(snapshot) {
|
|
1929
|
-
if (snapshot
|
|
1930
|
-
return snapshot.value.map ?? /* @__PURE__ */ new Map();
|
|
1931
|
-
}
|
|
1917
|
+
if (snapshot instanceof Map) return snapshot;
|
|
1932
1918
|
return /* @__PURE__ */ new Map();
|
|
1933
1919
|
}
|
|
1934
1920
|
function agentMemory(name, source, opts) {
|
|
@@ -1979,7 +1965,7 @@ function agentMemory(name, source, opts) {
|
|
|
1979
1965
|
consolidateTrigger
|
|
1980
1966
|
};
|
|
1981
1967
|
const distillBundle = distill(filteredSource, extractFn, distillOpts);
|
|
1982
|
-
graph.add("store", distillBundle.store.
|
|
1968
|
+
graph.add("store", distillBundle.store.entries);
|
|
1983
1969
|
graph.add("compact", distillBundle.compact);
|
|
1984
1970
|
graph.add("size", distillBundle.size);
|
|
1985
1971
|
graph.connect("store", "compact");
|
|
@@ -2006,7 +1992,7 @@ function agentMemory(name, source, opts) {
|
|
|
2006
1992
|
const permanentKeys = /* @__PURE__ */ new Set();
|
|
2007
1993
|
const tierOf = (key) => {
|
|
2008
1994
|
if (permanentKeys.has(key)) return "permanent";
|
|
2009
|
-
const storeMap = extractStoreMap(distillBundle.store.
|
|
1995
|
+
const storeMap = extractStoreMap(distillBundle.store.entries.get());
|
|
2010
1996
|
if (storeMap.has(key)) return "active";
|
|
2011
1997
|
return "archived";
|
|
2012
1998
|
};
|
|
@@ -2015,7 +2001,7 @@ function agentMemory(name, source, opts) {
|
|
|
2015
2001
|
permanent.upsert(key, value);
|
|
2016
2002
|
};
|
|
2017
2003
|
const entryCreatedAtNs = /* @__PURE__ */ new Map();
|
|
2018
|
-
const storeNode = distillBundle.store.
|
|
2004
|
+
const storeNode = distillBundle.store.entries;
|
|
2019
2005
|
const contextNode = opts.context ? fromAny(opts.context) : state(null);
|
|
2020
2006
|
const tierClassifier = effect([storeNode, contextNode], ([snapshot, ctx]) => {
|
|
2021
2007
|
const storeMap = extractStoreMap(snapshot);
|
|
@@ -2082,7 +2068,7 @@ function agentMemory(name, source, opts) {
|
|
|
2082
2068
|
if (vectors || kg) {
|
|
2083
2069
|
const embedFn = opts.embedFn;
|
|
2084
2070
|
const entityFn = opts.entityFn;
|
|
2085
|
-
const storeNode = distillBundle.store.
|
|
2071
|
+
const storeNode = distillBundle.store.entries;
|
|
2086
2072
|
const indexer = effect([storeNode], ([snapshot]) => {
|
|
2087
2073
|
const storeMap = extractStoreMap(snapshot);
|
|
2088
2074
|
for (const [key, mem] of storeMap) {
|
|
@@ -2127,7 +2113,7 @@ function agentMemory(name, source, opts) {
|
|
|
2127
2113
|
});
|
|
2128
2114
|
graph.add("retrievalTrace", traceState);
|
|
2129
2115
|
retrievalTraceNode = traceState;
|
|
2130
|
-
const storeNode = distillBundle.store.
|
|
2116
|
+
const storeNode = distillBundle.store.entries;
|
|
2131
2117
|
let lastTrace = null;
|
|
2132
2118
|
const retrievalDerived = derived(
|
|
2133
2119
|
[queryInput, storeNode, contextNode],
|
|
@@ -2220,12 +2206,10 @@ function agentMemory(name, source, opts) {
|
|
|
2220
2206
|
return result;
|
|
2221
2207
|
};
|
|
2222
2208
|
}
|
|
2223
|
-
|
|
2224
|
-
graph.destroy = () => {
|
|
2209
|
+
graph.addDisposer(() => {
|
|
2225
2210
|
for (const unsub of keepaliveSubs) unsub();
|
|
2226
2211
|
keepaliveSubs.length = 0;
|
|
2227
|
-
|
|
2228
|
-
};
|
|
2212
|
+
});
|
|
2229
2213
|
return Object.assign(graph, {
|
|
2230
2214
|
distillBundle,
|
|
2231
2215
|
compact: distillBundle.compact,
|
|
@@ -3268,7 +3252,7 @@ function funnel(name, sources, stages, opts) {
|
|
|
3268
3252
|
});
|
|
3269
3253
|
g.add(bridgeName, br);
|
|
3270
3254
|
g.connect(prevOutputPath, bridgeName);
|
|
3271
|
-
keepalive2(br);
|
|
3255
|
+
g.addDisposer(keepalive2(br));
|
|
3272
3256
|
prevOutputPath = `${stage.name}::output`;
|
|
3273
3257
|
}
|
|
3274
3258
|
return g;
|
|
@@ -3320,7 +3304,7 @@ function feedback(graph, condition, reentry, opts) {
|
|
|
3320
3304
|
});
|
|
3321
3305
|
graph.add(feedbackEffectName, feedbackEffect);
|
|
3322
3306
|
graph.connect(condition, feedbackEffectName);
|
|
3323
|
-
keepalive2(feedbackEffect);
|
|
3307
|
+
graph.addDisposer(keepalive2(feedbackEffect));
|
|
3324
3308
|
return graph;
|
|
3325
3309
|
}
|
|
3326
3310
|
function budgetGate(source, constraints, opts) {
|
|
@@ -3700,7 +3684,7 @@ function contentModerationGraph(name, opts) {
|
|
|
3700
3684
|
}
|
|
3701
3685
|
});
|
|
3702
3686
|
g.add("__review_accumulator", reviewAccumulator);
|
|
3703
|
-
keepalive3(reviewAccumulator);
|
|
3687
|
+
g.addDisposer(keepalive3(reviewAccumulator));
|
|
3704
3688
|
try {
|
|
3705
3689
|
g.connect("stratify::branch/review", "__review_accumulator");
|
|
3706
3690
|
} catch {
|
|
@@ -3748,8 +3732,7 @@ function contentModerationGraph(name, opts) {
|
|
|
3748
3732
|
const fbCondition = derived(
|
|
3749
3733
|
[reviewLog.entries, policy2],
|
|
3750
3734
|
(vals) => {
|
|
3751
|
-
const
|
|
3752
|
-
const entries = snap?.value?.entries;
|
|
3735
|
+
const entries = vals[0];
|
|
3753
3736
|
if (entries && entries.length > 0) {
|
|
3754
3737
|
const latest = entries[entries.length - 1];
|
|
3755
3738
|
if (latest && latest.falsePositive) {
|
|
@@ -4981,7 +4964,6 @@ function messagingMeta(kind, extra) {
|
|
|
4981
4964
|
}
|
|
4982
4965
|
var TopicGraph = class extends Graph {
|
|
4983
4966
|
_log;
|
|
4984
|
-
_keepaliveDisposers = [];
|
|
4985
4967
|
events;
|
|
4986
4968
|
latest;
|
|
4987
4969
|
constructor(name, opts = {}) {
|
|
@@ -4992,7 +4974,7 @@ var TopicGraph = class extends Graph {
|
|
|
4992
4974
|
this.latest = derived(
|
|
4993
4975
|
[this.events],
|
|
4994
4976
|
([snapshot]) => {
|
|
4995
|
-
const entries = snapshot
|
|
4977
|
+
const entries = snapshot;
|
|
4996
4978
|
return entries.length === 0 ? void 0 : entries[entries.length - 1];
|
|
4997
4979
|
},
|
|
4998
4980
|
{
|
|
@@ -5004,23 +4986,16 @@ var TopicGraph = class extends Graph {
|
|
|
5004
4986
|
);
|
|
5005
4987
|
this.add("latest", this.latest);
|
|
5006
4988
|
this.connect("events", "latest");
|
|
5007
|
-
this.
|
|
5008
|
-
}
|
|
5009
|
-
destroy() {
|
|
5010
|
-
for (const dispose of this._keepaliveDisposers) dispose();
|
|
5011
|
-
this._keepaliveDisposers.length = 0;
|
|
5012
|
-
super.destroy();
|
|
4989
|
+
this.addDisposer(keepalive4(this.latest));
|
|
5013
4990
|
}
|
|
5014
4991
|
publish(value) {
|
|
5015
4992
|
this._log.append(value);
|
|
5016
4993
|
}
|
|
5017
4994
|
retained() {
|
|
5018
|
-
|
|
5019
|
-
return snapshot.value.entries;
|
|
4995
|
+
return this.events.get();
|
|
5020
4996
|
}
|
|
5021
4997
|
};
|
|
5022
4998
|
var SubscriptionGraph = class extends Graph {
|
|
5023
|
-
_keepaliveDisposers = [];
|
|
5024
4999
|
source;
|
|
5025
5000
|
cursor;
|
|
5026
5001
|
available;
|
|
@@ -5045,7 +5020,7 @@ var SubscriptionGraph = class extends Graph {
|
|
|
5045
5020
|
this.available = derived(
|
|
5046
5021
|
[this.source, this.cursor],
|
|
5047
5022
|
([sourceSnapshot, cursor]) => {
|
|
5048
|
-
const entries = sourceSnapshot
|
|
5023
|
+
const entries = sourceSnapshot;
|
|
5049
5024
|
const start = Math.max(0, Math.trunc(cursor ?? 0));
|
|
5050
5025
|
return entries.slice(start);
|
|
5051
5026
|
},
|
|
@@ -5060,13 +5035,8 @@ var SubscriptionGraph = class extends Graph {
|
|
|
5060
5035
|
this.connect("topic::events", "source");
|
|
5061
5036
|
this.connect("source", "available");
|
|
5062
5037
|
this.connect("cursor", "available");
|
|
5063
|
-
this.
|
|
5064
|
-
this.
|
|
5065
|
-
}
|
|
5066
|
-
destroy() {
|
|
5067
|
-
for (const dispose of this._keepaliveDisposers) dispose();
|
|
5068
|
-
this._keepaliveDisposers.length = 0;
|
|
5069
|
-
super.destroy();
|
|
5038
|
+
this.addDisposer(keepalive4(this.source));
|
|
5039
|
+
this.addDisposer(keepalive4(this.available));
|
|
5070
5040
|
}
|
|
5071
5041
|
ack(count) {
|
|
5072
5042
|
const available = this.available.get();
|
|
@@ -5088,7 +5058,6 @@ var SubscriptionGraph = class extends Graph {
|
|
|
5088
5058
|
var JobQueueGraph = class extends Graph {
|
|
5089
5059
|
_pending;
|
|
5090
5060
|
_jobs;
|
|
5091
|
-
_keepaliveDisposers = [];
|
|
5092
5061
|
_seq = 0;
|
|
5093
5062
|
pending;
|
|
5094
5063
|
jobs;
|
|
@@ -5098,27 +5067,18 @@ var JobQueueGraph = class extends Graph {
|
|
|
5098
5067
|
this._pending = reactiveList([], { name: "pending" });
|
|
5099
5068
|
this._jobs = reactiveMap({ name: "jobs" });
|
|
5100
5069
|
this.pending = this._pending.items;
|
|
5101
|
-
this.jobs = this._jobs.
|
|
5070
|
+
this.jobs = this._jobs.entries;
|
|
5102
5071
|
this.add("pending", this.pending);
|
|
5103
5072
|
this.add("jobs", this.jobs);
|
|
5104
|
-
this.depth = derived(
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
meta: messagingMeta("queue_depth"),
|
|
5111
|
-
initial: 0
|
|
5112
|
-
}
|
|
5113
|
-
);
|
|
5073
|
+
this.depth = derived([this.pending], ([snapshot]) => snapshot.length, {
|
|
5074
|
+
name: "depth",
|
|
5075
|
+
describeKind: "derived",
|
|
5076
|
+
meta: messagingMeta("queue_depth"),
|
|
5077
|
+
initial: 0
|
|
5078
|
+
});
|
|
5114
5079
|
this.add("depth", this.depth);
|
|
5115
5080
|
this.connect("pending", "depth");
|
|
5116
|
-
this.
|
|
5117
|
-
}
|
|
5118
|
-
destroy() {
|
|
5119
|
-
for (const dispose of this._keepaliveDisposers) dispose();
|
|
5120
|
-
this._keepaliveDisposers.length = 0;
|
|
5121
|
-
super.destroy();
|
|
5081
|
+
this.addDisposer(keepalive4(this.depth));
|
|
5122
5082
|
}
|
|
5123
5083
|
enqueue(payload, opts = {}) {
|
|
5124
5084
|
const id = opts.id ?? `${this.name}-${++this._seq}`;
|
|
@@ -5141,8 +5101,7 @@ var JobQueueGraph = class extends Graph {
|
|
|
5141
5101
|
if (max === 0) return [];
|
|
5142
5102
|
const out = [];
|
|
5143
5103
|
while (out.length < max) {
|
|
5144
|
-
const
|
|
5145
|
-
const ids = snapshot.value.items;
|
|
5104
|
+
const ids = this.pending.get();
|
|
5146
5105
|
if (ids.length === 0) break;
|
|
5147
5106
|
const id = this._pending.pop(0);
|
|
5148
5107
|
const job = this._jobs.get(id);
|
|
@@ -5178,7 +5137,6 @@ var JobQueueGraph = class extends Graph {
|
|
|
5178
5137
|
var JobFlowGraph = class extends Graph {
|
|
5179
5138
|
_stageNames;
|
|
5180
5139
|
_queues = /* @__PURE__ */ new Map();
|
|
5181
|
-
_keepaliveDisposers = [];
|
|
5182
5140
|
_completed;
|
|
5183
5141
|
completed;
|
|
5184
5142
|
completedCount;
|
|
@@ -5203,7 +5161,7 @@ var JobFlowGraph = class extends Graph {
|
|
|
5203
5161
|
this.add("completed", this.completed);
|
|
5204
5162
|
this.completedCount = derived(
|
|
5205
5163
|
[this.completed],
|
|
5206
|
-
([snapshot]) => snapshot.
|
|
5164
|
+
([snapshot]) => snapshot.length,
|
|
5207
5165
|
{
|
|
5208
5166
|
name: "completedCount",
|
|
5209
5167
|
describeKind: "derived",
|
|
@@ -5213,7 +5171,7 @@ var JobFlowGraph = class extends Graph {
|
|
|
5213
5171
|
);
|
|
5214
5172
|
this.add("completedCount", this.completedCount);
|
|
5215
5173
|
this.connect("completed", "completedCount");
|
|
5216
|
-
this.
|
|
5174
|
+
this.addDisposer(keepalive4(this.completedCount));
|
|
5217
5175
|
const maxPerPump = Math.max(
|
|
5218
5176
|
1,
|
|
5219
5177
|
requireNonNegativeInt(opts.maxPerPump ?? DEFAULT_MAX_PER_PUMP, "job flow maxPerPump")
|
|
@@ -5253,14 +5211,9 @@ var JobFlowGraph = class extends Graph {
|
|
|
5253
5211
|
);
|
|
5254
5212
|
this.add(`pump_${stage}`, pump);
|
|
5255
5213
|
this.connect(`${stage}::pending`, `pump_${stage}`);
|
|
5256
|
-
this.
|
|
5214
|
+
this.addDisposer(keepalive4(pump));
|
|
5257
5215
|
}
|
|
5258
5216
|
}
|
|
5259
|
-
destroy() {
|
|
5260
|
-
for (const dispose of this._keepaliveDisposers) dispose();
|
|
5261
|
-
this._keepaliveDisposers.length = 0;
|
|
5262
|
-
super.destroy();
|
|
5263
|
-
}
|
|
5264
5217
|
stages() {
|
|
5265
5218
|
return this._stageNames;
|
|
5266
5219
|
}
|
|
@@ -5273,14 +5226,12 @@ var JobFlowGraph = class extends Graph {
|
|
|
5273
5226
|
return this.queue(this._stageNames[0]).enqueue(payload, opts);
|
|
5274
5227
|
}
|
|
5275
5228
|
retainedCompleted() {
|
|
5276
|
-
|
|
5277
|
-
return snapshot.value.entries;
|
|
5229
|
+
return this.completed.get();
|
|
5278
5230
|
}
|
|
5279
5231
|
};
|
|
5280
5232
|
var TopicBridgeGraph = class extends Graph {
|
|
5281
5233
|
_sourceSub;
|
|
5282
5234
|
_target;
|
|
5283
|
-
_keepaliveDisposers = [];
|
|
5284
5235
|
bridgedCount;
|
|
5285
5236
|
constructor(name, sourceTopic, targetTopic, opts = {}) {
|
|
5286
5237
|
super(name, opts.graph);
|
|
@@ -5325,12 +5276,7 @@ var TopicBridgeGraph = class extends Graph {
|
|
|
5325
5276
|
);
|
|
5326
5277
|
this.add("pump", pump);
|
|
5327
5278
|
this.connect("subscription::available", "pump");
|
|
5328
|
-
this.
|
|
5329
|
-
}
|
|
5330
|
-
destroy() {
|
|
5331
|
-
for (const dispose of this._keepaliveDisposers) dispose();
|
|
5332
|
-
this._keepaliveDisposers.length = 0;
|
|
5333
|
-
super.destroy();
|
|
5279
|
+
this.addDisposer(keepalive4(pump));
|
|
5334
5280
|
}
|
|
5335
5281
|
};
|
|
5336
5282
|
function topic(name, opts) {
|
|
@@ -5622,7 +5568,7 @@ function gate(graph, name, source, opts) {
|
|
|
5622
5568
|
isOpenNode.down([[DATA, false]]);
|
|
5623
5569
|
}
|
|
5624
5570
|
};
|
|
5625
|
-
countNode.subscribe(() => void 0);
|
|
5571
|
+
graph.addDisposer(countNode.subscribe(() => void 0));
|
|
5626
5572
|
registerStep(graph, name, output, src.path ? [src.path] : []);
|
|
5627
5573
|
const internal = new Graph(`${name}_state`);
|
|
5628
5574
|
internal.add("pending", pendingNode);
|
|
@@ -5869,9 +5815,9 @@ var DEFAULT_QUEUE_CONFIGS = {
|
|
|
5869
5815
|
function strategyModel() {
|
|
5870
5816
|
const _map = reactiveMap({ name: "strategy-entries" });
|
|
5871
5817
|
const snapshot = derived(
|
|
5872
|
-
[_map.
|
|
5818
|
+
[_map.entries],
|
|
5873
5819
|
([mapSnap]) => {
|
|
5874
|
-
const raw = mapSnap
|
|
5820
|
+
const raw = mapSnap;
|
|
5875
5821
|
return new Map(raw);
|
|
5876
5822
|
},
|
|
5877
5823
|
{
|
|
@@ -5906,7 +5852,10 @@ function strategyModel() {
|
|
|
5906
5852
|
}
|
|
5907
5853
|
const _unsub = snapshot.subscribe(() => {
|
|
5908
5854
|
});
|
|
5909
|
-
|
|
5855
|
+
function dispose() {
|
|
5856
|
+
_unsub();
|
|
5857
|
+
}
|
|
5858
|
+
return { node: snapshot, record, lookup, dispose };
|
|
5910
5859
|
}
|
|
5911
5860
|
function priorityScore(item, strategy, lastInteractionNs, urgency, signals) {
|
|
5912
5861
|
const severityWeights = { ...DEFAULT_SEVERITY_WEIGHTS, ...signals?.severityWeights };
|
|
@@ -6062,7 +6011,7 @@ function harnessLoop(name, opts) {
|
|
|
6062
6011
|
const topic2 = queueTopics.get(item.route);
|
|
6063
6012
|
if (topic2) topic2.publish(item);
|
|
6064
6013
|
});
|
|
6065
|
-
router.subscribe(() => {
|
|
6014
|
+
const routerUnsub = router.subscribe(() => {
|
|
6066
6015
|
});
|
|
6067
6016
|
const gateGraph = new Graph("gates");
|
|
6068
6017
|
const gateControllers = /* @__PURE__ */ new Map();
|
|
@@ -6174,7 +6123,7 @@ function harnessLoop(name, opts) {
|
|
|
6174
6123
|
}
|
|
6175
6124
|
}
|
|
6176
6125
|
});
|
|
6177
|
-
fastRetry.subscribe(() => {
|
|
6126
|
+
const fastRetryUnsub = fastRetry.subscribe(() => {
|
|
6178
6127
|
});
|
|
6179
6128
|
const harness = new HarnessGraph(
|
|
6180
6129
|
name,
|
|
@@ -6186,6 +6135,9 @@ function harnessLoop(name, opts) {
|
|
|
6186
6135
|
retryTracker,
|
|
6187
6136
|
reingestionTracker
|
|
6188
6137
|
);
|
|
6138
|
+
harness.addDisposer(routerUnsub);
|
|
6139
|
+
harness.addDisposer(fastRetryUnsub);
|
|
6140
|
+
harness.addDisposer(strategy.dispose);
|
|
6189
6141
|
harness.mount("intake", intake);
|
|
6190
6142
|
for (const [route, topic2] of queueTopics) {
|
|
6191
6143
|
harness.mount(`queue/${route}`, topic2);
|