@voltro/cli 0.43.1 → 0.44.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 (90) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/dist/{apiBuild-DF0f69Gf.js → apiBuild-DvWreIQP.js} +1 -1
  3. package/dist/apiBuild-XaW40W8x.js +2 -0
  4. package/dist/bin.js +1 -1
  5. package/dist/{build-LC_IJaHL.js → build-Ckc-FA7d.js} +6 -6
  6. package/dist/{checkCommand-DBpTSK8d.js → checkCommand-AlbawIal.js} +1 -1
  7. package/dist/{checkCommand-DDxwJCja.js → checkCommand-BNfEs4KG.js} +2 -2
  8. package/dist/{codegenCommand-LjxfK4Am.js → codegenCommand-iClXoRCW.js} +1 -1
  9. package/dist/{codemodRunner-Cnnz4-I7.js → codemodRunner-BKTnaGOz.js} +22 -0
  10. package/dist/{commands-CbQcuWsE.js → commands-fsnezHLH.js} +18 -18
  11. package/dist/{dashboardCommand-CAHjCe_9.js → dashboardCommand-DHDmlo9A.js} +1 -1
  12. package/dist/dataCommand-sfpGV694.js +867 -0
  13. package/dist/{dev-D0E5x2Ue.js → dev-BZO5aLdr.js} +1 -1
  14. package/dist/{dev-B2rZfqxw.js → dev-D-JZ6CGQ.js} +930 -916
  15. package/dist/doctorCommand-BeLOwq7S.js +2 -0
  16. package/dist/{doctorCommand-Ct_3BHgd.js → doctorCommand-BlUyESpD.js} +9 -9
  17. package/dist/{dormancyCommand-D1DKnYce.js → dormancyCommand-lQxdrU8C.js} +1 -1
  18. package/dist/{embeddingsCommand-1sZRBKlM.js → embeddingsCommand-ByBTju6X.js} +1 -1
  19. package/dist/{envCommand-7qjlQgLD.js → envCommand-CpCbYAgR.js} +1 -1
  20. package/dist/{evolveCommand-D5opB48I.js → evolveCommand-CBV3-TtK.js} +2 -2
  21. package/dist/index.js +1 -1
  22. package/dist/{infoCommand-Bs_8RU22.js → infoCommand-DJoA9cKD.js} +1 -1
  23. package/dist/{runtimeTrace-Wmi7V-wN.js → runtimeTrace-DJ9tPhrc.js} +1 -1
  24. package/dist/{sdkgen-DbTFGCjg.js → sdkgen-7dr8-Onw.js} +1 -1
  25. package/dist/serveCommand-BlnAlNQg.js +1891 -0
  26. package/dist/serveCommand-Dg_E1ev4.js +2 -0
  27. package/dist/serveEntry.js +1 -1
  28. package/dist/{updateCommand-CrI9B4d7.js → updateCommand-BvRidHp6.js} +1 -1
  29. package/dist/updateCommand-DcKVmLVN.js +2 -0
  30. package/dist/{webhooksCommand-BXUP5YjW.js → webhooksCommand-BfO_JF2b.js} +1 -1
  31. package/package.json +23 -17
  32. package/templates/AGENTS.md +1 -1
  33. package/templates/agent-docs/_index.md +1 -1
  34. package/templates/agent-docs/cli.md +144 -4
  35. package/templates/agent-docs/database/seedsdialects.md +12 -0
  36. package/templates/agent-docs/plugins/versioning.md +2 -0
  37. package/templates/agent-docs/whats-new.md +16 -51
  38. package/templates/apps/api-ai/package.json +7 -7
  39. package/templates/apps/api-auth/package.json +8 -8
  40. package/templates/apps/api-backend/package.json +7 -7
  41. package/templates/apps/api-backend-deactivation/package.json +7 -7
  42. package/templates/apps/api-backend-mail/package.json +8 -8
  43. package/templates/apps/api-backend-mariadb/package.json +9 -9
  44. package/templates/apps/api-backend-sqlite/package.json +8 -8
  45. package/templates/apps/api-backend-storage/package.json +8 -8
  46. package/templates/apps/api-cms/package.json +10 -10
  47. package/templates/apps/api-collab/package.json +8 -8
  48. package/templates/apps/api-data-advanced/package.json +8 -8
  49. package/templates/apps/api-durable/package.json +8 -8
  50. package/templates/apps/api-feature-flags/package.json +9 -9
  51. package/templates/apps/api-governance/package.json +8 -8
  52. package/templates/apps/api-kv/package.json +8 -8
  53. package/templates/apps/api-moderation/package.json +8 -8
  54. package/templates/apps/api-observability/package.json +8 -8
  55. package/templates/apps/api-ratelimit/package.json +8 -8
  56. package/templates/apps/api-rbac/package.json +8 -8
  57. package/templates/apps/api-rest/package.json +7 -7
  58. package/templates/apps/api-saas/package.json +11 -11
  59. package/templates/apps/api-saas-starter/package.json +10 -10
  60. package/templates/apps/api-search/package.json +8 -8
  61. package/templates/apps/api-status/package.json +8 -8
  62. package/templates/apps/api-versioning/package.json +8 -8
  63. package/templates/apps/api-webhooks/package.json +9 -9
  64. package/templates/apps/changelog/package.json +6 -6
  65. package/templates/apps/edge-functions/package.json +2 -2
  66. package/templates/apps/frontend-admin/package.json +8 -8
  67. package/templates/apps/frontend-app/package.json +9 -9
  68. package/templates/apps/frontend-auth/package.json +8 -8
  69. package/templates/apps/frontend-blank/package.json +7 -7
  70. package/templates/apps/frontend-cms/package.json +9 -9
  71. package/templates/apps/frontend-collab/package.json +10 -10
  72. package/templates/apps/frontend-contact/package.json +7 -7
  73. package/templates/apps/frontend-dashboard/package.json +7 -7
  74. package/templates/apps/frontend-docs/package.json +7 -7
  75. package/templates/apps/frontend-i18n/package.json +6 -6
  76. package/templates/apps/frontend-landing/package.json +7 -7
  77. package/templates/apps/frontend-portal/package.json +8 -8
  78. package/templates/apps/frontend-saas/package.json +8 -8
  79. package/templates/apps/frontend-spa/package.json +7 -7
  80. package/templates/apps/frontend-ssr/package.json +7 -7
  81. package/templates/apps/frontend-ssr-api/package.json +8 -8
  82. package/templates/apps/frontend-static-blog/package.json +6 -6
  83. package/templates/apps/frontend-status/package.json +8 -8
  84. package/templates/apps/mobile-app/package.json +4 -4
  85. package/dist/apiBuild-B7NgSMhX.js +0 -2
  86. package/dist/dataCommand-CrqvbVOv.js +0 -679
  87. package/dist/doctorCommand-CdsctSwg.js +0 -2
  88. package/dist/serveCommand-C8xzYCwa.js +0 -1776
  89. package/dist/serveCommand-CGNTXafv.js +0 -2
  90. package/dist/updateCommand-BvkKlV7D.js +0 -2
@@ -4,14 +4,14 @@ import { n } from "./appModuleLoader-C9r9mxZt.js";
4
4
  import { t as r } from "./bootRefusal-pgvDxlrU.js";
5
5
  import { n as i, r as a } from "./startupRunner-CEqQq7ax.js";
6
6
  import { r as o } from "./appPort-B_HpJ_ck.js";
7
- import { H as s, J as c, K as l, V as u, W as d, X as f, Y as p, Z as m, ct as h, ft as g, g as _, ht as v, lt as ee, pt as te, q as y, ut as b } from "./webDev-101csg6Q.js";
8
- import { n as x, r as S } from "./dialectDriver-czCHYpeH.js";
9
- import { a as C, i as ne, n as re, t as ie } from "./connectionConfig-Bk9IC7D0.js";
10
- import { a as ae, c as oe, i as se, n as ce, o as le, r as ue, t as de } from "./seedRunner-IdHEprqf.js";
11
- import { r as fe } from "./devActivity-Dx_3nnGv.js";
12
- import { C as pe, E as w, S as me, T as he, _ as ge, b as _e, d as ve, f as ye, g as be, h as xe, m as Se, o as Ce, p as T, r as we, u as Te, v as Ee, w as De, x as Oe } from "./frameworkTableAssembly-oMPBKqlE.js";
13
- import { A as ke, D as Ae, M as je, P as Me, S as Ne, _ as Pe, a as E, b as D, c as Fe, g as O, k as Ie, n as Le, o as Re, p as ze, s as Be, t as Ve, v as He, w as Ue, x as We, y as Ge } from "./fileConventions-Cof68_BL.js";
14
- import { A as Ke, C as qe, D as k, E as A, N as Je, O as Ye, S as Xe, T as Ze, _ as Qe, a as $e, b as et, c as tt, d as nt, f as rt, g as it, h as at, i as ot, l as st, m as ct, o as lt, p as ut, r as dt, s as ft, t as pt, u as mt, v as ht, w as j, x as gt, y as _t } from "./inspect-B7U7Cl_Z.js";
7
+ import { H as s, J as c, K as l, V as u, W as d, X as f, Y as p, Z as m, ct as h, ft as g, g as _, ht as v, lt as ee, pt as te, q as ne, ut as y } from "./webDev-101csg6Q.js";
8
+ import { n as b, r as x } from "./dialectDriver-czCHYpeH.js";
9
+ import { a as S, i as re, n as ie, t as ae } from "./connectionConfig-Bk9IC7D0.js";
10
+ import { a as oe, c as se, i as ce, n as le, o as ue, r as de, t as fe } from "./seedRunner-IdHEprqf.js";
11
+ import { r as pe } from "./devActivity-Dx_3nnGv.js";
12
+ import { C as me, E as C, S as he, T as ge, _ as _e, b as ve, d as ye, f as be, g as xe, h as Se, m as Ce, o as we, p as w, r as Te, u as Ee, v as De, w as Oe, x as ke } from "./frameworkTableAssembly-oMPBKqlE.js";
13
+ import { A as Ae, D as je, M as Me, P as Ne, S as Pe, _ as Fe, a as T, b as E, c as Ie, g as D, k as Le, n as Re, o as ze, p as Be, s as Ve, t as He, v as Ue, w as We, x as Ge, y as Ke } from "./fileConventions-Cof68_BL.js";
14
+ import { A as qe, C as Je, D as O, E as k, N as Ye, O as Xe, S as Ze, T as Qe, _ as $e, a as et, b as tt, c as nt, d as rt, f as it, g as at, h as ot, i as st, l as ct, m as lt, o as ut, p as dt, r as ft, s as pt, t as mt, u as ht, v as gt, w as A, x as _t, y as j } from "./inspect-B7U7Cl_Z.js";
15
15
  import { t as vt } from "./manifestBuild-BK42hu0k.js";
16
16
  import { n as yt } from "./cliRuntime-Dh7UDinH.js";
17
17
  import { n as bt, t as xt } from "./tsxLoader-EuXmSJ1K.js";
@@ -37,26 +37,26 @@ import { ADMISSIONS_TABLE as gr, EVENTS_TABLE as _r, PAUSES_TABLE as vr, Workflo
37
37
  import { makeClusterCronLayer as Jr, parseShardLockMode as Yr, pollWorkflowStorage as Xr, redriveFailedRun as Zr, resolveRunnerIdentity as Qr, resolveRunnerStorage as $r, resumeRunFromStep as ei, workflowEngineLayer as ti } from "@voltro/workflow/cluster";
38
38
  import { appToolDecision as ni, loadAgentMessages as ri, runAgentTurn as ii } from "@voltro/ai";
39
39
  import { actorsTable as ai, allRegisteredTables as oi, and as si, auditAllTableIndexes as ci, bindResidentStore as li, connectionIdentity as ui, contains as di, drainIdentifierWarnings as fi, encryptedColumnsOf as pi, ensureTableRegistered as mi, eq as z, formatIndexAuditIssue as hi, gte as gi, inSet as _i, isEmptyRelationsSpec as vi, isEncrypted as yi, isNotNull as bi, isNull as xi, isSqliteFamily as Si, lt as Ci, lte as wi, notInSubquery as Ti, or as Ei, registerCoreTables as Di, registerDiscoveredRelations as Oi, resolveTenantNamespace as ki, runWithWriteAttribution as Ai, serverOnlyColumns as ji, setResidencyConfig as Mi, startsWith as Ni, validateRegisteredRelations as Pi, walkLeaves as Fi } from "@voltro/database";
40
- import { AggregateError as Ii, AggregateMaintainer as Li, AggregateNotFound as Ri, AggregateRegistry as zi, AggregateStale as Bi, AnalyticsSink as Vi, CostRegistry as Hi, DEFAULT_APPROVAL_EXPIRY_MS as Ui, DORMANCY_WAKEUP_TENANT as Wi, Dispatcher as Gi, EventBus as Ki, ExpectationRegistry as qi, ExperimentRegistry as Ji, InMemoryDataStore as Yi, InstanceMembership as Xi, NO_ROW_FILTER as Zi, OUTBOX_TABLE as Qi, ReactionRateLimiter as $i, ReplicatedDataStore as ea, SYSTEM_SUBJECT as B, actingUserId as ta, apiKeyManagementRoutes as na, applyPluginRefRules as ra, applyUndoInvocation as ia, approvalsPendingExecutor as aa, assertConnectionCipherConfigured as oa, attachAnalyticsMirror as sa, attachExpectations as ca, attachExperiments as la, attachFinops as ua, awaitServerListening as da, bindEvent as fa, bindMutation as pa, bindStream as ma, bindSubscription as ha, buildTracingLayer as ga, cacheScopeLeaks as _a, cancelWakeup as va, collectPluginRefRules as ya, compileCron as ba, completeOAuthConnect as xa, cronOccurrences as Sa, dataStoreApiKeyStore as Ca, dataStoreIdempotencyStore as wa, decideApprovalInvocation as Ta, defineSchedule as Ea, drainOutbox as Da, enableGraphObservation as Oa, enterRequestLoader as V, extractDbCause as ka, formatCacheScopeLeaks as Aa, formatServerOnlyLeaks as ja, formatUnresolvedSources as Ma, frameworkApiKeyStrategy as Na, getFieldCipher as Pa, getResourcePolicy as Fa, getTimelineRecorder as Ia, installApprovalGate as La, installPolicyGuardResolver as Ra, isAggregateDefinition as za, isCostBudgetDefinition as Ba, isEmptyTenantScopedRead as Va, isExpectationDefinition as Ha, isExperimentDefinition as Ua, isOrglessUserSubject as Wa, isScheduleDefinition as Ga, isWorkflowEventTriggerDefinition as Ka, listRetentionConflicts as qa, listRetentions as H, loadResourceTuples as Ja, localityAwareSelector as Ya, makeActionRunner as Xa, makeAdvisoryLockCoordinator as Za, makeApiKeyService as Qa, makeApiKeyUsageBuffer as $a, makeApiKeyUsageFlusher as eo, makeAppAccess as to, makeApprovalGate as no, makeAsyncKv as ro, makeAuthMiddlewareLayers as io, makeBufferingSpanProcessor as ao, makeConnectionRegistry as oo, makeConnectionResolver as so, makeConnectionsFacade as co, makeCoordinatedScheduler as lo, makeDataLoader as uo, makeDisconnectConnectionExecutor as fo, makeEffectStoreLayer as po, makeEventPublisher as mo, makeEventsFacade as ho, makeLazyWorkflowFacade as go, makeListConnectionsExecutor as _o, makeMutationOutputCodec as vo, makeMutationRunner as yo, makeOneShotQueryRunner as bo, makeOutboxFacade as xo, makePostCommitWorkflowFacade as So, makeQueryDescriptorProducer as Co, makeQueryFinalizer as wo, makeQueryReauthorizer as To, makeQuerySubscriber as Eo, makeSchemaRegistry as Do, makeStartConnectionExecutor as Oo, makeSubmitTokenExecutor as ko, makeUndoCapture as Ao, makeWorkflowFacade as jo, makeWorkflowFacadeWithCallerContext as Mo, makeWorkflowLayers as No, memoryRywPositionStore as Po, nextFiring as Fo, noopAnalytics as Io, noopAnalyticsSpec as Lo, observedGraph as Ro, onProcessShutdown as U, parseApprovalInterval as zo, powerOfTwoSelector as Bo, recordSubscriptionDelivery as Vo, recordTimelineEvent as Ho, recordWorkflowRun as Uo, redisRywPositionStore as Wo, redoUndoInvocation as Go, registerDefaultTupleSource as Ko, registerRetention as W, registerWakeup as qo, resolveCurrentRegion as Jo, resolveSecretsBackend as Yo, retentionTtlMsFromEnv as G, runProvidedEffect as Xo, runReaction as Zo, sanitizeRedirectTo as Qo, serverOnlyLeaks as $o, setConnectionResolver as K, setSecretsBackend as es, setSystemStoreHandle as ts, settleHandlerBody as ns, singleCoordinator as rs, ssrfGuardHttpClientLayer as is, startRpcServer as as, startScheduler as os, stripForbiddenForWire as ss, sweepRetention as cs, tracingHttpClientLayer as ls, undoCaptureEnabled as us, undoLogExecutor as ds, undoSurfaceEnabled as fs, unresolvedSources as ps, withScopedRequest as ms, wrapStoreWithBootCodec as hs, wrapStoreWithMixinBehaviour as gs } from "@voltro/runtime";
41
- import { isEnvContract as _s } from "@voltro/env";
42
- import { SESSION_COOKIE_NAME as vs, readCookie as ys, resolveOptionalSessionSecrets as bs, verifySessionKeyed as xs } from "@voltro/protocol/session";
43
- import { randomBytes as Ss, randomUUID as Cs } from "node:crypto";
44
- import { Cache as ws, CacheLayer as Ts, InvalidationBus as Es, SemanticCache as Ds } from "@voltro/cache";
45
- import { WEBHOOK_EMIT_EFFECT as Os, buildDeliverWebhookExecute as ks, buildWebhooksService as As, defaultIncomingPath as js, deliverWebhookWorkflow as Ms, makeDeferredEmitHandler as Ns, mountIncomingWebhook as Ps } from "@voltro/plugin-webhooks";
46
- import { Kv as Fs } from "@voltro/kv";
47
- import { FetchHttpClient as Is } from "@effect/platform";
48
- import { getAuthSessionStrategy as Ls } from "@voltro/plugin-auth";
49
- import { collectPublicApiRoutes as Rs, restRoutesToHttpRoutes as zs } from "@voltro/protocol/rest";
50
- import { spawn as Bs } from "node:child_process";
51
- import { watch as Vs } from "chokidar";
52
- import { agentRouteDescriptors as Hs } from "@voltro/ai/agent";
53
- import { ArrayFormatter as Us } from "effect/ParseResult";
54
- import { isEmailTemplate as Ws, registerEmailTemplates as Gs } from "@voltro/plugin-mail";
55
- import { attachBroadcastBus as Ks, channelFor as qs, describeNamespaceResolution as Js, eventChannelFor as Ys, getBroadcastPlugin as Xs, resolveBroadcastNamespace as Zs } from "@voltro/plugin-broadcast";
56
- import { runImport as Qs } from "@voltro/data-transfer";
57
- import { createServer as $s } from "node:http";
40
+ import { AggregateError as Ii, AggregateMaintainer as Li, AggregateNotFound as Ri, AggregateRegistry as zi, AggregateStale as Bi, AnalyticsSink as Vi, CostRegistry as Hi, DEFAULT_APPROVAL_EXPIRY_MS as Ui, DORMANCY_WAKEUP_TENANT as Wi, Dispatcher as Gi, EventBus as Ki, ExpectationRegistry as qi, ExperimentRegistry as Ji, InMemoryDataStore as Yi, InstanceMembership as Xi, NO_ROW_FILTER as Zi, OUTBOX_TABLE as Qi, ReactionRateLimiter as $i, ReplicatedDataStore as ea, SYSTEM_SUBJECT as B, actingUserId as ta, apiKeyManagementRoutes as na, applyPluginRefRules as ra, applyUndoInvocation as ia, approvalsPendingExecutor as aa, assertConnectionCipherConfigured as oa, attachAnalyticsMirror as sa, attachExpectations as ca, attachExperiments as la, attachFinops as ua, awaitServerListening as da, bindEvent as fa, bindMutation as pa, bindStream as ma, bindSubscription as ha, buildTracingLayer as ga, cacheScopeLeaks as _a, cancelWakeup as va, collectPluginRefRules as ya, compileCron as ba, completeOAuthConnect as xa, cronOccurrences as Sa, dataStoreApiKeyStore as Ca, dataStoreIdempotencyStore as wa, decideApprovalInvocation as Ta, defineSchedule as Ea, drainOutbox as Da, enableGraphObservation as Oa, enterRequestLoader as V, extractDbCause as ka, formatCacheScopeLeaks as Aa, formatServerOnlyLeaks as ja, formatUnresolvedSources as Ma, frameworkApiKeyStrategy as Na, getFieldCipher as Pa, getResourcePolicy as Fa, getTimelineRecorder as Ia, installApprovalGate as La, installPolicyGuardResolver as Ra, isAggregateDefinition as H, isCostBudgetDefinition as za, isEmptyTenantScopedRead as Ba, isExpectationDefinition as Va, isExperimentDefinition as Ha, isOrglessUserSubject as Ua, isScheduleDefinition as Wa, isWorkflowEventTriggerDefinition as Ga, listRetentionConflicts as Ka, listRetentions as U, loadResourceTuples as qa, localityAwareSelector as Ja, makeActionRunner as Ya, makeAdvisoryLockCoordinator as Xa, makeApiKeyService as Za, makeApiKeyUsageBuffer as Qa, makeApiKeyUsageFlusher as $a, makeAppAccess as eo, makeApprovalGate as to, makeAsyncKv as no, makeAuthMiddlewareLayers as ro, makeBufferingSpanProcessor as io, makeConnectionRegistry as ao, makeConnectionResolver as oo, makeConnectionsFacade as so, makeCoordinatedScheduler as co, makeDataLoader as lo, makeDisconnectConnectionExecutor as uo, makeEffectStoreLayer as fo, makeEventPublisher as po, makeEventsFacade as mo, makeLazyWorkflowFacade as ho, makeListConnectionsExecutor as go, makeMutationOutputCodec as _o, makeMutationRunner as vo, makeOneShotQueryRunner as yo, makeOutboxFacade as bo, makePostCommitWorkflowFacade as xo, makeQueryDescriptorProducer as So, makeQueryFinalizer as Co, makeQueryReauthorizer as wo, makeQuerySubscriber as To, makeSchemaRegistry as Eo, makeStartConnectionExecutor as Do, makeSubmitTokenExecutor as Oo, makeUndoCapture as ko, makeWorkflowFacade as Ao, makeWorkflowFacadeWithCallerContext as jo, makeWorkflowLayers as Mo, memoryRywPositionStore as No, nextFiring as Po, noopAnalytics as Fo, noopAnalyticsSpec as Io, observedGraph as Lo, onProcessShutdown as W, parseApprovalInterval as Ro, powerOfTwoSelector as zo, recordSubscriptionDelivery as Bo, recordTimelineEvent as Vo, recordWorkflowRun as Ho, redisRywPositionStore as Uo, redoUndoInvocation as Wo, registerDefaultTupleSource as Go, registerRetention as G, registerWakeup as Ko, resolveCurrentRegion as qo, resolveSecretsBackend as Jo, retentionTtlMsFromEnv as K, runProvidedEffect as Yo, runReaction as Xo, sanitizeRedirectTo as Zo, serverOnlyLeaks as Qo, setConnectionResolver as q, setSecretsBackend as $o, setSystemStoreHandle as es, settleHandlerBody as ts, singleCoordinator as ns, ssrfGuardHttpClientLayer as rs, startRpcServer as is, startScheduler as as, stripForbiddenForWire as os, sweepRetention as ss, tracingHttpClientLayer as cs, undoCaptureEnabled as ls, undoLogExecutor as us, undoSurfaceEnabled as ds, unresolvedSources as fs, withScopedRequest as ps, wrapStoreWithBootCodec as ms, wrapStoreWithMixinBehaviour as hs } from "@voltro/runtime";
41
+ import { isEnvContract as gs } from "@voltro/env";
42
+ import { SESSION_COOKIE_NAME as _s, readCookie as vs, resolveOptionalSessionSecrets as ys, verifySessionKeyed as bs } from "@voltro/protocol/session";
43
+ import { randomBytes as xs, randomUUID as Ss } from "node:crypto";
44
+ import { Cache as Cs, CacheLayer as ws, InvalidationBus as Ts, SemanticCache as Es } from "@voltro/cache";
45
+ import { WEBHOOK_EMIT_EFFECT as Ds, buildDeliverWebhookExecute as Os, buildWebhooksService as ks, defaultIncomingPath as As, deliverWebhookWorkflow as js, makeDeferredEmitHandler as Ms, mountIncomingWebhook as Ns } from "@voltro/plugin-webhooks";
46
+ import { Kv as Ps } from "@voltro/kv";
47
+ import { FetchHttpClient as Fs } from "@effect/platform";
48
+ import { getAuthSessionStrategy as Is } from "@voltro/plugin-auth";
49
+ import { collectPublicApiRoutes as Ls, restRoutesToHttpRoutes as Rs } from "@voltro/protocol/rest";
50
+ import { spawn as zs } from "node:child_process";
51
+ import { watch as Bs } from "chokidar";
52
+ import { agentRouteDescriptors as Vs } from "@voltro/ai/agent";
53
+ import { ArrayFormatter as Hs } from "effect/ParseResult";
54
+ import { isEmailTemplate as Us, registerEmailTemplates as Ws } from "@voltro/plugin-mail";
55
+ import { attachBroadcastBus as Gs, channelFor as Ks, describeNamespaceResolution as qs, eventChannelFor as Js, getBroadcastPlugin as Ys, resolveBroadcastNamespace as Xs } from "@voltro/plugin-broadcast";
56
+ import { runImport as Zs } from "@voltro/data-transfer";
57
+ import { createServer as Qs } from "node:http";
58
58
  //#region src/advisoryGuardAudit.ts
59
- var ec = (e) => {
59
+ var $s = (e) => {
60
60
  let t = [];
61
61
  for (let n of e) for (let e of n) {
62
62
  let n = e.descriptor?.tag;
@@ -68,34 +68,34 @@ var ec = (e) => {
68
68
  } : { tag: n });
69
69
  }
70
70
  return t;
71
- }, tc = (e, t) => {
71
+ }, ec = (e, t) => {
72
72
  let n = bn(e);
73
73
  return n.length === 0 ? 0 : (t(on(n)), n.length);
74
- }, nc = (e, t, n = [], r = 0) => {
74
+ }, tc = (e, t, n = [], r = 0) => {
75
75
  let i = n.length, a = 1 + Math.max(0, r), o = e === void 0 ? void 0 : e * a + i, s = o !== void 0 && t !== void 0 ? o * t : void 0, c = i === 0 ? " No connections outside the pool in this process." : ` PLUS ${i} outside the pool (${n.map((e) => e.reason).join("; ")}) — those do not come out of the pool budget, they come out of the DATABASE's.`, l = r > 0 ? ` This process opens ${a} pools of that size — 1 primary + ${r} read replica(s) (DB_REPLICA_URLS), each with its own DB_MAX_CONNECTIONS.` : "";
76
- if (e === void 0) return "db pool: max per replica UNSET (DB_MAX_CONNECTIONS) — each replica opens the driver's default pool, so the fleet total is that default × replicas. Set DB_MAX_CONNECTIONS so the total stays under your database's connection limit; the pool scales with replicaCount and the database does not." + l + c + rc;
76
+ if (e === void 0) return "db pool: max per replica UNSET (DB_MAX_CONNECTIONS) — each replica opens the driver's default pool, so the fleet total is that default × replicas. Set DB_MAX_CONNECTIONS so the total stays under your database's connection limit; the pool scales with replicaCount and the database does not." + l + c + nc;
77
77
  let u = (r > 0 ? `max × ${a}` : "max") + (i === 0 ? "" : ` + ${i}`), d = r === 0 ? i === 0 ? "" : ` + ${i} = ${o}` : ` → ${u} = ${o} per pod`, f = r === 0 && i === 0 ? "max" : `(${u})`;
78
- return `db pool: max=${e} per replica (DB_MAX_CONNECTIONS)` + d + (s === void 0 ? ` — the fleet opens up to ${f} × replicas connections. Check that against your database's limit before raising replicaCount.` : ` × ${t} replicas = up to ${s} connections. Check that against your database's limit.`) + l + c + rc;
79
- }, rc = " A rolling update runs BOTH generations at once, so budget for (replicas + surge), not replicas — a surge pod that cannot get a connection crashloops, and a rollout that never completes cannot free the connections it is waiting for.", q = (e = process.env) => {
78
+ return `db pool: max=${e} per replica (DB_MAX_CONNECTIONS)` + d + (s === void 0 ? ` — the fleet opens up to ${f} × replicas connections. Check that against your database's limit before raising replicaCount.` : ` × ${t} replicas = up to ${s} connections. Check that against your database's limit.`) + l + c + nc;
79
+ }, nc = " A rolling update runs BOTH generations at once, so budget for (replicas + surge), not replicas — a surge pod that cannot get a connection crashloops, and a rollout that never completes cannot free the connections it is waiting for.", J = (e = process.env) => {
80
80
  let t = e.REPLICA_COUNT;
81
81
  if (t === void 0 || t === "") return;
82
82
  let n = Number(t);
83
83
  return Number.isInteger(n) && n > 0 ? n : void 0;
84
- }, ic = (e, t) => t ? e === "postgres" ? [{ reason: "CDC LISTEN consumer" }] : e === "mysql" || e === "mariadb" ? [{ reason: "binlog CDC reader (replication connection)" }] : [] : [], ac = (e = process.env) => q(e) !== void 0 || (e.DB_MAX_CONNECTIONS ?? "") !== "" || (e.PG_MAX_CONNECTIONS ?? "") !== "" || (e.DB_REPLICA_URLS ?? "") !== "", oc = (e) => {
84
+ }, rc = (e, t) => t ? e === "postgres" ? [{ reason: "CDC LISTEN consumer" }] : e === "mysql" || e === "mariadb" ? [{ reason: "binlog CDC reader (replication connection)" }] : [] : [], ic = (e = process.env) => J(e) !== void 0 || (e.DB_MAX_CONNECTIONS ?? "") !== "" || (e.PG_MAX_CONNECTIONS ?? "") !== "" || (e.DB_REPLICA_URLS ?? "") !== "", ac = (e) => {
85
85
  let t = e.env ?? process.env;
86
- return !e.always && !ac(t) ? !1 : (e.log.info(nc(e.max, q(t), e.outOfPool, e.readPools ?? 0)), !0);
87
- }, sc = /* @__PURE__ */ new Set([
86
+ return !e.always && !ic(t) ? !1 : (e.log.info(tc(e.max, J(t), e.outOfPool, e.readPools ?? 0)), !0);
87
+ }, oc = /* @__PURE__ */ new Set([
88
88
  "_voltro_workflow_runs",
89
89
  "_voltro_workflow_run_events",
90
90
  "_voltro_workflow_start_contexts"
91
- ]), cc = {
91
+ ]), sc = {
92
92
  publishWake: () => {},
93
93
  active: !1,
94
94
  cdcActive: !1,
95
95
  detach: async () => {}
96
- }, lc = async (e) => {
96
+ }, cc = async (e) => {
97
97
  let t = e.provider !== void 0 && e.crossReplica;
98
- if (!t && e.onChange === void 0) return cc;
98
+ if (!t && e.onChange === void 0) return sc;
99
99
  let n = (t) => {
100
100
  let n = !1;
101
101
  return () => {
@@ -122,15 +122,15 @@ var ec = (e) => {
122
122
  let c;
123
123
  if (e.onChange !== void 0) try {
124
124
  c = e.onChange((e) => {
125
- e.origin === "injected" && sc.has(e.table) && e.op !== "delete" && i();
125
+ e.origin === "injected" && oc.has(e.table) && e.op !== "delete" && i();
126
126
  }), e.log.info("workflow wake: change-stream wake enabled", {
127
- tables: [...sc],
127
+ tables: [...oc],
128
128
  coalesceMs: 200
129
129
  });
130
130
  } catch (t) {
131
131
  e.log.warn("workflow wake: change-stream subscribe failed — falling back to the poll interval", { reason: t?.message ?? String(t) });
132
132
  }
133
- return !s && c === void 0 ? cc : {
133
+ return !s && c === void 0 ? sc : {
134
134
  publishWake: o,
135
135
  active: s,
136
136
  cdcActive: c !== void 0,
@@ -143,7 +143,7 @@ var ec = (e) => {
143
143
  } catch {}
144
144
  }
145
145
  };
146
- }, uc = (e) => {
146
+ }, lc = (e) => {
147
147
  let t = e;
148
148
  return {
149
149
  name: t.name,
@@ -151,15 +151,15 @@ var ec = (e) => {
151
151
  output: t.element,
152
152
  error: t.error
153
153
  };
154
- }, dc = (e, t) => [
154
+ }, uc = (e, t) => [
155
155
  ...e.queries.map((e) => vt(e.descriptor, "query", zt(t, e.file))),
156
156
  ...e.mutations.map((e) => vt(e.descriptor, "mutation", zt(t, e.file))),
157
157
  ...e.actions.map((e) => vt(e.descriptor, "action", zt(t, e.file))),
158
- ...(e.streams ?? []).map((e) => vt(uc(e.descriptor), "stream", zt(t, e.file)))
159
- ], fc = (e, t) => e.workflows.map((e) => ({
158
+ ...(e.streams ?? []).map((e) => vt(lc(e.descriptor), "stream", zt(t, e.file)))
159
+ ], dc = (e, t) => e.workflows.map((e) => ({
160
160
  tag: String(e.definition.name),
161
161
  file: zt(t, e.file)
162
- })), pc = (e, t) => {
162
+ })), fc = (e, t) => {
163
163
  if (typeof process.getuid != "function") return;
164
164
  let n;
165
165
  try {
@@ -174,21 +174,21 @@ var ec = (e) => {
174
174
  } catch (t) {
175
175
  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.`;
176
176
  }
177
- }, mc = ".env.local", hc = (e) => {
177
+ }, pc = ".env.local", mc = (e) => {
178
178
  let t = N(e, ".gitignore"), n = "";
179
179
  try {
180
180
  Ut(t) && (n = Gt(t, "utf8"));
181
181
  } catch {
182
182
  return !1;
183
183
  }
184
- if (n.split(/\r?\n/).map((e) => e.trim()).some((e) => e === mc || e === `/${mc}` || e === ".env*" || e === ".env.*" || e === ".env.local*")) return !0;
184
+ if (n.split(/\r?\n/).map((e) => e.trim()).some((e) => e === pc || e === `/${pc}` || e === ".env*" || e === ".env.*" || e === ".env.local*")) return !0;
185
185
  try {
186
186
  let e = n === "" || n.endsWith("\n") ? "" : "\n";
187
- return Vt(t, `${e}\n# Local secrets minted by \`voltro dev\` — machine-specific, never commit.\n${mc}\n`, "utf8"), !0;
187
+ return Vt(t, `${e}\n# Local secrets minted by \`voltro dev\` — machine-specific, never commit.\n${pc}\n`, "utf8"), !0;
188
188
  } catch {
189
189
  return !1;
190
190
  }
191
- }, gc = (e) => Ss(32).toString(e), J = [{
191
+ }, hc = (e) => xs(32).toString(e), Y = [{
192
192
  key: "VOLTRO_INSPECT_TOKEN",
193
193
  encoding: "base64url",
194
194
  description: "Bearer token for /_voltro/inspect/* — minted so the dev inspect surface is not open to the network."
@@ -196,13 +196,13 @@ var ec = (e) => {
196
196
  key: "VOLTRO_INSPECT_WRITE_TOKEN",
197
197
  encoding: "base64url",
198
198
  description: "Second factor for MUTATING /_voltro/inspect/* endpoints (GDPR erase/export, storage share/revoke)."
199
- }], _c = (e, t, n = process.env) => {
199
+ }], gc = (e, t, n = process.env) => {
200
200
  let r = [];
201
- for (let e of J) {
201
+ for (let e of Y) {
202
202
  let t = n[e.key];
203
203
  (t === void 0 || t.trim() === "") && r.push({
204
204
  key: e.key,
205
- value: gc(e.encoding),
205
+ value: hc(e.encoding),
206
206
  description: e.description
207
207
  });
208
208
  }
@@ -211,13 +211,13 @@ var ec = (e) => {
211
211
  let e = n[t];
212
212
  (e === void 0 || e.trim() === "") && r.push({
213
213
  key: t,
214
- value: gc(i.generate),
214
+ value: hc(i.generate),
215
215
  description: i.description
216
216
  });
217
217
  }
218
218
  if (r.length === 0) return { minted: [] };
219
- if (!hc(t)) throw Error(`cannot mint ${r.map((e) => e.key).join(", ")}: failed to add "${mc}" to ${N(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\`).`);
220
- let i = N(t, mc), a = r.map((e) => `${e.description ? `# ${e.description}\n` : ""}${e.key}=${e.value}`).join("\n"), o;
219
+ if (!mc(t)) throw Error(`cannot mint ${r.map((e) => e.key).join(", ")}: failed to add "${pc}" to ${N(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\`).`);
220
+ let i = N(t, pc), a = r.map((e) => `${e.description ? `# ${e.description}\n` : ""}${e.key}=${e.value}`).join("\n"), o;
221
221
  try {
222
222
  if (Ut(i)) {
223
223
  let e = Gt(i, "utf8"), t = e === "" || e.endsWith("\n") ? "" : "\n";
@@ -228,7 +228,7 @@ var ec = (e) => {
228
228
  \n${a}\n`, {
229
229
  encoding: "utf8",
230
230
  mode: 384
231
- }), o = pc(i, t);
231
+ }), o = fc(i, t);
232
232
  } catch (e) {
233
233
  throw Error(`cannot mint ${r.map((e) => e.key).join(", ")}: failed to write ${i} — ${e.message}`);
234
234
  }
@@ -238,7 +238,7 @@ var ec = (e) => {
238
238
  file: i,
239
239
  ...o ? { ownershipWarning: o } : {}
240
240
  };
241
- }, vc = [".framework", ".env.local"], yc = /\.generated\./i, bc = (e) => {
241
+ }, _c = [".framework", ".env.local"], vc = /\.generated\./i, yc = (e) => {
242
242
  try {
243
243
  let t = Kt(e);
244
244
  return {
@@ -248,7 +248,7 @@ var ec = (e) => {
248
248
  } catch {
249
249
  return;
250
250
  }
251
- }, xc = (e, t, n) => {
251
+ }, bc = (e, t, n) => {
252
252
  let r = !0;
253
253
  try {
254
254
  Ht(e, t, n);
@@ -262,28 +262,28 @@ var ec = (e) => {
262
262
  } catch {
263
263
  return r;
264
264
  }
265
- for (let a of i) xc(N(e, a), t, n) || (r = !1);
265
+ for (let a of i) bc(N(e, a), t, n) || (r = !1);
266
266
  return r;
267
- }, Sc = (e) => {
267
+ }, xc = (e) => {
268
268
  if (typeof process.getuid != "function") return { adopted: [] };
269
- let t = bc(e);
269
+ let t = yc(e);
270
270
  if (t === void 0) return { adopted: [] };
271
271
  let n = process.getuid();
272
272
  if (t.uid === n) return { adopted: [] };
273
- let r = [...vc];
273
+ let r = [..._c];
274
274
  try {
275
- for (let t of P(e)) yc.test(t) && r.push(t);
275
+ for (let t of P(e)) vc.test(t) && r.push(t);
276
276
  } catch {}
277
277
  let i = [], a = !1;
278
278
  for (let n of r) {
279
279
  let r = N(e, n);
280
- bc(r) !== void 0 && (xc(r, t.uid, t.gid) ? i.push(n) : a = !0);
280
+ yc(r) !== void 0 && (bc(r, t.uid, t.gid) ? i.push(n) : a = !0);
281
281
  }
282
282
  return a ? {
283
283
  adopted: i,
284
284
  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}\`).`
285
285
  } : { adopted: i };
286
- }, Cc = (e) => {
286
+ }, Sc = (e) => {
287
287
  let t = Number(e.REPLICA_COUNT);
288
288
  if (Number.isFinite(t) && t >= 1) return t > 1 ? `REPLICA_COUNT=${t}` : null;
289
289
  for (let [t, n] of [
@@ -299,27 +299,27 @@ var ec = (e) => {
299
299
  ["RENDER_INSTANCE_ID", "Render"]
300
300
  ]) if ((e[t] ?? "") !== "") return `${t} is set (${n})`;
301
301
  return null;
302
- }, wc = (e) => e.startsWith("_voltro_"), Tc = (e) => e === void 0 || e === "" || !/^file:/i.test(e) || (process.env.TURSO_SYNC_URL ?? "") !== "", Ec = (e) => {
303
- if (e.dialect === "turso" && Tc(e.dbUrl)) return [{
302
+ }, Cc = (e) => e.startsWith("_voltro_"), wc = (e) => e === void 0 || e === "" || !/^file:/i.test(e) || (process.env.TURSO_SYNC_URL ?? "") !== "", Tc = (e) => {
303
+ if (e.dialect === "turso" && wc(e.dbUrl)) return [{
304
304
  level: "warn",
305
305
  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."
306
306
  }];
307
307
  if (e.dialect === "sqlite" || e.dialect === "memory") {
308
- let t = e.crossReplicaBus ? null : Cc(e.env ?? process.env);
308
+ let t = e.crossReplicaBus ? null : Sc(e.env ?? process.env);
309
309
  if (t !== null) return [{
310
310
  level: "warn",
311
311
  message: `this app runs on '${e.dialect}' — a ${e.dialect === "memory" ? "process-local store" : "local database file"} — but ${t}, which means several replicas. Neither dialect has ANY cross-instance change capture: a client connected to replica A never sees a write made on replica B, for every table, and each replica is also reading its OWN data. Nothing here will error — the app looks healthy and serves stale views. Use postgres (LISTEN/NOTIFY) or mysql/mariadb (binlog CDC) for a shared, reactive database; or run a SINGLE replica and set REPLICA_COUNT=1 to silence this. Adding @voltro/plugin-broadcast fans CHANGES out but does not give the replicas one database, so it silences this warning only because a bus means you have already thought about it.`
312
312
  }];
313
313
  }
314
314
  if (e.changeStrategy !== "cdc" || e.dialect === "sqlite" || e.dialect === "turso") return [];
315
- let t = new Set(e.querySources.filter((e) => !wc(e))), n = e.tables.filter((e) => !wc(e.tableName)).filter((e) => e.isReactive === !1 && t.has(e.tableName)).map((e) => e.tableName).sort();
315
+ let t = new Set(e.querySources.filter((e) => !Cc(e))), n = e.tables.filter((e) => !Cc(e.tableName)).filter((e) => e.isReactive === !1 && t.has(e.tableName)).map((e) => e.tableName).sort();
316
316
  if (n.length === 0) return [];
317
317
  let r = n.slice(0, 8).join(", "), i = n.length > 8 ? `, … (+${n.length - 8})` : "";
318
318
  return [{
319
319
  level: "warn",
320
320
  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.`
321
321
  }];
322
- }, Dc = (e, t) => {
322
+ }, Ec = (e, t) => {
323
323
  let n = e.length + 1, r = t.length + 1, i = Array.from({ length: r }, (e, t) => t);
324
324
  for (let a = 1; a < n; a += 1) {
325
325
  let n = [a, ...Array.from({ length: r - 1 }, () => 0)];
@@ -327,16 +327,16 @@ var ec = (e) => {
327
327
  i = n;
328
328
  }
329
329
  return i[r - 1];
330
- }, Oc = (e, t) => {
330
+ }, Dc = (e, t) => {
331
331
  let n = t.find((t) => t.endsWith(`_${e}`) || t === `_voltro_${e}`);
332
332
  if (n !== void 0) return n;
333
333
  let r, i = Infinity;
334
334
  for (let n of t) {
335
- let t = Dc(e, n);
335
+ let t = Ec(e, n);
336
336
  t < i && (i = t, r = n);
337
337
  }
338
338
  return r !== void 0 && i <= Math.max(2, Math.floor(e.length / 3)) ? r : void 0;
339
- }, kc = (e) => {
339
+ }, Oc = (e) => {
340
340
  let t = e.tables.map((e) => e.tableName), n = new Set(t), r = vn(), i = [];
341
341
  for (let a of e.queries) for (let e of An(a.source)) {
342
342
  if (e === "") continue;
@@ -350,7 +350,7 @@ var ec = (e) => {
350
350
  continue;
351
351
  }
352
352
  if (n.has(e)) continue;
353
- let o = Oc(e, t);
353
+ let o = Dc(e, t);
354
354
  i.push({
355
355
  query: a.name,
356
356
  source: e,
@@ -358,14 +358,14 @@ var ec = (e) => {
358
358
  });
359
359
  }
360
360
  return i;
361
- }, Ac = (e) => {
361
+ }, kc = (e) => {
362
362
  if (e.length === 0) return;
363
363
  let t = e.map((e) => e.channel === !0 ? ` ${e.query}: source '${e.source}' is not a declared reactivity channel` : ` ${e.query}: source '${e.source}' is not a declared table` + (e.suggestion === void 0 ? "" : ` — did you mean '${e.suggestion}'?`)), n = e.some((e) => e.channel === !0) ? "\n For the `channel:` entries: declare it with `reactivityChannel(<name>)` and pass the CHANNEL\n as `source:` rather than its key as a string — the import edge is what makes a channel\n source impossible to leave stale." : "";
364
364
  return `${e.length} quer${e.length === 1 ? "y declares" : "ies declare"} a \`source\` that names no table:\n${t.join("\n")}\n A \`source\` is matched BY NAME against change events, so one naming a table that does not\n exist matches nothing: the query returns its first result and never updates again. That is\n not an error at any layer — it is silence, and it looks exactly like "nothing has changed".` + n;
365
- }, jc = "VOLTRO_REMOTE_MIGRATIONS_OK", Mc = /^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/, Nc = (e) => {
365
+ }, Ac = "VOLTRO_REMOTE_MIGRATIONS_OK", jc = /^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/, Mc = (e) => {
366
366
  let t = e.toLowerCase().replace(/^\[|\]$/g, "");
367
- 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") || Mc.test(t) || !t.includes(".") && !t.includes(":"));
368
- }, Pc = (e) => {
367
+ 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") || jc.test(t) || !t.includes(".") && !t.includes(":"));
368
+ }, Nc = (e) => {
369
369
  if (e.url !== void 0 && e.url !== "") {
370
370
  if (/^(file|sqlite):/i.test(e.url)) return {
371
371
  kind: "local",
@@ -374,7 +374,7 @@ var ec = (e) => {
374
374
  try {
375
375
  let t = new URL(e.url).hostname;
376
376
  return {
377
- kind: Nc(t) ? "local" : "remote",
377
+ kind: Mc(t) ? "local" : "remote",
378
378
  host: t
379
379
  };
380
380
  } catch {
@@ -386,12 +386,12 @@ var ec = (e) => {
386
386
  }
387
387
  let t = e.host ?? "localhost";
388
388
  return {
389
- kind: Nc(t) ? "local" : "remote",
389
+ kind: Mc(t) ? "local" : "remote",
390
390
  host: t
391
391
  };
392
- }, Fc = (e) => {
392
+ }, Pc = (e) => {
393
393
  if (e.pendingIds.length === 0 || e.optIn) return { allowed: !0 };
394
- let t = Pc(e.conn);
394
+ let t = Nc(e.conn);
395
395
  if (t.kind === "local") return { allowed: !0 };
396
396
  let n = e.pendingIds.map((e) => ` • ${e}`).join("\n");
397
397
  return {
@@ -410,16 +410,16 @@ var ec = (e) => {
410
410
  " Choose one:",
411
411
  " • Point the app at a local database (DB_URL), which is what dev boot assumes.",
412
412
  " • Apply them deliberately, once: voltro db files .",
413
- ` • Accept it for this environment: ${jc}=1`
413
+ ` • Accept it for this environment: ${Ac}=1`
414
414
  ].join("\n")
415
415
  };
416
- }, Ic = async ({ env: e = process.env, semantic: t = !1 } = {}) => {
416
+ }, Fc = async ({ env: e = process.env, semantic: t = !1 } = {}) => {
417
417
  let n, r;
418
418
  if (t) {
419
- let e = $n.make(I.mergeAll(ws.Default, Ds.Default, Es.Default).pipe(I.provide(Ts.storeLayer)));
420
- r = await e.runPromise(Ds), n = e;
421
- } else n = $n.make(I.mergeAll(Ts.layer, Es.Default)), r = void 0;
422
- let i = await n.runPromise(ws), a = await n.runPromise(Es), o = r, s = o === void 0 ? void 0 : (e) => {
419
+ let e = $n.make(I.mergeAll(Cs.Default, Es.Default, Ts.Default).pipe(I.provide(ws.storeLayer)));
420
+ r = await e.runPromise(Es), n = e;
421
+ } else n = $n.make(I.mergeAll(ws.layer, Ts.Default)), r = void 0;
422
+ let i = await n.runPromise(Cs), a = await n.runPromise(Ts), o = r, s = o === void 0 ? void 0 : (e) => {
423
423
  n.runFork(o.onSourceChange(e));
424
424
  }, c = (e.CACHE_BACKEND ?? "memory").toLowerCase();
425
425
  return await n.runPromise(a.addSink((e) => i.invalidateTag(e))), {
@@ -455,40 +455,40 @@ var ec = (e) => {
455
455
  stats: () => n.runSync(i.stats()),
456
456
  dispose: () => n.dispose()
457
457
  };
458
- }, Lc = (e) => {
458
+ }, Ic = (e) => {
459
459
  let t = e / 36e5;
460
460
  return t < 48 ? `${Math.round(t)}h` : `${Math.round(t / 24)}d`;
461
- }, Rc = ({ store: e, dialect: t, env: n = process.env, log: r }) => {
462
- W({
461
+ }, Lc = ({ store: e, dialect: t, env: n = process.env, log: r }) => {
462
+ G({
463
463
  table: "_voltro_schedule_runs",
464
464
  timeColumn: "scheduledAt",
465
465
  source: "framework",
466
- ttlMs: G(n.VOLTRO_SCHEDULE_RUNS_TTL_HOURS, 720),
466
+ ttlMs: K(n.VOLTRO_SCHEDULE_RUNS_TTL_HOURS, 720),
467
467
  envVar: "VOLTRO_SCHEDULE_RUNS_TTL_HOURS"
468
- }), W({
468
+ }), G({
469
469
  table: "_voltro_schedule_claims",
470
470
  timeColumn: "claimedAt",
471
471
  source: "framework",
472
- ttlMs: G(n.VOLTRO_SCHEDULE_CLAIMS_TTL_HOURS, 24),
472
+ ttlMs: K(n.VOLTRO_SCHEDULE_CLAIMS_TTL_HOURS, 24),
473
473
  envVar: "VOLTRO_SCHEDULE_CLAIMS_TTL_HOURS"
474
- }), W({
474
+ }), G({
475
475
  source: "framework",
476
476
  table: "_voltro_undo_log",
477
477
  timeColumn: "createdAt",
478
- ttlMs: G(n.VOLTRO_UNDO_LOG_TTL_HOURS, 720),
478
+ ttlMs: K(n.VOLTRO_UNDO_LOG_TTL_HOURS, 720),
479
479
  envVar: "VOLTRO_UNDO_LOG_TTL_HOURS"
480
- }), W({
480
+ }), G({
481
481
  source: "framework",
482
482
  table: "_voltro_workflow_admissions",
483
483
  timeColumn: "admittedAt",
484
- ttlMs: G(n.VOLTRO_WORKFLOW_ADMISSIONS_TTL_HOURS, 720),
484
+ ttlMs: K(n.VOLTRO_WORKFLOW_ADMISSIONS_TTL_HOURS, 720),
485
485
  envVar: "VOLTRO_WORKFLOW_ADMISSIONS_TTL_HOURS",
486
486
  where: bi("releasedAt")
487
- }), W({
487
+ }), G({
488
488
  source: "framework",
489
489
  table: "_voltro_workflow_start_contexts",
490
490
  timeColumn: "createdAt",
491
- ttlMs: G(n.VOLTRO_WORKFLOW_START_CONTEXTS_TTL_HOURS, 720),
491
+ ttlMs: K(n.VOLTRO_WORKFLOW_START_CONTEXTS_TTL_HOURS, 720),
492
492
  envVar: "VOLTRO_WORKFLOW_START_CONTEXTS_TTL_HOURS",
493
493
  where: Ti("executionId", {
494
494
  table: "_voltro_workflow_runs",
@@ -498,37 +498,37 @@ var ec = (e) => {
498
498
  take: void 0,
499
499
  skip: void 0
500
500
  })
501
- }), W({
501
+ }), G({
502
502
  table: "_voltro_workflow_runs",
503
503
  timeColumn: "completedAt",
504
504
  source: "framework",
505
- ttlMs: G(n.VOLTRO_WORKFLOW_RUNS_TTL_HOURS, 720),
505
+ ttlMs: K(n.VOLTRO_WORKFLOW_RUNS_TTL_HOURS, 720),
506
506
  envVar: "VOLTRO_WORKFLOW_RUNS_TTL_HOURS",
507
507
  where: Ei(z("status", "succeeded"), z("status", "failed"), z("status", "cancelled"))
508
- }), W({
508
+ }), G({
509
509
  table: "_voltro_outbox_attempts",
510
510
  timeColumn: "startedAt",
511
511
  source: "framework",
512
- ttlMs: G(n.VOLTRO_OUTBOX_ATTEMPTS_TTL_HOURS, 720),
512
+ ttlMs: K(n.VOLTRO_OUTBOX_ATTEMPTS_TTL_HOURS, 720),
513
513
  envVar: "VOLTRO_OUTBOX_ATTEMPTS_TTL_HOURS"
514
- }), W({
514
+ }), G({
515
515
  table: "_voltro_outbox",
516
516
  timeColumn: "deliveredAt",
517
517
  source: "framework",
518
- ttlMs: G(n.VOLTRO_OUTBOX_TTL_HOURS, 720),
518
+ ttlMs: K(n.VOLTRO_OUTBOX_TTL_HOURS, 720),
519
519
  envVar: "VOLTRO_OUTBOX_TTL_HOURS",
520
520
  where: z("status", "delivered")
521
- }), W({
521
+ }), G({
522
522
  table: "_voltro_workflow_events",
523
523
  timeColumn: "occurredAt",
524
524
  source: "framework",
525
- ttlMs: G(n.VOLTRO_WORKFLOW_EVENTS_TTL_HOURS, 720),
525
+ ttlMs: K(n.VOLTRO_WORKFLOW_EVENTS_TTL_HOURS, 720),
526
526
  envVar: "VOLTRO_WORKFLOW_EVENTS_TTL_HOURS"
527
- }), W({
527
+ }), G({
528
528
  table: "_voltro_workflow_event_deliveries",
529
529
  timeColumn: "createdAt",
530
530
  source: "framework",
531
- ttlMs: G(n.VOLTRO_WORKFLOW_EVENT_DELIVERIES_TTL_HOURS, 720),
531
+ ttlMs: K(n.VOLTRO_WORKFLOW_EVENT_DELIVERIES_TTL_HOURS, 720),
532
532
  envVar: "VOLTRO_WORKFLOW_EVENT_DELIVERIES_TTL_HOURS"
533
533
  });
534
534
  let i = t === "postgres" ? e.raw?.bind(e) : void 0, a = (e) => {
@@ -564,17 +564,17 @@ var ec = (e) => {
564
564
  }
565
565
  }, s = async () => {
566
566
  let e = Date.now();
567
- for (let t of H()) try {
568
- await cs(t, e, o, 2e4);
567
+ for (let t of U()) try {
568
+ await ss(t, e, o, 2e4);
569
569
  } catch {}
570
- }, c = H();
570
+ }, c = U();
571
571
  if (c.length > 0) {
572
572
  r?.info?.(`retention: ${c.length} policy(ies) armed — rows older than the TTL are DELETED`);
573
573
  for (let e of [...c].sort((e, t) => e.table.localeCompare(t.table))) {
574
574
  let t = e.where === void 0 ? "every row" : "matching rows only";
575
- r?.info?.(` · ${e.table}: ${t} older than ${Lc(e.ttlMs)} by ${e.timeColumn}${e.envVar === void 0 ? "" : ` (${e.envVar})`}`);
575
+ r?.info?.(` · ${e.table}: ${t} older than ${Ic(e.ttlMs)} by ${e.timeColumn}${e.envVar === void 0 ? "" : ` (${e.envVar})`}`);
576
576
  }
577
- for (let e of qa()) r?.info?.(` ! ${e.table}: two registrations — kept the ${e.kept.source}'s ${Lc(e.kept.ttlMs)}, dropped the ${e.dropped.source}'s ${Lc(e.dropped.ttlMs)}. An app registration wins over a plugin's, and a plugin's over a framework default.`);
577
+ for (let e of Ka()) r?.info?.(` ! ${e.table}: two registrations — kept the ${e.kept.source}'s ${Ic(e.kept.ttlMs)}, dropped the ${e.dropped.source}'s ${Ic(e.dropped.ttlMs)}. An app registration wins over a plugin's, and a plugin's over a framework default.`);
578
578
  }
579
579
  let l = setTimeout(() => {
580
580
  s();
@@ -586,12 +586,12 @@ var ec = (e) => {
586
586
  return u.unref?.(), { stop: () => {
587
587
  clearTimeout(l), clearInterval(u);
588
588
  } };
589
- }, zc = (e) => {
589
+ }, Rc = (e) => {
590
590
  if (typeof e == "string") return e;
591
591
  let t = e;
592
592
  if (typeof t?.id == "string") return t.id;
593
593
  if (typeof t?.name == "string") return t.name;
594
- }, Y = (e, t) => {
594
+ }, zc = (e, t) => {
595
595
  let n = { tenantId: t.tenantId ?? null }, r = t.afterCommit, i = t.enqueue;
596
596
  return new Proxy(e, { get: (e, a, o) => a === "subscribe" ? (n) => typeof n != "object" || !n ? e.subscribe(n) : e.subscribe(n.tenantId === void 0 ? {
597
597
  ...n,
@@ -599,8 +599,8 @@ var ec = (e) => {
599
599
  } : n) : a === "emit" ? (t, a, o) => {
600
600
  let s = o?.tenantId === void 0 ? n : o;
601
601
  if (o?.immediate === !0 || r === void 0) return e.emit(t, a, s);
602
- let c = zc(t);
603
- return i !== void 0 && c !== void 0 ? i(Os, {
602
+ let c = Rc(t);
603
+ return i !== void 0 && c !== void 0 ? i(Ds, {
604
604
  event: c,
605
605
  payload: a,
606
606
  tenantId: s.tenantId ?? null
@@ -666,14 +666,14 @@ var ec = (e) => {
666
666
  return r.set(i, c), c;
667
667
  } });
668
668
  }, Uc = (e) => {
669
- let t = uo({ store: e.store });
669
+ let t = lo({ store: e.store });
670
670
  return V(t), {
671
- storeForTenant: (t) => gs(e.store, {
671
+ storeForTenant: (t) => hs(e.store, {
672
672
  subject: Nn(B, t),
673
673
  schemaRegistry: e.schemaRegistry,
674
674
  rowFilter: Zi
675
675
  }),
676
- store: gs(e.store, {
676
+ store: hs(e.store, {
677
677
  subject: B,
678
678
  schemaRegistry: e.schemaRegistry,
679
679
  rowFilter: Zi
@@ -682,7 +682,7 @@ var ec = (e) => {
682
682
  subject: B,
683
683
  traceId: "webhooks:trigger"
684
684
  },
685
- access: to(B),
685
+ access: eo(B),
686
686
  load: t.load,
687
687
  loadMany: t.loadMany,
688
688
  cache: e.cache,
@@ -696,13 +696,13 @@ var ec = (e) => {
696
696
  return e.ensureTenantProvisioned === void 0 ? i : Hc(i, r, e.ensureTenantProvisioned);
697
697
  }, m = (n, r) => e.resolveResidentStore === void 0 || n !== t ? n : e.resolveResidentStore(r);
698
698
  return (e, c = t, h, g = "app-context", _) => {
699
- let v = p(m(c, e.subject), e.subject), ee = o === void 0 ? void 0 : Mo(o, {
699
+ let v = p(m(c, e.subject), e.subject), ee = o === void 0 ? void 0 : jo(o, {
700
700
  subject: e.subject,
701
701
  traceId: e.traceId,
702
702
  source: g,
703
703
  ..._?.parentExecutionId === void 0 ? {} : { parentExecutionId: _.parentExecutionId },
704
704
  ..._?.parentClosePolicy === void 0 ? {} : { parentClosePolicy: _.parentClosePolicy }
705
- }), te = s.length === 0 || o === void 0 ? void 0 : ho({
705
+ }), te = s.length === 0 || o === void 0 ? void 0 : mo({
706
706
  triggers: s,
707
707
  store: p(t, e.subject),
708
708
  source: g,
@@ -710,8 +710,8 @@ var ec = (e) => {
710
710
  traceId: e.traceId,
711
711
  ...l === void 0 ? {} : { emit: l },
712
712
  ..._?.parentExecutionId === void 0 ? {} : { parentExecutionId: _.parentExecutionId },
713
- startWorkflow: (e, t, n) => Mo(o, n).start(e, t)
714
- }), y = f === void 0 ? void 0 : mo({
713
+ startWorkflow: (e, t, n) => jo(o, n).start(e, t)
714
+ }), ne = f === void 0 ? void 0 : po({
715
715
  bus: f,
716
716
  tenantId: e.subject.tenantId ?? null,
717
717
  ...h === void 0 ? {} : { deferToCommit: (e) => {
@@ -722,48 +722,48 @@ var ec = (e) => {
722
722
  onPublished: (e, t, n) => {
723
723
  te !== void 0 && te.emit(e, t).catch(() => {}), n.webhook !== void 0 && a !== void 0 && a.emit(n, t).catch(() => {});
724
724
  }
725
- }), b = u === void 0 ? void 0 : xo({
725
+ }), y = u === void 0 ? void 0 : bo({
726
726
  store: v,
727
727
  subject: e.subject,
728
728
  traceId: e.traceId,
729
729
  nudge: u.nudge,
730
730
  ...h === void 0 ? {} : { afterCommit: h.afterCommit }
731
- }), x = d === void 0 ? void 0 : co({
731
+ }), b = d === void 0 ? void 0 : so({
732
732
  store: v,
733
733
  registry: d.registry,
734
734
  subject: e.subject
735
- }), S = uo({ store: v });
736
- V(S);
737
- let C = e.rowFilter === void 0 ? {} : { rowFilter: e.rowFilter };
735
+ }), x = lo({ store: v });
736
+ V(x);
737
+ let S = e.rowFilter === void 0 ? {} : { rowFilter: e.rowFilter };
738
738
  return {
739
739
  storeForTenant: (t) => {
740
740
  let r = Nn(e.subject, t);
741
- return gs(p(m(c, r), r), {
741
+ return hs(p(m(c, r), r), {
742
742
  subject: r,
743
743
  schemaRegistry: n,
744
- ...C
744
+ ...S
745
745
  });
746
746
  },
747
- store: gs(v, {
747
+ store: hs(v, {
748
748
  subject: e.subject,
749
749
  schemaRegistry: n,
750
750
  ...e.rowFilter === void 0 ? {} : { rowFilter: e.rowFilter }
751
751
  }),
752
- load: S.load,
753
- loadMany: S.loadMany,
752
+ load: x.load,
753
+ loadMany: x.loadMany,
754
754
  request: e,
755
- access: to(e.subject),
755
+ access: eo(e.subject),
756
756
  cache: r,
757
757
  kv: i,
758
- ...a === void 0 ? {} : { webhooks: Y(a, {
758
+ ...a === void 0 ? {} : { webhooks: zc(a, {
759
759
  tenantId: e.subject.tenantId ?? null,
760
760
  ...h === void 0 ? {} : { afterCommit: h.afterCommit },
761
- ...b === void 0 ? {} : { enqueue: (e, t) => b.enqueue(e, t) }
761
+ ...y === void 0 ? {} : { enqueue: (e, t) => y.enqueue(e, t) }
762
762
  }) },
763
- ...y === void 0 ? {} : { events: y },
764
- ...b === void 0 ? {} : { outbox: b },
765
- ...x === void 0 ? {} : { connections: x },
766
- ...ee === void 0 ? {} : { workflows: h ? So(ee, h.afterCommit) : ee }
763
+ ...ne === void 0 ? {} : { events: ne },
764
+ ...y === void 0 ? {} : { outbox: y },
765
+ ...b === void 0 ? {} : { connections: b },
766
+ ...ee === void 0 ? {} : { workflows: h ? xo(ee, h.afterCommit) : ee }
767
767
  };
768
768
  };
769
769
  }, Gc = async (e, t, n) => {
@@ -777,8 +777,8 @@ var ec = (e) => {
777
777
  take: 1
778
778
  }))[0], a = i?.subject?.tenantId ?? null, o = t.tenantId ?? null;
779
779
  if (i === void 0 || a !== o) throw new tn({ reason: "not authorized for this workflow run" });
780
- }, Kc = (e = {}) => ls.pipe(I.provide(is(e)), I.provide(Is.layer), I.provide(I.succeed(Is.RequestInit, { redirect: "manual" }))), qc = (e) => {
781
- let t = I.succeed(ws, e.cacheService), n = I.succeed(Fs, e.kvService), r = e.semanticCache === void 0 ? [] : [I.succeed(Ds, e.semanticCache)], i = [
780
+ }, Kc = (e = {}) => cs.pipe(I.provide(rs(e)), I.provide(Fs.layer), I.provide(I.succeed(Fs.RequestInit, { redirect: "manual" }))), qc = (e) => {
781
+ let t = I.succeed(Cs, e.cacheService), n = I.succeed(Ps, e.kvService), r = e.semanticCache === void 0 ? [] : [I.succeed(Es, e.semanticCache)], i = [
782
782
  e.analyticsLayer,
783
783
  t,
784
784
  n,
@@ -809,12 +809,12 @@ var ec = (e) => {
809
809
  ttlMs: n?.ttlMs ?? 864e5
810
810
  };
811
811
  }, Zc = (e) => {
812
- let t = Rs(e.publicApiEntries ?? []), n = [...e.restRoutes ?? [], ...t];
812
+ let t = Ls(e.publicApiEntries ?? []), n = [...e.restRoutes ?? [], ...t];
813
813
  if (n.length === 0) return {
814
814
  routes: [],
815
815
  httpRoutes: []
816
816
  };
817
- let r = zs(n, {
817
+ let r = Rs(n, {
818
818
  store: e.store,
819
819
  resolveSubject: e.resolveSubject,
820
820
  ...e.idempotency === void 0 ? {} : { idempotency: e.idempotency }
@@ -844,7 +844,7 @@ var ec = (e) => {
844
844
  }, o = (e) => zt(a(e), e), s = (e) => {
845
845
  let t = a(e);
846
846
  return t === r ? o(e) : zt(Rt(Rt(t)), e);
847
- }, c = Vs(i, {
847
+ }, c = Bs(i, {
848
848
  persistent: !0,
849
849
  ignoreInitial: !0,
850
850
  atomic: !0,
@@ -900,7 +900,7 @@ var ec = (e) => {
900
900
  }), ll = "voltro:dev:ready", ul = (e, t = () => {}) => F.acquireUseRelease(F.sync(() => {
901
901
  let n = process.argv[1] ?? "", r = xt(), i = bt(r);
902
902
  i !== void 0 && X.warn(i);
903
- let a = Bs(process.execPath, [
903
+ let a = zs(process.execPath, [
904
904
  ...r.execArgv,
905
905
  n,
906
906
  "dev",
@@ -966,14 +966,14 @@ var ec = (e) => {
966
966
  process.exitCode = u;
967
967
  });
968
968
  }), pl = async (e) => {
969
- let t = e.spec ?? Lo, n;
969
+ let t = e.spec ?? Io, n;
970
970
  return t.kind !== "noop" && e.sqlLayer !== void 0 ? n = await F.runPromise(F.gen(function* () {
971
971
  let n = yield* nr.SqlClient, r = t.build(n);
972
972
  return t.initialize && (yield* t.initialize(r).pipe(F.catchAll((t) => F.sync(() => e.log.warn("analytics sink initialize failed", {
973
973
  provider: r.info.provider,
974
974
  err: String(t)
975
975
  }))))), r;
976
- }).pipe(F.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 = Io()), e.log.info("analytics sink", {
976
+ }).pipe(F.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 = Fo()), e.log.info("analytics sink", {
977
977
  provider: n.info.provider,
978
978
  capabilities: n.info.capabilities,
979
979
  ...n.info.detail ?? {}
@@ -1039,11 +1039,11 @@ var ec = (e) => {
1039
1039
  return r;
1040
1040
  }, vl = (e, t, n, r, i) => {
1041
1041
  if (e.length === 0) return () => {};
1042
- let a = gs(t, {
1042
+ let a = hs(t, {
1043
1043
  subject: B,
1044
1044
  schemaRegistry: r,
1045
1045
  rowFilter: Zi
1046
- }), o = i === void 0 ? void 0 : mo({
1046
+ }), o = i === void 0 ? void 0 : po({
1047
1047
  bus: i,
1048
1048
  tenantId: B.tenantId ?? null
1049
1049
  }), s = [];
@@ -1057,7 +1057,7 @@ var ec = (e) => {
1057
1057
  ...o === void 0 ? {} : { publish: o.publish }
1058
1058
  };
1059
1059
  try {
1060
- let a = ns(c(t, n));
1060
+ let a = ts(c(t, n));
1061
1061
  a !== void 0 && a.catch((n) => {
1062
1062
  e.warn("subscriber: handler rejected", {
1063
1063
  table: i,
@@ -1203,7 +1203,7 @@ var ec = (e) => {
1203
1203
  isArmed: () => !s && !f
1204
1204
  };
1205
1205
  }, Cl = "<builtin:connections>", wl = {
1206
- registry: oo([]),
1206
+ registry: ao([]),
1207
1207
  queries: [],
1208
1208
  mutations: [],
1209
1209
  actions: [],
@@ -1213,15 +1213,15 @@ var ec = (e) => {
1213
1213
  let { definitions: t, store: n, publicUrl: r, log: i } = e;
1214
1214
  if (t.length === 0) return wl;
1215
1215
  oa(t);
1216
- let a = oo(t), o = {
1216
+ let a = ao(t), o = {
1217
1217
  registry: a,
1218
1218
  publicUrl: r
1219
1219
  };
1220
- K(so({
1220
+ q(oo({
1221
1221
  store: n,
1222
1222
  registry: a
1223
1223
  }));
1224
- let s = _o(o), c = Oo(o), l = ko(o), u = fo(o), d = t.some((e) => e.kind === "oauth2"), f = d ? [{
1224
+ let s = go(o), c = Do(o), l = Oo(o), u = uo(o), d = t.some((e) => e.kind === "oauth2"), f = d ? [{
1225
1225
  method: "GET",
1226
1226
  path: "/_voltro/connections",
1227
1227
  handle: async (e) => {
@@ -1294,7 +1294,7 @@ var ec = (e) => {
1294
1294
  };
1295
1295
  }, El = (e) => ({
1296
1296
  status: 302,
1297
- headers: { location: Qo(e.startsWith("/") ? e : `/${e}`) },
1297
+ headers: { location: Zo(e.startsWith("/") ? e : `/${e}`) },
1298
1298
  body: ""
1299
1299
  }), Dl = (e) => process.env.VOLTRO_PUBLIC_URL?.replace(/\/+$/, "") ?? `http://localhost:${e}`, Ol = class extends Error {
1300
1300
  constructor(e) {
@@ -1609,18 +1609,18 @@ var ec = (e) => {
1609
1609
  }
1610
1610
  return n.authorization = t, n;
1611
1611
  }, ru = async (e, t, n, r, i = {}) => {
1612
- let a = e.includes("?") ? e.slice(0, e.indexOf("?")) : e, o = `${pt}/agent/tools`, s = `${pt}/agent/call`;
1612
+ let a = e.includes("?") ? e.slice(0, e.indexOf("?")) : e, o = `${mt}/agent/tools`, s = `${mt}/agent/call`;
1613
1613
  if (a !== o && a !== s) return null;
1614
- let c = k(n.origin ?? n.Origin), l = (i.method ?? "GET").toUpperCase(), u = (e, t) => ({
1614
+ let c = O(n.origin ?? n.Origin), l = (i.method ?? "GET").toUpperCase(), u = (e, t) => ({
1615
1615
  status: e,
1616
1616
  contentType: "application/json; charset=utf-8",
1617
1617
  body: JSON.stringify(t),
1618
1618
  headers: c
1619
1619
  });
1620
- if (Ke()) return u(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" });
1621
- let d = ot(l, n, c);
1620
+ if (qe()) return u(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" });
1621
+ let d = st(l, n, c);
1622
1622
  if (d !== null) return d;
1623
- let f = (i.authResolver ?? $e)(n, l);
1623
+ let f = (i.authResolver ?? et)(n, l);
1624
1624
  if (!f.ok) return u(401, {
1625
1625
  error: "unauthorized",
1626
1626
  reason: f.reason
@@ -1666,15 +1666,15 @@ var ec = (e) => {
1666
1666
  error: "no app credential",
1667
1667
  reason: `an agent tool call must carry the app credential it acts as, in the \`${Xl}\` header (e.g. \`Bearer <api key>\`). The inspect token authorises the TRANSPORT; it is not an app identity, and running as the anonymous subject instead would execute under a principal nobody chose.`
1668
1668
  });
1669
- let y = await p.resolveSubject(te), b = Zl();
1669
+ let ne = await p.resolveSubject(te), y = Zl();
1670
1670
  try {
1671
1671
  return u(200, {
1672
1672
  ok: !0,
1673
1673
  result: await v.run(_.input, {
1674
- subject: y,
1675
- traceId: b
1674
+ subject: ne,
1675
+ traceId: y
1676
1676
  }),
1677
- traceId: b
1677
+ traceId: y
1678
1678
  });
1679
1679
  } catch (e) {
1680
1680
  return u(200, {
@@ -1683,7 +1683,7 @@ var ec = (e) => {
1683
1683
  message: e.message,
1684
1684
  name: e.name
1685
1685
  } : String(e),
1686
- traceId: b
1686
+ traceId: y
1687
1687
  });
1688
1688
  }
1689
1689
  }, iu = (e) => {
@@ -1791,7 +1791,7 @@ var ec = (e) => {
1791
1791
  ...e
1792
1792
  }), l = t.onChange((e) => {
1793
1793
  let t = s.get(e.table);
1794
- if (t !== void 0) for (let { reaction: n, log: r } of t) Zo(n, e, c()).then((t) => {
1794
+ if (t !== void 0) for (let { reaction: n, log: r } of t) Xo(n, e, c()).then((t) => {
1795
1795
  t === "acted" && r.info("reaction: acted", {
1796
1796
  table: e.table,
1797
1797
  op: e.op
@@ -2046,7 +2046,7 @@ var ec = (e) => {
2046
2046
  continue;
2047
2047
  }
2048
2048
  let o = e.default;
2049
- if (!za(o)) {
2049
+ if (!H(o)) {
2050
2050
  t.warn("aggregate: default export is not a defineAggregate() result", { file: a });
2051
2051
  continue;
2052
2052
  }
@@ -2098,7 +2098,7 @@ var ec = (e) => {
2098
2098
  for (let e = 0; e < t.length; e++) {
2099
2099
  let i = n(t[e]);
2100
2100
  if (i._tag === "Left") {
2101
- let t = Us.formatErrorSync(i.left)[0], n = t?.path?.length ? t.path.join(".") : "<root>";
2101
+ let t = Hs.formatErrorSync(i.left)[0], n = t?.path?.length ? t.path.join(".") : "<root>";
2102
2102
  return {
2103
2103
  ok: !1,
2104
2104
  reason: `row[${e}] failed output-schema decode at ${n}: ${t?.message ?? "unknown"}`
@@ -2315,7 +2315,7 @@ var ec = (e) => {
2315
2315
  }, h);
2316
2316
  g.unref(), a.scheduleTimer = g;
2317
2317
  }, ju = async (e) => {
2318
- let t = e.storage ?? fu(), n = e.coordinator ?? rs, r = e.analytics ?? Io(), i = e.log;
2318
+ let t = e.storage ?? fu(), n = e.coordinator ?? ns, r = e.analytics ?? Fo(), i = e.log;
2319
2319
  await t.initialize();
2320
2320
  let a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = {
2321
2321
  refreshedAt: null,
@@ -2538,7 +2538,7 @@ var ec = (e) => {
2538
2538
  });
2539
2539
  }
2540
2540
  return o;
2541
- }, zu = (e, t) => Ru(e, t, Ha, "expectation", "defineExpectation"), Bu = (e, t) => Ru(e, t, Ba, "budget", "defineCostBudget"), Vu = (e, t) => Ru(e, t, Ua, "experiment", "defineExperiment"), Hu = {
2541
+ }, zu = (e, t) => Ru(e, t, Va, "expectation", "defineExpectation"), Bu = (e, t) => Ru(e, t, za, "budget", "defineCostBudget"), Vu = (e, t) => Ru(e, t, Ha, "experiment", "defineExperiment"), Hu = {
2542
2542
  snapshot: () => [],
2543
2543
  get: () => null,
2544
2544
  violations: () => [],
@@ -3339,7 +3339,7 @@ var ec = (e) => {
3339
3339
  t.warn("email: failed to import", { file: i }, e);
3340
3340
  continue;
3341
3341
  }
3342
- let a = Object.values(e).filter(Ws);
3342
+ let a = Object.values(e).filter(Us);
3343
3343
  if (a.length === 0) {
3344
3344
  t.warn("email: no defineEmail export found", { file: i });
3345
3345
  continue;
@@ -3356,7 +3356,7 @@ var ec = (e) => {
3356
3356
  let t = r.child("seeds"), s = await e.loadSeedFiles(i, t);
3357
3357
  if (a = s.length, o = s, s.length > 0) {
3358
3358
  for (let t of s) e.onSeedDiscovered?.(t);
3359
- if (de(s, n, t), e.seedPolicy === "run" && e.runBootSeeds !== void 0) {
3359
+ if (fe(s, n, t), e.seedPolicy === "run" && e.runBootSeeds !== void 0) {
3360
3360
  t.info("discovered seeds", { ids: s.map((e) => e.definition.id) });
3361
3361
  let r = await e.runBootSeeds(s, n, t);
3362
3362
  for (let t of r) e.onSeedResult?.(t);
@@ -3393,7 +3393,7 @@ var ec = (e) => {
3393
3393
  seeds: o
3394
3394
  });
3395
3395
  }, nf = (e) => {
3396
- let t = ae(e.seeds, e.store, e.log);
3396
+ let t = oe(e.seeds, e.store, e.log);
3397
3397
  return t.length === 0 ? e.schedules : (e.log.info(`${t.length} cron-lifecycle seed(s) scheduled on the coordinated cron scheduler`, { schedules: t.map((e) => e.name) }), [...e.schedules, ...t]);
3398
3398
  }, rf = (e) => `workflow:${e}`, af = {
3399
3399
  skip: "skip",
@@ -3504,7 +3504,7 @@ var ec = (e) => {
3504
3504
  return e.log?.warn("inspect.migrations: snapshot build failed", { err: String(n) }), t;
3505
3505
  }
3506
3506
  }, lf = (e) => F.map(e, (e) => ({ text: e })), uf = (e) => {
3507
- let { descriptor: t, executor: n, file: r } = e, { send: i, messages: a } = Hs(t);
3507
+ let { descriptor: t, executor: n, file: r } = e, { send: i, messages: a } = Vs(t);
3508
3508
  return [{
3509
3509
  kind: "action",
3510
3510
  file: r,
@@ -3529,16 +3529,16 @@ var ec = (e) => {
3529
3529
  executor: (e, t) => ri(t.store, e.threadId)
3530
3530
  }];
3531
3531
  }, df = "<builtin:undo>", ff = () => {
3532
- if (!fs()) return {
3532
+ if (!ds()) return {
3533
3533
  queries: [],
3534
3534
  mutations: []
3535
3535
  };
3536
- let e = us();
3536
+ let e = ls();
3537
3537
  return {
3538
3538
  queries: [{
3539
3539
  file: df,
3540
3540
  descriptor: Fn,
3541
- executor: (t, n) => e ? ds(t, n) : Promise.resolve([])
3541
+ executor: (t, n) => e ? us(t, n) : Promise.resolve([])
3542
3542
  }],
3543
3543
  mutations: [{
3544
3544
  file: df,
@@ -3547,22 +3547,22 @@ var ec = (e) => {
3547
3547
  }, {
3548
3548
  file: df,
3549
3549
  descriptor: In,
3550
- executor: (t, n) => e ? Go(t, n) : Promise.reject(new nn({ invocationId: t.invocationId }))
3550
+ executor: (t, n) => e ? Wo(t, n) : Promise.reject(new nn({ invocationId: t.invocationId }))
3551
3551
  }]
3552
3552
  };
3553
- }, pf = () => fs() && !us() ? "undo: the `__voltro.undo.*` procedures are served but capture is OFF for this environment, so the undo log will always be empty and apply/redo will answer UndoNotFound. Set VOLTRO_UNDO=on to capture (it costs a read-before-write per update/delete plus one log row per mutation), or VOLTRO_UNDO=off to remove the procedures from the client bundle as well." : void 0, mf = () => us() ? (e) => Ao(e) : (e) => ({
3553
+ }, pf = () => ds() && !ls() ? "undo: the `__voltro.undo.*` procedures are served but capture is OFF for this environment, so the undo log will always be empty and apply/redo will answer UndoNotFound. Set VOLTRO_UNDO=on to capture (it costs a read-before-write per update/delete plus one log row per mutation), or VOLTRO_UNDO=off to remove the procedures from the client bundle as well." : void 0, mf = () => ls() ? (e) => ko(e) : (e) => ({
3554
3554
  tx: e,
3555
3555
  persist: async () => {}
3556
3556
  }), hf = "<builtin:approvals>", gf = (e, t = process.env) => {
3557
3557
  let n = e?.approvals?.expiresIn;
3558
3558
  if (n !== void 0) {
3559
- let e = zo(n);
3559
+ let e = Ro(n);
3560
3560
  if (e === null) throw Error(`app.config.ts: \`approvals.expiresIn\` must be an interval like '4h' / '30m' (got ${JSON.stringify(n)})`);
3561
3561
  return e;
3562
3562
  }
3563
3563
  let r = Number(t.VOLTRO_APPROVAL_EXPIRY_HOURS);
3564
3564
  return Number.isFinite(r) && r > 0 ? r * 36e5 : Ui;
3565
- }, _f = (e) => e.some((e) => e?.requiresApproval != null), vf = (e) => (La(no({
3565
+ }, _f = (e) => e.some((e) => e?.requiresApproval != null), vf = (e) => (La(to({
3566
3566
  store: e.store,
3567
3567
  defaultExpiryMs: e.defaultExpiryMs ?? Ui
3568
3568
  })), {
@@ -3853,7 +3853,7 @@ var ec = (e) => {
3853
3853
  mutation: Pf(pn(Nf(e, "mutation", t))),
3854
3854
  action: Pf(pn(Nf(e, "action", t))),
3855
3855
  query: Pf(pn(Nf(e, "query", t)))
3856
- }), If = `${pt}/plugins/`, Lf = (e) => e.startsWith("/") ? e : `/${e}`, Rf = (e) => {
3856
+ }), If = `${mt}/plugins/`, Lf = (e) => e.startsWith("/") ? e : `/${e}`, Rf = (e) => {
3857
3857
  let t = e.indexOf("?");
3858
3858
  return t >= 0 ? e.slice(0, t) : e;
3859
3859
  }, zf = (e, t) => e.kind === "json" ? {
@@ -3869,7 +3869,7 @@ var ec = (e) => {
3869
3869
  }, Bf = (e) => {
3870
3870
  let t = /* @__PURE__ */ new Map(), n = [];
3871
3871
  for (let r of e) {
3872
- let e = r.inspectEndpoints ?? [], i = w(r.name);
3872
+ let e = r.inspectEndpoints ?? [], i = C(r.name);
3873
3873
  for (let a of e) {
3874
3874
  let e = `${If}${i}${Lf(a.path)}`, o = `${a.method} ${e}`, s = t.get(o);
3875
3875
  if (s !== void 0) throw Error(`plugin inspect endpoint collision: "${a.method} ${e}" declared by plugin "${r.name}" but already claimed by ${s}`);
@@ -3887,20 +3887,20 @@ var ec = (e) => {
3887
3887
  async dispatch(e, t, r, i, a) {
3888
3888
  let o = Rf(e);
3889
3889
  if (!o.startsWith(If)) return null;
3890
- let s = k(r.origin ?? r.Origin), c = t.toUpperCase();
3890
+ let s = O(r.origin ?? r.Origin), c = t.toUpperCase();
3891
3891
  if (c === "OPTIONS") return {
3892
3892
  status: 204,
3893
3893
  contentType: "text/plain",
3894
3894
  body: "",
3895
3895
  headers: s
3896
3896
  };
3897
- if (Ke()) return {
3897
+ if (qe()) return {
3898
3898
  status: 503,
3899
3899
  contentType: "application/json; charset=utf-8",
3900
3900
  body: JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }),
3901
3901
  headers: s
3902
3902
  };
3903
- let l = (a?.authResolver ?? $e)(r, t);
3903
+ let l = (a?.authResolver ?? et)(r, t);
3904
3904
  if (!l.ok) return {
3905
3905
  status: 401,
3906
3906
  contentType: "application/json; charset=utf-8",
@@ -4254,7 +4254,7 @@ var ec = (e) => {
4254
4254
  for (let n of e) {
4255
4255
  let e = n.dashboard ?? [];
4256
4256
  if (e.length === 0) continue;
4257
- let r = he(n.name), i = /* @__PURE__ */ new Set();
4257
+ let r = ge(n.name), i = /* @__PURE__ */ new Set();
4258
4258
  for (let a of e) {
4259
4259
  if (i.has(a.id)) throw Error(`plugin "${n.name}" declares duplicate dashboard mount id "${a.id}"`);
4260
4260
  i.add(a.id), t.push({
@@ -4292,7 +4292,7 @@ var ec = (e) => {
4292
4292
  for (let i of r) {
4293
4293
  if (op.has(i.name)) continue;
4294
4294
  let r = N(e, i.name);
4295
- i.isDirectory() ? await n(r) : i.isFile() && (ip.test(i.name) && !ap.test(i.name) || ke.test(i.name)) && t.push(r);
4295
+ i.isDirectory() ? await n(r) : i.isFile() && (ip.test(i.name) && !ap.test(i.name) || Ae.test(i.name)) && t.push(r);
4296
4296
  }
4297
4297
  };
4298
4298
  return await n(e), t;
@@ -4308,7 +4308,7 @@ var ec = (e) => {
4308
4308
  tag: e.name
4309
4309
  });
4310
4310
  }
4311
- if (r && typeof r == "object" && ke.test(e) && "name" in r) {
4311
+ if (r && typeof r == "object" && Ae.test(e) && "name" in r) {
4312
4312
  let e = r;
4313
4313
  typeof e.name == "string" && n.push({
4314
4314
  kind: "workflow",
@@ -4327,7 +4327,7 @@ var ec = (e) => {
4327
4327
  if (r.length === 0) return [];
4328
4328
  let i = await cp(n);
4329
4329
  return r.map((e) => {
4330
- let n = he(e.name), r = {
4330
+ let n = ge(e.name), r = {
4331
4331
  pluginName: e.name,
4332
4332
  pluginAlias: n,
4333
4333
  apiName: t,
@@ -4343,7 +4343,7 @@ var ec = (e) => {
4343
4343
  pluginContributions: await lp(e, t, n),
4344
4344
  pluginErrorImports: e.flatMap((e) => (e.errorSchemas ?? []).map((e) => e.import)),
4345
4345
  pluginRpcImports: e.flatMap((e) => (e.rpcClientDescriptors ?? []).map((t) => ({
4346
- tag: De(e, t.tag),
4346
+ tag: Oe(e, t.tag),
4347
4347
  kind: t.kind,
4348
4348
  module: t.import.module,
4349
4349
  name: t.import.name
@@ -4612,7 +4612,7 @@ var ec = (e) => {
4612
4612
  return {
4613
4613
  inspectStartWorkflow: async (e) => {
4614
4614
  if (i === void 0) throw Error("workflow runtime is not configured");
4615
- let t = await Mo(i, {
4615
+ let t = await jo(i, {
4616
4616
  traceId: `inspect-workflow-start-${Date.now()}`,
4617
4617
  source: "inspect"
4618
4618
  }).start(e.name, e.payload);
@@ -5011,7 +5011,7 @@ var ec = (e) => {
5011
5011
  let t = e.now ?? Date.now, n = {
5012
5012
  phase: "booting",
5013
5013
  startedAt: t()
5014
- }, r = $s((e, r) => {
5014
+ }, r = Qs((e, r) => {
5015
5015
  let i = (e.url ?? "/").split("?")[0], a = n.phase === "ready";
5016
5016
  if (i === "/internal/liveness") {
5017
5017
  r.writeHead(200, {
@@ -5086,7 +5086,7 @@ var ec = (e) => {
5086
5086
  delivery. Rename one of them.`);
5087
5087
  }, mm = (e) => {
5088
5088
  let t = new Map(e.events.map((e) => [e.descriptor.name, e.descriptor.delivery ?? "each"])), n = new Ki({
5089
- origin: e.origin ?? Cs(),
5089
+ origin: e.origin ?? Ss(),
5090
5090
  deliveryOf: (e) => t.get(e),
5091
5091
  ...e.publishRemote === void 0 ? {} : { publishRemote: e.publishRemote }
5092
5092
  }), r = [], i = {};
@@ -5394,14 +5394,14 @@ var ec = (e) => {
5394
5394
  if ((e.includes("?") ? e.slice(0, e.indexOf("?")) : e) !== "/_voltro/inspect/checks") return null;
5395
5395
  let i = (r.method ?? "GET").toUpperCase();
5396
5396
  if (i !== "GET") return null;
5397
- let a = k(n.origin ?? n.Origin), o = (e, t) => ({
5397
+ let a = O(n.origin ?? n.Origin), o = (e, t) => ({
5398
5398
  status: e,
5399
5399
  contentType: "application/json; charset=utf-8",
5400
5400
  body: JSON.stringify(t),
5401
5401
  headers: a
5402
5402
  });
5403
- if (Ke()) return o(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" });
5404
- let s = (r.authResolver ?? $e)(n, i);
5403
+ if (qe()) return o(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" });
5404
+ let s = (r.authResolver ?? et)(n, i);
5405
5405
  if (!s.ok) return o(401, {
5406
5406
  error: "unauthorized",
5407
5407
  reason: s.reason
@@ -5420,65 +5420,65 @@ var ec = (e) => {
5420
5420
  if (r) return r;
5421
5421
  }
5422
5422
  if (e.startsWith("/_voltro/inspect/schedules")) {
5423
- let r = await it(e, t, n, {
5423
+ let r = await at(e, t, n, {
5424
5424
  method: i,
5425
5425
  ...a === void 0 ? {} : { body: a }
5426
5426
  });
5427
5427
  if (r) return r;
5428
5428
  }
5429
5429
  if (e === "/_voltro/inspect/cluster" || e.startsWith("/_voltro/inspect/cluster?")) {
5430
- let r = await ft(e, t, n, { method: i });
5430
+ let r = await pt(e, t, n, { method: i });
5431
5431
  if (r) return r;
5432
5432
  }
5433
5433
  if (i === "GET" && (e === "/_voltro/inspect/data/rows" || e.startsWith("/_voltro/inspect/data/rows?"))) {
5434
- let r = await st(e, t, n, { method: i });
5434
+ let r = await ct(e, t, n, { method: i });
5435
5435
  if (r) return r;
5436
5436
  }
5437
5437
  if (i === "GET" && e.startsWith("/_voltro/inspect/provenance")) {
5438
- let r = await ct(e, t, n, { method: i });
5438
+ let r = await lt(e, t, n, { method: i });
5439
5439
  if (r) return r;
5440
5440
  }
5441
5441
  if (e.startsWith("/_voltro/inspect/workflows/flow-control")) {
5442
- let r = await nt(e, t, n, a ?? "", { method: i });
5442
+ let r = await rt(e, t, n, a ?? "", { method: i });
5443
5443
  if (r) return r;
5444
5444
  }
5445
5445
  if (i === "GET" && (e === "/_voltro/inspect/workflows/runs" || e.startsWith("/_voltro/inspect/workflows/runs?"))) {
5446
- let r = await Ze(e, t, n, { method: i });
5446
+ let r = await Qe(e, t, n, { method: i });
5447
5447
  if (r) return r;
5448
5448
  }
5449
5449
  if (i === "GET" && (e === "/_voltro/inspect/workflows/stats" || e.startsWith("/_voltro/inspect/workflows/stats?"))) {
5450
- let r = await qe(e, t, n, { method: i });
5450
+ let r = await Je(e, t, n, { method: i });
5451
5451
  if (r) return r;
5452
5452
  }
5453
5453
  if (i === "POST" && e.startsWith("/_voltro/inspect/workflows/start/")) {
5454
- let r = await A(e, t, n, a ?? "", { method: i });
5454
+ let r = await k(e, t, n, a ?? "", { method: i });
5455
5455
  if (r) return r;
5456
5456
  }
5457
5457
  if (i === "GET" && e.startsWith("/_voltro/inspect/workflows/runs/") && e.endsWith("/steps")) {
5458
- let r = await j(e, t, n, { method: i });
5458
+ let r = await A(e, t, n, { method: i });
5459
5459
  if (r) return r;
5460
5460
  }
5461
5461
  if (i === "GET" && e.startsWith("/_voltro/inspect/workflows/runs/") && e.endsWith("/events")) {
5462
- let r = await Xe(e, t, n, { method: i });
5462
+ let r = await Ze(e, t, n, { method: i });
5463
5463
  if (r) return r;
5464
5464
  }
5465
5465
  if (i === "GET" && (e === "/_voltro/inspect/workflows/events" || e.startsWith("/_voltro/inspect/workflows/events?"))) {
5466
- let r = await et(t, e, n, { method: i });
5466
+ let r = await tt(t, e, n, { method: i });
5467
5467
  if (r) return r;
5468
5468
  }
5469
5469
  if (i === "GET" && e.startsWith("/_voltro/inspect/workflows/events/") && e.endsWith("/deliveries")) {
5470
- let r = await gt(t, e, n, { method: i });
5470
+ let r = await _t(t, e, n, { method: i });
5471
5471
  if (r) return r;
5472
5472
  }
5473
5473
  if (i === "GET" && (e === "/_voltro/inspect/workflows/children" || e.startsWith("/_voltro/inspect/workflows/children?"))) {
5474
- let r = await _t(e, t, n, { method: i });
5474
+ let r = await j(e, t, n, { method: i });
5475
5475
  if (r) return r;
5476
5476
  }
5477
5477
  if (i === "POST" && e.startsWith("/_voltro/inspect/workflows/runs/") && (e.endsWith("/cancel") || e.endsWith("/retry") || e.endsWith("/suspend") || e.endsWith("/resume") || e.endsWith("/signal"))) {
5478
- let r = await ht(e, t, n, a ?? "", { method: i });
5478
+ let r = await gt(e, t, n, a ?? "", { method: i });
5479
5479
  if (r) return r;
5480
5480
  }
5481
- return i === "POST" && e.startsWith("/_voltro/inspect/webhooks/") ? Qe(e, t, n, a ?? "", { method: i }).then((e) => e ?? {
5481
+ return i === "POST" && e.startsWith("/_voltro/inspect/webhooks/") ? $e(e, t, n, a ?? "", { method: i }).then((e) => e ?? {
5482
5482
  status: 404,
5483
5483
  contentType: "application/json; charset=utf-8",
5484
5484
  body: JSON.stringify({ error: "unknown webhook URL" })
@@ -5491,12 +5491,12 @@ var ec = (e) => {
5491
5491
  targets: [],
5492
5492
  deliveries: []
5493
5493
  }),
5494
- headers: k(n.origin)
5494
+ headers: O(n.origin)
5495
5495
  } : t.webhooks().then((e) => ({
5496
5496
  status: 200,
5497
5497
  contentType: "application/json; charset=utf-8",
5498
5498
  body: JSON.stringify(e),
5499
- headers: k(n.origin)
5499
+ headers: O(n.origin)
5500
5500
  })) : null;
5501
5501
  }, Am = (e) => ({
5502
5502
  schedules: e.schedules.map((t) => ({
@@ -5508,7 +5508,7 @@ var ec = (e) => {
5508
5508
  backfill: t.backfill ?? "skip",
5509
5509
  maxRuntimeMs: t.maxRuntimeMs ?? 18e5,
5510
5510
  ...t.description === void 0 ? {} : { description: t.description },
5511
- nextFiringAt: Fo(t).toISOString()
5511
+ nextFiringAt: Po(t).toISOString()
5512
5512
  })),
5513
5513
  coordination: e.coordination
5514
5514
  }), jm = 1e4, Mm = (e) => async (t) => {
@@ -6137,11 +6137,11 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6137
6137
  }
6138
6138
  !l && c > n && t.onTruncated?.(c, n);
6139
6139
  }, fh = (e, t, n) => ({
6140
- option: Xs(e ?? [])?.broadcast?.namespace,
6140
+ option: Ys(e ?? [])?.broadcast?.namespace,
6141
6141
  env: n.VOLTRO_BROADCAST_NAMESPACE,
6142
6142
  appName: t
6143
- }), ph = (e, t, n = process.env) => Zs(fh(e, t, n)), mh = (e, t, n = process.env) => {
6144
- let r = Js(fh(e, t, n));
6143
+ }), ph = (e, t, n = process.env) => Xs(fh(e, t, n)), mh = (e, t, n = process.env) => {
6144
+ let r = qs(fh(e, t, n));
6145
6145
  if (r.changed) return `broadcast namespace "${r.configured}" was normalised to "${r.resolved}" — it becomes a broker subject, so whitespace, dots and wildcards are folded to "-".
6146
6146
  Two deployments configured differently can collapse onto ONE channel this way ("my app" and "my.app" both give "my-app"); if these are meant to be separate, make the resolved names differ.`;
6147
6147
  }, hh = (e) => typeof e == "object" && !!e && typeof e.route == "string" && typeof e.event == "string" && typeof e.origin == "string" && Number.isFinite(e.n) && Number.isFinite(e.emittedAt), gh = async (e) => {
@@ -6167,7 +6167,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6167
6167
  }
6168
6168
  }, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map(), a = (a) => {
6169
6169
  if (i.has(a)) return;
6170
- let o = Ys(e.namespace, a);
6170
+ let o = Js(e.namespace, a);
6171
6171
  F.runPromise(e.provider.subscribe(o, n(o))).then((e) => {
6172
6172
  if (!r.has(a)) {
6173
6173
  e();
@@ -6204,7 +6204,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6204
6204
  }, _h = (e, t, n) => {
6205
6205
  let r = !1;
6206
6206
  return (i) => {
6207
- let a = Ys(t, i.event);
6207
+ let a = Js(t, i.event);
6208
6208
  F.runPromise(e.publish(a, JSON.stringify(i))).then(() => {
6209
6209
  r = !1;
6210
6210
  }, (e) => {
@@ -6215,7 +6215,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6215
6215
  });
6216
6216
  };
6217
6217
  }, vh = (e, t, n) => {
6218
- let r = Xs(e ?? [])?.broadcast?.provider;
6218
+ let r = Ys(e ?? [])?.broadcast?.provider;
6219
6219
  return r === void 0 ? {
6220
6220
  publishRemote: void 0,
6221
6221
  attach: async () => null
@@ -6230,12 +6230,12 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6230
6230
  });
6231
6231
  return n?.info("events: cross-instance fan-out active", {
6232
6232
  provider: r.name,
6233
- channelPrefix: `${qs(t, "events")}:`
6233
+ channelPrefix: `${Ks(t, "events")}:`
6234
6234
  }), i;
6235
6235
  }
6236
6236
  };
6237
6237
  }, yh = (e) => typeof e == "object" && !!e && typeof e.instanceId == "string" && Number.isFinite(e.startedAt), bh = (e, t) => {
6238
- let n = Xs(e ?? [])?.broadcast?.provider, r = t.logger;
6238
+ let n = Ys(e ?? [])?.broadcast?.provider, r = t.logger;
6239
6239
  if (n === void 0) {
6240
6240
  let e = new Xi({
6241
6241
  instanceId: t.instanceId,
@@ -6252,10 +6252,10 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6252
6252
  instanceId: t.instanceId,
6253
6253
  ...t.meta === void 0 ? {} : { meta: t.meta },
6254
6254
  announce: (e) => {
6255
- F.runPromise(n.publish(qs(t.namespace, "members"), JSON.stringify(e))).catch(() => {});
6255
+ F.runPromise(n.publish(Ks(t.namespace, "members"), JSON.stringify(e))).catch(() => {});
6256
6256
  }
6257
6257
  }), a;
6258
- return F.runPromise(n.subscribe(qs(t.namespace, "members"), (e) => {
6258
+ return F.runPromise(n.subscribe(Ks(t.namespace, "members"), (e) => {
6259
6259
  let t;
6260
6260
  try {
6261
6261
  t = JSON.parse(e);
@@ -6271,7 +6271,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6271
6271
  r?.info(`membership: instance ${e.kind}`, { instanceId: e.instanceId });
6272
6272
  }), i.start(), r?.info("membership: announcing", {
6273
6273
  instanceId: t.instanceId,
6274
- channel: qs(t.namespace, "members")
6274
+ channel: Ks(t.namespace, "members")
6275
6275
  }), {
6276
6276
  membership: i,
6277
6277
  detach: async () => {
@@ -6342,11 +6342,11 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6342
6342
  })(), Dh = process.env.TENANT ?? "acme", Oh = {
6343
6343
  id: "voltro-password",
6344
6344
  resolve: (e) => {
6345
- let t = e.headers.cookie ?? e.headers.Cookie, n = ys(t, vs);
6345
+ let t = e.headers.cookie ?? e.headers.Cookie, n = vs(t, _s);
6346
6346
  if (!n) return { kind: "skip" };
6347
- let r = bs();
6347
+ let r = ys();
6348
6348
  if (!r) return { kind: "skip" };
6349
- let i = xs(n, r);
6349
+ let i = bs(n, r);
6350
6350
  return i ? {
6351
6351
  kind: "matched",
6352
6352
  subject: i.subject
@@ -6425,7 +6425,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6425
6425
  for (let i of r) {
6426
6426
  if (Ph.has(i.name)) continue;
6427
6427
  let r = N(e, i.name);
6428
- i.isDirectory() ? await n(r) : i.isFile() && (O.test(i.name) && !Pe.test(i.name) || Pe.test(i.name) || ke.test(i.name) || je.test(i.name) || Ae.test(i.name) || D.test(i.name) || Ge.test(i.name) || We.test(i.name) || Ne.test(i.name) || E.test(i.name) || Ie.test(i.name) || $d.test(i.name) || Se.test(i.name) || xe.test(i.name) || Ue.test(i.name) || ze.test(i.name) || He.test(i.name) || Ve.test(i.name) || Be.test(i.name) || Le.test(i.name) || Fe.test(i.name) || Re.test(i.name)) && t.push(r);
6428
+ i.isDirectory() ? await n(r) : i.isFile() && (D.test(i.name) && !Fe.test(i.name) || Fe.test(i.name) || Ae.test(i.name) || Me.test(i.name) || je.test(i.name) || E.test(i.name) || Ke.test(i.name) || Ge.test(i.name) || Pe.test(i.name) || T.test(i.name) || Le.test(i.name) || $d.test(i.name) || Ce.test(i.name) || Se.test(i.name) || We.test(i.name) || Be.test(i.name) || Ue.test(i.name) || He.test(i.name) || Ve.test(i.name) || Re.test(i.name) || Ie.test(i.name) || ze.test(i.name)) && t.push(r);
6429
6429
  }
6430
6430
  };
6431
6431
  return await n(e), t;
@@ -6494,13 +6494,13 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6494
6494
  let r = [], i = [], a = [], o = [], s = [], c = [], l = [], u = [], d = [], f = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Map(), h = [], g = [], _ = /* @__PURE__ */ new Map();
6495
6495
  for (let t of e) {
6496
6496
  let e = M(t);
6497
- if (D.test(e)) {
6497
+ if (E.test(e)) {
6498
6498
  let e = new Set(oi().map((e) => e.tableName)), r = await n(t), i = [...Object.values(r).filter((e) => Hh(e)), ...oi().filter((t) => !e.has(t.tableName))];
6499
6499
  for (let e of i) m.set(e.tableName, e), Gh(e) && f.add(e.tableName), qh(e) && p.add(e.tableName);
6500
6500
  Oi(r);
6501
6501
  continue;
6502
6502
  }
6503
- if (Ge.test(e)) {
6503
+ if (Ke.test(e)) {
6504
6504
  let e = await n(t);
6505
6505
  if (Oi(e) === 0) {
6506
6506
  let n = Object.entries(e).filter(([, e]) => vi(e)).map(([e]) => e);
@@ -6511,14 +6511,14 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6511
6511
  }
6512
6512
  continue;
6513
6513
  }
6514
- if (Me(e)) {
6514
+ if (Ne(e)) {
6515
6515
  Z.warn("skipping workflow — a workflow module must be `.workflow.tsx` (JSX steps); rename it", {
6516
6516
  file: t,
6517
6517
  expected: e.replace(/\.workflow\.ts$/, ".workflow.tsx")
6518
6518
  });
6519
6519
  continue;
6520
6520
  }
6521
- if (ke.test(e)) {
6521
+ if (Ae.test(e)) {
6522
6522
  let e = await n(t), r = Object.values(e).find(Vh);
6523
6523
  if (!r) {
6524
6524
  Z.warn("skipping workflow — no workflow(...) export", { file: t });
@@ -6547,9 +6547,9 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6547
6547
  for (let t of [...Object.values(e), ...Object.values(a)]) Nr(t) && l.push(t);
6548
6548
  continue;
6549
6549
  }
6550
- if (Ae.test(e)) {
6551
- let r = await n(t), i = r.default ?? Object.values(r).find(Ka);
6552
- if (!Ka(i)) {
6550
+ if (je.test(e)) {
6551
+ let r = await n(t), i = r.default ?? Object.values(r).find(Ga);
6552
+ if (!Ga(i)) {
6553
6553
  Z.warn("skipping trigger — default export is not triggerWorkflow(...)", { file: t });
6554
6554
  continue;
6555
6555
  }
@@ -6564,9 +6564,9 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6564
6564
  });
6565
6565
  continue;
6566
6566
  }
6567
- if (E.test(e)) {
6567
+ if (T.test(e)) {
6568
6568
  let e = (await n(t)).default;
6569
- if (!Ga(e)) {
6569
+ if (!Wa(e)) {
6570
6570
  Z.warn("skipping cron — default export is not defineSchedule(...)", { file: t });
6571
6571
  continue;
6572
6572
  }
@@ -6580,16 +6580,16 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6580
6580
  d.push(e);
6581
6581
  continue;
6582
6582
  }
6583
- if (Pe.test(e)) {
6583
+ if (Fe.test(e)) {
6584
6584
  let n = t.slice(0, -e.length), r = e.replace(/\.server\.ts$/, ".ts");
6585
6585
  _.set(n + r, t);
6586
6586
  continue;
6587
6587
  }
6588
- if (O.test(e)) {
6588
+ if (D.test(e)) {
6589
6589
  h.push(t);
6590
6590
  continue;
6591
6591
  }
6592
- if (Re.test(e)) {
6592
+ if (ze.test(e)) {
6593
6593
  g.push(t);
6594
6594
  continue;
6595
6595
  }
@@ -6644,7 +6644,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6644
6644
  let n = ji(t);
6645
6645
  n.length > 0 && v.set(e, n);
6646
6646
  }
6647
- let ee = v.size === 0 ? [] : r.flatMap((e) => $o({
6647
+ let ee = v.size === 0 ? [] : r.flatMap((e) => Qo({
6648
6648
  name: e.descriptor.name,
6649
6649
  output: e.descriptor.output,
6650
6650
  source: e.descriptor.source
@@ -6655,17 +6655,17 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6655
6655
  ...e.descriptor.cache === void 0 ? {} : { cache: e.descriptor.cache }
6656
6656
  }, f));
6657
6657
  m.has("actors") || m.set("actors", ai);
6658
- let y = m.get("actors"), b = m.get("tenants");
6659
- (y !== void 0 || b !== void 0) && Di({
6660
- ...y === void 0 ? {} : { actors: () => y },
6661
- ...b === void 0 ? {} : { tenants: () => b }
6658
+ let ne = m.get("actors"), y = m.get("tenants");
6659
+ (ne !== void 0 || y !== void 0) && Di({
6660
+ ...ne === void 0 ? {} : { actors: () => ne },
6661
+ ...y === void 0 ? {} : { tenants: () => y }
6662
6662
  });
6663
- let x = e.filter((e) => ye.test(M(e))), S = x.length > 0 ? await T(x, Z.child("connections")) : [], C = {
6663
+ let b = e.filter((e) => be.test(M(e))), x = b.length > 0 ? await w(b, Z.child("connections")) : [], S = {
6664
6664
  workflows: c.length > 0 || u.length > 0,
6665
- schedules: d.length > 0 || e.some((e) => Ce(M(e))),
6666
- webhooks: e.some((e) => Ie.test(M(e))),
6667
- agents: e.some((e) => Se.test(M(e))),
6668
- connections: x.length > 0
6665
+ schedules: d.length > 0 || e.some((e) => we(M(e))),
6666
+ webhooks: e.some((e) => Le.test(M(e))),
6667
+ agents: e.some((e) => Ce.test(M(e))),
6668
+ connections: b.length > 0
6669
6669
  };
6670
6670
  return Pi(), {
6671
6671
  queries: r,
@@ -6677,9 +6677,9 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6677
6677
  workflowWorkers: l,
6678
6678
  eventTriggers: u,
6679
6679
  schedules: d,
6680
- connections: S,
6680
+ connections: x,
6681
6681
  tables: [...m.values()],
6682
- featureMix: C,
6682
+ featureMix: S,
6683
6683
  tenantScopedTables: f,
6684
6684
  softDeleteScopedTables: p,
6685
6685
  serverOnlyLeaks: ee,
@@ -6703,8 +6703,8 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6703
6703
  ...r ? { error: e } : {}
6704
6704
  };
6705
6705
  }
6706
- }, Qh = async (e) => (await Zh(e)).config, Q = () => C("runtime"), $h = (e) => {
6707
- let t = ie();
6706
+ }, Qh = async (e) => (await Zh(e)).config, Q = () => S("runtime"), $h = (e) => {
6707
+ let t = ae();
6708
6708
  if ("url" in e && e.url) try {
6709
6709
  let n = new URL(e.url), r = n.username ? `${n.username}@` : "", i = n.port ? `:${n.port}` : "";
6710
6710
  return {
@@ -6729,29 +6729,30 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6729
6729
  let t = 2166136261;
6730
6730
  for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
6731
6731
  return 1e3 + (t >>> 0) % 2147482647;
6732
- }, $ = (e) => (process.env.DB_DIALECT ?? e?.store ?? "memory").toLowerCase(), ng = async (e, n, r) => {
6733
- let i = $(e);
6734
- if (i === "memory") return Z.info("sql dialect resolved: memory — in-process store, no persistence"), new Yi({});
6735
- let a = (process.env.CDC ?? "1") !== "0", o = await S(i), s = o.id === "postgres" ? "LISTEN/NOTIFY" : Si(o.id) ? "in-process bus" : o.id === "mariadb" ? "binlog CDC (ROW)" : o.id === "mssql" ? "Change Tracking (polled)" : o.id === "mysql" ? "binlog CDC (ROW)" : "inline only", c = o.id === "postgres" ? "native" : o.id === "mysql" ? "INSERT/UPDATE/DELETE then SELECT (no RETURNING)" : o.id === "mariadb" ? "native (INSERT/DELETE); UPDATE then SELECT" : o.id === "mssql" ? "OUTPUT INSERTED/DELETED" : Si(o.id) ? "native" : "unknown";
6736
- Z.info(`sql dialect resolved: ${o.id} — CDC: ${a ? s : "inline emit (CDC=0)"}, RETURNING: ${c}`);
6737
- let l = r ?? Q(), { summary: u, fromEnv: d } = $h(l);
6738
- Z.info(`db connection: ${u}${d ? "" : " (DEFAULT FALLBACK — no DB_URL / PG_HOST set)"}`), d || Z.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.");
6739
- let f;
6740
- if (a && (o.id === "mysql" || o.id === "mariadb")) {
6741
- let { connectionFromConfig: e } = await x("@voltro/sql-mysql"), t = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, n = oi().filter((e) => e.isReactive !== !1).map((e) => e.tableName).filter((e) => !e.startsWith("_voltro_"));
6742
- f = {
6732
+ }, $ = (e) => (process.env.DB_DIALECT ?? e?.store ?? "memory").toLowerCase(), ng = async (e, n, r, i) => {
6733
+ let a = $(e);
6734
+ if (a === "memory") return Z.info("sql dialect resolved: memory — in-process store, no persistence"), new Yi({});
6735
+ let o = (process.env.CDC ?? "1") !== "0", s = await x(a), c = s.id === "postgres" ? "LISTEN/NOTIFY" : Si(s.id) ? "in-process bus" : s.id === "mariadb" ? "binlog CDC (ROW)" : s.id === "mssql" ? "Change Tracking (polled)" : s.id === "mysql" ? "binlog CDC (ROW)" : "inline only", l = s.id === "postgres" ? "native" : s.id === "mysql" ? "INSERT/UPDATE/DELETE then SELECT (no RETURNING)" : s.id === "mariadb" ? "native (INSERT/DELETE); UPDATE then SELECT" : s.id === "mssql" ? "OUTPUT INSERTED/DELETED" : Si(s.id) ? "native" : "unknown";
6736
+ Z.info(`sql dialect resolved: ${s.id} — CDC: ${o ? c : "inline emit (CDC=0)"}, RETURNING: ${l}`);
6737
+ let u = r ?? Q(), { summary: d, fromEnv: f } = $h(u);
6738
+ Z.info(`db connection: ${d}${f ? "" : " (DEFAULT FALLBACK — no DB_URL / PG_HOST set)"}`), f || Z.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.");
6739
+ let p;
6740
+ if (o && (s.id === "mysql" || s.id === "mariadb")) {
6741
+ let { connectionFromConfig: e } = await b("@voltro/sql-mysql"), t = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, n = oi().filter((e) => e.isReactive !== !1).map((e) => e.tableName).filter((e) => !e.startsWith("_voltro_"));
6742
+ p = {
6743
6743
  serverId: tg(t),
6744
6744
  replicaId: t,
6745
- connection: e(l),
6746
- includeTables: n
6747
- }, n.length === 0 ? (a = !1, f = void 0, Z.info(`${o.id} binlog CDC skipped — every app table is .nonReactive()`)) : Z.info(`${o.id} binlog CDC enabled`, {
6745
+ connection: e(u),
6746
+ includeTables: n,
6747
+ ...i?.schemaWorkFollows === !0 ? { exclusionRefreshFollows: !0 } : {}
6748
+ }, n.length === 0 ? (o = !1, p = void 0, Z.info(`${s.id} binlog CDC skipped — every app table is .nonReactive()`)) : Z.info(`${s.id} binlog CDC enabled`, {
6748
6749
  replicaId: t,
6749
- serverId: f.serverId,
6750
+ serverId: p.serverId,
6750
6751
  tables: n.length
6751
6752
  });
6752
- } else if (a && o.id === "mssql") {
6753
- let { connectionFromConfig: e } = await x("@voltro/sql-mssql"), t = e(l), n = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, r = oi().filter((e) => e.isReactive !== !1).map((e) => e.tableName).filter((e) => !e.startsWith("_voltro_"));
6754
- f = {
6753
+ } else if (o && s.id === "mssql") {
6754
+ let { connectionFromConfig: e } = await b("@voltro/sql-mssql"), t = e(u), n = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, r = oi().filter((e) => e.isReactive !== !1).map((e) => e.tableName).filter((e) => !e.startsWith("_voltro_"));
6755
+ p = {
6755
6756
  serverId: 0,
6756
6757
  replicaId: n,
6757
6758
  connection: {
@@ -6762,91 +6763,91 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6762
6763
  database: t.database ?? "master"
6763
6764
  },
6764
6765
  includeTables: r
6765
- }, r.length === 0 ? (a = !1, f = void 0, Z.info("mssql Change Tracking CDC skipped — every app table is .nonReactive()")) : Z.info("mssql Change Tracking CDC enabled", {
6766
+ }, r.length === 0 ? (o = !1, p = void 0, Z.info("mssql Change Tracking CDC skipped — every app table is .nonReactive()")) : Z.info("mssql Change Tracking CDC enabled", {
6766
6767
  replicaId: n,
6767
6768
  tables: r.length
6768
6769
  });
6769
6770
  }
6770
- let p = await o.makeStore({
6771
- sqlLayer: o.makeSqlLayer(l),
6771
+ let m = await s.makeStore({
6772
+ sqlLayer: s.makeSqlLayer(u),
6772
6773
  ...n ? { tracerLayer: n } : {},
6773
- changeStrategy: a ? "cdc" : "inline",
6774
- ...f ? { cdcConfig: f } : {}
6775
- }), m = eg();
6776
- if (m.length === 0) return Z.info("read replicas: none configured (DB_REPLICA_URLS unset) — all queries → primary"), t.recordReplication({
6774
+ changeStrategy: o ? "cdc" : "inline",
6775
+ ...p ? { cdcConfig: p } : {}
6776
+ }), h = eg();
6777
+ if (h.length === 0) return Z.info("read replicas: none configured (DB_REPLICA_URLS unset) — all queries → primary"), t.recordReplication({
6777
6778
  replicaCount: 0,
6778
6779
  rywPolicy: "off",
6779
6780
  rywStore: "memory",
6780
6781
  region: null,
6781
6782
  localityEnabled: !1
6782
- }), p;
6783
- if (Si(o.id)) return Z.warn(`read replicas: not applicable (${o.id} is single-process); ignoring DB_REPLICA_URLS`), t.recordReplication({
6783
+ }), m;
6784
+ if (Si(s.id)) return Z.warn(`read replicas: not applicable (${s.id} is single-process); ignoring DB_REPLICA_URLS`), t.recordReplication({
6784
6785
  replicaCount: 0,
6785
6786
  rywPolicy: "off",
6786
6787
  rywStore: "memory",
6787
6788
  region: null,
6788
6789
  localityEnabled: !1
6789
- }), p;
6790
- let h = await sg(o.id);
6791
- if (h === null) return Z.warn(`read replicas: no replication adapter for dialect ${o.id}; falling back to primary-only routing`), t.recordReplication({
6790
+ }), m;
6791
+ let g = await sg(s.id);
6792
+ if (g === null) return Z.warn(`read replicas: no replication adapter for dialect ${s.id}; falling back to primary-only routing`), t.recordReplication({
6792
6793
  replicaCount: 0,
6793
6794
  rywPolicy: "off",
6794
6795
  rywStore: "memory",
6795
6796
  region: null,
6796
6797
  localityEnabled: !1
6797
- }), p;
6798
- let g = [];
6799
- for (let e of m) {
6800
- let t = await o.makeStore({
6801
- sqlLayer: o.makeSqlLayer(ne(l, e)),
6798
+ }), m;
6799
+ let _ = [];
6800
+ for (let e of h) {
6801
+ let t = await s.makeStore({
6802
+ sqlLayer: s.makeSqlLayer(re(u, e)),
6802
6803
  ...n ? { tracerLayer: n } : {},
6803
6804
  changeStrategy: "inline"
6804
6805
  });
6805
- g.push(t);
6806
+ _.push(t);
6806
6807
  }
6807
- let _ = process.env.RYW_POLICY ?? "fallback", v = (process.env.RYW_STORE ?? "memory").toLowerCase(), ee, te = "memory";
6808
- if (v === "redis") {
6808
+ let v = process.env.RYW_POLICY ?? "fallback", ee = (process.env.RYW_STORE ?? "memory").toLowerCase(), te, ne = "memory";
6809
+ if (ee === "redis") {
6809
6810
  let e = process.env.REDIS_URL;
6810
6811
  if (!e) Z.warn("RYW_STORE=redis set but REDIS_URL is empty — falling back to memory store");
6811
6812
  else try {
6812
6813
  let { default: t } = await import("ioredis"), n = new t(e), r = n.duplicate();
6813
- ee = Wo({
6814
+ te = Uo({
6814
6815
  client: n,
6815
6816
  subscriber: r
6816
- }), te = "redis", Z.info(`read replicas: ryw store = redis @ ${ig(e)}`);
6817
+ }), ne = "redis", Z.info(`read replicas: ryw store = redis @ ${ig(e)}`);
6817
6818
  } catch (e) {
6818
6819
  Z.warn("RYW_STORE=redis but ioredis import / connect failed — falling back to memory store", { err: e });
6819
6820
  }
6820
6821
  }
6821
- ee ||= Po();
6822
- let y = ag(m.length), b = Jo(), C = b && y.length > 0 ? Ya({
6823
- currentRegion: b,
6824
- replicaRegions: og(g, y),
6825
- inner: Bo()
6826
- }) : Bo();
6827
- return Z.info(`read replicas: ${g.length} configured, ryw policy '${_}', dialect=${o.id}, region=${b ?? "unknown"}` + (y.length > 0 ? ", replica-locality=on" : "")), t.recordReplication({
6828
- replicaCount: g.length,
6829
- rywPolicy: _,
6830
- rywStore: te,
6831
- region: b ?? null,
6832
- localityEnabled: y.length > 0 && b !== void 0
6822
+ te ||= No();
6823
+ let y = ag(h.length), S = qo(), ie = S && y.length > 0 ? Ja({
6824
+ currentRegion: S,
6825
+ replicaRegions: og(_, y),
6826
+ inner: zo()
6827
+ }) : zo();
6828
+ return Z.info(`read replicas: ${_.length} configured, ryw policy '${v}', dialect=${s.id}, region=${S ?? "unknown"}` + (y.length > 0 ? ", replica-locality=on" : "")), t.recordReplication({
6829
+ replicaCount: _.length,
6830
+ rywPolicy: v,
6831
+ rywStore: ne,
6832
+ region: S ?? null,
6833
+ localityEnabled: y.length > 0 && S !== void 0
6833
6834
  }), new ea({
6834
- primary: p,
6835
- replicas: g,
6836
- replicationAdapter: h,
6837
- rywPolicy: _,
6838
- rywStore: ee,
6839
- replicaSelector: C
6835
+ primary: m,
6836
+ replicas: _,
6837
+ replicationAdapter: g,
6838
+ rywPolicy: v,
6839
+ rywStore: te,
6840
+ replicaSelector: ie
6840
6841
  });
6841
6842
  }, rg = async (e, t, n, r, i, a) => {
6842
- let o = Xs(t?.plugins ?? []), s = n === "postgres" || n === "mysql" || n === "mariadb", c = n === "postgres" ? "LISTEN/NOTIFY" : "binlog CDC";
6843
+ let o = Ys(t?.plugins ?? []), s = n === "postgres" || n === "mysql" || n === "mariadb", c = n === "postgres" ? "LISTEN/NOTIFY" : "binlog CDC";
6843
6844
  if (!o) return n === "memory" || n === "sqlite" || n === "turso" ? i.info(`reactivity: single-instance (${n}) — no cross-replica fan-out needed`) : s ? i.info(`reactivity: cross-instance via native ${c} (${n})`) : i.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;
6844
6845
  let l = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`;
6845
- return o.broadcast.crossReplica ? s ? i.info(`reactivity: native ${c} (${n}) + @voltro/plugin-broadcast (${o.broadcast.provider.name}) — both paths active (own-origin skip dedups)`) : i.info(`reactivity: cross-instance via @voltro/plugin-broadcast (${o.broadcast.provider.name}) for dialect '${n}'`) : i.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 Ks({
6846
+ return o.broadcast.crossReplica ? s ? i.info(`reactivity: native ${c} (${n}) + @voltro/plugin-broadcast (${o.broadcast.provider.name}) — both paths active (own-origin skip dedups)`) : i.info(`reactivity: cross-instance via @voltro/plugin-broadcast (${o.broadcast.provider.name}) for dialect '${n}'`) : i.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 Gs({
6846
6847
  store: e,
6847
6848
  provider: o.broadcast.provider,
6848
6849
  replicaId: l,
6849
- channel: qs(r, "changes"),
6850
+ channel: Ks(r, "changes"),
6850
6851
  logger: i,
6851
6852
  ...a === void 0 ? {} : { onGap: a }
6852
6853
  });
@@ -6868,48 +6869,48 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6868
6869
  return n;
6869
6870
  }, sg = async (e) => {
6870
6871
  switch (e) {
6871
- case "postgres": return (await x("@voltro/sql-postgres")).postgresReplicationAdapter();
6872
+ case "postgres": return (await b("@voltro/sql-postgres")).postgresReplicationAdapter();
6872
6873
  case "mysql":
6873
- case "mariadb": return (await x("@voltro/sql-mysql")).mysqlReplicationAdapter();
6874
- case "mssql": return (await x("@voltro/sql-mssql")).mssqlReplicationAdapter();
6874
+ case "mariadb": return (await b("@voltro/sql-mysql")).mysqlReplicationAdapter();
6875
+ case "mssql": return (await b("@voltro/sql-mssql")).mssqlReplicationAdapter();
6875
6876
  default: return null;
6876
6877
  }
6877
6878
  }, cg = async (e) => {
6878
6879
  let t = e.find((e) => !e.startsWith("-")) ?? process.cwd(), n = Bt(t), r = await _(n);
6879
6880
  return r.ran ? r.exitCode : process.env.FRAMEWORK_DEV_INNER !== "1" && process.env.WATCH !== "0" ? (yt(fl({ root: n }), { scope: "voltro:dev" }), new Promise(() => {})) : lg(n);
6880
6881
  }, lg = async (n) => {
6881
- let g = Date.now(), _ = await Qh(n), x = o({
6882
+ let g = Date.now(), _ = await Qh(n), b = o({
6882
6883
  kind: "api",
6883
6884
  configPort: _?.port,
6884
6885
  env: process.env
6885
6886
  });
6886
- for (let e of x.warnings) Z.warn(e);
6887
- let C = x.port, ie = _?.name ?? M(n), ae = Ft("api", ie, C), de = It(ie);
6887
+ for (let e of b.warnings) Z.warn(e);
6888
+ let S = b.port, ae = _?.name ?? M(n), oe = Ft("api", ae, S), fe = It(ae);
6888
6889
  await Nt({
6889
- id: ae,
6890
- name: ie,
6890
+ id: oe,
6891
+ name: ae,
6891
6892
  kind: "api",
6892
- url: `http://localhost:${C}`,
6893
+ url: `http://localhost:${S}`,
6893
6894
  pid: process.pid,
6894
6895
  status: "booting",
6895
- logFile: de.path
6896
+ logFile: fe.path
6896
6897
  }).catch(() => {});
6897
- let w = f();
6898
- y(w), Z.info("booting voltro dev", {
6898
+ let C = f();
6899
+ ne(C), Z.info("booting voltro dev", {
6899
6900
  root: n,
6900
6901
  version: Eh,
6901
- logFile: de.path
6902
+ logFile: fe.path
6902
6903
  }), h(n, Z);
6903
- let he = await fe({
6904
+ let ge = await pe({
6904
6905
  project: M(n),
6905
6906
  cliVersion: Eh
6906
6907
  });
6907
- if (he.kind === "not-personal") return Z.error(`voltro dev needs a personal login — the stored credential belongs to no user.
6908
- ${he.message}`), 1;
6909
- he.kind === "reported" && he.seat === "claimed" && Z.info("cloud: this machine now counts toward your organisation's seats (voltro cloud whoami)");
6910
- let ye = process.env.VOLTRO_DEV_HEALTH_PORT, xe = ye === void 0 ? C + 1 : Number(ye), Ce;
6911
- xe > 0 && Number.isFinite(xe) && (Ce = await um({
6912
- port: xe,
6908
+ if (ge.kind === "not-personal") return Z.error(`voltro dev needs a personal login — the stored credential belongs to no user.
6909
+ ${ge.message}`), 1;
6910
+ ge.kind === "reported" && ge.seat === "claimed" && Z.info("cloud: this machine now counts toward your organisation's seats (voltro cloud whoami)");
6911
+ let be = process.env.VOLTRO_DEV_HEALTH_PORT, Se = be === void 0 ? S + 1 : Number(be), we;
6912
+ Se > 0 && Number.isFinite(Se) && (we = await um({
6913
+ port: Se,
6913
6914
  log: {
6914
6915
  info: (e, t) => Z.debug(e, t),
6915
6916
  warn: (e, t) => Z.warn(e, t)
@@ -6922,81 +6923,81 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
6922
6923
  }).catch((e) => {
6923
6924
  Z.warn("agent-instructions seed failed (non-fatal)", {}, e);
6924
6925
  });
6925
- let T = await Fh(n);
6926
- Z.info(`discovered ${T.length} files`, { count: T.length });
6927
- let { pluginContributions: De, pluginErrorImports: ke, pluginRpcImports: Ae } = await up(_?.plugins ?? [], _?.name ?? M(n), n), je = await Et({
6926
+ let w = await Fh(n);
6927
+ Z.info(`discovered ${w.length} files`, { count: w.length });
6928
+ let { pluginContributions: Oe, pluginErrorImports: Ae, pluginRpcImports: je } = await up(_?.plugins ?? [], _?.name ?? M(n), n), Me = await Et({
6928
6929
  root: n,
6929
- ...De.length > 0 ? { pluginContributions: De } : {},
6930
- ...ke.length > 0 ? { pluginErrorImports: ke } : {},
6931
- ...Ae.length > 0 ? { pluginRpcImports: Ae } : {},
6930
+ ...Oe.length > 0 ? { pluginContributions: Oe } : {},
6931
+ ...Ae.length > 0 ? { pluginErrorImports: Ae } : {},
6932
+ ...je.length > 0 ? { pluginRpcImports: je } : {},
6932
6933
  ..._?.name === void 0 ? {} : { apiName: _.name }
6933
6934
  });
6934
- if (je ? (Z.info("codegen wrote rpcGroup", { path: zt(n, je) }), await Ct(je)) : Z.debug("codegen skipped — no descriptors discovered"), process.env.VOLTRO_BROWSER_SAFETY !== "off") {
6935
- let e = await wt(n, T);
6935
+ if (Me ? (Z.info("codegen wrote rpcGroup", { path: zt(n, Me) }), await Ct(Me)) : Z.debug("codegen skipped — no descriptors discovered"), process.env.VOLTRO_BROWSER_SAFETY !== "off") {
6936
+ let e = await wt(n, w);
6936
6937
  if (e.length > 0) throw Error(e.map(Tt).join("\n\n"));
6937
6938
  }
6938
- let Me = $(_ ?? null), Pe = Me === "mariadb" ? "mariadb" : Me === "mssql" ? "mssql" : void 0, { queries: E, mutations: D, actions: O, streams: Ge, events: qe, workflows: A, workflowWorkers: Xe, eventTriggers: Ze, schedules: Qe, connections: et, tables: nt, featureMix: it, tenantScopedTables: ot, softDeleteScopedTables: st, serverOnlyLeaks: ct, cacheScopeLeaks: ft } = await Xh(T, { cdc: Pe !== void 0 && (process.env.CDC ?? "1") !== "0" }), pt = Hl({
6939
- queries: E,
6940
- mutations: D,
6941
- actions: O,
6942
- streams: Ge,
6943
- events: qe
6939
+ let Ne = $(_ ?? null), Fe = Ne === "mariadb" ? "mariadb" : Ne === "mssql" ? "mssql" : void 0, { queries: T, mutations: E, actions: D, streams: Ke, events: Je, workflows: k, workflowWorkers: Ze, eventTriggers: Qe, schedules: $e, connections: tt, tables: rt, featureMix: at, tenantScopedTables: st, softDeleteScopedTables: ct, serverOnlyLeaks: lt, cacheScopeLeaks: pt } = await Xh(w, { cdc: Fe !== void 0 && (process.env.CDC ?? "1") !== "0" }), mt = Hl({
6940
+ queries: T,
6941
+ mutations: E,
6942
+ actions: D,
6943
+ streams: Ke,
6944
+ events: Je
6944
6945
  });
6945
6946
  {
6946
- let e = Il(ct, Fl(process.env, "warn"), ja, "`voltro dev`");
6947
+ let e = Il(lt, Fl(process.env, "warn"), ja, "`voltro dev`");
6947
6948
  if (e.action === "fail") throw Error(e.message);
6948
6949
  e.action === "warn" && Z.warn(e.message ?? "");
6949
6950
  }
6950
6951
  {
6951
- let e = Il(ft, Fl(process.env, "warn"), Aa, "`voltro dev`");
6952
+ let e = Il(pt, Fl(process.env, "warn"), Aa, "`voltro dev`");
6952
6953
  if (e.action === "fail") throw Error(e.message);
6953
6954
  e.action === "warn" && Z.warn(e.message ?? "");
6954
6955
  }
6955
- Wl(pt, {
6956
+ Wl(mt, {
6956
6957
  defaultDeny: Bl(_),
6957
6958
  commandHint: "`voltro dev`"
6958
6959
  });
6959
- let ht = A.length > 0 || Ze.length > 0, j = await Qh(n), gt = Kc(j?.http ?? {});
6960
- es(Yo(j?.secrets));
6961
- let _t = _c(_s(j?.env) ? j.env : void 0, n);
6962
- _t.minted.length > 0 && _t.file !== void 0 && (Z.warn(`minted ${_t.minted.length} project secret(s) into ${zt(n, _t.file)} — unique to this project, gitignored. Your DEPLOYMENT needs its own values (\`voltro secret generate\`).`, {
6963
- keys: _t.minted,
6964
- file: zt(n, _t.file)
6965
- }), e.includes(_t.file) || e.unshift(_t.file)), _t.ownershipWarning !== void 0 && Z.warn(_t.ownershipWarning), await v({
6966
- rawEnv: j?.env,
6960
+ let gt = k.length > 0 || Qe.length > 0, A = await Qh(n), _t = Kc(A?.http ?? {});
6961
+ $o(Jo(A?.secrets));
6962
+ let j = gc(gs(A?.env) ? A.env : void 0, n);
6963
+ j.minted.length > 0 && j.file !== void 0 && (Z.warn(`minted ${j.minted.length} project secret(s) into ${zt(n, j.file)} — unique to this project, gitignored. Your DEPLOYMENT needs its own values (\`voltro secret generate\`).`, {
6964
+ keys: j.minted,
6965
+ file: zt(n, j.file)
6966
+ }), e.includes(j.file) || e.unshift(j.file)), j.ownershipWarning !== void 0 && Z.warn(j.ownershipWarning), await v({
6967
+ rawEnv: A?.env,
6967
6968
  appType: "api",
6968
6969
  root: n,
6969
6970
  log: Z,
6970
6971
  generateTypes: !0
6971
6972
  });
6972
- let vt = { current: void 0 }, yt = j?.apiKeys;
6973
+ let vt = { current: void 0 }, yt = A?.apiKeys;
6973
6974
  if (yt) {
6974
- let e = new Set((j?.plugins ?? []).flatMap((e) => e.declaredScopes ?? []));
6975
+ let e = new Set((A?.plugins ?? []).flatMap((e) => e.declaredScopes ?? []));
6975
6976
  e.size > 0 && ![
6976
6977
  "apikeys:issue:self",
6977
6978
  "apikeys:issue:org",
6978
6979
  "apikeys:issue:other"
6979
6980
  ].some((t) => e.has(t)) && !e.has("admin:full") && Z.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).");
6980
6981
  }
6981
- let bt = (typeof yt == "object" ? yt.prefix : void 0) ?? "voltro_", xt, Dt = yt ? [Na({ resolveByHash: (e, t) => xt ? xt.resolveByHash(e, t) : Promise.resolve(null) }, { prefix: bt })] : [], Rt = kh([...j?.auth?.strategies ?? [], ...Dt], Ls(j?.plugins ?? []), j?.auth?.anonymousTenantRequired ?? !1, j?.auth, () => vt.current), Bt = io({ resolveSubject: Rt }), Vt = Te({
6982
+ let bt = (typeof yt == "object" ? yt.prefix : void 0) ?? "voltro_", xt, Dt = yt ? [Na({ resolveByHash: (e, t) => xt ? xt.resolveByHash(e, t) : Promise.resolve(null) }, { prefix: bt })] : [], Rt = kh([...A?.auth?.strategies ?? [], ...Dt], Is(A?.plugins ?? []), A?.auth?.anonymousTenantRequired ?? !1, A?.auth, () => vt.current), Bt = ro({ resolveSubject: Rt }), Vt = Ee({
6982
6983
  nodeEnv: process.env.NODE_ENV,
6983
- cdcDialect: Pe,
6984
- declared: j?.schema
6985
- }), Ht = ve({
6984
+ cdcDialect: Fe,
6985
+ declared: A?.schema
6986
+ }), Ht = ye({
6986
6987
  gates: Vt,
6987
6988
  runtime: {
6988
6989
  traces: im(),
6989
- undo: us()
6990
+ undo: ls()
6990
6991
  }
6991
6992
  });
6992
6993
  if (Ht !== void 0) throw r(`dev: ${Ht}`);
6993
- let Ut = we({
6994
- mix: it,
6995
- plugins: j?.plugins ?? [],
6994
+ let Ut = Te({
6995
+ mix: at,
6996
+ plugins: A?.plugins ?? [],
6996
6997
  gates: Vt,
6997
- ...Pe ? { cdcDialect: Pe } : {}
6998
- }), Gt = j?.analytics?.tables ?? [], P = (() => {
6999
- let e = new Set(nt.map((e) => e.tableName)), t = [...nt];
6998
+ ...Fe ? { cdcDialect: Fe } : {}
6999
+ }), Gt = A?.analytics?.tables ?? [], P = (() => {
7000
+ let e = new Set(rt.map((e) => e.tableName)), t = [...rt];
7000
7001
  for (let n of [...Ut, ...Gt]) {
7001
7002
  let r = n.tableName;
7002
7003
  r === void 0 || e.has(r) || (e.add(r), t.push(n));
@@ -7005,7 +7006,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7005
7006
  })();
7006
7007
  for (let e of P) mi(e);
7007
7008
  {
7008
- let e = Ma(ps(E.map((e) => ({
7009
+ let e = Ma(fs(T.map((e) => ({
7009
7010
  name: e.descriptor.name,
7010
7011
  source: e.descriptor.source
7011
7012
  })), new Set(P.flatMap((e) => {
@@ -7015,47 +7016,47 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7015
7016
  e !== void 0 && Z.warn(e);
7016
7017
  }
7017
7018
  let Kt = Af({
7018
- plugins: j?.plugins ?? [],
7019
- appName: j?.name ?? M(n),
7019
+ plugins: A?.plugins ?? [],
7020
+ appName: A?.name ?? M(n),
7020
7021
  appType: "api",
7021
7022
  voltroVersion: process.env.npm_package_version ?? "0.0.0",
7022
7023
  log: Z
7023
7024
  });
7024
- j?.plugins?.length && (Z.info("plugins loaded", { plugins: j.plugins.map((e) => e.name) }), await Kt.activate());
7025
- let qt = await Kt.gatherObservability(), Jt = Bf(j?.plugins ?? []);
7025
+ A?.plugins?.length && (Z.info("plugins loaded", { plugins: A.plugins.map((e) => e.name) }), await Kt.activate());
7026
+ let qt = await Kt.gatherObservability(), Jt = Bf(A?.plugins ?? []);
7026
7027
  Jt.endpoints.length > 0 && Z.info("plugin inspect endpoints registered", {
7027
7028
  count: Jt.endpoints.length,
7028
7029
  endpoints: Jt.endpoints.map((e) => `${e.method} ${e.path}`)
7029
7030
  });
7030
- let Yt = rp(j?.plugins ?? []);
7031
+ let Yt = rp(A?.plugins ?? []);
7031
7032
  Yt.length > 0 && Z.info("plugin dashboard mounts registered", {
7032
7033
  count: Yt.length,
7033
7034
  mounts: Yt.map((e) => `${e.fullId} (${e.slot})`)
7034
7035
  });
7035
- let Xt = Oe(j?.plugins ?? []);
7036
+ let Xt = ke(A?.plugins ?? []);
7036
7037
  Xt.length > 0 && Z.info("plugin schema contributions", { plugins: Xt.map((e) => `${e.pluginName}: ${e.tables}t/${e.migrations}m`) });
7037
- let tn = pe(j?.plugins ?? []);
7038
+ let tn = me(A?.plugins ?? []);
7038
7039
  if (tn.length > 0) {
7039
7040
  let e = [
7041
+ ...T.map((e) => e.descriptor.name),
7040
7042
  ...E.map((e) => e.descriptor.name),
7041
7043
  ...D.map((e) => e.descriptor.name),
7042
- ...O.map((e) => e.descriptor.name),
7043
- ...Ge.map((e) => e.descriptor.name)
7044
+ ...Ke.map((e) => e.descriptor.name)
7044
7045
  ], t = /* @__PURE__ */ new Set([
7046
+ ...T.filter((e) => e.descriptor.overridesPlugin === !0).map((e) => e.descriptor.name),
7045
7047
  ...E.filter((e) => e.descriptor.overridesPlugin === !0).map((e) => e.descriptor.name),
7046
- ...D.filter((e) => e.descriptor.overridesPlugin === !0).map((e) => e.descriptor.name),
7047
- ...O.filter((e) => e.descriptor.overridesPlugin === !0).map((e) => e.descriptor.name)
7048
- ]), n = me(tn, e, t);
7048
+ ...D.filter((e) => e.descriptor.overridesPlugin === !0).map((e) => e.descriptor.name)
7049
+ ]), n = he(tn, e, t);
7049
7050
  tn.length - n.length > 0 && Z.info(`plugin routes overridden by app procedures: ${[...t].join(", ")}`);
7050
- for (let e of n) e.kind === "query" ? E.push({
7051
+ for (let e of n) e.kind === "query" ? T.push({
7051
7052
  file: e.file,
7052
7053
  descriptor: e.descriptor,
7053
7054
  executor: e.executor
7054
- }) : e.kind === "mutation" ? D.push({
7055
+ }) : e.kind === "mutation" ? E.push({
7055
7056
  file: e.file,
7056
7057
  descriptor: e.descriptor,
7057
7058
  executor: e.executor
7058
- }) : O.push({
7059
+ }) : D.push({
7059
7060
  file: e.file,
7060
7061
  descriptor: e.descriptor,
7061
7062
  executor: e.executor
@@ -7065,20 +7066,20 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7065
7066
  routes: tn.map((e) => `${e.plugin.name}:${e.descriptor.name} (${e.kind})`)
7066
7067
  });
7067
7068
  }
7068
- let nn = Z.child("agent"), on = T.filter((e) => be.test(M(e)));
7069
+ let nn = Z.child("agent"), on = w.filter((e) => xe.test(M(e)));
7069
7070
  if (on.length > 0) {
7070
- let e = await Ee(on, nn);
7071
+ let e = await De(on, nn);
7071
7072
  e > 0 && nn.info("wired tool handlers", { tools: e });
7072
7073
  }
7073
- let cn = T.filter((e) => Se.test(M(e))), ln = [];
7074
+ let cn = w.filter((e) => Ce.test(M(e))), ln = [];
7074
7075
  if (cn.length > 0) {
7075
- let e = await ge(cn, nn);
7076
+ let e = await _e(cn, nn);
7076
7077
  ln = e.agents.map((e) => e.descriptor.name);
7077
- for (let t of e.agents) for (let e of uf(t)) e.kind === "action" ? O.push({
7078
+ for (let t of e.agents) for (let e of uf(t)) e.kind === "action" ? D.push({
7078
7079
  file: e.file,
7079
7080
  descriptor: e.descriptor,
7080
7081
  executor: e.executor
7081
- }) : E.push({
7082
+ }) : T.push({
7082
7083
  file: e.file,
7083
7084
  descriptor: e.descriptor,
7084
7085
  executor: e.executor
@@ -7093,31 +7094,31 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7093
7094
  let e = pf();
7094
7095
  e !== void 0 && Z.info(e);
7095
7096
  }
7096
- (un.queries.length > 0 || un.mutations.length > 0) && (E.push(...un.queries), D.push(...un.mutations), Z.info("undo built-ins registered", { routes: [
7097
+ (un.queries.length > 0 || un.mutations.length > 0) && (T.push(...un.queries), E.push(...un.mutations), Z.info("undo built-ins registered", { routes: [
7097
7098
  "__voltro.undo.log",
7098
7099
  "__voltro.undo.apply",
7099
7100
  "__voltro.undo.redo"
7100
7101
  ] }));
7101
- let dn = Z.child("aggregate"), fn = T.filter((e) => Ve.test(e)), pn = fn.length > 0 ? await yu(fn, dn) : [], mn = pn.map((e) => e.definition.name), hn = Z.child("expectation"), gn = T.filter((e) => Be.test(e)), _n = gn.length > 0 ? await zu(gn, hn) : [], vn = Z.child("finops"), yn = T.filter((e) => Le.test(e)), bn = yn.length > 0 ? await Bu(yn, vn) : [], xn = Z.child("experiment"), Sn = T.filter((e) => Fe.test(e)), Cn = Sn.length > 0 ? await Vu(Sn, xn) : [];
7102
+ let dn = Z.child("aggregate"), fn = w.filter((e) => He.test(e)), pn = fn.length > 0 ? await yu(fn, dn) : [], mn = pn.map((e) => e.definition.name), hn = Z.child("expectation"), gn = w.filter((e) => Ve.test(e)), _n = gn.length > 0 ? await zu(gn, hn) : [], vn = Z.child("finops"), yn = w.filter((e) => Re.test(e)), bn = yn.length > 0 ? await Bu(yn, vn) : [], xn = Z.child("experiment"), Sn = w.filter((e) => Ie.test(e)), Cn = Sn.length > 0 ? await Vu(Sn, xn) : [];
7102
7103
  for (let e of fi()) Z.warn(`identifier length · ${e}`);
7103
- let wn = j?.restRoutes ?? [], Tn = T.filter((e) => Ue.test(e)).length, On = T.filter((e) => Ne.test(e)).length, An = T.filter((e) => /\.seed\.ts$/.test(e)).length, Mn = T.filter((e) => Ie.test(e)).length, Nn = T.filter((e) => $d.test(e)).length;
7104
- tc(ec([
7104
+ let wn = A?.restRoutes ?? [], Tn = w.filter((e) => We.test(e)).length, On = w.filter((e) => Pe.test(e)).length, An = w.filter((e) => /\.seed\.ts$/.test(e)).length, Mn = w.filter((e) => Le.test(e)).length, Nn = w.filter((e) => $d.test(e)).length;
7105
+ ec($s([
7106
+ T,
7105
7107
  E,
7106
7108
  D,
7107
- O,
7108
- Ge
7109
+ Ke
7109
7110
  ]), (e) => {
7110
7111
  Z.warn(e);
7111
7112
  }), Z.info("app surface", {
7112
- queryCount: E.length,
7113
- mutationCount: D.length,
7114
- actionCount: O.length,
7115
- streamCount: Ge.length,
7113
+ queryCount: T.length,
7114
+ mutationCount: E.length,
7115
+ actionCount: D.length,
7116
+ streamCount: Ke.length,
7116
7117
  restRouteCount: wn.length,
7117
- workflowCount: A.length,
7118
- workflowWorkerCount: Xe.length,
7119
- triggerCount: Ze.length,
7120
- scheduleCount: Qe.length,
7118
+ workflowCount: k.length,
7119
+ workflowWorkerCount: Ze.length,
7120
+ triggerCount: Qe.length,
7121
+ scheduleCount: $e.length,
7121
7122
  agentCount: ln.length,
7122
7123
  aggregateCount: mn.length,
7123
7124
  expectationCount: _n.length,
@@ -7128,17 +7129,17 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7128
7129
  seedCount: An,
7129
7130
  webhookCount: Mn,
7130
7131
  emailCount: Nn,
7131
- tenantTables: [...ot]
7132
+ tenantTables: [...st]
7132
7133
  }), Zt({
7133
- appName: j?.name ?? M(n),
7134
- queries: E.map((e) => e.descriptor.name),
7135
- mutations: D.map((e) => e.descriptor.name),
7136
- actions: O.map((e) => e.descriptor.name),
7137
- streams: Ge.map((e) => e.descriptor.name),
7134
+ appName: A?.name ?? M(n),
7135
+ queries: T.map((e) => e.descriptor.name),
7136
+ mutations: E.map((e) => e.descriptor.name),
7137
+ actions: D.map((e) => e.descriptor.name),
7138
+ streams: Ke.map((e) => e.descriptor.name),
7138
7139
  restRoutes: wn.map((e) => `${e.method} ${e.path}`),
7139
- workflows: A.map((e) => e.definition.name),
7140
- triggers: Ze.map((e) => `${e.event}→${e.workflow}`),
7141
- schedules: Qe.map((e) => e.name),
7140
+ workflows: k.map((e) => e.definition.name),
7141
+ triggers: Qe.map((e) => `${e.event}→${e.workflow}`),
7142
+ schedules: $e.map((e) => e.name),
7142
7143
  agents: ln,
7143
7144
  aggregates: mn,
7144
7145
  lifecycle: {
@@ -7148,16 +7149,16 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7148
7149
  webhooks: Mn,
7149
7150
  emails: Nn
7150
7151
  },
7151
- tenantTables: [...ot]
7152
+ tenantTables: [...st]
7152
7153
  });
7153
7154
  let Pn = Qp(), Fn = (process.env.VOLTRO_TRACING_BUFFER ?? "").toLowerCase() === "off", In = (process.env.VOLTRO_TRACING_STREAM ?? "").toLowerCase() === "all", Yn = () => {}, Xn = (e) => {
7154
7155
  if (!e.name.startsWith("http.server")) return !1;
7155
7156
  let t = e.attributes, n = String(t["url.path"] ?? t["http.route"] ?? t["http.target"] ?? "");
7156
7157
  return n.startsWith("/_voltro/") || n === "/ws" || n.startsWith("/ws/") || n.startsWith("/ws?");
7157
7158
  }, Zn = (e) => {
7158
- Xn(e) || Up(e) || e.name.startsWith("RpcServer.") || (Pn.append(e), (In || e.status === "error") && w.emit("trace", e), Yn(e));
7159
- }, Qn = Fn ? void 0 : ao(Zn), L = await ga({
7160
- serviceName: process.env.OTEL_SERVICE_NAME ?? j?.name ?? "voltro-api",
7159
+ Xn(e) || Up(e) || e.name.startsWith("RpcServer.") || (Pn.append(e), (In || e.status === "error") && C.emit("trace", e), Yn(e));
7160
+ }, Qn = Fn ? void 0 : io(Zn), L = await ga({
7161
+ serviceName: process.env.OTEL_SERVICE_NAME ?? A?.name ?? "voltro-api",
7161
7162
  ...Qn ? { traceSink: Qn } : {},
7162
7163
  ...qt.spanProcessors.length > 0 ? { extraSpanProcessors: qt.spanProcessors } : {},
7163
7164
  ...qt.metricReaders.length > 0 ? { extraMetricReaders: qt.metricReaders } : {},
@@ -7165,33 +7166,33 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7165
7166
  ...qt.sampler === void 0 ? {} : { sampler: qt.sampler }
7166
7167
  });
7167
7168
  L.mode === "off" ? L.bufferOnly || Z.info("tracing disabled", { reason: "buffer off" }) : Z.info("tracing enabled", { mode: L.mode });
7168
- let er = L.mode === "off" && L.bufferOnly === !1 ? void 0 : L.layer, R = await ng(j, er), tr = hs(R, $(j ?? null));
7169
+ let er = L.mode === "off" && L.bufferOnly === !1 ? void 0 : L.layer, R = await ng(A, er, void 0, { schemaWorkFollows: !0 }), tr = ms(R, $(A ?? null));
7169
7170
  vt.current = tr;
7170
7171
  let rr = vf({
7171
7172
  store: R,
7172
- defaultExpiryMs: gf(j)
7173
+ defaultExpiryMs: gf(A)
7173
7174
  });
7174
- E.push(...rr.queries), D.push(...rr.mutations);
7175
- let ar = [...D.map((e) => e.descriptor), ...O.map((e) => e.descriptor)];
7175
+ T.push(...rr.queries), E.push(...rr.mutations);
7176
+ let ar = [...E.map((e) => e.descriptor), ...D.map((e) => e.descriptor)];
7176
7177
  _f(ar) && Z.info("approvals: `requiresApproval` declared — the second-human gate is active", { procedures: ar.filter((e) => e.requiresApproval != null).map((e) => e.name ?? "?") });
7177
- for (let e of Ec({
7178
- dialect: $(j ?? null),
7178
+ for (let e of Tc({
7179
+ dialect: $(A ?? null),
7179
7180
  changeStrategy: (process.env.CDC ?? "1") === "0" ? "inline" : "cdc",
7180
7181
  dbUrl: process.env.DB_URL,
7181
- crossReplicaBus: Xs(j?.plugins ?? [])?.broadcast.crossReplica === !0,
7182
+ crossReplicaBus: Ys(A?.plugins ?? [])?.broadcast.crossReplica === !0,
7182
7183
  tables: oi().map((e) => ({
7183
7184
  tableName: e.tableName,
7184
7185
  isReactive: e.isReactive === !0
7185
7186
  })),
7186
- querySources: E.flatMap((e) => {
7187
+ querySources: T.flatMap((e) => {
7187
7188
  let t = e.descriptor.source;
7188
7189
  return t === void 0 ? [] : typeof t == "string" ? [t] : [...t];
7189
7190
  })
7190
7191
  })) e.level === "warn" ? Z.warn(e.message) : Z.info(e.message);
7191
7192
  {
7192
- let e = Ac(kc({
7193
+ let e = kc(Oc({
7193
7194
  tables: oi().map((e) => ({ tableName: e.tableName })),
7194
- queries: E.map((e) => ({
7195
+ queries: T.map((e) => ({
7195
7196
  name: e.descriptor.name,
7196
7197
  source: e.descriptor.source
7197
7198
  }))
@@ -7199,22 +7200,22 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7199
7200
  e !== void 0 && Z.warn(e);
7200
7201
  }
7201
7202
  if (yt) {
7202
- let e = Ca(R), t = $a({ flush: eo(e) });
7203
- U(() => t.shutdown()), xt = Qa(e, {
7203
+ let e = Ca(R), t = Qa({ flush: $a(e) });
7204
+ W(() => t.shutdown()), xt = Za(e, {
7204
7205
  prefix: bt,
7205
7206
  usage: t
7206
7207
  }), Z.info("api keys active", { prefix: bt });
7207
7208
  }
7208
7209
  let or = Tl({
7209
- definitions: et.map((e) => e.definition),
7210
+ definitions: tt.map((e) => e.definition),
7210
7211
  store: R,
7211
- publicUrl: Dl(C),
7212
+ publicUrl: Dl(S),
7212
7213
  log: Z.child("connections")
7213
7214
  });
7214
- E.push(...or.queries), D.push(...or.mutations), O.push(...or.actions);
7215
- let cr = $(j), lr = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, gr, _r;
7215
+ T.push(...or.queries), E.push(...or.mutations), D.push(...or.actions);
7216
+ let cr = $(A), lr = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, gr, _r;
7216
7217
  if (cr !== "memory") {
7217
- let e = await S(cr);
7218
+ let e = await x(cr);
7218
7219
  gr = $n.make(e.makeSqlLayer(Q())), _r = await gr.runPromise(nr.SqlClient);
7219
7220
  }
7220
7221
  let vr = [
@@ -7222,17 +7223,17 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7222
7223
  "mariadb",
7223
7224
  "mysql",
7224
7225
  "mssql"
7225
- ].includes(cr) ? Za(R, lr, Z) : rs, yr = dd(j?.scheduling), br = lo({
7226
+ ].includes(cr) ? Xa(R, lr, Z) : ns, yr = dd(A?.scheduling), br = co({
7226
7227
  coordinator: vr,
7227
7228
  replicaId: lr,
7228
7229
  log: Z,
7229
7230
  maxIdleIntervalMs: yr.pollCeilingMs
7230
- }), xr = [], Sr = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, Tr = ph(j?.plugins, j?.name ?? M(n));
7231
+ }), xr = [], Sr = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, Tr = ph(A?.plugins, A?.name ?? M(n));
7231
7232
  {
7232
- let e = mh(j?.plugins, j?.name ?? M(n));
7233
+ let e = mh(A?.plugins, A?.name ?? M(n));
7233
7234
  e !== void 0 && Z.warn(e);
7234
7235
  }
7235
- let Er = vh(j?.plugins, Tr, Z), Dr = Xs(j?.plugins ?? [])?.broadcast?.provider, Or = bh(j?.plugins, {
7236
+ let Er = vh(A?.plugins, Tr, Z), Dr = Ys(A?.plugins ?? [])?.broadcast?.provider, Or = bh(A?.plugins, {
7236
7237
  instanceId: Sr,
7237
7238
  namespace: Tr,
7238
7239
  meta: { mode: "dev" },
@@ -7242,29 +7243,29 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7242
7243
  instanceId: Sr,
7243
7244
  membership: Or.membership,
7244
7245
  ...Dr === void 0 ? {} : { broadcast: Dr },
7245
- broadcastChannels: { presence: qs(Tr, "presence") },
7246
+ broadcastChannels: { presence: Ks(Tr, "presence") },
7246
7247
  scheduleCoordinated: (e, t, n) => {
7247
7248
  let r = br(e, t, n);
7248
7249
  return xr.push(r), r;
7249
7250
  }
7250
7251
  };
7251
- for (let e of j?.plugins ?? []) e.bindDataStore?.(tr, kr);
7252
- let jr = $(j), Mr, Nr = await rg(R, j, jr, Tr, Z, (e, t) => {
7252
+ for (let e of A?.plugins ?? []) e.bindDataStore?.(tr, kr);
7253
+ let jr = $(A), Mr, Nr = await rg(R, A, jr, Tr, Z, (e, t) => {
7253
7254
  Mr?.refreshAll(`broadcast gap: missed ${t} change(s) from ${e}`);
7254
7255
  }), Pr = pd({
7255
7256
  changeScope: R.changeScope,
7256
7257
  broadcastAttached: Nr !== void 0
7257
7258
  });
7258
- j?.cache && !process.env.CACHE_BACKEND && (process.env.CACHE_BACKEND = j.cache), j?.cacheRedisUrl && !process.env.CACHE_REDIS_URL && (process.env.CACHE_REDIS_URL = j.cacheRedisUrl), j?.cacheRedisDriver && !process.env.CACHE_REDIS_DRIVER && (process.env.CACHE_REDIS_DRIVER = j.cacheRedisDriver), j?.cacheKeyPrefix && !process.env.CACHE_KEY_PREFIX && (process.env.CACHE_KEY_PREFIX = j.cacheKeyPrefix);
7259
- let { service: Ir, invalidationBus: Lr, snapshotCache: Rr, cache: zr, semantic: Br, evictSource: Wr, backend: Gr, stats: Kr, dispose: Yr } = await Ic({
7259
+ A?.cache && !process.env.CACHE_BACKEND && (process.env.CACHE_BACKEND = A.cache), A?.cacheRedisUrl && !process.env.CACHE_REDIS_URL && (process.env.CACHE_REDIS_URL = A.cacheRedisUrl), A?.cacheRedisDriver && !process.env.CACHE_REDIS_DRIVER && (process.env.CACHE_REDIS_DRIVER = A.cacheRedisDriver), A?.cacheKeyPrefix && !process.env.CACHE_KEY_PREFIX && (process.env.CACHE_KEY_PREFIX = A.cacheKeyPrefix);
7260
+ let { service: Ir, invalidationBus: Lr, snapshotCache: Rr, cache: zr, semantic: Br, evictSource: Wr, backend: Gr, stats: Kr, dispose: Yr } = await Fc({
7260
7261
  env: process.env,
7261
- semantic: j?.cacheSemantic ?? !1
7262
+ semantic: A?.cacheSemantic ?? !1
7262
7263
  });
7263
- Br !== void 0 && Z.info("semantic cache enabled — reactive eviction on live writes"), Z.info(`cache backend resolved: ${Gr}` + (Gr === "redis" ? ` (driver ${process.env.CACHE_REDIS_DRIVER ?? "resp"})` : " — in-process, not cross-instance")), j?.kv && !process.env.KV_BACKEND && (process.env.KV_BACKEND = j.kv), j?.kvRedisUrl && !process.env.KV_REDIS_URL && (process.env.KV_REDIS_URL = j.kvRedisUrl), j?.kvKeyPrefix && !process.env.KV_KEY_PREFIX && (process.env.KV_KEY_PREFIX = j.kvKeyPrefix);
7264
- let { kv: Qr, service: ni, backend: ri } = await ro({ store: R });
7264
+ Br !== void 0 && Z.info("semantic cache enabled — reactive eviction on live writes"), Z.info(`cache backend resolved: ${Gr}` + (Gr === "redis" ? ` (driver ${process.env.CACHE_REDIS_DRIVER ?? "resp"})` : " — in-process, not cross-instance")), A?.kv && !process.env.KV_BACKEND && (process.env.KV_BACKEND = A.kv), A?.kvRedisUrl && !process.env.KV_REDIS_URL && (process.env.KV_REDIS_URL = A.kvRedisUrl), A?.kvKeyPrefix && !process.env.KV_KEY_PREFIX && (process.env.KV_KEY_PREFIX = A.kvKeyPrefix);
7265
+ let { kv: Qr, service: ni, backend: ri } = await no({ store: R });
7265
7266
  Z.info(`kv backend resolved: ${ri}` + (ri === "database" ? " (durable, _voltro_kv)" : ri === "memory" ? " — in-process, non-durable" : ` (driver ${process.env.KV_REDIS_DRIVER ?? "resp"}, non-durable)`));
7266
- let ii = $(j), ai = j?.analytics !== void 0 && j.analytics.kind !== "noop" && ii !== "memory" ? (await S(ii)).makeSqlLayer(Q()) : void 0, li = await pl({
7267
- spec: j?.analytics,
7267
+ let ii = $(A), ai = A?.analytics !== void 0 && A.analytics.kind !== "noop" && ii !== "memory" ? (await x(ii)).makeSqlLayer(Q()) : void 0, li = await pl({
7268
+ spec: A?.analytics,
7268
7269
  sqlLayer: ai,
7269
7270
  log: Z
7270
7271
  });
@@ -7284,27 +7285,27 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7284
7285
  log: Z
7285
7286
  }), await li.dispose();
7286
7287
  })()), gi);
7287
- U(_i);
7288
- let vi = $(j), yi;
7288
+ W(_i);
7289
+ let vi = $(A), yi;
7289
7290
  if (vi !== "memory" && process.env.VOLTRO_AUTO_MIGRATE !== "0") {
7290
7291
  let e = Date.now(), t = (process.env.NODE_ENV ?? "").toLowerCase() === "production" ? "prod" : (process.env.NODE_ENV ?? "").toLowerCase() === "staging" ? "staging" : "dev";
7291
7292
  Z.info("auto-migrate: planning schema", {
7292
7293
  dialect: vi,
7293
7294
  env: t,
7294
7295
  tables: P.length
7295
- }), Ce?.set({
7296
+ }), we?.set({
7296
7297
  phase: "migrating",
7297
7298
  tablesTotal: P.length
7298
7299
  });
7299
7300
  try {
7300
- let r = await S(vi), i = r.makeSqlLayer(Q());
7301
+ let r = await x(vi), i = r.makeSqlLayer(Q());
7301
7302
  yi = i;
7302
7303
  let a = Uh(P.filter((e) => e.tableName.startsWith("_voltro_") || e.tableName === "voltro_isr_cache"), P);
7303
7304
  await dr(a, i, r.id, { retryFilter: r.retryFilter });
7304
- let o = Fc({
7305
+ let o = Pc({
7305
7306
  conn: Q(),
7306
7307
  pendingIds: await F.runPromise(nr.SqlClient.pipe(F.flatMap((e) => sr(e, n)), F.provide(i))),
7307
- optIn: process.env[jc] === "1"
7308
+ optIn: process.env[Ac] === "1"
7308
7309
  });
7309
7310
  if (!o.allowed) throw Z.error(`file-based migrations: ${o.message}`), Error("file-based migrations refused — see error above");
7310
7311
  let s = await F.runPromise(nr.SqlClient.pipe(F.flatMap((e) => ur(e, {
@@ -7321,28 +7322,28 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7321
7322
  if (c.kind === "refused-blocked" || c.kind === "prod-mismatch") throw Z.error(ir(c, r.id)), Error("auto-migrate refused — see error above");
7322
7323
  Z.info(ir(c, r.id), { durationMs: Date.now() - e });
7323
7324
  } catch (e) {
7324
- throw Z.error("auto-migrate failed — aborting boot", { err: e }), Ce?.set({
7325
+ throw Z.error("auto-migrate failed — aborting boot", { err: e }), we?.set({
7325
7326
  phase: "error",
7326
7327
  error: e instanceof Error ? e.message : String(e)
7327
7328
  }), e;
7328
7329
  }
7329
7330
  } else vi !== "memory" && Z.info("auto-migrate: skipped (VOLTRO_AUTO_MIGRATE=0)");
7330
- await le({
7331
+ await ue({
7331
7332
  dialectId: vi,
7332
7333
  tables: P,
7333
- mode: oe(j?.reactiveTriggers),
7334
+ mode: se(A?.reactiveTriggers),
7334
7335
  lockSchema: Q().schema,
7335
- makeLayer: async () => (await S(vi)).makeSqlLayer(Q()),
7336
+ makeLayer: async () => (await x(vi)).makeSqlLayer(Q()),
7336
7337
  log: {
7337
7338
  info: (e, t) => Z.info(e, t ?? {}),
7338
7339
  warn: (e, t) => Z.warn(e, t ?? {})
7339
7340
  }
7340
7341
  });
7341
- let bi = $(j);
7342
- if ((j?.plugins ?? []).some((e) => (e.extendSchema?.migrations?.length ?? 0) > 0) && bi !== "memory") {
7343
- let e = (await S(bi)).makeSqlLayer(Q());
7342
+ let bi = $(A);
7343
+ if ((A?.plugins ?? []).some((e) => (e.extendSchema?.migrations?.length ?? 0) > 0) && bi !== "memory") {
7344
+ let e = (await x(bi)).makeSqlLayer(Q());
7344
7345
  try {
7345
- let t = await F.runPromise(_e(j.plugins).pipe(F.provide(e))), n = t.filter((e) => e.status === "applied"), r = t.filter((e) => e.status === "skipped");
7346
+ let t = await F.runPromise(ve(A.plugins).pipe(F.provide(e))), n = t.filter((e) => e.status === "applied"), r = t.filter((e) => e.status === "skipped");
7346
7347
  Z.info("plugin migrations complete", {
7347
7348
  applied: n.map((e) => `${e.pluginName}:${e.migrationId} (${e.durationMs}ms)`),
7348
7349
  skippedCount: r.length
@@ -7351,67 +7352,76 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7351
7352
  throw Z.error("plugin migrations failed — aborting boot", { err: e }), e;
7352
7353
  }
7353
7354
  }
7354
- let xi = Rp(R, w);
7355
- U(() => {
7355
+ if (R.refreshChangeCaptureExclusions) try {
7356
+ let e = await R.refreshChangeCaptureExclusions();
7357
+ (e.readmitted.length > 0 || e.newlyExcluded.length > 0) && Z.info("cdc: exclusion set re-checked after schema work", {
7358
+ readmitted: e.readmitted,
7359
+ newlyExcluded: e.newlyExcluded
7360
+ });
7361
+ } catch (e) {
7362
+ Z.warn("cdc: could not re-check the exclusion set after schema work", {}, e);
7363
+ }
7364
+ let xi = Rp(R, C);
7365
+ W(() => {
7356
7366
  xi();
7357
7367
  });
7358
- let Ci = Do(P);
7359
- ts({
7368
+ let Ci = Eo(P);
7369
+ es({
7360
7370
  dataStore: R,
7361
7371
  schemaRegistry: Ci
7362
7372
  });
7363
7373
  let wi = Z.child("seeds"), Ti = await tf({
7364
- files: T,
7374
+ files: w,
7365
7375
  store: R,
7366
7376
  log: Z,
7367
7377
  seedPolicy: "run",
7368
- seedPattern: We,
7369
- loadSeedFiles: ce,
7370
- runBootSeeds: ue,
7378
+ seedPattern: Ge,
7379
+ loadSeedFiles: le,
7380
+ runBootSeeds: de,
7371
7381
  onSeedDiscovered: (e) => {
7372
7382
  t.registerSeed(e);
7373
7383
  },
7374
7384
  onSeedResult: (e) => {
7375
7385
  t.recordSeedResult(e);
7376
7386
  },
7377
- startupPattern: Ne,
7387
+ startupPattern: Pe,
7378
7388
  loadStartupFiles: i,
7379
7389
  runStartups: a,
7380
7390
  emailPattern: $d,
7381
7391
  loadEmailFiles: ef,
7382
- registerEmailTemplates: Gs
7392
+ registerEmailTemplates: Ws
7383
7393
  }), Di = of({
7384
7394
  schedules: nf({
7385
- schedules: Qe,
7395
+ schedules: $e,
7386
7396
  seeds: Ti.seeds,
7387
7397
  store: R,
7388
7398
  log: wi
7389
7399
  }),
7390
- workflows: A,
7400
+ workflows: k,
7391
7401
  log: Z
7392
7402
  }), Oi = Ti.startups;
7393
- Oi && U(() => Oi.shutdown()), Yl({
7394
- demands: Kl(pt),
7403
+ Oi && W(() => Oi.shutdown()), Yl({
7404
+ demands: Kl(mt),
7395
7405
  isRegistered: (e) => Fa(e) !== void 0
7396
7406
  });
7397
- let ki = Z.child("subscribe"), ji = T.filter((e) => Ue.test(e)), Mi = ji.length > 0 ? await _l(ji, ki) : [], Ni;
7407
+ let ki = Z.child("subscribe"), ji = w.filter((e) => We.test(e)), Mi = ji.length > 0 ? await _l(ji, ki) : [], Ni;
7398
7408
  pm({
7399
- events: qe,
7409
+ events: Je,
7400
7410
  rpcTags: [
7411
+ ...T.map((e) => e.descriptor.name),
7401
7412
  ...E.map((e) => e.descriptor.name),
7402
7413
  ...D.map((e) => e.descriptor.name),
7403
- ...O.map((e) => e.descriptor.name),
7404
- ...Ge.map((e) => e.descriptor.name)
7414
+ ...Ke.map((e) => e.descriptor.name)
7405
7415
  ]
7406
7416
  });
7407
7417
  let Pi = mm({
7408
- events: qe,
7418
+ events: Je,
7409
7419
  origin: Sr,
7410
7420
  ...Er.publishRemote === void 0 ? {} : { publishRemote: Er.publishRemote }
7411
7421
  });
7412
- if (qe.length > 0 && await Er.attach(Pi.bus), qe.length > 0) {
7413
- let e = Ym(qe);
7414
- for (let [, t] of lh(T.filter((e) => !Re.test(e)))) if (e.offer(t), e.settled) break;
7422
+ if (Je.length > 0 && await Er.attach(Pi.bus), Je.length > 0) {
7423
+ let e = Ym(Je);
7424
+ for (let [, t] of lh(w.filter((e) => !ze.test(e)))) if (e.offer(t), e.settled) break;
7415
7425
  e.settled || dh(n, {
7416
7426
  onFile: (t, n) => (e.offer(n), e.settled ? "stop" : "continue"),
7417
7427
  onTruncated: (e, t) => Z.warn(`event audit: stopped after ${t} sibling files (saw ${e}) — a \`no-consumer\` line below may mean "we stopped looking", not "nothing consumes it"`)
@@ -7421,13 +7431,13 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7421
7431
  let r = e.abstained();
7422
7432
  r > 0 && Z.info(`events: ${r} webhook event(s) NOT verified — this app emits through a shared helper that takes the descriptor as a value, so a source scan cannot tell a published event from a dead one. Not a warning, and not a pass either.`);
7423
7433
  }
7424
- Mi.length > 0 && (ki.info("discovered subscribers", { subscribers: Mi.map((e) => `${e.id}@${e.definition.table}`) }), Ni = vl(Mi, R, ki, Ci, Pi.bus)), Ni && U(() => {
7434
+ Mi.length > 0 && (ki.info("discovered subscribers", { subscribers: Mi.map((e) => `${e.id}@${e.definition.table}`) }), Ni = vl(Mi, R, ki, Ci, Pi.bus)), Ni && W(() => {
7425
7435
  Ni();
7426
- }), Ra(), Ko((e) => Ja(R, e.subjectId, e.resourceType, e.resourceId)) || Z.info("policy guards: using the app-registered tuple source");
7427
- let Ii, Li = Z.child("outbox"), Ri = T.filter((e) => ze.test(e)), Bi = Ri.length > 0 ? await bl(Ri, Li) : [], Vi = jt(T.filter((e) => Ie.test(e)).length, qe) ? [...Bi, {
7436
+ }), Ra(), Go((e) => qa(R, e.subjectId, e.resourceType, e.resourceId)) || Z.info("policy guards: using the app-registered tuple source");
7437
+ let Ii, Li = Z.child("outbox"), Ri = w.filter((e) => Be.test(e)), Bi = Ri.length > 0 ? await bl(Ri, Li) : [], Vi = jt(w.filter((e) => Le.test(e)).length, Je) ? [...Bi, {
7428
7438
  file: "<framework>/webhooks",
7429
7439
  id: "voltro-webhook-emit",
7430
- definition: Ns(() => Ii)
7440
+ definition: Ms(() => Ii)
7431
7441
  }] : Bi, Ui = Vi.length > 0 ? Sl({
7432
7442
  handlers: Vi,
7433
7443
  store: R,
@@ -7436,14 +7446,14 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7436
7446
  table: t.table,
7437
7447
  op: t.op
7438
7448
  })),
7439
- onShutdown: U
7440
- }) : void 0, Ki = fu(), Yi = $(j);
7449
+ onShutdown: W
7450
+ }) : void 0, Ki = fu(), Yi = $(A);
7441
7451
  if (pn.length > 0 && Yi !== "memory") try {
7442
- Ki = _u((await S(Yi)).makeSqlLayer(Q()));
7452
+ Ki = _u((await x(Yi)).makeSqlLayer(Q()));
7443
7453
  } catch (e) {
7444
7454
  dn.warn("aggregate: SQL storage init failed — falling back to in-process", { err: e });
7445
7455
  }
7446
- let Xi = Yi === "memory" ? rs : Za(R, `aggregate@${process.pid}`, dn), Zi = pn.length > 0 ? await ju({
7456
+ let Xi = Yi === "memory" ? ns : Xa(R, `aggregate@${process.pid}`, dn), Zi = pn.length > 0 ? await ju({
7447
7457
  discovered: pn,
7448
7458
  store: R,
7449
7459
  analytics: di,
@@ -7459,7 +7469,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7459
7469
  names: Zi.registered,
7460
7470
  storage: Yi === "memory" ? "in-process" : "sql-backed",
7461
7471
  coordination: Xi.kind
7462
- }), U(() => {
7472
+ }), W(() => {
7463
7473
  Zi.detach();
7464
7474
  });
7465
7475
  let Qi = _n.length > 0 ? ca({
@@ -7467,14 +7477,14 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7467
7477
  store: R,
7468
7478
  log: hn
7469
7479
  }) : void 0;
7470
- Qi !== void 0 && (hn.info("expectations registered", { names: Qi.registered }), U(() => {
7480
+ Qi !== void 0 && (hn.info("expectations registered", { names: Qi.registered }), W(() => {
7471
7481
  Qi.detach();
7472
7482
  }));
7473
7483
  let $i = bn.length > 0 ? ua({
7474
7484
  discovered: bn,
7475
7485
  log: vn
7476
7486
  }) : void 0;
7477
- $i !== void 0 && (vn.info("cost budgets registered", { names: $i.registered }), U(() => {
7487
+ $i !== void 0 && (vn.info("cost budgets registered", { names: $i.registered }), W(() => {
7478
7488
  $i.detach();
7479
7489
  }));
7480
7490
  let ea = Cn.length > 0 ? la({
@@ -7482,10 +7492,10 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7482
7492
  store: R,
7483
7493
  log: xn
7484
7494
  }) : void 0;
7485
- ea !== void 0 && (xn.info("experiments registered", { names: ea.registered }), U(() => {
7495
+ ea !== void 0 && (xn.info("experiments registered", { names: ea.registered }), W(() => {
7486
7496
  ea.detach();
7487
7497
  }));
7488
- let B = $(j), ra, ia = j?.scheduling ?? {}, aa = ia.trigger ?? "self", oa = ia.coordination ?? ([
7498
+ let B = $(A), ra, ia = A?.scheduling ?? {}, aa = ia.trigger ?? "self", oa = ia.coordination ?? ([
7489
7499
  "postgres",
7490
7500
  "mariadb",
7491
7501
  "mysql",
@@ -7503,7 +7513,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7503
7513
  }
7504
7514
  })) : [], ya = "in-memory", xa = await (async () => {
7505
7515
  if (B === "memory") return hr.layerMemory;
7506
- let e = await S(B), t = e.makeSqlLayer(Q()), n = $r({ sqliteFamily: Si(e.id) });
7516
+ let e = await x(B), t = e.makeSqlLayer(Q()), n = $r({ sqliteFamily: Si(e.id) });
7507
7517
  if (ya = `cluster-${n}`, Z.info(`workflow engine: cluster-${n}, dialect=${e.id}` + (n === "memory" ? " — single-process durable replay, no horizontal scaling" + (Si(e.id) ? "" : " (VOLTRO_WORKFLOW_RUNNER_STORAGE=memory: SqlRunnerStorage/cluster_runners + GET_LOCK skipped)") : "")), e.id === "mssql") {
7508
7518
  let e = await Ot(process.cwd());
7509
7519
  e && Z.warn(e);
@@ -7521,26 +7531,26 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7521
7531
  store: R,
7522
7532
  warn: (e, t) => Z.warn(e, t)
7523
7533
  }), Ta = wa.remember, Ea = wa.resolve, Da = kl({
7524
- authority: j?.auth,
7534
+ authority: A?.auth,
7525
7535
  getStore: () => vt.current
7526
- }), V = A.length > 0 ? go(() => Sa) : void 0, ka = Z.child("webhooks"), Pa = T.filter((e) => Ie.test(e)), La = Pa.length > 0 ? await Mt(Pa, ka) : {
7536
+ }), V = k.length > 0 ? ho(() => Sa) : void 0, ka = Z.child("webhooks"), Pa = w.filter((e) => Le.test(e)), La = Pa.length > 0 ? await Mt(Pa, ka) : {
7527
7537
  outgoing: [],
7528
7538
  incoming: [],
7529
7539
  providers: []
7530
- }, za = {
7540
+ }, H = {
7531
7541
  ...La,
7532
- outgoing: [...La.outgoing, ...At(qe)]
7542
+ outgoing: [...La.outgoing, ...At(Je)]
7533
7543
  };
7534
- za.outgoing.length + za.incoming.length + za.providers.length > 0 && ka.info("discovered webhooks", {
7535
- outgoing: za.outgoing.map((e) => e.descriptor.id),
7536
- incoming: za.incoming.map((e) => e.descriptor.id),
7537
- providers: za.providers.map((e) => e.descriptor.id)
7544
+ H.outgoing.length + H.incoming.length + H.providers.length > 0 && ka.info("discovered webhooks", {
7545
+ outgoing: H.outgoing.map((e) => e.descriptor.id),
7546
+ incoming: H.incoming.map((e) => e.descriptor.id),
7547
+ providers: H.providers.map((e) => e.descriptor.id)
7538
7548
  });
7539
- let Ba = /* @__PURE__ */ new Map();
7540
- for (let e of za.incoming) {
7541
- let t = e.descriptor.path ?? js(e.descriptor.id), n = `VOLTRO_WEBHOOK_SECRET_${e.descriptor.id.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, r = Ps(e.descriptor, {
7549
+ let za = /* @__PURE__ */ new Map();
7550
+ for (let e of H.incoming) {
7551
+ let t = e.descriptor.path ?? As(e.descriptor.id), n = `VOLTRO_WEBHOOK_SECRET_${e.descriptor.id.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, r = Ns(e.descriptor, {
7542
7552
  resolveSecret: async () => process.env[n] ?? null,
7543
- resolveWorkflows: () => V === void 0 ? void 0 : Mo(V, {
7553
+ resolveWorkflows: () => V === void 0 ? void 0 : jo(V, {
7544
7554
  traceId: `incoming:${e.descriptor.id}`,
7545
7555
  source: `incoming:${e.descriptor.id}`
7546
7556
  }),
@@ -7555,36 +7565,36 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7555
7565
  e.status >= 500 ? ka.error("incoming delivery failed", t) : e.status >= 400 ? ka.warn("incoming delivery rejected", t) : ka.info("incoming delivery handled", t);
7556
7566
  }
7557
7567
  });
7558
- Ba.set(t, r), ka.info("mounted incoming webhook", {
7568
+ za.set(t, r), ka.info("mounted incoming webhook", {
7559
7569
  id: e.descriptor.id,
7560
7570
  path: t,
7561
7571
  secretEnvKey: n
7562
7572
  });
7563
7573
  }
7564
- let Ha = Z.child("reaction"), Ua = T.filter((e) => He.test(e)), Ga = Ua.length > 0 ? await su(Ua, Ha) : [], Ka;
7565
- if (Ga.length > 0) {
7566
- Ha.info("discovered reactions", { reactions: Ga.map((e) => `${e.definition.name}@${e.definition.watch.table}`) });
7567
- let e = qd(R, { onError: (e) => Ha.warn("reaction: rate-slot claim failed; refusing the act", { cause: String(e) }) });
7568
- Ka = lu(Ga, R, {
7574
+ let Va = Z.child("reaction"), Ha = w.filter((e) => Ue.test(e)), Wa = Ha.length > 0 ? await su(Ha, Va) : [], Ga;
7575
+ if (Wa.length > 0) {
7576
+ Va.info("discovered reactions", { reactions: Wa.map((e) => `${e.definition.name}@${e.definition.watch.table}`) });
7577
+ let e = qd(R, { onError: (e) => Va.warn("reaction: rate-slot claim failed; refusing the act", { cause: String(e) }) });
7578
+ Ga = lu(Wa, R, {
7569
7579
  runAct: async (e, t) => {
7570
7580
  if (e.kind === "workflow") {
7571
7581
  if (V === void 0) {
7572
- Ha.warn("reaction workflow act skipped — no workflow engine in this app", { workflow: e.workflow });
7582
+ Va.warn("reaction workflow act skipped — no workflow engine in this app", { workflow: e.workflow });
7573
7583
  return;
7574
7584
  }
7575
7585
  let n = e.payload === void 0 ? t.new ?? t.old ?? {} : e.payload(t);
7576
- await Mo(V, {
7586
+ await jo(V, {
7577
7587
  traceId: `reaction:${e.workflow}`,
7578
7588
  source: `reaction:${e.workflow}`
7579
7589
  }).start(e.workflow, n);
7580
7590
  return;
7581
7591
  }
7582
7592
  await cu(e.agent, t, {
7583
- findAgentSend: (e) => O.find((t) => t.descriptor.name === `${e}.send`),
7584
- runAction: (e, t, n) => Promise.resolve(Ds(e, t, n)),
7593
+ findAgentSend: (e) => D.find((t) => t.descriptor.name === `${e}.send`),
7594
+ runAction: (e, t, n) => Promise.resolve(Es(e, t, n)),
7585
7595
  makeSubject: (e) => sn(e),
7586
7596
  now: () => Date.now(),
7587
- log: Ha
7597
+ log: Va
7588
7598
  });
7589
7599
  },
7590
7600
  checkBudget: async (e, t) => {
@@ -7595,29 +7605,29 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7595
7605
  limitUsd: t
7596
7606
  }))))._tag === "Right";
7597
7607
  } catch (t) {
7598
- return Ha.warn("reaction budget check failed — refusing the act", { tenantId: e }, t), !1;
7608
+ return Va.warn("reaction budget check failed — refusing the act", { tenantId: e }, t), !1;
7599
7609
  }
7600
7610
  },
7601
7611
  claimRateSlot: (t) => e.claim(t)
7602
- }, Ha);
7612
+ }, Va);
7603
7613
  }
7604
- Ka && U(() => {
7605
- Ka();
7614
+ Ga && W(() => {
7615
+ Ga();
7606
7616
  });
7607
- let qa = 0, H = new Gi({
7617
+ let Ka = 0, U = new Gi({
7608
7618
  store: R,
7609
7619
  cache: Rr,
7610
- ...j?.reactive === void 0 ? {} : { reactive: j.reactive },
7620
+ ...A?.reactive === void 0 ? {} : { reactive: A.reactive },
7611
7621
  ...$i === void 0 ? {} : { recordCost: $i.record },
7612
7622
  recordDelivery: (e) => {
7613
- Vo({
7623
+ Bo({
7614
7624
  label: e.label,
7615
7625
  kind: e.kind,
7616
7626
  durationMs: e.durationMs,
7617
7627
  rowCount: e.rowCount
7618
7628
  }), Zn({
7619
7629
  traceId: e.traceId,
7620
- spanId: (qa++).toString(16).padStart(16, "0"),
7630
+ spanId: (Ka++).toString(16).padStart(16, "0"),
7621
7631
  parentSpanId: e.parentSpanId ?? null,
7622
7632
  name: `${e.label}.${e.kind}`,
7623
7633
  kind: "internal",
@@ -7632,21 +7642,21 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7632
7642
  });
7633
7643
  }
7634
7644
  });
7635
- Mr = H;
7636
- let Ya = () => {
7637
- w.emit("subscriptions", Wm(() => H));
7645
+ Mr = U;
7646
+ let Ja = () => {
7647
+ C.emit("subscriptions", Wm(() => U));
7638
7648
  };
7639
- H.onSubscriptionsChange(Ya), Ya();
7640
- let to = Z.child("store"), no = (j?.plugins ?? []).filter((e) => typeof e.onChangeEvent == "function"), oo = R.changeScope ?? "local";
7649
+ U.onSubscriptionsChange(Ja), Ja();
7650
+ let eo = Z.child("store"), to = (A?.plugins ?? []).filter((e) => typeof e.onChangeEvent == "function"), ao = R.changeScope ?? "local";
7641
7651
  vm({
7642
7652
  store: R,
7643
7653
  ..._m(),
7644
7654
  log: Z
7645
7655
  }), R.onChange((e) => {
7646
- if (to.debug(`${e.op} on ${e.table}`, {
7656
+ if (eo.debug(`${e.op} on ${e.table}`, {
7647
7657
  op: e.op,
7648
7658
  table: e.table
7649
- }), Ho({
7659
+ }), Vo({
7650
7660
  table: e.table,
7651
7661
  op: e.op,
7652
7662
  old: e.old ?? null,
@@ -7659,10 +7669,10 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7659
7669
  ...t === void 0 ? {} : { id: t }
7660
7670
  });
7661
7671
  }
7662
- if (no.length > 0) {
7663
- let t = au(e, oo);
7664
- for (let n of no) {
7665
- let r = to.child(`plugin:${n.name}`);
7672
+ if (to.length > 0) {
7673
+ let t = au(e, ao);
7674
+ for (let n of to) {
7675
+ let r = eo.child(`plugin:${n.name}`);
7666
7676
  F.runFork(n.onChangeEvent(t).pipe(F.catchAllCause((t) => F.sync(() => r.warn("onChangeEvent failed", {
7667
7677
  table: e.table,
7668
7678
  op: e.op
@@ -7670,11 +7680,11 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7670
7680
  }
7671
7681
  }
7672
7682
  });
7673
- let so = A.map((e) => pr.make(e.definition.name, {
7683
+ let oo = k.map((e) => pr.make(e.definition.name, {
7674
7684
  payload: e.definition.payloadSchema,
7675
7685
  success: rn,
7676
7686
  error: e.definition.errorSchema
7677
- })), co = ht ? [
7687
+ })), so = gt ? [
7678
7688
  kn(Un),
7679
7689
  kn(Gn),
7680
7690
  kn(Wn),
@@ -7685,27 +7695,27 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7685
7695
  an(Vn),
7686
7696
  an(Kn),
7687
7697
  an(qn)
7688
- ] : [], uo = (j?.plugins ?? []).flatMap((e) => (e.errorSchemas ?? []).map((e) => e.schema)), fo = uo.length > 0 ? uo : void 0, mo = (e) => e.filter((e) => En(e.descriptor)), ho = mo(E), _o = mo(D), xo = mo(O), So = mo(Ge), Oo = [
7689
- ...ho.map((e) => kn(e.descriptor, fo)),
7690
- ..._o.map((e) => Dn(e.descriptor, fo)),
7691
- ...xo.map((e) => an(e.descriptor, fo)),
7692
- ...So.map((e) => jn(e.descriptor, fo)),
7698
+ ] : [], lo = (A?.plugins ?? []).flatMap((e) => (e.errorSchemas ?? []).map((e) => e.schema)), uo = lo.length > 0 ? lo : void 0, po = (e) => e.filter((e) => En(e.descriptor)), mo = po(T), go = po(E), bo = po(D), xo = po(Ke), Do = [
7699
+ ...mo.map((e) => kn(e.descriptor, uo)),
7700
+ ...go.map((e) => Dn(e.descriptor, uo)),
7701
+ ...bo.map((e) => an(e.descriptor, uo)),
7702
+ ...xo.map((e) => jn(e.descriptor, uo)),
7693
7703
  ...Pi.rpcs,
7694
- ...so,
7695
- ...co
7696
- ], ko = mr.make(...Oo).middleware($t).middleware(en), Ao = j?.layers ?? [], Po = (j?.plugins ?? []).map((e) => e.services).filter((e) => e !== void 0), Fo = I.succeed(zi, Zi.registry), Io = I.succeed(qi, Qi?.registry ?? Hu), Lo = I.succeed(Hi, $i?.registry ?? Uu), zo = I.succeed(Ji, ea?.registry ?? Wu), Bo = I.mergeAll(qc({
7704
+ ...oo,
7705
+ ...so
7706
+ ], Oo = mr.make(...Do).middleware($t).middleware(en), ko = A?.layers ?? [], No = (A?.plugins ?? []).map((e) => e.services).filter((e) => e !== void 0), Po = I.succeed(zi, Zi.registry), Fo = I.succeed(qi, Qi?.registry ?? Hu), Io = I.succeed(Hi, $i?.registry ?? Uu), Ro = I.succeed(Ji, ea?.registry ?? Wu), zo = I.mergeAll(qc({
7697
7707
  analyticsLayer: li.layer,
7698
7708
  cacheService: Ir,
7699
7709
  kvService: ni,
7700
7710
  ...Br === void 0 ? {} : { semanticCache: Br },
7701
- pluginServices: Po,
7702
- userLayers: Ao
7703
- }), Fo, Io, Lo, zo);
7704
- (Ao.length > 0 || Po.length > 0) && Z.info("layers loaded", {
7705
- userLayers: Ao.length,
7706
- pluginLayers: Po.length
7711
+ pluginServices: No,
7712
+ userLayers: ko
7713
+ }), Po, Fo, Io, Ro);
7714
+ (ko.length > 0 || No.length > 0) && Z.info("layers loaded", {
7715
+ userLayers: ko.length,
7716
+ pluginLayers: No.length
7707
7717
  });
7708
- let Wo = (e, t) => Xo(e.pipe(F.provide(po(t)), F.provide(Bo), F.provide(gt)));
7718
+ let Uo = (e, t) => Yo(e.pipe(F.provide(fo(t)), F.provide(zo), F.provide(_t)));
7709
7719
  if ((process.env.VOLTRO_INDEX_AUDIT ?? "on") !== "off") {
7710
7720
  let e = ci(P), t = process.stdout.isTTY === !0 && (process.env.NO_COLOR ?? "") === "";
7711
7721
  for (let n of e) Z.warn("\n" + hi(n, {
@@ -7713,16 +7723,16 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7713
7723
  indent: " "
7714
7724
  }));
7715
7725
  }
7716
- let Go;
7717
- if (za.outgoing.length > 0) {
7726
+ let Wo;
7727
+ if (H.outgoing.length > 0) {
7718
7728
  let e = Uc({
7719
7729
  store: R,
7720
7730
  schemaRegistry: Ci,
7721
7731
  cache: zr,
7722
7732
  kv: Qr
7723
- }), t = za.outgoing.map((e) => e.descriptor);
7724
- Go = Ms.toLayer(ks(e, { events: t })), Ii = As(e, async (e) => {
7725
- q.runPromise(Ms.execute(e)).catch((t) => {
7733
+ }), t = H.outgoing.map((e) => e.descriptor);
7734
+ Wo = js.toLayer(Os(e, { events: t })), Ii = ks(e, async (e) => {
7735
+ J.runPromise(js.execute(e)).catch((t) => {
7726
7736
  ka.error("deliverWebhook workflow crashed", {
7727
7737
  deliveryId: e.deliveryId,
7728
7738
  targetId: e.targetId
@@ -7730,63 +7740,63 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7730
7740
  });
7731
7741
  }, { events: t });
7732
7742
  }
7733
- let W = (process.env.VOLTRO_TENANT_ISOLATION ?? j?.tenancy?.isolation) === "namespace";
7734
- W && Z.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.");
7735
- let Jo = $(j), G = W && Jo !== "memory" ? await (async () => {
7736
- let e = await S(Jo);
7743
+ let G = (process.env.VOLTRO_TENANT_ISOLATION ?? A?.tenancy?.isolation) === "namespace";
7744
+ G && Z.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.");
7745
+ let qo = $(A), K = G && qo !== "memory" ? await (async () => {
7746
+ let e = await x(qo);
7737
7747
  return Bc({
7738
7748
  tables: oi(),
7739
7749
  sqlLayer: e.makeSqlLayer(Q()),
7740
- dialect: Jo,
7750
+ dialect: qo,
7741
7751
  options: { retryFilter: e.retryFilter },
7742
7752
  log: {
7743
7753
  info: (e, t) => Z.info(e, t),
7744
7754
  error: (e, t, n) => Z.error(e, t ?? {}, n)
7745
7755
  }
7746
7756
  });
7747
- })() : void 0, Zo = await wh({
7748
- input: j?.tenancy?.residency,
7749
- namespaceIsolationOn: W,
7750
- makeStoreForUrl: (e, t) => ng(j, er, ne(Q(), t)),
7757
+ })() : void 0, Xo = await wh({
7758
+ input: A?.tenancy?.residency,
7759
+ namespaceIsolationOn: G,
7760
+ makeStoreForUrl: (e, t) => ng(A, er, re(Q(), t)),
7751
7761
  log: {
7752
7762
  info: (e, t) => Z.info(e, t),
7753
7763
  warn: (e, t) => Z.warn(e, t)
7754
7764
  }
7755
7765
  });
7756
- Zo !== void 0 && U(async () => {
7757
- await Zo.close();
7766
+ Xo !== void 0 && W(async () => {
7767
+ await Xo.close();
7758
7768
  });
7759
- let Qo = Wc({
7769
+ let Zo = Wc({
7760
7770
  store: R,
7761
7771
  schemaRegistry: Ci,
7762
7772
  cache: zr,
7763
7773
  kv: Qr,
7764
- ...Zo === void 0 ? {} : { resolveResidentStore: Zo.resolveStore },
7774
+ ...Xo === void 0 ? {} : { resolveResidentStore: Xo.resolveStore },
7765
7775
  ...Ii === void 0 ? {} : { webhooksService: Ii },
7766
7776
  ...V === void 0 ? {} : { workflowsProxy: V },
7767
- eventTriggers: Ze,
7768
- namespaceIsolationOn: W,
7769
- ...G === void 0 ? {} : { ensureTenantProvisioned: G.ensure },
7770
- onEventEmit: (e, t) => w.emit(e, t),
7777
+ eventTriggers: Qe,
7778
+ namespaceIsolationOn: G,
7779
+ ...K === void 0 ? {} : { ensureTenantProvisioned: K.ensure },
7780
+ onEventEmit: (e, t) => C.emit(e, t),
7771
7781
  ...Ui === void 0 ? {} : { outbox: { nudge: Ui.nudge } },
7772
7782
  ...or.active ? { connections: { registry: or.registry } } : {},
7773
7783
  eventBus: Pi.bus
7774
- }), $o = async () => {
7784
+ }), Qo = async () => {
7775
7785
  if (Di.length === 0) return;
7776
7786
  let e = process.env.HOSTNAME ?? `pid-${process.pid}`, t;
7777
- fa ? t = rs : oa === "cluster" ? (Z.warn("scheduling.coordination=cluster needs store=postgres — falling back to single (dev/memory)"), t = rs) : oa === "advisoryLock" ? B === "memory" ? (Z.warn("scheduling.coordination=advisoryLock needs a SQL store (the claim-row gate) — falling back to single (memory)"), t = rs) : t = Za(R, e, {
7787
+ fa ? t = ns : oa === "cluster" ? (Z.warn("scheduling.coordination=cluster needs store=postgres — falling back to single (dev/memory)"), t = ns) : oa === "advisoryLock" ? B === "memory" ? (Z.warn("scheduling.coordination=advisoryLock needs a SQL store (the claim-row gate) — falling back to single (memory)"), t = ns) : t = Xa(R, e, {
7778
7788
  info: (e, t) => Z.info(e, t ?? {}),
7779
7789
  warn: (e, t) => Z.warn(e, t ?? {})
7780
- }) : t = rs;
7781
- let n = Hf(j?.plugins ?? [], bs);
7782
- ra = await os(Di, {
7790
+ }) : t = ns;
7791
+ let n = Hf(A?.plugins ?? [], ys);
7792
+ ra = await as(Di, {
7783
7793
  store: R,
7784
7794
  coordinator: t,
7785
7795
  defaultTrigger: aa,
7786
7796
  replicaId: e,
7787
7797
  armSelf: !fa,
7788
- dormancy: j?.dormancy ?? "always-on",
7789
- buildContext: ({ traceId: e, scheduleName: t, subject: n }) => Qo({
7798
+ dormancy: A?.dormancy ?? "always-on",
7799
+ buildContext: ({ traceId: e, scheduleName: t, subject: n }) => Zo({
7790
7800
  subject: n,
7791
7801
  traceId: e
7792
7802
  }, R, void 0, `schedule:${t}`),
@@ -7796,7 +7806,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7796
7806
  error: (e, t) => Z.error(e, t ?? {}),
7797
7807
  debug: (e, t) => Z.debug(e, t ?? {})
7798
7808
  },
7799
- onRunEvent: (e, t) => w.emit("scheduleRuns", {
7809
+ onRunEvent: (e, t) => C.emit("scheduleRuns", {
7800
7810
  op: e,
7801
7811
  row: t
7802
7812
  }),
@@ -7805,32 +7815,32 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7805
7815
  schedules: Di.length,
7806
7816
  coordination: fa ? "cluster" : t.kind,
7807
7817
  clusterCrons: _a.length
7808
- }), U(() => ra?.shutdown());
7809
- }, K = {}, ns = /* @__PURE__ */ new Set(), is = (e, t) => {
7810
- Va(e, ot, t) && (ns.has(e.table) || (ns.add(e.table), Z.warn("tenant-scoped read with an EMPTY tenant — every row is filtered out", {
7818
+ }), W(() => ra?.shutdown());
7819
+ }, q = {}, ts = /* @__PURE__ */ new Set(), rs = (e, t) => {
7820
+ Ba(e, st, t) && (ts.has(e.table) || (ts.add(e.table), Z.warn("tenant-scoped read with an EMPTY tenant — every row is filtered out", {
7811
7821
  table: e.table,
7812
7822
  tenantId: "",
7813
7823
  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'",
7814
7824
  fix: "resolve the subject to an active org before the read, or mark the query `.unscoped()` if it is deliberately cross-tenant"
7815
7825
  })));
7816
- }, cs = !1, ls = (e) => {
7817
- cs || !Wa(e) || (cs = !0, Z.warn("authenticated subject has NO active org (tenantId='') — every tenant-scoped read will be empty", {
7826
+ }, ss = !1, cs = (e) => {
7827
+ ss || !Ua(e) || (ss = !0, Z.warn("authenticated subject has NO active org (tenantId='') — every tenant-scoped read will be empty", {
7818
7828
  subjectType: "user",
7819
7829
  cause: "the session resolved a user but no organization/tenant; the empty-string sentinel fails closed",
7820
7830
  fix: "resolve the user to an active org during auth, or route org-less users to an onboarding flow"
7821
7831
  }));
7822
- }, ds = /* @__PURE__ */ new Set(), fs = (e) => {
7832
+ }, us = /* @__PURE__ */ new Set(), ds = (e) => {
7823
7833
  if (e.usingIndex !== void 0 || e.predicate === void 0) return;
7824
7834
  let t = /* @__PURE__ */ new Set();
7825
7835
  for (let n of Fi(e.predicate)) n.conjunctive && t.add(n.column);
7826
7836
  if (t.size === 0 || Ci.anyFieldIndexed(e.table, t)) return;
7827
7837
  let n = `${e.table}::${[...t].sort().join(",")}`;
7828
- ds.has(n) || (ds.add(n), Z.warn("non-indexed predicate — slow at scale", {
7838
+ us.has(n) || (us.add(n), Z.warn("non-indexed predicate — slow at scale", {
7829
7839
  table: e.table,
7830
7840
  fields: [...t],
7831
7841
  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"
7832
7842
  }));
7833
- }, gs = (e) => {
7843
+ }, hs = (e) => {
7834
7844
  if (e.usingIndex === void 0) return;
7835
7845
  let t = Ci.tables.get(e.table);
7836
7846
  if (!t) return;
@@ -7839,7 +7849,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7839
7849
  name: n.name,
7840
7850
  fields: n.fields
7841
7851
  };
7842
- }, vs = (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), ys = (e, t) => {
7852
+ }, _s = (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), vs = (e, t) => {
7843
7853
  let n = e.cache;
7844
7854
  if (n === void 0) return;
7845
7855
  let r = kt(n.ttl);
@@ -7847,64 +7857,64 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7847
7857
  ttlMs: r,
7848
7858
  swrMs: n.swr === void 0 ? void 0 : kt(n.swr) ?? void 0,
7849
7859
  scope: n.scope,
7850
- baseKey: `q:${e.name}:${vs(t)}`
7860
+ baseKey: `q:${e.name}:${_s(t)}`
7851
7861
  };
7852
- }, bs = Lt(), xs = Ff(j?.plugins ?? [], bs), Ss = xs.mutation, Cs = xs.action, ws = xs.query, Ts = Bl(_), Es = yo({
7862
+ }, ys = Lt(), bs = Ff(A?.plugins ?? [], ys), xs = bs.mutation, Ss = bs.action, Cs = bs.query, ws = Bl(_), Ts = vo({
7853
7863
  store: R,
7854
- defaultDeny: Ts,
7855
- buildContext: (e, t, n) => Qo(e, t, n),
7856
- runEffect: (e, t) => Wo(e, t),
7857
- ...Ss ? { interceptor: Ss } : {},
7858
- recordMetric: (e) => bs.record(e),
7864
+ defaultDeny: ws,
7865
+ buildContext: (e, t, n) => Zo(e, t, n),
7866
+ runEffect: (e, t) => Uo(e, t),
7867
+ ...xs ? { interceptor: xs } : {},
7868
+ recordMetric: (e) => ys.record(e),
7859
7869
  undoCapture: mf()
7860
- }), Ds = Xa({
7861
- defaultDeny: Ts,
7862
- buildContext: (e) => Qo(e),
7863
- runEffect: (e, t) => Wo(e, t),
7864
- ...Cs ? { interceptor: Cs } : {},
7865
- recordMetric: (e) => bs.record(e)
7866
- }), Os = wo({
7867
- tenantScopedTables: ot,
7868
- softDeleteScopedTables: st,
7870
+ }), Es = Ya({
7871
+ defaultDeny: ws,
7872
+ buildContext: (e) => Zo(e),
7873
+ runEffect: (e, t) => Uo(e, t),
7874
+ ...Ss ? { interceptor: Ss } : {},
7875
+ recordMetric: (e) => ys.record(e)
7876
+ }), Ds = Co({
7877
+ tenantScopedTables: st,
7878
+ softDeleteScopedTables: ct,
7869
7879
  observe: {
7870
7880
  beforeScope: (e, t) => {
7871
- ls(t), is(e, t.tenantId);
7881
+ cs(t), rs(e, t.tenantId);
7872
7882
  },
7873
- afterScope: fs
7874
- }
7875
- }), Fs = {
7876
- defaultDeny: Ts,
7877
- buildContext: (e) => Qo(e),
7878
- finalize: (e, t) => Os(e, t.subject),
7879
- provideEffect: (e, t) => e.pipe(F.provide(po(t)), F.provide(Bo), F.provide(gt)),
7880
- ...ws ? { interceptor: ws } : {}
7881
- }, Is = Co(Fs), Rs = bo({
7882
- ...Fs,
7883
- queryRows: (e, t) => R.query(e).then((n) => ss(e.table, n, t.subject))
7884
- }), zs = Eo({
7885
- ...Fs,
7886
- subscribeDescriptor: (e, t, n) => H.subscribe(e, t, n),
7887
- subscribeComputed: (e, t, n) => H.subscribeComputed(e, t, n)
7883
+ afterScope: ds
7884
+ }
7885
+ }), Ps = {
7886
+ defaultDeny: ws,
7887
+ buildContext: (e) => Zo(e),
7888
+ finalize: (e, t) => Ds(e, t.subject),
7889
+ provideEffect: (e, t) => e.pipe(F.provide(fo(t)), F.provide(zo), F.provide(_t)),
7890
+ ...Cs ? { interceptor: Cs } : {}
7891
+ }, Fs = So(Ps), Ls = yo({
7892
+ ...Ps,
7893
+ queryRows: (e, t) => R.query(e).then((n) => os(e.table, n, t.subject))
7894
+ }), Rs = To({
7895
+ ...Ps,
7896
+ subscribeDescriptor: (e, t, n) => U.subscribe(e, t, n),
7897
+ subscribeComputed: (e, t, n) => U.subscribeComputed(e, t, n)
7888
7898
  });
7889
- for (let e of ho) K[e.descriptor.name] = (t) => ha(Is(e, t), H, `subscription.${e.descriptor.name}`, gs, ys(e.descriptor, t), To(e, t));
7890
- let Bs = Xc(j?.idempotency, R);
7891
- for (let e of _o) {
7892
- let t = `mutation.${e.descriptor.name}`, n = vo(e.descriptor.output);
7893
- K[e.descriptor.name] = (r) => pa(async (t, n) => Es(e, t, n), r, t, n, Bs, Ln(e.descriptor, "mutation"));
7899
+ for (let e of mo) q[e.descriptor.name] = (t) => ha(Fs(e, t), U, `subscription.${e.descriptor.name}`, hs, vs(e.descriptor, t), wo(e, t));
7900
+ let zs = Xc(A?.idempotency, R);
7901
+ for (let e of go) {
7902
+ let t = `mutation.${e.descriptor.name}`, n = _o(e.descriptor.output);
7903
+ q[e.descriptor.name] = (r) => pa(async (t, n) => Ts(e, t, n), r, t, n, zs, Ln(e.descriptor, "mutation"));
7894
7904
  }
7895
- for (let e of xo) {
7896
- let t = `action.${e.descriptor.name}`, n = vo(e.descriptor.output);
7897
- K[e.descriptor.name] = (r) => pa(async (t, n) => Ds(e, t, n), r, t, n, Bs, e.descriptor.error);
7905
+ for (let e of bo) {
7906
+ let t = `action.${e.descriptor.name}`, n = _o(e.descriptor.output);
7907
+ q[e.descriptor.name] = (r) => pa(async (t, n) => Es(e, t, n), r, t, n, zs, e.descriptor.error);
7898
7908
  }
7899
- Object.assign(K, Pi.handlers);
7900
- for (let e of So) {
7909
+ Object.assign(q, Pi.handlers);
7910
+ for (let e of xo) {
7901
7911
  let t = `stream.${e.descriptor.name}`;
7902
- K[e.descriptor.name] = (n) => ma((t) => ms(t, (t) => {
7903
- let r = Qo(t), i = e.executor(n, r);
7904
- return F.isEffect(i) ? i.pipe(F.provide(po(r.store)), F.provide(Bo), F.provide(gt)) : typeof i == "object" && i && typeof i.then == "function" ? F.promise(() => i) : i;
7912
+ q[e.descriptor.name] = (n) => ma((t) => ps(t, (t) => {
7913
+ let r = Zo(t), i = e.executor(n, r);
7914
+ return F.isEffect(i) ? i.pipe(F.provide(fo(r.store)), F.provide(zo), F.provide(_t)) : typeof i == "object" && i && typeof i.then == "function" ? F.promise(() => i) : i;
7905
7915
  }), t);
7906
7916
  }
7907
- ht && (K[Un.name] = (e) => ha(Is({
7917
+ gt && (q[Un.name] = (e) => ha(Fs({
7908
7918
  descriptor: Un,
7909
7919
  executor: (e) => {
7910
7920
  let t = e.id;
@@ -7920,7 +7930,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7920
7930
  projection: void 0
7921
7931
  };
7922
7932
  }
7923
- }, e), H, `subscription.${Un.name}`), K[Gn.name] = (e) => ha(Is({
7933
+ }, e), U, `subscription.${Un.name}`), q[Gn.name] = (e) => ha(Fs({
7924
7934
  descriptor: Gn,
7925
7935
  executor: (e) => {
7926
7936
  let t = e, n = [...t.tag === void 0 ? [] : [z("tag", t.tag)], ...t.status === void 0 ? [] : [z("status", t.status)]], r = Number.isFinite(t.limit) && t.limit !== void 0 ? Math.min(Math.max(Math.floor(t.limit), 1), 500) : 100;
@@ -7936,7 +7946,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7936
7946
  projection: void 0
7937
7947
  };
7938
7948
  }
7939
- }, e), H, `subscription.${Gn.name}`), K[Wn.name] = (e) => ha(Is({
7949
+ }, e), U, `subscription.${Gn.name}`), q[Wn.name] = (e) => ha(Fs({
7940
7950
  descriptor: Wn,
7941
7951
  executor: (e) => {
7942
7952
  let t = e.runId;
@@ -7952,7 +7962,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7952
7962
  projection: void 0
7953
7963
  };
7954
7964
  }
7955
- }, e), H, `subscription.${Wn.name}`), K[Hn.name] = (e) => ha(Is({
7965
+ }, e), U, `subscription.${Wn.name}`), q[Hn.name] = (e) => ha(Fs({
7956
7966
  descriptor: Hn,
7957
7967
  executor: (e) => {
7958
7968
  let t = e.runId;
@@ -7968,7 +7978,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7968
7978
  projection: void 0
7969
7979
  };
7970
7980
  }
7971
- }, e), H, `subscription.${Hn.name}`), K[zn.name] = (e) => ha(Is({
7981
+ }, e), U, `subscription.${Hn.name}`), q[zn.name] = (e) => ha(Fs({
7972
7982
  descriptor: zn,
7973
7983
  executor: (e) => {
7974
7984
  let t = e;
@@ -7984,7 +7994,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
7984
7994
  projection: void 0
7985
7995
  };
7986
7996
  }
7987
- }, e), H, `subscription.${zn.name}`), K[Bn.name] = (e) => ha(Is({
7997
+ }, e), U, `subscription.${zn.name}`), q[Bn.name] = (e) => ha(Fs({
7988
7998
  descriptor: Bn,
7989
7999
  executor: (e) => {
7990
8000
  let t = e.eventId;
@@ -8000,32 +8010,32 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8000
8010
  projection: void 0
8001
8011
  };
8002
8012
  }
8003
- }, e), H, `subscription.${Bn.name}`), K[Rn.name] = (e) => pa(async (e, t) => {
8013
+ }, e), U, `subscription.${Bn.name}`), q[Rn.name] = (e) => pa(async (e, t) => {
8004
8014
  let n = e;
8005
- return await Gc(R, t.subject, { executionId: n.executionId }), await V.cancel(n.workflowName, n.executionId), await Zs(n.workflowName, n.executionId, "workflow.cancel"), { ok: !0 };
8006
- }, e, `action.${Rn.name}`), K[Vn.name] = (e) => pa(async (e, t) => {
8015
+ return await Gc(R, t.subject, { executionId: n.executionId }), await V.cancel(n.workflowName, n.executionId), await Xs(n.workflowName, n.executionId, "workflow.cancel"), { ok: !0 };
8016
+ }, e, `action.${Rn.name}`), q[Vn.name] = (e) => pa(async (e, t) => {
8007
8017
  let n = e;
8008
8018
  return await Gc(R, t.subject, { executionId: n.executionId }), await V.resume(n.workflowName, n.executionId), { ok: !0 };
8009
- }, e, `action.${Vn.name}`), K[Kn.name] = (e) => pa(async (e, t) => {
8019
+ }, e, `action.${Vn.name}`), q[Kn.name] = (e) => pa(async (e, t) => {
8010
8020
  let n = e;
8011
8021
  return await Gc(R, t.subject, { id: n.id }), V.signal({ id: n.id }, n.signalName, n.payload);
8012
- }, e, `action.${Kn.name}`), K[qn.name] = (e) => pa(async (e, t) => {
8022
+ }, e, `action.${Kn.name}`), q[qn.name] = (e) => pa(async (e, t) => {
8013
8023
  let n = e;
8014
8024
  return await Gc(R, t.subject, { id: n.id }), V.update({ id: n.id }, n.updateName, n.payload, n.timeoutMs === void 0 ? void 0 : { timeoutMs: n.timeoutMs });
8015
8025
  }, e, `action.${qn.name}`));
8016
- for (let e of A) K[e.definition.name] = (t) => pa(async (t, n) => {
8026
+ for (let e of k) q[e.definition.name] = (t) => pa(async (t, n) => {
8017
8027
  let r = n;
8018
- return Mo(V, {
8028
+ return jo(V, {
8019
8029
  subject: r.subject,
8020
8030
  traceId: r.traceId,
8021
8031
  source: "workflow-rpc"
8022
8032
  }).start(e.definition.name, t);
8023
8033
  }, t, `workflow.${e.definition.name}`);
8024
- let Vs = (e, t) => Qo({
8034
+ let Bs = (e, t) => Zo({
8025
8035
  subject: e.subject,
8026
8036
  traceId: e.traceId
8027
- }, R, void 0, `workflow:${t.workflowName}`, { parentExecutionId: t.executionId }), Hs = Wf(j?.plugins ?? [], bs), Us = Ur, Ws = (e, t) => w.emit(e, t), Ks = j?.dormancy === "sleep" ? {
8028
- register: (e, t, n) => qo(R, {
8037
+ }, R, void 0, `workflow:${t.workflowName}`, { parentExecutionId: t.executionId }), Vs = Wf(A?.plugins ?? [], ys), Hs = Ur, Us = (e, t) => C.emit(e, t), Gs = A?.dormancy === "sleep" ? {
8038
+ register: (e, t, n) => Ko(R, {
8029
8039
  tenantId: n ?? Wi,
8030
8040
  kind: "workflow",
8031
8041
  refId: e,
@@ -8036,24 +8046,24 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8036
8046
  kind: "workflow",
8037
8047
  refId: e
8038
8048
  }).then(() => {})
8039
- } : void 0, Js = Fr({
8049
+ } : void 0, qs = Fr({
8040
8050
  store: R,
8041
- emit: Ws,
8051
+ emit: Us,
8042
8052
  log: Z,
8043
- recording: fd(j?.workflows?.recording),
8044
- ...Ks === void 0 ? {} : { wakeups: Ks }
8045
- }), Ys = async (e, t) => {
8053
+ recording: fd(A?.workflows?.recording),
8054
+ ...Gs === void 0 ? {} : { wakeups: Gs }
8055
+ }), Js = async (e, t) => {
8046
8056
  await Cr({
8047
8057
  store: R,
8048
8058
  parentExecutionId: e,
8049
8059
  parentStatus: t,
8050
- recorder: Js,
8051
- emit: Ws,
8060
+ recorder: qs,
8061
+ emit: Us,
8052
8062
  log: Z,
8053
8063
  interruptChild: async (t, n, r) => {
8054
- let i = A.find((e) => e.definition.name === t);
8064
+ let i = k.find((e) => e.definition.name === t);
8055
8065
  if (!i) throw Error(`Unknown child workflow: ${t}`);
8056
- await q.runPromise(i.definition.interrupt(n)), Z.info("workflow.parentClose.childInterrupted", {
8066
+ await J.runPromise(i.definition.interrupt(n)), Z.info("workflow.parentClose.childInterrupted", {
8057
8067
  parentExecutionId: e,
8058
8068
  childWorkflowName: t,
8059
8069
  childExecutionId: n,
@@ -8061,7 +8071,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8061
8071
  });
8062
8072
  }
8063
8073
  });
8064
- }, Zs = async (e, t, n) => {
8074
+ }, Xs = async (e, t, n) => {
8065
8075
  let r = (await R.query({
8066
8076
  table: "_voltro_workflow_runs",
8067
8077
  order: [],
@@ -8076,12 +8086,12 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8076
8086
  cancelled: !0,
8077
8087
  completedAt: /* @__PURE__ */ new Date()
8078
8088
  });
8079
- i && w.emit("workflowRuns", {
8089
+ i && C.emit("workflowRuns", {
8080
8090
  op: "update",
8081
- row: Us(i)
8091
+ row: Hs(i)
8082
8092
  });
8083
8093
  let a = r.subject?.tenantId ?? void 0;
8084
- i && await Js.recordEvent({
8094
+ i && await qs.recordEvent({
8085
8095
  runId: r.id,
8086
8096
  eventType: "run-cancelled",
8087
8097
  payload: {
@@ -8090,8 +8100,8 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8090
8100
  executionId: t,
8091
8101
  ...a == null ? {} : { tenantId: a }
8092
8102
  }
8093
- }), i && await Ys(t, "cancelled");
8094
- }, $s = (e, t, n, r) => {
8103
+ }), i && await Js(t, "cancelled");
8104
+ }, Qs = (e, t, n, r) => {
8095
8105
  let i = Ar(t);
8096
8106
  return qr({
8097
8107
  name: e,
@@ -8104,35 +8114,35 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8104
8114
  workflowPatches: i.patches,
8105
8115
  parentExecutionId: r?.parentExecutionId ?? null,
8106
8116
  parentClosePolicy: r?.parentClosePolicy ?? null,
8107
- onParentClose: ({ executionId: e, status: t }) => Ys(e, t),
8117
+ onParentClose: ({ executionId: e, status: t }) => Js(e, t),
8108
8118
  ...Yd(t),
8109
8119
  onTerminal: async ({ executionId: e }) => {
8110
- await uc?.gate.release(e);
8120
+ await lc?.gate.release(e);
8111
8121
  },
8112
- recorder: Js,
8113
- pluginWorkflowStepLayer: Hs,
8114
- emit: Ws,
8115
- recordRun: Uo,
8122
+ recorder: qs,
8123
+ pluginWorkflowStepLayer: Vs,
8124
+ emit: Us,
8125
+ recordRun: Ho,
8116
8126
  log: Z
8117
8127
  }, n);
8118
- }, nc = [
8119
- ...No(A, {
8120
- buildContext: Vs,
8128
+ }, tc = [
8129
+ ...Mo(k, {
8130
+ buildContext: Bs,
8121
8131
  resolveStartContext: Ea,
8122
8132
  ...Da === void 0 ? {} : { resolveAuthority: Da }
8123
- }, (e, t, n) => $s(e.definition.name, e.definition, t, n)),
8124
- ...Xe,
8125
- ...Go === void 0 ? [] : [Go]
8126
- ], rc = nc.length > 0 ? I.mergeAll(...nc) : I.empty;
8127
- Z.child("workflow").info(`workflow runtime ready — ${nc.length} entity type(s) registered`, { entities: [...A.map((e) => e.definition.name).filter(Boolean), ...Go === void 0 ? [] : ["voltro.deliverWebhook"]] });
8128
- let q = $n.make(rc.pipe(I.provideMerge(xa), I.provideMerge(Bo), I.provideMerge(gt)));
8129
- U(() => q.dispose());
8130
- let ac = await lc({
8133
+ }, (e, t, n) => Qs(e.definition.name, e.definition, t, n)),
8134
+ ...Ze,
8135
+ ...Wo === void 0 ? [] : [Wo]
8136
+ ], nc = tc.length > 0 ? I.mergeAll(...tc) : I.empty;
8137
+ Z.child("workflow").info(`workflow runtime ready — ${tc.length} entity type(s) registered`, { entities: [...k.map((e) => e.definition.name).filter(Boolean), ...Wo === void 0 ? [] : ["voltro.deliverWebhook"]] });
8138
+ let J = $n.make(nc.pipe(I.provideMerge(xa), I.provideMerge(zo), I.provideMerge(_t)));
8139
+ W(() => J.dispose());
8140
+ let ic = await cc({
8131
8141
  provider: Dr,
8132
- crossReplica: Xs(j?.plugins ?? [])?.broadcast?.crossReplica ?? !1,
8142
+ crossReplica: Ys(A?.plugins ?? [])?.broadcast?.crossReplica ?? !1,
8133
8143
  namespace: Tr,
8134
8144
  replicaId: crypto.randomUUID(),
8135
- pollStorage: () => q.runPromise(Xr),
8145
+ pollStorage: () => J.runPromise(Xr),
8136
8146
  onChange: (e) => R.onChange((t) => e({
8137
8147
  table: t.table,
8138
8148
  op: t.op,
@@ -8140,23 +8150,23 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8140
8150
  })),
8141
8151
  log: Z
8142
8152
  });
8143
- U(() => ac.detach());
8144
- let sc, cc = () => {
8145
- if (sc !== void 0) return sc;
8146
- if (V !== void 0) return sc = Mp({
8153
+ W(() => ic.detach());
8154
+ let oc, sc = () => {
8155
+ if (oc !== void 0) return oc;
8156
+ if (V !== void 0) return oc = Mp({
8147
8157
  store: R,
8148
8158
  log: Z,
8149
- workflows: A,
8159
+ workflows: k,
8150
8160
  workflowsProxy: V,
8151
- workflowRuntime: q,
8152
- workflowRunRecorder: Js,
8153
- closeChildrenForParent: Ys,
8154
- onRunUpdated: (e) => w.emit("workflowRuns", {
8161
+ workflowRuntime: J,
8162
+ workflowRunRecorder: qs,
8163
+ closeChildrenForParent: Js,
8164
+ onRunUpdated: (e) => C.emit("workflowRuns", {
8155
8165
  op: "update",
8156
- row: Us(e)
8166
+ row: Hs(e)
8157
8167
  })
8158
- }), sc;
8159
- }, uc = bd({
8168
+ }), oc;
8169
+ }, lc = bd({
8160
8170
  store: R,
8161
8171
  onChange: (e) => R.onChange((t) => e({
8162
8172
  table: t.table,
@@ -8166,16 +8176,16 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8166
8176
  drainIntervalMs: yr.admissionDrainMs,
8167
8177
  cancelSweepIntervalMs: yr.cancelSweepMs,
8168
8178
  stalenessSweepIntervalMs: yr.stalenessSweepMs,
8169
- workflows: A,
8179
+ workflows: k,
8170
8180
  facade: () => Sa,
8171
- cancelRunWithReason: cc,
8172
- recordRunEvent: () => Js.recordEvent,
8173
- ...j?.workflows?.staleness === void 0 ? {} : { staleness: j.workflows.staleness },
8174
- ...j?.workflows?.suspendSignalHintMs === void 0 ? {} : { suspendSignalHintMs: j.workflows.suspendSignalHintMs },
8181
+ cancelRunWithReason: sc,
8182
+ recordRunEvent: () => qs.recordEvent,
8183
+ ...A?.workflows?.staleness === void 0 ? {} : { staleness: A.workflows.staleness },
8184
+ ...A?.workflows?.suspendSignalHintMs === void 0 ? {} : { suspendSignalHintMs: A.workflows.suspendSignalHintMs },
8175
8185
  scheduleCoordinated: br,
8176
8186
  onAbandoned: async (e) => {
8177
8187
  await Zd({
8178
- workflows: A,
8188
+ workflows: k,
8179
8189
  facade: () => Sa,
8180
8190
  log: Z,
8181
8191
  ...e
@@ -8183,8 +8193,8 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8183
8193
  },
8184
8194
  log: Z
8185
8195
  });
8186
- uc !== void 0 && U(() => uc.stop());
8187
- let pc = Wd({
8196
+ lc !== void 0 && W(() => lc.stop());
8197
+ let fc = Wd({
8188
8198
  store: R,
8189
8199
  onChange: (e) => R.onChange((t) => e({
8190
8200
  table: t.table,
@@ -8192,38 +8202,38 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8192
8202
  })),
8193
8203
  disarmWhenIdle: Pr,
8194
8204
  tickIntervalMs: yr.inferenceTickMs,
8195
- enabled: A.length > 0,
8205
+ enabled: k.length > 0,
8196
8206
  resumeSignal: () => async ({ executionId: e, workflowName: t, signalName: n, payload: r }) => {
8197
- await q.runPromise(wr({
8207
+ await J.runPromise(wr({
8198
8208
  store: R,
8199
8209
  target: Hd(e, t),
8200
8210
  signalName: n,
8201
8211
  payload: r
8202
8212
  }));
8203
8213
  },
8204
- runEffect: (e) => q.runPromise(e),
8214
+ runEffect: (e) => J.runPromise(e),
8205
8215
  scheduleCoordinated: br,
8206
8216
  log: Z
8207
8217
  });
8208
- pc !== void 0 && U(() => pc.stop()), Sa = A.length > 0 ? jo({
8209
- workflows: A,
8210
- runEffect: (e) => q.runPromise(e),
8211
- onEnqueue: () => ac.publishWake(),
8212
- ...uc === void 0 ? {} : {
8213
- admitStart: uc.gate.admitStart,
8214
- startPayloadSchema: uc.gate.startPayloadSchema,
8215
- parkDelayedStart: uc.gate.parkDelayed
8218
+ fc !== void 0 && W(() => fc.stop()), Sa = k.length > 0 ? Ao({
8219
+ workflows: k,
8220
+ runEffect: (e) => J.runPromise(e),
8221
+ onEnqueue: () => ic.publishWake(),
8222
+ ...lc === void 0 ? {} : {
8223
+ admitStart: lc.gate.admitStart,
8224
+ startPayloadSchema: lc.gate.startPayloadSchema,
8225
+ parkDelayedStart: lc.gate.parkDelayed
8216
8226
  },
8217
8227
  rememberStartContext: Ta,
8218
8228
  signal: async (e, t, n) => {
8219
8229
  let r = await Vr({
8220
8230
  store: R,
8221
- recorder: Js,
8231
+ recorder: qs,
8222
8232
  target: e,
8223
8233
  signalName: t,
8224
8234
  payload: n
8225
8235
  });
8226
- return await q.runPromise(wr({
8236
+ return await J.runPromise(wr({
8227
8237
  store: R,
8228
8238
  target: e,
8229
8239
  signalName: t,
@@ -8232,7 +8242,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8232
8242
  },
8233
8243
  update: (e, t, n, r) => Hr({
8234
8244
  store: R,
8235
- recorder: Js,
8245
+ recorder: qs,
8236
8246
  target: e,
8237
8247
  updateName: t,
8238
8248
  payload: n,
@@ -8241,51 +8251,51 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8241
8251
  listRuns: (e) => Xf(R, e),
8242
8252
  retry: (e, t) => Zf({
8243
8253
  store: R,
8244
- workflows: A,
8245
- runPromise: (e) => q.runPromise(e)
8254
+ workflows: k,
8255
+ runPromise: (e) => J.runPromise(e)
8246
8256
  }, e, t),
8247
8257
  redrive: (e) => $f({
8248
8258
  store: R,
8249
- workflows: A,
8250
- runRedrive: (e) => q.runPromise(Zr(e))
8259
+ workflows: k,
8260
+ runRedrive: (e) => J.runPromise(Zr(e))
8251
8261
  }, e).then((e) => e.outcome)
8252
8262
  }) : void 0;
8253
- let mc = I.mergeAll(ko.toLayer(K), Bt), hc = Yc(K, E.map((e) => e.descriptor.name), ht), gc = I.mergeAll(ko.toLayer(hc), Bt), J = B, vc = (J === "postgres" || J === "mysql" || J === "mariadb" || J === "mssql") && (process.env.CDC ?? "1") !== "0";
8254
- if (J === "postgres" && im()) {
8263
+ let pc = I.mergeAll(Oo.toLayer(q), Bt), mc = Yc(q, T.map((e) => e.descriptor.name), gt), hc = I.mergeAll(Oo.toLayer(mc), Bt), Y = B, _c = (Y === "postgres" || Y === "mysql" || Y === "mariadb" || Y === "mssql") && (process.env.CDC ?? "1") !== "0";
8264
+ if (Y === "postgres" && im()) {
8255
8265
  let e = lm({
8256
8266
  store: R,
8257
8267
  log: Z
8258
8268
  });
8259
- Yn = e.persistTraceSpan, U(e.stop);
8269
+ Yn = e.persistTraceSpan, W(e.stop);
8260
8270
  }
8261
- let yc = Rc({
8271
+ let vc = Lc({
8262
8272
  store: R,
8263
- dialect: J,
8273
+ dialect: Y,
8264
8274
  log: { info: (e) => Z.info(e) }
8265
8275
  });
8266
- U(() => {
8267
- yc.stop();
8268
- }), oc({
8276
+ W(() => {
8277
+ vc.stop();
8278
+ }), ac({
8269
8279
  log: Z,
8270
- max: re(),
8271
- outOfPool: ic(J, vc),
8280
+ max: ie(),
8281
+ outOfPool: rc(Y, _c),
8272
8282
  readPools: t.replicationSnapshot()?.replicaCount ?? 0,
8273
8283
  always: !1
8274
8284
  });
8275
- let bc = dc({
8276
- queries: E,
8277
- mutations: D,
8278
- actions: O,
8279
- streams: Ge,
8280
- workflows: A
8281
- }, n), xc = fc({
8282
- queries: E,
8283
- mutations: D,
8284
- actions: O,
8285
- streams: Ge,
8286
- workflows: A
8285
+ let yc = uc({
8286
+ queries: T,
8287
+ mutations: E,
8288
+ actions: D,
8289
+ streams: Ke,
8290
+ workflows: k
8291
+ }, n), bc = dc({
8292
+ queries: T,
8293
+ mutations: E,
8294
+ actions: D,
8295
+ streams: Ke,
8296
+ workflows: k
8287
8297
  }, n);
8288
- Wt.writeFile(N(n, "app.manifest.generated.json"), `${JSON.stringify(dt(bc, xc, [], j?.plugins ?? []), null, 2)}\n`, "utf8").catch(() => {}), (async () => {
8298
+ Wt.writeFile(N(n, "app.manifest.generated.json"), `${JSON.stringify(ft(yc, bc, [], A?.plugins ?? []), null, 2)}\n`, "utf8").catch(() => {}), (async () => {
8289
8299
  let e = N(n, ".gitignore"), t = "";
8290
8300
  try {
8291
8301
  t = await Wt.readFile(e, "utf8");
@@ -8293,18 +8303,18 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8293
8303
  let r = t.split("\n").filter((e) => e.trim() !== "");
8294
8304
  r.includes("app.manifest.generated.json") || (r.push("app.manifest.generated.json"), await Wt.writeFile(e, `${r.join("\n")}\n`, "utf8"));
8295
8305
  })().catch(() => {}), Oa();
8296
- let Cc = N(n, "app.graph.observed.generated.json");
8306
+ let Sc = N(n, "app.graph.observed.generated.json");
8297
8307
  Wt.rm(N(n, "app.graph.observed.json"), { force: !0 }).catch(() => {});
8298
- let wc = Sc(n);
8299
- wc.warning === void 0 ? wc.adopted.length > 0 && Z.debug("handed generated output to the workspace owner", { paths: wc.adopted.join(", ") }) : Z.warn(wc.warning);
8300
- let Tc = async () => {
8308
+ let Cc = xc(n);
8309
+ Cc.warning === void 0 ? Cc.adopted.length > 0 && Z.debug("handed generated output to the workspace owner", { paths: Cc.adopted.join(", ") }) : Z.warn(Cc.warning);
8310
+ let wc = async () => {
8301
8311
  try {
8302
- await Wt.writeFile(Cc, `${JSON.stringify(Ro(), null, 2)}\n`, "utf8");
8312
+ await Wt.writeFile(Sc, `${JSON.stringify(Lo(), null, 2)}\n`, "utf8");
8303
8313
  } catch {}
8304
8314
  };
8305
8315
  setInterval(() => {
8306
- Tc();
8307
- }, 1e4).unref(), U(() => Tc()), (async () => {
8316
+ wc();
8317
+ }, 1e4).unref(), W(() => wc()), (async () => {
8308
8318
  let e = N(n, ".gitignore"), t = "";
8309
8319
  try {
8310
8320
  t = await Wt.readFile(e, "utf8");
@@ -8312,8 +8322,8 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8312
8322
  let r = t.split("\n").filter((e) => e.trim() !== "");
8313
8323
  r.includes("app.graph.observed.generated.json") || (r.push("app.graph.observed.generated.json"), await Wt.writeFile(e, `${r.join("\n")}\n`, "utf8"));
8314
8324
  })().catch(() => {});
8315
- let Dc = /* @__PURE__ */ new Map();
8316
- for (let e of _o) Dc.set(e.descriptor.name, async (t, n) => {
8325
+ let Ec = /* @__PURE__ */ new Map();
8326
+ for (let e of go) Ec.set(e.descriptor.name, async (t, n) => {
8317
8327
  let r = {
8318
8328
  subject: (await Rt({
8319
8329
  headers: n,
@@ -8328,7 +8338,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8328
8338
  traceId: r.traceId,
8329
8339
  subjectId: ta(r.subject),
8330
8340
  procedure: e.descriptor.name
8331
- }, () => Es(e, t, r))
8341
+ }, () => Ts(e, t, r))
8332
8342
  };
8333
8343
  } catch (t) {
8334
8344
  let n = Nh(t);
@@ -8341,7 +8351,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8341
8351
  };
8342
8352
  }
8343
8353
  });
8344
- for (let e of xo) Dc.set(e.descriptor.name, async (t, n) => {
8354
+ for (let e of bo) Ec.set(e.descriptor.name, async (t, n) => {
8345
8355
  let r = {
8346
8356
  subject: (await Rt({
8347
8357
  headers: n,
@@ -8356,7 +8366,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8356
8366
  traceId: r.traceId,
8357
8367
  subjectId: ta(r.subject),
8358
8368
  procedure: e.descriptor.name
8359
- }, () => Ds(e, t, r))
8369
+ }, () => Es(e, t, r))
8360
8370
  };
8361
8371
  } catch (t) {
8362
8372
  let n = Nh(t);
@@ -8369,23 +8379,23 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8369
8379
  };
8370
8380
  }
8371
8381
  });
8372
- let Oc = {
8382
+ let Dc = {
8373
8383
  candidates: eu({
8374
- queries: ho,
8375
- mutations: _o,
8376
- actions: xo,
8384
+ queries: mo,
8385
+ mutations: go,
8386
+ actions: bo,
8377
8387
  descriptorOf: (e) => e.descriptor,
8378
- runQuery: (e, t, n) => Promise.resolve(Rs(e, t, n)),
8379
- runMutation: (e, t, n) => Es(e, t, n),
8380
- runAction: (e, t, n) => Ds(e, t, n)
8388
+ runQuery: (e, t, n) => Promise.resolve(Ls(e, t, n)),
8389
+ runMutation: (e, t, n) => Ts(e, t, n),
8390
+ runAction: (e, t, n) => Es(e, t, n)
8381
8391
  }),
8382
- policy: j?.agents?.tools ?? {},
8383
- mcpEnabled: j?.agents?.mcp === !0,
8392
+ policy: A?.agents?.tools ?? {},
8393
+ mcpEnabled: A?.agents?.mcp === !0,
8384
8394
  resolveSubject: async (e) => (await Rt({
8385
8395
  headers: e,
8386
8396
  clientId: -1
8387
8397
  })).subject
8388
- }, Mc = () => ({
8398
+ }, jc = () => ({
8389
8399
  dialect: B,
8390
8400
  replication: t.replicationSnapshot() ?? {
8391
8401
  replicaCount: 0,
@@ -8417,11 +8427,11 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8417
8427
  ...e.lastRunRowsTouched === void 0 ? {} : { lastRunRowsTouched: e.lastRunRowsTouched },
8418
8428
  ...e.lastError ? { lastError: e.lastError } : {}
8419
8429
  }))
8420
- }), Nc = async () => cf({
8430
+ }), Mc = async () => cf({
8421
8431
  sqlLayer: yi,
8422
8432
  declared: P,
8423
8433
  log: Z
8424
- }), Pc = async (e) => {
8434
+ }), Nc = async (e) => {
8425
8435
  let t = await R.query({
8426
8436
  table: "_voltro_workflow_runs",
8427
8437
  order: [],
@@ -8430,17 +8440,17 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8430
8440
  skip: void 0,
8431
8441
  take: 1
8432
8442
  });
8433
- t[0] && w.emit("workflowRuns", {
8443
+ t[0] && C.emit("workflowRuns", {
8434
8444
  op: "update",
8435
- row: Us(t[0])
8445
+ row: Hs(t[0])
8436
8446
  });
8437
- }, Lc = async (e) => {
8447
+ }, Ic = async (e) => {
8438
8448
  let t = await $f({
8439
8449
  store: R,
8440
- workflows: A,
8441
- runRedrive: (e) => q.runPromise(Zr(e))
8450
+ workflows: k,
8451
+ runRedrive: (e) => J.runPromise(Zr(e))
8442
8452
  }, e.runId);
8443
- return t.statusReset && (await Pc(e.runId), await Js.recordEvent({
8453
+ return t.statusReset && (await Nc(e.runId), await qs.recordEvent({
8444
8454
  runId: e.runId,
8445
8455
  eventType: "run-redriven",
8446
8456
  payload: {
@@ -8457,53 +8467,53 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8457
8467
  activitiesReset: t.outcome.activitiesReset,
8458
8468
  reason: t.outcome.reason
8459
8469
  };
8460
- }, zc = ui({
8461
- dialect: J,
8470
+ }, Rc = ui({
8471
+ dialect: Y,
8462
8472
  ...Q()
8463
- }), Y = {
8473
+ }), zc = {
8464
8474
  kind: "api",
8465
8475
  meta: {
8466
- name: j?.name ?? M(n),
8476
+ name: A?.name ?? M(n),
8467
8477
  voltroVersion: Eh,
8468
- port: C,
8478
+ port: S,
8469
8479
  mode: "dev",
8470
- store: J,
8471
- cdc: vc ? "on" : "off",
8472
- ...zc === void 0 ? {} : { databaseId: zc }
8480
+ store: Y,
8481
+ cdc: _c ? "on" : "off",
8482
+ ...Rc === void 0 ? {} : { databaseId: Rc }
8473
8483
  },
8474
- rpc: bc,
8475
- workflows: xc,
8476
- metrics: (e) => bs.snapshot(e),
8484
+ rpc: yc,
8485
+ workflows: bc,
8486
+ metrics: (e) => ys.snapshot(e),
8477
8487
  dataCache: () => Um({
8478
8488
  stats: Kr,
8479
8489
  backendKind: Gr
8480
8490
  }),
8481
- invokers: Dc,
8482
- agentTools: () => Oc,
8491
+ invokers: Ec,
8492
+ agentTools: () => Dc,
8483
8493
  invariantChecks: () => ({
8484
8494
  mode: "dev",
8485
- accessGate: pt,
8486
- config: j,
8487
- ...je ? { rpcGroupFile: je } : {},
8488
- serverOnlyLeaks: ct,
8489
- migrations: Nc
8495
+ accessGate: mt,
8496
+ config: A,
8497
+ ...Me ? { rpcGroupFile: Me } : {},
8498
+ serverOnlyLeaks: lt,
8499
+ migrations: Mc
8490
8500
  }),
8491
8501
  plugins: () => ({
8492
8502
  plugins: Kt.snapshot(),
8493
8503
  capturedAt: Date.now()
8494
8504
  }),
8495
- env: () => te(j?.name ?? M(n), {
8496
- contract: _s(j?.env) ? j.env : void 0,
8497
- plugins: j?.plugins ?? []
8505
+ env: () => te(A?.name ?? M(n), {
8506
+ contract: gs(A?.env) ? A.env : void 0,
8507
+ plugins: A?.plugins ?? []
8498
8508
  }),
8499
- subscriptions: () => Wm(() => H),
8509
+ subscriptions: () => Wm(() => U),
8500
8510
  events: hm(Pi.bus, Pi.declared),
8501
8511
  members: () => ({
8502
8512
  members: Or.membership.list(),
8503
8513
  capturedAt: Date.now()
8504
8514
  }),
8505
- database: Mc,
8506
- migrations: async () => Nc(),
8515
+ database: jc,
8516
+ migrations: async () => Mc(),
8507
8517
  inspectTables: () => kp(P),
8508
8518
  inspectRows: Ap({
8509
8519
  store: R,
@@ -8540,62 +8550,66 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8540
8550
  }), { deleted: t };
8541
8551
  },
8542
8552
  inspectImport: async (e) => {
8543
- let t = await F.runPromise(Qs({
8553
+ let t = await F.runPromise(Zs({
8544
8554
  store: R,
8545
8555
  bundleDir: e.bundleDir,
8546
8556
  ...e.mode ? { mode: e.mode } : {},
8547
8557
  ...e.onConflict ? { onConflict: e.onConflict } : {},
8548
8558
  ...e.atomic === void 0 ? {} : { atomic: e.atomic }
8549
- })), n = t.tables.reduce((e, t) => e + t.rowCount, 0);
8559
+ })), n = t.rowsWritten;
8550
8560
  return Z.info("inspect.data.import", {
8551
8561
  bundleDir: e.bundleDir,
8552
- tables: t.tables.length,
8562
+ tables: t.tablesWritten,
8553
8563
  rows: n,
8554
- mode: e.mode ?? "upsert"
8564
+ mode: e.mode ?? "upsert",
8565
+ ...t.tablesSkipped > 0 ? {
8566
+ skippedTables: t.tablesSkipped,
8567
+ skippedRows: t.rowsSkipped
8568
+ } : {}
8555
8569
  }), {
8556
- tables: t.tables.length,
8570
+ tables: t.tablesWritten,
8557
8571
  rows: n
8558
8572
  };
8559
8573
  },
8560
- ...ht ? {
8574
+ ...gt ? {
8561
8575
  ...Hm(R, {
8562
- controls: _d(A),
8563
- active: A.length > 0,
8564
- cancellation: () => uc?.cancelHealth()
8576
+ controls: _d(k),
8577
+ active: k.length > 0,
8578
+ cancellation: () => lc?.cancelHealth()
8565
8579
  }),
8566
8580
  ...Np({
8567
8581
  store: R,
8568
8582
  log: Z,
8569
- workflows: A,
8583
+ workflows: k,
8570
8584
  workflowsProxy: V,
8571
- workflowRuntime: q,
8572
- workflowRunRecorder: Js,
8573
- closeChildrenForParent: Ys,
8574
- onRunUpdated: (e) => w.emit("workflowRuns", {
8585
+ workflowRuntime: J,
8586
+ workflowRunRecorder: qs,
8587
+ closeChildrenForParent: Js,
8588
+ onRunUpdated: (e) => C.emit("workflowRuns", {
8575
8589
  op: "update",
8576
- row: Us(e)
8590
+ row: Hs(e)
8577
8591
  })
8578
8592
  }),
8579
8593
  inspectInferences: async (e) => Bd({
8580
8594
  store: R,
8581
- active: A.length > 0,
8582
- dispatcher: () => pc?.health()
8595
+ active: k.length > 0,
8596
+ dispatcher: () => fc?.health()
8583
8597
  }, e.limit === void 0 ? {} : { limit: e.limit }),
8584
8598
  ...Pd({
8585
8599
  store: R,
8586
- cancelRun: async (e) => await cc()?.(e) ?? !1,
8600
+ cancelRun: async (e) => await sc()?.(e) ?? !1,
8587
8601
  retryRun: async (e) => V?.retry(e),
8588
- redriveRun: async (e) => Lc({ runId: e }),
8602
+ redriveRun: async (e) => Ic({ runId: e }),
8589
8603
  log: Z
8590
8604
  }),
8591
- inspectRedriveWorkflowRun: Lc,
8605
+ inspectRedriveWorkflowRun: Ic,
8592
8606
  inspectResumeWorkflowRunFromStep: async (e) => {
8593
8607
  let t = await ep({
8594
8608
  store: R,
8595
- workflows: A,
8596
- runResume: (e) => q.runPromise(ei(e))
8609
+ workflows: k,
8610
+ runResume: (e) => J.runPromise(ei(e))
8597
8611
  }, e.runId, e.step);
8598
- return t.statusReset && (await Pc(e.runId), await Js.recordEvent({
8612
+ return t.statusReset && (await Nc(e.runId), await qs.recordEvent({
8599
8613
  runId: e.runId,
8600
8614
  eventType: "run-redriven",
8601
8615
  payload: {
@@ -8640,54 +8654,54 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8640
8654
  scheduleCoordChoice: oa
8641
8655
  }),
8642
8656
  runSeed: async (e) => {
8643
- let n = await se(Ti.seeds, e, R, wi);
8644
- return t.recordSeedResult(n), Mc();
8657
+ let n = await ce(Ti.seeds, e, R, wi);
8658
+ return t.recordSeedResult(n), jc();
8645
8659
  },
8646
- rollbackMigration: async (e) => (wi.warn("rollbackMigration called but only memory store is wired — no-op"), Mc()),
8660
+ rollbackMigration: async (e) => (wi.warn("rollbackMigration called but only memory store is wired — no-op"), jc()),
8647
8661
  webhooks: () => xm({
8648
8662
  store: R,
8649
- discoveredWebhooks: za
8663
+ discoveredWebhooks: H
8650
8664
  }),
8651
8665
  ...Ii === void 0 ? {} : { webhookActions: Gm(() => Ii) }
8652
8666
  }, Vc = np({
8653
- plugins: j?.plugins ?? [],
8654
- metrics: bs,
8667
+ plugins: A?.plugins ?? [],
8668
+ metrics: ys,
8655
8669
  log: Z
8656
- }), Hc = (j?.plugins ?? []).flatMap((e) => e.httpRoutes ?? []), Jc = typeof yt == "object" ? yt.managementPath : void 0, X = () => `public-${Math.random().toString(36).slice(2, 10)}`, Qc = [
8657
- ...E.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
8670
+ }), Hc = (A?.plugins ?? []).flatMap((e) => e.httpRoutes ?? []), Jc = typeof yt == "object" ? yt.managementPath : void 0, X = () => `public-${Math.random().toString(36).slice(2, 10)}`, Qc = [
8671
+ ...T.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
8658
8672
  descriptor: e.descriptor,
8659
- invoke: (t, n) => Rs(e, t, {
8673
+ invoke: (t, n) => Ls(e, t, {
8660
8674
  subject: n.subject,
8661
8675
  traceId: X()
8662
8676
  }),
8663
- subscribe: (t, n, r) => zs(e, t, {
8677
+ subscribe: (t, n, r) => Rs(e, t, {
8664
8678
  subject: n.subject,
8665
8679
  traceId: X()
8666
8680
  }, r)
8667
8681
  })),
8668
- ...D.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
8682
+ ...E.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
8669
8683
  descriptor: e.descriptor,
8670
- invoke: (t, n) => Es(e, t, {
8684
+ invoke: (t, n) => Ts(e, t, {
8671
8685
  subject: n.subject,
8672
8686
  traceId: X()
8673
8687
  })
8674
8688
  })),
8675
- ...O.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
8689
+ ...D.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
8676
8690
  descriptor: e.descriptor,
8677
- invoke: (t, n) => Ds(e, t, {
8691
+ invoke: (t, n) => Es(e, t, {
8678
8692
  subject: n.subject,
8679
8693
  traceId: X()
8680
8694
  })
8681
8695
  }))
8682
8696
  ], $c = Zc({
8683
- restRoutes: [...j?.restRoutes ?? [], ...xt ? na(xt, Jc ?? "/v1/api-keys") : []],
8697
+ restRoutes: [...A?.restRoutes ?? [], ...xt ? na(xt, Jc ?? "/v1/api-keys") : []],
8684
8698
  publicApiEntries: Qc,
8685
8699
  store: R,
8686
8700
  resolveSubject: async (e) => (await Rt({
8687
8701
  headers: e,
8688
8702
  clientId: -1
8689
8703
  })).subject,
8690
- ...Bs === void 0 ? {} : { idempotency: Bs },
8704
+ ...zs === void 0 ? {} : { idempotency: zs },
8691
8705
  log: Z
8692
8706
  }).httpRoutes, el = [
8693
8707
  ...Hc,
@@ -8695,31 +8709,31 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8695
8709
  ...or.httpRoutes
8696
8710
  ];
8697
8711
  try {
8698
- await ee(C, "voltro dev (api)");
8712
+ await ee(S, "voltro dev (api)");
8699
8713
  } catch (e) {
8700
8714
  Z.error(String(e.message ?? e)), process.exit(1);
8701
8715
  }
8702
- let { server: tl } = as({
8703
- group: ko,
8704
- handlersLayer: mc,
8705
- httpHandlersLayer: gc,
8706
- port: C,
8707
- path: j?.transport?.wsPath ?? "/ws",
8708
- security: iu(j),
8716
+ let { server: tl } = is({
8717
+ group: Oo,
8718
+ handlersLayer: pc,
8719
+ httpHandlersLayer: hc,
8720
+ port: S,
8721
+ path: A?.transport?.wsPath ?? "/ws",
8722
+ security: iu(A),
8709
8723
  ...Vc,
8710
8724
  ...el.length > 0 ? { httpRoutes: el } : {},
8711
8725
  getStore: () => vt.current,
8712
8726
  inspectRoute: { handle: async (e, t, n, r) => {
8713
- let i = Je(t.host, k(t.origin));
8727
+ let i = Ye(t.host, O(t.origin));
8714
8728
  if (i) return i;
8715
8729
  if (n !== "OPTIONS") {
8716
- if (Ke()) return {
8730
+ if (qe()) return {
8717
8731
  status: 503,
8718
8732
  contentType: "application/json",
8719
8733
  body: JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }),
8720
- headers: k(t.origin)
8734
+ headers: O(t.origin)
8721
8735
  };
8722
- let e = $e(t, n);
8736
+ let e = et(t, n);
8723
8737
  if (!e.ok) return {
8724
8738
  status: 401,
8725
8739
  contentType: "application/json",
@@ -8727,7 +8741,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8727
8741
  error: "unauthorized",
8728
8742
  reason: e.reason
8729
8743
  }),
8730
- headers: k(t.origin)
8744
+ headers: O(t.origin)
8731
8745
  };
8732
8746
  }
8733
8747
  if (n === "GET" && e === "/_voltro/inspect/plugins/dashboard-mounts") return {
@@ -8737,43 +8751,43 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8737
8751
  mounts: Yt,
8738
8752
  capturedAt: Date.now()
8739
8753
  }),
8740
- headers: k(t.origin)
8754
+ headers: O(t.origin)
8741
8755
  };
8742
- if (n === "POST" && (e === "/_voltro/inspect/invoke" || e.startsWith("/_voltro/inspect/invoke?"))) return ut(Y, t, r ?? "", { method: n });
8743
- let a = await km(e, Y, t, {
8756
+ if (n === "POST" && (e === "/_voltro/inspect/invoke" || e.startsWith("/_voltro/inspect/invoke?"))) return dt(zc, t, r ?? "", { method: n });
8757
+ let a = await km(e, zc, t, {
8744
8758
  method: n,
8745
8759
  ...r === void 0 ? {} : { body: r }
8746
8760
  });
8747
8761
  if (a) return a;
8748
8762
  if (n === "POST" && e.startsWith("/_voltro/inspect/")) {
8749
- let i = rt(e, Y, t, r ?? "", { method: n });
8763
+ let i = it(e, zc, t, r ?? "", { method: n });
8750
8764
  if (e === "/_voltro/inspect/seeds/run" || e === "/_voltro/inspect/migrations/rollback") return i;
8751
8765
  }
8752
8766
  if (n === "POST" && e === "/_voltro/inspect/clientLog") return {
8753
- ...l(r ?? "", w),
8754
- headers: k(t.origin)
8767
+ ...l(r ?? "", C),
8768
+ headers: O(t.origin)
8755
8769
  };
8756
8770
  if (n === "GET" && (e === "/_voltro/inspect/logs" || e.startsWith("/_voltro/inspect/logs?"))) return {
8757
8771
  ...d(e, c(), t),
8758
- headers: k(t.origin)
8772
+ headers: O(t.origin)
8759
8773
  };
8760
8774
  if (n === "GET" && (e === "/_voltro/inspect/traces" || e.startsWith("/_voltro/inspect/traces?"))) {
8761
8775
  let n = Qp();
8762
8776
  return {
8763
- ...Bp(e, J === "postgres" && im() ? await Yh(e, n, R) : n),
8764
- headers: k(t.origin)
8777
+ ...Bp(e, Y === "postgres" && im() ? await Yh(e, n, R) : n),
8778
+ headers: O(t.origin)
8765
8779
  };
8766
8780
  }
8767
8781
  if ((n === "POST" || n === "PATCH" || n === "DELETE") && e.startsWith("/_voltro/inspect/data/rows")) {
8768
- let i = await mt(e, Y, t, r ?? "", { method: n });
8782
+ let i = await ht(e, zc, t, r ?? "", { method: n });
8769
8783
  if (i) return i;
8770
8784
  }
8771
8785
  if (n === "POST" && e.startsWith("/_voltro/inspect/data/import")) {
8772
- let i = await tt(e, Y, t, r ?? "", { method: n });
8786
+ let i = await nt(e, zc, t, r ?? "", { method: n });
8773
8787
  if (i) return i;
8774
8788
  }
8775
8789
  if (e.startsWith("/_voltro/inspect/aggregates")) {
8776
- let r = await Lu(e, n, Zi.registry, k(t.origin));
8790
+ let r = await Lu(e, n, Zi.registry, O(t.origin));
8777
8791
  if (r) return r;
8778
8792
  }
8779
8793
  if (e.startsWith("/_voltro/inspect/expectations") || e.startsWith("/_voltro/inspect/budgets") || e.startsWith("/_voltro/inspect/experiments")) {
@@ -8781,67 +8795,67 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8781
8795
  expectations: Qi?.registry ?? Hu,
8782
8796
  cost: $i?.registry ?? Uu,
8783
8797
  experiments: ea?.registry ?? Wu
8784
- }, k(t.origin));
8798
+ }, O(t.origin));
8785
8799
  if (r) return r;
8786
8800
  }
8787
8801
  if (e.startsWith("/_voltro/inspect/timeline")) {
8788
8802
  let r = await od(e, n, {
8789
8803
  recorder: Ia(),
8790
- readCurrentRows: async (e) => Y.inspectRows === void 0 ? [] : (await Y.inspectRows({
8804
+ readCurrentRows: async (e) => zc.inspectRows === void 0 ? [] : (await zc.inspectRows({
8791
8805
  table: e,
8792
8806
  offset: 0,
8793
8807
  limit: 500,
8794
8808
  count: "none"
8795
8809
  })).rows
8796
- }, k(t.origin));
8810
+ }, O(t.origin));
8797
8811
  if (r) return r;
8798
8812
  }
8799
8813
  if (e.startsWith("/_voltro/inspect/analytics")) {
8800
8814
  let r = ed(e, n, {
8801
8815
  sink: di,
8802
- metricsCollector: bs
8803
- }, k(t.origin));
8816
+ metricsCollector: ys
8817
+ }, O(t.origin));
8804
8818
  if (r) return r;
8805
8819
  }
8806
8820
  if (e.startsWith("/_voltro/inspect/plugins/")) {
8807
8821
  let i = await Jt.dispatch(e, n, t, r ?? "");
8808
8822
  if (i) return i;
8809
8823
  }
8810
- return n === "GET" ? lt(e, Y, t, { method: n }).then((r) => r ?? at(e, Y, t, { method: n })) : at(e, Y, t, { method: n });
8824
+ return n === "GET" ? ut(e, zc, t, { method: n }).then((r) => r ?? ot(e, zc, t, { method: n })) : ot(e, zc, t, { method: n });
8811
8825
  } },
8812
8826
  inspectStream: {
8813
- authorize: (e) => Ye(e.host) ? $e(e, "GET") : {
8827
+ authorize: (e) => Xe(e.host) ? et(e, "GET") : {
8814
8828
  ok: !1,
8815
8829
  reason: "forbidden host (DNS-rebinding guard)"
8816
8830
  },
8817
- isDisabled: () => Ke(),
8818
- replay: () => w.buffered().map(p),
8819
- subscribe: (e) => w.subscribe((t) => e(p(t))),
8820
- corsHeaders: (e) => k(e),
8831
+ isDisabled: () => qe(),
8832
+ replay: () => C.buffered().map(p),
8833
+ subscribe: (e) => C.subscribe((t) => e(p(t))),
8834
+ corsHeaders: (e) => O(e),
8821
8835
  keepAlive: () => m()
8822
8836
  },
8823
- webhookRoutes: new Map(Array.from(Ba.entries()).map(([e, t]) => [e, { handle: t }])),
8837
+ webhookRoutes: new Map(Array.from(za.entries()).map(([e, t]) => [e, { handle: t }])),
8824
8838
  ...er ? { tracerLayer: er } : {}
8825
8839
  });
8826
8840
  try {
8827
8841
  await da(tl);
8828
8842
  } catch (e) {
8829
- Z.error(`rpc server failed to bind on port ${C} — aborting boot`, { port: C }, e), process.exit(1);
8843
+ Z.error(`rpc server failed to bind on port ${S} — aborting boot`, { port: S }, e), process.exit(1);
8830
8844
  }
8831
- Z.info(`listening on http://localhost:${C}`, {
8832
- port: C,
8833
- ws: `ws://localhost:${C}/ws`,
8834
- store: J
8835
- }), Ce?.set({ phase: "ready" }), process.send?.({ type: ll }), process.channel?.unref(), J === "postgres" && Z.info("postgres change-data-capture", { enabled: (process.env.CDC ?? "1") !== "0" }), await $o();
8845
+ Z.info(`listening on http://localhost:${S}`, {
8846
+ port: S,
8847
+ ws: `ws://localhost:${S}/ws`,
8848
+ store: Y
8849
+ }), we?.set({ phase: "ready" }), process.send?.({ type: ll }), process.channel?.unref(), Y === "postgres" && Z.info("postgres change-data-capture", { enabled: (process.env.CDC ?? "1") !== "0" }), await Qo();
8836
8850
  try {
8837
8851
  await Nt({
8838
- id: ae,
8839
- name: ie,
8852
+ id: oe,
8853
+ name: ae,
8840
8854
  kind: "api",
8841
- url: `http://localhost:${C}`,
8855
+ url: `http://localhost:${S}`,
8842
8856
  pid: process.pid,
8843
8857
  status: "live",
8844
- logFile: de.path
8858
+ logFile: fe.path
8845
8859
  });
8846
8860
  let e = s(n);
8847
8861
  if (e) {
@@ -8850,21 +8864,21 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8850
8864
  }
8851
8865
  setInterval(() => {
8852
8866
  Nt({
8853
- id: ae,
8854
- name: ie,
8867
+ id: oe,
8868
+ name: ae,
8855
8869
  kind: "api",
8856
- url: `http://localhost:${C}`,
8870
+ url: `http://localhost:${S}`,
8857
8871
  pid: process.pid,
8858
8872
  status: "live",
8859
- logFile: de.path
8873
+ logFile: fe.path
8860
8874
  }).catch(() => {});
8861
8875
  }, 1e4).unref();
8862
8876
  let t = async () => {
8863
8877
  Kt.deactivate();
8864
8878
  for (let e of xr) e.stop();
8865
- gr?.dispose(), Pt(ae), de.dispose(), Yr(), Nr?.close(), await _i();
8879
+ gr?.dispose(), Pt(oe), fe.dispose(), Yr(), Nr?.close(), await _i();
8866
8880
  };
8867
- U(t);
8881
+ W(t);
8868
8882
  let r = process.ppid;
8869
8883
  if (r > 1) {
8870
8884
  let e = setInterval(() => {
@@ -8875,7 +8889,7 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8875
8889
  } catch (e) {
8876
8890
  Z.warn("runtime-registry write failed", {}, e);
8877
8891
  }
8878
- return b(e, Z, {
8892
+ return y(e, Z, {
8879
8893
  root: n,
8880
8894
  onBeforeRestart: () => {
8881
8895
  try {
@@ -8884,15 +8898,15 @@ ${r.join("\n")}\n A deployment with no producer waits forever and looks exactly
8884
8898
  tl.close();
8885
8899
  }
8886
8900
  }), Qt({
8887
- app: ie,
8901
+ app: ae,
8888
8902
  kind: "api",
8889
- url: `http://localhost:${C}`,
8903
+ url: `http://localhost:${S}`,
8890
8904
  extras: [{
8891
8905
  label: "WS",
8892
- url: `ws://localhost:${C}/ws`
8906
+ url: `ws://localhost:${S}/ws`
8893
8907
  }],
8894
8908
  bootMs: Date.now() - g
8895
8909
  }), new Promise(() => {});
8896
8910
  };
8897
8911
  //#endregion
8898
- export { pf as $, pl as $t, vm as A, lu as At, np as B, zl as Bt, Hm as C, zu as Ct, km as D, yu as Dt, Mm as E, Mu as Et, Mp as F, eu as Ft, Wf as G, Nl as Gt, $f as H, Rl as Ht, Np as I, Yl as It, Af as J, Tl as Jt, Hf as K, kl as Kt, kp as L, Kl as Lt, mm as M, su as Mt, hm as N, au as Nt, xm as O, fu as Ot, im as P, iu as Pt, mf as Q, _l as Qt, Ap as R, Hl as Rt, Gm as S, tc as Sn, Bu as St, Am as T, ju as Tt, ep as U, Fl as Ut, Xf as V, Bl as Vt, Zf as W, Il as Wt, vf as X, Sl as Xt, gf as Y, bl as Yt, ff as Z, vl as Zt, vh as _, fc as _n, dd as _t, Uh as a, qc as an, $d as at, Um as b, oc as bn, Hu as bt, Qh as c, Uc as cn, Yd as ct, cg as d, Ic as dn, Wd as dt, hl as en, uf as et, Fh as f, kc as fn, Bd as ft, ph as g, dc as gn, pd as gt, mh as h, Sc as hn, bd as ht, ng as i, Kc as in, tf as it, pm as j, cu as jt, _m as k, _u as kt, Zh as l, Bc as ln, qd as lt, wh as m, Ec as mn, _d as mt, Ah as n, Xc as nn, of as nt, Q as o, Gc as on, ef as ot, rg as p, Ac as pn, Pd as pt, Ff as q, Dl as qt, kh as r, Yc as rn, nf as rt, Nh as s, Wc as sn, Zd as st, Eh as t, Zc as tn, cf as tt, Xh as u, Rc as un, Hd as ut, bh as v, lc as vn, fd as vt, Nm as w, Vu as wt, Wm as x, ec as xn, Wu as xt, qm as y, ic as yn, Uu as yt, up as z, Wl as zt };
8912
+ export { pf as $, pl as $t, vm as A, lu as At, np as B, zl as Bt, Hm as C, zu as Ct, km as D, yu as Dt, Mm as E, Mu as Et, Mp as F, eu as Ft, Wf as G, Nl as Gt, $f as H, Rl as Ht, Np as I, Yl as It, Af as J, Tl as Jt, Hf as K, kl as Kt, kp as L, Kl as Lt, mm as M, su as Mt, hm as N, au as Nt, xm as O, fu as Ot, im as P, iu as Pt, mf as Q, _l as Qt, Ap as R, Hl as Rt, Gm as S, ec as Sn, Bu as St, Am as T, ju as Tt, ep as U, Fl as Ut, Xf as V, Bl as Vt, Zf as W, Il as Wt, vf as X, Sl as Xt, gf as Y, bl as Yt, ff as Z, vl as Zt, vh as _, dc as _n, dd as _t, Uh as a, qc as an, $d as at, Um as b, ac as bn, Hu as bt, Qh as c, Uc as cn, Yd as ct, cg as d, Fc as dn, Wd as dt, hl as en, uf as et, Fh as f, Oc as fn, Bd as ft, ph as g, uc as gn, pd as gt, mh as h, xc as hn, bd as ht, ng as i, Kc as in, tf as it, pm as j, cu as jt, _m as k, _u as kt, Zh as l, Bc as ln, qd as lt, wh as m, Tc as mn, _d as mt, Ah as n, Xc as nn, of as nt, Q as o, Gc as on, ef as ot, rg as p, kc as pn, Pd as pt, Ff as q, Dl as qt, kh as r, Yc as rn, nf as rt, Nh as s, Wc as sn, Zd as st, Eh as t, Zc as tn, cf as tt, Xh as u, Lc as un, Hd as ut, bh as v, cc as vn, fd as vt, Nm as w, Vu as wt, Wm as x, $s as xn, Wu as xt, qm as y, rc as yn, Uu as yt, up as z, Wl as zt };