@blue-labs/document-processor 3.3.1 → 3.4.1

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
@@ -1,39 +1,39 @@
1
1
  import { evaluate as wt } from "@blue-quickjs/quickjs-runtime";
2
- import { validateDv as kt, DV_LIMIT_DEFAULTS as bt } from "@blue-quickjs/dv";
3
- import { HOST_V1_MANIFEST as Tt, HOST_V1_HASH as It } from "@blue-quickjs/abi-manifest";
4
- import { BlueNode as p, withTypeBlueId as g, blueNodeField as b, Properties as Te, BlueIdCalculator as Pt, Blue as Rt, MergingProcessors as L } from "@blue-labs/language";
5
- import Ie from "picomatch";
6
- import { z as l, ZodError as ge } from "zod";
7
- import { isNullable as he } from "@blue-labs/shared-utils";
8
- import { repository as Mt } from "@blue-repository/types";
2
+ import { validateDv as bt, DV_LIMIT_DEFAULTS as kt } from "@blue-quickjs/dv";
3
+ import { HOST_V1_MANIFEST as It, HOST_V1_HASH as Tt } from "@blue-quickjs/abi-manifest";
4
+ import { BlueNode as p, withTypeBlueId as g, blueNodeField as k, Properties as Te, BlueIdCalculator as Pt, Blue as Mt, MergingProcessors as B } from "@blue-labs/language";
5
+ import Pe from "picomatch";
6
+ import { z as l, ZodError as Ee } from "zod";
7
+ import { isNullable as de } from "@blue-labs/shared-utils";
8
+ import { repository as Rt } from "@blue-repository/types";
9
9
  function Nt(i) {
10
10
  return { ok: !0, value: i };
11
11
  }
12
12
  function Ot(i) {
13
13
  return { ok: !1, error: i };
14
14
  }
15
- function ji(i) {
15
+ function Qi(i) {
16
16
  return i.ok;
17
17
  }
18
- function Ji(i) {
18
+ function Xi(i) {
19
19
  return !i.ok;
20
20
  }
21
- function Qi(i, e) {
21
+ function Zi(i, e) {
22
22
  return i.ok ? Nt(e(i.value)) : i;
23
23
  }
24
- function Xi(i, e) {
24
+ function Yi(i, e) {
25
25
  return i.ok ? i : Ot(e(i.error));
26
26
  }
27
- function Yi(i, e) {
27
+ function eo(i, e) {
28
28
  return i.ok ? e(i.value) : i;
29
29
  }
30
- function Zi(i, e) {
30
+ function to(i, e) {
31
31
  return i.ok ? i.value : e;
32
32
  }
33
- function eo(i, e) {
33
+ function no(i, e) {
34
34
  return i.ok ? i.value : e(i.error);
35
35
  }
36
- function to(i, e) {
36
+ function ro(i, e) {
37
37
  return i.ok ? e.ok(i.value) : e.err(i.error);
38
38
  }
39
39
  const S = {
@@ -105,58 +105,58 @@ const Dt = {
105
105
  m["Core/Triggered Event Channel"],
106
106
  m["Core/Lifecycle Event Channel"],
107
107
  m["Core/Embedded Node Channel"]
108
- ], We = "embedded", Ge = "initialized", qe = "terminated", A = "checkpoint", Ee = new Set(
108
+ ], We = "embedded", Ge = "initialized", qe = "terminated", A = "checkpoint", ye = new Set(
109
109
  Bt
110
- ), je = new Set(xt);
110
+ ), Ce = new Set(xt);
111
111
  function _t(i) {
112
- return i != null && Ee.has(i);
112
+ return i != null && ye.has(i);
113
113
  }
114
- function ye(i) {
115
- return i != null && je.has(
114
+ function je(i) {
115
+ return i != null && Ce.has(
116
116
  i
117
117
  );
118
118
  }
119
- const no = {
119
+ const io = {
120
120
  KEY_EMBEDDED: We,
121
121
  KEY_INITIALIZED: Ge,
122
122
  KEY_TERMINATED: qe,
123
123
  KEY_CHECKPOINT: A,
124
- RESERVED_CONTRACT_KEYS: Ee,
125
- PROCESSOR_MANAGED_CHANNEL_BLUE_IDS: je,
124
+ RESERVED_CONTRACT_KEYS: ye,
125
+ PROCESSOR_MANAGED_CHANNEL_BLUE_IDS: Ce,
126
126
  isReservedContractKey: _t,
127
- isProcessorManagedChannelBlueId: ye
128
- }, H = "/contracts", de = `${H}/${Ge}`, Je = `${H}/${qe}`, Lt = `${H}/${We}`, Qe = `${H}/${A}`, Xe = "/lastEvents", Ye = "/lastSignatures";
129
- function re(i) {
130
- return `${H}/${i}`;
127
+ isProcessorManagedChannelBlueId: je
128
+ }, V = "/contracts", pe = `${V}/${Ge}`, Je = `${V}/${qe}`, Lt = `${V}/${We}`, Qe = `${V}/${A}`, Xe = "/lastEvents", Ze = "/lastSignatures";
129
+ function ie(i) {
130
+ return `${V}/${i}`;
131
131
  }
132
- function Ze(i, e) {
133
- return `${re(i)}${Xe}/${e}`;
132
+ function Ye(i, e) {
133
+ return `${ie(i)}${Xe}/${e}`;
134
134
  }
135
135
  function et(i, e) {
136
- return `${re(i)}${Ye}/${e}`;
136
+ return `${ie(i)}${Ze}/${e}`;
137
137
  }
138
- const ro = {
139
- RELATIVE_CONTRACTS: H,
140
- RELATIVE_INITIALIZED: de,
138
+ const oo = {
139
+ RELATIVE_CONTRACTS: V,
140
+ RELATIVE_INITIALIZED: pe,
141
141
  RELATIVE_TERMINATED: Je,
142
142
  RELATIVE_EMBEDDED: Lt,
143
143
  RELATIVE_CHECKPOINT: Qe,
144
144
  LAST_EVENTS_SUFFIX: Xe,
145
- LAST_SIGNATURES_SUFFIX: Ye,
146
- relativeContractsEntry: re,
147
- relativeCheckpointLastEvent: Ze,
145
+ LAST_SIGNATURES_SUFFIX: Ze,
146
+ relativeContractsEntry: ie,
147
+ relativeCheckpointLastEvent: Ye,
148
148
  relativeCheckpointLastSignature: et
149
149
  };
150
150
  function tt(i) {
151
151
  return i == null || i.length === 0;
152
152
  }
153
- function k(i) {
153
+ function b(i) {
154
154
  return tt(i) ? "/" : i.startsWith("/") ? i : `/${i}`;
155
155
  }
156
156
  function P(i) {
157
157
  return tt(i) ? "/" : i.startsWith("/") ? i : `/${i}`;
158
158
  }
159
- function Pe(i) {
159
+ function Me(i) {
160
160
  if (i == null)
161
161
  return "";
162
162
  let e = i.trim();
@@ -168,16 +168,16 @@ function Pe(i) {
168
168
  e = e.substring(0, e.length - 1);
169
169
  return e;
170
170
  }
171
- function io(i, e) {
172
- const t = Pe(i), n = Pe(e);
171
+ function so(i, e) {
172
+ const t = Me(i), n = Me(e);
173
173
  return t.length === 0 && n.length === 0 ? "/" : t.length === 0 ? `/${n}` : n.length === 0 ? `/${t}` : `/${t}/${n}`;
174
174
  }
175
- function I(i, e) {
176
- const t = k(i), n = P(e);
175
+ function T(i, e) {
176
+ const t = b(i), n = P(e);
177
177
  return t === "/" ? n : n === "/" || n.length === 1 ? t : `${t}${n}`;
178
178
  }
179
179
  function Ft(i, e) {
180
- const t = k(i), n = P(e);
180
+ const t = b(i), n = P(e);
181
181
  if (t === "/" || !n.startsWith(t))
182
182
  return n;
183
183
  if (n.length === t.length)
@@ -185,12 +185,12 @@ function Ft(i, e) {
185
185
  const r = n.substring(t.length);
186
186
  return r.length === 0 ? "/" : r.startsWith("/") ? r : `/${r}`;
187
187
  }
188
- function Ut(i) {
188
+ function $t(i) {
189
189
  return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
190
190
  }
191
- var ae, Re;
192
- function $t() {
193
- return Re || (Re = 1, ae = function i(e) {
191
+ var ce, Re;
192
+ function Ut() {
193
+ return Re || (Re = 1, ce = function i(e) {
194
194
  if (typeof e == "number" && isNaN(e))
195
195
  throw new Error("NaN is not allowed");
196
196
  if (typeof e == "number" && !isFinite(e))
@@ -201,25 +201,25 @@ function $t() {
201
201
  const o = n.length === 0 ? "" : ",";
202
202
  return `${n}${o}${i(r)}:${i(e[r])}`;
203
203
  }, "")}}`;
204
- }), ae;
204
+ }), ce;
205
205
  }
206
- var zt = $t();
207
- const Vt = /* @__PURE__ */ Ut(zt);
208
- function Ht(i, e) {
206
+ var zt = Ut();
207
+ const Ht = /* @__PURE__ */ $t(zt);
208
+ function Vt(i, e) {
209
209
  return i.nodeToJson(e, "official");
210
210
  }
211
211
  function Kt(i, e) {
212
- const t = Ht(i, e);
213
- return Vt(t);
212
+ const t = Vt(i, e);
213
+ return Ht(t);
214
214
  }
215
215
  function nt(i, e) {
216
216
  return e ? Kt(i, e) : null;
217
217
  }
218
- function Me(i, e) {
218
+ function Ne(i, e) {
219
219
  const t = nt(i, e);
220
220
  return t == null ? 0 : new TextEncoder().encode(t).length;
221
221
  }
222
- const Wt = 1700, pe = BigInt(
222
+ const Wt = 1700, fe = BigInt(
223
223
  Wt
224
224
  ), Gt = BigInt(Number.MAX_SAFE_INTEGER), qt = 4e4, jt = 4e4;
225
225
  function Jt(i) {
@@ -233,12 +233,12 @@ function Jt(i) {
233
233
  }
234
234
  if (e <= 0n)
235
235
  return 0;
236
- const t = (e + pe - 1n) / pe;
236
+ const t = (e + fe - 1n) / fe;
237
237
  return t > Gt ? Number.MAX_SAFE_INTEGER : Number(t);
238
238
  }
239
239
  function rt(i) {
240
240
  const e = BigInt(Math.max(0, Math.trunc(i)));
241
- return e <= 0n ? 0n : e * pe;
241
+ return e <= 0n ? 0n : e * fe;
242
242
  }
243
243
  const it = rt(
244
244
  qt
@@ -253,7 +253,7 @@ const it = rt(
253
253
  "currentContract",
254
254
  "currentContractCanonical"
255
255
  ]);
256
- class Ce {
256
+ class Se {
257
257
  // Serialize evaluations to avoid races when updating host handler bindings.
258
258
  evaluationQueue = Promise.resolve();
259
259
  handlerState = {
@@ -287,14 +287,14 @@ class Ce {
287
287
  code: this.wrapCode(e),
288
288
  abiId: "Host.v1",
289
289
  abiVersion: 1,
290
- abiManifestHash: It
290
+ abiManifestHash: Tt
291
291
  };
292
292
  try {
293
293
  const c = await wt({
294
294
  program: a,
295
295
  input: o,
296
296
  gasLimit: s,
297
- manifest: Tt,
297
+ manifest: It,
298
298
  handlers: this.handlers
299
299
  });
300
300
  if (n !== void 0 && r && r({
@@ -309,7 +309,7 @@ class Ce {
309
309
  }
310
310
  prepareBindings(e) {
311
311
  const t = e ?? {};
312
- Yt(t);
312
+ Zt(t);
313
313
  const n = W(t.event, null, "event"), r = W(
314
314
  t.eventCanonical ?? n,
315
315
  n,
@@ -329,11 +329,11 @@ class Ce {
329
329
  currentContract: s,
330
330
  currentContractCanonical: a
331
331
  }, u = this.extractDocumentBinding(t), h = typeof u?.canonical == "function" ? u.canonical : void 0;
332
- this.handlerState.documentGet = Ne(u), this.handlerState.documentGetCanonical = Ne(
332
+ this.handlerState.documentGet = Oe(u), this.handlerState.documentGetCanonical = Oe(
333
333
  h ?? u
334
334
  );
335
335
  const d = this.extractEmitBinding(t);
336
- return this.handlerState.emit = Zt(d), c;
336
+ return this.handlerState.emit = Yt(d), c;
337
337
  }
338
338
  extractDocumentBinding(e) {
339
339
  if (!Object.prototype.hasOwnProperty.call(e, "document"))
@@ -363,7 +363,7 @@ ${e}
363
363
  })()`;
364
364
  }
365
365
  }
366
- function Yt(i) {
366
+ function Zt(i) {
367
367
  for (const e of Object.keys(i))
368
368
  if (!Xt.has(e))
369
369
  throw new TypeError(`Unsupported QuickJS binding: "${e}"`);
@@ -371,7 +371,7 @@ function Yt(i) {
371
371
  function W(i, e, t) {
372
372
  const n = i === void 0 ? e : i;
373
373
  try {
374
- kt(n, { limits: bt });
374
+ bt(n, { limits: kt });
375
375
  } catch (r) {
376
376
  const o = r instanceof Error ? r.message : String(r);
377
377
  throw new TypeError(
@@ -380,7 +380,7 @@ function W(i, e, t) {
380
380
  }
381
381
  return n;
382
382
  }
383
- function Ne(i) {
383
+ function Oe(i) {
384
384
  return i ? (e) => {
385
385
  try {
386
386
  const t = i(e);
@@ -396,7 +396,7 @@ function Ne(i) {
396
396
  }
397
397
  } : () => ({ ok: null, units: O });
398
398
  }
399
- function Zt(i) {
399
+ function Yt(i) {
400
400
  return i ? (e) => {
401
401
  try {
402
402
  if (i(Y(e)) instanceof Promise)
@@ -446,9 +446,9 @@ function en(i) {
446
446
  function tn(i) {
447
447
  return i instanceof Error ? i : new Error(String(i ?? "Unknown error"));
448
448
  }
449
- const Oe = 120;
449
+ const Ae = 120;
450
450
  function nn(i) {
451
- return i.length <= Oe ? i : `${i.slice(0, Oe - 3)}...`;
451
+ return i.length <= Ae ? i : `${i.slice(0, Ae - 3)}...`;
452
452
  }
453
453
  class ot extends Error {
454
454
  constructor(e, t) {
@@ -456,7 +456,7 @@ class ot extends Error {
456
456
  }
457
457
  }
458
458
  const st = /^\$\{([\s\S]*)\}$/, rn = /\$\{([\s\S]+?)\}/, on = /\$\{([\s\S]+?)\}/g;
459
- function Z(i) {
459
+ function ee(i) {
460
460
  if (typeof i != "string" || !st.test(i))
461
461
  return !1;
462
462
  const e = i.indexOf("${"), t = i.lastIndexOf("${");
@@ -466,7 +466,7 @@ function sn(i) {
466
466
  return typeof i != "string" ? !1 : st.test(i) ? !0 : rn.test(i);
467
467
  }
468
468
  function an(i) {
469
- if (!Z(i))
469
+ if (!ee(i))
470
470
  throw new Error(`Invalid expression: ${i}`);
471
471
  return i.slice(2, -1);
472
472
  }
@@ -505,13 +505,13 @@ function ct({
505
505
  options: t
506
506
  }) {
507
507
  const n = { dot: !0, ...t ?? {} }, r = i.map(
508
- (s) => Ie(s, n)
508
+ (s) => Pe(s, n)
509
509
  ), o = e.map(
510
- (s) => Ie(s, n)
510
+ (s) => Pe(s, n)
511
511
  );
512
512
  return (s) => r.some((a) => a(s)) && !o.some((a) => a(s));
513
513
  }
514
- async function ee(i) {
514
+ async function te(i) {
515
515
  const {
516
516
  evaluator: e,
517
517
  node: t,
@@ -530,7 +530,7 @@ async function ee(i) {
530
530
  const d = h.getValue();
531
531
  if (d !== void 0) {
532
532
  if (typeof d == "string" && r(a)) {
533
- if (Z(d)) {
533
+ if (ee(d)) {
534
534
  const E = an(d), C = await at(
535
535
  e,
536
536
  E,
@@ -556,10 +556,10 @@ async function ee(i) {
556
556
  if (Array.isArray(v)) {
557
557
  const E = await Promise.all(
558
558
  v.map(
559
- (C, R) => ee({
559
+ (C, M) => te({
560
560
  ...i,
561
561
  node: C,
562
- pointer: `${a}/${R}`
562
+ pointer: `${a}/${M}`
563
563
  })
564
564
  )
565
565
  );
@@ -568,11 +568,11 @@ async function ee(i) {
568
568
  const f = h.getProperties?.();
569
569
  if (f) {
570
570
  const E = {};
571
- for (const [C, R] of Object.entries(f)) {
571
+ for (const [C, M] of Object.entries(f)) {
572
572
  const D = a === "/" ? `/${C}` : `${a}/${C}`;
573
- E[C] = await ee({
573
+ E[C] = await te({
574
574
  ...i,
575
- node: R,
575
+ node: M,
576
576
  pointer: D
577
577
  });
578
578
  }
@@ -580,32 +580,32 @@ async function ee(i) {
580
580
  }
581
581
  return h;
582
582
  }
583
- const ie = g(m["Core/Contract"])(l.object({
583
+ const oe = g(m["Core/Contract"])(l.object({
584
584
  description: l.string().optional(),
585
585
  name: l.string().optional(),
586
586
  order: l.number().optional()
587
- })), Se = ie, x = g(m["Core/Channel"])(ie.extend({
587
+ })), ve = oe, _ = g(m["Core/Channel"])(oe.extend({
588
588
  description: l.string().optional(),
589
- event: b().optional(),
589
+ event: k().optional(),
590
590
  name: l.string().optional()
591
- })), _ = x.merge(
592
- Se
591
+ })), L = _.merge(
592
+ ve
593
593
  ).extend({
594
594
  path: l.string().optional(),
595
- definition: b().optional()
596
- }), lt = g(m["Core/Handler"])(ie.extend({
595
+ definition: k().optional()
596
+ }), lt = g(m["Core/Handler"])(oe.extend({
597
597
  channel: l.string().optional(),
598
598
  description: l.string().optional(),
599
- event: b().optional(),
599
+ event: k().optional(),
600
600
  name: l.string().optional()
601
- })), ut = lt.merge(Se), K = g(m["Core/Marker"])(ie.extend({
601
+ })), ut = lt.merge(ve), K = g(m["Core/Marker"])(oe.extend({
602
602
  description: l.string().optional(),
603
603
  name: l.string().optional()
604
- })), N = K.merge(Se), ln = l.object({
604
+ })), N = K.merge(ve), ln = l.object({
605
605
  op: l.enum(["ADD", "REPLACE", "REMOVE"]),
606
606
  path: l.string(),
607
- val: b().optional()
608
- }), oo = g("JsonPatch")(
607
+ val: k().optional()
608
+ }), ao = g("JsonPatch")(
609
609
  ln
610
610
  ).superRefine((i, e) => {
611
611
  i.op === "REMOVE" && i.val !== void 0 && e.addIssue({
@@ -617,30 +617,30 @@ const ie = g(m["Core/Contract"])(l.object({
617
617
  message: `${i.op} operations must include a value`,
618
618
  path: ["val"]
619
619
  });
620
- }), un = g(m["Core/Document Update Channel"])(x.extend({
620
+ }), un = g(m["Core/Document Update Channel"])(_.extend({
621
621
  description: l.string().optional(),
622
622
  name: l.string().optional(),
623
623
  path: l.string().optional()
624
624
  })), hn = un.merge(
625
- _
626
- ), dn = g(m["Core/Embedded Node Channel"])(x.extend({
625
+ L
626
+ ), dn = g(m["Core/Embedded Node Channel"])(_.extend({
627
627
  childPath: l.string().optional(),
628
628
  description: l.string().optional(),
629
629
  name: l.string().optional()
630
630
  })), pn = dn.merge(
631
- _
632
- ), fn = g(m["Core/Lifecycle Event Channel"])(x.extend({
631
+ L
632
+ ), fn = g(m["Core/Lifecycle Event Channel"])(_.extend({
633
633
  description: l.string().optional(),
634
634
  name: l.string().optional()
635
635
  })), mn = fn.merge(
636
- _
637
- ), gn = g(m["Core/Triggered Event Channel"])(x.extend({
636
+ L
637
+ ), gn = g(m["Core/Triggered Event Channel"])(_.extend({
638
638
  description: l.string().optional(),
639
639
  name: l.string().optional()
640
- })), En = gn.merge(_), w = {
640
+ })), En = gn.merge(L), w = {
641
641
  "Conversation/Actor": "CN5efWVizJbRsMCw8YWRfT2q9vM9XfeGDN9wFvYcvMnQ",
642
642
  "Conversation/Composite Timeline Channel": "HsNatiPt2YvmkWQoqtfrFCbdp75ZUBLBUkWeq84WTfnr",
643
- "Conversation/JavaScript Code": "3hYcmWMtMUPAzXBLFLb7BpuG9537tuTJPCr7pxWXvTZK",
643
+ "Conversation/JavaScript Code": "ExZxT61PSpWHpEAtP2WKMXXqxEYN7Z13j7Zv36Dp99kS",
644
644
  "Conversation/Operation": "BoAiqVUZv9Fum3wFqaX2JnQMBHJLxJSo2V9U2UBmCfsC",
645
645
  "Conversation/Operation Request": "HM4Ku4LFcjC5MxnhPMRwQ8w3BbHmJKKZfHTTzsd4jbJq",
646
646
  "Conversation/Sequential Workflow": "7X3LkN54Yp88JgZbppPhP6hM3Jqiqv8Z2i4kS7phXtQe",
@@ -649,15 +649,15 @@ const ie = g(m["Core/Contract"])(l.object({
649
649
  "Conversation/Timeline": "3Ge54FsGJaaeZmm8nTKJdS6HVdYhiR3g18fDwg3Ev1Sa",
650
650
  "Conversation/Timeline Channel": "EvuCWsG1E6WJQg8QXmk6rwMANYTZjoLWVZ1vYQWUwdTH",
651
651
  "Conversation/Timeline Entry": "EzDiC9Frs8V5yQBMtDYh1DobVnWtWpFemXDX5fGUULBn",
652
- "Conversation/Trigger Event": "GxUtWr3eH9a6YQeioQkujEnsPjD5s9RU8ZhEfmsV1vuU",
653
- "Conversation/Update Document": "BnnNLCnKF49TUJ1bRfZ5rSMaFw8SVfUNfnE4kJFG7HtM"
654
- }, ht = g(w["Conversation/Timeline Channel"])(x.extend({
652
+ "Conversation/Trigger Event": "2bSWEoMSZwzf32Hnr4BDVsuq8NRjrWEpnhZvMZAJGhh2",
653
+ "Conversation/Update Document": "FtHZJzH4hqAoGxFBjsmy1svfT4BwEBB4aHpFSZycZLLa"
654
+ }, ht = g(w["Conversation/Timeline Channel"])(_.extend({
655
655
  description: l.string().optional(),
656
656
  name: l.string().optional(),
657
657
  timelineId: l.string().optional()
658
658
  })), yn = ht.merge(
659
- _
660
- ), T = {
659
+ L
660
+ ), I = {
661
661
  "MyOS/Document Anchor": "HS9yo34TGEAM2LGcNbLh7XPN4goPRhqdGZQkiyh473Wb",
662
662
  "MyOS/Document Anchors": "7Usvk6dZMVqas3yqs23ZEXn1zu1YDPjgYiZFNYaw3puH",
663
663
  "MyOS/Document Links": "4cmrbevB6K23ZenjqwmNxpnaw6RF4VB3wkP7XB59V7W5",
@@ -668,70 +668,70 @@ const ie = g(m["Core/Contract"])(l.object({
668
668
  "MyOS/MyOS Timeline Channel": "HCF8mXnX3dFjQ8osjxb4Wzm2Nm1DoXnTYuA5sPnV7NTs",
669
669
  "MyOS/MyOS Timeline Entry": "Furgmg5xcJVMDmaQXZRfZ1XehSf7PWctrioo8etRYJHQ",
670
670
  "MyOS/MyOS Worker Agency": "4Lix4AKXvBDvrwxw2htSdYFKxL4wugEQzqoSEYet5Dh1"
671
- }, Cn = g(T["MyOS/MyOS Timeline Channel"])(ht.extend({
671
+ }, Cn = g(I["MyOS/MyOS Timeline Channel"])(ht.extend({
672
672
  accountId: l.string().optional(),
673
673
  description: l.string().optional(),
674
674
  email: l.string().optional(),
675
675
  name: l.string().optional()
676
- })), Sn = Cn.merge(_), vn = g(w["Conversation/Composite Timeline Channel"])(x.extend({
676
+ })), Sn = Cn.merge(L), vn = g(w["Conversation/Composite Timeline Channel"])(_.extend({
677
677
  channels: l.array(l.string()).optional(),
678
678
  description: l.string().optional(),
679
679
  name: l.string().optional()
680
- })), dt = vn.merge(_), wn = g(m["Core/Channel Event Checkpoint"])(K.extend({
680
+ })), dt = vn.merge(L), wn = g(m["Core/Channel Event Checkpoint"])(K.extend({
681
681
  description: l.string().optional(),
682
- lastEvents: l.record(l.string(), b()).optional(),
682
+ lastEvents: l.record(l.string(), k()).optional(),
683
683
  name: l.string().optional()
684
- })), kn = wn.merge(N).extend({
684
+ })), bn = wn.merge(N).extend({
685
685
  lastSignatures: l.record(l.string()).optional()
686
- }), bn = g(m["Core/Processing Initialized Marker"])(K.extend({
686
+ }), kn = g(m["Core/Processing Initialized Marker"])(K.extend({
687
687
  description: l.string().optional(),
688
688
  documentId: l.string().optional(),
689
689
  name: l.string().optional()
690
- })), Tn = bn.merge(N), In = g(m["Core/Process Embedded"])(K.extend({
690
+ })), In = kn.merge(N), Tn = g(m["Core/Process Embedded"])(K.extend({
691
691
  description: l.string().optional(),
692
692
  name: l.string().optional(),
693
693
  paths: l.array(l.string()).optional()
694
- })), Pn = In.merge(
694
+ })), Pn = Tn.merge(
695
695
  N
696
- ), Rn = g(m["Core/Processing Terminated Marker"])(K.extend({
696
+ ), Mn = g(m["Core/Processing Terminated Marker"])(K.extend({
697
697
  cause: l.string().optional(),
698
698
  description: l.string().optional(),
699
699
  name: l.string().optional(),
700
700
  reason: l.string().optional()
701
- })), Mn = Rn.merge(N), J = g(w["Conversation/Operation"])(K.extend({
701
+ })), Rn = Mn.merge(N), J = g(w["Conversation/Operation"])(K.extend({
702
702
  channel: l.string().optional(),
703
703
  description: l.string().optional(),
704
704
  name: l.string().optional(),
705
- request: b().optional()
705
+ request: k().optional()
706
706
  })), Nn = J.merge(
707
707
  N
708
- ), On = g(T["MyOS/Document Anchor"])(l.object({
708
+ ), On = g(I["MyOS/Document Anchor"])(l.object({
709
709
  description: l.string().optional(),
710
710
  name: l.string().optional(),
711
- template: b().optional()
712
- })), An = g(T["MyOS/Document Anchors"])(l.object({}).catchall(On)), Dn = An.merge(N), Bn = g(T["MyOS/Link"])(l.object({
711
+ template: k().optional()
712
+ })), An = g(I["MyOS/Document Anchors"])(l.object({}).catchall(On)), Dn = An.merge(N), Bn = g(I["MyOS/Link"])(l.object({
713
713
  anchor: l.string().optional(),
714
714
  description: l.string().optional(),
715
715
  name: l.string().optional()
716
- })), xn = g(T["MyOS/Document Links"])(l.object({}).catchall(Bn)), _n = xn.merge(
716
+ })), xn = g(I["MyOS/Document Links"])(l.object({}).catchall(Bn)), _n = xn.merge(
717
717
  N
718
- ), Ln = g(T["MyOS/MyOS Participants Orchestration"])(l.object({
718
+ ), Ln = g(I["MyOS/MyOS Participants Orchestration"])(l.object({
719
719
  name: l.string().optional()
720
- })), Fn = Ln.merge(N), Un = g(T["MyOS/MyOS Session Interaction"])(l.object({
720
+ })), Fn = Ln.merge(N), $n = g(I["MyOS/MyOS Session Interaction"])(l.object({
721
721
  name: l.string().optional()
722
- })), $n = Un.merge(N), zn = g(T["MyOS/MyOS Worker Agency"])(l.object({
722
+ })), Un = $n.merge(N), zn = g(I["MyOS/MyOS Worker Agency"])(l.object({
723
723
  name: l.string().optional()
724
- })), Vn = zn.merge(
724
+ })), Hn = zn.merge(
725
725
  N
726
- ), oe = g(w["Conversation/Sequential Workflow Step"])(l.object({
726
+ ), se = g(w["Conversation/Sequential Workflow Step"])(l.object({
727
727
  description: l.string().optional(),
728
728
  name: l.string().optional()
729
729
  })), pt = g(w["Conversation/Sequential Workflow"])(lt.extend({
730
730
  description: l.string().optional(),
731
731
  name: l.string().optional(),
732
- steps: l.array(oe).optional()
733
- })), so = b(), Hn = pt.merge(ut).extend({
734
- steps: l.array(b()).optional()
732
+ steps: l.array(se).optional()
733
+ })), co = k(), Vn = pt.merge(ut).extend({
734
+ steps: l.array(k()).optional()
735
735
  }), Kn = g(w["Conversation/Sequential Workflow Operation"])(pt.extend({
736
736
  description: l.string().optional(),
737
737
  name: l.string().optional(),
@@ -739,7 +739,7 @@ const ie = g(m["Core/Contract"])(l.object({
739
739
  })), Wn = Kn.merge(
740
740
  ut
741
741
  ).extend({
742
- steps: l.array(b()).optional()
742
+ steps: l.array(k()).optional()
743
743
  });
744
744
  function Gn(i) {
745
745
  if (!Array.isArray(i.blueIds) || i.blueIds.length === 0)
@@ -789,18 +789,69 @@ class qn {
789
789
  lookupHandler(e) {
790
790
  return this.handlerProcessors.get(e);
791
791
  }
792
+ lookupHandlerForNode(e, t) {
793
+ return this.lookupProcessorForNode(e, t, this.handlerProcessors);
794
+ }
792
795
  lookupChannel(e) {
793
796
  return this.channelProcessors.get(e);
794
797
  }
798
+ lookupChannelForNode(e, t) {
799
+ return this.lookupProcessorForNode(e, t, this.channelProcessors);
800
+ }
795
801
  lookupMarker(e) {
796
802
  return this.markerProcessors.get(e);
797
803
  }
804
+ lookupMarkerForNode(e, t) {
805
+ return this.lookupProcessorForNode(e, t, this.markerProcessors);
806
+ }
798
807
  processors() {
799
808
  return new Map(this.processorsByBlueId);
800
809
  }
801
810
  registerProcessorMap(e) {
802
811
  Q(e, this.processorsByBlueId);
803
812
  }
813
+ lookupProcessorForNode(e, t, n) {
814
+ const r = t.getType();
815
+ if (!r)
816
+ return;
817
+ const o = r.getBlueId();
818
+ if (o) {
819
+ const c = n.get(o);
820
+ if (c)
821
+ return c;
822
+ }
823
+ const s = [];
824
+ for (const c of this.uniqueProcessors(n))
825
+ for (const u of c.blueIds)
826
+ s.push([u, c]);
827
+ return this.matchByTypeChain(e, t, s)?.value;
828
+ }
829
+ *uniqueProcessors(e) {
830
+ const t = /* @__PURE__ */ new Set();
831
+ for (const n of e.values())
832
+ t.has(n) || (t.add(n), yield n);
833
+ }
834
+ matchByTypeChain(e, t, n) {
835
+ const r = [];
836
+ for (const [a, c] of n)
837
+ e.isTypeOfBlueId(t, a) && r.push({
838
+ blueId: a,
839
+ value: c,
840
+ baseNode: new p().setType(new p().setBlueId(a))
841
+ });
842
+ if (r.length === 0)
843
+ return null;
844
+ if (r.length === 1) {
845
+ const a = r[0];
846
+ return { blueId: a.blueId, value: a.value };
847
+ }
848
+ const s = r.find(
849
+ (a) => r.every(
850
+ (c) => a === c || e.isTypeOfBlueId(a.baseNode, c.blueId)
851
+ )
852
+ ) ?? r[0];
853
+ return { blueId: s.blueId, value: s.value };
854
+ }
804
855
  }
805
856
  const jn = "compositeSourceChannelKey";
806
857
  function Jn(i, e) {
@@ -844,7 +895,7 @@ class Xn {
844
895
  throw new Error(
845
896
  `Composite timeline channel '${t.bindingKey}' references missing channel '${u}'`
846
897
  );
847
- const d = s(h.blueId);
898
+ const d = s(h.node);
848
899
  if (!d)
849
900
  throw new Error(
850
901
  `No processor registered for child channel '${u}' (${h.blueId})`
@@ -858,7 +909,7 @@ class Xn {
858
909
  continue;
859
910
  const D = d.channelize, ke = (D ? D.call(d, E, f) : void 0) ?? v.clone();
860
911
  this.enrichEvent(ke, u);
861
- const be = Jn(
912
+ const Ie = Jn(
862
913
  t.bindingKey,
863
914
  u
864
915
  ), vt = await this.shouldProcessChild({
@@ -868,13 +919,13 @@ class Xn {
868
919
  ...f,
869
920
  event: n.clone()
870
921
  },
871
- checkpointKey: be,
922
+ checkpointKey: Ie,
872
923
  markers: t.markers
873
924
  });
874
925
  c.push({
875
926
  eventNode: ke,
876
927
  eventId: a,
877
- checkpointKey: be,
928
+ checkpointKey: Ie,
878
929
  shouldProcess: vt
879
930
  });
880
931
  }
@@ -923,52 +974,52 @@ class Xn {
923
974
  return Qn(t) ? t : null;
924
975
  }
925
976
  }
926
- const Yn = g(w["Conversation/Actor"])(l.object({
977
+ const Zn = g(w["Conversation/Actor"])(l.object({
927
978
  description: l.string().optional(),
928
979
  name: l.string().optional()
929
980
  })), ft = g(w["Conversation/Timeline"])(l.object({
930
981
  description: l.string().optional(),
931
982
  name: l.string().optional(),
932
983
  timelineId: l.string().optional()
933
- })), M = g(w["Conversation/Timeline Entry"])(l.object({
934
- actor: Yn.optional(),
984
+ })), R = g(w["Conversation/Timeline Entry"])(l.object({
985
+ actor: Zn.optional(),
935
986
  description: l.string().optional(),
936
- message: b().optional(),
987
+ message: k().optional(),
937
988
  name: l.string().optional(),
938
- prevEntry: b().optional(),
989
+ prevEntry: k().optional(),
939
990
  timeline: ft.optional(),
940
991
  timestamp: l.number().optional()
941
- })), Zn = g(T["MyOS/MyOS Timeline"])(ft.extend({
992
+ })), Yn = g(I["MyOS/MyOS Timeline"])(ft.extend({
942
993
  accountId: l.string().optional(),
943
994
  description: l.string().optional(),
944
995
  name: l.string().optional()
945
- })), Ae = g(T["MyOS/MyOS Timeline Entry"])(M.extend({
996
+ })), De = g(I["MyOS/MyOS Timeline Entry"])(R.extend({
946
997
  description: l.string().optional(),
947
998
  name: l.string().optional(),
948
- timeline: Zn.optional()
999
+ timeline: Yn.optional()
949
1000
  }));
950
- function De(i, e) {
951
- return e && i.isTypeOf(e, M, { checkSchemaExtensions: !0 }) ? i.nodeToSchemaOutput(e, M) : null;
1001
+ function Be(i, e) {
1002
+ return e && i.isTypeOf(e, R, { checkSchemaExtensions: !0 }) ? i.nodeToSchemaOutput(e, R) : null;
952
1003
  }
953
1004
  function mt(i, e, t) {
954
- const n = De(i, e), r = De(i, t);
1005
+ const n = Be(i, e), r = Be(i, t);
955
1006
  if (!n || !r)
956
1007
  return !0;
957
1008
  const o = n.timestamp, s = r.timestamp;
958
1009
  return typeof o != "number" || typeof s != "number" ? !0 : o >= s;
959
1010
  }
960
- function Be(i, e) {
961
- return i.isTypeOf(e, Ae) ? i.nodeToSchemaOutput(e, Ae) : i.isTypeOf(e, M) ? i.nodeToSchemaOutput(e, M) : null;
1011
+ function xe(i, e) {
1012
+ return i.isTypeOf(e, De) ? i.nodeToSchemaOutput(e, De) : i.isTypeOf(e, R) ? i.nodeToSchemaOutput(e, R) : null;
962
1013
  }
963
1014
  class er {
964
1015
  kind = "channel";
965
- blueIds = [T["MyOS/MyOS Timeline Channel"]];
1016
+ blueIds = [I["MyOS/MyOS Timeline Channel"]];
966
1017
  schema = Sn;
967
1018
  matches(e, t) {
968
1019
  const { event: n, blue: r } = t;
969
1020
  if (!n)
970
1021
  return !1;
971
- const o = Be(r, n);
1022
+ const o = xe(r, n);
972
1023
  if (!o)
973
1024
  return !1;
974
1025
  const s = o.timeline?.timelineId;
@@ -976,7 +1027,7 @@ class er {
976
1027
  }
977
1028
  channelize(e, t) {
978
1029
  const { event: n, blue: r } = t;
979
- return !n || !Be(r, n) ? null : n.clone();
1030
+ return !n || !xe(r, n) ? null : n.clone();
980
1031
  }
981
1032
  isNewerEvent(e, t, n) {
982
1033
  const { event: r, blue: o } = t;
@@ -989,26 +1040,26 @@ class tr {
989
1040
  schema = yn;
990
1041
  matches(e, t) {
991
1042
  const { event: n, blue: r } = t;
992
- if (!n || !r.isTypeOf(n, M))
1043
+ if (!n || !r.isTypeOf(n, R))
993
1044
  return !1;
994
- const s = r.nodeToSchemaOutput(n, M).timeline?.timelineId;
1045
+ const s = r.nodeToSchemaOutput(n, R).timeline?.timelineId;
995
1046
  return !(!s || !e.timelineId || s !== e.timelineId);
996
1047
  }
997
1048
  channelize(e, t) {
998
1049
  const { event: n, blue: r } = t;
999
- return !n || !r.isTypeOf(n, M) ? null : n.clone();
1050
+ return !n || !r.isTypeOf(n, R) ? null : n.clone();
1000
1051
  }
1001
1052
  isNewerEvent(e, t, n) {
1002
1053
  const { event: r, blue: o } = t;
1003
1054
  return r ? mt(o, r, n) : !0;
1004
1055
  }
1005
1056
  }
1006
- const xe = g(w["Conversation/Trigger Event"])(oe.extend({
1057
+ const _e = g(w["Conversation/Trigger Event"])(se.extend({
1007
1058
  description: l.string().optional(),
1008
- event: b().optional(),
1059
+ event: k().optional(),
1009
1060
  name: l.string().optional()
1010
1061
  }));
1011
- function ve(i) {
1062
+ function we(i) {
1012
1063
  const { context: e, eventNode: t, stepResults: n, contractNode: r } = i, o = rr(e), s = r != null ? e.blue.nodeToJson(r, "simple") : null, a = r != null ? e.blue.nodeToJson(r, "official") : s;
1013
1064
  return {
1014
1065
  event: e.blue.nodeToJson(t, "simple"),
@@ -1042,16 +1093,16 @@ class ir {
1042
1093
  supportedBlueIds = [
1043
1094
  w["Conversation/Trigger Event"]
1044
1095
  ];
1045
- evaluator = new Ce();
1096
+ evaluator = new Se();
1046
1097
  async execute(e) {
1047
1098
  const { stepNode: t, context: n } = e;
1048
- if (!n.blue.isTypeOf(t, xe))
1099
+ if (!n.blue.isTypeOf(t, _e))
1049
1100
  return n.throwFatal("Trigger Event step payload is invalid");
1050
1101
  n.gasMeter().chargeTriggerEventBase();
1051
- const r = await ee({
1102
+ const r = await te({
1052
1103
  evaluator: this.evaluator,
1053
1104
  node: t,
1054
- bindings: ve(e),
1105
+ bindings: we(e),
1055
1106
  shouldResolve: ct({
1056
1107
  include: ["/event", "/event/**"]
1057
1108
  }),
@@ -1059,9 +1110,9 @@ class ir {
1059
1110
  context: n
1060
1111
  }), s = n.blue.nodeToSchemaOutput(
1061
1112
  r,
1062
- xe
1113
+ _e
1063
1114
  ).event;
1064
- if (he(s))
1115
+ if (de(s))
1065
1116
  return n.throwFatal(
1066
1117
  "Trigger Event step must declare event payload"
1067
1118
  );
@@ -1075,7 +1126,7 @@ function sr(i) {
1075
1126
  const e = i.getProperties?.();
1076
1127
  return e ? !!e.contracts : !1;
1077
1128
  }
1078
- const _e = g(w["Conversation/JavaScript Code"])(oe.extend({
1129
+ const Le = g(w["Conversation/JavaScript Code"])(se.extend({
1079
1130
  code: l.string().optional(),
1080
1131
  description: l.string().optional(),
1081
1132
  name: l.string().optional()
@@ -1084,24 +1135,24 @@ class ar {
1084
1135
  supportedBlueIds = [
1085
1136
  w["Conversation/JavaScript Code"]
1086
1137
  ];
1087
- evaluator = new Ce();
1138
+ evaluator = new Se();
1088
1139
  wasmGasLimit;
1089
1140
  constructor(e = {}) {
1090
1141
  this.wasmGasLimit = e.wasmGasLimit ?? it;
1091
1142
  }
1092
1143
  async execute(e) {
1093
1144
  const { context: t, stepNode: n } = e, { blue: r } = t;
1094
- if (!r.isTypeOf(n, _e))
1145
+ if (!r.isTypeOf(n, Le))
1095
1146
  return t.throwFatal("JavaScript Code step payload is invalid");
1096
1147
  const s = r.nodeToSchemaOutput(
1097
1148
  n,
1098
- _e
1149
+ Le
1099
1150
  ).code;
1100
1151
  if (!s)
1101
1152
  return t.throwFatal(
1102
1153
  "JavaScript Code step must include code to execute"
1103
1154
  );
1104
- const a = ve(e);
1155
+ const a = we(e);
1105
1156
  try {
1106
1157
  const c = await this.evaluator.evaluate({
1107
1158
  code: s,
@@ -1130,8 +1181,8 @@ const cr = g(m["Core/Json Patch Entry"])(l.object({
1130
1181
  name: l.string().optional(),
1131
1182
  op: l.string().optional(),
1132
1183
  path: l.string().optional(),
1133
- val: b().optional()
1134
- })), Le = g(w["Conversation/Update Document"])(oe.extend({
1184
+ val: k().optional()
1185
+ })), Fe = g(w["Conversation/Update Document"])(se.extend({
1135
1186
  changeset: l.array(cr).optional(),
1136
1187
  description: l.string().optional(),
1137
1188
  name: l.string().optional()
@@ -1140,15 +1191,15 @@ class lr {
1140
1191
  supportedBlueIds = [
1141
1192
  w["Conversation/Update Document"]
1142
1193
  ];
1143
- evaluator = new Ce();
1194
+ evaluator = new Se();
1144
1195
  async execute(e) {
1145
1196
  const { context: t, stepNode: n } = e, { blue: r } = t;
1146
- if (!r.isTypeOf(n, Le))
1197
+ if (!r.isTypeOf(n, Fe))
1147
1198
  return t.throwFatal("Update Document step payload is invalid");
1148
- const o = await ee({
1199
+ const o = await te({
1149
1200
  evaluator: this.evaluator,
1150
1201
  node: n,
1151
- bindings: ve(e),
1202
+ bindings: we(e),
1152
1203
  shouldResolve: ct({
1153
1204
  include: ["/changeset", "/changeset/**"]
1154
1205
  }),
@@ -1163,7 +1214,7 @@ class lr {
1163
1214
  extractChanges(e, t) {
1164
1215
  return t.blue.nodeToSchemaOutput(
1165
1216
  e,
1166
- Le
1217
+ Fe
1167
1218
  ).changeset ?? [];
1168
1219
  }
1169
1220
  createPatch(e, t) {
@@ -1183,14 +1234,14 @@ class lr {
1183
1234
  return n.length === 0 ? t.throwFatal("Update Document path cannot be empty") : n;
1184
1235
  }
1185
1236
  }
1186
- const we = [
1237
+ const be = [
1187
1238
  new ir(),
1188
1239
  new ar(),
1189
1240
  new lr()
1190
1241
  ];
1191
1242
  class gt {
1192
1243
  executorIndex;
1193
- constructor(e = we) {
1244
+ constructor(e = be) {
1194
1245
  const t = /* @__PURE__ */ new Map();
1195
1246
  for (const n of e)
1196
1247
  for (const r of n.supportedBlueIds)
@@ -1204,12 +1255,12 @@ class gt {
1204
1255
  const a = {};
1205
1256
  for (const [c, u] of s.entries()) {
1206
1257
  const h = u.getType?.()?.getBlueId();
1207
- if (he(h))
1258
+ if (de(h))
1208
1259
  return r.throwFatal(
1209
1260
  "Sequential workflow step is missing type metadata"
1210
1261
  );
1211
1262
  const d = this.executorIndex.get(h);
1212
- if (he(d)) {
1263
+ if (de(d)) {
1213
1264
  const E = u.getType?.()?.getName?.() ?? h;
1214
1265
  return r.throwFatal(
1215
1266
  `Unsupported workflow step type "${E}"`
@@ -1241,9 +1292,9 @@ class ur {
1241
1292
  blueIds = [
1242
1293
  w["Conversation/Sequential Workflow"]
1243
1294
  ];
1244
- schema = Hn;
1295
+ schema = Vn;
1245
1296
  runner;
1246
- constructor(e = we) {
1297
+ constructor(e = be) {
1247
1298
  this.runner = new gt(e);
1248
1299
  }
1249
1300
  async matches(e, t) {
@@ -1265,13 +1316,13 @@ class hr {
1265
1316
  blueIds = [w["Conversation/Operation"]];
1266
1317
  schema = Nn;
1267
1318
  }
1268
- const fe = g(w["Conversation/Operation Request"])(l.object({
1319
+ const me = g(w["Conversation/Operation Request"])(l.object({
1269
1320
  allowNewerVersion: l.boolean().optional(),
1270
1321
  description: l.string().optional(),
1271
- document: b().optional(),
1322
+ document: k().optional(),
1272
1323
  name: l.string().optional(),
1273
1324
  operation: l.string().optional(),
1274
- request: b().optional()
1325
+ request: k().optional()
1275
1326
  }));
1276
1327
  function Et(i) {
1277
1328
  const e = i.channel;
@@ -1287,15 +1338,15 @@ function dr(i, e) {
1287
1338
  return t instanceof p ? e.blue.calculateBlueIdSync(t) : null;
1288
1339
  }
1289
1340
  function pr(i, e) {
1290
- if (e.isTypeOf(i, fe, {
1341
+ if (e.isTypeOf(i, me, {
1291
1342
  checkSchemaExtensions: !0
1292
1343
  }))
1293
1344
  return i;
1294
- if (e.isTypeOf(i, M, {
1345
+ if (e.isTypeOf(i, R, {
1295
1346
  checkSchemaExtensions: !0
1296
1347
  })) {
1297
- const n = e.nodeToSchemaOutput(i, M).message;
1298
- if (n && e.isTypeOf(n, fe, {
1348
+ const n = e.nodeToSchemaOutput(i, R).message;
1349
+ if (n && e.isTypeOf(n, me, {
1299
1350
  checkSchemaExtensions: !0
1300
1351
  }))
1301
1352
  return n;
@@ -1311,7 +1362,9 @@ function mr(i, e) {
1311
1362
  if (!t)
1312
1363
  return null;
1313
1364
  const n = e.resolvePointer(`/contracts/${t}`), r = e.documentAt(n);
1314
- if (!r || !e.blue.isTypeOf(r, J))
1365
+ if (!r || !e.blue.isTypeOf(r, J, {
1366
+ checkSchemaExtensions: !0
1367
+ }))
1315
1368
  return null;
1316
1369
  const o = e.blue.nodeToSchemaOutput(
1317
1370
  r,
@@ -1353,7 +1406,7 @@ class Cr {
1353
1406
  ];
1354
1407
  schema = Wn;
1355
1408
  runner;
1356
- constructor(e = we) {
1409
+ constructor(e = be) {
1357
1410
  this.runner = new gt(e);
1358
1411
  }
1359
1412
  deriveChannel(e, t) {
@@ -1380,7 +1433,7 @@ class Cr {
1380
1433
  return !1;
1381
1434
  const o = t.blue.nodeToSchemaOutput(
1382
1435
  r,
1383
- fe
1436
+ me
1384
1437
  );
1385
1438
  if (!o || !fr(e, n, o, t))
1386
1439
  return !1;
@@ -1404,12 +1457,12 @@ class Cr {
1404
1457
  });
1405
1458
  }
1406
1459
  }
1407
- class se {
1460
+ class ae {
1408
1461
  constructor(e) {
1409
1462
  this.registry = e;
1410
1463
  }
1411
1464
  static create() {
1412
- return new se(
1465
+ return new ae(
1413
1466
  new qn()
1414
1467
  );
1415
1468
  }
@@ -1423,13 +1476,13 @@ class se {
1423
1476
  return this.registry;
1424
1477
  }
1425
1478
  }
1426
- const me = m["Core/Channel Event Checkpoint"];
1479
+ const ge = m["Core/Channel Event Checkpoint"];
1427
1480
  function yt(i) {
1428
1481
  return typeof i.order == "number" ? i.order : 0;
1429
1482
  }
1430
1483
  class Sr {
1431
- constructor(e, t, n) {
1432
- this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n;
1484
+ constructor(e, t, n, r) {
1485
+ this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n, this.bindingNode = r;
1433
1486
  }
1434
1487
  key() {
1435
1488
  return this.bindingKey;
@@ -1440,6 +1493,9 @@ class Sr {
1440
1493
  blueId() {
1441
1494
  return this.bindingBlueId;
1442
1495
  }
1496
+ node() {
1497
+ return this.bindingNode.clone();
1498
+ }
1443
1499
  order() {
1444
1500
  return yt(this.bindingContract);
1445
1501
  }
@@ -1464,13 +1520,13 @@ class vr {
1464
1520
  return yt(this.bindingContract);
1465
1521
  }
1466
1522
  }
1467
- class V {
1523
+ class H {
1468
1524
  constructor(e, t, n, r, o) {
1469
1525
  this.channels = e, this.handlersByChannel = t, this.markerStore = n, this.embeddedPathsInternal = r, this.checkpointDeclared = o;
1470
1526
  }
1471
1527
  checkpointDeclared;
1472
1528
  static fromComponents(e, t, n, r, o) {
1473
- return new V(
1529
+ return new H(
1474
1530
  e,
1475
1531
  t,
1476
1532
  n,
@@ -1482,7 +1538,7 @@ class V {
1482
1538
  return new wr();
1483
1539
  }
1484
1540
  static empty() {
1485
- return V.builder().build();
1541
+ return H.builder().build();
1486
1542
  }
1487
1543
  markers() {
1488
1544
  return new Map(
@@ -1515,7 +1571,7 @@ class V {
1515
1571
  this.markerStore.set(A, {
1516
1572
  key: A,
1517
1573
  contract: e,
1518
- blueId: me
1574
+ blueId: ge
1519
1575
  }), this.checkpointDeclared = !0;
1520
1576
  }
1521
1577
  handlersFor(e) {
@@ -1534,11 +1590,21 @@ class V {
1534
1590
  }
1535
1591
  channelEntry(e) {
1536
1592
  const t = this.channels.get(e);
1537
- return t ? { key: t.key, contract: t.contract, blueId: t.blueId } : null;
1593
+ return t ? {
1594
+ key: t.key,
1595
+ contract: t.contract,
1596
+ blueId: t.blueId,
1597
+ node: t.node.clone()
1598
+ } : null;
1538
1599
  }
1539
1600
  channelsOfType(...e) {
1540
1601
  const t = e.length > 0 ? new Set(e) : null, n = Array.from(this.channels.values()).filter((r) => !t || t.has(r.blueId)).map(
1541
- (r) => new Sr(r.key, r.contract, r.blueId)
1602
+ (r) => new Sr(
1603
+ r.key,
1604
+ r.contract,
1605
+ r.blueId,
1606
+ r.node
1607
+ )
1542
1608
  );
1543
1609
  return n.sort((r, o) => {
1544
1610
  const s = r.order() - o.order();
@@ -1553,8 +1619,8 @@ class wr {
1553
1619
  embeddedPaths = [];
1554
1620
  embeddedDeclared = !1;
1555
1621
  checkpointDeclared = !1;
1556
- addChannel(e, t, n) {
1557
- return this.channels.set(e, { key: e, contract: t, blueId: n }), this;
1622
+ addChannel(e, t, n, r) {
1623
+ return this.channels.set(e, { key: e, contract: t, blueId: n, node: r }), this;
1558
1624
  }
1559
1625
  addHandler(e, t, n, r) {
1560
1626
  const o = t.channel;
@@ -1571,11 +1637,11 @@ class wr {
1571
1637
  return this.embeddedDeclared = !0, this.embeddedPaths = e.paths ? [...e.paths] : [], this;
1572
1638
  }
1573
1639
  addMarker(e, t, n) {
1574
- if (e === A && n !== me)
1640
+ if (e === A && n !== ge)
1575
1641
  throw new Error(
1576
1642
  "Reserved key 'checkpoint' must contain a Channel Event Checkpoint"
1577
1643
  );
1578
- if (n === me) {
1644
+ if (n === ge) {
1579
1645
  if (e !== A)
1580
1646
  throw new Error(
1581
1647
  `Channel Event Checkpoint must use reserved key 'checkpoint' at key '${e}'`
@@ -1589,7 +1655,7 @@ class wr {
1589
1655
  return this.markerStore.set(e, { key: e, contract: t, blueId: n }), this;
1590
1656
  }
1591
1657
  build() {
1592
- return V.fromComponents(
1658
+ return H.fromComponents(
1593
1659
  new Map(this.channels),
1594
1660
  new Map(
1595
1661
  Array.from(this.handlersByChannel.entries(), ([e, t]) => [
@@ -1608,7 +1674,13 @@ class y extends Error {
1608
1674
  super(e || "Processor fatal error"), this.processorError = t, this.name = "ProcessorFatalError";
1609
1675
  }
1610
1676
  }
1611
- class kr {
1677
+ function Z(i, e, t) {
1678
+ for (const [n, r] of t.entries())
1679
+ if (i.isTypeOfBlueId(e, n))
1680
+ return r;
1681
+ return null;
1682
+ }
1683
+ class br {
1612
1684
  constructor(e, t, n) {
1613
1685
  this.blue = e, this.registry = t, this.builtinChannelSchemas = n;
1614
1686
  }
@@ -1639,7 +1711,7 @@ class kr {
1639
1711
  `/contracts/${u}`
1640
1712
  )
1641
1713
  );
1642
- if (!this.isRegisteredChannel(h.nodeTypeBlueId))
1714
+ if (!this.isRegisteredChannel(h))
1643
1715
  throw new y(
1644
1716
  `Contract '${u}' is not a channel`,
1645
1717
  S.invalidContract(
@@ -1700,7 +1772,7 @@ class kr {
1700
1772
  return o;
1701
1773
  }
1702
1774
  isRegisteredChannel(e) {
1703
- return this.builtinChannelSchemas.has(e) ? !0 : this.registry.lookupChannel(e) != null;
1775
+ return Z(this.blue, e.node, this.builtinChannelSchemas) ? !0 : this.registry.lookupChannelForNode(this.blue, e.node) != null;
1704
1776
  }
1705
1777
  setContractChannel(e, t) {
1706
1778
  const r = e.getProperties()?.channel;
@@ -1711,7 +1783,7 @@ class kr {
1711
1783
  e.addProperty("channel", new p().setValue(t));
1712
1784
  }
1713
1785
  isZodError(e) {
1714
- return e instanceof ge;
1786
+ return e instanceof Ee;
1715
1787
  }
1716
1788
  }
1717
1789
  class z extends Error {
@@ -1719,28 +1791,22 @@ class z extends Error {
1719
1791
  super(e ?? "MustUnderstand failure"), this.name = "MustUnderstandFailure";
1720
1792
  }
1721
1793
  }
1722
- function br(i) {
1723
- const {
1724
- compositeKey: e,
1725
- contract: t,
1726
- scopeContracts: n,
1727
- blueId: r,
1728
- blue: o,
1729
- compositeChannelBlueId: s
1730
- } = i, a = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), u = [], h = /* @__PURE__ */ new Map([
1794
+ const kr = w["Conversation/Composite Timeline Channel"];
1795
+ function Ir(i) {
1796
+ const { compositeKey: e, contract: t, scopeContracts: n, blueId: r, blue: o } = i, s = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), c = [], u = /* @__PURE__ */ new Map([
1731
1797
  [e, t]
1732
- ]), d = (f) => {
1733
- if (h.has(f))
1734
- return h.get(f) ?? null;
1798
+ ]), h = (f) => o.isTypeOfBlueId(f.node, kr), d = (f) => {
1799
+ if (u.has(f))
1800
+ return u.get(f) ?? null;
1735
1801
  const E = n.get(f);
1736
- if (!E || E.nodeTypeBlueId !== s)
1737
- return h.set(f, null), null;
1802
+ if (!E || !h(E))
1803
+ return u.set(f, null), null;
1738
1804
  try {
1739
1805
  const C = o.nodeToSchemaOutput(
1740
1806
  E.node,
1741
1807
  dt
1742
1808
  );
1743
- return h.set(f, C), C;
1809
+ return u.set(f, C), C;
1744
1810
  } catch (C) {
1745
1811
  if (Tr(C))
1746
1812
  throw new y(
@@ -1752,15 +1818,15 @@ function br(i) {
1752
1818
  C
1753
1819
  )
1754
1820
  );
1755
- const R = C?.message ?? "Failed to parse channel contract";
1821
+ const M = C?.message ?? "Failed to parse channel contract";
1756
1822
  throw new y(
1757
- R,
1758
- S.illegalState(R)
1823
+ M,
1824
+ S.illegalState(M)
1759
1825
  );
1760
1826
  }
1761
1827
  }, v = (f) => {
1762
- if (c.has(f)) {
1763
- const C = u.indexOf(f), D = [...u.slice(C), f].join(" -> ");
1828
+ if (a.has(f)) {
1829
+ const C = c.indexOf(f), D = [...c.slice(C), f].join(" -> ");
1764
1830
  throw new y(
1765
1831
  `Composite channel ${e} has a cyclic reference: ${D}`,
1766
1832
  S.invalidContract(
@@ -1770,29 +1836,29 @@ function br(i) {
1770
1836
  )
1771
1837
  );
1772
1838
  }
1773
- if (a.has(f))
1839
+ if (s.has(f))
1774
1840
  return;
1775
- c.add(f), u.push(f);
1841
+ a.add(f), c.push(f);
1776
1842
  const E = d(f);
1777
1843
  if (E)
1778
1844
  for (const C of E.channels ?? []) {
1779
- const R = n.get(C);
1780
- R && R.nodeTypeBlueId === s && v(C);
1845
+ const M = n.get(C);
1846
+ M && h(M) && v(C);
1781
1847
  }
1782
- u.pop(), c.delete(f), a.add(f);
1848
+ c.pop(), a.delete(f), s.add(f);
1783
1849
  };
1784
1850
  v(e);
1785
1851
  }
1786
1852
  function Tr(i) {
1787
- return i instanceof ge;
1853
+ return i instanceof Ee;
1788
1854
  }
1789
- const Ir = m["Core/Document Update Channel"], Pr = m["Core/Embedded Node Channel"], Rr = m["Core/Lifecycle Event Channel"], Mr = m["Core/Triggered Event Channel"], Fe = m["Core/Process Embedded"], Nr = m["Core/Processing Initialized Marker"], Or = m["Core/Processing Terminated Marker"], Ar = m["Core/Channel Event Checkpoint"], Dr = T["MyOS/Document Anchors"], Br = T["MyOS/Document Links"], xr = T["MyOS/MyOS Participants Orchestration"], _r = T["MyOS/MyOS Session Interaction"], Lr = T["MyOS/MyOS Worker Agency"], Ue = w["Conversation/Composite Timeline Channel"], ce = /* @__PURE__ */ new Map([
1855
+ const Pr = m["Core/Document Update Channel"], Mr = m["Core/Embedded Node Channel"], Rr = m["Core/Lifecycle Event Channel"], Nr = m["Core/Triggered Event Channel"], $e = m["Core/Process Embedded"], Or = m["Core/Processing Initialized Marker"], Ar = m["Core/Processing Terminated Marker"], Dr = m["Core/Channel Event Checkpoint"], Br = I["MyOS/Document Anchors"], xr = I["MyOS/Document Links"], _r = I["MyOS/MyOS Participants Orchestration"], Lr = I["MyOS/MyOS Session Interaction"], Fr = I["MyOS/MyOS Worker Agency"], $r = w["Conversation/Composite Timeline Channel"], le = /* @__PURE__ */ new Map([
1790
1856
  [
1791
- Ir,
1857
+ Pr,
1792
1858
  hn
1793
1859
  ],
1794
1860
  [
1795
- Pr,
1861
+ Mr,
1796
1862
  pn
1797
1863
  ],
1798
1864
  [
@@ -1800,55 +1866,55 @@ const Ir = m["Core/Document Update Channel"], Pr = m["Core/Embedded Node Channel
1800
1866
  mn
1801
1867
  ],
1802
1868
  [
1803
- Mr,
1869
+ Nr,
1804
1870
  En
1805
1871
  ]
1806
- ]), Fr = /* @__PURE__ */ new Map([
1807
- [
1808
- Nr,
1809
- Tn
1810
- ],
1872
+ ]), Ur = /* @__PURE__ */ new Map([
1811
1873
  [
1812
1874
  Or,
1813
- Mn
1875
+ In
1814
1876
  ],
1815
1877
  [
1816
1878
  Ar,
1817
- kn
1879
+ Rn
1818
1880
  ],
1819
1881
  [
1820
1882
  Dr,
1821
- Dn
1883
+ bn
1822
1884
  ],
1823
1885
  [
1824
1886
  Br,
1825
- _n
1887
+ Dn
1826
1888
  ],
1827
1889
  [
1828
1890
  xr,
1829
- Fn
1891
+ _n
1830
1892
  ],
1831
1893
  [
1832
1894
  _r,
1833
- $n
1895
+ Fn
1834
1896
  ],
1835
1897
  [
1836
1898
  Lr,
1837
- Vn
1899
+ Un
1900
+ ],
1901
+ [
1902
+ Fr,
1903
+ Hn
1838
1904
  ]
1839
1905
  ]);
1840
- class Ur {
1906
+ class zr {
1841
1907
  constructor(e, t) {
1842
- this.registry = e, this.blue = t, this.handlerRegistration = new kr(
1908
+ this.registry = e, this.blue = t, this.handlerRegistration = new br(
1843
1909
  this.blue,
1844
1910
  this.registry,
1845
- ce
1911
+ le
1846
1912
  );
1847
1913
  }
1848
1914
  handlerRegistration;
1849
1915
  load(e, t) {
1850
1916
  try {
1851
- const n = V.builder(), r = e.getContracts();
1917
+ const n = H.builder(), r = e.getContracts();
1852
1918
  if (!r)
1853
1919
  return n.build();
1854
1920
  const o = this.buildScopeContractsIndex(r);
@@ -1872,16 +1938,24 @@ class Ur {
1872
1938
  const o = n.getType()?.getBlueId();
1873
1939
  if (!o)
1874
1940
  return;
1875
- if (o === Fe) {
1941
+ if (this.blue.isTypeOfBlueId(n, $e)) {
1876
1942
  this.handleProcessEmbedded(e, t, n);
1877
1943
  return;
1878
1944
  }
1879
- const s = Fr.get(o);
1945
+ const s = Z(
1946
+ this.blue,
1947
+ n,
1948
+ Ur
1949
+ );
1880
1950
  if (s) {
1881
1951
  this.handleMarker(e, t, n, s, o);
1882
1952
  return;
1883
1953
  }
1884
- const a = ce.get(o);
1954
+ const a = Z(
1955
+ this.blue,
1956
+ n,
1957
+ le
1958
+ );
1885
1959
  if (a) {
1886
1960
  this.handleChannel(
1887
1961
  e,
@@ -1893,7 +1967,10 @@ class Ur {
1893
1967
  );
1894
1968
  return;
1895
1969
  }
1896
- const c = this.registry.lookupChannel(o);
1970
+ const c = this.registry.lookupChannelForNode(
1971
+ this.blue,
1972
+ n
1973
+ );
1897
1974
  if (c) {
1898
1975
  this.handleChannel(
1899
1976
  e,
@@ -1905,7 +1982,10 @@ class Ur {
1905
1982
  );
1906
1983
  return;
1907
1984
  }
1908
- const u = this.registry.lookupHandler(o);
1985
+ const u = this.registry.lookupHandlerForNode(
1986
+ this.blue,
1987
+ n
1988
+ );
1909
1989
  if (u) {
1910
1990
  this.handlerRegistration.register({
1911
1991
  builder: e,
@@ -1917,7 +1997,7 @@ class Ur {
1917
1997
  });
1918
1998
  return;
1919
1999
  }
1920
- const h = this.registry.lookupMarker(o);
2000
+ const h = this.registry.lookupMarkerForNode(this.blue, n);
1921
2001
  if (h) {
1922
2002
  this.handleMarker(
1923
2003
  e,
@@ -1928,7 +2008,7 @@ class Ur {
1928
2008
  );
1929
2009
  return;
1930
2010
  }
1931
- throw ye(o) ? new y(
2011
+ throw je(o) ? new y(
1932
2012
  "Built-in processor-managed channel is missing schema registration",
1933
2013
  S.invalidContract(
1934
2014
  o,
@@ -1945,10 +2025,10 @@ class Ur {
1945
2025
  );
1946
2026
  e.setEmbedded(r);
1947
2027
  } catch (r) {
1948
- throw le(r) ? new y(
2028
+ throw ue(r) ? new y(
1949
2029
  "Failed to parse ProcessEmbedded marker",
1950
2030
  S.invalidContract(
1951
- Fe,
2031
+ $e,
1952
2032
  "Failed to parse ProcessEmbedded marker",
1953
2033
  t,
1954
2034
  r
@@ -1967,16 +2047,16 @@ class Ur {
1967
2047
  n,
1968
2048
  r
1969
2049
  );
1970
- o === Ue && this.validateCompositeChannel(
2050
+ this.blue.isTypeOfBlueId(n, $r) && this.validateCompositeChannel(
1971
2051
  t,
1972
2052
  a,
1973
2053
  s,
1974
2054
  o
1975
- ), e.addChannel(t, a, o);
2055
+ ), e.addChannel(t, a, o, n);
1976
2056
  } catch (a) {
1977
2057
  if (a instanceof y || a instanceof z)
1978
2058
  throw a;
1979
- if (le(a))
2059
+ if (ue(a))
1980
2060
  throw new y(
1981
2061
  "Failed to parse channel contract",
1982
2062
  S.invalidContract(
@@ -2007,7 +2087,7 @@ class Ur {
2007
2087
  `/contracts/${s}`
2008
2088
  )
2009
2089
  );
2010
- if (!this.isRegisteredChannel(a.nodeTypeBlueId))
2090
+ if (!this.isRegisteredChannel(a))
2011
2091
  throw new y(
2012
2092
  `Contract '${s}' is not a channel`,
2013
2093
  S.invalidContract(
@@ -2017,18 +2097,17 @@ class Ur {
2017
2097
  )
2018
2098
  );
2019
2099
  }
2020
- br({
2100
+ Ir({
2021
2101
  compositeKey: e,
2022
2102
  contract: t,
2023
2103
  scopeContracts: n,
2024
2104
  blueId: r,
2025
- blue: this.blue,
2026
- compositeChannelBlueId: Ue
2105
+ blue: this.blue
2027
2106
  });
2028
2107
  }
2029
2108
  }
2030
2109
  isRegisteredChannel(e) {
2031
- return ce.has(e) ? !0 : this.registry.lookupChannel(e) != null;
2110
+ return Z(this.blue, e.node, le) ? !0 : this.registry.lookupChannelForNode(this.blue, e.node) != null;
2032
2111
  }
2033
2112
  handleMarker(e, t, n, r, o) {
2034
2113
  try {
@@ -2038,7 +2117,7 @@ class Ur {
2038
2117
  );
2039
2118
  e.addMarker(t, s, o);
2040
2119
  } catch (s) {
2041
- if (le(s))
2120
+ if (ue(s))
2042
2121
  throw new y(
2043
2122
  "Failed to parse marker contract",
2044
2123
  S.invalidContract(
@@ -2066,27 +2145,27 @@ class Ur {
2066
2145
  return t;
2067
2146
  }
2068
2147
  }
2069
- function le(i) {
2070
- return i instanceof ge;
2148
+ function ue(i) {
2149
+ return i instanceof Ee;
2071
2150
  }
2072
- const $r = m["Core/Channel Event Checkpoint"];
2073
- function zr(i) {
2151
+ const Hr = m["Core/Channel Event Checkpoint"];
2152
+ function Vr(i) {
2074
2153
  return i.jsonValueToNode({
2075
- type: { blueId: $r },
2154
+ type: { blueId: Hr },
2076
2155
  lastEvents: {},
2077
2156
  lastSignatures: {}
2078
2157
  });
2079
2158
  }
2080
- function Vr() {
2159
+ function Kr() {
2081
2160
  return {
2082
2161
  lastEvents: {},
2083
2162
  lastSignatures: {}
2084
2163
  };
2085
2164
  }
2086
- function $e(i) {
2165
+ function Ue(i) {
2087
2166
  return i != null && Object.prototype.hasOwnProperty.call(i, "lastEvents") && Object.prototype.hasOwnProperty.call(i, "lastSignatures");
2088
2167
  }
2089
- class Hr {
2168
+ class Wr {
2090
2169
  constructor(e, t, n, r, o) {
2091
2170
  this.markerKey = e, this.checkpoint = t, this.channelKey = n, this.lastEventNode = r, this.lastEventSignature = o;
2092
2171
  }
@@ -2096,28 +2175,28 @@ class Hr {
2096
2175
  return e != null && e === this.lastEventSignature;
2097
2176
  }
2098
2177
  }
2099
- class Kr {
2178
+ class Gr {
2100
2179
  constructor(e, t) {
2101
2180
  this.runtime = e, this.signatureFn = t;
2102
2181
  }
2103
2182
  ensureCheckpointMarker(e, t) {
2104
- const n = t.marker(A), r = I(e, Qe);
2183
+ const n = t.marker(A), r = T(e, Qe);
2105
2184
  if (!n) {
2106
- const o = zr(this.runtime.blue());
2107
- this.runtime.directWrite(r, o), t.registerCheckpointMarker(Vr());
2185
+ const o = Vr(this.runtime.blue());
2186
+ this.runtime.directWrite(r, o), t.registerCheckpointMarker(Kr());
2108
2187
  return;
2109
2188
  }
2110
- if (!$e(n))
2189
+ if (!Ue(n))
2111
2190
  throw new Error(
2112
2191
  `Reserved key 'checkpoint' must contain a Channel Event Checkpoint at ${r}`
2113
2192
  );
2114
2193
  }
2115
2194
  findCheckpoint(e, t) {
2116
2195
  for (const [n, r] of e.markerEntries()) {
2117
- if (!$e(r))
2196
+ if (!Ue(r))
2118
2197
  continue;
2119
2198
  const s = (r.lastEvents?.[t] ?? null)?.clone() ?? null, c = r.lastSignatures?.[t] ?? null ?? this.signatureFn(s);
2120
- return new Hr(
2199
+ return new Wr(
2121
2200
  n,
2122
2201
  r,
2123
2202
  t,
@@ -2133,19 +2212,19 @@ class Kr {
2133
2212
  persist(e, t, n, r, o) {
2134
2213
  if (!n)
2135
2214
  return;
2136
- const s = I(
2215
+ const s = T(
2137
2216
  e,
2138
- Ze(n.markerKey, n.channelKey)
2217
+ Ye(n.markerKey, n.channelKey)
2139
2218
  ), a = o?.clone() ?? null;
2140
2219
  this.runtime.gasMeter().chargeCheckpointUpdate(), this.runtime.directWrite(s, a), n.checkpoint.lastEvents || (n.checkpoint.lastEvents = {}), a ? n.checkpoint.lastEvents[n.channelKey] = a.clone() ?? null : delete n.checkpoint.lastEvents[n.channelKey], n.lastEventNode = a?.clone() ?? null;
2141
- const c = I(
2220
+ const c = T(
2142
2221
  e,
2143
2222
  et(n.markerKey, n.channelKey)
2144
2223
  ), u = r == null ? null : new p().setValue(r);
2145
2224
  this.runtime.directWrite(c, u), n.checkpoint.lastSignatures || (n.checkpoint.lastSignatures = {}), r == null ? delete n.checkpoint.lastSignatures[n.channelKey] : n.checkpoint.lastSignatures[n.channelKey] = r, n.lastEventSignature = r ?? null;
2146
2225
  }
2147
2226
  }
2148
- class Wr {
2227
+ class qr {
2149
2228
  constructor(e, t, n) {
2150
2229
  this.runtime = e, this.checkpointManager = t, this.deps = n;
2151
2230
  }
@@ -2255,7 +2334,7 @@ class Wr {
2255
2334
  async shouldProcessRelativeToCheckpoint(e, t, n, r, o) {
2256
2335
  if (!o?.lastEventNode)
2257
2336
  return !0;
2258
- const s = this.deps.channelProcessorFor(n.blueId());
2337
+ const s = this.deps.channelProcessorFor(n.node());
2259
2338
  if (!s || typeof s.isNewerEvent != "function")
2260
2339
  return !0;
2261
2340
  const a = {
@@ -2272,10 +2351,10 @@ class Wr {
2272
2351
  );
2273
2352
  }
2274
2353
  }
2275
- function Gr(i, e) {
2354
+ function jr(i, e) {
2276
2355
  return e.isResolved() ? i.createResolvedNode(e) : i.resolve(e);
2277
2356
  }
2278
- class $ extends y {
2357
+ class U extends y {
2279
2358
  constructor(e) {
2280
2359
  super(e, S.illegalState(e)), this.name = "IllegalStateException";
2281
2360
  }
@@ -2285,8 +2364,8 @@ class F extends Error {
2285
2364
  super(e), this.name = "BoundaryViolationException";
2286
2365
  }
2287
2366
  }
2288
- const qr = m["Core/Document Update Channel"], jr = m["Core/Embedded Node Channel"], Jr = m["Core/Triggered Event Channel"], Qr = m["Core/Lifecycle Event Channel"], ze = m["Core/Processing Initialized Marker"], Xr = m["Core/Document Processing Initiated"];
2289
- class Yr {
2367
+ const Jr = m["Core/Document Update Channel"], Qr = m["Core/Embedded Node Channel"], Xr = m["Core/Triggered Event Channel"], Zr = m["Core/Lifecycle Event Channel"], ze = m["Core/Processing Initialized Marker"], Yr = m["Core/Document Processing Initiated"];
2368
+ class ei {
2290
2369
  runtime;
2291
2370
  contractLoader;
2292
2371
  channelRunner;
@@ -2300,7 +2379,7 @@ class Yr {
2300
2379
  this.runtime = e.runtime, this.contractLoader = e.contractLoader, this.channelRunner = e.channelRunner, this.bundles = e.bundles, this.hooks = e.hooks, this.blueId = e.blueId, this.nodeAt = e.nodeAt, this.createDocumentUpdateEvent = e.createDocumentUpdateEvent, this.matchesDocumentUpdate = e.matchesDocumentUpdate;
2301
2380
  }
2302
2381
  async initializeScope(e, t) {
2303
- const n = k(e), r = /* @__PURE__ */ new Set();
2382
+ const n = b(e), r = /* @__PURE__ */ new Set();
2304
2383
  let o = null, s = null;
2305
2384
  for (t && this.runtime.gasMeter().chargeScopeEntry(n); ; ) {
2306
2385
  const d = this.nodeAt(n);
@@ -2311,14 +2390,14 @@ class Yr {
2311
2390
  if (!v)
2312
2391
  break;
2313
2392
  r.add(v);
2314
- const f = I(n, v);
2393
+ const f = T(n, v);
2315
2394
  this.nodeAt(f) && await this.initializeScope(f, !0);
2316
2395
  }
2317
2396
  if (!o)
2318
2397
  return;
2319
2398
  const a = this.hasInitializationMarker(n);
2320
2399
  if (!a && o.hasCheckpoint())
2321
- throw new $(
2400
+ throw new U(
2322
2401
  `Reserved key 'checkpoint' must not appear before initialization at scope ${n}`
2323
2402
  );
2324
2403
  if (a)
@@ -2334,22 +2413,22 @@ class Yr {
2334
2413
  await this.deliverLifecycle(n, o, u, !0), await this.addInitializationMarker(h, c);
2335
2414
  }
2336
2415
  loadBundles(e) {
2337
- const t = k(e);
2416
+ const t = b(e);
2338
2417
  if (this.bundles.has(t))
2339
2418
  return;
2340
- const n = this.nodeAt(t), r = n ? this.loadBundle(n, t) : V.empty();
2419
+ const n = this.nodeAt(t), r = n ? this.loadBundle(n, t) : H.empty();
2341
2420
  this.bundles.set(t, r);
2342
2421
  for (const o of r.embeddedPaths()) {
2343
- const s = I(t, o);
2422
+ const s = T(t, o);
2344
2423
  this.loadBundles(s);
2345
2424
  }
2346
2425
  }
2347
2426
  async processExternalEvent(e, t) {
2348
- const n = Gr(this.runtime.blue(), t);
2427
+ const n = jr(this.runtime.blue(), t);
2349
2428
  await this.processPreparedExternalEvent(e, n);
2350
2429
  }
2351
2430
  async processPreparedExternalEvent(e, t) {
2352
- const n = k(e);
2431
+ const n = b(e);
2353
2432
  if (this.hooks.isScopeInactive(n))
2354
2433
  return;
2355
2434
  this.runtime.gasMeter().chargeScopeEntry(n);
@@ -2364,7 +2443,7 @@ class Yr {
2364
2443
  for (const s of o) {
2365
2444
  if (this.hooks.isScopeInactive(n))
2366
2445
  break;
2367
- ye(s.blueId()) || await this.channelRunner.runExternalChannel(
2446
+ this.isProcessorManagedChannel(s) || await this.channelRunner.runExternalChannel(
2368
2447
  n,
2369
2448
  r,
2370
2449
  s,
@@ -2410,8 +2489,9 @@ class Yr {
2410
2489
  const a = this.bundles.get(s);
2411
2490
  if (!a || this.hooks.isScopeInactive(s))
2412
2491
  continue;
2413
- const c = this.createDocumentUpdateEvent(o, s), u = a.channelsOfType(
2414
- qr
2492
+ const c = this.createDocumentUpdateEvent(o, s), u = this.channelsMatching(
2493
+ a,
2494
+ Jr
2415
2495
  );
2416
2496
  for (const h of u) {
2417
2497
  const d = h.contract();
@@ -2435,7 +2515,7 @@ class Yr {
2435
2515
  await this.hooks.enterFatalTermination(e, t, s);
2436
2516
  return;
2437
2517
  }
2438
- if (o instanceof $ || o instanceof Error && !(o instanceof y)) {
2518
+ if (o instanceof U || o instanceof Error && !(o instanceof y)) {
2439
2519
  const s = this.hooks.fatalReason(o, "Runtime fatal");
2440
2520
  await this.hooks.enterFatalTermination(e, t, s);
2441
2521
  return;
@@ -2447,8 +2527,9 @@ class Yr {
2447
2527
  async deliverLifecycle(e, t, n, r) {
2448
2528
  if (this.runtime.gasMeter().chargeLifecycleDelivery(), await this.hooks.recordLifecycleForBridging(e, n), !t)
2449
2529
  return;
2450
- const o = t.channelsOfType(
2451
- Qr
2530
+ const o = this.channelsMatching(
2531
+ t,
2532
+ Zr
2452
2533
  );
2453
2534
  for (const s of o)
2454
2535
  if (await this.channelRunner.runHandlers(
@@ -2462,14 +2543,14 @@ class Yr {
2462
2543
  r && await this.finalizeScope(e, t);
2463
2544
  }
2464
2545
  async processEmbeddedChildren(e, t) {
2465
- const n = k(e), r = /* @__PURE__ */ new Set();
2546
+ const n = b(e), r = /* @__PURE__ */ new Set();
2466
2547
  let o = this.refreshBundle(n);
2467
2548
  for (; o; ) {
2468
2549
  const s = this.nextEmbeddedPath(o, r);
2469
2550
  if (!s)
2470
2551
  return o;
2471
2552
  r.add(s);
2472
- const a = I(n, s);
2553
+ const a = T(n, s);
2473
2554
  if (a === n || this.hooks.isScopeInactive(a)) {
2474
2555
  o = this.refreshBundle(n);
2475
2556
  continue;
@@ -2479,7 +2560,7 @@ class Yr {
2479
2560
  return null;
2480
2561
  }
2481
2562
  refreshBundle(e) {
2482
- const t = k(e), n = this.nodeAt(t);
2563
+ const t = b(e), n = this.nodeAt(t);
2483
2564
  if (!n)
2484
2565
  return this.bundles.delete(t), null;
2485
2566
  const r = this.loadBundle(n, t);
@@ -2510,7 +2591,7 @@ class Yr {
2510
2591
  }
2511
2592
  }
2512
2593
  async addInitializationMarker(e, t) {
2513
- const n = new p().setType(new p().setBlueId(ze)).addProperty("documentId", new p().setValue(t)), r = e.resolvePointer(de);
2594
+ const n = new p().setType(new p().setBlueId(ze)).addProperty("documentId", new p().setValue(t)), r = e.resolvePointer(pe);
2514
2595
  await e.applyPatch({
2515
2596
  op: "ADD",
2516
2597
  path: r,
@@ -2523,18 +2604,19 @@ class Yr {
2523
2604
  async bridgeEmbeddedEmissions(e, t) {
2524
2605
  if (this.hooks.isScopeInactive(e) || t.embeddedPaths().length === 0)
2525
2606
  return;
2526
- const n = t.channelsOfType(
2527
- jr
2607
+ const n = this.channelsMatching(
2608
+ t,
2609
+ Qr
2528
2610
  );
2529
2611
  if (n.length !== 0)
2530
2612
  for (const r of t.embeddedPaths()) {
2531
- const o = I(e, r), a = this.runtime.scope(o).drainBridgeableEvents();
2613
+ const o = T(e, r), a = this.runtime.scope(o).drainBridgeableEvents();
2532
2614
  if (a.length !== 0)
2533
2615
  for (const c of a) {
2534
2616
  let u = !1;
2535
2617
  for (const h of n) {
2536
2618
  const v = h.contract().childPath ?? "/";
2537
- I(e, v) === o && (u || (this.runtime.gasMeter().chargeBridge(), u = !0), await this.channelRunner.runHandlers(
2619
+ T(e, v) === o && (u || (this.runtime.gasMeter().chargeBridge(), u = !0), await this.channelRunner.runHandlers(
2538
2620
  e,
2539
2621
  t,
2540
2622
  h.key(),
@@ -2548,8 +2630,9 @@ class Yr {
2548
2630
  async drainTriggeredQueue(e, t) {
2549
2631
  if (this.hooks.isScopeInactive(e))
2550
2632
  return;
2551
- const n = this.runtime.scope(e), r = t.channelsOfType(
2552
- Jr
2633
+ const n = this.runtime.scope(e), r = this.channelsMatching(
2634
+ t,
2635
+ Xr
2553
2636
  );
2554
2637
  if (r.length === 0) {
2555
2638
  n.clearTriggered();
@@ -2578,8 +2661,24 @@ class Yr {
2578
2661
  }
2579
2662
  }
2580
2663
  }
2664
+ channelsMatching(e, ...t) {
2665
+ if (t.length === 0)
2666
+ return e.channelsOfType();
2667
+ const n = this.runtime.blue();
2668
+ return e.channelsOfType().filter((r) => {
2669
+ const o = r.node();
2670
+ return t.some((s) => n.isTypeOfBlueId(o, s));
2671
+ });
2672
+ }
2673
+ isProcessorManagedChannel(e) {
2674
+ const t = this.runtime.blue(), n = e.node();
2675
+ for (const r of Ce)
2676
+ if (t.isTypeOfBlueId(n, r))
2677
+ return !0;
2678
+ return !1;
2679
+ }
2581
2680
  validatePatchBoundary(e, t, n) {
2582
- const r = k(e), o = P(n.path);
2681
+ const r = b(e), o = P(n.path);
2583
2682
  if (o === r)
2584
2683
  throw new F(
2585
2684
  `Self-root mutation is forbidden at scope ${r}`
@@ -2589,7 +2688,7 @@ class Yr {
2589
2688
  `Patch path ${o} is outside scope ${r}`
2590
2689
  );
2591
2690
  for (const s of t.embeddedPaths()) {
2592
- const a = I(r, s);
2691
+ const a = T(r, s);
2593
2692
  if (o.startsWith(`${a}/`))
2594
2693
  throw new F(
2595
2694
  `Boundary violation: patch ${o} enters embedded scope ${a}`
@@ -2599,11 +2698,11 @@ class Yr {
2599
2698
  enforceReservedKeyWriteProtection(e, t, n) {
2600
2699
  if (n)
2601
2700
  return;
2602
- const r = k(e), o = P(t.path);
2603
- for (const s of Ee) {
2604
- const a = I(
2701
+ const r = b(e), o = P(t.path);
2702
+ for (const s of ye) {
2703
+ const a = T(
2605
2704
  r,
2606
- re(s)
2705
+ ie(s)
2607
2706
  );
2608
2707
  if (o === a || o.startsWith(`${a}/`))
2609
2708
  throw new F(
@@ -2616,88 +2715,88 @@ class Yr {
2616
2715
  return;
2617
2716
  const r = P(n.path);
2618
2717
  for (const o of t.embeddedPaths()) {
2619
- const s = I(e, o);
2718
+ const s = T(e, o);
2620
2719
  r === s && (n.op === "remove" || n.op === "replace") && await this.hooks.markCutOff(s);
2621
2720
  }
2622
2721
  }
2623
2722
  hasInitializationMarker(e) {
2624
- const t = I(e, de), n = this.nodeAt(t);
2723
+ const t = T(e, pe), n = this.nodeAt(t);
2625
2724
  if (!n)
2626
2725
  return !1;
2627
2726
  if (!(n instanceof p)) {
2628
2727
  const o = `Reserved key 'initialized' must contain a Processing Initialized Marker at ${t}`;
2629
- throw new $(o);
2728
+ throw new U(o);
2630
2729
  }
2631
2730
  if (n.getType()?.getBlueId() !== ze) {
2632
2731
  const o = `Reserved key 'initialized' must contain a Processing Initialized Marker at ${t}`;
2633
- throw new $(o);
2732
+ throw new U(o);
2634
2733
  }
2635
2734
  return !0;
2636
2735
  }
2637
2736
  createLifecycleEvent(e) {
2638
- return new p().setType(new p().setBlueId(Xr)).setProperties({
2737
+ return new p().setType(new p().setBlueId(Yr)).setProperties({
2639
2738
  type: new p().setValue("Core/Document Processing Initiated"),
2640
2739
  documentId: new p().setValue(e)
2641
2740
  });
2642
2741
  }
2643
2742
  }
2644
- class te extends Error {
2743
+ class ne extends Error {
2645
2744
  constructor(e) {
2646
2745
  super(
2647
2746
  e ? "Processing terminated due to fatal error" : "Processing terminated"
2648
2747
  ), this.fatal = e, this.name = "RunTerminationError";
2649
2748
  }
2650
2749
  }
2651
- const Zr = m["Core/Processing Terminated Marker"], ei = m["Core/Document Processing Terminated"];
2652
- class ti {
2750
+ const ti = m["Core/Processing Terminated Marker"], ni = m["Core/Document Processing Terminated"];
2751
+ class ri {
2653
2752
  constructor(e) {
2654
2753
  this.runtime = e;
2655
2754
  }
2656
2755
  async terminateScope(e, t, n, r, o) {
2657
2756
  e.recordPendingTermination(t, r, o ?? null);
2658
- const s = e.normalizeScope(t), a = I(s, Je);
2757
+ const s = e.normalizeScope(t), a = T(s, Je);
2659
2758
  this.runtime.directWrite(
2660
2759
  a,
2661
- ni(this.runtime.blue(), r, o)
2760
+ ii(this.runtime.blue(), r, o)
2662
2761
  ), this.runtime.gasMeter().chargeTerminationMarker();
2663
- const c = n ?? e.bundleForScope(s) ?? null, u = ri(r, o);
2762
+ const c = n ?? e.bundleForScope(s) ?? null, u = oi(r, o);
2664
2763
  if (await e.deliverLifecycle(
2665
2764
  s,
2666
2765
  c,
2667
2766
  u,
2668
2767
  !1
2669
2768
  ), this.runtime.scope(s).finalizeTermination(r, o ?? null), e.clearPendingTermination(t), r === "FATAL" && this.runtime.gasMeter().chargeFatalTerminationOverhead(), r === "FATAL" && s === "/")
2670
- throw this.runtime.markRunTerminated(), new te(!0);
2769
+ throw this.runtime.markRunTerminated(), new ne(!0);
2671
2770
  if (r === "GRACEFUL" && s === "/")
2672
- throw this.runtime.markRunTerminated(), new te(!1);
2771
+ throw this.runtime.markRunTerminated(), new ne(!1);
2673
2772
  }
2674
2773
  }
2675
- function ni(i, e, t) {
2676
- return ii(i, {
2677
- type: { blueId: Zr },
2774
+ function ii(i, e, t) {
2775
+ return si(i, {
2776
+ type: { blueId: ti },
2678
2777
  cause: e === "GRACEFUL" ? "graceful" : "fatal",
2679
2778
  ...t ? { reason: t } : {}
2680
2779
  });
2681
2780
  }
2682
- function ri(i, e) {
2781
+ function oi(i, e) {
2683
2782
  const t = new p().setType(
2684
- new p().setBlueId(ei)
2783
+ new p().setBlueId(ni)
2685
2784
  );
2686
2785
  return t.addProperty(
2687
2786
  "cause",
2688
2787
  new p().setValue(i === "GRACEFUL" ? "graceful" : "fatal")
2689
2788
  ), e && t.addProperty("reason", new p().setValue(e)), t;
2690
2789
  }
2691
- function ii(i, e) {
2790
+ function si(i, e) {
2692
2791
  return i.jsonValueToNode(e);
2693
2792
  }
2694
2793
  const j = "-";
2695
- class oi {
2794
+ class ai {
2696
2795
  constructor(e) {
2697
2796
  this.document = e;
2698
2797
  }
2699
2798
  applyPatch(e, t) {
2700
- const n = k(e), r = P(t.path), o = He(r), s = Ve(this.document, o, "before", r);
2799
+ const n = b(e), r = P(t.path), o = Ve(r), s = He(this.document, o, "before", r);
2701
2800
  switch (t.op) {
2702
2801
  case "ADD":
2703
2802
  this.applyAdd(o, r, t.val ?? null);
@@ -2709,34 +2808,34 @@ class oi {
2709
2808
  this.applyRemove(o, r);
2710
2809
  break;
2711
2810
  }
2712
- const a = t.op === "REMOVE" ? null : Ve(this.document, o, "after", r);
2811
+ const a = t.op === "REMOVE" ? null : He(this.document, o, "after", r);
2713
2812
  return {
2714
2813
  path: r,
2715
2814
  before: s,
2716
2815
  after: a,
2717
2816
  op: t.op.toLowerCase(),
2718
2817
  originScope: n,
2719
- cascadeScopes: si(n)
2818
+ cascadeScopes: ci(n)
2720
2819
  };
2721
2820
  }
2722
2821
  directWrite(e, t) {
2723
2822
  const n = P(e);
2724
2823
  if (n === "/")
2725
2824
  throw new Error("Direct write cannot target root document");
2726
- const r = He(n), { parent: o, leaf: s } = this.resolveParent(r);
2825
+ const r = Ve(n), { parent: o, leaf: s } = this.resolveParent(r);
2727
2826
  if (s === j)
2728
2827
  throw new Error(
2729
2828
  `Direct write does not support append token '-' for path ${n}`
2730
2829
  );
2731
2830
  const a = o.getItems();
2732
- if (a && U(s)) {
2831
+ if (a && $(s)) {
2733
2832
  this.directWriteArray(o, a, s, t, n);
2734
2833
  return;
2735
2834
  }
2736
2835
  this.directWriteObject(o, s, t);
2737
2836
  }
2738
2837
  directWriteArray(e, t, n, r, o) {
2739
- const s = ue(e, t), a = B(n, o);
2838
+ const s = he(e, t), a = x(n, o);
2740
2839
  if (r == null) {
2741
2840
  if (a < 0 || a >= s.length)
2742
2841
  return;
@@ -2782,8 +2881,8 @@ class oi {
2782
2881
  `Append token '-' must be final segment: ${G(n, r)}`
2783
2882
  );
2784
2883
  const o = e.getItems();
2785
- if (o && U(t)) {
2786
- const c = B(t, G(n, r));
2884
+ if (o && $(t)) {
2885
+ const c = x(t, G(n, r));
2787
2886
  if (c < 0 || c >= o.length)
2788
2887
  throw new Error(
2789
2888
  `Array index out of bounds: ${G(n, r)}`
@@ -2808,20 +2907,20 @@ class oi {
2808
2907
  "ADD"
2809
2908
  );
2810
2909
  try {
2811
- if (U(o)) {
2910
+ if ($(o)) {
2812
2911
  const u = r.getItems(), h = o === j;
2813
2912
  if (!u)
2814
2913
  throw new Error(
2815
2914
  h ? `Append token '-' requires array at ${s}` : `Array index segment requires array at ${s}`
2816
2915
  );
2817
2916
  if (h) {
2818
- ue(r, u).push(q(n));
2917
+ he(r, u).push(q(n));
2819
2918
  return;
2820
2919
  }
2821
- const d = B(o, t);
2920
+ const d = x(o, t);
2822
2921
  if (d < 0 || d > u.length)
2823
2922
  throw new Error(`Array index out of bounds in path: ${t}`);
2824
- ue(r, u).splice(d, 0, q(n));
2923
+ he(r, u).splice(d, 0, q(n));
2825
2924
  return;
2826
2925
  }
2827
2926
  const c = X(r);
@@ -2839,11 +2938,11 @@ class oi {
2839
2938
  "REPLACE"
2840
2939
  );
2841
2940
  try {
2842
- if (U(o)) {
2941
+ if ($(o)) {
2843
2942
  const c = r.getItems();
2844
2943
  if (!c)
2845
2944
  throw new Error(`Array index segment requires array at ${t}`);
2846
- const u = B(o, t);
2945
+ const u = x(o, t);
2847
2946
  if (u < 0 || u >= c.length)
2848
2947
  throw new Error(`Array index out of bounds in path: ${t}`);
2849
2948
  c[u] = q(n), r.setItems(c);
@@ -2863,11 +2962,11 @@ class oi {
2863
2962
  t,
2864
2963
  "REMOVE"
2865
2964
  );
2866
- if (U(r)) {
2965
+ if ($(r)) {
2867
2966
  const a = n.getItems();
2868
2967
  if (!a)
2869
2968
  throw new Error(`Array index segment requires array at ${t}`);
2870
- const c = B(r, t);
2969
+ const c = x(r, t);
2871
2970
  if (c < 0 || c >= a.length)
2872
2971
  throw new Error(`Array index out of bounds in path: ${t}`);
2873
2972
  a.splice(c, 1), n.setItems(a);
@@ -2886,11 +2985,11 @@ class oi {
2886
2985
  const o = [];
2887
2986
  for (let a = 0; a < e.length - 1; a += 1) {
2888
2987
  const c = e[a], u = G(e, a + 1);
2889
- if (U(c)) {
2988
+ if ($(c)) {
2890
2989
  const v = r.getItems();
2891
2990
  if (!v)
2892
2991
  throw new Error(`Array index segment requires array at ${u}`);
2893
- const f = B(c, u);
2992
+ const f = x(c, u);
2894
2993
  if (f < 0 || f >= v.length)
2895
2994
  throw new Error(`Array index out of bounds in path: ${u}`);
2896
2995
  const E = v[f];
@@ -2917,7 +3016,7 @@ class oi {
2917
3016
  }
2918
3017
  }
2919
3018
  }
2920
- function si(i) {
3019
+ function ci(i) {
2921
3020
  const e = [];
2922
3021
  let t = i;
2923
3022
  for (; e.push(t), t !== "/"; ) {
@@ -2926,26 +3025,26 @@ function si(i) {
2926
3025
  }
2927
3026
  return e;
2928
3027
  }
2929
- function Ve(i, e, t, n) {
3028
+ function He(i, e, t, n) {
2930
3029
  try {
2931
3030
  if (e.length === 0)
2932
3031
  return i.clone();
2933
- const r = ai(i, e, t, n);
3032
+ const r = li(i, e, t, n);
2934
3033
  return r ? r.clone() : null;
2935
3034
  } catch {
2936
3035
  return null;
2937
3036
  }
2938
3037
  }
2939
- function ai(i, e, t, n) {
3038
+ function li(i, e, t, n) {
2940
3039
  let r = i;
2941
3040
  for (let o = 0; o < e.length; o += 1) {
2942
3041
  const s = e[o] ?? "", a = o === e.length - 1;
2943
- if (r = ci(r, s, a, t, n), !r)
3042
+ if (r = ui(r, s, a, t, n), !r)
2944
3043
  return null;
2945
3044
  }
2946
3045
  return r;
2947
3046
  }
2948
- function ci(i, e, t, n, r) {
3047
+ function ui(i, e, t, n, r) {
2949
3048
  if (!i)
2950
3049
  return null;
2951
3050
  const o = i.getItems();
@@ -2955,7 +3054,7 @@ function ci(i, e, t, n, r) {
2955
3054
  throw new Error(`Append token '-' must be final segment: ${r}`);
2956
3055
  return n === "before" || o.length === 0 ? null : o[o.length - 1] ?? null;
2957
3056
  }
2958
- const c = B(e, r);
3057
+ const c = x(e, r);
2959
3058
  return c < 0 || c >= o.length ? null : o[c] ?? null;
2960
3059
  }
2961
3060
  const s = i.getProperties();
@@ -2964,13 +3063,13 @@ function ci(i, e, t, n, r) {
2964
3063
  const a = s[e];
2965
3064
  return a instanceof p ? a : null;
2966
3065
  }
2967
- function He(i) {
3066
+ function Ve(i) {
2968
3067
  if (i === "/" || i === "")
2969
3068
  return [];
2970
3069
  const e = i.startsWith("/") ? i.slice(1) : i;
2971
3070
  return e.length === 0 ? [] : e.split("/");
2972
3071
  }
2973
- function B(i, e) {
3072
+ function x(i, e) {
2974
3073
  const t = Number.parseInt(i, 10);
2975
3074
  if (Number.isNaN(t))
2976
3075
  throw new Error(`Expected numeric array index in path: ${e}`);
@@ -2987,7 +3086,7 @@ function G(i, e) {
2987
3086
  n += `/${i[r] ?? ""}`;
2988
3087
  return n === "" ? "/" : n;
2989
3088
  }
2990
- function ue(i, e) {
3089
+ function he(i, e) {
2991
3090
  const t = [...e];
2992
3091
  return i.setItems(t), t;
2993
3092
  }
@@ -3000,13 +3099,13 @@ function X(i) {
3000
3099
  const t = { ...e };
3001
3100
  return i.setProperties(t), t;
3002
3101
  }
3003
- function U(i) {
3102
+ function $(i) {
3004
3103
  return i === j || /^\d+$/.test(i);
3005
3104
  }
3006
3105
  function q(i) {
3007
3106
  return i == null ? new p().setValue(null) : i.clone();
3008
3107
  }
3009
- class li {
3108
+ class hi {
3010
3109
  constructor(e) {
3011
3110
  this.path = e;
3012
3111
  }
@@ -3068,7 +3167,7 @@ class li {
3068
3167
  return this.cutOff;
3069
3168
  }
3070
3169
  }
3071
- class ui {
3170
+ class di {
3072
3171
  scopesMap = /* @__PURE__ */ new Map();
3073
3172
  rootEmissionList = [];
3074
3173
  scopes() {
@@ -3076,7 +3175,7 @@ class ui {
3076
3175
  }
3077
3176
  scope(e) {
3078
3177
  let t = this.scopesMap.get(e);
3079
- return t || (t = new li(e), this.scopesMap.set(e, t)), t;
3178
+ return t || (t = new hi(e), this.scopesMap.set(e, t)), t;
3080
3179
  }
3081
3180
  existingScope(e) {
3082
3181
  return this.scopesMap.get(e);
@@ -3097,30 +3196,30 @@ class ui {
3097
3196
  function Ct(i) {
3098
3197
  return Math.floor((i + 99) / 100);
3099
3198
  }
3100
- function hi(i) {
3199
+ function pi(i) {
3101
3200
  const e = P(i);
3102
3201
  return e === "/" ? 0 : e.split("/").length - 1;
3103
3202
  }
3104
- function di(i) {
3203
+ function fi(i) {
3105
3204
  return 40 + 5 * Math.max(0, i);
3106
3205
  }
3107
- function pi(i, e) {
3108
- return 8 + hi(i) + Ct(e);
3206
+ function mi(i, e) {
3207
+ return 8 + pi(i) + Ct(e);
3109
3208
  }
3110
- const fi = 1e3, mi = 5, gi = 50, Ei = 2, yi = 10, Ci = 10, Si = 10, vi = 20, wi = 20, ki = 30, bi = 30, Ti = 100;
3111
- function Ii(i) {
3209
+ const gi = 1e3, Ei = 5, yi = 50, Ci = 2, Si = 10, vi = 10, wi = 10, bi = 20, ki = 20, Ii = 30, Ti = 30, Pi = 100;
3210
+ function Mi(i) {
3112
3211
  return 50 + 10 * i;
3113
3212
  }
3114
- function Pi(i) {
3213
+ function Ri(i) {
3115
3214
  return 20 + i;
3116
3215
  }
3117
- function Ri(i) {
3216
+ function Ni(i) {
3118
3217
  return 10 * i;
3119
3218
  }
3120
- function Mi(i) {
3219
+ function Oi(i) {
3121
3220
  return 20 + i;
3122
3221
  }
3123
- class Ni {
3222
+ class Ai {
3124
3223
  constructor(e) {
3125
3224
  this.blue = e;
3126
3225
  }
@@ -3132,59 +3231,59 @@ class Ni {
3132
3231
  this.total += e;
3133
3232
  }
3134
3233
  chargeScopeEntry(e) {
3135
- this.add(Ii(this.scopeDepth(e)));
3234
+ this.add(Mi(this.scopeDepth(e)));
3136
3235
  }
3137
3236
  chargeInitialization() {
3138
- this.add(fi);
3237
+ this.add(gi);
3139
3238
  }
3140
3239
  chargeChannelMatchAttempt() {
3141
- this.add(mi);
3240
+ this.add(Ei);
3142
3241
  }
3143
3242
  chargeHandlerOverhead() {
3144
- this.add(gi);
3243
+ this.add(yi);
3145
3244
  }
3146
3245
  chargeBoundaryCheck() {
3147
- this.add(Ei);
3246
+ this.add(Ci);
3148
3247
  }
3149
3248
  chargePatchAddOrReplace(e) {
3150
- this.add(Pi(this.payloadSizeCharge(e)));
3249
+ this.add(Ri(this.payloadSizeCharge(e)));
3151
3250
  }
3152
3251
  chargePatchRemove() {
3153
- this.add(yi);
3252
+ this.add(Si);
3154
3253
  }
3155
3254
  chargeCascadeRouting(e) {
3156
- e > 0 && this.add(Ri(e));
3255
+ e > 0 && this.add(Ni(e));
3157
3256
  }
3158
3257
  chargeEmitEvent(e) {
3159
- this.add(Mi(this.payloadSizeCharge(e)));
3258
+ this.add(Oi(this.payloadSizeCharge(e)));
3160
3259
  }
3161
3260
  chargeBridge() {
3162
- this.add(Ci);
3261
+ this.add(vi);
3163
3262
  }
3164
3263
  chargeDrainEvent() {
3165
- this.add(Si);
3264
+ this.add(wi);
3166
3265
  }
3167
3266
  chargeCheckpointUpdate() {
3168
- this.add(vi);
3267
+ this.add(bi);
3169
3268
  }
3170
3269
  chargeTerminationMarker() {
3171
- this.add(wi);
3270
+ this.add(ki);
3172
3271
  }
3173
3272
  chargeLifecycleDelivery() {
3174
- this.add(ki);
3273
+ this.add(Ii);
3175
3274
  }
3176
3275
  chargeFatalTerminationOverhead() {
3177
- this.add(Ti);
3276
+ this.add(Pi);
3178
3277
  }
3179
3278
  chargeTriggerEventBase() {
3180
- this.add(bi);
3279
+ this.add(Ti);
3181
3280
  }
3182
3281
  chargeUpdateDocumentBase(e) {
3183
- this.add(di(e));
3282
+ this.add(fi(e));
3184
3283
  }
3185
3284
  chargeDocumentSnapshot(e, t) {
3186
- const n = t ? Me(this.blue, t) : 0;
3187
- this.add(pi(e, n));
3285
+ const n = t ? Ne(this.blue, t) : 0;
3286
+ this.add(mi(e, n));
3188
3287
  }
3189
3288
  chargeWasmGas(e) {
3190
3289
  const t = Jt(e);
@@ -3193,11 +3292,11 @@ class Ni {
3193
3292
  payloadSizeCharge(e) {
3194
3293
  if (!e)
3195
3294
  return 0;
3196
- const t = Me(this.blue, e);
3295
+ const t = Ne(this.blue, e);
3197
3296
  return Ct(t);
3198
3297
  }
3199
3298
  scopeDepth(e) {
3200
- const t = k(e);
3299
+ const t = b(e);
3201
3300
  if (t === "/" || t.length <= 1)
3202
3301
  return 0;
3203
3302
  let n = 1;
@@ -3206,12 +3305,12 @@ class Ni {
3206
3305
  return n;
3207
3306
  }
3208
3307
  }
3209
- class Oi {
3308
+ class Di {
3210
3309
  constructor(e, t) {
3211
- this.documentRef = e, this.blueRef = t, this.patchEngine = new oi(this.documentRef), this.meter = new Ni(this.blueRef);
3310
+ this.documentRef = e, this.blueRef = t, this.patchEngine = new ai(this.documentRef), this.meter = new Ai(this.blueRef);
3212
3311
  }
3213
3312
  patchEngine;
3214
- emissionRegistry = new ui();
3313
+ emissionRegistry = new di();
3215
3314
  meter;
3216
3315
  runTerminated = !1;
3217
3316
  document() {
@@ -3260,15 +3359,15 @@ class Oi {
3260
3359
  return this.patchEngine.applyPatch(e, t);
3261
3360
  }
3262
3361
  }
3263
- const Ai = m["Core/Processing Initialized Marker"], Di = m["Core/Document Update"];
3264
- class Bi {
3362
+ const Bi = m["Core/Processing Initialized Marker"], xi = m["Core/Document Update"];
3363
+ class _i {
3265
3364
  constructor(e, t, n, r) {
3266
- this.contractLoader = e, this.registry = t, this.runtimeRef = new Oi(r, n);
3365
+ this.contractLoader = e, this.registry = t, this.runtimeRef = new Di(r, n);
3267
3366
  const o = (s) => nt(this.runtimeRef.blue(), s);
3268
- this.checkpointManager = new Kr(
3367
+ this.checkpointManager = new Gr(
3269
3368
  this.runtimeRef,
3270
3369
  o
3271
- ), this.terminationService = new ti(this.runtimeRef), this.channelRunner = new Wr(
3370
+ ), this.terminationService = new ri(this.runtimeRef), this.channelRunner = new qr(
3272
3371
  this.runtimeRef,
3273
3372
  this.checkpointManager,
3274
3373
  {
@@ -3282,7 +3381,7 @@ class Bi {
3282
3381
  !1
3283
3382
  ),
3284
3383
  shouldRunHandler: async (s, a) => {
3285
- const c = this.registry.lookupHandler(s.blueId());
3384
+ const c = this.lookupHandlerProcessor(s);
3286
3385
  if (!c) {
3287
3386
  const h = `No processor registered for handler contract ${s.blueId()}`;
3288
3387
  throw new y(
@@ -3296,9 +3395,9 @@ class Bi {
3296
3395
  executeHandler: async (s, a) => this.executeHandler(s, a),
3297
3396
  handleHandlerError: async (s, a, c) => this.handleHandlerError(s, a, c),
3298
3397
  canonicalSignature: o,
3299
- channelProcessorFor: (s) => this.registry.lookupChannel(s) ?? null
3398
+ channelProcessorFor: (s) => this.lookupChannelProcessor(s)
3300
3399
  }
3301
- ), this.scopeExecutor = new Yr({
3400
+ ), this.scopeExecutor = new ei({
3302
3401
  runtime: this.runtimeRef,
3303
3402
  contractLoader: this.contractLoader,
3304
3403
  channelRunner: this.channelRunner,
@@ -3349,7 +3448,7 @@ class Bi {
3349
3448
  );
3350
3449
  }
3351
3450
  createContext(e, t, n, r = !1, o = !1) {
3352
- return new xi(
3451
+ return new Li(
3353
3452
  this,
3354
3453
  t,
3355
3454
  e,
@@ -3370,10 +3469,10 @@ class Bi {
3370
3469
  return this.runtimeRef;
3371
3470
  }
3372
3471
  bundleForScope(e) {
3373
- return this.bundles.get(k(e));
3472
+ return this.bundles.get(b(e));
3374
3473
  }
3375
3474
  isScopeInactive(e) {
3376
- const t = k(e);
3475
+ const t = b(e);
3377
3476
  return this.cutOffScopes.has(t) || this.pendingTerminations.has(t) || this.runtimeRef.isScopeTerminated(t);
3378
3477
  }
3379
3478
  async enterGracefulTermination(e, t, n) {
@@ -3383,13 +3482,13 @@ class Bi {
3383
3482
  await this.terminate(e, t, "FATAL", n);
3384
3483
  }
3385
3484
  recordPendingTermination(e, t, n) {
3386
- this.pendingTerminations.set(k(e), { kind: t, reason: n });
3485
+ this.pendingTerminations.set(b(e), { kind: t, reason: n });
3387
3486
  }
3388
3487
  clearPendingTermination(e) {
3389
- this.pendingTerminations.delete(k(e));
3488
+ this.pendingTerminations.delete(b(e));
3390
3489
  }
3391
3490
  async markCutOff(e) {
3392
- const t = k(e);
3491
+ const t = b(e);
3393
3492
  this.cutOffScopes.add(t) && this.runtimeRef.existingScope(t)?.markCutOff();
3394
3493
  }
3395
3494
  async deliverLifecycle(e, t, n, r) {
@@ -3404,13 +3503,13 @@ class Bi {
3404
3503
  this.runtimeRef.scope(e).recordBridgeable(t.clone()), e === "/" && this.runtimeRef.recordRootEmission(t.clone());
3405
3504
  }
3406
3505
  normalizeScope(e) {
3407
- return k(e);
3506
+ return b(e);
3408
3507
  }
3409
3508
  resolvePointer(e, t) {
3410
- return I(e, t);
3509
+ return T(e, t);
3411
3510
  }
3412
3511
  async terminate(e, t, n, r) {
3413
- const o = k(e);
3512
+ const o = b(e);
3414
3513
  this.pendingTerminations.has(o) || this.runtimeRef.isScopeTerminated(o) || (this.pendingTerminations.set(o, { kind: n, reason: r }), await this.terminationService.terminateScope(
3415
3514
  this,
3416
3515
  e,
@@ -3420,13 +3519,13 @@ class Bi {
3420
3519
  ));
3421
3520
  }
3422
3521
  nodeAt(e) {
3423
- const t = k(e);
3424
- return ne.nodeAt(this.runtimeRef.document(), t, {
3522
+ const t = b(e);
3523
+ return re.nodeAt(this.runtimeRef.document(), t, {
3425
3524
  calculateBlueId: (n) => this.runtimeRef.blue().calculateBlueIdSync(n)
3426
3525
  });
3427
3526
  }
3428
3527
  async evaluateChannel(e, t, n, r) {
3429
- const o = this.registry.lookupChannel(e.blueId());
3528
+ const o = this.lookupChannelProcessor(e.node());
3430
3529
  if (!o)
3431
3530
  return { matches: !1 };
3432
3531
  const s = this.runtimeRef.blue().calculateBlueIdSync(r), a = r.clone(), c = e.contract(), u = c.event;
@@ -3439,7 +3538,7 @@ class Bi {
3439
3538
  markers: t.markers(),
3440
3539
  bindingKey: e.key(),
3441
3540
  resolveChannel: (C) => t.channelEntry(C),
3442
- channelProcessorFor: (C) => this.registry.lookupChannel(C) ?? null
3541
+ channelProcessorFor: (C) => this.lookupChannelProcessor(C)
3443
3542
  }, d = o.evaluate;
3444
3543
  if (typeof d == "function")
3445
3544
  return await d.call(o, c, h);
@@ -3453,7 +3552,7 @@ class Bi {
3453
3552
  };
3454
3553
  }
3455
3554
  async executeHandler(e, t) {
3456
- const n = this.registry.lookupHandler(e.blueId());
3555
+ const n = this.lookupHandlerProcessor(e);
3457
3556
  if (!n) {
3458
3557
  const r = `No processor registered for handler contract ${e.blueId()}`;
3459
3558
  throw new y(
@@ -3472,7 +3571,7 @@ class Bi {
3472
3571
  * the outer run logic can react according to spec (§22).
3473
3572
  */
3474
3573
  async handleHandlerError(e, t, n) {
3475
- if (n instanceof te || n instanceof z)
3574
+ if (n instanceof ne || n instanceof z)
3476
3575
  throw n;
3477
3576
  const r = this.fatalReason(n, "Runtime fatal");
3478
3577
  await this.enterFatalTermination(e, t, r);
@@ -3480,9 +3579,18 @@ class Bi {
3480
3579
  fatalReason(e, t) {
3481
3580
  return e instanceof Error && typeof e.message == "string" ? e.message : t;
3482
3581
  }
3582
+ lookupHandlerProcessor(e) {
3583
+ return this.registry.lookupHandlerForNode(
3584
+ this.runtimeRef.blue(),
3585
+ e.node()
3586
+ );
3587
+ }
3588
+ lookupChannelProcessor(e) {
3589
+ return this.registry.lookupChannelForNode(this.runtimeRef.blue(), e) ?? null;
3590
+ }
3483
3591
  createDocumentUpdateEvent(e, t) {
3484
3592
  const n = Ft(t, e.path), r = e.before != null ? e.before.clone() : new p().setValue(null), o = e.after != null ? e.after.clone() : new p().setValue(null), s = new p().setType(
3485
- new p().setBlueId(Di)
3593
+ new p().setBlueId(xi)
3486
3594
  );
3487
3595
  return s.setProperties({
3488
3596
  op: new p().setValue(e.op),
@@ -3494,17 +3602,17 @@ class Bi {
3494
3602
  matchesDocumentUpdate(e, t, n) {
3495
3603
  if (!t || t.length === 0)
3496
3604
  return !1;
3497
- const r = P(I(e, t)), o = P(n);
3605
+ const r = P(T(e, t)), o = P(n);
3498
3606
  return r === "/" || o === r ? !0 : o.startsWith(`${r}/`);
3499
3607
  }
3500
3608
  }
3501
- class ne {
3609
+ class re {
3502
3610
  constructor(e, t, n) {
3503
3611
  this.contractLoader = e, this.registry = t, this.blue = n;
3504
3612
  }
3505
3613
  async initializeDocument(e) {
3506
3614
  if (this.isInitialized(e))
3507
- throw new $("Document already initialized");
3615
+ throw new U("Document already initialized");
3508
3616
  const t = this.createExecution(e.clone());
3509
3617
  return this.run(e, t, async () => {
3510
3618
  await t.initializeScope("/", !0);
@@ -3512,7 +3620,7 @@ class ne {
3512
3620
  }
3513
3621
  async processDocument(e, t) {
3514
3622
  if (!this.isInitialized(e))
3515
- throw new $("Document not initialized");
3623
+ throw new U("Document not initialized");
3516
3624
  const n = this.createExecution(e.clone()), r = t.clone();
3517
3625
  return this.run(e, n, async () => {
3518
3626
  n.loadBundles("/"), await n.processExternalEvent("/", r);
@@ -3522,7 +3630,7 @@ class ne {
3522
3630
  return this.initializationMarker(e) != null;
3523
3631
  }
3524
3632
  createExecution(e) {
3525
- return new Bi(
3633
+ return new _i(
3526
3634
  this.contractLoader,
3527
3635
  this.registry,
3528
3636
  this.blue,
@@ -3533,7 +3641,7 @@ class ne {
3533
3641
  try {
3534
3642
  await n();
3535
3643
  } catch (r) {
3536
- if (r instanceof te)
3644
+ if (r instanceof ne)
3537
3645
  return t.result();
3538
3646
  if (r instanceof z) {
3539
3647
  const o = e.clone();
@@ -3557,7 +3665,7 @@ class ne {
3557
3665
  "Initialization Marker must be a BlueNode"
3558
3666
  )
3559
3667
  );
3560
- if (n.getType()?.getBlueId() !== Ai)
3668
+ if (n.getType()?.getBlueId() !== Bi)
3561
3669
  throw new y(
3562
3670
  "Initialization Marker must declare type 'Processing Initialized Marker'",
3563
3671
  S.illegalState(
@@ -3631,7 +3739,7 @@ class ne {
3631
3739
  }
3632
3740
  }
3633
3741
  }
3634
- class xi {
3742
+ class Li {
3635
3743
  constructor(e, t, n, r, o, s) {
3636
3744
  this.execution = e, this.bundle = t, this.scopePathValue = n, this.eventNode = r, this.allowTerminatedWork = o, this.allowReservedMutation = s;
3637
3745
  }
@@ -3686,7 +3794,7 @@ class xi {
3686
3794
  if (!e)
3687
3795
  return !1;
3688
3796
  try {
3689
- return ne.nodeAt(
3797
+ return re.nodeAt(
3690
3798
  this.execution.runtime().document(),
3691
3799
  e,
3692
3800
  {
@@ -3698,7 +3806,7 @@ class xi {
3698
3806
  }
3699
3807
  }
3700
3808
  documentNodeAt(e) {
3701
- const t = ne.nodeAt(
3809
+ const t = re.nodeAt(
3702
3810
  this.execution.runtime().document(),
3703
3811
  e,
3704
3812
  {
@@ -3725,16 +3833,16 @@ class xi {
3725
3833
  return !this.allowTerminatedWork && this.execution.isScopeInactive(this.scopePathValue);
3726
3834
  }
3727
3835
  }
3728
- const _i = new Rt({
3729
- repositories: [Mt]
3836
+ const Fi = new Mt({
3837
+ repositories: [Rt]
3730
3838
  });
3731
- class Li {
3839
+ class $i {
3732
3840
  blue;
3733
3841
  registryRef;
3734
3842
  contractLoaderRef;
3735
3843
  engine;
3736
3844
  constructor(e) {
3737
- this.registryRef = e?.registry ?? se.create().registerDefaults().build(), this.blue = e?.blue ?? _i, this.contractLoaderRef = new Ur(this.registryRef, this.blue), this.engine = new ne(
3845
+ this.registryRef = e?.registry ?? ae.create().registerDefaults().build(), this.blue = e?.blue ?? Fi, this.contractLoaderRef = new zr(this.registryRef, this.blue), this.engine = new re(
3738
3846
  this.contractLoaderRef,
3739
3847
  this.registryRef,
3740
3848
  this.blue
@@ -3767,14 +3875,14 @@ class Li {
3767
3875
  return this.contractLoaderRef;
3768
3876
  }
3769
3877
  static builder() {
3770
- return new Fi();
3878
+ return new Ui();
3771
3879
  }
3772
3880
  }
3773
- class Fi {
3881
+ class Ui {
3774
3882
  contractRegistry;
3775
3883
  blueInstance;
3776
3884
  constructor() {
3777
- this.contractRegistry = se.create().registerDefaults().build();
3885
+ this.contractRegistry = ae.create().registerDefaults().build();
3778
3886
  }
3779
3887
  withRegistry(e) {
3780
3888
  return this.contractRegistry = e, this;
@@ -3786,7 +3894,7 @@ class Fi {
3786
3894
  return this.blueInstance = e, this;
3787
3895
  }
3788
3896
  build() {
3789
- return new Li({
3897
+ return new $i({
3790
3898
  registry: this.contractRegistry,
3791
3899
  blue: this.blueInstance
3792
3900
  });
@@ -3795,7 +3903,7 @@ class Fi {
3795
3903
  class St {
3796
3904
  process(e, t) {
3797
3905
  const n = t.getValue();
3798
- if (Z(n)) {
3906
+ if (ee(n)) {
3799
3907
  const r = t.clone();
3800
3908
  return r.setValue(n), r.setProperties(void 0), r.setItems(void 0), r.setType(void 0), r;
3801
3909
  }
@@ -3806,79 +3914,80 @@ class St {
3806
3914
  */
3807
3915
  postProcess(e, t) {
3808
3916
  const n = t.getValue();
3809
- if (Z(n) && e.getValue() !== n && n !== void 0) {
3917
+ if (ee(n) && e.getValue() !== n && n !== void 0) {
3810
3918
  const r = e.clone();
3811
3919
  return r.setValue(n), r;
3812
3920
  }
3813
3921
  return e;
3814
3922
  }
3815
3923
  }
3816
- const ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3924
+ const lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3817
3925
  __proto__: null,
3818
3926
  ExpressionPreserver: St
3819
3927
  }, Symbol.toStringTag, { value: "Module" }));
3820
- function co() {
3821
- return new L.SequentialMergingProcessor([
3822
- new L.ValuePropagator(),
3928
+ function uo() {
3929
+ return new B.SequentialMergingProcessor([
3930
+ new B.ValuePropagator(),
3823
3931
  new St(),
3824
- new L.TypeAssigner(),
3825
- new L.ListProcessor(),
3826
- new L.DictionaryProcessor(),
3827
- new L.BasicTypesVerifier()
3932
+ new B.TypeAssigner(),
3933
+ new B.ListProcessor(),
3934
+ new B.DictionaryProcessor(),
3935
+ new B.MetadataPropagator(),
3936
+ new B.BasicTypesVerifier()
3828
3937
  ]);
3829
3938
  }
3830
3939
  export {
3831
3940
  Sr as ChannelBinding,
3832
- Wr as ChannelRunner,
3833
- Kr as CheckpointManager,
3834
- Hr as CheckpointRecord,
3941
+ qr as ChannelRunner,
3942
+ Gr as CheckpointManager,
3943
+ Wr as CheckpointRecord,
3835
3944
  ot as CodeBlockEvaluationError,
3836
- V as ContractBundle,
3945
+ H as ContractBundle,
3837
3946
  wr as ContractBundleBuilder,
3838
- Ur as ContractLoader,
3947
+ zr as ContractLoader,
3839
3948
  qn as ContractProcessorRegistry,
3840
- se as ContractProcessorRegistryBuilder,
3949
+ ae as ContractProcessorRegistryBuilder,
3841
3950
  Ke as DocumentProcessingResult,
3842
- Oi as DocumentProcessingRuntime,
3843
- Li as DocumentProcessor,
3844
- Fi as DocumentProcessorBuilder,
3845
- ui as EmissionRegistry,
3846
- Ni as GasMeter,
3951
+ Di as DocumentProcessingRuntime,
3952
+ $i as DocumentProcessor,
3953
+ Ui as DocumentProcessorBuilder,
3954
+ di as EmissionRegistry,
3955
+ Ai as GasMeter,
3847
3956
  vr as HandlerBinding,
3848
3957
  A as KEY_CHECKPOINT,
3849
3958
  We as KEY_EMBEDDED,
3850
3959
  Ge as KEY_INITIALIZED,
3851
3960
  qe as KEY_TERMINATED,
3852
- ao as MergingProcessors,
3853
- je as PROCESSOR_MANAGED_CHANNEL_BLUE_IDS,
3854
- oi as PatchEngine,
3855
- no as ProcessorContractConstants,
3856
- ne as ProcessorEngine,
3961
+ lo as MergingProcessors,
3962
+ Ce as PROCESSOR_MANAGED_CHANNEL_BLUE_IDS,
3963
+ ai as PatchEngine,
3964
+ io as ProcessorContractConstants,
3965
+ re as ProcessorEngine,
3857
3966
  S as ProcessorErrors,
3858
- Bi as ProcessorExecution,
3859
- xi as ProcessorExecutionContext,
3967
+ _i as ProcessorExecution,
3968
+ Li as ProcessorExecutionContext,
3860
3969
  y as ProcessorFatalError,
3861
- ro as ProcessorPointerConstants,
3862
- Ce as QuickJSEvaluator,
3970
+ oo as ProcessorPointerConstants,
3971
+ Se as QuickJSEvaluator,
3863
3972
  Qe as RELATIVE_CHECKPOINT,
3864
- H as RELATIVE_CONTRACTS,
3973
+ V as RELATIVE_CONTRACTS,
3865
3974
  Lt as RELATIVE_EMBEDDED,
3866
- de as RELATIVE_INITIALIZED,
3975
+ pe as RELATIVE_INITIALIZED,
3867
3976
  Je as RELATIVE_TERMINATED,
3868
- Ee as RESERVED_CONTRACT_KEYS,
3869
- te as RunTerminationError,
3870
- Yr as ScopeExecutor,
3871
- li as ScopeRuntimeContext,
3872
- ti as TerminationService,
3873
- Yi as andThen,
3977
+ ye as RESERVED_CONTRACT_KEYS,
3978
+ ne as RunTerminationError,
3979
+ ei as ScopeExecutor,
3980
+ hi as ScopeRuntimeContext,
3981
+ ri as TerminationService,
3982
+ eo as andThen,
3874
3983
  nt as canonicalSignature,
3875
- Me as canonicalSize,
3876
- _ as channelContractBaseSchema,
3877
- kn as channelEventCheckpointSchema,
3984
+ Ne as canonicalSize,
3985
+ L as channelContractBaseSchema,
3986
+ bn as channelEventCheckpointSchema,
3878
3987
  dt as compositeTimelineChannelSchema,
3879
3988
  sn as containsExpression,
3880
- Se as contractBaseSchema,
3881
- co as createDefaultMergingProcessor,
3989
+ ve as contractBaseSchema,
3990
+ uo as createDefaultMergingProcessor,
3882
3991
  ct as createPicomatchShouldResolve,
3883
3992
  Dn as documentAnchorsMarkerSchema,
3884
3993
  _n as documentLinksMarkerSchema,
@@ -3888,42 +3997,42 @@ export {
3888
3997
  at as evaluateQuickJSExpression,
3889
3998
  an as extractExpressionContent,
3890
3999
  ut as handlerContractBaseSchema,
3891
- Tn as initializationMarkerSchema,
3892
- Ji as isErr,
3893
- Z as isExpression,
3894
- ji as isOk,
3895
- ye as isProcessorManagedChannelBlueId,
4000
+ In as initializationMarkerSchema,
4001
+ Xi as isErr,
4002
+ ee as isExpression,
4003
+ Qi as isOk,
4004
+ je as isProcessorManagedChannelBlueId,
3896
4005
  _t as isReservedContractKey,
3897
- io as joinRelativePointers,
3898
- oo as jsonPatchSchema,
4006
+ so as joinRelativePointers,
4007
+ ao as jsonPatchSchema,
3899
4008
  mn as lifecycleChannelSchema,
3900
- Qi as map,
3901
- Xi as mapErr,
4009
+ Zi as map,
4010
+ Yi as mapErr,
3902
4011
  N as markerContractBaseSchema,
3903
- to as match,
4012
+ ro as match,
3904
4013
  Fn as myosParticipantsOrchestrationMarkerSchema,
3905
- $n as myosSessionInteractionMarkerSchema,
4014
+ Un as myosSessionInteractionMarkerSchema,
3906
4015
  Sn as myosTimelineChannelSchema,
3907
- Vn as myosWorkerAgencyMarkerSchema,
4016
+ Hn as myosWorkerAgencyMarkerSchema,
3908
4017
  P as normalizePointer,
3909
- k as normalizeScope,
4018
+ b as normalizeScope,
3910
4019
  Nt as ok,
3911
4020
  Nn as operationMarkerSchema,
3912
4021
  Pn as processEmbeddedMarkerSchema,
3913
- Mn as processingTerminatedMarkerSchema,
3914
- Ze as relativeCheckpointLastEvent,
4022
+ Rn as processingTerminatedMarkerSchema,
4023
+ Ye as relativeCheckpointLastEvent,
3915
4024
  et as relativeCheckpointLastSignature,
3916
- re as relativeContractsEntry,
4025
+ ie as relativeContractsEntry,
3917
4026
  Ft as relativizePointer,
3918
- ee as resolveNodeExpressions,
3919
- I as resolvePointer,
4027
+ te as resolveNodeExpressions,
4028
+ T as resolvePointer,
3920
4029
  cn as resolveTemplateString,
3921
4030
  Wn as sequentialWorkflowOperationSchema,
3922
- Hn as sequentialWorkflowSchema,
3923
- so as sequentialWorkflowStepSchema,
3924
- Pe as stripSlashes,
4031
+ Vn as sequentialWorkflowSchema,
4032
+ co as sequentialWorkflowStepSchema,
4033
+ Me as stripSlashes,
3925
4034
  yn as timelineChannelSchema,
3926
4035
  En as triggeredEventChannelSchema,
3927
- Zi as unwrapOr,
3928
- eo as unwrapOrElse
4036
+ to as unwrapOr,
4037
+ no as unwrapOrElse
3929
4038
  };