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