@voltro/cli 0.15.0 → 0.16.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/dist/{apiBuild-CHItlwPO.js → apiBuild-BJtiqoOu.js} +1 -1
  3. package/dist/apiBuild-BOczx9-m.js +2 -0
  4. package/dist/bin.js +2 -2
  5. package/dist/{commands-CPQuQRXh.js → commands-8A5RU3MW.js} +17 -12
  6. package/dist/dbCommand-DNQ6l-su.js +2 -0
  7. package/dist/{dbCommand-B8F29zV0.js → dbCommand-OPMtO0sX.js} +223 -209
  8. package/dist/{dev-C2lCUhYI.js → dev-DGjEvvkV.js} +807 -806
  9. package/dist/{dev-BHLM3RPX.js → dev-HdG7JdSk.js} +1 -1
  10. package/dist/index.js +1 -1
  11. package/dist/{serveCommand-DBzQcCuv.js → serveCommand-C3lq3mFd.js} +4 -2
  12. package/dist/serveEntry.js +1 -1
  13. package/package.json +17 -17
  14. package/templates/AGENTS.md +1 -1
  15. package/templates/agent-docs/_index.md +1 -1
  16. package/templates/agent-docs/data.md +9 -1
  17. package/templates/agent-docs/plugins.md +1 -1
  18. package/templates/agent-docs/whats-new.md +66 -224
  19. package/templates/apps/api-ai/package.json +7 -7
  20. package/templates/apps/api-auth/package.json +8 -8
  21. package/templates/apps/api-backend/package.json +7 -7
  22. package/templates/apps/api-backend-deactivation/package.json +7 -7
  23. package/templates/apps/api-backend-mail/package.json +8 -8
  24. package/templates/apps/api-backend-mariadb/package.json +9 -9
  25. package/templates/apps/api-backend-storage/package.json +8 -8
  26. package/templates/apps/api-data-advanced/package.json +8 -8
  27. package/templates/apps/api-durable/package.json +8 -8
  28. package/templates/apps/api-feature-flags/package.json +9 -9
  29. package/templates/apps/api-governance/package.json +8 -8
  30. package/templates/apps/api-kv/package.json +8 -8
  31. package/templates/apps/api-moderation/package.json +8 -8
  32. package/templates/apps/api-observability/package.json +8 -8
  33. package/templates/apps/api-ratelimit/package.json +8 -8
  34. package/templates/apps/api-rbac/package.json +8 -8
  35. package/templates/apps/api-rest/package.json +7 -7
  36. package/templates/apps/api-saas/package.json +11 -11
  37. package/templates/apps/api-search/package.json +8 -8
  38. package/templates/apps/api-versioning/package.json +8 -8
  39. package/templates/apps/api-webhooks/package.json +9 -9
  40. package/templates/apps/changelog/package.json +6 -6
  41. package/templates/apps/edge-functions/package.json +2 -2
  42. package/templates/apps/frontend-admin/package.json +8 -8
  43. package/templates/apps/frontend-app/package.json +8 -8
  44. package/templates/apps/frontend-blank/package.json +7 -7
  45. package/templates/apps/frontend-contact/package.json +7 -7
  46. package/templates/apps/frontend-dashboard/package.json +7 -7
  47. package/templates/apps/frontend-docs/package.json +7 -7
  48. package/templates/apps/frontend-i18n/package.json +6 -6
  49. package/templates/apps/frontend-landing/package.json +7 -7
  50. package/templates/apps/frontend-spa/package.json +7 -7
  51. package/templates/apps/frontend-ssr/package.json +7 -7
  52. package/templates/apps/frontend-ssr-api/package.json +8 -8
  53. package/templates/apps/frontend-static-blog/package.json +6 -6
  54. package/dist/apiBuild-D8juhYsS.js +0 -2
  55. package/dist/dbCommand-Dt7BtdMd.js +0 -2
@@ -13,39 +13,39 @@ import { fileURLToPath as dt, pathToFileURL as j } from "node:url";
13
13
  import { FetchHttpClient as ft } from "@effect/platform";
14
14
  import { Cause as pt, Cron as mt, Deferred as M, Duration as ht, Effect as N, Fiber as gt, Layer as P, ManagedRuntime as _t, Option as vt, Ref as yt, Schema as bt, Stream as xt } from "effect";
15
15
  import { createLogger as F, printAppSurface as St, printReadyBlock as Ct } from "@voltro/logger";
16
- import { appendFileSync as wt, chownSync as I, existsSync as Tt, promises as L, readFileSync as Et, readdirSync as Dt, statSync as Ot, writeFileSync as kt } from "node:fs";
17
- import { AggregateError as At, AggregateMaintainer as jt, AggregateNotFound as Mt, AggregateRegistry as Nt, AggregateStale as Pt, AnalyticsSink as R, DORMANCY_WAKEUP_TENANT as Ft, Dispatcher as It, InMemoryDataStore as Lt, ReactionRateLimiter as Rt, ReplicatedDataStore as zt, SYSTEM_SUBJECT as Bt, apiKeyManagementRoutes as Vt, applySoftDeleteScope as Ht, applyTenantScope as Ut, applyUndoInvocation as Wt, assertConnectionCipherConfigured as Gt, attachAnalyticsMirror as Kt, awaitServerListening as qt, bindMutation as Jt, bindStream as Yt, bindSubscription as Xt, buildTracingLayer as Zt, cancelWakeup as Qt, compileCron as $t, completeOAuthConnect as en, dataStoreApiKeyStore as tn, dataStoreIdempotencyStore as nn, drainOutbox as rn, enableGraphObservation as an, extractDbCause as on, formatServerOnlyLeaks as sn, frameworkApiKeyStrategy as cn, getConnectionSubject as ln, getTimelineRecorder as un, installPolicyGuardResolver as dn, isAggregateDefinition as fn, isEmptyTenantScopedRead as pn, isOrglessUserSubject as mn, isScheduleDefinition as hn, isWorkflowEventTriggerDefinition as gn, listRetentions as _n, loadResourceTuples as vn, localityAwareSelector as yn, makeActionRunner as bn, makeAdvisoryLockCoordinator as xn, makeApiKeyService as Sn, makeApiKeyUsageBuffer as Cn, makeApiKeyUsageFlusher as wn, makeAppAccess as Tn, makeAsyncKv as En, makeBufferingSpanProcessor as Dn, makeConnectionRegistry as On, makeConnectionResolver as kn, makeConnectionsFacade as An, makeCoordinatedScheduler as jn, makeDataLoader as Mn, makeDisconnectConnectionExecutor as Nn, makeEffectStoreLayer as Pn, makeEventsFacade as Fn, makeLazyWorkflowFacade as In, makeListConnectionsExecutor as Ln, makeMutationRunner as Rn, makeOneShotQueryRunner as zn, makeOutboxFacade as Bn, makePostCommitWorkflowFacade as Vn, makeQueryDescriptorProducer as Hn, makeQueryReauthorizer as Un, makeQuerySubscriber as Wn, makeSchemaRegistry as Gn, makeStartConnectionExecutor as Kn, makeSubmitTokenExecutor as qn, makeUndoCapture as Jn, makeWorkflowFacade as Yn, makeWorkflowFacadeWithCallerContext as Xn, makeWorkflowLayers as Zn, memoryRywPositionStore as Qn, nextFiring as $n, noopAnalytics as z, noopAnalyticsSpec as er, observedGraph as tr, powerOfTwoSelector as nr, recordSubscriptionDelivery as rr, recordTimelineEvent as ir, redisRywPositionStore as ar, redoUndoInvocation as or, registerRetention as sr, registerWakeup as cr, resolveCurrentRegion as lr, resolveSecretsBackend as ur, retentionTtlMsFromEnv as dr, runProvidedEffect as fr, runReaction as pr, sanitizeRedirectTo as mr, serverOnlyLeaks as hr, setConnectionResolver as gr, setSecretsBackend as _r, setSystemStoreHandle as vr, setTupleSource as yr, singleCoordinator as br, ssrfGuardHttpClientLayer as xr, startRpcServer as Sr, startScheduler as Cr, sweepRetention as wr, tracingHttpClientLayer as Tr, undoCaptureEnabled as Er, undoLogExecutor as Dr, wrapStoreWithMixinBehaviour as Or } from "@voltro/runtime";
18
- import { Rpc as kr, RpcGroup as Ar } from "@effect/rpc";
19
- import { SqlClient as B } from "@effect/sql";
20
- import { WorkflowEngine as jr } from "@effect/workflow";
21
- import { WorkflowStepInterceptorTag as Mr, closeWorkflowChildrenForParent as Nr, completeSuspendingSignal as Pr, getWorkflowVersionMetadata as Fr, isWorkflowWorkerLayer as Ir, makeWorkflowRunRecorder as Lr, sendWorkflowSignal as Rr, sendWorkflowUpdate as zr, serialiseWorkflowRowForWire as Br, wrapWorkflowExecuteWithRunRecording as Vr } from "@voltro/workflow";
22
- import { makeClusterCronLayer as Hr, parseShardLockMode as Ur, resolveRunnerIdentity as Wr, resolveRunnerStorage as Gr, workflowEngineLayer as Kr } from "@voltro/workflow/cluster";
23
- import { loadAgentMessages as qr, runAgentTurn as Jr } from "@voltro/ai";
24
- import { actorsTable as Yr, allRegisteredTables as Xr, and as Zr, auditAllTableIndexes as Qr, drainIdentifierWarnings as $r, ensureTableRegistered as ei, eq as V, formatIndexAuditIssue as ti, isSqliteFamily as ni, lt as ri, or as ii, registerCoreTables as ai, registerDiscoveredRelations as oi, resolveTenantNamespace as si, serverOnlyColumns as ci, validateRegisteredRelations as li, walkLeaves as ui } from "@voltro/database";
25
- import { AuthMiddleware as di, ConnectionInfoMiddleware as fi, Unauthenticated as pi, WorkflowRunHandleSchema as mi, actionToRpc as hi, advisoryResourceGuardWarning as gi, anonymousSubject as _i, checkFrameworkCompat as vi, composeAuthStrategies as yi, composeRpcInterceptors as bi, connectionDisconnectDescriptor as xi, connectionStartDescriptor as Si, connectionSubmitTokenDescriptor as Ci, connectionsListQueryDescriptor as wi, findAdvisoryResourceGuards as Ti, mutationToRpc as Ei, publishServerError as Di, queryToRpc as Oi, streamToRpc as ki, tenantScopedSubject as Ai, undoApplyDescriptor as ji, undoLogQueryDescriptor as Mi, undoRedoDescriptor as Ni, workflowCancelDescriptor as Pi, workflowDomainEventsQueryDescriptor as Fi, workflowEventDeliveriesQueryDescriptor as Ii, workflowResumeDescriptor as Li, workflowRunEventsQueryDescriptor as Ri, workflowRunQueryDescriptor as zi, workflowRunStepsQueryDescriptor as Bi, workflowRunsQueryDescriptor as Vi, workflowSignalDescriptor as Hi, workflowUpdateDescriptor as Ui } from "@voltro/protocol";
26
- import { isEnvContract as Wi } from "@voltro/env";
27
- import { readCookie as Gi, resolveOptionalSessionSecrets as Ki, verifySessionKeyed as qi } from "@voltro/protocol/session";
28
- import { createHash as Ji, randomBytes as Yi } from "node:crypto";
29
- import { declaredSnapshot as Xi, describeOutcome as Zi, fingerprintSchema as Qi, introspectSchema as $i, pendingFileMigrationIds as ea, planMigrations as ta, runFileBasedMigrations as na, runFrameworkBootstrap as ra, runPlannedMigrations as ia } from "@voltro/database/sql";
30
- import { Cache as aa, CacheLayer as oa, InvalidationBus as H } from "@voltro/cache";
31
- import { Kv as sa } from "@voltro/kv";
32
- import { getAuthSessionStrategy as ca } from "@voltro/plugin-auth";
33
- import { collectPublicApiRoutes as la, restRoutesToHttpRoutes as ua } from "@voltro/protocol/rest";
34
- import { spawn as da } from "node:child_process";
35
- import { watch as fa } from "chokidar";
36
- import { agentRouteDescriptors as pa, isAgentDescriptor as ma } from "@voltro/ai/agent";
37
- import { ArrayFormatter as ha } from "effect/ParseResult";
38
- import { buildDeliverWebhookExecute as ga, buildWebhooksService as _a, defaultIncomingPath as va, deliverWebhookWorkflow as ya, isWebhookDescriptor as ba, mountIncomingWebhook as xa } from "@voltro/plugin-webhooks";
39
- import { isEmailTemplate as Sa, registerEmailTemplates as Ca } from "@voltro/plugin-mail";
40
- import { attachBroadcastBus as wa, getBroadcastPlugin as Ta } from "@voltro/plugin-broadcast";
41
- import { runImport as Ea } from "@voltro/data-transfer";
42
- import { createServer as Da } from "node:http";
16
+ import { appendFileSync as wt, chownSync as I, existsSync as L, promises as R, readFileSync as Tt, readdirSync as Et, statSync as Dt, writeFileSync as Ot } from "node:fs";
17
+ import { AggregateError as kt, AggregateMaintainer as At, AggregateNotFound as jt, AggregateRegistry as Mt, AggregateStale as Nt, AnalyticsSink as z, DORMANCY_WAKEUP_TENANT as Pt, Dispatcher as Ft, InMemoryDataStore as It, ReactionRateLimiter as Lt, ReplicatedDataStore as Rt, SYSTEM_SUBJECT as zt, apiKeyManagementRoutes as Bt, applySoftDeleteScope as Vt, applyTenantScope as Ht, applyUndoInvocation as Ut, assertConnectionCipherConfigured as Wt, attachAnalyticsMirror as Gt, awaitServerListening as Kt, bindMutation as qt, bindStream as Jt, bindSubscription as Yt, buildTracingLayer as Xt, cancelWakeup as Zt, compileCron as Qt, completeOAuthConnect as $t, dataStoreApiKeyStore as en, dataStoreIdempotencyStore as tn, drainOutbox as nn, enableGraphObservation as rn, extractDbCause as an, formatServerOnlyLeaks as on, frameworkApiKeyStrategy as sn, getConnectionSubject as cn, getTimelineRecorder as ln, installPolicyGuardResolver as un, isAggregateDefinition as dn, isEmptyTenantScopedRead as fn, isOrglessUserSubject as pn, isScheduleDefinition as mn, isWorkflowEventTriggerDefinition as hn, listRetentions as gn, loadResourceTuples as _n, localityAwareSelector as vn, makeActionRunner as yn, makeAdvisoryLockCoordinator as bn, makeApiKeyService as xn, makeApiKeyUsageBuffer as Sn, makeApiKeyUsageFlusher as Cn, makeAppAccess as wn, makeAsyncKv as Tn, makeBufferingSpanProcessor as En, makeConnectionRegistry as Dn, makeConnectionResolver as On, makeConnectionsFacade as kn, makeCoordinatedScheduler as An, makeDataLoader as jn, makeDisconnectConnectionExecutor as Mn, makeEffectStoreLayer as Nn, makeEventsFacade as Pn, makeLazyWorkflowFacade as Fn, makeListConnectionsExecutor as In, makeMutationRunner as Ln, makeOneShotQueryRunner as Rn, makeOutboxFacade as zn, makePostCommitWorkflowFacade as Bn, makeQueryDescriptorProducer as Vn, makeQueryReauthorizer as Hn, makeQuerySubscriber as Un, makeSchemaRegistry as Wn, makeStartConnectionExecutor as Gn, makeSubmitTokenExecutor as Kn, makeUndoCapture as qn, makeWorkflowFacade as Jn, makeWorkflowFacadeWithCallerContext as Yn, makeWorkflowLayers as Xn, memoryRywPositionStore as Zn, nextFiring as Qn, noopAnalytics as B, noopAnalyticsSpec as $n, observedGraph as er, powerOfTwoSelector as tr, recordSubscriptionDelivery as nr, recordTimelineEvent as rr, redisRywPositionStore as ir, redoUndoInvocation as ar, registerRetention as or, registerWakeup as sr, resolveCurrentRegion as cr, resolveSecretsBackend as lr, retentionTtlMsFromEnv as ur, runProvidedEffect as dr, runReaction as fr, sanitizeRedirectTo as pr, serverOnlyLeaks as mr, setConnectionResolver as hr, setSecretsBackend as gr, setSystemStoreHandle as _r, setTupleSource as vr, singleCoordinator as yr, ssrfGuardHttpClientLayer as br, startRpcServer as xr, startScheduler as Sr, sweepRetention as Cr, tracingHttpClientLayer as wr, undoCaptureEnabled as Tr, undoLogExecutor as Er, wrapStoreWithMixinBehaviour as Dr } from "@voltro/runtime";
18
+ import { Rpc as Or, RpcGroup as kr } from "@effect/rpc";
19
+ import { SqlClient as V } from "@effect/sql";
20
+ import { WorkflowEngine as Ar } from "@effect/workflow";
21
+ import { WorkflowStepInterceptorTag as jr, closeWorkflowChildrenForParent as Mr, completeSuspendingSignal as Nr, getWorkflowVersionMetadata as Pr, isWorkflowWorkerLayer as Fr, makeWorkflowRunRecorder as Ir, sendWorkflowSignal as Lr, sendWorkflowUpdate as Rr, serialiseWorkflowRowForWire as zr, wrapWorkflowExecuteWithRunRecording as Br } from "@voltro/workflow";
22
+ import { makeClusterCronLayer as Vr, parseShardLockMode as Hr, resolveRunnerIdentity as Ur, resolveRunnerStorage as Wr, workflowEngineLayer as Gr } from "@voltro/workflow/cluster";
23
+ import { loadAgentMessages as Kr, runAgentTurn as qr } from "@voltro/ai";
24
+ import { actorsTable as Jr, allRegisteredTables as Yr, and as Xr, auditAllTableIndexes as Zr, drainIdentifierWarnings as Qr, ensureTableRegistered as $r, eq as H, formatIndexAuditIssue as ei, isSqliteFamily as ti, lt as ni, or as ri, registerCoreTables as ii, registerDiscoveredRelations as ai, resolveTenantNamespace as oi, serverOnlyColumns as si, validateRegisteredRelations as ci, walkLeaves as li } from "@voltro/database";
25
+ import { AuthMiddleware as ui, ConnectionInfoMiddleware as di, Unauthenticated as fi, WorkflowRunHandleSchema as pi, actionToRpc as mi, advisoryResourceGuardWarning as hi, anonymousSubject as gi, checkFrameworkCompat as _i, composeAuthStrategies as vi, composeRpcInterceptors as yi, connectionDisconnectDescriptor as bi, connectionStartDescriptor as xi, connectionSubmitTokenDescriptor as Si, connectionsListQueryDescriptor as Ci, findAdvisoryResourceGuards as wi, mutationToRpc as Ti, publishServerError as Ei, queryToRpc as Di, streamToRpc as Oi, tenantScopedSubject as ki, undoApplyDescriptor as Ai, undoLogQueryDescriptor as ji, undoRedoDescriptor as Mi, workflowCancelDescriptor as Ni, workflowDomainEventsQueryDescriptor as Pi, workflowEventDeliveriesQueryDescriptor as Fi, workflowResumeDescriptor as Ii, workflowRunEventsQueryDescriptor as Li, workflowRunQueryDescriptor as Ri, workflowRunStepsQueryDescriptor as zi, workflowRunsQueryDescriptor as Bi, workflowSignalDescriptor as Vi, workflowUpdateDescriptor as Hi } from "@voltro/protocol";
26
+ import { isEnvContract as Ui } from "@voltro/env";
27
+ import { readCookie as Wi, resolveOptionalSessionSecrets as Gi, verifySessionKeyed as Ki } from "@voltro/protocol/session";
28
+ import { createHash as qi, randomBytes as Ji } from "node:crypto";
29
+ import { declaredSnapshot as Yi, describeOutcome as Xi, fingerprintSchema as Zi, introspectSchema as Qi, pendingFileMigrationIds as $i, planMigrations as ea, runFileBasedMigrations as ta, runFrameworkBootstrap as na, runPlannedMigrations as ra } from "@voltro/database/sql";
30
+ import { Cache as ia, CacheLayer as aa, InvalidationBus as U } from "@voltro/cache";
31
+ import { Kv as oa } from "@voltro/kv";
32
+ import { getAuthSessionStrategy as sa } from "@voltro/plugin-auth";
33
+ import { collectPublicApiRoutes as ca, restRoutesToHttpRoutes as la } from "@voltro/protocol/rest";
34
+ import { spawn as ua } from "node:child_process";
35
+ import { watch as da } from "chokidar";
36
+ import { agentRouteDescriptors as fa, isAgentDescriptor as pa } from "@voltro/ai/agent";
37
+ import { ArrayFormatter as ma } from "effect/ParseResult";
38
+ import { buildDeliverWebhookExecute as ha, buildWebhooksService as ga, defaultIncomingPath as _a, deliverWebhookWorkflow as va, isWebhookDescriptor as ya, mountIncomingWebhook as ba } from "@voltro/plugin-webhooks";
39
+ import { isEmailTemplate as xa, registerEmailTemplates as Sa } from "@voltro/plugin-mail";
40
+ import { attachBroadcastBus as Ca, getBroadcastPlugin as wa } from "@voltro/plugin-broadcast";
41
+ import { runImport as Ta } from "@voltro/data-transfer";
42
+ import { createServer as Ea } from "node:http";
43
43
  //#region src/envSecretMint.ts
44
- var Oa = (e, t) => {
44
+ var Da = (e, t) => {
45
45
  if (typeof process.getuid != "function") return;
46
46
  let n;
47
47
  try {
48
- n = Ot(t);
48
+ n = Dt(t);
49
49
  } catch {
50
50
  return;
51
51
  }
@@ -56,30 +56,30 @@ var Oa = (e, t) => {
56
56
  } catch (t) {
57
57
  return `${e} was written as uid ${r} but the workspace is owned by uid ${n.uid}, and it could not be handed over (${t.message}). The file is mode 0600, so tools running as uid ${n.uid} — your tests, your editor, \`voltro doctor\` — will fail to read it with EACCES. Run this container as the workspace owner (docker \`--user ${n.uid}:${n.gid}\`), or set the variable(s) yourself so nothing needs minting.`;
58
58
  }
59
- }, U = ".env.local", ka = (e) => {
59
+ }, W = ".env.local", Oa = (e) => {
60
60
  let t = O(e, ".gitignore"), n = "";
61
61
  try {
62
- Tt(t) && (n = Et(t, "utf8"));
62
+ L(t) && (n = Tt(t, "utf8"));
63
63
  } catch {
64
64
  return !1;
65
65
  }
66
- if (n.split(/\r?\n/).map((e) => e.trim()).some((e) => e === U || e === `/${U}` || e === ".env*" || e === ".env.*" || e === ".env.local*")) return !0;
66
+ if (n.split(/\r?\n/).map((e) => e.trim()).some((e) => e === W || e === `/${W}` || e === ".env*" || e === ".env.*" || e === ".env.local*")) return !0;
67
67
  try {
68
- return wt(t, `${n === "" || n.endsWith("\n") ? "" : "\n"}\n# Local secrets minted by \`voltro dev\` — machine-specific, never commit.\n${U}\n`, "utf8"), !0;
68
+ return wt(t, `${n === "" || n.endsWith("\n") ? "" : "\n"}\n# Local secrets minted by \`voltro dev\` — machine-specific, never commit.\n${W}\n`, "utf8"), !0;
69
69
  } catch {
70
70
  return !1;
71
71
  }
72
- }, Aa = (e) => Yi(32).toString(e), W = [{
72
+ }, ka = (e) => Ji(32).toString(e), G = [{
73
73
  key: "VOLTRO_INSPECT_TOKEN",
74
74
  encoding: "base64url",
75
75
  description: "Bearer token for /_voltro/inspect/* — minted so the dev inspect surface is not open to the network."
76
- }], ja = (e, t, n = process.env) => {
76
+ }], Aa = (e, t, n = process.env) => {
77
77
  let r = [];
78
- for (let e of W) {
78
+ for (let e of G) {
79
79
  let t = n[e.key];
80
80
  t !== void 0 && t.trim() !== "" || r.push({
81
81
  key: e.key,
82
- value: Aa(e.encoding),
82
+ value: ka(e.encoding),
83
83
  description: e.description
84
84
  });
85
85
  }
@@ -88,24 +88,24 @@ var Oa = (e, t) => {
88
88
  let e = n[t];
89
89
  e !== void 0 && e.trim() !== "" || r.push({
90
90
  key: t,
91
- value: Aa(i.generate),
91
+ value: ka(i.generate),
92
92
  description: i.description
93
93
  });
94
94
  }
95
95
  if (r.length === 0) return { minted: [] };
96
- if (!ka(t)) throw Error(`cannot mint ${r.map((e) => e.key).join(", ")}: failed to add "${U}" to ${O(t, ".gitignore")}. Refusing to write a secret to a path that might be committed — add the entry by hand, or set the variable(s) yourself (\`voltro secret generate\`).`);
97
- let i = O(t, U), a = r.map((e) => `${e.description ? `# ${e.description}\n` : ""}${e.key}=${e.value}`).join("\n"), o;
96
+ if (!Oa(t)) throw Error(`cannot mint ${r.map((e) => e.key).join(", ")}: failed to add "${W}" to ${O(t, ".gitignore")}. Refusing to write a secret to a path that might be committed — add the entry by hand, or set the variable(s) yourself (\`voltro secret generate\`).`);
97
+ let i = O(t, W), a = r.map((e) => `${e.description ? `# ${e.description}\n` : ""}${e.key}=${e.value}`).join("\n"), o;
98
98
  try {
99
- if (Tt(i)) {
100
- let e = Et(i, "utf8");
99
+ if (L(i)) {
100
+ let e = Tt(i, "utf8");
101
101
  wt(i, `${e === "" || e.endsWith("\n") ? "" : "\n"}\n${a}\n`, "utf8");
102
- } else kt(i, `# Minted by \`voltro dev\` — unique to this project and this machine.
102
+ } else Ot(i, `# Minted by \`voltro dev\` — unique to this project and this machine.
103
103
  # Not committed (see .gitignore). Your deployment needs its OWN values:
104
104
  # voltro secret generate
105
105
  \n${a}\n`, {
106
106
  encoding: "utf8",
107
107
  mode: 384
108
- }), o = Oa(i, t);
108
+ }), o = Da(i, t);
109
109
  } catch (e) {
110
110
  throw Error(`cannot mint ${r.map((e) => e.key).join(", ")}: failed to write ${i} — ${e.message}`);
111
111
  }
@@ -115,9 +115,9 @@ var Oa = (e, t) => {
115
115
  file: i,
116
116
  ...o ? { ownershipWarning: o } : {}
117
117
  };
118
- }, Ma = [".framework", ".env.local"], Na = /\.generated\./i, Pa = (e) => {
118
+ }, ja = [".framework", ".env.local"], Ma = /\.generated\./i, Na = (e) => {
119
119
  try {
120
- let t = Ot(e);
120
+ let t = Dt(e);
121
121
  return {
122
122
  uid: t.uid,
123
123
  gid: t.gid
@@ -125,7 +125,7 @@ var Oa = (e, t) => {
125
125
  } catch {
126
126
  return;
127
127
  }
128
- }, Fa = (e, t, n) => {
128
+ }, Pa = (e, t, n) => {
129
129
  let r = !0;
130
130
  try {
131
131
  I(e, t, n);
@@ -134,49 +134,49 @@ var Oa = (e, t) => {
134
134
  }
135
135
  let i = [];
136
136
  try {
137
- if (!Ot(e).isDirectory()) return r;
138
- i = Dt(e);
137
+ if (!Dt(e).isDirectory()) return r;
138
+ i = Et(e);
139
139
  } catch {
140
140
  return r;
141
141
  }
142
- for (let a of i) Fa(O(e, a), t, n) || (r = !1);
142
+ for (let a of i) Pa(O(e, a), t, n) || (r = !1);
143
143
  return r;
144
- }, Ia = (e) => {
144
+ }, Fa = (e) => {
145
145
  if (typeof process.getuid != "function") return { adopted: [] };
146
- let t = Pa(e);
146
+ let t = Na(e);
147
147
  if (t === void 0) return { adopted: [] };
148
148
  let n = process.getuid();
149
149
  if (t.uid === n) return { adopted: [] };
150
- let r = [...Ma];
150
+ let r = [...ja];
151
151
  try {
152
- for (let t of Dt(e)) Na.test(t) && r.push(t);
152
+ for (let t of Et(e)) Ma.test(t) && r.push(t);
153
153
  } catch {}
154
154
  let i = [], a = !1;
155
155
  for (let n of r) {
156
156
  let r = O(e, n);
157
- Pa(r) !== void 0 && (Fa(r, t.uid, t.gid) ? i.push(n) : a = !0);
157
+ Na(r) !== void 0 && (Pa(r, t.uid, t.gid) ? i.push(n) : a = !0);
158
158
  }
159
159
  return a ? {
160
160
  adopted: i,
161
161
  warning: `generated files under ${e} are owned by uid ${n} but the workspace is owned by uid ${t.uid}, and they could not be handed over. On the host, tools running as uid ${t.uid} will fail with EACCES — \`voltro build\` cannot read \`.framework\`, and \`vitest\` cannot read \`.env.local\`. Run this container as the workspace owner (docker \`--user ${t.uid}:${t.gid}\`).`
162
162
  } : { adopted: i };
163
- }, La = (e) => e.startsWith("_voltro_"), Ra = (e) => e === void 0 || e === "" || !/^file:/i.test(e) || (process.env.TURSO_SYNC_URL ?? "") !== "", za = (e) => {
164
- if (e.dialect === "turso" && Ra(e.dbUrl)) return [{
163
+ }, Ia = (e) => e.startsWith("_voltro_"), La = (e) => e === void 0 || e === "" || !/^file:/i.test(e) || (process.env.TURSO_SYNC_URL ?? "") !== "", Ra = (e) => {
164
+ if (e.dialect === "turso" && La(e.dbUrl)) return [{
165
165
  level: "warn",
166
166
  message: "turso is configured against a shared primary, but this dialect has no NATIVE cross-instance change capture: it reuses the SQLite store, which emits inline only. Subscribers see writes made by THEIR OWN instance and never another's — for every table, regardless of .nonReactive(). Add @voltro/plugin-broadcast (Redis / NATS) to fan changes out between instances, or run a single instance."
167
167
  }];
168
168
  if (e.changeStrategy !== "cdc" || e.dialect === "sqlite" || e.dialect === "turso") return [];
169
- let t = new Set(e.querySources.filter((e) => !La(e))), n = e.tables.filter((e) => !La(e.tableName)).filter((e) => e.isReactive === !1 && t.has(e.tableName)).map((e) => e.tableName).sort();
169
+ let t = new Set(e.querySources.filter((e) => !Ia(e))), n = e.tables.filter((e) => !Ia(e.tableName)).filter((e) => e.isReactive === !1 && t.has(e.tableName)).map((e) => e.tableName).sort();
170
170
  if (n.length === 0) return [];
171
171
  let r = n.slice(0, 8).join(", "), i = n.length > 8 ? `, … (+${n.length - 8})` : "";
172
172
  return [{
173
173
  level: "warn",
174
174
  message: `${n.length} table(s) are .nonReactive() but a query declares them as a source — ${r}${i}. Those subscriptions will NEVER fire: a non-reactive table emits no change events at all, in this process or any other, so the query returns its first snapshot and then goes quiet forever. Either drop .nonReactive() from the table, or stop subscribing to it.`
175
175
  }];
176
- }, Ba = "VOLTRO_REMOTE_MIGRATIONS_OK", Va = /^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/, G = (e) => {
176
+ }, za = "VOLTRO_REMOTE_MIGRATIONS_OK", Ba = /^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/, K = (e) => {
177
177
  let t = e.toLowerCase().replace(/^\[|\]$/g, "");
178
- return !!(t === "" || t === "localhost" || t === "ip6-localhost" || t === "::1" || t === "0.0.0.0" || t === "::" || t.startsWith("127.") || t === "host.docker.internal" || t === "gateway.docker.internal" || t.endsWith(".localhost") || t.endsWith(".local") || Va.test(t) || !t.includes(".") && !t.includes(":"));
179
- }, Ha = (e) => {
178
+ return !!(t === "" || t === "localhost" || t === "ip6-localhost" || t === "::1" || t === "0.0.0.0" || t === "::" || t.startsWith("127.") || t === "host.docker.internal" || t === "gateway.docker.internal" || t.endsWith(".localhost") || t.endsWith(".local") || Ba.test(t) || !t.includes(".") && !t.includes(":"));
179
+ }, Va = (e) => {
180
180
  if (e.url !== void 0 && e.url !== "") {
181
181
  if (/^(file|sqlite):/i.test(e.url)) return {
182
182
  kind: "local",
@@ -185,7 +185,7 @@ var Oa = (e, t) => {
185
185
  try {
186
186
  let t = new URL(e.url).hostname;
187
187
  return {
188
- kind: G(t) ? "local" : "remote",
188
+ kind: K(t) ? "local" : "remote",
189
189
  host: t
190
190
  };
191
191
  } catch {
@@ -197,12 +197,12 @@ var Oa = (e, t) => {
197
197
  }
198
198
  let t = e.host ?? "localhost";
199
199
  return {
200
- kind: G(t) ? "local" : "remote",
200
+ kind: K(t) ? "local" : "remote",
201
201
  host: t
202
202
  };
203
- }, Ua = (e) => {
203
+ }, Ha = (e) => {
204
204
  if (e.pendingIds.length === 0 || e.optIn) return { allowed: !0 };
205
- let t = Ha(e.conn);
205
+ let t = Va(e.conn);
206
206
  if (t.kind === "local") return { allowed: !0 };
207
207
  let n = e.pendingIds.map((e) => ` • ${e}`).join("\n");
208
208
  return {
@@ -221,11 +221,11 @@ var Oa = (e, t) => {
221
221
  " Choose one:",
222
222
  " • Point the app at a local database (DB_URL), which is what dev boot assumes.",
223
223
  " • Apply them deliberately, once: voltro db files .",
224
- ` • Accept it for this environment: ${Ba}=1`
224
+ ` • Accept it for this environment: ${za}=1`
225
225
  ].join("\n")
226
226
  };
227
- }, Wa = async ({ env: e = process.env } = {}) => {
228
- let t = _t.make(P.mergeAll(oa.layer, H.Default)), n = await t.runPromise(aa), r = await t.runPromise(H), i = (e.CACHE_BACKEND ?? "memory").toLowerCase();
227
+ }, Ua = async ({ env: e = process.env } = {}) => {
228
+ let t = _t.make(P.mergeAll(aa.layer, U.Default)), n = await t.runPromise(ia), r = await t.runPromise(U), i = (e.CACHE_BACKEND ?? "memory").toLowerCase();
229
229
  return await t.runPromise(r.addSink((e) => n.invalidateTag(e))), {
230
230
  service: n,
231
231
  invalidationBus: r,
@@ -257,26 +257,26 @@ var Oa = (e, t) => {
257
257
  stats: () => t.runSync(n.stats()),
258
258
  dispose: () => t.dispose()
259
259
  };
260
- }, Ga = ({ store: e, dialect: t, env: n = process.env }) => {
260
+ }, Wa = ({ store: e, dialect: t, env: n = process.env }) => {
261
261
  if (t !== "postgres") return { stop: () => {} };
262
- sr({
262
+ or({
263
263
  table: "_voltro_schedule_runs",
264
264
  timeColumn: "scheduledAt",
265
- ttlMs: dr(n.VOLTRO_SCHEDULE_RUNS_TTL_HOURS, 720)
266
- }), sr({
265
+ ttlMs: ur(n.VOLTRO_SCHEDULE_RUNS_TTL_HOURS, 720)
266
+ }), or({
267
267
  table: "_voltro_workflow_runs",
268
268
  timeColumn: "completedAt",
269
- ttlMs: dr(n.VOLTRO_WORKFLOW_RUNS_TTL_HOURS, 720),
270
- where: ii(V("status", "succeeded"), V("status", "failed"), V("status", "cancelled"))
271
- }), sr({
269
+ ttlMs: ur(n.VOLTRO_WORKFLOW_RUNS_TTL_HOURS, 720),
270
+ where: ri(H("status", "succeeded"), H("status", "failed"), H("status", "cancelled"))
271
+ }), or({
272
272
  table: "_voltro_outbox_attempts",
273
273
  timeColumn: "startedAt",
274
- ttlMs: dr(n.VOLTRO_OUTBOX_ATTEMPTS_TTL_HOURS, 720)
275
- }), sr({
274
+ ttlMs: ur(n.VOLTRO_OUTBOX_ATTEMPTS_TTL_HOURS, 720)
275
+ }), or({
276
276
  table: "_voltro_outbox",
277
277
  timeColumn: "deliveredAt",
278
- ttlMs: dr(n.VOLTRO_OUTBOX_TTL_HOURS, 720),
279
- where: V("status", "delivered")
278
+ ttlMs: ur(n.VOLTRO_OUTBOX_TTL_HOURS, 720),
279
+ where: H("status", "delivered")
280
280
  });
281
281
  let r = e.raw?.bind(e), i = (e) => {
282
282
  if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)) throw Error(`retention: unsafe identifier "${e}"`);
@@ -291,7 +291,7 @@ var Oa = (e, t) => {
291
291
  };
292
292
  return (await r(e)).length;
293
293
  }
294
- let d = ri(l, a), f = s === void 0 ? d : Zr(d, s), p = await e.query({
294
+ let d = ni(l, a), f = s === void 0 ? d : Xr(d, s), p = await e.query({
295
295
  table: c,
296
296
  order: [],
297
297
  predicate: f,
@@ -305,48 +305,48 @@ var Oa = (e, t) => {
305
305
  return p.length;
306
306
  }, o = async () => {
307
307
  let e = Date.now();
308
- for (let t of _n()) try {
309
- await wr(t, e, a, 2e4);
308
+ for (let t of gn()) try {
309
+ await Cr(t, e, a, 2e4);
310
310
  } catch {}
311
311
  }, s = setInterval(() => {
312
312
  o();
313
313
  }, 5 * 6e4);
314
314
  return s.unref?.(), { stop: () => clearInterval(s) };
315
- }, Ka = (e) => {
316
- let t = Mn({ store: e.store });
315
+ }, Ga = (e) => {
316
+ let t = jn({ store: e.store });
317
317
  return {
318
- storeForTenant: (t) => Or(e.store, {
319
- subject: Ai(Bt, t),
318
+ storeForTenant: (t) => Dr(e.store, {
319
+ subject: ki(zt, t),
320
320
  schemaRegistry: e.schemaRegistry
321
321
  }),
322
- store: Or(e.store, {
323
- subject: Bt,
322
+ store: Dr(e.store, {
323
+ subject: zt,
324
324
  schemaRegistry: e.schemaRegistry
325
325
  }),
326
326
  request: {
327
- subject: Bt,
327
+ subject: zt,
328
328
  traceId: "webhooks:trigger"
329
329
  },
330
- access: Tn(Bt),
330
+ access: wn(zt),
331
331
  load: t.load,
332
332
  loadMany: t.loadMany,
333
333
  cache: e.cache,
334
334
  kv: e.kv
335
335
  };
336
- }, qa = (e) => {
336
+ }, Ka = (e) => {
337
337
  let { store: t, schemaRegistry: n, cache: r, kv: i, webhooksService: a, workflowsProxy: o, eventTriggers: s, namespaceIsolationOn: c, onEventEmit: l, outbox: u, connections: d } = e, f = (e, t) => {
338
338
  if (!c) return e;
339
339
  if (e.withNamespace === void 0) throw Error("tenantIsolation=namespace is set but the active store has no physical-namespace support (withNamespace).");
340
- return e.withNamespace(si(t.tenantId));
340
+ return e.withNamespace(oi(t.tenantId));
341
341
  };
342
342
  return (e, c = t, p, m = "app-context", h) => {
343
- let g = f(c, e.subject), _ = o === void 0 ? void 0 : Xn(o, {
343
+ let g = f(c, e.subject), _ = o === void 0 ? void 0 : Yn(o, {
344
344
  subject: e.subject,
345
345
  traceId: e.traceId,
346
346
  source: m,
347
347
  ...h?.parentExecutionId === void 0 ? {} : { parentExecutionId: h.parentExecutionId },
348
348
  ...h?.parentClosePolicy === void 0 ? {} : { parentClosePolicy: h.parentClosePolicy }
349
- }), ee = s.length === 0 || o === void 0 ? void 0 : Fn({
349
+ }), ee = s.length === 0 || o === void 0 ? void 0 : Pn({
350
350
  triggers: s,
351
351
  store: g,
352
352
  source: m,
@@ -355,30 +355,30 @@ var Oa = (e, t) => {
355
355
  ...l === void 0 ? {} : { emit: l },
356
356
  ...h?.parentExecutionId === void 0 ? {} : { parentExecutionId: h.parentExecutionId },
357
357
  startWorkflow: (e, t, n) => {
358
- let r = Xn(o, n);
359
- return (p ? Vn(r, p.afterCommit) : r).start(e, t);
358
+ let r = Yn(o, n);
359
+ return (p ? Bn(r, p.afterCommit) : r).start(e, t);
360
360
  }
361
- }), te = u === void 0 ? void 0 : Bn({
361
+ }), te = u === void 0 ? void 0 : zn({
362
362
  store: g,
363
363
  subject: e.subject,
364
364
  traceId: e.traceId,
365
365
  nudge: u.nudge,
366
366
  ...p === void 0 ? {} : { afterCommit: p.afterCommit }
367
- }), ne = d === void 0 ? void 0 : An({
367
+ }), ne = d === void 0 ? void 0 : kn({
368
368
  store: g,
369
369
  registry: d.registry,
370
370
  subject: e.subject
371
- }), re = Mn({ store: g }), ie = e.rowFilter === void 0 ? {} : { rowFilter: e.rowFilter };
371
+ }), re = jn({ store: g }), ie = e.rowFilter === void 0 ? {} : { rowFilter: e.rowFilter };
372
372
  return {
373
373
  storeForTenant: (t) => {
374
- let r = Ai(e.subject, t);
375
- return Or(f(c, r), {
374
+ let r = ki(e.subject, t);
375
+ return Dr(f(c, r), {
376
376
  subject: r,
377
377
  schemaRegistry: n,
378
378
  ...ie
379
379
  });
380
380
  },
381
- store: Or(g, {
381
+ store: Dr(g, {
382
382
  subject: e.subject,
383
383
  schemaRegistry: n,
384
384
  ...e.rowFilter === void 0 ? {} : { rowFilter: e.rowFilter }
@@ -386,19 +386,19 @@ var Oa = (e, t) => {
386
386
  load: re.load,
387
387
  loadMany: re.loadMany,
388
388
  request: e,
389
- access: Tn(e.subject),
389
+ access: wn(e.subject),
390
390
  cache: r,
391
391
  kv: i,
392
392
  ...a === void 0 ? {} : { webhooks: a },
393
393
  ...ee === void 0 ? {} : { events: ee },
394
394
  ...te === void 0 ? {} : { outbox: te },
395
395
  ...ne === void 0 ? {} : { connections: ne },
396
- ..._ === void 0 ? {} : { workflows: p ? Vn(_, p.afterCommit) : _ }
396
+ ..._ === void 0 ? {} : { workflows: p ? Bn(_, p.afterCommit) : _ }
397
397
  };
398
398
  };
399
- }, Ja = async (e, t, n) => {
400
- if (t.type === "anonymous" || t.id == null) throw new pi({ reason: "workflow control requires an authenticated subject" });
401
- let r = "id" in n ? V("id", n.id) : V("executionId", n.executionId), i = (await e.query({
399
+ }, qa = async (e, t, n) => {
400
+ if (t.type === "anonymous" || t.id == null) throw new fi({ reason: "workflow control requires an authenticated subject" });
401
+ let r = "id" in n ? H("id", n.id) : H("executionId", n.executionId), i = (await e.query({
402
402
  table: "_voltro_workflow_runs",
403
403
  order: [],
404
404
  predicate: r,
@@ -406,9 +406,9 @@ var Oa = (e, t) => {
406
406
  skip: void 0,
407
407
  take: 1
408
408
  }))[0], a = i?.subject?.tenantId ?? null, o = t.tenantId ?? null;
409
- if (i === void 0 || a !== o) throw new pi({ reason: "not authorized for this workflow run" });
410
- }, Ya = (e = {}) => Tr.pipe(P.provide(xr(e)), P.provide(ft.layer), P.provide(P.succeed(ft.RequestInit, { redirect: "manual" }))), Xa = (e) => {
411
- let t = P.succeed(aa, e.cacheService), n = P.succeed(sa, e.kvService), r = [
409
+ if (i === void 0 || a !== o) throw new fi({ reason: "not authorized for this workflow run" });
410
+ }, Ja = (e = {}) => wr.pipe(P.provide(br(e)), P.provide(ft.layer), P.provide(P.succeed(ft.RequestInit, { redirect: "manual" }))), Ya = (e) => {
411
+ let t = P.succeed(ia, e.cacheService), n = P.succeed(oa, e.kvService), r = [
412
412
  e.analyticsLayer,
413
413
  t,
414
414
  n,
@@ -416,55 +416,55 @@ var Oa = (e, t) => {
416
416
  ...e.userLayers
417
417
  ];
418
418
  return P.mergeAll(...r);
419
- }, Za = [
420
- zi,
421
- Vi,
422
- Bi,
419
+ }, Xa = [
423
420
  Ri,
424
- Fi,
425
- Ii
426
- ], Qa = (e, t, n) => {
421
+ Bi,
422
+ zi,
423
+ Li,
424
+ Pi,
425
+ Fi
426
+ ], Za = (e, t, n) => {
427
427
  let r = new Set(t);
428
- if (n) for (let e of Za) r.add(e.name);
428
+ if (n) for (let e of Xa) r.add(e.name);
429
429
  let i = {};
430
430
  for (let [t, n] of Object.entries(e)) i[t] = r.has(t) ? (e) => n(e).pipe(xt.take(1)) : n;
431
431
  return i;
432
- }, $a = F({ scope: "voltro:dev:supervisor" }), eo = /\.generated\./, to = /\.([cm]?[jt]sx?|json)$/, no = (e) => {
432
+ }, Qa = F({ scope: "voltro:dev:supervisor" }), $a = /\.generated\./, eo = /\.([cm]?[jt]sx?|json)$/, to = (e) => {
433
433
  let t = E(e);
434
- return !eo.test(t) && to.test(t);
435
- }, ro = (e) => e.startsWith("node_modules") || e.startsWith(".framework") || e.startsWith(".turbo") || e.startsWith(".vite") || e.startsWith("dist") || e.startsWith(".git"), io = process.env.WATCH_POLL === "1" || process.env.CHOKIDAR_USEPOLLING === "1", ao = 1e3, oo = (e) => xt.async((t) => {
436
- let n = A(e), r = (e) => k(n, e), i = fa(n, {
434
+ return !$a.test(t) && eo.test(t);
435
+ }, no = (e) => e.startsWith("node_modules") || e.startsWith(".framework") || e.startsWith(".turbo") || e.startsWith(".vite") || e.startsWith("dist") || e.startsWith(".git"), ro = process.env.WATCH_POLL === "1" || process.env.CHOKIDAR_USEPOLLING === "1", io = 1e3, ao = (e) => xt.async((t) => {
436
+ let n = A(e), r = (e) => k(n, e), i = da(n, {
437
437
  persistent: !0,
438
438
  ignoreInitial: !0,
439
439
  atomic: !0,
440
- usePolling: io,
441
- interval: ao,
442
- binaryInterval: ao,
440
+ usePolling: ro,
441
+ interval: io,
442
+ binaryInterval: io,
443
443
  ignored: (e) => {
444
444
  let t = r(e);
445
- return t === "" ? !1 : ro(t) || eo.test(E(e));
445
+ return t === "" ? !1 : no(t) || $a.test(E(e));
446
446
  }
447
447
  });
448
448
  return i.on("all", (e, n) => {
449
449
  let i = r(n);
450
- process.env.WATCH_DEBUG === "1" && $a.trace("watcher fired", {
450
+ process.env.WATCH_DEBUG === "1" && Qa.trace("watcher fired", {
451
451
  event: e,
452
452
  file: i
453
- }), !ro(i) && no(i) && t.single({ file: i });
453
+ }), !no(i) && to(i) && t.single({ file: i });
454
454
  }), i.on("error", (e) => {
455
- $a.error("watcher error", { hint: io ? void 0 : "on a bind-mount (k8s hostPath / Docker volume) set WATCH_POLL=1" }, e);
455
+ Qa.error("watcher error", { hint: ro ? void 0 : "on a bind-mount (k8s hostPath / Docker volume) set WATCH_POLL=1" }, e);
456
456
  }), N.sync(() => {
457
457
  i.close();
458
458
  });
459
- }), so = (e) => N.async((t) => {
459
+ }), oo = (e) => N.async((t) => {
460
460
  if (e.exitCode !== null) {
461
461
  t(N.succeed(e.exitCode));
462
462
  return;
463
463
  }
464
464
  e.once("exit", (e, n) => t(N.succeed(e ?? +!!n)));
465
- }), co = (e) => N.acquireUseRelease(N.sync(() => {
465
+ }), so = (e) => N.acquireUseRelease(N.sync(() => {
466
466
  let t = process.argv[1] ?? "";
467
- return da(process.execPath, [
467
+ return ua(process.execPath, [
468
468
  "--import",
469
469
  "tsx",
470
470
  t,
@@ -477,7 +477,7 @@ var Oa = (e, t) => {
477
477
  FRAMEWORK_DEV_INNER: "1"
478
478
  }
479
479
  });
480
- }), so, (e) => N.async((t) => {
480
+ }), oo, (e) => N.async((t) => {
481
481
  if (e.exitCode !== null || e.killed) {
482
482
  t(N.void);
483
483
  return;
@@ -489,20 +489,20 @@ var Oa = (e, t) => {
489
489
  e.once("exit", () => {
490
490
  clearTimeout(n), t(N.void);
491
491
  });
492
- })), lo = (e) => e.exitCode === 0 ? "stop" : e.keepAlive === "1" ? "wait-for-fix" : e.keepAlive === "0" ? "stop" : e.interactive ? "wait-for-fix" : "stop", uo = (e) => N.gen(function* () {
493
- $a.info("supervisor active — watching project root", {
492
+ })), co = (e) => e.exitCode === 0 ? "stop" : e.keepAlive === "1" ? "wait-for-fix" : e.keepAlive === "0" ? "stop" : e.interactive ? "wait-for-fix" : "stop", lo = (e) => N.gen(function* () {
493
+ Qa.info("supervisor active — watching project root", {
494
494
  root: e.root,
495
495
  patterns: ["**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs,json} (excl. *.generated.*)"],
496
- watcher: io ? "chokidar (polling)" : "chokidar (native)",
496
+ watcher: ro ? "chokidar (polling)" : "chokidar (native)",
497
497
  hint: "WATCH=0 disables, WATCH_DEBUG=1 traces every event, WATCH_POLL=1 for bind-mounts (k8s/Docker)"
498
498
  });
499
499
  let t = yield* yt.make(vt.none()), n = yield* M.make(), r = N.gen(function* () {
500
- let r = yield* N.fork(co(e.root).pipe(N.flatMap((e) => lo({
500
+ let r = yield* N.fork(so(e.root).pipe(N.flatMap((e) => co({
501
501
  exitCode: e,
502
502
  interactive: process.stdout.isTTY === !0,
503
503
  keepAlive: process.env.VOLTRO_DEV_KEEP_ALIVE
504
504
  }) === "stop" ? M.succeed(n, e) : N.sync(() => {
505
- $a.error("dev server crashed — waiting for a file change", {
505
+ Qa.error("dev server crashed — waiting for a file change", {
506
506
  exitCode: e,
507
507
  hint: "fix the cause and save; Ctrl-C to stop. VOLTRO_DEV_KEEP_ALIVE=0 exits instead."
508
508
  });
@@ -516,14 +516,14 @@ var Oa = (e, t) => {
516
516
  }), yield* yt.set(t, vt.none());
517
517
  });
518
518
  yield* r;
519
- let a = oo(e.root).pipe(xt.debounce(ht.millis(80)), xt.runForEach((e) => N.gen(function* () {
519
+ let a = ao(e.root).pipe(xt.debounce(ht.millis(80)), xt.runForEach((e) => N.gen(function* () {
520
520
  let t = Date.now();
521
- $a.info("file changed — restarting", { file: e.file }), yield* i, yield* r, $a.info("restart complete", { ms: Date.now() - t });
521
+ Qa.info("file changed — restarting", { file: e.file }), yield* i, yield* r, Qa.info("restart complete", { ms: Date.now() - t });
522
522
  })), N.andThen(N.never), N.as(0)), o = yield* N.raceFirst(a, M.await(n));
523
- o === 0 ? $a.info("dev server exited — supervisor stopping") : $a.error("dev server exited — supervisor stopping", { exitCode: o }), yield* N.sync(() => {
523
+ o === 0 ? Qa.info("dev server exited — supervisor stopping") : Qa.error("dev server exited — supervisor stopping", { exitCode: o }), yield* N.sync(() => {
524
524
  process.exitCode = o;
525
525
  });
526
- }), fo = /* @__PURE__ */ new Set(/* @__PURE__ */ "crypto.fs.path.os.net.http.https.http2.tls.dns.dgram.stream.zlib.child_process.worker_threads.cluster.readline.vm.module.perf_hooks.async_hooks.inspector.v8.process.tty.repl.constants.sys.string_decoder".split(".")), K = (e) => e.startsWith("node:") || fo.has(e) || e === "@voltro/workflow" ? !0 : e === "@voltro/database/wire" ? !1 : e === "@voltro/database" || e.startsWith("@voltro/database/") || e === "@voltro/runtime" || e.startsWith("@voltro/runtime/") ? !0 : e === "@voltro/ai/agent" || e === "@voltro/ai/events" ? !1 : !!(e === "@voltro/ai" || e.startsWith("@voltro/ai/") || [
526
+ }), uo = /* @__PURE__ */ new Set(/* @__PURE__ */ "crypto.fs.path.os.net.http.https.http2.tls.dns.dgram.stream.zlib.child_process.worker_threads.cluster.readline.vm.module.perf_hooks.async_hooks.inspector.v8.process.tty.repl.constants.sys.string_decoder".split(".")), q = (e) => e.startsWith("node:") || uo.has(e) || e === "@voltro/workflow" ? !0 : e === "@voltro/database/wire" ? !1 : e === "@voltro/database" || e.startsWith("@voltro/database/") || e === "@voltro/runtime" || e.startsWith("@voltro/runtime/") ? !0 : e === "@voltro/ai/agent" || e === "@voltro/ai/events" ? !1 : !!(e === "@voltro/ai" || e.startsWith("@voltro/ai/") || [
527
527
  "@voltro/protocol/session",
528
528
  "@voltro/protocol/jwt",
529
529
  "@voltro/protocol/apikey"
@@ -542,8 +542,8 @@ var Oa = (e, t) => {
542
542
  "@prisma/client",
543
543
  "nodemailer",
544
544
  "jose"
545
- ].includes(e)), po = (e) => e.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/(^|[^:])\/\/[^\n]*/g, "$1"), mo = (e) => {
546
- let t = po(e), n = [], r = /(?:^|[\n;}])\s*(?:import|export)\s+([^;'"]*?)\s+from\s+['"]([^'"]+)['"]/g, i;
545
+ ].includes(e)), fo = (e) => e.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/(^|[^:])\/\/[^\n]*/g, "$1"), po = (e) => {
546
+ let t = fo(e), n = [], r = /(?:^|[\n;}])\s*(?:import|export)\s+([^;'"]*?)\s+from\s+['"]([^'"]+)['"]/g, i;
547
547
  for (; (i = r.exec(t)) !== null;) {
548
548
  let e = i[1].trim();
549
549
  if (e === "type" || e.startsWith("type ")) continue;
@@ -559,29 +559,29 @@ var Oa = (e, t) => {
559
559
  let o = /\bimport\(\s*['"]([^'"]+)['"]\s*\)/g;
560
560
  for (; (i = o.exec(t)) !== null;) n.push(i[1]);
561
561
  return n;
562
- }, ho = (e) => e.endsWith(".ts") || e.endsWith(".tsx"), q = async (e) => {
563
- let t = ho(e) ? [e] : [
562
+ }, mo = (e) => e.endsWith(".ts") || e.endsWith(".tsx"), J = async (e) => {
563
+ let t = mo(e) ? [e] : [
564
564
  `${e}.ts`,
565
565
  `${e}.tsx`,
566
566
  O(e, "index.ts"),
567
567
  O(e, "index.tsx")
568
568
  ];
569
569
  for (let e of t) try {
570
- if ((await L.stat(e)).isFile()) return e;
570
+ if ((await R.stat(e)).isFile()) return e;
571
571
  } catch {}
572
572
  return null;
573
- }, go = async (e, t) => {
573
+ }, ho = async (e, t) => {
574
574
  let n = t;
575
575
  for (;;) {
576
576
  let t = O(n, "node_modules", e);
577
577
  try {
578
- if ((await L.stat(t)).isDirectory()) return t;
578
+ if ((await R.stat(t)).isDirectory()) return t;
579
579
  } catch {}
580
580
  let r = D(n);
581
581
  if (r === n) return null;
582
582
  n = r;
583
583
  }
584
- }, _o = (e) => {
584
+ }, go = (e) => {
585
585
  if (typeof e == "string") return e;
586
586
  if (typeof e == "object" && e) {
587
587
  let t = e;
@@ -591,23 +591,23 @@ var Oa = (e, t) => {
591
591
  "node",
592
592
  "default"
593
593
  ]) if (e in t) {
594
- let n = _o(t[e]);
594
+ let n = go(t[e]);
595
595
  if (n !== void 0) return n;
596
596
  }
597
597
  }
598
- }, vo = async (e, t) => {
599
- if (e.startsWith(".")) return q(A(D(t), e));
600
- let n = e.split("/"), r = e.startsWith("@"), i = r ? `${n[0]}/${n[1]}` : n[0], a = r ? n.slice(2) : n.slice(1), o = a.length > 0 ? `./${a.join("/")}` : ".", s = await go(i, D(t));
598
+ }, _o = async (e, t) => {
599
+ if (e.startsWith(".")) return J(A(D(t), e));
600
+ let n = e.split("/"), r = e.startsWith("@"), i = r ? `${n[0]}/${n[1]}` : n[0], a = r ? n.slice(2) : n.slice(1), o = a.length > 0 ? `./${a.join("/")}` : ".", s = await ho(i, D(t));
601
601
  if (!s) return null;
602
602
  try {
603
- let e = JSON.parse(await L.readFile(O(s, "package.json"), "utf8")), t = _o(e.exports?.[o]) ?? (o === "." ? e.module ?? e.main : void 0);
604
- if (typeof t == "string") return q(A(s, t));
603
+ let e = JSON.parse(await R.readFile(O(s, "package.json"), "utf8")), t = go(e.exports?.[o]) ?? (o === "." ? e.module ?? e.main : void 0);
604
+ if (typeof t == "string") return J(A(s, t));
605
605
  } catch {}
606
606
  return null;
607
- }, yo = (e, t) => e.startsWith(t) ? e.slice(t.length).replace(/^[/\\]/, "") : e, bo = async (e, t) => {
607
+ }, vo = (e, t) => e.startsWith(t) ? e.slice(t.length).replace(/^[/\\]/, "") : e, yo = async (e, t) => {
608
608
  let n = /* @__PURE__ */ new Set(), r = [{
609
609
  file: e,
610
- chain: [yo(e, t)]
610
+ chain: [vo(e, t)]
611
611
  }];
612
612
  for (; r.length > 0;) {
613
613
  let { file: e, chain: i } = r.shift();
@@ -615,41 +615,41 @@ var Oa = (e, t) => {
615
615
  n.add(e);
616
616
  let a;
617
617
  try {
618
- a = await L.readFile(e, "utf8");
618
+ a = await R.readFile(e, "utf8");
619
619
  } catch {
620
620
  continue;
621
621
  }
622
- for (let o of mo(a)) {
623
- if (K(o)) return {
622
+ for (let o of po(a)) {
623
+ if (q(o)) return {
624
624
  specifier: o,
625
625
  chain: [...i, o]
626
626
  };
627
- let a = await vo(o, e);
627
+ let a = await _o(o, e);
628
628
  a && !n.has(a) && r.push({
629
629
  file: a,
630
- chain: [...i, `${o} (${yo(a, t)})`]
630
+ chain: [...i, `${o} (${vo(a, t)})`]
631
631
  });
632
632
  }
633
633
  }
634
634
  return null;
635
- }, xo = /\.client\.tsx?$/, So = async (e, t) => {
635
+ }, bo = /\.client\.tsx?$/, xo = async (e, t) => {
636
636
  let n = [];
637
637
  for (let r of t) {
638
- if (!xo.test(r)) continue;
639
- let t = await bo(r, e);
638
+ if (!bo.test(r)) continue;
639
+ let t = await yo(r, e);
640
640
  t !== null && n.push({
641
- file: yo(r, e),
641
+ file: vo(r, e),
642
642
  violation: t
643
643
  });
644
644
  }
645
645
  return n;
646
- }, Co = (e) => `browser-safety violation — ${e.file} declares itself browser-safe (.client.ts) and is not.\n\n '${e.violation.specifier}' is server-only (node:* / database / ai / cluster / protocol session / db driver).\n\n import chain:\n → ${e.violation.chain.join("\n → ")}\n\n The .client suffix is a claim the framework checks, not a hint. Either move the server-only\n code behind a *.server.ts and keep this file pure, or drop the suffix — an unmarked file\n makes no claim, and only the rpcGroup guard will judge it (later, and with a longer chain).`, wo = async (e) => {
646
+ }, So = (e) => `browser-safety violation — ${e.file} declares itself browser-safe (.client.ts) and is not.\n\n '${e.violation.specifier}' is server-only (node:* / database / ai / cluster / protocol session / db driver).\n\n import chain:\n → ${e.violation.chain.join("\n → ")}\n\n The .client suffix is a claim the framework checks, not a hint. Either move the server-only\n code behind a *.server.ts and keep this file pure, or drop the suffix — an unmarked file\n makes no claim, and only the rpcGroup guard will judge it (later, and with a longer chain).`, Co = async (e) => {
647
647
  if (process.env.VOLTRO_BROWSER_SAFETY === "off") return;
648
- let t = await bo(e, D(e));
648
+ let t = await yo(e, D(e));
649
649
  if (!t) return;
650
650
  let n = t.chain.join("\n → ");
651
651
  throw Error(`browser-safety violation — the generated rpcGroup pulls a SERVER-ONLY module into the client bundle.\n\n '${t.specifier}' is server-only (node:* / database / ai / cluster / protocol session / db driver),\n and the web client loads rpcGroup VALUE-LEVEL — this crashes the browser with\n "Module …node:crypto… has been externalized for browser compatibility", or bloats the\n bundle with the whole server graph.\n\n import chain:\n → ${n}\n\n Fix: keep the descriptor (*.query/.mutation/.action.ts), the workflow descriptor\n (*.workflow.tsx, import from @voltro/workflow/define), AND any plugin error schema\n browser-safe. Move DB-backed / node: code behind a *.server.ts file or a browser-safe\n subpath (e.g. a plugin's '/errors' export). Escape hatch (not recommended):\n VOLTRO_BROWSER_SAFETY=off.`);
652
- }, To = /\.(query|mutation|action|stream)\.ts$/, Eo = /\.(query|mutation|action|stream)\.server\.ts$/, Do = /\.workflow\.tsx$/, Oo = /(?<!\.server)\.agent\.tsx?$/, J = /\.connection\.tsx?$/, ko = /* @__PURE__ */ new Set([
652
+ }, wo = /\.(query|mutation|action|stream)\.ts$/, To = /\.(query|mutation|action|stream)\.server\.ts$/, Eo = /\.workflow\.tsx$/, Do = /(?<!\.server)\.agent\.tsx?$/, Oo = /\.connection\.tsx?$/, ko = /* @__PURE__ */ new Set([
653
653
  "node_modules",
654
654
  "dist",
655
655
  "build",
@@ -659,22 +659,22 @@ var Oa = (e, t) => {
659
659
  ".git"
660
660
  ]), Ao = async (e) => {
661
661
  let t = async (e) => {
662
- let n = await L.readdir(e, { withFileTypes: !0 }).catch(() => []);
662
+ let n = await R.readdir(e, { withFileTypes: !0 }).catch(() => []);
663
663
  for (let r of n) if (!ko.has(r.name)) {
664
664
  if (r.isDirectory()) {
665
665
  if (await t(O(e, r.name))) return !0;
666
- } else if (r.isFile() && J.test(r.name)) return !0;
666
+ } else if (r.isFile() && Oo.test(r.name)) return !0;
667
667
  }
668
668
  return !1;
669
669
  };
670
670
  return t(e);
671
671
  }, jo = async (e) => {
672
672
  let t = [], n = async (e) => {
673
- let r = await L.readdir(e, { withFileTypes: !0 });
673
+ let r = await R.readdir(e, { withFileTypes: !0 });
674
674
  for (let i of r) {
675
675
  if (ko.has(i.name)) continue;
676
676
  let r = O(e, i.name);
677
- i.isDirectory() ? await n(r) : i.isFile() && (To.test(i.name) && !Eo.test(i.name) || Do.test(i.name) || Oo.test(i.name)) && t.push(r);
677
+ i.isDirectory() ? await n(r) : i.isFile() && (wo.test(i.name) && !To.test(i.name) || Eo.test(i.name) || Do.test(i.name)) && t.push(r);
678
678
  }
679
679
  };
680
680
  return await n(e), t;
@@ -698,9 +698,9 @@ var Oa = (e, t) => {
698
698
  }, Io = async (e) => {
699
699
  let t = [];
700
700
  for (let n of e) {
701
- if (!Oo.test(n)) continue;
701
+ if (!Do.test(n)) continue;
702
702
  let e = await import(j(n).href);
703
- for (let [r, i] of Object.entries(e)) ma(i) && t.push({
703
+ for (let [r, i] of Object.entries(e)) pa(i) && t.push({
704
704
  file: n,
705
705
  exportName: r,
706
706
  name: i.name
@@ -858,10 +858,10 @@ ${a.join("\n\n")}\n`);
858
858
  return [
859
859
  "// THIS FILE IS GENERATED — DO NOT EDIT BY HAND.",
860
860
  "// Re-emitted by `voltro dev` whenever query/mutation/action/stream/workflow files change.",
861
- `// descriptor-fingerprint: ${Ji("sha1").update(Se.map((e) => {
861
+ `// descriptor-fingerprint: ${qi("sha1").update(Se.map((e) => {
862
862
  let t = "";
863
863
  try {
864
- t = Et(e.file, "utf8");
864
+ t = Tt(e.file, "utf8");
865
865
  } catch {}
866
866
  return `${e.rpcTag}${t}`;
867
867
  }).join("")).digest("hex").slice(0, 16)}`,
@@ -1017,7 +1017,7 @@ ${a.join("\n\n")}\n`);
1017
1017
  "workflows"
1018
1018
  ]), c = (e) => e.slice(e.lastIndexOf("/") + 1), l = o;
1019
1019
  for (; l !== t && s.has(c(l));) l = l.slice(0, l.lastIndexOf("/")) || "/";
1020
- let u = A(e.outputFile ?? O(l, "rpcGroup.generated.ts")), d = [...new Map((e.pluginErrorImports ?? []).map((e) => [`${e.module}#${e.name}`, e])).values()], f = [...new Map((e.pluginRpcImports ?? []).map((e) => [e.tag, e])).values()], p = Vo(t, u, r, d, i, Er(), a, f), m = [];
1020
+ let u = A(e.outputFile ?? O(l, "rpcGroup.generated.ts")), d = [...new Map((e.pluginErrorImports ?? []).map((e) => [`${e.module}#${e.name}`, e])).values()], f = [...new Map((e.pluginRpcImports ?? []).map((e) => [e.tag, e])).values()], p = Vo(t, u, r, d, i, Tr(), a, f), m = [];
1021
1021
  for (let t of e.pluginContributions ?? []) {
1022
1022
  let e = null;
1023
1023
  try {
@@ -1034,9 +1034,9 @@ ${a.join("\n\n")}\n`);
1034
1034
  }
1035
1035
  let h = m.length === 0 ? p : `${p}\n\n// ---- plugin codegen ----\n\n${m.join("\n")}`, g = null;
1036
1036
  try {
1037
- g = await L.readFile(u, "utf8");
1037
+ g = await R.readFile(u, "utf8");
1038
1038
  } catch {}
1039
- return g !== h && await L.writeFile(u, h, "utf8"), await wo(u), u;
1039
+ return g !== h && await R.writeFile(u, h, "utf8"), await Co(u), u;
1040
1040
  }, Uo = (e) => {
1041
1041
  let t = [];
1042
1042
  for (let n of e) for (let e of n) {
@@ -1050,31 +1050,31 @@ ${a.join("\n\n")}\n`);
1050
1050
  }
1051
1051
  return t;
1052
1052
  }, Wo = (e, t) => {
1053
- let n = Ti(e);
1054
- return n.length === 0 ? 0 : (t(gi(n)), n.length);
1053
+ let n = wi(e);
1054
+ return n.length === 0 ? 0 : (t(hi(n)), n.length);
1055
1055
  }, Go = async (e) => {
1056
- let t = e.spec ?? er, n;
1056
+ let t = e.spec ?? $n, n;
1057
1057
  return t.kind !== "noop" && e.sqlLayer !== void 0 ? n = await N.runPromise(N.gen(function* () {
1058
- let n = yield* B.SqlClient, r = t.build(n);
1058
+ let n = yield* V.SqlClient, r = t.build(n);
1059
1059
  return t.initialize && (yield* t.initialize(r).pipe(N.catchAll((t) => N.sync(() => e.log.warn("analytics sink initialize failed", {
1060
1060
  provider: r.info.provider,
1061
1061
  err: String(t)
1062
1062
  }))))), r;
1063
- }).pipe(N.provide(e.sqlLayer))) : (t.kind !== "noop" && e.sqlLayer === void 0 && e.log.warn(`analytics sink '${t.kind}' requires a real SQL store — falling back to noop`), n = z()), e.log.info("analytics sink", {
1063
+ }).pipe(N.provide(e.sqlLayer))) : (t.kind !== "noop" && e.sqlLayer === void 0 && e.log.warn(`analytics sink '${t.kind}' requires a real SQL store — falling back to noop`), n = B()), e.log.info("analytics sink", {
1064
1064
  provider: n.info.provider,
1065
1065
  capabilities: n.info.capabilities,
1066
1066
  ...n.info.detail ?? {}
1067
1067
  }), {
1068
1068
  spec: t,
1069
1069
  sink: n,
1070
- layer: P.succeed(R, n),
1070
+ layer: P.succeed(z, n),
1071
1071
  tables: t.tables ?? [],
1072
1072
  dispose: async () => {
1073
1073
  t.dispose && await N.runPromise(t.dispose(n).pipe(N.timeout("1200 millis"), N.ignore));
1074
1074
  }
1075
1075
  };
1076
1076
  }, Ko = "@effect/cluster@0.59.0", X = "@effect__cluster@0.59.0.patch", qo = `patches/${X}`, Jo = D(dt(import.meta.url)), Yo = [A(Jo, "..", "templates", "patches", X), A(Jo, "..", "..", "templates", "patches", X)], Xo = async () => {
1077
- for (let e of Yo) if (Tt(e)) return L.readFile(e, "utf8");
1077
+ for (let e of Yo) if (L(e)) return R.readFile(e, "utf8");
1078
1078
  throw Error(`@effect/cluster patch asset not found (looked in: ${Yo.join(", ")}). This is a packaging bug — the CLI should ship it under templates/patches/.`);
1079
1079
  }, Zo = (e) => RegExp(`['"]?${Ko.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}['"]?\\s*:`).test(e), Qo = (e) => {
1080
1080
  if (Zo(e)) return null;
@@ -1083,7 +1083,7 @@ ${a.join("\n\n")}\n`);
1083
1083
  }, $o = (e) => {
1084
1084
  let t = A(e);
1085
1085
  for (let e = 0; e < 12; e++) {
1086
- if (Tt(O(t, "pnpm-workspace.yaml"))) return t;
1086
+ if (L(O(t, "pnpm-workspace.yaml"))) return t;
1087
1087
  let e = D(t);
1088
1088
  if (e === t) break;
1089
1089
  t = e;
@@ -1095,7 +1095,7 @@ ${a.join("\n\n")}\n`);
1095
1095
  let n = await ts(t);
1096
1096
  return n.fullyWired ? null : `mssql + durable cluster workflows need the @effect/cluster patch, which a plain install cannot carry. Run \`voltro add mssql\` then \`pnpm install\` to wire it (missing: ${[n.patchFilePresent ? null : qo, n.pnpmEntryPresent ? null : "patchedDependencies in pnpm-workspace.yaml"].filter(Boolean).join(" + ")}). Without it, workflow message/runner storage misbehaves on SQL Server.`;
1097
1097
  }, ts = async (e) => {
1098
- let t = Tt(O(e, qo)), n = O(e, "pnpm-workspace.yaml"), r = Tt(n) && Zo(await L.readFile(n, "utf8"));
1098
+ let t = L(O(e, qo)), n = O(e, "pnpm-workspace.yaml"), r = L(n) && Zo(await R.readFile(n, "utf8"));
1099
1099
  return {
1100
1100
  patchFilePresent: t,
1101
1101
  pnpmEntryPresent: r,
@@ -1103,11 +1103,11 @@ ${a.join("\n\n")}\n`);
1103
1103
  };
1104
1104
  }, ns = async (e) => {
1105
1105
  let t = [], n = O(e, qo), r = await Xo();
1106
- (Tt(n) ? await L.readFile(n, "utf8") : null) !== r && (await L.mkdir(D(n), { recursive: !0 }), await L.writeFile(n, r, "utf8"), t.push(`patch file → ${qo}`));
1106
+ (L(n) ? await R.readFile(n, "utf8") : null) !== r && (await R.mkdir(D(n), { recursive: !0 }), await R.writeFile(n, r, "utf8"), t.push(`patch file → ${qo}`));
1107
1107
  let i = O(e, "pnpm-workspace.yaml");
1108
- if (Tt(i)) {
1109
- let e = Qo(await L.readFile(i, "utf8"));
1110
- e !== null && (await L.writeFile(i, e, "utf8"), t.push(`patchedDependencies['${Ko}'] → pnpm-workspace.yaml`));
1108
+ if (L(i)) {
1109
+ let e = Qo(await R.readFile(i, "utf8"));
1110
+ e !== null && (await R.writeFile(i, e, "utf8"), t.push(`patchedDependencies['${Ko}'] → pnpm-workspace.yaml`));
1111
1111
  }
1112
1112
  return t;
1113
1113
  }, rs = (e) => e.replace(/\.subscribe\.tsx?$/, ""), is = async (e, t) => {
@@ -1143,8 +1143,8 @@ ${a.join("\n\n")}\n`);
1143
1143
  return n;
1144
1144
  }, as = (e, t, n, r) => {
1145
1145
  if (e.length === 0) return () => {};
1146
- let i = Or(t, {
1147
- subject: Bt,
1146
+ let i = Dr(t, {
1147
+ subject: zt,
1148
1148
  schemaRegistry: r
1149
1149
  }), a = [];
1150
1150
  for (let r of e) {
@@ -1161,7 +1161,7 @@ ${a.join("\n\n")}\n`);
1161
1161
  e.warn("subscriber: handler rejected", {
1162
1162
  table: o,
1163
1163
  op: t.op
1164
- }, n), Di({
1164
+ }, n), Ei({
1165
1165
  error: n,
1166
1166
  source: "subscriber",
1167
1167
  name: o,
@@ -1175,7 +1175,7 @@ ${a.join("\n\n")}\n`);
1175
1175
  e.warn("subscriber: handler threw synchronously", {
1176
1176
  table: o,
1177
1177
  op: t.op
1178
- }, n), Di({
1178
+ }, n), Ei({
1179
1179
  error: n,
1180
1180
  source: "subscriber",
1181
1181
  name: o,
@@ -1244,7 +1244,7 @@ ${a.join("\n\n")}\n`);
1244
1244
  }
1245
1245
  a = !0;
1246
1246
  try {
1247
- let t = await rn({
1247
+ let t = await nn({
1248
1248
  store: n,
1249
1249
  handlers: i,
1250
1250
  ...e.batchSize === void 0 ? {} : { batchSize: e.batchSize }
@@ -1271,7 +1271,7 @@ ${a.join("\n\n")}\n`);
1271
1271
  drainOnce: c
1272
1272
  };
1273
1273
  }, ls = "<builtin:connections>", us = {
1274
- registry: On([]),
1274
+ registry: Dn([]),
1275
1275
  queries: [],
1276
1276
  mutations: [],
1277
1277
  actions: [],
@@ -1280,16 +1280,16 @@ ${a.join("\n\n")}\n`);
1280
1280
  }, ds = (e) => {
1281
1281
  let { definitions: t, store: n, publicUrl: r, log: i } = e;
1282
1282
  if (t.length === 0) return us;
1283
- Gt(t);
1284
- let a = On(t), o = {
1283
+ Wt(t);
1284
+ let a = Dn(t), o = {
1285
1285
  registry: a,
1286
1286
  publicUrl: r
1287
1287
  };
1288
- gr(kn({
1288
+ hr(On({
1289
1289
  store: n,
1290
1290
  registry: a
1291
1291
  }));
1292
- let s = Ln(o), c = Kn(o), l = qn(o), u = Nn(o), d = t.some((e) => e.kind === "oauth2"), f = d ? [{
1292
+ let s = In(o), c = Gn(o), l = Kn(o), u = Mn(o), d = t.some((e) => e.kind === "oauth2"), f = d ? [{
1293
1293
  method: "GET",
1294
1294
  path: "/_voltro/connections",
1295
1295
  handle: async (e) => {
@@ -1310,7 +1310,7 @@ ${a.join("\n\n")}\n`);
1310
1310
  contentType: "text/plain"
1311
1311
  };
1312
1312
  try {
1313
- let e = await en({
1313
+ let e = await $t({
1314
1314
  store: n,
1315
1315
  registry: a,
1316
1316
  state: s,
@@ -1331,30 +1331,30 @@ ${a.join("\n\n")}\n`);
1331
1331
  connections: t.map((e) => `${e.id} (${e.kind})`),
1332
1332
  callback: d ? "/_voltro/connections/<id>/callback" : "(no oauth2 connection declared)",
1333
1333
  routes: [
1334
- wi.name,
1335
- Si.name,
1336
1334
  Ci.name,
1337
- xi.name
1335
+ xi.name,
1336
+ Si.name,
1337
+ bi.name
1338
1338
  ]
1339
1339
  }), {
1340
1340
  registry: a,
1341
1341
  queries: [{
1342
1342
  file: ls,
1343
- descriptor: wi,
1343
+ descriptor: Ci,
1344
1344
  executor: (e, t) => s(e, t)
1345
1345
  }],
1346
1346
  mutations: [{
1347
1347
  file: ls,
1348
- descriptor: Ci,
1348
+ descriptor: Si,
1349
1349
  executor: (e, t) => l(e, t)
1350
1350
  }, {
1351
1351
  file: ls,
1352
- descriptor: xi,
1352
+ descriptor: bi,
1353
1353
  executor: (e, t) => u(e, t)
1354
1354
  }],
1355
1355
  actions: [{
1356
1356
  file: ls,
1357
- descriptor: Si,
1357
+ descriptor: xi,
1358
1358
  executor: (e, t) => c(e, t)
1359
1359
  }],
1360
1360
  httpRoutes: f,
@@ -1362,7 +1362,7 @@ ${a.join("\n\n")}\n`);
1362
1362
  };
1363
1363
  }, fs = (e) => ({
1364
1364
  status: 302,
1365
- headers: { location: mr(e.startsWith("/") ? e : `/${e}`) },
1365
+ headers: { location: pr(e.startsWith("/") ? e : `/${e}`) },
1366
1366
  body: ""
1367
1367
  }), ps = (e) => process.env.VOLTRO_PUBLIC_URL?.replace(/\/+$/, "") ?? `http://localhost:${e}`, ms = (e) => e.replace(/\.reaction\.tsx?$/, ""), hs = async (e, t) => {
1368
1368
  let n = [];
@@ -1425,7 +1425,7 @@ ${a.join("\n\n")}\n`);
1425
1425
  add: (e) => {
1426
1426
  i.add(e);
1427
1427
  }
1428
- }, o = new Rt(), s = /* @__PURE__ */ new Map();
1428
+ }, o = new Lt(), s = /* @__PURE__ */ new Map();
1429
1429
  for (let t of e) {
1430
1430
  let e = r.child(`reaction:${t.id}`), n = s.get(t.definition.watch.table) ?? [];
1431
1431
  n.push({
@@ -1446,7 +1446,7 @@ ${a.join("\n\n")}\n`);
1446
1446
  ...e
1447
1447
  }), l = t.onChange((e) => {
1448
1448
  let t = s.get(e.table);
1449
- if (t !== void 0) for (let { reaction: n, log: r } of t) pr(n, e, c()).then((t) => {
1449
+ if (t !== void 0) for (let { reaction: n, log: r } of t) fr(n, e, c()).then((t) => {
1450
1450
  t === "acted" && r.info("reaction: acted", {
1451
1451
  table: e.table,
1452
1452
  op: e.op
@@ -1455,7 +1455,7 @@ ${a.join("\n\n")}\n`);
1455
1455
  r.warn("reaction: dispatch failed", {
1456
1456
  table: e.table,
1457
1457
  op: e.op
1458
- }, t), Di({
1458
+ }, t), Ei({
1459
1459
  error: t,
1460
1460
  source: "reaction",
1461
1461
  name: n.name,
@@ -1548,10 +1548,10 @@ ${a.join("\n\n")}\n`);
1548
1548
  lastError: null,
1549
1549
  nextRefreshAt: null
1550
1550
  }, r = (t) => N.runPromise(t.pipe(N.provide(e))), i = () => N.gen(function* () {
1551
- let e = yield* B.SqlClient;
1551
+ let e = yield* V.SqlClient;
1552
1552
  yield* e.unsafe(bs).pipe(N.orDie), yield* e.unsafe(xs).pipe(N.orDie), yield* e.unsafe(Ss).pipe(N.orDie);
1553
1553
  }), a = () => N.gen(function* () {
1554
- let e = yield* B.SqlClient, n = yield* e`SELECT * FROM ${e(Z)}`.pipe(N.orElseSucceed(() => []));
1554
+ let e = yield* V.SqlClient, n = yield* e`SELECT * FROM ${e(Z)}`.pipe(N.orElseSucceed(() => []));
1555
1555
  for (let r of n) {
1556
1556
  let n = yield* e`
1557
1557
  SELECT ${e("row_index")} AS row_index, ${e("row_data")} AS row_data
@@ -1569,7 +1569,7 @@ ${a.join("\n\n")}\n`);
1569
1569
  });
1570
1570
  }
1571
1571
  }), o = (e, t) => N.gen(function* () {
1572
- let n = yield* B.SqlClient, r = (yield* n`
1572
+ let n = yield* V.SqlClient, r = (yield* n`
1573
1573
  SELECT ${n("generation")} AS generation
1574
1574
  FROM ${n(Z)}
1575
1575
  WHERE ${n("name")} = ${e}
@@ -1607,7 +1607,7 @@ ${a.join("\n\n")}\n`);
1607
1607
  AND ${n("generation")} < ${i}
1608
1608
  `.pipe(N.orDie));
1609
1609
  }), s = (e, t) => N.gen(function* () {
1610
- let n = yield* B.SqlClient;
1610
+ let n = yield* V.SqlClient;
1611
1611
  yield* n`
1612
1612
  UPDATE ${n(Z)} SET
1613
1613
  ${n("refreshed_at")} = ${t.refreshedAt ? t.refreshedAt.toISOString() : null},
@@ -1668,7 +1668,7 @@ ${a.join("\n\n")}\n`);
1668
1668
  },
1669
1669
  refreshMirror: async (e) => {
1670
1670
  await r(N.gen(function* () {
1671
- let n = yield* B.SqlClient, r = (yield* n`
1671
+ let n = yield* V.SqlClient, r = (yield* n`
1672
1672
  SELECT * FROM ${n(Z)}
1673
1673
  WHERE ${n("name")} = ${e}
1674
1674
  `.pipe(N.orElseSucceed(() => [])))[0];
@@ -1701,7 +1701,7 @@ ${a.join("\n\n")}\n`);
1701
1701
  continue;
1702
1702
  }
1703
1703
  let a = e.default;
1704
- if (!fn(a)) {
1704
+ if (!dn(a)) {
1705
1705
  t.warn("aggregate: default export is not a defineAggregate() result", { file: i });
1706
1706
  continue;
1707
1707
  }
@@ -1753,7 +1753,7 @@ ${a.join("\n\n")}\n`);
1753
1753
  for (let e = 0; e < t.length; e++) {
1754
1754
  let i = n(t[e]);
1755
1755
  if (i._tag === "Left") {
1756
- let t = ha.formatErrorSync(i.left)[0], n = t?.path?.length ? t.path.join(".") : "<root>";
1756
+ let t = ma.formatErrorSync(i.left)[0], n = t?.path?.length ? t.path.join(".") : "<root>";
1757
1757
  return {
1758
1758
  ok: !1,
1759
1759
  reason: `row[${e}] failed output-schema decode at ${n}: ${t?.message ?? "unknown"}`
@@ -1863,7 +1863,7 @@ ${a.join("\n\n")}\n`);
1863
1863
  ...r.meta,
1864
1864
  lastError: n,
1865
1865
  nextRefreshAt: a
1866
- }), l.warn("refresh failed — last-good rows preserved", { err: n }), Di({
1866
+ }), l.warn("refresh failed — last-good rows preserved", { err: n }), Ei({
1867
1867
  error: e,
1868
1868
  source: "aggregate",
1869
1869
  name: t.name
@@ -1909,7 +1909,7 @@ ${a.join("\n\n")}\n`);
1909
1909
  }, Is = (e) => {
1910
1910
  let { definition: t, store: n, storage: r, log: i, schedule: a } = e, o = t.incremental;
1911
1911
  if (o === void 0) return;
1912
- let s = i.child(`aggregate:${t.name}`), c = new jt({
1912
+ let s = i.child(`aggregate:${t.name}`), c = new At({
1913
1913
  op: o.op,
1914
1914
  ...o.column === void 0 ? {} : { column: o.column },
1915
1915
  ...o.groupBy === void 0 ? {} : { groupBy: o.groupBy }
@@ -1970,7 +1970,7 @@ ${a.join("\n\n")}\n`);
1970
1970
  }, m);
1971
1971
  h.unref(), a.scheduleTimer = h;
1972
1972
  }, Ls = async (e) => {
1973
- let t = e.storage ?? ys(), n = e.coordinator ?? br, r = e.analytics ?? z(), i = e.log;
1973
+ let t = e.storage ?? ys(), n = e.coordinator ?? yr, r = e.analytics ?? B(), i = e.log;
1974
1974
  await t.initialize();
1975
1975
  let a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = {
1976
1976
  refreshedAt: null,
@@ -2051,13 +2051,13 @@ ${a.join("\n\n")}\n`);
2051
2051
  return {
2052
2052
  registry: {
2053
2053
  getHandle: (a) => {
2054
- let l = s.has(a.name), u = () => N.fail(new Mt({ name: a.name }));
2054
+ let l = s.has(a.name), u = () => N.fail(new jt({ name: a.name }));
2055
2055
  return l ? {
2056
2056
  read: (e) => N.gen(function* () {
2057
2057
  let n = t.get(a.name);
2058
2058
  if (e?.maxAgeMs !== void 0) {
2059
2059
  let t = n.meta.refreshedAt, r = t === null ? Infinity : Date.now() - t.getTime();
2060
- if (r > e.maxAgeMs) return yield* N.fail(new Pt({
2060
+ if (r > e.maxAgeMs) return yield* N.fail(new Nt({
2061
2061
  name: a.name,
2062
2062
  ageMs: Number.isFinite(r) ? r : -1,
2063
2063
  maxAgeMs: e.maxAgeMs
@@ -2077,7 +2077,7 @@ ${a.join("\n\n")}\n`);
2077
2077
  refreshState: o.get(a.name),
2078
2078
  scheduledAt: /* @__PURE__ */ new Date()
2079
2079
  }),
2080
- catch: (e) => new At({
2080
+ catch: (e) => new kt({
2081
2081
  name: a.name,
2082
2082
  operation: "refresh",
2083
2083
  cause: e instanceof Error ? `${e.name}: ${e.message}` : String(e)
@@ -2119,7 +2119,7 @@ ${a.join("\n\n")}\n`);
2119
2119
  };
2120
2120
  }, Rs = {
2121
2121
  getHandle: (e) => ({
2122
- read: () => N.fail(new Mt({ name: e.name })),
2122
+ read: () => N.fail(new jt({ name: e.name })),
2123
2123
  meta: () => N.succeed({
2124
2124
  refreshedAt: null,
2125
2125
  rowCount: 0,
@@ -2127,7 +2127,7 @@ ${a.join("\n\n")}\n`);
2127
2127
  lastError: null,
2128
2128
  nextRefreshAt: null
2129
2129
  }),
2130
- refresh: () => N.fail(new Mt({ name: e.name }))
2130
+ refresh: () => N.fail(new jt({ name: e.name }))
2131
2131
  }),
2132
2132
  snapshot: () => [],
2133
2133
  refreshByName: async () => !1
@@ -2280,7 +2280,7 @@ ${a.join("\n\n")}\n`);
2280
2280
  t.warn("webhook: failed to import", { file: a }, e);
2281
2281
  continue;
2282
2282
  }
2283
- let o = (e.default && ba(e.default) ? e.default : void 0) ?? Object.values(e).find(ba);
2283
+ let o = (e.default && ya(e.default) ? e.default : void 0) ?? Object.values(e).find(ya);
2284
2284
  if (!o) {
2285
2285
  t.warn("webhook: no descriptor default-exported", { file: a });
2286
2286
  continue;
@@ -2321,7 +2321,7 @@ ${a.join("\n\n")}\n`);
2321
2321
  t.warn("email: failed to import", { file: r }, e);
2322
2322
  continue;
2323
2323
  }
2324
- let i = Object.values(e).filter(Sa);
2324
+ let i = Object.values(e).filter(xa);
2325
2325
  if (i.length === 0) {
2326
2326
  t.warn("email: no defineEmail export found", { file: r });
2327
2327
  continue;
@@ -2333,14 +2333,14 @@ ${a.join("\n\n")}\n`);
2333
2333
  }
2334
2334
  return { templates: n };
2335
2335
  }, ic = (e) => N.map(e, (e) => ({ text: e })), ac = (e) => {
2336
- let { descriptor: t, executor: n, file: r } = e, { send: i, messages: a } = pa(t);
2336
+ let { descriptor: t, executor: n, file: r } = e, { send: i, messages: a } = fa(t);
2337
2337
  return [{
2338
2338
  kind: "action",
2339
2339
  file: r,
2340
2340
  descriptor: i,
2341
2341
  executor: (e, t) => {
2342
2342
  let { threadId: r, order: i } = e, a = t.request?.subject?.tenantId ?? null;
2343
- return Jr(n, t.store, {
2343
+ return qr(n, t.store, {
2344
2344
  threadId: r,
2345
2345
  input: e,
2346
2346
  tenantId: a,
@@ -2355,27 +2355,27 @@ ${a.join("\n\n")}\n`);
2355
2355
  kind: "query",
2356
2356
  file: r,
2357
2357
  descriptor: a,
2358
- executor: (e, t) => qr(t.store, e.threadId)
2358
+ executor: (e, t) => Kr(t.store, e.threadId)
2359
2359
  }];
2360
- }, oc = "<builtin:undo>", sc = () => Er() ? {
2360
+ }, oc = "<builtin:undo>", sc = () => Tr() ? {
2361
2361
  queries: [{
2362
2362
  file: oc,
2363
- descriptor: Mi,
2364
- executor: (e, t) => Dr(e, t)
2363
+ descriptor: ji,
2364
+ executor: (e, t) => Er(e, t)
2365
2365
  }],
2366
2366
  mutations: [{
2367
2367
  file: oc,
2368
- descriptor: ji,
2369
- executor: (e, t) => Wt(e, t)
2368
+ descriptor: Ai,
2369
+ executor: (e, t) => Ut(e, t)
2370
2370
  }, {
2371
2371
  file: oc,
2372
- descriptor: Ni,
2373
- executor: (e, t) => or(e, t)
2372
+ descriptor: Mi,
2373
+ executor: (e, t) => ar(e, t)
2374
2374
  }]
2375
2375
  } : {
2376
2376
  queries: [],
2377
2377
  mutations: []
2378
- }, cc = () => Er() ? (e) => Jn(e) : (e) => ({
2378
+ }, cc = () => Tr() ? (e) => qn(e) : (e) => ({
2379
2379
  tx: e,
2380
2380
  persist: async () => {}
2381
2381
  }), lc = {
@@ -2476,7 +2476,7 @@ ${a.join("\n\n")}\n`);
2476
2476
  }
2477
2477
  let n = (process.env.VOLTRO_STRICT_PLUGIN_COMPAT ?? "").toLowerCase(), i = n === "1" || n === "true";
2478
2478
  for (let t of e.plugins) {
2479
- let n = vi(t.name, t.framework, e.voltroVersion);
2479
+ let n = _i(t.name, t.framework, e.voltroVersion);
2480
2480
  if (!n.ok) {
2481
2481
  if (i) {
2482
2482
  let r = `plugin "${t.name}" is incompatible with framework ${e.voltroVersion}: ${n.reason}. Pin a compatible plugin version, or unset VOLTRO_STRICT_PLUGIN_COMPAT to downgrade this to a warning.`;
@@ -2788,11 +2788,11 @@ ${a.join("\n\n")}\n`);
2788
2788
  }), Mc = (e, t) => {
2789
2789
  let n = [];
2790
2790
  for (let r of e) typeof r.onWorkflowStep == "function" && n.push(jc(r.name, r.onWorkflowStep, t));
2791
- return n.length === 0 ? P.succeed(Mr, { interceptor: ((e) => e) }) : P.succeed(Mr, { interceptor: ((e, t) => n.reduceRight((e, n) => n(e, t), e)) });
2791
+ return n.length === 0 ? P.succeed(jr, { interceptor: ((e) => e) }) : P.succeed(jr, { interceptor: ((e, t) => n.reduceRight((e, n) => n(e, t), e)) });
2792
2792
  }, Nc = (e) => {
2793
2793
  if (!e) return;
2794
2794
  let t = e.workflowName ?? e.tag, n = [];
2795
- if (t !== void 0 && n.push(V("tag", t)), e.status !== void 0 && n.push(V("status", e.status)), n.length !== 0) return n.length === 1 ? n[0] : Zr(...n);
2795
+ if (t !== void 0 && n.push(H("tag", t)), e.status !== void 0 && n.push(H("status", e.status)), n.length !== 0) return n.length === 1 ? n[0] : Xr(...n);
2796
2796
  }, Pc = async (e, t) => {
2797
2797
  let n = Math.max(0, t?.offset ?? 0), r = Math.max(1, Math.min(500, t?.limit ?? 50)), i = Nc(t);
2798
2798
  return {
@@ -2840,7 +2840,7 @@ ${a.join("\n\n")}\n`);
2840
2840
  let r = (await e.store.query({
2841
2841
  table: "_voltro_workflow_runs",
2842
2842
  order: [],
2843
- predicate: V("id", t),
2843
+ predicate: H("id", t),
2844
2844
  projection: void 0,
2845
2845
  skip: void 0,
2846
2846
  take: 1
@@ -2907,7 +2907,7 @@ ${a.join("\n\n")}\n`);
2907
2907
  let t = [], n = async (e) => {
2908
2908
  let r;
2909
2909
  try {
2910
- r = await L.readdir(e, { withFileTypes: !0 });
2910
+ r = await R.readdir(e, { withFileTypes: !0 });
2911
2911
  } catch {
2912
2912
  return;
2913
2913
  }
@@ -3156,7 +3156,7 @@ ${a.join("\n\n")}\n`);
3156
3156
  let t = e.now ?? Date.now, n = {
3157
3157
  phase: "booting",
3158
3158
  startedAt: t()
3159
- }, r = Da((e, r) => {
3159
+ }, r = Ea((e, r) => {
3160
3160
  let i = (e.url ?? "/").split("?")[0], a = n.phase === "ready";
3161
3161
  if (i === "/internal/liveness") {
3162
3162
  r.writeHead(200, {
@@ -3213,7 +3213,7 @@ ${a.join("\n\n")}\n`);
3213
3213
  });
3214
3214
  }, $ = F({ scope: "voltro:dev" }), pl = await (async () => {
3215
3215
  try {
3216
- let e = O(D(dt(import.meta.url)), "..", "package.json"), t = await L.readFile(e, "utf8");
3216
+ let e = O(D(dt(import.meta.url)), "..", "package.json"), t = await R.readFile(e, "utf8");
3217
3217
  return JSON.parse(t).version ?? "0.0.0";
3218
3218
  } catch {
3219
3219
  return "0.0.0";
@@ -3221,18 +3221,18 @@ ${a.join("\n\n")}\n`);
3221
3221
  })(), ml = process.env.TENANT ?? "acme", hl = process.env.VOLTRO_SESSION_COOKIE ?? "voltro:session", gl = {
3222
3222
  id: "voltro-password",
3223
3223
  resolve: (e) => {
3224
- let t = Gi(e.headers.cookie ?? e.headers.Cookie, hl);
3224
+ let t = Wi(e.headers.cookie ?? e.headers.Cookie, hl);
3225
3225
  if (!t) return { kind: "skip" };
3226
- let n = Ki();
3226
+ let n = Gi();
3227
3227
  if (!n) return { kind: "skip" };
3228
- let r = qi(t, n);
3228
+ let r = Ki(t, n);
3229
3229
  return r ? {
3230
3230
  kind: "matched",
3231
3231
  subject: r.subject
3232
3232
  } : { kind: "skip" };
3233
3233
  }
3234
- }, _l = (e = [], t, n = !1, r, i) => (vl([t ?? gl, ...e]), yi([t ?? gl, ...e], {
3235
- ...n ? { anonymousTenantRequired: !0 } : { fallback: (e) => _i(e.headers["x-tenant"] ?? ml) },
3234
+ }, _l = (e = [], t, n = !1, r, i) => (vl([t ?? gl, ...e]), vi([t ?? gl, ...e], {
3235
+ ...n ? { anonymousTenantRequired: !0 } : { fallback: (e) => gi(e.headers["x-tenant"] ?? ml) },
3236
3236
  onStrategyFailed: ({ strategyId: e, reason: t }) => {
3237
3237
  $.warn(`auth strategy "${e}" rejected request: ${t}`);
3238
3238
  },
@@ -3248,10 +3248,10 @@ ${a.join("\n\n")}\n`);
3248
3248
  e === void 0 || e === "" || t.set(e, [...t.get(e) ?? [], n.id]);
3249
3249
  }
3250
3250
  for (let [e, n] of t) n.length < 2 || $.warn(`auth: ${n.length} strategies claim the bearer prefix "${e}" (${n.join(", ")}). The chain is first-match-wins, so the FIRST one decides the Subject for every token with this shape — if they resolve to different authority, which one answered decides whether authorization works. If this is \`apiKeys: true\` alongside your own key strategy, either drop one or give them distinct prefixes (\`apiKeys: { prefix: "…" }\`).`);
3251
- }, yl = (e) => P.succeed(di, di.of(({ headers: t, clientId: n }) => N.promise(async () => ln(n) || e({
3251
+ }, yl = (e) => P.succeed(ui, ui.of(({ headers: t, clientId: n }) => N.promise(async () => cn(n) || e({
3252
3252
  headers: t,
3253
3253
  clientId: n
3254
- })))), bl = P.succeed(fi, fi.of(({ clientId: e }) => N.succeed({ clientId: e }))), xl = (e) => {
3254
+ })))), bl = P.succeed(di, di.of(({ clientId: e }) => N.succeed({ clientId: e }))), xl = (e) => {
3255
3255
  if (pt.isCause(e)) return e;
3256
3256
  if (typeof e != "object" || !e) return;
3257
3257
  for (let t of Object.getOwnPropertySymbols(e)) if (t.description === "effect/Runtime/FiberFailure/Cause") {
@@ -3271,7 +3271,7 @@ ${a.join("\n\n")}\n`);
3271
3271
  if (e == null) return { message: "unknown error" };
3272
3272
  let t = Sl(e);
3273
3273
  if (t !== void 0 && t !== e) return Cl(t);
3274
- let n = on(e), r = (n.dbCode ?? n.dbSqlState ?? n.dbErrno ?? n.dbConstraint) === void 0 ? {} : n;
3274
+ let n = an(e), r = (n.dbCode ?? n.dbSqlState ?? n.dbErrno ?? n.dbConstraint) === void 0 ? {} : n;
3275
3275
  if (typeof e == "object" && "_tag" in e) return {
3276
3276
  ...e,
3277
3277
  ...r
@@ -3297,7 +3297,7 @@ ${a.join("\n\n")}\n`);
3297
3297
  ".git"
3298
3298
  ]), Tl = async (e) => {
3299
3299
  let t = [], n = async (e) => {
3300
- let r = await L.readdir(e, { withFileTypes: !0 });
3300
+ let r = await R.readdir(e, { withFileTypes: !0 });
3301
3301
  for (let i of r) {
3302
3302
  if (wl.has(i.name)) continue;
3303
3303
  let r = O(e, i.name);
@@ -3364,7 +3364,7 @@ ${a.join("\n\n")}\n`);
3364
3364
  column: "startedAt",
3365
3365
  direction: "desc"
3366
3366
  }],
3367
- predicate: i !== null && i.length > 0 ? V("traceId", i) : void 0,
3367
+ predicate: i !== null && i.length > 0 ? H("traceId", i) : void 0,
3368
3368
  projection: void 0,
3369
3369
  skip: void 0,
3370
3370
  take: i !== null && i.length > 0 ? 1e3 : 2e3
@@ -3388,11 +3388,11 @@ ${a.join("\n\n")}\n`);
3388
3388
  if (Me.test(e)) {
3389
3389
  let e = await b(t);
3390
3390
  for (let t of Object.values(e)) Fl(t) && (f.set(t.tableName, t), Rl(t) && u.add(t.tableName), Bl(t) && d.add(t.tableName));
3391
- oi(e);
3391
+ ai(e);
3392
3392
  continue;
3393
3393
  }
3394
3394
  if (Ne.test(e)) {
3395
- oi(await b(t)) === 0 && $.warn("skipping relations file — no relations(...) export found", { file: t });
3395
+ ai(await b(t)) === 0 && $.warn("skipping relations file — no relations(...) export found", { file: t });
3396
3396
  continue;
3397
3397
  }
3398
3398
  if (Te(e)) {
@@ -3428,12 +3428,12 @@ ${a.join("\n\n")}\n`);
3428
3428
  definition: n,
3429
3429
  buildExecute: a
3430
3430
  });
3431
- for (let t of [...Object.values(e), ...Object.values(i)]) Ir(t) && s.push(t);
3431
+ for (let t of [...Object.values(e), ...Object.values(i)]) Fr(t) && s.push(t);
3432
3432
  continue;
3433
3433
  }
3434
3434
  if (Ee.test(e)) {
3435
- let n = await b(t), r = n.default ?? Object.values(n).find(gn);
3436
- if (!gn(r)) {
3435
+ let n = await b(t), r = n.default ?? Object.values(n).find(hn);
3436
+ if (!hn(r)) {
3437
3437
  $.warn("skipping trigger — default export is not triggerWorkflow(...)", { file: t });
3438
3438
  continue;
3439
3439
  }
@@ -3450,7 +3450,7 @@ ${a.join("\n\n")}\n`);
3450
3450
  }
3451
3451
  if (Pe.test(e)) {
3452
3452
  let e = (await b(t)).default;
3453
- if (!hn(e)) {
3453
+ if (!mn(e)) {
3454
3454
  $.warn("skipping cron — default export is not defineSchedule(...)", { file: t });
3455
3455
  continue;
3456
3456
  }
@@ -3513,20 +3513,20 @@ ${a.join("\n\n")}\n`);
3513
3513
  }
3514
3514
  let h = /* @__PURE__ */ new Map();
3515
3515
  for (let [e, t] of f) {
3516
- let n = ci(t);
3516
+ let n = si(t);
3517
3517
  n.length > 0 && h.set(e, n);
3518
3518
  }
3519
3519
  if (h.size > 0) {
3520
- let e = sn(n.flatMap((e) => hr({
3520
+ let e = on(n.flatMap((e) => mr({
3521
3521
  name: e.descriptor.name,
3522
3522
  output: e.descriptor.output,
3523
3523
  source: e.descriptor.source
3524
3524
  }, h)));
3525
3525
  e !== void 0 && $.warn(`[serverOnly] ${e}`);
3526
3526
  }
3527
- f.has("actors") || f.set("actors", Yr);
3527
+ f.has("actors") || f.set("actors", Jr);
3528
3528
  let g = f.get("actors"), _ = f.get("tenants");
3529
- (g !== void 0 || _ !== void 0) && ai({
3529
+ (g !== void 0 || _ !== void 0) && ii({
3530
3530
  ...g === void 0 ? {} : { actors: () => g },
3531
3531
  ..._ === void 0 ? {} : { tenants: () => _ }
3532
3532
  });
@@ -3538,7 +3538,7 @@ ${a.join("\n\n")}\n`);
3538
3538
  outbox: e.some((e) => Fe.test(E(e))),
3539
3539
  connections: ee.length > 0
3540
3540
  };
3541
- return li(), {
3541
+ return ci(), {
3542
3542
  queries: n,
3543
3543
  mutations: r,
3544
3544
  actions: i,
@@ -3618,14 +3618,14 @@ ${a.join("\n\n")}\n`);
3618
3618
  return 1e3 + (t >>> 0) % 2147482647;
3619
3619
  }, Zl = (e) => (process.env.DB_DIALECT ?? e?.store ?? "memory").toLowerCase(), Ql = async (e, t) => {
3620
3620
  let n = Zl(e);
3621
- if (n === "memory") return $.info("sql dialect resolved: memory — in-process store, no persistence"), new Lt({});
3622
- let r = (process.env.CDC ?? "1") !== "0", i = await y(n), a = i.id === "postgres" ? "LISTEN/NOTIFY" : ni(i.id) ? "in-process bus" : i.id === "mariadb" ? "binlog CDC (ROW)" : i.id === "mssql" ? "Change Tracking (polled)" : i.id === "mysql" ? "binlog CDC (ROW)" : "inline only", o = i.id === "postgres" ? "native" : i.id === "mysql" ? "INSERT/UPDATE/DELETE then SELECT (no RETURNING)" : i.id === "mariadb" ? "native (INSERT/DELETE); UPDATE then SELECT" : i.id === "mssql" ? "OUTPUT INSERTED/DELETED" : ni(i.id) ? "native" : "unknown";
3621
+ if (n === "memory") return $.info("sql dialect resolved: memory — in-process store, no persistence"), new It({});
3622
+ let r = (process.env.CDC ?? "1") !== "0", i = await y(n), a = i.id === "postgres" ? "LISTEN/NOTIFY" : ti(i.id) ? "in-process bus" : i.id === "mariadb" ? "binlog CDC (ROW)" : i.id === "mssql" ? "Change Tracking (polled)" : i.id === "mysql" ? "binlog CDC (ROW)" : "inline only", o = i.id === "postgres" ? "native" : i.id === "mysql" ? "INSERT/UPDATE/DELETE then SELECT (no RETURNING)" : i.id === "mariadb" ? "native (INSERT/DELETE); UPDATE then SELECT" : i.id === "mssql" ? "OUTPUT INSERTED/DELETED" : ti(i.id) ? "native" : "unknown";
3623
3623
  $.info(`sql dialect resolved: ${i.id} — CDC: ${r ? a : "inline emit (CDC=0)"}, RETURNING: ${o}`);
3624
3624
  let s = Gl(), { summary: c, fromEnv: l } = Jl(s);
3625
3625
  $.info(`db connection: ${c}${l ? "" : " (DEFAULT FALLBACK — no DB_URL / PG_HOST set)"}`), l || $.warn("db connection: falling back to localhost:5432/app — no DB_URL or PG_HOST env var set.\n If this app should run against its OWN postgres (e.g. its docker-compose), set DB_URL.\n Copy `.env.example` to `.env` in the app dir, or set DB_URL in the shell.\n Otherwise this app is silently using whatever DB is at localhost:5432/app — which is\n voltro-starter's docker default + may carry foreign tables that confuse the planner.");
3626
3626
  let u;
3627
3627
  if (r && (i.id === "mysql" || i.id === "mariadb")) {
3628
- let { connectionFromConfig: e } = await v("@voltro/sql-mysql"), t = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, n = Xr().filter((e) => e.isReactive !== !1).map((e) => e.tableName).filter((e) => !e.startsWith("_voltro_"));
3628
+ let { connectionFromConfig: e } = await v("@voltro/sql-mysql"), t = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, n = Yr().filter((e) => e.isReactive !== !1).map((e) => e.tableName).filter((e) => !e.startsWith("_voltro_"));
3629
3629
  u = {
3630
3630
  serverId: Xl(t),
3631
3631
  replicaId: t,
@@ -3637,7 +3637,7 @@ ${a.join("\n\n")}\n`);
3637
3637
  tables: n.length
3638
3638
  });
3639
3639
  } else if (r && i.id === "mssql") {
3640
- let { connectionFromConfig: e } = await v("@voltro/sql-mssql"), t = e(s), n = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, i = Xr().filter((e) => e.isReactive !== !1).map((e) => e.tableName).filter((e) => !e.startsWith("_voltro_"));
3640
+ let { connectionFromConfig: e } = await v("@voltro/sql-mssql"), t = e(s), n = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, i = Yr().filter((e) => e.isReactive !== !1).map((e) => e.tableName).filter((e) => !e.startsWith("_voltro_"));
3641
3641
  u = {
3642
3642
  serverId: 0,
3643
3643
  replicaId: n,
@@ -3667,7 +3667,7 @@ ${a.join("\n\n")}\n`);
3667
3667
  region: null,
3668
3668
  localityEnabled: !1
3669
3669
  }), d;
3670
- if (ni(i.id)) return $.warn(`read replicas: not applicable (${i.id} is single-process); ignoring DB_REPLICA_URLS`), ut.recordReplication({
3670
+ if (ti(i.id)) return $.warn(`read replicas: not applicable (${i.id} is single-process); ignoring DB_REPLICA_URLS`), ut.recordReplication({
3671
3671
  replicaCount: 0,
3672
3672
  rywPolicy: "off",
3673
3673
  rywStore: "memory",
@@ -3697,7 +3697,7 @@ ${a.join("\n\n")}\n`);
3697
3697
  if (!e) $.warn("RYW_STORE=redis set but REDIS_URL is empty — falling back to memory store");
3698
3698
  else try {
3699
3699
  let { default: t } = await import("ioredis"), n = new t(e);
3700
- _ = ar({
3700
+ _ = ir({
3701
3701
  client: n,
3702
3702
  subscriber: n.duplicate()
3703
3703
  }), ee = "redis", $.info(`read replicas: ryw store = redis @ ${eu(e)}`);
@@ -3705,19 +3705,19 @@ ${a.join("\n\n")}\n`);
3705
3705
  $.warn("RYW_STORE=redis but ioredis import / connect failed — falling back to memory store", { err: e });
3706
3706
  }
3707
3707
  }
3708
- _ ||= Qn();
3709
- let te = tu(f.length), ne = lr(), re = ne && te.length > 0 ? yn({
3708
+ _ ||= Zn();
3709
+ let te = tu(f.length), ne = cr(), re = ne && te.length > 0 ? vn({
3710
3710
  currentRegion: ne,
3711
3711
  replicaRegions: nu(m, te),
3712
- inner: nr()
3713
- }) : nr();
3712
+ inner: tr()
3713
+ }) : tr();
3714
3714
  return $.info(`read replicas: ${m.length} configured, ryw policy '${h}', dialect=${i.id}, region=${ne ?? "unknown"}` + (te.length > 0 ? ", replica-locality=on" : "")), ut.recordReplication({
3715
3715
  replicaCount: m.length,
3716
3716
  rywPolicy: h,
3717
3717
  rywStore: ee,
3718
3718
  region: ne ?? null,
3719
3719
  localityEnabled: te.length > 0 && ne !== void 0
3720
- }), new zt({
3720
+ }), new Rt({
3721
3721
  primary: d,
3722
3722
  replicas: m,
3723
3723
  replicationAdapter: p,
@@ -3726,10 +3726,10 @@ ${a.join("\n\n")}\n`);
3726
3726
  replicaSelector: re
3727
3727
  });
3728
3728
  }, $l = async (e, t, n, r) => {
3729
- let i = Ta(t?.plugins ?? []), a = n === "postgres" || n === "mysql" || n === "mariadb", o = n === "postgres" ? "LISTEN/NOTIFY" : "binlog CDC";
3729
+ let i = wa(t?.plugins ?? []), a = n === "postgres" || n === "mysql" || n === "mariadb", o = n === "postgres" ? "LISTEN/NOTIFY" : "binlog CDC";
3730
3730
  if (!i) return n === "memory" || n === "sqlite" || n === "turso" ? r.info(`reactivity: single-instance (${n}) — no cross-replica fan-out needed`) : a ? r.info(`reactivity: cross-instance via native ${o} (${n})`) : r.warn(`reactivity: cross-instance fan-out is OFF for dialect '${n}'. A write on one replica will NOT reach clients on other replicas. Add @voltro/plugin-broadcast (Redis / NATS) to close the gap, or use postgres (LISTEN/NOTIFY) / mariadb (binlog CDC).`), null;
3731
3731
  let s = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`;
3732
- return i.broadcast.crossReplica ? a ? r.info(`reactivity: native ${o} (${n}) + @voltro/plugin-broadcast (${i.broadcast.provider.name}) — both paths active (own-origin skip dedups)`) : r.info(`reactivity: cross-instance via @voltro/plugin-broadcast (${i.broadcast.provider.name}) for dialect '${n}'`) : r.warn("reactivity: @voltro/plugin-broadcast resolved to the in-process memory provider — NO real cross-replica fan-out. Set BROADCAST_URL (redis:// or nats://) for a real bus."), await wa({
3732
+ return i.broadcast.crossReplica ? a ? r.info(`reactivity: native ${o} (${n}) + @voltro/plugin-broadcast (${i.broadcast.provider.name}) — both paths active (own-origin skip dedups)`) : r.info(`reactivity: cross-instance via @voltro/plugin-broadcast (${i.broadcast.provider.name}) for dialect '${n}'`) : r.warn("reactivity: @voltro/plugin-broadcast resolved to the in-process memory provider — NO real cross-replica fan-out. Set BROADCAST_URL (redis:// or nats://) for a real bus."), await Ca({
3733
3733
  store: e,
3734
3734
  provider: i.broadcast.provider,
3735
3735
  replicaId: s,
@@ -3761,7 +3761,7 @@ ${a.join("\n\n")}\n`);
3761
3761
  }
3762
3762
  }, iu = async (e) => {
3763
3763
  let t = A(e.find((e) => !e.startsWith("-")) ?? process.cwd()), n = await g(t);
3764
- return n.ran ? n.exitCode : process.env.FRAMEWORK_DEV_INNER !== "1" && process.env.WATCH !== "0" ? (m(uo({ root: t }), { scope: "voltro:dev" }), new Promise(() => {})) : au(t);
3764
+ return n.ran ? n.exitCode : process.env.FRAMEWORK_DEV_INNER !== "1" && process.env.WATCH !== "0" ? (m(lo({ root: t }), { scope: "voltro:dev" }), new Promise(() => {})) : au(t);
3765
3765
  }, au = async (m) => {
3766
3766
  let g = Date.now(), v = await Wl(m), b = Number(process.env.PORT ?? v?.port ?? 4e3), le = v?.name ?? E(m), x = o("api", le, b), ue = n(le);
3767
3767
  await h({
@@ -3810,13 +3810,13 @@ ${a.join("\n\n")}\n`);
3810
3810
  ...je.length > 0 ? { pluginRpcImports: je } : {},
3811
3811
  ...v?.name === void 0 ? {} : { apiName: v.name }
3812
3812
  });
3813
- if (Me ? ($.info("codegen wrote rpcGroup", { path: k(m, Me) }), await wo(Me)) : $.debug("codegen skipped — no descriptors discovered"), process.env.VOLTRO_BROWSER_SAFETY !== "off") {
3814
- let e = await So(m, C);
3815
- if (e.length > 0) throw Error(e.map(Co).join("\n\n"));
3813
+ if (Me ? ($.info("codegen wrote rpcGroup", { path: k(m, Me) }), await Co(Me)) : $.debug("codegen skipped — no descriptors discovered"), process.env.VOLTRO_BROWSER_SAFETY !== "off") {
3814
+ let e = await xo(m, C);
3815
+ if (e.length > 0) throw Error(e.map(So).join("\n\n"));
3816
3816
  }
3817
- let Ne = Zl(v ?? null), Pe = Ne === "mariadb" ? "mariadb" : Ne === "mssql" ? "mssql" : void 0, Le = Pe !== void 0 && (process.env.CDC ?? "1") !== "0", { queries: w, mutations: D, actions: A, streams: dt, workflows: j, workflowWorkers: ft, eventTriggers: mt, schedules: M, connections: ht, tables: gt, featureMix: vt, tenantScopedTables: yt, softDeleteScopedTables: bt } = await Ul(C, { cdc: Le }), xt = j.length > 0 || mt.length > 0, F = await Wl(m), wt = Ya(F?.http ?? {});
3818
- _r(ur(F?.secrets));
3819
- let I = ja(Wi(F?.env) ? F.env : void 0, m);
3817
+ let Ne = Zl(v ?? null), Pe = Ne === "mariadb" ? "mariadb" : Ne === "mssql" ? "mssql" : void 0, Le = Pe !== void 0 && (process.env.CDC ?? "1") !== "0", { queries: w, mutations: D, actions: A, streams: dt, workflows: j, workflowWorkers: ft, eventTriggers: mt, schedules: M, connections: ht, tables: gt, featureMix: vt, tenantScopedTables: yt, softDeleteScopedTables: bt } = await Ul(C, { cdc: Le }), xt = j.length > 0 || mt.length > 0, F = await Wl(m), wt = Ja(F?.http ?? {});
3818
+ gr(lr(F?.secrets));
3819
+ let I = Aa(Ui(F?.env) ? F.env : void 0, m);
3820
3820
  I.minted.length > 0 && I.file !== void 0 && ($.warn(`minted ${I.minted.length} project secret(s) into ${k(m, I.file)} — unique to this project, gitignored. Your DEPLOYMENT needs its own values (\`voltro secret generate\`).`, {
3821
3821
  keys: I.minted,
3822
3822
  file: k(m, I.file)
@@ -3827,8 +3827,8 @@ ${a.join("\n\n")}\n`);
3827
3827
  log: $,
3828
3828
  generateTypes: !0
3829
3829
  });
3830
- let Tt = { current: void 0 }, Et = F?.apiKeys;
3831
- if (Et) {
3830
+ let L = { current: void 0 }, Tt = F?.apiKeys;
3831
+ if (Tt) {
3832
3832
  let e = new Set((F?.plugins ?? []).flatMap((e) => e.declaredScopes ?? []));
3833
3833
  e.size > 0 && ![
3834
3834
  "apikeys:issue:self",
@@ -3836,49 +3836,49 @@ ${a.join("\n\n")}\n`);
3836
3836
  "apikeys:issue:other"
3837
3837
  ].some((t) => e.has(t)) && !e.has("admin:full") && $.warn("apiKeys is enabled but no role declares any of apikeys:issue:self / :org / :other. The management routes are mounted and every issue request will fail its guard — the capability is on and reachable by nobody. Grant the right one in your role map (`:self` lets a user mint their own key, `:org` a shared one, `:other` on behalf of a colleague).");
3838
3838
  }
3839
- let Dt = (typeof Et == "object" ? Et.prefix : void 0) ?? "voltro_", Ot, kt = Et ? [cn({ resolveByHash: (e, t) => Ot ? Ot.resolveByHash(e, t) : Promise.resolve(null) }, { prefix: Dt })] : [], At = _l([...F?.auth?.strategies ?? [], ...kt], ca(F?.plugins ?? []), F?.auth?.anonymousTenantRequired ?? !1, F?.auth?.resolveScopes, () => Tt.current), jt = yl(At), Mt = _e({
3839
+ let Et = (typeof Tt == "object" ? Tt.prefix : void 0) ?? "voltro_", Dt, Ot = Tt ? [sn({ resolveByHash: (e, t) => Dt ? Dt.resolveByHash(e, t) : Promise.resolve(null) }, { prefix: Et })] : [], kt = _l([...F?.auth?.strategies ?? [], ...Ot], sa(F?.plugins ?? []), F?.auth?.anonymousTenantRequired ?? !1, F?.auth?.resolveScopes, () => L.current), At = yl(kt), jt = _e({
3840
3840
  mix: vt,
3841
3841
  plugins: F?.plugins ?? [],
3842
3842
  cdc: Le,
3843
3843
  ...Pe ? { cdcDialect: Pe } : {}
3844
- }), Pt = F?.analytics?.tables ?? [], R = (() => {
3844
+ }), Nt = F?.analytics?.tables ?? [], z = (() => {
3845
3845
  let e = new Set(gt.map((e) => e.tableName)), t = [...gt];
3846
- for (let n of [...Mt, ...Pt]) {
3846
+ for (let n of [...jt, ...Nt]) {
3847
3847
  let r = n.tableName;
3848
3848
  r === void 0 || e.has(r) || (e.add(r), t.push(n));
3849
3849
  }
3850
3850
  return t;
3851
3851
  })();
3852
- for (let e of R) ei(e);
3853
- let Lt = bc({
3852
+ for (let e of z) $r(e);
3853
+ let It = bc({
3854
3854
  plugins: F?.plugins ?? [],
3855
3855
  appName: F?.name ?? E(m),
3856
3856
  appType: "api",
3857
3857
  voltroVersion: process.env.npm_package_version ?? "0.0.0",
3858
3858
  log: $
3859
3859
  });
3860
- F?.plugins?.length && ($.info("plugins loaded", { plugins: F.plugins.map((e) => e.name) }), await Lt.activate());
3861
- let Rt = await Lt.gatherObservability(), zt = Oc(F?.plugins ?? []);
3862
- zt.endpoints.length > 0 && $.info("plugin inspect endpoints registered", {
3863
- count: zt.endpoints.length,
3864
- endpoints: zt.endpoints.map((e) => `${e.method} ${e.path}`)
3860
+ F?.plugins?.length && ($.info("plugins loaded", { plugins: F.plugins.map((e) => e.name) }), await It.activate());
3861
+ let Lt = await It.gatherObservability(), Rt = Oc(F?.plugins ?? []);
3862
+ Rt.endpoints.length > 0 && $.info("plugin inspect endpoints registered", {
3863
+ count: Rt.endpoints.length,
3864
+ endpoints: Rt.endpoints.map((e) => `${e.method} ${e.path}`)
3865
3865
  });
3866
- let Bt = zc(F?.plugins ?? []);
3867
- Bt.length > 0 && $.info("plugin dashboard mounts registered", {
3868
- count: Bt.length,
3869
- mounts: Bt.map((e) => `${e.fullId} (${e.slot})`)
3866
+ let zt = zc(F?.plugins ?? []);
3867
+ zt.length > 0 && $.info("plugin dashboard mounts registered", {
3868
+ count: zt.length,
3869
+ mounts: zt.map((e) => `${e.fullId} (${e.slot})`)
3870
3870
  });
3871
- let Wt = fe(F?.plugins ?? []);
3872
- Wt.length > 0 && $.info("plugin schema contributions", { plugins: Wt.map((e) => `${e.pluginName}: ${e.tables}t/${e.migrations}m`) });
3873
- let Gt = Ce(F?.plugins ?? []);
3874
- if (Gt.length > 0) {
3875
- ce(Gt, [
3871
+ let Ut = fe(F?.plugins ?? []);
3872
+ Ut.length > 0 && $.info("plugin schema contributions", { plugins: Ut.map((e) => `${e.pluginName}: ${e.tables}t/${e.migrations}m`) });
3873
+ let Wt = Ce(F?.plugins ?? []);
3874
+ if (Wt.length > 0) {
3875
+ ce(Wt, [
3876
3876
  ...w.map((e) => e.descriptor.name),
3877
3877
  ...D.map((e) => e.descriptor.name),
3878
3878
  ...A.map((e) => e.descriptor.name),
3879
3879
  ...dt.map((e) => e.descriptor.name)
3880
3880
  ]);
3881
- for (let e of Gt) e.kind === "query" ? w.push({
3881
+ for (let e of Wt) e.kind === "query" ? w.push({
3882
3882
  file: e.file,
3883
3883
  descriptor: e.descriptor,
3884
3884
  executor: e.executor
@@ -3892,19 +3892,19 @@ ${a.join("\n\n")}\n`);
3892
3892
  executor: e.executor
3893
3893
  });
3894
3894
  $.info("plugin routes registered", {
3895
- count: Gt.length,
3896
- routes: Gt.map((e) => `${e.plugin.name}:${e.descriptor.name} (${e.kind})`)
3895
+ count: Wt.length,
3896
+ routes: Wt.map((e) => `${e.plugin.name}:${e.descriptor.name} (${e.kind})`)
3897
3897
  });
3898
3898
  }
3899
- let en = $.child("agent"), rn = C.filter((e) => de.test(E(e)));
3900
- if (rn.length > 0) {
3901
- let e = await ge(rn, en);
3902
- e > 0 && en.info("wired tool handlers", { tools: e });
3899
+ let $t = $.child("agent"), nn = C.filter((e) => de.test(E(e)));
3900
+ if (nn.length > 0) {
3901
+ let e = await ge(nn, $t);
3902
+ e > 0 && $t.info("wired tool handlers", { tools: e });
3903
3903
  }
3904
- let on = C.filter((e) => Se.test(E(e))), sn = [];
3905
- if (on.length > 0) {
3906
- let e = await ye(on, en);
3907
- sn = e.agents.map((e) => e.descriptor.name);
3904
+ let an = C.filter((e) => Se.test(E(e))), on = [];
3905
+ if (an.length > 0) {
3906
+ let e = await ye(an, $t);
3907
+ on = e.agents.map((e) => e.descriptor.name);
3908
3908
  for (let t of e.agents) for (let e of ac(t)) e.kind === "action" ? A.push({
3909
3909
  file: e.file,
3910
3910
  descriptor: e.descriptor,
@@ -3914,20 +3914,20 @@ ${a.join("\n\n")}\n`);
3914
3914
  descriptor: e.descriptor,
3915
3915
  executor: e.executor
3916
3916
  });
3917
- e.agents.length > 0 && en.info("discovered agents", {
3917
+ e.agents.length > 0 && $t.info("discovered agents", {
3918
3918
  agents: e.agents.map((e) => e.descriptor.name),
3919
3919
  routes: e.agents.flatMap((e) => [`${e.descriptor.name}.send`, `${e.descriptor.name}.messages`])
3920
3920
  });
3921
3921
  }
3922
- let ln = sc();
3923
- (ln.queries.length > 0 || ln.mutations.length > 0) && (w.push(...ln.queries), D.push(...ln.mutations), $.info("undo built-ins registered", { routes: [
3922
+ let cn = sc();
3923
+ (cn.queries.length > 0 || cn.mutations.length > 0) && (w.push(...cn.queries), D.push(...cn.mutations), $.info("undo built-ins registered", { routes: [
3924
3924
  "__voltro.undo.log",
3925
3925
  "__voltro.undo.apply",
3926
3926
  "__voltro.undo.redo"
3927
3927
  ] }));
3928
- let fn = $.child("aggregate"), hn = C.filter((e) => Re.test(e)), gn = hn.length > 0 ? await Ts(hn, fn) : [], _n = gn.map((e) => e.definition.name);
3929
- for (let e of $r()) $.warn(`identifier length · ${e}`);
3930
- let yn = F?.restRoutes ?? [], Tn = C.filter((e) => Ae.test(e)).length, On = C.filter((e) => ze.test(e)).length, kn = C.filter((e) => /\.seed\.ts$/.test(e)).length, An = C.filter((e) => Oe.test(e)).length, Mn = C.filter((e) => nc.test(e)).length;
3928
+ let dn = $.child("aggregate"), mn = C.filter((e) => Re.test(e)), hn = mn.length > 0 ? await Ts(mn, dn) : [], gn = hn.map((e) => e.definition.name);
3929
+ for (let e of Qr()) $.warn(`identifier length · ${e}`);
3930
+ let vn = F?.restRoutes ?? [], wn = C.filter((e) => Ae.test(e)).length, Dn = C.filter((e) => ze.test(e)).length, On = C.filter((e) => /\.seed\.ts$/.test(e)).length, kn = C.filter((e) => Oe.test(e)).length, jn = C.filter((e) => nc.test(e)).length;
3931
3931
  Wo(Uo([
3932
3932
  w,
3933
3933
  D,
@@ -3940,18 +3940,18 @@ ${a.join("\n\n")}\n`);
3940
3940
  mutationCount: D.length,
3941
3941
  actionCount: A.length,
3942
3942
  streamCount: dt.length,
3943
- restRouteCount: yn.length,
3943
+ restRouteCount: vn.length,
3944
3944
  workflowCount: j.length,
3945
3945
  workflowWorkerCount: ft.length,
3946
3946
  triggerCount: mt.length,
3947
3947
  scheduleCount: M.length,
3948
- agentCount: sn.length,
3949
- aggregateCount: _n.length,
3950
- subscriberCount: Tn,
3951
- startupCount: On,
3952
- seedCount: kn,
3953
- webhookCount: An,
3954
- emailCount: Mn,
3948
+ agentCount: on.length,
3949
+ aggregateCount: gn.length,
3950
+ subscriberCount: wn,
3951
+ startupCount: Dn,
3952
+ seedCount: On,
3953
+ webhookCount: kn,
3954
+ emailCount: jn,
3955
3955
  tenantTables: [...yt]
3956
3956
  }), St({
3957
3957
  appName: F?.name ?? E(m),
@@ -3959,43 +3959,43 @@ ${a.join("\n\n")}\n`);
3959
3959
  mutations: D.map((e) => e.descriptor.name),
3960
3960
  actions: A.map((e) => e.descriptor.name),
3961
3961
  streams: dt.map((e) => e.descriptor.name),
3962
- restRoutes: yn.map((e) => `${e.method} ${e.path}`),
3962
+ restRoutes: vn.map((e) => `${e.method} ${e.path}`),
3963
3963
  workflows: j.map((e) => e.definition.name),
3964
3964
  triggers: mt.map((e) => `${e.event}→${e.workflow}`),
3965
3965
  schedules: M.map((e) => e.name),
3966
- agents: sn,
3967
- aggregates: _n,
3966
+ agents: on,
3967
+ aggregates: gn,
3968
3968
  lifecycle: {
3969
- seeds: kn,
3970
- startups: On,
3971
- subscribers: Tn,
3972
- webhooks: An,
3973
- emails: Mn
3969
+ seeds: On,
3970
+ startups: Dn,
3971
+ subscribers: wn,
3972
+ webhooks: kn,
3973
+ emails: jn
3974
3974
  },
3975
3975
  tenantTables: [...yt]
3976
3976
  });
3977
- let Nn = ve(), Fn = (process.env.VOLTRO_TRACING_BUFFER ?? "").toLowerCase() === "off", Ln = (process.env.VOLTRO_TRACING_STREAM ?? "").toLowerCase() === "all", Bn = () => {}, Vn = (e) => {
3977
+ let Mn = ve(), Pn = (process.env.VOLTRO_TRACING_BUFFER ?? "").toLowerCase() === "off", In = (process.env.VOLTRO_TRACING_STREAM ?? "").toLowerCase() === "all", zn = () => {}, Bn = (e) => {
3978
3978
  if (!e.name.startsWith("http.server")) return !1;
3979
3979
  let t = e.attributes, n = String(t["url.path"] ?? t["http.route"] ?? t["http.target"] ?? "");
3980
3980
  return n.startsWith("/_voltro/") || n === "/ws" || n.startsWith("/ws/") || n.startsWith("/ws?");
3981
- }, Kn = (e) => {
3982
- Vn(e) || xe(e) || e.name.startsWith("RpcServer.") || (Nn.append(e), (Ln || e.status === "error") && S.emit("trace", e), Bn(e));
3983
- }, qn = Fn ? void 0 : Dn(Kn), Jn = await Zt({
3981
+ }, Gn = (e) => {
3982
+ Bn(e) || xe(e) || e.name.startsWith("RpcServer.") || (Mn.append(e), (In || e.status === "error") && S.emit("trace", e), zn(e));
3983
+ }, Kn = Pn ? void 0 : En(Gn), qn = await Xt({
3984
3984
  serviceName: process.env.OTEL_SERVICE_NAME ?? F?.name ?? "voltro-api",
3985
- ...qn ? { traceSink: qn } : {},
3986
- ...Rt.spanProcessors.length > 0 ? { extraSpanProcessors: Rt.spanProcessors } : {},
3987
- ...Rt.metricReaders.length > 0 ? { extraMetricReaders: Rt.metricReaders } : {},
3988
- ...Object.keys(Rt.resourceAttributes).length > 0 ? { resourceAttributes: Rt.resourceAttributes } : {},
3989
- ...Rt.sampler === void 0 ? {} : { sampler: Rt.sampler }
3985
+ ...Kn ? { traceSink: Kn } : {},
3986
+ ...Lt.spanProcessors.length > 0 ? { extraSpanProcessors: Lt.spanProcessors } : {},
3987
+ ...Lt.metricReaders.length > 0 ? { extraMetricReaders: Lt.metricReaders } : {},
3988
+ ...Object.keys(Lt.resourceAttributes).length > 0 ? { resourceAttributes: Lt.resourceAttributes } : {},
3989
+ ...Lt.sampler === void 0 ? {} : { sampler: Lt.sampler }
3990
3990
  });
3991
- Jn.mode === "off" ? Jn.bufferOnly || $.info("tracing disabled", { reason: "buffer off" }) : $.info("tracing enabled", { mode: Jn.mode });
3992
- let Qn = Jn.mode === "off" && Jn.bufferOnly === !1 ? void 0 : Jn.layer, z = await Ql(F, Qn);
3993
- Tt.current = z;
3994
- for (let e of za({
3991
+ qn.mode === "off" ? qn.bufferOnly || $.info("tracing disabled", { reason: "buffer off" }) : $.info("tracing enabled", { mode: qn.mode });
3992
+ let Zn = qn.mode === "off" && qn.bufferOnly === !1 ? void 0 : qn.layer, B = await Ql(F, Zn);
3993
+ L.current = B;
3994
+ for (let e of Ra({
3995
3995
  dialect: Zl(F ?? null),
3996
3996
  changeStrategy: (process.env.CDC ?? "1") === "0" ? "inline" : "cdc",
3997
3997
  dbUrl: process.env.DB_URL,
3998
- tables: Xr().map((e) => ({
3998
+ tables: Yr().map((e) => ({
3999
3999
  tableName: e.tableName,
4000
4000
  isReactive: e.isReactive === !0
4001
4001
  })),
@@ -4004,110 +4004,110 @@ ${a.join("\n\n")}\n`);
4004
4004
  return t === void 0 ? [] : typeof t == "string" ? [t] : [...t];
4005
4005
  })
4006
4006
  })) e.level === "warn" ? $.warn(e.message) : $.info(e.message);
4007
- if (Et) {
4008
- let e = tn(z), t = Cn({ flush: wn(e) });
4007
+ if (Tt) {
4008
+ let e = en(B), t = Sn({ flush: Cn(e) });
4009
4009
  process.once("exit", () => {
4010
4010
  t.shutdown();
4011
- }), Ot = Sn(e, {
4012
- prefix: Dt,
4011
+ }), Dt = xn(e, {
4012
+ prefix: Et,
4013
4013
  usage: t
4014
- }), $.info("api keys active", { prefix: Dt });
4014
+ }), $.info("api keys active", { prefix: Et });
4015
4015
  }
4016
- let er = ds({
4016
+ let $n = ds({
4017
4017
  definitions: ht.map((e) => e.definition),
4018
- store: z,
4018
+ store: B,
4019
4019
  publicUrl: ps(b),
4020
4020
  log: $.child("connections")
4021
4021
  });
4022
- w.push(...er.queries), D.push(...er.mutations), A.push(...er.actions);
4023
- let nr = Zl(F), ar = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, or, sr;
4024
- if (nr !== "memory") {
4025
- let e = await y(nr);
4026
- or = _t.make(e.makeSqlLayer(Gl())), sr = await or.runPromise(B.SqlClient);
4022
+ w.push(...$n.queries), D.push(...$n.mutations), A.push(...$n.actions);
4023
+ let tr = Zl(F), ir = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, ar, or;
4024
+ if (tr !== "memory") {
4025
+ let e = await y(tr);
4026
+ ar = _t.make(e.makeSqlLayer(Gl())), or = await ar.runPromise(V.SqlClient);
4027
4027
  }
4028
- let lr = jn({
4028
+ let cr = An({
4029
4029
  coordinator: [
4030
4030
  "postgres",
4031
4031
  "mariadb",
4032
4032
  "mysql",
4033
4033
  "mssql"
4034
- ].includes(nr) ? xn(z, ar, $) : br,
4035
- replicaId: ar,
4034
+ ].includes(tr) ? bn(B, ir, $) : yr,
4035
+ replicaId: ir,
4036
4036
  log: $
4037
- }), dr = [], pr = {
4038
- ...sr ? { sql: sr } : {},
4037
+ }), ur = [], fr = {
4038
+ ...or ? { sql: or } : {},
4039
4039
  scheduleCoordinated: (e, t, n) => {
4040
- let r = lr(e, t, n);
4041
- return dr.push(r), r;
4040
+ let r = cr(e, t, n);
4041
+ return ur.push(r), r;
4042
4042
  }
4043
4043
  };
4044
- for (let e of F?.plugins ?? []) e.bindDataStore?.(z, pr);
4045
- let mr = await $l(z, F, Zl(F), $);
4044
+ for (let e of F?.plugins ?? []) e.bindDataStore?.(B, fr);
4045
+ let pr = await $l(B, F, Zl(F), $);
4046
4046
  F?.cache && !process.env.CACHE_BACKEND && (process.env.CACHE_BACKEND = F.cache), F?.cacheRedisUrl && !process.env.CACHE_REDIS_URL && (process.env.CACHE_REDIS_URL = F.cacheRedisUrl), F?.cacheRedisDriver && !process.env.CACHE_REDIS_DRIVER && (process.env.CACHE_REDIS_DRIVER = F.cacheRedisDriver), F?.cacheKeyPrefix && !process.env.CACHE_KEY_PREFIX && (process.env.CACHE_KEY_PREFIX = F.cacheKeyPrefix);
4047
- let { service: hr, invalidationBus: gr, snapshotCache: xr, cache: wr, backend: Tr, stats: Er, dispose: Dr } = await Wa({ env: process.env });
4048
- $.info(`cache backend resolved: ${Tr}` + (Tr === "redis" ? ` (driver ${process.env.CACHE_REDIS_DRIVER ?? "resp"})` : " — in-process, not cross-instance")), F?.kv && !process.env.KV_BACKEND && (process.env.KV_BACKEND = F.kv), F?.kvRedisUrl && !process.env.KV_REDIS_URL && (process.env.KV_REDIS_URL = F.kvRedisUrl), F?.kvKeyPrefix && !process.env.KV_KEY_PREFIX && (process.env.KV_KEY_PREFIX = F.kvKeyPrefix);
4049
- let { kv: Or, service: Mr, backend: Ir } = await En({ store: z });
4050
- $.info(`kv backend resolved: ${Ir}` + (Ir === "database" ? " (durable, _voltro_kv)" : Ir === "memory" ? " — in-process, non-durable" : ` (driver ${process.env.KV_REDIS_DRIVER ?? "resp"}, non-durable)`));
4051
- let qr = Zl(F), Jr = F?.analytics !== void 0 && F.analytics.kind !== "noop" && qr !== "memory" ? (await y(qr)).makeSqlLayer(Gl()) : void 0, Yr = await Go({
4047
+ let { service: mr, invalidationBus: hr, snapshotCache: br, cache: Cr, backend: wr, stats: Tr, dispose: Er } = await Ua({ env: process.env });
4048
+ $.info(`cache backend resolved: ${wr}` + (wr === "redis" ? ` (driver ${process.env.CACHE_REDIS_DRIVER ?? "resp"})` : " — in-process, not cross-instance")), F?.kv && !process.env.KV_BACKEND && (process.env.KV_BACKEND = F.kv), F?.kvRedisUrl && !process.env.KV_REDIS_URL && (process.env.KV_REDIS_URL = F.kvRedisUrl), F?.kvKeyPrefix && !process.env.KV_KEY_PREFIX && (process.env.KV_KEY_PREFIX = F.kvKeyPrefix);
4049
+ let { kv: Dr, service: jr, backend: Fr } = await Tn({ store: B });
4050
+ $.info(`kv backend resolved: ${Fr}` + (Fr === "database" ? " (durable, _voltro_kv)" : Fr === "memory" ? " — in-process, non-durable" : ` (driver ${process.env.KV_REDIS_DRIVER ?? "resp"}, non-durable)`));
4051
+ let Kr = Zl(F), qr = F?.analytics !== void 0 && F.analytics.kind !== "noop" && Kr !== "memory" ? (await y(Kr)).makeSqlLayer(Gl()) : void 0, Jr = await Go({
4052
4052
  spec: F?.analytics,
4053
- sqlLayer: Jr,
4053
+ sqlLayer: qr,
4054
4054
  log: $
4055
4055
  });
4056
- Yr.spec;
4057
- let ri = Yr.sink, ai = Kt({
4058
- store: z,
4059
- sink: ri,
4056
+ Jr.spec;
4057
+ let ni = Jr.sink, ii = Gt({
4058
+ store: B,
4059
+ sink: ni,
4060
4060
  log: $
4061
4061
  });
4062
- ai.tables.length > 0 && $.info("analytics mirror", {
4063
- provider: ri.info.provider,
4064
- tables: ai.tables
4062
+ ii.tables.length > 0 && $.info("analytics mirror", {
4063
+ provider: ni.info.provider,
4064
+ tables: ii.tables
4065
4065
  }), process.on("beforeExit", () => {
4066
- ai.detach();
4066
+ ii.detach();
4067
4067
  });
4068
- let oi = Yr.dispose, si = Zl(F), ci;
4069
- if (si !== "memory" && process.env.VOLTRO_AUTO_MIGRATE !== "0") {
4068
+ let ai = Jr.dispose, oi = Zl(F), si;
4069
+ if (oi !== "memory" && process.env.VOLTRO_AUTO_MIGRATE !== "0") {
4070
4070
  let e = Date.now(), t = (process.env.NODE_ENV ?? "").toLowerCase() === "production" ? "prod" : (process.env.NODE_ENV ?? "").toLowerCase() === "staging" ? "staging" : "dev";
4071
4071
  $.info("auto-migrate: planning schema", {
4072
- dialect: si,
4072
+ dialect: oi,
4073
4073
  env: t,
4074
- tables: R.length
4074
+ tables: z.length
4075
4075
  }), Ee?.set({
4076
4076
  phase: "migrating",
4077
- tablesTotal: R.length
4077
+ tablesTotal: z.length
4078
4078
  });
4079
4079
  try {
4080
- let n = await y(si), r = n.makeSqlLayer(Gl());
4081
- ci = r, await ra(Il(R.filter((e) => e.tableName.startsWith("_voltro_") || e.tableName === "voltro_isr_cache"), R), r, n.id);
4082
- let i = Ua({
4080
+ let n = await y(oi), r = n.makeSqlLayer(Gl());
4081
+ si = r, await na(Il(z.filter((e) => e.tableName.startsWith("_voltro_") || e.tableName === "voltro_isr_cache"), z), r, n.id);
4082
+ let i = Ha({
4083
4083
  conn: Gl(),
4084
- pendingIds: await N.runPromise(B.SqlClient.pipe(N.flatMap((e) => ea(e, m)), N.provide(r))),
4085
- optIn: process.env[Ba] === "1"
4084
+ pendingIds: await N.runPromise(V.SqlClient.pipe(N.flatMap((e) => $i(e, m)), N.provide(r))),
4085
+ optIn: process.env[za] === "1"
4086
4086
  });
4087
4087
  if (!i.allowed) throw $.error(`file-based migrations: ${i.message}`), Error("file-based migrations refused — see error above");
4088
- let a = await N.runPromise(B.SqlClient.pipe(N.flatMap((e) => na(e, {
4088
+ let a = await N.runPromise(V.SqlClient.pipe(N.flatMap((e) => ta(e, {
4089
4089
  projectRoot: m,
4090
4090
  env: t,
4091
4091
  appliedBy: `boot:${t}`
4092
4092
  })), N.provide(r)));
4093
4093
  a.applied.length > 0 && $.info(`file-based migrations: applied ${a.applied.length}`, { applied: a.applied.map((e) => `${e.id} (${e.durationMs}ms)`) });
4094
- let o = await N.runPromise(B.SqlClient.pipe(N.flatMap((e) => ia(e, R, {
4094
+ let o = await N.runPromise(V.SqlClient.pipe(N.flatMap((e) => ra(e, z, {
4095
4095
  appliedBy: `boot:${t}`,
4096
4096
  environment: t,
4097
4097
  dialectId: n.id
4098
4098
  })), N.provide(r)));
4099
- if (o.kind === "refused-blocked" || o.kind === "prod-mismatch") throw $.error(Zi(o, n.id)), Error("auto-migrate refused — see error above");
4100
- $.info(Zi(o, n.id), { durationMs: Date.now() - e });
4099
+ if (o.kind === "refused-blocked" || o.kind === "prod-mismatch") throw $.error(Xi(o, n.id)), Error("auto-migrate refused — see error above");
4100
+ $.info(Xi(o, n.id), { durationMs: Date.now() - e });
4101
4101
  } catch (e) {
4102
4102
  throw $.error("auto-migrate failed — aborting boot", { err: e }), Ee?.set({
4103
4103
  phase: "error",
4104
4104
  error: e instanceof Error ? e.message : String(e)
4105
4105
  }), e;
4106
4106
  }
4107
- } else si !== "memory" && $.info("auto-migrate: skipped (VOLTRO_AUTO_MIGRATE=0)");
4108
- let li = Zl(F);
4109
- if ((F?.plugins ?? []).some((e) => (e.extendSchema?.migrations?.length ?? 0) > 0) && li !== "memory") {
4110
- let e = (await y(li)).makeSqlLayer(Gl());
4107
+ } else oi !== "memory" && $.info("auto-migrate: skipped (VOLTRO_AUTO_MIGRATE=0)");
4108
+ let ci = Zl(F);
4109
+ if ((F?.plugins ?? []).some((e) => (e.extendSchema?.migrations?.length ?? 0) > 0) && ci !== "memory") {
4110
+ let e = (await y(ci)).makeSqlLayer(Gl());
4111
4111
  try {
4112
4112
  let t = await N.runPromise(pe(F.plugins).pipe(N.provide(e))), n = t.filter((e) => e.status === "applied"), r = t.filter((e) => e.status === "skipped");
4113
4113
  $.info("plugin migrations complete", {
@@ -4118,108 +4118,108 @@ ${a.join("\n\n")}\n`);
4118
4118
  throw $.error("plugin migrations failed — aborting boot", { err: e }), e;
4119
4119
  }
4120
4120
  }
4121
- let pi = cl(z, S);
4121
+ let fi = cl(B, S);
4122
4122
  process.on("beforeExit", () => {
4123
- pi();
4123
+ fi();
4124
4124
  });
4125
- let gi = Gn(R);
4126
- vr({
4127
- dataStore: z,
4128
- schemaRegistry: gi
4125
+ let hi = Wn(z);
4126
+ _r({
4127
+ dataStore: B,
4128
+ schemaRegistry: hi
4129
4129
  });
4130
- let vi = $.child("seeds"), yi = C.filter((e) => /\.seed\.ts$/.test(e)), xi = yi.length > 0 ? await ae(yi, vi) : [];
4131
- if (xi.length > 0) {
4132
- vi.info("discovered seeds", { ids: xi.map((e) => e.definition.id) });
4133
- for (let e of xi) ut.registerSeed(e);
4134
- let e = await oe(xi, z, vi);
4130
+ let _i = $.child("seeds"), vi = C.filter((e) => /\.seed\.ts$/.test(e)), bi = vi.length > 0 ? await ae(vi, _i) : [];
4131
+ if (bi.length > 0) {
4132
+ _i.info("discovered seeds", { ids: bi.map((e) => e.definition.id) });
4133
+ for (let e of bi) ut.registerSeed(e);
4134
+ let e = await oe(bi, B, _i);
4135
4135
  for (let t of e) ut.recordSeedResult(t);
4136
4136
  let t = e.filter((e) => e.status === "failed");
4137
- t.length > 0 && vi.warn("one or more seeds failed (server continues)", { failedIds: t.map((e) => e.seedId) });
4137
+ t.length > 0 && _i.warn("one or more seeds failed (server continues)", { failedIds: t.map((e) => e.seedId) });
4138
4138
  }
4139
- let Si = $.child("startup"), Ci = C.filter((e) => ze.test(e)), wi = Ci.length > 0 ? await lt(Ci, Si) : [], Ti;
4140
- wi.length > 0 && (Si.info("discovered startups", { ids: wi.map((e) => e.id) }), Ti = await ct(wi, z, Si)), Ti && process.on("beforeExit", () => {
4141
- Ti.shutdown();
4139
+ let xi = $.child("startup"), Si = C.filter((e) => ze.test(e)), Ci = Si.length > 0 ? await lt(Si, xi) : [], wi;
4140
+ Ci.length > 0 && (xi.info("discovered startups", { ids: Ci.map((e) => e.id) }), wi = await ct(Ci, B, xi)), wi && process.on("beforeExit", () => {
4141
+ wi.shutdown();
4142
4142
  });
4143
- let Di = $.child("subscribe"), Ai = C.filter((e) => Ae.test(e)), ji = Ai.length > 0 ? await is(Ai, Di) : [], Mi;
4144
- ji.length > 0 && (Di.info("discovered subscribers", { subscribers: ji.map((e) => `${e.id}@${e.definition.table}`) }), Mi = as(ji, z, Di, gi)), Mi && process.on("beforeExit", () => {
4145
- Mi();
4146
- }), dn(), yr((e) => vn(z, e.subjectId, e.resourceType, e.resourceId));
4147
- let Ni = $.child("outbox"), Gi = C.filter((e) => Fe.test(e)), Ki = Gi.length > 0 ? await ss(Gi, Ni) : [], qi = Ki.length > 0 ? cs({
4148
- handlers: Ki,
4149
- store: z,
4150
- log: Ni
4143
+ let Ei = $.child("subscribe"), ki = C.filter((e) => Ae.test(e)), Ai = ki.length > 0 ? await is(ki, Ei) : [], ji;
4144
+ Ai.length > 0 && (Ei.info("discovered subscribers", { subscribers: Ai.map((e) => `${e.id}@${e.definition.table}`) }), ji = as(Ai, B, Ei, hi)), ji && process.on("beforeExit", () => {
4145
+ ji();
4146
+ }), un(), vr((e) => _n(B, e.subjectId, e.resourceType, e.resourceId));
4147
+ let Mi = $.child("outbox"), Wi = C.filter((e) => Fe.test(e)), Gi = Wi.length > 0 ? await ss(Wi, Mi) : [], Ki = Gi.length > 0 ? cs({
4148
+ handlers: Gi,
4149
+ store: B,
4150
+ log: Mi
4151
4151
  }) : void 0;
4152
- qi && process.on("beforeExit", () => {
4153
- qi.stop();
4152
+ Ki && process.on("beforeExit", () => {
4153
+ Ki.stop();
4154
4154
  });
4155
- let Ji = ys(), Yi = Zl(F);
4156
- if (gn.length > 0 && Yi !== "memory") try {
4157
- Ji = Cs((await y(Yi)).makeSqlLayer(Gl()));
4155
+ let qi = ys(), Ji = Zl(F);
4156
+ if (hn.length > 0 && Ji !== "memory") try {
4157
+ qi = Cs((await y(Ji)).makeSqlLayer(Gl()));
4158
4158
  } catch (e) {
4159
- fn.warn("aggregate: SQL storage init failed — falling back to in-process", { err: e });
4159
+ dn.warn("aggregate: SQL storage init failed — falling back to in-process", { err: e });
4160
4160
  }
4161
- let aa = Yi === "memory" ? br : xn(z, `aggregate@${process.pid}`, fn), oa = gn.length > 0 ? await Ls({
4162
- discovered: gn,
4163
- store: z,
4164
- analytics: ri,
4165
- storage: Ji,
4166
- coordinator: aa,
4167
- log: fn
4161
+ let ia = Ji === "memory" ? yr : bn(B, `aggregate@${process.pid}`, dn), aa = hn.length > 0 ? await Ls({
4162
+ discovered: hn,
4163
+ store: B,
4164
+ analytics: ni,
4165
+ storage: qi,
4166
+ coordinator: ia,
4167
+ log: dn
4168
4168
  }) : {
4169
4169
  registry: Rs,
4170
4170
  detach: () => {},
4171
4171
  registered: []
4172
4172
  };
4173
- oa.registered.length > 0 && fn.info("aggregates registered", {
4174
- names: oa.registered,
4175
- storage: Yi === "memory" ? "in-process" : "sql-backed",
4176
- coordination: aa.kind
4173
+ aa.registered.length > 0 && dn.info("aggregates registered", {
4174
+ names: aa.registered,
4175
+ storage: Ji === "memory" ? "in-process" : "sql-backed",
4176
+ coordination: ia.kind
4177
4177
  }), process.on("beforeExit", () => {
4178
- oa.detach();
4178
+ aa.detach();
4179
4179
  });
4180
- let H = Zl(F), sa, da = F?.scheduling ?? {}, fa = da.trigger ?? "self", pa = da.coordination ?? ([
4180
+ let U = Zl(F), oa, ua = F?.scheduling ?? {}, da = ua.trigger ?? "self", fa = ua.coordination ?? ([
4181
4181
  "postgres",
4182
4182
  "mariadb",
4183
4183
  "mysql",
4184
4184
  "mssql"
4185
- ].includes(H) ? "advisoryLock" : "single"), ma = pa === "cluster" && (/* @__PURE__ */ new Set([
4185
+ ].includes(U) ? "advisoryLock" : "single"), pa = fa === "cluster" && (/* @__PURE__ */ new Set([
4186
4186
  "postgres",
4187
4187
  "mysql",
4188
4188
  "mariadb",
4189
4189
  "mssql"
4190
- ])).has(H), ha = ma ? M.filter((e) => (e.trigger ?? fa) === "self").map((e) => Hr({
4190
+ ])).has(U), ma = pa ? M.filter((e) => (e.trigger ?? da) === "self").map((e) => Vr({
4191
4191
  name: e.name,
4192
- cron: $t(e),
4192
+ cron: Qt(e),
4193
4193
  execute: async () => {
4194
- await sa?.fireFromCluster(e.name);
4194
+ await oa?.fireFromCluster(e.name);
4195
4195
  }
4196
- })) : [], ba = await (async () => {
4197
- if (H === "memory") return jr.layerMemory;
4198
- let e = await y(H), t = e.makeSqlLayer(Gl()), n = Gr({ sqliteFamily: ni(e.id) });
4199
- if ($.info(`workflow engine: cluster-${n}, dialect=${e.id}` + (n === "memory" ? " — single-process durable replay, no horizontal scaling" + (ni(e.id) ? "" : " (VOLTRO_WORKFLOW_RUNNER_STORAGE=memory: SqlRunnerStorage/cluster_runners + GET_LOCK skipped)") : "")), e.id === "mssql") {
4196
+ })) : [], ya = await (async () => {
4197
+ if (U === "memory") return Ar.layerMemory;
4198
+ let e = await y(U), t = e.makeSqlLayer(Gl()), n = Wr({ sqliteFamily: ti(e.id) });
4199
+ if ($.info(`workflow engine: cluster-${n}, dialect=${e.id}` + (n === "memory" ? " — single-process durable replay, no horizontal scaling" + (ti(e.id) ? "" : " (VOLTRO_WORKFLOW_RUNNER_STORAGE=memory: SqlRunnerStorage/cluster_runners + GET_LOCK skipped)") : "")), e.id === "mssql") {
4200
4200
  let e = await es(process.cwd());
4201
4201
  e && $.warn(e);
4202
4202
  }
4203
- return Kr({
4203
+ return Gr({
4204
4204
  sqlClientLayer: t,
4205
4205
  runnerStorage: n,
4206
4206
  dialectId: e.id,
4207
4207
  ...process.env.VOLTRO_WORKFLOW_RUNNER_PORT ? { runnerListenPort: Number(process.env.VOLTRO_WORKFLOW_RUNNER_PORT) } : {},
4208
- ...ha.length > 0 ? { extraShardingLayers: ha } : {}
4208
+ ...ma.length > 0 ? { extraShardingLayers: ma } : {}
4209
4209
  });
4210
4210
  })();
4211
- $.info("workflow engine selected", { engine: H === "postgres" ? "cluster-postgres" : "in-memory" });
4212
- let Sa, wa = /* @__PURE__ */ new Map(), Ta = () => `wfctx_${globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`}`, Da = async (e, t, n) => {
4211
+ $.info("workflow engine selected", { engine: U === "postgres" ? "cluster-postgres" : "in-memory" });
4212
+ let xa, Ca = /* @__PURE__ */ new Map(), wa = () => `wfctx_${globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`}`, Ea = async (e, t, n) => {
4213
4213
  let r = {
4214
4214
  ...n,
4215
4215
  source: n.source ?? `workflow:${e}`
4216
4216
  };
4217
- wa.set(t, r);
4217
+ Ca.set(t, r);
4218
4218
  try {
4219
- let n = await z.query({
4219
+ let n = await B.query({
4220
4220
  table: "_voltro_workflow_start_contexts",
4221
4221
  order: [],
4222
- predicate: V("executionId", t),
4222
+ predicate: H("executionId", t),
4223
4223
  projection: ["id"],
4224
4224
  skip: void 0,
4225
4225
  take: 1
@@ -4233,10 +4233,10 @@ ${a.join("\n\n")}\n`);
4233
4233
  parentClosePolicy: r.parentClosePolicy ?? null,
4234
4234
  createdAt: /* @__PURE__ */ new Date()
4235
4235
  };
4236
- n[0] === void 0 ? await z.insert("_voltro_workflow_start_contexts", {
4237
- id: Ta(),
4236
+ n[0] === void 0 ? await B.insert("_voltro_workflow_start_contexts", {
4237
+ id: wa(),
4238
4238
  ...i
4239
- }) : await z.update("_voltro_workflow_start_contexts", n[0].id, i);
4239
+ }) : await B.update("_voltro_workflow_start_contexts", n[0].id, i);
4240
4240
  } catch (n) {
4241
4241
  $.warn("workflow.startContext.persist failed", {
4242
4242
  workflowName: e,
@@ -4244,14 +4244,14 @@ ${a.join("\n\n")}\n`);
4244
4244
  reason: n?.message ?? String(n)
4245
4245
  });
4246
4246
  }
4247
- }, Oa = async (e, t) => {
4248
- let n = wa.get(t);
4247
+ }, Da = async (e, t) => {
4248
+ let n = Ca.get(t);
4249
4249
  if (n !== void 0) return n;
4250
4250
  try {
4251
- let e = (await z.query({
4251
+ let e = (await B.query({
4252
4252
  table: "_voltro_workflow_start_contexts",
4253
4253
  order: [],
4254
- predicate: V("executionId", t),
4254
+ predicate: H("executionId", t),
4255
4255
  projection: void 0,
4256
4256
  skip: void 0,
4257
4257
  take: 1
@@ -4270,7 +4270,7 @@ ${a.join("\n\n")}\n`);
4270
4270
  ...e.parentExecutionId === null ? {} : { parentExecutionId: e.parentExecutionId },
4271
4271
  ...e.parentClosePolicy === null ? {} : { parentClosePolicy: e.parentClosePolicy }
4272
4272
  };
4273
- return wa.set(t, r), r;
4273
+ return Ca.set(t, r), r;
4274
4274
  } catch (e) {
4275
4275
  $.warn("workflow.startContext.resolve failed", {
4276
4276
  executionId: t,
@@ -4278,26 +4278,26 @@ ${a.join("\n\n")}\n`);
4278
4278
  });
4279
4279
  return;
4280
4280
  }
4281
- }, U = j.length > 0 ? In(() => Sa) : void 0, ka = $.child("webhooks"), Aa = C.filter((e) => Oe.test(e)), W = Aa.length > 0 ? await tc(Aa, ka) : {
4281
+ }, W = j.length > 0 ? Fn(() => xa) : void 0, Oa = $.child("webhooks"), ka = C.filter((e) => Oe.test(e)), G = ka.length > 0 ? await tc(ka, Oa) : {
4282
4282
  outgoing: [],
4283
4283
  incoming: [],
4284
4284
  providers: []
4285
4285
  };
4286
- W.outgoing.length + W.incoming.length + W.providers.length > 0 && ka.info("discovered webhooks", {
4287
- outgoing: W.outgoing.map((e) => e.descriptor.id),
4288
- incoming: W.incoming.map((e) => e.descriptor.id),
4289
- providers: W.providers.map((e) => e.descriptor.id)
4286
+ G.outgoing.length + G.incoming.length + G.providers.length > 0 && Oa.info("discovered webhooks", {
4287
+ outgoing: G.outgoing.map((e) => e.descriptor.id),
4288
+ incoming: G.incoming.map((e) => e.descriptor.id),
4289
+ providers: G.providers.map((e) => e.descriptor.id)
4290
4290
  });
4291
- let Ma = C.filter((e) => nc.test(e));
4292
- if (Ma.length > 0) {
4293
- let e = $.child("mail"), t = await rc(Ma, e);
4294
- t.templates.length > 0 && (Ca(t.templates.map((e) => e.template)), e.info("discovered email templates", { templates: t.templates.map((e) => e.template.name) }));
4291
+ let ja = C.filter((e) => nc.test(e));
4292
+ if (ja.length > 0) {
4293
+ let e = $.child("mail"), t = await rc(ja, e);
4294
+ t.templates.length > 0 && (Sa(t.templates.map((e) => e.template)), e.info("discovered email templates", { templates: t.templates.map((e) => e.template.name) }));
4295
4295
  }
4296
- let Na = /* @__PURE__ */ new Map();
4297
- for (let e of W.incoming) {
4298
- let t = e.descriptor.path ?? va(e.descriptor.id), n = `VOLTRO_WEBHOOK_SECRET_${e.descriptor.id.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, r = xa(e.descriptor, {
4296
+ let Ma = /* @__PURE__ */ new Map();
4297
+ for (let e of G.incoming) {
4298
+ let t = e.descriptor.path ?? _a(e.descriptor.id), n = `VOLTRO_WEBHOOK_SECRET_${e.descriptor.id.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, r = ba(e.descriptor, {
4299
4299
  resolveSecret: async () => process.env[n] ?? null,
4300
- resolveWorkflows: () => U === void 0 ? void 0 : Xn(U, {
4300
+ resolveWorkflows: () => W === void 0 ? void 0 : Yn(W, {
4301
4301
  traceId: `incoming:${e.descriptor.id}`,
4302
4302
  source: `incoming:${e.descriptor.id}`
4303
4303
  }),
@@ -4309,25 +4309,25 @@ ${a.join("\n\n")}\n`);
4309
4309
  idempotency: e.idempotency,
4310
4310
  durationMs: e.durationMs
4311
4311
  };
4312
- e.status >= 500 ? ka.error("incoming delivery failed", t) : e.status >= 400 ? ka.warn("incoming delivery rejected", t) : ka.info("incoming delivery handled", t);
4312
+ e.status >= 500 ? Oa.error("incoming delivery failed", t) : e.status >= 400 ? Oa.warn("incoming delivery rejected", t) : Oa.info("incoming delivery handled", t);
4313
4313
  }
4314
4314
  });
4315
- Na.set(t, r), ka.info("mounted incoming webhook", {
4315
+ Ma.set(t, r), Oa.info("mounted incoming webhook", {
4316
4316
  id: e.descriptor.id,
4317
4317
  path: t,
4318
4318
  secretEnvKey: n
4319
4319
  });
4320
4320
  }
4321
- let Pa = $.child("reaction"), Fa = C.filter((e) => Ie.test(e)), La = Fa.length > 0 ? await hs(Fa, Pa) : [], Ra;
4322
- La.length > 0 && (Pa.info("discovered reactions", { reactions: La.map((e) => `${e.definition.name}@${e.definition.watch.table}`) }), Ra = _s(La, z, {
4321
+ let Na = $.child("reaction"), Pa = C.filter((e) => Ie.test(e)), Ia = Pa.length > 0 ? await hs(Pa, Na) : [], La;
4322
+ Ia.length > 0 && (Na.info("discovered reactions", { reactions: Ia.map((e) => `${e.definition.name}@${e.definition.watch.table}`) }), La = _s(Ia, B, {
4323
4323
  runAct: async (e, t) => {
4324
4324
  if (e.kind === "workflow") {
4325
- if (U === void 0) {
4326
- Pa.warn("reaction workflow act skipped — no workflow engine in this app", { workflow: e.workflow });
4325
+ if (W === void 0) {
4326
+ Na.warn("reaction workflow act skipped — no workflow engine in this app", { workflow: e.workflow });
4327
4327
  return;
4328
4328
  }
4329
4329
  let n = t.new ?? t.old ?? {};
4330
- await Xn(U, {
4330
+ await Yn(W, {
4331
4331
  traceId: `reaction:${e.workflow}`,
4332
4332
  source: `reaction:${e.workflow}`
4333
4333
  }).start(e.workflow, n);
@@ -4336,37 +4336,37 @@ ${a.join("\n\n")}\n`);
4336
4336
  await gs(e.agent, t, {
4337
4337
  findAgentSend: (e) => A.find((t) => t.descriptor.name === `${e}.send`),
4338
4338
  runAction: (e, t, n) => Promise.resolve(Po(e, t, n)),
4339
- makeSubject: (e) => _i(e),
4339
+ makeSubject: (e) => gi(e),
4340
4340
  now: () => Date.now(),
4341
- log: Pa
4341
+ log: Na
4342
4342
  });
4343
4343
  },
4344
4344
  checkBudget: async (e, t) => {
4345
4345
  try {
4346
4346
  let { requireAiBudget: n } = await import("@voltro/ai");
4347
- return (await N.runPromise(N.either(n(z, {
4347
+ return (await N.runPromise(N.either(n(B, {
4348
4348
  tenantId: e,
4349
4349
  limitUsd: t
4350
4350
  }))))._tag === "Right";
4351
4351
  } catch (t) {
4352
- return Pa.warn("reaction budget check failed — refusing the act", { tenantId: e }, t), !1;
4352
+ return Na.warn("reaction budget check failed — refusing the act", { tenantId: e }, t), !1;
4353
4353
  }
4354
4354
  }
4355
- }, Pa)), Ra && process.on("beforeExit", () => {
4356
- Ra();
4355
+ }, Na)), La && process.on("beforeExit", () => {
4356
+ La();
4357
4357
  });
4358
- let Va = 0, G = new It({
4359
- store: z,
4360
- cache: xr,
4358
+ let Ba = 0, K = new Ft({
4359
+ store: B,
4360
+ cache: br,
4361
4361
  recordDelivery: (e) => {
4362
- rr({
4362
+ nr({
4363
4363
  label: e.label,
4364
4364
  kind: e.kind,
4365
4365
  durationMs: e.durationMs,
4366
4366
  rowCount: e.rowCount
4367
- }), Kn({
4367
+ }), Gn({
4368
4368
  traceId: e.traceId,
4369
- spanId: (Va++).toString(16).padStart(16, "0"),
4369
+ spanId: (Ba++).toString(16).padStart(16, "0"),
4370
4370
  parentSpanId: e.parentSpanId ?? null,
4371
4371
  name: `${e.label}.${e.kind}`,
4372
4372
  kind: "internal",
@@ -4380,10 +4380,10 @@ ${a.join("\n\n")}\n`);
4380
4380
  status: "ok"
4381
4381
  });
4382
4382
  }
4383
- }), Ha = () => {
4384
- let e = G.subscriptionSnapshot(), t = G.matcherStats(), n = e.map((e) => {
4383
+ }), Va = () => {
4384
+ let e = K.subscriptionSnapshot(), t = K.matcherStats(), n = e.map((e) => {
4385
4385
  let t = [];
4386
- for (let n of ui(e.predicate)) n.conjunctive && t.push(n.column);
4386
+ for (let n of li(e.predicate)) n.conjunctive && t.push(n.column);
4387
4387
  return {
4388
4388
  fingerprint: e.fingerprint,
4389
4389
  table: e.table,
@@ -4399,28 +4399,28 @@ ${a.join("\n\n")}\n`);
4399
4399
  capturedAt: Date.now()
4400
4400
  });
4401
4401
  };
4402
- G.onSubscriptionsChange(Ha), Ha();
4403
- let Za = $.child("store"), $a = (F?.plugins ?? []).filter((e) => typeof e.onChangeEvent == "function"), eo = z.changeScope ?? "local";
4404
- z.onChange((e) => {
4405
- if (Za.debug(`${e.op} on ${e.table}`, {
4402
+ K.onSubscriptionsChange(Va), Va();
4403
+ let Xa = $.child("store"), Qa = (F?.plugins ?? []).filter((e) => typeof e.onChangeEvent == "function"), $a = B.changeScope ?? "local";
4404
+ B.onChange((e) => {
4405
+ if (Xa.debug(`${e.op} on ${e.table}`, {
4406
4406
  op: e.op,
4407
4407
  table: e.table
4408
- }), ir({
4408
+ }), rr({
4409
4409
  table: e.table,
4410
4410
  op: e.op,
4411
4411
  old: e.old ?? null,
4412
4412
  new: e.new ?? null
4413
- }), N.runFork(gr.publish(e.table)), $a.length > 0) {
4413
+ }), N.runFork(hr.publish(e.table)), Qa.length > 0) {
4414
4414
  let t = {
4415
4415
  table: e.table,
4416
4416
  op: e.op,
4417
4417
  new: e.new ?? null,
4418
4418
  old: e.old ?? null,
4419
4419
  ...e.origin === void 0 ? {} : { origin: e.origin },
4420
- changeScope: eo
4420
+ changeScope: $a
4421
4421
  };
4422
- for (let n of $a) {
4423
- let r = Za.child(`plugin:${n.name}`);
4422
+ for (let n of Qa) {
4423
+ let r = Xa.child(`plugin:${n.name}`);
4424
4424
  N.runFork(n.onChangeEvent(t).pipe(N.catchAllCause((t) => N.sync(() => r.warn("onChangeEvent failed", {
4425
4425
  table: e.table,
4426
4426
  op: e.op
@@ -4428,98 +4428,98 @@ ${a.join("\n\n")}\n`);
4428
4428
  }
4429
4429
  }
4430
4430
  });
4431
- let to = j.map((e) => kr.make(e.definition.name, {
4431
+ let eo = j.map((e) => Or.make(e.definition.name, {
4432
4432
  payload: e.definition.payloadSchema,
4433
- success: mi,
4433
+ success: pi,
4434
4434
  error: e.definition.errorSchema
4435
- })), no = xt ? [
4436
- Oi(zi),
4437
- Oi(Vi),
4438
- Oi(Bi),
4439
- Oi(Ri),
4440
- Oi(Fi),
4441
- Oi(Ii),
4442
- hi(Pi),
4443
- hi(Li),
4444
- hi(Hi),
4445
- hi(Ui)
4446
- ] : [], ro = (F?.plugins ?? []).flatMap((e) => (e.errorSchemas ?? []).map((e) => e.schema)), io = ro.length > 0 ? ro : void 0, ao = [
4447
- ...w.map((e) => Oi(e.descriptor, io)),
4448
- ...D.map((e) => Ei(e.descriptor, io)),
4449
- ...A.map((e) => hi(e.descriptor, io)),
4450
- ...dt.map((e) => ki(e.descriptor, io)),
4451
- ...to,
4452
- ...no
4453
- ], oo = Ar.make(...ao).middleware(di).middleware(fi), so = F?.layers ?? [], co = (F?.plugins ?? []).map((e) => e.services).filter((e) => e !== void 0), lo = P.succeed(Nt, oa.registry), uo = P.mergeAll(Xa({
4454
- analyticsLayer: Yr.layer,
4455
- cacheService: hr,
4456
- kvService: Mr,
4457
- pluginServices: co,
4458
- userLayers: so
4459
- }), lo);
4460
- (so.length > 0 || co.length > 0) && $.info("layers loaded", {
4461
- userLayers: so.length,
4462
- pluginLayers: co.length
4435
+ })), to = xt ? [
4436
+ Di(Ri),
4437
+ Di(Bi),
4438
+ Di(zi),
4439
+ Di(Li),
4440
+ Di(Pi),
4441
+ Di(Fi),
4442
+ mi(Ni),
4443
+ mi(Ii),
4444
+ mi(Vi),
4445
+ mi(Hi)
4446
+ ] : [], no = (F?.plugins ?? []).flatMap((e) => (e.errorSchemas ?? []).map((e) => e.schema)), ro = no.length > 0 ? no : void 0, io = [
4447
+ ...w.map((e) => Di(e.descriptor, ro)),
4448
+ ...D.map((e) => Ti(e.descriptor, ro)),
4449
+ ...A.map((e) => mi(e.descriptor, ro)),
4450
+ ...dt.map((e) => Oi(e.descriptor, ro)),
4451
+ ...eo,
4452
+ ...to
4453
+ ], ao = kr.make(...io).middleware(ui).middleware(di), oo = F?.layers ?? [], so = (F?.plugins ?? []).map((e) => e.services).filter((e) => e !== void 0), co = P.succeed(Mt, aa.registry), lo = P.mergeAll(Ya({
4454
+ analyticsLayer: Jr.layer,
4455
+ cacheService: mr,
4456
+ kvService: jr,
4457
+ pluginServices: so,
4458
+ userLayers: oo
4459
+ }), co);
4460
+ (oo.length > 0 || so.length > 0) && $.info("layers loaded", {
4461
+ userLayers: oo.length,
4462
+ pluginLayers: so.length
4463
4463
  });
4464
- let fo = (e, t) => fr(e.pipe(N.provide(Pn(t)), N.provide(uo), N.provide(wt)));
4464
+ let uo = (e, t) => dr(e.pipe(N.provide(Nn(t)), N.provide(lo), N.provide(wt)));
4465
4465
  if ((process.env.VOLTRO_INDEX_AUDIT ?? "on") !== "off") {
4466
- let e = Qr(R), t = process.stdout.isTTY === !0 && (process.env.NO_COLOR ?? "") === "";
4467
- for (let n of e) $.warn("\n" + ti(n, {
4466
+ let e = Zr(z), t = process.stdout.isTTY === !0 && (process.env.NO_COLOR ?? "") === "";
4467
+ for (let n of e) $.warn("\n" + ei(n, {
4468
4468
  color: t,
4469
4469
  indent: " "
4470
4470
  }));
4471
4471
  }
4472
- let K;
4473
- if (W.outgoing.length > 0) {
4474
- let e = Ka({
4475
- store: z,
4476
- schemaRegistry: gi,
4477
- cache: wr,
4478
- kv: Or
4479
- }), t = W.outgoing.map((e) => e.descriptor);
4480
- K = _a(e, async (n) => {
4481
- let r = ya.execute(n).pipe(N.provide(ya.toLayer(ga(e, { events: t })).pipe(P.provideMerge(ba))));
4472
+ let q;
4473
+ if (G.outgoing.length > 0) {
4474
+ let e = Ga({
4475
+ store: B,
4476
+ schemaRegistry: hi,
4477
+ cache: Cr,
4478
+ kv: Dr
4479
+ }), t = G.outgoing.map((e) => e.descriptor);
4480
+ q = ga(e, async (n) => {
4481
+ let r = va.execute(n).pipe(N.provide(va.toLayer(ha(e, { events: t })).pipe(P.provideMerge(ya))));
4482
4482
  N.runPromise(r).catch((e) => {
4483
- ka.error("deliverWebhook workflow crashed", {
4483
+ Oa.error("deliverWebhook workflow crashed", {
4484
4484
  deliveryId: n.deliveryId,
4485
4485
  targetId: n.targetId
4486
4486
  }, e);
4487
4487
  });
4488
4488
  }, { events: t });
4489
4489
  }
4490
- let po = (process.env.VOLTRO_TENANT_ISOLATION ?? F?.tenancy?.isolation) === "namespace";
4491
- po && $.info("multi-tenancy: PHYSICAL namespace isolation ON — each request runs against its tenant's own namespace (schema/database/attached file). Requests without a resolvable tenant fail closed.");
4492
- let mo = qa({
4493
- store: z,
4494
- schemaRegistry: gi,
4495
- cache: wr,
4496
- kv: Or,
4497
- ...K === void 0 ? {} : { webhooksService: K },
4498
- ...U === void 0 ? {} : { workflowsProxy: U },
4490
+ let fo = (process.env.VOLTRO_TENANT_ISOLATION ?? F?.tenancy?.isolation) === "namespace";
4491
+ fo && $.info("multi-tenancy: PHYSICAL namespace isolation ON — each request runs against its tenant's own namespace (schema/database/attached file). Requests without a resolvable tenant fail closed.");
4492
+ let po = Ka({
4493
+ store: B,
4494
+ schemaRegistry: hi,
4495
+ cache: Cr,
4496
+ kv: Dr,
4497
+ ...q === void 0 ? {} : { webhooksService: q },
4498
+ ...W === void 0 ? {} : { workflowsProxy: W },
4499
4499
  eventTriggers: mt,
4500
- namespaceIsolationOn: po,
4500
+ namespaceIsolationOn: fo,
4501
4501
  onEventEmit: (e, t) => S.emit(e, t),
4502
- ...qi === void 0 ? {} : { outbox: { nudge: qi.nudge } },
4503
- ...er.active ? { connections: { registry: er.registry } } : {}
4504
- }), ho = async () => {
4502
+ ...Ki === void 0 ? {} : { outbox: { nudge: Ki.nudge } },
4503
+ ...$n.active ? { connections: { registry: $n.registry } } : {}
4504
+ }), mo = async () => {
4505
4505
  if (M.length === 0) return;
4506
4506
  let e = process.env.HOSTNAME ?? `pid-${process.pid}`, t;
4507
- ma ? t = br : pa === "cluster" ? ($.warn("scheduling.coordination=cluster needs store=postgres — falling back to single (dev/memory)"), t = br) : pa === "advisoryLock" ? H === "memory" ? ($.warn("scheduling.coordination=advisoryLock needs a SQL store (the claim-row gate) — falling back to single (memory)"), t = br) : t = xn(z, e, {
4507
+ pa ? t = yr : fa === "cluster" ? ($.warn("scheduling.coordination=cluster needs store=postgres — falling back to single (dev/memory)"), t = yr) : fa === "advisoryLock" ? U === "memory" ? ($.warn("scheduling.coordination=advisoryLock needs a SQL store (the claim-row gate) — falling back to single (memory)"), t = yr) : t = bn(B, e, {
4508
4508
  info: (e, t) => $.info(e, t ?? {}),
4509
4509
  warn: (e, t) => $.warn(e, t ?? {})
4510
- }) : t = br;
4511
- let n = Ac(F?.plugins ?? [], J);
4512
- sa = await Cr(M, {
4513
- store: z,
4510
+ }) : t = yr;
4511
+ let n = Ac(F?.plugins ?? [], Oo);
4512
+ oa = await Sr(M, {
4513
+ store: B,
4514
4514
  coordinator: t,
4515
- defaultTrigger: fa,
4515
+ defaultTrigger: da,
4516
4516
  replicaId: e,
4517
- armSelf: !ma,
4517
+ armSelf: !pa,
4518
4518
  dormancy: F?.dormancy ?? "always-on",
4519
- buildContext: ({ traceId: e, scheduleName: t, subject: n }) => mo({
4519
+ buildContext: ({ traceId: e, scheduleName: t, subject: n }) => po({
4520
4520
  subject: n,
4521
4521
  traceId: e
4522
- }, z, void 0, `schedule:${t}`),
4522
+ }, B, void 0, `schedule:${t}`),
4523
4523
  log: {
4524
4524
  info: (e, t) => $.info(e, t ?? {}),
4525
4525
  warn: (e, t) => $.warn(e, t ?? {}),
@@ -4533,45 +4533,45 @@ ${a.join("\n\n")}\n`);
4533
4533
  ...n === void 0 ? {} : { interceptFire: n }
4534
4534
  }), $.info("scheduler ready", {
4535
4535
  schedules: M.length,
4536
- coordination: ma ? "cluster" : t.kind,
4537
- clusterCrons: ha.length
4536
+ coordination: pa ? "cluster" : t.kind,
4537
+ clusterCrons: ma.length
4538
4538
  }), process.on("beforeExit", () => {
4539
- sa?.shutdown();
4539
+ oa?.shutdown();
4540
4540
  });
4541
- }, q = {}, go = /* @__PURE__ */ new Set(), _o = (e, t) => {
4542
- pn(e, yt, t) && (go.has(e.table) || (go.add(e.table), $.warn("tenant-scoped read with an EMPTY tenant — every row is filtered out", {
4541
+ }, J = {}, ho = /* @__PURE__ */ new Set(), go = (e, t) => {
4542
+ fn(e, yt, t) && (ho.has(e.table) || (ho.add(e.table), $.warn("tenant-scoped read with an EMPTY tenant — every row is filtered out", {
4543
4543
  table: e.table,
4544
4544
  tenantId: "",
4545
4545
  cause: "the subject authenticated but has no resolved org (tenantId=''), so the auto-merged `eq('tenantId', '')` matches no real row — this is NOT 'no such row'",
4546
4546
  fix: "resolve the subject to an active org before the read, or mark the query `.unscoped()` if it is deliberately cross-tenant"
4547
4547
  })));
4548
- }, vo = !1, yo = (e) => {
4549
- vo || !mn(e) || (vo = !0, $.warn("authenticated subject has NO active org (tenantId='') — every tenant-scoped read will be empty", {
4548
+ }, _o = !1, vo = (e) => {
4549
+ _o || !pn(e) || (_o = !0, $.warn("authenticated subject has NO active org (tenantId='') — every tenant-scoped read will be empty", {
4550
4550
  subjectType: "user",
4551
4551
  cause: "the session resolved a user but no organization/tenant; the empty-string sentinel fails closed",
4552
4552
  fix: "resolve the user to an active org during auth, or route org-less users to an onboarding flow"
4553
4553
  }));
4554
- }, bo = (e, t) => (yo(t.subject), _o(e, t.subject.tenantId), Ht(Ut(e, yt, t.subject.tenantId), bt)), xo = /* @__PURE__ */ new Set(), To = (e) => {
4554
+ }, yo = (e, t) => (vo(t.subject), go(e, t.subject.tenantId), Vt(Ht(e, yt, t.subject.tenantId), bt)), bo = /* @__PURE__ */ new Set(), wo = (e) => {
4555
4555
  if (e.usingIndex !== void 0 || e.predicate === void 0) return;
4556
4556
  let t = /* @__PURE__ */ new Set();
4557
- for (let n of ui(e.predicate)) n.conjunctive && t.add(n.column);
4558
- if (t.size === 0 || gi.anyFieldIndexed(e.table, t)) return;
4557
+ for (let n of li(e.predicate)) n.conjunctive && t.add(n.column);
4558
+ if (t.size === 0 || hi.anyFieldIndexed(e.table, t)) return;
4559
4559
  let n = `${e.table}::${[...t].sort().join(",")}`;
4560
- xo.has(n) || (xo.add(n), $.warn("non-indexed predicate — slow at scale", {
4560
+ bo.has(n) || (bo.add(n), $.warn("non-indexed predicate — slow at scale", {
4561
4561
  table: e.table,
4562
4562
  fields: [...t],
4563
4563
  hint: "declare `.index()` on a column, add `.index(name, [...fields])` to the table, or annotate the query with `.using('indexName')` if a covering index exists"
4564
4564
  }));
4565
- }, Eo = (e) => {
4565
+ }, To = (e) => {
4566
4566
  if (e.usingIndex === void 0) return;
4567
- let t = gi.tables.get(e.table);
4567
+ let t = hi.tables.get(e.table);
4568
4568
  if (!t) return;
4569
4569
  let n = t.compositeIndexes.find((t) => t.name === e.usingIndex);
4570
4570
  if (n) return {
4571
4571
  name: n.name,
4572
4572
  fields: n.fields
4573
4573
  };
4574
- }, Do = (e) => JSON.stringify(e, (e, t) => typeof t == "object" && t && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e.localeCompare(t))) : t), Oo = (e, t) => {
4574
+ }, Eo = (e) => JSON.stringify(e, (e, t) => typeof t == "object" && t && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e.localeCompare(t))) : t), Do = (e, t) => {
4575
4575
  let n = e.cache;
4576
4576
  if (n === void 0) return;
4577
4577
  let r = d(n.ttl);
@@ -4579,54 +4579,54 @@ ${a.join("\n\n")}\n`);
4579
4579
  ttlMs: r,
4580
4580
  swrMs: n.swr === void 0 ? void 0 : d(n.swr) ?? void 0,
4581
4581
  scope: n.scope,
4582
- baseKey: `q:${e.name}:${Do(t)}`
4582
+ baseKey: `q:${e.name}:${Eo(t)}`
4583
4583
  };
4584
- }, J = ne(), ko = F?.plugins ?? [], Ao = bi(Cc(ko, "mutation", J)), jo = bi(Cc(ko, "action", J)), Mo = bi(Cc(ko, "query", J)), No = Rn({
4585
- store: z,
4586
- buildContext: (e, t, n) => mo(e, t, n),
4587
- runEffect: (e, t) => fo(e, t),
4584
+ }, Oo = ne(), ko = F?.plugins ?? [], Ao = yi(Cc(ko, "mutation", Oo)), jo = yi(Cc(ko, "action", Oo)), Mo = yi(Cc(ko, "query", Oo)), No = Ln({
4585
+ store: B,
4586
+ buildContext: (e, t, n) => po(e, t, n),
4587
+ runEffect: (e, t) => uo(e, t),
4588
4588
  ...Ao ? { interceptor: Ao } : {},
4589
- recordMetric: (e) => J.record(e),
4589
+ recordMetric: (e) => Oo.record(e),
4590
4590
  undoCapture: cc()
4591
- }), Po = bn({
4592
- buildContext: (e) => mo(e),
4593
- runEffect: (e, t) => fo(e, t),
4591
+ }), Po = yn({
4592
+ buildContext: (e) => po(e),
4593
+ runEffect: (e, t) => uo(e, t),
4594
4594
  ...jo ? { interceptor: jo } : {},
4595
- recordMetric: (e) => J.record(e)
4595
+ recordMetric: (e) => Oo.record(e)
4596
4596
  }), Fo = {
4597
- buildContext: (e) => mo(e),
4597
+ buildContext: (e) => po(e),
4598
4598
  finalize: (e, t) => {
4599
- let n = bo(e, t);
4600
- return To(n), n;
4599
+ let n = yo(e, t);
4600
+ return wo(n), n;
4601
4601
  },
4602
- provideEffect: (e, t) => e.pipe(N.provide(Pn(t)), N.provide(wt)),
4602
+ provideEffect: (e, t) => e.pipe(N.provide(Nn(t)), N.provide(wt)),
4603
4603
  ...Mo ? { interceptor: Mo } : {}
4604
- }, Io = Hn(Fo), Y = zn({
4604
+ }, Io = Vn(Fo), Y = Rn({
4605
4605
  ...Fo,
4606
- queryRows: (e) => z.query(e)
4607
- }), Lo = Wn({
4606
+ queryRows: (e) => B.query(e)
4607
+ }), Lo = Un({
4608
4608
  ...Fo,
4609
- subscribeDescriptor: (e, t, n) => G.subscribe(e, t, n),
4610
- subscribeComputed: (e, t, n) => G.subscribeComputed(e, t, n)
4609
+ subscribeDescriptor: (e, t, n) => K.subscribe(e, t, n),
4610
+ subscribeComputed: (e, t, n) => K.subscribeComputed(e, t, n)
4611
4611
  });
4612
- for (let e of w) q[e.descriptor.name] = (t) => Xt(Io(e, t), G, `subscription.${e.descriptor.name}`, Eo, Oo(e.descriptor, t), Un(e, t));
4612
+ for (let e of w) J[e.descriptor.name] = (t) => Yt(Io(e, t), K, `subscription.${e.descriptor.name}`, To, Do(e.descriptor, t), Hn(e, t));
4613
4613
  for (let e of D) {
4614
4614
  let t = `mutation.${e.descriptor.name}`;
4615
- q[e.descriptor.name] = (n) => Jt(async (t, n) => No(e, t, n), n, t);
4615
+ J[e.descriptor.name] = (n) => qt(async (t, n) => No(e, t, n), n, t);
4616
4616
  }
4617
4617
  for (let e of A) {
4618
4618
  let t = `action.${e.descriptor.name}`;
4619
- q[e.descriptor.name] = (n) => Jt(async (t, n) => Po(e, t, n), n, t);
4619
+ J[e.descriptor.name] = (n) => qt(async (t, n) => Po(e, t, n), n, t);
4620
4620
  }
4621
4621
  for (let e of dt) {
4622
4622
  let t = `stream.${e.descriptor.name}`;
4623
- q[e.descriptor.name] = (n) => Yt((t) => {
4624
- let r = mo(t), i = e.executor(n, r);
4625
- return N.isEffect(i) ? i.pipe(N.provide(Pn(r.store)), N.provide(uo), N.provide(wt)) : typeof i == "object" && i && typeof i.then == "function" ? N.promise(() => i) : i;
4623
+ J[e.descriptor.name] = (n) => Jt((t) => {
4624
+ let r = po(t), i = e.executor(n, r);
4625
+ return N.isEffect(i) ? i.pipe(N.provide(Nn(r.store)), N.provide(lo), N.provide(wt)) : typeof i == "object" && i && typeof i.then == "function" ? N.promise(() => i) : i;
4626
4626
  }, t);
4627
4627
  }
4628
- xt && (q[zi.name] = (e) => Xt(Io({
4629
- descriptor: zi,
4628
+ xt && (J[Ri.name] = (e) => Yt(Io({
4629
+ descriptor: Ri,
4630
4630
  executor: (e) => {
4631
4631
  let t = e.id;
4632
4632
  return {
@@ -4635,30 +4635,30 @@ ${a.join("\n\n")}\n`);
4635
4635
  column: "startedAt",
4636
4636
  direction: "desc"
4637
4637
  }],
4638
- predicate: ii(V("id", t), V("executionId", t)),
4638
+ predicate: ri(H("id", t), H("executionId", t)),
4639
4639
  take: 1,
4640
4640
  skip: void 0,
4641
4641
  projection: void 0
4642
4642
  };
4643
4643
  }
4644
- }, e), G, `subscription.${zi.name}`), q[Vi.name] = (e) => Xt(Io({
4645
- descriptor: Vi,
4644
+ }, e), K, `subscription.${Ri.name}`), J[Bi.name] = (e) => Yt(Io({
4645
+ descriptor: Bi,
4646
4646
  executor: (e) => {
4647
- let t = e, n = [...t.tag === void 0 ? [] : [V("tag", t.tag)], ...t.status === void 0 ? [] : [V("status", t.status)]], r = Number.isFinite(t.limit) && t.limit !== void 0 ? Math.min(Math.max(Math.floor(t.limit), 1), 500) : 100;
4647
+ let t = e, n = [...t.tag === void 0 ? [] : [H("tag", t.tag)], ...t.status === void 0 ? [] : [H("status", t.status)]], r = Number.isFinite(t.limit) && t.limit !== void 0 ? Math.min(Math.max(Math.floor(t.limit), 1), 500) : 100;
4648
4648
  return {
4649
4649
  table: "_voltro_workflow_runs",
4650
4650
  order: [{
4651
4651
  column: "startedAt",
4652
4652
  direction: "desc"
4653
4653
  }],
4654
- predicate: n.length === 0 ? void 0 : n.length === 1 ? n[0] : Zr(...n),
4654
+ predicate: n.length === 0 ? void 0 : n.length === 1 ? n[0] : Xr(...n),
4655
4655
  take: r,
4656
4656
  skip: void 0,
4657
4657
  projection: void 0
4658
4658
  };
4659
4659
  }
4660
- }, e), G, `subscription.${Vi.name}`), q[Bi.name] = (e) => Xt(Io({
4661
- descriptor: Bi,
4660
+ }, e), K, `subscription.${Bi.name}`), J[zi.name] = (e) => Yt(Io({
4661
+ descriptor: zi,
4662
4662
  executor: (e) => {
4663
4663
  let t = e.runId;
4664
4664
  return {
@@ -4667,14 +4667,14 @@ ${a.join("\n\n")}\n`);
4667
4667
  column: "startedAt",
4668
4668
  direction: "asc"
4669
4669
  }],
4670
- predicate: V("runId", t),
4670
+ predicate: H("runId", t),
4671
4671
  take: 1e3,
4672
4672
  skip: void 0,
4673
4673
  projection: void 0
4674
4674
  };
4675
4675
  }
4676
- }, e), G, `subscription.${Bi.name}`), q[Ri.name] = (e) => Xt(Io({
4677
- descriptor: Ri,
4676
+ }, e), K, `subscription.${zi.name}`), J[Li.name] = (e) => Yt(Io({
4677
+ descriptor: Li,
4678
4678
  executor: (e) => {
4679
4679
  let t = e.runId;
4680
4680
  return {
@@ -4683,14 +4683,14 @@ ${a.join("\n\n")}\n`);
4683
4683
  column: "occurredAt",
4684
4684
  direction: "asc"
4685
4685
  }],
4686
- predicate: V("runId", t),
4686
+ predicate: H("runId", t),
4687
4687
  take: 1e3,
4688
4688
  skip: void 0,
4689
4689
  projection: void 0
4690
4690
  };
4691
4691
  }
4692
- }, e), G, `subscription.${Ri.name}`), q[Fi.name] = (e) => Xt(Io({
4693
- descriptor: Fi,
4692
+ }, e), K, `subscription.${Li.name}`), J[Pi.name] = (e) => Yt(Io({
4693
+ descriptor: Pi,
4694
4694
  executor: (e) => {
4695
4695
  let t = e;
4696
4696
  return {
@@ -4699,14 +4699,14 @@ ${a.join("\n\n")}\n`);
4699
4699
  column: "occurredAt",
4700
4700
  direction: "desc"
4701
4701
  }],
4702
- predicate: t.name === void 0 ? void 0 : V("name", t.name),
4702
+ predicate: t.name === void 0 ? void 0 : H("name", t.name),
4703
4703
  take: Math.max(1, Math.min(500, t.limit ?? 100)),
4704
4704
  skip: void 0,
4705
4705
  projection: void 0
4706
4706
  };
4707
4707
  }
4708
- }, e), G, `subscription.${Fi.name}`), q[Ii.name] = (e) => Xt(Io({
4709
- descriptor: Ii,
4708
+ }, e), K, `subscription.${Pi.name}`), J[Fi.name] = (e) => Yt(Io({
4709
+ descriptor: Fi,
4710
4710
  executor: (e) => {
4711
4711
  let t = e.eventId;
4712
4712
  return {
@@ -4715,56 +4715,56 @@ ${a.join("\n\n")}\n`);
4715
4715
  column: "createdAt",
4716
4716
  direction: "asc"
4717
4717
  }],
4718
- predicate: V("eventId", t),
4718
+ predicate: H("eventId", t),
4719
4719
  take: 500,
4720
4720
  skip: void 0,
4721
4721
  projection: void 0
4722
4722
  };
4723
4723
  }
4724
- }, e), G, `subscription.${Ii.name}`), q[Pi.name] = (e) => Jt(async (e, t) => {
4724
+ }, e), K, `subscription.${Fi.name}`), J[Ni.name] = (e) => qt(async (e, t) => {
4725
4725
  let n = e;
4726
- return await Ja(z, t.subject, { executionId: n.executionId }), await U.cancel(n.workflowName, n.executionId), await Jo(n.workflowName, n.executionId, "workflow.cancel"), { ok: !0 };
4727
- }, e, `action.${Pi.name}`), q[Li.name] = (e) => Jt(async (e, t) => {
4726
+ return await qa(B, t.subject, { executionId: n.executionId }), await W.cancel(n.workflowName, n.executionId), await Jo(n.workflowName, n.executionId, "workflow.cancel"), { ok: !0 };
4727
+ }, e, `action.${Ni.name}`), J[Ii.name] = (e) => qt(async (e, t) => {
4728
4728
  let n = e;
4729
- return await Ja(z, t.subject, { executionId: n.executionId }), await U.resume(n.workflowName, n.executionId), { ok: !0 };
4730
- }, e, `action.${Li.name}`), q[Hi.name] = (e) => Jt(async (e, t) => {
4729
+ return await qa(B, t.subject, { executionId: n.executionId }), await W.resume(n.workflowName, n.executionId), { ok: !0 };
4730
+ }, e, `action.${Ii.name}`), J[Vi.name] = (e) => qt(async (e, t) => {
4731
4731
  let n = e;
4732
- return await Ja(z, t.subject, { id: n.id }), U.signal({ id: n.id }, n.signalName, n.payload);
4733
- }, e, `action.${Hi.name}`), q[Ui.name] = (e) => Jt(async (e, t) => {
4732
+ return await qa(B, t.subject, { id: n.id }), W.signal({ id: n.id }, n.signalName, n.payload);
4733
+ }, e, `action.${Vi.name}`), J[Hi.name] = (e) => qt(async (e, t) => {
4734
4734
  let n = e;
4735
- return await Ja(z, t.subject, { id: n.id }), U.update({ id: n.id }, n.updateName, n.payload, n.timeoutMs === void 0 ? void 0 : { timeoutMs: n.timeoutMs });
4736
- }, e, `action.${Ui.name}`));
4737
- for (let e of j) q[e.definition.name] = (t) => Jt(async (t, n) => {
4735
+ return await qa(B, t.subject, { id: n.id }), W.update({ id: n.id }, n.updateName, n.payload, n.timeoutMs === void 0 ? void 0 : { timeoutMs: n.timeoutMs });
4736
+ }, e, `action.${Hi.name}`));
4737
+ for (let e of j) J[e.definition.name] = (t) => qt(async (t, n) => {
4738
4738
  let r = n;
4739
- return Xn(U, {
4739
+ return Yn(W, {
4740
4740
  subject: r.subject,
4741
4741
  traceId: r.traceId,
4742
4742
  source: "workflow-rpc"
4743
4743
  }).start(e.definition.name, t);
4744
4744
  }, t, `workflow.${e.definition.name}`);
4745
- let Ro = (e, t) => mo({
4745
+ let Ro = (e, t) => po({
4746
4746
  subject: e.subject,
4747
4747
  traceId: e.traceId
4748
- }, z, void 0, `workflow:${t.workflowName}`, { parentExecutionId: t.executionId }), zo = Mc(F?.plugins ?? [], J), Bo = Br, Vo = (e, t) => S.emit(e, t), Ko = F?.dormancy === "sleep" ? {
4749
- register: (e, t, n) => cr(z, {
4750
- tenantId: n ?? Ft,
4748
+ }, B, void 0, `workflow:${t.workflowName}`, { parentExecutionId: t.executionId }), zo = Mc(F?.plugins ?? [], Oo), Bo = zr, Vo = (e, t) => S.emit(e, t), Ko = F?.dormancy === "sleep" ? {
4749
+ register: (e, t, n) => sr(B, {
4750
+ tenantId: n ?? Pt,
4751
4751
  kind: "workflow",
4752
4752
  refId: e,
4753
4753
  wakeAt: t
4754
4754
  }),
4755
- cancel: (e, t) => Qt(z, {
4756
- tenantId: t ?? Ft,
4755
+ cancel: (e, t) => Zt(B, {
4756
+ tenantId: t ?? Pt,
4757
4757
  kind: "workflow",
4758
4758
  refId: e
4759
4759
  }).then(() => {})
4760
- } : void 0, X = Lr({
4761
- store: z,
4760
+ } : void 0, X = Ir({
4761
+ store: B,
4762
4762
  emit: Vo,
4763
4763
  log: $,
4764
4764
  ...Ko === void 0 ? {} : { wakeups: Ko }
4765
4765
  }), qo = async (e, t) => {
4766
- await Nr({
4767
- store: z,
4766
+ await Mr({
4767
+ store: B,
4768
4768
  parentExecutionId: e,
4769
4769
  parentStatus: t,
4770
4770
  recorder: X,
@@ -4782,16 +4782,16 @@ ${a.join("\n\n")}\n`);
4782
4782
  }
4783
4783
  });
4784
4784
  }, Jo = async (e, t, n) => {
4785
- let r = (await z.query({
4785
+ let r = (await B.query({
4786
4786
  table: "_voltro_workflow_runs",
4787
4787
  order: [],
4788
- predicate: V("executionId", t),
4788
+ predicate: H("executionId", t),
4789
4789
  projection: void 0,
4790
4790
  skip: void 0,
4791
4791
  take: 1
4792
4792
  }))[0];
4793
4793
  if (r === void 0) return;
4794
- let i = await z.update("_voltro_workflow_runs", r.id, {
4794
+ let i = await B.update("_voltro_workflow_runs", r.id, {
4795
4795
  status: "cancelled",
4796
4796
  cancelled: !0,
4797
4797
  completedAt: /* @__PURE__ */ new Date()
@@ -4812,10 +4812,10 @@ ${a.join("\n\n")}\n`);
4812
4812
  }
4813
4813
  }), i && await qo(t, "cancelled");
4814
4814
  }, Yo = (e, t, n, r) => {
4815
- let i = Fr(t);
4816
- return Vr({
4815
+ let i = Pr(t);
4816
+ return Br({
4817
4817
  name: e,
4818
- store: z,
4818
+ store: B,
4819
4819
  subject: r.subject,
4820
4820
  source: r.source ?? null,
4821
4821
  traceId: r.traceId,
@@ -4830,56 +4830,56 @@ ${a.join("\n\n")}\n`);
4830
4830
  emit: Vo,
4831
4831
  log: $
4832
4832
  }, n);
4833
- }, Xo = [...Zn(j, {
4833
+ }, Xo = [...Xn(j, {
4834
4834
  buildContext: Ro,
4835
- resolveStartContext: Oa
4836
- }, (e, t, n) => Yo(e.definition.name, e.definition, t, n)), ...ft], Zo = Xo.length > 0 ? P.mergeAll(...Xo) : P.empty, Qo = _t.make(Zo.pipe(P.provideMerge(ba), P.provideMerge(uo), P.provideMerge(wt)));
4835
+ resolveStartContext: Da
4836
+ }, (e, t, n) => Yo(e.definition.name, e.definition, t, n)), ...ft], Zo = Xo.length > 0 ? P.mergeAll(...Xo) : P.empty, Qo = _t.make(Zo.pipe(P.provideMerge(ya), P.provideMerge(lo), P.provideMerge(wt)));
4837
4837
  process.on("beforeExit", () => {
4838
4838
  Qo.dispose();
4839
- }), Sa = j.length > 0 ? Yn({
4839
+ }), xa = j.length > 0 ? Jn({
4840
4840
  workflows: j,
4841
4841
  runEffect: (e) => Qo.runPromise(e),
4842
- rememberStartContext: Da,
4842
+ rememberStartContext: Ea,
4843
4843
  signal: async (e, t, n) => {
4844
- let r = await Rr({
4845
- store: z,
4844
+ let r = await Lr({
4845
+ store: B,
4846
4846
  recorder: X,
4847
4847
  target: e,
4848
4848
  signalName: t,
4849
4849
  payload: n
4850
4850
  });
4851
- return await Qo.runPromise(Pr({
4852
- store: z,
4851
+ return await Qo.runPromise(Nr({
4852
+ store: B,
4853
4853
  target: e,
4854
4854
  signalName: t,
4855
4855
  payload: n
4856
4856
  })).catch(() => {}), r;
4857
4857
  },
4858
- update: (e, t, n, r) => zr({
4859
- store: z,
4858
+ update: (e, t, n, r) => Rr({
4859
+ store: B,
4860
4860
  recorder: X,
4861
4861
  target: e,
4862
4862
  updateName: t,
4863
4863
  payload: n,
4864
4864
  ...r === void 0 ? {} : { options: r }
4865
4865
  }),
4866
- listRuns: (e) => Ic(z, e),
4866
+ listRuns: (e) => Ic(B, e),
4867
4867
  retry: (e, t) => Lc({
4868
- store: z,
4868
+ store: B,
4869
4869
  workflows: j,
4870
4870
  runPromise: (e) => Qo.runPromise(e)
4871
4871
  }, e, t)
4872
4872
  }) : void 0;
4873
- let $o = P.mergeAll(oo.toLayer(q), jt, bl), ts = Qa(q, w.map((e) => e.descriptor.name), xt), ns = P.mergeAll(oo.toLayer(ts), jt, bl), rs = H, os = (rs === "postgres" || rs === "mysql" || rs === "mariadb" || rs === "mssql") && (process.env.CDC ?? "1") !== "0";
4873
+ let $o = P.mergeAll(ao.toLayer(J), At, bl), ts = Za(J, w.map((e) => e.descriptor.name), xt), ns = P.mergeAll(ao.toLayer(ts), At, bl), rs = U, os = (rs === "postgres" || rs === "mysql" || rs === "mariadb" || rs === "mssql") && (process.env.CDC ?? "1") !== "0";
4874
4874
  if (rs === "postgres" && me()) {
4875
4875
  let e = be({
4876
- store: z,
4876
+ store: B,
4877
4877
  log: $
4878
4878
  });
4879
- Bn = e.persistTraceSpan, process.on("beforeExit", e.stop);
4879
+ zn = e.persistTraceSpan, process.on("beforeExit", e.stop);
4880
4880
  }
4881
- let ls = Ga({
4882
- store: z,
4881
+ let ls = Wa({
4882
+ store: B,
4883
4883
  dialect: rs
4884
4884
  });
4885
4885
  process.on("beforeExit", () => {
@@ -4899,21 +4899,21 @@ ${a.join("\n\n")}\n`);
4899
4899
  tag: e.definition.name,
4900
4900
  file: k(m, e.file)
4901
4901
  }));
4902
- L.writeFile(O(m, "app.manifest.generated.json"), `${JSON.stringify(tt(us, fs, [], F?.plugins ?? []), null, 2)}\n`, "utf8").catch(() => {}), (async () => {
4902
+ R.writeFile(O(m, "app.manifest.generated.json"), `${JSON.stringify(tt(us, fs, [], F?.plugins ?? []), null, 2)}\n`, "utf8").catch(() => {}), (async () => {
4903
4903
  let e = O(m, ".gitignore"), t = "";
4904
4904
  try {
4905
- t = await L.readFile(e, "utf8");
4905
+ t = await R.readFile(e, "utf8");
4906
4906
  } catch {}
4907
4907
  let n = t.split("\n").filter((e) => e.trim() !== "");
4908
- n.includes("app.manifest.generated.json") || (n.push("app.manifest.generated.json"), await L.writeFile(e, `${n.join("\n")}\n`, "utf8"));
4909
- })().catch(() => {}), an();
4908
+ n.includes("app.manifest.generated.json") || (n.push("app.manifest.generated.json"), await R.writeFile(e, `${n.join("\n")}\n`, "utf8"));
4909
+ })().catch(() => {}), rn();
4910
4910
  let ms = O(m, "app.graph.observed.generated.json");
4911
- L.rm(O(m, "app.graph.observed.json"), { force: !0 }).catch(() => {});
4912
- let Z = Ia(m);
4911
+ R.rm(O(m, "app.graph.observed.json"), { force: !0 }).catch(() => {});
4912
+ let Z = Fa(m);
4913
4913
  Z.warning === void 0 ? Z.adopted.length > 0 && $.debug("handed generated output to the workspace owner", { paths: Z.adopted.join(", ") }) : $.warn(Z.warning);
4914
4914
  let vs = async () => {
4915
4915
  try {
4916
- await L.writeFile(ms, `${JSON.stringify(tr(), null, 2)}\n`, "utf8");
4916
+ await R.writeFile(ms, `${JSON.stringify(er(), null, 2)}\n`, "utf8");
4917
4917
  } catch {}
4918
4918
  };
4919
4919
  setInterval(() => {
@@ -4923,15 +4923,15 @@ ${a.join("\n\n")}\n`);
4923
4923
  }), (async () => {
4924
4924
  let e = O(m, ".gitignore"), t = "";
4925
4925
  try {
4926
- t = await L.readFile(e, "utf8");
4926
+ t = await R.readFile(e, "utf8");
4927
4927
  } catch {}
4928
4928
  let n = t.split("\n").filter((e) => e.trim() !== "");
4929
- n.includes("app.graph.observed.generated.json") || (n.push("app.graph.observed.generated.json"), await L.writeFile(e, `${n.join("\n")}\n`, "utf8"));
4929
+ n.includes("app.graph.observed.generated.json") || (n.push("app.graph.observed.generated.json"), await R.writeFile(e, `${n.join("\n")}\n`, "utf8"));
4930
4930
  })().catch(() => {});
4931
4931
  let bs = /* @__PURE__ */ new Map();
4932
4932
  for (let e of D) bs.set(e.descriptor.name, async (t, n) => {
4933
4933
  let r = {
4934
- subject: await At({
4934
+ subject: await kt({
4935
4935
  headers: n,
4936
4936
  clientId: -1
4937
4937
  }),
@@ -4955,7 +4955,7 @@ ${a.join("\n\n")}\n`);
4955
4955
  });
4956
4956
  for (let e of A) bs.set(e.descriptor.name, async (t, n) => {
4957
4957
  let r = {
4958
- subject: await At({
4958
+ subject: await kt({
4959
4959
  headers: n,
4960
4960
  clientId: -1
4961
4961
  }),
@@ -4978,7 +4978,7 @@ ${a.join("\n\n")}\n`);
4978
4978
  }
4979
4979
  });
4980
4980
  let xs = () => ({
4981
- dialect: H,
4981
+ dialect: U,
4982
4982
  replication: ut.replicationSnapshot() ?? {
4983
4983
  replicaCount: 0,
4984
4984
  rywPolicy: "off",
@@ -5020,9 +5020,9 @@ ${a.join("\n\n")}\n`);
5020
5020
  history: [],
5021
5021
  softDropSnapshots: []
5022
5022
  };
5023
- if (!ci) return e;
5023
+ if (!si) return e;
5024
5024
  let t = N.gen(function* () {
5025
- let e = yield* B.SqlClient, t = yield* e`
5025
+ let e = yield* V.SqlClient, t = yield* e`
5026
5026
  SELECT ${e("id")}, ${e("fingerprint")},
5027
5027
  ${e("appliedAt")}::text AS ${e("appliedAt")},
5028
5028
  ${e("appliedBy")}, ${e("environment")}, ${e("source")},
@@ -5031,17 +5031,17 @@ ${a.join("\n\n")}\n`);
5031
5031
  FROM ${e("_voltro_migration_plans")}
5032
5032
  ORDER BY ${e("appliedAt")} DESC
5033
5033
  LIMIT 20
5034
- `.pipe(N.orElseSucceed(() => [])), n = yield* $i(e), r = Qi({ tables: n.tables.filter((e) => !e.name.startsWith("_voltro_")) }), i = t[0], a = {
5034
+ `.pipe(N.orElseSucceed(() => [])), n = yield* Qi(e), r = Zi({ tables: n.tables.filter((e) => !e.name.startsWith("_voltro_")) }), i = t[0], a = {
5035
5035
  isDrifted: i ? i.fingerprint !== r : !1,
5036
5036
  liveFingerprint: r,
5037
5037
  liveSnapshot: n
5038
5038
  };
5039
5039
  i && (a.lastAppliedFingerprint = i.fingerprint, a.lastAppliedAt = i.appliedAt, a.lastAppliedId = i.id);
5040
- let o = R, s = ta({
5040
+ let o = z, s = ea({
5041
5041
  declared: o,
5042
5042
  live: n
5043
5043
  });
5044
- return Qi(Xi(o)), {
5044
+ return Zi(Yi(o)), {
5045
5045
  drift: a,
5046
5046
  pending: {
5047
5047
  operations: s.operations.map((e) => {
@@ -5080,7 +5080,7 @@ ${a.join("\n\n")}\n`);
5080
5080
  };
5081
5081
  });
5082
5082
  try {
5083
- return await N.runPromise(t.pipe(N.provide(ci)));
5083
+ return await N.runPromise(t.pipe(N.provide(si)));
5084
5084
  } catch (t) {
5085
5085
  return $.warn("inspect.migrations: snapshot build failed", { err: String(t) }), e;
5086
5086
  }
@@ -5096,11 +5096,11 @@ ${a.join("\n\n")}\n`);
5096
5096
  },
5097
5097
  rpc: us,
5098
5098
  workflows: fs,
5099
- metrics: (e) => J.snapshot(e),
5099
+ metrics: (e) => Oo.snapshot(e),
5100
5100
  dataCache: () => {
5101
- let e = Er(), t = (process.env.CACHE_REDIS_DRIVER ?? "resp") === "http" ? "http" : "resp", n = Tr === "redis" ? (process.env.CACHE_REDIS_URL ?? process.env.REDIS_URL ?? "").includes("upstash") ? "upstash" : "redis" : "memory";
5101
+ let e = Tr(), t = (process.env.CACHE_REDIS_DRIVER ?? "resp") === "http" ? "http" : "resp", n = wr === "redis" ? (process.env.CACHE_REDIS_URL ?? process.env.REDIS_URL ?? "").includes("upstash") ? "upstash" : "redis" : "memory";
5102
5102
  return {
5103
- backend: Tr === "redis" ? "redis" : "memory",
5103
+ backend: wr === "redis" ? "redis" : "memory",
5104
5104
  engine: n,
5105
5105
  driver: t,
5106
5106
  hits: e.hits,
@@ -5110,19 +5110,19 @@ ${a.join("\n\n")}\n`);
5110
5110
  },
5111
5111
  invokers: bs,
5112
5112
  plugins: () => ({
5113
- plugins: Lt.snapshot(),
5113
+ plugins: It.snapshot(),
5114
5114
  capturedAt: Date.now()
5115
5115
  }),
5116
5116
  env: () => _(F?.name ?? E(m), {
5117
- contract: Wi(F?.env) ? F.env : void 0,
5117
+ contract: Ui(F?.env) ? F.env : void 0,
5118
5118
  plugins: F?.plugins ?? []
5119
5119
  }),
5120
5120
  subscriptions: () => {
5121
- let e = G.subscriptionSnapshot(), t = G.matcherStats();
5121
+ let e = K.subscriptionSnapshot(), t = K.matcherStats();
5122
5122
  return {
5123
5123
  subscriptions: e.map((e) => {
5124
5124
  let t = [];
5125
- for (let n of ui(e.predicate)) n.conjunctive && t.push(n.column);
5125
+ for (let n of li(e.predicate)) n.conjunctive && t.push(n.column);
5126
5126
  return {
5127
5127
  fingerprint: e.fingerprint,
5128
5128
  table: e.table,
@@ -5138,7 +5138,7 @@ ${a.join("\n\n")}\n`);
5138
5138
  },
5139
5139
  database: xs,
5140
5140
  migrations: async () => Ss(),
5141
- inspectTables: () => ({ tables: R.map((e) => {
5141
+ inspectTables: () => ({ tables: z.map((e) => {
5142
5142
  let t = Nl(e), n = Pl(t);
5143
5143
  return {
5144
5144
  name: e.tableName,
@@ -5150,13 +5150,13 @@ ${a.join("\n\n")}\n`);
5150
5150
  };
5151
5151
  }) }),
5152
5152
  inspectRows: async (e) => {
5153
- let t = Math.max(0, e.offset ?? 0), n = Math.max(1, Math.min(500, e.limit ?? 50)), r = R.find((t) => t.tableName === e.table);
5153
+ let t = Math.max(0, e.offset ?? 0), n = Math.max(1, Math.min(500, e.limit ?? 50)), r = z.find((t) => t.tableName === e.table);
5154
5154
  if (!r) throw Error(`unknown table: ${e.table}`);
5155
5155
  let i = Nl(r), a = nl({
5156
5156
  filter: e.filter,
5157
5157
  quickSearch: e.quickSearch,
5158
5158
  columns: i
5159
- }), o = rl(e.sort, i), s = await z.query({
5159
+ }), o = rl(e.sort, i), s = await B.query({
5160
5160
  table: e.table,
5161
5161
  order: o,
5162
5162
  skip: t,
@@ -5164,7 +5164,7 @@ ${a.join("\n\n")}\n`);
5164
5164
  predicate: a,
5165
5165
  projection: void 0
5166
5166
  }), c = e.count ?? (t === 0 ? "exact" : "none"), l = null, u = "none";
5167
- return (c === "exact" || c === "estimate") && (l = (await z.query({
5167
+ return (c === "exact" || c === "estimate") && (l = (await B.query({
5168
5168
  table: e.table,
5169
5169
  order: [],
5170
5170
  predicate: a,
@@ -5181,8 +5181,8 @@ ${a.join("\n\n")}\n`);
5181
5181
  },
5182
5182
  inspectInsertRow: async (e) => {
5183
5183
  if (e.table.startsWith("_voltro_")) throw Error(`inspect data viewer cannot write to framework-internal table: ${e.table}`);
5184
- if (!R.some((t) => t.tableName === e.table)) throw Error(`unknown table: ${e.table}`);
5185
- let t = await z.insert(e.table, e.row);
5184
+ if (!z.some((t) => t.tableName === e.table)) throw Error(`unknown table: ${e.table}`);
5185
+ let t = await B.insert(e.table, e.row);
5186
5186
  return $.info("inspect.data.insert", {
5187
5187
  table: e.table,
5188
5188
  id: t?.id ?? null
@@ -5190,8 +5190,8 @@ ${a.join("\n\n")}\n`);
5190
5190
  },
5191
5191
  inspectUpdateRow: async (e) => {
5192
5192
  if (e.table.startsWith("_voltro_")) throw Error(`inspect data viewer cannot write to framework-internal table: ${e.table}`);
5193
- if (!R.some((t) => t.tableName === e.table)) throw Error(`unknown table: ${e.table}`);
5194
- let t = await z.update(e.table, e.id, e.patch);
5193
+ if (!z.some((t) => t.tableName === e.table)) throw Error(`unknown table: ${e.table}`);
5194
+ let t = await B.update(e.table, e.id, e.patch);
5195
5195
  return $.info("inspect.data.update", {
5196
5196
  table: e.table,
5197
5197
  id: e.id,
@@ -5200,8 +5200,8 @@ ${a.join("\n\n")}\n`);
5200
5200
  },
5201
5201
  inspectDeleteRow: async (e) => {
5202
5202
  if (e.table.startsWith("_voltro_")) throw Error(`inspect data viewer cannot delete from framework-internal table: ${e.table}`);
5203
- if (!R.some((t) => t.tableName === e.table)) throw Error(`unknown table: ${e.table}`);
5204
- let t = await z.delete(e.table, e.id);
5203
+ if (!z.some((t) => t.tableName === e.table)) throw Error(`unknown table: ${e.table}`);
5204
+ let t = await B.delete(e.table, e.id);
5205
5205
  return $.info("inspect.data.delete", {
5206
5206
  table: e.table,
5207
5207
  id: e.id,
@@ -5209,8 +5209,8 @@ ${a.join("\n\n")}\n`);
5209
5209
  }), { deleted: t };
5210
5210
  },
5211
5211
  inspectImport: async (e) => {
5212
- let t = await N.runPromise(Ea({
5213
- store: z,
5212
+ let t = await N.runPromise(Ta({
5213
+ store: B,
5214
5214
  bundleDir: e.bundleDir,
5215
5215
  ...e.mode ? { mode: e.mode } : {},
5216
5216
  ...e.onConflict ? { onConflict: e.onConflict } : {},
@@ -5228,14 +5228,14 @@ ${a.join("\n\n")}\n`);
5228
5228
  },
5229
5229
  ...xt ? {
5230
5230
  inspectStartWorkflow: async (e) => {
5231
- if (U === void 0) throw Error("workflow runtime is not configured");
5232
- return Xn(U, {
5231
+ if (W === void 0) throw Error("workflow runtime is not configured");
5232
+ return Yn(W, {
5233
5233
  traceId: `inspect-workflow-start-${Date.now()}`,
5234
5234
  source: "inspect"
5235
5235
  }).start(e.name, e.payload);
5236
5236
  },
5237
5237
  inspectWorkflowRuns: async (e) => {
5238
- let { rows: t, total: n, offset: r, limit: i } = await Pc(z, {
5238
+ let { rows: t, total: n, offset: r, limit: i } = await Pc(B, {
5239
5239
  ...e.tag === void 0 ? {} : { tag: e.tag },
5240
5240
  ...e.status === void 0 ? {} : { status: e.status },
5241
5241
  ...e.offset === void 0 ? {} : { offset: e.offset },
@@ -5268,10 +5268,10 @@ ${a.join("\n\n")}\n`);
5268
5268
  };
5269
5269
  },
5270
5270
  inspectCancelWorkflowRun: async (e) => {
5271
- let t = (await z.query({
5271
+ let t = (await B.query({
5272
5272
  table: "_voltro_workflow_runs",
5273
5273
  order: [],
5274
- predicate: V("id", e.runId),
5274
+ predicate: H("id", e.runId),
5275
5275
  projection: void 0,
5276
5276
  skip: void 0,
5277
5277
  take: 1
@@ -5290,7 +5290,7 @@ ${a.join("\n\n")}\n`);
5290
5290
  reason: t?.message ?? String(t)
5291
5291
  });
5292
5292
  }
5293
- let r = await z.update("_voltro_workflow_runs", e.runId, {
5293
+ let r = await B.update("_voltro_workflow_runs", e.runId, {
5294
5294
  status: "cancelled",
5295
5295
  cancelled: !0,
5296
5296
  completedAt: /* @__PURE__ */ new Date()
@@ -5312,13 +5312,13 @@ ${a.join("\n\n")}\n`);
5312
5312
  didUpdate: r !== null
5313
5313
  }), { cancelled: r !== null };
5314
5314
  },
5315
- inspectWorkflowRunSteps: async (e) => ({ steps: (await z.query({
5315
+ inspectWorkflowRunSteps: async (e) => ({ steps: (await B.query({
5316
5316
  table: "_voltro_workflow_run_steps",
5317
5317
  order: [{
5318
5318
  column: "startedAt",
5319
5319
  direction: "asc"
5320
5320
  }],
5321
- predicate: V("runId", e.runId),
5321
+ predicate: H("runId", e.runId),
5322
5322
  projection: void 0,
5323
5323
  skip: void 0,
5324
5324
  take: 1e3
@@ -5338,13 +5338,13 @@ ${a.join("\n\n")}\n`);
5338
5338
  completedAt: e.completedAt ? e.completedAt.toISOString() : null,
5339
5339
  durationMs: e.durationMs
5340
5340
  })) }),
5341
- inspectWorkflowRunEvents: async (e) => ({ events: (await z.query({
5341
+ inspectWorkflowRunEvents: async (e) => ({ events: (await B.query({
5342
5342
  table: "_voltro_workflow_run_events",
5343
5343
  order: [{
5344
5344
  column: "occurredAt",
5345
5345
  direction: "asc"
5346
5346
  }],
5347
- predicate: V("runId", e.runId),
5347
+ predicate: H("runId", e.runId),
5348
5348
  projection: void 0,
5349
5349
  skip: void 0,
5350
5350
  take: 2e3
@@ -5358,7 +5358,7 @@ ${a.join("\n\n")}\n`);
5358
5358
  attempt: e.attempt
5359
5359
  })) }),
5360
5360
  inspectWorkflowDomainEvents: async (e) => {
5361
- let t = Math.max(0, e.offset ?? 0), n = Math.max(1, Math.min(500, e.limit ?? 100)), r = e.name === void 0 ? void 0 : V("name", e.name), i = await z.query({
5361
+ let t = Math.max(0, e.offset ?? 0), n = Math.max(1, Math.min(500, e.limit ?? 100)), r = e.name === void 0 ? void 0 : H("name", e.name), i = await B.query({
5362
5362
  table: "_voltro_workflow_events",
5363
5363
  order: [{
5364
5364
  column: "occurredAt",
@@ -5368,7 +5368,7 @@ ${a.join("\n\n")}\n`);
5368
5368
  projection: void 0,
5369
5369
  skip: t,
5370
5370
  take: n
5371
- }), a = await z.query({
5371
+ }), a = await B.query({
5372
5372
  table: "_voltro_workflow_events",
5373
5373
  order: [],
5374
5374
  predicate: r,
@@ -5391,13 +5391,13 @@ ${a.join("\n\n")}\n`);
5391
5391
  limit: n
5392
5392
  };
5393
5393
  },
5394
- inspectWorkflowEventDeliveries: async (e) => ({ deliveries: (await z.query({
5394
+ inspectWorkflowEventDeliveries: async (e) => ({ deliveries: (await B.query({
5395
5395
  table: "_voltro_workflow_event_deliveries",
5396
5396
  order: [{
5397
5397
  column: "createdAt",
5398
5398
  direction: "asc"
5399
5399
  }],
5400
- predicate: V("eventId", e.eventId),
5400
+ predicate: H("eventId", e.eventId),
5401
5401
  projection: void 0,
5402
5402
  skip: void 0,
5403
5403
  take: 500
@@ -5416,13 +5416,13 @@ ${a.join("\n\n")}\n`);
5416
5416
  completedAt: e.completedAt ? e.completedAt.toISOString() : null
5417
5417
  })) }),
5418
5418
  inspectWorkflowChildren: async (e) => {
5419
- let t = (await z.query({
5419
+ let t = (await B.query({
5420
5420
  table: "_voltro_workflow_runs",
5421
5421
  order: [{
5422
5422
  column: "startedAt",
5423
5423
  direction: "asc"
5424
5424
  }],
5425
- predicate: V("parentExecutionId", e.parentExecutionId),
5425
+ predicate: H("parentExecutionId", e.parentExecutionId),
5426
5426
  projection: void 0,
5427
5427
  skip: void 0,
5428
5428
  take: 200
@@ -5454,10 +5454,10 @@ ${a.join("\n\n")}\n`);
5454
5454
  };
5455
5455
  },
5456
5456
  inspectSuspendWorkflowRun: async (e) => {
5457
- let t = (await z.query({
5457
+ let t = (await B.query({
5458
5458
  table: "_voltro_workflow_runs",
5459
5459
  order: [],
5460
- predicate: V("id", e.runId),
5460
+ predicate: H("id", e.runId),
5461
5461
  projection: void 0,
5462
5462
  skip: void 0,
5463
5463
  take: 1
@@ -5472,7 +5472,7 @@ ${a.join("\n\n")}\n`);
5472
5472
  reason: t?.message ?? String(t)
5473
5473
  });
5474
5474
  }
5475
- let r = await z.update("_voltro_workflow_runs", e.runId, {
5475
+ let r = await B.update("_voltro_workflow_runs", e.runId, {
5476
5476
  status: "suspended",
5477
5477
  completedAt: /* @__PURE__ */ new Date()
5478
5478
  });
@@ -5486,10 +5486,10 @@ ${a.join("\n\n")}\n`);
5486
5486
  }), { suspended: r !== null };
5487
5487
  },
5488
5488
  inspectResumeWorkflowRun: async (e) => {
5489
- let t = (await z.query({
5489
+ let t = (await B.query({
5490
5490
  table: "_voltro_workflow_runs",
5491
5491
  order: [],
5492
- predicate: V("id", e.runId),
5492
+ predicate: H("id", e.runId),
5493
5493
  projection: void 0,
5494
5494
  skip: void 0,
5495
5495
  take: 1
@@ -5504,7 +5504,7 @@ ${a.join("\n\n")}\n`);
5504
5504
  reason: t?.message ?? String(t)
5505
5505
  }), { resumed: !1 };
5506
5506
  }
5507
- let r = await z.update("_voltro_workflow_runs", e.runId, {
5507
+ let r = await B.update("_voltro_workflow_runs", e.runId, {
5508
5508
  status: "running",
5509
5509
  completedAt: null
5510
5510
  });
@@ -5521,7 +5521,7 @@ ${a.join("\n\n")}\n`);
5521
5521
  let t = e.payloadOverride !== void 0;
5522
5522
  try {
5523
5523
  let n = await Lc({
5524
- store: z,
5524
+ store: B,
5525
5525
  workflows: j,
5526
5526
  runPromise: (e) => Qo.runPromise(e)
5527
5527
  }, e.runId, t ? { payloadOverride: e.payloadOverride } : void 0);
@@ -5537,8 +5537,8 @@ ${a.join("\n\n")}\n`);
5537
5537
  }
5538
5538
  },
5539
5539
  inspectSignalWorkflowRun: async (e) => {
5540
- let t = await Rr({
5541
- store: z,
5540
+ let t = await Lr({
5541
+ store: B,
5542
5542
  recorder: X,
5543
5543
  target: { id: e.runId },
5544
5544
  signalName: e.signalName,
@@ -5551,8 +5551,8 @@ ${a.join("\n\n")}\n`);
5551
5551
  }), t;
5552
5552
  },
5553
5553
  inspectUpdateWorkflowRun: async (e) => {
5554
- let t = await zr({
5555
- store: z,
5554
+ let t = await Rr({
5555
+ store: B,
5556
5556
  recorder: X,
5557
5557
  target: { id: e.runId },
5558
5558
  updateName: e.updateName,
@@ -5574,17 +5574,17 @@ ${a.join("\n\n")}\n`);
5574
5574
  name: e.name,
5575
5575
  cron: e.cron,
5576
5576
  timezone: e.timezone,
5577
- trigger: e.trigger ?? fa,
5577
+ trigger: e.trigger ?? da,
5578
5578
  onOverlap: e.onOverlap ?? "skip",
5579
5579
  backfill: e.backfill ?? "skip",
5580
5580
  maxRuntimeMs: e.maxRuntimeMs ?? 30 * 6e4,
5581
5581
  ...e.description === void 0 ? {} : { description: e.description },
5582
- nextFiringAt: $n(e).toISOString()
5582
+ nextFiringAt: Qn(e).toISOString()
5583
5583
  })),
5584
- coordination: ma ? "cluster" : pa === "advisoryLock" && H === "postgres" ? "advisoryLock" : "single"
5584
+ coordination: pa ? "cluster" : fa === "advisoryLock" && U === "postgres" ? "advisoryLock" : "single"
5585
5585
  }),
5586
5586
  inspectScheduleRuns: async (e) => {
5587
- let t = Math.max(0, e.offset ?? 0), n = Math.max(1, Math.min(500, e.limit ?? 50)), r = e.name === void 0 ? void 0 : V("name", e.name), i = await z.query({
5587
+ let t = Math.max(0, e.offset ?? 0), n = Math.max(1, Math.min(500, e.limit ?? 50)), r = e.name === void 0 ? void 0 : H("name", e.name), i = await B.query({
5588
5588
  table: "_voltro_schedule_runs",
5589
5589
  order: [{
5590
5590
  column: "scheduledAt",
@@ -5594,7 +5594,7 @@ ${a.join("\n\n")}\n`);
5594
5594
  projection: void 0,
5595
5595
  skip: t,
5596
5596
  take: n
5597
- }), a = await z.query({
5597
+ }), a = await B.query({
5598
5598
  table: "_voltro_schedule_runs",
5599
5599
  order: [],
5600
5600
  predicate: r,
@@ -5623,21 +5623,21 @@ ${a.join("\n\n")}\n`);
5623
5623
  };
5624
5624
  },
5625
5625
  inspectFireSchedule: async (e) => {
5626
- if (!sa) throw Error("scheduler not started (no self-triggered schedules?)");
5627
- return { runId: await sa.fireNow(e.name, e.trigger) ?? null };
5626
+ if (!oa) throw Error("scheduler not started (no self-triggered schedules?)");
5627
+ return { runId: await oa.fireNow(e.name, e.trigger) ?? null };
5628
5628
  }
5629
5629
  } : {},
5630
5630
  cluster: async () => {
5631
- let e = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, t = H, n = t === "memory", r = n ? "none" : Gr({ sqliteFamily: t === "sqlite" || t === "turso" }), i = Wr({
5631
+ let e = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, t = U, n = t === "memory", r = n ? "none" : Wr({ sqliteFamily: t === "sqlite" || t === "turso" }), i = Ur({
5632
5632
  runnerStorage: r === "sql" ? "sql" : "memory",
5633
5633
  ...process.env.VOLTRO_WORKFLOW_RUNNER_PORT ? { runnerListenPort: Number(process.env.VOLTRO_WORKFLOW_RUNNER_PORT) } : {}
5634
- }), a = !n && (process.env.CDC ?? "1") !== "0", o = t === "postgres" ? "LISTEN/NOTIFY" : t === "sqlite" || t === "turso" ? "in-process bus" : t === "mariadb" || t === "mysql" ? "binlog CDC (ROW)" : t === "mssql" ? "inline only" : t === "memory" ? "none (single-process)" : "inline only", s = t === "postgres" || t === "mariadb" || t === "mssql" ? "full" : t === "mysql" ? "inline-only" : t === "sqlite" || t === "turso" ? "single-process" : "none", c = ma ? "cluster" : pa === "advisoryLock" && H === "postgres" ? "advisoryLock" : "single", l = a && t === "mariadb" ? Xl(e) : void 0, u = {
5634
+ }), a = !n && (process.env.CDC ?? "1") !== "0", o = t === "postgres" ? "LISTEN/NOTIFY" : t === "sqlite" || t === "turso" ? "in-process bus" : t === "mariadb" || t === "mysql" ? "binlog CDC (ROW)" : t === "mssql" ? "inline only" : t === "memory" ? "none (single-process)" : "inline only", s = t === "postgres" || t === "mariadb" || t === "mssql" ? "full" : t === "mysql" ? "inline-only" : t === "sqlite" || t === "turso" ? "single-process" : "none", c = pa ? "cluster" : fa === "advisoryLock" && U === "postgres" ? "advisoryLock" : "single", l = a && t === "mariadb" ? Xl(e) : void 0, u = {
5635
5635
  replicaId: e,
5636
5636
  dialect: t,
5637
5637
  runnerHost: i.host,
5638
5638
  runnerPort: r === "none" ? 0 : i.port,
5639
5639
  runnerStorage: r,
5640
- shardLock: r === "sql" ? Ur() : "none",
5640
+ shardLock: r === "sql" ? Hr() : "none",
5641
5641
  coordination: c,
5642
5642
  cdc: {
5643
5643
  enabled: a,
@@ -5649,7 +5649,7 @@ ${a.join("\n\n")}\n`);
5649
5649
  }, d = async (e) => {
5650
5650
  if (n) return [];
5651
5651
  try {
5652
- return await z.query(e);
5652
+ return await B.query(e);
5653
5653
  } catch {
5654
5654
  return [];
5655
5655
  }
@@ -5684,7 +5684,7 @@ ${a.join("\n\n")}\n`);
5684
5684
  runningWorkflowRuns: (await d({
5685
5685
  table: "_voltro_workflow_runs",
5686
5686
  order: [],
5687
- predicate: V("status", "running"),
5687
+ predicate: H("status", "running"),
5688
5688
  projection: ["id"],
5689
5689
  skip: void 0,
5690
5690
  take: void 0
@@ -5694,17 +5694,17 @@ ${a.join("\n\n")}\n`);
5694
5694
  };
5695
5695
  },
5696
5696
  runSeed: async (e) => {
5697
- let t = await ie(xi, e, z, vi);
5697
+ let t = await ie(bi, e, B, _i);
5698
5698
  return ut.recordSeedResult(t), xs();
5699
5699
  },
5700
- rollbackMigration: async (e) => (vi.warn("rollbackMigration called but only memory store is wired — no-op"), xs()),
5700
+ rollbackMigration: async (e) => (_i.warn("rollbackMigration called but only memory store is wired — no-op"), xs()),
5701
5701
  webhooks: async () => {
5702
- let e = W.outgoing.map((e) => ({
5702
+ let e = G.outgoing.map((e) => ({
5703
5703
  id: e.descriptor.id,
5704
5704
  ...e.descriptor.description === void 0 ? {} : { description: e.descriptor.description },
5705
5705
  version: e.descriptor.version ?? 1,
5706
5706
  file: e.file
5707
- })), t = W.incoming.map((e) => {
5707
+ })), t = G.incoming.map((e) => {
5708
5708
  let t = e.descriptor.path ?? `/webhooks/${e.descriptor.id}`, n = e.descriptor.provider?.id, r = e.descriptor.signature !== void 0 || e.descriptor.provider?.signature !== void 0;
5709
5709
  return {
5710
5710
  id: e.descriptor.id,
@@ -5715,7 +5715,7 @@ ${a.join("\n\n")}\n`);
5715
5715
  };
5716
5716
  }), n = [], r = [];
5717
5717
  try {
5718
- n = (await z.query({
5718
+ n = (await B.query({
5719
5719
  table: "_voltro_webhook_targets",
5720
5720
  order: [{
5721
5721
  column: "createdAt",
@@ -5730,7 +5730,7 @@ ${a.join("\n\n")}\n`);
5730
5730
  }));
5731
5731
  } catch {}
5732
5732
  try {
5733
- r = (await z.query({
5733
+ r = (await B.query({
5734
5734
  table: "_voltro_webhook_deliveries",
5735
5735
  order: [{
5736
5736
  column: "createdAt",
@@ -5750,23 +5750,23 @@ ${a.join("\n\n")}\n`);
5750
5750
  deliveries: r
5751
5751
  };
5752
5752
  },
5753
- ...K === void 0 ? {} : { webhookActions: {
5754
- subscribe: (e) => K.subscribe(e).then((e) => ({
5753
+ ...q === void 0 ? {} : { webhookActions: {
5754
+ subscribe: (e) => q.subscribe(e).then((e) => ({
5755
5755
  id: e.id,
5756
5756
  event: e.event,
5757
5757
  url: e.url,
5758
5758
  secret: e.secret
5759
5759
  })),
5760
- pause: (e) => K.pauseTarget(e),
5761
- resume: (e) => K.resumeTarget(e),
5762
- delete: (e) => K.deleteTarget(e),
5763
- rotateSecret: (e) => K.rotateSecret(e),
5764
- replay: (e) => K.replay(e),
5765
- updateTargetPayloadVersion: (e, t) => K.updateTargetPayloadVersion(e, t)
5760
+ pause: (e) => q.pauseTarget(e),
5761
+ resume: (e) => q.resumeTarget(e),
5762
+ delete: (e) => q.deleteTarget(e),
5763
+ rotateSecret: (e) => q.rotateSecret(e),
5764
+ replay: (e) => q.replay(e),
5765
+ updateTargetPayloadVersion: (e, t) => q.updateTargetPayloadVersion(e, t)
5766
5766
  } }
5767
- }, ws = Rc(F?.plugins ?? [], J);
5767
+ }, ws = Rc(F?.plugins ?? [], Oo);
5768
5768
  ws !== void 0 && $.info("plugin http-request interceptor active", { plugins: (F?.plugins ?? []).filter((e) => typeof e.onHttpRequest == "function").map((e) => e.name) });
5769
- let Es = (F?.plugins ?? []).flatMap((e) => e.httpRoutes ?? []), Ds = typeof Et == "object" ? Et.managementPath : void 0, Os = () => `public-${Math.random().toString(36).slice(2, 10)}`, ks = la([
5769
+ let Es = (F?.plugins ?? []).flatMap((e) => e.httpRoutes ?? []), Ds = typeof Tt == "object" ? Tt.managementPath : void 0, Os = () => `public-${Math.random().toString(36).slice(2, 10)}`, ks = ca([
5770
5770
  ...w.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
5771
5771
  descriptor: e.descriptor,
5772
5772
  invoke: (t, n) => Y(e, t, {
@@ -5794,17 +5794,17 @@ ${a.join("\n\n")}\n`);
5794
5794
  }))
5795
5795
  ]), As = [
5796
5796
  ...F?.restRoutes ?? [],
5797
- ...Ot ? Vt(Ot, Ds ?? "/v1/api-keys") : [],
5797
+ ...Dt ? Bt(Dt, Ds ?? "/v1/api-keys") : [],
5798
5798
  ...ks
5799
5799
  ];
5800
5800
  ks.length > 0 && $.info("public-api routes projected from descriptors", { routes: ks.map((e) => `${e.method} ${e.path}`) });
5801
5801
  let js = F?.idempotency, Ms = js ? {
5802
- store: nn(z),
5802
+ store: tn(B),
5803
5803
  header: (typeof js == "object" ? js.header : void 0) ?? "Idempotency-Key",
5804
5804
  ttlMs: (typeof js == "object" ? js.ttlMs : void 0) ?? 864e5
5805
- } : void 0, Ns = As.length > 0 ? ua(As, {
5806
- store: z,
5807
- resolveSubject: (e) => At({
5805
+ } : void 0, Ns = As.length > 0 ? la(As, {
5806
+ store: B,
5807
+ resolveSubject: (e) => kt({
5808
5808
  headers: e,
5809
5809
  clientId: -1
5810
5810
  }),
@@ -5817,21 +5817,22 @@ ${a.join("\n\n")}\n`);
5817
5817
  let Ps = [
5818
5818
  ...Es,
5819
5819
  ...Ns,
5820
- ...er.httpRoutes
5821
- ], { server: Fs } = Sr({
5822
- group: oo,
5820
+ ...$n.httpRoutes
5821
+ ], { server: Fs } = xr({
5822
+ group: ao,
5823
5823
  handlersLayer: $o,
5824
5824
  httpHandlersLayer: ns,
5825
5825
  port: b,
5826
5826
  path: F?.transport?.wsPath ?? "/ws",
5827
5827
  ...ws ? { pluginHttpInterceptor: ws } : {},
5828
5828
  ...Ps.length > 0 ? { httpRoutes: Ps } : {},
5829
+ getStore: () => L.current,
5829
5830
  inspectRoute: { handle: async (e, t, n, i) => {
5830
5831
  if (n === "GET" && e === "/_voltro/inspect/plugins/dashboard-mounts") return {
5831
5832
  status: 200,
5832
5833
  contentType: "application/json; charset=utf-8",
5833
5834
  body: JSON.stringify({
5834
- mounts: Bt,
5835
+ mounts: zt,
5835
5836
  capturedAt: Date.now()
5836
5837
  }),
5837
5838
  headers: T(t.origin)
@@ -5857,7 +5858,7 @@ ${a.join("\n\n")}\n`);
5857
5858
  if (n === "GET" && (e === "/_voltro/inspect/traces" || e.startsWith("/_voltro/inspect/traces?"))) {
5858
5859
  let n = ve();
5859
5860
  return {
5860
- ...ul(e, rs === "postgres" && me() ? await Hl(e, n, z) : n),
5861
+ ...ul(e, rs === "postgres" && me() ? await Hl(e, n, B) : n),
5861
5862
  headers: T(t.origin)
5862
5863
  };
5863
5864
  }
@@ -5918,12 +5919,12 @@ ${a.join("\n\n")}\n`);
5918
5919
  if (r) return r;
5919
5920
  }
5920
5921
  if (e.startsWith("/_voltro/inspect/aggregates")) {
5921
- let r = await Us(e, n, oa.registry, T(t.origin));
5922
+ let r = await Us(e, n, aa.registry, T(t.origin));
5922
5923
  if (r) return r;
5923
5924
  }
5924
5925
  if (e.startsWith("/_voltro/inspect/timeline")) {
5925
5926
  let r = await $s(e, n, {
5926
- recorder: un(),
5927
+ recorder: ln(),
5927
5928
  readCurrentRows: async (e) => Q.inspectRows === void 0 ? [] : (await Q.inspectRows({
5928
5929
  table: e,
5929
5930
  offset: 0,
@@ -5935,8 +5936,8 @@ ${a.join("\n\n")}\n`);
5935
5936
  }
5936
5937
  if (e.startsWith("/_voltro/inspect/analytics")) {
5937
5938
  let r = qs(e, n, {
5938
- sink: ri,
5939
- metricsCollector: J
5939
+ sink: ni,
5940
+ metricsCollector: Oo
5940
5941
  }, T(t.origin));
5941
5942
  if (r) return r;
5942
5943
  }
@@ -5957,7 +5958,7 @@ ${a.join("\n\n")}\n`);
5957
5958
  headers: T(t.origin)
5958
5959
  }));
5959
5960
  if (e.startsWith("/_voltro/inspect/plugins/")) {
5960
- let r = await zt.dispatch(e, n, t, i ?? "");
5961
+ let r = await Rt.dispatch(e, n, t, i ?? "");
5961
5962
  if (r) return r;
5962
5963
  }
5963
5964
  return et(e, Q, t, { method: n });
@@ -5970,11 +5971,11 @@ ${a.join("\n\n")}\n`);
5970
5971
  corsHeaders: (e) => T(e),
5971
5972
  keepAlive: () => i()
5972
5973
  },
5973
- webhookRoutes: new Map(Array.from(Na.entries()).map(([e, t]) => [e, { handle: t }])),
5974
- ...Qn ? { tracerLayer: Qn } : {}
5974
+ webhookRoutes: new Map(Array.from(Ma.entries()).map(([e, t]) => [e, { handle: t }])),
5975
+ ...Zn ? { tracerLayer: Zn } : {}
5975
5976
  });
5976
5977
  try {
5977
- await qt(Fs);
5978
+ await Kt(Fs);
5978
5979
  } catch (e) {
5979
5980
  $.error(`rpc server failed to bind on port ${b} — aborting boot`, { port: b }, e), process.exit(1);
5980
5981
  }
@@ -5982,7 +5983,7 @@ ${a.join("\n\n")}\n`);
5982
5983
  port: b,
5983
5984
  ws: `ws://localhost:${b}/ws`,
5984
5985
  store: rs
5985
- }), Ee?.set({ phase: "ready" }), rs === "postgres" && $.info("postgres change-data-capture", { enabled: (process.env.CDC ?? "1") !== "0" }), await ho();
5986
+ }), Ee?.set({ phase: "ready" }), rs === "postgres" && $.info("postgres change-data-capture", { enabled: (process.env.CDC ?? "1") !== "0" }), await mo();
5986
5987
  try {
5987
5988
  await h({
5988
5989
  id: x,
@@ -6010,9 +6011,9 @@ ${a.join("\n\n")}\n`);
6010
6011
  }).catch(() => {});
6011
6012
  }, 1e4).unref();
6012
6013
  let r = async () => {
6013
- Lt.deactivate();
6014
- for (let e of dr) e.stop();
6015
- or?.dispose(), e(x), ue.dispose(), Dr(), mr?.close(), await oi();
6014
+ It.deactivate();
6015
+ for (let e of ur) e.stop();
6016
+ ar?.dispose(), e(x), ue.dispose(), Er(), pr?.close(), await ai();
6016
6017
  };
6017
6018
  process.on("SIGINT", () => {
6018
6019
  r();
@@ -6049,4 +6050,4 @@ ${a.join("\n\n")}\n`);
6049
6050
  }), new Promise(() => {});
6050
6051
  };
6051
6052
  //#endregion
6052
- export { Wa as $, gs as A, Go as B, tc as C, ys as D, Ts as E, cs as F, So as G, Wo as H, as as I, Xa as J, Qa as K, is as L, ps as M, ds as N, Cs as O, ss as P, Ga as Q, ns as R, ec as S, Rs as T, Ho as U, Uo as V, xo as W, qa as X, Ja as Y, Ka as Z, Ac as _, Gl as a, cc as b, Ul as c, Kl as d, za as et, Tl as f, Lc as g, Ic as h, Il as i, hs as j, _s as k, ql as l, Kc as m, _l as n, Cl as o, $l as p, Ya as q, Ql as r, Wl as s, vl as t, Ia as tt, iu as u, bc as v, Ls as w, ac as x, sc as y, es as z };
6053
+ export { Ua as $, gs as A, Go as B, tc as C, ys as D, Ts as E, cs as F, xo as G, Wo as H, as as I, Ya as J, Za as K, is as L, ps as M, ds as N, Cs as O, ss as P, Wa as Q, ns as R, ec as S, Rs as T, Ho as U, Uo as V, bo as W, Ka as X, qa as Y, Ga as Z, Ac as _, Gl as a, cc as b, Ul as c, Kl as d, Ra as et, Tl as f, Lc as g, Ic as h, Il as i, hs as j, _s as k, ql as l, Kc as m, _l as n, Cl as o, $l as p, Ja as q, Ql as r, Wl as s, vl as t, Fa as tt, iu as u, bc as v, Ls as w, ac as x, sc as y, es as z };