@graphrefly/graphrefly 0.19.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.
Files changed (52) hide show
  1. package/README.md +20 -3
  2. package/dist/{chunk-JC2SN46B.js → chunk-2UDLYZHT.js} +3 -3
  3. package/dist/{chunk-YXR3WW3Q.js → chunk-4MQ2J6IG.js} +4 -4
  4. package/dist/{chunk-YXR3WW3Q.js.map → chunk-4MQ2J6IG.js.map} +1 -1
  5. package/dist/{chunk-XUOY3YKN.js → chunk-7IGHIFTT.js} +2 -2
  6. package/dist/{chunk-AHRKWMNI.js → chunk-DOSLSFKL.js} +3 -3
  7. package/dist/{chunk-BER7UYLM.js → chunk-ECN37NVS.js} +161 -199
  8. package/dist/chunk-ECN37NVS.js.map +1 -0
  9. package/dist/{chunk-YLR5JUJZ.js → chunk-G66H6ZRK.js} +3 -3
  10. package/dist/{chunk-IRZAGZUB.js → chunk-VOQFK7YN.js} +26 -2
  11. package/dist/chunk-VOQFK7YN.js.map +1 -0
  12. package/dist/{chunk-OO5QOAXI.js → chunk-XWBVAO2R.js} +22 -9
  13. package/dist/chunk-XWBVAO2R.js.map +1 -0
  14. package/dist/{chunk-UW77D7SP.js → chunk-ZTCDY5NQ.js} +3 -3
  15. package/dist/compat/nestjs/index.cjs +15 -6
  16. package/dist/compat/nestjs/index.cjs.map +1 -1
  17. package/dist/compat/nestjs/index.js +7 -7
  18. package/dist/core/index.cjs +3 -3
  19. package/dist/core/index.cjs.map +1 -1
  20. package/dist/core/index.d.cts +1 -1
  21. package/dist/core/index.d.ts +1 -1
  22. package/dist/core/index.js +3 -3
  23. package/dist/extra/index.cjs +183 -199
  24. package/dist/extra/index.cjs.map +1 -1
  25. package/dist/extra/index.d.cts +1 -1
  26. package/dist/extra/index.d.ts +1 -1
  27. package/dist/extra/index.js +7 -3
  28. package/dist/graph/index.cjs +1 -1
  29. package/dist/graph/index.cjs.map +1 -1
  30. package/dist/graph/index.js +4 -4
  31. package/dist/{index-CvKzv0AW.d.ts → index-BHfg_Ez3.d.ts} +1 -1
  32. package/dist/{index-BBUYZfJ1.d.cts → index-Bc_diYYJ.d.cts} +1 -1
  33. package/dist/{index-BnkMgNNa.d.ts → index-DuN3bhtm.d.ts} +47 -2
  34. package/dist/{index-Bjh5C1Tp.d.cts → index-SFzE_KTa.d.cts} +47 -2
  35. package/dist/index.cjs +463 -281
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +275 -10
  38. package/dist/index.d.ts +275 -10
  39. package/dist/index.js +284 -90
  40. package/dist/index.js.map +1 -1
  41. package/dist/patterns/reactive-layout/index.cjs +1 -1
  42. package/dist/patterns/reactive-layout/index.cjs.map +1 -1
  43. package/dist/patterns/reactive-layout/index.js +4 -4
  44. package/package.json +3 -2
  45. package/dist/chunk-BER7UYLM.js.map +0 -1
  46. package/dist/chunk-IRZAGZUB.js.map +0 -1
  47. package/dist/chunk-OO5QOAXI.js.map +0 -1
  48. /package/dist/{chunk-JC2SN46B.js.map → chunk-2UDLYZHT.js.map} +0 -0
  49. /package/dist/{chunk-XUOY3YKN.js.map → chunk-7IGHIFTT.js.map} +0 -0
  50. /package/dist/{chunk-AHRKWMNI.js.map → chunk-DOSLSFKL.js.map} +0 -0
  51. /package/dist/{chunk-YLR5JUJZ.js.map → chunk-G66H6ZRK.js.map} +0 -0
  52. /package/dist/{chunk-UW77D7SP.js.map → chunk-ZTCDY5NQ.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -196,6 +196,7 @@ __export(index_exports, {
196
196
  isTerminalMessage: () => isTerminalMessage,
197
197
  isV1: () => isV1,
198
198
  jotai: () => jotai_exports,
199
+ keepalive: () => keepalive,
199
200
  knownMessageTypes: () => knownMessageTypes,
200
201
  last: () => last,
201
202
  layout: () => reactive_layout_exports,
@@ -238,6 +239,7 @@ __export(index_exports, {
238
239
  rateLimiter: () => rateLimiter,
239
240
  reachable: () => reachable,
240
241
  react: () => react_exports,
242
+ reactiveCounter: () => reactiveCounter,
241
243
  reactiveIndex: () => reactiveIndex,
242
244
  reactiveList: () => reactiveList,
243
245
  reactiveLog: () => reactiveLog,
@@ -1352,7 +1354,7 @@ var NodeImpl = class extends NodeBase {
1352
1354
  try {
1353
1355
  const consumed = this._onMessage(msg, index, this._actions);
1354
1356
  if (consumed) {
1355
- if (t === START) {
1357
+ if (t === START || t === DATA || t === RESOLVED) {
1356
1358
  this._depDirtyMask.clear(index);
1357
1359
  if (this._depDirtyMask.any() && this._depSettledMask.covers(this._depDirtyMask)) {
1358
1360
  this._depDirtyMask.reset();
@@ -1845,8 +1847,8 @@ function producer(fn, opts) {
1845
1847
  function derived(deps, fn, opts) {
1846
1848
  return node(deps, fn, { describeKind: "derived", ...opts });
1847
1849
  }
1848
- function effect(deps, fn) {
1849
- return node(deps, fn, { describeKind: "effect" });
1850
+ function effect(deps, fn, opts) {
1851
+ return node(deps, fn, { describeKind: "effect", ...opts });
1850
1852
  }
1851
1853
  function pipe(source, ...ops) {
1852
1854
  let current = source;
@@ -2842,6 +2844,28 @@ function firstWhere(source, predicate) {
2842
2844
  });
2843
2845
  }
2844
2846
  var shareReplay = replay;
2847
+ function keepalive(n) {
2848
+ return n.subscribe(() => {
2849
+ });
2850
+ }
2851
+ function reactiveCounter(cap) {
2852
+ const counter = state(0);
2853
+ return {
2854
+ node: counter,
2855
+ increment() {
2856
+ const current = counter.get() ?? 0;
2857
+ if (current >= cap) return false;
2858
+ counter.down([[DIRTY], [DATA, current + 1]]);
2859
+ return true;
2860
+ },
2861
+ get() {
2862
+ return counter.get() ?? 0;
2863
+ },
2864
+ atCap() {
2865
+ return (counter.get() ?? 0) >= cap;
2866
+ }
2867
+ };
2868
+ }
2845
2869
 
2846
2870
  // src/compat/nestjs/explorer.ts
2847
2871
  var scheduleSeq = 0;
@@ -6069,6 +6093,18 @@ function replayWAL(entries) {
6069
6093
  return result;
6070
6094
  }
6071
6095
 
6096
+ // src/patterns/_internal.ts
6097
+ function domainMeta(domain, kind, extra) {
6098
+ return {
6099
+ [domain]: true,
6100
+ [`${domain}_type`]: kind,
6101
+ ...extra ?? {}
6102
+ };
6103
+ }
6104
+ function trackingKey(item) {
6105
+ return item.relatedTo?.[0] ?? item.summary;
6106
+ }
6107
+
6072
6108
  // src/patterns/cqrs.ts
6073
6109
  var COMMAND_GUARD = policy((allow, deny) => {
6074
6110
  allow("write");
@@ -6086,11 +6122,7 @@ var EVENT_GUARD = policy((allow, deny) => {
6086
6122
  deny("write");
6087
6123
  });
6088
6124
  function cqrsMeta(kind, extra) {
6089
- return { cqrs: true, cqrs_type: kind, ...extra ?? {} };
6090
- }
6091
- function keepalive(n) {
6092
- return n.subscribe(() => {
6093
- });
6125
+ return domainMeta("cqrs", kind, extra);
6094
6126
  }
6095
6127
  var MemoryEventStore = class {
6096
6128
  _store = /* @__PURE__ */ new Map();
@@ -7150,6 +7182,7 @@ __export(extra_exports, {
7150
7182
  fromWebhook: () => fromWebhook,
7151
7183
  globToRegExp: () => globToRegExp,
7152
7184
  interval: () => interval,
7185
+ keepalive: () => keepalive,
7153
7186
  last: () => last,
7154
7187
  linear: () => linear,
7155
7188
  logSlice: () => logSlice,
@@ -7171,6 +7204,7 @@ __export(extra_exports, {
7171
7204
  pubsub: () => pubsub,
7172
7205
  race: () => race,
7173
7206
  rateLimiter: () => rateLimiter,
7207
+ reactiveCounter: () => reactiveCounter,
7174
7208
  reactiveIndex: () => reactiveIndex,
7175
7209
  reactiveList: () => reactiveList,
7176
7210
  reactiveLog: () => reactiveLog,
@@ -10666,9 +10700,11 @@ function scan(source, reducer, seed, opts) {
10666
10700
  function reduce(source, reducer, seed, opts) {
10667
10701
  let acc = seed;
10668
10702
  let sawData = false;
10703
+ let depHasData = false;
10669
10704
  return node(
10670
10705
  [source],
10671
10706
  ([v]) => {
10707
+ if (!depHasData) return void 0;
10672
10708
  sawData = true;
10673
10709
  acc = reducer(acc, v);
10674
10710
  return void 0;
@@ -10679,8 +10715,10 @@ function reduce(source, reducer, seed, opts) {
10679
10715
  onResubscribe: opts?.resubscribable === true ? () => {
10680
10716
  acc = seed;
10681
10717
  sawData = false;
10718
+ depHasData = false;
10682
10719
  } : void 0,
10683
10720
  onMessage(msg, _i, a) {
10721
+ if (msg[0] === DATA) depHasData = true;
10684
10722
  if (msg[0] === COMPLETE) {
10685
10723
  if (!sawData) acc = seed;
10686
10724
  a.emit(acc);
@@ -10799,9 +10837,11 @@ function skip(source, count, opts) {
10799
10837
  }
10800
10838
  function takeWhile(source, predicate, opts) {
10801
10839
  let done = false;
10840
+ let depHasData = false;
10802
10841
  return node(
10803
10842
  [source],
10804
10843
  ([v], a) => {
10844
+ if (!depHasData) return void 0;
10805
10845
  if (done) return void 0;
10806
10846
  if (!predicate(v)) {
10807
10847
  done = true;
@@ -10814,6 +10854,7 @@ function takeWhile(source, predicate, opts) {
10814
10854
  ...operatorOpts3(opts),
10815
10855
  completeWhenDepsComplete: false,
10816
10856
  onMessage(msg, _i, a) {
10857
+ if (msg[0] === DATA) depHasData = true;
10817
10858
  if (done) {
10818
10859
  if (msg[0] === COMPLETE) {
10819
10860
  a.down([[COMPLETE]]);
@@ -10866,9 +10907,11 @@ function last(source, options) {
10866
10907
  const useDefault = options != null && Object.hasOwn(options, "defaultValue");
10867
10908
  let lastVal;
10868
10909
  let has = false;
10910
+ let depHasData = false;
10869
10911
  return node(
10870
10912
  [source],
10871
10913
  ([v]) => {
10914
+ if (!depHasData) return void 0;
10872
10915
  lastVal = v;
10873
10916
  has = true;
10874
10917
  return void 0;
@@ -10877,6 +10920,7 @@ function last(source, options) {
10877
10920
  ...operatorOpts3(rest),
10878
10921
  completeWhenDepsComplete: false,
10879
10922
  onMessage(msg, _i, a) {
10923
+ if (msg[0] === DATA) depHasData = true;
10880
10924
  if (msg[0] === COMPLETE) {
10881
10925
  if (has) {
10882
10926
  a.emit(lastVal);
@@ -11263,120 +11307,101 @@ function forwardInner(inner, a, onInnerComplete) {
11263
11307
  function switchMap(source, project, opts) {
11264
11308
  let innerUnsub;
11265
11309
  let sourceDone = false;
11266
- let attached = false;
11267
11310
  function clearInner() {
11268
11311
  innerUnsub?.();
11269
11312
  innerUnsub = void 0;
11270
11313
  }
11271
11314
  function attach(v, a) {
11272
- attached = true;
11273
11315
  clearInner();
11274
11316
  innerUnsub = forwardInner(fromAny(project(v)), a, () => {
11275
11317
  clearInner();
11276
11318
  if (sourceDone) a.down([[COMPLETE]]);
11277
11319
  });
11278
11320
  }
11279
- return node(
11280
- [source],
11281
- ([v], a) => {
11282
- if (!attached) attach(v, a);
11283
- return clearInner;
11284
- },
11285
- {
11286
- ...operatorOpts3(opts),
11287
- completeWhenDepsComplete: false,
11288
- onMessage(msg, _i, a) {
11289
- const t = msg[0];
11290
- if (t === ERROR) {
11291
- clearInner();
11292
- a.down([msg]);
11293
- return true;
11294
- }
11295
- if (t === COMPLETE) {
11296
- sourceDone = true;
11297
- if (innerUnsub === void 0) a.down([[COMPLETE]]);
11298
- return true;
11299
- }
11300
- if (t === DIRTY) {
11301
- a.down([[DIRTY]]);
11302
- return true;
11303
- }
11304
- if (t === RESOLVED) {
11305
- a.down([[RESOLVED]]);
11306
- return true;
11307
- }
11308
- if (t === DATA) {
11309
- attach(msg[1], a);
11310
- return true;
11311
- }
11312
- 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;
11335
+ }
11336
+ if (t === DIRTY) {
11337
+ a.down([[DIRTY]]);
11338
+ return true;
11313
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;
11314
11349
  }
11315
- );
11350
+ });
11316
11351
  }
11317
11352
  function exhaustMap(source, project, opts) {
11318
11353
  let innerUnsub;
11319
11354
  let sourceDone = false;
11320
- let attached = false;
11321
11355
  function clearInner() {
11322
11356
  innerUnsub?.();
11323
11357
  innerUnsub = void 0;
11324
11358
  }
11325
11359
  function attach(v, a) {
11326
- attached = true;
11327
11360
  innerUnsub = forwardInner(fromAny(project(v)), a, () => {
11328
11361
  clearInner();
11329
11362
  if (sourceDone) a.down([[COMPLETE]]);
11330
11363
  });
11331
11364
  }
11332
- return node(
11333
- [source],
11334
- ([v], a) => {
11335
- if (!attached && innerUnsub === void 0) attach(v, a);
11336
- return clearInner;
11337
- },
11338
- {
11339
- ...operatorOpts3(opts),
11340
- completeWhenDepsComplete: false,
11341
- onMessage(msg, _i, a) {
11342
- const t = msg[0];
11343
- if (t === ERROR) {
11344
- clearInner();
11345
- a.down([msg]);
11346
- return true;
11347
- }
11348
- if (t === COMPLETE) {
11349
- sourceDone = true;
11350
- if (innerUnsub === void 0) a.down([[COMPLETE]]);
11351
- return true;
11352
- }
11353
- if (t === DIRTY) {
11354
- a.down([[DIRTY]]);
11355
- return true;
11356
- }
11357
- 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) {
11358
11390
  a.down([[RESOLVED]]);
11359
11391
  return true;
11360
11392
  }
11361
- if (t === DATA) {
11362
- if (innerUnsub !== void 0) {
11363
- a.down([[RESOLVED]]);
11364
- return true;
11365
- }
11366
- attach(msg[1], a);
11367
- return true;
11368
- }
11369
- return false;
11393
+ attach(msg[1], a);
11394
+ return true;
11370
11395
  }
11396
+ return false;
11371
11397
  }
11372
- );
11398
+ });
11373
11399
  }
11374
11400
  function concatMap(source, project, opts) {
11375
11401
  const { maxBuffer: maxBuf, ...concatNodeOpts } = opts ?? {};
11376
11402
  const queue = [];
11377
11403
  let innerUnsub;
11378
11404
  let sourceDone = false;
11379
- let attached = false;
11380
11405
  function clearInner() {
11381
11406
  innerUnsub?.();
11382
11407
  innerUnsub = void 0;
@@ -11394,49 +11419,41 @@ function concatMap(source, project, opts) {
11394
11419
  });
11395
11420
  }
11396
11421
  function enqueue(v, a) {
11397
- attached = true;
11398
11422
  if (maxBuf && maxBuf > 0 && queue.length >= maxBuf) queue.shift();
11399
11423
  queue.push(v);
11400
11424
  tryPump(a);
11401
11425
  }
11402
- return node(
11403
- [source],
11404
- ([v], a) => {
11405
- if (!attached) enqueue(v, a);
11406
- return clearInner;
11407
- },
11408
- {
11409
- ...operatorOpts3(concatNodeOpts),
11410
- completeWhenDepsComplete: false,
11411
- onMessage(msg, _i, a) {
11412
- const t = msg[0];
11413
- if (t === ERROR) {
11414
- clearInner();
11415
- queue.length = 0;
11416
- a.down([msg]);
11417
- return true;
11418
- }
11419
- if (t === COMPLETE) {
11420
- sourceDone = true;
11421
- tryPump(a);
11422
- return true;
11423
- }
11424
- if (t === DIRTY) {
11425
- a.down([[DIRTY]]);
11426
- return true;
11427
- }
11428
- if (t === RESOLVED) {
11429
- a.down([[RESOLVED]]);
11430
- return true;
11431
- }
11432
- if (t === DATA) {
11433
- enqueue(msg[1], a);
11434
- return true;
11435
- }
11436
- 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;
11437
11449
  }
11450
+ if (t === DATA) {
11451
+ enqueue(msg[1], a);
11452
+ return true;
11453
+ }
11454
+ return false;
11438
11455
  }
11439
- );
11456
+ });
11440
11457
  }
11441
11458
  function mergeMap(source, project, opts) {
11442
11459
  const { concurrent: concurrentOpt, ...mergeNodeOpts } = opts ?? {};
@@ -11492,47 +11509,36 @@ function mergeMap(source, project, opts) {
11492
11509
  active = 0;
11493
11510
  buffer2.length = 0;
11494
11511
  }
11495
- let attached = false;
11496
- return node(
11497
- [source],
11498
- ([v], a) => {
11499
- if (!attached) {
11500
- attached = true;
11501
- enqueue(v, a);
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;
11502
11521
  }
11503
- return clearAll;
11504
- },
11505
- {
11506
- ...operatorOpts3(mergeNodeOpts),
11507
- completeWhenDepsComplete: false,
11508
- onMessage(msg, _i, a) {
11509
- const t = msg[0];
11510
- if (t === ERROR) {
11511
- clearAll();
11512
- a.down([msg]);
11513
- return true;
11514
- }
11515
- if (t === COMPLETE) {
11516
- sourceDone = true;
11517
- tryComplete(a);
11518
- return true;
11519
- }
11520
- if (t === DIRTY) {
11521
- a.down([[DIRTY]]);
11522
- return true;
11523
- }
11524
- if (t === RESOLVED) {
11525
- a.down([[RESOLVED]]);
11526
- return true;
11527
- }
11528
- if (t === DATA) {
11529
- enqueue(msg[1], a);
11530
- return true;
11531
- }
11532
- 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;
11533
11534
  }
11535
+ if (t === DATA) {
11536
+ enqueue(msg[1], a);
11537
+ return true;
11538
+ }
11539
+ return false;
11534
11540
  }
11535
- );
11541
+ });
11536
11542
  }
11537
11543
  var flatMap = mergeMap;
11538
11544
  function delay(source, ms, opts) {
@@ -11851,53 +11857,39 @@ function buffer(source, notifier, opts) {
11851
11857
  function bufferCount(source, count, opts) {
11852
11858
  if (count <= 0) throw new RangeError("bufferCount expects count > 0");
11853
11859
  const buf = [];
11854
- let started = false;
11855
- return node(
11856
- [source],
11857
- ([v], a) => {
11858
- if (!started) {
11859
- started = true;
11860
- buf.push(v);
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]);
11861
11885
  if (buf.length >= count) {
11862
11886
  a.emit(buf.splice(0, buf.length));
11863
11887
  }
11888
+ return true;
11864
11889
  }
11865
- return void 0;
11866
- },
11867
- {
11868
- ...operatorOpts3(opts),
11869
- completeWhenDepsComplete: false,
11870
- onMessage(msg, _i, a) {
11871
- const t = msg[0];
11872
- if (t === ERROR) {
11873
- a.down([msg]);
11874
- return true;
11875
- }
11876
- if (t === COMPLETE) {
11877
- if (buf.length > 0) a.emit([...buf]);
11878
- buf.length = 0;
11879
- a.down([[COMPLETE]]);
11880
- return true;
11881
- }
11882
- if (t === DIRTY) {
11883
- a.down([[DIRTY]]);
11884
- return true;
11885
- }
11886
- if (t === RESOLVED) {
11887
- a.down([[RESOLVED]]);
11888
- return true;
11889
- }
11890
- if (t === DATA) {
11891
- buf.push(msg[1]);
11892
- if (buf.length >= count) {
11893
- a.emit(buf.splice(0, buf.length));
11894
- }
11895
- return true;
11896
- }
11897
- return false;
11898
- }
11890
+ return false;
11899
11891
  }
11900
- );
11892
+ });
11901
11893
  }
11902
11894
  function windowCount(source, count, opts) {
11903
11895
  if (count <= 0) throw new RangeError("windowCount expects count > 0");
@@ -13156,6 +13148,7 @@ __export(ai_exports, {
13156
13148
  agentLoop: () => agentLoop,
13157
13149
  agentMemory: () => agentMemory,
13158
13150
  chatStream: () => chatStream,
13151
+ contentGate: () => contentGate,
13159
13152
  costMeterExtractor: () => costMeterExtractor,
13160
13153
  fromLLM: () => fromLLM,
13161
13154
  gatedStream: () => gatedStream,
@@ -13166,6 +13159,7 @@ __export(ai_exports, {
13166
13159
  llmConsolidator: () => llmConsolidator,
13167
13160
  llmExtractor: () => llmExtractor,
13168
13161
  promptNode: () => promptNode,
13162
+ redactor: () => redactor,
13169
13163
  streamExtractor: () => streamExtractor,
13170
13164
  streamingPromptNode: () => streamingPromptNode,
13171
13165
  suggestStrategy: () => suggestStrategy,
@@ -13572,16 +13566,8 @@ function requireNonNegativeInt(value, label) {
13572
13566
  }
13573
13567
  return value;
13574
13568
  }
13575
- function keepalive3(n) {
13576
- return n.subscribe(() => {
13577
- });
13578
- }
13579
13569
  function messagingMeta(kind, extra) {
13580
- return {
13581
- messaging: true,
13582
- messaging_type: kind,
13583
- ...extra ?? {}
13584
- };
13570
+ return domainMeta("messaging", kind, extra);
13585
13571
  }
13586
13572
  var TopicGraph = class extends Graph {
13587
13573
  _log;
@@ -13607,7 +13593,7 @@ var TopicGraph = class extends Graph {
13607
13593
  );
13608
13594
  this.add("latest", this.latest);
13609
13595
  this.connect("events", "latest");
13610
- this.addDisposer(keepalive3(this.latest));
13596
+ this.addDisposer(keepalive(this.latest));
13611
13597
  }
13612
13598
  publish(value) {
13613
13599
  this._log.append(value);
@@ -13656,8 +13642,8 @@ var SubscriptionGraph = class extends Graph {
13656
13642
  this.connect("topic::events", "source");
13657
13643
  this.connect("source", "available");
13658
13644
  this.connect("cursor", "available");
13659
- this.addDisposer(keepalive3(this.source));
13660
- this.addDisposer(keepalive3(this.available));
13645
+ this.addDisposer(keepalive(this.source));
13646
+ this.addDisposer(keepalive(this.available));
13661
13647
  }
13662
13648
  ack(count) {
13663
13649
  const available = this.available.get();
@@ -13699,7 +13685,7 @@ var JobQueueGraph = class extends Graph {
13699
13685
  });
13700
13686
  this.add("depth", this.depth);
13701
13687
  this.connect("pending", "depth");
13702
- this.addDisposer(keepalive3(this.depth));
13688
+ this.addDisposer(keepalive(this.depth));
13703
13689
  }
13704
13690
  enqueue(payload, opts = {}) {
13705
13691
  const id = opts.id ?? `${this.name}-${++this._seq}`;
@@ -13792,7 +13778,7 @@ var JobFlowGraph = class extends Graph {
13792
13778
  );
13793
13779
  this.add("completedCount", this.completedCount);
13794
13780
  this.connect("completed", "completedCount");
13795
- this.addDisposer(keepalive3(this.completedCount));
13781
+ this.addDisposer(keepalive(this.completedCount));
13796
13782
  const maxPerPump = Math.max(
13797
13783
  1,
13798
13784
  requireNonNegativeInt(opts.maxPerPump ?? DEFAULT_MAX_PER_PUMP, "job flow maxPerPump")
@@ -13832,7 +13818,7 @@ var JobFlowGraph = class extends Graph {
13832
13818
  );
13833
13819
  this.add(`pump_${stage}`, pump);
13834
13820
  this.connect(`${stage}::pending`, `pump_${stage}`);
13835
- this.addDisposer(keepalive3(pump));
13821
+ this.addDisposer(keepalive(pump));
13836
13822
  }
13837
13823
  }
13838
13824
  stages() {
@@ -13897,7 +13883,7 @@ var TopicBridgeGraph = class extends Graph {
13897
13883
  );
13898
13884
  this.add("pump", pump);
13899
13885
  this.connect("subscription::available", "pump");
13900
- this.addDisposer(keepalive3(pump));
13886
+ this.addDisposer(keepalive(pump));
13901
13887
  }
13902
13888
  };
13903
13889
  function topic(name, opts) {
@@ -13964,11 +13950,7 @@ function registerStep(graph, name, step, depPaths) {
13964
13950
  }
13965
13951
  }
13966
13952
  function baseMeta(kind, meta) {
13967
- return {
13968
- orchestration: true,
13969
- orchestration_type: kind,
13970
- ...meta ?? {}
13971
- };
13953
+ return domainMeta("orchestration", kind, meta);
13972
13954
  }
13973
13955
  function coerceLoopIterations(raw) {
13974
13956
  const parseString = (value) => {
@@ -14414,14 +14396,7 @@ function onFailure(graph, name, source, recover, opts) {
14414
14396
 
14415
14397
  // src/patterns/ai.ts
14416
14398
  function aiMeta(kind, extra) {
14417
- return {
14418
- ai: true,
14419
- ai_type: kind,
14420
- ...extra ?? {}
14421
- };
14422
- }
14423
- function keepalive4(n) {
14424
- return n.subscribe(() => void 0);
14399
+ return domainMeta("ai", kind, extra);
14425
14400
  }
14426
14401
  function isPromiseLike(x) {
14427
14402
  return x != null && typeof x.then === "function";
@@ -14555,7 +14530,7 @@ function streamingPromptNode(adapter, deps, prompt, opts) {
14555
14530
  }
14556
14531
  return fromAny(pumpAndCollect());
14557
14532
  });
14558
- const unsub = keepalive4(output);
14533
+ const unsub = keepalive(output);
14559
14534
  return {
14560
14535
  output,
14561
14536
  stream: streamTopic,
@@ -14681,6 +14656,53 @@ function costMeterExtractor(streamTopic, opts) {
14681
14656
  }
14682
14657
  );
14683
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
+ }
14684
14706
  function gatedStream(graph, name, adapter, deps, prompt, opts) {
14685
14707
  const cancelSignal = state(0, { name: `${name}/cancel` });
14686
14708
  let cancelCounter = 0;
@@ -14740,7 +14762,7 @@ function gatedStream(graph, name, adapter, deps, prompt, opts) {
14740
14762
  }
14741
14763
  return fromAny(pumpAndCollect());
14742
14764
  });
14743
- const unsub = keepalive4(output);
14765
+ const unsub = keepalive(output);
14744
14766
  const nonNullOutput = derived(
14745
14767
  [output],
14746
14768
  ([v]) => {
@@ -14871,7 +14893,7 @@ var ChatStreamGraph = class extends Graph {
14871
14893
  );
14872
14894
  this.add("latest", this.latest);
14873
14895
  this.connect("messages", "latest");
14874
- this.addDisposer(keepalive4(this.latest));
14896
+ this.addDisposer(keepalive(this.latest));
14875
14897
  this.messageCount = derived(
14876
14898
  [this.messages],
14877
14899
  ([snapshot]) => snapshot.length,
@@ -14884,7 +14906,7 @@ var ChatStreamGraph = class extends Graph {
14884
14906
  );
14885
14907
  this.add("messageCount", this.messageCount);
14886
14908
  this.connect("messages", "messageCount");
14887
- this.addDisposer(keepalive4(this.messageCount));
14909
+ this.addDisposer(keepalive(this.messageCount));
14888
14910
  }
14889
14911
  append(role, content, extra) {
14890
14912
  this._log.append({ role, content, ...extra });
@@ -14925,7 +14947,7 @@ var ToolRegistryGraph = class extends Graph {
14925
14947
  );
14926
14948
  this.add("schemas", this.schemas);
14927
14949
  this.connect("definitions", "schemas");
14928
- this.addDisposer(keepalive4(this.schemas));
14950
+ this.addDisposer(keepalive(this.schemas));
14929
14951
  }
14930
14952
  register(tool) {
14931
14953
  const current = this.definitions.get();
@@ -14967,7 +14989,7 @@ function systemPromptBuilder(sections, opts) {
14967
14989
  initial: ""
14968
14990
  }
14969
14991
  );
14970
- const unsub = keepalive4(prompt);
14992
+ const unsub = keepalive(prompt);
14971
14993
  return Object.assign(prompt, { dispose: unsub });
14972
14994
  }
14973
14995
  function llmExtractor(systemPrompt, opts) {
@@ -16856,21 +16878,14 @@ __export(domain_templates_exports, {
16856
16878
  var reduction_exports = {};
16857
16879
  __export(reduction_exports, {
16858
16880
  budgetGate: () => budgetGate,
16881
+ effectivenessTracker: () => effectivenessTracker,
16859
16882
  feedback: () => feedback,
16860
16883
  funnel: () => funnel,
16861
16884
  scorer: () => scorer,
16862
16885
  stratify: () => stratify
16863
16886
  });
16864
16887
  function baseMeta2(kind, meta) {
16865
- return {
16866
- reduction: true,
16867
- reduction_type: kind,
16868
- ...meta ?? {}
16869
- };
16870
- }
16871
- function keepalive5(n) {
16872
- return n.subscribe(() => {
16873
- });
16888
+ return domainMeta("reduction", kind, meta);
16874
16889
  }
16875
16890
  function stratify(name, source, rules, opts) {
16876
16891
  const g = new Graph(name, opts);
@@ -17008,7 +17023,7 @@ function funnel(name, sources, stages, opts) {
17008
17023
  });
17009
17024
  g.add(bridgeName, br);
17010
17025
  g.connect(prevOutputPath, bridgeName);
17011
- g.addDisposer(keepalive5(br));
17026
+ g.addDisposer(keepalive(br));
17012
17027
  prevOutputPath = `${stage.name}::output`;
17013
17028
  }
17014
17029
  return g;
@@ -17060,7 +17075,7 @@ function feedback(graph, condition, reentry, opts) {
17060
17075
  });
17061
17076
  graph.add(feedbackEffectName, feedbackEffect);
17062
17077
  graph.connect(condition, feedbackEffectName);
17063
- graph.addDisposer(keepalive5(feedbackEffect));
17078
+ graph.addDisposer(keepalive(feedbackEffect));
17064
17079
  return graph;
17065
17080
  }
17066
17081
  function budgetGate(source, constraints, opts) {
@@ -17194,14 +17209,55 @@ function scorer(sources, weights, opts) {
17194
17209
  }
17195
17210
  );
17196
17211
  }
17197
-
17198
- // src/patterns/domain-templates.ts
17199
- function keepalive6(n) {
17200
- return n.subscribe(() => {
17212
+ function effectivenessTracker(opts) {
17213
+ const _map = reactiveMap({
17214
+ name: opts?.name ?? "effectiveness-entries"
17201
17215
  });
17216
+ const snapshot = derived(
17217
+ [_map.entries],
17218
+ ([mapSnap]) => {
17219
+ return new Map(mapSnap);
17220
+ },
17221
+ {
17222
+ name: `${opts?.name ?? "effectiveness"}-snapshot`,
17223
+ equals: (a, b) => {
17224
+ const am = a;
17225
+ const bm = b;
17226
+ if (am.size !== bm.size) return false;
17227
+ for (const [k, v] of am) {
17228
+ const bv = bm.get(k);
17229
+ if (!bv || v.attempts !== bv.attempts || v.successes !== bv.successes) return false;
17230
+ }
17231
+ return true;
17232
+ }
17233
+ }
17234
+ );
17235
+ function record(key, success) {
17236
+ const existing = _map.get(key);
17237
+ const attempts = (existing?.attempts ?? 0) + 1;
17238
+ const successes = (existing?.successes ?? 0) + (success ? 1 : 0);
17239
+ _map.set(key, {
17240
+ key,
17241
+ attempts,
17242
+ successes,
17243
+ successRate: successes / attempts
17244
+ });
17245
+ }
17246
+ function lookup(key) {
17247
+ return _map.get(key);
17248
+ }
17249
+ const _unsub = keepalive(snapshot);
17250
+ return {
17251
+ node: snapshot,
17252
+ record,
17253
+ lookup,
17254
+ dispose: () => _unsub()
17255
+ };
17202
17256
  }
17257
+
17258
+ // src/patterns/domain-templates.ts
17203
17259
  function baseMeta3(kind, extra) {
17204
- return { domain_template: true, template_type: kind, ...extra ?? {} };
17260
+ return domainMeta("domain_template", kind, extra);
17205
17261
  }
17206
17262
  function observabilityGraph(name, opts) {
17207
17263
  const g = new Graph(name, opts);
@@ -17441,7 +17497,7 @@ function contentModerationGraph(name, opts) {
17441
17497
  }
17442
17498
  });
17443
17499
  g.add("__review_accumulator", reviewAccumulator);
17444
- g.addDisposer(keepalive6(reviewAccumulator));
17500
+ g.addDisposer(keepalive(reviewAccumulator));
17445
17501
  try {
17446
17502
  g.connect("stratify::branch/review", "__review_accumulator");
17447
17503
  } catch {
@@ -17552,7 +17608,7 @@ function dataQualityGraph(name, opts) {
17552
17608
  });
17553
17609
  g.add("__baseline_updater", baselineUpdater);
17554
17610
  g.connect("validate", "__baseline_updater");
17555
- keepalive6(baselineUpdater);
17611
+ keepalive(baselineUpdater);
17556
17612
  const detectDriftFn = opts.detectDrift ?? (() => ({ drift: false }));
17557
17613
  const driftNode = derived(
17558
17614
  [opts.source, baseline],
@@ -18642,52 +18698,179 @@ __export(harness_exports, {
18642
18698
  DEFAULT_SEVERITY_WEIGHTS: () => DEFAULT_SEVERITY_WEIGHTS,
18643
18699
  HarnessGraph: () => HarnessGraph,
18644
18700
  QUEUE_NAMES: () => QUEUE_NAMES,
18701
+ affectedTaskFilter: () => affectedTaskFilter,
18702
+ beforeAfterCompare: () => beforeAfterCompare,
18703
+ codeChangeBridge: () => codeChangeBridge,
18704
+ createIntakeBridge: () => createIntakeBridge,
18645
18705
  defaultErrorClassifier: () => defaultErrorClassifier,
18646
18706
  evalIntakeBridge: () => evalIntakeBridge,
18707
+ evalSource: () => evalSource,
18647
18708
  harnessLoop: () => harnessLoop,
18648
18709
  harnessProfile: () => harnessProfile,
18649
18710
  harnessTrace: () => harnessTrace,
18711
+ notifyEffect: () => notifyEffect,
18650
18712
  priorityScore: () => priorityScore,
18651
18713
  strategyKey: () => strategyKey,
18652
18714
  strategyModel: () => strategyModel
18653
18715
  });
18654
18716
 
18655
18717
  // src/patterns/harness/bridge.ts
18656
- function evalIntakeBridge(evalSource, intakeTopic, opts) {
18718
+ function createIntakeBridge(source, intakeTopic, parser, opts) {
18719
+ return effect(
18720
+ [source],
18721
+ ([value]) => {
18722
+ if (value == null) return;
18723
+ const items = parser(value);
18724
+ for (const item of items) {
18725
+ intakeTopic.publish(item);
18726
+ }
18727
+ },
18728
+ { name: opts?.name ?? "intake-bridge" }
18729
+ );
18730
+ }
18731
+ function evalIntakeBridge(evalSource2, intakeTopic, opts) {
18657
18732
  const defaultSeverity = opts?.defaultSeverity ?? "medium";
18658
- return effect([evalSource], ([results]) => {
18659
- if (results == null) return;
18660
- const runs = Array.isArray(results) ? results : [results];
18661
- for (const run of runs) {
18662
- for (const task2 of run.tasks) {
18663
- if (task2.valid && task2.judge_scores?.every((s) => s.pass)) continue;
18664
- if (!task2.valid && (!task2.judge_scores || task2.judge_scores.length === 0)) {
18665
- intakeTopic.publish({
18666
- source: "eval",
18667
- summary: `Task ${task2.task_id} invalid (model: ${run.model})`,
18668
- evidence: `Run ${run.run_id}: task produced invalid output`,
18669
- affectsAreas: ["graphspec"],
18670
- affectsEvalTasks: [task2.task_id],
18671
- severity: defaultSeverity
18672
- });
18673
- continue;
18674
- }
18675
- if (task2.judge_scores) {
18676
- for (const score of task2.judge_scores) {
18677
- if (score.pass) continue;
18733
+ return effect(
18734
+ [evalSource2],
18735
+ ([results]) => {
18736
+ if (results == null) return;
18737
+ const runs = Array.isArray(results) ? results : [results];
18738
+ for (const run of runs) {
18739
+ for (const task2 of run.tasks) {
18740
+ if (task2.valid && task2.judge_scores?.every((s) => s.pass)) continue;
18741
+ if (!task2.valid && (!task2.judge_scores || task2.judge_scores.length === 0)) {
18678
18742
  intakeTopic.publish({
18679
18743
  source: "eval",
18680
- summary: `${task2.task_id}: ${score.claim} (model: ${run.model})`,
18681
- evidence: score.reasoning,
18744
+ summary: `Task ${task2.task_id} invalid (model: ${run.model})`,
18745
+ evidence: `Run ${run.run_id}: task produced invalid output`,
18682
18746
  affectsAreas: ["graphspec"],
18683
18747
  affectsEvalTasks: [task2.task_id],
18684
18748
  severity: defaultSeverity
18685
18749
  });
18750
+ continue;
18751
+ }
18752
+ if (task2.judge_scores) {
18753
+ for (const score of task2.judge_scores) {
18754
+ if (score.pass) continue;
18755
+ intakeTopic.publish({
18756
+ source: "eval",
18757
+ summary: `${task2.task_id}: ${score.claim} (model: ${run.model})`,
18758
+ evidence: score.reasoning,
18759
+ affectsAreas: ["graphspec"],
18760
+ affectsEvalTasks: [task2.task_id],
18761
+ severity: defaultSeverity
18762
+ });
18763
+ }
18686
18764
  }
18687
18765
  }
18688
18766
  }
18767
+ },
18768
+ { name: opts?.name ?? "eval-intake-bridge" }
18769
+ );
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
+ });
18689
18840
  }
18690
- });
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
+ );
18691
18874
  }
18692
18875
 
18693
18876
  // src/patterns/harness/types.ts
@@ -18797,9 +18980,6 @@ function priorityScore(item, strategy, lastInteractionNs, urgency, signals) {
18797
18980
  }
18798
18981
 
18799
18982
  // src/patterns/harness/loop.ts
18800
- function trackingKey(item) {
18801
- return item.relatedTo?.[0] ?? item.summary;
18802
- }
18803
18983
  var DEFAULT_TRIAGE_PROMPT = `You are a triage classifier for a reactive collaboration harness.
18804
18984
 
18805
18985
  Given an intake item, classify it and output JSON:
@@ -19806,6 +19986,7 @@ var version = "0.0.0";
19806
19986
  isTerminalMessage,
19807
19987
  isV1,
19808
19988
  jotai,
19989
+ keepalive,
19809
19990
  knownMessageTypes,
19810
19991
  last,
19811
19992
  layout,
@@ -19848,6 +20029,7 @@ var version = "0.0.0";
19848
20029
  rateLimiter,
19849
20030
  reachable,
19850
20031
  react,
20032
+ reactiveCounter,
19851
20033
  reactiveIndex,
19852
20034
  reactiveList,
19853
20035
  reactiveLog,