@voltro/protocol 0.80.0 → 0.82.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 l, J as ee, K as te, L as ne, M as re, N as ie, O as ae, P as oe, Q as se, R as ce, S as le, T as ue, U as de, V as fe, W as pe, X as me, Y as he, Z as ge, _ as u, a as _e, b as d, c as ve, d as ye, f as be, g as xe, h as Se, i as Ce, j as we, k as Te, l as Ee, m as De, n as Oe, o as f, p as ke, q as Ae, r as je, s as Me, t as Ne, u as Pe, v as Fe, w as Ie, x as Le, y as Re, z as ze } from "./scopes-BbIyym8y.js";
2
- import { C as Be, D as Ve, E as He, S as Ue, T as We, _ as Ge, a as Ke, b as qe, c as Je, d as Ye, f as Xe, g as Ze, h as Qe, i as $e, l as et, m as tt, n as nt, o as rt, p as it, r as at, s as ot, t as st, u as ct, v as lt, w as ut, x as dt, y as ft } from "./restFormat-ChSVyufA.js";
3
- import { Context as pt, Layer as mt, Schema as p } from "effect";
4
- import { Rpc as m } from "@effect/rpc";
5
- import { VersionConflict as ht } 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 gt = p.Union(p.String, p.Number), h = p.Record({
8
- key: p.String,
9
- value: p.Unknown
10
- }).pipe(p.filter((e) => "id" in e, { message: () => "patch row must carry an id" })), _t = p.Union(p.Struct({
11
- op: p.Literal("add"),
12
- path: p.String,
13
- value: h
14
- }), p.Struct({
15
- op: p.Literal("replace"),
16
- path: p.String,
17
- value: h
18
- }), p.Struct({
19
- op: p.Literal("remove"),
20
- path: p.String
21
- }), p.Struct({
22
- op: p.Literal("mergeCells"),
23
- path: p.String,
24
- value: p.Record({
25
- key: p.String,
26
- value: p.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
- })), vt = p.Struct({
29
- ops: p.Array(_t),
30
- order: p.Array(gt)
31
- }), g = (e) => `/${String(e).replace(/~/g, "~0").replace(/\//g, "~1")}`, yt = (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), bt = (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
- }, xt = (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) || bt(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 gt = p.Union(p.String, p.Number), h = p.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
- }, St = (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
- }), Ct = (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 = yt(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
- }, y = (e) => p.Union(p.Struct({
125
- _tag: p.Literal("snapshot"),
126
- revision: p.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: p.optional(p.Boolean),
129
- reconciles: p.optional(p.String)
130
- }), p.Struct({
131
- _tag: p.Literal("delta"),
132
- revision: p.Number,
133
- emittedAt: p.Number,
134
- patch: vt
135
- }), p.Struct({
136
- _tag: p.Literal("error"),
137
- error: p.Unknown,
138
- revision: p.optional(p.Number)
139
- })), wt = (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
- }, b = (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
- }, Tt = (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
171
  }, x = (e, t, n) => {
158
- let r = b(t, n), i = e.annotations({
172
+ let r = Ht(t, n), i = e.annotations({
159
173
  parseOptions: { onExcessProperty: "error" },
160
174
  parseIssueTitle: () => r
161
175
  });
162
- return Tt(e) ? p.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
- }, Et = class extends p.TaggedError()("BusinessRuleViolation", {
164
- rule: p.String,
165
- params: p.optional(p.Record({
166
- key: p.String,
167
- value: p.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: p.optional(p.String),
170
- message: p.optional(p.String),
171
- severity: p.Literal("error", "warning")
172
- }) {}, Dt = p.Struct({
173
- field: p.String,
174
- message: p.String,
175
- params: p.optional(p.Record({
176
- key: p.String,
177
- value: p.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
- }), Ot = class extends p.TaggedError()("ValidationError", {
180
- field: p.String,
181
- message: p.String,
182
- params: p.optional(p.Record({
183
- key: p.String,
184
- value: p.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
- }) {}, kt = class extends p.TaggedError()("ValidationErrors", { issues: p.Array(Dt).pipe(p.minItems(1)) }) {}, At = (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 gt = p.Union(p.String, p.Number), h = p.Record({
209
223
  }];
210
224
  }
211
225
  return [];
212
- }, jt = class extends p.TaggedError()("ApprovalRequired", {
213
- approvalId: p.String,
214
- procedure: p.String,
215
- expiresAt: p.String,
216
- requiredScopes: p.Array(p.String),
217
- reason: p.NullOr(p.String),
218
- created: p.Boolean
219
- }) {}, Mt = class extends p.TaggedError()("ApprovalNotFound", { approvalId: p.String }) {}, Nt = class extends p.TaggedError()("ApprovalSelfApproval", {
220
- approvalId: p.String,
221
- subjectId: p.NullOr(p.String)
222
- }) {}, Pt = class extends p.TaggedError()("ApprovalRejected", {
223
- approvalId: p.String,
224
- decidedBy: p.NullOr(p.String),
225
- note: p.NullOr(p.String)
226
- }) {}, S = class extends p.TaggedError()("ApprovalExpired", {
227
- approvalId: p.String,
228
- expiredAt: p.String
229
- }) {}, Ft = class extends p.TaggedError()("ApprovalNotPending", {
230
- approvalId: p.String,
231
- status: p.String
232
- }) {}, It = class extends p.TaggedError()("ApprovalForbidden", {
233
- approvalId: p.String,
234
- required: p.NullOr(p.String),
235
- message: p.String
236
- }) {}, C = class extends p.TaggedError()("ApprovalUnavailable", {
237
- procedure: p.String,
238
- message: p.String
239
- }) {}, Lt = p.Union(jt, Pt, S, C), Rt = p.Union(Mt, Nt, S, Ft, It, C), zt = p.Struct({
240
- id: p.String,
241
- procedure: p.String,
242
- kind: p.Literal("mutation", "action"),
243
- requestedBy: p.NullOr(p.String),
244
- status: p.Literal("pending", "approved", "rejected", "expired", "consumed"),
245
- reason: p.NullOr(p.String),
246
- requiredScopes: p.Array(p.String),
247
- requestedAt: p.String,
248
- expiresAt: p.String,
249
- decidedBy: p.NullOr(p.String),
250
- decidedAt: p.NullOr(p.String),
251
- note: p.NullOr(p.String),
252
- relation: p.Literal("to-decide", "requested")
253
- }), w = "channel:", Bt = Symbol.for("@voltro/protocol/reactivityChannels"), Vt = globalThis, T = Vt[Bt] ?? (Vt[Bt] = /* @__PURE__ */ new Map()), Ht = /^[a-z][a-z0-9-]*(\.[a-z0-9-]+)*$/, Ut = (e) => {
254
- if (!Ht.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 (\`${w}<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 = T.get(e);
272
+ let t = O.get(e);
259
273
  if (t !== void 0) return t;
260
- let n = `${w}${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 T.set(e, r), r;
267
- }, Wt = (e) => typeof e == "object" && !!e && e.kind === "reactivity-channel", Gt = (e) => e.startsWith(w), Kt = () => new Set([...T.values()].map((e) => e.key)), E = (e) => Wt(e) ? e.key : e, qt = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map(E) : [E(e)], Jt = (e) => e === void 0 ? void 0 : Array.isArray(e) ? e.map(E) : E(e), Yt = (e) => {
268
- let t = Kt(), n = [];
269
- for (let r of e) for (let e of qt(r.source)) Gt(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
- }, Xt = (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 gt = p.Union(p.String, p.Number), h = p.Record({
280
294
  old: {},
281
295
  origin: "inline"
282
296
  }), !0);
283
- }, Zt = (e) => e.internal !== !0, D = (e) => {
284
- if (Qt(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,7 +319,27 @@ var gt = p.Union(p.String, p.Number), h = p.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
- }, Qt = (e) => {
322
+ }, _n = (e) => {
323
+ let t = e.service;
324
+ if (t === void 0) return;
325
+ let n = t.callers;
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'] }\`,
327
+ or drop \`service:\` if the procedure is meant for this app's own clients.`);
328
+ let r = n.filter((e) => typeof e != "string" || !gn.test(e));
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
330
+ lists in \`serviceCallers\` and the caller's credential resolves to.`);
331
+ if (new Set(n).size !== n.length) throw Error(`${e.name}: \`service.callers\` lists the same app twice`);
332
+ let i = [
333
+ e.internal === !0 ? "`internal: true` (it removes the wire surface a service calls over)" : void 0,
334
+ e.publicApi === void 0 ? void 0 : "`publicApi` (a REST route is for callers that are not the listed apps)",
335
+ e.exposeAsTool === void 0 ? void 0 : "`exposeAsTool` (an agent tool is not one of the listed apps)",
336
+ e.requiresApproval === void 0 ? void 0 : "`requiresApproval` (a second HUMAN cannot approve a machine call)",
337
+ e.overridesPlugin === !0 ? "`overridesPlugin` (a plugin route is a client surface; replacing it with a service-only one breaks its clients)" : void 0,
338
+ e.idempotencyScope === "connection" ? "`idempotencyScope: 'connection'` (a service call dedups per service, across reconnects)" : void 0
339
+ ].filter((e) => e !== void 0);
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
341
+ socket, with their service credential. Drop the other field, or drop \`service:\`.`);
342
+ }, vn = (e) => {
309
343
  let t = e.requiresApproval;
310
344
  if (t !== void 0) {
311
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
@@ -315,51 +349,59 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
315
349
  human from every other, and the second-pair-of-eyes control would enforce nothing.
316
350
  Give the procedure a \`guards:\` decision, or drop \`requiresApproval\`.`);
317
351
  }
318
- }, $t = (e) => e.action !== void 0 && e.resourceType !== void 0, en = (e) => e.authenticated === !0, tn = (e) => e.openAccess !== void 0 || e.guards !== void 0 && e.guards.length > 0, O = (e, t, n) => {
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) {
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
355
+ holds no scopes, and no user may call a service procedure. Keep exactly one.`);
356
+ return Array.isArray(i.callers) ? [a(i.callers)] : void 0;
357
+ }
319
358
  if (n === void 0) return t;
320
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
321
360
  without an authorization check — e.g. \`openAccess: 'public pricing, no caller data'\`.`);
322
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
323
362
  caller must hold a scope; drop them if anyone may call it.`);
324
- return [d(n.trim())];
325
- }, k = (e) => D({
363
+ return [r(n.trim())];
364
+ }, N = (e) => j({
326
365
  kind: "query",
327
366
  name: e.name,
328
367
  input: e.input,
329
368
  output: e.output,
330
- error: e.error ?? p.Never,
331
- source: Jt(e.source),
369
+ error: e.error ?? h.Never,
370
+ source: un(e.source),
332
371
  cache: e.cache,
333
- guards: O(e.name, e.guards, e.openAccess),
372
+ guards: M(e.name, e.guards, e.openAccess, e.service),
334
373
  openAccess: e.openAccess,
374
+ service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
335
375
  publicApi: e.publicApi,
336
376
  exposeAsTool: e.exposeAsTool,
337
377
  internal: e.internal,
338
378
  overridesPlugin: e.overridesPlugin
339
- }), A = (e) => D({
379
+ }), P = (e) => j({
340
380
  kind: "mutation",
341
381
  name: e.name,
342
382
  input: e.input,
343
383
  output: e.output,
344
- error: e.error ?? p.Never,
384
+ error: e.error ?? h.Never,
345
385
  ...e.idempotencyScope === void 0 ? {} : { idempotencyScope: e.idempotencyScope },
346
386
  ...e.serialize === void 0 ? {} : { serialize: e.serialize },
347
387
  target: e.target,
348
- guards: O(e.name, e.guards, e.openAccess),
388
+ guards: M(e.name, e.guards, e.openAccess, e.service),
349
389
  openAccess: e.openAccess,
390
+ service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
350
391
  publicApi: e.publicApi,
351
392
  exposeAsTool: e.exposeAsTool,
352
393
  requiresApproval: e.requiresApproval,
353
394
  internal: e.internal,
354
395
  overridesPlugin: e.overridesPlugin
355
- }), j = (e) => D({
396
+ }), F = (e) => j({
356
397
  kind: "action",
357
398
  name: e.name,
358
399
  input: e.input,
359
400
  output: e.output,
360
- error: e.error ?? p.Never,
361
- guards: O(e.name, e.guards, e.openAccess),
401
+ error: e.error ?? h.Never,
402
+ guards: M(e.name, e.guards, e.openAccess, e.service),
362
403
  openAccess: e.openAccess,
404
+ service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
363
405
  source: e.source,
364
406
  target: e.target,
365
407
  publicApi: e.publicApi,
@@ -367,54 +409,85 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
367
409
  requiresApproval: e.requiresApproval,
368
410
  internal: e.internal,
369
411
  overridesPlugin: e.overridesPlugin
370
- }), nn = (e) => D({
412
+ }), Sn = (e) => j({
371
413
  kind: "stream",
372
414
  name: e.name,
373
415
  input: e.input,
374
416
  element: e.element,
375
- error: e.error ?? p.Never,
417
+ error: e.error ?? h.Never,
376
418
  internal: e.internal,
377
419
  overridesPlugin: e.overridesPlugin,
378
- guards: O(e.name, e.guards, e.openAccess),
420
+ guards: M(e.name, e.guards, e.openAccess),
379
421
  openAccess: e.openAccess
380
- }), M = (e, t) => t && t.length > 0 ? p.Union(e, ...t) : e, N = (e) => e !== void 0 && e.some((e) => !u(e)), rn = (e) => p.Union(e, f, l), an = (e) => p.Union(e, Et), on = (e) => p.Union(e, Ot, kt), sn = (e, t) => t === void 0 ? e : p.Union(e, Lt), P = (e, t) => {
381
- let n = rn(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);
382
424
  if (t === "stream" || t === "query") return n;
383
- let r = t === "mutation" ? p.Union(an(n), dt, ht) : n;
384
- return sn(on(t === "mutation" && e.idempotencyScope === "connection" ? p.Union(r, qe) : r), e.requiresApproval);
385
- }, cn = (e, t) => M(rn(e.errorSchema), t), ln = (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) => ({
386
446
  ...e,
387
447
  name: t
388
- }), un = (e, t) => m.make(e.name, {
389
- payload: x(e.input, e.name, N(e.guards)),
390
- success: y(e.output),
391
- 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),
392
452
  stream: !0
393
- }), dn = (e, t) => m.make(e.name, {
394
- payload: x(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)),
395
455
  success: e.output,
396
- error: M(P(e, "mutation"), t)
397
- }), fn = (e, t) => m.make(e.name, {
398
- payload: x(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)),
399
459
  success: e.output,
400
- error: M(P(e, "action"), t)
401
- }), pn = (e, t) => m.make(e.name, {
402
- payload: x(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)),
403
463
  success: e.element,
404
- error: M(e.error, t),
464
+ error: L(e, "stream", t),
405
465
  stream: !0
406
- }), mn = (e) => {
466
+ }), R = (e) => {
407
467
  if (typeof e != "object" || !e) return;
408
468
  let t = e._tag;
409
469
  return typeof t == "string" ? t : void 0;
410
- }, hn = (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) => {
411
484
  switch (e.kind) {
412
- case "query": return un(e);
413
- case "mutation": return dn(e);
414
- case "action": return fn(e);
415
- case "stream": return pn(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);
416
489
  }
417
- }, gn = (e) => {
490
+ }, Bn = (e) => {
418
491
  let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r };
419
492
  if (e.kind === "query") return {
420
493
  kind: "query",
@@ -460,7 +533,7 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
460
533
  ..."relations" in e && e.relations !== void 0 ? { relations: e.relations } : {}
461
534
  }))
462
535
  };
463
- }, _n = 7500, vn = (e) => typeof e == "object" && !!e && e.kind === "event", yn = (e) => {
536
+ }, Vn = 7500, Hn = (e) => typeof e == "object" && !!e && e.kind === "event", Un = (e) => {
464
537
  if (e.name.length === 0) throw Error("defineEvent: `name` must not be empty");
465
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
466
539
  whitespace and delivers nothing — silently, and only on that broker, so an
@@ -489,68 +562,68 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
489
562
  name: e.name,
490
563
  key: e.key,
491
564
  payload: e.payload,
492
- guards: e.openAccess === void 0 ? e.guards : [d(e.openAccess.trim())],
565
+ guards: e.openAccess === void 0 ? e.guards : [r(e.openAccess.trim())],
493
566
  openAccess: e.openAccess,
494
567
  rewind: e.rewind,
495
568
  webhook: e.webhook,
496
569
  delivery: e.delivery
497
570
  };
498
- }, bn = (e) => p.Struct({
499
- _tag: p.Literal("event"),
500
- origin: p.String,
501
- n: p.Number,
502
- emittedAt: p.Number,
571
+ }, Wn = (e) => h.Struct({
572
+ _tag: h.Literal("event"),
573
+ origin: h.String,
574
+ n: h.Number,
575
+ emittedAt: h.Number,
503
576
  payload: e
504
- }), xn = p.Struct({
505
- _tag: p.Literal("gap"),
506
- missed: p.Number,
507
- reason: p.Literal("buffer", "resume")
508
- }), Sn = p.Struct({ _tag: p.Literal("attached") }), Cn = (e) => p.Union(Sn, bn(e), xn), wn = p.Struct({
509
- origin: p.String,
510
- n: p.Number
511
- }), Tn = (e) => p.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({
512
585
  key: e,
513
- resume: p.optional(p.Array(wn))
514
- }), En = (e, t) => {
515
- let n = e.guards !== void 0 && e.guards.some((e) => !u(e)) ? p.Union(f, l) : l, r = t && t.length > 0 ? p.Union(n, ...t) : n;
516
- return m.make(e.name, {
517
- payload: x(Tn(e.key), e.name, N(e.guards)),
518
- success: Cn(e.payload),
519
- 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,
520
593
  stream: !0
521
594
  });
522
- }, Dn = class extends p.TaggedError()("EventPayloadInvalid", {
523
- event: p.String,
524
- message: p.String
525
- }) {}, On = class extends p.TaggedError()("EventKeyInvalid", {
526
- event: p.String,
527
- message: p.String
528
- }) {}, kn = class extends p.TaggedError()("EventPayloadTooLarge", {
529
- event: p.String,
530
- bytes: p.Number,
531
- limit: p.Number
532
- }) {}, An = (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) => {
533
606
  if (typeof e != "object" || !e) return JSON.stringify(e) ?? "null";
534
607
  let t = Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t));
535
608
  return JSON.stringify(t);
536
- }, jn = "\0", Mn = (e, t, n) => [
609
+ }, tr = "\0", nr = (e, t, n) => [
537
610
  e ?? "~",
538
611
  t,
539
- An(n)
540
- ].join("\0"), Nn = (e) => {
612
+ er(n)
613
+ ].join("\0"), rr = (e) => {
541
614
  let [t = "~", n = "", r = ""] = e.split("\0");
542
615
  return {
543
616
  tenantId: t === "~" ? null : t,
544
617
  event: n,
545
618
  key: r
546
619
  };
547
- }, Pn = (e) => e.split("\0").join(" · "), F = Symbol.for("@voltro/protocol/workflow-access"), Fn = {
620
+ }, ir = (e) => e.split("\0").join(" · "), z = Symbol.for("@voltro/protocol/workflow-access"), ar = {
548
621
  guards: void 0,
549
622
  openAccess: void 0,
550
623
  internal: !1,
551
624
  controls: void 0,
552
625
  controlsOpenAccess: void 0
553
- }, In = (e, t) => {
626
+ }, or = (e, t) => {
554
627
  let n = t.guards;
555
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
556
629
  and decide with \`openAccess\` or \`internal\`, or list the scopes that may start it.`);
@@ -565,34 +638,34 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
565
638
  \`openAccess\` (an internal workflow needs no wire decision), or drop
566
639
  \`internal: true\` if the workflow really is meant to be startable by clients.`);
567
640
  }
568
- let r = t.controls?.guards, i = t.controls?.openAccess;
569
- 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
570
643
  \`controls\` (wire control is then refused for everyone but \`admin:full\`), or
571
644
  list the scopes a caller needs to cancel or signal a run.`);
572
- if (i !== void 0) {
573
- 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
574
647
  run should be able to cancel or signal it — e.g. \`controls: { openAccess:
575
648
  'the run belongs to the caller who started it; cancelling it affects nobody else' }\`.`);
576
- 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.`);
577
650
  }
578
651
  return {
579
- guards: t.openAccess === void 0 ? t.guards : [d(t.openAccess.trim())],
652
+ guards: t.openAccess === void 0 ? t.guards : [r(t.openAccess.trim())],
580
653
  openAccess: t.openAccess?.trim(),
581
654
  internal: t.internal === !0,
582
- controls: i === void 0 ? r : [d(i.trim())],
583
- controlsOpenAccess: i?.trim()
655
+ controls: a === void 0 ? i : [r(a.trim())],
656
+ controlsOpenAccess: a?.trim()
584
657
  };
585
- }, Ln = (e, t) => {
586
- Object.defineProperty(e, F, {
658
+ }, sr = (e, t) => {
659
+ Object.defineProperty(e, z, {
587
660
  value: t,
588
661
  enumerable: !1
589
662
  });
590
- }, I = (e) => {
591
- if (typeof e != "object" || !e) return Fn;
592
- let t = e[F];
593
- return t === void 0 ? Fn : t;
594
- }, Rn = (e) => {
595
- 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);
596
669
  return {
597
670
  name: e.name,
598
671
  internal: t.internal,
@@ -600,20 +673,25 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
600
673
  openAccess: t.openAccess,
601
674
  controls: t.controls
602
675
  };
603
- }, zn = (e) => e, Bn = (e) => e, Vn = (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) => {
604
682
  let t = e.alias?.trim(), n = e.instance?.trim(), r = t !== void 0 && t !== "" ? t : e.base;
605
683
  return n !== void 0 && n !== "" ? `${r}#${n}` : r;
606
- }, Hn = (e) => {
684
+ }, mr = (e) => {
607
685
  if (e.length !== 0) return (t, n) => e.reduceRight((e, t) => t(e, n), t);
608
- }, Un = (e, t) => {
609
- let n = pt.GenericTag(e);
686
+ }, hr = (e, t) => {
687
+ let n = Tt.GenericTag(e);
610
688
  return {
611
689
  Tag: n,
612
- Live: mt.succeed(n, t)
690
+ Live: Ot.succeed(n, t)
613
691
  };
614
- }, Wn = (e, t, n) => {
692
+ }, gr = (e, t, n) => {
615
693
  if (!t) return { ok: !0 };
616
- let r = n === void 0 ? null : L(n);
694
+ let r = n === void 0 ? null : V(n);
617
695
  if (!r) return {
618
696
  ok: !0,
619
697
  unverified: `plugin "${e}" requires framework ${t}, but the running framework version is ${n === void 0 ? "unknown" : `unreadable ("${n}")`} — not checked.`
@@ -621,12 +699,12 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
621
699
  let i = t.trim();
622
700
  if (i === "*" || i === "") return { ok: !0 };
623
701
  let a = i.split(/\s+/).filter((e) => e.length > 0);
624
- for (let i of a) if (!Gn(i, r)) return {
702
+ for (let i of a) if (!_r(i, r)) return {
625
703
  ok: !1,
626
704
  reason: `plugin "${e}" requires framework ${t}, running ${n}`
627
705
  };
628
706
  return { ok: !0 };
629
- }, L = (e) => {
707
+ }, V = (e) => {
630
708
  let t = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9a-zA-Z.-]+))?$/.exec(e.trim());
631
709
  return t ? {
632
710
  major: Number(t[1]),
@@ -634,109 +712,109 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
634
712
  patch: Number(t[3]),
635
713
  pre: t[4] ?? ""
636
714
  } : null;
637
- }, 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, Gn = (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) => {
638
716
  if (e === "*") return !0;
639
717
  if (e.startsWith("^")) {
640
- let n = L(e.slice(1));
641
- 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;
642
720
  }
643
721
  if (e.startsWith("~")) {
644
- let n = L(e.slice(1));
645
- 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;
646
724
  }
647
725
  let n = /^(>=|<=|>|<)(.+)$/.exec(e);
648
726
  if (n) {
649
- let e = n[1], r = L(n[2]);
727
+ let e = n[1], r = V(n[2]);
650
728
  if (!r) return !1;
651
- let i = R(t, r);
729
+ let i = H(t, r);
652
730
  if (e === ">=") return i >= 0;
653
731
  if (e === "<=") return i <= 0;
654
732
  if (e === ">") return i > 0;
655
733
  if (e === "<") return i < 0;
656
734
  }
657
- let r = L(e);
658
- return r ? R(t, r) === 0 : !1;
659
- }, Kn = (e) => {
735
+ let r = V(e);
736
+ return r ? H(t, r) === 0 : !1;
737
+ }, vr = (e) => {
660
738
  let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
661
739
  return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/-([a-zA-Z0-9])/g, (e, t) => t.toUpperCase());
662
- }, qn = (e) => {
740
+ }, yr = (e) => {
663
741
  let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
664
742
  return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/#/g, "--").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
665
- }, Jn = Symbol.for("@voltro/protocol/pluginAliases"), z = () => {
666
- let e = globalThis, t = e[Jn];
743
+ }, br = Symbol.for("@voltro/protocol/pluginAliases"), U = () => {
744
+ let e = globalThis, t = e[br];
667
745
  if (t instanceof Map) return t;
668
746
  let n = /* @__PURE__ */ new Map();
669
- return e[Jn] = n, n;
670
- }, Yn = (e) => {
671
- let t = z();
747
+ return e[br] = n, n;
748
+ }, xr = (e) => {
749
+ let t = U();
672
750
  for (let [n, r] of Object.entries(e)) {
673
751
  if (r === "") continue;
674
752
  let e = t.get(n);
675
753
  e === void 0 ? t.set(n, /* @__PURE__ */ new Set([r])) : e.add(r);
676
754
  }
677
- }, Xn = () => {
678
- z().clear();
679
- }, Zn = (e, t) => {
680
- let n = z().get(e);
681
- if (n === void 0 || n.size === 0) return `${Kn(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}`;
682
760
  if (n.size === 1) return `${[...n][0]}.${t}`;
683
761
  let r = [...n].filter((e) => !e.includes("#"));
684
762
  if (r.length === 1) return `${r[0]}.${t}`;
685
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}').`);
686
- }, B = p.Union(p.Struct({
687
- kind: p.Literal("dropped"),
688
- at: p.Number,
689
- retryAfterMs: p.Number
690
- }), p.Struct({
691
- kind: p.Literal("skipped"),
692
- at: p.Number,
693
- executionId: p.String,
694
- runId: p.String
695
- }), p.Struct({
696
- kind: p.Literal("superseded"),
697
- at: p.Number
698
- }), p.Struct({
699
- kind: p.Literal("cancelled"),
700
- at: p.Number
701
- }), p.Struct({
702
- kind: p.Literal("abandoned"),
703
- at: p.Number,
704
- failureId: p.NonEmptyString
705
- })), V = p.Literal("running", "succeeded", "failed", "cancelled", "suspended"), H = p.Struct({
706
- id: p.String,
707
- workflowName: p.String,
708
- executionId: p.String,
709
- status: p.Union(V, p.Literal("unknown")),
710
- output: p.optional(p.Unknown),
711
- error: p.optional(p.Struct({
712
- tag: p.NullOr(p.String),
713
- message: p.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
714
792
  }))
715
- }), U = p.Struct({
716
- operation: p.Literal("cancel", "resume"),
717
- kind: p.Literal("accepted", "confirmed", "unknown", "already-terminal"),
718
- requestId: p.NullOr(p.NonEmptyString),
719
- snapshot: H
720
- }).pipe(p.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 = p.Struct({
721
- operation: p.Literal("cancel"),
722
- workflowName: p.NonEmptyString,
723
- receiptId: p.NonEmptyString,
724
- requestId: p.NullOr(p.NonEmptyString),
725
- kind: p.Literal("accepted", "confirmed", "unknown", "already-terminal"),
726
- observation: p.Union(p.Struct({ kind: p.Literal("pending") }), p.Struct({
727
- kind: p.Literal("admission"),
728
- outcome: p.Union(B, p.Struct({
729
- kind: p.Literal("rejected"),
730
- failureId: p.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
731
809
  }))
732
- }), p.Struct({
733
- kind: p.Literal("execution"),
734
- snapshot: H
735
- }), p.Struct({
736
- kind: p.Literal("unavailable"),
737
- reason: p.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")
738
816
  }))
739
- }).pipe(p.filter((e) => {
817
+ }).pipe(h.filter((e) => {
740
818
  let t = e.observation;
741
819
  if (t.kind === "unavailable") return e.kind === "unknown" && (t.reason === "missing-request" ? e.requestId === null : e.requestId !== null);
742
820
  if (e.requestId === null) return !1;
@@ -744,307 +822,342 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
744
822
  if (t.kind === "admission") return e.kind === (t.outcome.kind === "cancelled" ? "confirmed" : "already-terminal");
745
823
  let n = t.snapshot;
746
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");
747
- }, { message: () => "Queued cancellation acknowledgement contradicts its receipt or observation" })), Qn = p.Literal("cancel", "terminate", "abandon"), $n = p.Struct({
748
- mode: p.String,
749
- dueAt: p.NullOr(p.Number),
750
- retryAfterMs: p.NullOr(p.Number),
751
- intentId: p.NullOr(p.String)
752
- }), er = p.Struct({
753
- id: p.String,
754
- workflowName: p.String,
755
- executionId: p.NullOr(p.String),
756
- status: p.Literal("running", "succeeded", "queued", "dropped", "skipped", "replayed"),
757
- deferral: p.optional($n)
758
- }), tr = (e, t) => {
759
- let n = I(e);
760
- return m.make(e.name, {
761
- payload: x(e.payloadSchema, e.name, N(n.guards)),
762
- success: er,
763
- error: cn({
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({
764
842
  errorSchema: e.errorSchema,
765
843
  guards: n.guards
766
844
  }, t)
767
845
  });
768
- }, G = p.Struct({
769
- id: p.String,
770
- tag: p.String,
771
- executionId: p.String,
772
- status: V,
773
- payload: p.Unknown,
774
- workflowVersion: p.NullOr(p.String),
775
- workflowPatches: p.NullOr(p.Unknown),
776
- output: p.NullOr(p.Unknown),
777
- subject: p.NullOr(p.Unknown),
778
- source: p.NullOr(p.String),
779
- errorTag: p.NullOr(p.String),
780
- errorMessage: p.NullOr(p.String),
781
- cancelled: p.Boolean,
782
- startedAt: p.Date,
783
- completedAt: p.NullOr(p.Date),
784
- durationMs: p.NullOr(p.Number),
785
- traceId: p.NullOr(p.String),
786
- parentExecutionId: p.NullOr(p.String),
787
- parentClosePolicy: p.NullOr(Qn)
788
- }), nr = p.Struct({
789
- tag: p.optional(p.String),
790
- status: p.optional(V),
791
- limit: p.optional(p.Number)
792
- }), rr = p.Struct({
793
- id: p.String,
794
- runId: p.String,
795
- stepName: p.String,
796
- attempt: p.Number,
797
- status: p.Literal("running", "succeeded", "failed"),
798
- input: p.NullOr(p.Unknown),
799
- retryPolicy: p.NullOr(p.Unknown),
800
- output: p.NullOr(p.Unknown),
801
- errorTag: p.NullOr(p.String),
802
- errorMessage: p.NullOr(p.String),
803
- errorCause: p.NullOr(p.Unknown),
804
- startedAt: p.Date,
805
- completedAt: p.NullOr(p.Date),
806
- durationMs: p.NullOr(p.Number)
807
- }), ir = p.Struct({
808
- id: p.String,
809
- runId: p.String,
810
- eventType: p.String,
811
- payload: p.NullOr(p.Unknown),
812
- occurredAt: p.Date,
813
- stepName: p.NullOr(p.String),
814
- attempt: p.NullOr(p.Number)
815
- }), ar = p.Struct({
816
- id: p.String,
817
- name: p.String,
818
- payload: p.Unknown,
819
- source: p.String,
820
- subject: p.NullOr(p.Unknown),
821
- traceId: p.NullOr(p.String),
822
- occurredAt: p.Date
823
- }), or = p.Struct({
824
- id: p.String,
825
- eventId: p.String,
826
- eventName: p.String,
827
- triggerId: p.String,
828
- workflowName: p.String,
829
- executionId: p.NullOr(p.String),
830
- status: p.Literal("starting", "started", "skipped", "failed"),
831
- idempotencyKey: p.String,
832
- skipped: p.Boolean,
833
- errorMessage: p.NullOr(p.String),
834
- createdAt: p.Date,
835
- completedAt: p.NullOr(p.Date)
836
- }), sr = p.Struct({ id: p.String }), K = p.Struct({ runId: p.String }), cr = p.Struct({
837
- name: p.optional(p.String),
838
- limit: p.optional(p.Number)
839
- }), lr = p.Struct({ eventId: p.String }), q = p.Struct({
840
- requestId: p.NonEmptyString,
841
- cause: p.optionalWith(p.Struct({
842
- reason: p.NonEmptyString,
843
- detail: p.optional(p.Record({
844
- key: p.String,
845
- value: p.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
846
924
  }))
847
925
  }), { exact: !0 })
848
- }), J = p.Struct({
849
- workflowName: p.String,
850
- executionId: p.String,
851
- control: p.optional(q)
852
- }), ur = p.Struct({
853
- workflowName: p.NonEmptyString,
854
- executionId: p.NonEmptyString,
855
- operation: p.Literal("cancel", "resume"),
856
- requestId: p.NonEmptyString
857
- }), Y = p.Struct({
858
- workflowName: p.NonEmptyString,
859
- receiptId: p.NonEmptyString,
860
- requestId: p.NonEmptyString
861
- }), dr = p.Struct({
862
- ...Y.fields,
863
- cause: q.fields.cause
864
- }), fr = 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({
865
943
  name: "__voltro.workflow.queued.cancel",
866
- input: dr,
867
- output: W,
944
+ input: Ur,
945
+ output: wr,
868
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"
869
- }), pr = k({
947
+ }), Gr = N({
870
948
  name: "__voltro.workflow.queued.control",
871
- input: Y,
872
- output: W,
949
+ input: Hr,
950
+ output: wr,
873
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"
874
- }), mr = k({
952
+ }), Kr = N({
875
953
  name: "__voltro.workflow.control",
876
- input: ur,
877
- output: U,
954
+ input: Vr,
955
+ output: q,
878
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"
879
- }), hr = p.Struct({
880
- id: p.String,
881
- signalName: p.String,
882
- payload: p.optional(p.Unknown)
883
- }), gr = p.Struct({
884
- id: p.String,
885
- updateName: p.String,
886
- payload: p.optional(p.Unknown),
887
- timeoutMs: p.optional(p.Number)
888
- }), _r = p.Struct({
889
- eventId: p.String,
890
- updateId: p.String,
891
- completedEventId: p.String,
892
- result: p.Unknown
893
- }), vr = 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({
894
972
  name: "__voltro.workflow.run",
895
973
  source: "_voltro_workflow_runs",
896
- input: sr,
897
- output: p.Array(G),
974
+ input: Fr,
975
+ output: h.Array(kr),
898
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"
899
- }), yr = k({
977
+ }), Zr = N({
900
978
  name: "__voltro.workflow.runs",
901
979
  source: "_voltro_workflow_runs",
902
- input: nr,
903
- output: p.Array(G),
980
+ input: Ar,
981
+ output: h.Array(kr),
904
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"
905
- }), br = k({
983
+ }), Qr = N({
906
984
  name: "__voltro.workflow.run.steps",
907
985
  source: "_voltro_workflow_run_steps",
908
- input: K,
909
- output: p.Array(rr),
986
+ input: Ir,
987
+ output: h.Array(jr),
910
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"
911
- }), xr = k({
989
+ }), $r = N({
912
990
  name: "__voltro.workflow.run.events",
913
991
  source: "_voltro_workflow_run_events",
914
- input: K,
915
- output: p.Array(ir),
992
+ input: Ir,
993
+ output: h.Array(Mr),
916
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"
917
- }), Sr = k({
995
+ }), ei = N({
918
996
  name: "__voltro.workflow.domainEvents",
919
997
  source: "_voltro_workflow_events",
920
- input: cr,
921
- output: p.Array(ar),
998
+ input: Lr,
999
+ output: h.Array(Nr),
922
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"
923
- }), Cr = k({
1001
+ }), ti = N({
924
1002
  name: "__voltro.workflow.event.deliveries",
925
1003
  source: "_voltro_workflow_event_deliveries",
926
- input: lr,
927
- output: p.Array(or),
1004
+ input: Rr,
1005
+ output: h.Array(Pr),
928
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"
929
- }), wr = j({
1007
+ }), ni = F({
930
1008
  name: "__voltro.workflow.cancel",
931
- input: J,
932
- output: U,
1009
+ input: Br,
1010
+ output: q,
933
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"
934
- }), Tr = j({
1012
+ }), ri = F({
935
1013
  name: "__voltro.workflow.resume",
936
- input: J,
937
- output: U,
1014
+ input: Br,
1015
+ output: q,
938
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"
939
- }), Er = j({
1017
+ }), ii = F({
940
1018
  name: "__voltro.workflow.signal",
941
- input: hr,
942
- output: p.Struct({ eventId: p.String }),
1019
+ input: qr,
1020
+ output: h.Struct({ eventId: h.String }),
943
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"
944
- }), Dr = j({
1022
+ }), ai = F({
945
1023
  name: "__voltro.workflow.update",
946
- input: gr,
947
- output: _r,
1024
+ input: Jr,
1025
+ output: Yr,
948
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"
949
- }), Or = p.NonEmptyString.pipe(p.filter((e) => e.trim().length > 0, { message: () => "A workflow retry identity must not be blank" })), kr = p.Struct({
950
- runId: Or,
951
- requestId: Or
952
- }), Ar = p.Struct({
953
- ...kr.fields,
954
- payloadOverride: p.optional(p.Unknown)
955
- }), X = {
956
- requestId: p.NonEmptyString,
957
- originalRunId: p.NonEmptyString,
958
- originalExecutionId: p.NonEmptyString,
959
- workflowName: p.NonEmptyString
960
- }, jr = p.Union(p.Struct({
961
- ...X,
962
- kind: p.Literal("queued"),
963
- nextAttemptAt: p.NullOr(p.Number)
964
- }), p.Struct({
965
- ...X,
966
- kind: p.Literal("accepted"),
967
- executionId: p.NonEmptyString
968
- }).pipe(p.filter((e) => e.executionId !== e.originalExecutionId, { message: () => "A retry cannot accept its original execution identity" })), p.Struct({
969
- ...X,
970
- kind: p.Literal("unconfirmed"),
971
- automaticRetryStopped: p.Boolean,
972
- nextAttemptAt: p.NullOr(p.Number)
973
- }).pipe(p.filter((e) => !e.automaticRetryStopped || e.nextAttemptAt === null, { message: () => "Stopped automatic retries cannot have a next attempt" })), p.Struct({
974
- ...X,
975
- kind: p.Literal("not-started"),
976
- outcome: B
977
- }), p.Struct({
978
- ...X,
979
- kind: p.Literal("rejected"),
980
- failureId: p.NonEmptyString
981
- })), Mr = "__voltro.undo.log", Nr = "__voltro.undo.apply", Pr = "__voltro.undo.redo", Fr = p.Struct({
982
- id: p.String,
983
- tag: p.String,
984
- label: p.NullOr(p.String),
985
- undone: p.Boolean,
986
- crossesAction: p.Boolean,
987
- createdAt: p.String
988
- }), Ir = class extends p.TaggedError()("UndoNotFound", { invocationId: p.String }) {}, Lr = class extends p.TaggedError()("UndoForbidden", { invocationId: p.String }) {}, Rr = class extends p.TaggedError()("UndoConflict", {
989
- invocationId: p.String,
990
- reason: p.Literal("conflict", "action")
991
- }) {}, zr = p.Union(Ir, Lr, Rr), Br = k({
992
- name: Mr,
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,
993
1106
  source: "_voltro_undo_log",
994
- input: p.Struct({ limit: p.optional(p.Number) }),
995
- output: p.Array(Fr),
1107
+ input: h.Struct({ limit: h.optional(h.Number) }),
1108
+ output: h.Array(vi),
996
1109
  openAccess: "subject-scoped by construction: lists only the calling subject's own undoable actions"
997
- }), Vr = A({
998
- name: Nr,
999
- input: p.Struct({ invocationId: p.String }),
1000
- output: p.Struct({ ok: p.Boolean }),
1001
- error: zr,
1110
+ }), wi = P({
1111
+ name: gi,
1112
+ input: h.Struct({ invocationId: h.String }),
1113
+ output: h.Struct({ ok: h.Boolean }),
1114
+ error: Si,
1002
1115
  openAccess: "subject-scoped by construction: undo is per-actor — another subject's invocation fails typed with UndoForbidden"
1003
- }), Hr = A({
1004
- name: Pr,
1005
- input: p.Struct({ invocationId: p.String }),
1006
- output: p.Struct({ ok: p.Boolean }),
1007
- error: zr,
1116
+ }), Ti = P({
1117
+ name: _i,
1118
+ input: h.Struct({ invocationId: h.String }),
1119
+ output: h.Struct({ ok: h.Boolean }),
1120
+ error: Si,
1008
1121
  openAccess: "subject-scoped by construction: redo is per-actor — another subject's invocation fails typed with UndoForbidden"
1009
- }), Ur = class extends p.TaggedError()("TenantScopeViolation", {
1010
- table: p.String,
1011
- reason: p.String
1012
- }) {}, Wr = class extends p.TaggedError()("StoreOperationFailed", {
1013
- operation: p.String,
1014
- table: p.String,
1015
- cause: p.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
1016
1129
  }) {
1017
1130
  get message() {
1018
1131
  return `${this.operation} on '${this.table}' failed: ${this.cause}`;
1019
1132
  }
1020
- }, Gr = class extends p.TaggedError()("NoRowFound", {
1021
- table: p.String,
1022
- found: p.Number
1133
+ }, Oi = class extends h.TaggedError()("NoRowFound", {
1134
+ table: h.String,
1135
+ found: h.Number
1023
1136
  }) {
1024
1137
  get message() {
1025
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`;
1026
1139
  }
1027
- }, Kr = class extends p.TaggedError()("TableValidationFailed", {
1028
- table: p.String,
1029
- summary: p.String,
1030
- issues: p.Array(p.Struct({
1031
- path: p.String,
1032
- message: p.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
1033
1146
  }))
1034
- }) {}, qr = class extends p.TaggedError()("TenantRowNotFound", {
1035
- table: p.String,
1036
- id: p.String,
1037
- reason: p.String
1038
- }) {}, Jr = class extends p.TaggedError()("ServerOnlyColumnWrite", {
1039
- table: p.String,
1040
- columns: p.Array(p.String)
1041
- }) {}, Yr = class extends p.TaggedError()("ConstraintViolation", {
1042
- kind: p.Literal("foreignKey", "foreignKeyInUse", "unique", "notNull", "check"),
1043
- table: p.String,
1044
- operation: p.String,
1045
- constraint: p.optional(p.String),
1046
- column: p.optional(p.String),
1047
- detail: p.optional(p.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)
1048
1161
  }) {
1049
1162
  get message() {
1050
1163
  if (this.detail !== void 0) return this.detail;
@@ -1057,86 +1170,243 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
1057
1170
  case "check": return `check constraint ${t}: the row does not satisfy it`;
1058
1171
  }
1059
1172
  }
1060
- }, Xr = "__voltro.approvals.pending", Zr = "__voltro.approvals.decide", Qr = k({
1061
- name: Xr,
1173
+ }, Ni = "__voltro.approvals.pending", Pi = "__voltro.approvals.decide", Fi = N({
1174
+ name: Ni,
1062
1175
  source: "_voltro_approvals",
1063
- input: p.Struct({ limit: p.optional(p.Number) }),
1064
- output: p.Array(zt),
1176
+ input: h.Struct({ limit: h.optional(h.Number) }),
1177
+ output: h.Array(en),
1065
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"
1066
- }), $r = A({
1067
- name: Zr,
1068
- input: p.Struct({
1069
- approvalId: p.String,
1070
- decision: p.Literal("approve", "reject"),
1071
- note: p.optional(p.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)
1072
1185
  }),
1073
- output: p.Struct({
1074
- approvalId: p.String,
1075
- status: p.Literal("approved", "rejected")
1186
+ output: h.Struct({
1187
+ approvalId: h.String,
1188
+ status: h.Literal("approved", "rejected")
1076
1189
  }),
1077
- error: Rt,
1190
+ error: $t,
1078
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"
1079
- }), Z = "__voltro.connections.list", ei = "__voltro.connections.start", ti = "__voltro.connections.submitToken", ni = "__voltro.connections.disconnect", Q = p.Literal("oauth2", "pat"), ri = p.Literal("disconnected", "connected", "expired", "revoked", "error"), ii = p.Struct({
1080
- connectionId: p.String,
1081
- kind: Q,
1082
- label: p.String,
1083
- status: ri,
1084
- accountId: p.NullOr(p.String),
1085
- accountLabel: p.NullOr(p.String),
1086
- scopes: p.Array(p.String),
1087
- expiresAt: p.NullOr(p.String),
1088
- lastError: p.NullOr(p.String),
1089
- connectedAt: p.NullOr(p.String)
1090
- }), ai = class extends p.TaggedError()("ConnectionNotDeclared", { connectionId: p.String }) {}, oi = class extends p.TaggedError()("ConnectionSubjectRequired", { connectionId: p.String }) {}, si = class extends p.TaggedError()("ConnectionKindMismatch", {
1091
- connectionId: p.String,
1092
- expected: Q,
1093
- actual: Q
1094
- }) {}, ci = class extends p.TaggedError()("ConnectionHandshakeFailed", {
1095
- connectionId: p.String,
1096
- reason: p.String,
1097
- transient: p.Boolean
1098
- }) {}, $ = p.Union(ai, oi, si, ci), li = k({
1099
- name: Z,
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,
1100
1213
  source: "_voltro_connections",
1101
- input: p.Struct({}),
1102
- output: p.Array(ii),
1214
+ input: h.Struct({}),
1215
+ output: h.Array(Hi),
1103
1216
  openAccess: "self-scoped read: projects the declared connections for the calling subject only (its own connect/disconnect state)"
1104
- }), ui = j({
1105
- name: ei,
1106
- input: p.Struct({
1107
- connectionId: p.String,
1108
- redirectTo: p.optional(p.String)
1217
+ }), Yi = F({
1218
+ name: Ri,
1219
+ input: h.Struct({
1220
+ connectionId: h.String,
1221
+ redirectTo: h.optional(h.String)
1109
1222
  }),
1110
- output: p.Struct({
1111
- authorizeUrl: p.String,
1112
- state: p.String
1223
+ output: h.Struct({
1224
+ authorizeUrl: h.String,
1225
+ state: h.String
1113
1226
  }),
1114
- error: $,
1227
+ error: qi,
1115
1228
  openAccess: "self-service: begins an oauth handshake that stores a credential for the calling subject only; anonymous callers fail typed with ConnectionSubjectRequired"
1116
- }), di = A({
1117
- name: ti,
1118
- input: p.Struct({
1119
- connectionId: p.String,
1120
- token: p.String
1229
+ }), Xi = P({
1230
+ name: zi,
1231
+ input: h.Struct({
1232
+ connectionId: h.String,
1233
+ token: h.String
1121
1234
  }),
1122
- output: p.Struct({ ok: p.Boolean }),
1123
- error: $,
1235
+ output: h.Struct({ ok: h.Boolean }),
1236
+ error: qi,
1124
1237
  openAccess: "self-service: stores a pasted token as the calling subject's own credential; anonymous callers fail typed with ConnectionSubjectRequired"
1125
- }), fi = A({
1126
- name: ni,
1127
- input: p.Struct({ connectionId: p.String }),
1128
- output: p.Struct({ ok: p.Boolean }),
1129
- error: $,
1238
+ }), Zi = P({
1239
+ name: Bi,
1240
+ input: h.Struct({ connectionId: h.String }),
1241
+ output: h.Struct({ ok: h.Boolean }),
1242
+ error: qi,
1130
1243
  openAccess: "self-service: deletes only the calling subject's own credential row for this connection"
1131
- }), pi = (e) => {
1244
+ }), Qi = (e) => {
1132
1245
  let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : typeof e == "string" ? new Date(e).getTime() : 0;
1133
1246
  return Number.isNaN(t) ? 0 : t;
1134
- }, mi = 4001, hi = /* @__PURE__ */ new Set(["/rpc", "/ws"]), gi = (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) => {
1135
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`);
1136
1335
  if (!e.path.startsWith("/")) throw Error(`defineWebSocket: path must be absolute, got '${e.path}'`);
1137
- if (hi.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`);
1138
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)}'`);
1139
1338
  return e;
1140
- }, _i = 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;
1141
1411
  //#endregion
1142
- export { Ne as ADMIN_SCOPE, Oe as APIKEY_ISSUE_ORG_SCOPE, je as APIKEY_ISSUE_OTHER_SCOPE, Ce as APIKEY_ISSUE_SELF_SCOPE, Zr as APPROVALS_DECIDE_TAG, Xr as APPROVALS_PENDING_TAG, Rt as ApprovalDecisionErrors, Lt as ApprovalErrors, S as ApprovalExpired, It as ApprovalForbidden, Mt as ApprovalNotFound, Ft as ApprovalNotPending, Pt as ApprovalRejected, jt as ApprovalRequired, Nt as ApprovalSelfApproval, C as ApprovalUnavailable, i as AuthMiddleware, Et as BusinessRuleViolation, Z as CONNECTIONS_LIST_TAG, ni as CONNECTION_DISCONNECT_TAG, ei as CONNECTION_START_TAG, ti as CONNECTION_SUBMIT_TOKEN_TAG, ci as ConnectionHandshakeFailed, ae as ConnectionInfo, Te as ConnectionInfoMiddleware, Q as ConnectionKind, si as ConnectionKindMismatch, ai as ConnectionNotDeclared, ii as ConnectionState, ri as ConnectionStatus, oi as ConnectionSubjectRequired, Yr as ConstraintViolation, t as DEFAULT_SCOPE_CACHE_MAX_ENTRIES, we as DEFAULT_SCOPE_CACHE_TTL_MS, _e as DEVICES_MANAGE_SCOPE, jn as EVENT_ROUTE_SEP, On as EventKeyInvalid, Dn as EventPayloadInvalid, kn as EventPayloadTooLarge, mi as GATEWAY_CREDENTIAL_EXPIRED_CLOSE_CODE, re as IMPERSONATION_METADATA_KEY, st as JSONAPI_MEDIA_TYPE, _n as MAX_EVENT_ENVELOPE_BYTES, ft as MUTATION_IN_FLIGHT_RETRY_AFTER_MS, qe as MutationConnectionRequired, dt as MutationInFlight, Gr as NoRowFound, nt as PROBLEM_JSON, _i as PROTOCOL_VERSION, zt as PendingApproval, w as REACTIVITY_CHANNEL_PREFIX, at as REST_PROFILE_NAMES, f as ScopeError, Jr as ServerOnlyColumnWrite, Wr as StoreOperationFailed, ie as Subject, oe as SubjectIdentity, o as SubjectService, Kr as TableValidationFailed, qr as TenantRowNotFound, Ur as TenantScopeViolation, ge as TenantSelectionRefused, Nr as UNDO_APPLY_TAG, Mr as UNDO_LOG_TAG, Pr as UNDO_REDO_TAG, l as Unauthenticated, Rr as UndoConflict, Lr as UndoForbidden, Fr as UndoLogEntry, Ir as UndoNotFound, Ot as ValidationError, kt as ValidationErrors, Dt as ValidationIssue, F as WorkflowAccessProperty, J as WorkflowControlInputSchema, q as WorkflowControlIntentSchema, ur as WorkflowControlReadInputSchema, U as WorkflowControlResultSchema, ar as WorkflowDomainEventRowSchema, cr as WorkflowDomainEventsInputSchema, lr as WorkflowEventDeliveriesInputSchema, or as WorkflowEventDeliveryRowSchema, Qn as WorkflowParentClosePolicySchema, dr as WorkflowQueuedCancelInputSchema, W as WorkflowQueuedCancellationResultSchema, Y as WorkflowQueuedControlTargetSchema, Ar as WorkflowRetryCommandSchema, jr as WorkflowRetryObservationSchema, kr as WorkflowRetryTargetSchema, ir as WorkflowRunEventRowSchema, er as WorkflowRunHandleSchema, sr as WorkflowRunRefSchema, G as WorkflowRunRowSchema, H as WorkflowRunSnapshotSchema, V as WorkflowRunStatusSchema, rr as WorkflowRunStepRowSchema, K as WorkflowRunTableRefSchema, nr as WorkflowRunsInputSchema, hr as WorkflowSignalInputSchema, $n as WorkflowStartDeferralSchema, B as WorkflowStartTerminalOutcomeSchema, gr as WorkflowUpdateInputSchema, _r as WorkflowUpdateResultSchema, fn as actionToRpc, Me as advisoryResourceGuardWarning, ne as anonymousSubject, Ct as applyRowPatch, ce as applyScopeDecision, $r as approvalsDecideDescriptor, Qr as approvalsPendingQueryDescriptor, ze as assertAuthenticated, Ln as attachWorkflowAccess, Ue as beginIdempotent, Wn as checkFrameworkCompat, ve as checkGuards, Ee as checkGuardsEffect, tt as compareSurfaces, n as composeAuthStrategies, Hn as composeRpcInterceptors, fi as connectionDisconnectDescriptor, ui as connectionStartDescriptor, di as connectionSubmitTokenDescriptor, li as connectionsListQueryDescriptor, Kt as declaredReactivityChannelKeys, j as defineAction, yn as defineEvent, A as defineMutation, zn as definePlugin, Bn as definePluginRoute, Un as definePluginService, k as defineQuery, nn as defineStream, gi as defineWebSocket, xt as diffRows, Pe as effectiveScopes, An as encodeEventKey, $e as encodeRestError, Ke as encodeRestSuccess, mn as errorTag, Sn as eventAttached, bn as eventEnvelope, xn as eventGap, wn as eventResumePoint, Mn as eventRoute, Cn as eventStreamEvent, Tn as eventSubscribeInput, En as eventToRpc, Be as failIdempotent, At as fieldIssuesOf, ye as findAdvisoryResourceGuards, ut as finishIdempotent, wt as firstEventValue, Pn as formatEventRoute, be as getPolicyGuardResolver, ke as getResourceScopeResolver, I as getWorkflowAccess, Qe as groupShapeDigests, tn as hasAccessDecision, fe as hasCallbackRoutes, De as hasEffectiveScope, N as hasEnforcedGuard, Se as hasScope, g as idToPath, We as idempotencyScope, b as inputLabel, xe as isAuthenticatedCheck, en as isAuthenticatedGuard, vn as isEventDescriptor, St as isIdKeyed, u as isOpenAccess, Fe as isPolicyCheck, $t as isPolicyGuard, Wt as isReactivityChannel, Gt as isReactivityChannelKey, c as isSystemSubject, se as isTenantSelectable, Zt as isWireReachable, de as makeScopeCache, He as memoryIdempotencyStore, Re as missingAccessDecision, dn as mutationToRpc, rt as nextLink, gn as normalizeDescriptor, Jt as normalizeSource, d as openAccessSpec, pe as orderByBearerPrefix, Nn as parseEventRoute, yt as pathToId, Kn as pluginAlias, Vn as pluginInstanceName, qn as pluginSlug, Zn as pluginTag, ot as problemDetails, Je as problemTypeOf, Ze as procedureShapeDigest, Xt as publishReactivity, Xe as publishServerError, un as queryToRpc, s as rawImpersonationMark, Ut as reactivityChannel, Yn as registerPluginAliases, Le as requireScope, Xn as resetPluginAliases, le as resolvePolicyAction, et as resolveRestFormat, In as resolveWorkflowAccess, ct as restViewSchema, _t as rowPatchOpSchema, vt as rowPatchSchema, Ge as schemaShape, te as scopeCacheKey, e as selectSubjectTenant, r as setEffectiveScopes, Ie as setPolicyGuardResolver, ue as setResourceScopeResolver, lt as shapeDigest, qt as sourceKeys, pn as streamToRpc, x as strictInput, Ae as subjectAuditActorId, ee as subjectIdentity, a as subjectScopes, it as subscribeServerErrors, y as subscriptionEvent, he as systemSubject, me as tenantScopedSubject, hn as toRpc, Ye as toSnakeCase, pi as tsMs, Yt as undeclaredChannelKeys, Vr as undoApplyDescriptor, Br as undoLogQueryDescriptor, Hr as undoRedoDescriptor, P as wireErrorUnion, ln as withRpcTag, Rn as workflowAccessDescriptor, wr as workflowCancelDescriptor, mr as workflowControlQueryDescriptor, Sr as workflowDomainEventsQueryDescriptor, Cr as workflowEventDeliveriesQueryDescriptor, fr as workflowQueuedCancelDescriptor, pr as workflowQueuedControlQueryDescriptor, Tr as workflowResumeDescriptor, xr as workflowRunEventsQueryDescriptor, vr as workflowRunQueryDescriptor, br as workflowRunStepsQueryDescriptor, yr as workflowRunsQueryDescriptor, Er as workflowSignalDescriptor, tr as workflowToRpc, Dr as workflowUpdateDescriptor, cn as workflowWireErrorUnion, Ve 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 };