@blue-labs/document-processor 3.10.0 → 3.11.0

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