@voltro/protocol 0.80.0 → 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,22 +121,22 @@ 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
- })), wt = (e, t, n) => {
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
140
  if (!t || typeof t != "object" || !("_tag" in t)) return t;
141
141
  let r = t;
142
142
  switch (r._tag) {
@@ -148,42 +148,42 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
148
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
149
  default: return t;
150
150
  }
151
- }, b = (e, t) => {
151
+ }, Ft = (e, t) => {
152
152
  let n = `${e ?? "this procedure"} input`;
153
153
  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) => {
154
+ }, It = (e) => {
155
155
  let t = e.ast;
156
156
  return t._tag === "TypeLiteral" && (t.propertySignatures?.length ?? 0) === 0 && (t.indexSignatures?.length ?? 0) === 0;
157
- }, x = (e, t, n) => {
158
- let r = b(t, n), i = e.annotations({
157
+ }, y = (e, t, n) => {
158
+ let r = Ft(t, n), i = e.annotations({
159
159
  parseOptions: { onExcessProperty: "error" },
160
160
  parseIssueTitle: () => r
161
161
  });
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
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
168
168
  })),
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
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
178
178
  }))
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
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
185
185
  }))
186
- }) {}, kt = class extends p.TaggedError()("ValidationErrors", { issues: p.Array(Dt).pipe(p.minItems(1)) }) {}, At = (e) => {
186
+ }) {}, Bt = class extends m.TaggedError()("ValidationErrors", { issues: m.Array(Rt).pipe(m.minItems(1)) }) {}, Vt = (e) => {
187
187
  if (typeof e != "object" || !e) return [];
188
188
  let t = e._tag;
189
189
  if (t === "ValidationError") {
@@ -209,69 +209,69 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
209
209
  }];
210
210
  }
211
211
  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\`,
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\`,
255
255
  \`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
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
257
257
  routes as two.`);
258
- let t = T.get(e);
258
+ let t = C.get(e);
259
259
  if (t !== void 0) return t;
260
- let n = `${w}${e}`, r = Object.freeze({
260
+ let n = `${S}${e}`, r = Object.freeze({
261
261
  kind: "reactivity-channel",
262
262
  name: e,
263
263
  key: n,
264
264
  toString: () => n
265
265
  });
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({
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({
270
270
  procedure: r.name,
271
271
  key: e
272
272
  });
273
273
  return n;
274
- }, Xt = (e, t) => {
274
+ }, cn = (e, t) => {
275
275
  let n = e?.injectExternalChange;
276
276
  return n !== void 0 && (n.call(e, {
277
277
  table: t.key,
@@ -280,8 +280,8 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
280
280
  old: {},
281
281
  origin: "inline"
282
282
  }), !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'`);
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'`);
285
285
  let t = e.serialize;
286
286
  if (t !== void 0) {
287
287
  if (typeof t.key != "function") throw Error(`${e.name}: serialize.key must be a function of the input`);
@@ -305,7 +305,27 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
305
305
  let r = [e.publicApi === void 0 ? void 0 : "publicApi", e.exposeAsTool === void 0 ? void 0 : "exposeAsTool"].filter((e) => e !== void 0);
306
306
  if (r.length === 0) return e;
307
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.`);
308
- }, Qt = (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) => {
309
329
  let t = e.requiresApproval;
310
330
  if (t !== void 0) {
311
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
@@ -315,23 +335,29 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
315
335
  human from every other, and the second-pair-of-eyes control would enforce nothing.
316
336
  Give the procedure a \`guards:\` decision, or drop \`requiresApproval\`.`);
317
337
  }
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) => {
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
+ }
319
344
  if (n === void 0) return t;
320
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
321
346
  without an authorization check — e.g. \`openAccess: 'public pricing, no caller data'\`.`);
322
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
323
348
  caller must hold a scope; drop them if anyone may call it.`);
324
- return [d(n.trim())];
349
+ return [f(n.trim())];
325
350
  }, k = (e) => D({
326
351
  kind: "query",
327
352
  name: e.name,
328
353
  input: e.input,
329
354
  output: e.output,
330
- error: e.error ?? p.Never,
331
- source: Jt(e.source),
355
+ error: e.error ?? m.Never,
356
+ source: on(e.source),
332
357
  cache: e.cache,
333
- guards: O(e.name, e.guards, e.openAccess),
358
+ guards: O(e.name, e.guards, e.openAccess, e.service),
334
359
  openAccess: e.openAccess,
360
+ service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
335
361
  publicApi: e.publicApi,
336
362
  exposeAsTool: e.exposeAsTool,
337
363
  internal: e.internal,
@@ -341,12 +367,13 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
341
367
  name: e.name,
342
368
  input: e.input,
343
369
  output: e.output,
344
- error: e.error ?? p.Never,
370
+ error: e.error ?? m.Never,
345
371
  ...e.idempotencyScope === void 0 ? {} : { idempotencyScope: e.idempotencyScope },
346
372
  ...e.serialize === void 0 ? {} : { serialize: e.serialize },
347
373
  target: e.target,
348
- guards: O(e.name, e.guards, e.openAccess),
374
+ guards: O(e.name, e.guards, e.openAccess, e.service),
349
375
  openAccess: e.openAccess,
376
+ service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
350
377
  publicApi: e.publicApi,
351
378
  exposeAsTool: e.exposeAsTool,
352
379
  requiresApproval: e.requiresApproval,
@@ -357,9 +384,10 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
357
384
  name: e.name,
358
385
  input: e.input,
359
386
  output: e.output,
360
- error: e.error ?? p.Never,
361
- 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),
362
389
  openAccess: e.openAccess,
390
+ service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
363
391
  source: e.source,
364
392
  target: e.target,
365
393
  publicApi: e.publicApi,
@@ -367,54 +395,54 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
367
395
  requiresApproval: e.requiresApproval,
368
396
  internal: e.internal,
369
397
  overridesPlugin: e.overridesPlugin
370
- }), nn = (e) => D({
398
+ }), _n = (e) => D({
371
399
  kind: "stream",
372
400
  name: e.name,
373
401
  input: e.input,
374
402
  element: e.element,
375
- error: e.error ?? p.Never,
403
+ error: e.error ?? m.Never,
376
404
  internal: e.internal,
377
405
  overridesPlugin: e.overridesPlugin,
378
406
  guards: O(e.name, e.guards, e.openAccess),
379
407
  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);
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);
382
410
  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) => ({
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) => ({
386
414
  ...e,
387
415
  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),
416
+ }), wn = (e, t) => h.make(e.name, {
417
+ payload: y(e.input, e.name, N(e.guards)),
418
+ success: Nt(e.output),
391
419
  error: M(P(e, "query"), t),
392
420
  stream: !0
393
- }), dn = (e, t) => m.make(e.name, {
394
- 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)),
395
423
  success: e.output,
396
424
  error: M(P(e, "mutation"), t)
397
- }), fn = (e, t) => m.make(e.name, {
398
- 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)),
399
427
  success: e.output,
400
428
  error: M(P(e, "action"), t)
401
- }), pn = (e, t) => m.make(e.name, {
402
- 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)),
403
431
  success: e.element,
404
432
  error: M(e.error, t),
405
433
  stream: !0
406
- }), mn = (e) => {
434
+ }), On = (e) => {
407
435
  if (typeof e != "object" || !e) return;
408
436
  let t = e._tag;
409
437
  return typeof t == "string" ? t : void 0;
410
- }, hn = (e) => {
438
+ }, kn = (e) => {
411
439
  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);
440
+ case "query": return wn(e);
441
+ case "mutation": return Tn(e);
442
+ case "action": return En(e);
443
+ case "stream": return Dn(e);
416
444
  }
417
- }, gn = (e) => {
445
+ }, An = (e) => {
418
446
  let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r };
419
447
  if (e.kind === "query") return {
420
448
  kind: "query",
@@ -460,7 +488,7 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
460
488
  ..."relations" in e && e.relations !== void 0 ? { relations: e.relations } : {}
461
489
  }))
462
490
  };
463
- }, _n = 7500, vn = (e) => typeof e == "object" && !!e && e.kind === "event", yn = (e) => {
491
+ }, jn = 7500, Mn = (e) => typeof e == "object" && !!e && e.kind === "event", Nn = (e) => {
464
492
  if (e.name.length === 0) throw Error("defineEvent: `name` must not be empty");
465
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
466
494
  whitespace and delivers nothing — silently, and only on that broker, so an
@@ -489,68 +517,68 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
489
517
  name: e.name,
490
518
  key: e.key,
491
519
  payload: e.payload,
492
- guards: e.openAccess === void 0 ? e.guards : [d(e.openAccess.trim())],
520
+ guards: e.openAccess === void 0 ? e.guards : [f(e.openAccess.trim())],
493
521
  openAccess: e.openAccess,
494
522
  rewind: e.rewind,
495
523
  webhook: e.webhook,
496
524
  delivery: e.delivery
497
525
  };
498
- }, bn = (e) => p.Struct({
499
- _tag: p.Literal("event"),
500
- origin: p.String,
501
- n: p.Number,
502
- 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,
503
531
  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({
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({
512
540
  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),
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),
519
547
  error: r,
520
548
  stream: !0
521
549
  });
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) => {
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) => {
533
561
  if (typeof e != "object" || !e) return JSON.stringify(e) ?? "null";
534
562
  let t = Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t));
535
563
  return JSON.stringify(t);
536
- }, jn = "\0", Mn = (e, t, n) => [
564
+ }, Gn = "\0", Kn = (e, t, n) => [
537
565
  e ?? "~",
538
566
  t,
539
- An(n)
540
- ].join("\0"), Nn = (e) => {
567
+ Wn(n)
568
+ ].join("\0"), qn = (e) => {
541
569
  let [t = "~", n = "", r = ""] = e.split("\0");
542
570
  return {
543
571
  tenantId: t === "~" ? null : t,
544
572
  event: n,
545
573
  key: r
546
574
  };
547
- }, Pn = (e) => e.split("\0").join(" · "), F = Symbol.for("@voltro/protocol/workflow-access"), Fn = {
575
+ }, Jn = (e) => e.split("\0").join(" · "), F = Symbol.for("@voltro/protocol/workflow-access"), Yn = {
548
576
  guards: void 0,
549
577
  openAccess: void 0,
550
578
  internal: !1,
551
579
  controls: void 0,
552
580
  controlsOpenAccess: void 0
553
- }, In = (e, t) => {
581
+ }, Xn = (e, t) => {
554
582
  let n = t.guards;
555
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
556
584
  and decide with \`openAccess\` or \`internal\`, or list the scopes that may start it.`);
@@ -576,22 +604,22 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
576
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.`);
577
605
  }
578
606
  return {
579
- guards: t.openAccess === void 0 ? t.guards : [d(t.openAccess.trim())],
607
+ guards: t.openAccess === void 0 ? t.guards : [f(t.openAccess.trim())],
580
608
  openAccess: t.openAccess?.trim(),
581
609
  internal: t.internal === !0,
582
- controls: i === void 0 ? r : [d(i.trim())],
610
+ controls: i === void 0 ? r : [f(i.trim())],
583
611
  controlsOpenAccess: i?.trim()
584
612
  };
585
- }, Ln = (e, t) => {
613
+ }, Zn = (e, t) => {
586
614
  Object.defineProperty(e, F, {
587
615
  value: t,
588
616
  enumerable: !1
589
617
  });
590
618
  }, I = (e) => {
591
- if (typeof e != "object" || !e) return Fn;
619
+ if (typeof e != "object" || !e) return Yn;
592
620
  let t = e[F];
593
- return t === void 0 ? Fn : t;
594
- }, Rn = (e) => {
621
+ return t === void 0 ? Yn : t;
622
+ }, Qn = (e) => {
595
623
  let t = I(e);
596
624
  return {
597
625
  name: e.name,
@@ -600,18 +628,23 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
600
628
  openAccess: t.openAccess,
601
629
  controls: t.controls
602
630
  };
603
- }, zn = (e) => e, Bn = (e) => e, Vn = (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) => {
604
637
  let t = e.alias?.trim(), n = e.instance?.trim(), r = t !== void 0 && t !== "" ? t : e.base;
605
638
  return n !== void 0 && n !== "" ? `${r}#${n}` : r;
606
- }, Hn = (e) => {
639
+ }, ir = (e) => {
607
640
  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);
641
+ }, ar = (e, t) => {
642
+ let n = xt.GenericTag(e);
610
643
  return {
611
644
  Tag: n,
612
- Live: mt.succeed(n, t)
645
+ Live: St.succeed(n, t)
613
646
  };
614
- }, Wn = (e, t, n) => {
647
+ }, or = (e, t, n) => {
615
648
  if (!t) return { ok: !0 };
616
649
  let r = n === void 0 ? null : L(n);
617
650
  if (!r) return {
@@ -621,7 +654,7 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
621
654
  let i = t.trim();
622
655
  if (i === "*" || i === "") return { ok: !0 };
623
656
  let a = i.split(/\s+/).filter((e) => e.length > 0);
624
- for (let i of a) if (!Gn(i, r)) return {
657
+ for (let i of a) if (!sr(i, r)) return {
625
658
  ok: !1,
626
659
  reason: `plugin "${e}" requires framework ${t}, running ${n}`
627
660
  };
@@ -634,7 +667,7 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
634
667
  patch: Number(t[3]),
635
668
  pre: t[4] ?? ""
636
669
  } : 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) => {
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) => {
638
671
  if (e === "*") return !0;
639
672
  if (e.startsWith("^")) {
640
673
  let n = L(e.slice(1));
@@ -656,87 +689,87 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
656
689
  }
657
690
  let r = L(e);
658
691
  return r ? R(t, r) === 0 : !1;
659
- }, Kn = (e) => {
692
+ }, cr = (e) => {
660
693
  let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
661
694
  return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/-([a-zA-Z0-9])/g, (e, t) => t.toUpperCase());
662
- }, qn = (e) => {
695
+ }, lr = (e) => {
663
696
  let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
664
697
  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];
698
+ }, ur = Symbol.for("@voltro/protocol/pluginAliases"), z = () => {
699
+ let e = globalThis, t = e[ur];
667
700
  if (t instanceof Map) return t;
668
701
  let n = /* @__PURE__ */ new Map();
669
- return e[Jn] = n, n;
670
- }, Yn = (e) => {
702
+ return e[ur] = n, n;
703
+ }, dr = (e) => {
671
704
  let t = z();
672
705
  for (let [n, r] of Object.entries(e)) {
673
706
  if (r === "") continue;
674
707
  let e = t.get(n);
675
708
  e === void 0 ? t.set(n, /* @__PURE__ */ new Set([r])) : e.add(r);
676
709
  }
677
- }, Xn = () => {
710
+ }, fr = () => {
678
711
  z().clear();
679
- }, Zn = (e, t) => {
712
+ }, pr = (e, t) => {
680
713
  let n = z().get(e);
681
- if (n === void 0 || n.size === 0) return `${Kn(e)}.${t}`;
714
+ if (n === void 0 || n.size === 0) return `${cr(e)}.${t}`;
682
715
  if (n.size === 1) return `${[...n][0]}.${t}`;
683
716
  let r = [...n].filter((e) => !e.includes("#"));
684
717
  if (r.length === 1) return `${r[0]}.${t}`;
685
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}').`);
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
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
714
747
  }))
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),
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),
719
752
  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
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
731
764
  }))
732
- }), p.Struct({
733
- kind: p.Literal("execution"),
765
+ }), m.Struct({
766
+ kind: m.Literal("execution"),
734
767
  snapshot: H
735
- }), p.Struct({
736
- kind: p.Literal("unavailable"),
737
- 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")
738
771
  }))
739
- }).pipe(p.filter((e) => {
772
+ }).pipe(m.filter((e) => {
740
773
  let t = e.observation;
741
774
  if (t.kind === "unavailable") return e.kind === "unknown" && (t.reason === "missing-request" ? e.requestId === null : e.requestId !== null);
742
775
  if (e.requestId === null) return !1;
@@ -744,307 +777,307 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
744
777
  if (t.kind === "admission") return e.kind === (t.outcome.kind === "cancelled" ? "confirmed" : "already-terminal");
745
778
  let n = t.snapshot;
746
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");
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) => {
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) => {
759
792
  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({
793
+ return h.make(e.name, {
794
+ payload: y(e.payloadSchema, e.name, N(n.guards)),
795
+ success: gr,
796
+ error: Sn({
764
797
  errorSchema: e.errorSchema,
765
798
  guards: n.guards
766
799
  }, t)
767
800
  });
768
- }, G = p.Struct({
769
- id: p.String,
770
- tag: p.String,
771
- executionId: p.String,
801
+ }, G = m.Struct({
802
+ id: m.String,
803
+ tag: m.String,
804
+ executionId: m.String,
772
805
  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
806
+ payload: m.Unknown,
807
+ workflowVersion: m.NullOr(m.String),
808
+ workflowPatches: m.NullOr(m.Unknown),
809
+ output: m.NullOr(m.Unknown),
810
+ subject: m.NullOr(m.Unknown),
811
+ source: m.NullOr(m.String),
812
+ errorTag: m.NullOr(m.String),
813
+ errorMessage: m.NullOr(m.String),
814
+ cancelled: m.Boolean,
815
+ startedAt: m.Date,
816
+ completedAt: m.NullOr(m.Date),
817
+ durationMs: m.NullOr(m.Number),
818
+ traceId: m.NullOr(m.String),
819
+ parentExecutionId: m.NullOr(m.String),
820
+ parentClosePolicy: m.NullOr(mr)
821
+ }), vr = m.Struct({
822
+ tag: m.optional(m.String),
823
+ status: m.optional(V),
824
+ limit: m.optional(m.Number)
825
+ }), yr = m.Struct({
826
+ id: m.String,
827
+ runId: m.String,
828
+ stepName: m.String,
829
+ attempt: m.Number,
830
+ status: m.Literal("running", "succeeded", "failed"),
831
+ input: m.NullOr(m.Unknown),
832
+ retryPolicy: m.NullOr(m.Unknown),
833
+ output: m.NullOr(m.Unknown),
834
+ errorTag: m.NullOr(m.String),
835
+ errorMessage: m.NullOr(m.String),
836
+ errorCause: m.NullOr(m.Unknown),
837
+ startedAt: m.Date,
838
+ completedAt: m.NullOr(m.Date),
839
+ durationMs: m.NullOr(m.Number)
840
+ }), br = m.Struct({
841
+ id: m.String,
842
+ runId: m.String,
843
+ eventType: m.String,
844
+ payload: m.NullOr(m.Unknown),
845
+ occurredAt: m.Date,
846
+ stepName: m.NullOr(m.String),
847
+ attempt: m.NullOr(m.Number)
848
+ }), xr = m.Struct({
849
+ id: m.String,
850
+ name: m.String,
851
+ payload: m.Unknown,
852
+ source: m.String,
853
+ subject: m.NullOr(m.Unknown),
854
+ traceId: m.NullOr(m.String),
855
+ occurredAt: m.Date
856
+ }), Sr = m.Struct({
857
+ id: m.String,
858
+ eventId: m.String,
859
+ eventName: m.String,
860
+ triggerId: m.String,
861
+ workflowName: m.String,
862
+ executionId: m.NullOr(m.String),
863
+ status: m.Literal("starting", "started", "skipped", "failed"),
864
+ idempotencyKey: m.String,
865
+ skipped: m.Boolean,
866
+ errorMessage: m.NullOr(m.String),
867
+ createdAt: m.Date,
868
+ completedAt: m.NullOr(m.Date)
869
+ }), Cr = m.Struct({ id: m.String }), K = m.Struct({ runId: m.String }), wr = m.Struct({
870
+ name: m.optional(m.String),
871
+ limit: m.optional(m.Number)
872
+ }), Tr = m.Struct({ eventId: m.String }), q = m.Struct({
873
+ requestId: m.NonEmptyString,
874
+ cause: m.optionalWith(m.Struct({
875
+ reason: m.NonEmptyString,
876
+ detail: m.optional(m.Record({
877
+ key: m.String,
878
+ value: m.Unknown
846
879
  }))
847
880
  }), { 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({
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({
862
895
  ...Y.fields,
863
896
  cause: q.fields.cause
864
- }), fr = j({
897
+ }), Or = j({
865
898
  name: "__voltro.workflow.queued.cancel",
866
- input: dr,
899
+ input: Dr,
867
900
  output: W,
868
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"
869
- }), pr = k({
902
+ }), kr = k({
870
903
  name: "__voltro.workflow.queued.control",
871
904
  input: Y,
872
905
  output: W,
873
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"
874
- }), mr = k({
907
+ }), Ar = k({
875
908
  name: "__voltro.workflow.control",
876
- input: ur,
909
+ input: Er,
877
910
  output: U,
878
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"
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({
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({
894
927
  name: "__voltro.workflow.run",
895
928
  source: "_voltro_workflow_runs",
896
- input: sr,
897
- output: p.Array(G),
929
+ input: Cr,
930
+ output: m.Array(G),
898
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"
899
- }), yr = k({
932
+ }), Fr = k({
900
933
  name: "__voltro.workflow.runs",
901
934
  source: "_voltro_workflow_runs",
902
- input: nr,
903
- output: p.Array(G),
935
+ input: vr,
936
+ output: m.Array(G),
904
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"
905
- }), br = k({
938
+ }), Ir = k({
906
939
  name: "__voltro.workflow.run.steps",
907
940
  source: "_voltro_workflow_run_steps",
908
941
  input: K,
909
- output: p.Array(rr),
942
+ output: m.Array(yr),
910
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"
911
- }), xr = k({
944
+ }), Lr = k({
912
945
  name: "__voltro.workflow.run.events",
913
946
  source: "_voltro_workflow_run_events",
914
947
  input: K,
915
- output: p.Array(ir),
948
+ output: m.Array(br),
916
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"
917
- }), Sr = k({
950
+ }), Rr = k({
918
951
  name: "__voltro.workflow.domainEvents",
919
952
  source: "_voltro_workflow_events",
920
- input: cr,
921
- output: p.Array(ar),
953
+ input: wr,
954
+ output: m.Array(xr),
922
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"
923
- }), Cr = k({
956
+ }), zr = k({
924
957
  name: "__voltro.workflow.event.deliveries",
925
958
  source: "_voltro_workflow_event_deliveries",
926
- input: lr,
927
- output: p.Array(or),
959
+ input: Tr,
960
+ output: m.Array(Sr),
928
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"
929
- }), wr = j({
962
+ }), Br = j({
930
963
  name: "__voltro.workflow.cancel",
931
964
  input: J,
932
965
  output: U,
933
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"
934
- }), Tr = j({
967
+ }), Vr = j({
935
968
  name: "__voltro.workflow.resume",
936
969
  input: J,
937
970
  output: U,
938
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"
939
- }), Er = j({
972
+ }), Hr = j({
940
973
  name: "__voltro.workflow.signal",
941
- input: hr,
942
- output: p.Struct({ eventId: p.String }),
974
+ input: jr,
975
+ output: m.Struct({ eventId: m.String }),
943
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"
944
- }), Dr = j({
977
+ }), Ur = j({
945
978
  name: "__voltro.workflow.update",
946
- input: gr,
947
- output: _r,
979
+ input: Mr,
980
+ output: Nr,
948
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"
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)
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)
955
988
  }), X = {
956
- requestId: p.NonEmptyString,
957
- originalRunId: p.NonEmptyString,
958
- originalExecutionId: p.NonEmptyString,
959
- workflowName: p.NonEmptyString
960
- }, jr = 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({
961
994
  ...X,
962
- kind: p.Literal("queued"),
963
- nextAttemptAt: p.NullOr(p.Number)
964
- }), p.Struct({
995
+ kind: m.Literal("queued"),
996
+ nextAttemptAt: m.NullOr(m.Number)
997
+ }), m.Struct({
965
998
  ...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({
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({
969
1002
  ...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({
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({
974
1007
  ...X,
975
- kind: p.Literal("not-started"),
1008
+ kind: m.Literal("not-started"),
976
1009
  outcome: B
977
- }), p.Struct({
1010
+ }), m.Struct({
978
1011
  ...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,
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,
993
1026
  source: "_voltro_undo_log",
994
- input: p.Struct({ limit: p.optional(p.Number) }),
995
- output: p.Array(Fr),
1027
+ input: m.Struct({ limit: m.optional(m.Number) }),
1028
+ output: m.Array(Zr),
996
1029
  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,
1030
+ }), ri = A({
1031
+ name: Yr,
1032
+ input: m.Struct({ invocationId: m.String }),
1033
+ output: m.Struct({ ok: m.Boolean }),
1034
+ error: ti,
1002
1035
  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,
1036
+ }), ii = A({
1037
+ name: Xr,
1038
+ input: m.Struct({ invocationId: m.String }),
1039
+ output: m.Struct({ ok: m.Boolean }),
1040
+ error: ti,
1008
1041
  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
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
1016
1049
  }) {
1017
1050
  get message() {
1018
1051
  return `${this.operation} on '${this.table}' failed: ${this.cause}`;
1019
1052
  }
1020
- }, Gr = class extends p.TaggedError()("NoRowFound", {
1021
- table: p.String,
1022
- found: p.Number
1053
+ }, si = class extends m.TaggedError()("NoRowFound", {
1054
+ table: m.String,
1055
+ found: m.Number
1023
1056
  }) {
1024
1057
  get message() {
1025
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`;
1026
1059
  }
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
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
1033
1066
  }))
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)
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)
1048
1081
  }) {
1049
1082
  get message() {
1050
1083
  if (this.detail !== void 0) return this.detail;
@@ -1057,86 +1090,86 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
1057
1090
  case "check": return `check constraint ${t}: the row does not satisfy it`;
1058
1091
  }
1059
1092
  }
1060
- }, Xr = "__voltro.approvals.pending", Zr = "__voltro.approvals.decide", Qr = k({
1061
- name: Xr,
1093
+ }, fi = "__voltro.approvals.pending", pi = "__voltro.approvals.decide", mi = k({
1094
+ name: fi,
1062
1095
  source: "_voltro_approvals",
1063
- input: p.Struct({ limit: p.optional(p.Number) }),
1064
- output: p.Array(zt),
1096
+ input: m.Struct({ limit: m.optional(m.Number) }),
1097
+ output: m.Array(Xt),
1065
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"
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)
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)
1072
1105
  }),
1073
- output: p.Struct({
1074
- approvalId: p.String,
1075
- status: p.Literal("approved", "rejected")
1106
+ output: m.Struct({
1107
+ approvalId: m.String,
1108
+ status: m.Literal("approved", "rejected")
1076
1109
  }),
1077
- error: Rt,
1110
+ error: Yt,
1078
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"
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,
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,
1081
1114
  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,
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,
1092
1125
  expected: Q,
1093
1126
  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,
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,
1100
1133
  source: "_voltro_connections",
1101
- input: p.Struct({}),
1102
- output: p.Array(ii),
1134
+ input: m.Struct({}),
1135
+ output: m.Array(bi),
1103
1136
  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)
1137
+ }), Ei = j({
1138
+ name: _i,
1139
+ input: m.Struct({
1140
+ connectionId: m.String,
1141
+ redirectTo: m.optional(m.String)
1109
1142
  }),
1110
- output: p.Struct({
1111
- authorizeUrl: p.String,
1112
- state: p.String
1143
+ output: m.Struct({
1144
+ authorizeUrl: m.String,
1145
+ state: m.String
1113
1146
  }),
1114
1147
  error: $,
1115
1148
  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
1149
+ }), Di = A({
1150
+ name: vi,
1151
+ input: m.Struct({
1152
+ connectionId: m.String,
1153
+ token: m.String
1121
1154
  }),
1122
- output: p.Struct({ ok: p.Boolean }),
1155
+ output: m.Struct({ ok: m.Boolean }),
1123
1156
  error: $,
1124
1157
  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 }),
1158
+ }), Oi = A({
1159
+ name: Z,
1160
+ input: m.Struct({ connectionId: m.String }),
1161
+ output: m.Struct({ ok: m.Boolean }),
1129
1162
  error: $,
1130
1163
  openAccess: "self-service: deletes only the calling subject's own credential row for this connection"
1131
- }), pi = (e) => {
1164
+ }), ki = (e) => {
1132
1165
  let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : typeof e == "string" ? new Date(e).getTime() : 0;
1133
1166
  return Number.isNaN(t) ? 0 : t;
1134
- }, mi = 4001, hi = /* @__PURE__ */ new Set(["/rpc", "/ws"]), gi = (e) => {
1167
+ }, Ai = 4001, ji = /* @__PURE__ */ new Set(["/rpc", "/ws"]), Mi = (e) => {
1135
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`);
1136
1169
  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`);
1170
+ if (ji.has(e.path)) throw Error(`defineWebSocket: '${e.path}' is the framework's own socket surface — mount the gateway elsewhere`);
1138
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)}'`);
1139
1172
  return e;
1140
- }, _i = 1;
1173
+ }, Ni = 1;
1141
1174
  //#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 };
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 };