@graphrefly/graphrefly 0.20.0 → 0.21.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/README.md +20 -3
- package/dist/{chunk-3N2Y6PCR.js → chunk-2UDLYZHT.js} +3 -3
- package/dist/{chunk-XYL3GLB3.js → chunk-4MQ2J6IG.js} +2 -2
- package/dist/{chunk-XYL3GLB3.js.map → chunk-4MQ2J6IG.js.map} +1 -1
- package/dist/{chunk-2L5J6RPM.js → chunk-7IGHIFTT.js} +2 -2
- package/dist/{chunk-PGEU5MEH.js → chunk-DOSLSFKL.js} +3 -3
- package/dist/{chunk-BJAOEU4D.js → chunk-ECN37NVS.js} +154 -196
- package/dist/chunk-ECN37NVS.js.map +1 -0
- package/dist/{chunk-R2LPZIY2.js → chunk-G66H6ZRK.js} +3 -3
- package/dist/{chunk-OOA2UTXF.js → chunk-VOQFK7YN.js} +2 -2
- package/dist/{chunk-5PSVTDNZ.js → chunk-XWBVAO2R.js} +4 -4
- package/dist/{chunk-IAPLC4NR.js → chunk-ZTCDY5NQ.js} +3 -3
- package/dist/compat/nestjs/index.cjs +1 -1
- package/dist/compat/nestjs/index.cjs.map +1 -1
- package/dist/compat/nestjs/index.js +7 -7
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +3 -3
- package/dist/extra/index.cjs +152 -194
- package/dist/extra/index.cjs.map +1 -1
- package/dist/extra/index.js +3 -3
- package/dist/graph/index.cjs +1 -1
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.js +4 -4
- package/dist/index.cjs +312 -196
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +201 -5
- package/dist/index.d.ts +201 -5
- package/dist/index.js +173 -15
- package/dist/index.js.map +1 -1
- package/dist/patterns/reactive-layout/index.cjs +1 -1
- package/dist/patterns/reactive-layout/index.cjs.map +1 -1
- package/dist/patterns/reactive-layout/index.js +4 -4
- package/package.json +2 -1
- package/dist/chunk-BJAOEU4D.js.map +0 -1
- /package/dist/{chunk-3N2Y6PCR.js.map → chunk-2UDLYZHT.js.map} +0 -0
- /package/dist/{chunk-2L5J6RPM.js.map → chunk-7IGHIFTT.js.map} +0 -0
- /package/dist/{chunk-PGEU5MEH.js.map → chunk-DOSLSFKL.js.map} +0 -0
- /package/dist/{chunk-R2LPZIY2.js.map → chunk-G66H6ZRK.js.map} +0 -0
- /package/dist/{chunk-OOA2UTXF.js.map → chunk-VOQFK7YN.js.map} +0 -0
- /package/dist/{chunk-5PSVTDNZ.js.map → chunk-XWBVAO2R.js.map} +0 -0
- /package/dist/{chunk-IAPLC4NR.js.map → chunk-ZTCDY5NQ.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1354,7 +1354,7 @@ var NodeImpl = class extends NodeBase {
|
|
|
1354
1354
|
try {
|
|
1355
1355
|
const consumed = this._onMessage(msg, index, this._actions);
|
|
1356
1356
|
if (consumed) {
|
|
1357
|
-
if (t === START) {
|
|
1357
|
+
if (t === START || t === DATA || t === RESOLVED) {
|
|
1358
1358
|
this._depDirtyMask.clear(index);
|
|
1359
1359
|
if (this._depDirtyMask.any() && this._depSettledMask.covers(this._depDirtyMask)) {
|
|
1360
1360
|
this._depDirtyMask.reset();
|
|
@@ -10700,9 +10700,11 @@ function scan(source, reducer, seed, opts) {
|
|
|
10700
10700
|
function reduce(source, reducer, seed, opts) {
|
|
10701
10701
|
let acc = seed;
|
|
10702
10702
|
let sawData = false;
|
|
10703
|
+
let depHasData = false;
|
|
10703
10704
|
return node(
|
|
10704
10705
|
[source],
|
|
10705
10706
|
([v]) => {
|
|
10707
|
+
if (!depHasData) return void 0;
|
|
10706
10708
|
sawData = true;
|
|
10707
10709
|
acc = reducer(acc, v);
|
|
10708
10710
|
return void 0;
|
|
@@ -10713,8 +10715,10 @@ function reduce(source, reducer, seed, opts) {
|
|
|
10713
10715
|
onResubscribe: opts?.resubscribable === true ? () => {
|
|
10714
10716
|
acc = seed;
|
|
10715
10717
|
sawData = false;
|
|
10718
|
+
depHasData = false;
|
|
10716
10719
|
} : void 0,
|
|
10717
10720
|
onMessage(msg, _i, a) {
|
|
10721
|
+
if (msg[0] === DATA) depHasData = true;
|
|
10718
10722
|
if (msg[0] === COMPLETE) {
|
|
10719
10723
|
if (!sawData) acc = seed;
|
|
10720
10724
|
a.emit(acc);
|
|
@@ -10833,9 +10837,11 @@ function skip(source, count, opts) {
|
|
|
10833
10837
|
}
|
|
10834
10838
|
function takeWhile(source, predicate, opts) {
|
|
10835
10839
|
let done = false;
|
|
10840
|
+
let depHasData = false;
|
|
10836
10841
|
return node(
|
|
10837
10842
|
[source],
|
|
10838
10843
|
([v], a) => {
|
|
10844
|
+
if (!depHasData) return void 0;
|
|
10839
10845
|
if (done) return void 0;
|
|
10840
10846
|
if (!predicate(v)) {
|
|
10841
10847
|
done = true;
|
|
@@ -10848,6 +10854,7 @@ function takeWhile(source, predicate, opts) {
|
|
|
10848
10854
|
...operatorOpts3(opts),
|
|
10849
10855
|
completeWhenDepsComplete: false,
|
|
10850
10856
|
onMessage(msg, _i, a) {
|
|
10857
|
+
if (msg[0] === DATA) depHasData = true;
|
|
10851
10858
|
if (done) {
|
|
10852
10859
|
if (msg[0] === COMPLETE) {
|
|
10853
10860
|
a.down([[COMPLETE]]);
|
|
@@ -10900,9 +10907,11 @@ function last(source, options) {
|
|
|
10900
10907
|
const useDefault = options != null && Object.hasOwn(options, "defaultValue");
|
|
10901
10908
|
let lastVal;
|
|
10902
10909
|
let has = false;
|
|
10910
|
+
let depHasData = false;
|
|
10903
10911
|
return node(
|
|
10904
10912
|
[source],
|
|
10905
10913
|
([v]) => {
|
|
10914
|
+
if (!depHasData) return void 0;
|
|
10906
10915
|
lastVal = v;
|
|
10907
10916
|
has = true;
|
|
10908
10917
|
return void 0;
|
|
@@ -10911,6 +10920,7 @@ function last(source, options) {
|
|
|
10911
10920
|
...operatorOpts3(rest),
|
|
10912
10921
|
completeWhenDepsComplete: false,
|
|
10913
10922
|
onMessage(msg, _i, a) {
|
|
10923
|
+
if (msg[0] === DATA) depHasData = true;
|
|
10914
10924
|
if (msg[0] === COMPLETE) {
|
|
10915
10925
|
if (has) {
|
|
10916
10926
|
a.emit(lastVal);
|
|
@@ -11297,120 +11307,101 @@ function forwardInner(inner, a, onInnerComplete) {
|
|
|
11297
11307
|
function switchMap(source, project, opts) {
|
|
11298
11308
|
let innerUnsub;
|
|
11299
11309
|
let sourceDone = false;
|
|
11300
|
-
let attached = false;
|
|
11301
11310
|
function clearInner() {
|
|
11302
11311
|
innerUnsub?.();
|
|
11303
11312
|
innerUnsub = void 0;
|
|
11304
11313
|
}
|
|
11305
11314
|
function attach(v, a) {
|
|
11306
|
-
attached = true;
|
|
11307
11315
|
clearInner();
|
|
11308
11316
|
innerUnsub = forwardInner(fromAny(project(v)), a, () => {
|
|
11309
11317
|
clearInner();
|
|
11310
11318
|
if (sourceDone) a.down([[COMPLETE]]);
|
|
11311
11319
|
});
|
|
11312
11320
|
}
|
|
11313
|
-
return node(
|
|
11314
|
-
|
|
11315
|
-
|
|
11316
|
-
|
|
11317
|
-
|
|
11318
|
-
|
|
11319
|
-
|
|
11320
|
-
|
|
11321
|
-
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
|
|
11327
|
-
return true;
|
|
11328
|
-
}
|
|
11329
|
-
if (t === COMPLETE) {
|
|
11330
|
-
sourceDone = true;
|
|
11331
|
-
if (innerUnsub === void 0) a.down([[COMPLETE]]);
|
|
11332
|
-
return true;
|
|
11333
|
-
}
|
|
11334
|
-
if (t === DIRTY) {
|
|
11335
|
-
a.down([[DIRTY]]);
|
|
11336
|
-
return true;
|
|
11337
|
-
}
|
|
11338
|
-
if (t === RESOLVED) {
|
|
11339
|
-
a.down([[RESOLVED]]);
|
|
11340
|
-
return true;
|
|
11341
|
-
}
|
|
11342
|
-
if (t === DATA) {
|
|
11343
|
-
attach(msg[1], a);
|
|
11344
|
-
return true;
|
|
11345
|
-
}
|
|
11346
|
-
return false;
|
|
11321
|
+
return node([source], () => clearInner, {
|
|
11322
|
+
...operatorOpts3(opts),
|
|
11323
|
+
completeWhenDepsComplete: false,
|
|
11324
|
+
onMessage(msg, _i, a) {
|
|
11325
|
+
const t = msg[0];
|
|
11326
|
+
if (t === ERROR) {
|
|
11327
|
+
clearInner();
|
|
11328
|
+
a.down([msg]);
|
|
11329
|
+
return true;
|
|
11330
|
+
}
|
|
11331
|
+
if (t === COMPLETE) {
|
|
11332
|
+
sourceDone = true;
|
|
11333
|
+
if (innerUnsub === void 0) a.down([[COMPLETE]]);
|
|
11334
|
+
return true;
|
|
11347
11335
|
}
|
|
11336
|
+
if (t === DIRTY) {
|
|
11337
|
+
a.down([[DIRTY]]);
|
|
11338
|
+
return true;
|
|
11339
|
+
}
|
|
11340
|
+
if (t === RESOLVED) {
|
|
11341
|
+
a.down([[RESOLVED]]);
|
|
11342
|
+
return true;
|
|
11343
|
+
}
|
|
11344
|
+
if (t === DATA) {
|
|
11345
|
+
attach(msg[1], a);
|
|
11346
|
+
return true;
|
|
11347
|
+
}
|
|
11348
|
+
return false;
|
|
11348
11349
|
}
|
|
11349
|
-
);
|
|
11350
|
+
});
|
|
11350
11351
|
}
|
|
11351
11352
|
function exhaustMap(source, project, opts) {
|
|
11352
11353
|
let innerUnsub;
|
|
11353
11354
|
let sourceDone = false;
|
|
11354
|
-
let attached = false;
|
|
11355
11355
|
function clearInner() {
|
|
11356
11356
|
innerUnsub?.();
|
|
11357
11357
|
innerUnsub = void 0;
|
|
11358
11358
|
}
|
|
11359
11359
|
function attach(v, a) {
|
|
11360
|
-
attached = true;
|
|
11361
11360
|
innerUnsub = forwardInner(fromAny(project(v)), a, () => {
|
|
11362
11361
|
clearInner();
|
|
11363
11362
|
if (sourceDone) a.down([[COMPLETE]]);
|
|
11364
11363
|
});
|
|
11365
11364
|
}
|
|
11366
|
-
return node(
|
|
11367
|
-
|
|
11368
|
-
|
|
11369
|
-
|
|
11370
|
-
|
|
11371
|
-
|
|
11372
|
-
|
|
11373
|
-
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11377
|
-
|
|
11378
|
-
|
|
11379
|
-
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
|
|
11385
|
-
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
|
|
11389
|
-
|
|
11390
|
-
|
|
11391
|
-
if (t === RESOLVED) {
|
|
11365
|
+
return node([source], () => clearInner, {
|
|
11366
|
+
...operatorOpts3(opts),
|
|
11367
|
+
completeWhenDepsComplete: false,
|
|
11368
|
+
onMessage(msg, _i, a) {
|
|
11369
|
+
const t = msg[0];
|
|
11370
|
+
if (t === ERROR) {
|
|
11371
|
+
clearInner();
|
|
11372
|
+
a.down([msg]);
|
|
11373
|
+
return true;
|
|
11374
|
+
}
|
|
11375
|
+
if (t === COMPLETE) {
|
|
11376
|
+
sourceDone = true;
|
|
11377
|
+
if (innerUnsub === void 0) a.down([[COMPLETE]]);
|
|
11378
|
+
return true;
|
|
11379
|
+
}
|
|
11380
|
+
if (t === DIRTY) {
|
|
11381
|
+
a.down([[DIRTY]]);
|
|
11382
|
+
return true;
|
|
11383
|
+
}
|
|
11384
|
+
if (t === RESOLVED) {
|
|
11385
|
+
a.down([[RESOLVED]]);
|
|
11386
|
+
return true;
|
|
11387
|
+
}
|
|
11388
|
+
if (t === DATA) {
|
|
11389
|
+
if (innerUnsub !== void 0) {
|
|
11392
11390
|
a.down([[RESOLVED]]);
|
|
11393
11391
|
return true;
|
|
11394
11392
|
}
|
|
11395
|
-
|
|
11396
|
-
|
|
11397
|
-
a.down([[RESOLVED]]);
|
|
11398
|
-
return true;
|
|
11399
|
-
}
|
|
11400
|
-
attach(msg[1], a);
|
|
11401
|
-
return true;
|
|
11402
|
-
}
|
|
11403
|
-
return false;
|
|
11393
|
+
attach(msg[1], a);
|
|
11394
|
+
return true;
|
|
11404
11395
|
}
|
|
11396
|
+
return false;
|
|
11405
11397
|
}
|
|
11406
|
-
);
|
|
11398
|
+
});
|
|
11407
11399
|
}
|
|
11408
11400
|
function concatMap(source, project, opts) {
|
|
11409
11401
|
const { maxBuffer: maxBuf, ...concatNodeOpts } = opts ?? {};
|
|
11410
11402
|
const queue = [];
|
|
11411
11403
|
let innerUnsub;
|
|
11412
11404
|
let sourceDone = false;
|
|
11413
|
-
let attached = false;
|
|
11414
11405
|
function clearInner() {
|
|
11415
11406
|
innerUnsub?.();
|
|
11416
11407
|
innerUnsub = void 0;
|
|
@@ -11428,49 +11419,41 @@ function concatMap(source, project, opts) {
|
|
|
11428
11419
|
});
|
|
11429
11420
|
}
|
|
11430
11421
|
function enqueue(v, a) {
|
|
11431
|
-
attached = true;
|
|
11432
11422
|
if (maxBuf && maxBuf > 0 && queue.length >= maxBuf) queue.shift();
|
|
11433
11423
|
queue.push(v);
|
|
11434
11424
|
tryPump(a);
|
|
11435
11425
|
}
|
|
11436
|
-
return node(
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11441
|
-
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11454
|
-
|
|
11455
|
-
|
|
11456
|
-
|
|
11457
|
-
|
|
11458
|
-
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
a.down([[RESOLVED]]);
|
|
11464
|
-
return true;
|
|
11465
|
-
}
|
|
11466
|
-
if (t === DATA) {
|
|
11467
|
-
enqueue(msg[1], a);
|
|
11468
|
-
return true;
|
|
11469
|
-
}
|
|
11470
|
-
return false;
|
|
11426
|
+
return node([source], () => clearInner, {
|
|
11427
|
+
...operatorOpts3(concatNodeOpts),
|
|
11428
|
+
completeWhenDepsComplete: false,
|
|
11429
|
+
onMessage(msg, _i, a) {
|
|
11430
|
+
const t = msg[0];
|
|
11431
|
+
if (t === ERROR) {
|
|
11432
|
+
clearInner();
|
|
11433
|
+
queue.length = 0;
|
|
11434
|
+
a.down([msg]);
|
|
11435
|
+
return true;
|
|
11436
|
+
}
|
|
11437
|
+
if (t === COMPLETE) {
|
|
11438
|
+
sourceDone = true;
|
|
11439
|
+
tryPump(a);
|
|
11440
|
+
return true;
|
|
11441
|
+
}
|
|
11442
|
+
if (t === DIRTY) {
|
|
11443
|
+
a.down([[DIRTY]]);
|
|
11444
|
+
return true;
|
|
11445
|
+
}
|
|
11446
|
+
if (t === RESOLVED) {
|
|
11447
|
+
a.down([[RESOLVED]]);
|
|
11448
|
+
return true;
|
|
11449
|
+
}
|
|
11450
|
+
if (t === DATA) {
|
|
11451
|
+
enqueue(msg[1], a);
|
|
11452
|
+
return true;
|
|
11471
11453
|
}
|
|
11454
|
+
return false;
|
|
11472
11455
|
}
|
|
11473
|
-
);
|
|
11456
|
+
});
|
|
11474
11457
|
}
|
|
11475
11458
|
function mergeMap(source, project, opts) {
|
|
11476
11459
|
const { concurrent: concurrentOpt, ...mergeNodeOpts } = opts ?? {};
|
|
@@ -11526,47 +11509,36 @@ function mergeMap(source, project, opts) {
|
|
|
11526
11509
|
active = 0;
|
|
11527
11510
|
buffer2.length = 0;
|
|
11528
11511
|
}
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
11532
|
-
(
|
|
11533
|
-
|
|
11534
|
-
|
|
11535
|
-
|
|
11512
|
+
return node([source], () => clearAll, {
|
|
11513
|
+
...operatorOpts3(mergeNodeOpts),
|
|
11514
|
+
completeWhenDepsComplete: false,
|
|
11515
|
+
onMessage(msg, _i, a) {
|
|
11516
|
+
const t = msg[0];
|
|
11517
|
+
if (t === ERROR) {
|
|
11518
|
+
clearAll();
|
|
11519
|
+
a.down([msg]);
|
|
11520
|
+
return true;
|
|
11536
11521
|
}
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
|
|
11553
|
-
}
|
|
11554
|
-
if (t === DIRTY) {
|
|
11555
|
-
a.down([[DIRTY]]);
|
|
11556
|
-
return true;
|
|
11557
|
-
}
|
|
11558
|
-
if (t === RESOLVED) {
|
|
11559
|
-
a.down([[RESOLVED]]);
|
|
11560
|
-
return true;
|
|
11561
|
-
}
|
|
11562
|
-
if (t === DATA) {
|
|
11563
|
-
enqueue(msg[1], a);
|
|
11564
|
-
return true;
|
|
11565
|
-
}
|
|
11566
|
-
return false;
|
|
11522
|
+
if (t === COMPLETE) {
|
|
11523
|
+
sourceDone = true;
|
|
11524
|
+
tryComplete(a);
|
|
11525
|
+
return true;
|
|
11526
|
+
}
|
|
11527
|
+
if (t === DIRTY) {
|
|
11528
|
+
a.down([[DIRTY]]);
|
|
11529
|
+
return true;
|
|
11530
|
+
}
|
|
11531
|
+
if (t === RESOLVED) {
|
|
11532
|
+
a.down([[RESOLVED]]);
|
|
11533
|
+
return true;
|
|
11534
|
+
}
|
|
11535
|
+
if (t === DATA) {
|
|
11536
|
+
enqueue(msg[1], a);
|
|
11537
|
+
return true;
|
|
11567
11538
|
}
|
|
11539
|
+
return false;
|
|
11568
11540
|
}
|
|
11569
|
-
);
|
|
11541
|
+
});
|
|
11570
11542
|
}
|
|
11571
11543
|
var flatMap = mergeMap;
|
|
11572
11544
|
function delay(source, ms, opts) {
|
|
@@ -11885,53 +11857,39 @@ function buffer(source, notifier, opts) {
|
|
|
11885
11857
|
function bufferCount(source, count, opts) {
|
|
11886
11858
|
if (count <= 0) throw new RangeError("bufferCount expects count > 0");
|
|
11887
11859
|
const buf = [];
|
|
11888
|
-
|
|
11889
|
-
|
|
11890
|
-
|
|
11891
|
-
(
|
|
11892
|
-
|
|
11893
|
-
|
|
11894
|
-
|
|
11860
|
+
return node([source], () => void 0, {
|
|
11861
|
+
...operatorOpts3(opts),
|
|
11862
|
+
completeWhenDepsComplete: false,
|
|
11863
|
+
onMessage(msg, _i, a) {
|
|
11864
|
+
const t = msg[0];
|
|
11865
|
+
if (t === ERROR) {
|
|
11866
|
+
a.down([msg]);
|
|
11867
|
+
return true;
|
|
11868
|
+
}
|
|
11869
|
+
if (t === COMPLETE) {
|
|
11870
|
+
if (buf.length > 0) a.emit([...buf]);
|
|
11871
|
+
buf.length = 0;
|
|
11872
|
+
a.down([[COMPLETE]]);
|
|
11873
|
+
return true;
|
|
11874
|
+
}
|
|
11875
|
+
if (t === DIRTY) {
|
|
11876
|
+
a.down([[DIRTY]]);
|
|
11877
|
+
return true;
|
|
11878
|
+
}
|
|
11879
|
+
if (t === RESOLVED) {
|
|
11880
|
+
a.down([[RESOLVED]]);
|
|
11881
|
+
return true;
|
|
11882
|
+
}
|
|
11883
|
+
if (t === DATA) {
|
|
11884
|
+
buf.push(msg[1]);
|
|
11895
11885
|
if (buf.length >= count) {
|
|
11896
11886
|
a.emit(buf.splice(0, buf.length));
|
|
11897
11887
|
}
|
|
11888
|
+
return true;
|
|
11898
11889
|
}
|
|
11899
|
-
return
|
|
11900
|
-
},
|
|
11901
|
-
{
|
|
11902
|
-
...operatorOpts3(opts),
|
|
11903
|
-
completeWhenDepsComplete: false,
|
|
11904
|
-
onMessage(msg, _i, a) {
|
|
11905
|
-
const t = msg[0];
|
|
11906
|
-
if (t === ERROR) {
|
|
11907
|
-
a.down([msg]);
|
|
11908
|
-
return true;
|
|
11909
|
-
}
|
|
11910
|
-
if (t === COMPLETE) {
|
|
11911
|
-
if (buf.length > 0) a.emit([...buf]);
|
|
11912
|
-
buf.length = 0;
|
|
11913
|
-
a.down([[COMPLETE]]);
|
|
11914
|
-
return true;
|
|
11915
|
-
}
|
|
11916
|
-
if (t === DIRTY) {
|
|
11917
|
-
a.down([[DIRTY]]);
|
|
11918
|
-
return true;
|
|
11919
|
-
}
|
|
11920
|
-
if (t === RESOLVED) {
|
|
11921
|
-
a.down([[RESOLVED]]);
|
|
11922
|
-
return true;
|
|
11923
|
-
}
|
|
11924
|
-
if (t === DATA) {
|
|
11925
|
-
buf.push(msg[1]);
|
|
11926
|
-
if (buf.length >= count) {
|
|
11927
|
-
a.emit(buf.splice(0, buf.length));
|
|
11928
|
-
}
|
|
11929
|
-
return true;
|
|
11930
|
-
}
|
|
11931
|
-
return false;
|
|
11932
|
-
}
|
|
11890
|
+
return false;
|
|
11933
11891
|
}
|
|
11934
|
-
);
|
|
11892
|
+
});
|
|
11935
11893
|
}
|
|
11936
11894
|
function windowCount(source, count, opts) {
|
|
11937
11895
|
if (count <= 0) throw new RangeError("windowCount expects count > 0");
|
|
@@ -13190,6 +13148,7 @@ __export(ai_exports, {
|
|
|
13190
13148
|
agentLoop: () => agentLoop,
|
|
13191
13149
|
agentMemory: () => agentMemory,
|
|
13192
13150
|
chatStream: () => chatStream,
|
|
13151
|
+
contentGate: () => contentGate,
|
|
13193
13152
|
costMeterExtractor: () => costMeterExtractor,
|
|
13194
13153
|
fromLLM: () => fromLLM,
|
|
13195
13154
|
gatedStream: () => gatedStream,
|
|
@@ -13200,6 +13159,7 @@ __export(ai_exports, {
|
|
|
13200
13159
|
llmConsolidator: () => llmConsolidator,
|
|
13201
13160
|
llmExtractor: () => llmExtractor,
|
|
13202
13161
|
promptNode: () => promptNode,
|
|
13162
|
+
redactor: () => redactor,
|
|
13203
13163
|
streamExtractor: () => streamExtractor,
|
|
13204
13164
|
streamingPromptNode: () => streamingPromptNode,
|
|
13205
13165
|
suggestStrategy: () => suggestStrategy,
|
|
@@ -14696,6 +14656,53 @@ function costMeterExtractor(streamTopic, opts) {
|
|
|
14696
14656
|
}
|
|
14697
14657
|
);
|
|
14698
14658
|
}
|
|
14659
|
+
function redactor(streamTopic, patterns, replaceFn, opts) {
|
|
14660
|
+
const replace = replaceFn ?? (() => "[REDACTED]");
|
|
14661
|
+
function sanitize(text) {
|
|
14662
|
+
let result = text;
|
|
14663
|
+
for (const pat of patterns) {
|
|
14664
|
+
const global = pat.global ? pat : new RegExp(pat.source, `${pat.flags}g`);
|
|
14665
|
+
result = result.replace(global, (m) => replace(m, pat));
|
|
14666
|
+
}
|
|
14667
|
+
return result;
|
|
14668
|
+
}
|
|
14669
|
+
return derived(
|
|
14670
|
+
[streamTopic.latest],
|
|
14671
|
+
([chunk]) => {
|
|
14672
|
+
if (chunk == null) {
|
|
14673
|
+
return { source: "", token: "", accumulated: "", index: -1 };
|
|
14674
|
+
}
|
|
14675
|
+
const c = chunk;
|
|
14676
|
+
const sanitizedAccumulated = sanitize(c.accumulated);
|
|
14677
|
+
const sanitizedToken = sanitize(c.token);
|
|
14678
|
+
return {
|
|
14679
|
+
source: c.source,
|
|
14680
|
+
token: sanitizedToken,
|
|
14681
|
+
accumulated: sanitizedAccumulated,
|
|
14682
|
+
index: c.index
|
|
14683
|
+
};
|
|
14684
|
+
},
|
|
14685
|
+
{ name: opts?.name ?? "redactor" }
|
|
14686
|
+
);
|
|
14687
|
+
}
|
|
14688
|
+
function contentGate(streamTopic, classifier, threshold, opts) {
|
|
14689
|
+
const hardThreshold = threshold * (opts?.hardMultiplier ?? 1.5);
|
|
14690
|
+
const isNodeClassifier = typeof classifier !== "function";
|
|
14691
|
+
const deps = [streamTopic.latest];
|
|
14692
|
+
if (isNodeClassifier) deps.push(classifier);
|
|
14693
|
+
return derived(
|
|
14694
|
+
deps,
|
|
14695
|
+
(values) => {
|
|
14696
|
+
const chunk = values[0];
|
|
14697
|
+
if (chunk == null) return "allow";
|
|
14698
|
+
const score = isNodeClassifier ? values[1] ?? 0 : classifier(chunk.accumulated);
|
|
14699
|
+
if (score >= hardThreshold) return "block";
|
|
14700
|
+
if (score >= threshold) return "review";
|
|
14701
|
+
return "allow";
|
|
14702
|
+
},
|
|
14703
|
+
{ name: opts?.name ?? "content-gate", initial: "allow" }
|
|
14704
|
+
);
|
|
14705
|
+
}
|
|
14699
14706
|
function gatedStream(graph, name, adapter, deps, prompt, opts) {
|
|
14700
14707
|
const cancelSignal = state(0, { name: `${name}/cancel` });
|
|
14701
14708
|
let cancelCounter = 0;
|
|
@@ -18691,12 +18698,17 @@ __export(harness_exports, {
|
|
|
18691
18698
|
DEFAULT_SEVERITY_WEIGHTS: () => DEFAULT_SEVERITY_WEIGHTS,
|
|
18692
18699
|
HarnessGraph: () => HarnessGraph,
|
|
18693
18700
|
QUEUE_NAMES: () => QUEUE_NAMES,
|
|
18701
|
+
affectedTaskFilter: () => affectedTaskFilter,
|
|
18702
|
+
beforeAfterCompare: () => beforeAfterCompare,
|
|
18703
|
+
codeChangeBridge: () => codeChangeBridge,
|
|
18694
18704
|
createIntakeBridge: () => createIntakeBridge,
|
|
18695
18705
|
defaultErrorClassifier: () => defaultErrorClassifier,
|
|
18696
18706
|
evalIntakeBridge: () => evalIntakeBridge,
|
|
18707
|
+
evalSource: () => evalSource,
|
|
18697
18708
|
harnessLoop: () => harnessLoop,
|
|
18698
18709
|
harnessProfile: () => harnessProfile,
|
|
18699
18710
|
harnessTrace: () => harnessTrace,
|
|
18711
|
+
notifyEffect: () => notifyEffect,
|
|
18700
18712
|
priorityScore: () => priorityScore,
|
|
18701
18713
|
strategyKey: () => strategyKey,
|
|
18702
18714
|
strategyModel: () => strategyModel
|
|
@@ -18716,10 +18728,10 @@ function createIntakeBridge(source, intakeTopic, parser, opts) {
|
|
|
18716
18728
|
{ name: opts?.name ?? "intake-bridge" }
|
|
18717
18729
|
);
|
|
18718
18730
|
}
|
|
18719
|
-
function evalIntakeBridge(
|
|
18731
|
+
function evalIntakeBridge(evalSource2, intakeTopic, opts) {
|
|
18720
18732
|
const defaultSeverity = opts?.defaultSeverity ?? "medium";
|
|
18721
18733
|
return effect(
|
|
18722
|
-
[
|
|
18734
|
+
[evalSource2],
|
|
18723
18735
|
([results]) => {
|
|
18724
18736
|
if (results == null) return;
|
|
18725
18737
|
const runs = Array.isArray(results) ? results : [results];
|
|
@@ -18756,6 +18768,110 @@ function evalIntakeBridge(evalSource, intakeTopic, opts) {
|
|
|
18756
18768
|
{ name: opts?.name ?? "eval-intake-bridge" }
|
|
18757
18769
|
);
|
|
18758
18770
|
}
|
|
18771
|
+
function evalSource(trigger2, runner) {
|
|
18772
|
+
return switchMap(trigger2, () => fromAny(runner()));
|
|
18773
|
+
}
|
|
18774
|
+
function beforeAfterCompare(before, after) {
|
|
18775
|
+
return derived(
|
|
18776
|
+
[before, after],
|
|
18777
|
+
([b, a]) => {
|
|
18778
|
+
const bRes = b;
|
|
18779
|
+
const aRes = a;
|
|
18780
|
+
const beforeMap = new Map(bRes.tasks.map((t) => [t.task_id, t]));
|
|
18781
|
+
const afterMap = new Map(aRes.tasks.map((t) => [t.task_id, t]));
|
|
18782
|
+
const allIds = /* @__PURE__ */ new Set([...beforeMap.keys(), ...afterMap.keys()]);
|
|
18783
|
+
const taskDeltas = [];
|
|
18784
|
+
const newFailures = [];
|
|
18785
|
+
const resolved = [];
|
|
18786
|
+
for (const id of allIds) {
|
|
18787
|
+
const bt = beforeMap.get(id);
|
|
18788
|
+
const at = afterMap.get(id);
|
|
18789
|
+
const beforeValid = bt?.valid ?? false;
|
|
18790
|
+
const afterValid = at?.valid ?? false;
|
|
18791
|
+
const beforeScore = bt?.judge_scores ? bt.judge_scores.filter((s) => s.pass).length : void 0;
|
|
18792
|
+
const afterScore = at?.judge_scores ? at.judge_scores.filter((s) => s.pass).length : void 0;
|
|
18793
|
+
const scoreDiff = beforeScore !== void 0 && afterScore !== void 0 ? afterScore - beforeScore : void 0;
|
|
18794
|
+
taskDeltas.push({ taskId: id, before: beforeValid, after: afterValid, scoreDiff });
|
|
18795
|
+
if (beforeValid && !afterValid) newFailures.push(id);
|
|
18796
|
+
if (!beforeValid && afterValid) resolved.push(id);
|
|
18797
|
+
}
|
|
18798
|
+
return {
|
|
18799
|
+
newFailures,
|
|
18800
|
+
resolved,
|
|
18801
|
+
taskDeltas,
|
|
18802
|
+
overallImproved: resolved.length > newFailures.length
|
|
18803
|
+
};
|
|
18804
|
+
},
|
|
18805
|
+
{ name: "eval-delta" }
|
|
18806
|
+
);
|
|
18807
|
+
}
|
|
18808
|
+
function affectedTaskFilter(issues, fullTaskSet) {
|
|
18809
|
+
const taskSetNode = fullTaskSet == null ? null : Array.isArray(fullTaskSet) ? state(fullTaskSet) : fullTaskSet;
|
|
18810
|
+
const deps = [issues];
|
|
18811
|
+
if (taskSetNode) deps.push(taskSetNode);
|
|
18812
|
+
return derived(
|
|
18813
|
+
deps,
|
|
18814
|
+
(values) => {
|
|
18815
|
+
const items = values[0];
|
|
18816
|
+
const all = taskSetNode ? new Set(values[1]) : null;
|
|
18817
|
+
const affected = /* @__PURE__ */ new Set();
|
|
18818
|
+
for (const item of items) {
|
|
18819
|
+
for (const id of item.affectsEvalTasks ?? []) {
|
|
18820
|
+
if (all == null || all.has(id)) affected.add(id);
|
|
18821
|
+
}
|
|
18822
|
+
}
|
|
18823
|
+
return [...affected].sort();
|
|
18824
|
+
},
|
|
18825
|
+
{ name: "affected-task-filter" }
|
|
18826
|
+
);
|
|
18827
|
+
}
|
|
18828
|
+
function codeChangeBridge(source, intakeTopic, parser, opts) {
|
|
18829
|
+
const defaultSeverity = opts?.defaultSeverity ?? "high";
|
|
18830
|
+
function defaultParser(change) {
|
|
18831
|
+
const items = [];
|
|
18832
|
+
for (const err of change.lintErrors ?? []) {
|
|
18833
|
+
items.push({
|
|
18834
|
+
source: "code-change",
|
|
18835
|
+
summary: `Lint: ${err.rule} in ${err.file}:${err.line}`,
|
|
18836
|
+
evidence: err.message,
|
|
18837
|
+
affectsAreas: [err.file],
|
|
18838
|
+
severity: defaultSeverity
|
|
18839
|
+
});
|
|
18840
|
+
}
|
|
18841
|
+
for (const fail of change.testFailures ?? []) {
|
|
18842
|
+
items.push({
|
|
18843
|
+
source: "test",
|
|
18844
|
+
summary: `Test failure: ${fail.testId}`,
|
|
18845
|
+
evidence: fail.message,
|
|
18846
|
+
affectsAreas: [fail.file],
|
|
18847
|
+
affectsEvalTasks: [fail.testId],
|
|
18848
|
+
severity: defaultSeverity
|
|
18849
|
+
});
|
|
18850
|
+
}
|
|
18851
|
+
return items;
|
|
18852
|
+
}
|
|
18853
|
+
const resolve = parser ?? defaultParser;
|
|
18854
|
+
return effect(
|
|
18855
|
+
[source],
|
|
18856
|
+
([change]) => {
|
|
18857
|
+
if (change == null) return;
|
|
18858
|
+
for (const item of resolve(change)) {
|
|
18859
|
+
intakeTopic.publish(item);
|
|
18860
|
+
}
|
|
18861
|
+
},
|
|
18862
|
+
{ name: opts?.name ?? "code-change-bridge" }
|
|
18863
|
+
);
|
|
18864
|
+
}
|
|
18865
|
+
function notifyEffect(topic2, transport, opts) {
|
|
18866
|
+
return effect(
|
|
18867
|
+
[topic2.latest],
|
|
18868
|
+
([item]) => {
|
|
18869
|
+
if (item == null) return;
|
|
18870
|
+
void transport(item);
|
|
18871
|
+
},
|
|
18872
|
+
{ name: opts?.name ?? "notify-effect" }
|
|
18873
|
+
);
|
|
18874
|
+
}
|
|
18759
18875
|
|
|
18760
18876
|
// src/patterns/harness/types.ts
|
|
18761
18877
|
var QUEUE_NAMES = [
|