@holonograph/client 0.3.0 → 0.5.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/index.js CHANGED
@@ -4064,7 +4064,9 @@ var SYSTEM_ROLE_SURFACE_IDS = {
4064
4064
 
4065
4065
  conformanceClerk: "system:conformance-clerk",
4066
4066
 
4067
- blastRadiusJudge: "system:blast-radius-judging"
4067
+ blastRadiusJudge: "system:blast-radius-judging",
4068
+
4069
+ orthogonalityHypothesisDrafter: "system:orthogonality-hypothesis-drafting"
4068
4070
  };
4069
4071
  var PLATFORM_SYSTEM_ROLE_SURFACES = [
4070
4072
  {
@@ -4081,6 +4083,11 @@ var PLATFORM_SYSTEM_ROLE_SURFACES = [
4081
4083
  role: "judge",
4082
4084
  surfaceId: SYSTEM_ROLE_SURFACE_IDS.blastRadiusJudge,
4083
4085
  label: "blast-radius-judge"
4086
+ },
4087
+ {
4088
+ role: "clerk",
4089
+ surfaceId: SYSTEM_ROLE_SURFACE_IDS.orthogonalityHypothesisDrafter,
4090
+ label: "orthogonality-hypothesis-drafter"
4084
4091
  }
4085
4092
  ];
4086
4093
  new Set(
@@ -4769,7 +4776,11 @@ var EvaluationEventKindSchema = external_exports.enum([
4769
4776
 
4770
4777
  "analysis.conformance-fixture",
4771
4778
 
4772
- "analysis.emission-coverage"
4779
+ "analysis.emission-coverage",
4780
+
4781
+ "analysis.delivery-orphan",
4782
+
4783
+ "analysis.orthogonality-hypothesis"
4773
4784
  ]);
4774
4785
  var AvailabilityTransitionDirectionSchema = external_exports.enum([
4775
4786
  "reachable->unreachable",
@@ -4945,6 +4956,29 @@ var ConformanceFixtureRecordSchema = external_exports.object({
4945
4956
 
4946
4957
  sourceSurfaceId: external_exports.string().min(1).optional()
4947
4958
  });
4959
+ var OrthogonalityHypothesisRecordSchema = external_exports.object({
4960
+
4961
+ draftId: external_exports.string().min(1),
4962
+
4963
+ targetSurfaceId: external_exports.string().min(1),
4964
+
4965
+ targetDimensionId: external_exports.string().min(1),
4966
+
4967
+ candidateColumnId: external_exports.string().min(1),
4968
+
4969
+ proposedHypothesis: external_exports.string().min(1),
4970
+
4971
+ evidence: external_exports.object({
4972
+ scoredEventCount: external_exports.number().int().nonnegative(),
4973
+ sigmaObservedSquared: external_exports.number().nonnegative(),
4974
+ sigmaAgentSquared: external_exports.number().nonnegative(),
4975
+ sigmaAgentCILower: external_exports.number().nonnegative()
4976
+ }),
4977
+
4978
+ approverId: external_exports.string().min(1),
4979
+
4980
+ occurredAt: external_exports.string().min(1)
4981
+ });
4948
4982
  var EmissionCoverageSchema = external_exports.object({
4949
4983
 
4950
4984
  streamId: external_exports.string().min(1),
@@ -4957,6 +4991,16 @@ var EmissionCoverageSchema = external_exports.object({
4957
4991
 
4958
4992
  observedAtMs: external_exports.number().int().nonnegative()
4959
4993
  });
4994
+ var DeliveryOrphanSchema = external_exports.object({
4995
+
4996
+ darkEventId: external_exports.string().min(1),
4997
+
4998
+ emissionStreamId: external_exports.string().min(1),
4999
+
5000
+ surfaceId: external_exports.string().min(1),
5001
+
5002
+ witnessedAtMs: external_exports.number().int().nonnegative()
5003
+ });
4960
5004
  var EvaluationEventSchema = external_exports.object({
4961
5005
 
4962
5006
  eventId: external_exports.string().min(1),
@@ -4967,6 +5011,8 @@ var EvaluationEventSchema = external_exports.object({
4967
5011
 
4968
5012
  correlationId: CorrelationIdSchema,
4969
5013
 
5014
+ emissionStreamId: external_exports.string().min(1).optional(),
5015
+
4970
5016
  lensVersion: external_exports.string().min(1),
4971
5017
 
4972
5018
  kind: EvaluationEventKindSchema.default("evaluation"),
@@ -4989,34 +5035,44 @@ var EvaluationEventSchema = external_exports.object({
4989
5035
 
4990
5036
  conformanceFixtureRecord: ConformanceFixtureRecordSchema.optional(),
4991
5037
 
4992
- emissionCoverage: EmissionCoverageSchema.optional()
5038
+ emissionCoverage: EmissionCoverageSchema.optional(),
5039
+
5040
+ deliveryOrphan: DeliveryOrphanSchema.optional(),
5041
+
5042
+ orthogonalityHypothesis: OrthogonalityHypothesisRecordSchema.optional()
4993
5043
  }).refine(
4994
5044
  (e) => {
4995
5045
  if (e.kind === "evaluation") {
4996
- return e.light !== void 0 && e.substrate !== void 0 && e.surface !== void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0;
5046
+ return e.light !== void 0 && e.substrate !== void 0 && e.surface !== void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0 && e.deliveryOrphan === void 0 && e.orthogonalityHypothesis === void 0;
4997
5047
  }
4998
5048
  if (e.kind === "availability.transition") {
4999
- return e.availability !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0;
5049
+ return e.availability !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0 && e.deliveryOrphan === void 0 && e.orthogonalityHypothesis === void 0;
5000
5050
  }
5001
5051
  if (e.kind === "analysis.noise-floor-calibration") {
5002
- return e.noiseFloorCalibration !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0;
5052
+ return e.noiseFloorCalibration !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0 && e.deliveryOrphan === void 0 && e.orthogonalityHypothesis === void 0;
5003
5053
  }
5004
5054
  if (e.kind === "analysis.variance-decomposition") {
5005
- return e.varianceDecomposition !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0;
5055
+ return e.varianceDecomposition !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0 && e.deliveryOrphan === void 0 && e.orthogonalityHypothesis === void 0;
5006
5056
  }
5007
5057
  if (e.kind === "analysis.lifecycle-transition") {
5008
- return e.lifecycleTransition !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0;
5058
+ return e.lifecycleTransition !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0 && e.deliveryOrphan === void 0 && e.orthogonalityHypothesis === void 0;
5009
5059
  }
5010
5060
  if (e.kind === "analysis.eval-recommendation") {
5011
- return e.evalRecommendation !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0;
5061
+ return e.evalRecommendation !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0 && e.deliveryOrphan === void 0 && e.orthogonalityHypothesis === void 0;
5012
5062
  }
5013
5063
  if (e.kind === "analysis.conformance-fixture") {
5014
- return e.conformanceFixtureRecord !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.emissionCoverage === void 0;
5064
+ return e.conformanceFixtureRecord !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.emissionCoverage === void 0 && e.deliveryOrphan === void 0 && e.orthogonalityHypothesis === void 0;
5065
+ }
5066
+ if (e.kind === "analysis.emission-coverage") {
5067
+ return e.emissionCoverage !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.deliveryOrphan === void 0 && e.orthogonalityHypothesis === void 0;
5068
+ }
5069
+ if (e.kind === "analysis.delivery-orphan") {
5070
+ return e.deliveryOrphan !== void 0 && e.emissionCoverage === void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.orthogonalityHypothesis === void 0;
5015
5071
  }
5016
- return e.emissionCoverage !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0;
5072
+ return e.orthogonalityHypothesis !== void 0 && e.deliveryOrphan === void 0 && e.emissionCoverage === void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0;
5017
5073
  },
5018
5074
  {
5019
- message: "EvaluationEvent shape invariant: each kind requires exactly its corresponding payload and forbids the others. kind='evaluation' \u2192 light+substrate+surface; kind='availability.transition' \u2192 availability; kind='analysis.noise-floor-calibration' \u2192 noiseFloorCalibration; kind='analysis.variance-decomposition' \u2192 varianceDecomposition; kind='analysis.lifecycle-transition' \u2192 lifecycleTransition; kind='analysis.eval-recommendation' \u2192 evalRecommendation; kind='analysis.conformance-fixture' \u2192 conformanceFixtureRecord; kind='analysis.emission-coverage' \u2192 emissionCoverage."
5075
+ message: "EvaluationEvent shape invariant: each kind requires exactly its corresponding payload and forbids the others. kind='evaluation' \u2192 light+substrate+surface; kind='availability.transition' \u2192 availability; kind='analysis.noise-floor-calibration' \u2192 noiseFloorCalibration; kind='analysis.variance-decomposition' \u2192 varianceDecomposition; kind='analysis.lifecycle-transition' \u2192 lifecycleTransition; kind='analysis.eval-recommendation' \u2192 evalRecommendation; kind='analysis.conformance-fixture' \u2192 conformanceFixtureRecord; kind='analysis.emission-coverage' \u2192 emissionCoverage; kind='analysis.delivery-orphan' \u2192 deliveryOrphan; kind='analysis.orthogonality-hypothesis' \u2192 orthogonalityHypothesis."
5020
5076
  }
5021
5077
  );
5022
5078
  function newEventId(occurredAt = new Date()) {
@@ -5527,6 +5583,8 @@ var EvaluationEventEmitter = class {
5527
5583
 
5528
5584
  lastSeq = -1;
5529
5585
 
5586
+ emitsSentinels;
5587
+
5530
5588
  inFlight = null;
5531
5589
  stopped = false;
5532
5590
  constructor(opts) {
@@ -5538,6 +5596,7 @@ var EvaluationEventEmitter = class {
5538
5596
  this.sentinelTargets = this.flushTargets.filter((t) => typeof t.emitSentinel === "function");
5539
5597
  this.now = opts.now ?? Date.now;
5540
5598
  this.streamId = opts.streamId ?? generateStreamId(this.now());
5599
+ this.emitsSentinels = opts.deployment !== "serverless";
5541
5600
  this.onFlushError = opts.onFlushError ?? ((error) => {
5542
5601
  console.warn("[holonograph] emit flush error:", error);
5543
5602
  });
@@ -5554,9 +5613,12 @@ var EvaluationEventEmitter = class {
5554
5613
  this.stopInterval = schedule(() => {
5555
5614
  this.tick();
5556
5615
  }, opts.flushIntervalMs ?? DEFAULT_FLUSH_INTERVAL_MS);
5557
- this.stopSentinelInterval = schedule(() => {
5616
+ this.stopSentinelInterval = this.emitsSentinels ? schedule(() => {
5558
5617
  this.sentinelTick();
5559
- }, opts.sentinelIntervalMs ?? DEFAULT_SENTINEL_INTERVAL_MS);
5618
+ }, opts.sentinelIntervalMs ?? DEFAULT_SENTINEL_INTERVAL_MS) : (
5619
+
5620
+ () => void 0
5621
+ );
5560
5622
  }
5561
5623
 
5562
5624
  enqueue(event) {
@@ -5564,7 +5626,8 @@ var EvaluationEventEmitter = class {
5564
5626
  const seq = this.nextSeq;
5565
5627
  this.nextSeq += 1;
5566
5628
  this.lastSeq = seq;
5567
- const accepted = this.buffer.offer({ event, seq, streamId: this.streamId });
5629
+ const stamped = event.emissionStreamId === void 0 ? { ...event, emissionStreamId: this.streamId } : event;
5630
+ const accepted = this.buffer.offer({ event: stamped, seq, streamId: this.streamId });
5568
5631
  this.accounting.recordOffer(nowMs, accepted);
5569
5632
  this.accounting.maybeRollover(nowMs);
5570
5633
  return event.eventId;
@@ -5581,6 +5644,7 @@ var EvaluationEventEmitter = class {
5581
5644
  }
5582
5645
 
5583
5646
  async emitSentinelNow(final) {
5647
+ if (!this.emitsSentinels) return;
5584
5648
  if (this.sentinelTargets.length === 0) return;
5585
5649
  const sentinel = { streamId: this.streamId, seq: this.lastSeq, final };
5586
5650
  await Promise.all(
@@ -5961,7 +6025,14 @@ var HttpTransport = class {
5961
6025
  otlpOpts.rawResponseLocation = mode === "dual" ? "http-channel" : "store";
5962
6026
  flushTargets.push(new OtlpEventFlushTarget(otlpOpts));
5963
6027
  }
6028
+ if (e.deployment === "serverless" && e.streamId === void 0) {
6029
+ throw new Error(
6030
+ "emit.deployment 'serverless' requires a stable emit.streamId (e.g. the function name) \u2014 a per-request id would make streamCount track calls, not emitters. Completeness for a serverless emitter comes from reconciliation over that stable stream."
6031
+ );
6032
+ }
5964
6033
  const emitterOpts = { flushTargets, lensVersion };
6034
+ if (e.deployment !== void 0) emitterOpts.deployment = e.deployment;
6035
+ if (e.streamId !== void 0) emitterOpts.streamId = e.streamId;
5965
6036
  if (e.bufferSize !== void 0) emitterOpts.bufferSize = e.bufferSize;
5966
6037
  if (e.flushIntervalMs !== void 0) emitterOpts.flushIntervalMs = e.flushIntervalMs;
5967
6038
  if (e.sentinelIntervalMs !== void 0) emitterOpts.sentinelIntervalMs = e.sentinelIntervalMs;
@@ -6036,6 +6107,18 @@ var HttpTransport = class {
6036
6107
  async getContract() {
6037
6108
  return this.get("/holonograph/contract");
6038
6109
  }
6110
+ async getReconciliation(query = {}) {
6111
+ const { since, until, emissionStreamId } = query;
6112
+ return this.get(
6113
+ `/holonograph/reconciliation${toQueryString({ since, until, emissionStreamId })}`
6114
+ );
6115
+ }
6116
+ async getEmission(query = {}) {
6117
+ const { since, until, surfaceId } = query;
6118
+ return this.get(
6119
+ `/holonograph/emission${toQueryString({ since, until, surfaceId })}`
6120
+ );
6121
+ }
6039
6122
  async markAvailability(req) {
6040
6123
  return this.post("/lens/availability/mark", req);
6041
6124
  }
@@ -6143,6 +6226,14 @@ function lightSnapshotFromResult(result) {
6143
6226
  }
6144
6227
  return snapshot;
6145
6228
  }
6229
+ function toQueryString(query) {
6230
+ const params = new URLSearchParams();
6231
+ for (const [k, v] of Object.entries(query)) {
6232
+ if (v !== void 0) params.set(k, v);
6233
+ }
6234
+ const s = params.toString();
6235
+ return s.length > 0 ? `?${s}` : "";
6236
+ }
6146
6237
 
6147
6238
  function isHttpOptions(opts) {
6148
6239
  return "endpoint" in opts;
@@ -6492,6 +6583,128 @@ var HolonographClient = class {
6492
6583
  }
6493
6584
  };
6494
6585
 
6586
+ function hasChanges(diff) {
6587
+ return diff.added.length > 0 || diff.removed.length > 0 || diff.changed.length > 0;
6588
+ }
6589
+ function structuralEquals(a, b) {
6590
+ if (a === b) return true;
6591
+ try {
6592
+ return JSON.stringify(a) === JSON.stringify(b);
6593
+ } catch {
6594
+ return false;
6595
+ }
6596
+ }
6597
+ function diffByKey(prev, next, keyOf, opts = {}) {
6598
+ const equals = opts.equals ?? structuralEquals;
6599
+ const prevByKey = new Map();
6600
+ for (const item of prev) prevByKey.set(keyOf(item), item);
6601
+ const nextByKey = new Map();
6602
+ for (const item of next) nextByKey.set(keyOf(item), item);
6603
+ const diff = { added: [], removed: [], changed: [], unchanged: [] };
6604
+ for (const [key, nextItem] of nextByKey) {
6605
+ const prevItem = prevByKey.get(key);
6606
+ if (prevItem === void 0) {
6607
+ diff.added.push(nextItem);
6608
+ } else if (equals(prevItem, nextItem)) {
6609
+ diff.unchanged.push(nextItem);
6610
+ } else {
6611
+ diff.changed.push({ key, prev: prevItem, next: nextItem });
6612
+ }
6613
+ }
6614
+ for (const [key, prevItem] of prevByKey) {
6615
+ if (!nextByKey.has(key)) diff.removed.push(prevItem);
6616
+ }
6617
+ return diff;
6618
+ }
6619
+
6620
+ function createPoller(opts) {
6621
+ const { poll, intervalMs, onResult, onError, signal, immediate = true } = opts;
6622
+ let timer;
6623
+ const controller = new AbortController();
6624
+ const stopped = () => controller.signal.aborted;
6625
+ const stop = () => {
6626
+ if (stopped()) return;
6627
+ if (timer !== void 0) clearTimeout(timer);
6628
+ controller.abort();
6629
+ };
6630
+ if (signal !== void 0) {
6631
+ if (signal.aborted) {
6632
+ stop();
6633
+ return { stop };
6634
+ }
6635
+ signal.addEventListener("abort", stop, { once: true });
6636
+ }
6637
+ const scheduleNext = () => {
6638
+ if (stopped()) return;
6639
+ timer = setTimeout(() => void tick(), intervalMs);
6640
+ };
6641
+ const tick = async () => {
6642
+ if (stopped()) return;
6643
+ try {
6644
+ const result = await poll(controller.signal);
6645
+ if (stopped()) return;
6646
+ await onResult(result);
6647
+ } catch (err) {
6648
+ if (!stopped()) onError?.(err);
6649
+ }
6650
+ scheduleNext();
6651
+ };
6652
+ if (immediate) void tick();
6653
+ else scheduleNext();
6654
+ return { stop };
6655
+ }
6656
+ function watchByKey(opts) {
6657
+ const { poll, intervalMs, keyOf, onChange, equals, onError, signal, emitInitial = false } = opts;
6658
+ const diffOpts = equals !== void 0 ? { equals } : {};
6659
+ let baseline;
6660
+ return createPoller({
6661
+ poll,
6662
+ intervalMs,
6663
+ ...onError !== void 0 ? { onError } : {},
6664
+ ...signal !== void 0 ? { signal } : {},
6665
+ onResult: async (next) => {
6666
+ if (baseline === void 0) {
6667
+ baseline = next;
6668
+ if (emitInitial) {
6669
+ const diff2 = diffByKey([], next, keyOf, diffOpts);
6670
+ if (hasChanges(diff2)) await onChange(diff2);
6671
+ }
6672
+ return;
6673
+ }
6674
+ const diff = diffByKey(baseline, next, keyOf, diffOpts);
6675
+ baseline = next;
6676
+ if (hasChanges(diff)) await onChange(diff);
6677
+ }
6678
+ });
6679
+ }
6680
+
6681
+ function watchReconciliation(opts) {
6682
+ const { reader, query, intervalMs, onChange, equals, onError, signal, emitInitial } = opts;
6683
+ return watchByKey({
6684
+ intervalMs,
6685
+ onChange,
6686
+ keyOf: (e) => e.emissionStreamId,
6687
+ poll: async () => (await reader.getReconciliation(query)).emitters,
6688
+ ...equals !== void 0 ? { equals } : {},
6689
+ ...onError !== void 0 ? { onError } : {},
6690
+ ...signal !== void 0 ? { signal } : {},
6691
+ ...emitInitial !== void 0 ? { emitInitial } : {}
6692
+ });
6693
+ }
6694
+ function watchEmission(opts) {
6695
+ const { reader, query, intervalMs, onChange, equals, onError, signal, emitInitial } = opts;
6696
+ return watchByKey({
6697
+ intervalMs,
6698
+ onChange,
6699
+ keyOf: (s) => s.surfaceId,
6700
+ poll: async () => (await reader.getEmission(query)).surfaces,
6701
+ ...equals !== void 0 ? { equals } : {},
6702
+ ...onError !== void 0 ? { onError } : {},
6703
+ ...signal !== void 0 ? { signal } : {},
6704
+ ...emitInitial !== void 0 ? { emitInitial } : {}
6705
+ });
6706
+ }
6707
+
6495
6708
  var HolonographClient2 = HolonographClient;
6496
6709
 
6497
- export { HolonographClient2 as HolonographClient, HolonographGradeAfterReportError, HolonographHttpError, HolonographMarkerPairingWarningError, HolonographNoObserversError, HolonographObserverNotFoundError, HttpTransport };
6710
+ export { HolonographClient2 as HolonographClient, HolonographGradeAfterReportError, HolonographHttpError, HolonographMarkerPairingWarningError, HolonographNoObserversError, HolonographObserverNotFoundError, HttpTransport, createPoller, diffByKey, hasChanges, watchByKey, watchEmission, watchReconciliation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holonograph/client",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "TypeScript HTTP client for a Holonograph lens. Send messages through the lens and report scored outcomes back to it.",
5
5
  "license": "MIT",
6
6
  "type": "module",