@voltro/protocol 0.81.0 → 0.83.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,58 +1,67 @@
1
- import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as ee, J as te, K as ne, L as re, M as ie, N as ae, O as oe, P as se, Q as ce, R as le, S as ue, T as de, U as fe, V as pe, W as me, X as he, Y as ge, Z as _e, _ as l, a as ve, at as ye, b as be, c as xe, d as Se, et as Ce, f as we, g as Te, h as Ee, i as De, it as Oe, j as ke, k as Ae, l as je, m as Me, n as Ne, nt as Pe, o as u, p as Fe, q as Ie, r as Le, rt as Re, s as ze, t as Be, tt as Ve, u as He, v as Ue, w as d, x as f, y as We, z as p } from "./scopes-CvU5QBQ4.js";
2
- import { A as Ge, C as Ke, D as qe, E as Je, O as Ye, S as Xe, T as Ze, _ as Qe, a as $e, b as et, c as tt, d as nt, f as rt, g as it, h as at, i as ot, k as st, l as ct, m as lt, n as ut, o as dt, p as ft, r as pt, s as mt, t as ht, u as gt, v as _t, w as vt, x as yt, y as bt } from "./restFormat-CzdGVkuB.js";
3
- import { Context as xt, Layer as St, Schema as m } from "effect";
4
- import { Rpc as h } from "@effect/rpc";
5
- import { VersionConflict as Ct } from "@voltro/database/wire";
1
+ import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as ee, J as te, K as ne, L as re, M as ie, N as ae, O as oe, P as se, Q as ce, R as le, S as ue, T as de, U as fe, V as l, W as pe, X as me, Y as he, Z as ge, _ as _e, a as ve, at as ye, b as be, c as xe, d as u, et as Se, f as Ce, g as we, h as Te, i as Ee, it as De, j as Oe, k as ke, l as Ae, m as je, n as Me, nt as Ne, o as d, ot as Pe, p as Fe, q as Ie, r as Le, rt as Re, s as f, st as ze, t as Be, tt as Ve, u as He, v as Ue, w as We, x as Ge, y as p, z as Ke } from "./scopes-Di756ENh.js";
2
+ import { A as qe, C as m, D as Je, E as Ye, O as Xe, S as Ze, T as Qe, _ as $e, a as et, b as tt, c as nt, d as rt, f as it, g as at, h as ot, i as st, j as ct, k as lt, l as ut, m as dt, n as ft, o as pt, p as mt, r as ht, s as gt, t as _t, u as vt, v as yt, w as bt, x as xt, y as St } from "./restFormat-EZ8k9ZcQ.js";
3
+ import { n as Ct, t as wt } from "./sessionHeader-DriTZhmv.js";
4
+ import { Context as Tt, Either as Et, Encoding as Dt, Layer as Ot, Schema as h } from "effect";
5
+ import { Rpc as g } from "@effect/rpc";
6
+ import { VersionConflict as kt } from "@voltro/database/wire";
6
7
  //#region src/rowPatch.ts
7
- var wt = m.Union(m.String, m.Number), Tt = m.Record({
8
- key: m.String,
9
- value: m.Unknown
10
- }).pipe(m.filter((e) => "id" in e, { message: () => "patch row must carry an id" })), Et = m.Union(m.Struct({
11
- op: m.Literal("add"),
12
- path: m.String,
13
- value: Tt
14
- }), m.Struct({
15
- op: m.Literal("replace"),
16
- path: m.String,
17
- value: Tt
18
- }), m.Struct({
19
- op: m.Literal("remove"),
20
- path: m.String
21
- }), m.Struct({
22
- op: m.Literal("mergeCells"),
23
- path: m.String,
24
- value: m.Record({
25
- key: m.String,
26
- value: m.Unknown
8
+ var At = h.Union(h.String, h.Number), jt = (e) => typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1 && typeof e.$bytes == "string", _ = h.transform(h.Unknown, h.Unknown, {
9
+ strict: !0,
10
+ decode: (e) => {
11
+ if (!jt(e)) return e;
12
+ let t = Dt.decodeBase64(e.$bytes);
13
+ return Et.isRight(t) ? t.right : e;
14
+ },
15
+ encode: (e) => e instanceof Uint8Array ? { $bytes: Dt.encodeBase64(e) } : e
16
+ }), Mt = h.Record({
17
+ key: h.String,
18
+ value: _
19
+ }).pipe(h.filter((e) => "id" in e, { message: () => "patch row must carry an id" })), Nt = h.Union(h.Struct({
20
+ op: h.Literal("add"),
21
+ path: h.String,
22
+ value: Mt
23
+ }), h.Struct({
24
+ op: h.Literal("replace"),
25
+ path: h.String,
26
+ value: Mt
27
+ }), h.Struct({
28
+ op: h.Literal("remove"),
29
+ path: h.String
30
+ }), h.Struct({
31
+ op: h.Literal("mergeCells"),
32
+ path: h.String,
33
+ value: h.Record({
34
+ key: h.String,
35
+ value: _
27
36
  })
28
- })), Dt = m.Struct({
29
- ops: m.Array(Et),
30
- order: m.Array(wt)
31
- }), g = (e) => `/${String(e).replace(/~/g, "~0").replace(/\//g, "~1")}`, Ot = (e) => (e.startsWith("/") ? e.slice(1) : e).replace(/~1/g, "/").replace(/~0/g, "~"), _ = (e) => {
37
+ })), Pt = h.Struct({
38
+ ops: h.Array(Nt),
39
+ order: h.Array(At)
40
+ }), v = (e) => `/${String(e).replace(/~/g, "~0").replace(/\//g, "~1")}`, y = (e) => (e.startsWith("/") ? e.slice(1) : e).replace(/~1/g, "/").replace(/~0/g, "~"), b = (e) => {
32
41
  let t = Object.keys(e).sort(), n = {};
33
42
  for (let r of t) n[r] = e[r];
34
43
  return JSON.stringify(n);
35
- }, v = (e, t) => _(e) === _(t), kt = (e, t) => {
44
+ }, Ft = (e, t) => b(e) === b(t), It = (e, t) => {
36
45
  if (e instanceof Uint8Array && t instanceof Uint8Array) {
37
46
  if (e.length !== t.length) return !1;
38
47
  for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
39
48
  return !0;
40
49
  }
41
- return _({
50
+ return b({
42
51
  id: 0,
43
52
  v: e
44
- }) === _({
53
+ }) === b({
45
54
  id: 0,
46
55
  v: t
47
56
  });
48
- }, At = (e, t, n = {}) => {
57
+ }, Lt = (e, t, n = {}) => {
49
58
  let r = /* @__PURE__ */ new Map();
50
59
  for (let t of e) r.set(t.id, t);
51
60
  let i = [], a = [], o = /* @__PURE__ */ new Set(), s = n.crdt, c = (e, t) => {
52
61
  if (s === void 0 || s.columns.size === 0) return;
53
62
  let n = {}, r = !1;
54
63
  for (let i of s.columns) {
55
- if (!(i in t) || kt(e[i], t[i])) continue;
64
+ if (!(i in t) || It(e[i], t[i])) continue;
56
65
  let a = s.incremental(i, e[i], t[i]);
57
66
  if (a === void 0) return;
58
67
  n[i] = a, r = !0;
@@ -70,120 +79,125 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
70
79
  let t = r.get(e.id);
71
80
  if (t === void 0) i.push({
72
81
  op: "add",
73
- path: g(e.id),
82
+ path: v(e.id),
74
83
  value: e
75
84
  });
76
- else if (!v(t, e)) {
85
+ else if (!Ft(t, e)) {
77
86
  let n = c(t, e);
78
87
  n === void 0 ? i.push({
79
88
  op: "replace",
80
- path: g(e.id),
89
+ path: v(e.id),
81
90
  value: e
82
- }) : (v(Object.fromEntries(Object.entries(t).filter(([e]) => !s.columns.has(e))), n.scalars) || i.push({
91
+ }) : (Ft(Object.fromEntries(Object.entries(t).filter(([e]) => !s.columns.has(e))), n.scalars) || i.push({
83
92
  op: "replace",
84
- path: g(e.id),
93
+ path: v(e.id),
85
94
  value: n.scalars
86
95
  }), i.push({
87
96
  op: "mergeCells",
88
- path: g(e.id),
97
+ path: v(e.id),
89
98
  value: n.merges
90
99
  }));
91
100
  }
92
101
  }
93
102
  for (let t of e) o.has(t.id) || i.push({
94
103
  op: "remove",
95
- path: g(t.id)
104
+ path: v(t.id)
96
105
  });
97
106
  return {
98
107
  ops: i,
99
108
  order: a
100
109
  };
101
- }, jt = (e) => e.every((e) => {
110
+ }, Rt = (e) => e.every((e) => {
102
111
  let t = e.id;
103
112
  return typeof t == "string" || typeof t == "number";
104
- }), Mt = (e, t, n = {}) => {
113
+ }), zt = (e, t, n = {}) => {
105
114
  let r = /* @__PURE__ */ new Map();
106
115
  for (let t of e) r.set(t.id, t);
116
+ let i = /* @__PURE__ */ new Map();
117
+ for (let e of t.ops) e.op === "mergeCells" && i.set(y(e.path), Object.keys(e.value));
107
118
  for (let e of t.ops) {
108
119
  if (e.op === "mergeCells") {
109
- let t = Ot(e.path), i = r.get(t) ?? r.get(Number(t)), a = r.has(t) ? t : Number(t);
120
+ let t = y(e.path), i = r.get(t) ?? r.get(Number(t)), a = r.has(t) ? t : Number(t);
110
121
  if (i === void 0) continue;
111
122
  let o = { ...i };
112
123
  for (let [t, r] of Object.entries(e.value)) o[t] = n.mergeCell === void 0 ? r : n.mergeCell(t, i[t], r);
113
124
  r.set(a, o);
114
125
  continue;
115
126
  }
116
- (e.op === "add" || e.op === "replace") && r.set(e.value.id, e.value);
127
+ if (e.op === "add" && r.set(e.value.id, e.value), e.op === "replace") {
128
+ let t = r.get(e.value.id), n = (t === void 0 ? [] : i.get(String(e.value.id)) ?? []).filter((n) => !(n in e.value) && n in t);
129
+ r.set(e.value.id, n.length === 0 ? e.value : {
130
+ ...e.value,
131
+ ...Object.fromEntries(n.map((e) => [e, t[e]]))
132
+ });
133
+ }
117
134
  }
118
- let i = [];
135
+ let a = [];
119
136
  for (let e of t.order) {
120
137
  let t = r.get(e);
121
- t !== void 0 && i.push(t);
138
+ t !== void 0 && a.push(t);
122
139
  }
123
- return i;
124
- }, Nt = (e) => m.Union(m.Struct({
125
- _tag: m.Literal("snapshot"),
126
- revision: m.Number,
140
+ return a;
141
+ }, Bt = (e) => h.Union(h.Struct({
142
+ _tag: h.Literal("snapshot"),
143
+ revision: h.Number,
127
144
  data: e,
128
- computed: m.optional(m.Boolean),
129
- reconciles: m.optional(m.String)
130
- }), m.Struct({
131
- _tag: m.Literal("delta"),
132
- revision: m.Number,
133
- emittedAt: m.Number,
134
- patch: Dt
135
- }), m.Struct({
136
- _tag: m.Literal("error"),
137
- error: m.Unknown,
138
- revision: m.optional(m.Number)
139
- })), Pt = (e, t, n) => {
145
+ computed: h.optional(h.Boolean),
146
+ reconciles: h.optional(h.String)
147
+ }), h.Struct({
148
+ _tag: h.Literal("delta"),
149
+ revision: h.Number,
150
+ emittedAt: h.Number,
151
+ patch: Pt
152
+ }), h.Struct({
153
+ _tag: h.Literal("error"),
154
+ error: h.Unknown,
155
+ revision: h.optional(h.Number)
156
+ })), Vt = (e, t, n) => {
140
157
  if (!t || typeof t != "object" || !("_tag" in t)) return t;
141
158
  let r = t;
142
159
  switch (r._tag) {
143
160
  case "snapshot": return r.data;
144
- case "error": {
145
- let t = r.error;
146
- throw Object.assign(Error(`${n} ${e}: ${t?._tag ?? "error"}${t?.message ? ` — ${t.message}` : ""}`, { cause: r.error }), { voltroError: r.error });
147
- }
161
+ case "error": throw r.error === void 0 ? Error(`${n} ${e}: the rpc refused without an error value`) : r.error;
148
162
  case "delta": throw Error(`${n} ${e}: received a 'delta' as the first event, which should be impossible — a subscription always opens with a snapshot. This is a framework bug.`);
149
163
  default: return t;
150
164
  }
151
- }, Ft = (e, t) => {
165
+ }, Ht = (e, t) => {
152
166
  let n = `${e ?? "this procedure"} input`;
153
167
  return t === !0 ? `${n} (guarded — the guard did NOT run: the payload failed to decode first, so this says nothing about access)` : n;
154
- }, It = (e) => {
168
+ }, Ut = (e) => {
155
169
  let t = e.ast;
156
170
  return t._tag === "TypeLiteral" && (t.propertySignatures?.length ?? 0) === 0 && (t.indexSignatures?.length ?? 0) === 0;
157
- }, y = (e, t, n) => {
158
- let r = Ft(t, n), i = e.annotations({
171
+ }, x = (e, t, n) => {
172
+ let r = Ht(t, n), i = e.annotations({
159
173
  parseOptions: { onExcessProperty: "error" },
160
174
  parseIssueTitle: () => r
161
175
  });
162
- return It(e) ? m.filter((e) => typeof e == "object" && e && Object.keys(e).length > 0 ? `this procedure declares no input; received: ${Object.keys(e).join(", ")}` : void 0)(i).annotations({ identifier: r }) : i;
163
- }, Lt = class extends m.TaggedError()("BusinessRuleViolation", {
164
- rule: m.String,
165
- params: m.optional(m.Record({
166
- key: m.String,
167
- value: m.Unknown
176
+ return Ut(e) ? h.filter((e) => typeof e == "object" && e && Object.keys(e).length > 0 ? `this procedure declares no input; received: ${Object.keys(e).join(", ")}` : void 0)(i).annotations({ identifier: r }) : i;
177
+ }, S = class extends h.TaggedError()("BusinessRuleViolation", {
178
+ rule: h.String,
179
+ params: h.optional(h.Record({
180
+ key: h.String,
181
+ value: h.Unknown
168
182
  })),
169
- field: m.optional(m.String),
170
- message: m.optional(m.String),
171
- severity: m.Literal("error", "warning")
172
- }) {}, Rt = m.Struct({
173
- field: m.String,
174
- message: m.String,
175
- params: m.optional(m.Record({
176
- key: m.String,
177
- value: m.Unknown
183
+ field: h.optional(h.String),
184
+ message: h.optional(h.String),
185
+ severity: h.Literal("error", "warning")
186
+ }) {}, Wt = h.Struct({
187
+ field: h.String,
188
+ message: h.String,
189
+ params: h.optional(h.Record({
190
+ key: h.String,
191
+ value: h.Unknown
178
192
  }))
179
- }), zt = class extends m.TaggedError()("ValidationError", {
180
- field: m.String,
181
- message: m.String,
182
- params: m.optional(m.Record({
183
- key: m.String,
184
- value: m.Unknown
193
+ }), C = class extends h.TaggedError()("ValidationError", {
194
+ field: h.String,
195
+ message: h.String,
196
+ params: h.optional(h.Record({
197
+ key: h.String,
198
+ value: h.Unknown
185
199
  }))
186
- }) {}, Bt = class extends m.TaggedError()("ValidationErrors", { issues: m.Array(Rt).pipe(m.minItems(1)) }) {}, Vt = (e) => {
200
+ }) {}, w = class extends h.TaggedError()("ValidationErrors", { issues: h.Array(Wt).pipe(h.minItems(1)) }) {}, Gt = (e) => {
187
201
  if (typeof e != "object" || !e) return [];
188
202
  let t = e._tag;
189
203
  if (t === "ValidationError") {
@@ -209,69 +223,69 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
209
223
  }];
210
224
  }
211
225
  return [];
212
- }, Ht = class extends m.TaggedError()("ApprovalRequired", {
213
- approvalId: m.String,
214
- procedure: m.String,
215
- expiresAt: m.String,
216
- requiredScopes: m.Array(m.String),
217
- reason: m.NullOr(m.String),
218
- created: m.Boolean
219
- }) {}, Ut = class extends m.TaggedError()("ApprovalNotFound", { approvalId: m.String }) {}, Wt = class extends m.TaggedError()("ApprovalSelfApproval", {
220
- approvalId: m.String,
221
- subjectId: m.NullOr(m.String)
222
- }) {}, Gt = class extends m.TaggedError()("ApprovalRejected", {
223
- approvalId: m.String,
224
- decidedBy: m.NullOr(m.String),
225
- note: m.NullOr(m.String)
226
- }) {}, b = class extends m.TaggedError()("ApprovalExpired", {
227
- approvalId: m.String,
228
- expiredAt: m.String
229
- }) {}, Kt = class extends m.TaggedError()("ApprovalNotPending", {
230
- approvalId: m.String,
231
- status: m.String
232
- }) {}, qt = class extends m.TaggedError()("ApprovalForbidden", {
233
- approvalId: m.String,
234
- required: m.NullOr(m.String),
235
- message: m.String
236
- }) {}, x = class extends m.TaggedError()("ApprovalUnavailable", {
237
- procedure: m.String,
238
- message: m.String
239
- }) {}, Jt = m.Union(Ht, Gt, b, x), Yt = m.Union(Ut, Wt, b, Kt, qt, x), Xt = m.Struct({
240
- id: m.String,
241
- procedure: m.String,
242
- kind: m.Literal("mutation", "action"),
243
- requestedBy: m.NullOr(m.String),
244
- status: m.Literal("pending", "approved", "rejected", "expired", "consumed"),
245
- reason: m.NullOr(m.String),
246
- requiredScopes: m.Array(m.String),
247
- requestedAt: m.String,
248
- expiresAt: m.String,
249
- decidedBy: m.NullOr(m.String),
250
- decidedAt: m.NullOr(m.String),
251
- note: m.NullOr(m.String),
252
- relation: m.Literal("to-decide", "requested")
253
- }), S = "channel:", Zt = Symbol.for("@voltro/protocol/reactivityChannels"), Qt = globalThis, C = Qt[Zt] ?? (Qt[Zt] = /* @__PURE__ */ new Map()), $t = /^[a-z][a-z0-9-]*(\.[a-z0-9-]+)*$/, en = (e) => {
254
- if (!$t.test(e)) throw Error(`reactivityChannel('${e}'): invalid channel name.\n Use lowercase kebab segments separated by dots — \`presence\`, \`job-queue\`,
226
+ }, Kt = class extends h.TaggedError()("ApprovalRequired", {
227
+ approvalId: h.String,
228
+ procedure: h.String,
229
+ expiresAt: h.String,
230
+ requiredScopes: h.Array(h.String),
231
+ reason: h.NullOr(h.String),
232
+ created: h.Boolean
233
+ }) {}, qt = class extends h.TaggedError()("ApprovalNotFound", { approvalId: h.String }) {}, Jt = class extends h.TaggedError()("ApprovalSelfApproval", {
234
+ approvalId: h.String,
235
+ subjectId: h.NullOr(h.String)
236
+ }) {}, Yt = class extends h.TaggedError()("ApprovalRejected", {
237
+ approvalId: h.String,
238
+ decidedBy: h.NullOr(h.String),
239
+ note: h.NullOr(h.String)
240
+ }) {}, T = class extends h.TaggedError()("ApprovalExpired", {
241
+ approvalId: h.String,
242
+ expiredAt: h.String
243
+ }) {}, Xt = class extends h.TaggedError()("ApprovalNotPending", {
244
+ approvalId: h.String,
245
+ status: h.String
246
+ }) {}, Zt = class extends h.TaggedError()("ApprovalForbidden", {
247
+ approvalId: h.String,
248
+ required: h.NullOr(h.String),
249
+ message: h.String
250
+ }) {}, E = class extends h.TaggedError()("ApprovalUnavailable", {
251
+ procedure: h.String,
252
+ message: h.String
253
+ }) {}, Qt = h.Union(Kt, Yt, T, E), $t = h.Union(qt, Jt, T, Xt, Zt, E), en = h.Struct({
254
+ id: h.String,
255
+ procedure: h.String,
256
+ kind: h.Literal("mutation", "action"),
257
+ requestedBy: h.NullOr(h.String),
258
+ status: h.Literal("pending", "approved", "rejected", "expired", "consumed"),
259
+ reason: h.NullOr(h.String),
260
+ requiredScopes: h.Array(h.String),
261
+ requestedAt: h.String,
262
+ expiresAt: h.String,
263
+ decidedBy: h.NullOr(h.String),
264
+ decidedAt: h.NullOr(h.String),
265
+ note: h.NullOr(h.String),
266
+ relation: h.Literal("to-decide", "requested")
267
+ }), D = "channel:", tn = Symbol.for("@voltro/protocol/reactivityChannels"), nn = globalThis, O = nn[tn] ?? (nn[tn] = /* @__PURE__ */ new Map()), rn = /^[a-z][a-z0-9-]*(\.[a-z0-9-]+)*$/, an = (e) => {
268
+ if (!rn.test(e)) throw Error(`reactivityChannel('${e}'): invalid channel name.\n Use lowercase kebab segments separated by dots — \`presence\`, \`job-queue\`,
255
269
  \`billing.usage\`. A \`:\` is refused because it is the namespace separator in
256
- the routing key (\`${S}<name>\`), and an uppercase letter is\n refused because a key that differs only by case reads as one channel and
270
+ the routing key (\`${D}<name>\`), and an uppercase letter is\n refused because a key that differs only by case reads as one channel and
257
271
  routes as two.`);
258
- let t = C.get(e);
272
+ let t = O.get(e);
259
273
  if (t !== void 0) return t;
260
- let n = `${S}${e}`, r = Object.freeze({
274
+ let n = `${D}${e}`, r = Object.freeze({
261
275
  kind: "reactivity-channel",
262
276
  name: e,
263
277
  key: n,
264
278
  toString: () => n
265
279
  });
266
- return C.set(e, r), r;
267
- }, tn = (e) => typeof e == "object" && !!e && e.kind === "reactivity-channel", nn = (e) => e.startsWith(S), rn = () => new Set([...C.values()].map((e) => e.key)), w = (e) => tn(e) ? e.key : e, an = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map(w) : [w(e)], on = (e) => e === void 0 ? void 0 : Array.isArray(e) ? e.map(w) : w(e), sn = (e) => {
268
- let t = rn(), n = [];
269
- for (let r of e) for (let e of an(r.source)) nn(e) && !t.has(e) && n.push({
280
+ return O.set(e, r), r;
281
+ }, on = (e) => typeof e == "object" && !!e && e.kind === "reactivity-channel", sn = (e) => e.startsWith(D), cn = () => new Set([...O.values()].map((e) => e.key)), k = (e) => on(e) ? e.key : e, ln = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map(k) : [k(e)], un = (e) => e === void 0 ? void 0 : Array.isArray(e) ? e.map(k) : k(e), dn = (e) => {
282
+ let t = cn(), n = [];
283
+ for (let r of e) for (let e of ln(r.source)) sn(e) && !t.has(e) && n.push({
270
284
  procedure: r.name,
271
285
  key: e
272
286
  });
273
287
  return n;
274
- }, cn = (e, t) => {
288
+ }, fn = (e, t) => {
275
289
  let n = e?.injectExternalChange;
276
290
  return n !== void 0 && (n.call(e, {
277
291
  table: t.key,
@@ -280,8 +294,8 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
280
294
  old: {},
281
295
  origin: "inline"
282
296
  }), !0);
283
- }, T = (e) => e.internal !== !0, ln = (e) => e.service === void 0 ? "client" : "service", un = (e) => T(e) && e.service === void 0, dn = (e) => T(e) && e.service !== void 0, E = /^[a-z][a-z0-9-]{0,55}$/i, D = (e) => {
284
- if (pn(e), fn(e), e.idempotencyScope !== void 0 && e.idempotencyScope !== "subject" && e.idempotencyScope !== "connection") throw Error(`${e.name}: idempotencyScope must be 'subject' or 'connection'`);
297
+ }, A = (e) => e.internal !== !0, pn = (e) => e.service === void 0 ? "client" : "service", mn = (e) => A(e) && e.service === void 0, hn = (e) => A(e) && e.service !== void 0, gn = /^[a-z][a-z0-9-]{0,55}$/i, j = (e) => {
298
+ if (vn(e), _n(e), e.idempotencyScope !== void 0 && e.idempotencyScope !== "subject" && e.idempotencyScope !== "connection") throw Error(`${e.name}: idempotencyScope must be 'subject' or 'connection'`);
285
299
  let t = e.serialize;
286
300
  if (t !== void 0) {
287
301
  if (typeof t.key != "function") throw Error(`${e.name}: serialize.key must be a function of the input`);
@@ -305,13 +319,13 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
305
319
  let r = [e.publicApi === void 0 ? void 0 : "publicApi", e.exposeAsTool === void 0 ? void 0 : "exposeAsTool"].filter((e) => e !== void 0);
306
320
  if (r.length === 0) return e;
307
321
  throw Error(`${e.name}: \`internal: true\` cannot be combined with ${r.map((e) => `\`${e}\``).join(" or ")}. \`internal\` takes the procedure OFF the wire; those put it back ON a different one (${r.includes("publicApi") ? "a REST route" : "an agent tool"}), and that surface is projected without consulting the flag — so the procedure would be unreachable from your client and reachable from the internet. Drop \`internal: true\` if the wider surface is intended, or remove the ${r.join(" / ")} annotation if it is not.`);
308
- }, fn = (e) => {
322
+ }, _n = (e) => {
309
323
  let t = e.service;
310
324
  if (t === void 0) return;
311
325
  let n = t.callers;
312
326
  if (!Array.isArray(n) || n.length === 0) throw Error(`${e.name}: \`service.callers\` is empty, so NO app may call this procedure —\n and no browser either. Name the calling app(s), e.g. \`service: { callers: ['worker'] }\`,
313
327
  or drop \`service:\` if the procedure is meant for this app's own clients.`);
314
- let r = n.filter((e) => typeof e != "string" || !E.test(e));
328
+ let r = n.filter((e) => typeof e != "string" || !gn.test(e));
315
329
  if (r.length > 0) throw Error(`${e.name}: \`service.callers\` holds ${r.map((e) => JSON.stringify(e)).join(", ")} — a caller is an\n app name (letters, digits, dashes; starting with a letter; at most 56 characters), the same name this app
316
330
  lists in \`serviceCallers\` and the caller's credential resolves to.`);
317
331
  if (new Set(n).size !== n.length) throw Error(`${e.name}: \`service.callers\` lists the same app twice`);
@@ -325,7 +339,7 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
325
339
  ].filter((e) => e !== void 0);
326
340
  if (i.length !== 0) throw Error(`${e.name}: \`service:\` cannot be combined with ${i.join("; ")}.\n A service procedure is callable only by the listed apps of this project, over the
327
341
  socket, with their service credential. Drop the other field, or drop \`service:\`.`);
328
- }, pn = (e) => {
342
+ }, vn = (e) => {
329
343
  let t = e.requiresApproval;
330
344
  if (t !== void 0) {
331
345
  if (!Array.isArray(t.approvers) || t.approvers.length === 0) throw Error(`${e.name}: \`requiresApproval.approvers\` is empty, so NOBODY can approve this\n procedure and every call would park forever. Name the scope(s) an approver must hold
@@ -335,43 +349,43 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
335
349
  human from every other, and the second-pair-of-eyes control would enforce nothing.
336
350
  Give the procedure a \`guards:\` decision, or drop \`requiresApproval\`.`);
337
351
  }
338
- }, mn = (e) => e.action !== void 0 && e.resourceType !== void 0, hn = (e) => e.authenticated === !0, gn = (e) => e.openAccess !== void 0 || e.guards !== void 0 && e.guards.length > 0, O = (e, t, n, r) => {
339
- if (r !== void 0) {
352
+ }, yn = (e) => e.action !== void 0 && e.resourceType !== void 0, bn = (e) => e.authenticated === !0, xn = (e) => e.openAccess !== void 0 || e.guards !== void 0 && e.guards.length > 0, M = (e, t, n, i) => {
353
+ if (i !== void 0) {
340
354
  if (n !== void 0 || t !== void 0 && t.length > 0) throw Error(`${e}: \`service:\` is an access decision of its own — only the listed apps may\n call this procedure — so it cannot sit beside \`guards:\` or \`openAccess:\`. A service
341
355
  holds no scopes, and no user may call a service procedure. Keep exactly one.`);
342
- return Array.isArray(r.callers) ? [d(r.callers)] : void 0;
356
+ return Array.isArray(i.callers) ? [a(i.callers)] : void 0;
343
357
  }
344
358
  if (n === void 0) return t;
345
359
  if (n.trim() === "") throw Error(`${e}: \`openAccess\` needs a REASON, not an empty string. It is the sentence a\n reviewer reads to decide whether this procedure should really be callable
346
360
  without an authorization check — e.g. \`openAccess: 'public pricing, no caller data'\`.`);
347
361
  if (t !== void 0 && t.length > 0) throw Error(`${e}: \`openAccess\` and \`guards\` are two different access decisions, so\n declaring both says the procedure is protected AND open. Keep the guards if a
348
362
  caller must hold a scope; drop them if anyone may call it.`);
349
- return [f(n.trim())];
350
- }, k = (e) => D({
363
+ return [r(n.trim())];
364
+ }, N = (e) => j({
351
365
  kind: "query",
352
366
  name: e.name,
353
367
  input: e.input,
354
368
  output: e.output,
355
- error: e.error ?? m.Never,
356
- source: on(e.source),
369
+ error: e.error ?? h.Never,
370
+ source: un(e.source),
357
371
  cache: e.cache,
358
- guards: O(e.name, e.guards, e.openAccess, e.service),
372
+ guards: M(e.name, e.guards, e.openAccess, e.service),
359
373
  openAccess: e.openAccess,
360
374
  service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
361
375
  publicApi: e.publicApi,
362
376
  exposeAsTool: e.exposeAsTool,
363
377
  internal: e.internal,
364
378
  overridesPlugin: e.overridesPlugin
365
- }), A = (e) => D({
379
+ }), P = (e) => j({
366
380
  kind: "mutation",
367
381
  name: e.name,
368
382
  input: e.input,
369
383
  output: e.output,
370
- error: e.error ?? m.Never,
384
+ error: e.error ?? h.Never,
371
385
  ...e.idempotencyScope === void 0 ? {} : { idempotencyScope: e.idempotencyScope },
372
386
  ...e.serialize === void 0 ? {} : { serialize: e.serialize },
373
387
  target: e.target,
374
- guards: O(e.name, e.guards, e.openAccess, e.service),
388
+ guards: M(e.name, e.guards, e.openAccess, e.service),
375
389
  openAccess: e.openAccess,
376
390
  service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
377
391
  publicApi: e.publicApi,
@@ -379,13 +393,13 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
379
393
  requiresApproval: e.requiresApproval,
380
394
  internal: e.internal,
381
395
  overridesPlugin: e.overridesPlugin
382
- }), j = (e) => D({
396
+ }), F = (e) => j({
383
397
  kind: "action",
384
398
  name: e.name,
385
399
  input: e.input,
386
400
  output: e.output,
387
- error: e.error ?? m.Never,
388
- guards: O(e.name, e.guards, e.openAccess, e.service),
401
+ error: e.error ?? h.Never,
402
+ guards: M(e.name, e.guards, e.openAccess, e.service),
389
403
  openAccess: e.openAccess,
390
404
  service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
391
405
  source: e.source,
@@ -395,54 +409,85 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
395
409
  requiresApproval: e.requiresApproval,
396
410
  internal: e.internal,
397
411
  overridesPlugin: e.overridesPlugin
398
- }), _n = (e) => D({
412
+ }), Sn = (e) => j({
399
413
  kind: "stream",
400
414
  name: e.name,
401
415
  input: e.input,
402
416
  element: e.element,
403
- error: e.error ?? m.Never,
417
+ error: e.error ?? h.Never,
404
418
  internal: e.internal,
405
419
  overridesPlugin: e.overridesPlugin,
406
- guards: O(e.name, e.guards, e.openAccess),
420
+ guards: M(e.name, e.guards, e.openAccess),
407
421
  openAccess: e.openAccess
408
- }), M = (e, t) => t && t.length > 0 ? m.Union(e, ...t) : e, N = (e) => e !== void 0 && e.some((e) => !l(e)), vn = (e) => m.Union(e, u, p), yn = (e) => m.Union(e, Lt), bn = (e) => m.Union(e, zt, Bt), xn = (e, t) => t === void 0 ? e : m.Union(e, Jt), P = (e, t) => {
409
- let n = vn(e.error);
422
+ }), Cn = (e, t) => t && t.length > 0 ? h.Union(e, ...t) : e, I = (e) => e !== void 0 && e.some((e) => !p(e)), wn = (e) => h.Union(e, f, l), Tn = (e) => h.Union(e, S), En = (e) => h.Union(e, C, w), Dn = (e, t) => t === void 0 ? e : h.Union(e, Qt), On = (e, t) => u(t) ? h.Union(e, d) : e, L = (e, t, n) => Cn(kn(e, t), n), kn = (e, t) => {
423
+ let n = On(wn(e.error), e.guards);
410
424
  if (t === "stream" || t === "query") return n;
411
- let r = t === "mutation" ? m.Union(yn(n), Xe, Ct) : n;
412
- return xn(bn(t === "mutation" && e.idempotencyScope === "connection" ? m.Union(r, yt) : r), e.requiresApproval);
413
- }, Sn = (e, t) => M(vn(e.errorSchema), t), Cn = (e, t) => ({
425
+ let r = t === "mutation" ? h.Union(Tn(n), m, kt) : n;
426
+ return Dn(En(t === "mutation" && e.idempotencyScope === "connection" ? h.Union(r, Ze) : r), e.requiresApproval);
427
+ }, An = {
428
+ query: [f, l],
429
+ stream: [f, l],
430
+ action: [
431
+ f,
432
+ l,
433
+ C,
434
+ w
435
+ ],
436
+ mutation: [
437
+ f,
438
+ l,
439
+ S,
440
+ m,
441
+ kt,
442
+ C,
443
+ w
444
+ ]
445
+ }, jn = (e, t) => Cn(On(wn(e.errorSchema), e.guards), t), Mn = (e, t) => ({
414
446
  ...e,
415
447
  name: t
416
- }), wn = (e, t) => h.make(e.name, {
417
- payload: y(e.input, e.name, N(e.guards)),
418
- success: Nt(e.output),
419
- error: M(P(e, "query"), t),
448
+ }), Nn = (e, t) => g.make(e.name, {
449
+ payload: x(e.input, e.name, I(e.guards)),
450
+ success: Bt(e.output),
451
+ error: L(e, "query", t),
420
452
  stream: !0
421
- }), Tn = (e, t) => h.make(e.name, {
422
- payload: y(e.input, e.name, N(e.guards)),
453
+ }), Pn = (e, t) => g.make(e.name, {
454
+ payload: x(e.input, e.name, I(e.guards)),
423
455
  success: e.output,
424
- error: M(P(e, "mutation"), t)
425
- }), En = (e, t) => h.make(e.name, {
426
- payload: y(e.input, e.name, N(e.guards)),
456
+ error: L(e, "mutation", t)
457
+ }), Fn = (e, t) => g.make(e.name, {
458
+ payload: x(e.input, e.name, I(e.guards)),
427
459
  success: e.output,
428
- error: M(P(e, "action"), t)
429
- }), Dn = (e, t) => h.make(e.name, {
430
- payload: y(e.input, e.name, N(e.guards)),
460
+ error: L(e, "action", t)
461
+ }), In = (e, t) => g.make(e.name, {
462
+ payload: x(e.input, e.name, I(e.guards)),
431
463
  success: e.element,
432
- error: M(e.error, t),
464
+ error: L(e, "stream", t),
433
465
  stream: !0
434
- }), On = (e) => {
466
+ }), R = (e) => {
435
467
  if (typeof e != "object" || !e) return;
436
468
  let t = e._tag;
437
469
  return typeof t == "string" ? t : void 0;
438
- }, kn = (e) => {
470
+ }, Ln = (e) => {
471
+ if (typeof e == "string") return e;
472
+ if (typeof e == "object" && e) {
473
+ let t = e.message;
474
+ if (typeof t == "string" && t !== "") return t;
475
+ let n = R(e);
476
+ if (n !== void 0) return n;
477
+ }
478
+ return String(e);
479
+ }, Rn = (e) => {
480
+ if (e instanceof Error) return e;
481
+ let t = Error(Ln(e), { cause: e });
482
+ return t.name = R(e) ?? "NonErrorThrown", t;
483
+ }, zn = (e) => {
439
484
  switch (e.kind) {
440
- case "query": return wn(e);
441
- case "mutation": return Tn(e);
442
- case "action": return En(e);
443
- case "stream": return Dn(e);
485
+ case "query": return Nn(e);
486
+ case "mutation": return Pn(e);
487
+ case "action": return Fn(e);
488
+ case "stream": return In(e);
444
489
  }
445
- }, An = (e) => {
490
+ }, Bn = (e) => {
446
491
  let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r };
447
492
  if (e.kind === "query") return {
448
493
  kind: "query",
@@ -488,7 +533,7 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
488
533
  ..."relations" in e && e.relations !== void 0 ? { relations: e.relations } : {}
489
534
  }))
490
535
  };
491
- }, jn = 7500, Mn = (e) => typeof e == "object" && !!e && e.kind === "event", Nn = (e) => {
536
+ }, Vn = 7500, Hn = (e) => typeof e == "object" && !!e && e.kind === "event", Un = (e) => {
492
537
  if (e.name.length === 0) throw Error("defineEvent: `name` must not be empty");
493
538
  if (/\s/.test(e.name)) throw Error(`defineEvent("${e.name}"): \`name\` must not contain whitespace.\n The name is used as a broker subject segment. NATS refuses a subject with
494
539
  whitespace and delivers nothing — silently, and only on that broker, so an
@@ -517,68 +562,68 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
517
562
  name: e.name,
518
563
  key: e.key,
519
564
  payload: e.payload,
520
- guards: e.openAccess === void 0 ? e.guards : [f(e.openAccess.trim())],
565
+ guards: e.openAccess === void 0 ? e.guards : [r(e.openAccess.trim())],
521
566
  openAccess: e.openAccess,
522
567
  rewind: e.rewind,
523
568
  webhook: e.webhook,
524
569
  delivery: e.delivery
525
570
  };
526
- }, Pn = (e) => m.Struct({
527
- _tag: m.Literal("event"),
528
- origin: m.String,
529
- n: m.Number,
530
- emittedAt: m.Number,
571
+ }, Wn = (e) => h.Struct({
572
+ _tag: h.Literal("event"),
573
+ origin: h.String,
574
+ n: h.Number,
575
+ emittedAt: h.Number,
531
576
  payload: e
532
- }), Fn = m.Struct({
533
- _tag: m.Literal("gap"),
534
- missed: m.Number,
535
- reason: m.Literal("buffer", "resume")
536
- }), In = m.Struct({ _tag: m.Literal("attached") }), Ln = (e) => m.Union(In, Pn(e), Fn), Rn = m.Struct({
537
- origin: m.String,
538
- n: m.Number
539
- }), zn = (e) => m.Struct({
577
+ }), Gn = h.Struct({
578
+ _tag: h.Literal("gap"),
579
+ missed: h.Number,
580
+ reason: h.Literal("buffer", "resume")
581
+ }), Kn = h.Struct({ _tag: h.Literal("attached") }), qn = (e) => h.Union(Kn, Wn(e), Gn), Jn = h.Struct({
582
+ origin: h.String,
583
+ n: h.Number
584
+ }), Yn = (e) => h.Struct({
540
585
  key: e,
541
- resume: m.optional(m.Array(Rn))
542
- }), Bn = (e, t) => {
543
- let n = e.guards !== void 0 && e.guards.some((e) => !l(e)) ? m.Union(u, p) : p, r = t && t.length > 0 ? m.Union(n, ...t) : n;
544
- return h.make(e.name, {
545
- payload: y(zn(e.key), e.name, N(e.guards)),
546
- success: Ln(e.payload),
547
- error: r,
586
+ resume: h.optional(h.Array(Jn))
587
+ }), Xn = (e, t) => {
588
+ let n = e.guards !== void 0 && e.guards.some((e) => !p(e)) ? h.Union(f, l) : l, r = u(e.guards) ? h.Union(n, d) : n, i = t && t.length > 0 ? h.Union(r, ...t) : r;
589
+ return g.make(e.name, {
590
+ payload: x(Yn(e.key), e.name, I(e.guards)),
591
+ success: qn(e.payload),
592
+ error: i,
548
593
  stream: !0
549
594
  });
550
- }, Vn = class extends m.TaggedError()("EventPayloadInvalid", {
551
- event: m.String,
552
- message: m.String
553
- }) {}, Hn = class extends m.TaggedError()("EventKeyInvalid", {
554
- event: m.String,
555
- message: m.String
556
- }) {}, Un = class extends m.TaggedError()("EventPayloadTooLarge", {
557
- event: m.String,
558
- bytes: m.Number,
559
- limit: m.Number
560
- }) {}, Wn = (e) => {
595
+ }, Zn = class extends h.TaggedError()("EventPayloadInvalid", {
596
+ event: h.String,
597
+ message: h.String
598
+ }) {}, Qn = class extends h.TaggedError()("EventKeyInvalid", {
599
+ event: h.String,
600
+ message: h.String
601
+ }) {}, $n = class extends h.TaggedError()("EventPayloadTooLarge", {
602
+ event: h.String,
603
+ bytes: h.Number,
604
+ limit: h.Number
605
+ }) {}, er = (e) => {
561
606
  if (typeof e != "object" || !e) return JSON.stringify(e) ?? "null";
562
607
  let t = Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t));
563
608
  return JSON.stringify(t);
564
- }, Gn = "\0", Kn = (e, t, n) => [
609
+ }, tr = "\0", nr = (e, t, n) => [
565
610
  e ?? "~",
566
611
  t,
567
- Wn(n)
568
- ].join("\0"), qn = (e) => {
612
+ er(n)
613
+ ].join("\0"), rr = (e) => {
569
614
  let [t = "~", n = "", r = ""] = e.split("\0");
570
615
  return {
571
616
  tenantId: t === "~" ? null : t,
572
617
  event: n,
573
618
  key: r
574
619
  };
575
- }, Jn = (e) => e.split("\0").join(" · "), F = Symbol.for("@voltro/protocol/workflow-access"), Yn = {
620
+ }, ir = (e) => e.split("\0").join(" · "), z = Symbol.for("@voltro/protocol/workflow-access"), ar = {
576
621
  guards: void 0,
577
622
  openAccess: void 0,
578
623
  internal: !1,
579
624
  controls: void 0,
580
625
  controlsOpenAccess: void 0
581
- }, Xn = (e, t) => {
626
+ }, or = (e, t) => {
582
627
  let n = t.guards;
583
628
  if (n !== void 0 && n.length === 0) throw Error(`workflow("${e}"): \`guards: []\` is empty, so it enforces nothing —\n but it reads at the call site as if the start were protected. Omit the field
584
629
  and decide with \`openAccess\` or \`internal\`, or list the scopes that may start it.`);
@@ -593,34 +638,34 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
593
638
  \`openAccess\` (an internal workflow needs no wire decision), or drop
594
639
  \`internal: true\` if the workflow really is meant to be startable by clients.`);
595
640
  }
596
- let r = t.controls?.guards, i = t.controls?.openAccess;
597
- if (r !== void 0 && r.length === 0) throw Error(`workflow("${e}"): \`controls: { guards: [] }\` is empty, so it enforces nothing —\n but it reads at the call site as if driving this run were protected. Omit
641
+ let i = t.controls?.guards, a = t.controls?.openAccess;
642
+ if (i !== void 0 && i.length === 0) throw Error(`workflow("${e}"): \`controls: { guards: [] }\` is empty, so it enforces nothing —\n but it reads at the call site as if driving this run were protected. Omit
598
643
  \`controls\` (wire control is then refused for everyone but \`admin:full\`), or
599
644
  list the scopes a caller needs to cancel or signal a run.`);
600
- if (i !== void 0) {
601
- if (i.trim() === "") throw Error(`workflow("${e}"): \`controls: { openAccess }\` needs a REASON, not an empty string.\n It is the sentence a reviewer reads to decide whether anyone who can see this
645
+ if (a !== void 0) {
646
+ if (a.trim() === "") throw Error(`workflow("${e}"): \`controls: { openAccess }\` needs a REASON, not an empty string.\n It is the sentence a reviewer reads to decide whether anyone who can see this
602
647
  run should be able to cancel or signal it — e.g. \`controls: { openAccess:
603
648
  'the run belongs to the caller who started it; cancelling it affects nobody else' }\`.`);
604
- if (r !== void 0 && r.length > 0) throw Error(`workflow("${e}"): \`controls\` takes \`guards\` OR \`openAccess\`, not both.\n Two answers to one question; keep the guards if a caller needs a scope.`);
649
+ if (i !== void 0 && i.length > 0) throw Error(`workflow("${e}"): \`controls\` takes \`guards\` OR \`openAccess\`, not both.\n Two answers to one question; keep the guards if a caller needs a scope.`);
605
650
  }
606
651
  return {
607
- guards: t.openAccess === void 0 ? t.guards : [f(t.openAccess.trim())],
652
+ guards: t.openAccess === void 0 ? t.guards : [r(t.openAccess.trim())],
608
653
  openAccess: t.openAccess?.trim(),
609
654
  internal: t.internal === !0,
610
- controls: i === void 0 ? r : [f(i.trim())],
611
- controlsOpenAccess: i?.trim()
655
+ controls: a === void 0 ? i : [r(a.trim())],
656
+ controlsOpenAccess: a?.trim()
612
657
  };
613
- }, Zn = (e, t) => {
614
- Object.defineProperty(e, F, {
658
+ }, sr = (e, t) => {
659
+ Object.defineProperty(e, z, {
615
660
  value: t,
616
661
  enumerable: !1
617
662
  });
618
- }, I = (e) => {
619
- if (typeof e != "object" || !e) return Yn;
620
- let t = e[F];
621
- return t === void 0 ? Yn : t;
622
- }, Qn = (e) => {
623
- let t = I(e);
663
+ }, B = (e) => {
664
+ if (typeof e != "object" || !e) return ar;
665
+ let t = e[z];
666
+ return t === void 0 ? ar : t;
667
+ }, cr = (e) => {
668
+ let t = B(e);
624
669
  return {
625
670
  name: e.name,
626
671
  internal: t.internal,
@@ -628,25 +673,25 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
628
673
  openAccess: t.openAccess,
629
674
  controls: t.controls
630
675
  };
631
- }, $n = class extends m.TaggedError()("ApiUnavailable", {
632
- api: m.String,
633
- tag: m.String,
634
- reason: m.Literal("timeout", "transport", "closed"),
635
- message: m.String
636
- }) {}, er = (e) => typeof e == "object" && !!e && e._tag === "ApiUnavailable", tr = (e) => e, nr = (e) => e, rr = (e) => {
676
+ }, lr = class extends h.TaggedError()("ApiUnavailable", {
677
+ api: h.String,
678
+ tag: h.String,
679
+ reason: h.Literal("timeout", "transport", "closed"),
680
+ message: h.String
681
+ }) {}, ur = (e) => typeof e == "object" && !!e && e._tag === "ApiUnavailable", dr = (e) => e, fr = (e) => e, pr = (e) => {
637
682
  let t = e.alias?.trim(), n = e.instance?.trim(), r = t !== void 0 && t !== "" ? t : e.base;
638
683
  return n !== void 0 && n !== "" ? `${r}#${n}` : r;
639
- }, ir = (e) => {
684
+ }, mr = (e) => {
640
685
  if (e.length !== 0) return (t, n) => e.reduceRight((e, t) => t(e, n), t);
641
- }, ar = (e, t) => {
642
- let n = xt.GenericTag(e);
686
+ }, hr = (e, t) => {
687
+ let n = Tt.GenericTag(e);
643
688
  return {
644
689
  Tag: n,
645
- Live: St.succeed(n, t)
690
+ Live: Ot.succeed(n, t)
646
691
  };
647
- }, or = (e, t, n) => {
692
+ }, gr = (e, t, n) => {
648
693
  if (!t) return { ok: !0 };
649
- let r = n === void 0 ? null : L(n);
694
+ let r = n === void 0 ? null : V(n);
650
695
  if (!r) return {
651
696
  ok: !0,
652
697
  unverified: `plugin "${e}" requires framework ${t}, but the running framework version is ${n === void 0 ? "unknown" : `unreadable ("${n}")`} — not checked.`
@@ -654,12 +699,12 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
654
699
  let i = t.trim();
655
700
  if (i === "*" || i === "") return { ok: !0 };
656
701
  let a = i.split(/\s+/).filter((e) => e.length > 0);
657
- for (let i of a) if (!sr(i, r)) return {
702
+ for (let i of a) if (!_r(i, r)) return {
658
703
  ok: !1,
659
704
  reason: `plugin "${e}" requires framework ${t}, running ${n}`
660
705
  };
661
706
  return { ok: !0 };
662
- }, L = (e) => {
707
+ }, V = (e) => {
663
708
  let t = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9a-zA-Z.-]+))?$/.exec(e.trim());
664
709
  return t ? {
665
710
  major: Number(t[1]),
@@ -667,109 +712,109 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
667
712
  patch: Number(t[3]),
668
713
  pre: t[4] ?? ""
669
714
  } : null;
670
- }, R = (e, t) => e.major === t.major ? e.minor === t.minor ? e.patch === t.patch ? e.pre && !t.pre ? -1 : !e.pre && t.pre ? 1 : e.pre && t.pre ? e.pre < t.pre ? -1 : +(e.pre > t.pre) : 0 : e.patch - t.patch : e.minor - t.minor : e.major - t.major, sr = (e, t) => {
715
+ }, H = (e, t) => e.major === t.major ? e.minor === t.minor ? e.patch === t.patch ? e.pre && !t.pre ? -1 : !e.pre && t.pre ? 1 : e.pre && t.pre ? e.pre < t.pre ? -1 : +(e.pre > t.pre) : 0 : e.patch - t.patch : e.minor - t.minor : e.major - t.major, _r = (e, t) => {
671
716
  if (e === "*") return !0;
672
717
  if (e.startsWith("^")) {
673
- let n = L(e.slice(1));
674
- return !n || t.major !== n.major ? !1 : R(t, n) >= 0;
718
+ let n = V(e.slice(1));
719
+ return !n || t.major !== n.major ? !1 : H(t, n) >= 0;
675
720
  }
676
721
  if (e.startsWith("~")) {
677
- let n = L(e.slice(1));
678
- return !n || t.major !== n.major || t.minor !== n.minor ? !1 : R(t, n) >= 0;
722
+ let n = V(e.slice(1));
723
+ return !n || t.major !== n.major || t.minor !== n.minor ? !1 : H(t, n) >= 0;
679
724
  }
680
725
  let n = /^(>=|<=|>|<)(.+)$/.exec(e);
681
726
  if (n) {
682
- let e = n[1], r = L(n[2]);
727
+ let e = n[1], r = V(n[2]);
683
728
  if (!r) return !1;
684
- let i = R(t, r);
729
+ let i = H(t, r);
685
730
  if (e === ">=") return i >= 0;
686
731
  if (e === "<=") return i <= 0;
687
732
  if (e === ">") return i > 0;
688
733
  if (e === "<") return i < 0;
689
734
  }
690
- let r = L(e);
691
- return r ? R(t, r) === 0 : !1;
692
- }, cr = (e) => {
735
+ let r = V(e);
736
+ return r ? H(t, r) === 0 : !1;
737
+ }, vr = (e) => {
693
738
  let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
694
739
  return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/-([a-zA-Z0-9])/g, (e, t) => t.toUpperCase());
695
- }, lr = (e) => {
740
+ }, yr = (e) => {
696
741
  let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
697
742
  return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/#/g, "--").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
698
- }, ur = Symbol.for("@voltro/protocol/pluginAliases"), z = () => {
699
- let e = globalThis, t = e[ur];
743
+ }, br = Symbol.for("@voltro/protocol/pluginAliases"), U = () => {
744
+ let e = globalThis, t = e[br];
700
745
  if (t instanceof Map) return t;
701
746
  let n = /* @__PURE__ */ new Map();
702
- return e[ur] = n, n;
703
- }, dr = (e) => {
704
- let t = z();
747
+ return e[br] = n, n;
748
+ }, xr = (e) => {
749
+ let t = U();
705
750
  for (let [n, r] of Object.entries(e)) {
706
751
  if (r === "") continue;
707
752
  let e = t.get(n);
708
753
  e === void 0 ? t.set(n, /* @__PURE__ */ new Set([r])) : e.add(r);
709
754
  }
710
- }, fr = () => {
711
- z().clear();
712
- }, pr = (e, t) => {
713
- let n = z().get(e);
714
- if (n === void 0 || n.size === 0) return `${cr(e)}.${t}`;
755
+ }, Sr = () => {
756
+ U().clear();
757
+ }, Cr = (e, t) => {
758
+ let n = U().get(e);
759
+ if (n === void 0 || n.size === 0) return `${vr(e)}.${t}`;
715
760
  if (n.size === 1) return `${[...n][0]}.${t}`;
716
761
  let r = [...n].filter((e) => !e.includes("#"));
717
762
  if (r.length === 1) return `${r[0]}.${t}`;
718
763
  throw Error(`[voltro] ${e} is installed more than once (${[...n].sort().join(", ")}) and no single install is the primary one, so a plugin hook cannot tell which of them it addresses. Call the route by its full tag instead — e.g. useSubscription(api, '${[...n].sort()[0]}.${t}').`);
719
- }, B = m.Union(m.Struct({
720
- kind: m.Literal("dropped"),
721
- at: m.Number,
722
- retryAfterMs: m.Number
723
- }), m.Struct({
724
- kind: m.Literal("skipped"),
725
- at: m.Number,
726
- executionId: m.String,
727
- runId: m.String
728
- }), m.Struct({
729
- kind: m.Literal("superseded"),
730
- at: m.Number
731
- }), m.Struct({
732
- kind: m.Literal("cancelled"),
733
- at: m.Number
734
- }), m.Struct({
735
- kind: m.Literal("abandoned"),
736
- at: m.Number,
737
- failureId: m.NonEmptyString
738
- })), V = m.Literal("running", "succeeded", "failed", "cancelled", "suspended"), H = m.Struct({
739
- id: m.String,
740
- workflowName: m.String,
741
- executionId: m.String,
742
- status: m.Union(V, m.Literal("unknown")),
743
- output: m.optional(m.Unknown),
744
- error: m.optional(m.Struct({
745
- tag: m.NullOr(m.String),
746
- message: m.String
764
+ }, W = h.Union(h.Struct({
765
+ kind: h.Literal("dropped"),
766
+ at: h.Number,
767
+ retryAfterMs: h.Number
768
+ }), h.Struct({
769
+ kind: h.Literal("skipped"),
770
+ at: h.Number,
771
+ executionId: h.String,
772
+ runId: h.String
773
+ }), h.Struct({
774
+ kind: h.Literal("superseded"),
775
+ at: h.Number
776
+ }), h.Struct({
777
+ kind: h.Literal("cancelled"),
778
+ at: h.Number
779
+ }), h.Struct({
780
+ kind: h.Literal("abandoned"),
781
+ at: h.Number,
782
+ failureId: h.NonEmptyString
783
+ })), G = h.Literal("running", "succeeded", "failed", "cancelled", "suspended"), K = h.Struct({
784
+ id: h.String,
785
+ workflowName: h.String,
786
+ executionId: h.String,
787
+ status: h.Union(G, h.Literal("unknown")),
788
+ output: h.optional(h.Unknown),
789
+ error: h.optional(h.Struct({
790
+ tag: h.NullOr(h.String),
791
+ message: h.String
747
792
  }))
748
- }), U = m.Struct({
749
- operation: m.Literal("cancel", "resume"),
750
- kind: m.Literal("accepted", "confirmed", "unknown", "already-terminal"),
751
- requestId: m.NullOr(m.NonEmptyString),
752
- snapshot: H
753
- }).pipe(m.filter((e) => e.kind === "unknown" ? !0 : e.kind === "accepted" ? e.requestId !== null && (e.snapshot.status === "running" || e.snapshot.status === "suspended") : e.kind === "already-terminal" ? e.snapshot.status === "succeeded" || e.snapshot.status === "failed" || e.snapshot.status === "cancelled" : e.operation === "cancel" ? e.snapshot.status === "cancelled" : e.requestId !== null && e.snapshot.status === "running", { message: () => "Workflow control acknowledgement contradicts its observed state or receipt identity" })), W = m.Struct({
754
- operation: m.Literal("cancel"),
755
- workflowName: m.NonEmptyString,
756
- receiptId: m.NonEmptyString,
757
- requestId: m.NullOr(m.NonEmptyString),
758
- kind: m.Literal("accepted", "confirmed", "unknown", "already-terminal"),
759
- observation: m.Union(m.Struct({ kind: m.Literal("pending") }), m.Struct({
760
- kind: m.Literal("admission"),
761
- outcome: m.Union(B, m.Struct({
762
- kind: m.Literal("rejected"),
763
- failureId: m.NonEmptyString
793
+ }), q = h.Struct({
794
+ operation: h.Literal("cancel", "resume"),
795
+ kind: h.Literal("accepted", "confirmed", "unknown", "already-terminal"),
796
+ requestId: h.NullOr(h.NonEmptyString),
797
+ snapshot: K
798
+ }).pipe(h.filter((e) => e.kind === "unknown" ? !0 : e.kind === "accepted" ? e.requestId !== null && (e.snapshot.status === "running" || e.snapshot.status === "suspended") : e.kind === "already-terminal" ? e.snapshot.status === "succeeded" || e.snapshot.status === "failed" || e.snapshot.status === "cancelled" : e.operation === "cancel" ? e.snapshot.status === "cancelled" : e.requestId !== null && e.snapshot.status === "running", { message: () => "Workflow control acknowledgement contradicts its observed state or receipt identity" })), wr = h.Struct({
799
+ operation: h.Literal("cancel"),
800
+ workflowName: h.NonEmptyString,
801
+ receiptId: h.NonEmptyString,
802
+ requestId: h.NullOr(h.NonEmptyString),
803
+ kind: h.Literal("accepted", "confirmed", "unknown", "already-terminal"),
804
+ observation: h.Union(h.Struct({ kind: h.Literal("pending") }), h.Struct({
805
+ kind: h.Literal("admission"),
806
+ outcome: h.Union(W, h.Struct({
807
+ kind: h.Literal("rejected"),
808
+ failureId: h.NonEmptyString
764
809
  }))
765
- }), m.Struct({
766
- kind: m.Literal("execution"),
767
- snapshot: H
768
- }), m.Struct({
769
- kind: m.Literal("unavailable"),
770
- reason: m.Literal("missing-request", "missing-run", "unconfirmed-generation", "unbound-submission")
810
+ }), h.Struct({
811
+ kind: h.Literal("execution"),
812
+ snapshot: K
813
+ }), h.Struct({
814
+ kind: h.Literal("unavailable"),
815
+ reason: h.Literal("missing-request", "missing-run", "unconfirmed-generation", "unbound-submission")
771
816
  }))
772
- }).pipe(m.filter((e) => {
817
+ }).pipe(h.filter((e) => {
773
818
  let t = e.observation;
774
819
  if (t.kind === "unavailable") return e.kind === "unknown" && (t.reason === "missing-request" ? e.requestId === null : e.requestId !== null);
775
820
  if (e.requestId === null) return !1;
@@ -777,307 +822,342 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
777
822
  if (t.kind === "admission") return e.kind === (t.outcome.kind === "cancelled" ? "confirmed" : "already-terminal");
778
823
  let n = t.snapshot;
779
824
  return n.workflowName !== e.workflowName || n.id.length === 0 || n.executionId.length === 0 ? !1 : e.kind === "accepted" ? n.status === "running" || n.status === "suspended" : e.kind === "confirmed" ? n.status === "cancelled" : e.kind === "already-terminal" && (n.status === "succeeded" || n.status === "failed" || n.status === "cancelled");
780
- }, { message: () => "Queued cancellation acknowledgement contradicts its receipt or observation" })), mr = m.Literal("cancel", "terminate", "abandon"), hr = m.Struct({
781
- mode: m.String,
782
- dueAt: m.NullOr(m.Number),
783
- retryAfterMs: m.NullOr(m.Number),
784
- intentId: m.NullOr(m.String)
785
- }), gr = m.Struct({
786
- id: m.String,
787
- workflowName: m.String,
788
- executionId: m.NullOr(m.String),
789
- status: m.Literal("running", "succeeded", "queued", "dropped", "skipped", "replayed"),
790
- deferral: m.optional(hr)
791
- }), _r = (e, t) => {
792
- let n = I(e);
793
- return h.make(e.name, {
794
- payload: y(e.payloadSchema, e.name, N(n.guards)),
795
- success: gr,
796
- error: Sn({
825
+ }, { message: () => "Queued cancellation acknowledgement contradicts its receipt or observation" })), Tr = h.Literal("cancel", "terminate", "abandon"), Er = h.Struct({
826
+ mode: h.String,
827
+ dueAt: h.NullOr(h.Number),
828
+ retryAfterMs: h.NullOr(h.Number),
829
+ intentId: h.NullOr(h.String)
830
+ }), Dr = h.Struct({
831
+ id: h.String,
832
+ workflowName: h.String,
833
+ executionId: h.NullOr(h.String),
834
+ status: h.Literal("running", "succeeded", "queued", "dropped", "skipped", "replayed"),
835
+ deferral: h.optional(Er)
836
+ }), Or = (e, t) => {
837
+ let n = B(e);
838
+ return g.make(e.name, {
839
+ payload: x(e.payloadSchema, e.name, I(n.guards)),
840
+ success: Dr,
841
+ error: jn({
797
842
  errorSchema: e.errorSchema,
798
843
  guards: n.guards
799
844
  }, t)
800
845
  });
801
- }, G = m.Struct({
802
- id: m.String,
803
- tag: m.String,
804
- executionId: m.String,
805
- status: V,
806
- payload: m.Unknown,
807
- workflowVersion: m.NullOr(m.String),
808
- workflowPatches: m.NullOr(m.Unknown),
809
- output: m.NullOr(m.Unknown),
810
- subject: m.NullOr(m.Unknown),
811
- source: m.NullOr(m.String),
812
- errorTag: m.NullOr(m.String),
813
- errorMessage: m.NullOr(m.String),
814
- cancelled: m.Boolean,
815
- startedAt: m.Date,
816
- completedAt: m.NullOr(m.Date),
817
- durationMs: m.NullOr(m.Number),
818
- traceId: m.NullOr(m.String),
819
- parentExecutionId: m.NullOr(m.String),
820
- parentClosePolicy: m.NullOr(mr)
821
- }), vr = m.Struct({
822
- tag: m.optional(m.String),
823
- status: m.optional(V),
824
- limit: m.optional(m.Number)
825
- }), yr = m.Struct({
826
- id: m.String,
827
- runId: m.String,
828
- stepName: m.String,
829
- attempt: m.Number,
830
- status: m.Literal("running", "succeeded", "failed"),
831
- input: m.NullOr(m.Unknown),
832
- retryPolicy: m.NullOr(m.Unknown),
833
- output: m.NullOr(m.Unknown),
834
- errorTag: m.NullOr(m.String),
835
- errorMessage: m.NullOr(m.String),
836
- errorCause: m.NullOr(m.Unknown),
837
- startedAt: m.Date,
838
- completedAt: m.NullOr(m.Date),
839
- durationMs: m.NullOr(m.Number)
840
- }), br = m.Struct({
841
- id: m.String,
842
- runId: m.String,
843
- eventType: m.String,
844
- payload: m.NullOr(m.Unknown),
845
- occurredAt: m.Date,
846
- stepName: m.NullOr(m.String),
847
- attempt: m.NullOr(m.Number)
848
- }), xr = m.Struct({
849
- id: m.String,
850
- name: m.String,
851
- payload: m.Unknown,
852
- source: m.String,
853
- subject: m.NullOr(m.Unknown),
854
- traceId: m.NullOr(m.String),
855
- occurredAt: m.Date
856
- }), Sr = m.Struct({
857
- id: m.String,
858
- eventId: m.String,
859
- eventName: m.String,
860
- triggerId: m.String,
861
- workflowName: m.String,
862
- executionId: m.NullOr(m.String),
863
- status: m.Literal("starting", "started", "skipped", "failed"),
864
- idempotencyKey: m.String,
865
- skipped: m.Boolean,
866
- errorMessage: m.NullOr(m.String),
867
- createdAt: m.Date,
868
- completedAt: m.NullOr(m.Date)
869
- }), Cr = m.Struct({ id: m.String }), K = m.Struct({ runId: m.String }), wr = m.Struct({
870
- name: m.optional(m.String),
871
- limit: m.optional(m.Number)
872
- }), Tr = m.Struct({ eventId: m.String }), q = m.Struct({
873
- requestId: m.NonEmptyString,
874
- cause: m.optionalWith(m.Struct({
875
- reason: m.NonEmptyString,
876
- detail: m.optional(m.Record({
877
- key: m.String,
878
- value: m.Unknown
846
+ }, kr = h.Struct({
847
+ id: h.String,
848
+ tag: h.String,
849
+ executionId: h.String,
850
+ status: G,
851
+ payload: h.Unknown,
852
+ workflowVersion: h.NullOr(h.String),
853
+ workflowPatches: h.NullOr(h.Unknown),
854
+ output: h.NullOr(h.Unknown),
855
+ subject: h.NullOr(h.Unknown),
856
+ source: h.NullOr(h.String),
857
+ errorTag: h.NullOr(h.String),
858
+ errorMessage: h.NullOr(h.String),
859
+ cancelled: h.Boolean,
860
+ startedAt: h.Date,
861
+ completedAt: h.NullOr(h.Date),
862
+ durationMs: h.NullOr(h.Number),
863
+ traceId: h.NullOr(h.String),
864
+ parentExecutionId: h.NullOr(h.String),
865
+ parentClosePolicy: h.NullOr(Tr)
866
+ }), Ar = h.Struct({
867
+ tag: h.optional(h.String),
868
+ status: h.optional(G),
869
+ limit: h.optional(h.Number)
870
+ }), jr = h.Struct({
871
+ id: h.String,
872
+ runId: h.String,
873
+ stepName: h.String,
874
+ attempt: h.Number,
875
+ status: h.Literal("running", "succeeded", "failed"),
876
+ input: h.NullOr(h.Unknown),
877
+ retryPolicy: h.NullOr(h.Unknown),
878
+ output: h.NullOr(h.Unknown),
879
+ errorTag: h.NullOr(h.String),
880
+ errorMessage: h.NullOr(h.String),
881
+ errorCause: h.NullOr(h.Unknown),
882
+ startedAt: h.Date,
883
+ completedAt: h.NullOr(h.Date),
884
+ durationMs: h.NullOr(h.Number)
885
+ }), Mr = h.Struct({
886
+ id: h.String,
887
+ runId: h.String,
888
+ eventType: h.String,
889
+ payload: h.NullOr(h.Unknown),
890
+ occurredAt: h.Date,
891
+ stepName: h.NullOr(h.String),
892
+ attempt: h.NullOr(h.Number)
893
+ }), Nr = h.Struct({
894
+ id: h.String,
895
+ name: h.String,
896
+ payload: h.Unknown,
897
+ source: h.String,
898
+ subject: h.NullOr(h.Unknown),
899
+ traceId: h.NullOr(h.String),
900
+ occurredAt: h.Date
901
+ }), Pr = h.Struct({
902
+ id: h.String,
903
+ eventId: h.String,
904
+ eventName: h.String,
905
+ triggerId: h.String,
906
+ workflowName: h.String,
907
+ executionId: h.NullOr(h.String),
908
+ status: h.Literal("starting", "started", "skipped", "failed"),
909
+ idempotencyKey: h.String,
910
+ skipped: h.Boolean,
911
+ errorMessage: h.NullOr(h.String),
912
+ createdAt: h.Date,
913
+ completedAt: h.NullOr(h.Date)
914
+ }), Fr = h.Struct({ id: h.String }), Ir = h.Struct({ runId: h.String }), Lr = h.Struct({
915
+ name: h.optional(h.String),
916
+ limit: h.optional(h.Number)
917
+ }), Rr = h.Struct({ eventId: h.String }), zr = h.Struct({
918
+ requestId: h.NonEmptyString,
919
+ cause: h.optionalWith(h.Struct({
920
+ reason: h.NonEmptyString,
921
+ detail: h.optional(h.Record({
922
+ key: h.String,
923
+ value: h.Unknown
879
924
  }))
880
925
  }), { exact: !0 })
881
- }), J = m.Struct({
882
- workflowName: m.String,
883
- executionId: m.String,
884
- control: m.optional(q)
885
- }), Er = m.Struct({
886
- workflowName: m.NonEmptyString,
887
- executionId: m.NonEmptyString,
888
- operation: m.Literal("cancel", "resume"),
889
- requestId: m.NonEmptyString
890
- }), Y = m.Struct({
891
- workflowName: m.NonEmptyString,
892
- receiptId: m.NonEmptyString,
893
- requestId: m.NonEmptyString
894
- }), Dr = m.Struct({
895
- ...Y.fields,
896
- cause: q.fields.cause
897
- }), Or = j({
926
+ }), Br = h.Struct({
927
+ workflowName: h.String,
928
+ executionId: h.String,
929
+ control: h.optional(zr)
930
+ }), Vr = h.Struct({
931
+ workflowName: h.NonEmptyString,
932
+ executionId: h.NonEmptyString,
933
+ operation: h.Literal("cancel", "resume"),
934
+ requestId: h.NonEmptyString
935
+ }), Hr = h.Struct({
936
+ workflowName: h.NonEmptyString,
937
+ receiptId: h.NonEmptyString,
938
+ requestId: h.NonEmptyString
939
+ }), Ur = h.Struct({
940
+ ...Hr.fields,
941
+ cause: zr.fields.cause
942
+ }), Wr = F({
898
943
  name: "__voltro.workflow.queued.cancel",
899
- input: Dr,
900
- output: W,
944
+ input: Ur,
945
+ output: wr,
901
946
  openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
902
- }), kr = k({
947
+ }), Gr = N({
903
948
  name: "__voltro.workflow.queued.control",
904
- input: Y,
905
- output: W,
949
+ input: Hr,
950
+ output: wr,
906
951
  openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
907
- }), Ar = k({
952
+ }), Kr = N({
908
953
  name: "__voltro.workflow.control",
909
- input: Er,
910
- output: U,
954
+ input: Vr,
955
+ output: q,
911
956
  openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
912
- }), jr = m.Struct({
913
- id: m.String,
914
- signalName: m.String,
915
- payload: m.optional(m.Unknown)
916
- }), Mr = m.Struct({
917
- id: m.String,
918
- updateName: m.String,
919
- payload: m.optional(m.Unknown),
920
- timeoutMs: m.optional(m.Number)
921
- }), Nr = m.Struct({
922
- eventId: m.String,
923
- updateId: m.String,
924
- completedEventId: m.String,
925
- result: m.Unknown
926
- }), Pr = k({
957
+ }), qr = h.Struct({
958
+ id: h.String,
959
+ signalName: h.String,
960
+ payload: h.optional(h.Unknown)
961
+ }), Jr = h.Struct({
962
+ id: h.String,
963
+ updateName: h.String,
964
+ payload: h.optional(h.Unknown),
965
+ timeoutMs: h.optional(h.Number)
966
+ }), Yr = h.Struct({
967
+ eventId: h.String,
968
+ updateId: h.String,
969
+ completedEventId: h.String,
970
+ result: h.Unknown
971
+ }), Xr = N({
927
972
  name: "__voltro.workflow.run",
928
973
  source: "_voltro_workflow_runs",
929
- input: Cr,
930
- output: m.Array(G),
974
+ input: Fr,
975
+ output: h.Array(kr),
931
976
  openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
932
- }), Fr = k({
977
+ }), Zr = N({
933
978
  name: "__voltro.workflow.runs",
934
979
  source: "_voltro_workflow_runs",
935
- input: vr,
936
- output: m.Array(G),
980
+ input: Ar,
981
+ output: h.Array(kr),
937
982
  openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
938
- }), Ir = k({
983
+ }), Qr = N({
939
984
  name: "__voltro.workflow.run.steps",
940
985
  source: "_voltro_workflow_run_steps",
941
- input: K,
942
- output: m.Array(yr),
986
+ input: Ir,
987
+ output: h.Array(jr),
943
988
  openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
944
- }), Lr = k({
989
+ }), $r = N({
945
990
  name: "__voltro.workflow.run.events",
946
991
  source: "_voltro_workflow_run_events",
947
- input: K,
948
- output: m.Array(br),
992
+ input: Ir,
993
+ output: h.Array(Mr),
949
994
  openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
950
- }), Rr = k({
995
+ }), ei = N({
951
996
  name: "__voltro.workflow.domainEvents",
952
997
  source: "_voltro_workflow_events",
953
- input: wr,
954
- output: m.Array(xr),
998
+ input: Lr,
999
+ output: h.Array(Nr),
955
1000
  openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
956
- }), zr = k({
1001
+ }), ti = N({
957
1002
  name: "__voltro.workflow.event.deliveries",
958
1003
  source: "_voltro_workflow_event_deliveries",
959
- input: Tr,
960
- output: m.Array(Sr),
1004
+ input: Rr,
1005
+ output: h.Array(Pr),
961
1006
  openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
962
- }), Br = j({
1007
+ }), ni = F({
963
1008
  name: "__voltro.workflow.cancel",
964
- input: J,
965
- output: U,
1009
+ input: Br,
1010
+ output: q,
966
1011
  openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
967
- }), Vr = j({
1012
+ }), ri = F({
968
1013
  name: "__voltro.workflow.resume",
969
- input: J,
970
- output: U,
1014
+ input: Br,
1015
+ output: q,
971
1016
  openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
972
- }), Hr = j({
1017
+ }), ii = F({
973
1018
  name: "__voltro.workflow.signal",
974
- input: jr,
975
- output: m.Struct({ eventId: m.String }),
1019
+ input: qr,
1020
+ output: h.Struct({ eventId: h.String }),
976
1021
  openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
977
- }), Ur = j({
1022
+ }), ai = F({
978
1023
  name: "__voltro.workflow.update",
979
- input: Mr,
980
- output: Nr,
1024
+ input: Jr,
1025
+ output: Yr,
981
1026
  openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
982
- }), Wr = m.NonEmptyString.pipe(m.filter((e) => e.trim().length > 0, { message: () => "A workflow retry identity must not be blank" })), Gr = m.Struct({
983
- runId: Wr,
984
- requestId: Wr
985
- }), Kr = m.Struct({
986
- ...Gr.fields,
987
- payloadOverride: m.optional(m.Unknown)
988
- }), X = {
989
- requestId: m.NonEmptyString,
990
- originalRunId: m.NonEmptyString,
991
- originalExecutionId: m.NonEmptyString,
992
- workflowName: m.NonEmptyString
993
- }, qr = m.Union(m.Struct({
994
- ...X,
995
- kind: m.Literal("queued"),
996
- nextAttemptAt: m.NullOr(m.Number)
997
- }), m.Struct({
998
- ...X,
999
- kind: m.Literal("accepted"),
1000
- executionId: m.NonEmptyString
1001
- }).pipe(m.filter((e) => e.executionId !== e.originalExecutionId, { message: () => "A retry cannot accept its original execution identity" })), m.Struct({
1002
- ...X,
1003
- kind: m.Literal("unconfirmed"),
1004
- automaticRetryStopped: m.Boolean,
1005
- nextAttemptAt: m.NullOr(m.Number)
1006
- }).pipe(m.filter((e) => !e.automaticRetryStopped || e.nextAttemptAt === null, { message: () => "Stopped automatic retries cannot have a next attempt" })), m.Struct({
1007
- ...X,
1008
- kind: m.Literal("not-started"),
1009
- outcome: B
1010
- }), m.Struct({
1011
- ...X,
1012
- kind: m.Literal("rejected"),
1013
- failureId: m.NonEmptyString
1014
- })), Jr = "__voltro.undo.log", Yr = "__voltro.undo.apply", Xr = "__voltro.undo.redo", Zr = m.Struct({
1015
- id: m.String,
1016
- tag: m.String,
1017
- label: m.NullOr(m.String),
1018
- undone: m.Boolean,
1019
- crossesAction: m.Boolean,
1020
- createdAt: m.String
1021
- }), Qr = class extends m.TaggedError()("UndoNotFound", { invocationId: m.String }) {}, $r = class extends m.TaggedError()("UndoForbidden", { invocationId: m.String }) {}, ei = class extends m.TaggedError()("UndoConflict", {
1022
- invocationId: m.String,
1023
- reason: m.Literal("conflict", "action")
1024
- }) {}, ti = m.Union(Qr, $r, ei), ni = k({
1025
- name: Jr,
1027
+ }), oi = h.NonEmptyString.pipe(h.filter((e) => e.trim().length > 0, { message: () => "A workflow retry identity must not be blank" })), si = h.Struct({
1028
+ runId: oi,
1029
+ requestId: oi
1030
+ }), ci = h.Struct({
1031
+ ...si.fields,
1032
+ payloadOverride: h.optional(h.Unknown)
1033
+ }), J = {
1034
+ requestId: h.NonEmptyString,
1035
+ originalRunId: h.NonEmptyString,
1036
+ originalExecutionId: h.NonEmptyString,
1037
+ workflowName: h.NonEmptyString
1038
+ }, li = h.Union(h.Struct({
1039
+ ...J,
1040
+ kind: h.Literal("queued"),
1041
+ nextAttemptAt: h.NullOr(h.Number)
1042
+ }), h.Struct({
1043
+ ...J,
1044
+ kind: h.Literal("accepted"),
1045
+ executionId: h.NonEmptyString
1046
+ }).pipe(h.filter((e) => e.executionId !== e.originalExecutionId, { message: () => "A retry cannot accept its original execution identity" })), h.Struct({
1047
+ ...J,
1048
+ kind: h.Literal("unconfirmed"),
1049
+ automaticRetryStopped: h.Boolean,
1050
+ nextAttemptAt: h.NullOr(h.Number)
1051
+ }).pipe(h.filter((e) => !e.automaticRetryStopped || e.nextAttemptAt === null, { message: () => "Stopped automatic retries cannot have a next attempt" })), h.Struct({
1052
+ ...J,
1053
+ kind: h.Literal("not-started"),
1054
+ outcome: W
1055
+ }), h.Struct({
1056
+ ...J,
1057
+ kind: h.Literal("rejected"),
1058
+ failureId: h.NonEmptyString
1059
+ })), Y = h.NonEmptyString.pipe(h.filter((e) => e.trim().length > 0, { message: () => "A workflow restart identity must not be blank" })), ui = h.Union(h.Struct({ kind: h.Literal("failed-steps") }), h.Struct({
1060
+ kind: h.Literal("from-step"),
1061
+ stepName: Y
1062
+ })), X = h.Struct({
1063
+ requestId: Y.pipe(h.maxLength(64)),
1064
+ runId: Y
1065
+ }), di = h.Struct({
1066
+ ...X.fields,
1067
+ selection: ui
1068
+ }), fi = {
1069
+ ...di.fields,
1070
+ workflowName: Y,
1071
+ executionId: Y,
1072
+ originalGeneration: Y,
1073
+ requestedAt: h.Number.pipe(h.finite()),
1074
+ dispatchAttempts: h.NonNegativeInt
1075
+ }, pi = h.Union(h.Struct({
1076
+ ...X.fields,
1077
+ kind: h.Literal("not-found")
1078
+ }), h.Struct({
1079
+ ...di.fields,
1080
+ kind: h.Literal("withdrawn"),
1081
+ workflowName: Y,
1082
+ withdrawnAt: h.Number.pipe(h.finite())
1083
+ }), h.Struct({
1084
+ ...fi,
1085
+ kind: h.Literal("pending")
1086
+ }), h.Struct({
1087
+ ...fi,
1088
+ kind: h.Literal("entered"),
1089
+ enteredGeneration: Y
1090
+ }).pipe(h.filter((e) => e.enteredGeneration !== e.originalGeneration && e.dispatchAttempts > 0, { message: () => "Restart entry requires a dispatched command and a new generation" }))), mi = h.Union(pi, h.Struct({
1091
+ ...X.fields,
1092
+ kind: h.Literal("not-reserved"),
1093
+ reason: h.Literal("admission", "journal")
1094
+ })), hi = "__voltro.undo.log", gi = "__voltro.undo.apply", _i = "__voltro.undo.redo", vi = h.Struct({
1095
+ id: h.String,
1096
+ tag: h.String,
1097
+ label: h.NullOr(h.String),
1098
+ undone: h.Boolean,
1099
+ crossesAction: h.Boolean,
1100
+ createdAt: h.String
1101
+ }), yi = class extends h.TaggedError()("UndoNotFound", { invocationId: h.String }) {}, bi = class extends h.TaggedError()("UndoForbidden", { invocationId: h.String }) {}, xi = class extends h.TaggedError()("UndoConflict", {
1102
+ invocationId: h.String,
1103
+ reason: h.Literal("conflict", "action")
1104
+ }) {}, Si = h.Union(yi, bi, xi), Ci = N({
1105
+ name: hi,
1026
1106
  source: "_voltro_undo_log",
1027
- input: m.Struct({ limit: m.optional(m.Number) }),
1028
- output: m.Array(Zr),
1107
+ input: h.Struct({ limit: h.optional(h.Number) }),
1108
+ output: h.Array(vi),
1029
1109
  openAccess: "subject-scoped by construction: lists only the calling subject's own undoable actions"
1030
- }), ri = A({
1031
- name: Yr,
1032
- input: m.Struct({ invocationId: m.String }),
1033
- output: m.Struct({ ok: m.Boolean }),
1034
- error: ti,
1110
+ }), wi = P({
1111
+ name: gi,
1112
+ input: h.Struct({ invocationId: h.String }),
1113
+ output: h.Struct({ ok: h.Boolean }),
1114
+ error: Si,
1035
1115
  openAccess: "subject-scoped by construction: undo is per-actor — another subject's invocation fails typed with UndoForbidden"
1036
- }), ii = A({
1037
- name: Xr,
1038
- input: m.Struct({ invocationId: m.String }),
1039
- output: m.Struct({ ok: m.Boolean }),
1040
- error: ti,
1116
+ }), Ti = P({
1117
+ name: _i,
1118
+ input: h.Struct({ invocationId: h.String }),
1119
+ output: h.Struct({ ok: h.Boolean }),
1120
+ error: Si,
1041
1121
  openAccess: "subject-scoped by construction: redo is per-actor — another subject's invocation fails typed with UndoForbidden"
1042
- }), ai = class extends m.TaggedError()("TenantScopeViolation", {
1043
- table: m.String,
1044
- reason: m.String
1045
- }) {}, oi = class extends m.TaggedError()("StoreOperationFailed", {
1046
- operation: m.String,
1047
- table: m.String,
1048
- cause: m.String
1122
+ }), Ei = class extends h.TaggedError()("TenantScopeViolation", {
1123
+ table: h.String,
1124
+ reason: h.String
1125
+ }) {}, Di = class extends h.TaggedError()("StoreOperationFailed", {
1126
+ operation: h.String,
1127
+ table: h.String,
1128
+ cause: h.String
1049
1129
  }) {
1050
1130
  get message() {
1051
1131
  return `${this.operation} on '${this.table}' failed: ${this.cause}`;
1052
1132
  }
1053
- }, si = class extends m.TaggedError()("NoRowFound", {
1054
- table: m.String,
1055
- found: m.Number
1133
+ }, Oi = class extends h.TaggedError()("NoRowFound", {
1134
+ table: h.String,
1135
+ found: h.Number
1056
1136
  }) {
1057
1137
  get message() {
1058
1138
  return this.found === 0 ? `expected exactly one row in '${this.table}', found none` : `expected exactly one row in '${this.table}', found more than one`;
1059
1139
  }
1060
- }, ci = class extends m.TaggedError()("TableValidationFailed", {
1061
- table: m.String,
1062
- summary: m.String,
1063
- issues: m.Array(m.Struct({
1064
- path: m.String,
1065
- message: m.String
1140
+ }, ki = class extends h.TaggedError()("TableValidationFailed", {
1141
+ table: h.String,
1142
+ summary: h.String,
1143
+ issues: h.Array(h.Struct({
1144
+ path: h.String,
1145
+ message: h.String
1066
1146
  }))
1067
- }) {}, li = class extends m.TaggedError()("TenantRowNotFound", {
1068
- table: m.String,
1069
- id: m.String,
1070
- reason: m.String
1071
- }) {}, ui = class extends m.TaggedError()("ServerOnlyColumnWrite", {
1072
- table: m.String,
1073
- columns: m.Array(m.String)
1074
- }) {}, di = class extends m.TaggedError()("ConstraintViolation", {
1075
- kind: m.Literal("foreignKey", "foreignKeyInUse", "unique", "notNull", "check"),
1076
- table: m.String,
1077
- operation: m.String,
1078
- constraint: m.optional(m.String),
1079
- column: m.optional(m.String),
1080
- detail: m.optional(m.String)
1147
+ }) {}, Ai = class extends h.TaggedError()("TenantRowNotFound", {
1148
+ table: h.String,
1149
+ id: h.String,
1150
+ reason: h.String
1151
+ }) {}, ji = class extends h.TaggedError()("ServerOnlyColumnWrite", {
1152
+ table: h.String,
1153
+ columns: h.Array(h.String)
1154
+ }) {}, Mi = class extends h.TaggedError()("ConstraintViolation", {
1155
+ kind: h.Literal("foreignKey", "foreignKeyInUse", "unique", "notNull", "check"),
1156
+ table: h.String,
1157
+ operation: h.String,
1158
+ constraint: h.optional(h.String),
1159
+ column: h.optional(h.String),
1160
+ detail: h.optional(h.String)
1081
1161
  }) {
1082
1162
  get message() {
1083
1163
  if (this.detail !== void 0) return this.detail;
@@ -1090,86 +1170,243 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
1090
1170
  case "check": return `check constraint ${t}: the row does not satisfy it`;
1091
1171
  }
1092
1172
  }
1093
- }, fi = "__voltro.approvals.pending", pi = "__voltro.approvals.decide", mi = k({
1094
- name: fi,
1173
+ }, Ni = "__voltro.approvals.pending", Pi = "__voltro.approvals.decide", Fi = N({
1174
+ name: Ni,
1095
1175
  source: "_voltro_approvals",
1096
- input: m.Struct({ limit: m.optional(m.Number) }),
1097
- output: m.Array(Xt),
1176
+ input: h.Struct({ limit: h.optional(h.Number) }),
1177
+ output: h.Array(en),
1098
1178
  openAccess: "the answer is scoped to the caller — a row appears only if they requested it or hold its recorded approver scopes, so an anonymous caller sees nothing"
1099
- }), hi = A({
1100
- name: pi,
1101
- input: m.Struct({
1102
- approvalId: m.String,
1103
- decision: m.Literal("approve", "reject"),
1104
- note: m.optional(m.String)
1179
+ }), Ii = P({
1180
+ name: Pi,
1181
+ input: h.Struct({
1182
+ approvalId: h.String,
1183
+ decision: h.Literal("approve", "reject"),
1184
+ note: h.optional(h.String)
1105
1185
  }),
1106
- output: m.Struct({
1107
- approvalId: m.String,
1108
- status: m.Literal("approved", "rejected")
1186
+ output: h.Struct({
1187
+ approvalId: h.String,
1188
+ status: h.Literal("approved", "rejected")
1109
1189
  }),
1110
- error: Yt,
1190
+ error: $t,
1111
1191
  openAccess: "the approver authority is the PENDING ROW's own recorded scopes (plus an unconditional self-approval refusal), checked in-handler — a descriptor-level scope would have to be the union of every approval-requiring procedure in the app"
1112
- }), gi = "__voltro.connections.list", _i = "__voltro.connections.start", vi = "__voltro.connections.submitToken", Z = "__voltro.connections.disconnect", Q = m.Literal("oauth2", "pat"), yi = m.Literal("disconnected", "connected", "expired", "revoked", "error"), bi = m.Struct({
1113
- connectionId: m.String,
1114
- kind: Q,
1115
- label: m.String,
1116
- status: yi,
1117
- accountId: m.NullOr(m.String),
1118
- accountLabel: m.NullOr(m.String),
1119
- scopes: m.Array(m.String),
1120
- expiresAt: m.NullOr(m.String),
1121
- lastError: m.NullOr(m.String),
1122
- connectedAt: m.NullOr(m.String)
1123
- }), xi = class extends m.TaggedError()("ConnectionNotDeclared", { connectionId: m.String }) {}, Si = class extends m.TaggedError()("ConnectionSubjectRequired", { connectionId: m.String }) {}, Ci = class extends m.TaggedError()("ConnectionKindMismatch", {
1124
- connectionId: m.String,
1125
- expected: Q,
1126
- actual: Q
1127
- }) {}, wi = class extends m.TaggedError()("ConnectionHandshakeFailed", {
1128
- connectionId: m.String,
1129
- reason: m.String,
1130
- transient: m.Boolean
1131
- }) {}, $ = m.Union(xi, Si, Ci, wi), Ti = k({
1132
- name: gi,
1192
+ }), Li = "__voltro.connections.list", Ri = "__voltro.connections.start", zi = "__voltro.connections.submitToken", Bi = "__voltro.connections.disconnect", Z = h.Literal("oauth2", "pat"), Vi = h.Literal("disconnected", "connected", "expired", "revoked", "error"), Hi = h.Struct({
1193
+ connectionId: h.String,
1194
+ kind: Z,
1195
+ label: h.String,
1196
+ status: Vi,
1197
+ accountId: h.NullOr(h.String),
1198
+ accountLabel: h.NullOr(h.String),
1199
+ scopes: h.Array(h.String),
1200
+ expiresAt: h.NullOr(h.String),
1201
+ lastError: h.NullOr(h.String),
1202
+ connectedAt: h.NullOr(h.String)
1203
+ }), Ui = class extends h.TaggedError()("ConnectionNotDeclared", { connectionId: h.String }) {}, Wi = class extends h.TaggedError()("ConnectionSubjectRequired", { connectionId: h.String }) {}, Gi = class extends h.TaggedError()("ConnectionKindMismatch", {
1204
+ connectionId: h.String,
1205
+ expected: Z,
1206
+ actual: Z
1207
+ }) {}, Ki = class extends h.TaggedError()("ConnectionHandshakeFailed", {
1208
+ connectionId: h.String,
1209
+ reason: h.String,
1210
+ transient: h.Boolean
1211
+ }) {}, qi = h.Union(Ui, Wi, Gi, Ki), Ji = N({
1212
+ name: Li,
1133
1213
  source: "_voltro_connections",
1134
- input: m.Struct({}),
1135
- output: m.Array(bi),
1214
+ input: h.Struct({}),
1215
+ output: h.Array(Hi),
1136
1216
  openAccess: "self-scoped read: projects the declared connections for the calling subject only (its own connect/disconnect state)"
1137
- }), Ei = j({
1138
- name: _i,
1139
- input: m.Struct({
1140
- connectionId: m.String,
1141
- redirectTo: m.optional(m.String)
1217
+ }), Yi = F({
1218
+ name: Ri,
1219
+ input: h.Struct({
1220
+ connectionId: h.String,
1221
+ redirectTo: h.optional(h.String)
1142
1222
  }),
1143
- output: m.Struct({
1144
- authorizeUrl: m.String,
1145
- state: m.String
1223
+ output: h.Struct({
1224
+ authorizeUrl: h.String,
1225
+ state: h.String
1146
1226
  }),
1147
- error: $,
1227
+ error: qi,
1148
1228
  openAccess: "self-service: begins an oauth handshake that stores a credential for the calling subject only; anonymous callers fail typed with ConnectionSubjectRequired"
1149
- }), Di = A({
1150
- name: vi,
1151
- input: m.Struct({
1152
- connectionId: m.String,
1153
- token: m.String
1229
+ }), Xi = P({
1230
+ name: zi,
1231
+ input: h.Struct({
1232
+ connectionId: h.String,
1233
+ token: h.String
1154
1234
  }),
1155
- output: m.Struct({ ok: m.Boolean }),
1156
- error: $,
1235
+ output: h.Struct({ ok: h.Boolean }),
1236
+ error: qi,
1157
1237
  openAccess: "self-service: stores a pasted token as the calling subject's own credential; anonymous callers fail typed with ConnectionSubjectRequired"
1158
- }), Oi = A({
1159
- name: Z,
1160
- input: m.Struct({ connectionId: m.String }),
1161
- output: m.Struct({ ok: m.Boolean }),
1162
- error: $,
1238
+ }), Zi = P({
1239
+ name: Bi,
1240
+ input: h.Struct({ connectionId: h.String }),
1241
+ output: h.Struct({ ok: h.Boolean }),
1242
+ error: qi,
1163
1243
  openAccess: "self-service: deletes only the calling subject's own credential row for this connection"
1164
- }), ki = (e) => {
1244
+ }), Qi = (e) => {
1165
1245
  let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : typeof e == "string" ? new Date(e).getTime() : 0;
1166
1246
  return Number.isNaN(t) ? 0 : t;
1167
- }, Ai = 4001, ji = /* @__PURE__ */ new Set(["/rpc", "/ws"]), Mi = (e) => {
1247
+ }, $i = [
1248
+ "app-store",
1249
+ "play",
1250
+ "mac-app-store",
1251
+ "microsoft-store"
1252
+ ], Q = [
1253
+ {
1254
+ name: "iphone-6.7",
1255
+ label: "iPhone 6.7″ — 1290×2796",
1256
+ kind: "phone",
1257
+ viewport: {
1258
+ width: 430,
1259
+ height: 932
1260
+ },
1261
+ deviceScaleFactor: 3,
1262
+ stores: ["app-store"]
1263
+ },
1264
+ {
1265
+ name: "iphone-6.5",
1266
+ label: "iPhone 6.5″ — 1242×2688",
1267
+ kind: "phone",
1268
+ viewport: {
1269
+ width: 414,
1270
+ height: 896
1271
+ },
1272
+ deviceScaleFactor: 3,
1273
+ stores: ["app-store"]
1274
+ },
1275
+ {
1276
+ name: "ipad-12.9",
1277
+ label: "iPad 12.9″ — 2048×2732",
1278
+ kind: "tablet",
1279
+ viewport: {
1280
+ width: 1024,
1281
+ height: 1366
1282
+ },
1283
+ deviceScaleFactor: 2,
1284
+ stores: ["app-store"]
1285
+ },
1286
+ {
1287
+ name: "android-phone",
1288
+ label: "Android phone — 1080×2160",
1289
+ kind: "phone",
1290
+ viewport: {
1291
+ width: 360,
1292
+ height: 720
1293
+ },
1294
+ deviceScaleFactor: 3,
1295
+ stores: ["play"]
1296
+ },
1297
+ {
1298
+ name: "android-tablet-10",
1299
+ label: "Android 10″ tablet — 1600×2560",
1300
+ kind: "tablet",
1301
+ viewport: {
1302
+ width: 800,
1303
+ height: 1280
1304
+ },
1305
+ deviceScaleFactor: 2,
1306
+ stores: ["play"]
1307
+ },
1308
+ {
1309
+ name: "mac",
1310
+ label: "Mac — 2880×1800",
1311
+ kind: "desktop",
1312
+ viewport: {
1313
+ width: 1440,
1314
+ height: 900
1315
+ },
1316
+ deviceScaleFactor: 2,
1317
+ stores: ["mac-app-store"]
1318
+ },
1319
+ {
1320
+ name: "windows",
1321
+ label: "Windows — 1366×768",
1322
+ kind: "desktop",
1323
+ viewport: {
1324
+ width: 1366,
1325
+ height: 768
1326
+ },
1327
+ deviceScaleFactor: 1,
1328
+ stores: ["microsoft-store"]
1329
+ }
1330
+ ], ea = Q.map((e) => e.name), ta = (e) => Q.find((t) => t.name === e), na = (e) => ({
1331
+ width: e.viewport.width * e.deviceScaleFactor,
1332
+ height: e.viewport.height * e.deviceScaleFactor
1333
+ }), ra = (e) => Q.filter((t) => t.stores.includes(e)), ia = 4001, aa = /* @__PURE__ */ new Set(["/rpc", "/ws"]), oa = (e) => {
1168
1334
  for (let [t, n] of Object.entries(e.limits ?? {})) if (n !== void 0 && (!Number.isSafeInteger(n) || n <= 0)) throw Error(`defineWebSocket: limits.${t} must be a positive safe integer`);
1169
1335
  if (!e.path.startsWith("/")) throw Error(`defineWebSocket: path must be absolute, got '${e.path}'`);
1170
- if (ji.has(e.path)) throw Error(`defineWebSocket: '${e.path}' is the framework's own socket surface — mount the gateway elsewhere`);
1336
+ if (aa.has(e.path)) throw Error(`defineWebSocket: '${e.path}' is the framework's own socket surface — mount the gateway elsewhere`);
1171
1337
  if (e.auth !== "subject" && e.auth !== "public") throw Error(`defineWebSocket: auth must be 'subject' or 'public' (explicitly — an unauthenticated socket has to be a decision somebody wrote down), got '${String(e.auth)}'`);
1172
1338
  return e;
1173
- }, Ni = 1;
1339
+ }, sa = "voltro-dev", ca = "pair", $ = "voltro:pairing", la = (e) => {
1340
+ try {
1341
+ let t = new URL(e);
1342
+ return t.protocol === "http:" || t.protocol === "https:";
1343
+ } catch {
1344
+ return !1;
1345
+ }
1346
+ }, ua = (e) => {
1347
+ try {
1348
+ let t = new URL(e).hostname;
1349
+ return t === "localhost" || t === "127.0.0.1" || t === "::1" || t === "[::1]";
1350
+ } catch {
1351
+ return !1;
1352
+ }
1353
+ }, da = (e) => {
1354
+ if (!la(e.api)) throw Error(`pairingLink: api must be an http(s) url, got ${JSON.stringify(e.api)}`);
1355
+ if (ua(e.api)) throw Error("pairingLink: api must be the LAN address — a device cannot reach localhost on this machine");
1356
+ if (!/^[A-Za-z0-9_-]+$/.test(e.name)) throw Error(`pairingLink: name must be a plain identifier, got ${JSON.stringify(e.name)}`);
1357
+ let t = new URLSearchParams({
1358
+ api: e.api,
1359
+ name: e.name
1360
+ });
1361
+ return e.token !== void 0 && e.token.length > 0 && t.set("token", e.token), `${sa}://${ca}?${t.toString()}`;
1362
+ }, fa = (e) => {
1363
+ let t;
1364
+ try {
1365
+ t = new URL(e);
1366
+ } catch {
1367
+ return null;
1368
+ }
1369
+ if (t.protocol !== "voltro-dev:" || (t.host || t.pathname.replace(/^\/+/, "")) !== "pair") return null;
1370
+ let n = t.searchParams.get("api") ?? "", r = t.searchParams.get("name") ?? "", i = t.searchParams.get("token");
1371
+ return !la(n) || ua(n) || !/^[A-Za-z0-9_-]+$/.test(r) ? null : {
1372
+ api: n,
1373
+ name: r,
1374
+ ...i !== null && i.length > 0 ? { token: i } : {}
1375
+ };
1376
+ }, pa = (e) => "getItem" in e ? {
1377
+ get: async (t) => e.getItem(t),
1378
+ set: async (t, n) => {
1379
+ await e.setItem(t, n);
1380
+ },
1381
+ remove: e.removeItem ? async (t) => {
1382
+ await e.removeItem(t);
1383
+ } : null
1384
+ } : {
1385
+ get: async (t) => e.get(t),
1386
+ set: async (t, n) => {
1387
+ await e.set(t, n);
1388
+ },
1389
+ remove: e.remove ? async (t) => {
1390
+ await e.remove(t);
1391
+ } : null
1392
+ }, ma = async (e, t) => {
1393
+ await pa(e).set($, JSON.stringify(t));
1394
+ }, ha = async (e) => {
1395
+ let t = await pa(e).get($);
1396
+ if (t === null || t === "") return null;
1397
+ try {
1398
+ let e = JSON.parse(t);
1399
+ return typeof e.api != "string" || typeof e.name != "string" || !la(e.api) ? null : {
1400
+ api: e.api,
1401
+ name: e.name,
1402
+ ...typeof e.token == "string" && e.token.length > 0 ? { token: e.token } : {}
1403
+ };
1404
+ } catch {
1405
+ return null;
1406
+ }
1407
+ }, ga = async (e) => {
1408
+ let t = pa(e);
1409
+ t.remove ? await t.remove($) : await t.set($, "");
1410
+ }, _a = 1;
1174
1411
  //#endregion
1175
- export { Be as ADMIN_SCOPE, Ne as APIKEY_ISSUE_ORG_SCOPE, Le as APIKEY_ISSUE_OTHER_SCOPE, De as APIKEY_ISSUE_SELF_SCOPE, pi as APPROVALS_DECIDE_TAG, fi as APPROVALS_PENDING_TAG, $n as ApiUnavailable, Yt as ApprovalDecisionErrors, Jt as ApprovalErrors, b as ApprovalExpired, qt as ApprovalForbidden, Ut as ApprovalNotFound, Kt as ApprovalNotPending, Gt as ApprovalRejected, Ht as ApprovalRequired, Wt as ApprovalSelfApproval, x as ApprovalUnavailable, t as AuthMiddleware, Lt as BusinessRuleViolation, gi as CONNECTIONS_LIST_TAG, Z as CONNECTION_DISCONNECT_TAG, _i as CONNECTION_START_TAG, vi as CONNECTION_SUBMIT_TOKEN_TAG, wi as ConnectionHandshakeFailed, ke as ConnectionInfo, ie as ConnectionInfoMiddleware, Q as ConnectionKind, Ci as ConnectionKindMismatch, xi as ConnectionNotDeclared, bi as ConnectionState, yi as ConnectionStatus, Si as ConnectionSubjectRequired, di as ConstraintViolation, bt as DEFAULT_IN_FLIGHT_LEASE_MS, ae as DEFAULT_SCOPE_CACHE_MAX_ENTRIES, se as DEFAULT_SCOPE_CACHE_TTL_MS, ve as DEVICES_MANAGE_SCOPE, Gn as EVENT_ROUTE_SEP, Hn as EventKeyInvalid, Vn as EventPayloadInvalid, Un as EventPayloadTooLarge, Ai as GATEWAY_CREDENTIAL_EXPIRED_CLOSE_CODE, o as IMPERSONATION_METADATA_KEY, ht as JSONAPI_MEDIA_TYPE, jn as MAX_EVENT_ENVELOPE_BYTES, et as MUTATION_IN_FLIGHT_RETRY_AFTER_MS, yt as MutationConnectionRequired, Xe as MutationInFlight, si as NoRowFound, ut as PROBLEM_JSON, Ni as PROTOCOL_VERSION, Xt as PendingApproval, S as REACTIVITY_CHANNEL_PREFIX, pt as REST_PROFILE_NAMES, E as SERVICE_NAME_PATTERN, u as ScopeError, ui as ServerOnlyColumnWrite, oi as StoreOperationFailed, ee as Subject, re as SubjectIdentity, le as SubjectService, ci as TableValidationFailed, li as TenantRowNotFound, ai as TenantScopeViolation, Re as TenantSelectionRefused, Yr as UNDO_APPLY_TAG, Jr as UNDO_LOG_TAG, Xr as UNDO_REDO_TAG, p as Unauthenticated, ei as UndoConflict, $r as UndoForbidden, Zr as UndoLogEntry, Qr as UndoNotFound, zt as ValidationError, Bt as ValidationErrors, Rt as ValidationIssue, F as WorkflowAccessProperty, J as WorkflowControlInputSchema, q as WorkflowControlIntentSchema, Er as WorkflowControlReadInputSchema, U as WorkflowControlResultSchema, xr as WorkflowDomainEventRowSchema, wr as WorkflowDomainEventsInputSchema, Tr as WorkflowEventDeliveriesInputSchema, Sr as WorkflowEventDeliveryRowSchema, mr as WorkflowParentClosePolicySchema, Dr as WorkflowQueuedCancelInputSchema, W as WorkflowQueuedCancellationResultSchema, Y as WorkflowQueuedControlTargetSchema, Kr as WorkflowRetryCommandSchema, qr as WorkflowRetryObservationSchema, Gr as WorkflowRetryTargetSchema, br as WorkflowRunEventRowSchema, gr as WorkflowRunHandleSchema, Cr as WorkflowRunRefSchema, G as WorkflowRunRowSchema, H as WorkflowRunSnapshotSchema, V as WorkflowRunStatusSchema, yr as WorkflowRunStepRowSchema, K as WorkflowRunTableRefSchema, vr as WorkflowRunsInputSchema, jr as WorkflowSignalInputSchema, hr as WorkflowStartDeferralSchema, B as WorkflowStartTerminalOutcomeSchema, Mr as WorkflowUpdateInputSchema, Nr as WorkflowUpdateResultSchema, En as actionToRpc, ze as advisoryResourceGuardWarning, n as anonymousSubject, Mt as applyRowPatch, pe as applyScopeDecision, hi as approvalsDecideDescriptor, mi as approvalsPendingQueryDescriptor, c as assertAuthenticated, Zn as attachWorkflowAccess, Ke as beginIdempotent, or as checkFrameworkCompat, xe as checkGuards, je as checkGuardsEffect, lt as compareSurfaces, fe as composeAuthStrategies, ir as composeRpcInterceptors, Oi as connectionDisconnectDescriptor, Ei as connectionStartDescriptor, Di as connectionSubmitTokenDescriptor, Ti as connectionsListQueryDescriptor, rn as declaredReactivityChannelKeys, j as defineAction, Nn as defineEvent, A as defineMutation, tr as definePlugin, nr as definePluginRoute, ar as definePluginService, k as defineQuery, _n as defineStream, Mi as defineWebSocket, At as diffRows, He as effectiveScopes, Wn as encodeEventKey, ot as encodeRestError, $e as encodeRestSuccess, On as errorTag, In as eventAttached, Pn as eventEnvelope, Fn as eventGap, Rn as eventResumePoint, Kn as eventRoute, Ln as eventStreamEvent, zn as eventSubscribeInput, Bn as eventToRpc, vt as failIdempotent, Vt as fieldIssuesOf, Se as findAdvisoryResourceGuards, Ze as finishIdempotent, Pt as firstEventValue, Jn as formatEventRoute, Je as freshFor, we as getPolicyGuardResolver, Fe as getResourceScopeResolver, I as getWorkflowAccess, at as groupShapeDigests, gn as hasAccessDecision, me as hasCallbackRoutes, Me as hasEffectiveScope, N as hasEnforcedGuard, Ee as hasScope, qe as holdIdempotentClaim, g as idToPath, Ye as idempotencyScope, Ft as inputLabel, er as isApiUnavailable, Te as isAuthenticatedCheck, hn as isAuthenticatedGuard, un as isClientReachable, Mn as isEventDescriptor, jt as isIdKeyed, s as isMachineSubject, l as isOpenAccess, Ue as isPolicyCheck, mn as isPolicyGuard, tn as isReactivityChannel, nn as isReactivityChannelKey, We as isServiceAccess, dn as isServiceReachable, ne as isServiceSubject, Ie as isSystemSubject, Oe as isTenantSelectable, T as isWireReachable, te as makeScopeCache, st as memoryIdempotencyStore, be as missingAccessDecision, Tn as mutationToRpc, dt as nextLink, An as normalizeDescriptor, on as normalizeSource, f as openAccessSpec, ge as orderByBearerPrefix, qn as parseEventRoute, Ot as pathToId, cr as pluginAlias, rr as pluginInstanceName, lr as pluginSlug, pr as pluginTag, mt as problemDetails, tt as problemTypeOf, it as procedureShapeDigest, cn as publishReactivity, rt as publishServerError, wn as queryToRpc, he as rawImpersonationMark, en as reactivityChannel, dr as registerPluginAliases, ue as requireScope, fr as resetPluginAliases, r as resolvePolicyAction, ct as resolveRestFormat, Xn as resolveWorkflowAccess, gt as restViewSchema, Et as rowPatchOpSchema, Dt as rowPatchSchema, Qe as schemaShape, _e as scopeCacheKey, ye as selectSubjectTenant, d as serviceAccessSpec, de as serviceCallersOf, ce as serviceSubject, a as setEffectiveScopes, i as setPolicyGuardResolver, oe as setResourceScopeResolver, _t as shapeDigest, an as sourceKeys, Dn as streamToRpc, y as strictInput, e as subjectAuditActorId, Ce as subjectIdentity, Ae as subjectScopes, ft as subscribeServerErrors, Nt as subscriptionEvent, Ve as systemSubject, Pe as tenantScopedSubject, kn as toRpc, nt as toSnakeCase, ki as tsMs, sn as undeclaredChannelKeys, ri as undoApplyDescriptor, ni as undoLogQueryDescriptor, ii as undoRedoDescriptor, ln as wireAudienceOf, P as wireErrorUnion, Cn as withRpcTag, Qn as workflowAccessDescriptor, Br as workflowCancelDescriptor, Ar as workflowControlQueryDescriptor, Rr as workflowDomainEventsQueryDescriptor, zr as workflowEventDeliveriesQueryDescriptor, Or as workflowQueuedCancelDescriptor, kr as workflowQueuedControlQueryDescriptor, Vr as workflowResumeDescriptor, Lr as workflowRunEventsQueryDescriptor, Pr as workflowRunQueryDescriptor, Ir as workflowRunStepsQueryDescriptor, Fr as workflowRunsQueryDescriptor, Hr as workflowSignalDescriptor, _r as workflowToRpc, Ur as workflowUpdateDescriptor, Sn as workflowWireErrorUnion, Ge as wsMutationIdempotencyScope };
1412
+ export { Be as ADMIN_SCOPE, Me as APIKEY_ISSUE_ORG_SCOPE, Le as APIKEY_ISSUE_OTHER_SCOPE, Ee as APIKEY_ISSUE_SELF_SCOPE, Pi as APPROVALS_DECIDE_TAG, Ni as APPROVALS_PENDING_TAG, lr as ApiUnavailable, $t as ApprovalDecisionErrors, Qt as ApprovalErrors, T as ApprovalExpired, Zt as ApprovalForbidden, qt as ApprovalNotFound, Xt as ApprovalNotPending, Yt as ApprovalRejected, Kt as ApprovalRequired, Jt as ApprovalSelfApproval, E as ApprovalUnavailable, ie as AuthMiddleware, S as BusinessRuleViolation, Li as CONNECTIONS_LIST_TAG, Bi as CONNECTION_DISCONNECT_TAG, Ri as CONNECTION_START_TAG, zi as CONNECTION_SUBMIT_TOKEN_TAG, Ki as ConnectionHandshakeFailed, ae as ConnectionInfo, se as ConnectionInfoMiddleware, Z as ConnectionKind, Gi as ConnectionKindMismatch, Ui as ConnectionNotDeclared, Hi as ConnectionState, Vi as ConnectionStatus, Wi as ConnectionSubjectRequired, Mi as ConstraintViolation, tt as DEFAULT_IN_FLIGHT_LEASE_MS, o as DEFAULT_SCOPE_CACHE_MAX_ENTRIES, ee as DEFAULT_SCOPE_CACHE_TTL_MS, ve as DEVICES_MANAGE_SCOPE, tr as EVENT_ROUTE_SEP, Qn as EventKeyInvalid, Zn as EventPayloadInvalid, $n as EventPayloadTooLarge, An as FRAMEWORK_WIRE_ERRORS, ia as GATEWAY_CREDENTIAL_EXPIRED_CLOSE_CODE, re as IMPERSONATION_METADATA_KEY, _t as JSONAPI_MEDIA_TYPE, Vn as MAX_EVENT_ENVELOPE_BYTES, xt as MUTATION_IN_FLIGHT_RETRY_AFTER_MS, Ze as MutationConnectionRequired, m as MutationInFlight, Oi as NoRowFound, d as NoSuchResource, ca as PAIRING_HOST, sa as PAIRING_SCHEME, $ as PAIRING_STORAGE_KEY, ft as PROBLEM_JSON, _a as PROTOCOL_VERSION, en as PendingApproval, D as REACTIVITY_CHANNEL_PREFIX, ht as REST_PROFILE_NAMES, gn as SERVICE_NAME_PATTERN, wt as SESSION_HEADER_NAME, Q as STORE_SCREENSHOT_PRESETS, ea as STORE_SCREENSHOT_PRESET_NAMES, $i as STORE_SCREENSHOT_STORES, f as ScopeError, ji as ServerOnlyColumnWrite, Di as StoreOperationFailed, le as Subject, Ke as SubjectIdentity, n as SubjectService, ki as TableValidationFailed, Ai as TenantRowNotFound, Ei as TenantScopeViolation, ye as TenantSelectionRefused, gi as UNDO_APPLY_TAG, hi as UNDO_LOG_TAG, _i as UNDO_REDO_TAG, l as Unauthenticated, xi as UndoConflict, bi as UndoForbidden, vi as UndoLogEntry, yi as UndoNotFound, C as ValidationError, w as ValidationErrors, Wt as ValidationIssue, z as WorkflowAccessProperty, Br as WorkflowControlInputSchema, zr as WorkflowControlIntentSchema, Vr as WorkflowControlReadInputSchema, q as WorkflowControlResultSchema, Nr as WorkflowDomainEventRowSchema, Lr as WorkflowDomainEventsInputSchema, Rr as WorkflowEventDeliveriesInputSchema, Pr as WorkflowEventDeliveryRowSchema, Tr as WorkflowParentClosePolicySchema, Ur as WorkflowQueuedCancelInputSchema, wr as WorkflowQueuedCancellationResultSchema, Hr as WorkflowQueuedControlTargetSchema, di as WorkflowRestartCommandSchema, pi as WorkflowRestartObservationSchema, mi as WorkflowRestartResultSchema, ui as WorkflowRestartSelectionSchema, X as WorkflowRestartTargetSchema, ci as WorkflowRetryCommandSchema, li as WorkflowRetryObservationSchema, si as WorkflowRetryTargetSchema, Mr as WorkflowRunEventRowSchema, Dr as WorkflowRunHandleSchema, Fr as WorkflowRunRefSchema, kr as WorkflowRunRowSchema, K as WorkflowRunSnapshotSchema, G as WorkflowRunStatusSchema, jr as WorkflowRunStepRowSchema, Ir as WorkflowRunTableRefSchema, Ar as WorkflowRunsInputSchema, qr as WorkflowSignalInputSchema, Er as WorkflowStartDeferralSchema, W as WorkflowStartTerminalOutcomeSchema, Jr as WorkflowUpdateInputSchema, Yr as WorkflowUpdateResultSchema, Fn as actionToRpc, xe as advisoryResourceGuardWarning, c as anonymousSubject, ma as applyPairing, zt as applyRowPatch, fe as applyScopeDecision, Ii as approvalsDecideDescriptor, Fi as approvalsPendingQueryDescriptor, pe as assertAuthenticated, sr as attachWorkflowAccess, bt as beginIdempotent, gr as checkFrameworkCompat, Ae as checkGuards, He as checkGuardsEffect, ga as clearPairing, ot as compareSurfaces, s as composeAuthStrategies, mr as composeRpcInterceptors, Zi as connectionDisconnectDescriptor, Yi as connectionStartDescriptor, Xi as connectionSubmitTokenDescriptor, Ji as connectionsListQueryDescriptor, cn as declaredReactivityChannelKeys, u as declaresResourceGuard, F as defineAction, Un as defineEvent, P as defineMutation, dr as definePlugin, fr as definePluginRoute, hr as definePluginService, N as defineQuery, Sn as defineStream, oa as defineWebSocket, Lt as diffRows, Ce as effectiveScopes, er as encodeEventKey, st as encodeRestError, et as encodeRestSuccess, Ln as errorMessage, R as errorTag, Kn as eventAttached, Wn as eventEnvelope, Gn as eventGap, Jn as eventResumePoint, nr as eventRoute, qn as eventStreamEvent, Yn as eventSubscribeInput, Xn as eventToRpc, Qe as failIdempotent, Gt as fieldIssuesOf, Fe as findAdvisoryResourceGuards, Ye as finishIdempotent, Vt as firstEventValue, ir as formatEventRoute, Je as freshFor, je as getPolicyGuardResolver, Te as getResourceScopeResolver, B as getWorkflowAccess, at as groupShapeDigests, xn as hasAccessDecision, ne as hasCallbackRoutes, we as hasEffectiveScope, I as hasEnforcedGuard, _e as hasScope, Xe as holdIdempotentClaim, v as idToPath, lt as idempotencyScope, Ht as inputLabel, ur as isApiUnavailable, Ue as isAuthenticatedCheck, bn as isAuthenticatedGuard, mn as isClientReachable, Hn as isEventDescriptor, Rt as isIdKeyed, Ie as isMachineSubject, p as isOpenAccess, be as isPolicyCheck, yn as isPolicyGuard, on as isReactivityChannel, sn as isReactivityChannelKey, Ge as isServiceAccess, hn as isServiceReachable, te as isServiceSubject, he as isSystemSubject, Pe as isTenantSelectable, A as isWireReachable, me as makeScopeCache, qe as memoryIdempotencyStore, ue as missingAccessDecision, Pn as mutationToRpc, pt as nextLink, Bn as normalizeDescriptor, un as normalizeSource, r as openAccessSpec, ge as orderByBearerPrefix, da as pairingLink, rr as parseEventRoute, fa as parsePairingLink, _ as patchCellSchema, y as pathToId, vr as pluginAlias, pr as pluginInstanceName, yr as pluginSlug, Cr as pluginTag, gt as problemDetails, nt as problemTypeOf, $e as procedureShapeDigest, fn as publishReactivity, it as publishServerError, Nn as queryToRpc, ce as rawImpersonationMark, an as reactivityChannel, ha as readPairing, xr as registerPluginAliases, Rn as reportableError, We as requireScope, Sr as resetPluginAliases, de as resolvePolicyAction, ut as resolveRestFormat, or as resolveWorkflowAccess, vt as restViewSchema, Nt as rowPatchOpSchema, Pt as rowPatchSchema, yt as schemaShape, e as scopeCacheKey, ze as selectSubjectTenant, a as serviceAccessSpec, i as serviceCallersOf, Se as serviceSubject, Ct as sessionValueFromHeaders, oe as setEffectiveScopes, ke as setPolicyGuardResolver, t as setResourceScopeResolver, St as shapeDigest, ln as sourceKeys, na as storeScreenshotPixels, ta as storeScreenshotPreset, ra as storeScreenshotPresetsFor, In as streamToRpc, x as strictInput, Ve as subjectAuditActorId, Ne as subjectIdentity, Oe as subjectScopes, mt as subscribeServerErrors, Bt as subscriptionEvent, Re as systemSubject, De as tenantScopedSubject, zn as toRpc, rt as toSnakeCase, Qi as tsMs, dn as undeclaredChannelKeys, wi as undoApplyDescriptor, Ci as undoLogQueryDescriptor, Ti as undoRedoDescriptor, pn as wireAudienceOf, L as wireErrorUnion, Mn as withRpcTag, dt as withheldServerError, cr as workflowAccessDescriptor, ni as workflowCancelDescriptor, Kr as workflowControlQueryDescriptor, ei as workflowDomainEventsQueryDescriptor, ti as workflowEventDeliveriesQueryDescriptor, Wr as workflowQueuedCancelDescriptor, Gr as workflowQueuedControlQueryDescriptor, ri as workflowResumeDescriptor, $r as workflowRunEventsQueryDescriptor, Xr as workflowRunQueryDescriptor, Qr as workflowRunStepsQueryDescriptor, Zr as workflowRunsQueryDescriptor, ii as workflowSignalDescriptor, Or as workflowToRpc, ai as workflowUpdateDescriptor, jn as workflowWireErrorUnion, ct as wsMutationIdempotencyScope };