@blue-labs/document-processor 4.0.0-rc.2 → 4.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/index.js +666 -673
  2. package/dist/model/channels/composite-timeline-channel.d.ts +4 -4
  3. package/dist/model/channels/document-update-channel.d.ts +4 -4
  4. package/dist/model/channels/embedded-node-channel.d.ts +4 -4
  5. package/dist/model/channels/lifecycle-channel.d.ts +4 -4
  6. package/dist/model/channels/myos-timeline-channel.d.ts +4 -4
  7. package/dist/model/channels/timeline-channel.d.ts +4 -4
  8. package/dist/model/channels/triggered-event-channel.d.ts +4 -4
  9. package/dist/model/handlers/sequential-workflow-operation.d.ts +6 -6
  10. package/dist/model/handlers/sequential-workflow.d.ts +6 -6
  11. package/dist/model/markers/actor-policy.d.ts +2 -2
  12. package/dist/model/markers/channel-event-checkpoint.d.ts +2 -2
  13. package/dist/model/markers/document-anchors.d.ts +2 -2
  14. package/dist/model/markers/document-links.d.ts +2 -2
  15. package/dist/model/markers/initialization-marker.d.ts +2 -2
  16. package/dist/model/markers/myos-participants-orchestration.d.ts +2 -2
  17. package/dist/model/markers/myos-session-interaction.d.ts +2 -2
  18. package/dist/model/markers/myos-worker-agency.d.ts +2 -2
  19. package/dist/model/markers/operation.d.ts +2 -2
  20. package/dist/model/markers/process-embedded.d.ts +2 -2
  21. package/dist/model/markers/processing-terminated-marker.d.ts +4 -4
  22. package/dist/model/shared/channel-contract-base.d.ts +4 -4
  23. package/dist/model/shared/handler-contract-base.d.ts +4 -4
  24. package/dist/model/shared/marker-contract-base.d.ts +2 -2
  25. package/dist/registry/processors/actor-policy-marker-processor.d.ts +2 -2
  26. package/dist/registry/processors/composite-timeline-channel-processor.d.ts +4 -4
  27. package/dist/registry/processors/generic-marker-processor.d.ts +2 -2
  28. package/dist/registry/processors/myos-timeline-channel-processor.d.ts +4 -4
  29. package/dist/registry/processors/operation-marker-processor.d.ts +2 -2
  30. package/dist/registry/processors/sequential-workflow-operation-processor.d.ts +6 -6
  31. package/dist/registry/processors/sequential-workflow-processor.d.ts +6 -6
  32. package/dist/registry/processors/timeline-channel-processor.d.ts +4 -4
  33. package/dist/repository/semantic-repository.d.ts +40 -40
  34. package/dist/repository/semantic-repository.d.ts.map +1 -1
  35. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1,39 +1,39 @@
1
- import { repository as xt } from "@blue-repository/types";
2
- import { BlueNode as p, MergingProcessors as L, reindexRepositoryForSemanticStorage as Ft, withTypeBlueId as m, blueNodeField as I, Properties as Ne, Blue as $t } from "@blue-labs/language";
1
+ import { repository as Ze } from "@blue-repository/types";
2
+ import { evaluate as Lt } from "@blue-quickjs/quickjs-runtime";
3
+ import { validateDv as xt, DV_LIMIT_DEFAULTS as Ft } from "@blue-quickjs/dv";
4
+ import { HOST_V1_MANIFEST as $t, HOST_V1_HASH as Ut } from "@blue-quickjs/abi-manifest";
5
+ import { BlueNode as p, withTypeBlueId as m, blueNodeField as I, Properties as Ne, MergingProcessors as L, Blue as zt } from "@blue-labs/language";
3
6
  import Ae from "picomatch";
4
- import { evaluate as Ut } from "@blue-quickjs/quickjs-runtime";
5
- import { validateDv as zt, DV_LIMIT_DEFAULTS as Vt } from "@blue-quickjs/dv";
6
- import { HOST_V1_MANIFEST as Ht, HOST_V1_HASH as Kt } from "@blue-quickjs/abi-manifest";
7
7
  import { z as l, ZodError as ve } from "zod";
8
8
  import { isNullable as ge } from "@blue-labs/shared-utils";
9
- function Wt(o) {
9
+ function Vt(o) {
10
10
  return { ok: !0, value: o };
11
11
  }
12
- function qt(o) {
12
+ function Ht(o) {
13
13
  return { ok: !1, error: o };
14
14
  }
15
- function Oi(o) {
15
+ function Ri(o) {
16
16
  return o.ok;
17
17
  }
18
- function Ni(o) {
18
+ function Mi(o) {
19
19
  return !o.ok;
20
20
  }
21
- function Ai(o, e) {
22
- return o.ok ? Wt(e(o.value)) : o;
21
+ function Oi(o, e) {
22
+ return o.ok ? Vt(e(o.value)) : o;
23
23
  }
24
- function Bi(o, e) {
25
- return o.ok ? o : qt(e(o.error));
24
+ function Ni(o, e) {
25
+ return o.ok ? o : Ht(e(o.error));
26
26
  }
27
- function Di(o, e) {
27
+ function Ai(o, e) {
28
28
  return o.ok ? e(o.value) : o;
29
29
  }
30
- function _i(o, e) {
30
+ function Bi(o, e) {
31
31
  return o.ok ? o.value : e;
32
32
  }
33
- function Li(o, e) {
33
+ function Di(o, e) {
34
34
  return o.ok ? o.value : e(o.error);
35
35
  }
36
- function xi(o, e) {
36
+ function _i(o, e) {
37
37
  return o.ok ? e.ok(o.value) : e.err(o.error);
38
38
  }
39
39
  const C = {
@@ -56,14 +56,14 @@ const C = {
56
56
  return { kind: "UnsupportedOp", operation: o, reason: e };
57
57
  }
58
58
  };
59
- function Gt(o) {
59
+ function Kt(o) {
60
60
  return Object.freeze([...o]);
61
61
  }
62
- const jt = {
62
+ const Wt = {
63
63
  of(o, e, t) {
64
64
  return {
65
65
  document: o,
66
- triggeredEvents: Gt(e),
66
+ triggeredEvents: Kt(e),
67
67
  totalGas: t,
68
68
  capabilityFailure: !1,
69
69
  failureReason: null
@@ -78,273 +78,75 @@ const jt = {
78
78
  failureReason: e ?? null
79
79
  };
80
80
  }
81
- }, Ze = jt, Be = 120;
82
- function Jt(o) {
83
- return o.length <= Be ? o : `${o.slice(0, Be - 3)}...`;
84
- }
85
- class Xe extends Error {
86
- constructor(e, t) {
87
- super(`Failed to evaluate code block: ${Jt(e)}`, { cause: t }), this.code = e, this.cause = t, this.name = "CodeBlockEvaluationError";
88
- }
89
- }
90
- const Qt = 1700, Ee = BigInt(
91
- Qt
92
- ), Yt = BigInt(Number.MAX_SAFE_INTEGER), Zt = 4e4, Xt = 4e4;
93
- function en(o) {
94
- let e;
95
- if (typeof o == "bigint")
96
- e = o;
97
- else {
98
- if (!Number.isFinite(o) || o <= 0)
99
- return 0;
100
- e = BigInt(Math.trunc(o));
101
- }
102
- if (e <= 0n)
103
- return 0;
104
- const t = (e + Ee - 1n) / Ee;
105
- return t > Yt ? Number.MAX_SAFE_INTEGER : Number(t);
106
- }
107
- function et(o) {
108
- const e = BigInt(Math.max(0, Math.trunc(o)));
109
- return e <= 0n ? 0n : e * Ee;
110
- }
111
- const tt = et(
112
- Zt
113
- ), tn = et(
114
- Xt
115
- ), nt = /^\$\{([\s\S]*)\}$/, nn = /\$\{([\s\S]+?)\}/, rn = /\$\{([\s\S]+?)\}/g;
116
- function ne(o) {
117
- if (typeof o != "string" || !nt.test(o))
118
- return !1;
119
- const e = o.indexOf("${"), t = o.lastIndexOf("${");
120
- return e === t;
121
- }
122
- function on(o) {
123
- return typeof o != "string" ? !1 : nt.test(o) ? !0 : nn.test(o);
124
- }
125
- function sn(o) {
126
- if (!ne(o))
127
- throw new Error(`Invalid expression: ${o}`);
128
- return o.slice(2, -1);
129
- }
130
- async function rt(o, e, t, n, r) {
131
- const i = `return (${e});`;
132
- try {
133
- return await o.evaluate({
134
- code: i,
135
- bindings: t,
136
- wasmGasLimit: n,
137
- onWasmGasUsed: r
138
- });
139
- } catch (s) {
140
- throw new Xe(e, s);
141
- }
142
- }
143
- async function an(o, e, t, n, r) {
144
- let i = "", s = 0;
145
- for (const a of e.matchAll(rn)) {
146
- const c = a[0], u = a[1], h = a.index ?? 0;
147
- i += e.slice(s, h);
148
- const d = await rt(
149
- o,
150
- u,
151
- t,
152
- n,
153
- r
154
- );
155
- i += d == null ? "" : String(d), s = h + c.length;
156
- }
157
- return i += e.slice(s), i;
158
- }
159
- function ot({
160
- include: o,
161
- exclude: e = [],
162
- options: t
163
- }) {
164
- const n = { dot: !0, ...t ?? {} }, r = o.map(
165
- (s) => Ae(s, n)
166
- ), i = e.map(
167
- (s) => Ae(s, n)
168
- );
169
- return (s) => r.some((a) => a(s)) && !i.some((a) => a(s));
170
- }
171
- async function re(o) {
172
- const {
173
- evaluator: e,
174
- node: t,
175
- bindings: n,
176
- shouldResolve: r,
177
- shouldDescend: i = () => !0,
178
- context: s,
179
- pointer: a = "/"
180
- } = o, c = tn, u = ({
181
- used: g
182
- }) => {
183
- s.gasMeter().chargeWasmGas(g);
184
- }, h = t.clone();
185
- if (!i(a, h))
186
- return h;
187
- const d = h.getValue();
188
- if (d !== void 0) {
189
- if (typeof d == "string" && r(a)) {
190
- if (ne(d)) {
191
- const g = sn(d), y = await rt(
192
- e,
193
- g,
194
- n,
195
- c,
196
- u
197
- );
198
- return s.blue.jsonValueToNode(y ?? null);
199
- } else if (on(d)) {
200
- const g = await an(
201
- e,
202
- d,
203
- n,
204
- c,
205
- u
206
- );
207
- return new p().setValue(g);
208
- }
209
- }
210
- return h;
211
- }
212
- const v = h.getItems?.();
213
- if (Array.isArray(v)) {
214
- const g = await Promise.all(
215
- v.map(
216
- (y, O) => re({
217
- ...o,
218
- node: y,
219
- pointer: `${a}/${O}`
220
- })
221
- )
222
- );
223
- return h.setItems(g), h;
224
- }
225
- const f = h.getProperties?.();
226
- if (f) {
227
- const g = {};
228
- for (const [y, O] of Object.entries(f)) {
229
- const _ = a === "/" ? `/${y}` : `${a}/${y}`;
230
- g[y] = await re({
231
- ...o,
232
- node: O,
233
- pointer: _
234
- });
235
- }
236
- h.setProperties(g);
237
- }
238
- return h;
239
- }
240
- class it {
241
- process(e, t) {
242
- const n = t.getValue();
243
- if (ne(n)) {
244
- const r = t.clone();
245
- return r.setValue(n), r.setProperties(void 0), r.setItems(void 0), r.setType(void 0), r;
246
- }
247
- return e;
248
- }
249
- /**
250
- * Post-process to ensure expressions aren't overridden by subsequent processors
251
- */
252
- postProcess(e, t) {
253
- const n = t.getValue();
254
- if (ne(n) && e.getValue() !== n && n !== void 0) {
255
- const r = e.clone();
256
- return r.setValue(n), r;
257
- }
258
- return e;
259
- }
260
- }
261
- function st() {
262
- return new L.SequentialMergingProcessor([
263
- new L.ValuePropagator(),
264
- new it(),
265
- new L.TypeAssigner(),
266
- new L.ListProcessor(),
267
- new L.DictionaryProcessor(),
268
- new L.MetadataPropagator(),
269
- new L.BasicTypesVerifier()
270
- ]);
271
- }
272
- const at = Ft(
273
- xt,
274
- {
275
- mergingProcessor: st()
276
- }
277
- ), S = we("core"), b = we("conversation"), q = we("myos");
81
+ }, Xe = Wt, S = we("core"), b = we("conversation"), q = we("myos");
278
82
  function we(o) {
279
- const e = at.packages[o];
83
+ const e = Ze.packages[o];
280
84
  if (!e)
281
- throw new Error(
282
- `Missing reindexed Blue repository package ${o}.`
283
- );
85
+ throw new Error(`Missing Blue repository package ${o}.`);
284
86
  return e.aliases;
285
87
  }
286
- const cn = [
88
+ const qt = [
287
89
  "embedded",
288
90
  "initialized",
289
91
  "terminated",
290
92
  "checkpoint"
291
- ], ln = [
93
+ ], Gt = [
292
94
  S["Core/Document Update Channel"],
293
95
  S["Core/Triggered Event Channel"],
294
96
  S["Core/Lifecycle Event Channel"],
295
97
  S["Core/Embedded Node Channel"]
296
- ], ct = "embedded", lt = "initialized", ut = "terminated", D = "checkpoint", be = new Set(
297
- cn
298
- ), Ie = new Set(ln);
299
- function un(o) {
98
+ ], et = "embedded", tt = "initialized", nt = "terminated", D = "checkpoint", be = new Set(
99
+ qt
100
+ ), Ie = new Set(Gt);
101
+ function jt(o) {
300
102
  return o != null && be.has(o);
301
103
  }
302
- function ht(o) {
104
+ function rt(o) {
303
105
  return o != null && Ie.has(
304
106
  o
305
107
  );
306
108
  }
307
- const Fi = {
308
- KEY_EMBEDDED: ct,
309
- KEY_INITIALIZED: lt,
310
- KEY_TERMINATED: ut,
109
+ const Li = {
110
+ KEY_EMBEDDED: et,
111
+ KEY_INITIALIZED: tt,
112
+ KEY_TERMINATED: nt,
311
113
  KEY_CHECKPOINT: D,
312
114
  RESERVED_CONTRACT_KEYS: be,
313
115
  PROCESSOR_MANAGED_CHANNEL_BLUE_IDS: Ie,
314
- isReservedContractKey: un,
315
- isProcessorManagedChannelBlueId: ht
316
- }, G = "/contracts", ye = `${G}/${lt}`, dt = `${G}/${ut}`, hn = `${G}/${ct}`, pt = `${G}/${D}`, ft = "/lastEvents", mt = "/lastSignatures";
116
+ isReservedContractKey: jt,
117
+ isProcessorManagedChannelBlueId: rt
118
+ }, G = "/contracts", Ee = `${G}/${tt}`, ot = `${G}/${nt}`, Jt = `${G}/${et}`, it = `${G}/${D}`, st = "/lastEvents", at = "/lastSignatures";
317
119
  function ae(o) {
318
120
  return `${G}/${o}`;
319
121
  }
320
- function gt(o, e) {
321
- return `${ae(o)}${ft}/${e}`;
122
+ function ct(o, e) {
123
+ return `${ae(o)}${st}/${e}`;
322
124
  }
323
- function Et(o, e) {
324
- return `${ae(o)}${mt}/${e}`;
125
+ function lt(o, e) {
126
+ return `${ae(o)}${at}/${e}`;
325
127
  }
326
- const $i = {
128
+ const xi = {
327
129
  RELATIVE_CONTRACTS: G,
328
- RELATIVE_INITIALIZED: ye,
329
- RELATIVE_TERMINATED: dt,
330
- RELATIVE_EMBEDDED: hn,
331
- RELATIVE_CHECKPOINT: pt,
332
- LAST_EVENTS_SUFFIX: ft,
333
- LAST_SIGNATURES_SUFFIX: mt,
130
+ RELATIVE_INITIALIZED: Ee,
131
+ RELATIVE_TERMINATED: ot,
132
+ RELATIVE_EMBEDDED: Jt,
133
+ RELATIVE_CHECKPOINT: it,
134
+ LAST_EVENTS_SUFFIX: st,
135
+ LAST_SIGNATURES_SUFFIX: at,
334
136
  relativeContractsEntry: ae,
335
- relativeCheckpointLastEvent: gt,
336
- relativeCheckpointLastSignature: Et
137
+ relativeCheckpointLastEvent: ct,
138
+ relativeCheckpointLastSignature: lt
337
139
  };
338
- function yt(o) {
140
+ function ut(o) {
339
141
  return o == null || o.length === 0;
340
142
  }
341
143
  function w(o) {
342
- return yt(o) ? "/" : o.startsWith("/") ? o : `/${o}`;
144
+ return ut(o) ? "/" : o.startsWith("/") ? o : `/${o}`;
343
145
  }
344
146
  function R(o) {
345
- return yt(o) ? "/" : o.startsWith("/") ? o : `/${o}`;
147
+ return ut(o) ? "/" : o.startsWith("/") ? o : `/${o}`;
346
148
  }
347
- function De(o) {
149
+ function Be(o) {
348
150
  if (o == null)
349
151
  return "";
350
152
  let e = o.trim();
@@ -356,15 +158,15 @@ function De(o) {
356
158
  e = e.substring(0, e.length - 1);
357
159
  return e;
358
160
  }
359
- function Ui(o, e) {
360
- const t = De(o), n = De(e);
161
+ function Fi(o, e) {
162
+ const t = Be(o), n = Be(e);
361
163
  return t.length === 0 && n.length === 0 ? "/" : t.length === 0 ? `/${n}` : n.length === 0 ? `/${t}` : `/${t}/${n}`;
362
164
  }
363
165
  function k(o, e) {
364
166
  const t = w(o), n = R(e);
365
167
  return t === "/" ? n : n === "/" || n.length === 1 ? t : `${t}${n}`;
366
168
  }
367
- function dn(o, e) {
169
+ function Qt(o, e) {
368
170
  const t = w(o), n = R(e);
369
171
  if (t === "/" || !n.startsWith(t))
370
172
  return n;
@@ -373,12 +175,12 @@ function dn(o, e) {
373
175
  const r = n.substring(t.length);
374
176
  return r.length === 0 ? "/" : r.startsWith("/") ? r : `/${r}`;
375
177
  }
376
- function pn(o) {
178
+ function Yt(o) {
377
179
  return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
378
180
  }
379
- var he, _e;
380
- function fn() {
381
- return _e || (_e = 1, he = function o(e) {
181
+ var he, De;
182
+ function Zt() {
183
+ return De || (De = 1, he = function o(e) {
382
184
  if (typeof e == "number" && isNaN(e))
383
185
  throw new Error("NaN is not allowed");
384
186
  if (typeof e == "number" && !isFinite(e))
@@ -391,23 +193,48 @@ function fn() {
391
193
  }, "")}}`;
392
194
  }), he;
393
195
  }
394
- var mn = fn();
395
- const gn = /* @__PURE__ */ pn(mn);
396
- function En(o, e) {
196
+ var Xt = Zt();
197
+ const en = /* @__PURE__ */ Yt(Xt);
198
+ function tn(o, e) {
397
199
  return o.nodeToJson(e, "official");
398
200
  }
399
- function yn(o, e) {
400
- const t = En(o, e);
401
- return gn(t);
201
+ function nn(o, e) {
202
+ const t = tn(o, e);
203
+ return en(t);
402
204
  }
403
- function Ct(o, e) {
404
- return e ? yn(o, e) : null;
205
+ function ht(o, e) {
206
+ return e ? nn(o, e) : null;
405
207
  }
406
- function Le(o, e) {
407
- const t = Ct(o, e);
208
+ function _e(o, e) {
209
+ const t = ht(o, e);
408
210
  return t == null ? 0 : new TextEncoder().encode(t).length;
409
211
  }
410
- const B = 1, Cn = /* @__PURE__ */ new Set([
212
+ const rn = 1700, ye = BigInt(
213
+ rn
214
+ ), on = BigInt(Number.MAX_SAFE_INTEGER), sn = 4e4, an = 4e4;
215
+ function cn(o) {
216
+ let e;
217
+ if (typeof o == "bigint")
218
+ e = o;
219
+ else {
220
+ if (!Number.isFinite(o) || o <= 0)
221
+ return 0;
222
+ e = BigInt(Math.trunc(o));
223
+ }
224
+ if (e <= 0n)
225
+ return 0;
226
+ const t = (e + ye - 1n) / ye;
227
+ return t > on ? Number.MAX_SAFE_INTEGER : Number(t);
228
+ }
229
+ function dt(o) {
230
+ const e = BigInt(Math.max(0, Math.trunc(o)));
231
+ return e <= 0n ? 0n : e * ye;
232
+ }
233
+ const pt = dt(
234
+ sn
235
+ ), ln = dt(
236
+ an
237
+ ), B = 1, un = /* @__PURE__ */ new Set([
411
238
  "event",
412
239
  "eventCanonical",
413
240
  "steps",
@@ -446,33 +273,33 @@ class ke {
446
273
  wasmGasLimit: n,
447
274
  onWasmGasUsed: r
448
275
  }) {
449
- const i = this.prepareBindings(t), s = n ?? tt, a = {
276
+ const i = this.prepareBindings(t), s = n ?? pt, a = {
450
277
  code: this.wrapCode(e),
451
278
  abiId: "Host.v1",
452
279
  abiVersion: 1,
453
- abiManifestHash: Kt
280
+ abiManifestHash: Ut
454
281
  };
455
282
  try {
456
- const c = await Ut({
283
+ const c = await Lt({
457
284
  program: a,
458
285
  input: i,
459
286
  gasLimit: s,
460
- manifest: Ht,
287
+ manifest: $t,
461
288
  handlers: this.handlers
462
289
  });
463
290
  if (n !== void 0 && r && r({
464
291
  used: c.gasUsed,
465
292
  remaining: c.gasRemaining
466
293
  }), !c.ok)
467
- throw wn(c);
468
- return oe(c.value);
294
+ throw pn(c);
295
+ return ne(c.value);
469
296
  } catch (c) {
470
- throw bn(c);
297
+ throw fn(c);
471
298
  }
472
299
  }
473
300
  prepareBindings(e) {
474
301
  const t = e ?? {};
475
- Sn(t);
302
+ hn(t);
476
303
  const n = j(t.event, null, "event"), r = j(
477
304
  t.eventCanonical ?? n,
478
305
  n,
@@ -492,11 +319,11 @@ class ke {
492
319
  currentContract: s,
493
320
  currentContractCanonical: a
494
321
  }, u = this.extractDocumentBinding(t), h = typeof u?.canonical == "function" ? u.canonical : void 0;
495
- this.handlerState.documentGet = xe(u), this.handlerState.documentGetCanonical = xe(
322
+ this.handlerState.documentGet = Le(u), this.handlerState.documentGetCanonical = Le(
496
323
  h ?? u
497
324
  );
498
325
  const d = this.extractEmitBinding(t);
499
- return this.handlerState.emit = vn(d), c;
326
+ return this.handlerState.emit = dn(d), c;
500
327
  }
501
328
  extractDocumentBinding(e) {
502
329
  if (!Object.prototype.hasOwnProperty.call(e, "document"))
@@ -526,15 +353,15 @@ ${e}
526
353
  })()`;
527
354
  }
528
355
  }
529
- function Sn(o) {
356
+ function hn(o) {
530
357
  for (const e of Object.keys(o))
531
- if (!Cn.has(e))
358
+ if (!un.has(e))
532
359
  throw new TypeError(`Unsupported QuickJS binding: "${e}"`);
533
360
  }
534
361
  function j(o, e, t) {
535
362
  const n = o === void 0 ? e : o;
536
363
  try {
537
- zt(n, { limits: Vt });
364
+ xt(n, { limits: Ft });
538
365
  } catch (r) {
539
366
  const i = r instanceof Error ? r.message : String(r);
540
367
  throw new TypeError(
@@ -543,7 +370,7 @@ function j(o, e, t) {
543
370
  }
544
371
  return n;
545
372
  }
546
- function xe(o) {
373
+ function Le(o) {
547
374
  return o ? (e) => {
548
375
  try {
549
376
  const t = o(e);
@@ -559,10 +386,10 @@ function xe(o) {
559
386
  }
560
387
  } : () => ({ ok: null, units: B });
561
388
  }
562
- function vn(o) {
389
+ function dn(o) {
563
390
  return o ? (e) => {
564
391
  try {
565
- if (o(oe(e)) instanceof Promise)
392
+ if (o(ne(e)) instanceof Promise)
566
393
  throw new Error("Async emit handlers are not supported");
567
394
  return { ok: null, units: B };
568
395
  } catch {
@@ -573,23 +400,23 @@ function vn(o) {
573
400
  }
574
401
  } : () => ({ ok: null, units: B });
575
402
  }
576
- function oe(o) {
403
+ function ne(o) {
577
404
  if (o == null)
578
405
  return o;
579
406
  if (Array.isArray(o))
580
- return o.map((e) => oe(e));
407
+ return o.map((e) => ne(e));
581
408
  if (typeof o == "object") {
582
409
  const e = Object.getPrototypeOf(o);
583
410
  if (e !== Object.prototype && e !== null)
584
411
  return o;
585
412
  const t = {};
586
413
  for (const [n, r] of Object.entries(o))
587
- t[n] = oe(r);
414
+ t[n] = ne(r);
588
415
  return t;
589
416
  }
590
417
  return o;
591
418
  }
592
- function wn(o) {
419
+ function pn(o) {
593
420
  if (o.ok)
594
421
  return new Error("Unexpected evaluation result");
595
422
  if (o.type === "invalid-output") {
@@ -606,9 +433,143 @@ function wn(o) {
606
433
  const t = e.message || o.message, n = new Error(t);
607
434
  return e.kind === "js-exception" ? (n.name = e.name || "Error", n) : e.kind === "host-error" ? (n.name = "HostError", n) : e.kind === "manifest-error" ? (n.name = "ManifestError", n) : (e.kind === "unknown" && e.name && (n.name = e.name), n);
608
435
  }
609
- function bn(o) {
436
+ function fn(o) {
610
437
  return o instanceof Error ? o : new Error(String(o ?? "Unknown error"));
611
438
  }
439
+ const xe = 120;
440
+ function mn(o) {
441
+ return o.length <= xe ? o : `${o.slice(0, xe - 3)}...`;
442
+ }
443
+ class ft extends Error {
444
+ constructor(e, t) {
445
+ super(`Failed to evaluate code block: ${mn(e)}`, { cause: t }), this.code = e, this.cause = t, this.name = "CodeBlockEvaluationError";
446
+ }
447
+ }
448
+ const mt = /^\$\{([\s\S]*)\}$/, gn = /\$\{([\s\S]+?)\}/, En = /\$\{([\s\S]+?)\}/g;
449
+ function re(o) {
450
+ if (typeof o != "string" || !mt.test(o))
451
+ return !1;
452
+ const e = o.indexOf("${"), t = o.lastIndexOf("${");
453
+ return e === t;
454
+ }
455
+ function yn(o) {
456
+ return typeof o != "string" ? !1 : mt.test(o) ? !0 : gn.test(o);
457
+ }
458
+ function Cn(o) {
459
+ if (!re(o))
460
+ throw new Error(`Invalid expression: ${o}`);
461
+ return o.slice(2, -1);
462
+ }
463
+ async function gt(o, e, t, n, r) {
464
+ const i = `return (${e});`;
465
+ try {
466
+ return await o.evaluate({
467
+ code: i,
468
+ bindings: t,
469
+ wasmGasLimit: n,
470
+ onWasmGasUsed: r
471
+ });
472
+ } catch (s) {
473
+ throw new ft(e, s);
474
+ }
475
+ }
476
+ async function Sn(o, e, t, n, r) {
477
+ let i = "", s = 0;
478
+ for (const a of e.matchAll(En)) {
479
+ const c = a[0], u = a[1], h = a.index ?? 0;
480
+ i += e.slice(s, h);
481
+ const d = await gt(
482
+ o,
483
+ u,
484
+ t,
485
+ n,
486
+ r
487
+ );
488
+ i += d == null ? "" : String(d), s = h + c.length;
489
+ }
490
+ return i += e.slice(s), i;
491
+ }
492
+ function Et({
493
+ include: o,
494
+ exclude: e = [],
495
+ options: t
496
+ }) {
497
+ const n = { dot: !0, ...t ?? {} }, r = o.map(
498
+ (s) => Ae(s, n)
499
+ ), i = e.map(
500
+ (s) => Ae(s, n)
501
+ );
502
+ return (s) => r.some((a) => a(s)) && !i.some((a) => a(s));
503
+ }
504
+ async function oe(o) {
505
+ const {
506
+ evaluator: e,
507
+ node: t,
508
+ bindings: n,
509
+ shouldResolve: r,
510
+ shouldDescend: i = () => !0,
511
+ context: s,
512
+ pointer: a = "/"
513
+ } = o, c = ln, u = ({
514
+ used: g
515
+ }) => {
516
+ s.gasMeter().chargeWasmGas(g);
517
+ }, h = t.clone();
518
+ if (!i(a, h))
519
+ return h;
520
+ const d = h.getValue();
521
+ if (d !== void 0) {
522
+ if (typeof d == "string" && r(a)) {
523
+ if (re(d)) {
524
+ const g = Cn(d), y = await gt(
525
+ e,
526
+ g,
527
+ n,
528
+ c,
529
+ u
530
+ );
531
+ return s.blue.jsonValueToNode(y ?? null);
532
+ } else if (yn(d)) {
533
+ const g = await Sn(
534
+ e,
535
+ d,
536
+ n,
537
+ c,
538
+ u
539
+ );
540
+ return new p().setValue(g);
541
+ }
542
+ }
543
+ return h;
544
+ }
545
+ const v = h.getItems?.();
546
+ if (Array.isArray(v)) {
547
+ const g = await Promise.all(
548
+ v.map(
549
+ (y, O) => oe({
550
+ ...o,
551
+ node: y,
552
+ pointer: `${a}/${O}`
553
+ })
554
+ )
555
+ );
556
+ return h.setItems(g), h;
557
+ }
558
+ const f = h.getProperties?.();
559
+ if (f) {
560
+ const g = {};
561
+ for (const [y, O] of Object.entries(f)) {
562
+ const _ = a === "/" ? `/${y}` : `${a}/${y}`;
563
+ g[y] = await oe({
564
+ ...o,
565
+ node: O,
566
+ pointer: _
567
+ });
568
+ }
569
+ h.setProperties(g);
570
+ }
571
+ return h;
572
+ }
612
573
  const P = {
613
574
  "Core/Channel": "DcoJyCh7XXxy1nR5xjy7qfkUgQ1GiZnKKSxh8DJusBSr",
614
575
  "Core/Channel Event Checkpoint": "B7YQeYdQzUNuzaDQ4tNTd2iJqgd4YnVQkgz4QgymDWWU",
@@ -636,20 +597,20 @@ const P = {
636
597
  ).extend({
637
598
  path: l.string().optional(),
638
599
  definition: I().optional()
639
- }), St = m(P["Core/Handler"])(ce.extend({
600
+ }), yt = m(P["Core/Handler"])(ce.extend({
640
601
  channel: l.string().optional(),
641
602
  description: l.string().optional(),
642
603
  event: I().optional(),
643
604
  name: l.string().optional()
644
- })), vt = St.merge(Te), z = m(P["Core/Marker"])(ce.extend({
605
+ })), Ct = yt.merge(Te), z = m(P["Core/Marker"])(ce.extend({
645
606
  description: l.string().optional(),
646
607
  name: l.string().optional()
647
- })), M = z.merge(Te), In = l.object({
608
+ })), M = z.merge(Te), vn = l.object({
648
609
  op: l.enum(["ADD", "REPLACE", "REMOVE"]),
649
610
  path: l.string(),
650
611
  val: I().optional()
651
- }), zi = m("JsonPatch")(
652
- In
612
+ }), $i = m("JsonPatch")(
613
+ vn
653
614
  ).superRefine((o, e) => {
654
615
  o.op === "REMOVE" && o.val !== void 0 && e.addIssue({
655
616
  code: l.ZodIssueCode.custom,
@@ -660,27 +621,27 @@ const P = {
660
621
  message: `${o.op} operations must include a value`,
661
622
  path: ["val"]
662
623
  });
663
- }), kn = m(P["Core/Document Update Channel"])($.extend({
624
+ }), wn = m(P["Core/Document Update Channel"])($.extend({
664
625
  description: l.string().optional(),
665
626
  name: l.string().optional(),
666
627
  path: l.string().optional()
667
- })), Tn = kn.merge(
628
+ })), bn = wn.merge(
668
629
  U
669
- ), Pn = m(P["Core/Embedded Node Channel"])($.extend({
630
+ ), In = m(P["Core/Embedded Node Channel"])($.extend({
670
631
  childPath: l.string().optional(),
671
632
  description: l.string().optional(),
672
633
  name: l.string().optional()
673
- })), Rn = Pn.merge(
634
+ })), kn = In.merge(
674
635
  U
675
- ), Mn = m(P["Core/Lifecycle Event Channel"])($.extend({
636
+ ), Tn = m(P["Core/Lifecycle Event Channel"])($.extend({
676
637
  description: l.string().optional(),
677
638
  name: l.string().optional()
678
- })), On = Mn.merge(
639
+ })), Pn = Tn.merge(
679
640
  U
680
- ), Nn = m(P["Core/Triggered Event Channel"])($.extend({
641
+ ), Rn = m(P["Core/Triggered Event Channel"])($.extend({
681
642
  description: l.string().optional(),
682
643
  name: l.string().optional()
683
- })), An = Nn.merge(U), T = {
644
+ })), Mn = Rn.merge(U), T = {
684
645
  "Conversation/Actor": "CN5efWVizJbRsMCw8YWRfT2q9vM9XfeGDN9wFvYcvMnQ",
685
646
  "Conversation/Actor Policy": "EeWqP1Tw9WXo5nq8kx93FuTw9HRqpv34mbWFjH72nR7o",
686
647
  "Conversation/Composite Timeline Channel": "HsNatiPt2YvmkWQoqtfrFCbdp75ZUBLBUkWeq84WTfnr",
@@ -695,11 +656,11 @@ const P = {
695
656
  "Conversation/Timeline Entry": "29tcU8MkrV3KL5HqH6DHJDPPfJMheoqwiKJsaHnrp9hT",
696
657
  "Conversation/Trigger Event": "2bSWEoMSZwzf32Hnr4BDVsuq8NRjrWEpnhZvMZAJGhh2",
697
658
  "Conversation/Update Document": "FtHZJzH4hqAoGxFBjsmy1svfT4BwEBB4aHpFSZycZLLa"
698
- }, wt = m(T["Conversation/Timeline Channel"])($.extend({
659
+ }, St = m(T["Conversation/Timeline Channel"])($.extend({
699
660
  description: l.string().optional(),
700
661
  name: l.string().optional(),
701
662
  timelineId: l.string().optional()
702
- })), Bn = wt.merge(
663
+ })), On = St.merge(
703
664
  U
704
665
  ), A = {
705
666
  "MyOS/Document Anchor": "HS9yo34TGEAM2LGcNbLh7XPN4goPRhqdGZQkiyh473Wb",
@@ -712,16 +673,16 @@ const P = {
712
673
  "MyOS/MyOS Timeline Channel": "HCF8mXnX3dFjQ8osjxb4Wzm2Nm1DoXnTYuA5sPnV7NTs",
713
674
  "MyOS/MyOS Timeline Entry": "F3mQaGQ1B48yMedKZojFTxeKxtee4xU66QBbiyEMvGeZ",
714
675
  "MyOS/MyOS Worker Agency": "4Lix4AKXvBDvrwxw2htSdYFKxL4wugEQzqoSEYet5Dh1"
715
- }, Dn = m(A["MyOS/MyOS Timeline Channel"])(wt.extend({
676
+ }, Nn = m(A["MyOS/MyOS Timeline Channel"])(St.extend({
716
677
  accountId: l.string().optional(),
717
678
  description: l.string().optional(),
718
679
  email: l.string().optional(),
719
680
  name: l.string().optional()
720
- })), _n = Dn.merge(U), Ln = m(T["Conversation/Composite Timeline Channel"])($.extend({
681
+ })), An = Nn.merge(U), Bn = m(T["Conversation/Composite Timeline Channel"])($.extend({
721
682
  channels: l.array(l.string()).optional(),
722
683
  description: l.string().optional(),
723
684
  name: l.string().optional()
724
- })), bt = Ln.merge(U), xn = m(T["Conversation/Actor Policy"])(z.extend({
685
+ })), vt = Bn.merge(U), Dn = m(T["Conversation/Actor Policy"])(z.extend({
725
686
  description: l.string().optional(),
726
687
  name: l.string().optional(),
727
688
  operations: l.record(l.string(), l.object({
@@ -729,25 +690,25 @@ const P = {
729
690
  requiresActor: l.string().optional(),
730
691
  requiresSource: l.string().optional()
731
692
  })).optional()
732
- })), It = ["principal", "agent", "any"], kt = [
693
+ })), wt = ["principal", "agent", "any"], bt = [
733
694
  "browserSession",
734
695
  "apiCall",
735
696
  "documentRequest"
736
- ], Fn = l.enum(It), Fe = l.enum(kt), $n = l.object({
697
+ ], _n = l.enum(wt), Fe = l.enum(bt), Ln = l.object({
737
698
  excludeSource: Fe.optional(),
738
- requiresActor: Fn.optional(),
699
+ requiresActor: _n.optional(),
739
700
  requiresSource: Fe.optional()
740
- }), Tt = xn.merge(
701
+ }), It = Dn.merge(
741
702
  M
742
703
  ).extend({
743
- operations: l.record(l.string(), $n).optional()
744
- }), Un = new Set(It), $e = new Set(kt);
745
- class Pt extends Error {
704
+ operations: l.record(l.string(), Ln).optional()
705
+ }), xn = new Set(wt), $e = new Set(bt);
706
+ class kt extends Error {
746
707
  constructor(e) {
747
708
  super(e), this.name = "ActorPolicyLiteralValidationError";
748
709
  }
749
710
  }
750
- function zn(o) {
711
+ function Fn(o) {
751
712
  const e = o.getProperties()?.operations;
752
713
  if (!(e instanceof p))
753
714
  return;
@@ -761,7 +722,7 @@ function zn(o) {
761
722
  n,
762
723
  "requiresActor",
763
724
  i.requiresActor,
764
- Un
725
+ xn
765
726
  ), de(
766
727
  n,
767
728
  "requiresSource",
@@ -780,77 +741,77 @@ function de(o, e, t, n) {
780
741
  return;
781
742
  const r = t.getValue();
782
743
  if (r != null && (typeof r != "string" || !n.has(r)))
783
- throw new Pt(
744
+ throw new kt(
784
745
  `Actor Policy operation '${o}' declares unsupported ${e} '${String(
785
746
  r
786
747
  )}'`
787
748
  );
788
749
  }
789
- const Vn = m(P["Core/Channel Event Checkpoint"])(z.extend({
750
+ const $n = m(P["Core/Channel Event Checkpoint"])(z.extend({
790
751
  description: l.string().optional(),
791
752
  lastEvents: l.record(l.string(), I()).optional(),
792
753
  name: l.string().optional()
793
- })), Hn = Vn.merge(M).extend({
754
+ })), Un = $n.merge(M).extend({
794
755
  lastSignatures: l.record(l.string()).optional()
795
- }), Kn = m(P["Core/Processing Initialized Marker"])(z.extend({
756
+ }), zn = m(P["Core/Processing Initialized Marker"])(z.extend({
796
757
  description: l.string().optional(),
797
758
  documentId: l.string().optional(),
798
759
  name: l.string().optional()
799
- })), Wn = Kn.merge(M), qn = m(P["Core/Process Embedded"])(z.extend({
760
+ })), Vn = zn.merge(M), Hn = m(P["Core/Process Embedded"])(z.extend({
800
761
  description: l.string().optional(),
801
762
  name: l.string().optional(),
802
763
  paths: l.array(l.string()).optional()
803
- })), Gn = qn.merge(
764
+ })), Kn = Hn.merge(
804
765
  M
805
- ), jn = m(P["Core/Processing Terminated Marker"])(z.extend({
766
+ ), Wn = m(P["Core/Processing Terminated Marker"])(z.extend({
806
767
  cause: l.string().optional(),
807
768
  description: l.string().optional(),
808
769
  name: l.string().optional(),
809
770
  reason: l.string().optional()
810
- })), Jn = jn.merge(M), Z = m(T["Conversation/Operation"])(z.extend({
771
+ })), qn = Wn.merge(M), Z = m(T["Conversation/Operation"])(z.extend({
811
772
  channel: l.string().optional(),
812
773
  description: l.string().optional(),
813
774
  name: l.string().optional(),
814
775
  request: I().optional()
815
- })), Qn = Z.merge(
776
+ })), Gn = Z.merge(
816
777
  M
817
- ), Yn = m(A["MyOS/Document Anchor"])(l.object({
778
+ ), jn = m(A["MyOS/Document Anchor"])(l.object({
818
779
  description: l.string().optional(),
819
780
  name: l.string().optional(),
820
781
  template: I().optional()
821
- })), Zn = m(A["MyOS/Document Anchors"])(l.object({}).catchall(Yn)), Xn = Zn.merge(M), er = m(A["MyOS/Link"])(l.object({
782
+ })), Jn = m(A["MyOS/Document Anchors"])(l.object({}).catchall(jn)), Qn = Jn.merge(M), Yn = m(A["MyOS/Link"])(l.object({
822
783
  anchor: l.string().optional(),
823
784
  description: l.string().optional(),
824
785
  name: l.string().optional()
825
- })), tr = m(A["MyOS/Document Links"])(l.object({}).catchall(er)), nr = tr.merge(
786
+ })), Zn = m(A["MyOS/Document Links"])(l.object({}).catchall(Yn)), Xn = Zn.merge(
826
787
  M
827
- ), rr = m(A["MyOS/MyOS Participants Orchestration"])(l.object({
788
+ ), er = m(A["MyOS/MyOS Participants Orchestration"])(l.object({
828
789
  name: l.string().optional()
829
- })), or = rr.merge(M), ir = m(A["MyOS/MyOS Session Interaction"])(l.object({
790
+ })), tr = er.merge(M), nr = m(A["MyOS/MyOS Session Interaction"])(l.object({
830
791
  name: l.string().optional()
831
- })), sr = ir.merge(M), ar = m(A["MyOS/MyOS Worker Agency"])(l.object({
792
+ })), rr = nr.merge(M), or = m(A["MyOS/MyOS Worker Agency"])(l.object({
832
793
  name: l.string().optional()
833
- })), cr = ar.merge(
794
+ })), ir = or.merge(
834
795
  M
835
796
  ), le = m(T["Conversation/Sequential Workflow Step"])(l.object({
836
797
  description: l.string().optional(),
837
798
  name: l.string().optional()
838
- })), Rt = m(T["Conversation/Sequential Workflow"])(St.extend({
799
+ })), Tt = m(T["Conversation/Sequential Workflow"])(yt.extend({
839
800
  description: l.string().optional(),
840
801
  name: l.string().optional(),
841
802
  steps: l.array(le).optional()
842
- })), Vi = I(), lr = Rt.merge(vt).extend({
803
+ })), Ui = I(), sr = Tt.merge(Ct).extend({
843
804
  steps: l.array(I()).optional()
844
- }), ur = m(T["Conversation/Sequential Workflow Operation"])(Rt.extend({
805
+ }), ar = m(T["Conversation/Sequential Workflow Operation"])(Tt.extend({
845
806
  description: l.string().optional(),
846
807
  name: l.string().optional(),
847
808
  operation: l.string().optional()
848
- })), hr = ur.merge(
849
- vt
809
+ })), cr = ar.merge(
810
+ Ct
850
811
  ).extend({
851
812
  steps: l.array(I()).optional()
852
813
  });
853
- function dr(o) {
814
+ function lr(o) {
854
815
  if (!Array.isArray(o.blueIds) || o.blueIds.length === 0)
855
816
  throw new Error("Contract processors must declare at least one BlueId");
856
817
  for (const e of o.blueIds)
@@ -858,11 +819,11 @@ function dr(o) {
858
819
  throw new Error("Contract processor BlueIds must be non-empty strings");
859
820
  }
860
821
  function X(o, e) {
861
- dr(o);
822
+ lr(o);
862
823
  for (const t of o.blueIds)
863
824
  e.set(t, o);
864
825
  }
865
- class pr {
826
+ class ur {
866
827
  processorsByBlueId = /* @__PURE__ */ new Map();
867
828
  handlerProcessors = /* @__PURE__ */ new Map();
868
829
  channelProcessors = /* @__PURE__ */ new Map();
@@ -962,26 +923,26 @@ class pr {
962
923
  return { blueId: s.blueId, value: s.value };
963
924
  }
964
925
  }
965
- class fr {
926
+ class hr {
966
927
  kind = "marker";
967
928
  blueIds = [
968
929
  b["Conversation/Actor Policy"]
969
930
  ];
970
- schema = Tt;
931
+ schema = It;
971
932
  }
972
- const mr = "compositeSourceChannelKey";
973
- function gr(o, e) {
933
+ const dr = "compositeSourceChannelKey";
934
+ function pr(o, e) {
974
935
  return `${o}::${e}`;
975
936
  }
976
- function Er(o) {
937
+ function fr(o) {
977
938
  return o != null && Object.prototype.hasOwnProperty.call(o, "lastEvents") && Object.prototype.hasOwnProperty.call(o, "lastSignatures");
978
939
  }
979
- class yr {
940
+ class mr {
980
941
  kind = "channel";
981
942
  blueIds = [
982
943
  b["Conversation/Composite Timeline Channel"]
983
944
  ];
984
- schema = bt;
945
+ schema = vt;
985
946
  /**
986
947
  * Fallback match hook that delegates to {@link evaluate} for consistent behavior.
987
948
  */
@@ -1025,10 +986,10 @@ class yr {
1025
986
  continue;
1026
987
  const _ = d.channelize, Me = (_ ? _.call(d, g, f) : void 0) ?? v.clone();
1027
988
  this.enrichEvent(Me, u);
1028
- const Oe = gr(
989
+ const Oe = pr(
1029
990
  t.bindingKey,
1030
991
  u
1031
- ), Lt = await this.shouldProcessChild({
992
+ ), _t = await this.shouldProcessChild({
1032
993
  childProcessor: d,
1033
994
  childContract: g,
1034
995
  context: {
@@ -1042,7 +1003,7 @@ class yr {
1042
1003
  eventNode: Me,
1043
1004
  eventId: a,
1044
1005
  checkpointKey: Oe,
1045
- shouldProcess: Lt
1006
+ shouldProcess: _t
1046
1007
  });
1047
1008
  }
1048
1009
  return {
@@ -1064,7 +1025,7 @@ class yr {
1064
1025
  const n = e.getProperties() ?? {}, r = n.meta instanceof p ? n.meta.clone() : new p(), i = r.getProperties() ?? {};
1065
1026
  r.setProperties({
1066
1027
  ...i,
1067
- [mr]: new p().setValue(t)
1028
+ [dr]: new p().setValue(t)
1068
1029
  }), e.setProperties({ ...n, meta: r });
1069
1030
  }
1070
1031
  /**
@@ -1087,38 +1048,38 @@ class yr {
1087
1048
  */
1088
1049
  resolveCheckpoint(e) {
1089
1050
  const t = e.get(D);
1090
- return Er(t) ? t : null;
1051
+ return fr(t) ? t : null;
1091
1052
  }
1092
1053
  }
1093
- const Cr = m(T["Conversation/Actor"])(l.object({
1054
+ const gr = m(T["Conversation/Actor"])(l.object({
1094
1055
  description: l.string().optional(),
1095
1056
  name: l.string().optional()
1096
- })), Mt = m(T["Conversation/Timeline"])(l.object({
1057
+ })), Pt = m(T["Conversation/Timeline"])(l.object({
1097
1058
  description: l.string().optional(),
1098
1059
  name: l.string().optional(),
1099
1060
  timelineId: l.string().optional()
1100
1061
  })), N = m(T["Conversation/Timeline Entry"])(l.object({
1101
- actor: Cr.optional(),
1062
+ actor: gr.optional(),
1102
1063
  description: l.string().optional(),
1103
1064
  message: I().optional(),
1104
1065
  name: l.string().optional(),
1105
1066
  prevEntry: I().optional(),
1106
1067
  source: I().optional(),
1107
- timeline: Mt.optional(),
1068
+ timeline: Pt.optional(),
1108
1069
  timestamp: l.number().optional()
1109
- })), Sr = m(A["MyOS/MyOS Timeline"])(Mt.extend({
1070
+ })), Er = m(A["MyOS/MyOS Timeline"])(Pt.extend({
1110
1071
  accountId: l.string().optional(),
1111
1072
  description: l.string().optional(),
1112
1073
  name: l.string().optional()
1113
1074
  })), Ue = m(A["MyOS/MyOS Timeline Entry"])(N.extend({
1114
1075
  description: l.string().optional(),
1115
1076
  name: l.string().optional(),
1116
- timeline: Sr.optional()
1077
+ timeline: Er.optional()
1117
1078
  }));
1118
1079
  function ze(o, e) {
1119
1080
  return e && o.isTypeOf(e, N, { checkSchemaExtensions: !0 }) ? o.nodeToSchemaOutput(e, N) : null;
1120
1081
  }
1121
- function Ot(o, e, t) {
1082
+ function Rt(o, e, t) {
1122
1083
  const n = ze(o, e), r = ze(o, t);
1123
1084
  if (!n || !r)
1124
1085
  return !0;
@@ -1128,10 +1089,10 @@ function Ot(o, e, t) {
1128
1089
  function Ve(o, e) {
1129
1090
  return o.isTypeOf(e, Ue) ? o.nodeToSchemaOutput(e, Ue) : o.isTypeOf(e, N) ? o.nodeToSchemaOutput(e, N) : null;
1130
1091
  }
1131
- class vr {
1092
+ class yr {
1132
1093
  kind = "channel";
1133
1094
  blueIds = [q["MyOS/MyOS Timeline Channel"]];
1134
- schema = _n;
1095
+ schema = An;
1135
1096
  matches(e, t) {
1136
1097
  const { event: n, blue: r } = t;
1137
1098
  if (!n)
@@ -1148,13 +1109,13 @@ class vr {
1148
1109
  }
1149
1110
  isNewerEvent(e, t, n) {
1150
1111
  const { event: r, blue: i } = t;
1151
- return r ? Ot(i, r, n) : !0;
1112
+ return r ? Rt(i, r, n) : !0;
1152
1113
  }
1153
1114
  }
1154
- class wr {
1115
+ class Cr {
1155
1116
  kind = "channel";
1156
1117
  blueIds = [b["Conversation/Timeline Channel"]];
1157
- schema = Bn;
1118
+ schema = On;
1158
1119
  matches(e, t) {
1159
1120
  const { event: n, blue: r } = t;
1160
1121
  if (!n || !r.isTypeOf(n, N))
@@ -1168,7 +1129,7 @@ class wr {
1168
1129
  }
1169
1130
  isNewerEvent(e, t, n) {
1170
1131
  const { event: r, blue: i } = t;
1171
- return r ? Ot(i, r, n) : !0;
1132
+ return r ? Rt(i, r, n) : !0;
1172
1133
  }
1173
1134
  }
1174
1135
  const He = m(T["Conversation/Trigger Event"])(le.extend({
@@ -1177,7 +1138,7 @@ const He = m(T["Conversation/Trigger Event"])(le.extend({
1177
1138
  name: l.string().optional()
1178
1139
  }));
1179
1140
  function Pe(o) {
1180
- const { context: e, eventNode: t, stepResults: n, contractNode: r } = o, i = Ir(e), s = r != null ? e.blue.nodeToJson(r, "simple") : null, a = r != null ? e.blue.nodeToJson(r, "official") : s;
1141
+ const { context: e, eventNode: t, stepResults: n, contractNode: r } = o, i = vr(e), s = r != null ? e.blue.nodeToJson(r, "simple") : null, a = r != null ? e.blue.nodeToJson(r, "official") : s;
1181
1142
  return {
1182
1143
  event: e.blue.nodeToJson(t, "simple"),
1183
1144
  eventCanonical: e.blue.nodeToJson(t, "official"),
@@ -1187,13 +1148,13 @@ function Pe(o) {
1187
1148
  currentContractCanonical: a
1188
1149
  };
1189
1150
  }
1190
- const br = /* @__PURE__ */ new Set(["blueId", "name", "description", "value"]);
1191
- function Ir(o) {
1151
+ const Sr = /* @__PURE__ */ new Set(["blueId", "name", "description", "value"]);
1152
+ function vr(o) {
1192
1153
  const e = (i) => {
1193
1154
  if (i === "/")
1194
1155
  return !1;
1195
1156
  const s = i.lastIndexOf("/"), a = i.substring(s + 1);
1196
- return br.has(a);
1157
+ return Sr.has(a);
1197
1158
  }, t = (i) => {
1198
1159
  const s = i == null ? "/" : typeof i == "string" ? i : (() => {
1199
1160
  throw new TypeError("document() expects a string pointer");
@@ -1206,7 +1167,7 @@ function Ir(o) {
1206
1167
  }, r = ((i) => n(i, "simple"));
1207
1168
  return r.canonical = (i) => n(i, "official"), r;
1208
1169
  }
1209
- class kr {
1170
+ class wr {
1210
1171
  supportedBlueIds = [
1211
1172
  b["Conversation/Trigger Event"]
1212
1173
  ];
@@ -1216,14 +1177,14 @@ class kr {
1216
1177
  if (!n.blue.isTypeOf(t, He))
1217
1178
  return n.throwFatal("Trigger Event step payload is invalid");
1218
1179
  n.gasMeter().chargeTriggerEventBase();
1219
- const r = await re({
1180
+ const r = await oe({
1220
1181
  evaluator: this.evaluator,
1221
1182
  node: t,
1222
1183
  bindings: Pe(e),
1223
- shouldResolve: ot({
1184
+ shouldResolve: Et({
1224
1185
  include: ["/event", "/event/**"]
1225
1186
  }),
1226
- shouldDescend: Tr(),
1187
+ shouldDescend: br(),
1227
1188
  context: n
1228
1189
  }), s = n.blue.nodeToSchemaOutput(
1229
1190
  r,
@@ -1236,10 +1197,10 @@ class kr {
1236
1197
  n.emitEvent(s.clone());
1237
1198
  }
1238
1199
  }
1239
- function Tr() {
1240
- return (o, e) => o === "/event" || !o.startsWith("/event/") ? !0 : !Pr(e);
1200
+ function br() {
1201
+ return (o, e) => o === "/event" || !o.startsWith("/event/") ? !0 : !Ir(e);
1241
1202
  }
1242
- function Pr(o) {
1203
+ function Ir(o) {
1243
1204
  const e = o.getProperties?.();
1244
1205
  return e ? !!e.contracts : !1;
1245
1206
  }
@@ -1248,14 +1209,14 @@ const Ke = m(T["Conversation/JavaScript Code"])(le.extend({
1248
1209
  description: l.string().optional(),
1249
1210
  name: l.string().optional()
1250
1211
  }));
1251
- class Rr {
1212
+ class kr {
1252
1213
  supportedBlueIds = [
1253
1214
  b["Conversation/JavaScript Code"]
1254
1215
  ];
1255
1216
  evaluator = new ke();
1256
1217
  wasmGasLimit;
1257
1218
  constructor(e = {}) {
1258
- this.wasmGasLimit = e.wasmGasLimit ?? tt;
1219
+ this.wasmGasLimit = e.wasmGasLimit ?? pt;
1259
1220
  }
1260
1221
  async execute(e) {
1261
1222
  const { context: t, stepNode: n } = e, { blue: r } = t;
@@ -1279,7 +1240,7 @@ class Rr {
1279
1240
  });
1280
1241
  return this.handleEvents(c, t), c;
1281
1242
  } catch (c) {
1282
- throw new Xe(s, c);
1243
+ throw new ft(s, c);
1283
1244
  }
1284
1245
  }
1285
1246
  handleEvents(e, t) {
@@ -1293,18 +1254,18 @@ class Rr {
1293
1254
  }
1294
1255
  }
1295
1256
  }
1296
- const Mr = m(P["Core/Json Patch Entry"])(l.object({
1257
+ const Tr = m(P["Core/Json Patch Entry"])(l.object({
1297
1258
  description: l.string().optional(),
1298
1259
  name: l.string().optional(),
1299
1260
  op: l.string().optional(),
1300
1261
  path: l.string().optional(),
1301
1262
  val: I().optional()
1302
1263
  })), We = m(T["Conversation/Update Document"])(le.extend({
1303
- changeset: l.array(Mr).optional(),
1264
+ changeset: l.array(Tr).optional(),
1304
1265
  description: l.string().optional(),
1305
1266
  name: l.string().optional()
1306
1267
  }));
1307
- class Or {
1268
+ class Pr {
1308
1269
  supportedBlueIds = [
1309
1270
  b["Conversation/Update Document"]
1310
1271
  ];
@@ -1313,11 +1274,11 @@ class Or {
1313
1274
  const { context: t, stepNode: n } = e, { blue: r } = t;
1314
1275
  if (!r.isTypeOf(n, We))
1315
1276
  return t.throwFatal("Update Document step payload is invalid");
1316
- const i = await re({
1277
+ const i = await oe({
1317
1278
  evaluator: this.evaluator,
1318
1279
  node: n,
1319
1280
  bindings: Pe(e),
1320
- shouldResolve: ot({
1281
+ shouldResolve: Et({
1321
1282
  include: ["/changeset", "/changeset/**"]
1322
1283
  }),
1323
1284
  context: t
@@ -1352,11 +1313,11 @@ class Or {
1352
1313
  }
1353
1314
  }
1354
1315
  const Re = [
1316
+ new wr(),
1355
1317
  new kr(),
1356
- new Rr(),
1357
- new Or()
1318
+ new Pr()
1358
1319
  ];
1359
- class Nt {
1320
+ class Mt {
1360
1321
  executorIndex;
1361
1322
  constructor(e = Re) {
1362
1323
  const t = /* @__PURE__ */ new Map();
@@ -1404,15 +1365,15 @@ class Nt {
1404
1365
  return n && typeof n == "string" && n.length > 0 ? n : `Step${t + 1}`;
1405
1366
  }
1406
1367
  }
1407
- class Nr {
1368
+ class Rr {
1408
1369
  kind = "handler";
1409
1370
  blueIds = [
1410
1371
  b["Conversation/Sequential Workflow"]
1411
1372
  ];
1412
- schema = lr;
1373
+ schema = sr;
1413
1374
  runner;
1414
1375
  constructor(e = Re) {
1415
- this.runner = new Nt(e);
1376
+ this.runner = new Mt(e);
1416
1377
  }
1417
1378
  async matches(e, t) {
1418
1379
  const n = t.event();
@@ -1428,15 +1389,15 @@ class Nr {
1428
1389
  });
1429
1390
  }
1430
1391
  }
1431
- class Ar {
1392
+ class Mr {
1432
1393
  kind = "marker";
1433
1394
  blueIds = [S["Core/Marker"]];
1434
1395
  schema = M;
1435
1396
  }
1436
- class Br {
1397
+ class Or {
1437
1398
  kind = "marker";
1438
1399
  blueIds = [b["Conversation/Operation"]];
1439
- schema = Qn;
1400
+ schema = Gn;
1440
1401
  }
1441
1402
  const Ce = m(T["Conversation/Operation Request"])(l.object({
1442
1403
  allowNewerVersion: l.boolean().optional(),
@@ -1446,7 +1407,7 @@ const Ce = m(T["Conversation/Operation Request"])(l.object({
1446
1407
  operation: l.string().optional(),
1447
1408
  request: I().optional()
1448
1409
  }));
1449
- function At(o) {
1410
+ function Ot(o) {
1450
1411
  const e = o.channel;
1451
1412
  if (typeof e == "string") {
1452
1413
  const t = e.trim();
@@ -1455,14 +1416,14 @@ function At(o) {
1455
1416
  }
1456
1417
  return null;
1457
1418
  }
1458
- function Dr(o, e) {
1419
+ function Nr(o, e) {
1459
1420
  const t = o.getProperties()?.document;
1460
1421
  if (!(t instanceof p))
1461
1422
  return null;
1462
1423
  const n = t.getReferenceBlueId();
1463
1424
  return n || e.blue.calculateBlueIdSync(t);
1464
1425
  }
1465
- function _r(o, e) {
1426
+ function Ar(o, e) {
1466
1427
  if (e.isTypeOf(o, Ce, {
1467
1428
  checkSchemaExtensions: !0
1468
1429
  }))
@@ -1478,11 +1439,11 @@ function _r(o, e) {
1478
1439
  }
1479
1440
  return null;
1480
1441
  }
1481
- function Lr(o, e, t, n) {
1442
+ function Br(o, e, t, n) {
1482
1443
  const { blue: r } = n, i = o.operation;
1483
1444
  return !(!i || t.operation !== i || o.event && !r.isTypeOfNode(e, o.event));
1484
1445
  }
1485
- function xr(o, e) {
1446
+ function Dr(o, e) {
1486
1447
  const t = o.operation;
1487
1448
  if (!t)
1488
1449
  return null;
@@ -1494,13 +1455,13 @@ function xr(o, e) {
1494
1455
  const i = e.blue.nodeToSchemaOutput(
1495
1456
  r,
1496
1457
  Z
1497
- ), s = At(i);
1458
+ ), s = Ot(i);
1498
1459
  return { operationNode: r, operation: i, channelKey: s };
1499
1460
  }
1500
- function Fr(o, e) {
1461
+ function _r(o, e) {
1501
1462
  return !(o && e && o !== e);
1502
1463
  }
1503
- function $r(o, e, t) {
1464
+ function Lr(o, e, t) {
1504
1465
  const n = o.getProperties()?.request, r = e.getProperties()?.request;
1505
1466
  if (!(n instanceof p) || !(r instanceof p))
1506
1467
  return !1;
@@ -1523,10 +1484,10 @@ function qe(o, e, t) {
1523
1484
  const n = e.getType()?.getBlueId();
1524
1485
  return typeof n == "string" && n.length > 0 && t.isTypeOfBlueId(o, n);
1525
1486
  }
1526
- function Ur(o, e, t) {
1487
+ function xr(o, e, t) {
1527
1488
  if (!o || o.allowNewerVersion !== !1)
1528
1489
  return !0;
1529
- const n = Dr(e, t);
1490
+ const n = Nr(e, t);
1530
1491
  if (!n)
1531
1492
  return !0;
1532
1493
  const r = t.resolvePointer("/"), i = t.documentAt(r);
@@ -1535,35 +1496,35 @@ function Ur(o, e, t) {
1535
1496
  const c = (i.getContracts()?.initialized ?? null)?.get("/documentId") ?? null, u = typeof c == "string" && c.length > 0 ? c : t.blue.calculateBlueIdSync(i);
1536
1497
  return n === u;
1537
1498
  }
1538
- const zr = b["Conversation/Actor Policy"], Vr = b["Conversation/Principal Actor"], Hr = b["Conversation/Agent Actor"], Kr = b["Conversation/Browser Session"], Wr = b["Conversation/API Call"], qr = b["Conversation/Document Request"];
1539
- function Gr(o, e, t) {
1540
- const r = jr(t)?.operations?.[o];
1499
+ const Fr = b["Conversation/Actor Policy"], $r = b["Conversation/Principal Actor"], Ur = b["Conversation/Agent Actor"], zr = b["Conversation/Browser Session"], Vr = b["Conversation/API Call"], Hr = b["Conversation/Document Request"];
1500
+ function Kr(o, e, t) {
1501
+ const r = Wr(t)?.operations?.[o];
1541
1502
  if (!r)
1542
1503
  return !0;
1543
- const i = Jr(e, t), s = Qr(e, t);
1544
- return Yr(r, i, s);
1504
+ const i = qr(e, t), s = Gr(e, t);
1505
+ return jr(r, i, s);
1545
1506
  }
1546
- function jr(o) {
1507
+ function Wr(o) {
1547
1508
  const e = o.resolvePointer("/contracts"), n = o.documentAt(e)?.getProperties();
1548
1509
  if (!n)
1549
1510
  return null;
1550
1511
  for (const r of Object.values(n))
1551
- if (r instanceof p && o.blue.isTypeOfBlueId(r, zr))
1512
+ if (r instanceof p && o.blue.isTypeOfBlueId(r, Fr))
1552
1513
  return o.blue.nodeToSchemaOutput(
1553
1514
  r,
1554
- Tt
1515
+ It
1555
1516
  );
1556
1517
  return null;
1557
1518
  }
1558
- function Jr(o, e) {
1559
- const t = Bt(o, "actor", e);
1560
- return t ? e.blue.isTypeOfBlueId(t, Hr) ? "agent" : e.blue.isTypeOfBlueId(t, Vr) ? "principal" : null : null;
1519
+ function qr(o, e) {
1520
+ const t = Nt(o, "actor", e);
1521
+ return t ? e.blue.isTypeOfBlueId(t, Ur) ? "agent" : e.blue.isTypeOfBlueId(t, $r) ? "principal" : null : null;
1561
1522
  }
1562
- function Qr(o, e) {
1563
- const t = Bt(o, "source", e);
1564
- return t ? e.blue.isTypeOfBlueId(t, Kr) ? "browserSession" : e.blue.isTypeOfBlueId(t, Wr) ? "apiCall" : e.blue.isTypeOfBlueId(t, qr) ? "documentRequest" : null : null;
1523
+ function Gr(o, e) {
1524
+ const t = Nt(o, "source", e);
1525
+ return t ? e.blue.isTypeOfBlueId(t, zr) ? "browserSession" : e.blue.isTypeOfBlueId(t, Vr) ? "apiCall" : e.blue.isTypeOfBlueId(t, Hr) ? "documentRequest" : null : null;
1565
1526
  }
1566
- function Bt(o, e, t) {
1527
+ function Nt(o, e, t) {
1567
1528
  if (!t.blue.isTypeOf(o, N, {
1568
1529
  checkSchemaExtensions: !0
1569
1530
  }))
@@ -1571,18 +1532,18 @@ function Bt(o, e, t) {
1571
1532
  const n = o.getProperties()?.[e];
1572
1533
  return n instanceof p ? n : null;
1573
1534
  }
1574
- function Yr(o, e, t) {
1535
+ function jr(o, e, t) {
1575
1536
  return !(o.requiresActor && (!e || o.requiresActor !== "any" && o.requiresActor !== e) || o.requiresSource && (!t || o.requiresSource !== t) || o.excludeSource && (!t || o.excludeSource === t));
1576
1537
  }
1577
- class Zr {
1538
+ class Jr {
1578
1539
  kind = "handler";
1579
1540
  blueIds = [
1580
1541
  b["Conversation/Sequential Workflow Operation"]
1581
1542
  ];
1582
- schema = hr;
1543
+ schema = cr;
1583
1544
  runner;
1584
1545
  constructor(e = Re) {
1585
- this.runner = new Nt(e);
1546
+ this.runner = new Mt(e);
1586
1547
  }
1587
1548
  deriveChannel(e, t) {
1588
1549
  const n = e.operation;
@@ -1594,13 +1555,13 @@ class Zr {
1594
1555
  }))
1595
1556
  return null;
1596
1557
  const i = t.blue.nodeToSchemaOutput(r.node, Z);
1597
- return i ? At(i) : null;
1558
+ return i ? Ot(i) : null;
1598
1559
  }
1599
1560
  async matches(e, t) {
1600
1561
  const n = t.event();
1601
1562
  if (!n)
1602
1563
  return !1;
1603
- const r = _r(
1564
+ const r = Ar(
1604
1565
  n,
1605
1566
  t.blue
1606
1567
  );
@@ -1610,20 +1571,20 @@ class Zr {
1610
1571
  r,
1611
1572
  Ce
1612
1573
  );
1613
- if (!i || !Lr(e, n, i, t))
1574
+ if (!i || !Br(e, n, i, t))
1614
1575
  return !1;
1615
- const s = xr(e, t);
1576
+ const s = Dr(e, t);
1616
1577
  if (!s)
1617
1578
  return !1;
1618
1579
  const a = typeof e.channel == "string" ? e.channel.trim() : "", c = a.length > 0 ? a : null;
1619
- if (!Fr(s.channelKey, c) || !$r(
1580
+ if (!_r(s.channelKey, c) || !Lr(
1620
1581
  r,
1621
1582
  s.operationNode,
1622
1583
  t.blue
1623
- ) || i?.allowNewerVersion === !1 && !Ur(i, r, t))
1584
+ ) || i?.allowNewerVersion === !1 && !xr(i, r, t))
1624
1585
  return !1;
1625
1586
  const u = e.operation;
1626
- return !(!u || !Gr(u, n, t));
1587
+ return !(!u || !Kr(u, n, t));
1627
1588
  }
1628
1589
  async execute(e, t, n) {
1629
1590
  const r = t.event();
@@ -1641,11 +1602,11 @@ class ue {
1641
1602
  }
1642
1603
  static create() {
1643
1604
  return new ue(
1644
- new pr()
1605
+ new ur()
1645
1606
  );
1646
1607
  }
1647
1608
  registerDefaults() {
1648
- return this.registry.register(new yr()), this.registry.register(new vr()), this.registry.register(new wr()), this.registry.register(new Nr()), this.registry.register(new fr()), this.registry.register(new Br()), this.registry.register(new Ar()), this.registry.register(new Zr()), this;
1609
+ return this.registry.register(new mr()), this.registry.register(new yr()), this.registry.register(new Cr()), this.registry.register(new Rr()), this.registry.register(new hr()), this.registry.register(new Or()), this.registry.register(new Mr()), this.registry.register(new Jr()), this;
1649
1610
  }
1650
1611
  register(e) {
1651
1612
  return this.registry.register(e), this;
@@ -1655,10 +1616,10 @@ class ue {
1655
1616
  }
1656
1617
  }
1657
1618
  const Se = S["Core/Channel Event Checkpoint"];
1658
- function Dt(o) {
1619
+ function At(o) {
1659
1620
  return typeof o.order == "number" ? o.order : 0;
1660
1621
  }
1661
- class Xr {
1622
+ class Qr {
1662
1623
  constructor(e, t, n, r) {
1663
1624
  this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n, this.bindingNode = r;
1664
1625
  }
@@ -1675,10 +1636,10 @@ class Xr {
1675
1636
  return this.bindingNode.clone();
1676
1637
  }
1677
1638
  order() {
1678
- return Dt(this.bindingContract);
1639
+ return At(this.bindingContract);
1679
1640
  }
1680
1641
  }
1681
- class eo {
1642
+ class Yr {
1682
1643
  constructor(e, t, n, r) {
1683
1644
  this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n, this.bindingNode = r;
1684
1645
  }
@@ -1695,7 +1656,7 @@ class eo {
1695
1656
  return this.bindingNode.clone();
1696
1657
  }
1697
1658
  order() {
1698
- return Dt(this.bindingContract);
1659
+ return At(this.bindingContract);
1699
1660
  }
1700
1661
  }
1701
1662
  class W {
@@ -1713,7 +1674,7 @@ class W {
1713
1674
  );
1714
1675
  }
1715
1676
  static builder() {
1716
- return new to();
1677
+ return new Zr();
1717
1678
  }
1718
1679
  static empty() {
1719
1680
  return W.builder().build();
@@ -1755,7 +1716,7 @@ class W {
1755
1716
  handlersFor(e) {
1756
1717
  const t = this.handlersByChannel.get(e);
1757
1718
  return !t || t.length === 0 ? [] : [...t].map(
1758
- (n) => new eo(
1719
+ (n) => new Yr(
1759
1720
  n.key,
1760
1721
  n.contract,
1761
1722
  n.blueId,
@@ -1777,7 +1738,7 @@ class W {
1777
1738
  }
1778
1739
  channelsOfType(...e) {
1779
1740
  const t = e.length > 0 ? new Set(e) : null, n = Array.from(this.channels.values()).filter((r) => !t || t.has(r.blueId)).map(
1780
- (r) => new Xr(
1741
+ (r) => new Qr(
1781
1742
  r.key,
1782
1743
  r.contract,
1783
1744
  r.blueId,
@@ -1790,7 +1751,7 @@ class W {
1790
1751
  }), n;
1791
1752
  }
1792
1753
  }
1793
- class to {
1754
+ class Zr {
1794
1755
  channels = /* @__PURE__ */ new Map();
1795
1756
  handlersByChannel = /* @__PURE__ */ new Map();
1796
1757
  markerStore = /* @__PURE__ */ new Map();
@@ -1858,7 +1819,7 @@ function te(o, e, t) {
1858
1819
  return r;
1859
1820
  return null;
1860
1821
  }
1861
- class no {
1822
+ class Xr {
1862
1823
  constructor(e, t, n) {
1863
1824
  this.blue = e, this.registry = t, this.builtinChannelSchemas = n;
1864
1825
  }
@@ -1969,11 +1930,11 @@ class F extends Error {
1969
1930
  super(e ?? "MustUnderstand failure"), this.name = "MustUnderstandFailure";
1970
1931
  }
1971
1932
  }
1972
- const ro = b["Conversation/Composite Timeline Channel"];
1973
- function oo(o) {
1933
+ const eo = b["Conversation/Composite Timeline Channel"];
1934
+ function to(o) {
1974
1935
  const { compositeKey: e, contract: t, scopeContracts: n, blueId: r, blue: i } = o, s = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), c = [], u = /* @__PURE__ */ new Map([
1975
1936
  [e, t]
1976
- ]), h = (f) => i.isTypeOfBlueId(f.node, ro), d = (f) => {
1937
+ ]), h = (f) => i.isTypeOfBlueId(f.node, eo), d = (f) => {
1977
1938
  if (u.has(f))
1978
1939
  return u.get(f) ?? null;
1979
1940
  const g = n.get(f);
@@ -1982,11 +1943,11 @@ function oo(o) {
1982
1943
  try {
1983
1944
  const y = i.nodeToSchemaOutput(
1984
1945
  g.node,
1985
- bt
1946
+ vt
1986
1947
  );
1987
1948
  return u.set(f, y), y;
1988
1949
  } catch (y) {
1989
- if (io(y))
1950
+ if (no(y))
1990
1951
  throw new E(
1991
1952
  "Failed to parse channel contract",
1992
1953
  C.invalidContract(
@@ -2027,63 +1988,63 @@ function oo(o) {
2027
1988
  };
2028
1989
  v(e);
2029
1990
  }
2030
- function io(o) {
1991
+ function no(o) {
2031
1992
  return o instanceof ve;
2032
1993
  }
2033
- const so = S["Core/Document Update Channel"], ao = S["Core/Embedded Node Channel"], co = S["Core/Lifecycle Event Channel"], lo = S["Core/Triggered Event Channel"], Ge = S["Core/Process Embedded"], uo = S["Core/Processing Initialized Marker"], ho = S["Core/Processing Terminated Marker"], po = S["Core/Channel Event Checkpoint"], fo = q["MyOS/Document Anchors"], mo = q["MyOS/Document Links"], go = q["MyOS/MyOS Participants Orchestration"], Eo = q["MyOS/MyOS Session Interaction"], yo = q["MyOS/MyOS Worker Agency"], Co = b["Conversation/Composite Timeline Channel"], pe = /* @__PURE__ */ new Map([
1994
+ const ro = S["Core/Document Update Channel"], oo = S["Core/Embedded Node Channel"], io = S["Core/Lifecycle Event Channel"], so = S["Core/Triggered Event Channel"], Ge = S["Core/Process Embedded"], ao = S["Core/Processing Initialized Marker"], co = S["Core/Processing Terminated Marker"], lo = S["Core/Channel Event Checkpoint"], uo = q["MyOS/Document Anchors"], ho = q["MyOS/Document Links"], po = q["MyOS/MyOS Participants Orchestration"], fo = q["MyOS/MyOS Session Interaction"], mo = q["MyOS/MyOS Worker Agency"], go = b["Conversation/Composite Timeline Channel"], pe = /* @__PURE__ */ new Map([
2034
1995
  [
2035
- so,
2036
- Tn
1996
+ ro,
1997
+ bn
2037
1998
  ],
1999
+ [
2000
+ oo,
2001
+ kn
2002
+ ],
2003
+ [
2004
+ io,
2005
+ Pn
2006
+ ],
2007
+ [
2008
+ so,
2009
+ Mn
2010
+ ]
2011
+ ]), Eo = /* @__PURE__ */ new Map([
2038
2012
  [
2039
2013
  ao,
2040
- Rn
2014
+ Vn
2041
2015
  ],
2042
2016
  [
2043
2017
  co,
2044
- On
2018
+ qn
2045
2019
  ],
2046
2020
  [
2047
2021
  lo,
2048
- An
2049
- ]
2050
- ]), So = /* @__PURE__ */ new Map([
2022
+ Un
2023
+ ],
2051
2024
  [
2052
2025
  uo,
2053
- Wn
2026
+ Qn
2054
2027
  ],
2055
2028
  [
2056
2029
  ho,
2057
- Jn
2030
+ Xn
2058
2031
  ],
2059
2032
  [
2060
2033
  po,
2061
- Hn
2034
+ tr
2062
2035
  ],
2063
2036
  [
2064
2037
  fo,
2065
- Xn
2038
+ rr
2066
2039
  ],
2067
2040
  [
2068
2041
  mo,
2069
- nr
2070
- ],
2071
- [
2072
- go,
2073
- or
2074
- ],
2075
- [
2076
- Eo,
2077
- sr
2078
- ],
2079
- [
2080
- yo,
2081
- cr
2042
+ ir
2082
2043
  ]
2083
2044
  ]);
2084
- class vo {
2045
+ class yo {
2085
2046
  constructor(e, t) {
2086
- this.registry = e, this.blue = t, this.handlerRegistration = new no(
2047
+ this.registry = e, this.blue = t, this.handlerRegistration = new Xr(
2087
2048
  this.blue,
2088
2049
  this.registry,
2089
2050
  pe
@@ -2123,7 +2084,7 @@ class vo {
2123
2084
  const s = te(
2124
2085
  this.blue,
2125
2086
  n,
2126
- So
2087
+ Eo
2127
2088
  );
2128
2089
  if (s) {
2129
2090
  this.handleMarker(
@@ -2194,7 +2155,7 @@ class vo {
2194
2155
  );
2195
2156
  return;
2196
2157
  }
2197
- throw ht(i) ? new E(
2158
+ throw rt(i) ? new E(
2198
2159
  "Built-in processor-managed channel is missing schema registration",
2199
2160
  C.invalidContract(
2200
2161
  i,
@@ -2207,7 +2168,7 @@ class vo {
2207
2168
  try {
2208
2169
  const r = this.blue.nodeToSchemaOutput(
2209
2170
  n,
2210
- Gn
2171
+ Kn
2211
2172
  );
2212
2173
  e.setEmbedded(r);
2213
2174
  } catch (r) {
@@ -2233,7 +2194,7 @@ class vo {
2233
2194
  n,
2234
2195
  r
2235
2196
  );
2236
- this.blue.isTypeOfBlueId(n, Co) && this.validateCompositeChannel(
2197
+ this.blue.isTypeOfBlueId(n, go) && this.validateCompositeChannel(
2237
2198
  t,
2238
2199
  a,
2239
2200
  s,
@@ -2283,7 +2244,7 @@ class vo {
2283
2244
  )
2284
2245
  );
2285
2246
  }
2286
- oo({
2247
+ to({
2287
2248
  compositeKey: e,
2288
2249
  contract: t,
2289
2250
  scopeContracts: n,
@@ -2298,7 +2259,7 @@ class vo {
2298
2259
  handleMarker(e, t, n, r, i, s) {
2299
2260
  try {
2300
2261
  const a = b["Conversation/Actor Policy"];
2301
- this.blue.isTypeOfBlueId(n, a) && (this.assertSingleActorPolicyMarker(t, s, i), zn(n));
2262
+ this.blue.isTypeOfBlueId(n, a) && (this.assertSingleActorPolicyMarker(t, s, i), Fn(n));
2302
2263
  const c = this.blue.nodeToSchemaOutput(
2303
2264
  n,
2304
2265
  r
@@ -2307,7 +2268,7 @@ class vo {
2307
2268
  } catch (a) {
2308
2269
  if (a instanceof E || a instanceof F)
2309
2270
  throw a;
2310
- if (a instanceof Pt)
2271
+ if (a instanceof kt)
2311
2272
  throw new E(
2312
2273
  a.message,
2313
2274
  C.invalidContract(i, a.message, t, a)
@@ -2359,15 +2320,15 @@ class vo {
2359
2320
  function fe(o) {
2360
2321
  return o instanceof ve;
2361
2322
  }
2362
- const wo = S["Core/Channel Event Checkpoint"];
2363
- function bo(o) {
2323
+ const Co = S["Core/Channel Event Checkpoint"];
2324
+ function So(o) {
2364
2325
  return o.jsonValueToNode({
2365
- type: { blueId: wo },
2326
+ type: { blueId: Co },
2366
2327
  lastEvents: {},
2367
2328
  lastSignatures: {}
2368
2329
  });
2369
2330
  }
2370
- function Io() {
2331
+ function vo() {
2371
2332
  return {
2372
2333
  lastEvents: {},
2373
2334
  lastSignatures: {}
@@ -2376,7 +2337,7 @@ function Io() {
2376
2337
  function je(o) {
2377
2338
  return o != null && Object.prototype.hasOwnProperty.call(o, "lastEvents") && Object.prototype.hasOwnProperty.call(o, "lastSignatures");
2378
2339
  }
2379
- class ko {
2340
+ class wo {
2380
2341
  constructor(e, t, n, r, i) {
2381
2342
  this.markerKey = e, this.checkpoint = t, this.channelKey = n, this.lastEventNode = r, this.lastEventSignature = i;
2382
2343
  }
@@ -2386,15 +2347,15 @@ class ko {
2386
2347
  return e != null && e === this.lastEventSignature;
2387
2348
  }
2388
2349
  }
2389
- class To {
2350
+ class bo {
2390
2351
  constructor(e, t) {
2391
2352
  this.runtime = e, this.signatureFn = t;
2392
2353
  }
2393
2354
  ensureCheckpointMarker(e, t) {
2394
- const n = t.marker(D), r = k(e, pt);
2355
+ const n = t.marker(D), r = k(e, it);
2395
2356
  if (!n) {
2396
- const i = bo(this.runtime.blue());
2397
- this.runtime.directWrite(r, i), t.registerCheckpointMarker(Io());
2357
+ const i = So(this.runtime.blue());
2358
+ this.runtime.directWrite(r, i), t.registerCheckpointMarker(vo());
2398
2359
  return;
2399
2360
  }
2400
2361
  if (!je(n))
@@ -2407,7 +2368,7 @@ class To {
2407
2368
  if (!je(r))
2408
2369
  continue;
2409
2370
  const s = (r.lastEvents?.[t] ?? null)?.clone() ?? null, c = r.lastSignatures?.[t] ?? null ?? this.signatureFn(s);
2410
- return new ko(
2371
+ return new wo(
2411
2372
  n,
2412
2373
  r,
2413
2374
  t,
@@ -2425,17 +2386,17 @@ class To {
2425
2386
  return;
2426
2387
  const s = k(
2427
2388
  e,
2428
- gt(n.markerKey, n.channelKey)
2389
+ ct(n.markerKey, n.channelKey)
2429
2390
  ), a = i?.clone() ?? null;
2430
2391
  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;
2431
2392
  const c = k(
2432
2393
  e,
2433
- Et(n.markerKey, n.channelKey)
2394
+ lt(n.markerKey, n.channelKey)
2434
2395
  ), u = r == null ? null : new p().setValue(r);
2435
2396
  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;
2436
2397
  }
2437
2398
  }
2438
- class Po {
2399
+ class Io {
2439
2400
  constructor(e, t, n) {
2440
2401
  this.runtime = e, this.checkpointManager = t, this.deps = n;
2441
2402
  }
@@ -2562,7 +2523,7 @@ class Po {
2562
2523
  );
2563
2524
  }
2564
2525
  }
2565
- function Ro(o, e) {
2526
+ function ko(o, e) {
2566
2527
  return e.isResolved() ? o.createResolvedNode(e) : o.resolve(e);
2567
2528
  }
2568
2529
  class K extends E {
@@ -2575,8 +2536,8 @@ class V extends Error {
2575
2536
  super(e), this.name = "BoundaryViolationException";
2576
2537
  }
2577
2538
  }
2578
- const Mo = S["Core/Document Update Channel"], Oo = S["Core/Embedded Node Channel"], No = S["Core/Triggered Event Channel"], Ao = S["Core/Lifecycle Event Channel"], Je = S["Core/Processing Initialized Marker"], Bo = S["Core/Document Processing Initiated"];
2579
- class Do {
2539
+ const To = S["Core/Document Update Channel"], Po = S["Core/Embedded Node Channel"], Ro = S["Core/Triggered Event Channel"], Mo = S["Core/Lifecycle Event Channel"], Je = S["Core/Processing Initialized Marker"], Oo = S["Core/Document Processing Initiated"];
2540
+ class No {
2580
2541
  runtime;
2581
2542
  contractLoader;
2582
2543
  channelRunner;
@@ -2635,7 +2596,7 @@ class Do {
2635
2596
  }
2636
2597
  }
2637
2598
  async processExternalEvent(e, t) {
2638
- const n = Ro(this.runtime.blue(), t);
2599
+ const n = ko(this.runtime.blue(), t);
2639
2600
  await this.processPreparedExternalEvent(e, n);
2640
2601
  }
2641
2602
  async processPreparedExternalEvent(e, t) {
@@ -2702,7 +2663,7 @@ class Do {
2702
2663
  continue;
2703
2664
  const c = this.createDocumentUpdateEvent(i, s), u = this.channelsMatching(
2704
2665
  a,
2705
- Mo
2666
+ To
2706
2667
  );
2707
2668
  for (const h of u) {
2708
2669
  const d = h.contract();
@@ -2740,7 +2701,7 @@ class Do {
2740
2701
  return;
2741
2702
  const i = this.channelsMatching(
2742
2703
  t,
2743
- Ao
2704
+ Mo
2744
2705
  );
2745
2706
  for (const s of i)
2746
2707
  if (await this.channelRunner.runHandlers(
@@ -2802,7 +2763,7 @@ class Do {
2802
2763
  }
2803
2764
  }
2804
2765
  async addInitializationMarker(e, t) {
2805
- const n = new p().setType(new p().setBlueId(Je)).addProperty("documentId", new p().setValue(t)), r = e.resolvePointer(ye);
2766
+ const n = new p().setType(new p().setBlueId(Je)).addProperty("documentId", new p().setValue(t)), r = e.resolvePointer(Ee);
2806
2767
  await e.applyPatch({
2807
2768
  op: "ADD",
2808
2769
  path: r,
@@ -2817,7 +2778,7 @@ class Do {
2817
2778
  return;
2818
2779
  const n = this.channelsMatching(
2819
2780
  t,
2820
- Oo
2781
+ Po
2821
2782
  );
2822
2783
  if (n.length !== 0)
2823
2784
  for (const r of t.embeddedPaths()) {
@@ -2843,7 +2804,7 @@ class Do {
2843
2804
  return;
2844
2805
  const n = this.runtime.scope(e), r = this.channelsMatching(
2845
2806
  t,
2846
- No
2807
+ Ro
2847
2808
  );
2848
2809
  if (r.length === 0) {
2849
2810
  n.clearTriggered();
@@ -2931,7 +2892,7 @@ class Do {
2931
2892
  }
2932
2893
  }
2933
2894
  hasInitializationMarker(e) {
2934
- const t = k(e, ye), n = this.nodeAt(t);
2895
+ const t = k(e, Ee), n = this.nodeAt(t);
2935
2896
  if (!n)
2936
2897
  return !1;
2937
2898
  if (!(n instanceof p)) {
@@ -2945,7 +2906,7 @@ class Do {
2945
2906
  return !0;
2946
2907
  }
2947
2908
  createLifecycleEvent(e) {
2948
- return new p().setType(new p().setBlueId(Bo)).setProperties({
2909
+ return new p().setType(new p().setBlueId(Oo)).setProperties({
2949
2910
  type: new p().setValue("Core/Document Processing Initiated"),
2950
2911
  documentId: new p().setValue(e)
2951
2912
  });
@@ -2958,19 +2919,19 @@ class ie extends Error {
2958
2919
  ), this.fatal = e, this.name = "RunTerminationError";
2959
2920
  }
2960
2921
  }
2961
- const _o = S["Core/Processing Terminated Marker"], Lo = S["Core/Document Processing Terminated"];
2962
- class xo {
2922
+ const Ao = S["Core/Processing Terminated Marker"], Bo = S["Core/Document Processing Terminated"];
2923
+ class Do {
2963
2924
  constructor(e) {
2964
2925
  this.runtime = e;
2965
2926
  }
2966
2927
  async terminateScope(e, t, n, r, i) {
2967
2928
  e.recordPendingTermination(t, r, i ?? null);
2968
- const s = e.normalizeScope(t), a = k(s, dt);
2929
+ const s = e.normalizeScope(t), a = k(s, ot);
2969
2930
  this.runtime.directWrite(
2970
2931
  a,
2971
- Fo(this.runtime.blue(), r, i)
2932
+ _o(this.runtime.blue(), r, i)
2972
2933
  ), this.runtime.gasMeter().chargeTerminationMarker();
2973
- const c = n ?? e.bundleForScope(s) ?? null, u = $o(r, i);
2934
+ const c = n ?? e.bundleForScope(s) ?? null, u = Lo(r, i);
2974
2935
  if (await e.deliverLifecycle(
2975
2936
  s,
2976
2937
  c,
@@ -2982,27 +2943,27 @@ class xo {
2982
2943
  throw this.runtime.markRunTerminated(), new ie(!1);
2983
2944
  }
2984
2945
  }
2985
- function Fo(o, e, t) {
2986
- return Uo(o, {
2987
- type: { blueId: _o },
2946
+ function _o(o, e, t) {
2947
+ return xo(o, {
2948
+ type: { blueId: Ao },
2988
2949
  cause: e === "GRACEFUL" ? "graceful" : "fatal",
2989
2950
  ...t ? { reason: t } : {}
2990
2951
  });
2991
2952
  }
2992
- function $o(o, e) {
2953
+ function Lo(o, e) {
2993
2954
  const t = new p().setType(
2994
- new p().setBlueId(Lo)
2955
+ new p().setBlueId(Bo)
2995
2956
  );
2996
2957
  return t.addProperty(
2997
2958
  "cause",
2998
2959
  new p().setValue(o === "GRACEFUL" ? "graceful" : "fatal")
2999
2960
  ), e && t.addProperty("reason", new p().setValue(e)), t;
3000
2961
  }
3001
- function Uo(o, e) {
2962
+ function xo(o, e) {
3002
2963
  return o.jsonValueToNode(e);
3003
2964
  }
3004
2965
  const Y = "-";
3005
- class zo {
2966
+ class Fo {
3006
2967
  constructor(e) {
3007
2968
  this.document = e;
3008
2969
  }
@@ -3026,7 +2987,7 @@ class zo {
3026
2987
  after: a,
3027
2988
  op: t.op.toLowerCase(),
3028
2989
  originScope: n,
3029
- cascadeScopes: Vo(n)
2990
+ cascadeScopes: $o(n)
3030
2991
  };
3031
2992
  }
3032
2993
  directWrite(e, t) {
@@ -3227,7 +3188,7 @@ class zo {
3227
3188
  }
3228
3189
  }
3229
3190
  }
3230
- function Vo(o) {
3191
+ function $o(o) {
3231
3192
  const e = [];
3232
3193
  let t = o;
3233
3194
  for (; e.push(t), t !== "/"; ) {
@@ -3240,22 +3201,22 @@ function Qe(o, e, t, n) {
3240
3201
  try {
3241
3202
  if (e.length === 0)
3242
3203
  return o.clone();
3243
- const r = Ho(o, e, t, n);
3204
+ const r = Uo(o, e, t, n);
3244
3205
  return r ? r.clone() : null;
3245
3206
  } catch {
3246
3207
  return null;
3247
3208
  }
3248
3209
  }
3249
- function Ho(o, e, t, n) {
3210
+ function Uo(o, e, t, n) {
3250
3211
  let r = o;
3251
3212
  for (let i = 0; i < e.length; i += 1) {
3252
3213
  const s = e[i] ?? "", a = i === e.length - 1;
3253
- if (r = Ko(r, s, a, t, n), !r)
3214
+ if (r = zo(r, s, a, t, n), !r)
3254
3215
  return null;
3255
3216
  }
3256
3217
  return r;
3257
3218
  }
3258
- function Ko(o, e, t, n, r) {
3219
+ function zo(o, e, t, n, r) {
3259
3220
  if (!o)
3260
3221
  return null;
3261
3222
  const i = o.getItems();
@@ -3316,7 +3277,7 @@ function H(o) {
3316
3277
  function Q(o) {
3317
3278
  return o == null ? new p().setValue(null) : o.clone();
3318
3279
  }
3319
- class Wo {
3280
+ class Vo {
3320
3281
  constructor(e) {
3321
3282
  this.path = e;
3322
3283
  }
@@ -3378,7 +3339,7 @@ class Wo {
3378
3339
  return this.cutOff;
3379
3340
  }
3380
3341
  }
3381
- class qo {
3342
+ class Ho {
3382
3343
  scopesMap = /* @__PURE__ */ new Map();
3383
3344
  rootEmissionList = [];
3384
3345
  scopes() {
@@ -3386,7 +3347,7 @@ class qo {
3386
3347
  }
3387
3348
  scope(e) {
3388
3349
  let t = this.scopesMap.get(e);
3389
- return t || (t = new Wo(e), this.scopesMap.set(e, t)), t;
3350
+ return t || (t = new Vo(e), this.scopesMap.set(e, t)), t;
3390
3351
  }
3391
3352
  existingScope(e) {
3392
3353
  return this.scopesMap.get(e);
@@ -3404,33 +3365,33 @@ class qo {
3404
3365
  this.scopesMap.delete(e);
3405
3366
  }
3406
3367
  }
3407
- function _t(o) {
3368
+ function Bt(o) {
3408
3369
  return Math.floor((o + 99) / 100);
3409
3370
  }
3410
- function Go(o) {
3371
+ function Ko(o) {
3411
3372
  const e = R(o);
3412
3373
  return e === "/" ? 0 : e.split("/").length - 1;
3413
3374
  }
3414
- function jo(o) {
3375
+ function Wo(o) {
3415
3376
  return 40 + 5 * Math.max(0, o);
3416
3377
  }
3417
- function Jo(o, e) {
3418
- return 8 + Go(o) + _t(e);
3378
+ function qo(o, e) {
3379
+ return 8 + Ko(o) + Bt(e);
3419
3380
  }
3420
- const Qo = 1e3, Yo = 5, Zo = 50, Xo = 2, ei = 10, ti = 10, ni = 10, ri = 20, oi = 20, ii = 30, si = 30, ai = 100;
3421
- function ci(o) {
3381
+ const Go = 1e3, jo = 5, Jo = 50, Qo = 2, Yo = 10, Zo = 10, Xo = 10, ei = 20, ti = 20, ni = 30, ri = 30, oi = 100;
3382
+ function ii(o) {
3422
3383
  return 50 + 10 * o;
3423
3384
  }
3424
- function li(o) {
3385
+ function si(o) {
3425
3386
  return 20 + o;
3426
3387
  }
3427
- function ui(o) {
3388
+ function ai(o) {
3428
3389
  return 10 * o;
3429
3390
  }
3430
- function hi(o) {
3391
+ function ci(o) {
3431
3392
  return 20 + o;
3432
3393
  }
3433
- class di {
3394
+ class li {
3434
3395
  constructor(e) {
3435
3396
  this.blue = e;
3436
3397
  }
@@ -3442,69 +3403,69 @@ class di {
3442
3403
  this.total += e;
3443
3404
  }
3444
3405
  chargeScopeEntry(e) {
3445
- this.add(ci(this.scopeDepth(e)));
3406
+ this.add(ii(this.scopeDepth(e)));
3446
3407
  }
3447
3408
  chargeInitialization() {
3448
- this.add(Qo);
3409
+ this.add(Go);
3449
3410
  }
3450
3411
  chargeChannelMatchAttempt() {
3451
- this.add(Yo);
3412
+ this.add(jo);
3452
3413
  }
3453
3414
  chargeHandlerOverhead() {
3454
- this.add(Zo);
3415
+ this.add(Jo);
3455
3416
  }
3456
3417
  chargeBoundaryCheck() {
3457
- this.add(Xo);
3418
+ this.add(Qo);
3458
3419
  }
3459
3420
  chargePatchAddOrReplace(e) {
3460
- this.add(li(this.payloadSizeCharge(e)));
3421
+ this.add(si(this.payloadSizeCharge(e)));
3461
3422
  }
3462
3423
  chargePatchRemove() {
3463
- this.add(ei);
3424
+ this.add(Yo);
3464
3425
  }
3465
3426
  chargeCascadeRouting(e) {
3466
- e > 0 && this.add(ui(e));
3427
+ e > 0 && this.add(ai(e));
3467
3428
  }
3468
3429
  chargeEmitEvent(e) {
3469
- this.add(hi(this.payloadSizeCharge(e)));
3430
+ this.add(ci(this.payloadSizeCharge(e)));
3470
3431
  }
3471
3432
  chargeBridge() {
3472
- this.add(ti);
3433
+ this.add(Zo);
3473
3434
  }
3474
3435
  chargeDrainEvent() {
3475
- this.add(ni);
3436
+ this.add(Xo);
3476
3437
  }
3477
3438
  chargeCheckpointUpdate() {
3478
- this.add(ri);
3439
+ this.add(ei);
3479
3440
  }
3480
3441
  chargeTerminationMarker() {
3481
- this.add(oi);
3442
+ this.add(ti);
3482
3443
  }
3483
3444
  chargeLifecycleDelivery() {
3484
- this.add(ii);
3445
+ this.add(ni);
3485
3446
  }
3486
3447
  chargeFatalTerminationOverhead() {
3487
- this.add(ai);
3448
+ this.add(oi);
3488
3449
  }
3489
3450
  chargeTriggerEventBase() {
3490
- this.add(si);
3451
+ this.add(ri);
3491
3452
  }
3492
3453
  chargeUpdateDocumentBase(e) {
3493
- this.add(jo(e));
3454
+ this.add(Wo(e));
3494
3455
  }
3495
3456
  chargeDocumentSnapshot(e, t) {
3496
- const n = t ? Le(this.blue, t) : 0;
3497
- this.add(Jo(e, n));
3457
+ const n = t ? _e(this.blue, t) : 0;
3458
+ this.add(qo(e, n));
3498
3459
  }
3499
3460
  chargeWasmGas(e) {
3500
- const t = en(e);
3461
+ const t = cn(e);
3501
3462
  t > 0 && this.add(t);
3502
3463
  }
3503
3464
  payloadSizeCharge(e) {
3504
3465
  if (!e)
3505
3466
  return 0;
3506
- const t = Le(this.blue, e);
3507
- return _t(t);
3467
+ const t = _e(this.blue, e);
3468
+ return Bt(t);
3508
3469
  }
3509
3470
  scopeDepth(e) {
3510
3471
  const t = w(e);
@@ -3516,12 +3477,12 @@ class di {
3516
3477
  return n;
3517
3478
  }
3518
3479
  }
3519
- class pi {
3480
+ class ui {
3520
3481
  constructor(e, t) {
3521
- this.documentRef = e, this.blueRef = t, this.patchEngine = new zo(this.documentRef), this.meter = new di(this.blueRef);
3482
+ this.documentRef = e, this.blueRef = t, this.patchEngine = new Fo(this.documentRef), this.meter = new li(this.blueRef);
3522
3483
  }
3523
3484
  patchEngine;
3524
- emissionRegistry = new qo();
3485
+ emissionRegistry = new Ho();
3525
3486
  meter;
3526
3487
  runTerminated = !1;
3527
3488
  document() {
@@ -3570,15 +3531,15 @@ class pi {
3570
3531
  return this.patchEngine.applyPatch(e, t);
3571
3532
  }
3572
3533
  }
3573
- const fi = S["Core/Processing Initialized Marker"], mi = S["Core/Document Update"];
3574
- class gi {
3534
+ const hi = S["Core/Processing Initialized Marker"], di = S["Core/Document Update"];
3535
+ class pi {
3575
3536
  constructor(e, t, n, r) {
3576
- this.contractLoader = e, this.registry = t, this.runtimeRef = new pi(r, n);
3577
- const i = (s) => Ct(this.runtimeRef.blue(), s);
3578
- this.checkpointManager = new To(
3537
+ this.contractLoader = e, this.registry = t, this.runtimeRef = new ui(r, n);
3538
+ const i = (s) => ht(this.runtimeRef.blue(), s);
3539
+ this.checkpointManager = new bo(
3579
3540
  this.runtimeRef,
3580
3541
  i
3581
- ), this.terminationService = new xo(this.runtimeRef), this.channelRunner = new Po(
3542
+ ), this.terminationService = new Do(this.runtimeRef), this.channelRunner = new Io(
3582
3543
  this.runtimeRef,
3583
3544
  this.checkpointManager,
3584
3545
  {
@@ -3608,7 +3569,7 @@ class gi {
3608
3569
  canonicalSignature: i,
3609
3570
  channelProcessorFor: (s) => this.lookupChannelProcessor(s)
3610
3571
  }
3611
- ), this.scopeExecutor = new Do({
3572
+ ), this.scopeExecutor = new No({
3612
3573
  runtime: this.runtimeRef,
3613
3574
  contractLoader: this.contractLoader,
3614
3575
  channelRunner: this.channelRunner,
@@ -3659,7 +3620,7 @@ class gi {
3659
3620
  );
3660
3621
  }
3661
3622
  createContext(e, t, n, r = !1, i = !1) {
3662
- return new Ei(
3623
+ return new fi(
3663
3624
  this,
3664
3625
  t,
3665
3626
  e,
@@ -3670,7 +3631,7 @@ class gi {
3670
3631
  }
3671
3632
  result() {
3672
3633
  const e = this.runtimeRef.document().clone(), t = this.runtimeRef.rootEmissions().map((n) => n.clone());
3673
- return Ze.of(
3634
+ return Xe.of(
3674
3635
  e,
3675
3636
  t,
3676
3637
  this.runtimeRef.totalGas()
@@ -3800,8 +3761,8 @@ class gi {
3800
3761
  return this.registry.lookupChannelForNode(this.runtimeRef.blue(), e) ?? null;
3801
3762
  }
3802
3763
  createDocumentUpdateEvent(e, t) {
3803
- const n = dn(t, e.path), r = e.before != null ? e.before.clone() : new p().setValue(null), i = e.after != null ? e.after.clone() : new p().setValue(null), s = new p().setType(
3804
- new p().setBlueId(mi)
3764
+ const n = Qt(t, e.path), r = e.before != null ? e.before.clone() : new p().setValue(null), i = e.after != null ? e.after.clone() : new p().setValue(null), s = new p().setType(
3765
+ new p().setBlueId(di)
3805
3766
  );
3806
3767
  return s.setProperties({
3807
3768
  op: new p().setValue(e.op),
@@ -3841,7 +3802,7 @@ class se {
3841
3802
  return this.initializationMarker(e) != null;
3842
3803
  }
3843
3804
  createExecution(e) {
3844
- return new gi(
3805
+ return new pi(
3845
3806
  this.contractLoader,
3846
3807
  this.registry,
3847
3808
  this.blue,
@@ -3856,7 +3817,7 @@ class se {
3856
3817
  return t.result();
3857
3818
  if (r instanceof F) {
3858
3819
  const i = e.clone();
3859
- return Ze.capabilityFailure(
3820
+ return Xe.capabilityFailure(
3860
3821
  i,
3861
3822
  r.message ?? null
3862
3823
  );
@@ -3876,7 +3837,7 @@ class se {
3876
3837
  "Initialization Marker must be a BlueNode"
3877
3838
  )
3878
3839
  );
3879
- if (n.getType()?.getBlueId() !== fi)
3840
+ if (n.getType()?.getBlueId() !== hi)
3880
3841
  throw new E(
3881
3842
  "Initialization Marker must declare type 'Processing Initialized Marker'",
3882
3843
  C.illegalState(
@@ -3957,7 +3918,7 @@ class se {
3957
3918
  }
3958
3919
  }
3959
3920
  }
3960
- class Ei {
3921
+ class fi {
3961
3922
  constructor(e, t, n, r, i, s) {
3962
3923
  this.execution = e, this.bundle = t, this.scopePathValue = n, this.eventNode = r, this.allowTerminatedWork = i, this.allowReservedMutation = s;
3963
3924
  }
@@ -4051,17 +4012,49 @@ class Ei {
4051
4012
  return !this.allowTerminatedWork && this.execution.isScopeInactive(this.scopePathValue);
4052
4013
  }
4053
4014
  }
4054
- const yi = new $t({
4055
- repositories: [at],
4056
- mergingProcessor: st()
4015
+ class Dt {
4016
+ process(e, t) {
4017
+ const n = t.getValue();
4018
+ if (re(n)) {
4019
+ const r = t.clone();
4020
+ return r.setValue(n), r.setProperties(void 0), r.setItems(void 0), r.setType(void 0), r;
4021
+ }
4022
+ return e;
4023
+ }
4024
+ /**
4025
+ * Post-process to ensure expressions aren't overridden by subsequent processors
4026
+ */
4027
+ postProcess(e, t) {
4028
+ const n = t.getValue();
4029
+ if (re(n) && e.getValue() !== n && n !== void 0) {
4030
+ const r = e.clone();
4031
+ return r.setValue(n), r;
4032
+ }
4033
+ return e;
4034
+ }
4035
+ }
4036
+ function mi() {
4037
+ return new L.SequentialMergingProcessor([
4038
+ new L.ValuePropagator(),
4039
+ new Dt(),
4040
+ new L.TypeAssigner(),
4041
+ new L.ListProcessor(),
4042
+ new L.DictionaryProcessor(),
4043
+ new L.MetadataPropagator(),
4044
+ new L.BasicTypesVerifier()
4045
+ ]);
4046
+ }
4047
+ const gi = new zt({
4048
+ repositories: [Ze],
4049
+ mergingProcessor: mi()
4057
4050
  });
4058
- class Ci {
4051
+ class Ei {
4059
4052
  blue;
4060
4053
  registryRef;
4061
4054
  contractLoaderRef;
4062
4055
  engine;
4063
4056
  constructor(e) {
4064
- this.registryRef = e?.registry ?? ue.create().registerDefaults().build(), this.blue = e?.blue ?? yi, this.contractLoaderRef = new vo(this.registryRef, this.blue), this.engine = new se(
4057
+ this.registryRef = e?.registry ?? ue.create().registerDefaults().build(), this.blue = e?.blue ?? gi, this.contractLoaderRef = new yo(this.registryRef, this.blue), this.engine = new se(
4065
4058
  this.contractLoaderRef,
4066
4059
  this.registryRef,
4067
4060
  this.blue
@@ -4094,10 +4087,10 @@ class Ci {
4094
4087
  return this.contractLoaderRef;
4095
4088
  }
4096
4089
  static builder() {
4097
- return new Si();
4090
+ return new yi();
4098
4091
  }
4099
4092
  }
4100
- class Si {
4093
+ class yi {
4101
4094
  contractRegistry;
4102
4095
  blueInstance;
4103
4096
  constructor() {
@@ -4113,117 +4106,117 @@ class Si {
4113
4106
  return this.blueInstance = e, this;
4114
4107
  }
4115
4108
  build() {
4116
- return new Ci({
4109
+ return new Ei({
4117
4110
  registry: this.contractRegistry,
4118
4111
  blue: this.blueInstance
4119
4112
  });
4120
4113
  }
4121
4114
  }
4122
- const Hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4115
+ const zi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4123
4116
  __proto__: null,
4124
- ExpressionPreserver: it
4117
+ ExpressionPreserver: Dt
4125
4118
  }, Symbol.toStringTag, { value: "Module" }));
4126
4119
  export {
4127
- Pt as ActorPolicyLiteralValidationError,
4128
- Xr as ChannelBinding,
4129
- Po as ChannelRunner,
4130
- To as CheckpointManager,
4131
- ko as CheckpointRecord,
4132
- Xe as CodeBlockEvaluationError,
4120
+ kt as ActorPolicyLiteralValidationError,
4121
+ Qr as ChannelBinding,
4122
+ Io as ChannelRunner,
4123
+ bo as CheckpointManager,
4124
+ wo as CheckpointRecord,
4125
+ ft as CodeBlockEvaluationError,
4133
4126
  W as ContractBundle,
4134
- to as ContractBundleBuilder,
4135
- vo as ContractLoader,
4136
- pr as ContractProcessorRegistry,
4127
+ Zr as ContractBundleBuilder,
4128
+ yo as ContractLoader,
4129
+ ur as ContractProcessorRegistry,
4137
4130
  ue as ContractProcessorRegistryBuilder,
4138
- Ze as DocumentProcessingResult,
4139
- pi as DocumentProcessingRuntime,
4140
- Ci as DocumentProcessor,
4141
- Si as DocumentProcessorBuilder,
4142
- qo as EmissionRegistry,
4143
- di as GasMeter,
4144
- eo as HandlerBinding,
4131
+ Xe as DocumentProcessingResult,
4132
+ ui as DocumentProcessingRuntime,
4133
+ Ei as DocumentProcessor,
4134
+ yi as DocumentProcessorBuilder,
4135
+ Ho as EmissionRegistry,
4136
+ li as GasMeter,
4137
+ Yr as HandlerBinding,
4145
4138
  D as KEY_CHECKPOINT,
4146
- ct as KEY_EMBEDDED,
4147
- lt as KEY_INITIALIZED,
4148
- ut as KEY_TERMINATED,
4149
- Hi as MergingProcessors,
4139
+ et as KEY_EMBEDDED,
4140
+ tt as KEY_INITIALIZED,
4141
+ nt as KEY_TERMINATED,
4142
+ zi as MergingProcessors,
4150
4143
  Ie as PROCESSOR_MANAGED_CHANNEL_BLUE_IDS,
4151
- zo as PatchEngine,
4152
- Fi as ProcessorContractConstants,
4144
+ Fo as PatchEngine,
4145
+ Li as ProcessorContractConstants,
4153
4146
  se as ProcessorEngine,
4154
4147
  C as ProcessorErrors,
4155
- gi as ProcessorExecution,
4156
- Ei as ProcessorExecutionContext,
4148
+ pi as ProcessorExecution,
4149
+ fi as ProcessorExecutionContext,
4157
4150
  E as ProcessorFatalError,
4158
- $i as ProcessorPointerConstants,
4151
+ xi as ProcessorPointerConstants,
4159
4152
  ke as QuickJSEvaluator,
4160
- pt as RELATIVE_CHECKPOINT,
4153
+ it as RELATIVE_CHECKPOINT,
4161
4154
  G as RELATIVE_CONTRACTS,
4162
- hn as RELATIVE_EMBEDDED,
4163
- ye as RELATIVE_INITIALIZED,
4164
- dt as RELATIVE_TERMINATED,
4155
+ Jt as RELATIVE_EMBEDDED,
4156
+ Ee as RELATIVE_INITIALIZED,
4157
+ ot as RELATIVE_TERMINATED,
4165
4158
  be as RESERVED_CONTRACT_KEYS,
4166
4159
  ie as RunTerminationError,
4167
- Do as ScopeExecutor,
4168
- Wo as ScopeRuntimeContext,
4169
- xo as TerminationService,
4170
- Tt as actorPolicyMarkerSchema,
4171
- $n as actorPolicyRuleSchema,
4172
- Di as andThen,
4173
- Ct as canonicalSignature,
4174
- Le as canonicalSize,
4160
+ No as ScopeExecutor,
4161
+ Vo as ScopeRuntimeContext,
4162
+ Do as TerminationService,
4163
+ It as actorPolicyMarkerSchema,
4164
+ Ln as actorPolicyRuleSchema,
4165
+ Ai as andThen,
4166
+ ht as canonicalSignature,
4167
+ _e as canonicalSize,
4175
4168
  U as channelContractBaseSchema,
4176
- Hn as channelEventCheckpointSchema,
4177
- bt as compositeTimelineChannelSchema,
4178
- on as containsExpression,
4169
+ Un as channelEventCheckpointSchema,
4170
+ vt as compositeTimelineChannelSchema,
4171
+ yn as containsExpression,
4179
4172
  Te as contractBaseSchema,
4180
- st as createDefaultMergingProcessor,
4181
- ot as createPicomatchShouldResolve,
4182
- Xn as documentAnchorsMarkerSchema,
4183
- nr as documentLinksMarkerSchema,
4184
- Tn as documentUpdateChannelSchema,
4185
- Rn as embeddedNodeChannelSchema,
4186
- qt as err,
4187
- rt as evaluateQuickJSExpression,
4188
- sn as extractExpressionContent,
4189
- vt as handlerContractBaseSchema,
4190
- Wn as initializationMarkerSchema,
4191
- Ni as isErr,
4192
- ne as isExpression,
4193
- Oi as isOk,
4194
- ht as isProcessorManagedChannelBlueId,
4195
- un as isReservedContractKey,
4196
- Ui as joinRelativePointers,
4197
- zi as jsonPatchSchema,
4198
- On as lifecycleChannelSchema,
4199
- Ai as map,
4200
- Bi as mapErr,
4173
+ mi as createDefaultMergingProcessor,
4174
+ Et as createPicomatchShouldResolve,
4175
+ Qn as documentAnchorsMarkerSchema,
4176
+ Xn as documentLinksMarkerSchema,
4177
+ bn as documentUpdateChannelSchema,
4178
+ kn as embeddedNodeChannelSchema,
4179
+ Ht as err,
4180
+ gt as evaluateQuickJSExpression,
4181
+ Cn as extractExpressionContent,
4182
+ Ct as handlerContractBaseSchema,
4183
+ Vn as initializationMarkerSchema,
4184
+ Mi as isErr,
4185
+ re as isExpression,
4186
+ Ri as isOk,
4187
+ rt as isProcessorManagedChannelBlueId,
4188
+ jt as isReservedContractKey,
4189
+ Fi as joinRelativePointers,
4190
+ $i as jsonPatchSchema,
4191
+ Pn as lifecycleChannelSchema,
4192
+ Oi as map,
4193
+ Ni as mapErr,
4201
4194
  M as markerContractBaseSchema,
4202
- xi as match,
4203
- or as myosParticipantsOrchestrationMarkerSchema,
4204
- sr as myosSessionInteractionMarkerSchema,
4205
- _n as myosTimelineChannelSchema,
4206
- cr as myosWorkerAgencyMarkerSchema,
4195
+ _i as match,
4196
+ tr as myosParticipantsOrchestrationMarkerSchema,
4197
+ rr as myosSessionInteractionMarkerSchema,
4198
+ An as myosTimelineChannelSchema,
4199
+ ir as myosWorkerAgencyMarkerSchema,
4207
4200
  R as normalizePointer,
4208
4201
  w as normalizeScope,
4209
- Wt as ok,
4210
- Qn as operationMarkerSchema,
4211
- Gn as processEmbeddedMarkerSchema,
4212
- Jn as processingTerminatedMarkerSchema,
4213
- gt as relativeCheckpointLastEvent,
4214
- Et as relativeCheckpointLastSignature,
4202
+ Vt as ok,
4203
+ Gn as operationMarkerSchema,
4204
+ Kn as processEmbeddedMarkerSchema,
4205
+ qn as processingTerminatedMarkerSchema,
4206
+ ct as relativeCheckpointLastEvent,
4207
+ lt as relativeCheckpointLastSignature,
4215
4208
  ae as relativeContractsEntry,
4216
- dn as relativizePointer,
4217
- re as resolveNodeExpressions,
4209
+ Qt as relativizePointer,
4210
+ oe as resolveNodeExpressions,
4218
4211
  k as resolvePointer,
4219
- an as resolveTemplateString,
4220
- hr as sequentialWorkflowOperationSchema,
4221
- lr as sequentialWorkflowSchema,
4222
- Vi as sequentialWorkflowStepSchema,
4223
- De as stripSlashes,
4224
- Bn as timelineChannelSchema,
4225
- An as triggeredEventChannelSchema,
4226
- _i as unwrapOr,
4227
- Li as unwrapOrElse,
4228
- zn as validateActorPolicyNode
4212
+ Sn as resolveTemplateString,
4213
+ cr as sequentialWorkflowOperationSchema,
4214
+ sr as sequentialWorkflowSchema,
4215
+ Ui as sequentialWorkflowStepSchema,
4216
+ Be as stripSlashes,
4217
+ On as timelineChannelSchema,
4218
+ Mn as triggeredEventChannelSchema,
4219
+ Bi as unwrapOr,
4220
+ Di as unwrapOrElse,
4221
+ Fn as validateActorPolicyNode
4229
4222
  };