@voltro/cli 0.46.0 → 0.48.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 (96) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/dist/apiBuild-DOnvi2zm.js +2 -0
  3. package/dist/{apiBuild-BKdd0I1Z.js → apiBuild-Dz8TJSxp.js} +1 -1
  4. package/dist/bin.js +1 -1
  5. package/dist/{build-co6yadYz.js → build-DLme2ppa.js} +7 -7
  6. package/dist/{checkCommand-CXAXTjZL.js → checkCommand-BUBqPBlI.js} +1 -1
  7. package/dist/{checkCommand-B-eiW-G_.js → checkCommand-Dals7g-I.js} +4 -4
  8. package/dist/{codegen-sbN1Y8PB.js → codegen-CrMXs4hb.js} +176 -162
  9. package/dist/codegen-DiMn2KkZ.js +2 -0
  10. package/dist/{codegenCommand-CB6_3sX0.js → codegenCommand-L6vacVRW.js} +4 -3
  11. package/dist/{commands-C-hxgAGr.js → commands-CAxFLqG4.js} +18 -18
  12. package/dist/{dashboardCommand-CEVO0GWF.js → dashboardCommand-CJC8Kg-s.js} +1 -1
  13. package/dist/{dataCommand-k0ezbQWa.js → dataCommand-hIaq2iKY.js} +266 -189
  14. package/dist/dbCommand-D1Q33ktl.js +2 -0
  15. package/dist/{dbCommand-BwkyNxn-.js → dbCommand-ZGNItjoJ.js} +4 -4
  16. package/dist/declaredSchemaGates-BlcwObhb.js +25 -0
  17. package/dist/{dev-DyoYst4j.js → dev-cGGsLNn6.js} +1 -1
  18. package/dist/{dev-8hTEnN6s.js → dev-lvnVq5RD.js} +32 -31
  19. package/dist/{doctorCommand-B6D7HH1-.js → doctorCommand-BK0qu7eD.js} +34 -16
  20. package/dist/doctorCommand-CWgUPye-.js +2 -0
  21. package/dist/doctorDecidedSchema-BlbWgCD_.js +23 -0
  22. package/dist/{doctorSourceRelations-CPjSwYuZ.js → doctorSourceRelations-Dd48LPvO.js} +15 -10
  23. package/dist/{dormancyCommand-CrPAwOgo.js → dormancyCommand-CyIk-zq4.js} +1 -1
  24. package/dist/{embeddingsCommand-DsSxsn_b.js → embeddingsCommand-D7TLklps.js} +1 -1
  25. package/dist/{envCommand-B_NPVGUf.js → envCommand-BHxKkGXq.js} +1 -1
  26. package/dist/{evolveCommand-DUuaCIyn.js → evolveCommand-CQh6dw21.js} +1 -1
  27. package/dist/{frameworkTableAssembly-BPlPfU07.js → frameworkTableAssembly-BNod_DKN.js} +124 -143
  28. package/dist/frameworkTableAssembly-Rft-DPUg.js +2 -0
  29. package/dist/index.js +1 -1
  30. package/dist/{migrate-CM1qwalu.js → migrate-CL5Ed01M.js} +4 -4
  31. package/dist/{runtimeTrace-BRNM06vK.js → runtimeTrace-C0SlIoQY.js} +1 -1
  32. package/dist/{sdkgen-CRCw_XcR.js → sdkgen-BXm7zx7F.js} +1 -1
  33. package/dist/{serveCommand-CHOr74WM.js → serveCommand-CV3YO9L3.js} +676 -569
  34. package/dist/serveCommand-ZP_Cb-yz.js +2 -0
  35. package/dist/serveEntry.js +1 -1
  36. package/dist/{test-CHb7UwvE.js → test-rXFq4S76.js} +1 -1
  37. package/dist/{webhooksCommand-BRrG_sGf.js → webhooksCommand-QlAk_tED.js} +1 -1
  38. package/package.json +17 -17
  39. package/templates/AGENTS.md +1 -1
  40. package/templates/agent-docs/_index.md +1 -1
  41. package/templates/agent-docs/cli.md +86 -3
  42. package/templates/agent-docs/database/migrations.md +19 -5
  43. package/templates/agent-docs/whats-new.md +39 -135
  44. package/templates/apps/api-ai/package.json +7 -7
  45. package/templates/apps/api-auth/package.json +8 -8
  46. package/templates/apps/api-backend/package.json +7 -7
  47. package/templates/apps/api-backend-deactivation/package.json +7 -7
  48. package/templates/apps/api-backend-mail/package.json +8 -8
  49. package/templates/apps/api-backend-mariadb/package.json +9 -9
  50. package/templates/apps/api-backend-sqlite/package.json +8 -8
  51. package/templates/apps/api-backend-storage/package.json +8 -8
  52. package/templates/apps/api-cms/package.json +10 -10
  53. package/templates/apps/api-collab/package.json +8 -8
  54. package/templates/apps/api-data-advanced/package.json +8 -8
  55. package/templates/apps/api-durable/package.json +8 -8
  56. package/templates/apps/api-feature-flags/package.json +9 -9
  57. package/templates/apps/api-governance/package.json +8 -8
  58. package/templates/apps/api-kv/package.json +8 -8
  59. package/templates/apps/api-moderation/package.json +8 -8
  60. package/templates/apps/api-observability/package.json +8 -8
  61. package/templates/apps/api-ratelimit/package.json +8 -8
  62. package/templates/apps/api-rbac/package.json +8 -8
  63. package/templates/apps/api-rest/package.json +7 -7
  64. package/templates/apps/api-saas/package.json +11 -11
  65. package/templates/apps/api-saas-starter/package.json +10 -10
  66. package/templates/apps/api-search/package.json +8 -8
  67. package/templates/apps/api-status/package.json +8 -8
  68. package/templates/apps/api-versioning/package.json +8 -8
  69. package/templates/apps/api-webhooks/package.json +9 -9
  70. package/templates/apps/changelog/package.json +6 -6
  71. package/templates/apps/edge-functions/package.json +2 -2
  72. package/templates/apps/frontend-admin/package.json +8 -8
  73. package/templates/apps/frontend-app/package.json +9 -9
  74. package/templates/apps/frontend-auth/package.json +8 -8
  75. package/templates/apps/frontend-blank/package.json +7 -7
  76. package/templates/apps/frontend-cms/package.json +9 -9
  77. package/templates/apps/frontend-collab/package.json +10 -10
  78. package/templates/apps/frontend-contact/package.json +7 -7
  79. package/templates/apps/frontend-dashboard/package.json +7 -7
  80. package/templates/apps/frontend-docs/package.json +7 -7
  81. package/templates/apps/frontend-i18n/package.json +6 -6
  82. package/templates/apps/frontend-landing/package.json +7 -7
  83. package/templates/apps/frontend-portal/package.json +8 -8
  84. package/templates/apps/frontend-saas/package.json +8 -8
  85. package/templates/apps/frontend-spa/package.json +7 -7
  86. package/templates/apps/frontend-ssr/package.json +7 -7
  87. package/templates/apps/frontend-ssr-api/package.json +8 -8
  88. package/templates/apps/frontend-static-blog/package.json +6 -6
  89. package/templates/apps/frontend-status/package.json +8 -8
  90. package/templates/apps/mobile-app/package.json +4 -4
  91. package/dist/apiBuild-P2gewrfQ.js +0 -2
  92. package/dist/codegen-DcE2li1i.js +0 -2
  93. package/dist/dbCommand-C2XK63Dd.js +0 -2
  94. package/dist/doctorCommand-Btl2Jz1a.js +0 -2
  95. package/dist/frameworkTableAssembly-Bob3vj9R.js +0 -2
  96. package/dist/serveCommand-BNHMVXyp.js +0 -2
@@ -1,45 +1,46 @@
1
1
  import { n as e } from "./appModuleLoader-C9r9mxZt.js";
2
- import { D as t, a as n, j as r, k as i, x as a } from "./fileConventions-Cof68_BL.js";
3
- import { basename as o, join as s } from "node:path";
4
- import { existsSync as c, promises as l } from "node:fs";
5
- import { pathToFileURL as u } from "node:url";
6
- import { defineAction as d, defineMutation as f, defineQuery as ee } from "@voltro/protocol";
7
- import { _voltroApiKeysTable as te, _voltroCdcOffsetsTable as ne, _voltroIdempotencyTable as re, _voltroKvTable as ie, _voltroMigrationPlansTable as ae, _voltroMigrationsTable as oe, _voltroMssqlCdcOffsetsTable as se, _voltroReplaceInProgressTable as ce, _voltroSeedsTable as le } from "@voltro/database";
2
+ import { n as t } from "./declaredSchemaGates-BlcwObhb.js";
3
+ import { D as n, a as r, j as i, k as a, x as o } from "./fileConventions-Cof68_BL.js";
4
+ import { basename as s, join as c } from "node:path";
5
+ import { existsSync as l, promises as u } from "node:fs";
6
+ import { pathToFileURL as d } from "node:url";
7
+ import { defineAction as f, defineMutation as ee, defineQuery as te } from "@voltro/protocol";
8
+ import { _voltroApiKeysTable as ne, _voltroCdcOffsetsTable as re, _voltroIdempotencyTable as ie, _voltroImportRunsTable as ae, _voltroKvTable as oe, _voltroMigrationPlansTable as se, _voltroMigrationsTable as ce, _voltroMssqlCdcOffsetsTable as le, _voltroReplaceInProgressTable as ue, _voltroSeedsTable as de } from "@voltro/database";
8
9
  import { Effect as p } from "effect";
9
10
  import { SqlClient as m } from "@effect/sql";
10
- import { _voltroApprovalsTable as ue, _voltroConnectionGrantsTable as de, _voltroConnectionsTable as fe, _voltroScheduleClaimsTable as pe, _voltroScheduleRunsTable as me, _voltroTracesTable as he, _voltroUndoLogTable as ge, _voltroWakeupsTable as h, _voltroWorkflowEventDeliveriesTable as g, _voltroWorkflowEventsTable as _, outboxAttemptsTable as v, outboxTable as y } from "@voltro/runtime";
11
- import { _voltroBudgetHoldsTable as b, _voltroWorkflowAdmissionsTable as x, _voltroWorkflowPausesTable as S, _voltroWorkflowPendingTable as C, _voltroWorkflowRunEventsTable as w, _voltroWorkflowRunStepsTable as T, _voltroWorkflowRunsTable as E, _voltroWorkflowStartContextsTable as D, _voltroWorkflowWatermarksTable as O } from "@voltro/workflow";
12
- import { agentMessagesTable as k, agentThreadsTable as A, aiBudgetTable as j, aiInferencesTable as M, aiUsageTable as N, isAgentDescriptor as P, isAgentExecutor as F, promptsTable as I, resolveToolModuleHandlers as L } from "@voltro/ai";
13
- import { _voltroWebhookDeliveriesTable as _e, _voltroWebhookTargetsTable as ve } from "@voltro/plugin-webhooks/mixin";
14
- import { _voltroStorageBlobsTable as ye, _voltroStorageGrantsTable as be, _voltroStorageRefsTable as xe, _voltroStorageUsageTable as Se } from "@voltro/plugin-storage";
11
+ import { _voltroApprovalsTable as fe, _voltroConnectionGrantsTable as pe, _voltroConnectionsTable as me, _voltroScheduleClaimsTable as he, _voltroScheduleRunsTable as h, _voltroTracesTable as g, _voltroUndoLogTable as _, _voltroWakeupsTable as v, _voltroWorkflowEventDeliveriesTable as y, _voltroWorkflowEventsTable as b, outboxAttemptsTable as x, outboxTable as S } from "@voltro/runtime";
12
+ import { _voltroBudgetHoldsTable as C, _voltroWorkflowAdmissionsTable as w, _voltroWorkflowPausesTable as T, _voltroWorkflowPendingTable as E, _voltroWorkflowRunEventsTable as D, _voltroWorkflowRunStepsTable as O, _voltroWorkflowRunsTable as k, _voltroWorkflowStartContextsTable as A, _voltroWorkflowWatermarksTable as j } from "@voltro/workflow";
13
+ import { agentMessagesTable as M, agentThreadsTable as N, aiBudgetTable as P, aiInferencesTable as F, aiUsageTable as I, isAgentDescriptor as L, isAgentExecutor as R, promptsTable as ge, resolveToolModuleHandlers as _e } from "@voltro/ai";
14
+ import { _voltroWebhookDeliveriesTable as ve, _voltroWebhookTargetsTable as ye } from "@voltro/plugin-webhooks/mixin";
15
+ import { _voltroStorageBlobsTable as be, _voltroStorageGrantsTable as xe, _voltroStorageRefsTable as Se, _voltroStorageUsageTable as Ce } from "@voltro/plugin-storage";
15
16
  //#region src/frameworkTables.ts
16
- var Ce = [
17
+ var we = [
17
18
  {
18
- table: oe,
19
+ table: ce,
19
20
  when: "always"
20
21
  },
21
22
  {
22
- table: le,
23
+ table: de,
23
24
  when: "always"
24
25
  },
25
26
  {
26
- table: ae,
27
+ table: se,
27
28
  when: "always"
28
29
  },
29
30
  {
30
- table: ce,
31
+ table: ue,
31
32
  when: "always"
32
33
  },
33
34
  {
34
- table: E,
35
- when: "workflows"
35
+ table: ae,
36
+ when: "always"
36
37
  },
37
38
  {
38
- table: T,
39
+ table: k,
39
40
  when: "workflows"
40
41
  },
41
42
  {
42
- table: w,
43
+ table: O,
43
44
  when: "workflows"
44
45
  },
45
46
  {
@@ -47,166 +48,170 @@ var Ce = [
47
48
  when: "workflows"
48
49
  },
49
50
  {
50
- table: C,
51
+ table: A,
51
52
  when: "workflows"
52
53
  },
53
54
  {
54
- table: x,
55
+ table: E,
55
56
  when: "workflows"
56
57
  },
57
58
  {
58
- table: S,
59
+ table: w,
59
60
  when: "workflows"
60
61
  },
61
62
  {
62
- table: O,
63
+ table: T,
63
64
  when: "workflows"
64
65
  },
65
66
  {
66
- table: _,
67
+ table: j,
67
68
  when: "workflows"
68
69
  },
69
70
  {
70
- table: g,
71
+ table: b,
71
72
  when: "workflows"
72
73
  },
73
74
  {
74
- table: me,
75
+ table: y,
76
+ when: "workflows"
77
+ },
78
+ {
79
+ table: h,
75
80
  when: "schedules"
76
81
  },
77
82
  {
78
- table: pe,
83
+ table: he,
79
84
  when: "schedules"
80
85
  },
81
86
  {
82
- table: ve,
87
+ table: ye,
83
88
  when: "webhooks"
84
89
  },
85
90
  {
86
- table: _e,
91
+ table: ve,
87
92
  when: "webhooks"
88
93
  },
89
94
  {
90
- table: he,
95
+ table: g,
91
96
  when: "traces"
92
97
  },
93
98
  {
94
- table: ge,
99
+ table: _,
95
100
  when: "undo"
96
101
  },
97
102
  {
98
- table: ue,
103
+ table: fe,
99
104
  when: "always"
100
105
  },
101
106
  {
102
- table: b,
107
+ table: C,
103
108
  when: "workflows"
104
109
  },
105
110
  {
106
- table: y,
111
+ table: S,
107
112
  when: "always"
108
113
  },
109
114
  {
110
- table: v,
115
+ table: x,
111
116
  when: "always"
112
117
  },
113
118
  {
114
- table: fe,
119
+ table: me,
115
120
  when: "connections"
116
121
  },
117
122
  {
118
- table: de,
123
+ table: pe,
119
124
  when: "connections"
120
125
  },
121
126
  {
122
- table: h,
127
+ table: v,
123
128
  when: "always"
124
129
  },
125
130
  {
126
- table: xe,
131
+ table: Se,
127
132
  when: "always"
128
133
  },
129
134
  {
130
- table: be,
135
+ table: xe,
131
136
  when: "always"
132
137
  },
133
138
  {
134
- table: ye,
139
+ table: be,
135
140
  when: "always"
136
141
  },
137
142
  {
138
- table: Se,
143
+ table: Ce,
139
144
  when: "always"
140
145
  },
141
146
  {
142
- table: re,
147
+ table: ie,
143
148
  when: "always"
144
149
  },
145
150
  {
146
- table: te,
151
+ table: ne,
147
152
  when: "always"
148
153
  },
149
154
  {
150
- table: ie,
155
+ table: oe,
151
156
  when: "always"
152
157
  }
153
- ], we = (e) => {
154
- let t = Ce.filter((t) => t.when === "always" || t.when === "workflows" && e.workflows || t.when === "schedules" && e.schedules || t.when === "webhooks" && e.webhooks || t.when === "traces" && e.traces || t.when === "undo" && e.undo === !0 || t.when === "connections" && e.connections === !0).map((e) => e.table);
155
- return e.cdc === !0 && t.push(e.cdcDialect === "mssql" ? se : ne), t;
156
- }, R = (e) => {
158
+ ], Te = (e) => {
159
+ let t = we.filter((t) => t.when === "always" || t.when === "workflows" && e.workflows || t.when === "schedules" && e.schedules || t.when === "webhooks" && e.webhooks || t.when === "traces" && e.traces || t.when === "undo" && e.undo === !0 || t.when === "connections" && e.connections === !0).map((e) => e.table);
160
+ return e.cdc === !0 && t.push(e.cdcDialect === "mssql" ? le : re), t;
161
+ }, z = (e) => {
157
162
  let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
158
163
  return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/-([a-zA-Z0-9])/g, (e, t) => t.toUpperCase());
159
- }, Te = (e) => {
164
+ }, Ee = (e) => {
160
165
  let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
161
166
  return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/#/g, "--").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
162
- }, Ee = (e, t) => z(e, t.name), z = (e, t) => {
163
- let n = R(e.name);
167
+ }, De = (e, t) => B(e, t.name), B = (e, t) => {
168
+ let n = z(e.name);
164
169
  if (!t.includes(".")) return `${n}.${t}`;
165
170
  if (e.baseName === void 0) return t;
166
- let r = `${R(e.baseName)}.`;
171
+ let r = `${z(e.baseName)}.`;
167
172
  return t.startsWith(r) ? `${n}.${t.slice(r.length)}` : t;
168
- }, B = (e) => e.openAccess === void 0 ? e.guards !== void 0 && e.guards.length > 0 ? { guards: e.guards } : {} : { openAccess: e.openAccess }, De = (e, t, n) => {
173
+ }, V = (e) => e.openAccess === void 0 ? e.guards !== void 0 && e.guards.length > 0 ? { guards: e.guards } : {} : { openAccess: e.openAccess }, Oe = (e, t, n) => {
169
174
  switch (e) {
170
- case "query": return ee({
175
+ case "query": return te({
171
176
  name: t,
172
177
  input: n.input,
173
178
  output: n.output,
174
179
  ...n.error === void 0 ? {} : { error: n.error },
175
- ...B(n),
180
+ ...V(n),
176
181
  ...n.source === void 0 ? {} : { source: n.source }
177
182
  });
178
- case "mutation": return f({
183
+ case "mutation": return ee({
179
184
  name: t,
180
185
  input: n.input,
181
186
  output: n.output,
182
187
  ...n.error === void 0 ? {} : { error: n.error },
183
- ...B(n)
188
+ ...V(n)
184
189
  });
185
- case "action": return d({
190
+ case "action": return f({
186
191
  name: t,
187
192
  input: n.input,
188
193
  output: n.output,
189
194
  ...n.error === void 0 ? {} : { error: n.error },
190
- ...B(n)
195
+ ...V(n)
191
196
  });
192
197
  }
193
- }, Oe = (e) => (t, n) => p.suspend(() => {
198
+ }, ke = (e) => (t, n) => p.suspend(() => {
194
199
  let r = { request: {
195
200
  subject: n.request.subject,
196
201
  traceId: n.request.traceId
197
202
  } };
198
203
  return e.execute(t, r);
199
- }), ke = (e) => {
204
+ }), Ae = (e) => {
200
205
  let t = [];
201
206
  for (let n of e) {
202
207
  let e = n.routes ?? [];
203
208
  for (let r of e) {
204
- let e = Ee(n, r), i = De(r.kind, e, r);
209
+ let e = De(n, r), i = Oe(r.kind, e, r);
205
210
  t.push({
206
211
  kind: r.kind,
207
212
  file: `plugin:${n.name}`,
208
213
  descriptor: i,
209
- executor: Oe(r),
214
+ executor: ke(r),
210
215
  plugin: {
211
216
  name: n.name,
212
217
  version: n.version
@@ -215,7 +220,7 @@ var Ce = [
215
220
  }
216
221
  }
217
222
  return t;
218
- }, Ae = (e, t, n = /* @__PURE__ */ new Set()) => {
223
+ }, je = (e, t, n = /* @__PURE__ */ new Set()) => {
219
224
  let r = /* @__PURE__ */ new Map();
220
225
  for (let e of t) r.set(e, "user-route");
221
226
  let i = [];
@@ -227,9 +232,9 @@ var Ce = [
227
232
  }
228
233
  }
229
234
  return i;
230
- }, V = "_voltro_plugin_migrations", je = () => p.gen(function* () {
235
+ }, H = "_voltro_plugin_migrations", Me = () => p.gen(function* () {
231
236
  yield* (yield* m.SqlClient).unsafe(`
232
- CREATE TABLE IF NOT EXISTS ${V} (
237
+ CREATE TABLE IF NOT EXISTS ${H} (
233
238
  id TEXT PRIMARY KEY,
234
239
  plugin_name TEXT NOT NULL,
235
240
  migration_id TEXT NOT NULL,
@@ -237,25 +242,25 @@ var Ce = [
237
242
  applied_at TEXT NOT NULL
238
243
  );
239
244
  `).pipe(p.orDie);
240
- }), Me = (e, t) => `${R(e)}__${t}`, Ne = () => p.gen(function* () {
241
- let e = yield* m.SqlClient, t = yield* e`SELECT id FROM ${e(V)}`.pipe(p.orDie);
245
+ }), Ne = (e, t) => `${z(e)}__${t}`, Pe = () => p.gen(function* () {
246
+ let e = yield* m.SqlClient, t = yield* e`SELECT id FROM ${e(H)}`.pipe(p.orDie);
242
247
  return new Set(t.map((e) => e.id));
243
- }), Pe = (e) => p.gen(function* () {
248
+ }), Fe = (e) => p.gen(function* () {
244
249
  let t = yield* m.SqlClient, n = (/* @__PURE__ */ new Date()).toISOString();
245
250
  yield* t`
246
- INSERT INTO ${t(V)} (id, plugin_name, migration_id, description, applied_at)
251
+ INSERT INTO ${t(H)} (id, plugin_name, migration_id, description, applied_at)
247
252
  VALUES (${e.key}, ${e.pluginName}, ${e.migration.id}, ${e.migration.description ?? null}, ${n})
248
253
  `.pipe(p.orDie);
249
- }), H = (e) => p.gen(function* () {
254
+ }), U = (e) => p.gen(function* () {
250
255
  let t = e.flatMap((e) => (e.extendSchema?.migrations ?? []).map((t) => ({
251
256
  plugin: e,
252
257
  migration: t
253
258
  })));
254
259
  if (t.length === 0) return [];
255
- yield* je();
256
- let n = yield* Ne(), r = [];
260
+ yield* Me();
261
+ let n = yield* Pe(), r = [];
257
262
  for (let { plugin: e, migration: i } of t) {
258
- let t = Me(e.name, i.id), a = Date.now();
263
+ let t = Ne(e.name, i.id), a = Date.now();
259
264
  if (n.has(t)) {
260
265
  r.push({
261
266
  pluginName: e.name,
@@ -267,7 +272,7 @@ var Ce = [
267
272
  }
268
273
  let o = yield* m.SqlClient;
269
274
  try {
270
- yield* i.up(o).pipe(p.mapError((e) => e)), yield* Pe({
275
+ yield* i.up(o).pipe(p.mapError((e) => e)), yield* Fe({
271
276
  key: t,
272
277
  pluginName: e.name,
273
278
  migration: i
@@ -288,29 +293,29 @@ var Ce = [
288
293
  }
289
294
  }
290
295
  return r;
291
- }), Fe = (e, t) => p.gen(function* () {
292
- let n = yield* H(e);
296
+ }), Ie = (e, t) => p.gen(function* () {
297
+ let n = yield* U(e);
293
298
  if (n.length === 0) return n;
294
299
  let r = n.filter((e) => e.status === "applied"), i = n.filter((e) => e.status === "skipped");
295
300
  return t(`plugin migrations: ${r.length} applied, ${i.length} already applied`, { applied: r.map((e) => `${e.pluginName}:${e.migrationId}`) }), n;
296
- }), Ie = (e) => e.filter((e) => e.extendSchema && (e.extendSchema.tables?.length ?? 0) + (e.extendSchema.migrations?.length ?? 0) > 0).map((e) => ({
301
+ }), Le = (e) => e.filter((e) => e.extendSchema && (e.extendSchema.tables?.length ?? 0) + (e.extendSchema.migrations?.length ?? 0) > 0).map((e) => ({
297
302
  pluginName: e.name,
298
- pluginAlias: R(e.name),
303
+ pluginAlias: z(e.name),
299
304
  tables: e.extendSchema.tables?.length ?? 0,
300
305
  migrations: e.extendSchema.migrations?.length ?? 0
301
- })), Le = (e) => e.flatMap((e) => e.extendSchema?.tables ?? []), U = /(?<!\.server)\.agent\.tsx?$/, Re = /\.agent\.server\.tsx?$/, W = /\.tool\.tsx?$/, ze = async (t, n) => {
306
+ })), Re = (e) => e.flatMap((e) => e.extendSchema?.tables ?? []), W = /(?<!\.server)\.agent\.tsx?$/, ze = /\.agent\.server\.tsx?$/, G = /\.tool\.tsx?$/, Be = async (t, n) => {
302
307
  let r = 0;
303
- for (let i of t) if (W.test(i)) try {
308
+ for (let i of t) if (G.test(i)) try {
304
309
  let t = await e(i);
305
- r += L(t);
310
+ r += _e(t);
306
311
  } catch (e) {
307
312
  n.warn("tool: failed to import — handler not wired", { file: i }, e);
308
313
  }
309
314
  return r;
310
- }, Be = (e) => e.replace(/\.agent\.(tsx?)$/, ".agent.server.$1"), Ve = async (t, n) => {
315
+ }, Ve = (e) => e.replace(/\.agent\.(tsx?)$/, ".agent.server.$1"), K = async (t, n) => {
311
316
  let r = [], i = /* @__PURE__ */ new Set();
312
317
  for (let a of t) {
313
- if (!U.test(a)) continue;
318
+ if (!W.test(a)) continue;
314
319
  let t;
315
320
  try {
316
321
  t = await e(a);
@@ -318,7 +323,7 @@ var Ce = [
318
323
  n.warn("agent: failed to import descriptor", { file: a }, e);
319
324
  continue;
320
325
  }
321
- let o = Object.values(t).find(P);
326
+ let o = Object.values(t).find(L);
322
327
  if (o === void 0) {
323
328
  n.warn("agent: no defineAgent() descriptor export found", { file: a });
324
329
  continue;
@@ -330,7 +335,7 @@ var Ce = [
330
335
  });
331
336
  continue;
332
337
  }
333
- let s = Be(a), c;
338
+ let s = Ve(a), c;
334
339
  try {
335
340
  c = await e(s);
336
341
  } catch (e) {
@@ -342,7 +347,7 @@ var Ce = [
342
347
  continue;
343
348
  }
344
349
  let l = c.default;
345
- if (!F(l)) {
350
+ if (!R(l)) {
346
351
  n.warn("agent: executor file must default-export defineAgentExecutor(descriptor, {...})", {
347
352
  file: s,
348
353
  name: o.name
@@ -357,7 +362,7 @@ var Ce = [
357
362
  });
358
363
  }
359
364
  return { agents: r };
360
- }, G = /\.connection\.tsx?$/, K = (e) => e.replace(G, ""), He = async (t, n) => {
365
+ }, q = /\.connection\.tsx?$/, He = (e) => e.replace(q, ""), Ue = async (t, n) => {
361
366
  let r = [], i = /* @__PURE__ */ new Map();
362
367
  for (let a of t) {
363
368
  let t;
@@ -400,55 +405,31 @@ var Ce = [
400
405
  }
401
406
  return r.length > 0 && n.info("discovered connections", {
402
407
  connections: r.map((e) => `${e.definition.id} (${e.definition.kind})`),
403
- files: r.map((e) => K(o(e.file)))
408
+ files: r.map((e) => He(s(e.file)))
404
409
  }), r;
405
- }, q = (e) => {
406
- let t = e.nodeEnv !== "production";
407
- return {
408
- traces: e.declared?.traces ?? t,
409
- undo: e.declared?.undo ?? t,
410
- cdc: e.cdcDialect !== void 0
411
- };
412
- }, Ue = (e) => {
413
- let t = e.nodeEnv ?? "<unset>", n = (n) => e.declared?.[n] === void 0 ? `the default for NODE_ENV=${t}` : `app.config.ts \`schema: { ${n}: ${String(e.declared[n])} }\``, r = (e, t, n) => ` ${e ? "+" : "-"} ${t.padEnd(22)} ${n}`;
414
- return `The three tables whose presence is DECIDED rather than implied by your source tree —
415
- compare these against the other process's environment before anything else:
416
-
417
- ${r(e.gates.traces, "_voltro_traces", n("traces"))}\n${r(e.gates.undo, "_voltro_undo_log", n("undo"))}\n${r(e.gates.cdc, "_voltro_cdc_offsets", `DB_DIALECT=${e.cdcDialect ?? "<no out-of-band CDC>"}`)}\n\nNone of them reads a runtime flag any more. If you are upgrading FROM a version where\nthey did, a migrate job without \`CDC\` / \`VOLTRO_UNDO\` / \`VOLTRO_TRACING_PERSIST\` recorded\na different set than your pods computed — re-run \`voltro db apply\` once on this version.`;
418
- }, We = (e) => {
419
- let t = [{
420
- key: "traces",
421
- table: "_voltro_traces",
422
- envVar: "VOLTRO_TRACING_PERSIST"
423
- }, {
424
- key: "undo",
425
- table: "_voltro_undo_log",
426
- envVar: "VOLTRO_UNDO"
427
- }].filter((t) => e.runtime[t.key] && !e.gates[t.key]);
428
- if (t.length !== 0) return `refusing to boot — a runtime flag asks for a table the deployment does not declare:\n\n${t.map(({ key: e, table: t, envVar: n }) => ` \`${n}\` turns ${e} capture ON, but \`${t}\` is not in this app's declared schema.\n Declare it: \`schema: { ${e}: true }\` in app.config.ts.`).join("\n\n")}\n\nThe declaration has to live in app.config.ts rather than in the environment because the\npre-deploy migrate job runs with its OWN env block. A flag set on the pods and not on the\njob produces a green apply and a schema fingerprint no container can reproduce.`;
429
- }, J = (e) => n.test(e) || a.test(e), Y = async (e) => {
430
- let n = !1, a = !1, o = !1, c = !1, u = !1, d = async (e) => {
431
- let f = await l.readdir(e, { withFileTypes: !0 }).catch(() => []);
432
- for (let l of f) if (l.isDirectory()) {
433
- if (l.name === "node_modules" || l.name === "dist" || l.name === ".framework" || l.name.startsWith(".")) continue;
434
- await d(s(e, l.name));
410
+ }, J = (e) => r.test(e) || o.test(e), Y = async (e) => {
411
+ let t = !1, r = !1, o = !1, s = !1, l = !1, d = async (e) => {
412
+ let f = await u.readdir(e, { withFileTypes: !0 }).catch(() => []);
413
+ for (let u of f) if (u.isDirectory()) {
414
+ if (u.name === "node_modules" || u.name === "dist" || u.name === ".framework" || u.name.startsWith(".")) continue;
415
+ await d(c(e, u.name));
435
416
  } else {
436
- let e = l.name;
437
- (r.test(e) || t.test(e)) && (n = !0), J(e) && (a = !0), i.test(e) && (o = !0), U.test(e) && (c = !0), G.test(e) && (u = !0);
417
+ let e = u.name;
418
+ (i.test(e) || n.test(e)) && (t = !0), J(e) && (r = !0), a.test(e) && (o = !0), W.test(e) && (s = !0), q.test(e) && (l = !0);
438
419
  }
439
420
  };
440
421
  return await d(e), {
441
- workflows: n,
442
- schedules: a,
422
+ workflows: t,
423
+ schedules: r,
443
424
  webhooks: o,
444
- agents: c,
445
- connections: u
425
+ agents: s,
426
+ connections: l
446
427
  };
447
- }, Ge = async (e) => {
448
- let t = s(e, "app.config.ts");
449
- if (!c(t)) return { plugins: [] };
428
+ }, We = async (e) => {
429
+ let t = c(e, "app.config.ts");
430
+ if (!l(t)) return { plugins: [] };
450
431
  try {
451
- let e = await import(u(t).href);
432
+ let e = await import(d(t).href);
452
433
  return {
453
434
  plugins: e.default?.plugins ?? [],
454
435
  ...e.default?.schema ? { schema: e.default.schema } : {}
@@ -459,8 +440,8 @@ ${r(e.gates.traces, "_voltro_traces", n("traces"))}\n${r(e.gates.undo, "_voltro_
459
440
  error: e
460
441
  };
461
442
  }
462
- }, Ke = async (e) => (await X(e)).plugins, X = async (e) => {
463
- let { plugins: t, schema: n, error: r } = await Ge(e);
443
+ }, Ge = async (e) => (await X(e)).plugins, X = async (e) => {
444
+ let { plugins: t, schema: n, error: r } = await We(e);
464
445
  if (r !== void 0) throw new Z(e, r);
465
446
  return {
466
447
  plugins: t,
@@ -482,7 +463,7 @@ Cause: ${t instanceof Error ? t.message : String(t)}`), this.root = e, this.caus
482
463
  let t = /* @__PURE__ */ new Map(), n = (e) => {
483
464
  e?.tableName && !t.has(e.tableName) && t.set(e.tableName, e);
484
465
  };
485
- for (let t of we({
466
+ for (let t of Te({
486
467
  workflows: e.mix.workflows,
487
468
  schedules: e.mix.schedules,
488
469
  webhooks: e.mix.webhooks,
@@ -492,18 +473,18 @@ Cause: ${t instanceof Error ? t.message : String(t)}`), this.root = e, this.caus
492
473
  undo: e.gates.undo,
493
474
  connections: e.mix.connections
494
475
  })) n(t);
495
- e.mix.agents && (n(A), n(k), n(N), n(j)), e.mix.workflows && n(M), (e.mix.workflows || e.mix.agents) && n(I);
496
- for (let t of Le(e.plugins)) n(t);
476
+ e.mix.agents && (n(N), n(M), n(I), n(P)), e.mix.workflows && n(F), (e.mix.workflows || e.mix.agents) && n(ge);
477
+ for (let t of Re(e.plugins)) n(t);
497
478
  return [...t.values()];
498
- }, qe = async (e) => {
499
- let t = await Y(e.root), { plugins: n, schema: r } = await X(e.root);
479
+ }, Ke = async (e) => {
480
+ let n = await Y(e.root), { plugins: r, schema: i } = await X(e.root);
500
481
  return Q({
501
- mix: t,
502
- plugins: n,
503
- gates: q({
482
+ mix: n,
483
+ plugins: r,
484
+ gates: t({
504
485
  nodeEnv: process.env.NODE_ENV,
505
486
  cdcDialect: $(),
506
- declared: r
487
+ declared: i
507
488
  }),
508
489
  ...$() ? { cdcDialect: $() } : {}
509
490
  });
@@ -512,4 +493,4 @@ Cause: ${t instanceof Error ? t.message : String(t)}`), this.root = e, this.caus
512
493
  return t === "mariadb" ? "mariadb" : t === "mssql" ? "mssql" : void 0;
513
494
  };
514
495
  //#endregion
515
- export { ke as C, Te as E, Ae as S, R as T, Ve as _, Y as a, H as b, X as c, We as d, G as f, W as g, Re as h, $ as i, Ue as l, U as m, qe as n, J as o, He as p, Q as r, Ke as s, Z as t, q as u, ze as v, z as w, Ie as x, Fe as y };
496
+ export { Ee as C, z as S, U as _, Y as a, Ae as b, X as c, W as d, ze as f, Ie as g, Be as h, $ as i, q as l, K as m, Ke as n, J as o, G as p, Q as r, Ge as s, Z as t, Ue as u, Le as v, B as x, je as y };
@@ -0,0 +1,2 @@
1
+ import { c as e, n as t } from "./frameworkTableAssembly-BNod_DKN.js";
2
+ export { t as assembleFrameworkTables, e as loadAppSchemaInputs };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, i as t, n, o as r, r as i, t as a } from "./commands-C-hxgAGr.js";
1
+ import { a as e, i as t, n, o as r, r as i, t as a } from "./commands-CAxFLqG4.js";
2
2
  import { r as o } from "./templates-BR-fb4SP.js";
3
3
  //#region src/index.ts
4
4
  var s = "framework";
@@ -1,7 +1,7 @@
1
1
  import { t as e } from "./cliError-BmdYnghb.js";
2
2
  import { r as t } from "./dialectDriver-czCHYpeH.js";
3
3
  import { a as n, r } from "./connectionConfig-Bk9IC7D0.js";
4
- import { n as i, s as a, y as o } from "./frameworkTableAssembly-BPlPfU07.js";
4
+ import { g as i, n as a, s as o } from "./frameworkTableAssembly-BNod_DKN.js";
5
5
  import { t as s } from "./cliRuntime-Dh7UDinH.js";
6
6
  import { join as c, relative as l, resolve as u } from "node:path";
7
7
  import { pathToFileURL as d } from "node:url";
@@ -43,7 +43,7 @@ var _ = /* @__PURE__ */ new Set([
43
43
  root: e
44
44
  }), 1;
45
45
  yield* m.logInfo(`discovered ${t.length} schema file(s)`, { files: t.map((t) => l(e, t)) });
46
- let n = yield* x(t), r = yield* m.promise(() => i({ root: e })), s = [...n, ...r];
46
+ let n = yield* x(t), r = yield* m.promise(() => a({ root: e })), s = [...n, ...r];
47
47
  if (yield* m.logInfo(`tables to apply: ${s.length}`, {
48
48
  user: n.map((e) => e.tableName),
49
49
  framework: r.map((e) => e.tableName)
@@ -56,7 +56,7 @@ var _ = /* @__PURE__ */ new Set([
56
56
  });
57
57
  let g = yield* m.promise(() => w()), _ = g.makeSqlLayer(C());
58
58
  yield* m.promise(() => h(s, _, g.id, { retryFilter: g.retryFilter }));
59
- let v = yield* m.promise(() => a(e)), b = [], S = yield* o(v, (e, t) => {
59
+ let v = yield* m.promise(() => o(e)), b = [], S = yield* i(v, (e, t) => {
60
60
  b.push({
61
61
  message: e,
62
62
  fields: t ?? {}
@@ -79,7 +79,7 @@ var _ = /* @__PURE__ */ new Set([
79
79
  let t = u(e.find((e) => !e.startsWith("-")) ?? process.cwd());
80
80
  return s(S(t), { scope: "voltro:migrate" });
81
81
  }
82
- let { runDbCommand: t } = await import("./dbCommand-C2XK63Dd.js");
82
+ let { runDbCommand: t } = await import("./dbCommand-D1Q33ktl.js");
83
83
  return t(["apply", ...e]);
84
84
  };
85
85
  //#endregion
@@ -1,4 +1,4 @@
1
- import { n as e } from "./apiBuild-BKdd0I1Z.js";
1
+ import { n as e } from "./apiBuild-Dz8TJSxp.js";
2
2
  import { join as t, resolve as n, sep as r } from "node:path";
3
3
  import { existsSync as i, promises as a } from "node:fs";
4
4
  import { createLogger as o } from "@voltro/logger";
@@ -422,7 +422,7 @@ let package = Package(
422
422
  await l.mkdir(o(e), { recursive: !0 }), await l.writeFile(e, n.content, "utf8");
423
423
  }
424
424
  }, X = async (e) => {
425
- let { offlineManifest: t } = await import("./checkCommand-CXAXTjZL.js"), { manifest: n } = await t(e);
425
+ let { offlineManifest: t } = await import("./checkCommand-BUBqPBlI.js"), { manifest: n } = await t(e);
426
426
  return n;
427
427
  }, Z = async (e) => {
428
428
  let t = J(await (e.manifestProvider ?? X)(e.root), {