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

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 (36) hide show
  1. package/dist/index.js +690 -716
  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/registry/processors/workflow/operation-matcher.d.ts.map +1 -1
  34. package/dist/repository/semantic-repository.d.ts +40 -40
  35. package/dist/repository/semantic-repository.d.ts.map +1 -1
  36. 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 Ye } from "@blue-repository/types";
2
+ import { evaluate as _t } from "@blue-quickjs/quickjs-runtime";
3
+ import { validateDv as Lt, DV_LIMIT_DEFAULTS as xt } from "@blue-quickjs/dv";
4
+ import { HOST_V1_MANIFEST as Ft, HOST_V1_HASH as $t } from "@blue-quickjs/abi-manifest";
5
+ import { BlueNode as p, withTypeBlueId as m, blueNodeField as I, Properties as Ne, MergingProcessors as L, Blue as Ut } 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 zt(o) {
10
10
  return { ok: !0, value: o };
11
11
  }
12
- function qt(o) {
12
+ function Vt(o) {
13
13
  return { ok: !1, error: o };
14
14
  }
15
- function Oi(o) {
15
+ function Pi(o) {
16
16
  return o.ok;
17
17
  }
18
- function Ni(o) {
18
+ function Ri(o) {
19
19
  return !o.ok;
20
20
  }
21
- function Ai(o, e) {
22
- return o.ok ? Wt(e(o.value)) : o;
21
+ function Mi(o, e) {
22
+ return o.ok ? zt(e(o.value)) : o;
23
23
  }
24
- function Bi(o, e) {
25
- return o.ok ? o : qt(e(o.error));
24
+ function Oi(o, e) {
25
+ return o.ok ? o : Vt(e(o.error));
26
26
  }
27
- function Di(o, e) {
27
+ function Ni(o, e) {
28
28
  return o.ok ? e(o.value) : o;
29
29
  }
30
- function _i(o, e) {
30
+ function Ai(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 Bi(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 Ht(o) {
60
60
  return Object.freeze([...o]);
61
61
  }
62
- const jt = {
62
+ const Kt = {
63
63
  of(o, e, t) {
64
64
  return {
65
65
  document: o,
66
- triggeredEvents: Gt(e),
66
+ triggeredEvents: Ht(e),
67
67
  totalGas: t,
68
68
  capabilityFailure: !1,
69
69
  failureReason: null
@@ -78,271 +78,73 @@ 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
+ }, Ze = Kt, S = we("core"), b = we("conversation"), q = we("myos");
278
82
  function we(o) {
279
- const e = at.packages[o];
83
+ const e = Ye.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 Wt = [
287
89
  "embedded",
288
90
  "initialized",
289
91
  "terminated",
290
92
  "checkpoint"
291
- ], ln = [
93
+ ], qt = [
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
+ ], Xe = "embedded", et = "initialized", tt = "terminated", B = "checkpoint", be = new Set(
99
+ Wt
100
+ ), Ie = new Set(qt);
101
+ function Gt(o) {
300
102
  return o != null && be.has(o);
301
103
  }
302
- function ht(o) {
104
+ function nt(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,
311
- KEY_CHECKPOINT: D,
109
+ const _i = {
110
+ KEY_EMBEDDED: Xe,
111
+ KEY_INITIALIZED: et,
112
+ KEY_TERMINATED: tt,
113
+ KEY_CHECKPOINT: B,
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: Gt,
117
+ isProcessorManagedChannelBlueId: nt
118
+ }, G = "/contracts", Ee = `${G}/${et}`, rt = `${G}/${tt}`, jt = `${G}/${Xe}`, ot = `${G}/${B}`, it = "/lastEvents", st = "/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 at(o, e) {
123
+ return `${ae(o)}${it}/${e}`;
322
124
  }
323
- function Et(o, e) {
324
- return `${ae(o)}${mt}/${e}`;
125
+ function ct(o, e) {
126
+ return `${ae(o)}${st}/${e}`;
325
127
  }
326
- const $i = {
128
+ const Li = {
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: rt,
132
+ RELATIVE_EMBEDDED: jt,
133
+ RELATIVE_CHECKPOINT: ot,
134
+ LAST_EVENTS_SUFFIX: it,
135
+ LAST_SIGNATURES_SUFFIX: st,
334
136
  relativeContractsEntry: ae,
335
- relativeCheckpointLastEvent: gt,
336
- relativeCheckpointLastSignature: Et
137
+ relativeCheckpointLastEvent: at,
138
+ relativeCheckpointLastSignature: ct
337
139
  };
338
- function yt(o) {
140
+ function lt(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 lt(o) ? "/" : o.startsWith("/") ? o : `/${o}`;
343
145
  }
344
146
  function R(o) {
345
- return yt(o) ? "/" : o.startsWith("/") ? o : `/${o}`;
147
+ return lt(o) ? "/" : o.startsWith("/") ? o : `/${o}`;
346
148
  }
347
149
  function De(o) {
348
150
  if (o == null)
@@ -356,7 +158,7 @@ function De(o) {
356
158
  e = e.substring(0, e.length - 1);
357
159
  return e;
358
160
  }
359
- function Ui(o, e) {
161
+ function xi(o, e) {
360
162
  const t = De(o), n = De(e);
361
163
  return t.length === 0 && n.length === 0 ? "/" : t.length === 0 ? `/${n}` : n.length === 0 ? `/${t}` : `/${t}/${n}`;
362
164
  }
@@ -364,7 +166,7 @@ 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 Jt(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 Qt(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, Be;
182
+ function Yt() {
183
+ return Be || (Be = 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 Zt = Yt();
197
+ const Xt = /* @__PURE__ */ Qt(Zt);
198
+ function en(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 tn(o, e) {
202
+ const t = en(o, e);
203
+ return Xt(t);
402
204
  }
403
- function Ct(o, e) {
404
- return e ? yn(o, e) : null;
205
+ function ut(o, e) {
206
+ return e ? tn(o, e) : null;
405
207
  }
406
- function Le(o, e) {
407
- const t = Ct(o, e);
208
+ function _e(o, e) {
209
+ const t = ut(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 nn = 1700, ye = BigInt(
213
+ nn
214
+ ), rn = BigInt(Number.MAX_SAFE_INTEGER), on = 4e4, sn = 4e4;
215
+ function an(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 > rn ? Number.MAX_SAFE_INTEGER : Number(t);
228
+ }
229
+ function ht(o) {
230
+ const e = BigInt(Math.max(0, Math.trunc(o)));
231
+ return e <= 0n ? 0n : e * ye;
232
+ }
233
+ const dt = ht(
234
+ on
235
+ ), cn = ht(
236
+ sn
237
+ ), D = 1, ln = /* @__PURE__ */ new Set([
411
238
  "event",
412
239
  "eventCanonical",
413
240
  "steps",
@@ -420,9 +247,9 @@ class ke {
420
247
  // Serialize evaluations to avoid races when updating host handler bindings.
421
248
  evaluationQueue = Promise.resolve();
422
249
  handlerState = {
423
- documentGet: () => ({ ok: null, units: B }),
424
- documentGetCanonical: () => ({ ok: null, units: B }),
425
- emit: () => ({ ok: null, units: B })
250
+ documentGet: () => ({ ok: null, units: D }),
251
+ documentGetCanonical: () => ({ ok: null, units: D }),
252
+ emit: () => ({ ok: null, units: D })
426
253
  };
427
254
  handlers = {
428
255
  document: {
@@ -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 ?? dt, a = {
450
277
  code: this.wrapCode(e),
451
278
  abiId: "Host.v1",
452
279
  abiVersion: 1,
453
- abiManifestHash: Kt
280
+ abiManifestHash: $t
454
281
  };
455
282
  try {
456
- const c = await Ut({
283
+ const c = await _t({
457
284
  program: a,
458
285
  input: i,
459
286
  gasLimit: s,
460
- manifest: Ht,
287
+ manifest: Ft,
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 dn(c);
295
+ return ne(c.value);
469
296
  } catch (c) {
470
- throw bn(c);
297
+ throw pn(c);
471
298
  }
472
299
  }
473
300
  prepareBindings(e) {
474
301
  const t = e ?? {};
475
- Sn(t);
302
+ un(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 = hn(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 un(o) {
530
357
  for (const e of Object.keys(o))
531
- if (!Cn.has(e))
358
+ if (!ln.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
+ Lt(n, { limits: xt });
538
365
  } catch (r) {
539
366
  const i = r instanceof Error ? r.message : String(r);
540
367
  throw new TypeError(
@@ -543,53 +370,53 @@ 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);
550
377
  return {
551
378
  ok: t === void 0 ? null : t,
552
- units: B
379
+ units: D
553
380
  };
554
381
  } catch {
555
382
  return {
556
383
  err: { code: "INVALID_PATH", tag: "host/invalid_path" },
557
- units: B
384
+ units: D
558
385
  };
559
386
  }
560
- } : () => ({ ok: null, units: B });
387
+ } : () => ({ ok: null, units: D });
561
388
  }
562
- function vn(o) {
389
+ function hn(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
- return { ok: null, units: B };
394
+ return { ok: null, units: D };
568
395
  } catch {
569
396
  return {
570
397
  err: { code: "LIMIT_EXCEEDED", tag: "host/limit" },
571
- units: B
398
+ units: D
572
399
  };
573
400
  }
574
- } : () => ({ ok: null, units: B });
401
+ } : () => ({ ok: null, units: D });
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 dn(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 pn(o) {
610
437
  return o instanceof Error ? o : new Error(String(o ?? "Unknown error"));
611
438
  }
439
+ const xe = 120;
440
+ function fn(o) {
441
+ return o.length <= xe ? o : `${o.slice(0, xe - 3)}...`;
442
+ }
443
+ class pt extends Error {
444
+ constructor(e, t) {
445
+ super(`Failed to evaluate code block: ${fn(e)}`, { cause: t }), this.code = e, this.cause = t, this.name = "CodeBlockEvaluationError";
446
+ }
447
+ }
448
+ const ft = /^\$\{([\s\S]*)\}$/, mn = /\$\{([\s\S]+?)\}/, gn = /\$\{([\s\S]+?)\}/g;
449
+ function re(o) {
450
+ if (typeof o != "string" || !ft.test(o))
451
+ return !1;
452
+ const e = o.indexOf("${"), t = o.lastIndexOf("${");
453
+ return e === t;
454
+ }
455
+ function En(o) {
456
+ return typeof o != "string" ? !1 : ft.test(o) ? !0 : mn.test(o);
457
+ }
458
+ function yn(o) {
459
+ if (!re(o))
460
+ throw new Error(`Invalid expression: ${o}`);
461
+ return o.slice(2, -1);
462
+ }
463
+ async function mt(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 pt(e, s);
474
+ }
475
+ }
476
+ async function Cn(o, e, t, n, r) {
477
+ let i = "", s = 0;
478
+ for (const a of e.matchAll(gn)) {
479
+ const c = a[0], u = a[1], h = a.index ?? 0;
480
+ i += e.slice(s, h);
481
+ const d = await mt(
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 gt({
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 = cn, 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 = yn(d), y = await mt(
525
+ e,
526
+ g,
527
+ n,
528
+ c,
529
+ u
530
+ );
531
+ return s.blue.jsonValueToNode(y ?? null);
532
+ } else if (En(d)) {
533
+ const g = await Cn(
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
+ }), Et = 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
+ })), yt = Et.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), Sn = 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
+ }), Fi = m("JsonPatch")(
613
+ Sn
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
+ }), vn = 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
+ })), wn = vn.merge(
668
629
  U
669
- ), Pn = m(P["Core/Embedded Node Channel"])($.extend({
630
+ ), bn = 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
+ })), In = bn.merge(
674
635
  U
675
- ), Mn = m(P["Core/Lifecycle Event Channel"])($.extend({
636
+ ), kn = m(P["Core/Lifecycle Event Channel"])($.extend({
676
637
  description: l.string().optional(),
677
638
  name: l.string().optional()
678
- })), On = Mn.merge(
639
+ })), Tn = kn.merge(
679
640
  U
680
- ), Nn = m(P["Core/Triggered Event Channel"])($.extend({
641
+ ), Pn = 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
+ })), Rn = Pn.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
+ }, Ct = 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
+ })), Mn = Ct.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
+ }, On = m(A["MyOS/MyOS Timeline Channel"])(Ct.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
+ })), Nn = On.merge(U), An = 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
+ })), St = An.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
+ })), vt = ["principal", "agent", "any"], wt = [
733
694
  "browserSession",
734
695
  "apiCall",
735
696
  "documentRequest"
736
- ], Fn = l.enum(It), Fe = l.enum(kt), $n = l.object({
697
+ ], Bn = l.enum(vt), Fe = l.enum(wt), _n = l.object({
737
698
  excludeSource: Fe.optional(),
738
- requiresActor: Fn.optional(),
699
+ requiresActor: Bn.optional(),
739
700
  requiresSource: Fe.optional()
740
- }), Tt = xn.merge(
701
+ }), bt = 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(), _n).optional()
705
+ }), Ln = new Set(vt), $e = new Set(wt);
706
+ class It extends Error {
746
707
  constructor(e) {
747
708
  super(e), this.name = "ActorPolicyLiteralValidationError";
748
709
  }
749
710
  }
750
- function zn(o) {
711
+ function xn(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
+ Ln
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 It(
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 Fn = 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
+ })), $n = Fn.merge(M).extend({
794
755
  lastSignatures: l.record(l.string()).optional()
795
- }), Kn = m(P["Core/Processing Initialized Marker"])(z.extend({
756
+ }), Un = 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
+ })), zn = Un.merge(M), Vn = 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
+ })), Hn = Vn.merge(
804
765
  M
805
- ), jn = m(P["Core/Processing Terminated Marker"])(z.extend({
766
+ ), Kn = 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
+ })), Wn = Kn.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
+ })), qn = Z.merge(
816
777
  M
817
- ), Yn = m(A["MyOS/Document Anchor"])(l.object({
778
+ ), Gn = 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(Gn)), Jn = jn.merge(M), Qn = 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
+ })), Yn = m(A["MyOS/Document Links"])(l.object({}).catchall(Qn)), Zn = Yn.merge(
826
787
  M
827
- ), rr = m(A["MyOS/MyOS Participants Orchestration"])(l.object({
788
+ ), Xn = 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
+ })), er = Xn.merge(M), tr = 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
+ })), nr = tr.merge(M), rr = m(A["MyOS/MyOS Worker Agency"])(l.object({
832
793
  name: l.string().optional()
833
- })), cr = ar.merge(
794
+ })), or = rr.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
+ })), kt = m(T["Conversation/Sequential Workflow"])(Et.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
+ })), $i = I(), ir = kt.merge(yt).extend({
843
804
  steps: l.array(I()).optional()
844
- }), ur = m(T["Conversation/Sequential Workflow Operation"])(Rt.extend({
805
+ }), sr = m(T["Conversation/Sequential Workflow Operation"])(kt.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
+ })), ar = sr.merge(
810
+ yt
850
811
  ).extend({
851
812
  steps: l.array(I()).optional()
852
813
  });
853
- function dr(o) {
814
+ function cr(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
+ cr(o);
862
823
  for (const t of o.blueIds)
863
824
  e.set(t, o);
864
825
  }
865
- class pr {
826
+ class lr {
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 ur {
966
927
  kind = "marker";
967
928
  blueIds = [
968
929
  b["Conversation/Actor Policy"]
969
930
  ];
970
- schema = Tt;
931
+ schema = bt;
971
932
  }
972
- const mr = "compositeSourceChannelKey";
973
- function gr(o, e) {
933
+ const hr = "compositeSourceChannelKey";
934
+ function dr(o, e) {
974
935
  return `${o}::${e}`;
975
936
  }
976
- function Er(o) {
937
+ function pr(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 fr {
980
941
  kind = "channel";
981
942
  blueIds = [
982
943
  b["Conversation/Composite Timeline Channel"]
983
944
  ];
984
- schema = bt;
945
+ schema = St;
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 = dr(
1029
990
  t.bindingKey,
1030
991
  u
1031
- ), Lt = await this.shouldProcessChild({
992
+ ), Bt = 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: Bt
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
+ [hr]: new p().setValue(t)
1068
1029
  }), e.setProperties({ ...n, meta: r });
1069
1030
  }
1070
1031
  /**
@@ -1086,39 +1047,39 @@ class yr {
1086
1047
  * Resolve the checkpoint marker for the current scope, if present.
1087
1048
  */
1088
1049
  resolveCheckpoint(e) {
1089
- const t = e.get(D);
1090
- return Er(t) ? t : null;
1050
+ const t = e.get(B);
1051
+ return pr(t) ? t : null;
1091
1052
  }
1092
1053
  }
1093
- const Cr = m(T["Conversation/Actor"])(l.object({
1054
+ const mr = 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
+ })), Tt = 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: mr.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: Tt.optional(),
1108
1069
  timestamp: l.number().optional()
1109
- })), Sr = m(A["MyOS/MyOS Timeline"])(Mt.extend({
1070
+ })), gr = m(A["MyOS/MyOS Timeline"])(Tt.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: gr.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 Pt(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 Er {
1132
1093
  kind = "channel";
1133
1094
  blueIds = [q["MyOS/MyOS Timeline Channel"]];
1134
- schema = _n;
1095
+ schema = Nn;
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 ? Pt(i, r, n) : !0;
1152
1113
  }
1153
1114
  }
1154
- class wr {
1115
+ class yr {
1155
1116
  kind = "channel";
1156
1117
  blueIds = [b["Conversation/Timeline Channel"]];
1157
- schema = Bn;
1118
+ schema = Mn;
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 ? Pt(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 = Sr(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 Cr = /* @__PURE__ */ new Set(["blueId", "name", "description", "value"]);
1152
+ function Sr(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 Cr.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 vr {
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: gt({
1224
1185
  include: ["/event", "/event/**"]
1225
1186
  }),
1226
- shouldDescend: Tr(),
1187
+ shouldDescend: wr(),
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 wr() {
1201
+ return (o, e) => o === "/event" || !o.startsWith("/event/") ? !0 : !br(e);
1241
1202
  }
1242
- function Pr(o) {
1203
+ function br(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 Ir {
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 ?? dt;
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 pt(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 kr = 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(kr).optional(),
1304
1265
  description: l.string().optional(),
1305
1266
  name: l.string().optional()
1306
1267
  }));
1307
- class Or {
1268
+ class Tr {
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: gt({
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 = [
1355
- new kr(),
1356
- new Rr(),
1357
- new Or()
1316
+ new vr(),
1317
+ new Ir(),
1318
+ new Tr()
1358
1319
  ];
1359
- class Nt {
1320
+ class Rt {
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 Pr {
1408
1369
  kind = "handler";
1409
1370
  blueIds = [
1410
1371
  b["Conversation/Sequential Workflow"]
1411
1372
  ];
1412
- schema = lr;
1373
+ schema = ir;
1413
1374
  runner;
1414
1375
  constructor(e = Re) {
1415
- this.runner = new Nt(e);
1376
+ this.runner = new Rt(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 Rr {
1432
1393
  kind = "marker";
1433
1394
  blueIds = [S["Core/Marker"]];
1434
1395
  schema = M;
1435
1396
  }
1436
- class Br {
1397
+ class Mr {
1437
1398
  kind = "marker";
1438
1399
  blueIds = [b["Conversation/Operation"]];
1439
- schema = Qn;
1400
+ schema = qn;
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 Mt(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 Or(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 Nr(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 Ar(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,39 +1455,20 @@ function xr(o, e) {
1494
1455
  const i = e.blue.nodeToSchemaOutput(
1495
1456
  r,
1496
1457
  Z
1497
- ), s = At(i);
1458
+ ), s = Mt(i);
1498
1459
  return { operationNode: r, operation: i, channelKey: s };
1499
1460
  }
1500
- function Fr(o, e) {
1461
+ function Br(o, e) {
1501
1462
  return !(o && e && o !== e);
1502
1463
  }
1503
- function $r(o, e, t) {
1464
+ function _r(o, e, t) {
1504
1465
  const n = o.getProperties()?.request, r = e.getProperties()?.request;
1505
- if (!(n instanceof p) || !(r instanceof p))
1506
- return !1;
1507
- try {
1508
- if (!t.isTypeOfNode(n, r) && !qe(
1509
- n,
1510
- r,
1511
- t
1512
- ))
1513
- return !1;
1514
- } catch {
1515
- if (!qe(n, r, t))
1516
- return !1;
1517
- }
1518
- return !0;
1519
- }
1520
- function qe(o, e, t) {
1521
- if (!e.isResolved())
1522
- return !1;
1523
- const n = e.getType()?.getBlueId();
1524
- return typeof n == "string" && n.length > 0 && t.isTypeOfBlueId(o, n);
1466
+ return !(!(n instanceof p) || !(r instanceof p) || !t.isTypeOfNode(n, r));
1525
1467
  }
1526
- function Ur(o, e, t) {
1468
+ function Lr(o, e, t) {
1527
1469
  if (!o || o.allowNewerVersion !== !1)
1528
1470
  return !0;
1529
- const n = Dr(e, t);
1471
+ const n = Or(e, t);
1530
1472
  if (!n)
1531
1473
  return !0;
1532
1474
  const r = t.resolvePointer("/"), i = t.documentAt(r);
@@ -1535,35 +1477,35 @@ function Ur(o, e, t) {
1535
1477
  const c = (i.getContracts()?.initialized ?? null)?.get("/documentId") ?? null, u = typeof c == "string" && c.length > 0 ? c : t.blue.calculateBlueIdSync(i);
1536
1478
  return n === u;
1537
1479
  }
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];
1480
+ const xr = b["Conversation/Actor Policy"], Fr = b["Conversation/Principal Actor"], $r = b["Conversation/Agent Actor"], Ur = b["Conversation/Browser Session"], zr = b["Conversation/API Call"], Vr = b["Conversation/Document Request"];
1481
+ function Hr(o, e, t) {
1482
+ const r = Kr(t)?.operations?.[o];
1541
1483
  if (!r)
1542
1484
  return !0;
1543
- const i = Jr(e, t), s = Qr(e, t);
1544
- return Yr(r, i, s);
1485
+ const i = Wr(e, t), s = qr(e, t);
1486
+ return Gr(r, i, s);
1545
1487
  }
1546
- function jr(o) {
1488
+ function Kr(o) {
1547
1489
  const e = o.resolvePointer("/contracts"), n = o.documentAt(e)?.getProperties();
1548
1490
  if (!n)
1549
1491
  return null;
1550
1492
  for (const r of Object.values(n))
1551
- if (r instanceof p && o.blue.isTypeOfBlueId(r, zr))
1493
+ if (r instanceof p && o.blue.isTypeOfBlueId(r, xr))
1552
1494
  return o.blue.nodeToSchemaOutput(
1553
1495
  r,
1554
- Tt
1496
+ bt
1555
1497
  );
1556
1498
  return null;
1557
1499
  }
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;
1500
+ function Wr(o, e) {
1501
+ const t = Ot(o, "actor", e);
1502
+ return t ? e.blue.isTypeOfBlueId(t, $r) ? "agent" : e.blue.isTypeOfBlueId(t, Fr) ? "principal" : null : null;
1561
1503
  }
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;
1504
+ function qr(o, e) {
1505
+ const t = Ot(o, "source", e);
1506
+ return t ? e.blue.isTypeOfBlueId(t, Ur) ? "browserSession" : e.blue.isTypeOfBlueId(t, zr) ? "apiCall" : e.blue.isTypeOfBlueId(t, Vr) ? "documentRequest" : null : null;
1565
1507
  }
1566
- function Bt(o, e, t) {
1508
+ function Ot(o, e, t) {
1567
1509
  if (!t.blue.isTypeOf(o, N, {
1568
1510
  checkSchemaExtensions: !0
1569
1511
  }))
@@ -1571,18 +1513,18 @@ function Bt(o, e, t) {
1571
1513
  const n = o.getProperties()?.[e];
1572
1514
  return n instanceof p ? n : null;
1573
1515
  }
1574
- function Yr(o, e, t) {
1516
+ function Gr(o, e, t) {
1575
1517
  return !(o.requiresActor && (!e || o.requiresActor !== "any" && o.requiresActor !== e) || o.requiresSource && (!t || o.requiresSource !== t) || o.excludeSource && (!t || o.excludeSource === t));
1576
1518
  }
1577
- class Zr {
1519
+ class jr {
1578
1520
  kind = "handler";
1579
1521
  blueIds = [
1580
1522
  b["Conversation/Sequential Workflow Operation"]
1581
1523
  ];
1582
- schema = hr;
1524
+ schema = ar;
1583
1525
  runner;
1584
1526
  constructor(e = Re) {
1585
- this.runner = new Nt(e);
1527
+ this.runner = new Rt(e);
1586
1528
  }
1587
1529
  deriveChannel(e, t) {
1588
1530
  const n = e.operation;
@@ -1594,13 +1536,13 @@ class Zr {
1594
1536
  }))
1595
1537
  return null;
1596
1538
  const i = t.blue.nodeToSchemaOutput(r.node, Z);
1597
- return i ? At(i) : null;
1539
+ return i ? Mt(i) : null;
1598
1540
  }
1599
1541
  async matches(e, t) {
1600
1542
  const n = t.event();
1601
1543
  if (!n)
1602
1544
  return !1;
1603
- const r = _r(
1545
+ const r = Nr(
1604
1546
  n,
1605
1547
  t.blue
1606
1548
  );
@@ -1610,20 +1552,20 @@ class Zr {
1610
1552
  r,
1611
1553
  Ce
1612
1554
  );
1613
- if (!i || !Lr(e, n, i, t))
1555
+ if (!i || !Ar(e, n, i, t))
1614
1556
  return !1;
1615
- const s = xr(e, t);
1557
+ const s = Dr(e, t);
1616
1558
  if (!s)
1617
1559
  return !1;
1618
1560
  const a = typeof e.channel == "string" ? e.channel.trim() : "", c = a.length > 0 ? a : null;
1619
- if (!Fr(s.channelKey, c) || !$r(
1561
+ if (!Br(s.channelKey, c) || !_r(
1620
1562
  r,
1621
1563
  s.operationNode,
1622
1564
  t.blue
1623
- ) || i?.allowNewerVersion === !1 && !Ur(i, r, t))
1565
+ ) || i?.allowNewerVersion === !1 && !Lr(i, r, t))
1624
1566
  return !1;
1625
1567
  const u = e.operation;
1626
- return !(!u || !Gr(u, n, t));
1568
+ return !(!u || !Hr(u, n, t));
1627
1569
  }
1628
1570
  async execute(e, t, n) {
1629
1571
  const r = t.event();
@@ -1641,11 +1583,11 @@ class ue {
1641
1583
  }
1642
1584
  static create() {
1643
1585
  return new ue(
1644
- new pr()
1586
+ new lr()
1645
1587
  );
1646
1588
  }
1647
1589
  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;
1590
+ return this.registry.register(new fr()), this.registry.register(new Er()), this.registry.register(new yr()), this.registry.register(new Pr()), this.registry.register(new ur()), this.registry.register(new Mr()), this.registry.register(new Rr()), this.registry.register(new jr()), this;
1649
1591
  }
1650
1592
  register(e) {
1651
1593
  return this.registry.register(e), this;
@@ -1655,10 +1597,10 @@ class ue {
1655
1597
  }
1656
1598
  }
1657
1599
  const Se = S["Core/Channel Event Checkpoint"];
1658
- function Dt(o) {
1600
+ function Nt(o) {
1659
1601
  return typeof o.order == "number" ? o.order : 0;
1660
1602
  }
1661
- class Xr {
1603
+ class Jr {
1662
1604
  constructor(e, t, n, r) {
1663
1605
  this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n, this.bindingNode = r;
1664
1606
  }
@@ -1675,10 +1617,10 @@ class Xr {
1675
1617
  return this.bindingNode.clone();
1676
1618
  }
1677
1619
  order() {
1678
- return Dt(this.bindingContract);
1620
+ return Nt(this.bindingContract);
1679
1621
  }
1680
1622
  }
1681
- class eo {
1623
+ class Qr {
1682
1624
  constructor(e, t, n, r) {
1683
1625
  this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n, this.bindingNode = r;
1684
1626
  }
@@ -1695,7 +1637,7 @@ class eo {
1695
1637
  return this.bindingNode.clone();
1696
1638
  }
1697
1639
  order() {
1698
- return Dt(this.bindingContract);
1640
+ return Nt(this.bindingContract);
1699
1641
  }
1700
1642
  }
1701
1643
  class W {
@@ -1713,7 +1655,7 @@ class W {
1713
1655
  );
1714
1656
  }
1715
1657
  static builder() {
1716
- return new to();
1658
+ return new Yr();
1717
1659
  }
1718
1660
  static empty() {
1719
1661
  return W.builder().build();
@@ -1746,8 +1688,8 @@ class W {
1746
1688
  throw new Error(
1747
1689
  "Duplicate Channel Event Checkpoint markers detected in same contracts map"
1748
1690
  );
1749
- this.markerStore.set(D, {
1750
- key: D,
1691
+ this.markerStore.set(B, {
1692
+ key: B,
1751
1693
  contract: e,
1752
1694
  blueId: Se
1753
1695
  }), this.checkpointDeclared = !0;
@@ -1755,7 +1697,7 @@ class W {
1755
1697
  handlersFor(e) {
1756
1698
  const t = this.handlersByChannel.get(e);
1757
1699
  return !t || t.length === 0 ? [] : [...t].map(
1758
- (n) => new eo(
1700
+ (n) => new Qr(
1759
1701
  n.key,
1760
1702
  n.contract,
1761
1703
  n.blueId,
@@ -1777,7 +1719,7 @@ class W {
1777
1719
  }
1778
1720
  channelsOfType(...e) {
1779
1721
  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(
1722
+ (r) => new Jr(
1781
1723
  r.key,
1782
1724
  r.contract,
1783
1725
  r.blueId,
@@ -1790,7 +1732,7 @@ class W {
1790
1732
  }), n;
1791
1733
  }
1792
1734
  }
1793
- class to {
1735
+ class Yr {
1794
1736
  channels = /* @__PURE__ */ new Map();
1795
1737
  handlersByChannel = /* @__PURE__ */ new Map();
1796
1738
  markerStore = /* @__PURE__ */ new Map();
@@ -1815,12 +1757,12 @@ class to {
1815
1757
  return this.embeddedDeclared = !0, this.embeddedPaths = e.paths ? [...e.paths] : [], this;
1816
1758
  }
1817
1759
  addMarker(e, t, n) {
1818
- if (e === D && n !== Se)
1760
+ if (e === B && n !== Se)
1819
1761
  throw new Error(
1820
1762
  "Reserved key 'checkpoint' must contain a Channel Event Checkpoint"
1821
1763
  );
1822
1764
  if (n === Se) {
1823
- if (e !== D)
1765
+ if (e !== B)
1824
1766
  throw new Error(
1825
1767
  `Channel Event Checkpoint must use reserved key 'checkpoint' at key '${e}'`
1826
1768
  );
@@ -1858,7 +1800,7 @@ function te(o, e, t) {
1858
1800
  return r;
1859
1801
  return null;
1860
1802
  }
1861
- class no {
1803
+ class Zr {
1862
1804
  constructor(e, t, n) {
1863
1805
  this.blue = e, this.registry = t, this.builtinChannelSchemas = n;
1864
1806
  }
@@ -1969,11 +1911,11 @@ class F extends Error {
1969
1911
  super(e ?? "MustUnderstand failure"), this.name = "MustUnderstandFailure";
1970
1912
  }
1971
1913
  }
1972
- const ro = b["Conversation/Composite Timeline Channel"];
1973
- function oo(o) {
1914
+ const Xr = b["Conversation/Composite Timeline Channel"];
1915
+ function eo(o) {
1974
1916
  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
1917
  [e, t]
1976
- ]), h = (f) => i.isTypeOfBlueId(f.node, ro), d = (f) => {
1918
+ ]), h = (f) => i.isTypeOfBlueId(f.node, Xr), d = (f) => {
1977
1919
  if (u.has(f))
1978
1920
  return u.get(f) ?? null;
1979
1921
  const g = n.get(f);
@@ -1982,11 +1924,11 @@ function oo(o) {
1982
1924
  try {
1983
1925
  const y = i.nodeToSchemaOutput(
1984
1926
  g.node,
1985
- bt
1927
+ St
1986
1928
  );
1987
1929
  return u.set(f, y), y;
1988
1930
  } catch (y) {
1989
- if (io(y))
1931
+ if (to(y))
1990
1932
  throw new E(
1991
1933
  "Failed to parse channel contract",
1992
1934
  C.invalidContract(
@@ -2027,63 +1969,63 @@ function oo(o) {
2027
1969
  };
2028
1970
  v(e);
2029
1971
  }
2030
- function io(o) {
1972
+ function to(o) {
2031
1973
  return o instanceof ve;
2032
1974
  }
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([
1975
+ const no = S["Core/Document Update Channel"], ro = S["Core/Embedded Node Channel"], oo = S["Core/Lifecycle Event Channel"], io = S["Core/Triggered Event Channel"], qe = S["Core/Process Embedded"], so = S["Core/Processing Initialized Marker"], ao = S["Core/Processing Terminated Marker"], co = S["Core/Channel Event Checkpoint"], lo = q["MyOS/Document Anchors"], uo = q["MyOS/Document Links"], ho = q["MyOS/MyOS Participants Orchestration"], po = q["MyOS/MyOS Session Interaction"], fo = q["MyOS/MyOS Worker Agency"], mo = b["Conversation/Composite Timeline Channel"], pe = /* @__PURE__ */ new Map([
2034
1976
  [
2035
- so,
2036
- Tn
1977
+ no,
1978
+ wn
2037
1979
  ],
2038
1980
  [
2039
- ao,
2040
- Rn
1981
+ ro,
1982
+ In
2041
1983
  ],
2042
1984
  [
2043
- co,
2044
- On
1985
+ oo,
1986
+ Tn
2045
1987
  ],
2046
1988
  [
2047
- lo,
2048
- An
1989
+ io,
1990
+ Rn
2049
1991
  ]
2050
- ]), So = /* @__PURE__ */ new Map([
1992
+ ]), go = /* @__PURE__ */ new Map([
2051
1993
  [
2052
- uo,
2053
- Wn
1994
+ so,
1995
+ zn
2054
1996
  ],
2055
1997
  [
2056
- ho,
2057
- Jn
1998
+ ao,
1999
+ Wn
2058
2000
  ],
2059
2001
  [
2060
- po,
2061
- Hn
2002
+ co,
2003
+ $n
2062
2004
  ],
2063
2005
  [
2064
- fo,
2065
- Xn
2006
+ lo,
2007
+ Jn
2066
2008
  ],
2067
2009
  [
2068
- mo,
2069
- nr
2010
+ uo,
2011
+ Zn
2070
2012
  ],
2071
2013
  [
2072
- go,
2073
- or
2014
+ ho,
2015
+ er
2074
2016
  ],
2075
2017
  [
2076
- Eo,
2077
- sr
2018
+ po,
2019
+ nr
2078
2020
  ],
2079
2021
  [
2080
- yo,
2081
- cr
2022
+ fo,
2023
+ or
2082
2024
  ]
2083
2025
  ]);
2084
- class vo {
2026
+ class Eo {
2085
2027
  constructor(e, t) {
2086
- this.registry = e, this.blue = t, this.handlerRegistration = new no(
2028
+ this.registry = e, this.blue = t, this.handlerRegistration = new Zr(
2087
2029
  this.blue,
2088
2030
  this.registry,
2089
2031
  pe
@@ -2116,14 +2058,14 @@ class vo {
2116
2058
  const i = n.getType()?.getBlueId();
2117
2059
  if (!i)
2118
2060
  return;
2119
- if (this.blue.isTypeOfBlueId(n, Ge)) {
2061
+ if (this.blue.isTypeOfBlueId(n, qe)) {
2120
2062
  this.handleProcessEmbedded(e, t, n);
2121
2063
  return;
2122
2064
  }
2123
2065
  const s = te(
2124
2066
  this.blue,
2125
2067
  n,
2126
- So
2068
+ go
2127
2069
  );
2128
2070
  if (s) {
2129
2071
  this.handleMarker(
@@ -2194,7 +2136,7 @@ class vo {
2194
2136
  );
2195
2137
  return;
2196
2138
  }
2197
- throw ht(i) ? new E(
2139
+ throw nt(i) ? new E(
2198
2140
  "Built-in processor-managed channel is missing schema registration",
2199
2141
  C.invalidContract(
2200
2142
  i,
@@ -2207,14 +2149,14 @@ class vo {
2207
2149
  try {
2208
2150
  const r = this.blue.nodeToSchemaOutput(
2209
2151
  n,
2210
- Gn
2152
+ Hn
2211
2153
  );
2212
2154
  e.setEmbedded(r);
2213
2155
  } catch (r) {
2214
2156
  throw fe(r) ? new E(
2215
2157
  "Failed to parse ProcessEmbedded marker",
2216
2158
  C.invalidContract(
2217
- Ge,
2159
+ qe,
2218
2160
  "Failed to parse ProcessEmbedded marker",
2219
2161
  t,
2220
2162
  r
@@ -2233,7 +2175,7 @@ class vo {
2233
2175
  n,
2234
2176
  r
2235
2177
  );
2236
- this.blue.isTypeOfBlueId(n, Co) && this.validateCompositeChannel(
2178
+ this.blue.isTypeOfBlueId(n, mo) && this.validateCompositeChannel(
2237
2179
  t,
2238
2180
  a,
2239
2181
  s,
@@ -2283,7 +2225,7 @@ class vo {
2283
2225
  )
2284
2226
  );
2285
2227
  }
2286
- oo({
2228
+ eo({
2287
2229
  compositeKey: e,
2288
2230
  contract: t,
2289
2231
  scopeContracts: n,
@@ -2298,7 +2240,7 @@ class vo {
2298
2240
  handleMarker(e, t, n, r, i, s) {
2299
2241
  try {
2300
2242
  const a = b["Conversation/Actor Policy"];
2301
- this.blue.isTypeOfBlueId(n, a) && (this.assertSingleActorPolicyMarker(t, s, i), zn(n));
2243
+ this.blue.isTypeOfBlueId(n, a) && (this.assertSingleActorPolicyMarker(t, s, i), xn(n));
2302
2244
  const c = this.blue.nodeToSchemaOutput(
2303
2245
  n,
2304
2246
  r
@@ -2307,7 +2249,7 @@ class vo {
2307
2249
  } catch (a) {
2308
2250
  if (a instanceof E || a instanceof F)
2309
2251
  throw a;
2310
- if (a instanceof Pt)
2252
+ if (a instanceof It)
2311
2253
  throw new E(
2312
2254
  a.message,
2313
2255
  C.invalidContract(i, a.message, t, a)
@@ -2359,24 +2301,24 @@ class vo {
2359
2301
  function fe(o) {
2360
2302
  return o instanceof ve;
2361
2303
  }
2362
- const wo = S["Core/Channel Event Checkpoint"];
2363
- function bo(o) {
2304
+ const yo = S["Core/Channel Event Checkpoint"];
2305
+ function Co(o) {
2364
2306
  return o.jsonValueToNode({
2365
- type: { blueId: wo },
2307
+ type: { blueId: yo },
2366
2308
  lastEvents: {},
2367
2309
  lastSignatures: {}
2368
2310
  });
2369
2311
  }
2370
- function Io() {
2312
+ function So() {
2371
2313
  return {
2372
2314
  lastEvents: {},
2373
2315
  lastSignatures: {}
2374
2316
  };
2375
2317
  }
2376
- function je(o) {
2318
+ function Ge(o) {
2377
2319
  return o != null && Object.prototype.hasOwnProperty.call(o, "lastEvents") && Object.prototype.hasOwnProperty.call(o, "lastSignatures");
2378
2320
  }
2379
- class ko {
2321
+ class vo {
2380
2322
  constructor(e, t, n, r, i) {
2381
2323
  this.markerKey = e, this.checkpoint = t, this.channelKey = n, this.lastEventNode = r, this.lastEventSignature = i;
2382
2324
  }
@@ -2386,28 +2328,28 @@ class ko {
2386
2328
  return e != null && e === this.lastEventSignature;
2387
2329
  }
2388
2330
  }
2389
- class To {
2331
+ class wo {
2390
2332
  constructor(e, t) {
2391
2333
  this.runtime = e, this.signatureFn = t;
2392
2334
  }
2393
2335
  ensureCheckpointMarker(e, t) {
2394
- const n = t.marker(D), r = k(e, pt);
2336
+ const n = t.marker(B), r = k(e, ot);
2395
2337
  if (!n) {
2396
- const i = bo(this.runtime.blue());
2397
- this.runtime.directWrite(r, i), t.registerCheckpointMarker(Io());
2338
+ const i = Co(this.runtime.blue());
2339
+ this.runtime.directWrite(r, i), t.registerCheckpointMarker(So());
2398
2340
  return;
2399
2341
  }
2400
- if (!je(n))
2342
+ if (!Ge(n))
2401
2343
  throw new Error(
2402
2344
  `Reserved key 'checkpoint' must contain a Channel Event Checkpoint at ${r}`
2403
2345
  );
2404
2346
  }
2405
2347
  findCheckpoint(e, t) {
2406
2348
  for (const [n, r] of e.markerEntries()) {
2407
- if (!je(r))
2349
+ if (!Ge(r))
2408
2350
  continue;
2409
2351
  const s = (r.lastEvents?.[t] ?? null)?.clone() ?? null, c = r.lastSignatures?.[t] ?? null ?? this.signatureFn(s);
2410
- return new ko(
2352
+ return new vo(
2411
2353
  n,
2412
2354
  r,
2413
2355
  t,
@@ -2425,17 +2367,17 @@ class To {
2425
2367
  return;
2426
2368
  const s = k(
2427
2369
  e,
2428
- gt(n.markerKey, n.channelKey)
2370
+ at(n.markerKey, n.channelKey)
2429
2371
  ), a = i?.clone() ?? null;
2430
2372
  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
2373
  const c = k(
2432
2374
  e,
2433
- Et(n.markerKey, n.channelKey)
2375
+ ct(n.markerKey, n.channelKey)
2434
2376
  ), u = r == null ? null : new p().setValue(r);
2435
2377
  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
2378
  }
2437
2379
  }
2438
- class Po {
2380
+ class bo {
2439
2381
  constructor(e, t, n) {
2440
2382
  this.runtime = e, this.checkpointManager = t, this.deps = n;
2441
2383
  }
@@ -2562,7 +2504,7 @@ class Po {
2562
2504
  );
2563
2505
  }
2564
2506
  }
2565
- function Ro(o, e) {
2507
+ function Io(o, e) {
2566
2508
  return e.isResolved() ? o.createResolvedNode(e) : o.resolve(e);
2567
2509
  }
2568
2510
  class K extends E {
@@ -2575,8 +2517,8 @@ class V extends Error {
2575
2517
  super(e), this.name = "BoundaryViolationException";
2576
2518
  }
2577
2519
  }
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 {
2520
+ const ko = S["Core/Document Update Channel"], To = S["Core/Embedded Node Channel"], Po = S["Core/Triggered Event Channel"], Ro = S["Core/Lifecycle Event Channel"], je = S["Core/Processing Initialized Marker"], Mo = S["Core/Document Processing Initiated"];
2521
+ class Oo {
2580
2522
  runtime;
2581
2523
  contractLoader;
2582
2524
  channelRunner;
@@ -2635,7 +2577,7 @@ class Do {
2635
2577
  }
2636
2578
  }
2637
2579
  async processExternalEvent(e, t) {
2638
- const n = Ro(this.runtime.blue(), t);
2580
+ const n = Io(this.runtime.blue(), t);
2639
2581
  await this.processPreparedExternalEvent(e, n);
2640
2582
  }
2641
2583
  async processPreparedExternalEvent(e, t) {
@@ -2702,7 +2644,7 @@ class Do {
2702
2644
  continue;
2703
2645
  const c = this.createDocumentUpdateEvent(i, s), u = this.channelsMatching(
2704
2646
  a,
2705
- Mo
2647
+ ko
2706
2648
  );
2707
2649
  for (const h of u) {
2708
2650
  const d = h.contract();
@@ -2740,7 +2682,7 @@ class Do {
2740
2682
  return;
2741
2683
  const i = this.channelsMatching(
2742
2684
  t,
2743
- Ao
2685
+ Ro
2744
2686
  );
2745
2687
  for (const s of i)
2746
2688
  if (await this.channelRunner.runHandlers(
@@ -2802,7 +2744,7 @@ class Do {
2802
2744
  }
2803
2745
  }
2804
2746
  async addInitializationMarker(e, t) {
2805
- const n = new p().setType(new p().setBlueId(Je)).addProperty("documentId", new p().setValue(t)), r = e.resolvePointer(ye);
2747
+ const n = new p().setType(new p().setBlueId(je)).addProperty("documentId", new p().setValue(t)), r = e.resolvePointer(Ee);
2806
2748
  await e.applyPatch({
2807
2749
  op: "ADD",
2808
2750
  path: r,
@@ -2817,7 +2759,7 @@ class Do {
2817
2759
  return;
2818
2760
  const n = this.channelsMatching(
2819
2761
  t,
2820
- Oo
2762
+ To
2821
2763
  );
2822
2764
  if (n.length !== 0)
2823
2765
  for (const r of t.embeddedPaths()) {
@@ -2843,7 +2785,7 @@ class Do {
2843
2785
  return;
2844
2786
  const n = this.runtime.scope(e), r = this.channelsMatching(
2845
2787
  t,
2846
- No
2788
+ Po
2847
2789
  );
2848
2790
  if (r.length === 0) {
2849
2791
  n.clearTriggered();
@@ -2931,21 +2873,21 @@ class Do {
2931
2873
  }
2932
2874
  }
2933
2875
  hasInitializationMarker(e) {
2934
- const t = k(e, ye), n = this.nodeAt(t);
2876
+ const t = k(e, Ee), n = this.nodeAt(t);
2935
2877
  if (!n)
2936
2878
  return !1;
2937
2879
  if (!(n instanceof p)) {
2938
2880
  const i = `Reserved key 'initialized' must contain a Processing Initialized Marker at ${t}`;
2939
2881
  throw new K(i);
2940
2882
  }
2941
- if (n.getType()?.getBlueId() !== Je) {
2883
+ if (n.getType()?.getBlueId() !== je) {
2942
2884
  const i = `Reserved key 'initialized' must contain a Processing Initialized Marker at ${t}`;
2943
2885
  throw new K(i);
2944
2886
  }
2945
2887
  return !0;
2946
2888
  }
2947
2889
  createLifecycleEvent(e) {
2948
- return new p().setType(new p().setBlueId(Bo)).setProperties({
2890
+ return new p().setType(new p().setBlueId(Mo)).setProperties({
2949
2891
  type: new p().setValue("Core/Document Processing Initiated"),
2950
2892
  documentId: new p().setValue(e)
2951
2893
  });
@@ -2958,19 +2900,19 @@ class ie extends Error {
2958
2900
  ), this.fatal = e, this.name = "RunTerminationError";
2959
2901
  }
2960
2902
  }
2961
- const _o = S["Core/Processing Terminated Marker"], Lo = S["Core/Document Processing Terminated"];
2962
- class xo {
2903
+ const No = S["Core/Processing Terminated Marker"], Ao = S["Core/Document Processing Terminated"];
2904
+ class Do {
2963
2905
  constructor(e) {
2964
2906
  this.runtime = e;
2965
2907
  }
2966
2908
  async terminateScope(e, t, n, r, i) {
2967
2909
  e.recordPendingTermination(t, r, i ?? null);
2968
- const s = e.normalizeScope(t), a = k(s, dt);
2910
+ const s = e.normalizeScope(t), a = k(s, rt);
2969
2911
  this.runtime.directWrite(
2970
2912
  a,
2971
- Fo(this.runtime.blue(), r, i)
2913
+ Bo(this.runtime.blue(), r, i)
2972
2914
  ), this.runtime.gasMeter().chargeTerminationMarker();
2973
- const c = n ?? e.bundleForScope(s) ?? null, u = $o(r, i);
2915
+ const c = n ?? e.bundleForScope(s) ?? null, u = _o(r, i);
2974
2916
  if (await e.deliverLifecycle(
2975
2917
  s,
2976
2918
  c,
@@ -2982,32 +2924,32 @@ class xo {
2982
2924
  throw this.runtime.markRunTerminated(), new ie(!1);
2983
2925
  }
2984
2926
  }
2985
- function Fo(o, e, t) {
2986
- return Uo(o, {
2987
- type: { blueId: _o },
2927
+ function Bo(o, e, t) {
2928
+ return Lo(o, {
2929
+ type: { blueId: No },
2988
2930
  cause: e === "GRACEFUL" ? "graceful" : "fatal",
2989
2931
  ...t ? { reason: t } : {}
2990
2932
  });
2991
2933
  }
2992
- function $o(o, e) {
2934
+ function _o(o, e) {
2993
2935
  const t = new p().setType(
2994
- new p().setBlueId(Lo)
2936
+ new p().setBlueId(Ao)
2995
2937
  );
2996
2938
  return t.addProperty(
2997
2939
  "cause",
2998
2940
  new p().setValue(o === "GRACEFUL" ? "graceful" : "fatal")
2999
2941
  ), e && t.addProperty("reason", new p().setValue(e)), t;
3000
2942
  }
3001
- function Uo(o, e) {
2943
+ function Lo(o, e) {
3002
2944
  return o.jsonValueToNode(e);
3003
2945
  }
3004
2946
  const Y = "-";
3005
- class zo {
2947
+ class xo {
3006
2948
  constructor(e) {
3007
2949
  this.document = e;
3008
2950
  }
3009
2951
  applyPatch(e, t) {
3010
- const n = w(e), r = R(t.path), i = Ye(r), s = Qe(this.document, i, "before", r);
2952
+ const n = w(e), r = R(t.path), i = Qe(r), s = Je(this.document, i, "before", r);
3011
2953
  switch (t.op) {
3012
2954
  case "ADD":
3013
2955
  this.applyAdd(i, r, t.val ?? null);
@@ -3019,21 +2961,21 @@ class zo {
3019
2961
  this.applyRemove(i, r);
3020
2962
  break;
3021
2963
  }
3022
- const a = t.op === "REMOVE" ? null : Qe(this.document, i, "after", r);
2964
+ const a = t.op === "REMOVE" ? null : Je(this.document, i, "after", r);
3023
2965
  return {
3024
2966
  path: r,
3025
2967
  before: s,
3026
2968
  after: a,
3027
2969
  op: t.op.toLowerCase(),
3028
2970
  originScope: n,
3029
- cascadeScopes: Vo(n)
2971
+ cascadeScopes: Fo(n)
3030
2972
  };
3031
2973
  }
3032
2974
  directWrite(e, t) {
3033
2975
  const n = R(e);
3034
2976
  if (n === "/")
3035
2977
  throw new Error("Direct write cannot target root document");
3036
- const r = Ye(n), { parent: i, leaf: s } = this.resolveParent(r);
2978
+ const r = Qe(n), { parent: i, leaf: s } = this.resolveParent(r);
3037
2979
  if (s === Y)
3038
2980
  throw new Error(
3039
2981
  `Direct write does not support append token '-' for path ${n}`
@@ -3227,7 +3169,7 @@ class zo {
3227
3169
  }
3228
3170
  }
3229
3171
  }
3230
- function Vo(o) {
3172
+ function Fo(o) {
3231
3173
  const e = [];
3232
3174
  let t = o;
3233
3175
  for (; e.push(t), t !== "/"; ) {
@@ -3236,26 +3178,26 @@ function Vo(o) {
3236
3178
  }
3237
3179
  return e;
3238
3180
  }
3239
- function Qe(o, e, t, n) {
3181
+ function Je(o, e, t, n) {
3240
3182
  try {
3241
3183
  if (e.length === 0)
3242
3184
  return o.clone();
3243
- const r = Ho(o, e, t, n);
3185
+ const r = $o(o, e, t, n);
3244
3186
  return r ? r.clone() : null;
3245
3187
  } catch {
3246
3188
  return null;
3247
3189
  }
3248
3190
  }
3249
- function Ho(o, e, t, n) {
3191
+ function $o(o, e, t, n) {
3250
3192
  let r = o;
3251
3193
  for (let i = 0; i < e.length; i += 1) {
3252
3194
  const s = e[i] ?? "", a = i === e.length - 1;
3253
- if (r = Ko(r, s, a, t, n), !r)
3195
+ if (r = Uo(r, s, a, t, n), !r)
3254
3196
  return null;
3255
3197
  }
3256
3198
  return r;
3257
3199
  }
3258
- function Ko(o, e, t, n, r) {
3200
+ function Uo(o, e, t, n, r) {
3259
3201
  if (!o)
3260
3202
  return null;
3261
3203
  const i = o.getItems();
@@ -3274,7 +3216,7 @@ function Ko(o, e, t, n, r) {
3274
3216
  const a = s[e];
3275
3217
  return a instanceof p ? a : null;
3276
3218
  }
3277
- function Ye(o) {
3219
+ function Qe(o) {
3278
3220
  if (o === "/" || o === "")
3279
3221
  return [];
3280
3222
  const e = o.startsWith("/") ? o.slice(1) : o;
@@ -3316,7 +3258,7 @@ function H(o) {
3316
3258
  function Q(o) {
3317
3259
  return o == null ? new p().setValue(null) : o.clone();
3318
3260
  }
3319
- class Wo {
3261
+ class zo {
3320
3262
  constructor(e) {
3321
3263
  this.path = e;
3322
3264
  }
@@ -3378,7 +3320,7 @@ class Wo {
3378
3320
  return this.cutOff;
3379
3321
  }
3380
3322
  }
3381
- class qo {
3323
+ class Vo {
3382
3324
  scopesMap = /* @__PURE__ */ new Map();
3383
3325
  rootEmissionList = [];
3384
3326
  scopes() {
@@ -3386,7 +3328,7 @@ class qo {
3386
3328
  }
3387
3329
  scope(e) {
3388
3330
  let t = this.scopesMap.get(e);
3389
- return t || (t = new Wo(e), this.scopesMap.set(e, t)), t;
3331
+ return t || (t = new zo(e), this.scopesMap.set(e, t)), t;
3390
3332
  }
3391
3333
  existingScope(e) {
3392
3334
  return this.scopesMap.get(e);
@@ -3404,33 +3346,33 @@ class qo {
3404
3346
  this.scopesMap.delete(e);
3405
3347
  }
3406
3348
  }
3407
- function _t(o) {
3349
+ function At(o) {
3408
3350
  return Math.floor((o + 99) / 100);
3409
3351
  }
3410
- function Go(o) {
3352
+ function Ho(o) {
3411
3353
  const e = R(o);
3412
3354
  return e === "/" ? 0 : e.split("/").length - 1;
3413
3355
  }
3414
- function jo(o) {
3356
+ function Ko(o) {
3415
3357
  return 40 + 5 * Math.max(0, o);
3416
3358
  }
3417
- function Jo(o, e) {
3418
- return 8 + Go(o) + _t(e);
3359
+ function Wo(o, e) {
3360
+ return 8 + Ho(o) + At(e);
3419
3361
  }
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) {
3362
+ const qo = 1e3, Go = 5, jo = 50, Jo = 2, Qo = 10, Yo = 10, Zo = 10, Xo = 20, ei = 20, ti = 30, ni = 30, ri = 100;
3363
+ function oi(o) {
3422
3364
  return 50 + 10 * o;
3423
3365
  }
3424
- function li(o) {
3366
+ function ii(o) {
3425
3367
  return 20 + o;
3426
3368
  }
3427
- function ui(o) {
3369
+ function si(o) {
3428
3370
  return 10 * o;
3429
3371
  }
3430
- function hi(o) {
3372
+ function ai(o) {
3431
3373
  return 20 + o;
3432
3374
  }
3433
- class di {
3375
+ class ci {
3434
3376
  constructor(e) {
3435
3377
  this.blue = e;
3436
3378
  }
@@ -3442,69 +3384,69 @@ class di {
3442
3384
  this.total += e;
3443
3385
  }
3444
3386
  chargeScopeEntry(e) {
3445
- this.add(ci(this.scopeDepth(e)));
3387
+ this.add(oi(this.scopeDepth(e)));
3446
3388
  }
3447
3389
  chargeInitialization() {
3448
- this.add(Qo);
3390
+ this.add(qo);
3449
3391
  }
3450
3392
  chargeChannelMatchAttempt() {
3451
- this.add(Yo);
3393
+ this.add(Go);
3452
3394
  }
3453
3395
  chargeHandlerOverhead() {
3454
- this.add(Zo);
3396
+ this.add(jo);
3455
3397
  }
3456
3398
  chargeBoundaryCheck() {
3457
- this.add(Xo);
3399
+ this.add(Jo);
3458
3400
  }
3459
3401
  chargePatchAddOrReplace(e) {
3460
- this.add(li(this.payloadSizeCharge(e)));
3402
+ this.add(ii(this.payloadSizeCharge(e)));
3461
3403
  }
3462
3404
  chargePatchRemove() {
3463
- this.add(ei);
3405
+ this.add(Qo);
3464
3406
  }
3465
3407
  chargeCascadeRouting(e) {
3466
- e > 0 && this.add(ui(e));
3408
+ e > 0 && this.add(si(e));
3467
3409
  }
3468
3410
  chargeEmitEvent(e) {
3469
- this.add(hi(this.payloadSizeCharge(e)));
3411
+ this.add(ai(this.payloadSizeCharge(e)));
3470
3412
  }
3471
3413
  chargeBridge() {
3472
- this.add(ti);
3414
+ this.add(Yo);
3473
3415
  }
3474
3416
  chargeDrainEvent() {
3475
- this.add(ni);
3417
+ this.add(Zo);
3476
3418
  }
3477
3419
  chargeCheckpointUpdate() {
3478
- this.add(ri);
3420
+ this.add(Xo);
3479
3421
  }
3480
3422
  chargeTerminationMarker() {
3481
- this.add(oi);
3423
+ this.add(ei);
3482
3424
  }
3483
3425
  chargeLifecycleDelivery() {
3484
- this.add(ii);
3426
+ this.add(ti);
3485
3427
  }
3486
3428
  chargeFatalTerminationOverhead() {
3487
- this.add(ai);
3429
+ this.add(ri);
3488
3430
  }
3489
3431
  chargeTriggerEventBase() {
3490
- this.add(si);
3432
+ this.add(ni);
3491
3433
  }
3492
3434
  chargeUpdateDocumentBase(e) {
3493
- this.add(jo(e));
3435
+ this.add(Ko(e));
3494
3436
  }
3495
3437
  chargeDocumentSnapshot(e, t) {
3496
- const n = t ? Le(this.blue, t) : 0;
3497
- this.add(Jo(e, n));
3438
+ const n = t ? _e(this.blue, t) : 0;
3439
+ this.add(Wo(e, n));
3498
3440
  }
3499
3441
  chargeWasmGas(e) {
3500
- const t = en(e);
3442
+ const t = an(e);
3501
3443
  t > 0 && this.add(t);
3502
3444
  }
3503
3445
  payloadSizeCharge(e) {
3504
3446
  if (!e)
3505
3447
  return 0;
3506
- const t = Le(this.blue, e);
3507
- return _t(t);
3448
+ const t = _e(this.blue, e);
3449
+ return At(t);
3508
3450
  }
3509
3451
  scopeDepth(e) {
3510
3452
  const t = w(e);
@@ -3516,12 +3458,12 @@ class di {
3516
3458
  return n;
3517
3459
  }
3518
3460
  }
3519
- class pi {
3461
+ class li {
3520
3462
  constructor(e, t) {
3521
- this.documentRef = e, this.blueRef = t, this.patchEngine = new zo(this.documentRef), this.meter = new di(this.blueRef);
3463
+ this.documentRef = e, this.blueRef = t, this.patchEngine = new xo(this.documentRef), this.meter = new ci(this.blueRef);
3522
3464
  }
3523
3465
  patchEngine;
3524
- emissionRegistry = new qo();
3466
+ emissionRegistry = new Vo();
3525
3467
  meter;
3526
3468
  runTerminated = !1;
3527
3469
  document() {
@@ -3570,15 +3512,15 @@ class pi {
3570
3512
  return this.patchEngine.applyPatch(e, t);
3571
3513
  }
3572
3514
  }
3573
- const fi = S["Core/Processing Initialized Marker"], mi = S["Core/Document Update"];
3574
- class gi {
3515
+ const ui = S["Core/Processing Initialized Marker"], hi = S["Core/Document Update"];
3516
+ class di {
3575
3517
  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(
3518
+ this.contractLoader = e, this.registry = t, this.runtimeRef = new li(r, n);
3519
+ const i = (s) => ut(this.runtimeRef.blue(), s);
3520
+ this.checkpointManager = new wo(
3579
3521
  this.runtimeRef,
3580
3522
  i
3581
- ), this.terminationService = new xo(this.runtimeRef), this.channelRunner = new Po(
3523
+ ), this.terminationService = new Do(this.runtimeRef), this.channelRunner = new bo(
3582
3524
  this.runtimeRef,
3583
3525
  this.checkpointManager,
3584
3526
  {
@@ -3608,7 +3550,7 @@ class gi {
3608
3550
  canonicalSignature: i,
3609
3551
  channelProcessorFor: (s) => this.lookupChannelProcessor(s)
3610
3552
  }
3611
- ), this.scopeExecutor = new Do({
3553
+ ), this.scopeExecutor = new Oo({
3612
3554
  runtime: this.runtimeRef,
3613
3555
  contractLoader: this.contractLoader,
3614
3556
  channelRunner: this.channelRunner,
@@ -3659,7 +3601,7 @@ class gi {
3659
3601
  );
3660
3602
  }
3661
3603
  createContext(e, t, n, r = !1, i = !1) {
3662
- return new Ei(
3604
+ return new pi(
3663
3605
  this,
3664
3606
  t,
3665
3607
  e,
@@ -3800,8 +3742,8 @@ class gi {
3800
3742
  return this.registry.lookupChannelForNode(this.runtimeRef.blue(), e) ?? null;
3801
3743
  }
3802
3744
  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)
3745
+ const n = Jt(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(
3746
+ new p().setBlueId(hi)
3805
3747
  );
3806
3748
  return s.setProperties({
3807
3749
  op: new p().setValue(e.op),
@@ -3841,7 +3783,7 @@ class se {
3841
3783
  return this.initializationMarker(e) != null;
3842
3784
  }
3843
3785
  createExecution(e) {
3844
- return new gi(
3786
+ return new di(
3845
3787
  this.contractLoader,
3846
3788
  this.registry,
3847
3789
  this.blue,
@@ -3876,7 +3818,7 @@ class se {
3876
3818
  "Initialization Marker must be a BlueNode"
3877
3819
  )
3878
3820
  );
3879
- if (n.getType()?.getBlueId() !== fi)
3821
+ if (n.getType()?.getBlueId() !== ui)
3880
3822
  throw new E(
3881
3823
  "Initialization Marker must declare type 'Processing Initialized Marker'",
3882
3824
  C.illegalState(
@@ -3957,7 +3899,7 @@ class se {
3957
3899
  }
3958
3900
  }
3959
3901
  }
3960
- class Ei {
3902
+ class pi {
3961
3903
  constructor(e, t, n, r, i, s) {
3962
3904
  this.execution = e, this.bundle = t, this.scopePathValue = n, this.eventNode = r, this.allowTerminatedWork = i, this.allowReservedMutation = s;
3963
3905
  }
@@ -4051,17 +3993,49 @@ class Ei {
4051
3993
  return !this.allowTerminatedWork && this.execution.isScopeInactive(this.scopePathValue);
4052
3994
  }
4053
3995
  }
4054
- const yi = new $t({
4055
- repositories: [at],
4056
- mergingProcessor: st()
3996
+ class Dt {
3997
+ process(e, t) {
3998
+ const n = t.getValue();
3999
+ if (re(n)) {
4000
+ const r = t.clone();
4001
+ return r.setValue(n), r.setProperties(void 0), r.setItems(void 0), r.setType(void 0), r;
4002
+ }
4003
+ return e;
4004
+ }
4005
+ /**
4006
+ * Post-process to ensure expressions aren't overridden by subsequent processors
4007
+ */
4008
+ postProcess(e, t) {
4009
+ const n = t.getValue();
4010
+ if (re(n) && e.getValue() !== n && n !== void 0) {
4011
+ const r = e.clone();
4012
+ return r.setValue(n), r;
4013
+ }
4014
+ return e;
4015
+ }
4016
+ }
4017
+ function fi() {
4018
+ return new L.SequentialMergingProcessor([
4019
+ new L.ValuePropagator(),
4020
+ new Dt(),
4021
+ new L.TypeAssigner(),
4022
+ new L.ListProcessor(),
4023
+ new L.DictionaryProcessor(),
4024
+ new L.MetadataPropagator(),
4025
+ new L.BasicTypesVerifier()
4026
+ ]);
4027
+ }
4028
+ const mi = new Ut({
4029
+ repositories: [Ye],
4030
+ mergingProcessor: fi()
4057
4031
  });
4058
- class Ci {
4032
+ class gi {
4059
4033
  blue;
4060
4034
  registryRef;
4061
4035
  contractLoaderRef;
4062
4036
  engine;
4063
4037
  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(
4038
+ this.registryRef = e?.registry ?? ue.create().registerDefaults().build(), this.blue = e?.blue ?? mi, this.contractLoaderRef = new Eo(this.registryRef, this.blue), this.engine = new se(
4065
4039
  this.contractLoaderRef,
4066
4040
  this.registryRef,
4067
4041
  this.blue
@@ -4094,10 +4068,10 @@ class Ci {
4094
4068
  return this.contractLoaderRef;
4095
4069
  }
4096
4070
  static builder() {
4097
- return new Si();
4071
+ return new Ei();
4098
4072
  }
4099
4073
  }
4100
- class Si {
4074
+ class Ei {
4101
4075
  contractRegistry;
4102
4076
  blueInstance;
4103
4077
  constructor() {
@@ -4113,117 +4087,117 @@ class Si {
4113
4087
  return this.blueInstance = e, this;
4114
4088
  }
4115
4089
  build() {
4116
- return new Ci({
4090
+ return new gi({
4117
4091
  registry: this.contractRegistry,
4118
4092
  blue: this.blueInstance
4119
4093
  });
4120
4094
  }
4121
4095
  }
4122
- const Hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4096
+ const Ui = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4123
4097
  __proto__: null,
4124
- ExpressionPreserver: it
4098
+ ExpressionPreserver: Dt
4125
4099
  }, Symbol.toStringTag, { value: "Module" }));
4126
4100
  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,
4101
+ It as ActorPolicyLiteralValidationError,
4102
+ Jr as ChannelBinding,
4103
+ bo as ChannelRunner,
4104
+ wo as CheckpointManager,
4105
+ vo as CheckpointRecord,
4106
+ pt as CodeBlockEvaluationError,
4133
4107
  W as ContractBundle,
4134
- to as ContractBundleBuilder,
4135
- vo as ContractLoader,
4136
- pr as ContractProcessorRegistry,
4108
+ Yr as ContractBundleBuilder,
4109
+ Eo as ContractLoader,
4110
+ lr as ContractProcessorRegistry,
4137
4111
  ue as ContractProcessorRegistryBuilder,
4138
4112
  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,
4145
- D as KEY_CHECKPOINT,
4146
- ct as KEY_EMBEDDED,
4147
- lt as KEY_INITIALIZED,
4148
- ut as KEY_TERMINATED,
4149
- Hi as MergingProcessors,
4113
+ li as DocumentProcessingRuntime,
4114
+ gi as DocumentProcessor,
4115
+ Ei as DocumentProcessorBuilder,
4116
+ Vo as EmissionRegistry,
4117
+ ci as GasMeter,
4118
+ Qr as HandlerBinding,
4119
+ B as KEY_CHECKPOINT,
4120
+ Xe as KEY_EMBEDDED,
4121
+ et as KEY_INITIALIZED,
4122
+ tt as KEY_TERMINATED,
4123
+ Ui as MergingProcessors,
4150
4124
  Ie as PROCESSOR_MANAGED_CHANNEL_BLUE_IDS,
4151
- zo as PatchEngine,
4152
- Fi as ProcessorContractConstants,
4125
+ xo as PatchEngine,
4126
+ _i as ProcessorContractConstants,
4153
4127
  se as ProcessorEngine,
4154
4128
  C as ProcessorErrors,
4155
- gi as ProcessorExecution,
4156
- Ei as ProcessorExecutionContext,
4129
+ di as ProcessorExecution,
4130
+ pi as ProcessorExecutionContext,
4157
4131
  E as ProcessorFatalError,
4158
- $i as ProcessorPointerConstants,
4132
+ Li as ProcessorPointerConstants,
4159
4133
  ke as QuickJSEvaluator,
4160
- pt as RELATIVE_CHECKPOINT,
4134
+ ot as RELATIVE_CHECKPOINT,
4161
4135
  G as RELATIVE_CONTRACTS,
4162
- hn as RELATIVE_EMBEDDED,
4163
- ye as RELATIVE_INITIALIZED,
4164
- dt as RELATIVE_TERMINATED,
4136
+ jt as RELATIVE_EMBEDDED,
4137
+ Ee as RELATIVE_INITIALIZED,
4138
+ rt as RELATIVE_TERMINATED,
4165
4139
  be as RESERVED_CONTRACT_KEYS,
4166
4140
  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,
4141
+ Oo as ScopeExecutor,
4142
+ zo as ScopeRuntimeContext,
4143
+ Do as TerminationService,
4144
+ bt as actorPolicyMarkerSchema,
4145
+ _n as actorPolicyRuleSchema,
4146
+ Ni as andThen,
4147
+ ut as canonicalSignature,
4148
+ _e as canonicalSize,
4175
4149
  U as channelContractBaseSchema,
4176
- Hn as channelEventCheckpointSchema,
4177
- bt as compositeTimelineChannelSchema,
4178
- on as containsExpression,
4150
+ $n as channelEventCheckpointSchema,
4151
+ St as compositeTimelineChannelSchema,
4152
+ En as containsExpression,
4179
4153
  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,
4154
+ fi as createDefaultMergingProcessor,
4155
+ gt as createPicomatchShouldResolve,
4156
+ Jn as documentAnchorsMarkerSchema,
4157
+ Zn as documentLinksMarkerSchema,
4158
+ wn as documentUpdateChannelSchema,
4159
+ In as embeddedNodeChannelSchema,
4160
+ Vt as err,
4161
+ mt as evaluateQuickJSExpression,
4162
+ yn as extractExpressionContent,
4163
+ yt as handlerContractBaseSchema,
4164
+ zn as initializationMarkerSchema,
4165
+ Ri as isErr,
4166
+ re as isExpression,
4167
+ Pi as isOk,
4168
+ nt as isProcessorManagedChannelBlueId,
4169
+ Gt as isReservedContractKey,
4170
+ xi as joinRelativePointers,
4171
+ Fi as jsonPatchSchema,
4172
+ Tn as lifecycleChannelSchema,
4173
+ Mi as map,
4174
+ Oi as mapErr,
4201
4175
  M as markerContractBaseSchema,
4202
- xi as match,
4203
- or as myosParticipantsOrchestrationMarkerSchema,
4204
- sr as myosSessionInteractionMarkerSchema,
4205
- _n as myosTimelineChannelSchema,
4206
- cr as myosWorkerAgencyMarkerSchema,
4176
+ Bi as match,
4177
+ er as myosParticipantsOrchestrationMarkerSchema,
4178
+ nr as myosSessionInteractionMarkerSchema,
4179
+ Nn as myosTimelineChannelSchema,
4180
+ or as myosWorkerAgencyMarkerSchema,
4207
4181
  R as normalizePointer,
4208
4182
  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,
4183
+ zt as ok,
4184
+ qn as operationMarkerSchema,
4185
+ Hn as processEmbeddedMarkerSchema,
4186
+ Wn as processingTerminatedMarkerSchema,
4187
+ at as relativeCheckpointLastEvent,
4188
+ ct as relativeCheckpointLastSignature,
4215
4189
  ae as relativeContractsEntry,
4216
- dn as relativizePointer,
4217
- re as resolveNodeExpressions,
4190
+ Jt as relativizePointer,
4191
+ oe as resolveNodeExpressions,
4218
4192
  k as resolvePointer,
4219
- an as resolveTemplateString,
4220
- hr as sequentialWorkflowOperationSchema,
4221
- lr as sequentialWorkflowSchema,
4222
- Vi as sequentialWorkflowStepSchema,
4193
+ Cn as resolveTemplateString,
4194
+ ar as sequentialWorkflowOperationSchema,
4195
+ ir as sequentialWorkflowSchema,
4196
+ $i as sequentialWorkflowStepSchema,
4223
4197
  De as stripSlashes,
4224
- Bn as timelineChannelSchema,
4225
- An as triggeredEventChannelSchema,
4226
- _i as unwrapOr,
4227
- Li as unwrapOrElse,
4228
- zn as validateActorPolicyNode
4198
+ Mn as timelineChannelSchema,
4199
+ Rn as triggeredEventChannelSchema,
4200
+ Ai as unwrapOr,
4201
+ Di as unwrapOrElse,
4202
+ xn as validateActorPolicyNode
4229
4203
  };