@feltdb/core 0.7.4 → 0.8.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 (106) hide show
  1. package/README.md +25 -0
  2. package/dist/application-development.d.ts +3 -1
  3. package/dist/application-development.d.ts.map +1 -1
  4. package/dist/application-development.js +16 -0
  5. package/dist/application-manifest.d.ts +1 -0
  6. package/dist/application-manifest.d.ts.map +1 -1
  7. package/dist/canonical-application.d.ts +1 -0
  8. package/dist/canonical-application.d.ts.map +1 -1
  9. package/dist/canonical-application.js +3 -2
  10. package/dist/cli/cli.js +1 -1
  11. package/dist/cli/commands.js +225 -42
  12. package/dist/cli/index.js +1 -1
  13. package/dist/cli/managed-environment.js +6 -0
  14. package/dist/cli/managed-project.js +6 -0
  15. package/dist/cli/proposal-client.js +12 -3
  16. package/dist/cli/publish-engine.js +7 -4
  17. package/dist/cli/source-sync.js +47 -3
  18. package/dist/create/cli.js +10 -1
  19. package/dist/create/create.js +10 -12
  20. package/dist/create/managed-account.js +71 -7
  21. package/dist/create/package-versions.js +1 -1
  22. package/dist/create/server-source/crates/feltdb/src/application.rs +10 -0
  23. package/dist/create/server-source/crates/feltdb/src/lib.rs +20 -2
  24. package/dist/create/server-source/crates/feltdb-server/src/app_state.rs +12 -24
  25. package/dist/create/server-source/crates/feltdb-server/src/application_contract.rs +11 -3
  26. package/dist/create/server-source/crates/feltdb-server/src/authenticated_principal.rs +0 -1
  27. package/dist/create/server-source/crates/feltdb-server/src/certification_harness.rs +23 -22
  28. package/dist/create/server-source/crates/feltdb-server/src/delegation_token.rs +5 -15
  29. package/dist/create/server-source/crates/feltdb-server/src/durable_operations.rs +13 -28
  30. package/dist/create/server-source/crates/feltdb-server/src/identity.rs +79 -14
  31. package/dist/create/server-source/crates/feltdb-server/src/key_management.rs +28 -7
  32. package/dist/create/server-source/crates/feltdb-server/src/lib.rs +5 -5
  33. package/dist/create/server-source/crates/feltdb-server/src/main.rs +1777 -259
  34. package/dist/create/server-source/crates/feltdb-server/src/managed_diagnostics.rs +10 -30
  35. package/dist/create/server-source/crates/feltdb-server/src/membership_policy.rs +12 -4
  36. package/dist/create/server-source/crates/feltdb-server/src/request_telemetry.rs +8 -6
  37. package/dist/create/server-source/crates/feltdb-server/src/snapshot_cursor.rs +10 -14
  38. package/dist/create/server-source/crates/feltdb-server/src/tenancy.rs +183 -21
  39. package/dist/create/server-source/crates/feltdb-server/src/tenant_policies.rs +9 -21
  40. package/dist/create/server-source/crates/feltdb-server/src/transaction_idempotency.rs +5 -3
  41. package/dist/create/server-source/crates/feltdb-server/src/transaction_recovery.rs +9 -8
  42. package/dist/create/server-source/crates/feltdb-server/tests/revision_recovery_integration_test.rs +1 -4
  43. package/dist/create/template/default-project/feltdb.flow +5 -0
  44. package/dist/flowspec.d.ts +1 -0
  45. package/dist/flowspec.d.ts.map +1 -1
  46. package/dist/flowspec.js +46 -12
  47. package/dist/http-client.d.ts +135 -14
  48. package/dist/http-client.d.ts.map +1 -1
  49. package/dist/http-client.js +79 -31
  50. package/dist/index-core.d.ts +2 -0
  51. package/dist/index-core.d.ts.map +1 -1
  52. package/dist/index-core.js +2 -0
  53. package/dist/module-intent.d.ts +37 -0
  54. package/dist/module-intent.d.ts.map +1 -0
  55. package/dist/module-intent.js +81 -0
  56. package/dist/module.d.ts +76 -0
  57. package/dist/module.d.ts.map +1 -0
  58. package/dist/module.js +61 -0
  59. package/dist/proposal.d.ts +80 -4
  60. package/dist/proposal.d.ts.map +1 -1
  61. package/dist/proposal.js +132 -5
  62. package/dist/studio/app.d.ts +3 -1
  63. package/dist/studio/app.d.ts.map +1 -1
  64. package/dist/studio/components/AskFeltDB.d.ts +2 -1
  65. package/dist/studio/components/AskFeltDB.d.ts.map +1 -1
  66. package/dist/studio/components/ContractInspector.d.ts +7 -0
  67. package/dist/studio/components/ContractInspector.d.ts.map +1 -0
  68. package/dist/studio/components/ManagedInstancePanel.d.ts.map +1 -1
  69. package/dist/studio/components/ManagedInstancePanel.js +1 -5
  70. package/dist/studio/components/ModuleExplorer.d.ts +6 -0
  71. package/dist/studio/components/ModuleExplorer.d.ts.map +1 -0
  72. package/dist/studio/components/ProposalBrowser.d.ts +10 -1
  73. package/dist/studio/components/ProposalBrowser.d.ts.map +1 -1
  74. package/dist/studio/components/StateExplorer.d.ts +6 -7
  75. package/dist/studio/components/StateExplorer.d.ts.map +1 -1
  76. package/dist/studio/components/index.d.ts +2 -0
  77. package/dist/studio/components/index.d.ts.map +1 -1
  78. package/dist/studio/components/index.js +4 -4
  79. package/dist/studio/components-CNSNrmA9.js +2787 -0
  80. package/dist/studio/index.js +193 -147
  81. package/dist/studio/studio.css +1 -1
  82. package/dist/studio/utils/index.d.ts +2 -0
  83. package/dist/studio/utils/index.d.ts.map +1 -1
  84. package/dist/studio/utils/index.js +14 -12
  85. package/dist/studio/utils/managed-instance.d.ts +0 -4
  86. package/dist/studio/utils/managed-instance.d.ts.map +1 -1
  87. package/dist/studio/utils/managed-instance.js +0 -4
  88. package/dist/studio/utils/proposal-api.d.ts +53 -0
  89. package/dist/studio/utils/proposal-api.d.ts.map +1 -0
  90. package/dist/studio/utils/proposal-api.js +91 -0
  91. package/dist/studio/utils/service-api.d.ts +81 -0
  92. package/dist/studio/utils/service-api.d.ts.map +1 -0
  93. package/dist/studio/utils/service-api.js +51 -0
  94. package/dist/studio-app/assets/{dist-DA1MYSzp.js → dist-CCOk39Uc.js} +1 -1
  95. package/dist/studio-app/assets/{feltdb_wasm-B-Ccgccb.js → feltdb_wasm-CSB6KVgw.js} +1 -1
  96. package/dist/studio-app/assets/feltdb_wasm_bg-Dd1fnO9U.wasm +0 -0
  97. package/dist/studio-app/assets/index-Bncji3aN.js +43 -0
  98. package/dist/studio-app/assets/{index-BRrmvaKw.css → index-yazaWMUN.css} +1 -1
  99. package/dist/studio-app/index.html +2 -2
  100. package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
  101. package/dist/workspace/local-development-authority.d.ts.map +1 -1
  102. package/dist/workspace/local-development-authority.js +64 -3
  103. package/package.json +1 -1
  104. package/dist/studio/components-Bm4sjhcX.js +0 -2162
  105. package/dist/studio-app/assets/feltdb_wasm_bg-wH3enJIA.wasm +0 -0
  106. package/dist/studio-app/assets/index-CEIqowCh.js +0 -42
@@ -1,2162 +0,0 @@
1
- import "./KeyManagementPanel-DZuSeWBK.js";
2
- import "./components/ManagedInstancePanel.js";
3
- import e, { useCallback as t, useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
4
- import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
5
- import { createFeltDB as l, diffFlowSpec as u, emptyFlowSpec as d, formatFlowSpec as f, parseFlowSpec as p, planFlowSpecMigration as m, validateFlowSpec as h } from "@feltdb/core";
6
- //#region src/components/OverviewDashboard.tsx
7
- function g({ stats: e }) {
8
- return e ? /* @__PURE__ */ c("div", {
9
- className: "overview-dashboard",
10
- children: [/* @__PURE__ */ c("div", {
11
- className: "dashboard-header",
12
- children: [/* @__PURE__ */ s("h1", { children: "FeltDB Studio" }), /* @__PURE__ */ s("div", {
13
- className: "namespace-badge",
14
- children: e.namespace
15
- })]
16
- }), /* @__PURE__ */ c("div", {
17
- className: "dashboard-grid",
18
- children: [
19
- /* @__PURE__ */ c("div", {
20
- className: "stat-card",
21
- children: [
22
- /* @__PURE__ */ s("label", { children: "Runtime" }),
23
- /* @__PURE__ */ s("div", {
24
- className: `status-indicator ${e.status}`,
25
- children: "●"
26
- }),
27
- /* @__PURE__ */ s("span", { children: e.status.charAt(0).toUpperCase() + e.status.slice(1) })
28
- ]
29
- }),
30
- /* @__PURE__ */ c("div", {
31
- className: "stat-card",
32
- children: [/* @__PURE__ */ s("label", { children: "Storage" }), /* @__PURE__ */ c("span", { children: [
33
- e.persistence,
34
- " / ",
35
- e.storageBackend
36
- ] })]
37
- }),
38
- /* @__PURE__ */ c("div", {
39
- className: "stat-card",
40
- children: [/* @__PURE__ */ s("label", { children: "Peers" }), /* @__PURE__ */ s("span", {
41
- className: "stat-number",
42
- children: e.peersCount
43
- })]
44
- }),
45
- /* @__PURE__ */ c("div", {
46
- className: "stat-card",
47
- children: [/* @__PURE__ */ s("label", { children: "Objects" }), /* @__PURE__ */ s("span", {
48
- className: "stat-number",
49
- children: e.objectsCount
50
- })]
51
- }),
52
- /* @__PURE__ */ c("div", {
53
- className: "stat-card",
54
- children: [/* @__PURE__ */ s("label", { children: "Operations" }), /* @__PURE__ */ s("span", {
55
- className: "stat-number",
56
- children: e.operationsCount
57
- })]
58
- }),
59
- /* @__PURE__ */ c("div", {
60
- className: "stat-card",
61
- children: [/* @__PURE__ */ s("label", { children: "Capabilities" }), /* @__PURE__ */ s("span", {
62
- className: "stat-number",
63
- children: e.capabilitiesCount
64
- })]
65
- }),
66
- /* @__PURE__ */ c("div", {
67
- className: "stat-card",
68
- children: [/* @__PURE__ */ s("label", { children: "Executions" }), /* @__PURE__ */ s("span", {
69
- className: "stat-number",
70
- children: e.executionsCount
71
- })]
72
- }),
73
- /* @__PURE__ */ c("div", {
74
- className: "stat-card",
75
- children: [/* @__PURE__ */ s("label", { children: "Workflows" }), /* @__PURE__ */ s("span", {
76
- className: "stat-number",
77
- children: e.workflowsCount
78
- })]
79
- }),
80
- /* @__PURE__ */ c("div", {
81
- className: "stat-card",
82
- children: [/* @__PURE__ */ s("label", { children: "Agents" }), /* @__PURE__ */ s("span", {
83
- className: "stat-number",
84
- children: e.agentsCount
85
- })]
86
- }),
87
- /* @__PURE__ */ c("div", {
88
- className: "stat-card",
89
- children: [/* @__PURE__ */ s("label", { children: "Conflicts" }), /* @__PURE__ */ s("span", {
90
- className: "stat-number",
91
- children: e.conflictsCount
92
- })]
93
- })
94
- ]
95
- })]
96
- }) : /* @__PURE__ */ s("div", {
97
- className: "overview-dashboard loading",
98
- children: /* @__PURE__ */ s("p", { children: "Loading runtime information..." })
99
- });
100
- }
101
- //#endregion
102
- //#region src/hooks/index.ts
103
- function _(e, t = "default") {
104
- let [r, i] = a(null);
105
- return n(() => {
106
- if (!e) {
107
- i(null);
108
- return;
109
- }
110
- let n = e.runtime(), r = n.runtime === "browser" ? "browser" : n.runtime === "node" ? "self-hosted" : "remote";
111
- i({
112
- db: e,
113
- connected: !0,
114
- namespace: t,
115
- instanceId: e.instanceId?.() || "unknown",
116
- environment: r
117
- });
118
- }, [e, t]), r;
119
- }
120
- function v(e, t = null, r = "default") {
121
- let [i, o] = a(null);
122
- return n(() => {
123
- if (!e) {
124
- o(null);
125
- return;
126
- }
127
- let n = async () => {
128
- try {
129
- let n = e.runtime(), i = e.health(), a = e.sync?.(), s = t ? await Promise.all(t.collections.map((t) => e.collection(t.name).count())) : [];
130
- o({
131
- namespace: r,
132
- status: i?.status || "healthy",
133
- storageBackend: n.storage,
134
- persistence: n.persistent ? "durable" : "volatile",
135
- peersCount: a?.connected_peers?.length || 0,
136
- objectsCount: s.reduce((e, t) => e + t, 0),
137
- operationsCount: a?.sequence || 0,
138
- capabilitiesCount: t?.capabilities.length || 0,
139
- executionsCount: await e.collection("_flow_executions").count() || await e.collection("Decision").count(),
140
- workflowsCount: t?.workflows.length || 0,
141
- agentsCount: t?.agents.length || 0,
142
- conflictsCount: a?.conflicts_detected || 0
143
- });
144
- } catch (e) {
145
- console.error("Failed to fetch dashboard stats:", e);
146
- }
147
- };
148
- n();
149
- let i = setInterval(n, 5e3);
150
- return () => clearInterval(i);
151
- }, [
152
- e,
153
- t,
154
- r
155
- ]), i;
156
- }
157
- function y(e) {
158
- let [r, i] = a(null), [o, s] = a(!1), [c, l] = a(null), u = t(async () => {
159
- if (e) {
160
- s(!0), l(null);
161
- try {
162
- let t = e.health();
163
- i(t);
164
- } catch (e) {
165
- l(e instanceof Error ? e.message : "Failed to fetch diagnostics");
166
- } finally {
167
- s(!1);
168
- }
169
- }
170
- }, [e]);
171
- return n(() => {
172
- u();
173
- }, [e, u]), {
174
- diagnostics: r,
175
- loading: o,
176
- error: c,
177
- refresh: u
178
- };
179
- }
180
- function b(e, t) {
181
- let [r, i] = a([]), [o, s] = a(!0), [c, l] = a(null);
182
- return n(() => {
183
- if (e) {
184
- s(!0), l(null);
185
- try {
186
- let n = e.collection(t).subscribe((e) => {
187
- i(e), s(!1);
188
- });
189
- return () => n();
190
- } catch (e) {
191
- l(e instanceof Error ? e.message : "Failed to load collection"), s(!1);
192
- }
193
- }
194
- }, [e, t]), {
195
- items: r,
196
- loading: o,
197
- error: c
198
- };
199
- }
200
- function x(e) {
201
- let [t, r] = a([]);
202
- return n(() => {
203
- if (!e) {
204
- r([]);
205
- return;
206
- }
207
- let t = () => {
208
- try {
209
- let t = e.sync?.();
210
- r(t?.connected_peers || []);
211
- } catch (e) {
212
- console.error("Failed to fetch peers:", e);
213
- }
214
- };
215
- t();
216
- let n = setInterval(t, 2e3);
217
- return () => clearInterval(n);
218
- }, [e]), t;
219
- }
220
- function S(e, t) {
221
- let [r, i] = a(null), [o, s] = a(!1), [c, l] = a(null);
222
- return n(() => {
223
- if (!e || !t) {
224
- i(null);
225
- return;
226
- }
227
- s(!0), l(null), (async () => {
228
- try {
229
- let n = e.provenance(t);
230
- i(n);
231
- } catch (e) {
232
- l(e instanceof Error ? e.message : "Failed to fetch provenance");
233
- } finally {
234
- s(!1);
235
- }
236
- })();
237
- }, [e, t]), {
238
- provenance: r,
239
- loading: o,
240
- error: c
241
- };
242
- }
243
- //#endregion
244
- //#region src/components/StateExplorer.tsx
245
- function C({ db: e, definition: t, namespace: n, bridgedItems: r }) {
246
- let { items: i, loading: o, error: l } = b(e, t.name), u = r ?? i, [d, f] = a(null);
247
- return /* @__PURE__ */ c("article", {
248
- className: "state-collection studio-card",
249
- children: [
250
- /* @__PURE__ */ c("header", { children: [/* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("span", {
251
- className: "card-kind",
252
- children: "collection"
253
- }), /* @__PURE__ */ s("h2", { children: t.name })] }), /* @__PURE__ */ s("strong", { children: r ? r.length : o ? "…" : i.length })] }),
254
- l && /* @__PURE__ */ s("p", {
255
- className: "runtime-error",
256
- children: l
257
- }),
258
- (!o || r) && !u.length && /* @__PURE__ */ s("div", {
259
- className: "model-empty compact",
260
- children: "No records yet. Mutations will appear here live."
261
- }),
262
- u.map((e, r) => {
263
- let i = String(e.id ?? e.key ?? r);
264
- return /* @__PURE__ */ c("button", {
265
- className: "state-row",
266
- onClick: () => f(d === r ? null : r),
267
- children: [
268
- /* @__PURE__ */ c("span", { children: [/* @__PURE__ */ s("b", { children: i }), /* @__PURE__ */ c("small", { children: [
269
- "flow://",
270
- n,
271
- "/",
272
- t.name,
273
- "/",
274
- i
275
- ] })] }),
276
- /* @__PURE__ */ s("span", { children: d === r ? "−" : "+" }),
277
- d === r && /* @__PURE__ */ s("pre", { children: JSON.stringify(e, null, 2) })
278
- ]
279
- }, i);
280
- })
281
- ]
282
- });
283
- }
284
- function w({ db: e, model: t, namespace: r = "default", applicationUrl: o = "", developmentSession: l }) {
285
- let u = i(null), [d, f] = a(null);
286
- return n(() => {
287
- if (!o) return;
288
- let e = new URL(o).origin, t = () => {
289
- l?.sessionId && u.current?.contentWindow?.postMessage({
290
- type: "feltdb:dev-session",
291
- session: l
292
- }, e), u.current?.contentWindow?.postMessage({
293
- type: "feltdb:studio:read",
294
- requestId: "live"
295
- }, e);
296
- }, n = (n) => {
297
- n.origin === e && (n.data?.type === "feltdb:studio:ready" && t(), n.data?.type === "feltdb:studio:data" && f(n.data.records));
298
- };
299
- window.addEventListener("message", n);
300
- let r = window.setInterval(t, 1500);
301
- return () => {
302
- window.removeEventListener("message", n), window.clearInterval(r);
303
- };
304
- }, [o, l]), /* @__PURE__ */ c("div", {
305
- className: "studio-model-page",
306
- children: [
307
- /* @__PURE__ */ c("header", { children: [
308
- /* @__PURE__ */ s("span", {
309
- className: "eyebrow",
310
- children: "Observe"
311
- }),
312
- /* @__PURE__ */ s("h1", { children: "Data" }),
313
- /* @__PURE__ */ s("p", { children: "Live application records grouped by collection. Select a record to inspect every field." })
314
- ] }),
315
- o && /* @__PURE__ */ s("iframe", {
316
- ref: u,
317
- className: "studio-data-bridge",
318
- src: o,
319
- title: "FeltDB application data bridge",
320
- onLoad: () => {
321
- let e = new URL(o).origin;
322
- l?.sessionId && u.current?.contentWindow?.postMessage({
323
- type: "feltdb:dev-session",
324
- session: l
325
- }, e), u.current?.contentWindow?.postMessage({
326
- type: "feltdb:studio:read",
327
- requestId: "initial"
328
- }, e);
329
- }
330
- }),
331
- /* @__PURE__ */ c("div", {
332
- className: "model-summary",
333
- children: [
334
- /* @__PURE__ */ c("span", { children: [t?.collections.length ?? 0, " collections"] }),
335
- /* @__PURE__ */ c("span", { children: [r, " namespace"] }),
336
- /* @__PURE__ */ s("span", { children: e ? "runtime connected" : "runtime unavailable" })
337
- ]
338
- }),
339
- /* @__PURE__ */ c("div", {
340
- className: "state-grid",
341
- children: [t?.collections.map((t) => /* @__PURE__ */ s(C, {
342
- db: e ?? null,
343
- definition: t,
344
- namespace: r,
345
- bridgedItems: d?.[t.name]
346
- }, t.name)), !t?.collections.length && /* @__PURE__ */ c("div", {
347
- className: "model-empty",
348
- children: [
349
- "No collection model is loaded. Open Studio through ",
350
- /* @__PURE__ */ s("code", { children: "feltdb dev" }),
351
- " to load the active project."
352
- ]
353
- })]
354
- })
355
- ]
356
- });
357
- }
358
- //#endregion
359
- //#region src/components/ReferenceExplorer.tsx
360
- function T(e) {
361
- let t = e.trim().replace(/^flow:\/\//, "").split("/").filter(Boolean);
362
- return e.startsWith("flow://") ? t.length >= 3 ? {
363
- collection: t[t.length - 2],
364
- id: t[t.length - 1]
365
- } : null : t.length >= 2 ? {
366
- collection: t[t.length - 2],
367
- id: t[t.length - 1]
368
- } : null;
369
- }
370
- function E({ db: e, model: t, namespace: n = "default" }) {
371
- let [r, i] = a(""), [o, l] = a(), [u, d] = a("Enter a reference to resolve live state."), f = async () => {
372
- let t = T(r);
373
- if (!t || !e) {
374
- l(void 0), d(e ? "Use Collection/id or flow://namespace/Collection/id." : "Runtime unavailable.");
375
- return;
376
- }
377
- let n = await e.collection(t.collection).get(t.id);
378
- l(n), d(n ? "Materialized locally" : "Reference is valid but is not materialized locally");
379
- };
380
- return /* @__PURE__ */ c("div", {
381
- className: "studio-model-page",
382
- children: [
383
- /* @__PURE__ */ c("header", { children: [
384
- /* @__PURE__ */ s("span", {
385
- className: "eyebrow",
386
- children: "Observe"
387
- }),
388
- /* @__PURE__ */ s("h1", { children: "References" }),
389
- /* @__PURE__ */ s("p", { children: "Resolve stable Flow references directly into their materialized state." })
390
- ] }),
391
- /* @__PURE__ */ c("div", {
392
- className: "reference-query",
393
- children: [/* @__PURE__ */ s("input", {
394
- value: r,
395
- onChange: (e) => i(e.target.value),
396
- onKeyDown: (e) => {
397
- e.key === "Enter" && f();
398
- },
399
- placeholder: `flow://${n}/Collection/id`
400
- }), /* @__PURE__ */ s("button", {
401
- onClick: () => void f(),
402
- children: "Resolve"
403
- })]
404
- }),
405
- /* @__PURE__ */ c("div", {
406
- className: "reference-layout",
407
- children: [/* @__PURE__ */ c("article", {
408
- className: "studio-card",
409
- children: [/* @__PURE__ */ s("span", {
410
- className: "card-kind",
411
- children: "Known collections"
412
- }), t?.collections.map((e) => /* @__PURE__ */ c("button", {
413
- className: "reference-example",
414
- onClick: () => i(`flow://${n}/${e.name}/id`),
415
- children: [e.name, /* @__PURE__ */ c("small", { children: [e.fields.length, " fields"] })]
416
- }, e.name))]
417
- }), /* @__PURE__ */ c("article", {
418
- className: "studio-card reference-result",
419
- children: [
420
- /* @__PURE__ */ s("span", {
421
- className: "card-kind",
422
- children: "Resolution"
423
- }),
424
- /* @__PURE__ */ s("h2", { children: u }),
425
- o !== void 0 && /* @__PURE__ */ s("pre", { children: JSON.stringify(o, null, 2) })
426
- ]
427
- })]
428
- })
429
- ]
430
- });
431
- }
432
- //#endregion
433
- //#region src/components/OperationsExplorer.tsx
434
- function D({ db: e, namespace: t = "default" }) {
435
- let [r, i] = a([]), [o, l] = a("all");
436
- n(() => {
437
- if (!e) return;
438
- let t = !0, n = async () => {
439
- let n = await e.auditEvents();
440
- t && i(n.slice().reverse());
441
- };
442
- n();
443
- let r = setInterval(() => void n(), 1e3);
444
- return () => {
445
- t = !1, clearInterval(r);
446
- };
447
- }, [e]);
448
- let u = r.filter((e) => o === "all" || e.type === o);
449
- return /* @__PURE__ */ c("div", {
450
- className: "studio-model-page",
451
- children: [
452
- /* @__PURE__ */ c("header", { children: [
453
- /* @__PURE__ */ s("span", {
454
- className: "eyebrow",
455
- children: "Observe"
456
- }),
457
- /* @__PURE__ */ s("h1", { children: "Operations" }),
458
- /* @__PURE__ */ s("p", { children: "The runtime's durable local mutation log—not a simulated activity feed." })
459
- ] }),
460
- /* @__PURE__ */ c("div", {
461
- className: "model-summary",
462
- children: [
463
- /* @__PURE__ */ c("span", { children: [r.length, " recorded"] }),
464
- /* @__PURE__ */ c("span", { children: [t, " namespace"] }),
465
- /* @__PURE__ */ c("select", {
466
- value: o,
467
- onChange: (e) => l(e.target.value),
468
- children: [
469
- /* @__PURE__ */ s("option", {
470
- value: "all",
471
- children: "All mutations"
472
- }),
473
- /* @__PURE__ */ s("option", {
474
- value: "put",
475
- children: "Writes"
476
- }),
477
- /* @__PURE__ */ s("option", {
478
- value: "delete",
479
- children: "Deletes"
480
- })
481
- ]
482
- })
483
- ]
484
- }),
485
- /* @__PURE__ */ s("div", {
486
- className: "table-shell",
487
- children: /* @__PURE__ */ c("table", {
488
- className: "operations-table",
489
- children: [/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ c("tr", { children: [
490
- /* @__PURE__ */ s("th", { children: "Sequence" }),
491
- /* @__PURE__ */ s("th", { children: "Mutation" }),
492
- /* @__PURE__ */ s("th", { children: "Collection" }),
493
- /* @__PURE__ */ s("th", { children: "Key" }),
494
- /* @__PURE__ */ s("th", { children: "Timestamp" })
495
- ] }) }), /* @__PURE__ */ c("tbody", { children: [u.map((e) => /* @__PURE__ */ c("tr", { children: [
496
- /* @__PURE__ */ s("td", { children: e.sequence }),
497
- /* @__PURE__ */ s("td", { children: /* @__PURE__ */ s("span", {
498
- className: `event-pill ${e.type}`,
499
- children: e.type
500
- }) }),
501
- /* @__PURE__ */ s("td", { children: e.collection }),
502
- /* @__PURE__ */ s("td", { children: /* @__PURE__ */ s("code", { children: e.key }) }),
503
- /* @__PURE__ */ s("td", { children: new Date(e.timestamp).toLocaleString() })
504
- ] }, `${e.sequence}-${e.key}`)), !u.length && /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s("td", {
505
- colSpan: 5,
506
- className: "empty-message",
507
- children: "No matching mutations yet. Create or change application state to populate this stream."
508
- }) })] })]
509
- })
510
- })
511
- ]
512
- });
513
- }
514
- //#endregion
515
- //#region src/components/PeerMap.tsx
516
- function O({ peers: t = [], localInstance: n = "local" }) {
517
- return /* @__PURE__ */ c("div", {
518
- className: "studio-model-page",
519
- children: [
520
- /* @__PURE__ */ c("header", { children: [
521
- /* @__PURE__ */ s("span", {
522
- className: "eyebrow",
523
- children: "Observe"
524
- }),
525
- /* @__PURE__ */ s("h1", { children: "Peers" }),
526
- /* @__PURE__ */ s("p", { children: "The live topology participating in this application's convergence fabric." })
527
- ] }),
528
- /* @__PURE__ */ c("div", {
529
- className: "peer-topology",
530
- children: [/* @__PURE__ */ c("article", {
531
- className: "peer-node local",
532
- children: [
533
- /* @__PURE__ */ s("span", { children: "this instance" }),
534
- /* @__PURE__ */ s("h2", { children: n }),
535
- /* @__PURE__ */ s("small", { children: "online · authoritative local state" })
536
- ]
537
- }), t.map((t) => /* @__PURE__ */ c(e.Fragment, { children: [/* @__PURE__ */ s("i", { className: "peer-link" }), /* @__PURE__ */ c("article", {
538
- className: "peer-node",
539
- children: [
540
- /* @__PURE__ */ s("span", { children: "connected peer" }),
541
- /* @__PURE__ */ s("h2", { children: t }),
542
- /* @__PURE__ */ s("small", { children: "online · exchanging operations" })
543
- ]
544
- })] }, t))]
545
- }),
546
- !t.length && /* @__PURE__ */ s("div", {
547
- className: "model-empty",
548
- children: "This embedded runtime is operating independently. Its state remains durable and can converge when a network peer is attached."
549
- })
550
- ]
551
- });
552
- }
553
- //#endregion
554
- //#region src/components/CapabilityExplorer.tsx
555
- function k({ model: e }) {
556
- let t = e?.capabilities ?? [];
557
- return /* @__PURE__ */ c("div", {
558
- className: "studio-model-page",
559
- children: [
560
- /* @__PURE__ */ c("header", { children: [
561
- /* @__PURE__ */ s("span", {
562
- className: "eyebrow",
563
- children: "Design"
564
- }),
565
- /* @__PURE__ */ s("h1", { children: "Capabilities" }),
566
- /* @__PURE__ */ c("p", { children: [
567
- "Declared authority available to workflows and autonomous agents in ",
568
- e?.app ?? "this application",
569
- "."
570
- ] })
571
- ] }),
572
- /* @__PURE__ */ c("div", {
573
- className: "model-summary",
574
- children: [/* @__PURE__ */ c("span", { children: [t.length, " declared"] }), /* @__PURE__ */ c("span", { children: [new Set(t.flatMap((e) => e.statements)).size, " permission rules"] })]
575
- }),
576
- /* @__PURE__ */ c("div", {
577
- className: "studio-card-grid",
578
- children: [t.map((e) => /* @__PURE__ */ c("article", {
579
- className: "studio-card capability-card",
580
- children: [
581
- /* @__PURE__ */ s("div", {
582
- className: "card-kind",
583
- children: "capability"
584
- }),
585
- /* @__PURE__ */ s("h2", { children: e.name }),
586
- /* @__PURE__ */ s("div", {
587
- className: "statement-list",
588
- children: e.statements.map((e) => {
589
- let [t, ...n] = e.split(" ");
590
- return /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("b", { children: t }), /* @__PURE__ */ s("code", { children: n.join(" ") })] }, e);
591
- })
592
- })
593
- ]
594
- }, e.name)), !t.length && /* @__PURE__ */ s("div", {
595
- className: "model-empty",
596
- children: "No capabilities are declared in the current project model."
597
- })]
598
- })
599
- ]
600
- });
601
- }
602
- //#endregion
603
- //#region src/components/ExecutionViewer.tsx
604
- function A({ db: e, name: t, label: n }) {
605
- let { items: r } = b(e, t);
606
- return r.length ? /* @__PURE__ */ c("section", { children: [/* @__PURE__ */ c("h2", { children: [n, /* @__PURE__ */ s("span", { children: r.length })] }), /* @__PURE__ */ s("div", {
607
- className: "execution-list",
608
- children: r.map((e, r) => /* @__PURE__ */ c("article", {
609
- className: "execution-row",
610
- children: [
611
- /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("b", { children: String(e.name ?? e.workflow ?? e.incident_id ?? e.id ?? n) }), /* @__PURE__ */ s("small", { children: t })] }),
612
- /* @__PURE__ */ s("span", {
613
- className: "event-pill put",
614
- children: String(e.status ?? e.state ?? "materialized")
615
- }),
616
- /* @__PURE__ */ s("pre", { children: JSON.stringify(e, null, 2) })
617
- ]
618
- }, String(e.id ?? r)))
619
- })] }) : null;
620
- }
621
- function j({ db: e, model: t }) {
622
- return /* @__PURE__ */ c("div", {
623
- className: "studio-model-page",
624
- children: [
625
- /* @__PURE__ */ c("header", { children: [
626
- /* @__PURE__ */ s("span", {
627
- className: "eyebrow",
628
- children: "Observe"
629
- }),
630
- /* @__PURE__ */ s("h1", { children: "Executions" }),
631
- /* @__PURE__ */ s("p", { children: "Capability work, workflow runs, assignments, and agent decisions as inspectable state." })
632
- ] }),
633
- /* @__PURE__ */ c("div", {
634
- className: "model-summary",
635
- children: [/* @__PURE__ */ c("span", { children: [t?.workflows.length ?? 0, " workflow definitions"] }), /* @__PURE__ */ c("span", { children: [t?.agents.length ?? 0, " autonomous agents"] })]
636
- }),
637
- /* @__PURE__ */ s(A, {
638
- db: e ?? null,
639
- name: "_flow_executions",
640
- label: "Capability executions"
641
- }),
642
- /* @__PURE__ */ s(A, {
643
- db: e ?? null,
644
- name: "_flow_workflow_runs",
645
- label: "Workflow runs"
646
- }),
647
- /* @__PURE__ */ s(A, {
648
- db: e ?? null,
649
- name: "Assignment",
650
- label: "Materialized assignments"
651
- }),
652
- /* @__PURE__ */ s(A, {
653
- db: e ?? null,
654
- name: "Decision",
655
- label: "Agent decisions"
656
- }),
657
- /* @__PURE__ */ s(A, {
658
- db: e ?? null,
659
- name: "_flow_agent_executions",
660
- label: "Agent executions"
661
- }),
662
- /* @__PURE__ */ c("div", {
663
- className: "model-empty execution-empty",
664
- children: [
665
- "Execution sections appear as soon as their state is committed. Defined workflows: ",
666
- t?.workflows.map((e) => e.name).join(", ") || "none",
667
- "."
668
- ]
669
- })
670
- ]
671
- });
672
- }
673
- //#endregion
674
- //#region src/components/ConflictExplorer.tsx
675
- function M({ db: e, diagnostics: t }) {
676
- let n = (() => {
677
- try {
678
- return e?.sync();
679
- } catch {
680
- return;
681
- }
682
- })(), r = n?.conflicts_detected ?? 0;
683
- return /* @__PURE__ */ c("div", {
684
- className: "studio-model-page",
685
- children: [
686
- /* @__PURE__ */ c("header", { children: [
687
- /* @__PURE__ */ s("span", {
688
- className: "eyebrow",
689
- children: "Observe"
690
- }),
691
- /* @__PURE__ */ s("h1", { children: "Conflicts" }),
692
- /* @__PURE__ */ s("p", { children: "Concurrent mutations detected while replicas converge." })
693
- ] }),
694
- /* @__PURE__ */ c("div", {
695
- className: "metric-grid",
696
- children: [
697
- /* @__PURE__ */ c("article", { children: [/* @__PURE__ */ s("b", { children: r }), /* @__PURE__ */ s("span", { children: "detected" })] }),
698
- /* @__PURE__ */ c("article", { children: [/* @__PURE__ */ s("b", { children: n?.pending_operations ?? 0 }), /* @__PURE__ */ s("span", { children: "pending operations" })] }),
699
- /* @__PURE__ */ c("article", { children: [/* @__PURE__ */ s("b", { children: n?.connected_peers.length ?? 0 }), /* @__PURE__ */ s("span", { children: "connected peers" })] })
700
- ]
701
- }),
702
- /* @__PURE__ */ c("article", {
703
- className: "studio-card",
704
- children: [
705
- /* @__PURE__ */ s("span", {
706
- className: "card-kind",
707
- children: "Convergence"
708
- }),
709
- /* @__PURE__ */ s("h2", { children: r ? "Conflict activity detected" : "No conflicts detected" }),
710
- /* @__PURE__ */ s("p", { children: t?.sync.connected ? "The fabric is connected and applying causal ordering." : "The local replica is independent; conflict detection begins when operations converge with peers." }),
711
- /* @__PURE__ */ s("code", { children: "Causal ordering → deterministic materialization → auditable resolution" })
712
- ]
713
- })
714
- ]
715
- });
716
- }
717
- //#endregion
718
- //#region src/components/WorkflowVisualizer.tsx
719
- function N({ model: t }) {
720
- let n = t?.workflows ?? [], [r, i] = a(), l = n.find((e) => e.name === r) ?? n[0];
721
- return /* @__PURE__ */ c("div", {
722
- className: "studio-model-page",
723
- children: [/* @__PURE__ */ c("header", { children: [
724
- /* @__PURE__ */ s("span", {
725
- className: "eyebrow",
726
- children: "Design"
727
- }),
728
- /* @__PURE__ */ s("h1", { children: "Workflows" }),
729
- /* @__PURE__ */ s("p", { children: "Durable state transitions declared by the application model." })
730
- ] }), /* @__PURE__ */ c("div", {
731
- className: "split-browser",
732
- children: [/* @__PURE__ */ s("aside", { children: n.map((e) => /* @__PURE__ */ c("button", {
733
- className: e.name === l?.name ? "active" : "",
734
- onClick: () => i(e.name),
735
- children: [/* @__PURE__ */ s("strong", { children: e.name }), /* @__PURE__ */ c("span", { children: [e.steps.length, " steps"] })]
736
- }, e.name)) }), /* @__PURE__ */ s("section", { children: l ? /* @__PURE__ */ c(o, { children: [
737
- /* @__PURE__ */ s("div", {
738
- className: "card-kind",
739
- children: "workflow"
740
- }),
741
- /* @__PURE__ */ s("h2", { children: l.name }),
742
- l.parameters.length > 0 && /* @__PURE__ */ c("code", {
743
- className: "signature",
744
- children: [
745
- "(",
746
- l.parameters,
747
- ")"
748
- ]
749
- }),
750
- /* @__PURE__ */ s("div", {
751
- className: "workflow-track",
752
- children: l.steps.map((t, n) => /* @__PURE__ */ c(e.Fragment, { children: [/* @__PURE__ */ c("article", { children: [/* @__PURE__ */ s("span", { children: n + 1 }), /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("strong", { children: t.name }), t.statements.map((e) => /* @__PURE__ */ s("code", { children: e }, e))] })] }), n < l.steps.length - 1 && /* @__PURE__ */ s("i", { children: "→" })] }, t.name))
753
- })
754
- ] }) : /* @__PURE__ */ s("div", {
755
- className: "model-empty",
756
- children: "No workflows are declared."
757
- }) })]
758
- })]
759
- });
760
- }
761
- //#endregion
762
- //#region src/components/AgentExplorer.tsx
763
- function P({ model: e }) {
764
- let t = e?.agents ?? [], [n, r] = a(), i = t.find((e) => e.name === n) ?? t[0];
765
- return /* @__PURE__ */ c("div", {
766
- className: "studio-model-page",
767
- children: [/* @__PURE__ */ c("header", { children: [
768
- /* @__PURE__ */ s("span", {
769
- className: "eyebrow",
770
- children: "Design"
771
- }),
772
- /* @__PURE__ */ s("h1", { children: "Agents" }),
773
- /* @__PURE__ */ s("p", { children: "Autonomous participants whose authority and workflows are part of the model." })
774
- ] }), /* @__PURE__ */ c("div", {
775
- className: "split-browser",
776
- children: [/* @__PURE__ */ s("aside", { children: t.map((e) => /* @__PURE__ */ c("button", {
777
- className: e.name === i?.name ? "active" : "",
778
- onClick: () => r(e.name),
779
- children: [/* @__PURE__ */ s("strong", { children: e.name }), /* @__PURE__ */ c("span", { children: [e.statements.length, " bindings"] })]
780
- }, e.name)) }), /* @__PURE__ */ s("section", { children: i ? /* @__PURE__ */ s(o, { children: /* @__PURE__ */ c("div", {
781
- className: "agent-orbit",
782
- children: [/* @__PURE__ */ c("div", {
783
- className: "agent-core",
784
- children: [/* @__PURE__ */ s("span", { children: "agent" }), /* @__PURE__ */ s("strong", { children: i.name })]
785
- }), i.statements.map((e) => /* @__PURE__ */ c("div", {
786
- className: "agent-binding",
787
- children: [/* @__PURE__ */ s("span", { children: e.split(" ")[0] }), /* @__PURE__ */ s("strong", { children: e.split(" ").slice(1).join(" ") })]
788
- }, e))]
789
- }) }) : /* @__PURE__ */ s("div", {
790
- className: "model-empty",
791
- children: "No agents are declared."
792
- }) })]
793
- })]
794
- });
795
- }
796
- //#endregion
797
- //#region src/components/ProvenanceViewer.tsx
798
- function F({ db: e, namespace: t = "default", reference: r }) {
799
- let [i, l] = a(r ?? ""), [u, d] = a(null), [f, p] = a([]), [m, h] = a("Enter a Flow reference to trace it.");
800
- n(() => {
801
- r && l(r);
802
- }, [r]);
803
- let g = async () => {
804
- if (!(!e || !i)) try {
805
- let t = e.provenance(i);
806
- d(t), h("Causal graph resolved");
807
- } catch {
808
- d(null);
809
- let t = await e.auditEvents(), n = i.split("/"), r = n[n.length - 1] ?? "", a = t.filter((e) => e.key.includes(r));
810
- p(a), h(a.length ? "Local mutation lineage" : "No local lineage found for this reference");
811
- }
812
- };
813
- return /* @__PURE__ */ c("div", {
814
- className: "studio-model-page",
815
- children: [
816
- /* @__PURE__ */ c("header", { children: [
817
- /* @__PURE__ */ s("span", {
818
- className: "eyebrow",
819
- children: "Observe"
820
- }),
821
- /* @__PURE__ */ s("h1", { children: "Provenance" }),
822
- /* @__PURE__ */ s("p", { children: "Follow why state exists—from durable mutations to causal workflow and agent edges." })
823
- ] }),
824
- /* @__PURE__ */ c("div", {
825
- className: "reference-query",
826
- children: [/* @__PURE__ */ s("input", {
827
- value: i,
828
- onChange: (e) => l(e.target.value),
829
- placeholder: `flow://${t}/Collection/id`
830
- }), /* @__PURE__ */ s("button", {
831
- onClick: () => void g(),
832
- children: "Trace"
833
- })]
834
- }),
835
- /* @__PURE__ */ c("article", {
836
- className: "studio-card provenance-result",
837
- children: [
838
- /* @__PURE__ */ s("span", {
839
- className: "card-kind",
840
- children: "Lineage"
841
- }),
842
- /* @__PURE__ */ s("h2", { children: m }),
843
- u && /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ c("div", {
844
- className: "model-summary",
845
- children: [/* @__PURE__ */ c("span", { children: [u.nodes.length, " nodes"] }), /* @__PURE__ */ c("span", { children: [u.edges.length, " edges"] })]
846
- }), /* @__PURE__ */ s("div", {
847
- className: "provenance-nodes",
848
- children: u.nodes.map((e) => /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("b", { children: e.label }), /* @__PURE__ */ s("small", { children: e.type })] }, e.id))
849
- })] }),
850
- !u && f.map((e) => /* @__PURE__ */ c("div", {
851
- className: "provenance-event",
852
- children: [
853
- /* @__PURE__ */ s("span", { children: e.sequence }),
854
- /* @__PURE__ */ c("b", { children: [
855
- e.type,
856
- " ",
857
- e.collection
858
- ] }),
859
- /* @__PURE__ */ s("code", { children: e.key }),
860
- /* @__PURE__ */ s("small", { children: new Date(e.timestamp).toLocaleString() })
861
- ]
862
- }, `${e.sequence}-${e.key}`))
863
- ]
864
- })
865
- ]
866
- });
867
- }
868
- //#endregion
869
- //#region src/components/HealthCenter.tsx
870
- function I({ diagnostics: e, model: t }) {
871
- let n = e ? [
872
- [
873
- "Runtime",
874
- e.runtime.status,
875
- e.runtime.reactive ? "reactive" : "non-reactive"
876
- ],
877
- [
878
- "Storage",
879
- e.storage.status,
880
- `${e.storage.backend} · ${e.storage.persistent ? "persistent" : "volatile"}`
881
- ],
882
- [
883
- "Synchronization",
884
- e.sync.status,
885
- `${e.sync.peers} peers · ${e.sync.pendingOperations} pending`
886
- ],
887
- [
888
- "Fabric",
889
- e.fabric.status,
890
- `${e.fabric.references} references`
891
- ],
892
- [
893
- "Capabilities",
894
- e.capabilities.status,
895
- `${e.capabilities.available}/${e.capabilities.count} available`
896
- ],
897
- [
898
- "Execution",
899
- e.execution.status,
900
- `${e.execution.running} running · ${e.execution.failed} failed`
901
- ],
902
- [
903
- "Workflows",
904
- e.workflow.status,
905
- `${e.workflow.active}/${e.workflow.total} active`
906
- ]
907
- ] : [];
908
- return /* @__PURE__ */ c("div", {
909
- className: "studio-model-page",
910
- children: [
911
- /* @__PURE__ */ c("header", { children: [
912
- /* @__PURE__ */ s("span", {
913
- className: "eyebrow",
914
- children: "Observe"
915
- }),
916
- /* @__PURE__ */ s("h1", { children: "Health" }),
917
- /* @__PURE__ */ s("p", { children: "Runtime diagnostics, not optimistic defaults." })
918
- ] }),
919
- /* @__PURE__ */ s("div", {
920
- className: "health-grid",
921
- children: n.map(([e, t, n]) => /* @__PURE__ */ c("article", {
922
- className: `health-item status-${t}`,
923
- children: [/* @__PURE__ */ s("span", {
924
- className: "status-icon",
925
- children: t === "healthy" ? "✓" : "!"
926
- }), /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("b", { children: e }), /* @__PURE__ */ s("small", { children: n })] })]
927
- }, e))
928
- }),
929
- !e && /* @__PURE__ */ s("div", {
930
- className: "model-empty",
931
- children: "Diagnostics are unavailable until Studio connects to a runtime."
932
- }),
933
- e?.issues.map((e, t) => /* @__PURE__ */ c("div", {
934
- className: `health-issue ${e.severity}`,
935
- children: [
936
- /* @__PURE__ */ s("b", { children: e.component }),
937
- " ",
938
- e.message
939
- ]
940
- }, t)),
941
- /* @__PURE__ */ c("div", {
942
- className: "model-summary",
943
- children: [
944
- /* @__PURE__ */ c("span", { children: [t?.collections.length ?? 0, " collections modeled"] }),
945
- /* @__PURE__ */ c("span", { children: [t?.workflows.length ?? 0, " workflows modeled"] }),
946
- /* @__PURE__ */ c("span", { children: [t?.agents.length ?? 0, " agents modeled"] })
947
- ]
948
- })
949
- ]
950
- });
951
- }
952
- //#endregion
953
- //#region src/components/SettingsPanel.tsx
954
- function L({ db: e, remoteUrl: t = "", token: r = "", onConnect: i }) {
955
- let [o, l] = a(t), [u, d] = a(r), f = e?.runtime();
956
- return n(() => {
957
- l(t), d(r);
958
- }, [t, r]), /* @__PURE__ */ c("div", {
959
- className: "settings-panel",
960
- children: [/* @__PURE__ */ s("h2", { children: "Settings" }), /* @__PURE__ */ c("div", {
961
- className: "settings-content",
962
- children: [
963
- /* @__PURE__ */ s("h3", { children: "Connection" }),
964
- /* @__PURE__ */ c("div", {
965
- className: "connection-info",
966
- children: [
967
- /* @__PURE__ */ c("div", {
968
- className: "info-row",
969
- children: [/* @__PURE__ */ s("label", { children: "Runtime Environment" }), /* @__PURE__ */ s("span", { children: f?.runtime || "unavailable" })]
970
- }),
971
- /* @__PURE__ */ c("div", {
972
- className: "info-row",
973
- children: [/* @__PURE__ */ s("label", { children: "Storage Backend" }), /* @__PURE__ */ s("span", { children: f?.storage || "unavailable" })]
974
- }),
975
- /* @__PURE__ */ c("div", {
976
- className: "info-row",
977
- children: [/* @__PURE__ */ s("label", { children: "Instance ID" }), /* @__PURE__ */ s("span", {
978
- className: "monospace",
979
- children: e?.instanceId?.() || "unavailable"
980
- })]
981
- })
982
- ]
983
- }),
984
- /* @__PURE__ */ c("form", {
985
- className: "connection-form",
986
- onSubmit: (e) => {
987
- e.preventDefault(), i?.(o, u);
988
- },
989
- children: [
990
- /* @__PURE__ */ c("label", { children: ["Server or managed endpoint", /* @__PURE__ */ s("input", {
991
- type: "url",
992
- value: o,
993
- onChange: (e) => l(e.target.value),
994
- placeholder: "https://your-runtime.example.com"
995
- })] }),
996
- /* @__PURE__ */ c("label", { children: ["API token", /* @__PURE__ */ s("input", {
997
- type: "password",
998
- value: u,
999
- onChange: (e) => d(e.target.value),
1000
- placeholder: "fdb_live_…",
1001
- autoComplete: "off"
1002
- })] }),
1003
- /* @__PURE__ */ s("p", { children: "Tokens are kept in this browser session and are never written to the project." }),
1004
- /* @__PURE__ */ s("button", {
1005
- className: "btn btn-primary",
1006
- type: "submit",
1007
- children: "Connect Studio"
1008
- })
1009
- ]
1010
- })
1011
- ]
1012
- })]
1013
- });
1014
- }
1015
- //#endregion
1016
- //#region src/components/GlobalSearch.tsx
1017
- function R({ db: e, model: t, onSearch: r }) {
1018
- let [i, o] = a(""), [l, u] = a([]), d = (e) => {
1019
- o(e), r && r(e);
1020
- };
1021
- return n(() => {
1022
- let n = !0;
1023
- return (async () => {
1024
- let r = i.trim().toLowerCase();
1025
- if (!r) {
1026
- u([]);
1027
- return;
1028
- }
1029
- let a = [
1030
- ...t?.collections.map((e) => ({
1031
- kind: "collection",
1032
- name: e.name,
1033
- detail: `${e.fields.length} fields`
1034
- })) ?? [],
1035
- ...t?.capabilities.map((e) => ({
1036
- kind: "capability",
1037
- name: e.name,
1038
- detail: e.statements.join(" · ")
1039
- })) ?? [],
1040
- ...t?.workflows.map((e) => ({
1041
- kind: "workflow",
1042
- name: e.name,
1043
- detail: `${e.steps.length} steps`
1044
- })) ?? [],
1045
- ...t?.agents.map((e) => ({
1046
- kind: "agent",
1047
- name: e.name,
1048
- detail: e.statements.join(" · ")
1049
- })) ?? []
1050
- ].filter((e) => JSON.stringify(e).toLowerCase().includes(r)), o = e && t ? (await Promise.all(t.collections.map(async (t) => (await e.collection(t.name).all()).filter((e) => JSON.stringify(e).toLowerCase().includes(r)).slice(0, 3).map((e) => ({
1051
- kind: "object",
1052
- name: `${t.name}/${String(e.id ?? "record")}`,
1053
- detail: JSON.stringify(e)
1054
- }))))).flat() : [];
1055
- n && u([...a, ...o].slice(0, 12));
1056
- })(), () => {
1057
- n = !1;
1058
- };
1059
- }, [
1060
- e,
1061
- t,
1062
- i
1063
- ]), /* @__PURE__ */ c("div", {
1064
- className: "global-search",
1065
- children: [/* @__PURE__ */ s("input", {
1066
- type: "text",
1067
- placeholder: "Search: documents/123, flow://, agent/name, etc.",
1068
- value: i,
1069
- onChange: (e) => d(e.target.value),
1070
- className: "search-input global"
1071
- }), i && /* @__PURE__ */ s("div", {
1072
- className: "search-results",
1073
- children: /* @__PURE__ */ c("div", {
1074
- className: "results-group",
1075
- children: [
1076
- /* @__PURE__ */ s("h4", { children: "Model & runtime" }),
1077
- l.map((e, t) => /* @__PURE__ */ c("div", {
1078
- className: "search-result",
1079
- children: [
1080
- /* @__PURE__ */ s("b", { children: e.name }),
1081
- /* @__PURE__ */ s("span", { children: e.kind }),
1082
- /* @__PURE__ */ s("small", { children: e.detail })
1083
- ]
1084
- }, `${e.kind}-${e.name}-${t}`)),
1085
- !l.length && /* @__PURE__ */ s("div", {
1086
- className: "empty-message",
1087
- children: "No matches"
1088
- })
1089
- ]
1090
- })
1091
- })]
1092
- });
1093
- }
1094
- //#endregion
1095
- //#region src/components/ApplicationDesigner.tsx
1096
- var z = f(d("Application"));
1097
- function B({ db: e, namespace: t = "default", projectSpec: o, managedPublish: g, onSpecChange: _ }) {
1098
- let v = `feltdb:studio:draft:${t}`, y = i((() => {
1099
- if (typeof window > "u") return z;
1100
- let e = window.localStorage.getItem(v);
1101
- if (!e) return z;
1102
- try {
1103
- return p(e), e;
1104
- } catch {
1105
- return z;
1106
- }
1107
- })()), b = i(y.current !== z), [x, S] = a(y.current), [C, w] = a(() => p(y.current)), [T, E] = a([]), [D, O] = a([]), [k, A] = a("Draft is valid"), [j, M] = a(0), [N, P] = a(null), [F, I] = a(null), [L, R] = a(!1), [B, V] = a(!1), [H, U] = a(() => ({
1108
- url: g?.url || "",
1109
- namespace: g?.namespace || t,
1110
- token: g?.token || "",
1111
- environment: g?.environment,
1112
- applicationId: g?.applicationId,
1113
- publishEndpoint: g?.publishEndpoint,
1114
- allowDestructive: !1
1115
- })), W = i(null), G = D.length ? D[D.length - 1].source : f(d(C.app)), K = r(() => u(p(G), C), [G, C]), q = r(() => m(p(G), C), [G, C]);
1116
- n(() => {
1117
- if (!e || o) return;
1118
- let t = !1;
1119
- return (async () => {
1120
- try {
1121
- let n = await e.collection("_flow_apps").all(), r = n.find((e) => e.status === "active") ?? n[0];
1122
- if (!r || t) return;
1123
- let i = f(r.spec);
1124
- b.current || (w(r.spec), S(i)), M(r.version ?? 0);
1125
- let a = (await e.collection("_flow_app_versions").all()).filter((e) => e.app === r.app).sort((e, t) => e.version - t.version);
1126
- t || (O(a.map((e) => ({
1127
- version: e.version,
1128
- source: f(e.spec),
1129
- savedAt: e.deployed_at
1130
- }))), A(`Loaded ${r.app} v${r.version}`));
1131
- } catch (e) {
1132
- t || A(`Could not load deployed model: ${e instanceof Error ? e.message : String(e)}`);
1133
- }
1134
- })(), () => {
1135
- t = !0;
1136
- };
1137
- }, [e, o]), n(() => {
1138
- let e = window.setTimeout(() => window.localStorage.setItem(v, x), 200);
1139
- return () => window.clearTimeout(e);
1140
- }, [v, x]);
1141
- let J = (e) => {
1142
- S(e);
1143
- try {
1144
- let t = p(e), n = h(t);
1145
- w(t), _?.(t), E(n), A(n.some((e) => e.severity === "error") ? "Model has validation errors" : "Draft is valid");
1146
- } catch (e) {
1147
- E([{
1148
- severity: "error",
1149
- message: e instanceof Error ? e.message : String(e)
1150
- }]), A("DSL parse failed");
1151
- }
1152
- };
1153
- n(() => {
1154
- if (!o) return;
1155
- let e = f(o);
1156
- S(e), w(o), E(h(o)), A(`Loaded ${o.app} project model`);
1157
- }, [o]);
1158
- let Y = (e) => {
1159
- w(e), J(f(e));
1160
- }, X = () => {
1161
- if (!F) return I({ name: "" });
1162
- let e = F.name.trim();
1163
- if (!/^[A-Z][A-Za-z0-9_]*$/.test(e)) return I({
1164
- ...F,
1165
- error: "Use a capitalized name with no spaces."
1166
- });
1167
- if (C.collections.some((t) => t.name === e)) return I({
1168
- ...F,
1169
- error: "That collection already exists."
1170
- });
1171
- Y({
1172
- ...C,
1173
- collections: [...C.collections, {
1174
- name: e,
1175
- fields: [],
1176
- indexes: []
1177
- }]
1178
- }), I(null);
1179
- }, Z = (e) => P({
1180
- collection: e,
1181
- name: "",
1182
- type: "text",
1183
- reference: "",
1184
- optional: !1
1185
- }), Q = () => {
1186
- if (!N) return;
1187
- let e = N.name.trim(), t = C.collections.find((e) => e.name === N.collection);
1188
- if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)) return P({
1189
- ...N,
1190
- error: "Use a letter-led name with no spaces."
1191
- });
1192
- if (t?.fields.some((t) => t.name === e)) return P({
1193
- ...N,
1194
- error: "That field already exists."
1195
- });
1196
- if ([
1197
- "ref",
1198
- "enum",
1199
- "array",
1200
- "map",
1201
- "vector"
1202
- ].includes(N.type) && !N.reference.trim()) return P({
1203
- ...N,
1204
- error: "Configure this field type."
1205
- });
1206
- let n = N.type === "ref" ? `ref ${N.reference}` : N.type === "enum" ? `enum(${N.reference.split(",").map((e) => e.trim()).filter(Boolean).join(",")})` : N.type === "array" ? `array<${N.reference.trim()}>` : N.type === "map" ? `map<${N.reference.trim()}>` : N.type === "vector" ? `vector<${N.reference.trim()}>` : N.type;
1207
- Y({
1208
- ...C,
1209
- collections: C.collections.map((t) => t.name === N.collection ? {
1210
- ...t,
1211
- fields: [...t.fields, {
1212
- name: e,
1213
- type: n,
1214
- optional: N.optional
1215
- }]
1216
- } : t)
1217
- }), P(null);
1218
- }, $ = () => {
1219
- let e = [...D, {
1220
- version: D.length + 1,
1221
- source: x,
1222
- savedAt: Date.now()
1223
- }];
1224
- O(e), A(`Saved local revision v${e.length}`);
1225
- }, ee = async () => {
1226
- if (!e) return A("Local embedded storage is unavailable");
1227
- if (T.some((e) => e.severity === "error")) return A("Resolve validation errors before deploying");
1228
- if (q.filter((e) => e.safety === "destructive").length && !L) return A("Review and approve destructive local changes before applying");
1229
- try {
1230
- let t = await e.deployFlowSpec(C, j, L), n = [...D, {
1231
- version: t.version,
1232
- source: x,
1233
- savedAt: Date.now()
1234
- }];
1235
- O(n), M(t.version), R(!1), A(`Applied locally as ${t.app} v${t.version}`);
1236
- } catch (e) {
1237
- A(`Local apply failed: ${e instanceof Error ? e.message : String(e)}`);
1238
- }
1239
- }, te = async () => {
1240
- if (H.publishEndpoint) {
1241
- U({
1242
- ...H,
1243
- publishing: !0,
1244
- error: void 0
1245
- });
1246
- try {
1247
- let e = await fetch(H.publishEndpoint, {
1248
- method: "POST",
1249
- headers: { "content-type": "application/json" },
1250
- body: JSON.stringify({
1251
- environment: H.environment,
1252
- approveDestructive: H.allowDestructive
1253
- })
1254
- }), t = await e.json();
1255
- if (!e.ok) throw Error(t.error || "Publish failed");
1256
- U({
1257
- ...H,
1258
- publishing: !1,
1259
- error: void 0
1260
- }), V(!1), A(t.messages?.at(-1) || `Published immutable version ${t.version}`);
1261
- return;
1262
- } catch (e) {
1263
- U({
1264
- ...H,
1265
- publishing: !1,
1266
- error: e instanceof Error ? e.message : String(e)
1267
- });
1268
- return;
1269
- }
1270
- }
1271
- if (!H.url.trim() || !H.token.trim()) return U({
1272
- ...H,
1273
- error: "Cloud URL and API key are required."
1274
- });
1275
- if (T.some((e) => e.severity === "error")) return U({
1276
- ...H,
1277
- error: "Resolve validation errors before publishing."
1278
- });
1279
- U({
1280
- ...H,
1281
- publishing: !0,
1282
- error: void 0
1283
- });
1284
- let e = l({
1285
- namespace: H.namespace.trim() || t,
1286
- server: {
1287
- url: H.url.trim().replace(/\/$/, ""),
1288
- token: H.token
1289
- }
1290
- });
1291
- try {
1292
- let t = await e.collection("_flow_apps").get(C.app), n = m(t?.spec ?? d(C.app), C).filter((e) => e.safety === "destructive");
1293
- if (n.length && !H.allowDestructive) return U({
1294
- ...H,
1295
- publishing: !1,
1296
- destructive: n.map((e) => e.target),
1297
- error: `Review and approve destructive changes: ${n.map((e) => e.target).join(", ")}`
1298
- });
1299
- let r = await e.deployFlowSpec(C, t?.version ?? 0, H.allowDestructive);
1300
- window.sessionStorage.setItem(`feltdb-token:${H.url.trim()}`, H.token), U({
1301
- ...H,
1302
- publishing: !1,
1303
- error: void 0
1304
- }), V(!1), A(`Published ${r.app} v${r.version} to ${H.environment || "cloud"}`);
1305
- } catch (e) {
1306
- U({
1307
- ...H,
1308
- publishing: !1,
1309
- error: e instanceof Error ? e.message : String(e)
1310
- });
1311
- } finally {
1312
- await e.close();
1313
- }
1314
- }, ne = () => {
1315
- let e = URL.createObjectURL(new Blob([x], { type: "text/plain" })), t = document.createElement("a");
1316
- t.href = e, t.download = "feltdb.flow", t.click(), URL.revokeObjectURL(e);
1317
- }, re = async (e) => {
1318
- e && J(await e.text());
1319
- }, ie = [
1320
- ["Data", C.collections.map((e) => e.name)],
1321
- ["Capabilities", C.capabilities.map((e) => e.name)],
1322
- ["Agents", C.agents.map((e) => e.name)],
1323
- ["Workflows", C.workflows.map((e) => e.name)],
1324
- ["Triggers", C.triggers.map((e) => e.event)],
1325
- ["Policies", C.policies.map((e) => e.name)],
1326
- ["Schedules", C.schedules.map((e) => e.name)]
1327
- ];
1328
- return /* @__PURE__ */ c("div", {
1329
- className: "application-designer",
1330
- children: [
1331
- /* @__PURE__ */ c("header", {
1332
- className: "designer-header",
1333
- children: [/* @__PURE__ */ c("div", { children: [
1334
- /* @__PURE__ */ s("span", {
1335
- className: "eyebrow",
1336
- children: "Application fabric"
1337
- }),
1338
- /* @__PURE__ */ s("h1", { children: C.app }),
1339
- /* @__PURE__ */ s("p", { children: "One model for state, intelligence, automation, security, and placement." })
1340
- ] }), /* @__PURE__ */ c("div", {
1341
- className: "designer-actions",
1342
- children: [
1343
- /* @__PURE__ */ s("input", {
1344
- ref: W,
1345
- hidden: !0,
1346
- type: "file",
1347
- accept: ".flow,text/plain",
1348
- onChange: (e) => void re(e.target.files?.[0])
1349
- }),
1350
- /* @__PURE__ */ s("button", {
1351
- className: "btn btn-ghost",
1352
- onClick: () => W.current?.click(),
1353
- children: "Import"
1354
- }),
1355
- /* @__PURE__ */ s("button", {
1356
- className: "btn btn-ghost",
1357
- onClick: ne,
1358
- children: "Export"
1359
- }),
1360
- /* @__PURE__ */ s("button", {
1361
- className: "btn btn-ghost",
1362
- onClick: $,
1363
- children: "Version"
1364
- }),
1365
- /* @__PURE__ */ s("button", {
1366
- className: "btn btn-ghost",
1367
- onClick: () => void ee(),
1368
- children: "Apply locally"
1369
- }),
1370
- /* @__PURE__ */ s("button", {
1371
- className: "btn btn-primary",
1372
- onClick: () => V((e) => !e),
1373
- children: "Publish to cloud"
1374
- })
1375
- ]
1376
- })]
1377
- }),
1378
- q.some((e) => e.safety === "destructive") && /* @__PURE__ */ c("label", {
1379
- className: "local-destructive",
1380
- children: [/* @__PURE__ */ s("input", {
1381
- type: "checkbox",
1382
- checked: L,
1383
- onChange: (e) => R(e.target.checked)
1384
- }), /* @__PURE__ */ c("span", { children: ["Approve destructive local changes: ", q.filter((e) => e.safety === "destructive").map((e) => e.target).join(", ")] })]
1385
- }),
1386
- B && /* @__PURE__ */ c("form", {
1387
- className: "cloud-publisher",
1388
- onSubmit: (e) => {
1389
- e.preventDefault(), te();
1390
- },
1391
- children: [
1392
- /* @__PURE__ */ c("div", {
1393
- className: "cloud-publisher-heading",
1394
- children: [/* @__PURE__ */ c("div", { children: [
1395
- /* @__PURE__ */ s("span", {
1396
- className: "eyebrow",
1397
- children: "Cloud release"
1398
- }),
1399
- /* @__PURE__ */ s("h2", { children: "Publish this application definition" }),
1400
- /* @__PURE__ */ s("p", { children: "FeltDB validates an immutable revision and atomically promotes the environment." })
1401
- ] }), /* @__PURE__ */ s("button", {
1402
- type: "button",
1403
- "aria-label": "Close cloud publisher",
1404
- onClick: () => V(!1),
1405
- children: "×"
1406
- })]
1407
- }),
1408
- /* @__PURE__ */ c("div", {
1409
- className: "cloud-fields",
1410
- children: [
1411
- /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "FeltDB Cloud URL" }), /* @__PURE__ */ s("input", {
1412
- type: "url",
1413
- value: H.url,
1414
- readOnly: !!H.publishEndpoint,
1415
- onChange: (e) => U({
1416
- ...H,
1417
- url: e.target.value,
1418
- error: void 0,
1419
- destructive: void 0,
1420
- allowDestructive: !1
1421
- })
1422
- })] }),
1423
- /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "Namespace" }), /* @__PURE__ */ s("input", {
1424
- value: H.namespace,
1425
- readOnly: !!H.publishEndpoint,
1426
- onChange: (e) => U({
1427
- ...H,
1428
- namespace: e.target.value,
1429
- error: void 0,
1430
- destructive: void 0,
1431
- allowDestructive: !1
1432
- })
1433
- })] }),
1434
- !H.publishEndpoint && /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "API key" }), /* @__PURE__ */ s("input", {
1435
- type: "password",
1436
- autoComplete: "off",
1437
- placeholder: "Loaded securely from this project",
1438
- value: H.token,
1439
- onChange: (e) => U({
1440
- ...H,
1441
- token: e.target.value,
1442
- error: void 0
1443
- })
1444
- })] }),
1445
- H.environment && /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "Environment" }), /* @__PURE__ */ s("input", {
1446
- value: H.environment,
1447
- readOnly: !0
1448
- })] }),
1449
- H.applicationId && /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "Application" }), /* @__PURE__ */ s("input", {
1450
- value: H.applicationId,
1451
- readOnly: !0
1452
- })] })
1453
- ]
1454
- }),
1455
- (H.destructive?.length || q.some((e) => e.safety === "destructive")) && /* @__PURE__ */ c("label", {
1456
- className: "cloud-destructive",
1457
- children: [/* @__PURE__ */ s("input", {
1458
- type: "checkbox",
1459
- checked: H.allowDestructive,
1460
- onChange: (e) => U({
1461
- ...H,
1462
- allowDestructive: e.target.checked
1463
- })
1464
- }), /* @__PURE__ */ c("span", { children: ["I reviewed and approve destructive model changes", H.destructive?.length ? `: ${H.destructive.join(", ")}` : "."] })]
1465
- }),
1466
- H.error && /* @__PURE__ */ s("div", {
1467
- className: "cloud-error",
1468
- role: "alert",
1469
- children: H.error
1470
- }),
1471
- /* @__PURE__ */ c("div", {
1472
- className: "cloud-actions",
1473
- children: [/* @__PURE__ */ s("button", {
1474
- type: "button",
1475
- className: "btn btn-ghost",
1476
- onClick: () => V(!1),
1477
- children: "Cancel"
1478
- }), /* @__PURE__ */ s("button", {
1479
- className: "btn btn-primary",
1480
- disabled: H.publishing,
1481
- type: "submit",
1482
- children: H.publishing ? "Publishing…" : "Review and publish"
1483
- })]
1484
- })
1485
- ]
1486
- }),
1487
- /* @__PURE__ */ c("div", {
1488
- className: `designer-status ${T.some((e) => e.severity === "error") ? "error" : ""}`,
1489
- children: [/* @__PURE__ */ s("span", { children: k }), /* @__PURE__ */ c("span", { children: [
1490
- C.collections.length,
1491
- " collections · ",
1492
- C.workflows.length,
1493
- " workflows · ",
1494
- D.length ? `v${D.length}` : "draft"
1495
- ] })]
1496
- }),
1497
- /* @__PURE__ */ c("div", {
1498
- className: "designer-grid",
1499
- children: [
1500
- /* @__PURE__ */ c("aside", {
1501
- className: "model-tree",
1502
- children: [
1503
- /* @__PURE__ */ c("div", {
1504
- className: "panel-title",
1505
- children: [/* @__PURE__ */ s("span", { children: "Application" }), /* @__PURE__ */ s("button", {
1506
- "aria-label": "Add collection",
1507
- onClick: () => I({ name: "" }),
1508
- children: "+"
1509
- })]
1510
- }),
1511
- F && /* @__PURE__ */ c("form", {
1512
- className: "collection-editor",
1513
- onSubmit: (e) => {
1514
- e.preventDefault(), X();
1515
- },
1516
- onKeyDown: (e) => {
1517
- e.key === "Escape" && I(null);
1518
- },
1519
- children: [
1520
- /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "New collection" }), /* @__PURE__ */ s("input", {
1521
- autoFocus: !0,
1522
- placeholder: "e.g. Customer",
1523
- value: F.name,
1524
- onChange: (e) => I({ name: e.target.value })
1525
- })] }),
1526
- F.error && /* @__PURE__ */ s("div", {
1527
- className: "field-error",
1528
- role: "alert",
1529
- children: F.error
1530
- }),
1531
- /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("button", {
1532
- type: "button",
1533
- onClick: () => I(null),
1534
- children: "Cancel"
1535
- }), /* @__PURE__ */ s("button", {
1536
- className: "collection-save",
1537
- type: "submit",
1538
- children: "Add"
1539
- })] })
1540
- ]
1541
- }),
1542
- ie.map(([e, t]) => /* @__PURE__ */ c("section", { children: [/* @__PURE__ */ s("h3", { children: e }), t.length ? t.map((e) => /* @__PURE__ */ s("div", {
1543
- className: "tree-item",
1544
- children: e
1545
- }, e)) : /* @__PURE__ */ s("div", {
1546
- className: "tree-empty",
1547
- children: "None"
1548
- })] }, e))
1549
- ]
1550
- }),
1551
- /* @__PURE__ */ c("section", {
1552
- className: "model-canvas",
1553
- children: [
1554
- /* @__PURE__ */ c("div", {
1555
- className: "panel-title",
1556
- children: [/* @__PURE__ */ s("span", { children: "Application graph" }), /* @__PURE__ */ s("span", {
1557
- className: "graph-legend",
1558
- children: "intent → fabric"
1559
- })]
1560
- }),
1561
- /* @__PURE__ */ c("div", {
1562
- className: "graph-board",
1563
- children: [
1564
- C.collections.map((e) => /* @__PURE__ */ c("article", {
1565
- className: "model-node",
1566
- children: [
1567
- /* @__PURE__ */ s("div", {
1568
- className: "node-kind",
1569
- children: "collection"
1570
- }),
1571
- /* @__PURE__ */ s("h3", { children: e.name }),
1572
- e.fields.map((e) => /* @__PURE__ */ c("div", {
1573
- className: "node-field",
1574
- children: [/* @__PURE__ */ s("span", { children: e.name }), /* @__PURE__ */ c("code", { children: [e.type, e.optional ? "?" : ""] })]
1575
- }, e.name)),
1576
- N?.collection === e.name ? /* @__PURE__ */ c("form", {
1577
- className: "field-editor",
1578
- onSubmit: (e) => {
1579
- e.preventDefault(), Q();
1580
- },
1581
- onKeyDown: (e) => {
1582
- e.key === "Escape" && P(null);
1583
- },
1584
- children: [
1585
- /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "Field name" }), /* @__PURE__ */ s("input", {
1586
- autoFocus: !0,
1587
- value: N.name,
1588
- placeholder: "e.g. publishedAt",
1589
- onChange: (e) => P({
1590
- ...N,
1591
- name: e.target.value,
1592
- error: void 0
1593
- })
1594
- })] }),
1595
- /* @__PURE__ */ c("div", {
1596
- className: "field-editor-row",
1597
- children: [
1598
- /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "Type" }), /* @__PURE__ */ c("select", {
1599
- value: N.type,
1600
- onChange: (e) => P({
1601
- ...N,
1602
- type: e.target.value,
1603
- error: void 0
1604
- }),
1605
- children: [
1606
- /* @__PURE__ */ s("option", {
1607
- value: "text",
1608
- children: "Text"
1609
- }),
1610
- /* @__PURE__ */ s("option", {
1611
- value: "integer",
1612
- children: "Integer"
1613
- }),
1614
- /* @__PURE__ */ s("option", {
1615
- value: "number",
1616
- children: "Number"
1617
- }),
1618
- /* @__PURE__ */ s("option", {
1619
- value: "decimal",
1620
- children: "Decimal"
1621
- }),
1622
- /* @__PURE__ */ s("option", {
1623
- value: "money",
1624
- children: "Money"
1625
- }),
1626
- /* @__PURE__ */ s("option", {
1627
- value: "bigint",
1628
- children: "Big integer"
1629
- }),
1630
- /* @__PURE__ */ s("option", {
1631
- value: "boolean",
1632
- children: "Boolean"
1633
- }),
1634
- /* @__PURE__ */ s("option", {
1635
- value: "datetime",
1636
- children: "Date & time"
1637
- }),
1638
- /* @__PURE__ */ s("option", {
1639
- value: "date",
1640
- children: "Date"
1641
- }),
1642
- /* @__PURE__ */ s("option", {
1643
- value: "time",
1644
- children: "Time"
1645
- }),
1646
- /* @__PURE__ */ s("option", {
1647
- value: "uuid",
1648
- children: "UUID"
1649
- }),
1650
- /* @__PURE__ */ s("option", {
1651
- value: "email",
1652
- children: "Email"
1653
- }),
1654
- /* @__PURE__ */ s("option", {
1655
- value: "url",
1656
- children: "URL"
1657
- }),
1658
- /* @__PURE__ */ s("option", {
1659
- value: "phone",
1660
- children: "Phone"
1661
- }),
1662
- /* @__PURE__ */ s("option", {
1663
- value: "json",
1664
- children: "JSON"
1665
- }),
1666
- /* @__PURE__ */ s("option", {
1667
- value: "object",
1668
- children: "Object"
1669
- }),
1670
- /* @__PURE__ */ s("option", {
1671
- value: "binary",
1672
- children: "Binary"
1673
- }),
1674
- /* @__PURE__ */ s("option", {
1675
- value: "file",
1676
- children: "File"
1677
- }),
1678
- /* @__PURE__ */ s("option", {
1679
- value: "geo",
1680
- children: "Geo point"
1681
- }),
1682
- /* @__PURE__ */ s("option", {
1683
- value: "enum",
1684
- children: "Enum"
1685
- }),
1686
- /* @__PURE__ */ s("option", {
1687
- value: "array",
1688
- children: "Array"
1689
- }),
1690
- /* @__PURE__ */ s("option", {
1691
- value: "map",
1692
- children: "Typed map"
1693
- }),
1694
- /* @__PURE__ */ s("option", {
1695
- value: "vector",
1696
- children: "Vector"
1697
- }),
1698
- /* @__PURE__ */ s("option", {
1699
- value: "ref",
1700
- children: "Reference"
1701
- })
1702
- ]
1703
- })] }),
1704
- N.type === "ref" && /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "Collection" }), /* @__PURE__ */ s("select", {
1705
- value: N.reference,
1706
- onChange: (e) => P({
1707
- ...N,
1708
- reference: e.target.value,
1709
- error: void 0
1710
- }),
1711
- children: C.collections.filter((t) => t.name !== e.name).map((e) => /* @__PURE__ */ s("option", {
1712
- value: e.name,
1713
- children: e.name
1714
- }, e.name))
1715
- })] }),
1716
- N.type === "enum" && /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "Values" }), /* @__PURE__ */ s("input", {
1717
- placeholder: "draft,active,done",
1718
- value: N.reference,
1719
- onChange: (e) => P({
1720
- ...N,
1721
- reference: e.target.value,
1722
- error: void 0
1723
- })
1724
- })] }),
1725
- (N.type === "array" || N.type === "map") && /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "Item type" }), /* @__PURE__ */ s("input", {
1726
- placeholder: "text, uuid, ref Project…",
1727
- value: N.reference,
1728
- onChange: (e) => P({
1729
- ...N,
1730
- reference: e.target.value,
1731
- error: void 0
1732
- })
1733
- })] }),
1734
- N.type === "vector" && /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "Dimensions" }), /* @__PURE__ */ s("input", {
1735
- type: "number",
1736
- min: "1",
1737
- placeholder: "1536",
1738
- value: N.reference,
1739
- onChange: (e) => P({
1740
- ...N,
1741
- reference: e.target.value,
1742
- error: void 0
1743
- })
1744
- })] })
1745
- ]
1746
- }),
1747
- /* @__PURE__ */ c("label", {
1748
- className: "field-optional",
1749
- children: [/* @__PURE__ */ s("input", {
1750
- type: "checkbox",
1751
- checked: N.optional,
1752
- onChange: (e) => P({
1753
- ...N,
1754
- optional: e.target.checked
1755
- })
1756
- }), /* @__PURE__ */ s("span", { children: "Optional field" })]
1757
- }),
1758
- N.error && /* @__PURE__ */ s("div", {
1759
- className: "field-error",
1760
- role: "alert",
1761
- children: N.error
1762
- }),
1763
- /* @__PURE__ */ c("div", {
1764
- className: "field-editor-actions",
1765
- children: [/* @__PURE__ */ s("button", {
1766
- type: "button",
1767
- onClick: () => P(null),
1768
- children: "Cancel"
1769
- }), /* @__PURE__ */ s("button", {
1770
- className: "field-save",
1771
- type: "submit",
1772
- children: "Add field"
1773
- })]
1774
- })
1775
- ]
1776
- }) : /* @__PURE__ */ s("button", {
1777
- className: "node-add",
1778
- onClick: () => Z(e.name),
1779
- children: "+ field"
1780
- })
1781
- ]
1782
- }, e.name)),
1783
- C.workflows.map((e) => /* @__PURE__ */ c("article", {
1784
- className: "model-node workflow-node",
1785
- children: [
1786
- /* @__PURE__ */ s("div", {
1787
- className: "node-kind",
1788
- children: "workflow"
1789
- }),
1790
- /* @__PURE__ */ s("h3", { children: e.name }),
1791
- e.steps.map((e) => /* @__PURE__ */ s("div", {
1792
- className: "node-step",
1793
- children: e.name
1794
- }, e.name))
1795
- ]
1796
- }, e.name)),
1797
- C.agents.map((e) => /* @__PURE__ */ c("article", {
1798
- className: "model-node agent-node",
1799
- children: [
1800
- /* @__PURE__ */ s("div", {
1801
- className: "node-kind",
1802
- children: "agent"
1803
- }),
1804
- /* @__PURE__ */ s("h3", { children: e.name }),
1805
- e.statements.map((e) => /* @__PURE__ */ s("div", {
1806
- className: "node-step",
1807
- children: e
1808
- }, e))
1809
- ]
1810
- }, e.name))
1811
- ]
1812
- }),
1813
- /* @__PURE__ */ c("div", {
1814
- className: "change-strip",
1815
- children: [
1816
- /* @__PURE__ */ s("strong", { children: "Model diff" }),
1817
- /* @__PURE__ */ c("span", {
1818
- className: "added",
1819
- children: ["+ ", K.added.join(", ") || "none"]
1820
- }),
1821
- /* @__PURE__ */ c("span", {
1822
- className: "changed",
1823
- children: ["~ ", K.changed.join(", ") || "none"]
1824
- }),
1825
- /* @__PURE__ */ c("span", {
1826
- className: "removed",
1827
- children: ["− ", K.removed.join(", ") || "none"]
1828
- })
1829
- ]
1830
- })
1831
- ]
1832
- }),
1833
- /* @__PURE__ */ c("section", {
1834
- className: "dsl-panel",
1835
- children: [
1836
- /* @__PURE__ */ c("div", {
1837
- className: "panel-title",
1838
- children: [/* @__PURE__ */ s("span", { children: "Flow DSL" }), /* @__PURE__ */ s("span", { children: "feltdb.flow" })]
1839
- }),
1840
- /* @__PURE__ */ s("textarea", {
1841
- "aria-label": "Flow DSL",
1842
- spellCheck: !1,
1843
- value: x,
1844
- onChange: (e) => J(e.target.value)
1845
- }),
1846
- T.length > 0 && /* @__PURE__ */ s("div", {
1847
- className: "diagnostics",
1848
- children: T.map((e, t) => /* @__PURE__ */ c("div", {
1849
- className: e.severity,
1850
- children: [
1851
- e.severity,
1852
- ": ",
1853
- e.message
1854
- ]
1855
- }, t))
1856
- })
1857
- ]
1858
- })
1859
- ]
1860
- })
1861
- ]
1862
- });
1863
- }
1864
- //#endregion
1865
- //#region src/components/AskFeltDB.tsx
1866
- function V({ configuration: e, onApplied: t }) {
1867
- let [n, r] = a(""), [i, l] = a(), [u, d] = a(), [f, m] = a(""), [h, g] = a(0), [_, v] = a(!1), [y, b] = a([]), x = typeof navigator < "u" && "gpu" in navigator, S = e?.aiModel?.provider === "openai-compatible", C = !!(e?.enabled && (S ? e.aiModel?.credentialConfigured : e.webllmEnabled && x)), w = async () => {
1868
- if (!(!C || !e)) {
1869
- m("Loading local model…"), d(void 0), l(void 0);
1870
- try {
1871
- let t = await fetch("/_feltdb/contract", { cache: "no-store" }), r = await t.json();
1872
- if (!t.ok) throw Error(r.error || "Could not load contract");
1873
- if (r.drift && !r.drift.synchronized) throw Error("Contract drift detected. Review feltdb status before generating.");
1874
- let i;
1875
- if (S) {
1876
- m(`Asking ${e.aiModel?.model} through the local CLI…`);
1877
- let t = await fetch("/_feltdb/ai/generate", {
1878
- method: "POST",
1879
- headers: {
1880
- "content-type": "application/json",
1881
- "x-feltdb-studio-token": e.token
1882
- },
1883
- body: JSON.stringify({ intent: n })
1884
- }), r = await t.json();
1885
- if (!t.ok) throw Error(r.error || "Configured model failed");
1886
- i = r.proposal;
1887
- } else {
1888
- let { WebLLMProvider: t } = await import("@feltdb/webllm"), a = new t({
1889
- model: e.aiModel?.model,
1890
- contract: r.snapshot,
1891
- onProgress: (e) => {
1892
- g(e.progress), m(e.text);
1893
- }
1894
- });
1895
- try {
1896
- i = await a.generateFlow(n, { currentFlow: r.source });
1897
- } finally {
1898
- await a.shutdown();
1899
- }
1900
- }
1901
- let a = await fetch("/_feltdb/proposals", {
1902
- method: "POST",
1903
- headers: {
1904
- "content-type": "application/json",
1905
- "x-feltdb-studio-token": e.token
1906
- },
1907
- body: JSON.stringify({ proposal: i })
1908
- }), o = await a.json();
1909
- if (!a.ok) throw Error(o.error || "Proposal validation failed");
1910
- l(i), d(o), b(p(i.proposedFlow).collections.map((e) => ({
1911
- name: e.name,
1912
- fields: e.fields.map((e) => e.name)
1913
- }))), m("Validated proposal ready for review");
1914
- } catch (e) {
1915
- m(e instanceof Error ? e.message : String(e));
1916
- }
1917
- }
1918
- }, T = async (t) => {
1919
- if (!(!u || !e)) {
1920
- m(t === "approve" ? "Recording approval…" : "Rejecting preview…");
1921
- try {
1922
- let n = await fetch(`/_feltdb/proposals/${t}`, {
1923
- method: "POST",
1924
- headers: {
1925
- "content-type": "application/json",
1926
- "x-feltdb-studio-token": e.token
1927
- },
1928
- body: JSON.stringify({
1929
- proposalId: u.proposalId,
1930
- confirm: !0,
1931
- approveAuthorization: _
1932
- })
1933
- }), r = await n.json();
1934
- if (!n.ok) throw Error(r.error || "Proposal decision failed");
1935
- t === "approve" ? m(`Approved. Run ${r.command} in your project to synchronize the repository.`) : (l(void 0), d(void 0), b([]), m("Preview rejected. The application and repository are unchanged."));
1936
- } catch (e) {
1937
- m(e instanceof Error ? e.message : String(e));
1938
- }
1939
- }
1940
- };
1941
- return /* @__PURE__ */ c("section", {
1942
- className: "ask-feltdb",
1943
- children: [
1944
- /* @__PURE__ */ c("div", { children: [
1945
- /* @__PURE__ */ s("span", {
1946
- className: "eyebrow",
1947
- children: "Contract-aware proposal engine"
1948
- }),
1949
- /* @__PURE__ */ s("h2", { children: "Ask FeltDB" }),
1950
- /* @__PURE__ */ s("p", { children: "Describe a contract change. Your selected model proposes; FeltDB validates, and the CLI owns source synchronization." })
1951
- ] }),
1952
- /* @__PURE__ */ c("p", {
1953
- className: "ai-model-choice",
1954
- children: [
1955
- "Model: ",
1956
- /* @__PURE__ */ s("strong", { children: e?.aiModel?.model ?? "SmolLM2-360M-Instruct" }),
1957
- " (",
1958
- S ? "bring-your-own provider; credential held by CLI" : "private local WebLLM",
1959
- "). Change it with ",
1960
- /* @__PURE__ */ s("code", { children: "feltdb ai model set" }),
1961
- "."
1962
- ]
1963
- }),
1964
- S && !e?.aiModel?.credentialConfigured ? /* @__PURE__ */ c("p", {
1965
- className: "ai-unavailable",
1966
- children: [
1967
- "The selected hosted model needs a credential. Pipe it securely with ",
1968
- /* @__PURE__ */ s("code", { children: "printf %s \"$KEY\" | feltdb ai model set ... --api-key-stdin" }),
1969
- "."
1970
- ]
1971
- }) : !S && !e?.webllmEnabled ? /* @__PURE__ */ c("p", {
1972
- className: "ai-unavailable",
1973
- children: [
1974
- "Local AI is not enabled for this project. Install ",
1975
- /* @__PURE__ */ s("code", { children: "@feltdb/webllm" }),
1976
- " to opt in, or configure your own model with ",
1977
- /* @__PURE__ */ s("code", { children: "feltdb ai model set" }),
1978
- "."
1979
- ]
1980
- }) : !S && !x ? /* @__PURE__ */ s("p", {
1981
- className: "ai-unavailable",
1982
- children: "Local FeltDB AI is unavailable because WebGPU is not available. You can configure an OpenAI-compatible model instead."
1983
- }) : /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("textarea", {
1984
- "aria-label": "Ask FeltDB",
1985
- value: n,
1986
- onChange: (e) => r(e.target.value),
1987
- placeholder: "Add invitations so organization owners can invite users."
1988
- }), /* @__PURE__ */ s("button", {
1989
- className: "btn btn-primary",
1990
- disabled: !n.trim(),
1991
- onClick: () => void w(),
1992
- children: "Generate proposal"
1993
- })] }),
1994
- h > 0 && h < 1 && /* @__PURE__ */ s("progress", {
1995
- value: h,
1996
- max: 1
1997
- }),
1998
- " ",
1999
- f && /* @__PURE__ */ s("p", {
2000
- className: "ai-status",
2001
- children: f
2002
- }),
2003
- i && u && /* @__PURE__ */ c("div", {
2004
- className: "proposal-review",
2005
- children: [
2006
- /* @__PURE__ */ s("h3", { children: "Ephemeral application preview" }),
2007
- /* @__PURE__ */ s("p", { children: i.summary }),
2008
- /* @__PURE__ */ s("ul", { children: u.changes.map((e) => /* @__PURE__ */ s("li", { children: e }, e)) }),
2009
- /* @__PURE__ */ c("div", {
2010
- className: "proposal-app-preview",
2011
- "aria-label": "Proposed application preview",
2012
- children: [/* @__PURE__ */ s("nav", { children: y.map((e) => /* @__PURE__ */ s("span", { children: e.name }, e.name)) }), y.map((e) => /* @__PURE__ */ c("section", { children: [/* @__PURE__ */ s("strong", { children: e.name }), /* @__PURE__ */ s("small", { children: e.fields.join(" · ") || "No fields" })] }, e.name))]
2013
- }),
2014
- /* @__PURE__ */ c("p", { children: [
2015
- /* @__PURE__ */ s("strong", { children: "Source impact" }),
2016
- ": ",
2017
- u.sourcePlan.join(", ")
2018
- ] }),
2019
- i.warnings.length > 0 && /* @__PURE__ */ s("div", {
2020
- className: "proposal-warning",
2021
- children: i.warnings.join(" · ")
2022
- }),
2023
- u.authorizationChanges.length > 0 && /* @__PURE__ */ c("div", { children: [u.authorizationChanges.map((e) => /* @__PURE__ */ c("div", {
2024
- className: "proposal-warning",
2025
- children: [
2026
- /* @__PURE__ */ c("strong", { children: ["AUTHORIZATION CHANGE", e.widening ? " — POSSIBLE WIDENING" : ""] }),
2027
- /* @__PURE__ */ s("br", {}),
2028
- e.policy,
2029
- /* @__PURE__ */ s("br", {}),
2030
- /* @__PURE__ */ c("code", { children: [
2031
- (e.before ?? ["<absent>"]).join(" | "),
2032
- " → ",
2033
- (e.after ?? ["<removed>"]).join(" | ")
2034
- ] })
2035
- ]
2036
- }, e.policy)), /* @__PURE__ */ c("label", {
2037
- className: "authorization-approval",
2038
- children: [/* @__PURE__ */ s("input", {
2039
- type: "checkbox",
2040
- checked: _,
2041
- onChange: (e) => v(e.target.checked)
2042
- }), /* @__PURE__ */ s("span", { children: "I explicitly approve this authorization change." })]
2043
- })] }),
2044
- /* @__PURE__ */ c("details", { children: [/* @__PURE__ */ s("summary", { children: "Proposed feltdb.flow" }), /* @__PURE__ */ s("pre", { children: i.proposedFlow })] }),
2045
- !e?.previewOnly && /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("button", {
2046
- className: "btn btn-primary",
2047
- disabled: u.authorizationChanges.length > 0 && !_,
2048
- onClick: () => void T("approve"),
2049
- children: "Approve proposal"
2050
- }), /* @__PURE__ */ s("button", {
2051
- className: "btn",
2052
- onClick: () => void T("reject"),
2053
- children: "Reject preview"
2054
- })] }),
2055
- e?.previewOnly && /* @__PURE__ */ c("p", {
2056
- className: "proposal-boundary",
2057
- children: [/* @__PURE__ */ s("strong", { children: "Preview-only session:" }), " no proposal artifact or source file will be written."]
2058
- }),
2059
- /* @__PURE__ */ s("p", {
2060
- className: "proposal-boundary",
2061
- children: "This preview is ephemeral. Approval records a proposal artifact; Studio never writes application source, changes the running contract, or publishes."
2062
- })
2063
- ]
2064
- })
2065
- ]
2066
- });
2067
- }
2068
- //#endregion
2069
- //#region src/components/ProposalBrowser.tsx
2070
- function H() {
2071
- let [e, t] = a([]), [r, i] = a(), [l, u] = a(""), d = () => void fetch("/_feltdb/proposals/list", { cache: "no-store" }).then(async (e) => {
2072
- let n = await e.json();
2073
- if (!e.ok) throw Error(n.error || "Proposal service unavailable");
2074
- t(n.proposals || []), u("");
2075
- }).catch((e) => u(e instanceof Error ? e.message : String(e)));
2076
- n(() => {
2077
- d();
2078
- let e = window.setInterval(d, 2e3);
2079
- return () => window.clearInterval(e);
2080
- }, []);
2081
- let f = (e) => void fetch(`/_feltdb/proposals/${encodeURIComponent(e)}`, { cache: "no-store" }).then(async (e) => {
2082
- let t = await e.json();
2083
- if (!e.ok) throw Error(t.error);
2084
- i(t);
2085
- }).catch((e) => u(e instanceof Error ? e.message : String(e)));
2086
- return /* @__PURE__ */ c("div", {
2087
- className: "proposal-browser",
2088
- children: [
2089
- /* @__PURE__ */ c("header", { children: [
2090
- /* @__PURE__ */ s("span", {
2091
- className: "eyebrow",
2092
- children: "Durable application state"
2093
- }),
2094
- /* @__PURE__ */ s("h1", { children: "Proposals" }),
2095
- /* @__PURE__ */ c("p", { children: [
2096
- "Contract-governed application changes stored in ",
2097
- /* @__PURE__ */ s("code", { children: "_feltdb.Proposal" }),
2098
- "."
2099
- ] })
2100
- ] }),
2101
- l && /* @__PURE__ */ s("p", {
2102
- className: "proposal-warning",
2103
- children: l
2104
- }),
2105
- /* @__PURE__ */ c("div", {
2106
- className: "proposal-browser-layout",
2107
- children: [/* @__PURE__ */ c("section", {
2108
- className: "studio-card",
2109
- children: [
2110
- /* @__PURE__ */ s("h2", { children: "History" }),
2111
- !e.length && /* @__PURE__ */ s("p", { children: "No proposals yet." }),
2112
- e.map((e) => /* @__PURE__ */ c("button", {
2113
- className: "proposal-list-row",
2114
- onClick: () => f(e.id),
2115
- children: [/* @__PURE__ */ c("span", { children: [/* @__PURE__ */ s("strong", { children: e.summary }), /* @__PURE__ */ c("small", { children: [
2116
- e.id,
2117
- " · ",
2118
- String(e.created_at)
2119
- ] })] }), /* @__PURE__ */ s("b", { children: e.status })]
2120
- }, e.id))
2121
- ]
2122
- }), /* @__PURE__ */ s("section", {
2123
- className: "studio-card proposal-detail",
2124
- children: r ? /* @__PURE__ */ c(o, { children: [
2125
- /* @__PURE__ */ s("h2", { children: r.proposal.summary }),
2126
- /* @__PURE__ */ c("p", { children: [
2127
- /* @__PURE__ */ s("b", { children: r.proposal.status }),
2128
- " · contract v",
2129
- r.proposal.base_contract_version,
2130
- /* @__PURE__ */ s("br", {}),
2131
- /* @__PURE__ */ s("code", { children: r.proposal.base_contract_hash })
2132
- ] }),
2133
- /* @__PURE__ */ s("h3", { children: "Contract diff" }),
2134
- /* @__PURE__ */ s("pre", { children: r.proposal.contract_diff.join("\n") || "Not validated" }),
2135
- /* @__PURE__ */ s("h3", { children: "Source plan" }),
2136
- /* @__PURE__ */ s("pre", { children: JSON.stringify(r.proposal.source_plan, null, 2) }),
2137
- /* @__PURE__ */ s("h3", { children: "Warnings" }),
2138
- /* @__PURE__ */ s("p", { children: r.proposal.warnings.join(" · ") || "None" }),
2139
- /* @__PURE__ */ c("details", { children: [/* @__PURE__ */ s("summary", { children: "Proposed flow" }), /* @__PURE__ */ s("pre", { children: r.proposal.proposed_flow })] }),
2140
- /* @__PURE__ */ s("h3", { children: "Status history" }),
2141
- /* @__PURE__ */ s("ol", { children: r.history.map((e) => /* @__PURE__ */ c("li", { children: [
2142
- String(e.created_at),
2143
- " — ",
2144
- e.from_status ? `${e.from_status} → ` : "",
2145
- e.to_status
2146
- ] }, e.id)) }),
2147
- r.proposal.status === "approved" && /* @__PURE__ */ c("p", {
2148
- className: "proposal-boundary",
2149
- children: [
2150
- "Approved. Run ",
2151
- /* @__PURE__ */ c("code", { children: ["feltdb ai apply ", r.proposal.id] }),
2152
- " in the project."
2153
- ]
2154
- })
2155
- ] }) : /* @__PURE__ */ s("p", { children: "Select a proposal to inspect its flow, diff, source plan, warnings, and audit history." })
2156
- })]
2157
- })
2158
- ]
2159
- });
2160
- }
2161
- //#endregion
2162
- export { g as C, y as S, b as _, L as a, x as b, P as c, j as d, k as f, w as g, E as h, R as i, N as l, D as m, V as n, I as o, O as p, B as r, F as s, H as t, M as u, v, S as x, _ as y };