@blue-labs/document-processor 3.11.0 → 4.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/api/document-processor.d.ts.map +1 -1
  2. package/dist/constants/processor-contract-constants.d.ts +1 -1
  3. package/dist/engine/checkpoint-manager.d.ts.map +1 -1
  4. package/dist/engine/composite-channel-validation.d.ts.map +1 -1
  5. package/dist/engine/contract-loader.d.ts.map +1 -1
  6. package/dist/engine/processor-engine.d.ts.map +1 -1
  7. package/dist/engine/scope-executor.d.ts.map +1 -1
  8. package/dist/engine/termination-service.d.ts.map +1 -1
  9. package/dist/index.js +1130 -1137
  10. package/dist/model/channels/composite-timeline-channel.d.ts +4 -4
  11. package/dist/model/channels/document-update-channel.d.ts +4 -4
  12. package/dist/model/channels/embedded-node-channel.d.ts +4 -4
  13. package/dist/model/channels/lifecycle-channel.d.ts +4 -4
  14. package/dist/model/channels/myos-timeline-channel.d.ts +4 -4
  15. package/dist/model/channels/timeline-channel.d.ts +4 -4
  16. package/dist/model/channels/triggered-event-channel.d.ts +4 -4
  17. package/dist/model/handlers/sequential-workflow-operation.d.ts +6 -6
  18. package/dist/model/handlers/sequential-workflow.d.ts +6 -6
  19. package/dist/model/markers/actor-policy.d.ts +2 -2
  20. package/dist/model/markers/channel-event-checkpoint.d.ts +2 -2
  21. package/dist/model/markers/document-anchors.d.ts +2 -2
  22. package/dist/model/markers/document-links.d.ts +2 -2
  23. package/dist/model/markers/initialization-marker.d.ts +2 -2
  24. package/dist/model/markers/myos-participants-orchestration.d.ts +2 -2
  25. package/dist/model/markers/myos-session-interaction.d.ts +2 -2
  26. package/dist/model/markers/myos-worker-agency.d.ts +2 -2
  27. package/dist/model/markers/operation.d.ts +2 -2
  28. package/dist/model/markers/process-embedded.d.ts +2 -2
  29. package/dist/model/markers/processing-terminated-marker.d.ts +4 -4
  30. package/dist/model/shared/channel-contract-base.d.ts +4 -4
  31. package/dist/model/shared/handler-contract-base.d.ts +4 -4
  32. package/dist/model/shared/marker-contract-base.d.ts +2 -2
  33. package/dist/registry/processors/actor-policy-marker-processor.d.ts +2 -2
  34. package/dist/registry/processors/actor-policy-marker-processor.d.ts.map +1 -1
  35. package/dist/registry/processors/composite-timeline-channel-processor.d.ts +4 -4
  36. package/dist/registry/processors/composite-timeline-channel-processor.d.ts.map +1 -1
  37. package/dist/registry/processors/generic-marker-processor.d.ts +2 -2
  38. package/dist/registry/processors/generic-marker-processor.d.ts.map +1 -1
  39. package/dist/registry/processors/myos-timeline-channel-processor.d.ts +4 -4
  40. package/dist/registry/processors/myos-timeline-channel-processor.d.ts.map +1 -1
  41. package/dist/registry/processors/operation-marker-processor.d.ts +2 -2
  42. package/dist/registry/processors/operation-marker-processor.d.ts.map +1 -1
  43. package/dist/registry/processors/sequential-workflow-operation-processor.d.ts +6 -6
  44. package/dist/registry/processors/sequential-workflow-operation-processor.d.ts.map +1 -1
  45. package/dist/registry/processors/sequential-workflow-processor.d.ts +6 -6
  46. package/dist/registry/processors/sequential-workflow-processor.d.ts.map +1 -1
  47. package/dist/registry/processors/timeline-channel-processor.d.ts +4 -4
  48. package/dist/registry/processors/timeline-channel-processor.d.ts.map +1 -1
  49. package/dist/registry/processors/utils/operation-utils.d.ts.map +1 -1
  50. package/dist/registry/processors/workflow/operation-matcher.d.ts.map +1 -1
  51. package/dist/repository/semantic-repository.d.ts +176 -0
  52. package/dist/repository/semantic-repository.d.ts.map +1 -0
  53. package/dist/test-support/blue.d.ts.map +1 -1
  54. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,42 +1,42 @@
1
- import { evaluate as Mt } from "@blue-quickjs/quickjs-runtime";
2
- import { validateDv as Nt, DV_LIMIT_DEFAULTS as Ot } from "@blue-quickjs/dv";
3
- import { HOST_V1_MANIFEST as Dt, HOST_V1_HASH as Bt } from "@blue-quickjs/abi-manifest";
4
- import { BlueNode as p, withTypeBlueId as g, blueNodeField as k, Properties as Pe, BlueIdCalculator as Lt, Blue as xt, MergingProcessors as B } from "@blue-labs/language";
5
- import Re from "picomatch";
6
- import { z as l, ZodError as Ce } from "zod";
7
- import { isNullable as pe } from "@blue-labs/shared-utils";
8
- import { repository as _t } from "@blue-repository/types";
9
- function Ft(o) {
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";
3
+ 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
+ import { z as l, ZodError as ve } from "zod";
8
+ import { isNullable as ge } from "@blue-labs/shared-utils";
9
+ function Wt(o) {
10
10
  return { ok: !0, value: o };
11
11
  }
12
- function Ut(o) {
12
+ function qt(o) {
13
13
  return { ok: !1, error: o };
14
14
  }
15
- function bi(o) {
15
+ function Oi(o) {
16
16
  return o.ok;
17
17
  }
18
- function ki(o) {
18
+ function Ni(o) {
19
19
  return !o.ok;
20
20
  }
21
- function Ti(o, e) {
22
- return o.ok ? Ft(e(o.value)) : o;
21
+ function Ai(o, e) {
22
+ return o.ok ? Wt(e(o.value)) : o;
23
23
  }
24
- function Ii(o, e) {
25
- return o.ok ? o : Ut(e(o.error));
24
+ function Bi(o, e) {
25
+ return o.ok ? o : qt(e(o.error));
26
26
  }
27
- function Pi(o, e) {
27
+ function Di(o, e) {
28
28
  return o.ok ? e(o.value) : o;
29
29
  }
30
- function Ri(o, e) {
30
+ function _i(o, e) {
31
31
  return o.ok ? o.value : e;
32
32
  }
33
- function Ai(o, e) {
33
+ function Li(o, e) {
34
34
  return o.ok ? o.value : e(o.error);
35
35
  }
36
- function Mi(o, e) {
36
+ function xi(o, e) {
37
37
  return o.ok ? e.ok(o.value) : e.err(o.error);
38
38
  }
39
- const S = {
39
+ const C = {
40
40
  capabilityFailure(o, e, t) {
41
41
  return { kind: "CapabilityFailure", capability: o, reason: e, details: t };
42
42
  },
@@ -56,14 +56,14 @@ const S = {
56
56
  return { kind: "UnsupportedOp", operation: o, reason: e };
57
57
  }
58
58
  };
59
- function Ht(o) {
59
+ function Gt(o) {
60
60
  return Object.freeze([...o]);
61
61
  }
62
- const zt = {
62
+ const jt = {
63
63
  of(o, e, t) {
64
64
  return {
65
65
  document: o,
66
- triggeredEvents: Ht(e),
66
+ triggeredEvents: Gt(e),
67
67
  totalGas: t,
68
68
  capabilityFailure: !1,
69
69
  failureReason: null
@@ -78,85 +78,273 @@ const zt = {
78
78
  failureReason: e ?? null
79
79
  };
80
80
  }
81
- }, Ge = zt, m = {
82
- "Core/Channel": "DcoJyCh7XXxy1nR5xjy7qfkUgQ1GiZnKKSxh8DJusBSr",
83
- "Core/Channel Event Checkpoint": "B7YQeYdQzUNuzaDQ4tNTd2iJqgd4YnVQkgz4QgymDWWU",
84
- "Core/Contract": "AERp8BWnuUsjoPciAeNXuUWS9fmqPNMdWbxmKn3tcitx",
85
- "Core/Document Processing Initiated": "BrpmpNt5JkapeUvPqYcxgXZrHNZX3R757dRwuXXdfNM2",
86
- "Core/Document Processing Terminated": "5AJiAUgiSDwfCzv9rCYKNaAJu1hm8BXFu7eLNAEHNACr",
87
- "Core/Document Update": "7htwgHAXA9FjUGRytXFfwYMUZz4R3BDMfmeHeGvpscLP",
88
- "Core/Document Update Channel": "6H1iGrDAcqtFE1qv3iyMTj79jCZsMUMxsNUzqYSJNbyR",
89
- "Core/Embedded Node Channel": "Fjbu3QpnUaTruDTcTidETCX2N5STyv7KYxT42PCzGHxm",
90
- "Core/Handler": "9ZE5pGjtSGJgWJG7iAVz4iPEz5CatceX3yb3qp5MpAKJ",
91
- "Core/Json Patch Entry": "Bz49DbfqKC1yJeCfv5RYPZUKTfb7rtZnmreCaz4RsXn5",
92
- "Core/Lifecycle Event Channel": "H2aCCTUcLMTJozWkn7HPUjyFBFxamraw1q8DyWk87zxr",
93
- "Core/Marker": "7QACj919YMRvFCTELCf6jfQTp41RVhtHdE6bPazLUZQ6",
94
- "Core/Process Embedded": "Hu4XkfvyXLSdfFNUwuXebEu3oJeWcMyhBTcRV9AQyKPC",
95
- "Core/Processing Initialized Marker": "EVguxFmq5iFtMZaBQgHfjWDojaoesQ1vEXCQFZ59yL28",
96
- "Core/Processing Terminated Marker": "5NiEhupJ6uF54Q3vs4GwQX4UX4ExtwHpKRVvjKEHtvjR",
97
- "Core/Triggered Event Channel": "C77W4kVGcxL7Mkx9WL9QESPEFFL2GzWAe647s1Efprt"
98
- }, $t = [
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");
278
+ function we(o) {
279
+ const e = at.packages[o];
280
+ if (!e)
281
+ throw new Error(
282
+ `Missing reindexed Blue repository package ${o}.`
283
+ );
284
+ return e.aliases;
285
+ }
286
+ const cn = [
99
287
  "embedded",
100
288
  "initialized",
101
289
  "terminated",
102
290
  "checkpoint"
103
- ], Vt = [
104
- m["Core/Document Update Channel"],
105
- m["Core/Triggered Event Channel"],
106
- m["Core/Lifecycle Event Channel"],
107
- m["Core/Embedded Node Channel"]
108
- ], je = "embedded", Ye = "initialized", Je = "terminated", O = "checkpoint", ye = new Set(
109
- $t
110
- ), ve = new Set(Vt);
111
- function Wt(o) {
112
- return o != null && ye.has(o);
291
+ ], ln = [
292
+ S["Core/Document Update Channel"],
293
+ S["Core/Triggered Event Channel"],
294
+ S["Core/Lifecycle Event Channel"],
295
+ 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) {
300
+ return o != null && be.has(o);
113
301
  }
114
- function Xe(o) {
115
- return o != null && ve.has(
302
+ function ht(o) {
303
+ return o != null && Ie.has(
116
304
  o
117
305
  );
118
306
  }
119
- const Ni = {
120
- KEY_EMBEDDED: je,
121
- KEY_INITIALIZED: Ye,
122
- KEY_TERMINATED: Je,
123
- KEY_CHECKPOINT: O,
124
- RESERVED_CONTRACT_KEYS: ye,
125
- PROCESSOR_MANAGED_CHANNEL_BLUE_IDS: ve,
126
- isReservedContractKey: Wt,
127
- isProcessorManagedChannelBlueId: Xe
128
- }, W = "/contracts", fe = `${W}/${Ye}`, Qe = `${W}/${Je}`, Kt = `${W}/${je}`, Ze = `${W}/${O}`, et = "/lastEvents", tt = "/lastSignatures";
129
- function oe(o) {
130
- return `${W}/${o}`;
131
- }
132
- function nt(o, e) {
133
- return `${oe(o)}${et}/${e}`;
134
- }
135
- function rt(o, e) {
136
- return `${oe(o)}${tt}/${e}`;
137
- }
138
- const Oi = {
139
- RELATIVE_CONTRACTS: W,
140
- RELATIVE_INITIALIZED: fe,
141
- RELATIVE_TERMINATED: Qe,
142
- RELATIVE_EMBEDDED: Kt,
143
- RELATIVE_CHECKPOINT: Ze,
144
- LAST_EVENTS_SUFFIX: et,
145
- LAST_SIGNATURES_SUFFIX: tt,
146
- relativeContractsEntry: oe,
147
- relativeCheckpointLastEvent: nt,
148
- relativeCheckpointLastSignature: rt
307
+ const Fi = {
308
+ KEY_EMBEDDED: ct,
309
+ KEY_INITIALIZED: lt,
310
+ KEY_TERMINATED: ut,
311
+ KEY_CHECKPOINT: D,
312
+ RESERVED_CONTRACT_KEYS: be,
313
+ 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";
317
+ function ae(o) {
318
+ return `${G}/${o}`;
319
+ }
320
+ function gt(o, e) {
321
+ return `${ae(o)}${ft}/${e}`;
322
+ }
323
+ function Et(o, e) {
324
+ return `${ae(o)}${mt}/${e}`;
325
+ }
326
+ const $i = {
327
+ 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,
334
+ relativeContractsEntry: ae,
335
+ relativeCheckpointLastEvent: gt,
336
+ relativeCheckpointLastSignature: Et
149
337
  };
150
- function ot(o) {
338
+ function yt(o) {
151
339
  return o == null || o.length === 0;
152
340
  }
153
- function b(o) {
154
- return ot(o) ? "/" : o.startsWith("/") ? o : `/${o}`;
341
+ function w(o) {
342
+ return yt(o) ? "/" : o.startsWith("/") ? o : `/${o}`;
155
343
  }
156
- function P(o) {
157
- return ot(o) ? "/" : o.startsWith("/") ? o : `/${o}`;
344
+ function R(o) {
345
+ return yt(o) ? "/" : o.startsWith("/") ? o : `/${o}`;
158
346
  }
159
- function Ae(o) {
347
+ function De(o) {
160
348
  if (o == null)
161
349
  return "";
162
350
  let e = o.trim();
@@ -168,16 +356,16 @@ function Ae(o) {
168
356
  e = e.substring(0, e.length - 1);
169
357
  return e;
170
358
  }
171
- function Di(o, e) {
172
- const t = Ae(o), n = Ae(e);
359
+ function Ui(o, e) {
360
+ const t = De(o), n = De(e);
173
361
  return t.length === 0 && n.length === 0 ? "/" : t.length === 0 ? `/${n}` : n.length === 0 ? `/${t}` : `/${t}/${n}`;
174
362
  }
175
- function I(o, e) {
176
- const t = b(o), n = P(e);
363
+ function k(o, e) {
364
+ const t = w(o), n = R(e);
177
365
  return t === "/" ? n : n === "/" || n.length === 1 ? t : `${t}${n}`;
178
366
  }
179
- function qt(o, e) {
180
- const t = b(o), n = P(e);
367
+ function dn(o, e) {
368
+ const t = w(o), n = R(e);
181
369
  if (t === "/" || !n.startsWith(t))
182
370
  return n;
183
371
  if (n.length === t.length)
@@ -185,12 +373,12 @@ function qt(o, e) {
185
373
  const r = n.substring(t.length);
186
374
  return r.length === 0 ? "/" : r.startsWith("/") ? r : `/${r}`;
187
375
  }
188
- function Gt(o) {
376
+ function pn(o) {
189
377
  return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
190
378
  }
191
- var ce, Me;
192
- function jt() {
193
- return Me || (Me = 1, ce = function o(e) {
379
+ var he, _e;
380
+ function fn() {
381
+ return _e || (_e = 1, he = function o(e) {
194
382
  if (typeof e == "number" && isNaN(e))
195
383
  throw new Error("NaN is not allowed");
196
384
  if (typeof e == "number" && !isFinite(e))
@@ -201,50 +389,25 @@ function jt() {
201
389
  const i = n.length === 0 ? "" : ",";
202
390
  return `${n}${i}${o(r)}:${o(e[r])}`;
203
391
  }, "")}}`;
204
- }), ce;
392
+ }), he;
205
393
  }
206
- var Yt = jt();
207
- const Jt = /* @__PURE__ */ Gt(Yt);
208
- function Xt(o, e) {
394
+ var mn = fn();
395
+ const gn = /* @__PURE__ */ pn(mn);
396
+ function En(o, e) {
209
397
  return o.nodeToJson(e, "official");
210
398
  }
211
- function Qt(o, e) {
212
- const t = Xt(o, e);
213
- return Jt(t);
399
+ function yn(o, e) {
400
+ const t = En(o, e);
401
+ return gn(t);
214
402
  }
215
- function it(o, e) {
216
- return e ? Qt(o, e) : null;
403
+ function Ct(o, e) {
404
+ return e ? yn(o, e) : null;
217
405
  }
218
- function Ne(o, e) {
219
- const t = it(o, e);
406
+ function Le(o, e) {
407
+ const t = Ct(o, e);
220
408
  return t == null ? 0 : new TextEncoder().encode(t).length;
221
409
  }
222
- const Zt = 1700, me = BigInt(
223
- Zt
224
- ), en = BigInt(Number.MAX_SAFE_INTEGER), tn = 4e4, nn = 4e4;
225
- function rn(o) {
226
- let e;
227
- if (typeof o == "bigint")
228
- e = o;
229
- else {
230
- if (!Number.isFinite(o) || o <= 0)
231
- return 0;
232
- e = BigInt(Math.trunc(o));
233
- }
234
- if (e <= 0n)
235
- return 0;
236
- const t = (e + me - 1n) / me;
237
- return t > en ? Number.MAX_SAFE_INTEGER : Number(t);
238
- }
239
- function st(o) {
240
- const e = BigInt(Math.max(0, Math.trunc(o)));
241
- return e <= 0n ? 0n : e * me;
242
- }
243
- const at = st(
244
- tn
245
- ), on = st(
246
- nn
247
- ), N = 1, sn = /* @__PURE__ */ new Set([
410
+ const B = 1, Cn = /* @__PURE__ */ new Set([
248
411
  "event",
249
412
  "eventCanonical",
250
413
  "steps",
@@ -253,13 +416,13 @@ const at = st(
253
416
  "currentContract",
254
417
  "currentContractCanonical"
255
418
  ]);
256
- class Se {
419
+ class ke {
257
420
  // Serialize evaluations to avoid races when updating host handler bindings.
258
421
  evaluationQueue = Promise.resolve();
259
422
  handlerState = {
260
- documentGet: () => ({ ok: null, units: N }),
261
- documentGetCanonical: () => ({ ok: null, units: N }),
262
- emit: () => ({ ok: null, units: N })
423
+ documentGet: () => ({ ok: null, units: B }),
424
+ documentGetCanonical: () => ({ ok: null, units: B }),
425
+ emit: () => ({ ok: null, units: B })
263
426
  };
264
427
  handlers = {
265
428
  document: {
@@ -283,42 +446,42 @@ class Se {
283
446
  wasmGasLimit: n,
284
447
  onWasmGasUsed: r
285
448
  }) {
286
- const i = this.prepareBindings(t), s = n ?? at, a = {
449
+ const i = this.prepareBindings(t), s = n ?? tt, a = {
287
450
  code: this.wrapCode(e),
288
451
  abiId: "Host.v1",
289
452
  abiVersion: 1,
290
- abiManifestHash: Bt
453
+ abiManifestHash: Kt
291
454
  };
292
455
  try {
293
- const c = await Mt({
456
+ const c = await Ut({
294
457
  program: a,
295
458
  input: i,
296
459
  gasLimit: s,
297
- manifest: Dt,
460
+ manifest: Ht,
298
461
  handlers: this.handlers
299
462
  });
300
463
  if (n !== void 0 && r && r({
301
464
  used: c.gasUsed,
302
465
  remaining: c.gasRemaining
303
466
  }), !c.ok)
304
- throw ln(c);
305
- return Z(c.value);
467
+ throw wn(c);
468
+ return oe(c.value);
306
469
  } catch (c) {
307
- throw un(c);
470
+ throw bn(c);
308
471
  }
309
472
  }
310
473
  prepareBindings(e) {
311
474
  const t = e ?? {};
312
- an(t);
313
- const n = K(t.event, null, "event"), r = K(
475
+ Sn(t);
476
+ const n = j(t.event, null, "event"), r = j(
314
477
  t.eventCanonical ?? n,
315
478
  n,
316
479
  "eventCanonical"
317
- ), i = K(t.steps, [], "steps"), s = K(
480
+ ), i = j(t.steps, [], "steps"), s = j(
318
481
  t.currentContract,
319
482
  null,
320
483
  "currentContract"
321
- ), a = K(
484
+ ), a = j(
322
485
  t.currentContractCanonical,
323
486
  s,
324
487
  "currentContractCanonical"
@@ -329,11 +492,11 @@ class Se {
329
492
  currentContract: s,
330
493
  currentContractCanonical: a
331
494
  }, u = this.extractDocumentBinding(t), h = typeof u?.canonical == "function" ? u.canonical : void 0;
332
- this.handlerState.documentGet = Oe(u), this.handlerState.documentGetCanonical = Oe(
495
+ this.handlerState.documentGet = xe(u), this.handlerState.documentGetCanonical = xe(
333
496
  h ?? u
334
497
  );
335
498
  const d = this.extractEmitBinding(t);
336
- return this.handlerState.emit = cn(d), c;
499
+ return this.handlerState.emit = vn(d), c;
337
500
  }
338
501
  extractDocumentBinding(e) {
339
502
  if (!Object.prototype.hasOwnProperty.call(e, "document"))
@@ -363,15 +526,15 @@ ${e}
363
526
  })()`;
364
527
  }
365
528
  }
366
- function an(o) {
529
+ function Sn(o) {
367
530
  for (const e of Object.keys(o))
368
- if (!sn.has(e))
531
+ if (!Cn.has(e))
369
532
  throw new TypeError(`Unsupported QuickJS binding: "${e}"`);
370
533
  }
371
- function K(o, e, t) {
534
+ function j(o, e, t) {
372
535
  const n = o === void 0 ? e : o;
373
536
  try {
374
- Nt(n, { limits: Ot });
537
+ zt(n, { limits: Vt });
375
538
  } catch (r) {
376
539
  const i = r instanceof Error ? r.message : String(r);
377
540
  throw new TypeError(
@@ -380,53 +543,53 @@ function K(o, e, t) {
380
543
  }
381
544
  return n;
382
545
  }
383
- function Oe(o) {
546
+ function xe(o) {
384
547
  return o ? (e) => {
385
548
  try {
386
549
  const t = o(e);
387
550
  return {
388
551
  ok: t === void 0 ? null : t,
389
- units: N
552
+ units: B
390
553
  };
391
554
  } catch {
392
555
  return {
393
556
  err: { code: "INVALID_PATH", tag: "host/invalid_path" },
394
- units: N
557
+ units: B
395
558
  };
396
559
  }
397
- } : () => ({ ok: null, units: N });
560
+ } : () => ({ ok: null, units: B });
398
561
  }
399
- function cn(o) {
562
+ function vn(o) {
400
563
  return o ? (e) => {
401
564
  try {
402
- if (o(Z(e)) instanceof Promise)
565
+ if (o(oe(e)) instanceof Promise)
403
566
  throw new Error("Async emit handlers are not supported");
404
- return { ok: null, units: N };
567
+ return { ok: null, units: B };
405
568
  } catch {
406
569
  return {
407
570
  err: { code: "LIMIT_EXCEEDED", tag: "host/limit" },
408
- units: N
571
+ units: B
409
572
  };
410
573
  }
411
- } : () => ({ ok: null, units: N });
574
+ } : () => ({ ok: null, units: B });
412
575
  }
413
- function Z(o) {
576
+ function oe(o) {
414
577
  if (o == null)
415
578
  return o;
416
579
  if (Array.isArray(o))
417
- return o.map((e) => Z(e));
580
+ return o.map((e) => oe(e));
418
581
  if (typeof o == "object") {
419
582
  const e = Object.getPrototypeOf(o);
420
583
  if (e !== Object.prototype && e !== null)
421
584
  return o;
422
585
  const t = {};
423
586
  for (const [n, r] of Object.entries(o))
424
- t[n] = Z(r);
587
+ t[n] = oe(r);
425
588
  return t;
426
589
  }
427
590
  return o;
428
591
  }
429
- function ln(o) {
592
+ function wn(o) {
430
593
  if (o.ok)
431
594
  return new Error("Unexpected evaluation result");
432
595
  if (o.type === "invalid-output") {
@@ -443,170 +606,50 @@ function ln(o) {
443
606
  const t = e.message || o.message, n = new Error(t);
444
607
  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);
445
608
  }
446
- function un(o) {
609
+ function bn(o) {
447
610
  return o instanceof Error ? o : new Error(String(o ?? "Unknown error"));
448
611
  }
449
- const De = 120;
450
- function hn(o) {
451
- return o.length <= De ? o : `${o.slice(0, De - 3)}...`;
452
- }
453
- class ct extends Error {
454
- constructor(e, t) {
455
- super(`Failed to evaluate code block: ${hn(e)}`, { cause: t }), this.code = e, this.cause = t, this.name = "CodeBlockEvaluationError";
456
- }
457
- }
458
- const lt = /^\$\{([\s\S]*)\}$/, dn = /\$\{([\s\S]+?)\}/, pn = /\$\{([\s\S]+?)\}/g;
459
- function ee(o) {
460
- if (typeof o != "string" || !lt.test(o))
461
- return !1;
462
- const e = o.indexOf("${"), t = o.lastIndexOf("${");
463
- return e === t;
464
- }
465
- function fn(o) {
466
- return typeof o != "string" ? !1 : lt.test(o) ? !0 : dn.test(o);
467
- }
468
- function mn(o) {
469
- if (!ee(o))
470
- throw new Error(`Invalid expression: ${o}`);
471
- return o.slice(2, -1);
472
- }
473
- async function ut(o, e, t, n, r) {
474
- const i = `return (${e});`;
475
- try {
476
- return await o.evaluate({
477
- code: i,
478
- bindings: t,
479
- wasmGasLimit: n,
480
- onWasmGasUsed: r
481
- });
482
- } catch (s) {
483
- throw new ct(e, s);
484
- }
485
- }
486
- async function gn(o, e, t, n, r) {
487
- let i = "", s = 0;
488
- for (const a of e.matchAll(pn)) {
489
- const c = a[0], u = a[1], h = a.index ?? 0;
490
- i += e.slice(s, h);
491
- const d = await ut(
492
- o,
493
- u,
494
- t,
495
- n,
496
- r
497
- );
498
- i += d == null ? "" : String(d), s = h + c.length;
499
- }
500
- return i += e.slice(s), i;
501
- }
502
- function ht({
503
- include: o,
504
- exclude: e = [],
505
- options: t
506
- }) {
507
- const n = { dot: !0, ...t ?? {} }, r = o.map(
508
- (s) => Re(s, n)
509
- ), i = e.map(
510
- (s) => Re(s, n)
511
- );
512
- return (s) => r.some((a) => a(s)) && !i.some((a) => a(s));
513
- }
514
- async function te(o) {
515
- const {
516
- evaluator: e,
517
- node: t,
518
- bindings: n,
519
- shouldResolve: r,
520
- shouldDescend: i = () => !0,
521
- context: s,
522
- pointer: a = "/"
523
- } = o, c = on, u = ({
524
- used: E
525
- }) => {
526
- s.gasMeter().chargeWasmGas(E);
527
- }, h = t.clone();
528
- if (!i(a, h))
529
- return h;
530
- const d = h.getValue();
531
- if (d !== void 0) {
532
- if (typeof d == "string" && r(a)) {
533
- if (ee(d)) {
534
- const E = mn(d), v = await ut(
535
- e,
536
- E,
537
- n,
538
- c,
539
- u
540
- );
541
- return s.blue.jsonValueToNode(v ?? null);
542
- } else if (fn(d)) {
543
- const E = await gn(
544
- e,
545
- d,
546
- n,
547
- c,
548
- u
549
- );
550
- return new p().setValue(E);
551
- }
552
- }
553
- return h;
554
- }
555
- const w = h.getItems?.();
556
- if (Array.isArray(w)) {
557
- const E = await Promise.all(
558
- w.map(
559
- (v, A) => te({
560
- ...o,
561
- node: v,
562
- pointer: `${a}/${A}`
563
- })
564
- )
565
- );
566
- return h.setItems(E), h;
567
- }
568
- const f = h.getProperties?.();
569
- if (f) {
570
- const E = {};
571
- for (const [v, A] of Object.entries(f)) {
572
- const D = a === "/" ? `/${v}` : `${a}/${v}`;
573
- E[v] = await te({
574
- ...o,
575
- node: A,
576
- pointer: D
577
- });
578
- }
579
- h.setProperties(E);
580
- }
581
- return h;
582
- }
583
- const ie = g(m["Core/Contract"])(l.object({
612
+ const P = {
613
+ "Core/Channel": "DcoJyCh7XXxy1nR5xjy7qfkUgQ1GiZnKKSxh8DJusBSr",
614
+ "Core/Channel Event Checkpoint": "B7YQeYdQzUNuzaDQ4tNTd2iJqgd4YnVQkgz4QgymDWWU",
615
+ "Core/Contract": "AERp8BWnuUsjoPciAeNXuUWS9fmqPNMdWbxmKn3tcitx",
616
+ "Core/Document Update Channel": "6H1iGrDAcqtFE1qv3iyMTj79jCZsMUMxsNUzqYSJNbyR",
617
+ "Core/Embedded Node Channel": "Fjbu3QpnUaTruDTcTidETCX2N5STyv7KYxT42PCzGHxm",
618
+ "Core/Handler": "9ZE5pGjtSGJgWJG7iAVz4iPEz5CatceX3yb3qp5MpAKJ",
619
+ "Core/Json Patch Entry": "Bz49DbfqKC1yJeCfv5RYPZUKTfb7rtZnmreCaz4RsXn5",
620
+ "Core/Lifecycle Event Channel": "H2aCCTUcLMTJozWkn7HPUjyFBFxamraw1q8DyWk87zxr",
621
+ "Core/Marker": "7QACj919YMRvFCTELCf6jfQTp41RVhtHdE6bPazLUZQ6",
622
+ "Core/Process Embedded": "Hu4XkfvyXLSdfFNUwuXebEu3oJeWcMyhBTcRV9AQyKPC",
623
+ "Core/Processing Initialized Marker": "EVguxFmq5iFtMZaBQgHfjWDojaoesQ1vEXCQFZ59yL28",
624
+ "Core/Processing Terminated Marker": "5NiEhupJ6uF54Q3vs4GwQX4UX4ExtwHpKRVvjKEHtvjR",
625
+ "Core/Triggered Event Channel": "C77W4kVGcxL7Mkx9WL9QESPEFFL2GzWAe647s1Efprt"
626
+ }, ce = m(P["Core/Contract"])(l.object({
584
627
  description: l.string().optional(),
585
628
  name: l.string().optional(),
586
629
  order: l.number().optional()
587
- })), we = ie, _ = g(m["Core/Channel"])(ie.extend({
630
+ })), Te = ce, $ = m(P["Core/Channel"])(ce.extend({
588
631
  description: l.string().optional(),
589
- event: k().optional(),
632
+ event: I().optional(),
590
633
  name: l.string().optional()
591
- })), F = _.merge(
592
- we
634
+ })), U = $.merge(
635
+ Te
593
636
  ).extend({
594
637
  path: l.string().optional(),
595
- definition: k().optional()
596
- }), dt = g(m["Core/Handler"])(ie.extend({
638
+ definition: I().optional()
639
+ }), St = m(P["Core/Handler"])(ce.extend({
597
640
  channel: l.string().optional(),
598
641
  description: l.string().optional(),
599
- event: k().optional(),
642
+ event: I().optional(),
600
643
  name: l.string().optional()
601
- })), pt = dt.merge(we), U = g(m["Core/Marker"])(ie.extend({
644
+ })), vt = St.merge(Te), z = m(P["Core/Marker"])(ce.extend({
602
645
  description: l.string().optional(),
603
646
  name: l.string().optional()
604
- })), R = U.merge(we), En = l.object({
647
+ })), M = z.merge(Te), In = l.object({
605
648
  op: l.enum(["ADD", "REPLACE", "REMOVE"]),
606
649
  path: l.string(),
607
- val: k().optional()
608
- }), Bi = g("JsonPatch")(
609
- En
650
+ val: I().optional()
651
+ }), zi = m("JsonPatch")(
652
+ In
610
653
  ).superRefine((o, e) => {
611
654
  o.op === "REMOVE" && o.val !== void 0 && e.addIssue({
612
655
  code: l.ZodIssueCode.custom,
@@ -617,88 +660,48 @@ const ie = g(m["Core/Contract"])(l.object({
617
660
  message: `${o.op} operations must include a value`,
618
661
  path: ["val"]
619
662
  });
620
- }), Cn = g(m["Core/Document Update Channel"])(_.extend({
663
+ }), kn = m(P["Core/Document Update Channel"])($.extend({
621
664
  description: l.string().optional(),
622
665
  name: l.string().optional(),
623
666
  path: l.string().optional()
624
- })), yn = Cn.merge(
625
- F
626
- ), vn = g(m["Core/Embedded Node Channel"])(_.extend({
667
+ })), Tn = kn.merge(
668
+ U
669
+ ), Pn = m(P["Core/Embedded Node Channel"])($.extend({
627
670
  childPath: l.string().optional(),
628
671
  description: l.string().optional(),
629
672
  name: l.string().optional()
630
- })), Sn = vn.merge(
631
- F
632
- ), wn = g(m["Core/Lifecycle Event Channel"])(_.extend({
673
+ })), Rn = Pn.merge(
674
+ U
675
+ ), Mn = m(P["Core/Lifecycle Event Channel"])($.extend({
633
676
  description: l.string().optional(),
634
677
  name: l.string().optional()
635
- })), bn = wn.merge(
636
- F
637
- ), kn = g(m["Core/Triggered Event Channel"])(_.extend({
678
+ })), On = Mn.merge(
679
+ U
680
+ ), Nn = m(P["Core/Triggered Event Channel"])($.extend({
638
681
  description: l.string().optional(),
639
682
  name: l.string().optional()
640
- })), Tn = kn.merge(F), C = {
641
- "Conversation/Accept Change Operation": "APk3siB8g9pvWLG3qyqtGjRNNGB7RDpFWQtG4epj5Avv",
642
- "Conversation/Accept Change Workflow": "Eh2y8JypsGTdFMpEGEK64vBdGtaJ9Q7Q5t7ChqHafwCV",
683
+ })), An = Nn.merge(U), T = {
643
684
  "Conversation/Actor": "CN5efWVizJbRsMCw8YWRfT2q9vM9XfeGDN9wFvYcvMnQ",
644
685
  "Conversation/Actor Policy": "EeWqP1Tw9WXo5nq8kx93FuTw9HRqpv34mbWFjH72nR7o",
645
- "Conversation/Agent Actor": "FM1K89eMHRDN6vHtHfGwFNojmgvSnACuYdtc3qQ6qPYB",
646
- "Conversation/API Call": "HCTXeqkKBbVbsa3WfN2bPFSX7mthbtZ6ZhzByf9VDJJs",
647
- "Conversation/Browser Session": "8UVUYbhSVBAx7BAupgjSeeFuuyrgdFcGbaXBitEZD9B1",
648
- "Conversation/Change Operation": "Hd5uuFjqxyw5mrFPgJf2mcatij8ddtmGAMJu9ij5K1tc",
649
- "Conversation/Change Request": "FW7iYkzig4fepCdwfCdgNJw4DQ1fKwnAUf3YpjgfTPmG",
650
- "Conversation/Change Workflow": "4pFvBSYyitoq8rWqTmY5rLywU2tpZsivDUCAo5vwoAT9",
651
- "Conversation/Chat Message": "AkUKoKY1hHY1CytCrAXDPKCd4md1QGmn1WNcQtWBsyAD",
652
686
  "Conversation/Composite Timeline Channel": "HsNatiPt2YvmkWQoqtfrFCbdp75ZUBLBUkWeq84WTfnr",
653
- "Conversation/Contracts Change Policy": "6FDVZRQwuhXdXtnXq8kRg3f3DM8SUdbN3TT8rSGJcS2U",
654
- "Conversation/Customer Action Requested": "6ZLHE59mb1ytEjW78jmYCU3DXxj4Fzfjea7tz3VEkwyX",
655
- "Conversation/Customer Action Responded": "GFyes2Px1cY5Yfk2oiA1qpzhz2purMED3g1L74Bu1Ho6",
656
- "Conversation/Customer Consent": "5UeiZ6EC1y3KMafuX6ioNqHHM62S5Xf3ULrC9L3m7MJx",
657
- "Conversation/Customer Consent Revoked": "9h1AhEexkxxKLYv1NHbEESYCPtvW7Nt51msGtuQC5jWK",
658
- "Conversation/Document Bootstrap Completed": "HH5u8PwvdXrARNkT4oyWR4QjgkwhKfPWGnNtEwfUBiUg",
659
- "Conversation/Document Bootstrap Failed": "B8b1ayXMrAYbwkqaJfAS6Aspp2kZyJda8ay9QeFkZ9MH",
660
- "Conversation/Document Bootstrap Requested": "4derXUpwPZDDkBpYPCTMr6t3mbeGU7AUYmvfW22cZior",
661
- "Conversation/Document Bootstrap Responded": "1Ucfmhtb9xjvyLxLKSVkqXZjVVuAdXyzdjb11QG11Uv",
662
- "Conversation/Document Request": "7jZFAkmthHTeg6zAu5kBCDHswd2J5HNVnYPo9y435sin",
663
- "Conversation/Document Section": "JBfupL6eyZsqj7CYbReFaS5ga784SLT8aP8r9W64vbLm",
664
- "Conversation/Document Section Change Entry": "9xv7YjqsSn7W7P8rnUhSpdWGfSrgL4Jt3cmiACJT5VQs",
665
- "Conversation/Document Section Changes": "DEmFwGa1sWm2BKhrN98LREKiB8j8B8kFAo7KBkkaojnN",
666
- "Conversation/Document Status": "58B8orsFkxxy7bWqjLXJmtBs2b5rwnNQNbeoAbGhPkJc",
667
- "Conversation/Event": "5Wz4G9qcnBJnntYRkz4dgLK5bSuoMpYJZj4j5M59z4we",
668
- "Conversation/Inform User About Pending Action": "8Akr9sdTkxBqMYWSGh8gHgoXQQeYEPfhV4s8fXeKTd9W",
669
687
  "Conversation/JavaScript Code": "ExZxT61PSpWHpEAtP2WKMXXqxEYN7Z13j7Zv36Dp99kS",
670
- "Conversation/Lifecycle Event": "5YZEAtUaHhNfnVnwtSsyBnBakpcSwdL75UcgtrtnqeYn",
671
688
  "Conversation/Operation": "BoAiqVUZv9Fum3wFqaX2JnQMBHJLxJSo2V9U2UBmCfsC",
672
689
  "Conversation/Operation Request": "HM4Ku4LFcjC5MxnhPMRwQ8w3BbHmJKKZfHTTzsd4jbJq",
673
- "Conversation/Principal Actor": "FqipbF4UATjCRTqovGdREPAoaxj59NECb9xtnWRW1SWi",
674
- "Conversation/Propose Change Operation": "BeiedmmcKDhStxDnnQqUaXDJLofWSnqX6CazKTvVpfbW",
675
- "Conversation/Propose Change Workflow": "7icTT1chbH3UA2ybXgpfSSyNEAR4Wmm3EkbdGFaZSydo",
676
- "Conversation/Proposed Change Invalid": "EbGQYtYR9UNAxcn7auCCujXmnz6DWxMpqVcgYSsKE85M",
677
- "Conversation/Reject Change Operation": "4T5AmhKAXSJAAHDEjtVJ2FQgCyz2qyd9qG5uoh627Ux6",
678
- "Conversation/Reject Change Workflow": "DUjCaEniHH5oDXU3Ss5jWWft3pT9TUcNhv7HoCDU1NTB",
679
- "Conversation/Request": "8f9UhHMbRe62sFgzQVheToaJPYi7t7HPNVvpQTbqfL5n",
680
- "Conversation/Response": "36epvrpVHZLjapbeZsNodz2NDnm7XZeNZcnkWHgkP1pp",
681
690
  "Conversation/Sequential Workflow": "7X3LkN54Yp88JgZbppPhP6hM3Jqiqv8Z2i4kS7phXtQe",
682
691
  "Conversation/Sequential Workflow Operation": "CGdxkNjPcsdescqLPz6SNLsMyak6demQQr7RoKNHbCyv",
683
692
  "Conversation/Sequential Workflow Step": "HYsLiqsqk7t98d5fK6YxKEQGeqBaHNVjM4rRNdxK4yUW",
684
- "Conversation/Source": "6ADCPYXkusrp4dL1FC126L2ccuzYfqGdBf1w6EXh2hnC",
685
- "Conversation/Status Change": "C48nKSkbxraMSv4gCiGYVHKFjmtK12k63Yasn95zknWE",
686
- "Conversation/Status Completed": "EhPFqrRCreg7StsZEcW8fRQ1FQVdqYSsMSis2CHHJZ1G",
687
- "Conversation/Status Failed": "Guus3kHbivXvy5G93yhiKs3Pc8sxCc4XVvSo7CqLsQEc",
688
- "Conversation/Status In Progress": "56Lhu3Z2oF3kuYG41eZAK8TvgVtRNevkbRi4D31kKWZm",
689
- "Conversation/Status Pending": "ETAPjwZVyYEfPUWvXkCWAuybBhYUayg4hKC2V7mLXmsv",
690
693
  "Conversation/Timeline": "3Ge54FsGJaaeZmm8nTKJdS6HVdYhiR3g18fDwg3Ev1Sa",
691
694
  "Conversation/Timeline Channel": "EvuCWsG1E6WJQg8QXmk6rwMANYTZjoLWVZ1vYQWUwdTH",
692
695
  "Conversation/Timeline Entry": "29tcU8MkrV3KL5HqH6DHJDPPfJMheoqwiKJsaHnrp9hT",
693
696
  "Conversation/Trigger Event": "2bSWEoMSZwzf32Hnr4BDVsuq8NRjrWEpnhZvMZAJGhh2",
694
697
  "Conversation/Update Document": "FtHZJzH4hqAoGxFBjsmy1svfT4BwEBB4aHpFSZycZLLa"
695
- }, ft = g(C["Conversation/Timeline Channel"])(_.extend({
698
+ }, wt = m(T["Conversation/Timeline Channel"])($.extend({
696
699
  description: l.string().optional(),
697
700
  name: l.string().optional(),
698
701
  timelineId: l.string().optional()
699
- })), In = ft.merge(
700
- F
701
- ), T = {
702
+ })), Bn = wt.merge(
703
+ U
704
+ ), A = {
702
705
  "MyOS/Document Anchor": "HS9yo34TGEAM2LGcNbLh7XPN4goPRhqdGZQkiyh473Wb",
703
706
  "MyOS/Document Anchors": "7Usvk6dZMVqas3yqs23ZEXn1zu1YDPjgYiZFNYaw3puH",
704
707
  "MyOS/Document Links": "4cmrbevB6K23ZenjqwmNxpnaw6RF4VB3wkP7XB59V7W5",
@@ -709,16 +712,16 @@ const ie = g(m["Core/Contract"])(l.object({
709
712
  "MyOS/MyOS Timeline Channel": "HCF8mXnX3dFjQ8osjxb4Wzm2Nm1DoXnTYuA5sPnV7NTs",
710
713
  "MyOS/MyOS Timeline Entry": "F3mQaGQ1B48yMedKZojFTxeKxtee4xU66QBbiyEMvGeZ",
711
714
  "MyOS/MyOS Worker Agency": "4Lix4AKXvBDvrwxw2htSdYFKxL4wugEQzqoSEYet5Dh1"
712
- }, Pn = g(T["MyOS/MyOS Timeline Channel"])(ft.extend({
715
+ }, Dn = m(A["MyOS/MyOS Timeline Channel"])(wt.extend({
713
716
  accountId: l.string().optional(),
714
717
  description: l.string().optional(),
715
718
  email: l.string().optional(),
716
719
  name: l.string().optional()
717
- })), Rn = Pn.merge(F), An = g(C["Conversation/Composite Timeline Channel"])(_.extend({
720
+ })), _n = Dn.merge(U), Ln = m(T["Conversation/Composite Timeline Channel"])($.extend({
718
721
  channels: l.array(l.string()).optional(),
719
722
  description: l.string().optional(),
720
723
  name: l.string().optional()
721
- })), mt = An.merge(F), Mn = g(C["Conversation/Actor Policy"])(U.extend({
724
+ })), bt = Ln.merge(U), xn = m(T["Conversation/Actor Policy"])(z.extend({
722
725
  description: l.string().optional(),
723
726
  name: l.string().optional(),
724
727
  operations: l.record(l.string(), l.object({
@@ -726,25 +729,25 @@ const ie = g(m["Core/Contract"])(l.object({
726
729
  requiresActor: l.string().optional(),
727
730
  requiresSource: l.string().optional()
728
731
  })).optional()
729
- })), gt = ["principal", "agent", "any"], Et = [
732
+ })), It = ["principal", "agent", "any"], kt = [
730
733
  "browserSession",
731
734
  "apiCall",
732
735
  "documentRequest"
733
- ], Nn = l.enum(gt), Be = l.enum(Et), On = l.object({
734
- excludeSource: Be.optional(),
735
- requiresActor: Nn.optional(),
736
- requiresSource: Be.optional()
737
- }), Ct = Mn.merge(
738
- R
736
+ ], Fn = l.enum(It), Fe = l.enum(kt), $n = l.object({
737
+ excludeSource: Fe.optional(),
738
+ requiresActor: Fn.optional(),
739
+ requiresSource: Fe.optional()
740
+ }), Tt = xn.merge(
741
+ M
739
742
  ).extend({
740
- operations: l.record(l.string(), On).optional()
741
- }), Dn = new Set(gt), Le = new Set(Et);
742
- class yt extends Error {
743
+ operations: l.record(l.string(), $n).optional()
744
+ }), Un = new Set(It), $e = new Set(kt);
745
+ class Pt extends Error {
743
746
  constructor(e) {
744
747
  super(e), this.name = "ActorPolicyLiteralValidationError";
745
748
  }
746
749
  }
747
- function Bn(o) {
750
+ function zn(o) {
748
751
  const e = o.getProperties()?.operations;
749
752
  if (!(e instanceof p))
750
753
  return;
@@ -754,124 +757,124 @@ function Bn(o) {
754
757
  if (!(r instanceof p))
755
758
  continue;
756
759
  const i = r.getProperties();
757
- i && (le(
760
+ i && (de(
758
761
  n,
759
762
  "requiresActor",
760
763
  i.requiresActor,
761
- Dn
762
- ), le(
764
+ Un
765
+ ), de(
763
766
  n,
764
767
  "requiresSource",
765
768
  i.requiresSource,
766
- Le
767
- ), le(
769
+ $e
770
+ ), de(
768
771
  n,
769
772
  "excludeSource",
770
773
  i.excludeSource,
771
- Le
774
+ $e
772
775
  ));
773
776
  }
774
777
  }
775
- function le(o, e, t, n) {
778
+ function de(o, e, t, n) {
776
779
  if (!(t instanceof p))
777
780
  return;
778
781
  const r = t.getValue();
779
782
  if (r != null && (typeof r != "string" || !n.has(r)))
780
- throw new yt(
783
+ throw new Pt(
781
784
  `Actor Policy operation '${o}' declares unsupported ${e} '${String(
782
785
  r
783
786
  )}'`
784
787
  );
785
788
  }
786
- const Ln = g(m["Core/Channel Event Checkpoint"])(U.extend({
789
+ const Vn = m(P["Core/Channel Event Checkpoint"])(z.extend({
787
790
  description: l.string().optional(),
788
- lastEvents: l.record(l.string(), k()).optional(),
791
+ lastEvents: l.record(l.string(), I()).optional(),
789
792
  name: l.string().optional()
790
- })), xn = Ln.merge(R).extend({
793
+ })), Hn = Vn.merge(M).extend({
791
794
  lastSignatures: l.record(l.string()).optional()
792
- }), _n = g(m["Core/Processing Initialized Marker"])(U.extend({
795
+ }), Kn = m(P["Core/Processing Initialized Marker"])(z.extend({
793
796
  description: l.string().optional(),
794
797
  documentId: l.string().optional(),
795
798
  name: l.string().optional()
796
- })), Fn = _n.merge(R), Un = g(m["Core/Process Embedded"])(U.extend({
799
+ })), Wn = Kn.merge(M), qn = m(P["Core/Process Embedded"])(z.extend({
797
800
  description: l.string().optional(),
798
801
  name: l.string().optional(),
799
802
  paths: l.array(l.string()).optional()
800
- })), Hn = Un.merge(
801
- R
802
- ), zn = g(m["Core/Processing Terminated Marker"])(U.extend({
803
+ })), Gn = qn.merge(
804
+ M
805
+ ), jn = m(P["Core/Processing Terminated Marker"])(z.extend({
803
806
  cause: l.string().optional(),
804
807
  description: l.string().optional(),
805
808
  name: l.string().optional(),
806
809
  reason: l.string().optional()
807
- })), $n = zn.merge(R), Y = g(C["Conversation/Operation"])(U.extend({
810
+ })), Jn = jn.merge(M), Z = m(T["Conversation/Operation"])(z.extend({
808
811
  channel: l.string().optional(),
809
812
  description: l.string().optional(),
810
813
  name: l.string().optional(),
811
- request: k().optional()
812
- })), Vn = Y.merge(
813
- R
814
- ), Wn = g(T["MyOS/Document Anchor"])(l.object({
814
+ request: I().optional()
815
+ })), Qn = Z.merge(
816
+ M
817
+ ), Yn = m(A["MyOS/Document Anchor"])(l.object({
815
818
  description: l.string().optional(),
816
819
  name: l.string().optional(),
817
- template: k().optional()
818
- })), Kn = g(T["MyOS/Document Anchors"])(l.object({}).catchall(Wn)), qn = Kn.merge(R), Gn = g(T["MyOS/Link"])(l.object({
820
+ 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({
819
822
  anchor: l.string().optional(),
820
823
  description: l.string().optional(),
821
824
  name: l.string().optional()
822
- })), jn = g(T["MyOS/Document Links"])(l.object({}).catchall(Gn)), Yn = jn.merge(
823
- R
824
- ), Jn = g(T["MyOS/MyOS Participants Orchestration"])(l.object({
825
+ })), tr = m(A["MyOS/Document Links"])(l.object({}).catchall(er)), nr = tr.merge(
826
+ M
827
+ ), rr = m(A["MyOS/MyOS Participants Orchestration"])(l.object({
825
828
  name: l.string().optional()
826
- })), Xn = Jn.merge(R), Qn = g(T["MyOS/MyOS Session Interaction"])(l.object({
829
+ })), or = rr.merge(M), ir = m(A["MyOS/MyOS Session Interaction"])(l.object({
827
830
  name: l.string().optional()
828
- })), Zn = Qn.merge(R), er = g(T["MyOS/MyOS Worker Agency"])(l.object({
831
+ })), sr = ir.merge(M), ar = m(A["MyOS/MyOS Worker Agency"])(l.object({
829
832
  name: l.string().optional()
830
- })), tr = er.merge(
831
- R
832
- ), se = g(C["Conversation/Sequential Workflow Step"])(l.object({
833
+ })), cr = ar.merge(
834
+ M
835
+ ), le = m(T["Conversation/Sequential Workflow Step"])(l.object({
833
836
  description: l.string().optional(),
834
837
  name: l.string().optional()
835
- })), vt = g(C["Conversation/Sequential Workflow"])(dt.extend({
838
+ })), Rt = m(T["Conversation/Sequential Workflow"])(St.extend({
836
839
  description: l.string().optional(),
837
840
  name: l.string().optional(),
838
- steps: l.array(se).optional()
839
- })), Li = k(), nr = vt.merge(pt).extend({
840
- steps: l.array(k()).optional()
841
- }), rr = g(C["Conversation/Sequential Workflow Operation"])(vt.extend({
841
+ steps: l.array(le).optional()
842
+ })), Vi = I(), lr = Rt.merge(vt).extend({
843
+ steps: l.array(I()).optional()
844
+ }), ur = m(T["Conversation/Sequential Workflow Operation"])(Rt.extend({
842
845
  description: l.string().optional(),
843
846
  name: l.string().optional(),
844
847
  operation: l.string().optional()
845
- })), or = rr.merge(
846
- pt
848
+ })), hr = ur.merge(
849
+ vt
847
850
  ).extend({
848
- steps: l.array(k()).optional()
851
+ steps: l.array(I()).optional()
849
852
  });
850
- function ir(o) {
853
+ function dr(o) {
851
854
  if (!Array.isArray(o.blueIds) || o.blueIds.length === 0)
852
855
  throw new Error("Contract processors must declare at least one BlueId");
853
856
  for (const e of o.blueIds)
854
857
  if (typeof e != "string" || e.trim().length === 0)
855
858
  throw new Error("Contract processor BlueIds must be non-empty strings");
856
859
  }
857
- function J(o, e) {
858
- ir(o);
860
+ function X(o, e) {
861
+ dr(o);
859
862
  for (const t of o.blueIds)
860
863
  e.set(t, o);
861
864
  }
862
- class sr {
865
+ class pr {
863
866
  processorsByBlueId = /* @__PURE__ */ new Map();
864
867
  handlerProcessors = /* @__PURE__ */ new Map();
865
868
  channelProcessors = /* @__PURE__ */ new Map();
866
869
  markerProcessors = /* @__PURE__ */ new Map();
867
870
  registerHandler(e) {
868
- J(e, this.handlerProcessors), this.registerProcessorMap(e);
871
+ X(e, this.handlerProcessors), this.registerProcessorMap(e);
869
872
  }
870
873
  registerChannel(e) {
871
- J(e, this.channelProcessors), this.registerProcessorMap(e);
874
+ X(e, this.channelProcessors), this.registerProcessorMap(e);
872
875
  }
873
876
  registerMarker(e) {
874
- J(e, this.markerProcessors), this.registerProcessorMap(e);
877
+ X(e, this.markerProcessors), this.registerProcessorMap(e);
875
878
  }
876
879
  register(e) {
877
880
  switch (e.kind) {
@@ -914,7 +917,7 @@ class sr {
914
917
  return new Map(this.processorsByBlueId);
915
918
  }
916
919
  registerProcessorMap(e) {
917
- J(e, this.processorsByBlueId);
920
+ X(e, this.processorsByBlueId);
918
921
  }
919
922
  lookupProcessorForNode(e, t, n) {
920
923
  const r = t.getType();
@@ -959,26 +962,26 @@ class sr {
959
962
  return { blueId: s.blueId, value: s.value };
960
963
  }
961
964
  }
962
- class ar {
965
+ class fr {
963
966
  kind = "marker";
964
967
  blueIds = [
965
- C["Conversation/Actor Policy"]
968
+ b["Conversation/Actor Policy"]
966
969
  ];
967
- schema = Ct;
970
+ schema = Tt;
968
971
  }
969
- const cr = "compositeSourceChannelKey";
970
- function lr(o, e) {
972
+ const mr = "compositeSourceChannelKey";
973
+ function gr(o, e) {
971
974
  return `${o}::${e}`;
972
975
  }
973
- function ur(o) {
976
+ function Er(o) {
974
977
  return o != null && Object.prototype.hasOwnProperty.call(o, "lastEvents") && Object.prototype.hasOwnProperty.call(o, "lastSignatures");
975
978
  }
976
- class hr {
979
+ class yr {
977
980
  kind = "channel";
978
981
  blueIds = [
979
- C["Conversation/Composite Timeline Channel"]
982
+ b["Conversation/Composite Timeline Channel"]
980
983
  ];
981
- schema = mt;
984
+ schema = bt;
982
985
  /**
983
986
  * Fallback match hook that delegates to {@link evaluate} for consistent behavior.
984
987
  */
@@ -1013,33 +1016,33 @@ class hr {
1013
1016
  throw new Error(
1014
1017
  `No processor registered for child channel '${u}' (${h.blueId})`
1015
1018
  );
1016
- const w = n.clone(), f = {
1019
+ const v = n.clone(), f = {
1017
1020
  ...t,
1018
- event: w,
1021
+ event: v,
1019
1022
  bindingKey: u
1020
- }, E = h.contract, v = E.event;
1021
- if (v && !t.blue.isTypeOfNode(w, v) || !await d.matches(E, f))
1023
+ }, g = h.contract, y = g.event;
1024
+ if (y && !t.blue.isTypeOfNode(v, y) || !await d.matches(g, f))
1022
1025
  continue;
1023
- const D = d.channelize, Te = (D ? D.call(d, E, f) : void 0) ?? w.clone();
1024
- this.enrichEvent(Te, u);
1025
- const Ie = lr(
1026
+ const _ = d.channelize, Me = (_ ? _.call(d, g, f) : void 0) ?? v.clone();
1027
+ this.enrichEvent(Me, u);
1028
+ const Oe = gr(
1026
1029
  t.bindingKey,
1027
1030
  u
1028
- ), At = await this.shouldProcessChild({
1031
+ ), Lt = await this.shouldProcessChild({
1029
1032
  childProcessor: d,
1030
- childContract: E,
1033
+ childContract: g,
1031
1034
  context: {
1032
1035
  ...f,
1033
1036
  event: n.clone()
1034
1037
  },
1035
- checkpointKey: Ie,
1038
+ checkpointKey: Oe,
1036
1039
  markers: t.markers
1037
1040
  });
1038
1041
  c.push({
1039
- eventNode: Te,
1042
+ eventNode: Me,
1040
1043
  eventId: a,
1041
- checkpointKey: Ie,
1042
- shouldProcess: At
1044
+ checkpointKey: Oe,
1045
+ shouldProcess: Lt
1043
1046
  });
1044
1047
  }
1045
1048
  return {
@@ -1061,7 +1064,7 @@ class hr {
1061
1064
  const n = e.getProperties() ?? {}, r = n.meta instanceof p ? n.meta.clone() : new p(), i = r.getProperties() ?? {};
1062
1065
  r.setProperties({
1063
1066
  ...i,
1064
- [cr]: new p().setValue(t)
1067
+ [mr]: new p().setValue(t)
1065
1068
  }), e.setProperties({ ...n, meta: r });
1066
1069
  }
1067
1070
  /**
@@ -1083,57 +1086,57 @@ class hr {
1083
1086
  * Resolve the checkpoint marker for the current scope, if present.
1084
1087
  */
1085
1088
  resolveCheckpoint(e) {
1086
- const t = e.get(O);
1087
- return ur(t) ? t : null;
1089
+ const t = e.get(D);
1090
+ return Er(t) ? t : null;
1088
1091
  }
1089
1092
  }
1090
- const dr = g(C["Conversation/Actor"])(l.object({
1093
+ const Cr = m(T["Conversation/Actor"])(l.object({
1091
1094
  description: l.string().optional(),
1092
1095
  name: l.string().optional()
1093
- })), St = g(C["Conversation/Timeline"])(l.object({
1096
+ })), Mt = m(T["Conversation/Timeline"])(l.object({
1094
1097
  description: l.string().optional(),
1095
1098
  name: l.string().optional(),
1096
1099
  timelineId: l.string().optional()
1097
- })), M = g(C["Conversation/Timeline Entry"])(l.object({
1098
- actor: dr.optional(),
1100
+ })), N = m(T["Conversation/Timeline Entry"])(l.object({
1101
+ actor: Cr.optional(),
1099
1102
  description: l.string().optional(),
1100
- message: k().optional(),
1103
+ message: I().optional(),
1101
1104
  name: l.string().optional(),
1102
- prevEntry: k().optional(),
1103
- source: k().optional(),
1104
- timeline: St.optional(),
1105
+ prevEntry: I().optional(),
1106
+ source: I().optional(),
1107
+ timeline: Mt.optional(),
1105
1108
  timestamp: l.number().optional()
1106
- })), pr = g(T["MyOS/MyOS Timeline"])(St.extend({
1109
+ })), Sr = m(A["MyOS/MyOS Timeline"])(Mt.extend({
1107
1110
  accountId: l.string().optional(),
1108
1111
  description: l.string().optional(),
1109
1112
  name: l.string().optional()
1110
- })), xe = g(T["MyOS/MyOS Timeline Entry"])(M.extend({
1113
+ })), Ue = m(A["MyOS/MyOS Timeline Entry"])(N.extend({
1111
1114
  description: l.string().optional(),
1112
1115
  name: l.string().optional(),
1113
- timeline: pr.optional()
1116
+ timeline: Sr.optional()
1114
1117
  }));
1115
- function _e(o, e) {
1116
- return e && o.isTypeOf(e, M, { checkSchemaExtensions: !0 }) ? o.nodeToSchemaOutput(e, M) : null;
1118
+ function ze(o, e) {
1119
+ return e && o.isTypeOf(e, N, { checkSchemaExtensions: !0 }) ? o.nodeToSchemaOutput(e, N) : null;
1117
1120
  }
1118
- function wt(o, e, t) {
1119
- const n = _e(o, e), r = _e(o, t);
1121
+ function Ot(o, e, t) {
1122
+ const n = ze(o, e), r = ze(o, t);
1120
1123
  if (!n || !r)
1121
1124
  return !0;
1122
1125
  const i = n.timestamp, s = r.timestamp;
1123
1126
  return typeof i != "number" || typeof s != "number" ? !0 : i >= s;
1124
1127
  }
1125
- function Fe(o, e) {
1126
- return o.isTypeOf(e, xe) ? o.nodeToSchemaOutput(e, xe) : o.isTypeOf(e, M) ? o.nodeToSchemaOutput(e, M) : null;
1128
+ function Ve(o, e) {
1129
+ return o.isTypeOf(e, Ue) ? o.nodeToSchemaOutput(e, Ue) : o.isTypeOf(e, N) ? o.nodeToSchemaOutput(e, N) : null;
1127
1130
  }
1128
- class fr {
1131
+ class vr {
1129
1132
  kind = "channel";
1130
- blueIds = [T["MyOS/MyOS Timeline Channel"]];
1131
- schema = Rn;
1133
+ blueIds = [q["MyOS/MyOS Timeline Channel"]];
1134
+ schema = _n;
1132
1135
  matches(e, t) {
1133
1136
  const { event: n, blue: r } = t;
1134
1137
  if (!n)
1135
1138
  return !1;
1136
- const i = Fe(r, n);
1139
+ const i = Ve(r, n);
1137
1140
  if (!i)
1138
1141
  return !1;
1139
1142
  const s = i.timeline?.timelineId;
@@ -1141,40 +1144,40 @@ class fr {
1141
1144
  }
1142
1145
  channelize(e, t) {
1143
1146
  const { event: n, blue: r } = t;
1144
- return !n || !Fe(r, n) ? null : n.clone();
1147
+ return !n || !Ve(r, n) ? null : n.clone();
1145
1148
  }
1146
1149
  isNewerEvent(e, t, n) {
1147
1150
  const { event: r, blue: i } = t;
1148
- return r ? wt(i, r, n) : !0;
1151
+ return r ? Ot(i, r, n) : !0;
1149
1152
  }
1150
1153
  }
1151
- class mr {
1154
+ class wr {
1152
1155
  kind = "channel";
1153
- blueIds = [C["Conversation/Timeline Channel"]];
1154
- schema = In;
1156
+ blueIds = [b["Conversation/Timeline Channel"]];
1157
+ schema = Bn;
1155
1158
  matches(e, t) {
1156
1159
  const { event: n, blue: r } = t;
1157
- if (!n || !r.isTypeOf(n, M))
1160
+ if (!n || !r.isTypeOf(n, N))
1158
1161
  return !1;
1159
- const s = r.nodeToSchemaOutput(n, M).timeline?.timelineId;
1162
+ const s = r.nodeToSchemaOutput(n, N).timeline?.timelineId;
1160
1163
  return !(!s || !e.timelineId || s !== e.timelineId);
1161
1164
  }
1162
1165
  channelize(e, t) {
1163
1166
  const { event: n, blue: r } = t;
1164
- return !n || !r.isTypeOf(n, M) ? null : n.clone();
1167
+ return !n || !r.isTypeOf(n, N) ? null : n.clone();
1165
1168
  }
1166
1169
  isNewerEvent(e, t, n) {
1167
1170
  const { event: r, blue: i } = t;
1168
- return r ? wt(i, r, n) : !0;
1171
+ return r ? Ot(i, r, n) : !0;
1169
1172
  }
1170
1173
  }
1171
- const Ue = g(C["Conversation/Trigger Event"])(se.extend({
1174
+ const He = m(T["Conversation/Trigger Event"])(le.extend({
1172
1175
  description: l.string().optional(),
1173
- event: k().optional(),
1176
+ event: I().optional(),
1174
1177
  name: l.string().optional()
1175
1178
  }));
1176
- function be(o) {
1177
- const { context: e, eventNode: t, stepResults: n, contractNode: r } = o, i = Er(e), s = r != null ? e.blue.nodeToJson(r, "simple") : null, a = r != null ? e.blue.nodeToJson(r, "official") : s;
1179
+ 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;
1178
1181
  return {
1179
1182
  event: e.blue.nodeToJson(t, "simple"),
1180
1183
  eventCanonical: e.blue.nodeToJson(t, "official"),
@@ -1184,17 +1187,17 @@ function be(o) {
1184
1187
  currentContractCanonical: a
1185
1188
  };
1186
1189
  }
1187
- const gr = /* @__PURE__ */ new Set(["blueId", "name", "description", "value"]);
1188
- function Er(o) {
1190
+ const br = /* @__PURE__ */ new Set(["blueId", "name", "description", "value"]);
1191
+ function Ir(o) {
1189
1192
  const e = (i) => {
1190
1193
  if (i === "/")
1191
1194
  return !1;
1192
1195
  const s = i.lastIndexOf("/"), a = i.substring(s + 1);
1193
- return gr.has(a);
1196
+ return br.has(a);
1194
1197
  }, t = (i) => {
1195
1198
  const s = i == null ? "/" : typeof i == "string" ? i : (() => {
1196
1199
  throw new TypeError("document() expects a string pointer");
1197
- })(), a = s.startsWith("/") ? s : o.resolvePointer(s), c = P(a), u = o.documentAt(c);
1200
+ })(), a = s.startsWith("/") ? s : o.resolvePointer(s), c = R(a), u = o.documentAt(c);
1198
1201
  return o.gasMeter().chargeDocumentSnapshot(c, u), { snapshot: u, normalizedPointer: c };
1199
1202
  }, n = (i, s) => {
1200
1203
  const { snapshot: a, normalizedPointer: c } = t(i);
@@ -1203,70 +1206,70 @@ function Er(o) {
1203
1206
  }, r = ((i) => n(i, "simple"));
1204
1207
  return r.canonical = (i) => n(i, "official"), r;
1205
1208
  }
1206
- class Cr {
1209
+ class kr {
1207
1210
  supportedBlueIds = [
1208
- C["Conversation/Trigger Event"]
1211
+ b["Conversation/Trigger Event"]
1209
1212
  ];
1210
- evaluator = new Se();
1213
+ evaluator = new ke();
1211
1214
  async execute(e) {
1212
1215
  const { stepNode: t, context: n } = e;
1213
- if (!n.blue.isTypeOf(t, Ue))
1216
+ if (!n.blue.isTypeOf(t, He))
1214
1217
  return n.throwFatal("Trigger Event step payload is invalid");
1215
1218
  n.gasMeter().chargeTriggerEventBase();
1216
- const r = await te({
1219
+ const r = await re({
1217
1220
  evaluator: this.evaluator,
1218
1221
  node: t,
1219
- bindings: be(e),
1220
- shouldResolve: ht({
1222
+ bindings: Pe(e),
1223
+ shouldResolve: ot({
1221
1224
  include: ["/event", "/event/**"]
1222
1225
  }),
1223
- shouldDescend: yr(),
1226
+ shouldDescend: Tr(),
1224
1227
  context: n
1225
1228
  }), s = n.blue.nodeToSchemaOutput(
1226
1229
  r,
1227
- Ue
1230
+ He
1228
1231
  ).event;
1229
- if (pe(s))
1232
+ if (ge(s))
1230
1233
  return n.throwFatal(
1231
1234
  "Trigger Event step must declare event payload"
1232
1235
  );
1233
1236
  n.emitEvent(s.clone());
1234
1237
  }
1235
1238
  }
1236
- function yr() {
1237
- return (o, e) => o === "/event" || !o.startsWith("/event/") ? !0 : !vr(e);
1239
+ function Tr() {
1240
+ return (o, e) => o === "/event" || !o.startsWith("/event/") ? !0 : !Pr(e);
1238
1241
  }
1239
- function vr(o) {
1242
+ function Pr(o) {
1240
1243
  const e = o.getProperties?.();
1241
1244
  return e ? !!e.contracts : !1;
1242
1245
  }
1243
- const He = g(C["Conversation/JavaScript Code"])(se.extend({
1246
+ const Ke = m(T["Conversation/JavaScript Code"])(le.extend({
1244
1247
  code: l.string().optional(),
1245
1248
  description: l.string().optional(),
1246
1249
  name: l.string().optional()
1247
1250
  }));
1248
- class Sr {
1251
+ class Rr {
1249
1252
  supportedBlueIds = [
1250
- C["Conversation/JavaScript Code"]
1253
+ b["Conversation/JavaScript Code"]
1251
1254
  ];
1252
- evaluator = new Se();
1255
+ evaluator = new ke();
1253
1256
  wasmGasLimit;
1254
1257
  constructor(e = {}) {
1255
- this.wasmGasLimit = e.wasmGasLimit ?? at;
1258
+ this.wasmGasLimit = e.wasmGasLimit ?? tt;
1256
1259
  }
1257
1260
  async execute(e) {
1258
1261
  const { context: t, stepNode: n } = e, { blue: r } = t;
1259
- if (!r.isTypeOf(n, He))
1262
+ if (!r.isTypeOf(n, Ke))
1260
1263
  return t.throwFatal("JavaScript Code step payload is invalid");
1261
1264
  const s = r.nodeToSchemaOutput(
1262
1265
  n,
1263
- He
1266
+ Ke
1264
1267
  ).code;
1265
1268
  if (!s)
1266
1269
  return t.throwFatal(
1267
1270
  "JavaScript Code step must include code to execute"
1268
1271
  );
1269
- const a = be(e);
1272
+ const a = Pe(e);
1270
1273
  try {
1271
1274
  const c = await this.evaluator.evaluate({
1272
1275
  code: s,
@@ -1276,7 +1279,7 @@ class Sr {
1276
1279
  });
1277
1280
  return this.handleEvents(c, t), c;
1278
1281
  } catch (c) {
1279
- throw new ct(s, c);
1282
+ throw new Xe(s, c);
1280
1283
  }
1281
1284
  }
1282
1285
  handleEvents(e, t) {
@@ -1290,31 +1293,31 @@ class Sr {
1290
1293
  }
1291
1294
  }
1292
1295
  }
1293
- const wr = g(m["Core/Json Patch Entry"])(l.object({
1296
+ const Mr = m(P["Core/Json Patch Entry"])(l.object({
1294
1297
  description: l.string().optional(),
1295
1298
  name: l.string().optional(),
1296
1299
  op: l.string().optional(),
1297
1300
  path: l.string().optional(),
1298
- val: k().optional()
1299
- })), ze = g(C["Conversation/Update Document"])(se.extend({
1300
- changeset: l.array(wr).optional(),
1301
+ val: I().optional()
1302
+ })), We = m(T["Conversation/Update Document"])(le.extend({
1303
+ changeset: l.array(Mr).optional(),
1301
1304
  description: l.string().optional(),
1302
1305
  name: l.string().optional()
1303
1306
  }));
1304
- class br {
1307
+ class Or {
1305
1308
  supportedBlueIds = [
1306
- C["Conversation/Update Document"]
1309
+ b["Conversation/Update Document"]
1307
1310
  ];
1308
- evaluator = new Se();
1311
+ evaluator = new ke();
1309
1312
  async execute(e) {
1310
1313
  const { context: t, stepNode: n } = e, { blue: r } = t;
1311
- if (!r.isTypeOf(n, ze))
1314
+ if (!r.isTypeOf(n, We))
1312
1315
  return t.throwFatal("Update Document step payload is invalid");
1313
- const i = await te({
1316
+ const i = await re({
1314
1317
  evaluator: this.evaluator,
1315
1318
  node: n,
1316
- bindings: be(e),
1317
- shouldResolve: ht({
1319
+ bindings: Pe(e),
1320
+ shouldResolve: ot({
1318
1321
  include: ["/changeset", "/changeset/**"]
1319
1322
  }),
1320
1323
  context: t
@@ -1328,7 +1331,7 @@ class br {
1328
1331
  extractChanges(e, t) {
1329
1332
  return t.blue.nodeToSchemaOutput(
1330
1333
  e,
1331
- ze
1334
+ We
1332
1335
  ).changeset ?? [];
1333
1336
  }
1334
1337
  createPatch(e, t) {
@@ -1348,14 +1351,14 @@ class br {
1348
1351
  return n.length === 0 ? t.throwFatal("Update Document path cannot be empty") : n;
1349
1352
  }
1350
1353
  }
1351
- const ke = [
1352
- new Cr(),
1353
- new Sr(),
1354
- new br()
1354
+ const Re = [
1355
+ new kr(),
1356
+ new Rr(),
1357
+ new Or()
1355
1358
  ];
1356
- class bt {
1359
+ class Nt {
1357
1360
  executorIndex;
1358
- constructor(e = ke) {
1361
+ constructor(e = Re) {
1359
1362
  const t = /* @__PURE__ */ new Map();
1360
1363
  for (const n of e)
1361
1364
  for (const r of n.supportedBlueIds)
@@ -1369,18 +1372,18 @@ class bt {
1369
1372
  const a = {};
1370
1373
  for (const [c, u] of s.entries()) {
1371
1374
  const h = u.getType?.()?.getBlueId();
1372
- if (pe(h))
1375
+ if (ge(h))
1373
1376
  return r.throwFatal(
1374
1377
  "Sequential workflow step is missing type metadata"
1375
1378
  );
1376
1379
  const d = this.executorIndex.get(h);
1377
- if (pe(d)) {
1378
- const E = u.getType?.()?.getName?.() ?? h;
1380
+ if (ge(d)) {
1381
+ const g = u.getType?.()?.getName?.() ?? h;
1379
1382
  return r.throwFatal(
1380
- `Unsupported workflow step type "${E}"`
1383
+ `Unsupported workflow step type "${g}"`
1381
1384
  );
1382
1385
  }
1383
- const w = {
1386
+ const v = {
1384
1387
  workflow: t,
1385
1388
  stepNode: u,
1386
1389
  eventNode: n,
@@ -1388,10 +1391,10 @@ class bt {
1388
1391
  stepResults: a,
1389
1392
  stepIndex: c,
1390
1393
  contractNode: i
1391
- }, f = await d.execute(w);
1394
+ }, f = await d.execute(v);
1392
1395
  if (f !== void 0) {
1393
- const E = this.stepResultKey(u, c);
1394
- a[E] = f;
1396
+ const g = this.stepResultKey(u, c);
1397
+ a[g] = f;
1395
1398
  }
1396
1399
  }
1397
1400
  return a;
@@ -1401,15 +1404,15 @@ class bt {
1401
1404
  return n && typeof n == "string" && n.length > 0 ? n : `Step${t + 1}`;
1402
1405
  }
1403
1406
  }
1404
- class kr {
1407
+ class Nr {
1405
1408
  kind = "handler";
1406
1409
  blueIds = [
1407
- C["Conversation/Sequential Workflow"]
1410
+ b["Conversation/Sequential Workflow"]
1408
1411
  ];
1409
- schema = nr;
1412
+ schema = lr;
1410
1413
  runner;
1411
- constructor(e = ke) {
1412
- this.runner = new bt(e);
1414
+ constructor(e = Re) {
1415
+ this.runner = new Nt(e);
1413
1416
  }
1414
1417
  async matches(e, t) {
1415
1418
  const n = t.event();
@@ -1425,25 +1428,25 @@ class kr {
1425
1428
  });
1426
1429
  }
1427
1430
  }
1428
- class Tr {
1431
+ class Ar {
1429
1432
  kind = "marker";
1430
- blueIds = [m["Core/Marker"]];
1431
- schema = R;
1433
+ blueIds = [S["Core/Marker"]];
1434
+ schema = M;
1432
1435
  }
1433
- class Ir {
1436
+ class Br {
1434
1437
  kind = "marker";
1435
- blueIds = [C["Conversation/Operation"]];
1436
- schema = Vn;
1438
+ blueIds = [b["Conversation/Operation"]];
1439
+ schema = Qn;
1437
1440
  }
1438
- const ge = g(C["Conversation/Operation Request"])(l.object({
1441
+ const Ce = m(T["Conversation/Operation Request"])(l.object({
1439
1442
  allowNewerVersion: l.boolean().optional(),
1440
1443
  description: l.string().optional(),
1441
- document: k().optional(),
1444
+ document: I().optional(),
1442
1445
  name: l.string().optional(),
1443
1446
  operation: l.string().optional(),
1444
- request: k().optional()
1447
+ request: I().optional()
1445
1448
  }));
1446
- function kt(o) {
1449
+ function At(o) {
1447
1450
  const e = o.channel;
1448
1451
  if (typeof e == "string") {
1449
1452
  const t = e.trim();
@@ -1452,64 +1455,78 @@ function kt(o) {
1452
1455
  }
1453
1456
  return null;
1454
1457
  }
1455
- function Pr(o, e) {
1458
+ function Dr(o, e) {
1456
1459
  const t = o.getProperties()?.document;
1457
- return t instanceof p ? e.blue.calculateBlueIdSync(t) : null;
1460
+ if (!(t instanceof p))
1461
+ return null;
1462
+ const n = t.getReferenceBlueId();
1463
+ return n || e.blue.calculateBlueIdSync(t);
1458
1464
  }
1459
- function Rr(o, e) {
1460
- if (e.isTypeOf(o, ge, {
1465
+ function _r(o, e) {
1466
+ if (e.isTypeOf(o, Ce, {
1461
1467
  checkSchemaExtensions: !0
1462
1468
  }))
1463
1469
  return o;
1464
- if (e.isTypeOf(o, M, {
1470
+ if (e.isTypeOf(o, N, {
1465
1471
  checkSchemaExtensions: !0
1466
1472
  })) {
1467
- const n = e.nodeToSchemaOutput(o, M).message;
1468
- if (n && e.isTypeOf(n, ge, {
1473
+ const n = e.nodeToSchemaOutput(o, N).message;
1474
+ if (n && e.isTypeOf(n, Ce, {
1469
1475
  checkSchemaExtensions: !0
1470
1476
  }))
1471
1477
  return n;
1472
1478
  }
1473
1479
  return null;
1474
1480
  }
1475
- function Ar(o, e, t, n) {
1481
+ function Lr(o, e, t, n) {
1476
1482
  const { blue: r } = n, i = o.operation;
1477
1483
  return !(!i || t.operation !== i || o.event && !r.isTypeOfNode(e, o.event));
1478
1484
  }
1479
- function Mr(o, e) {
1485
+ function xr(o, e) {
1480
1486
  const t = o.operation;
1481
1487
  if (!t)
1482
1488
  return null;
1483
1489
  const n = e.resolvePointer(`/contracts/${t}`), r = e.documentAt(n);
1484
- if (!r || !e.blue.isTypeOf(r, Y, {
1490
+ if (!r || !e.blue.isTypeOf(r, Z, {
1485
1491
  checkSchemaExtensions: !0
1486
1492
  }))
1487
1493
  return null;
1488
1494
  const i = e.blue.nodeToSchemaOutput(
1489
1495
  r,
1490
- Y
1491
- ), s = kt(i);
1496
+ Z
1497
+ ), s = At(i);
1492
1498
  return { operationNode: r, operation: i, channelKey: s };
1493
1499
  }
1494
- function Nr(o, e) {
1500
+ function Fr(o, e) {
1495
1501
  return !(o && e && o !== e);
1496
1502
  }
1497
- function Or(o, e, t) {
1503
+ function $r(o, e, t) {
1498
1504
  const n = o.getProperties()?.request, r = e.getProperties()?.request;
1499
1505
  if (!(n instanceof p) || !(r instanceof p))
1500
1506
  return !1;
1501
1507
  try {
1502
- if (!t.isTypeOfNode(n, r))
1508
+ if (!t.isTypeOfNode(n, r) && !qe(
1509
+ n,
1510
+ r,
1511
+ t
1512
+ ))
1503
1513
  return !1;
1504
1514
  } catch {
1505
- return !1;
1515
+ if (!qe(n, r, t))
1516
+ return !1;
1506
1517
  }
1507
1518
  return !0;
1508
1519
  }
1509
- function Dr(o, e, t) {
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);
1525
+ }
1526
+ function Ur(o, e, t) {
1510
1527
  if (!o || o.allowNewerVersion !== !1)
1511
1528
  return !0;
1512
- const n = Pr(e, t);
1529
+ const n = Dr(e, t);
1513
1530
  if (!n)
1514
1531
  return !0;
1515
1532
  const r = t.resolvePointer("/"), i = t.documentAt(r);
@@ -1518,72 +1535,72 @@ function Dr(o, e, t) {
1518
1535
  const c = (i.getContracts()?.initialized ?? null)?.get("/documentId") ?? null, u = typeof c == "string" && c.length > 0 ? c : t.blue.calculateBlueIdSync(i);
1519
1536
  return n === u;
1520
1537
  }
1521
- const Br = C["Conversation/Actor Policy"], Lr = C["Conversation/Principal Actor"], xr = C["Conversation/Agent Actor"], _r = C["Conversation/Browser Session"], Fr = C["Conversation/API Call"], Ur = C["Conversation/Document Request"];
1522
- function Hr(o, e, t) {
1523
- const r = zr(t)?.operations?.[o];
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];
1524
1541
  if (!r)
1525
1542
  return !0;
1526
- const i = $r(e, t), s = Vr(e, t);
1527
- return Wr(r, i, s);
1543
+ const i = Jr(e, t), s = Qr(e, t);
1544
+ return Yr(r, i, s);
1528
1545
  }
1529
- function zr(o) {
1546
+ function jr(o) {
1530
1547
  const e = o.resolvePointer("/contracts"), n = o.documentAt(e)?.getProperties();
1531
1548
  if (!n)
1532
1549
  return null;
1533
1550
  for (const r of Object.values(n))
1534
- if (r instanceof p && o.blue.isTypeOfBlueId(r, Br))
1551
+ if (r instanceof p && o.blue.isTypeOfBlueId(r, zr))
1535
1552
  return o.blue.nodeToSchemaOutput(
1536
1553
  r,
1537
- Ct
1554
+ Tt
1538
1555
  );
1539
1556
  return null;
1540
1557
  }
1541
- function $r(o, e) {
1542
- const t = Tt(o, "actor", e);
1543
- return t ? e.blue.isTypeOfBlueId(t, xr) ? "agent" : e.blue.isTypeOfBlueId(t, Lr) ? "principal" : null : null;
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;
1544
1561
  }
1545
- function Vr(o, e) {
1546
- const t = Tt(o, "source", e);
1547
- return t ? e.blue.isTypeOfBlueId(t, _r) ? "browserSession" : e.blue.isTypeOfBlueId(t, Fr) ? "apiCall" : e.blue.isTypeOfBlueId(t, Ur) ? "documentRequest" : null : null;
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;
1548
1565
  }
1549
- function Tt(o, e, t) {
1550
- if (!t.blue.isTypeOf(o, M, {
1566
+ function Bt(o, e, t) {
1567
+ if (!t.blue.isTypeOf(o, N, {
1551
1568
  checkSchemaExtensions: !0
1552
1569
  }))
1553
1570
  return null;
1554
1571
  const n = o.getProperties()?.[e];
1555
1572
  return n instanceof p ? n : null;
1556
1573
  }
1557
- function Wr(o, e, t) {
1574
+ function Yr(o, e, t) {
1558
1575
  return !(o.requiresActor && (!e || o.requiresActor !== "any" && o.requiresActor !== e) || o.requiresSource && (!t || o.requiresSource !== t) || o.excludeSource && (!t || o.excludeSource === t));
1559
1576
  }
1560
- class Kr {
1577
+ class Zr {
1561
1578
  kind = "handler";
1562
1579
  blueIds = [
1563
- C["Conversation/Sequential Workflow Operation"]
1580
+ b["Conversation/Sequential Workflow Operation"]
1564
1581
  ];
1565
- schema = or;
1582
+ schema = hr;
1566
1583
  runner;
1567
- constructor(e = ke) {
1568
- this.runner = new bt(e);
1584
+ constructor(e = Re) {
1585
+ this.runner = new Nt(e);
1569
1586
  }
1570
1587
  deriveChannel(e, t) {
1571
1588
  const n = e.operation;
1572
1589
  if (!n)
1573
1590
  return null;
1574
1591
  const r = t.scopeContracts.get(n);
1575
- if (!r || !t.blue.isTypeOf(r.node, Y, {
1592
+ if (!r || !t.blue.isTypeOf(r.node, Z, {
1576
1593
  checkSchemaExtensions: !0
1577
1594
  }))
1578
1595
  return null;
1579
- const i = t.blue.nodeToSchemaOutput(r.node, Y);
1580
- return i ? kt(i) : null;
1596
+ const i = t.blue.nodeToSchemaOutput(r.node, Z);
1597
+ return i ? At(i) : null;
1581
1598
  }
1582
1599
  async matches(e, t) {
1583
1600
  const n = t.event();
1584
1601
  if (!n)
1585
1602
  return !1;
1586
- const r = Rr(
1603
+ const r = _r(
1587
1604
  n,
1588
1605
  t.blue
1589
1606
  );
@@ -1591,22 +1608,22 @@ class Kr {
1591
1608
  return !1;
1592
1609
  const i = t.blue.nodeToSchemaOutput(
1593
1610
  r,
1594
- ge
1611
+ Ce
1595
1612
  );
1596
- if (!i || !Ar(e, n, i, t))
1613
+ if (!i || !Lr(e, n, i, t))
1597
1614
  return !1;
1598
- const s = Mr(e, t);
1615
+ const s = xr(e, t);
1599
1616
  if (!s)
1600
1617
  return !1;
1601
1618
  const a = typeof e.channel == "string" ? e.channel.trim() : "", c = a.length > 0 ? a : null;
1602
- if (!Nr(s.channelKey, c) || !Or(
1619
+ if (!Fr(s.channelKey, c) || !$r(
1603
1620
  r,
1604
1621
  s.operationNode,
1605
1622
  t.blue
1606
- ) || i?.allowNewerVersion === !1 && !Dr(i, r, t))
1623
+ ) || i?.allowNewerVersion === !1 && !Ur(i, r, t))
1607
1624
  return !1;
1608
1625
  const u = e.operation;
1609
- return !(!u || !Hr(u, n, t));
1626
+ return !(!u || !Gr(u, n, t));
1610
1627
  }
1611
1628
  async execute(e, t, n) {
1612
1629
  const r = t.event();
@@ -1618,17 +1635,17 @@ class Kr {
1618
1635
  });
1619
1636
  }
1620
1637
  }
1621
- class ae {
1638
+ class ue {
1622
1639
  constructor(e) {
1623
1640
  this.registry = e;
1624
1641
  }
1625
1642
  static create() {
1626
- return new ae(
1627
- new sr()
1643
+ return new ue(
1644
+ new pr()
1628
1645
  );
1629
1646
  }
1630
1647
  registerDefaults() {
1631
- return this.registry.register(new hr()), this.registry.register(new fr()), this.registry.register(new mr()), this.registry.register(new kr()), this.registry.register(new ar()), this.registry.register(new Ir()), this.registry.register(new Tr()), this.registry.register(new Kr()), this;
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;
1632
1649
  }
1633
1650
  register(e) {
1634
1651
  return this.registry.register(e), this;
@@ -1637,11 +1654,11 @@ class ae {
1637
1654
  return this.registry;
1638
1655
  }
1639
1656
  }
1640
- const Ee = m["Core/Channel Event Checkpoint"];
1641
- function It(o) {
1657
+ const Se = S["Core/Channel Event Checkpoint"];
1658
+ function Dt(o) {
1642
1659
  return typeof o.order == "number" ? o.order : 0;
1643
1660
  }
1644
- class qr {
1661
+ class Xr {
1645
1662
  constructor(e, t, n, r) {
1646
1663
  this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n, this.bindingNode = r;
1647
1664
  }
@@ -1658,10 +1675,10 @@ class qr {
1658
1675
  return this.bindingNode.clone();
1659
1676
  }
1660
1677
  order() {
1661
- return It(this.bindingContract);
1678
+ return Dt(this.bindingContract);
1662
1679
  }
1663
1680
  }
1664
- class Gr {
1681
+ class eo {
1665
1682
  constructor(e, t, n, r) {
1666
1683
  this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n, this.bindingNode = r;
1667
1684
  }
@@ -1678,16 +1695,16 @@ class Gr {
1678
1695
  return this.bindingNode.clone();
1679
1696
  }
1680
1697
  order() {
1681
- return It(this.bindingContract);
1698
+ return Dt(this.bindingContract);
1682
1699
  }
1683
1700
  }
1684
- class V {
1701
+ class W {
1685
1702
  constructor(e, t, n, r, i) {
1686
1703
  this.channels = e, this.handlersByChannel = t, this.markerStore = n, this.embeddedPathsInternal = r, this.checkpointDeclared = i;
1687
1704
  }
1688
1705
  checkpointDeclared;
1689
1706
  static fromComponents(e, t, n, r, i) {
1690
- return new V(
1707
+ return new W(
1691
1708
  e,
1692
1709
  t,
1693
1710
  n,
@@ -1696,10 +1713,10 @@ class V {
1696
1713
  );
1697
1714
  }
1698
1715
  static builder() {
1699
- return new jr();
1716
+ return new to();
1700
1717
  }
1701
1718
  static empty() {
1702
- return V.builder().build();
1719
+ return W.builder().build();
1703
1720
  }
1704
1721
  markers() {
1705
1722
  return new Map(
@@ -1729,16 +1746,16 @@ class V {
1729
1746
  throw new Error(
1730
1747
  "Duplicate Channel Event Checkpoint markers detected in same contracts map"
1731
1748
  );
1732
- this.markerStore.set(O, {
1733
- key: O,
1749
+ this.markerStore.set(D, {
1750
+ key: D,
1734
1751
  contract: e,
1735
- blueId: Ee
1752
+ blueId: Se
1736
1753
  }), this.checkpointDeclared = !0;
1737
1754
  }
1738
1755
  handlersFor(e) {
1739
1756
  const t = this.handlersByChannel.get(e);
1740
1757
  return !t || t.length === 0 ? [] : [...t].map(
1741
- (n) => new Gr(
1758
+ (n) => new eo(
1742
1759
  n.key,
1743
1760
  n.contract,
1744
1761
  n.blueId,
@@ -1760,7 +1777,7 @@ class V {
1760
1777
  }
1761
1778
  channelsOfType(...e) {
1762
1779
  const t = e.length > 0 ? new Set(e) : null, n = Array.from(this.channels.values()).filter((r) => !t || t.has(r.blueId)).map(
1763
- (r) => new qr(
1780
+ (r) => new Xr(
1764
1781
  r.key,
1765
1782
  r.contract,
1766
1783
  r.blueId,
@@ -1773,7 +1790,7 @@ class V {
1773
1790
  }), n;
1774
1791
  }
1775
1792
  }
1776
- class jr {
1793
+ class to {
1777
1794
  channels = /* @__PURE__ */ new Map();
1778
1795
  handlersByChannel = /* @__PURE__ */ new Map();
1779
1796
  markerStore = /* @__PURE__ */ new Map();
@@ -1798,12 +1815,12 @@ class jr {
1798
1815
  return this.embeddedDeclared = !0, this.embeddedPaths = e.paths ? [...e.paths] : [], this;
1799
1816
  }
1800
1817
  addMarker(e, t, n) {
1801
- if (e === O && n !== Ee)
1818
+ if (e === D && n !== Se)
1802
1819
  throw new Error(
1803
1820
  "Reserved key 'checkpoint' must contain a Channel Event Checkpoint"
1804
1821
  );
1805
- if (n === Ee) {
1806
- if (e !== O)
1822
+ if (n === Se) {
1823
+ if (e !== D)
1807
1824
  throw new Error(
1808
1825
  `Channel Event Checkpoint must use reserved key 'checkpoint' at key '${e}'`
1809
1826
  );
@@ -1816,7 +1833,7 @@ class jr {
1816
1833
  return this.markerStore.set(e, { key: e, contract: t, blueId: n }), this;
1817
1834
  }
1818
1835
  build() {
1819
- return V.fromComponents(
1836
+ return W.fromComponents(
1820
1837
  new Map(this.channels),
1821
1838
  new Map(
1822
1839
  Array.from(this.handlersByChannel.entries(), ([e, t]) => [
@@ -1830,18 +1847,18 @@ class jr {
1830
1847
  );
1831
1848
  }
1832
1849
  }
1833
- class y extends Error {
1850
+ class E extends Error {
1834
1851
  constructor(e, t) {
1835
1852
  super(e || "Processor fatal error"), this.processorError = t, this.name = "ProcessorFatalError";
1836
1853
  }
1837
1854
  }
1838
- function Q(o, e, t) {
1855
+ function te(o, e, t) {
1839
1856
  for (const [n, r] of t.entries())
1840
1857
  if (o.isTypeOfBlueId(e, n))
1841
1858
  return r;
1842
1859
  return null;
1843
1860
  }
1844
- class Yr {
1861
+ class no {
1845
1862
  constructor(e, t, n) {
1846
1863
  this.blue = e, this.registry = t, this.builtinChannelSchemas = n;
1847
1864
  }
@@ -1864,18 +1881,18 @@ class Yr {
1864
1881
  handlerKey: t
1865
1882
  }), h = s.get(u);
1866
1883
  if (!h)
1867
- throw new y(
1884
+ throw new E(
1868
1885
  `Handler ${t} references unknown channel '${u}'`,
1869
- S.invalidContract(
1886
+ C.invalidContract(
1870
1887
  i,
1871
1888
  `Channel '${u}' is not declared in this scope`,
1872
1889
  `/contracts/${u}`
1873
1890
  )
1874
1891
  );
1875
1892
  if (!this.isRegisteredChannel(h))
1876
- throw new y(
1893
+ throw new E(
1877
1894
  `Contract '${u}' is not a channel`,
1878
- S.invalidContract(
1895
+ C.invalidContract(
1879
1896
  h.nodeTypeBlueId,
1880
1897
  `Contract '${u}' is not a channel`,
1881
1898
  `/contracts/${u}`
@@ -1890,9 +1907,9 @@ class Yr {
1890
1907
  );
1891
1908
  } catch (a) {
1892
1909
  if (this.isZodError(a))
1893
- throw new y(
1910
+ throw new E(
1894
1911
  "Failed to parse handler contract",
1895
- S.invalidContract(
1912
+ C.invalidContract(
1896
1913
  i,
1897
1914
  "Failed to parse handler contract",
1898
1915
  t,
@@ -1900,9 +1917,9 @@ class Yr {
1900
1917
  )
1901
1918
  );
1902
1919
  const c = a?.message ?? "Failed to register handler contract";
1903
- throw new y(
1920
+ throw new E(
1904
1921
  c,
1905
- S.illegalState(c)
1922
+ C.illegalState(c)
1906
1923
  );
1907
1924
  }
1908
1925
  }
@@ -1924,16 +1941,16 @@ class Yr {
1924
1941
  }
1925
1942
  }
1926
1943
  if (!i)
1927
- throw new y(
1944
+ throw new E(
1928
1945
  `Handler ${r} must declare channel (missing explicit channel and derivation failed)`,
1929
- S.illegalState(
1946
+ C.illegalState(
1930
1947
  `Handler ${r} must declare channel (missing explicit channel and derivation failed)`
1931
1948
  )
1932
1949
  );
1933
1950
  return i;
1934
1951
  }
1935
1952
  isRegisteredChannel(e) {
1936
- return Q(this.blue, e.node, this.builtinChannelSchemas) ? !0 : this.registry.lookupChannelForNode(this.blue, e.node) != null;
1953
+ return te(this.blue, e.node, this.builtinChannelSchemas) ? !0 : this.registry.lookupChannelForNode(this.blue, e.node) != null;
1937
1954
  }
1938
1955
  setContractChannel(e, t) {
1939
1956
  const r = e.getProperties()?.channel;
@@ -1944,55 +1961,55 @@ class Yr {
1944
1961
  e.addProperty("channel", new p().setValue(t));
1945
1962
  }
1946
1963
  isZodError(e) {
1947
- return e instanceof Ce;
1964
+ return e instanceof ve;
1948
1965
  }
1949
1966
  }
1950
- class x extends Error {
1967
+ class F extends Error {
1951
1968
  constructor(e) {
1952
1969
  super(e ?? "MustUnderstand failure"), this.name = "MustUnderstandFailure";
1953
1970
  }
1954
1971
  }
1955
- const Jr = C["Conversation/Composite Timeline Channel"];
1956
- function Xr(o) {
1972
+ const ro = b["Conversation/Composite Timeline Channel"];
1973
+ function oo(o) {
1957
1974
  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([
1958
1975
  [e, t]
1959
- ]), h = (f) => i.isTypeOfBlueId(f.node, Jr), d = (f) => {
1976
+ ]), h = (f) => i.isTypeOfBlueId(f.node, ro), d = (f) => {
1960
1977
  if (u.has(f))
1961
1978
  return u.get(f) ?? null;
1962
- const E = n.get(f);
1963
- if (!E || !h(E))
1979
+ const g = n.get(f);
1980
+ if (!g || !h(g))
1964
1981
  return u.set(f, null), null;
1965
1982
  try {
1966
- const v = i.nodeToSchemaOutput(
1967
- E.node,
1968
- mt
1983
+ const y = i.nodeToSchemaOutput(
1984
+ g.node,
1985
+ bt
1969
1986
  );
1970
- return u.set(f, v), v;
1971
- } catch (v) {
1972
- if (Qr(v))
1973
- throw new y(
1987
+ return u.set(f, y), y;
1988
+ } catch (y) {
1989
+ if (io(y))
1990
+ throw new E(
1974
1991
  "Failed to parse channel contract",
1975
- S.invalidContract(
1976
- E.nodeTypeBlueId,
1992
+ C.invalidContract(
1993
+ g.nodeTypeBlueId,
1977
1994
  "Failed to parse channel contract",
1978
1995
  `/contracts/${f}`,
1979
- v
1996
+ y
1980
1997
  )
1981
1998
  );
1982
- const A = v?.message ?? "Failed to parse channel contract";
1983
- throw new y(
1984
- A,
1985
- S.illegalState(A)
1999
+ const O = y?.message ?? "Failed to parse channel contract";
2000
+ throw new E(
2001
+ O,
2002
+ C.illegalState(O)
1986
2003
  );
1987
2004
  }
1988
- }, w = (f) => {
2005
+ }, v = (f) => {
1989
2006
  if (a.has(f)) {
1990
- const v = c.indexOf(f), D = [...c.slice(v), f].join(" -> ");
1991
- throw new y(
1992
- `Composite channel ${e} has a cyclic reference: ${D}`,
1993
- S.invalidContract(
2007
+ const y = c.indexOf(f), _ = [...c.slice(y), f].join(" -> ");
2008
+ throw new E(
2009
+ `Composite channel ${e} has a cyclic reference: ${_}`,
2010
+ C.invalidContract(
1994
2011
  r,
1995
- `Composite channel '${e}' has a cyclic reference: ${D}`,
2012
+ `Composite channel '${e}' has a cyclic reference: ${_}`,
1996
2013
  `/contracts/${e}`
1997
2014
  )
1998
2015
  );
@@ -2000,82 +2017,82 @@ function Xr(o) {
2000
2017
  if (s.has(f))
2001
2018
  return;
2002
2019
  a.add(f), c.push(f);
2003
- const E = d(f);
2004
- if (E)
2005
- for (const v of E.channels ?? []) {
2006
- const A = n.get(v);
2007
- A && h(A) && w(v);
2020
+ const g = d(f);
2021
+ if (g)
2022
+ for (const y of g.channels ?? []) {
2023
+ const O = n.get(y);
2024
+ O && h(O) && v(y);
2008
2025
  }
2009
2026
  c.pop(), a.delete(f), s.add(f);
2010
2027
  };
2011
- w(e);
2028
+ v(e);
2012
2029
  }
2013
- function Qr(o) {
2014
- return o instanceof Ce;
2030
+ function io(o) {
2031
+ return o instanceof ve;
2015
2032
  }
2016
- const Zr = m["Core/Document Update Channel"], eo = m["Core/Embedded Node Channel"], to = m["Core/Lifecycle Event Channel"], no = m["Core/Triggered Event Channel"], $e = m["Core/Process Embedded"], ro = m["Core/Processing Initialized Marker"], oo = m["Core/Processing Terminated Marker"], io = m["Core/Channel Event Checkpoint"], so = T["MyOS/Document Anchors"], ao = T["MyOS/Document Links"], co = T["MyOS/MyOS Participants Orchestration"], lo = T["MyOS/MyOS Session Interaction"], uo = T["MyOS/MyOS Worker Agency"], ho = C["Conversation/Composite Timeline Channel"], ue = /* @__PURE__ */ new Map([
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([
2017
2034
  [
2018
- Zr,
2019
- yn
2035
+ so,
2036
+ Tn
2020
2037
  ],
2021
2038
  [
2022
- eo,
2023
- Sn
2039
+ ao,
2040
+ Rn
2024
2041
  ],
2025
2042
  [
2026
- to,
2027
- bn
2043
+ co,
2044
+ On
2028
2045
  ],
2029
2046
  [
2030
- no,
2031
- Tn
2047
+ lo,
2048
+ An
2032
2049
  ]
2033
- ]), po = /* @__PURE__ */ new Map([
2050
+ ]), So = /* @__PURE__ */ new Map([
2034
2051
  [
2035
- ro,
2036
- Fn
2052
+ uo,
2053
+ Wn
2037
2054
  ],
2038
2055
  [
2039
- oo,
2040
- $n
2056
+ ho,
2057
+ Jn
2041
2058
  ],
2042
2059
  [
2043
- io,
2044
- xn
2060
+ po,
2061
+ Hn
2045
2062
  ],
2046
2063
  [
2047
- so,
2048
- qn
2064
+ fo,
2065
+ Xn
2049
2066
  ],
2050
2067
  [
2051
- ao,
2052
- Yn
2068
+ mo,
2069
+ nr
2053
2070
  ],
2054
2071
  [
2055
- co,
2056
- Xn
2072
+ go,
2073
+ or
2057
2074
  ],
2058
2075
  [
2059
- lo,
2060
- Zn
2076
+ Eo,
2077
+ sr
2061
2078
  ],
2062
2079
  [
2063
- uo,
2064
- tr
2080
+ yo,
2081
+ cr
2065
2082
  ]
2066
2083
  ]);
2067
- class fo {
2084
+ class vo {
2068
2085
  constructor(e, t) {
2069
- this.registry = e, this.blue = t, this.handlerRegistration = new Yr(
2086
+ this.registry = e, this.blue = t, this.handlerRegistration = new no(
2070
2087
  this.blue,
2071
2088
  this.registry,
2072
- ue
2089
+ pe
2073
2090
  );
2074
2091
  }
2075
2092
  handlerRegistration;
2076
2093
  load(e, t) {
2077
2094
  try {
2078
- const n = V.builder(), r = e.getContracts();
2095
+ const n = W.builder(), r = e.getContracts();
2079
2096
  if (!r)
2080
2097
  return n.build();
2081
2098
  const i = this.buildScopeContractsIndex(r);
@@ -2083,12 +2100,12 @@ class fo {
2083
2100
  a && this.processContract(n, s, a, i);
2084
2101
  return n.build();
2085
2102
  } catch (n) {
2086
- if (n instanceof x || n instanceof y)
2103
+ if (n instanceof F || n instanceof E)
2087
2104
  throw n;
2088
2105
  const r = n?.message ?? "Failed to load contracts";
2089
- throw new y(
2106
+ throw new E(
2090
2107
  `Failed to load contracts for scope ${t}: ${r}`,
2091
- S.runtimeFatal(
2108
+ C.runtimeFatal(
2092
2109
  `Failed to load contracts for scope ${t}`,
2093
2110
  n
2094
2111
  )
@@ -2099,14 +2116,14 @@ class fo {
2099
2116
  const i = n.getType()?.getBlueId();
2100
2117
  if (!i)
2101
2118
  return;
2102
- if (this.blue.isTypeOfBlueId(n, $e)) {
2119
+ if (this.blue.isTypeOfBlueId(n, Ge)) {
2103
2120
  this.handleProcessEmbedded(e, t, n);
2104
2121
  return;
2105
2122
  }
2106
- const s = Q(
2123
+ const s = te(
2107
2124
  this.blue,
2108
2125
  n,
2109
- po
2126
+ So
2110
2127
  );
2111
2128
  if (s) {
2112
2129
  this.handleMarker(
@@ -2119,10 +2136,10 @@ class fo {
2119
2136
  );
2120
2137
  return;
2121
2138
  }
2122
- const a = Q(
2139
+ const a = te(
2123
2140
  this.blue,
2124
2141
  n,
2125
- ue
2142
+ pe
2126
2143
  );
2127
2144
  if (a) {
2128
2145
  this.handleChannel(
@@ -2177,34 +2194,34 @@ class fo {
2177
2194
  );
2178
2195
  return;
2179
2196
  }
2180
- throw Xe(i) ? new y(
2197
+ throw ht(i) ? new E(
2181
2198
  "Built-in processor-managed channel is missing schema registration",
2182
- S.invalidContract(
2199
+ C.invalidContract(
2183
2200
  i,
2184
2201
  "Built-in processor-managed channel is missing schema registration",
2185
2202
  t
2186
2203
  )
2187
- ) : new x(`Unsupported contract type: ${i}`);
2204
+ ) : new F(`Unsupported contract type: ${i}`);
2188
2205
  }
2189
2206
  handleProcessEmbedded(e, t, n) {
2190
2207
  try {
2191
2208
  const r = this.blue.nodeToSchemaOutput(
2192
2209
  n,
2193
- Hn
2210
+ Gn
2194
2211
  );
2195
2212
  e.setEmbedded(r);
2196
2213
  } catch (r) {
2197
- throw he(r) ? new y(
2214
+ throw fe(r) ? new E(
2198
2215
  "Failed to parse ProcessEmbedded marker",
2199
- S.invalidContract(
2200
- $e,
2216
+ C.invalidContract(
2217
+ Ge,
2201
2218
  "Failed to parse ProcessEmbedded marker",
2202
2219
  t,
2203
2220
  r
2204
2221
  )
2205
- ) : new y(
2222
+ ) : new E(
2206
2223
  r?.message ?? "Failed to register ProcessEmbedded marker",
2207
- S.illegalState(
2224
+ C.illegalState(
2208
2225
  r?.message ?? "Failed to register ProcessEmbedded marker"
2209
2226
  )
2210
2227
  );
@@ -2216,19 +2233,19 @@ class fo {
2216
2233
  n,
2217
2234
  r
2218
2235
  );
2219
- this.blue.isTypeOfBlueId(n, ho) && this.validateCompositeChannel(
2236
+ this.blue.isTypeOfBlueId(n, Co) && this.validateCompositeChannel(
2220
2237
  t,
2221
2238
  a,
2222
2239
  s,
2223
2240
  i
2224
2241
  ), e.addChannel(t, a, i, n);
2225
2242
  } catch (a) {
2226
- if (a instanceof y || a instanceof x)
2243
+ if (a instanceof E || a instanceof F)
2227
2244
  throw a;
2228
- if (he(a))
2229
- throw new y(
2245
+ if (fe(a))
2246
+ throw new E(
2230
2247
  "Failed to parse channel contract",
2231
- S.invalidContract(
2248
+ C.invalidContract(
2232
2249
  i,
2233
2250
  "Failed to parse channel contract",
2234
2251
  t,
@@ -2236,9 +2253,9 @@ class fo {
2236
2253
  )
2237
2254
  );
2238
2255
  const c = a?.message ?? "Failed to register channel contract";
2239
- throw new y(
2256
+ throw new E(
2240
2257
  c,
2241
- S.illegalState(c)
2258
+ C.illegalState(c)
2242
2259
  );
2243
2260
  }
2244
2261
  }
@@ -2248,25 +2265,25 @@ class fo {
2248
2265
  for (const s of i) {
2249
2266
  const a = n.get(s);
2250
2267
  if (!a)
2251
- throw new y(
2268
+ throw new E(
2252
2269
  `Composite channel ${e} references unknown channel '${s}'`,
2253
- S.invalidContract(
2270
+ C.invalidContract(
2254
2271
  r,
2255
2272
  `Channel '${s}' is not declared in this scope`,
2256
2273
  `/contracts/${s}`
2257
2274
  )
2258
2275
  );
2259
2276
  if (!this.isRegisteredChannel(a))
2260
- throw new y(
2277
+ throw new E(
2261
2278
  `Contract '${s}' is not a channel`,
2262
- S.invalidContract(
2279
+ C.invalidContract(
2263
2280
  a.nodeTypeBlueId,
2264
2281
  `Contract '${s}' is not a channel`,
2265
2282
  `/contracts/${s}`
2266
2283
  )
2267
2284
  );
2268
2285
  }
2269
- Xr({
2286
+ oo({
2270
2287
  compositeKey: e,
2271
2288
  contract: t,
2272
2289
  scopeContracts: n,
@@ -2276,29 +2293,29 @@ class fo {
2276
2293
  }
2277
2294
  }
2278
2295
  isRegisteredChannel(e) {
2279
- return Q(this.blue, e.node, ue) ? !0 : this.registry.lookupChannelForNode(this.blue, e.node) != null;
2296
+ return te(this.blue, e.node, pe) ? !0 : this.registry.lookupChannelForNode(this.blue, e.node) != null;
2280
2297
  }
2281
2298
  handleMarker(e, t, n, r, i, s) {
2282
2299
  try {
2283
- const a = C["Conversation/Actor Policy"];
2284
- this.blue.isTypeOfBlueId(n, a) && (this.assertSingleActorPolicyMarker(t, s, i), Bn(n));
2300
+ const a = b["Conversation/Actor Policy"];
2301
+ this.blue.isTypeOfBlueId(n, a) && (this.assertSingleActorPolicyMarker(t, s, i), zn(n));
2285
2302
  const c = this.blue.nodeToSchemaOutput(
2286
2303
  n,
2287
2304
  r
2288
2305
  );
2289
2306
  e.addMarker(t, c, i);
2290
2307
  } catch (a) {
2291
- if (a instanceof y || a instanceof x)
2308
+ if (a instanceof E || a instanceof F)
2292
2309
  throw a;
2293
- if (a instanceof yt)
2294
- throw new y(
2310
+ if (a instanceof Pt)
2311
+ throw new E(
2295
2312
  a.message,
2296
- S.invalidContract(i, a.message, t, a)
2313
+ C.invalidContract(i, a.message, t, a)
2297
2314
  );
2298
- if (he(a))
2299
- throw new y(
2315
+ if (fe(a))
2316
+ throw new E(
2300
2317
  "Failed to parse marker contract",
2301
- S.invalidContract(
2318
+ C.invalidContract(
2302
2319
  i,
2303
2320
  "Failed to parse marker contract",
2304
2321
  t,
@@ -2306,22 +2323,22 @@ class fo {
2306
2323
  )
2307
2324
  );
2308
2325
  const c = a?.message ?? "Failed to register marker contract";
2309
- throw new y(
2326
+ throw new E(
2310
2327
  c,
2311
- S.illegalState(c)
2328
+ C.illegalState(c)
2312
2329
  );
2313
2330
  }
2314
2331
  }
2315
2332
  assertSingleActorPolicyMarker(e, t, n) {
2316
- const r = C["Conversation/Actor Policy"], i = Array.from(t.entries()).find(
2333
+ const r = b["Conversation/Actor Policy"], i = Array.from(t.entries()).find(
2317
2334
  ([a, c]) => a !== e && this.blue.isTypeOfBlueId(c.node, r)
2318
2335
  );
2319
2336
  if (!i)
2320
2337
  return;
2321
2338
  const [s] = i;
2322
- throw new y(
2339
+ throw new E(
2323
2340
  `Multiple Actor Policy markers declared in the same scope: '${e}' conflicts with '${s}'`,
2324
- S.invalidContract(
2341
+ C.invalidContract(
2325
2342
  n,
2326
2343
  "Multiple Actor Policy markers declared in the same scope",
2327
2344
  `/contracts/${e}`
@@ -2339,27 +2356,27 @@ class fo {
2339
2356
  return t;
2340
2357
  }
2341
2358
  }
2342
- function he(o) {
2343
- return o instanceof Ce;
2359
+ function fe(o) {
2360
+ return o instanceof ve;
2344
2361
  }
2345
- const mo = m["Core/Channel Event Checkpoint"];
2346
- function go(o) {
2362
+ const wo = S["Core/Channel Event Checkpoint"];
2363
+ function bo(o) {
2347
2364
  return o.jsonValueToNode({
2348
- type: { blueId: mo },
2365
+ type: { blueId: wo },
2349
2366
  lastEvents: {},
2350
2367
  lastSignatures: {}
2351
2368
  });
2352
2369
  }
2353
- function Eo() {
2370
+ function Io() {
2354
2371
  return {
2355
2372
  lastEvents: {},
2356
2373
  lastSignatures: {}
2357
2374
  };
2358
2375
  }
2359
- function Ve(o) {
2376
+ function je(o) {
2360
2377
  return o != null && Object.prototype.hasOwnProperty.call(o, "lastEvents") && Object.prototype.hasOwnProperty.call(o, "lastSignatures");
2361
2378
  }
2362
- class Co {
2379
+ class ko {
2363
2380
  constructor(e, t, n, r, i) {
2364
2381
  this.markerKey = e, this.checkpoint = t, this.channelKey = n, this.lastEventNode = r, this.lastEventSignature = i;
2365
2382
  }
@@ -2369,28 +2386,28 @@ class Co {
2369
2386
  return e != null && e === this.lastEventSignature;
2370
2387
  }
2371
2388
  }
2372
- class yo {
2389
+ class To {
2373
2390
  constructor(e, t) {
2374
2391
  this.runtime = e, this.signatureFn = t;
2375
2392
  }
2376
2393
  ensureCheckpointMarker(e, t) {
2377
- const n = t.marker(O), r = I(e, Ze);
2394
+ const n = t.marker(D), r = k(e, pt);
2378
2395
  if (!n) {
2379
- const i = go(this.runtime.blue());
2380
- this.runtime.directWrite(r, i), t.registerCheckpointMarker(Eo());
2396
+ const i = bo(this.runtime.blue());
2397
+ this.runtime.directWrite(r, i), t.registerCheckpointMarker(Io());
2381
2398
  return;
2382
2399
  }
2383
- if (!Ve(n))
2400
+ if (!je(n))
2384
2401
  throw new Error(
2385
2402
  `Reserved key 'checkpoint' must contain a Channel Event Checkpoint at ${r}`
2386
2403
  );
2387
2404
  }
2388
2405
  findCheckpoint(e, t) {
2389
2406
  for (const [n, r] of e.markerEntries()) {
2390
- if (!Ve(r))
2407
+ if (!je(r))
2391
2408
  continue;
2392
2409
  const s = (r.lastEvents?.[t] ?? null)?.clone() ?? null, c = r.lastSignatures?.[t] ?? null ?? this.signatureFn(s);
2393
- return new Co(
2410
+ return new ko(
2394
2411
  n,
2395
2412
  r,
2396
2413
  t,
@@ -2406,19 +2423,19 @@ class yo {
2406
2423
  persist(e, t, n, r, i) {
2407
2424
  if (!n)
2408
2425
  return;
2409
- const s = I(
2426
+ const s = k(
2410
2427
  e,
2411
- nt(n.markerKey, n.channelKey)
2428
+ gt(n.markerKey, n.channelKey)
2412
2429
  ), a = i?.clone() ?? null;
2413
2430
  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;
2414
- const c = I(
2431
+ const c = k(
2415
2432
  e,
2416
- rt(n.markerKey, n.channelKey)
2433
+ Et(n.markerKey, n.channelKey)
2417
2434
  ), u = r == null ? null : new p().setValue(r);
2418
2435
  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;
2419
2436
  }
2420
2437
  }
2421
- class vo {
2438
+ class Po {
2422
2439
  constructor(e, t, n) {
2423
2440
  this.runtime = e, this.checkpointManager = t, this.deps = n;
2424
2441
  }
@@ -2545,21 +2562,21 @@ class vo {
2545
2562
  );
2546
2563
  }
2547
2564
  }
2548
- function So(o, e) {
2565
+ function Ro(o, e) {
2549
2566
  return e.isResolved() ? o.createResolvedNode(e) : o.resolve(e);
2550
2567
  }
2551
- class $ extends y {
2568
+ class K extends E {
2552
2569
  constructor(e) {
2553
- super(e, S.illegalState(e)), this.name = "IllegalStateException";
2570
+ super(e, C.illegalState(e)), this.name = "IllegalStateException";
2554
2571
  }
2555
2572
  }
2556
- class H extends Error {
2573
+ class V extends Error {
2557
2574
  constructor(e) {
2558
2575
  super(e), this.name = "BoundaryViolationException";
2559
2576
  }
2560
2577
  }
2561
- const wo = m["Core/Document Update Channel"], bo = m["Core/Embedded Node Channel"], ko = m["Core/Triggered Event Channel"], To = m["Core/Lifecycle Event Channel"], We = m["Core/Processing Initialized Marker"], Io = m["Core/Document Processing Initiated"];
2562
- class Po {
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 {
2563
2580
  runtime;
2564
2581
  contractLoader;
2565
2582
  channelRunner;
@@ -2573,25 +2590,25 @@ class Po {
2573
2590
  this.runtime = e.runtime, this.contractLoader = e.contractLoader, this.channelRunner = e.channelRunner, this.bundles = e.bundles, this.hooks = e.hooks, this.blueId = e.blueId, this.nodeAt = e.nodeAt, this.createDocumentUpdateEvent = e.createDocumentUpdateEvent, this.matchesDocumentUpdate = e.matchesDocumentUpdate;
2574
2591
  }
2575
2592
  async initializeScope(e, t) {
2576
- const n = b(e), r = /* @__PURE__ */ new Set();
2593
+ const n = w(e), r = /* @__PURE__ */ new Set();
2577
2594
  let i = null, s = null;
2578
2595
  for (t && this.runtime.gasMeter().chargeScopeEntry(n); ; ) {
2579
2596
  const d = this.nodeAt(n);
2580
2597
  if (!d)
2581
2598
  return;
2582
2599
  s || (s = d.clone()), i = this.loadBundle(d, n), this.bundles.set(n, i);
2583
- const w = i.embeddedPaths().find((v) => !r.has(v)) ?? null;
2584
- if (!w)
2600
+ const v = i.embeddedPaths().find((y) => !r.has(y)) ?? null;
2601
+ if (!v)
2585
2602
  break;
2586
- r.add(w);
2587
- const f = I(n, w);
2603
+ r.add(v);
2604
+ const f = k(n, v);
2588
2605
  this.nodeAt(f) && await this.initializeScope(f, !0);
2589
2606
  }
2590
2607
  if (!i)
2591
2608
  return;
2592
2609
  const a = this.hasInitializationMarker(n);
2593
2610
  if (!a && i.hasCheckpoint())
2594
- throw new $(
2611
+ throw new K(
2595
2612
  `Reserved key 'checkpoint' must not appear before initialization at scope ${n}`
2596
2613
  );
2597
2614
  if (a)
@@ -2607,22 +2624,22 @@ class Po {
2607
2624
  await this.deliverLifecycle(n, i, u, !0), await this.addInitializationMarker(h, c);
2608
2625
  }
2609
2626
  loadBundles(e) {
2610
- const t = b(e);
2627
+ const t = w(e);
2611
2628
  if (this.bundles.has(t))
2612
2629
  return;
2613
- const n = this.nodeAt(t), r = n ? this.loadBundle(n, t) : V.empty();
2630
+ const n = this.nodeAt(t), r = n ? this.loadBundle(n, t) : W.empty();
2614
2631
  this.bundles.set(t, r);
2615
2632
  for (const i of r.embeddedPaths()) {
2616
- const s = I(t, i);
2633
+ const s = k(t, i);
2617
2634
  this.loadBundles(s);
2618
2635
  }
2619
2636
  }
2620
2637
  async processExternalEvent(e, t) {
2621
- const n = So(this.runtime.blue(), t);
2638
+ const n = Ro(this.runtime.blue(), t);
2622
2639
  await this.processPreparedExternalEvent(e, n);
2623
2640
  }
2624
2641
  async processPreparedExternalEvent(e, t) {
2625
- const n = b(e);
2642
+ const n = w(e);
2626
2643
  if (this.hooks.isScopeInactive(n))
2627
2644
  return;
2628
2645
  this.runtime.gasMeter().chargeScopeEntry(n);
@@ -2656,7 +2673,7 @@ class Po {
2656
2673
  r
2657
2674
  );
2658
2675
  } catch (i) {
2659
- if (i instanceof H) {
2676
+ if (i instanceof V) {
2660
2677
  const s = this.hooks.fatalReason(i, "Boundary violation");
2661
2678
  await this.hooks.enterFatalTermination(e, t, s);
2662
2679
  return;
@@ -2685,7 +2702,7 @@ class Po {
2685
2702
  continue;
2686
2703
  const c = this.createDocumentUpdateEvent(i, s), u = this.channelsMatching(
2687
2704
  a,
2688
- wo
2705
+ Mo
2689
2706
  );
2690
2707
  for (const h of u) {
2691
2708
  const d = h.contract();
@@ -2704,12 +2721,12 @@ class Po {
2704
2721
  }
2705
2722
  }
2706
2723
  } catch (i) {
2707
- if (i instanceof H) {
2724
+ if (i instanceof V) {
2708
2725
  const s = this.hooks.fatalReason(i, "Boundary violation");
2709
2726
  await this.hooks.enterFatalTermination(e, t, s);
2710
2727
  return;
2711
2728
  }
2712
- if (i instanceof $ || i instanceof Error && !(i instanceof y)) {
2729
+ if (i instanceof K || i instanceof Error && !(i instanceof E)) {
2713
2730
  const s = this.hooks.fatalReason(i, "Runtime fatal");
2714
2731
  await this.hooks.enterFatalTermination(e, t, s);
2715
2732
  return;
@@ -2723,7 +2740,7 @@ class Po {
2723
2740
  return;
2724
2741
  const i = this.channelsMatching(
2725
2742
  t,
2726
- To
2743
+ Ao
2727
2744
  );
2728
2745
  for (const s of i)
2729
2746
  if (await this.channelRunner.runHandlers(
@@ -2737,14 +2754,14 @@ class Po {
2737
2754
  r && await this.finalizeScope(e, t);
2738
2755
  }
2739
2756
  async processEmbeddedChildren(e, t) {
2740
- const n = b(e), r = /* @__PURE__ */ new Set();
2757
+ const n = w(e), r = /* @__PURE__ */ new Set();
2741
2758
  let i = this.refreshBundle(n);
2742
2759
  for (; i; ) {
2743
2760
  const s = this.nextEmbeddedPath(i, r);
2744
2761
  if (!s)
2745
2762
  return i;
2746
2763
  r.add(s);
2747
- const a = I(n, s);
2764
+ const a = k(n, s);
2748
2765
  if (a === n || this.hooks.isScopeInactive(a)) {
2749
2766
  i = this.refreshBundle(n);
2750
2767
  continue;
@@ -2754,7 +2771,7 @@ class Po {
2754
2771
  return null;
2755
2772
  }
2756
2773
  refreshBundle(e) {
2757
- const t = b(e), n = this.nodeAt(t);
2774
+ const t = w(e), n = this.nodeAt(t);
2758
2775
  if (!n)
2759
2776
  return this.bundles.delete(t), null;
2760
2777
  const r = this.loadBundle(n, t);
@@ -2772,12 +2789,12 @@ class Po {
2772
2789
  try {
2773
2790
  return this.contractLoader.load(e, t);
2774
2791
  } catch (n) {
2775
- if (n instanceof y || n instanceof x)
2792
+ if (n instanceof E || n instanceof F)
2776
2793
  throw n;
2777
2794
  const r = n?.message ?? "Failed to load contracts";
2778
- throw new y(
2795
+ throw new E(
2779
2796
  r,
2780
- S.runtimeFatal(
2797
+ C.runtimeFatal(
2781
2798
  `Failed to load contracts for scope ${t}`,
2782
2799
  n
2783
2800
  )
@@ -2785,7 +2802,7 @@ class Po {
2785
2802
  }
2786
2803
  }
2787
2804
  async addInitializationMarker(e, t) {
2788
- const n = new p().setType(new p().setBlueId(We)).addProperty("documentId", new p().setValue(t)), r = e.resolvePointer(fe);
2805
+ const n = new p().setType(new p().setBlueId(Je)).addProperty("documentId", new p().setValue(t)), r = e.resolvePointer(ye);
2789
2806
  await e.applyPatch({
2790
2807
  op: "ADD",
2791
2808
  path: r,
@@ -2800,17 +2817,17 @@ class Po {
2800
2817
  return;
2801
2818
  const n = this.channelsMatching(
2802
2819
  t,
2803
- bo
2820
+ Oo
2804
2821
  );
2805
2822
  if (n.length !== 0)
2806
2823
  for (const r of t.embeddedPaths()) {
2807
- const i = I(e, r), a = this.runtime.scope(i).drainBridgeableEvents();
2824
+ const i = k(e, r), a = this.runtime.scope(i).drainBridgeableEvents();
2808
2825
  if (a.length !== 0)
2809
2826
  for (const c of a) {
2810
2827
  let u = !1;
2811
2828
  for (const h of n) {
2812
- const w = h.contract().childPath ?? "/";
2813
- I(e, w) === i && (u || (this.runtime.gasMeter().chargeBridge(), u = !0), await this.channelRunner.runHandlers(
2829
+ const v = h.contract().childPath ?? "/";
2830
+ k(e, v) === i && (u || (this.runtime.gasMeter().chargeBridge(), u = !0), await this.channelRunner.runHandlers(
2814
2831
  e,
2815
2832
  t,
2816
2833
  h.key(),
@@ -2826,7 +2843,7 @@ class Po {
2826
2843
  return;
2827
2844
  const n = this.runtime.scope(e), r = this.channelsMatching(
2828
2845
  t,
2829
- ko
2846
+ No
2830
2847
  );
2831
2848
  if (r.length === 0) {
2832
2849
  n.clearTriggered();
@@ -2866,25 +2883,25 @@ class Po {
2866
2883
  }
2867
2884
  isProcessorManagedChannel(e) {
2868
2885
  const t = this.runtime.blue(), n = e.node();
2869
- for (const r of ve)
2886
+ for (const r of Ie)
2870
2887
  if (t.isTypeOfBlueId(n, r))
2871
2888
  return !0;
2872
2889
  return !1;
2873
2890
  }
2874
2891
  validatePatchBoundary(e, t, n) {
2875
- const r = b(e), i = P(n.path);
2892
+ const r = w(e), i = R(n.path);
2876
2893
  if (i === r)
2877
- throw new H(
2894
+ throw new V(
2878
2895
  `Self-root mutation is forbidden at scope ${r}`
2879
2896
  );
2880
2897
  if (r !== "/" && !i.startsWith(`${r}/`))
2881
- throw new H(
2898
+ throw new V(
2882
2899
  `Patch path ${i} is outside scope ${r}`
2883
2900
  );
2884
2901
  for (const s of t.embeddedPaths()) {
2885
- const a = I(r, s);
2902
+ const a = k(r, s);
2886
2903
  if (i.startsWith(`${a}/`))
2887
- throw new H(
2904
+ throw new V(
2888
2905
  `Boundary violation: patch ${i} enters embedded scope ${a}`
2889
2906
  );
2890
2907
  }
@@ -2892,14 +2909,14 @@ class Po {
2892
2909
  enforceReservedKeyWriteProtection(e, t, n) {
2893
2910
  if (n)
2894
2911
  return;
2895
- const r = b(e), i = P(t.path);
2896
- for (const s of ye) {
2897
- const a = I(
2912
+ const r = w(e), i = R(t.path);
2913
+ for (const s of be) {
2914
+ const a = k(
2898
2915
  r,
2899
- oe(s)
2916
+ ae(s)
2900
2917
  );
2901
2918
  if (i === a || i.startsWith(`${a}/`))
2902
- throw new H(
2919
+ throw new V(
2903
2920
  `Reserved key '${s}' is write-protected at ${a}`
2904
2921
  );
2905
2922
  }
@@ -2907,90 +2924,90 @@ class Po {
2907
2924
  async markCutOffChildrenIfNeeded(e, t, n) {
2908
2925
  if (t.embeddedPaths().length === 0)
2909
2926
  return;
2910
- const r = P(n.path);
2927
+ const r = R(n.path);
2911
2928
  for (const i of t.embeddedPaths()) {
2912
- const s = I(e, i);
2929
+ const s = k(e, i);
2913
2930
  r === s && (n.op === "remove" || n.op === "replace") && await this.hooks.markCutOff(s);
2914
2931
  }
2915
2932
  }
2916
2933
  hasInitializationMarker(e) {
2917
- const t = I(e, fe), n = this.nodeAt(t);
2934
+ const t = k(e, ye), n = this.nodeAt(t);
2918
2935
  if (!n)
2919
2936
  return !1;
2920
2937
  if (!(n instanceof p)) {
2921
2938
  const i = `Reserved key 'initialized' must contain a Processing Initialized Marker at ${t}`;
2922
- throw new $(i);
2939
+ throw new K(i);
2923
2940
  }
2924
- if (n.getType()?.getBlueId() !== We) {
2941
+ if (n.getType()?.getBlueId() !== Je) {
2925
2942
  const i = `Reserved key 'initialized' must contain a Processing Initialized Marker at ${t}`;
2926
- throw new $(i);
2943
+ throw new K(i);
2927
2944
  }
2928
2945
  return !0;
2929
2946
  }
2930
2947
  createLifecycleEvent(e) {
2931
- return new p().setType(new p().setBlueId(Io)).setProperties({
2948
+ return new p().setType(new p().setBlueId(Bo)).setProperties({
2932
2949
  type: new p().setValue("Core/Document Processing Initiated"),
2933
2950
  documentId: new p().setValue(e)
2934
2951
  });
2935
2952
  }
2936
2953
  }
2937
- class ne extends Error {
2954
+ class ie extends Error {
2938
2955
  constructor(e) {
2939
2956
  super(
2940
2957
  e ? "Processing terminated due to fatal error" : "Processing terminated"
2941
2958
  ), this.fatal = e, this.name = "RunTerminationError";
2942
2959
  }
2943
2960
  }
2944
- const Ro = m["Core/Processing Terminated Marker"], Ao = m["Core/Document Processing Terminated"];
2945
- class Mo {
2961
+ const _o = S["Core/Processing Terminated Marker"], Lo = S["Core/Document Processing Terminated"];
2962
+ class xo {
2946
2963
  constructor(e) {
2947
2964
  this.runtime = e;
2948
2965
  }
2949
2966
  async terminateScope(e, t, n, r, i) {
2950
2967
  e.recordPendingTermination(t, r, i ?? null);
2951
- const s = e.normalizeScope(t), a = I(s, Qe);
2968
+ const s = e.normalizeScope(t), a = k(s, dt);
2952
2969
  this.runtime.directWrite(
2953
2970
  a,
2954
- No(this.runtime.blue(), r, i)
2971
+ Fo(this.runtime.blue(), r, i)
2955
2972
  ), this.runtime.gasMeter().chargeTerminationMarker();
2956
- const c = n ?? e.bundleForScope(s) ?? null, u = Oo(r, i);
2973
+ const c = n ?? e.bundleForScope(s) ?? null, u = $o(r, i);
2957
2974
  if (await e.deliverLifecycle(
2958
2975
  s,
2959
2976
  c,
2960
2977
  u,
2961
2978
  !1
2962
2979
  ), this.runtime.scope(s).finalizeTermination(r, i ?? null), e.clearPendingTermination(t), r === "FATAL" && this.runtime.gasMeter().chargeFatalTerminationOverhead(), r === "FATAL" && s === "/")
2963
- throw this.runtime.markRunTerminated(), new ne(!0);
2980
+ throw this.runtime.markRunTerminated(), new ie(!0);
2964
2981
  if (r === "GRACEFUL" && s === "/")
2965
- throw this.runtime.markRunTerminated(), new ne(!1);
2982
+ throw this.runtime.markRunTerminated(), new ie(!1);
2966
2983
  }
2967
2984
  }
2968
- function No(o, e, t) {
2969
- return Do(o, {
2970
- type: { blueId: Ro },
2985
+ function Fo(o, e, t) {
2986
+ return Uo(o, {
2987
+ type: { blueId: _o },
2971
2988
  cause: e === "GRACEFUL" ? "graceful" : "fatal",
2972
2989
  ...t ? { reason: t } : {}
2973
2990
  });
2974
2991
  }
2975
- function Oo(o, e) {
2992
+ function $o(o, e) {
2976
2993
  const t = new p().setType(
2977
- new p().setBlueId(Ao)
2994
+ new p().setBlueId(Lo)
2978
2995
  );
2979
2996
  return t.addProperty(
2980
2997
  "cause",
2981
2998
  new p().setValue(o === "GRACEFUL" ? "graceful" : "fatal")
2982
2999
  ), e && t.addProperty("reason", new p().setValue(e)), t;
2983
3000
  }
2984
- function Do(o, e) {
3001
+ function Uo(o, e) {
2985
3002
  return o.jsonValueToNode(e);
2986
3003
  }
2987
- const j = "-";
2988
- class Bo {
3004
+ const Y = "-";
3005
+ class zo {
2989
3006
  constructor(e) {
2990
3007
  this.document = e;
2991
3008
  }
2992
3009
  applyPatch(e, t) {
2993
- const n = b(e), r = P(t.path), i = qe(r), s = Ke(this.document, i, "before", r);
3010
+ const n = w(e), r = R(t.path), i = Ye(r), s = Qe(this.document, i, "before", r);
2994
3011
  switch (t.op) {
2995
3012
  case "ADD":
2996
3013
  this.applyAdd(i, r, t.val ?? null);
@@ -3002,34 +3019,34 @@ class Bo {
3002
3019
  this.applyRemove(i, r);
3003
3020
  break;
3004
3021
  }
3005
- const a = t.op === "REMOVE" ? null : Ke(this.document, i, "after", r);
3022
+ const a = t.op === "REMOVE" ? null : Qe(this.document, i, "after", r);
3006
3023
  return {
3007
3024
  path: r,
3008
3025
  before: s,
3009
3026
  after: a,
3010
3027
  op: t.op.toLowerCase(),
3011
3028
  originScope: n,
3012
- cascadeScopes: Lo(n)
3029
+ cascadeScopes: Vo(n)
3013
3030
  };
3014
3031
  }
3015
3032
  directWrite(e, t) {
3016
- const n = P(e);
3033
+ const n = R(e);
3017
3034
  if (n === "/")
3018
3035
  throw new Error("Direct write cannot target root document");
3019
- const r = qe(n), { parent: i, leaf: s } = this.resolveParent(r);
3020
- if (s === j)
3036
+ const r = Ye(n), { parent: i, leaf: s } = this.resolveParent(r);
3037
+ if (s === Y)
3021
3038
  throw new Error(
3022
3039
  `Direct write does not support append token '-' for path ${n}`
3023
3040
  );
3024
3041
  const a = i.getItems();
3025
- if (a && z(s)) {
3042
+ if (a && H(s)) {
3026
3043
  this.directWriteArray(i, a, s, t, n);
3027
3044
  return;
3028
3045
  }
3029
3046
  this.directWriteObject(i, s, t);
3030
3047
  }
3031
3048
  directWriteArray(e, t, n, r, i) {
3032
- const s = de(e, t), a = L(n, i);
3049
+ const s = me(e, t), a = x(n, i);
3033
3050
  if (r == null) {
3034
3051
  if (a < 0 || a >= s.length)
3035
3052
  return;
@@ -3050,7 +3067,7 @@ class Bo {
3050
3067
  );
3051
3068
  }
3052
3069
  directWriteObject(e, t, n) {
3053
- const r = X(e);
3070
+ const r = ee(e);
3054
3071
  if (n == null) {
3055
3072
  delete r[t], e.setProperties(
3056
3073
  Object.keys(r).length > 0 ? r : void 0
@@ -3070,25 +3087,25 @@ class Bo {
3070
3087
  return { parent: t, leaf: e[e.length - 1] };
3071
3088
  }
3072
3089
  getOrCreateChild(e, t, n, r) {
3073
- if (t === j)
3090
+ if (t === Y)
3074
3091
  throw new Error(
3075
- `Append token '-' must be final segment: ${q(n, r)}`
3092
+ `Append token '-' must be final segment: ${J(n, r)}`
3076
3093
  );
3077
3094
  const i = e.getItems();
3078
- if (i && z(t)) {
3079
- const c = L(t, q(n, r));
3095
+ if (i && H(t)) {
3096
+ const c = x(t, J(n, r));
3080
3097
  if (c < 0 || c >= i.length)
3081
3098
  throw new Error(
3082
- `Array index out of bounds: ${q(n, r)}`
3099
+ `Array index out of bounds: ${J(n, r)}`
3083
3100
  );
3084
3101
  const u = i[c];
3085
3102
  if (!u)
3086
3103
  throw new Error(
3087
- `Path does not exist: ${q(n, r)}`
3104
+ `Path does not exist: ${J(n, r)}`
3088
3105
  );
3089
3106
  return u;
3090
3107
  }
3091
- const s = X(e);
3108
+ const s = ee(e);
3092
3109
  let a = s[t];
3093
3110
  return a || (a = new p(), s[t] = a, e.setProperties(s)), a;
3094
3111
  }
@@ -3101,24 +3118,24 @@ class Bo {
3101
3118
  "ADD"
3102
3119
  );
3103
3120
  try {
3104
- if (z(i)) {
3105
- const u = r.getItems(), h = i === j;
3121
+ if (H(i)) {
3122
+ const u = r.getItems(), h = i === Y;
3106
3123
  if (!u)
3107
3124
  throw new Error(
3108
3125
  h ? `Append token '-' requires array at ${s}` : `Array index segment requires array at ${s}`
3109
3126
  );
3110
3127
  if (h) {
3111
- de(r, u).push(G(n));
3128
+ me(r, u).push(Q(n));
3112
3129
  return;
3113
3130
  }
3114
- const d = L(i, t);
3131
+ const d = x(i, t);
3115
3132
  if (d < 0 || d > u.length)
3116
3133
  throw new Error(`Array index out of bounds in path: ${t}`);
3117
- de(r, u).splice(d, 0, G(n));
3134
+ me(r, u).splice(d, 0, Q(n));
3118
3135
  return;
3119
3136
  }
3120
- const c = X(r);
3121
- c[i] = G(n), r.setProperties(c);
3137
+ const c = ee(r);
3138
+ c[i] = Q(n), r.setProperties(c);
3122
3139
  } catch (c) {
3123
3140
  throw this.rollbackCreated(a), c;
3124
3141
  }
@@ -3132,18 +3149,18 @@ class Bo {
3132
3149
  "REPLACE"
3133
3150
  );
3134
3151
  try {
3135
- if (z(i)) {
3152
+ if (H(i)) {
3136
3153
  const c = r.getItems();
3137
3154
  if (!c)
3138
3155
  throw new Error(`Array index segment requires array at ${t}`);
3139
- const u = L(i, t);
3156
+ const u = x(i, t);
3140
3157
  if (u < 0 || u >= c.length)
3141
3158
  throw new Error(`Array index out of bounds in path: ${t}`);
3142
- c[u] = G(n), r.setItems(c);
3159
+ c[u] = Q(n), r.setItems(c);
3143
3160
  return;
3144
3161
  }
3145
- const a = X(r);
3146
- a[i] = G(n), r.setProperties(a);
3162
+ const a = ee(r);
3163
+ a[i] = Q(n), r.setProperties(a);
3147
3164
  } catch (a) {
3148
3165
  throw this.rollbackCreated(s), a;
3149
3166
  }
@@ -3156,11 +3173,11 @@ class Bo {
3156
3173
  t,
3157
3174
  "REMOVE"
3158
3175
  );
3159
- if (z(r)) {
3176
+ if (H(r)) {
3160
3177
  const a = n.getItems();
3161
3178
  if (!a)
3162
3179
  throw new Error(`Array index segment requires array at ${t}`);
3163
- const c = L(r, t);
3180
+ const c = x(r, t);
3164
3181
  if (c < 0 || c >= a.length)
3165
3182
  throw new Error(`Array index out of bounds in path: ${t}`);
3166
3183
  a.splice(c, 1), n.setItems(a);
@@ -3178,18 +3195,18 @@ class Bo {
3178
3195
  let r = this.document;
3179
3196
  const i = [];
3180
3197
  for (let a = 0; a < e.length - 1; a += 1) {
3181
- const c = e[a], u = q(e, a + 1);
3182
- if (z(c)) {
3183
- const w = r.getItems();
3184
- if (!w)
3198
+ const c = e[a], u = J(e, a + 1);
3199
+ if (H(c)) {
3200
+ const v = r.getItems();
3201
+ if (!v)
3185
3202
  throw new Error(`Array index segment requires array at ${u}`);
3186
- const f = L(c, u);
3187
- if (f < 0 || f >= w.length)
3203
+ const f = x(c, u);
3204
+ if (f < 0 || f >= v.length)
3188
3205
  throw new Error(`Array index out of bounds in path: ${u}`);
3189
- const E = w[f];
3190
- if (!(E instanceof p))
3206
+ const g = v[f];
3207
+ if (!(g instanceof p))
3191
3208
  throw new Error(`Array index out of bounds in path: ${u}`);
3192
- r = E;
3209
+ r = g;
3193
3210
  continue;
3194
3211
  }
3195
3212
  let h = r.getProperties(), d = h?.[c] ?? null;
@@ -3210,7 +3227,7 @@ class Bo {
3210
3227
  }
3211
3228
  }
3212
3229
  }
3213
- function Lo(o) {
3230
+ function Vo(o) {
3214
3231
  const e = [];
3215
3232
  let t = o;
3216
3233
  for (; e.push(t), t !== "/"; ) {
@@ -3219,36 +3236,36 @@ function Lo(o) {
3219
3236
  }
3220
3237
  return e;
3221
3238
  }
3222
- function Ke(o, e, t, n) {
3239
+ function Qe(o, e, t, n) {
3223
3240
  try {
3224
3241
  if (e.length === 0)
3225
3242
  return o.clone();
3226
- const r = xo(o, e, t, n);
3243
+ const r = Ho(o, e, t, n);
3227
3244
  return r ? r.clone() : null;
3228
3245
  } catch {
3229
3246
  return null;
3230
3247
  }
3231
3248
  }
3232
- function xo(o, e, t, n) {
3249
+ function Ho(o, e, t, n) {
3233
3250
  let r = o;
3234
3251
  for (let i = 0; i < e.length; i += 1) {
3235
3252
  const s = e[i] ?? "", a = i === e.length - 1;
3236
- if (r = _o(r, s, a, t, n), !r)
3253
+ if (r = Ko(r, s, a, t, n), !r)
3237
3254
  return null;
3238
3255
  }
3239
3256
  return r;
3240
3257
  }
3241
- function _o(o, e, t, n, r) {
3258
+ function Ko(o, e, t, n, r) {
3242
3259
  if (!o)
3243
3260
  return null;
3244
3261
  const i = o.getItems();
3245
3262
  if (i) {
3246
- if (e === j) {
3263
+ if (e === Y) {
3247
3264
  if (!t)
3248
3265
  throw new Error(`Append token '-' must be final segment: ${r}`);
3249
3266
  return n === "before" || i.length === 0 ? null : i[i.length - 1] ?? null;
3250
3267
  }
3251
- const c = L(e, r);
3268
+ const c = x(e, r);
3252
3269
  return c < 0 || c >= i.length ? null : i[c] ?? null;
3253
3270
  }
3254
3271
  const s = o.getProperties();
@@ -3257,13 +3274,13 @@ function _o(o, e, t, n, r) {
3257
3274
  const a = s[e];
3258
3275
  return a instanceof p ? a : null;
3259
3276
  }
3260
- function qe(o) {
3277
+ function Ye(o) {
3261
3278
  if (o === "/" || o === "")
3262
3279
  return [];
3263
3280
  const e = o.startsWith("/") ? o.slice(1) : o;
3264
3281
  return e.length === 0 ? [] : e.split("/");
3265
3282
  }
3266
- function L(o, e) {
3283
+ function x(o, e) {
3267
3284
  const t = Number.parseInt(o, 10);
3268
3285
  if (Number.isNaN(t))
3269
3286
  throw new Error(`Expected numeric array index in path: ${e}`);
@@ -3271,7 +3288,7 @@ function L(o, e) {
3271
3288
  throw new Error(`Negative array index in path: ${e}`);
3272
3289
  return t;
3273
3290
  }
3274
- function q(o, e) {
3291
+ function J(o, e) {
3275
3292
  if (e <= 0)
3276
3293
  return "/";
3277
3294
  const t = Math.min(e, o.length);
@@ -3280,11 +3297,11 @@ function q(o, e) {
3280
3297
  n += `/${o[r] ?? ""}`;
3281
3298
  return n === "" ? "/" : n;
3282
3299
  }
3283
- function de(o, e) {
3300
+ function me(o, e) {
3284
3301
  const t = [...e];
3285
3302
  return o.setItems(t), t;
3286
3303
  }
3287
- function X(o) {
3304
+ function ee(o) {
3288
3305
  const e = o.getProperties();
3289
3306
  if (!e) {
3290
3307
  const n = {};
@@ -3293,13 +3310,13 @@ function X(o) {
3293
3310
  const t = { ...e };
3294
3311
  return o.setProperties(t), t;
3295
3312
  }
3296
- function z(o) {
3297
- return o === j || /^\d+$/.test(o);
3313
+ function H(o) {
3314
+ return o === Y || /^\d+$/.test(o);
3298
3315
  }
3299
- function G(o) {
3316
+ function Q(o) {
3300
3317
  return o == null ? new p().setValue(null) : o.clone();
3301
3318
  }
3302
- class Fo {
3319
+ class Wo {
3303
3320
  constructor(e) {
3304
3321
  this.path = e;
3305
3322
  }
@@ -3361,7 +3378,7 @@ class Fo {
3361
3378
  return this.cutOff;
3362
3379
  }
3363
3380
  }
3364
- class Uo {
3381
+ class qo {
3365
3382
  scopesMap = /* @__PURE__ */ new Map();
3366
3383
  rootEmissionList = [];
3367
3384
  scopes() {
@@ -3369,7 +3386,7 @@ class Uo {
3369
3386
  }
3370
3387
  scope(e) {
3371
3388
  let t = this.scopesMap.get(e);
3372
- return t || (t = new Fo(e), this.scopesMap.set(e, t)), t;
3389
+ return t || (t = new Wo(e), this.scopesMap.set(e, t)), t;
3373
3390
  }
3374
3391
  existingScope(e) {
3375
3392
  return this.scopesMap.get(e);
@@ -3387,33 +3404,33 @@ class Uo {
3387
3404
  this.scopesMap.delete(e);
3388
3405
  }
3389
3406
  }
3390
- function Pt(o) {
3407
+ function _t(o) {
3391
3408
  return Math.floor((o + 99) / 100);
3392
3409
  }
3393
- function Ho(o) {
3394
- const e = P(o);
3410
+ function Go(o) {
3411
+ const e = R(o);
3395
3412
  return e === "/" ? 0 : e.split("/").length - 1;
3396
3413
  }
3397
- function zo(o) {
3414
+ function jo(o) {
3398
3415
  return 40 + 5 * Math.max(0, o);
3399
3416
  }
3400
- function $o(o, e) {
3401
- return 8 + Ho(o) + Pt(e);
3417
+ function Jo(o, e) {
3418
+ return 8 + Go(o) + _t(e);
3402
3419
  }
3403
- const Vo = 1e3, Wo = 5, Ko = 50, qo = 2, Go = 10, jo = 10, Yo = 10, Jo = 20, Xo = 20, Qo = 30, Zo = 30, ei = 100;
3404
- function ti(o) {
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) {
3405
3422
  return 50 + 10 * o;
3406
3423
  }
3407
- function ni(o) {
3424
+ function li(o) {
3408
3425
  return 20 + o;
3409
3426
  }
3410
- function ri(o) {
3427
+ function ui(o) {
3411
3428
  return 10 * o;
3412
3429
  }
3413
- function oi(o) {
3430
+ function hi(o) {
3414
3431
  return 20 + o;
3415
3432
  }
3416
- class ii {
3433
+ class di {
3417
3434
  constructor(e) {
3418
3435
  this.blue = e;
3419
3436
  }
@@ -3425,72 +3442,72 @@ class ii {
3425
3442
  this.total += e;
3426
3443
  }
3427
3444
  chargeScopeEntry(e) {
3428
- this.add(ti(this.scopeDepth(e)));
3445
+ this.add(ci(this.scopeDepth(e)));
3429
3446
  }
3430
3447
  chargeInitialization() {
3431
- this.add(Vo);
3448
+ this.add(Qo);
3432
3449
  }
3433
3450
  chargeChannelMatchAttempt() {
3434
- this.add(Wo);
3451
+ this.add(Yo);
3435
3452
  }
3436
3453
  chargeHandlerOverhead() {
3437
- this.add(Ko);
3454
+ this.add(Zo);
3438
3455
  }
3439
3456
  chargeBoundaryCheck() {
3440
- this.add(qo);
3457
+ this.add(Xo);
3441
3458
  }
3442
3459
  chargePatchAddOrReplace(e) {
3443
- this.add(ni(this.payloadSizeCharge(e)));
3460
+ this.add(li(this.payloadSizeCharge(e)));
3444
3461
  }
3445
3462
  chargePatchRemove() {
3446
- this.add(Go);
3463
+ this.add(ei);
3447
3464
  }
3448
3465
  chargeCascadeRouting(e) {
3449
- e > 0 && this.add(ri(e));
3466
+ e > 0 && this.add(ui(e));
3450
3467
  }
3451
3468
  chargeEmitEvent(e) {
3452
- this.add(oi(this.payloadSizeCharge(e)));
3469
+ this.add(hi(this.payloadSizeCharge(e)));
3453
3470
  }
3454
3471
  chargeBridge() {
3455
- this.add(jo);
3472
+ this.add(ti);
3456
3473
  }
3457
3474
  chargeDrainEvent() {
3458
- this.add(Yo);
3475
+ this.add(ni);
3459
3476
  }
3460
3477
  chargeCheckpointUpdate() {
3461
- this.add(Jo);
3478
+ this.add(ri);
3462
3479
  }
3463
3480
  chargeTerminationMarker() {
3464
- this.add(Xo);
3481
+ this.add(oi);
3465
3482
  }
3466
3483
  chargeLifecycleDelivery() {
3467
- this.add(Qo);
3484
+ this.add(ii);
3468
3485
  }
3469
3486
  chargeFatalTerminationOverhead() {
3470
- this.add(ei);
3487
+ this.add(ai);
3471
3488
  }
3472
3489
  chargeTriggerEventBase() {
3473
- this.add(Zo);
3490
+ this.add(si);
3474
3491
  }
3475
3492
  chargeUpdateDocumentBase(e) {
3476
- this.add(zo(e));
3493
+ this.add(jo(e));
3477
3494
  }
3478
3495
  chargeDocumentSnapshot(e, t) {
3479
- const n = t ? Ne(this.blue, t) : 0;
3480
- this.add($o(e, n));
3496
+ const n = t ? Le(this.blue, t) : 0;
3497
+ this.add(Jo(e, n));
3481
3498
  }
3482
3499
  chargeWasmGas(e) {
3483
- const t = rn(e);
3500
+ const t = en(e);
3484
3501
  t > 0 && this.add(t);
3485
3502
  }
3486
3503
  payloadSizeCharge(e) {
3487
3504
  if (!e)
3488
3505
  return 0;
3489
- const t = Ne(this.blue, e);
3490
- return Pt(t);
3506
+ const t = Le(this.blue, e);
3507
+ return _t(t);
3491
3508
  }
3492
3509
  scopeDepth(e) {
3493
- const t = b(e);
3510
+ const t = w(e);
3494
3511
  if (t === "/" || t.length <= 1)
3495
3512
  return 0;
3496
3513
  let n = 1;
@@ -3499,12 +3516,12 @@ class ii {
3499
3516
  return n;
3500
3517
  }
3501
3518
  }
3502
- class si {
3519
+ class pi {
3503
3520
  constructor(e, t) {
3504
- this.documentRef = e, this.blueRef = t, this.patchEngine = new Bo(this.documentRef), this.meter = new ii(this.blueRef);
3521
+ this.documentRef = e, this.blueRef = t, this.patchEngine = new zo(this.documentRef), this.meter = new di(this.blueRef);
3505
3522
  }
3506
3523
  patchEngine;
3507
- emissionRegistry = new Uo();
3524
+ emissionRegistry = new qo();
3508
3525
  meter;
3509
3526
  runTerminated = !1;
3510
3527
  document() {
@@ -3553,15 +3570,15 @@ class si {
3553
3570
  return this.patchEngine.applyPatch(e, t);
3554
3571
  }
3555
3572
  }
3556
- const ai = m["Core/Processing Initialized Marker"], ci = m["Core/Document Update"];
3557
- class li {
3573
+ const fi = S["Core/Processing Initialized Marker"], mi = S["Core/Document Update"];
3574
+ class gi {
3558
3575
  constructor(e, t, n, r) {
3559
- this.contractLoader = e, this.registry = t, this.runtimeRef = new si(r, n);
3560
- const i = (s) => it(this.runtimeRef.blue(), s);
3561
- this.checkpointManager = new yo(
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(
3562
3579
  this.runtimeRef,
3563
3580
  i
3564
- ), this.terminationService = new Mo(this.runtimeRef), this.channelRunner = new vo(
3581
+ ), this.terminationService = new xo(this.runtimeRef), this.channelRunner = new Po(
3565
3582
  this.runtimeRef,
3566
3583
  this.checkpointManager,
3567
3584
  {
@@ -3578,9 +3595,9 @@ class li {
3578
3595
  const c = this.lookupHandlerProcessor(s);
3579
3596
  if (!c) {
3580
3597
  const h = `No processor registered for handler contract ${s.blueId()}`;
3581
- throw new y(
3598
+ throw new E(
3582
3599
  h,
3583
- S.illegalState(h)
3600
+ C.illegalState(h)
3584
3601
  );
3585
3602
  }
3586
3603
  const u = c.matches;
@@ -3591,7 +3608,7 @@ class li {
3591
3608
  canonicalSignature: i,
3592
3609
  channelProcessorFor: (s) => this.lookupChannelProcessor(s)
3593
3610
  }
3594
- ), this.scopeExecutor = new Po({
3611
+ ), this.scopeExecutor = new Do({
3595
3612
  runtime: this.runtimeRef,
3596
3613
  contractLoader: this.contractLoader,
3597
3614
  channelRunner: this.channelRunner,
@@ -3642,7 +3659,7 @@ class li {
3642
3659
  );
3643
3660
  }
3644
3661
  createContext(e, t, n, r = !1, i = !1) {
3645
- return new ui(
3662
+ return new Ei(
3646
3663
  this,
3647
3664
  t,
3648
3665
  e,
@@ -3653,7 +3670,7 @@ class li {
3653
3670
  }
3654
3671
  result() {
3655
3672
  const e = this.runtimeRef.document().clone(), t = this.runtimeRef.rootEmissions().map((n) => n.clone());
3656
- return Ge.of(
3673
+ return Ze.of(
3657
3674
  e,
3658
3675
  t,
3659
3676
  this.runtimeRef.totalGas()
@@ -3663,10 +3680,10 @@ class li {
3663
3680
  return this.runtimeRef;
3664
3681
  }
3665
3682
  bundleForScope(e) {
3666
- return this.bundles.get(b(e));
3683
+ return this.bundles.get(w(e));
3667
3684
  }
3668
3685
  isScopeInactive(e) {
3669
- const t = b(e);
3686
+ const t = w(e);
3670
3687
  return this.cutOffScopes.has(t) || this.pendingTerminations.has(t) || this.runtimeRef.isScopeTerminated(t);
3671
3688
  }
3672
3689
  async enterGracefulTermination(e, t, n) {
@@ -3676,13 +3693,13 @@ class li {
3676
3693
  await this.terminate(e, t, "FATAL", n);
3677
3694
  }
3678
3695
  recordPendingTermination(e, t, n) {
3679
- this.pendingTerminations.set(b(e), { kind: t, reason: n });
3696
+ this.pendingTerminations.set(w(e), { kind: t, reason: n });
3680
3697
  }
3681
3698
  clearPendingTermination(e) {
3682
- this.pendingTerminations.delete(b(e));
3699
+ this.pendingTerminations.delete(w(e));
3683
3700
  }
3684
3701
  async markCutOff(e) {
3685
- const t = b(e);
3702
+ const t = w(e);
3686
3703
  this.cutOffScopes.add(t) && this.runtimeRef.existingScope(t)?.markCutOff();
3687
3704
  }
3688
3705
  async deliverLifecycle(e, t, n, r) {
@@ -3697,13 +3714,13 @@ class li {
3697
3714
  this.runtimeRef.scope(e).recordBridgeable(t.clone()), e === "/" && this.runtimeRef.recordRootEmission(t.clone());
3698
3715
  }
3699
3716
  normalizeScope(e) {
3700
- return b(e);
3717
+ return w(e);
3701
3718
  }
3702
3719
  resolvePointer(e, t) {
3703
- return I(e, t);
3720
+ return k(e, t);
3704
3721
  }
3705
3722
  async terminate(e, t, n, r) {
3706
- const i = b(e);
3723
+ const i = w(e);
3707
3724
  this.pendingTerminations.has(i) || this.runtimeRef.isScopeTerminated(i) || (this.pendingTerminations.set(i, { kind: n, reason: r }), await this.terminationService.terminateScope(
3708
3725
  this,
3709
3726
  e,
@@ -3713,8 +3730,8 @@ class li {
3713
3730
  ));
3714
3731
  }
3715
3732
  nodeAt(e) {
3716
- const t = b(e);
3717
- return re.nodeAt(this.runtimeRef.document(), t, {
3733
+ const t = w(e);
3734
+ return se.nodeAt(this.runtimeRef.document(), t, {
3718
3735
  calculateBlueId: (n) => this.runtimeRef.blue().calculateBlueIdSync(n)
3719
3736
  });
3720
3737
  }
@@ -3731,27 +3748,27 @@ class li {
3731
3748
  event: a,
3732
3749
  markers: t.markers(),
3733
3750
  bindingKey: e.key(),
3734
- resolveChannel: (v) => t.channelEntry(v),
3735
- channelProcessorFor: (v) => this.lookupChannelProcessor(v)
3751
+ resolveChannel: (y) => t.channelEntry(y),
3752
+ channelProcessorFor: (y) => this.lookupChannelProcessor(y)
3736
3753
  }, d = i.evaluate;
3737
3754
  if (typeof d == "function")
3738
3755
  return await d.call(i, c, h);
3739
3756
  if (!await i.matches(c, h))
3740
3757
  return { matches: !1 };
3741
- const f = i.channelize, E = f ? f.call(i, c, h) : void 0;
3758
+ const f = i.channelize, g = f ? f.call(i, c, h) : void 0;
3742
3759
  return {
3743
3760
  matches: !0,
3744
3761
  eventId: s,
3745
- eventNode: E ?? a.clone()
3762
+ eventNode: g ?? a.clone()
3746
3763
  };
3747
3764
  }
3748
3765
  async executeHandler(e, t) {
3749
3766
  const n = this.lookupHandlerProcessor(e);
3750
3767
  if (!n) {
3751
3768
  const r = `No processor registered for handler contract ${e.blueId()}`;
3752
- throw new y(
3769
+ throw new E(
3753
3770
  r,
3754
- S.illegalState(r)
3771
+ C.illegalState(r)
3755
3772
  );
3756
3773
  }
3757
3774
  await n.execute(e.contract(), t, {
@@ -3765,7 +3782,7 @@ class li {
3765
3782
  * the outer run logic can react according to spec (§22).
3766
3783
  */
3767
3784
  async handleHandlerError(e, t, n) {
3768
- if (n instanceof ne || n instanceof x)
3785
+ if (n instanceof ie || n instanceof F)
3769
3786
  throw n;
3770
3787
  const r = this.fatalReason(n, "Runtime fatal");
3771
3788
  await this.enterFatalTermination(e, t, r);
@@ -3783,8 +3800,8 @@ class li {
3783
3800
  return this.registry.lookupChannelForNode(this.runtimeRef.blue(), e) ?? null;
3784
3801
  }
3785
3802
  createDocumentUpdateEvent(e, t) {
3786
- const n = qt(t, e.path), r = e.before != null ? e.before.clone() : new p().setValue(null), i = e.after != null ? e.after.clone() : new p().setValue(null), s = new p().setType(
3787
- new p().setBlueId(ci)
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)
3788
3805
  );
3789
3806
  return s.setProperties({
3790
3807
  op: new p().setValue(e.op),
@@ -3796,17 +3813,17 @@ class li {
3796
3813
  matchesDocumentUpdate(e, t, n) {
3797
3814
  if (!t || t.length === 0)
3798
3815
  return !1;
3799
- const r = P(I(e, t)), i = P(n);
3816
+ const r = R(k(e, t)), i = R(n);
3800
3817
  return r === "/" || i === r ? !0 : i.startsWith(`${r}/`);
3801
3818
  }
3802
3819
  }
3803
- class re {
3820
+ class se {
3804
3821
  constructor(e, t, n) {
3805
3822
  this.contractLoader = e, this.registry = t, this.blue = n;
3806
3823
  }
3807
3824
  async initializeDocument(e) {
3808
3825
  if (this.isInitialized(e))
3809
- throw new $("Document already initialized");
3826
+ throw new K("Document already initialized");
3810
3827
  const t = this.createExecution(e.clone());
3811
3828
  return this.run(e, t, async () => {
3812
3829
  await t.initializeScope("/", !0);
@@ -3814,7 +3831,7 @@ class re {
3814
3831
  }
3815
3832
  async processDocument(e, t) {
3816
3833
  if (!this.isInitialized(e))
3817
- throw new $("Document not initialized");
3834
+ throw new K("Document not initialized");
3818
3835
  const n = this.createExecution(e.clone()), r = t.clone();
3819
3836
  return this.run(e, n, async () => {
3820
3837
  n.loadBundles("/"), await n.processExternalEvent("/", r);
@@ -3824,7 +3841,7 @@ class re {
3824
3841
  return this.initializationMarker(e) != null;
3825
3842
  }
3826
3843
  createExecution(e) {
3827
- return new li(
3844
+ return new gi(
3828
3845
  this.contractLoader,
3829
3846
  this.registry,
3830
3847
  this.blue,
@@ -3835,11 +3852,11 @@ class re {
3835
3852
  try {
3836
3853
  await n();
3837
3854
  } catch (r) {
3838
- if (r instanceof ne)
3855
+ if (r instanceof ie)
3839
3856
  return t.result();
3840
- if (r instanceof x) {
3857
+ if (r instanceof F) {
3841
3858
  const i = e.clone();
3842
- return Ge.capabilityFailure(
3859
+ return Ze.capabilityFailure(
3843
3860
  i,
3844
3861
  r.message ?? null
3845
3862
  );
@@ -3849,20 +3866,20 @@ class re {
3849
3866
  return t.result();
3850
3867
  }
3851
3868
  initializationMarker(e) {
3852
- const n = e.getProperties()?.[Pe.OBJECT_CONTRACTS]?.getProperties()?.initialized ?? null;
3869
+ const n = e.getProperties()?.[Ne.OBJECT_CONTRACTS]?.getProperties()?.initialized ?? null;
3853
3870
  if (!n)
3854
3871
  return null;
3855
3872
  if (!(n instanceof p))
3856
- throw new y(
3873
+ throw new E(
3857
3874
  "Initialization Marker must be a BlueNode",
3858
- S.illegalState(
3875
+ C.illegalState(
3859
3876
  "Initialization Marker must be a BlueNode"
3860
3877
  )
3861
3878
  );
3862
- if (n.getType()?.getBlueId() !== ai)
3863
- throw new y(
3879
+ if (n.getType()?.getBlueId() !== fi)
3880
+ throw new E(
3864
3881
  "Initialization Marker must declare type 'Processing Initialized Marker'",
3865
- S.illegalState(
3882
+ C.illegalState(
3866
3883
  "Initialization Marker must declare type 'Processing Initialized Marker'"
3867
3884
  )
3868
3885
  );
@@ -3871,7 +3888,7 @@ class re {
3871
3888
  static nodeAt(e, t, n) {
3872
3889
  if (!(e instanceof p))
3873
3890
  return null;
3874
- const r = P(t);
3891
+ const r = R(t);
3875
3892
  if (r === "/")
3876
3893
  return e;
3877
3894
  const i = r.slice(1).split("/");
@@ -3922,10 +3939,17 @@ class re {
3922
3939
  return new p().setValue(e.getValue() ?? null);
3923
3940
  case "blue":
3924
3941
  return e.getBlue() ?? null;
3925
- case Pe.OBJECT_CONTRACTS:
3942
+ case Ne.OBJECT_CONTRACTS:
3926
3943
  return new p().setContracts(e.getContracts());
3927
3944
  case "blueId": {
3928
- const r = e.getBlueId() ?? n?.calculateBlueId?.(e) ?? Lt.calculateBlueIdSync(e);
3945
+ const r = n?.calculateBlueId?.(e);
3946
+ if (r === void 0)
3947
+ throw new E(
3948
+ "ProcessorEngine.nodeAt requires a semantic calculateBlueId option for /blueId.",
3949
+ C.illegalState(
3950
+ "ProcessorEngine.nodeAt requires a semantic calculateBlueId option for /blueId."
3951
+ )
3952
+ );
3929
3953
  return new p().setValue(r ?? null);
3930
3954
  }
3931
3955
  default:
@@ -3933,7 +3957,7 @@ class re {
3933
3957
  }
3934
3958
  }
3935
3959
  }
3936
- class ui {
3960
+ class Ei {
3937
3961
  constructor(e, t, n, r, i, s) {
3938
3962
  this.execution = e, this.bundle = t, this.scopePathValue = n, this.eventNode = r, this.allowTerminatedWork = i, this.allowReservedMutation = s;
3939
3963
  }
@@ -3969,7 +3993,7 @@ class ui {
3969
3993
  this.shouldSkipTerminatedWork() || this.execution.runtime().addGas(e);
3970
3994
  }
3971
3995
  throwFatal(e) {
3972
- throw new y(e, S.runtimeFatal(e));
3996
+ throw new E(e, C.runtimeFatal(e));
3973
3997
  }
3974
3998
  resolvePointer(e) {
3975
3999
  return this.execution.resolvePointer(this.scopePathValue, e);
@@ -3988,7 +4012,7 @@ class ui {
3988
4012
  if (!e)
3989
4013
  return !1;
3990
4014
  try {
3991
- return re.nodeAt(
4015
+ return se.nodeAt(
3992
4016
  this.execution.runtime().document(),
3993
4017
  e,
3994
4018
  {
@@ -4000,7 +4024,7 @@ class ui {
4000
4024
  }
4001
4025
  }
4002
4026
  documentNodeAt(e) {
4003
- const t = re.nodeAt(
4027
+ const t = se.nodeAt(
4004
4028
  this.execution.runtime().document(),
4005
4029
  e,
4006
4030
  {
@@ -4027,16 +4051,17 @@ class ui {
4027
4051
  return !this.allowTerminatedWork && this.execution.isScopeInactive(this.scopePathValue);
4028
4052
  }
4029
4053
  }
4030
- const hi = new xt({
4031
- repositories: [_t]
4054
+ const yi = new $t({
4055
+ repositories: [at],
4056
+ mergingProcessor: st()
4032
4057
  });
4033
- class di {
4058
+ class Ci {
4034
4059
  blue;
4035
4060
  registryRef;
4036
4061
  contractLoaderRef;
4037
4062
  engine;
4038
4063
  constructor(e) {
4039
- this.registryRef = e?.registry ?? ae.create().registerDefaults().build(), this.blue = e?.blue ?? hi, this.contractLoaderRef = new fo(this.registryRef, this.blue), this.engine = new re(
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(
4040
4065
  this.contractLoaderRef,
4041
4066
  this.registryRef,
4042
4067
  this.blue
@@ -4069,14 +4094,14 @@ class di {
4069
4094
  return this.contractLoaderRef;
4070
4095
  }
4071
4096
  static builder() {
4072
- return new pi();
4097
+ return new Si();
4073
4098
  }
4074
4099
  }
4075
- class pi {
4100
+ class Si {
4076
4101
  contractRegistry;
4077
4102
  blueInstance;
4078
4103
  constructor() {
4079
- this.contractRegistry = ae.create().registerDefaults().build();
4104
+ this.contractRegistry = ue.create().registerDefaults().build();
4080
4105
  }
4081
4106
  withRegistry(e) {
4082
4107
  return this.contractRegistry = e, this;
@@ -4088,149 +4113,117 @@ class pi {
4088
4113
  return this.blueInstance = e, this;
4089
4114
  }
4090
4115
  build() {
4091
- return new di({
4116
+ return new Ci({
4092
4117
  registry: this.contractRegistry,
4093
4118
  blue: this.blueInstance
4094
4119
  });
4095
4120
  }
4096
4121
  }
4097
- class Rt {
4098
- process(e, t) {
4099
- const n = t.getValue();
4100
- if (ee(n)) {
4101
- const r = t.clone();
4102
- return r.setValue(n), r.setProperties(void 0), r.setItems(void 0), r.setType(void 0), r;
4103
- }
4104
- return e;
4105
- }
4106
- /**
4107
- * Post-process to ensure expressions aren't overridden by subsequent processors
4108
- */
4109
- postProcess(e, t) {
4110
- const n = t.getValue();
4111
- if (ee(n) && e.getValue() !== n && n !== void 0) {
4112
- const r = e.clone();
4113
- return r.setValue(n), r;
4114
- }
4115
- return e;
4116
- }
4117
- }
4118
- const xi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4122
+ const Hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4119
4123
  __proto__: null,
4120
- ExpressionPreserver: Rt
4124
+ ExpressionPreserver: it
4121
4125
  }, Symbol.toStringTag, { value: "Module" }));
4122
- function _i() {
4123
- return new B.SequentialMergingProcessor([
4124
- new B.ValuePropagator(),
4125
- new Rt(),
4126
- new B.TypeAssigner(),
4127
- new B.ListProcessor(),
4128
- new B.DictionaryProcessor(),
4129
- new B.MetadataPropagator(),
4130
- new B.BasicTypesVerifier()
4131
- ]);
4132
- }
4133
4126
  export {
4134
- yt as ActorPolicyLiteralValidationError,
4135
- qr as ChannelBinding,
4136
- vo as ChannelRunner,
4137
- yo as CheckpointManager,
4138
- Co as CheckpointRecord,
4139
- ct as CodeBlockEvaluationError,
4140
- V as ContractBundle,
4141
- jr as ContractBundleBuilder,
4142
- fo as ContractLoader,
4143
- sr as ContractProcessorRegistry,
4144
- ae as ContractProcessorRegistryBuilder,
4145
- Ge as DocumentProcessingResult,
4146
- si as DocumentProcessingRuntime,
4147
- di as DocumentProcessor,
4148
- pi as DocumentProcessorBuilder,
4149
- Uo as EmissionRegistry,
4150
- ii as GasMeter,
4151
- Gr as HandlerBinding,
4152
- O as KEY_CHECKPOINT,
4153
- je as KEY_EMBEDDED,
4154
- Ye as KEY_INITIALIZED,
4155
- Je as KEY_TERMINATED,
4156
- xi as MergingProcessors,
4157
- ve as PROCESSOR_MANAGED_CHANNEL_BLUE_IDS,
4158
- Bo as PatchEngine,
4159
- Ni as ProcessorContractConstants,
4160
- re as ProcessorEngine,
4161
- S as ProcessorErrors,
4162
- li as ProcessorExecution,
4163
- ui as ProcessorExecutionContext,
4164
- y as ProcessorFatalError,
4165
- Oi as ProcessorPointerConstants,
4166
- Se as QuickJSEvaluator,
4167
- Ze as RELATIVE_CHECKPOINT,
4168
- W as RELATIVE_CONTRACTS,
4169
- Kt as RELATIVE_EMBEDDED,
4170
- fe as RELATIVE_INITIALIZED,
4171
- Qe as RELATIVE_TERMINATED,
4172
- ye as RESERVED_CONTRACT_KEYS,
4173
- ne as RunTerminationError,
4174
- Po as ScopeExecutor,
4175
- Fo as ScopeRuntimeContext,
4176
- Mo as TerminationService,
4177
- Ct as actorPolicyMarkerSchema,
4178
- On as actorPolicyRuleSchema,
4179
- Pi as andThen,
4180
- it as canonicalSignature,
4181
- Ne as canonicalSize,
4182
- F as channelContractBaseSchema,
4183
- xn as channelEventCheckpointSchema,
4184
- mt as compositeTimelineChannelSchema,
4185
- fn as containsExpression,
4186
- we as contractBaseSchema,
4187
- _i as createDefaultMergingProcessor,
4188
- ht as createPicomatchShouldResolve,
4189
- qn as documentAnchorsMarkerSchema,
4190
- Yn as documentLinksMarkerSchema,
4191
- yn as documentUpdateChannelSchema,
4192
- Sn as embeddedNodeChannelSchema,
4193
- Ut as err,
4194
- ut as evaluateQuickJSExpression,
4195
- mn as extractExpressionContent,
4196
- pt as handlerContractBaseSchema,
4197
- Fn as initializationMarkerSchema,
4198
- ki as isErr,
4199
- ee as isExpression,
4200
- bi as isOk,
4201
- Xe as isProcessorManagedChannelBlueId,
4202
- Wt as isReservedContractKey,
4203
- Di as joinRelativePointers,
4204
- Bi as jsonPatchSchema,
4205
- bn as lifecycleChannelSchema,
4206
- Ti as map,
4207
- Ii as mapErr,
4208
- R as markerContractBaseSchema,
4209
- Mi as match,
4210
- Xn as myosParticipantsOrchestrationMarkerSchema,
4211
- Zn as myosSessionInteractionMarkerSchema,
4212
- Rn as myosTimelineChannelSchema,
4213
- tr as myosWorkerAgencyMarkerSchema,
4214
- P as normalizePointer,
4215
- b as normalizeScope,
4216
- Ft as ok,
4217
- Vn as operationMarkerSchema,
4218
- Hn as processEmbeddedMarkerSchema,
4219
- $n as processingTerminatedMarkerSchema,
4220
- nt as relativeCheckpointLastEvent,
4221
- rt as relativeCheckpointLastSignature,
4222
- oe as relativeContractsEntry,
4223
- qt as relativizePointer,
4224
- te as resolveNodeExpressions,
4225
- I as resolvePointer,
4226
- gn as resolveTemplateString,
4227
- or as sequentialWorkflowOperationSchema,
4228
- nr as sequentialWorkflowSchema,
4229
- Li as sequentialWorkflowStepSchema,
4230
- Ae as stripSlashes,
4231
- In as timelineChannelSchema,
4232
- Tn as triggeredEventChannelSchema,
4233
- Ri as unwrapOr,
4234
- Ai as unwrapOrElse,
4235
- Bn as validateActorPolicyNode
4127
+ Pt as ActorPolicyLiteralValidationError,
4128
+ Xr as ChannelBinding,
4129
+ Po as ChannelRunner,
4130
+ To as CheckpointManager,
4131
+ ko as CheckpointRecord,
4132
+ Xe as CodeBlockEvaluationError,
4133
+ W as ContractBundle,
4134
+ to as ContractBundleBuilder,
4135
+ vo as ContractLoader,
4136
+ pr as ContractProcessorRegistry,
4137
+ ue as ContractProcessorRegistryBuilder,
4138
+ Ze as DocumentProcessingResult,
4139
+ pi as DocumentProcessingRuntime,
4140
+ Ci as DocumentProcessor,
4141
+ Si as DocumentProcessorBuilder,
4142
+ qo as EmissionRegistry,
4143
+ di as GasMeter,
4144
+ eo as HandlerBinding,
4145
+ D as KEY_CHECKPOINT,
4146
+ ct as KEY_EMBEDDED,
4147
+ lt as KEY_INITIALIZED,
4148
+ ut as KEY_TERMINATED,
4149
+ Hi as MergingProcessors,
4150
+ Ie as PROCESSOR_MANAGED_CHANNEL_BLUE_IDS,
4151
+ zo as PatchEngine,
4152
+ Fi as ProcessorContractConstants,
4153
+ se as ProcessorEngine,
4154
+ C as ProcessorErrors,
4155
+ gi as ProcessorExecution,
4156
+ Ei as ProcessorExecutionContext,
4157
+ E as ProcessorFatalError,
4158
+ $i as ProcessorPointerConstants,
4159
+ ke as QuickJSEvaluator,
4160
+ pt as RELATIVE_CHECKPOINT,
4161
+ G as RELATIVE_CONTRACTS,
4162
+ hn as RELATIVE_EMBEDDED,
4163
+ ye as RELATIVE_INITIALIZED,
4164
+ dt as RELATIVE_TERMINATED,
4165
+ be as RESERVED_CONTRACT_KEYS,
4166
+ 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,
4175
+ U as channelContractBaseSchema,
4176
+ Hn as channelEventCheckpointSchema,
4177
+ bt as compositeTimelineChannelSchema,
4178
+ on as containsExpression,
4179
+ 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,
4201
+ M as markerContractBaseSchema,
4202
+ xi as match,
4203
+ or as myosParticipantsOrchestrationMarkerSchema,
4204
+ sr as myosSessionInteractionMarkerSchema,
4205
+ _n as myosTimelineChannelSchema,
4206
+ cr as myosWorkerAgencyMarkerSchema,
4207
+ R as normalizePointer,
4208
+ 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,
4215
+ ae as relativeContractsEntry,
4216
+ dn as relativizePointer,
4217
+ re as resolveNodeExpressions,
4218
+ k as resolvePointer,
4219
+ an as resolveTemplateString,
4220
+ hr as sequentialWorkflowOperationSchema,
4221
+ lr as sequentialWorkflowSchema,
4222
+ Vi as sequentialWorkflowStepSchema,
4223
+ De as stripSlashes,
4224
+ Bn as timelineChannelSchema,
4225
+ An as triggeredEventChannelSchema,
4226
+ _i as unwrapOr,
4227
+ Li as unwrapOrElse,
4228
+ zn as validateActorPolicyNode
4236
4229
  };