@voltro/cli 0.30.0 → 0.30.2

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 (79) hide show
  1. package/CHANGELOG.md +119 -0
  2. package/dist/{apiBuild-BceikpQf.js → apiBuild-BUS1RfPi.js} +2 -2
  3. package/dist/apiBuild-DMlxvL8h.js +2 -0
  4. package/dist/bin.js +3 -3
  5. package/dist/checkCommand-CARZ36Tr.js +2 -0
  6. package/dist/{checkCommand-BMr-X48w.js → checkCommand-D_wdOFhw.js} +498 -321
  7. package/dist/{commands-D4Y1-Nlu.js → commands-BgGAUcku.js} +2392 -2390
  8. package/dist/{dbCommand-C7hbl5pk.js → dbCommand-CbPRCD1x.js} +56 -19
  9. package/dist/dbCommand-Ht47LrV-.js +2 -0
  10. package/dist/{dev-DmnkH-wr.js → dev-GAOIot9G.js} +2202 -2170
  11. package/dist/{dev-Cr-teYsz.js → dev-tPcOmjPJ.js} +1 -1
  12. package/dist/{frameworkTableAssembly-BzAajuUv.js → frameworkTableAssembly-BwIrO5nv.js} +162 -145
  13. package/dist/frameworkTableAssembly-D-EebUQX.js +2 -0
  14. package/dist/index.js +1 -1
  15. package/dist/{inspectMetrics-BeJdP_3b.js → inspectMetrics-BM1vrsga.js} +316 -314
  16. package/dist/{sdkgen-CqpOq_fy.js → sdkgen-BV4fFucu.js} +1 -1
  17. package/dist/{serveCommand-Ciq_wIY8.js → serveCommand-ClqXCX1y.js} +22 -21
  18. package/dist/serveEntry.js +2 -2
  19. package/dist/{start-ocqB1seX.js → start-CTnNvKlk.js} +370 -368
  20. package/dist/startEntry.js +2 -2
  21. package/package.json +17 -17
  22. package/templates/AGENTS.md +1 -1
  23. package/templates/agent-docs/_index.md +1 -1
  24. package/templates/agent-docs/cli.md +29 -0
  25. package/templates/agent-docs/internationalization.md +25 -3
  26. package/templates/agent-docs/routing.md +14 -0
  27. package/templates/agent-docs/whats-new.md +23 -352
  28. package/templates/agent-docs/workflows.md +2 -0
  29. package/templates/apps/api-ai/package.json +7 -7
  30. package/templates/apps/api-auth/package.json +8 -8
  31. package/templates/apps/api-backend/package.json +7 -7
  32. package/templates/apps/api-backend-deactivation/package.json +7 -7
  33. package/templates/apps/api-backend-mail/package.json +8 -8
  34. package/templates/apps/api-backend-mariadb/package.json +9 -9
  35. package/templates/apps/api-backend-sqlite/package.json +8 -8
  36. package/templates/apps/api-backend-storage/package.json +8 -8
  37. package/templates/apps/api-cms/package.json +10 -10
  38. package/templates/apps/api-collab/package.json +8 -8
  39. package/templates/apps/api-data-advanced/package.json +8 -8
  40. package/templates/apps/api-durable/package.json +8 -8
  41. package/templates/apps/api-feature-flags/package.json +9 -9
  42. package/templates/apps/api-governance/package.json +8 -8
  43. package/templates/apps/api-kv/package.json +8 -8
  44. package/templates/apps/api-moderation/package.json +8 -8
  45. package/templates/apps/api-observability/package.json +8 -8
  46. package/templates/apps/api-ratelimit/package.json +8 -8
  47. package/templates/apps/api-rbac/package.json +8 -8
  48. package/templates/apps/api-rest/package.json +7 -7
  49. package/templates/apps/api-saas/package.json +11 -11
  50. package/templates/apps/api-saas-starter/package.json +10 -10
  51. package/templates/apps/api-search/package.json +8 -8
  52. package/templates/apps/api-status/package.json +8 -8
  53. package/templates/apps/api-versioning/package.json +8 -8
  54. package/templates/apps/api-webhooks/package.json +9 -9
  55. package/templates/apps/changelog/package.json +6 -6
  56. package/templates/apps/edge-functions/package.json +2 -2
  57. package/templates/apps/frontend-admin/package.json +8 -8
  58. package/templates/apps/frontend-app/package.json +8 -8
  59. package/templates/apps/frontend-auth/package.json +8 -8
  60. package/templates/apps/frontend-blank/package.json +7 -7
  61. package/templates/apps/frontend-cms/package.json +9 -9
  62. package/templates/apps/frontend-collab/package.json +9 -9
  63. package/templates/apps/frontend-contact/package.json +7 -7
  64. package/templates/apps/frontend-dashboard/package.json +7 -7
  65. package/templates/apps/frontend-docs/package.json +7 -7
  66. package/templates/apps/frontend-i18n/package.json +6 -6
  67. package/templates/apps/frontend-landing/package.json +7 -7
  68. package/templates/apps/frontend-portal/package.json +8 -8
  69. package/templates/apps/frontend-saas/package.json +8 -8
  70. package/templates/apps/frontend-spa/package.json +7 -7
  71. package/templates/apps/frontend-ssr/package.json +7 -7
  72. package/templates/apps/frontend-ssr-api/package.json +8 -8
  73. package/templates/apps/frontend-static-blog/package.json +6 -6
  74. package/templates/apps/frontend-status/package.json +8 -8
  75. package/templates/apps/mobile-app/package.json +2 -2
  76. package/dist/apiBuild-CxvR1Dwt.js +0 -2
  77. package/dist/checkCommand-BOk9y264.js +0 -2
  78. package/dist/dbCommand-D8nhyppR.js +0 -2
  79. package/dist/frameworkTableAssembly-DU0aOxjL.js +0 -2
@@ -1,3 +1,3 @@
1
1
  import "./seedRunner-Bqxgp7HZ.js";
2
- import { c as e, h as t, u as n } from "./dev-DmnkH-wr.js";
2
+ import { c as e, h as t, u as n } from "./dev-GAOIot9G.js";
3
3
  export { e as loadApiConfig, n as loadDiscovered, t as walk };
@@ -1,73 +1,73 @@
1
1
  import { n as e } from "./appModuleLoader-C9r9mxZt.js";
2
- import { D as t, a as n, j as r, k as i, p as a } from "./fileConventions-Cof68_BL.js";
3
- import { basename as o, join as s } from "node:path";
4
- import { pathToFileURL as c } from "node:url";
5
- import { Effect as l } from "effect";
6
- import { promises as u } from "node:fs";
7
- import { _voltroConnectionGrantsTable as d, _voltroConnectionsTable as f, _voltroScheduleClaimsTable as p, _voltroScheduleRunsTable as m, _voltroTracesTable as h, _voltroUndoLogTable as ee, _voltroWakeupsTable as te, _voltroWorkflowEventDeliveriesTable as ne, _voltroWorkflowEventsTable as re, outboxAttemptsTable as ie, outboxTable as ae, undoCaptureEnabled as oe } from "@voltro/runtime";
8
- import { SqlClient as g } from "@effect/sql";
9
- import { _voltroWorkflowAdmissionsTable as se, _voltroWorkflowPausesTable as ce, _voltroWorkflowPendingTable as le, _voltroWorkflowRunEventsTable as ue, _voltroWorkflowRunStepsTable as de, _voltroWorkflowRunsTable as fe, _voltroWorkflowStartContextsTable as pe, _voltroWorkflowWatermarksTable as me } from "@voltro/workflow";
10
- import { agentMessagesTable as he, agentThreadsTable as _, aiBudgetTable as v, aiInferencesTable as y, aiUsageTable as b, isAgentDescriptor as x, isAgentExecutor as S, resolveToolModuleHandlers as C } from "@voltro/ai";
11
- import { _voltroApiKeysTable as w, _voltroCdcOffsetsTable as T, _voltroIdempotencyTable as E, _voltroKvTable as D, _voltroMigrationPlansTable as O, _voltroMigrationsTable as k, _voltroMssqlCdcOffsetsTable as A, _voltroSeedsTable as j, lt as M } from "@voltro/database";
12
- import { _voltroWebhookDeliveriesTable as N, _voltroWebhookTargetsTable as P } from "@voltro/plugin-webhooks/mixin";
13
- import { _voltroStorageBlobsTable as F, _voltroStorageGrantsTable as I, _voltroStorageRefsTable as L, _voltroStorageUsageTable as R } from "@voltro/plugin-storage";
14
- import { defineAction as ge, defineMutation as _e, defineQuery as ve } from "@voltro/protocol";
2
+ import { D as t, a as n, j as r, k as i } from "./fileConventions-Cof68_BL.js";
3
+ import { basename as a, join as o } from "node:path";
4
+ import { pathToFileURL as s } from "node:url";
5
+ import { Effect as c } from "effect";
6
+ import { existsSync as l, promises as u } from "node:fs";
7
+ import { _voltroConnectionGrantsTable as d, _voltroConnectionsTable as f, _voltroScheduleClaimsTable as p, _voltroScheduleRunsTable as ee, _voltroTracesTable as te, _voltroUndoLogTable as ne, _voltroWakeupsTable as re, _voltroWorkflowEventDeliveriesTable as ie, _voltroWorkflowEventsTable as ae, outboxAttemptsTable as oe, outboxTable as se, undoCaptureEnabled as ce } from "@voltro/runtime";
8
+ import { SqlClient as m } from "@effect/sql";
9
+ import { _voltroWorkflowAdmissionsTable as le, _voltroWorkflowPausesTable as ue, _voltroWorkflowPendingTable as de, _voltroWorkflowRunEventsTable as fe, _voltroWorkflowRunStepsTable as pe, _voltroWorkflowRunsTable as me, _voltroWorkflowStartContextsTable as he, _voltroWorkflowWatermarksTable as ge } from "@voltro/workflow";
10
+ import { agentMessagesTable as _e, agentThreadsTable as h, aiBudgetTable as g, aiInferencesTable as _, aiUsageTable as v, isAgentDescriptor as y, isAgentExecutor as b, resolveToolModuleHandlers as x } from "@voltro/ai";
11
+ import { _voltroApiKeysTable as S, _voltroCdcOffsetsTable as C, _voltroIdempotencyTable as w, _voltroKvTable as T, _voltroMigrationPlansTable as E, _voltroMigrationsTable as D, _voltroMssqlCdcOffsetsTable as O, _voltroSeedsTable as k, lt as A } from "@voltro/database";
12
+ import { _voltroWebhookDeliveriesTable as j, _voltroWebhookTargetsTable as M } from "@voltro/plugin-webhooks/mixin";
13
+ import { _voltroStorageBlobsTable as N, _voltroStorageGrantsTable as P, _voltroStorageRefsTable as F, _voltroStorageUsageTable as I } from "@voltro/plugin-storage";
14
+ import { defineAction as ve, defineMutation as ye, defineQuery as be } from "@voltro/protocol";
15
15
  //#region src/frameworkTables.ts
16
- var ye = [
16
+ var xe = [
17
17
  {
18
- table: k,
18
+ table: D,
19
19
  when: "always"
20
20
  },
21
21
  {
22
- table: j,
22
+ table: k,
23
23
  when: "always"
24
24
  },
25
25
  {
26
- table: O,
26
+ table: E,
27
27
  when: "always"
28
28
  },
29
29
  {
30
- table: fe,
30
+ table: me,
31
31
  when: "workflows"
32
32
  },
33
33
  {
34
- table: de,
34
+ table: pe,
35
35
  when: "workflows"
36
36
  },
37
37
  {
38
- table: ue,
38
+ table: fe,
39
39
  when: "workflows"
40
40
  },
41
41
  {
42
- table: pe,
42
+ table: he,
43
43
  when: "workflows"
44
44
  },
45
45
  {
46
- table: le,
46
+ table: de,
47
47
  when: "workflows"
48
48
  },
49
49
  {
50
- table: se,
50
+ table: le,
51
51
  when: "workflows"
52
52
  },
53
53
  {
54
- table: ce,
54
+ table: ue,
55
55
  when: "workflows"
56
56
  },
57
57
  {
58
- table: me,
58
+ table: ge,
59
59
  when: "workflows"
60
60
  },
61
61
  {
62
- table: re,
62
+ table: ae,
63
63
  when: "workflows"
64
64
  },
65
65
  {
66
- table: ne,
66
+ table: ie,
67
67
  when: "workflows"
68
68
  },
69
69
  {
70
- table: m,
70
+ table: ee,
71
71
  when: "schedules"
72
72
  },
73
73
  {
@@ -75,28 +75,28 @@ var ye = [
75
75
  when: "schedules"
76
76
  },
77
77
  {
78
- table: P,
78
+ table: M,
79
79
  when: "webhooks"
80
80
  },
81
81
  {
82
- table: N,
82
+ table: j,
83
83
  when: "webhooks"
84
84
  },
85
85
  {
86
- table: h,
86
+ table: te,
87
87
  when: "traces"
88
88
  },
89
89
  {
90
- table: ee,
90
+ table: ne,
91
91
  when: "undo"
92
92
  },
93
93
  {
94
- table: ae,
95
- when: "outbox"
94
+ table: se,
95
+ when: "always"
96
96
  },
97
97
  {
98
- table: ie,
99
- when: "outbox"
98
+ table: oe,
99
+ when: "always"
100
100
  },
101
101
  {
102
102
  table: f,
@@ -107,85 +107,85 @@ var ye = [
107
107
  when: "connections"
108
108
  },
109
109
  {
110
- table: te,
110
+ table: re,
111
111
  when: "always"
112
112
  },
113
113
  {
114
- table: L,
114
+ table: F,
115
115
  when: "always"
116
116
  },
117
117
  {
118
- table: I,
118
+ table: P,
119
119
  when: "always"
120
120
  },
121
121
  {
122
- table: F,
122
+ table: N,
123
123
  when: "always"
124
124
  },
125
125
  {
126
- table: R,
126
+ table: I,
127
127
  when: "always"
128
128
  },
129
129
  {
130
- table: E,
130
+ table: w,
131
131
  when: "always"
132
132
  },
133
133
  {
134
- table: w,
134
+ table: S,
135
135
  when: "always"
136
136
  },
137
137
  {
138
- table: D,
138
+ table: T,
139
139
  when: "always"
140
140
  }
141
- ], z = (e) => {
142
- let t = ye.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 === "outbox" && e.outbox === !0 || t.when === "connections" && e.connections === !0).map((e) => e.table);
143
- return e.cdc === !0 && t.push(e.cdcDialect === "mssql" ? A : T), t;
144
- }, B = (e) => {
141
+ ], L = (e) => {
142
+ let t = xe.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);
143
+ return e.cdc === !0 && t.push(e.cdcDialect === "mssql" ? O : C), t;
144
+ }, R = (e) => {
145
145
  let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
146
146
  return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/-([a-zA-Z0-9])/g, (e, t) => t.toUpperCase());
147
- }, be = (e) => {
147
+ }, Se = (e) => {
148
148
  let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
149
149
  return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/#/g, "--").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
150
- }, xe = (e, t) => t.name.includes(".") ? t.name : `${B(e.name)}.${t.name}`, Se = (e, t, n) => {
150
+ }, Ce = (e, t) => t.name.includes(".") ? t.name : `${R(e.name)}.${t.name}`, we = (e, t, n) => {
151
151
  switch (e) {
152
- case "query": return ve({
152
+ case "query": return be({
153
153
  name: t,
154
154
  input: n.input,
155
155
  output: n.output,
156
156
  ...n.error === void 0 ? {} : { error: n.error },
157
157
  ...n.source === void 0 ? {} : { source: n.source }
158
158
  });
159
- case "mutation": return _e({
159
+ case "mutation": return ye({
160
160
  name: t,
161
161
  input: n.input,
162
162
  output: n.output,
163
163
  ...n.error === void 0 ? {} : { error: n.error }
164
164
  });
165
- case "action": return ge({
165
+ case "action": return ve({
166
166
  name: t,
167
167
  input: n.input,
168
168
  output: n.output,
169
169
  ...n.error === void 0 ? {} : { error: n.error }
170
170
  });
171
171
  }
172
- }, Ce = (e) => (t, n) => l.suspend(() => {
172
+ }, Te = (e) => (t, n) => c.suspend(() => {
173
173
  let r = { request: {
174
174
  subject: n.request.subject,
175
175
  traceId: n.request.traceId
176
176
  } };
177
177
  return e.execute(t, r);
178
- }), we = (e) => {
178
+ }), Ee = (e) => {
179
179
  let t = [];
180
180
  for (let n of e) {
181
181
  let e = n.routes ?? [];
182
182
  for (let r of e) {
183
- let e = xe(n, r), i = Se(r.kind, e, r);
183
+ let e = Ce(n, r), i = we(r.kind, e, r);
184
184
  t.push({
185
185
  kind: r.kind,
186
186
  file: `plugin:${n.name}`,
187
187
  descriptor: i,
188
- executor: Ce(r),
188
+ executor: Te(r),
189
189
  plugin: {
190
190
  name: n.name,
191
191
  version: n.version
@@ -194,7 +194,7 @@ var ye = [
194
194
  }
195
195
  }
196
196
  return t;
197
- }, V = (e, t, n = /* @__PURE__ */ new Set()) => {
197
+ }, De = (e, t, n = /* @__PURE__ */ new Set()) => {
198
198
  let r = /* @__PURE__ */ new Map();
199
199
  for (let e of t) r.set(e, "user-route");
200
200
  let i = [];
@@ -206,35 +206,35 @@ var ye = [
206
206
  }
207
207
  }
208
208
  return i;
209
- }, H = "_voltro_plugin_migrations", Te = () => l.gen(function* () {
210
- yield* (yield* g.SqlClient).unsafe(`
211
- CREATE TABLE IF NOT EXISTS ${H} (
209
+ }, z = "_voltro_plugin_migrations", B = () => c.gen(function* () {
210
+ yield* (yield* m.SqlClient).unsafe(`
211
+ CREATE TABLE IF NOT EXISTS ${z} (
212
212
  id TEXT PRIMARY KEY,
213
213
  plugin_name TEXT NOT NULL,
214
214
  migration_id TEXT NOT NULL,
215
215
  description TEXT,
216
216
  applied_at TEXT NOT NULL
217
217
  );
218
- `).pipe(l.orDie);
219
- }), Ee = (e, t) => `${B(e)}__${t}`, De = () => l.gen(function* () {
220
- let e = yield* g.SqlClient, t = yield* e`SELECT id FROM ${e(H)}`.pipe(l.orDie);
218
+ `).pipe(c.orDie);
219
+ }), Oe = (e, t) => `${R(e)}__${t}`, ke = () => c.gen(function* () {
220
+ let e = yield* m.SqlClient, t = yield* e`SELECT id FROM ${e(z)}`.pipe(c.orDie);
221
221
  return new Set(t.map((e) => e.id));
222
- }), Oe = (e) => l.gen(function* () {
223
- let t = yield* g.SqlClient, n = (/* @__PURE__ */ new Date()).toISOString();
222
+ }), Ae = (e) => c.gen(function* () {
223
+ let t = yield* m.SqlClient, n = (/* @__PURE__ */ new Date()).toISOString();
224
224
  yield* t`
225
- INSERT INTO ${t(H)} (id, plugin_name, migration_id, description, applied_at)
225
+ INSERT INTO ${t(z)} (id, plugin_name, migration_id, description, applied_at)
226
226
  VALUES (${e.key}, ${e.pluginName}, ${e.migration.id}, ${e.migration.description ?? null}, ${n})
227
- `.pipe(l.orDie);
228
- }), ke = (e) => l.gen(function* () {
227
+ `.pipe(c.orDie);
228
+ }), je = (e) => c.gen(function* () {
229
229
  let t = e.flatMap((e) => (e.extendSchema?.migrations ?? []).map((t) => ({
230
230
  plugin: e,
231
231
  migration: t
232
232
  })));
233
233
  if (t.length === 0) return [];
234
- yield* Te();
235
- let n = yield* De(), r = [];
234
+ yield* B();
235
+ let n = yield* ke(), r = [];
236
236
  for (let { plugin: e, migration: i } of t) {
237
- let t = Ee(e.name, i.id), a = Date.now();
237
+ let t = Oe(e.name, i.id), a = Date.now();
238
238
  if (n.has(t)) {
239
239
  r.push({
240
240
  pluginName: e.name,
@@ -244,9 +244,9 @@ var ye = [
244
244
  });
245
245
  continue;
246
246
  }
247
- let o = yield* g.SqlClient;
247
+ let o = yield* m.SqlClient;
248
248
  try {
249
- yield* i.up(o).pipe(l.mapError((e) => e)), yield* Oe({
249
+ yield* i.up(o).pipe(c.mapError((e) => e)), yield* Ae({
250
250
  key: t,
251
251
  pluginName: e.name,
252
252
  migration: i
@@ -263,28 +263,28 @@ var ye = [
263
263
  status: "failed",
264
264
  durationMs: Date.now() - a,
265
265
  error: t
266
- }), yield* l.fail(/* @__PURE__ */ Error(`Plugin migration failed: ${e.name} ${i.id} — ${t instanceof Error ? t.message : String(t)}`));
266
+ }), yield* c.fail(/* @__PURE__ */ Error(`Plugin migration failed: ${e.name} ${i.id} — ${t instanceof Error ? t.message : String(t)}`));
267
267
  }
268
268
  }
269
269
  return r;
270
- }), Ae = (e) => e.filter((e) => e.extendSchema && (e.extendSchema.tables?.length ?? 0) + (e.extendSchema.migrations?.length ?? 0) > 0).map((e) => ({
270
+ }), Me = (e) => e.filter((e) => e.extendSchema && (e.extendSchema.tables?.length ?? 0) + (e.extendSchema.migrations?.length ?? 0) > 0).map((e) => ({
271
271
  pluginName: e.name,
272
- pluginAlias: B(e.name),
272
+ pluginAlias: R(e.name),
273
273
  tables: e.extendSchema.tables?.length ?? 0,
274
274
  migrations: e.extendSchema.migrations?.length ?? 0
275
- })), je = (e) => e.flatMap((e) => e.extendSchema?.tables ?? []), U = /(?<!\.server)\.agent\.tsx?$/, Me = /\.agent\.server\.tsx?$/, W = /\.tool\.tsx?$/, Ne = async (t, n) => {
275
+ })), Ne = (e) => e.flatMap((e) => e.extendSchema?.tables ?? []), V = /(?<!\.server)\.agent\.tsx?$/, Pe = /\.agent\.server\.tsx?$/, H = /\.tool\.tsx?$/, Fe = async (t, n) => {
276
276
  let r = 0;
277
- for (let i of t) if (W.test(i)) try {
277
+ for (let i of t) if (H.test(i)) try {
278
278
  let t = await e(i);
279
- r += C(t);
279
+ r += x(t);
280
280
  } catch (e) {
281
281
  n.warn("tool: failed to import — handler not wired", { file: i }, e);
282
282
  }
283
283
  return r;
284
- }, Pe = (e) => e.replace(/\.agent\.(tsx?)$/, ".agent.server.$1"), Fe = async (t, n) => {
284
+ }, Ie = (e) => e.replace(/\.agent\.(tsx?)$/, ".agent.server.$1"), Le = async (t, n) => {
285
285
  let r = [], i = /* @__PURE__ */ new Set();
286
286
  for (let a of t) {
287
- if (!U.test(a)) continue;
287
+ if (!V.test(a)) continue;
288
288
  let t;
289
289
  try {
290
290
  t = await e(a);
@@ -292,7 +292,7 @@ var ye = [
292
292
  n.warn("agent: failed to import descriptor", { file: a }, e);
293
293
  continue;
294
294
  }
295
- let o = Object.values(t).find(x);
295
+ let o = Object.values(t).find(y);
296
296
  if (o === void 0) {
297
297
  n.warn("agent: no defineAgent() descriptor export found", { file: a });
298
298
  continue;
@@ -304,7 +304,7 @@ var ye = [
304
304
  });
305
305
  continue;
306
306
  }
307
- let s = Pe(a), c;
307
+ let s = Ie(a), c;
308
308
  try {
309
309
  c = await e(s);
310
310
  } catch (e) {
@@ -316,7 +316,7 @@ var ye = [
316
316
  continue;
317
317
  }
318
318
  let l = c.default;
319
- if (!S(l)) {
319
+ if (!b(l)) {
320
320
  n.warn("agent: executor file must default-export defineAgentExecutor(descriptor, {...})", {
321
321
  file: s,
322
322
  name: o.name
@@ -331,7 +331,7 @@ var ye = [
331
331
  });
332
332
  }
333
333
  return { agents: r };
334
- }, G = /\.connection\.tsx?$/, Ie = (e) => e.replace(G, ""), Le = async (t, n) => {
334
+ }, U = /\.connection\.tsx?$/, Re = (e) => e.replace(U, ""), ze = async (t, n) => {
335
335
  let r = [], i = /* @__PURE__ */ new Map();
336
336
  for (let a of t) {
337
337
  let t;
@@ -374,26 +374,26 @@ var ye = [
374
374
  }
375
375
  return r.length > 0 && n.info("discovered connections", {
376
376
  connections: r.map((e) => `${e.definition.id} (${e.definition.kind})`),
377
- files: r.map((e) => Ie(o(e.file)))
377
+ files: r.map((e) => Re(a(e.file)))
378
378
  }), r;
379
- }, K = (e) => typeof e.attributes["framework.kind"] == "string" && e.attributes["framework.kind"].startsWith("subscription."), q = (e) => {
379
+ }, W = (e) => typeof e.attributes["framework.kind"] == "string" && e.attributes["framework.kind"].startsWith("subscription."), G = (e) => {
380
380
  if (e.name.includes("_voltro_traces")) return !0;
381
381
  for (let t in e.attributes) {
382
382
  let n = e.attributes[t];
383
383
  if (typeof n == "string" && n.includes("_voltro_traces")) return !0;
384
384
  }
385
385
  return !1;
386
- }, Re = (e) => typeof e.attributes["framework.kind"] == "string" && e.attributes["framework.kind"].startsWith("subscription"), ze = 1e3, Be = 500, Ve = 50, J = class {
386
+ }, Be = (e) => typeof e.attributes["framework.kind"] == "string" && e.attributes["framework.kind"].startsWith("subscription"), Ve = 1e3, He = 500, Ue = 50, K = class {
387
387
  capacity;
388
388
  buffer = [];
389
- constructor(e = ze) {
389
+ constructor(e = Ve) {
390
390
  this.capacity = e;
391
391
  }
392
392
  append(e) {
393
393
  this.buffer.push(e), this.buffer.length > this.capacity && this.buffer.shift();
394
394
  }
395
395
  query(e = {}) {
396
- let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? Be, this.capacity), i = e.traceId, a = e.minDurationMs, o = e.status, s = e.name?.toLowerCase(), c = [];
396
+ let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? He, this.capacity), i = e.traceId, a = e.minDurationMs, o = e.status, s = e.name?.toLowerCase(), c = [];
397
397
  for (let e = this.buffer.length - 1; e >= 0 && c.length < r; e--) {
398
398
  let r = this.buffer[e];
399
399
  r.startMs < t || r.startMs > n || i !== void 0 && r.traceId !== i || a !== void 0 && r.durationMs < a || o !== void 0 && r.status !== o || s !== void 0 && !r.name.toLowerCase().includes(s) || c.push(r);
@@ -401,7 +401,7 @@ var ye = [
401
401
  return c.reverse();
402
402
  }
403
403
  queryGrouped(e = {}) {
404
- let t = e.since ?? 0, n = e.maxTraces ?? Ve, r = e.onlyErrors ?? !1, i = /* @__PURE__ */ new Map();
404
+ let t = e.since ?? 0, n = e.maxTraces ?? Ue, r = e.onlyErrors ?? !1, i = /* @__PURE__ */ new Map();
405
405
  for (let e of this.buffer) {
406
406
  if (e.startMs < t) continue;
407
407
  let n = i.get(e.traceId);
@@ -412,7 +412,7 @@ var ye = [
412
412
  t.sort((e, t) => e.startMs - t.startMs);
413
413
  let n = t.some((e) => e.status === "error");
414
414
  if (r && !n) continue;
415
- let i = t[0].startMs, o = t.reduce((e, t) => t.endMs > e ? t.endMs : e, i), s = t.filter(K), c = s.length > 0 || t.some(Re), l = s.reduce((e, t) => e === void 0 || t.startMs > e.startMs ? t : e, void 0);
415
+ let i = t[0].startMs, o = t.reduce((e, t) => t.endMs > e ? t.endMs : e, i), s = t.filter(W), c = s.length > 0 || t.some(Be), l = s.reduce((e, t) => e === void 0 || t.startMs > e.startMs ? t : e, void 0);
416
416
  a.push({
417
417
  traceId: e,
418
418
  rootName: t[0].name,
@@ -437,69 +437,69 @@ var ye = [
437
437
  clear() {
438
438
  this.buffer = [];
439
439
  }
440
- }, Y = null, He = () => (Y === null && (Y = new J()), Y), Ue = /* @__PURE__ */ new Set([
440
+ }, q = null, We = () => (q === null && (q = new K()), q), Ge = /* @__PURE__ */ new Set([
441
441
  "off",
442
442
  "errors",
443
443
  "interesting",
444
444
  "all"
445
- ]), X = (e, t, n, r) => {
445
+ ]), J = (e, t, n, r) => {
446
446
  let i = Number(e);
447
447
  return Number.isFinite(i) ? Math.min(r, Math.max(n, i)) : t;
448
- }, We = (e) => e !== void 0 && [
448
+ }, Ke = (e) => e !== void 0 && [
449
449
  "1",
450
450
  "true",
451
451
  "yes",
452
452
  "on"
453
- ].includes(e.toLowerCase()), Ge = (e) => {
453
+ ].includes(e.toLowerCase()), qe = (e) => {
454
454
  let t = Number(e);
455
455
  return Number.isFinite(t) && t > 0 ? t : 24;
456
- }, Z = (e = process.env) => {
457
- let t = (e.VOLTRO_TRACING_BUFFER ?? "").toLowerCase() === "off", n = X(e.VOLTRO_TRACING_SAMPLE, 1, 0, 1), r = (e.VOLTRO_TRACING_PERSIST ?? "").toLowerCase(), i = e.NODE_ENV === "production" ? "off" : "interesting";
456
+ }, Y = (e = process.env) => {
457
+ let t = (e.VOLTRO_TRACING_BUFFER ?? "").toLowerCase() === "off", n = J(e.VOLTRO_TRACING_SAMPLE, 1, 0, 1), r = (e.VOLTRO_TRACING_PERSIST ?? "").toLowerCase(), i = e.NODE_ENV === "production" ? "off" : "interesting";
458
458
  return {
459
- mode: Ue.has(r) ? r : n <= 0 ? "off" : i,
459
+ mode: Ge.has(r) ? r : n <= 0 ? "off" : i,
460
460
  sampleRate: n,
461
- slowMs: X(e.VOLTRO_TRACING_SLOW_MS, 500, 0, 2 ** 53 - 1),
462
- ttlHours: Ge(e.VOLTRO_TRACING_TTL_HOURS),
463
- persistDelivery: We(e.VOLTRO_TRACING_PERSIST_DELIVERY),
461
+ slowMs: J(e.VOLTRO_TRACING_SLOW_MS, 500, 0, 2 ** 53 - 1),
462
+ ttlHours: qe(e.VOLTRO_TRACING_TTL_HOURS),
463
+ persistDelivery: Ke(e.VOLTRO_TRACING_PERSIST_DELIVERY),
464
464
  bufferDisabled: t
465
465
  };
466
- }, Q = (e = process.env) => {
467
- let t = Z(e);
466
+ }, X = (e = process.env) => {
467
+ let t = Y(e);
468
468
  return !t.bufferDisabled && t.mode !== "off";
469
- }, Ke = (e, t) => {
469
+ }, Je = (e, t) => {
470
470
  if (t >= 1) return !0;
471
471
  if (t <= 0) return !1;
472
472
  let n = 2166136261;
473
473
  for (let t = 0; t < e.length; t++) n ^= e.charCodeAt(t), n = Math.imul(n, 16777619);
474
474
  return (n >>> 0) % 1e3 < t * 1e3;
475
- }, qe = (e, t) => {
476
- if (t.mode === "off" || q(e) || K(e) && !t.persistDelivery) return !1;
475
+ }, Ye = (e, t) => {
476
+ if (t.mode === "off" || G(e) || W(e) && !t.persistDelivery) return !1;
477
477
  let n = e.status === "error";
478
478
  if (t.mode === "errors") return n;
479
479
  if (n) return !0;
480
- if (!Ke(e.traceId, t.sampleRate)) return !1;
480
+ if (!Je(e.traceId, t.sampleRate)) return !1;
481
481
  if (t.mode === "all") return !0;
482
482
  let r = e.parentSpanId === null || e.parentSpanId === void 0 || e.parentSpanId === "", i = typeof e.durationMs == "number" && e.durationMs >= t.slowMs;
483
483
  return r || i;
484
- }, Je = (e) => {
484
+ }, Xe = (e) => {
485
485
  if (e.bufferDisabled) return "durable traces: OFF (VOLTRO_TRACING_BUFFER=off)";
486
486
  if (e.mode === "off") return "durable traces: OFF — _voltro_traces not created (prod default; set VOLTRO_TRACING_PERSIST=interesting to enable, or use OTLP)";
487
487
  let t = e.mode === "interesting" ? ` (errors + slow≥${e.slowMs}ms + roots)` : e.mode === "errors" ? " (errors only)" : "";
488
488
  return `durable traces: mode=${e.mode}${t}` + (e.sampleRate < 1 ? ` · sample=${e.sampleRate}` : "") + (e.persistDelivery ? " · +delivery" : "") + ` · ttl=${e.ttlHours}h`;
489
- }, Ye = (e = 30 * 6e4) => {
489
+ }, Ze = (e = 30 * 6e4) => {
490
490
  let t = /* @__PURE__ */ new Map();
491
491
  return (n, r) => {
492
492
  let i = t.get(n);
493
493
  return i !== void 0 && r - i < e ? !1 : (t.set(n, r), !0);
494
494
  };
495
- }, Xe = (e) => {
496
- let { store: t, log: n } = e, r = e.policy ?? Z();
497
- n.info(Je(r));
498
- let i = Ye(), a = [], o = () => {};
495
+ }, Qe = (e) => {
496
+ let { store: t, log: n } = e, r = e.policy ?? Y();
497
+ n.info(Xe(r));
498
+ let i = Ze(), a = [], o = () => {};
499
499
  if (r.mode !== "off") {
500
500
  let e = [], s = 0;
501
501
  o = (t) => {
502
- qe(t, r) && (e.length >= 5e3 && (e.shift(), s += 1, i("flush-drop", Date.now()) && (n.warn(`trace flush queue saturated — dropping durable spans (${s}+ since last warning). Durable inflow exceeds write throughput; reduce it with VOLTRO_TRACING_PERSIST=errors|interesting or VOLTRO_TRACING_SAMPLE<1.`), s = 0)), e.push(t));
502
+ Ye(t, r) && (e.length >= 5e3 && (e.shift(), s += 1, i("flush-drop", Date.now()) && (n.warn(`trace flush queue saturated — dropping durable spans (${s}+ since last warning). Durable inflow exceeds write throughput; reduce it with VOLTRO_TRACING_PERSIST=errors|interesting or VOLTRO_TRACING_SAMPLE<1.`), s = 0)), e.push(t));
503
503
  };
504
504
  let c = async () => {
505
505
  if (e.length === 0) return;
@@ -541,7 +541,7 @@ var ye = [
541
541
  let n = await t.query({
542
542
  table: "_voltro_traces",
543
543
  order: [],
544
- predicate: M("startedAt", e),
544
+ predicate: A("startedAt", e),
545
545
  projection: ["id"],
546
546
  skip: void 0,
547
547
  take: c
@@ -565,57 +565,74 @@ var ye = [
565
565
  for (let e of a) clearInterval(e);
566
566
  }
567
567
  };
568
- }, Ze = async (e) => {
569
- let o = !1, c = !1, l = !1, d = !1, f = !1, p = !1, m = async (e) => {
570
- let h = await u.readdir(e, { withFileTypes: !0 }).catch(() => []);
571
- for (let u of h) if (u.isDirectory()) {
568
+ }, Z = async (e) => {
569
+ let a = !1, s = !1, c = !1, l = !1, d = !1, f = async (e) => {
570
+ let p = await u.readdir(e, { withFileTypes: !0 }).catch(() => []);
571
+ for (let u of p) if (u.isDirectory()) {
572
572
  if (u.name === "node_modules" || u.name === "dist" || u.name === ".framework" || u.name.startsWith(".")) continue;
573
- await m(s(e, u.name));
573
+ await f(o(e, u.name));
574
574
  } else {
575
575
  let e = u.name;
576
- (r.test(e) || t.test(e)) && (o = !0), n.test(e) && (c = !0), i.test(e) && (l = !0), U.test(e) && (d = !0), a.test(e) && (f = !0), G.test(e) && (p = !0);
576
+ (r.test(e) || t.test(e)) && (a = !0), n.test(e) && (s = !0), i.test(e) && (c = !0), V.test(e) && (l = !0), U.test(e) && (d = !0);
577
577
  }
578
578
  };
579
- return await m(e), {
580
- workflows: o,
581
- schedules: c,
582
- webhooks: l,
583
- agents: d,
584
- outbox: f,
585
- connections: p
579
+ return await f(e), {
580
+ workflows: a,
581
+ schedules: s,
582
+ webhooks: c,
583
+ agents: l,
584
+ connections: d
586
585
  };
587
- }, Qe = async (e) => {
586
+ }, $e = async (e) => {
587
+ let t = o(e, "app.config.ts");
588
+ if (!l(t)) return { plugins: [] };
588
589
  try {
589
- return (await import(c(s(e, "app.config.ts")).href)).default?.plugins ?? [];
590
- } catch {
591
- return [];
590
+ return { plugins: (await import(s(t).href)).default?.plugins ?? [] };
591
+ } catch (e) {
592
+ return {
593
+ plugins: [],
594
+ error: e
595
+ };
596
+ }
597
+ }, Q = class extends Error {
598
+ root;
599
+ cause;
600
+ constructor(e, t) {
601
+ super(`app.config.ts could not be imported, so this app's plugin list is EMPTY and every plugin table is missing from the schema.
602
+
603
+ This is refused rather than continued: a plan computed without them does not merely omit them, it proposes DROPPING them, and the failure surfaces later as a pluginRef error naming an unrelated plugin.
604
+
605
+ The import ran at config-evaluation time — anything your config imports, directly or transitively, that does work when the module is first evaluated will reach here.
606
+
607
+ Cause: ${t instanceof Error ? t.message : String(t)}`), this.root = e, this.cause = t, this.name = "AppConfigLoadError";
592
608
  }
593
609
  }, $ = (e) => {
594
610
  let t = /* @__PURE__ */ new Map(), n = (e) => {
595
611
  e?.tableName && !t.has(e.tableName) && t.set(e.tableName, e);
596
612
  };
597
- for (let t of z({
613
+ for (let t of L({
598
614
  workflows: e.mix.workflows,
599
615
  schedules: e.mix.schedules,
600
616
  webhooks: e.mix.webhooks,
601
- traces: Q(),
617
+ traces: X(),
602
618
  cdc: e.cdc,
603
619
  ...e.cdcDialect ? { cdcDialect: e.cdcDialect } : {},
604
- undo: oe(),
605
- outbox: e.mix.outbox,
620
+ undo: ce(),
606
621
  connections: e.mix.connections
607
622
  })) n(t);
608
- e.mix.agents && (n(_), n(he), n(b), n(v)), e.mix.workflows && n(y);
609
- for (let t of je(e.plugins)) n(t);
623
+ e.mix.agents && (n(h), n(_e), n(v), n(g)), e.mix.workflows && n(_);
624
+ for (let t of Ne(e.plugins)) n(t);
610
625
  return [...t.values()];
611
- }, $e = async (e) => {
612
- let t = await Ze(e.root), n = await Qe(e.root), r = (process.env.DB_DIALECT ?? "postgres").toLowerCase(), i = r === "mariadb" ? "mariadb" : r === "mssql" ? "mssql" : void 0;
626
+ }, et = async (e) => {
627
+ let t = await Z(e.root), { plugins: n, error: r } = await $e(e.root);
628
+ if (r !== void 0) throw new Q(e.root, r);
629
+ let i = (process.env.DB_DIALECT ?? "postgres").toLowerCase(), a = i === "mariadb" ? "mariadb" : i === "mssql" ? "mssql" : void 0;
613
630
  return $({
614
631
  mix: t,
615
632
  plugins: n,
616
- cdc: e.cdc ?? (i !== void 0 && (process.env.CDC ?? "1") !== "0"),
617
- ...i ? { cdcDialect: i } : {}
633
+ cdc: e.cdc ?? (a !== void 0 && (process.env.CDC ?? "1") !== "0"),
634
+ ...a ? { cdcDialect: a } : {}
618
635
  });
619
636
  };
620
637
  //#endregion
621
- export { V as _, J as a, be as b, G as c, Me as d, W as f, Ae as g, ke as h, Q as i, Le as l, Ne as m, $ as n, He as o, Fe as p, Xe as r, q as s, $e as t, U as u, we as v, z as x, B as y };
638
+ export { L as C, Se as S, je as _, Qe as a, Ee as b, We as c, ze as d, V as f, Fe as g, Le as h, Z as i, G as l, H as m, et as n, X as o, Pe as p, $ as r, K as s, Q as t, U as u, Me as v, R as x, De as y };
@@ -0,0 +1,2 @@
1
+ import { n as e } from "./frameworkTableAssembly-BwIrO5nv.js";
2
+ export { e as assembleFrameworkTables };
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-D4Y1-Nlu.js";
1
+ import { a as e, i as t, n, o as r, r as i, t as a } from "./commands-BgGAUcku.js";
2
2
  //#region src/index.ts
3
3
  var o = "framework";
4
4
  //#endregion