@voltro/cli 0.34.0 → 0.35.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 (137) hide show
  1. package/CHANGELOG.md +167 -0
  2. package/dist/apiBuild-B8aoJvuw.js +2 -0
  3. package/dist/{apiBuild-DZF_f0_I.js → apiBuild-DYD_ONLD.js} +2 -2
  4. package/dist/{appGraph-gQ_6GkQQ.js → appGraph-KGDPTuTy.js} +1 -1
  5. package/dist/appGraph-zuMGKVYX.js +2 -0
  6. package/dist/bin.js +1 -1
  7. package/dist/{build-CE7Ca9gm.js → build-CD8K4XOr.js} +7 -7
  8. package/dist/{checkCommand-Dv8r9tGO.js → checkCommand-Ct9xkTrS.js} +8 -7
  9. package/dist/{checkCommand-YZDmkAGd.js → checkCommand-DKpDLlqu.js} +1 -1
  10. package/dist/{clusterCmd-CNXKlcvD.js → clusterCmd-D5wsCmA_.js} +1 -1
  11. package/dist/{codegenCommand-DC6w2tNZ.js → codegenCommand-C4YoQIc2.js} +3 -3
  12. package/dist/{codemodRunner-DRRqXR74.js → codemodRunner-BnFq3Fgu.js} +175 -34
  13. package/dist/{commands-gutsz-Ac.js → commands-BE8E7zF3.js} +37 -29
  14. package/dist/{dashboardCommand-3YG8p-UA.js → dashboardCommand-D7SgZGaN.js} +3 -3
  15. package/dist/{dataCommand-qL0r7fPO.js → dataCommand-BhYwDgg-.js} +56 -54
  16. package/dist/dbCommand-DS4b97Is.js +2 -0
  17. package/dist/{dbCommand-B6X0FZbq.js → dbCommand-O8HA63s2.js} +6 -6
  18. package/dist/{dev-CerMd0mW.js → dev-C7sFZq3m.js} +2696 -2188
  19. package/dist/{dev-CoG-ZPx8.js → dev-D2BikO7a.js} +1 -1
  20. package/dist/doctorCommand-CM4Ch9C7.js +2 -0
  21. package/dist/{doctorCommand-CnDXQxfa.js → doctorCommand-DnimF5IM.js} +76 -73
  22. package/dist/{dormancyCommand-Dszo57d6.js → dormancyCommand-QewYug_s.js} +1 -1
  23. package/dist/{embeddingsCommand-C0sKVRo1.js → embeddingsCommand-BfiLS_QI.js} +1 -1
  24. package/dist/{envCommand-DPgdV1Bq.js → envCommand-CCGPRQY1.js} +2 -2
  25. package/dist/{evolveCommand-DHpkgjgH.js → evolveCommand-CHsLCtDf.js} +2 -2
  26. package/dist/frameworkTableAssembly-YyVe32Cb.js +2 -0
  27. package/dist/frameworkTableAssembly-oMPBKqlE.js +511 -0
  28. package/dist/{generateCommand-oibemh97.js → generateCommand-DbgcUpGw.js} +1 -1
  29. package/dist/index.js +1 -1
  30. package/dist/{infoCommand-BJw9nLUR.js → infoCommand-DwOgK1t6.js} +1 -1
  31. package/dist/{inspect-CBqFtAKA.js → inspect-CjTYzAs_.js} +32 -2
  32. package/dist/inspect-P4pxoMaV.js +2 -0
  33. package/dist/{inspectCmd-Bppy-GGw.js → inspectCmd-EHFZ9yYu.js} +1 -1
  34. package/dist/{inspectFetch-Cm8_wVvp.js → inspectFetch-EMuhTG_9.js} +1 -1
  35. package/dist/{logsCmd-CCca3KRZ.js → logsCmd-D36xK7Zu.js} +1 -1
  36. package/dist/manifestBuild-COkJoyAr.js +2 -0
  37. package/dist/{manifestBuild-sxpwdKY1.js → manifestBuild-hpPLaGxV.js} +1 -1
  38. package/dist/{migrate-CBwOt_iV.js → migrate-BV7I-ZHZ.js} +3 -3
  39. package/dist/probeCommand-CZfaaUOZ.js +122 -0
  40. package/dist/{runtimeTrace-CRxalXTs.js → runtimeTrace-CH3eUiMw.js} +1 -1
  41. package/dist/scheduleCmd-DQRu6BZC.js +149 -0
  42. package/dist/{sdkgen-CYJscZC7.js → sdkgen-BLkvGRfX.js} +1 -1
  43. package/dist/{seedRunner-TFHHiToI.js → seedRunner-ZmLSqNe2.js} +74 -70
  44. package/dist/serveCommand-CbDHU6l-.js +2 -0
  45. package/dist/serveCommand-iwlUBNS1.js +1766 -0
  46. package/dist/serveEntry.js +1 -1
  47. package/dist/{start-B-9Nsp-S.js → start-BgN62boB.js} +1 -1
  48. package/dist/{start-9LiUOfES.js → start-T4VesWiM.js} +2 -2
  49. package/dist/startEntry.js +1 -1
  50. package/dist/{tracesCmd-CkEZQrtt.js → tracesCmd-DStmCJPi.js} +1 -1
  51. package/dist/updateCommand-BlMZhWgO.js +2 -0
  52. package/dist/{updateCommand-Bkptutss.js → updateCommand-x0pI_x-B.js} +1 -1
  53. package/dist/webDev-BcykISYQ2.js +2 -0
  54. package/dist/{webDev-CBYvPqQr.js → webDev-Dybxew86.js} +14 -2
  55. package/dist/{webhooksCommand-CID96Rga.js → webhooksCommand-DlAgS2Iw.js} +1 -1
  56. package/dist/{workflowsCmd-D1VTmLMY.js → workflowsCmd-BGF-mRZ5.js} +1 -1
  57. package/package.json +47 -17
  58. package/templates/AGENTS.md +1 -1
  59. package/templates/agent-docs/_index.md +1 -1
  60. package/templates/agent-docs/_manifest.json +1 -1
  61. package/templates/agent-docs/authentication.md +55 -7
  62. package/templates/agent-docs/cli.md +59 -0
  63. package/templates/agent-docs/data.md +59 -2
  64. package/templates/agent-docs/database/migrations.md +50 -1
  65. package/templates/agent-docs/deployment.md +214 -21
  66. package/templates/agent-docs/introduction.md +1 -1
  67. package/templates/agent-docs/multi-tenancy.md +93 -22
  68. package/templates/agent-docs/plugins/ai-flows.md +86 -0
  69. package/templates/agent-docs/plugins/billing.md +1 -1
  70. package/templates/agent-docs/plugins/clickhouse.md +31 -0
  71. package/templates/agent-docs/plugins/search.md +6 -3
  72. package/templates/agent-docs/plugins/storage.md +11 -0
  73. package/templates/agent-docs/plugins.md +3 -1
  74. package/templates/agent-docs/scheduling.md +17 -0
  75. package/templates/agent-docs/security.md +2 -2
  76. package/templates/agent-docs/whats-new.md +95 -1729
  77. package/templates/agent-docs/workflows.md +101 -0
  78. package/templates/apps/api-ai/package.json +7 -7
  79. package/templates/apps/api-auth/package.json +8 -8
  80. package/templates/apps/api-backend/package.json +7 -7
  81. package/templates/apps/api-backend-deactivation/package.json +7 -7
  82. package/templates/apps/api-backend-mail/package.json +8 -8
  83. package/templates/apps/api-backend-mariadb/package.json +9 -9
  84. package/templates/apps/api-backend-sqlite/package.json +8 -8
  85. package/templates/apps/api-backend-storage/package.json +8 -8
  86. package/templates/apps/api-cms/package.json +10 -10
  87. package/templates/apps/api-collab/package.json +8 -8
  88. package/templates/apps/api-data-advanced/package.json +8 -8
  89. package/templates/apps/api-durable/package.json +8 -8
  90. package/templates/apps/api-feature-flags/package.json +9 -9
  91. package/templates/apps/api-governance/package.json +8 -8
  92. package/templates/apps/api-kv/package.json +8 -8
  93. package/templates/apps/api-moderation/package.json +8 -8
  94. package/templates/apps/api-observability/package.json +8 -8
  95. package/templates/apps/api-ratelimit/package.json +8 -8
  96. package/templates/apps/api-rbac/package.json +8 -8
  97. package/templates/apps/api-rest/package.json +7 -7
  98. package/templates/apps/api-saas/package.json +11 -11
  99. package/templates/apps/api-saas-starter/package.json +10 -10
  100. package/templates/apps/api-search/package.json +8 -8
  101. package/templates/apps/api-status/package.json +8 -8
  102. package/templates/apps/api-versioning/package.json +8 -8
  103. package/templates/apps/api-webhooks/package.json +9 -9
  104. package/templates/apps/changelog/package.json +6 -6
  105. package/templates/apps/edge-functions/package.json +2 -2
  106. package/templates/apps/frontend-admin/package.json +8 -8
  107. package/templates/apps/frontend-app/package.json +9 -9
  108. package/templates/apps/frontend-auth/package.json +8 -8
  109. package/templates/apps/frontend-blank/package.json +7 -7
  110. package/templates/apps/frontend-cms/package.json +9 -9
  111. package/templates/apps/frontend-collab/package.json +10 -10
  112. package/templates/apps/frontend-contact/package.json +7 -7
  113. package/templates/apps/frontend-dashboard/package.json +7 -7
  114. package/templates/apps/frontend-docs/package.json +7 -7
  115. package/templates/apps/frontend-i18n/package.json +6 -6
  116. package/templates/apps/frontend-landing/package.json +7 -7
  117. package/templates/apps/frontend-portal/package.json +8 -8
  118. package/templates/apps/frontend-saas/package.json +8 -8
  119. package/templates/apps/frontend-spa/package.json +7 -7
  120. package/templates/apps/frontend-ssr/package.json +7 -7
  121. package/templates/apps/frontend-ssr-api/package.json +8 -8
  122. package/templates/apps/frontend-static-blog/package.json +6 -6
  123. package/templates/apps/frontend-status/package.json +8 -8
  124. package/templates/apps/mobile-app/package.json +3 -3
  125. package/dist/apiBuild-BICVGnEC.js +0 -2
  126. package/dist/appGraph-CvQCte0z.js +0 -2
  127. package/dist/dbCommand-CpdKLeQq.js +0 -2
  128. package/dist/doctorCommand-BvqGBwNG.js +0 -2
  129. package/dist/frameworkTableAssembly-BGHmck-x.js +0 -2
  130. package/dist/frameworkTableAssembly-DkkP6BgC.js +0 -674
  131. package/dist/inspect-C_T_WGvl.js +0 -2
  132. package/dist/manifestBuild-ChsKAhmn.js +0 -2
  133. package/dist/scheduleCmd--jksTrf6.js +0 -69
  134. package/dist/serveCommand-B_isw7q4.js +0 -1647
  135. package/dist/serveCommand-DOvbgRnQ.js +0 -2
  136. package/dist/updateCommand-us1_hdIC.js +0 -2
  137. package/dist/webDev-Cg-fFiyd2.js +0 -2
@@ -1,674 +0,0 @@
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 p } from "@voltro/protocol";
7
- import { Effect as m } from "effect";
8
- import { SqlClient as h } from "@effect/sql";
9
- import { _voltroBudgetHoldsTable as ee, _voltroWorkflowAdmissionsTable as te, _voltroWorkflowPausesTable as ne, _voltroWorkflowPendingTable as re, _voltroWorkflowRunEventsTable as ie, _voltroWorkflowRunStepsTable as ae, _voltroWorkflowRunsTable as oe, _voltroWorkflowStartContextsTable as se, _voltroWorkflowWatermarksTable as ce } from "@voltro/workflow";
10
- import { agentMessagesTable as le, agentThreadsTable as ue, aiBudgetTable as de, aiInferencesTable as fe, aiUsageTable as pe, isAgentDescriptor as me, isAgentExecutor as he, promptsTable as ge, resolveToolModuleHandlers as _e } from "@voltro/ai";
11
- import { _voltroApiKeysTable as ve, _voltroCdcOffsetsTable as ye, _voltroIdempotencyTable as g, _voltroKvTable as _, _voltroMigrationPlansTable as v, _voltroMigrationsTable as y, _voltroMssqlCdcOffsetsTable as b, _voltroSeedsTable as x, lt as S } from "@voltro/database";
12
- import { _voltroApprovalsTable as C, _voltroConnectionGrantsTable as w, _voltroConnectionsTable as T, _voltroScheduleClaimsTable as E, _voltroScheduleRunsTable as D, _voltroTracesTable as O, _voltroUndoLogTable as k, _voltroWakeupsTable as A, _voltroWorkflowEventDeliveriesTable as j, _voltroWorkflowEventsTable as M, outboxAttemptsTable as N, outboxTable as P, undoCaptureEnabled as be } from "@voltro/runtime";
13
- import { _voltroWebhookDeliveriesTable as xe, _voltroWebhookTargetsTable as Se } from "@voltro/plugin-webhooks/mixin";
14
- import { _voltroStorageBlobsTable as Ce, _voltroStorageGrantsTable as we, _voltroStorageRefsTable as Te, _voltroStorageUsageTable as Ee } from "@voltro/plugin-storage";
15
- //#region src/frameworkTables.ts
16
- var De = [
17
- {
18
- table: y,
19
- when: "always"
20
- },
21
- {
22
- table: x,
23
- when: "always"
24
- },
25
- {
26
- table: v,
27
- when: "always"
28
- },
29
- {
30
- table: oe,
31
- when: "workflows"
32
- },
33
- {
34
- table: ae,
35
- when: "workflows"
36
- },
37
- {
38
- table: ie,
39
- when: "workflows"
40
- },
41
- {
42
- table: se,
43
- when: "workflows"
44
- },
45
- {
46
- table: re,
47
- when: "workflows"
48
- },
49
- {
50
- table: te,
51
- when: "workflows"
52
- },
53
- {
54
- table: ne,
55
- when: "workflows"
56
- },
57
- {
58
- table: ce,
59
- when: "workflows"
60
- },
61
- {
62
- table: M,
63
- when: "workflows"
64
- },
65
- {
66
- table: j,
67
- when: "workflows"
68
- },
69
- {
70
- table: D,
71
- when: "schedules"
72
- },
73
- {
74
- table: E,
75
- when: "schedules"
76
- },
77
- {
78
- table: Se,
79
- when: "webhooks"
80
- },
81
- {
82
- table: xe,
83
- when: "webhooks"
84
- },
85
- {
86
- table: O,
87
- when: "traces"
88
- },
89
- {
90
- table: k,
91
- when: "undo"
92
- },
93
- {
94
- table: C,
95
- when: "always"
96
- },
97
- {
98
- table: ee,
99
- when: "workflows"
100
- },
101
- {
102
- table: P,
103
- when: "always"
104
- },
105
- {
106
- table: N,
107
- when: "always"
108
- },
109
- {
110
- table: T,
111
- when: "connections"
112
- },
113
- {
114
- table: w,
115
- when: "connections"
116
- },
117
- {
118
- table: A,
119
- when: "always"
120
- },
121
- {
122
- table: Te,
123
- when: "always"
124
- },
125
- {
126
- table: we,
127
- when: "always"
128
- },
129
- {
130
- table: Ce,
131
- when: "always"
132
- },
133
- {
134
- table: Ee,
135
- when: "always"
136
- },
137
- {
138
- table: g,
139
- when: "always"
140
- },
141
- {
142
- table: ve,
143
- when: "always"
144
- },
145
- {
146
- table: _,
147
- when: "always"
148
- }
149
- ], Oe = (e) => {
150
- let t = De.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);
151
- return e.cdc === !0 && t.push(e.cdcDialect === "mssql" ? b : ye), t;
152
- }, F = (e) => {
153
- let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
154
- return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/-([a-zA-Z0-9])/g, (e, t) => t.toUpperCase());
155
- }, ke = (e) => {
156
- let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
157
- return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/#/g, "--").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
158
- }, Ae = (e, t) => I(e, t.name), I = (e, t) => {
159
- let n = F(e.name);
160
- if (!t.includes(".")) return `${n}.${t}`;
161
- if (e.baseName === void 0) return t;
162
- let r = `${F(e.baseName)}.`;
163
- return t.startsWith(r) ? `${n}.${t.slice(r.length)}` : t;
164
- }, je = (e, t, n) => {
165
- switch (e) {
166
- case "query": return p({
167
- name: t,
168
- input: n.input,
169
- output: n.output,
170
- ...n.error === void 0 ? {} : { error: n.error },
171
- ...n.source === void 0 ? {} : { source: n.source }
172
- });
173
- case "mutation": return f({
174
- name: t,
175
- input: n.input,
176
- output: n.output,
177
- ...n.error === void 0 ? {} : { error: n.error }
178
- });
179
- case "action": return d({
180
- name: t,
181
- input: n.input,
182
- output: n.output,
183
- ...n.error === void 0 ? {} : { error: n.error }
184
- });
185
- }
186
- }, Me = (e) => (t, n) => m.suspend(() => {
187
- let r = { request: {
188
- subject: n.request.subject,
189
- traceId: n.request.traceId
190
- } };
191
- return e.execute(t, r);
192
- }), Ne = (e) => {
193
- let t = [];
194
- for (let n of e) {
195
- let e = n.routes ?? [];
196
- for (let r of e) {
197
- let e = Ae(n, r), i = je(r.kind, e, r);
198
- t.push({
199
- kind: r.kind,
200
- file: `plugin:${n.name}`,
201
- descriptor: i,
202
- executor: Me(r),
203
- plugin: {
204
- name: n.name,
205
- version: n.version
206
- }
207
- });
208
- }
209
- }
210
- return t;
211
- }, Pe = (e, t, n = /* @__PURE__ */ new Set()) => {
212
- let r = /* @__PURE__ */ new Map();
213
- for (let e of t) r.set(e, "user-route");
214
- let i = [];
215
- for (let t of e) {
216
- let e = t.descriptor.name, a = r.get(e);
217
- if (!(a === "user-route" && n.has(e))) {
218
- if (a !== void 0) throw Error(`plugin route tag collision: "${e}" declared by plugin "${t.plugin.name}" but already claimed by ${a === "user-route" ? "a user-authored route" : `plugin "${a}"`}` + (a === "user-route" ? `.\nIf replacing it is intentional, declare \`overridesPlugin: true\` on your "${e}" — renaming yours or aliasing the plugin both split the namespace by who built it.` : ""));
219
- r.set(e, t.plugin.name), i.push(t);
220
- }
221
- }
222
- return i;
223
- }, L = "_voltro_plugin_migrations", Fe = () => m.gen(function* () {
224
- yield* (yield* h.SqlClient).unsafe(`
225
- CREATE TABLE IF NOT EXISTS ${L} (
226
- id TEXT PRIMARY KEY,
227
- plugin_name TEXT NOT NULL,
228
- migration_id TEXT NOT NULL,
229
- description TEXT,
230
- applied_at TEXT NOT NULL
231
- );
232
- `).pipe(m.orDie);
233
- }), Ie = (e, t) => `${F(e)}__${t}`, Le = () => m.gen(function* () {
234
- let e = yield* h.SqlClient, t = yield* e`SELECT id FROM ${e(L)}`.pipe(m.orDie);
235
- return new Set(t.map((e) => e.id));
236
- }), Re = (e) => m.gen(function* () {
237
- let t = yield* h.SqlClient, n = (/* @__PURE__ */ new Date()).toISOString();
238
- yield* t`
239
- INSERT INTO ${t(L)} (id, plugin_name, migration_id, description, applied_at)
240
- VALUES (${e.key}, ${e.pluginName}, ${e.migration.id}, ${e.migration.description ?? null}, ${n})
241
- `.pipe(m.orDie);
242
- }), R = (e) => m.gen(function* () {
243
- let t = e.flatMap((e) => (e.extendSchema?.migrations ?? []).map((t) => ({
244
- plugin: e,
245
- migration: t
246
- })));
247
- if (t.length === 0) return [];
248
- yield* Fe();
249
- let n = yield* Le(), r = [];
250
- for (let { plugin: e, migration: i } of t) {
251
- let t = Ie(e.name, i.id), a = Date.now();
252
- if (n.has(t)) {
253
- r.push({
254
- pluginName: e.name,
255
- migrationId: i.id,
256
- status: "skipped",
257
- durationMs: 0
258
- });
259
- continue;
260
- }
261
- let o = yield* h.SqlClient;
262
- try {
263
- yield* i.up(o).pipe(m.mapError((e) => e)), yield* Re({
264
- key: t,
265
- pluginName: e.name,
266
- migration: i
267
- }), r.push({
268
- pluginName: e.name,
269
- migrationId: i.id,
270
- status: "applied",
271
- durationMs: Date.now() - a
272
- });
273
- } catch (t) {
274
- return r.push({
275
- pluginName: e.name,
276
- migrationId: i.id,
277
- status: "failed",
278
- durationMs: Date.now() - a,
279
- error: t
280
- }), yield* m.fail(/* @__PURE__ */ Error(`Plugin migration failed: ${e.name} ${i.id} — ${t instanceof Error ? t.message : String(t)}`));
281
- }
282
- }
283
- return r;
284
- }), ze = (e, t) => m.gen(function* () {
285
- let n = yield* R(e);
286
- if (n.length === 0) return n;
287
- let r = n.filter((e) => e.status === "applied"), i = n.filter((e) => e.status === "skipped");
288
- return t(`plugin migrations: ${r.length} applied, ${i.length} already applied`, { applied: r.map((e) => `${e.pluginName}:${e.migrationId}`) }), n;
289
- }), Be = (e) => e.filter((e) => e.extendSchema && (e.extendSchema.tables?.length ?? 0) + (e.extendSchema.migrations?.length ?? 0) > 0).map((e) => ({
290
- pluginName: e.name,
291
- pluginAlias: F(e.name),
292
- tables: e.extendSchema.tables?.length ?? 0,
293
- migrations: e.extendSchema.migrations?.length ?? 0
294
- })), Ve = (e) => e.flatMap((e) => e.extendSchema?.tables ?? []), z = /(?<!\.server)\.agent\.tsx?$/, He = /\.agent\.server\.tsx?$/, B = /\.tool\.tsx?$/, Ue = async (t, n) => {
295
- let r = 0;
296
- for (let i of t) if (B.test(i)) try {
297
- let t = await e(i);
298
- r += _e(t);
299
- } catch (e) {
300
- n.warn("tool: failed to import — handler not wired", { file: i }, e);
301
- }
302
- return r;
303
- }, We = (e) => e.replace(/\.agent\.(tsx?)$/, ".agent.server.$1"), Ge = async (t, n) => {
304
- let r = [], i = /* @__PURE__ */ new Set();
305
- for (let a of t) {
306
- if (!z.test(a)) continue;
307
- let t;
308
- try {
309
- t = await e(a);
310
- } catch (e) {
311
- n.warn("agent: failed to import descriptor", { file: a }, e);
312
- continue;
313
- }
314
- let o = Object.values(t).find(me);
315
- if (o === void 0) {
316
- n.warn("agent: no defineAgent() descriptor export found", { file: a });
317
- continue;
318
- }
319
- if (i.has(o.name)) {
320
- n.warn("agent: duplicate name — skipping", {
321
- file: a,
322
- name: o.name
323
- });
324
- continue;
325
- }
326
- let s = We(a), c;
327
- try {
328
- c = await e(s);
329
- } catch (e) {
330
- n.warn("agent: no executor — expected a `*.agent.server.tsx` default-exporting defineAgentExecutor()", {
331
- descriptor: a,
332
- expected: s,
333
- name: o.name
334
- }, e);
335
- continue;
336
- }
337
- let l = c.default;
338
- if (!he(l)) {
339
- n.warn("agent: executor file must default-export defineAgentExecutor(descriptor, {...})", {
340
- file: s,
341
- name: o.name
342
- });
343
- continue;
344
- }
345
- i.add(o.name), r.push({
346
- file: a,
347
- serverFile: s,
348
- descriptor: o,
349
- executor: l
350
- });
351
- }
352
- return { agents: r };
353
- }, V = /\.connection\.tsx?$/, Ke = (e) => e.replace(V, ""), qe = async (t, n) => {
354
- let r = [], i = /* @__PURE__ */ new Map();
355
- for (let a of t) {
356
- let t;
357
- try {
358
- t = await e(a);
359
- } catch (e) {
360
- n.warn("connections: failed to import", { file: a }, e);
361
- continue;
362
- }
363
- let o = t.default;
364
- if (o === void 0 || typeof o != "object" || !o) {
365
- n.warn("connections: missing or non-object default export — expected `defineConnection({...})`", { file: a });
366
- continue;
367
- }
368
- let s = o;
369
- if (typeof s.id != "string" || s.id.length === 0) {
370
- n.warn("connections: invalid `id` field", { file: a });
371
- continue;
372
- }
373
- if (s.kind !== "oauth2" && s.kind !== "pat") {
374
- n.warn("connections: `kind` must be \"oauth2\" or \"pat\"", {
375
- file: a,
376
- kind: String(s.kind)
377
- });
378
- continue;
379
- }
380
- let c = i.get(s.id);
381
- if (c !== void 0) {
382
- n.error("connections: DUPLICATE id — only the first is registered", {
383
- id: s.id,
384
- registered: c,
385
- ignored: a
386
- });
387
- continue;
388
- }
389
- i.set(s.id, a), r.push({
390
- file: a,
391
- definition: s
392
- });
393
- }
394
- return r.length > 0 && n.info("discovered connections", {
395
- connections: r.map((e) => `${e.definition.id} (${e.definition.kind})`),
396
- files: r.map((e) => Ke(o(e.file)))
397
- }), r;
398
- }, H = (e) => typeof e.attributes["framework.kind"] == "string" && e.attributes["framework.kind"].startsWith("subscription."), U = (e) => {
399
- if (e.name.includes("_voltro_traces")) return !0;
400
- for (let t in e.attributes) {
401
- let n = e.attributes[t];
402
- if (typeof n == "string" && n.includes("_voltro_traces")) return !0;
403
- }
404
- return !1;
405
- }, Je = [
406
- "_voltro_schedule_claims",
407
- "_voltro_workflow_pending",
408
- "_voltro_workflow_pauses",
409
- "_voltro_ai_inferences"
410
- ], Ye = (e) => {
411
- for (let t of Je) {
412
- if (e.name.includes(t)) return !0;
413
- for (let n in e.attributes) {
414
- let r = e.attributes[n];
415
- if (typeof r == "string" && r.includes(t)) return !0;
416
- }
417
- }
418
- return !1;
419
- }, Xe = (e) => typeof e.attributes["framework.kind"] == "string" && e.attributes["framework.kind"].startsWith("subscription"), Ze = 1e3, Qe = 500, $e = 50, W = class {
420
- capacity;
421
- buffer = [];
422
- constructor(e = Ze) {
423
- this.capacity = e;
424
- }
425
- append(e) {
426
- this.buffer.push(e), this.buffer.length > this.capacity && this.buffer.shift();
427
- }
428
- query(e = {}) {
429
- let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? Qe, this.capacity), i = e.traceId, a = e.minDurationMs, o = e.status, s = e.name?.toLowerCase(), c = [];
430
- for (let e = this.buffer.length - 1; e >= 0 && c.length < r; e--) {
431
- let r = this.buffer[e];
432
- 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);
433
- }
434
- return c.reverse();
435
- }
436
- queryGrouped(e = {}) {
437
- let t = e.since ?? 0, n = e.maxTraces ?? $e, r = e.onlyErrors ?? !1, i = /* @__PURE__ */ new Map();
438
- for (let e of this.buffer) {
439
- if (e.startMs < t) continue;
440
- let n = i.get(e.traceId);
441
- n ? n.push(e) : i.set(e.traceId, [e]);
442
- }
443
- let a = [];
444
- for (let [e, t] of i) {
445
- t.sort((e, t) => e.startMs - t.startMs);
446
- let n = t.some((e) => e.status === "error");
447
- if (r && !n) continue;
448
- let i = t[0].startMs, o = t.reduce((e, t) => t.endMs > e ? t.endMs : e, i), s = t.filter(H), c = s.length > 0 || t.some(Xe), l = s.reduce((e, t) => e === void 0 || t.startMs > e.startMs ? t : e, void 0);
449
- a.push({
450
- traceId: e,
451
- rootName: t[0].name,
452
- startMs: i,
453
- durationMs: o - i,
454
- spanCount: t.length,
455
- hasError: n,
456
- kind: c ? "subscription" : "request",
457
- ...l === void 0 ? {} : { lastDeliveryMs: l.durationMs },
458
- ...s.length > 0 ? { deliveryCount: s.length } : {},
459
- spans: t
460
- });
461
- }
462
- return a.sort((e, t) => t.startMs - e.startMs), a.slice(0, n);
463
- }
464
- size() {
465
- return this.buffer.length;
466
- }
467
- capacityHint() {
468
- return this.capacity;
469
- }
470
- clear() {
471
- this.buffer = [];
472
- }
473
- }, G = null, et = () => (G === null && (G = new W()), G), tt = /* @__PURE__ */ new Set([
474
- "off",
475
- "errors",
476
- "interesting",
477
- "all"
478
- ]), K = (e, t, n, r) => {
479
- let i = Number(e);
480
- return Number.isFinite(i) ? Math.min(r, Math.max(n, i)) : t;
481
- }, nt = (e) => e !== void 0 && [
482
- "1",
483
- "true",
484
- "yes",
485
- "on"
486
- ].includes(e.toLowerCase()), rt = (e) => {
487
- let t = Number(e);
488
- return Number.isFinite(t) && t > 0 ? t : 24;
489
- }, q = (e = process.env) => {
490
- let t = (e.VOLTRO_TRACING_BUFFER ?? "").toLowerCase() === "off", n = K(e.VOLTRO_TRACING_SAMPLE, 1, 0, 1), r = (e.VOLTRO_TRACING_PERSIST ?? "").toLowerCase(), i = e.NODE_ENV === "production" ? "off" : "interesting";
491
- return {
492
- mode: tt.has(r) ? r : n <= 0 ? "off" : i,
493
- sampleRate: n,
494
- slowMs: K(e.VOLTRO_TRACING_SLOW_MS, 500, 0, 2 ** 53 - 1),
495
- ttlHours: rt(e.VOLTRO_TRACING_TTL_HOURS),
496
- persistDelivery: nt(e.VOLTRO_TRACING_PERSIST_DELIVERY),
497
- bufferDisabled: t
498
- };
499
- }, J = (e = process.env) => {
500
- let t = q(e);
501
- return !t.bufferDisabled && t.mode !== "off";
502
- }, it = (e, t) => {
503
- if (t >= 1) return !0;
504
- if (t <= 0) return !1;
505
- let n = 2166136261;
506
- for (let t = 0; t < e.length; t++) n ^= e.charCodeAt(t), n = Math.imul(n, 16777619);
507
- return (n >>> 0) % 1e3 < t * 1e3;
508
- }, at = (e, t) => {
509
- if (t.mode === "off" || U(e) || H(e) && !t.persistDelivery) return !1;
510
- let n = e.status === "error";
511
- if (t.mode === "errors") return n;
512
- if (n) return !0;
513
- if (!it(e.traceId, t.sampleRate)) return !1;
514
- if (t.mode === "all") return !0;
515
- if (Ye(e)) return !1;
516
- let r = e.parentSpanId === null || e.parentSpanId === void 0 || e.parentSpanId === "", i = typeof e.durationMs == "number" && e.durationMs >= t.slowMs;
517
- return r || i;
518
- }, ot = (e) => {
519
- if (e.bufferDisabled) return "durable traces: OFF (VOLTRO_TRACING_BUFFER=off)";
520
- if (e.mode === "off") return "durable traces: OFF — _voltro_traces not created (prod default; set VOLTRO_TRACING_PERSIST=interesting to enable, or use OTLP)";
521
- let t = e.mode === "interesting" ? ` (errors + slow≥${e.slowMs}ms + roots)` : e.mode === "errors" ? " (errors only)" : "";
522
- return `durable traces: mode=${e.mode}${t}` + (e.sampleRate < 1 ? ` · sample=${e.sampleRate}` : "") + (e.persistDelivery ? " · +delivery" : "") + ` · ttl=${e.ttlHours}h`;
523
- }, st = (e = 30 * 6e4) => {
524
- let t = /* @__PURE__ */ new Map();
525
- return (n, r) => {
526
- let i = t.get(n);
527
- return i !== void 0 && r - i < e ? !1 : (t.set(n, r), !0);
528
- };
529
- }, ct = (e) => {
530
- let { store: t, log: n } = e, r = e.policy ?? q();
531
- n.info(ot(r));
532
- let i = st(), a = [], o = () => {};
533
- if (r.mode !== "off") {
534
- let e = [], s = 0;
535
- o = (t) => {
536
- at(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));
537
- };
538
- let c = async () => {
539
- if (e.length === 0) return;
540
- let n = e.splice(0, 200);
541
- for (let e of n) try {
542
- await t.insert("_voltro_traces", {
543
- id: `${e.traceId}:${e.spanId}`,
544
- traceId: e.traceId,
545
- spanId: e.spanId,
546
- parentSpanId: e.parentSpanId,
547
- name: e.name,
548
- kind: e.kind,
549
- status: e.status,
550
- statusMessage: e.statusMessage ?? null,
551
- startedAt: new Date(e.startMs),
552
- endedAt: new Date(e.endMs),
553
- durationMs: Math.round(e.durationMs),
554
- attributes: e.attributes,
555
- events: e.events ?? null
556
- });
557
- } catch {}
558
- }, l = setInterval(() => {
559
- c();
560
- }, 1e3);
561
- l.unref?.(), a.push(l);
562
- }
563
- let s = r.ttlHours, c = 2e4, l = t.raw?.bind(t), u = async () => {
564
- try {
565
- let e = /* @__PURE__ */ new Date(Date.now() - s * 36e5), r = 0;
566
- if (l) for (;;) {
567
- let t = await l({
568
- _tag: "RawSqlFragment",
569
- strings: ["DELETE FROM \"_voltro_traces\" WHERE \"id\" IN (SELECT \"id\" FROM \"_voltro_traces\" WHERE \"startedAt\" < ", ` LIMIT ${c}) RETURNING "id"`],
570
- values: [e]
571
- });
572
- if (r += t.length, t.length < c) break;
573
- }
574
- else for (;;) {
575
- let n = await t.query({
576
- table: "_voltro_traces",
577
- order: [],
578
- predicate: S("startedAt", e),
579
- projection: ["id"],
580
- skip: void 0,
581
- take: c
582
- });
583
- if (n.length === 0) break;
584
- for (let e of n) try {
585
- await t.delete("_voltro_traces", e.id);
586
- } catch {}
587
- if (r += n.length, n.length < c) break;
588
- }
589
- r >= c && i("gc-volume", Date.now()) && n.warn(`trace GC pruned ${r} spans past the ${s}h TTL in one pass — high durable-trace volume. If _voltro_traces stays large, cut the inflow (VOLTRO_TRACING_PERSIST=errors|interesting, VOLTRO_TRACING_SAMPLE<1) or shorten VOLTRO_TRACING_TTL_HOURS.`);
590
- } catch (e) {
591
- i("gc-error", Date.now()) && n.warn(`trace GC pass failed — _voltro_traces may grow until this clears: ${e instanceof Error ? e.message : String(e)}`);
592
- }
593
- }, d = setInterval(() => {
594
- u();
595
- }, 5 * 6e4);
596
- return d.unref?.(), a.push(d), {
597
- persistTraceSpan: (e) => o(e),
598
- stop: () => {
599
- for (let e of a) clearInterval(e);
600
- }
601
- };
602
- }, Y = (e) => n.test(e) || a.test(e), X = async (e) => {
603
- let n = !1, a = !1, o = !1, c = !1, u = !1, d = async (e) => {
604
- let f = await l.readdir(e, { withFileTypes: !0 }).catch(() => []);
605
- for (let l of f) if (l.isDirectory()) {
606
- if (l.name === "node_modules" || l.name === "dist" || l.name === ".framework" || l.name.startsWith(".")) continue;
607
- await d(s(e, l.name));
608
- } else {
609
- let e = l.name;
610
- (r.test(e) || t.test(e)) && (n = !0), Y(e) && (a = !0), i.test(e) && (o = !0), z.test(e) && (c = !0), V.test(e) && (u = !0);
611
- }
612
- };
613
- return await d(e), {
614
- workflows: n,
615
- schedules: a,
616
- webhooks: o,
617
- agents: c,
618
- connections: u
619
- };
620
- }, lt = async (e) => {
621
- let t = s(e, "app.config.ts");
622
- if (!c(t)) return { plugins: [] };
623
- try {
624
- return { plugins: (await import(u(t).href)).default?.plugins ?? [] };
625
- } catch (e) {
626
- return {
627
- plugins: [],
628
- error: e
629
- };
630
- }
631
- }, Z = async (e) => {
632
- let { plugins: t, error: n } = await lt(e);
633
- if (n !== void 0) throw new Q(e, n);
634
- return t;
635
- }, Q = class extends Error {
636
- root;
637
- cause;
638
- constructor(e, t) {
639
- 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.
640
-
641
- 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.
642
-
643
- 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.
644
-
645
- Cause: ${t instanceof Error ? t.message : String(t)}`), this.root = e, this.cause = t, this.name = "AppConfigLoadError";
646
- }
647
- }, $ = (e) => {
648
- let t = /* @__PURE__ */ new Map(), n = (e) => {
649
- e?.tableName && !t.has(e.tableName) && t.set(e.tableName, e);
650
- };
651
- for (let t of Oe({
652
- workflows: e.mix.workflows,
653
- schedules: e.mix.schedules,
654
- webhooks: e.mix.webhooks,
655
- traces: J(),
656
- cdc: e.cdc,
657
- ...e.cdcDialect ? { cdcDialect: e.cdcDialect } : {},
658
- undo: be(),
659
- connections: e.mix.connections
660
- })) n(t);
661
- e.mix.agents && (n(ue), n(le), n(pe), n(de)), e.mix.workflows && n(fe), (e.mix.workflows || e.mix.agents) && n(ge);
662
- for (let t of Ve(e.plugins)) n(t);
663
- return [...t.values()];
664
- }, ut = async (e) => {
665
- let t = await X(e.root), n = await Z(e.root), r = (process.env.DB_DIALECT ?? "postgres").toLowerCase(), i = r === "mariadb" ? "mariadb" : r === "mssql" ? "mssql" : void 0;
666
- return $({
667
- mix: t,
668
- plugins: n,
669
- cdc: e.cdc ?? (i !== void 0 && (process.env.CDC ?? "1") !== "0"),
670
- ...i ? { cdcDialect: i } : {}
671
- });
672
- };
673
- //#endregion
674
- export { Ne as C, ke as E, Pe as S, F as T, Ge as _, Y as a, R as b, J as c, U as d, V as f, B as g, He as h, X as i, W as l, z as m, ut as n, Z as o, qe as p, $ as r, ct as s, Q as t, et as u, Ue as v, I as w, Be as x, ze as y };
@@ -1,2 +0,0 @@
1
- import { r as e } from "./inspect-CBqFtAKA.js";
2
- export { e as buildCapabilityManifest };
@@ -1,2 +0,0 @@
1
- import { t as e } from "./manifestBuild-sxpwdKY1.js";
2
- export { e as buildRpcEntry };