@feltdb/core 0.4.4 → 0.4.6
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.
- package/README.md +22 -0
- package/bin/create-feltdb.js +3 -0
- package/bin/feltdb.js +3 -0
- package/dist/analytics-backend.js +1 -1
- package/dist/cli/api-client.js +236 -0
- package/dist/cli/cli.js +18 -0
- package/dist/cli/commands.js +795 -0
- package/dist/cli/config.js +66 -0
- package/dist/cli/index.js +399 -0
- package/dist/create/application-identity.js +132 -0
- package/dist/create/cli-scripts-generator.js +211 -0
- package/dist/create/cli.js +202 -0
- package/dist/create/create.js +638 -0
- package/dist/create/docker-compose-generator.js +258 -0
- package/dist/create/index.js +4 -0
- package/dist/create/package-versions.js +4 -0
- package/dist/create/runtime-templates.js +272 -0
- package/dist/index-backend.js +1 -1
- package/dist/migrate/analyzer/index.d.ts +2 -0
- package/dist/migrate/analyzer/index.js +34 -0
- package/dist/migrate/benchmark/index.d.ts +13 -0
- package/dist/migrate/benchmark/index.js +8 -0
- package/dist/migrate/capability-gate/index.d.ts +3 -0
- package/dist/migrate/capability-gate/index.js +3 -0
- package/dist/migrate/classifier/index.d.ts +3 -0
- package/dist/migrate/classifier/index.js +53 -0
- package/dist/migrate/cli/index.d.ts +2 -0
- package/dist/migrate/cli/index.js +201 -0
- package/dist/migrate/domain-model/index.d.ts +2 -0
- package/dist/migrate/domain-model/index.js +4 -0
- package/dist/migrate/generator/index.d.ts +2 -0
- package/dist/migrate/generator/index.js +21 -0
- package/dist/migrate/index.d.ts +16 -0
- package/dist/migrate/index.js +16 -0
- package/dist/migrate/measurement/index.d.ts +7 -0
- package/dist/migrate/measurement/index.js +1 -0
- package/dist/migrate/migrator/index.d.ts +2 -0
- package/dist/migrate/migrator/index.js +35 -0
- package/dist/migrate/planner/index.d.ts +2 -0
- package/dist/migrate/planner/index.js +12 -0
- package/dist/migrate/prover/index.d.ts +9 -0
- package/dist/migrate/prover/index.js +3 -0
- package/dist/migrate/reporter/index.d.ts +4 -0
- package/dist/migrate/reporter/index.js +1 -0
- package/dist/migrate/runtime-dependencies/index.d.ts +13 -0
- package/dist/migrate/runtime-dependencies/index.js +112 -0
- package/dist/migrate/state-contract/index.d.ts +13 -0
- package/dist/migrate/state-contract/index.js +49 -0
- package/dist/migrate/types/index.d.ts +228 -0
- package/dist/migrate/types/index.js +1 -0
- package/dist/migrate/ui-wiring/index.d.ts +18 -0
- package/dist/migrate/ui-wiring/index.js +2 -0
- package/dist/migrate/util.d.ts +5 -0
- package/dist/migrate/util.js +10 -0
- package/dist/react/index.d.ts +7 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +6 -0
- package/dist/react/useCapability.d.ts +11 -0
- package/dist/react/useCapability.d.ts.map +1 -0
- package/dist/react/useCapability.js +30 -0
- package/dist/react/useCollection.d.ts +17 -0
- package/dist/react/useCollection.d.ts.map +1 -0
- package/dist/react/useCollection.js +69 -0
- package/dist/react/useFeltDB.d.ts +136 -0
- package/dist/react/useFeltDB.d.ts.map +1 -0
- package/dist/react/useFeltDB.js +350 -0
- package/dist/studio/.gitkeep +1 -0
- package/dist/studio/KeyManagementPanel-BOvWTRyH.js +246 -0
- package/dist/studio/app.d.ts +10 -0
- package/dist/studio/app.d.ts.map +1 -0
- package/dist/studio/components/AgentExplorer.d.ts +9 -0
- package/dist/studio/components/AgentExplorer.d.ts.map +1 -0
- package/dist/studio/components/ApplicationDesigner.d.ts +11 -0
- package/dist/studio/components/ApplicationDesigner.d.ts.map +1 -0
- package/dist/studio/components/CapabilityExplorer.d.ts +9 -0
- package/dist/studio/components/CapabilityExplorer.d.ts.map +1 -0
- package/dist/studio/components/ConflictExplorer.d.ts +9 -0
- package/dist/studio/components/ConflictExplorer.d.ts.map +1 -0
- package/dist/studio/components/ExecutionViewer.d.ts +9 -0
- package/dist/studio/components/ExecutionViewer.d.ts.map +1 -0
- package/dist/studio/components/GlobalSearch.d.ts +10 -0
- package/dist/studio/components/GlobalSearch.d.ts.map +1 -0
- package/dist/studio/components/HealthCenter.d.ts +9 -0
- package/dist/studio/components/HealthCenter.d.ts.map +1 -0
- package/dist/studio/components/KeyManagementPanel.d.ts +9 -0
- package/dist/studio/components/KeyManagementPanel.d.ts.map +1 -0
- package/dist/studio/components/KeyManagementPanel.js +2 -0
- package/dist/studio/components/ManagedInstancePanel.d.ts +4 -0
- package/dist/studio/components/ManagedInstancePanel.d.ts.map +1 -0
- package/dist/studio/components/ManagedInstancePanel.js +281 -0
- package/dist/studio/components/OperationsExplorer.d.ts +10 -0
- package/dist/studio/components/OperationsExplorer.d.ts.map +1 -0
- package/dist/studio/components/OverviewDashboard.d.ts +8 -0
- package/dist/studio/components/OverviewDashboard.d.ts.map +1 -0
- package/dist/studio/components/PeerMap.d.ts +8 -0
- package/dist/studio/components/PeerMap.d.ts.map +1 -0
- package/dist/studio/components/ProvenanceViewer.d.ts +11 -0
- package/dist/studio/components/ProvenanceViewer.d.ts.map +1 -0
- package/dist/studio/components/ReferenceExplorer.d.ts +10 -0
- package/dist/studio/components/ReferenceExplorer.d.ts.map +1 -0
- package/dist/studio/components/SettingsPanel.d.ts +7 -0
- package/dist/studio/components/SettingsPanel.d.ts.map +1 -0
- package/dist/studio/components/StateExplorer.d.ts +10 -0
- package/dist/studio/components/StateExplorer.d.ts.map +1 -0
- package/dist/studio/components/WorkflowVisualizer.d.ts +9 -0
- package/dist/studio/components/WorkflowVisualizer.d.ts.map +1 -0
- package/dist/studio/components/index.d.ts +24 -0
- package/dist/studio/components/index.d.ts.map +1 -0
- package/dist/studio/components/index.js +4 -0
- package/dist/studio/components-BRYUceo9.js +1711 -0
- package/dist/studio/hooks/index.d.ts +37 -0
- package/dist/studio/hooks/index.d.ts.map +1 -0
- package/dist/studio/index.d.ts +27 -0
- package/dist/studio/index.d.ts.map +1 -0
- package/dist/studio/index.html +30 -0
- package/dist/studio/index.js +236 -0
- package/dist/studio/main.d.ts +1 -0
- package/dist/studio/main.d.ts.map +1 -0
- package/dist/studio/studio.css +2 -0
- package/dist/studio/types/index.d.ts +133 -0
- package/dist/studio/types/index.d.ts.map +1 -0
- package/dist/studio/utils/api.d.ts +27 -0
- package/dist/studio/utils/api.d.ts.map +1 -0
- package/dist/studio/utils/format.d.ts +24 -0
- package/dist/studio/utils/format.d.ts.map +1 -0
- package/dist/studio/utils/index.d.ts +7 -0
- package/dist/studio/utils/index.d.ts.map +1 -0
- package/dist/studio/utils/index.js +75 -0
- package/dist/studio/utils/managed-instance.d.ts +40 -0
- package/dist/studio/utils/managed-instance.d.ts.map +1 -0
- package/dist/studio/utils/managed-instance.js +51 -0
- package/dist/studio-app/.gitkeep +1 -0
- package/dist/studio-app/assets/feltdb_wasm-BXMn9UxO.js +1 -0
- package/dist/studio-app/assets/feltdb_wasm_bg-bYYbZeRM.wasm +0 -0
- package/dist/studio-app/assets/index-B-lZjdtI.js +28 -0
- package/dist/studio-app/assets/index-CB-Eed9V.css +1 -0
- package/dist/studio-app/index.html +3 -0
- package/dist/wasm/feltdb_wasm.d.ts +461 -0
- package/dist/wasm/feltdb_wasm.js +1690 -0
- package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
- package/dist/wasm/feltdb_wasm_bg.wasm.d.ts +84 -0
- package/dist/wasm/package.json +16 -0
- package/package.json +40 -5
|
@@ -0,0 +1,1711 @@
|
|
|
1
|
+
import "./KeyManagementPanel-BOvWTRyH.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 }) {
|
|
246
|
+
let { items: r, loading: i, error: o } = b(e, t.name), [l, u] = 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: i ? "…" : r.length })] }),
|
|
254
|
+
o && /* @__PURE__ */ s("p", {
|
|
255
|
+
className: "runtime-error",
|
|
256
|
+
children: o
|
|
257
|
+
}),
|
|
258
|
+
!i && !r.length && /* @__PURE__ */ s("div", {
|
|
259
|
+
className: "model-empty compact",
|
|
260
|
+
children: "No materialized state yet. Mutations will appear here live."
|
|
261
|
+
}),
|
|
262
|
+
r.map((e, r) => {
|
|
263
|
+
let i = String(e.id ?? e.key ?? r);
|
|
264
|
+
return /* @__PURE__ */ c("button", {
|
|
265
|
+
className: "state-row",
|
|
266
|
+
onClick: () => u(l === 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: l === r ? "−" : "+" }),
|
|
277
|
+
l === 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: n = "default" }) {
|
|
285
|
+
return /* @__PURE__ */ c("div", {
|
|
286
|
+
className: "studio-model-page",
|
|
287
|
+
children: [
|
|
288
|
+
/* @__PURE__ */ c("header", { children: [
|
|
289
|
+
/* @__PURE__ */ s("span", {
|
|
290
|
+
className: "eyebrow",
|
|
291
|
+
children: "Observe"
|
|
292
|
+
}),
|
|
293
|
+
/* @__PURE__ */ s("h1", { children: "State" }),
|
|
294
|
+
/* @__PURE__ */ s("p", { children: "Live, materialized application state. Every object is addressable and reactive." })
|
|
295
|
+
] }),
|
|
296
|
+
/* @__PURE__ */ c("div", {
|
|
297
|
+
className: "model-summary",
|
|
298
|
+
children: [
|
|
299
|
+
/* @__PURE__ */ c("span", { children: [t?.collections.length ?? 0, " collections"] }),
|
|
300
|
+
/* @__PURE__ */ c("span", { children: [n, " namespace"] }),
|
|
301
|
+
/* @__PURE__ */ s("span", { children: e ? "runtime connected" : "runtime unavailable" })
|
|
302
|
+
]
|
|
303
|
+
}),
|
|
304
|
+
/* @__PURE__ */ c("div", {
|
|
305
|
+
className: "state-grid",
|
|
306
|
+
children: [t?.collections.map((t) => /* @__PURE__ */ s(C, {
|
|
307
|
+
db: e ?? null,
|
|
308
|
+
definition: t,
|
|
309
|
+
namespace: n
|
|
310
|
+
}, t.name)), !t?.collections.length && /* @__PURE__ */ c("div", {
|
|
311
|
+
className: "model-empty",
|
|
312
|
+
children: [
|
|
313
|
+
"No collection model is loaded. Open Studio through ",
|
|
314
|
+
/* @__PURE__ */ s("code", { children: "feltdb dev" }),
|
|
315
|
+
" to load the active project."
|
|
316
|
+
]
|
|
317
|
+
})]
|
|
318
|
+
})
|
|
319
|
+
]
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
//#endregion
|
|
323
|
+
//#region src/components/ReferenceExplorer.tsx
|
|
324
|
+
function T(e) {
|
|
325
|
+
let t = e.trim().replace(/^flow:\/\//, "").split("/").filter(Boolean);
|
|
326
|
+
return e.startsWith("flow://") ? t.length >= 3 ? {
|
|
327
|
+
collection: t[t.length - 2],
|
|
328
|
+
id: t[t.length - 1]
|
|
329
|
+
} : null : t.length >= 2 ? {
|
|
330
|
+
collection: t[t.length - 2],
|
|
331
|
+
id: t[t.length - 1]
|
|
332
|
+
} : null;
|
|
333
|
+
}
|
|
334
|
+
function E({ db: e, model: t, namespace: n = "default" }) {
|
|
335
|
+
let [r, i] = a(""), [o, l] = a(), [u, d] = a("Enter a reference to resolve live state."), f = async () => {
|
|
336
|
+
let t = T(r);
|
|
337
|
+
if (!t || !e) {
|
|
338
|
+
l(void 0), d(e ? "Use Collection/id or flow://namespace/Collection/id." : "Runtime unavailable.");
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
let n = await e.collection(t.collection).get(t.id);
|
|
342
|
+
l(n), d(n ? "Materialized locally" : "Reference is valid but is not materialized locally");
|
|
343
|
+
};
|
|
344
|
+
return /* @__PURE__ */ c("div", {
|
|
345
|
+
className: "studio-model-page",
|
|
346
|
+
children: [
|
|
347
|
+
/* @__PURE__ */ c("header", { children: [
|
|
348
|
+
/* @__PURE__ */ s("span", {
|
|
349
|
+
className: "eyebrow",
|
|
350
|
+
children: "Observe"
|
|
351
|
+
}),
|
|
352
|
+
/* @__PURE__ */ s("h1", { children: "References" }),
|
|
353
|
+
/* @__PURE__ */ s("p", { children: "Resolve stable Flow references directly into their materialized state." })
|
|
354
|
+
] }),
|
|
355
|
+
/* @__PURE__ */ c("div", {
|
|
356
|
+
className: "reference-query",
|
|
357
|
+
children: [/* @__PURE__ */ s("input", {
|
|
358
|
+
value: r,
|
|
359
|
+
onChange: (e) => i(e.target.value),
|
|
360
|
+
onKeyDown: (e) => {
|
|
361
|
+
e.key === "Enter" && f();
|
|
362
|
+
},
|
|
363
|
+
placeholder: `flow://${n}/Collection/id`
|
|
364
|
+
}), /* @__PURE__ */ s("button", {
|
|
365
|
+
onClick: () => void f(),
|
|
366
|
+
children: "Resolve"
|
|
367
|
+
})]
|
|
368
|
+
}),
|
|
369
|
+
/* @__PURE__ */ c("div", {
|
|
370
|
+
className: "reference-layout",
|
|
371
|
+
children: [/* @__PURE__ */ c("article", {
|
|
372
|
+
className: "studio-card",
|
|
373
|
+
children: [/* @__PURE__ */ s("span", {
|
|
374
|
+
className: "card-kind",
|
|
375
|
+
children: "Known collections"
|
|
376
|
+
}), t?.collections.map((e) => /* @__PURE__ */ c("button", {
|
|
377
|
+
className: "reference-example",
|
|
378
|
+
onClick: () => i(`flow://${n}/${e.name}/id`),
|
|
379
|
+
children: [e.name, /* @__PURE__ */ c("small", { children: [e.fields.length, " fields"] })]
|
|
380
|
+
}, e.name))]
|
|
381
|
+
}), /* @__PURE__ */ c("article", {
|
|
382
|
+
className: "studio-card reference-result",
|
|
383
|
+
children: [
|
|
384
|
+
/* @__PURE__ */ s("span", {
|
|
385
|
+
className: "card-kind",
|
|
386
|
+
children: "Resolution"
|
|
387
|
+
}),
|
|
388
|
+
/* @__PURE__ */ s("h2", { children: u }),
|
|
389
|
+
o !== void 0 && /* @__PURE__ */ s("pre", { children: JSON.stringify(o, null, 2) })
|
|
390
|
+
]
|
|
391
|
+
})]
|
|
392
|
+
})
|
|
393
|
+
]
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
//#endregion
|
|
397
|
+
//#region src/components/OperationsExplorer.tsx
|
|
398
|
+
function D({ db: e, namespace: t = "default" }) {
|
|
399
|
+
let [r, i] = a([]), [o, l] = a("all");
|
|
400
|
+
n(() => {
|
|
401
|
+
if (!e) return;
|
|
402
|
+
let t = !0, n = async () => {
|
|
403
|
+
let n = await e.auditEvents();
|
|
404
|
+
t && i(n.slice().reverse());
|
|
405
|
+
};
|
|
406
|
+
n();
|
|
407
|
+
let r = setInterval(() => void n(), 1e3);
|
|
408
|
+
return () => {
|
|
409
|
+
t = !1, clearInterval(r);
|
|
410
|
+
};
|
|
411
|
+
}, [e]);
|
|
412
|
+
let u = r.filter((e) => o === "all" || e.type === o);
|
|
413
|
+
return /* @__PURE__ */ c("div", {
|
|
414
|
+
className: "studio-model-page",
|
|
415
|
+
children: [
|
|
416
|
+
/* @__PURE__ */ c("header", { children: [
|
|
417
|
+
/* @__PURE__ */ s("span", {
|
|
418
|
+
className: "eyebrow",
|
|
419
|
+
children: "Observe"
|
|
420
|
+
}),
|
|
421
|
+
/* @__PURE__ */ s("h1", { children: "Operations" }),
|
|
422
|
+
/* @__PURE__ */ s("p", { children: "The runtime's durable local mutation log—not a simulated activity feed." })
|
|
423
|
+
] }),
|
|
424
|
+
/* @__PURE__ */ c("div", {
|
|
425
|
+
className: "model-summary",
|
|
426
|
+
children: [
|
|
427
|
+
/* @__PURE__ */ c("span", { children: [r.length, " recorded"] }),
|
|
428
|
+
/* @__PURE__ */ c("span", { children: [t, " namespace"] }),
|
|
429
|
+
/* @__PURE__ */ c("select", {
|
|
430
|
+
value: o,
|
|
431
|
+
onChange: (e) => l(e.target.value),
|
|
432
|
+
children: [
|
|
433
|
+
/* @__PURE__ */ s("option", {
|
|
434
|
+
value: "all",
|
|
435
|
+
children: "All mutations"
|
|
436
|
+
}),
|
|
437
|
+
/* @__PURE__ */ s("option", {
|
|
438
|
+
value: "put",
|
|
439
|
+
children: "Writes"
|
|
440
|
+
}),
|
|
441
|
+
/* @__PURE__ */ s("option", {
|
|
442
|
+
value: "delete",
|
|
443
|
+
children: "Deletes"
|
|
444
|
+
})
|
|
445
|
+
]
|
|
446
|
+
})
|
|
447
|
+
]
|
|
448
|
+
}),
|
|
449
|
+
/* @__PURE__ */ s("div", {
|
|
450
|
+
className: "table-shell",
|
|
451
|
+
children: /* @__PURE__ */ c("table", {
|
|
452
|
+
className: "operations-table",
|
|
453
|
+
children: [/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ c("tr", { children: [
|
|
454
|
+
/* @__PURE__ */ s("th", { children: "Sequence" }),
|
|
455
|
+
/* @__PURE__ */ s("th", { children: "Mutation" }),
|
|
456
|
+
/* @__PURE__ */ s("th", { children: "Collection" }),
|
|
457
|
+
/* @__PURE__ */ s("th", { children: "Key" }),
|
|
458
|
+
/* @__PURE__ */ s("th", { children: "Timestamp" })
|
|
459
|
+
] }) }), /* @__PURE__ */ c("tbody", { children: [u.map((e) => /* @__PURE__ */ c("tr", { children: [
|
|
460
|
+
/* @__PURE__ */ s("td", { children: e.sequence }),
|
|
461
|
+
/* @__PURE__ */ s("td", { children: /* @__PURE__ */ s("span", {
|
|
462
|
+
className: `event-pill ${e.type}`,
|
|
463
|
+
children: e.type
|
|
464
|
+
}) }),
|
|
465
|
+
/* @__PURE__ */ s("td", { children: e.collection }),
|
|
466
|
+
/* @__PURE__ */ s("td", { children: /* @__PURE__ */ s("code", { children: e.key }) }),
|
|
467
|
+
/* @__PURE__ */ s("td", { children: new Date(e.timestamp).toLocaleString() })
|
|
468
|
+
] }, `${e.sequence}-${e.key}`)), !u.length && /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s("td", {
|
|
469
|
+
colSpan: 5,
|
|
470
|
+
className: "empty-message",
|
|
471
|
+
children: "No matching mutations yet. Create or change application state to populate this stream."
|
|
472
|
+
}) })] })]
|
|
473
|
+
})
|
|
474
|
+
})
|
|
475
|
+
]
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region src/components/PeerMap.tsx
|
|
480
|
+
function O({ peers: t = [], localInstance: n = "local" }) {
|
|
481
|
+
return /* @__PURE__ */ c("div", {
|
|
482
|
+
className: "studio-model-page",
|
|
483
|
+
children: [
|
|
484
|
+
/* @__PURE__ */ c("header", { children: [
|
|
485
|
+
/* @__PURE__ */ s("span", {
|
|
486
|
+
className: "eyebrow",
|
|
487
|
+
children: "Observe"
|
|
488
|
+
}),
|
|
489
|
+
/* @__PURE__ */ s("h1", { children: "Peers" }),
|
|
490
|
+
/* @__PURE__ */ s("p", { children: "The live topology participating in this application's convergence fabric." })
|
|
491
|
+
] }),
|
|
492
|
+
/* @__PURE__ */ c("div", {
|
|
493
|
+
className: "peer-topology",
|
|
494
|
+
children: [/* @__PURE__ */ c("article", {
|
|
495
|
+
className: "peer-node local",
|
|
496
|
+
children: [
|
|
497
|
+
/* @__PURE__ */ s("span", { children: "this instance" }),
|
|
498
|
+
/* @__PURE__ */ s("h2", { children: n }),
|
|
499
|
+
/* @__PURE__ */ s("small", { children: "online · authoritative local state" })
|
|
500
|
+
]
|
|
501
|
+
}), t.map((t) => /* @__PURE__ */ c(e.Fragment, { children: [/* @__PURE__ */ s("i", { className: "peer-link" }), /* @__PURE__ */ c("article", {
|
|
502
|
+
className: "peer-node",
|
|
503
|
+
children: [
|
|
504
|
+
/* @__PURE__ */ s("span", { children: "connected peer" }),
|
|
505
|
+
/* @__PURE__ */ s("h2", { children: t }),
|
|
506
|
+
/* @__PURE__ */ s("small", { children: "online · exchanging operations" })
|
|
507
|
+
]
|
|
508
|
+
})] }, t))]
|
|
509
|
+
}),
|
|
510
|
+
!t.length && /* @__PURE__ */ s("div", {
|
|
511
|
+
className: "model-empty",
|
|
512
|
+
children: "This embedded runtime is operating independently. Its state remains durable and can converge when a network peer is attached."
|
|
513
|
+
})
|
|
514
|
+
]
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
//#endregion
|
|
518
|
+
//#region src/components/CapabilityExplorer.tsx
|
|
519
|
+
function k({ model: e }) {
|
|
520
|
+
let t = e?.capabilities ?? [];
|
|
521
|
+
return /* @__PURE__ */ c("div", {
|
|
522
|
+
className: "studio-model-page",
|
|
523
|
+
children: [
|
|
524
|
+
/* @__PURE__ */ c("header", { children: [
|
|
525
|
+
/* @__PURE__ */ s("span", {
|
|
526
|
+
className: "eyebrow",
|
|
527
|
+
children: "Design"
|
|
528
|
+
}),
|
|
529
|
+
/* @__PURE__ */ s("h1", { children: "Capabilities" }),
|
|
530
|
+
/* @__PURE__ */ c("p", { children: [
|
|
531
|
+
"Declared authority available to workflows and autonomous agents in ",
|
|
532
|
+
e?.app ?? "this application",
|
|
533
|
+
"."
|
|
534
|
+
] })
|
|
535
|
+
] }),
|
|
536
|
+
/* @__PURE__ */ c("div", {
|
|
537
|
+
className: "model-summary",
|
|
538
|
+
children: [/* @__PURE__ */ c("span", { children: [t.length, " declared"] }), /* @__PURE__ */ c("span", { children: [new Set(t.flatMap((e) => e.statements)).size, " permission rules"] })]
|
|
539
|
+
}),
|
|
540
|
+
/* @__PURE__ */ c("div", {
|
|
541
|
+
className: "studio-card-grid",
|
|
542
|
+
children: [t.map((e) => /* @__PURE__ */ c("article", {
|
|
543
|
+
className: "studio-card capability-card",
|
|
544
|
+
children: [
|
|
545
|
+
/* @__PURE__ */ s("div", {
|
|
546
|
+
className: "card-kind",
|
|
547
|
+
children: "capability"
|
|
548
|
+
}),
|
|
549
|
+
/* @__PURE__ */ s("h2", { children: e.name }),
|
|
550
|
+
/* @__PURE__ */ s("div", {
|
|
551
|
+
className: "statement-list",
|
|
552
|
+
children: e.statements.map((e) => {
|
|
553
|
+
let [t, ...n] = e.split(" ");
|
|
554
|
+
return /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("b", { children: t }), /* @__PURE__ */ s("code", { children: n.join(" ") })] }, e);
|
|
555
|
+
})
|
|
556
|
+
})
|
|
557
|
+
]
|
|
558
|
+
}, e.name)), !t.length && /* @__PURE__ */ s("div", {
|
|
559
|
+
className: "model-empty",
|
|
560
|
+
children: "No capabilities are declared in the current project model."
|
|
561
|
+
})]
|
|
562
|
+
})
|
|
563
|
+
]
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
//#endregion
|
|
567
|
+
//#region src/components/ExecutionViewer.tsx
|
|
568
|
+
function A({ db: e, name: t, label: n }) {
|
|
569
|
+
let { items: r } = b(e, t);
|
|
570
|
+
return r.length ? /* @__PURE__ */ c("section", { children: [/* @__PURE__ */ c("h2", { children: [n, /* @__PURE__ */ s("span", { children: r.length })] }), /* @__PURE__ */ s("div", {
|
|
571
|
+
className: "execution-list",
|
|
572
|
+
children: r.map((e, r) => /* @__PURE__ */ c("article", {
|
|
573
|
+
className: "execution-row",
|
|
574
|
+
children: [
|
|
575
|
+
/* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("b", { children: String(e.name ?? e.workflow ?? e.incident_id ?? e.id ?? n) }), /* @__PURE__ */ s("small", { children: t })] }),
|
|
576
|
+
/* @__PURE__ */ s("span", {
|
|
577
|
+
className: "event-pill put",
|
|
578
|
+
children: String(e.status ?? e.state ?? "materialized")
|
|
579
|
+
}),
|
|
580
|
+
/* @__PURE__ */ s("pre", { children: JSON.stringify(e, null, 2) })
|
|
581
|
+
]
|
|
582
|
+
}, String(e.id ?? r)))
|
|
583
|
+
})] }) : null;
|
|
584
|
+
}
|
|
585
|
+
function j({ db: e, model: t }) {
|
|
586
|
+
return /* @__PURE__ */ c("div", {
|
|
587
|
+
className: "studio-model-page",
|
|
588
|
+
children: [
|
|
589
|
+
/* @__PURE__ */ c("header", { children: [
|
|
590
|
+
/* @__PURE__ */ s("span", {
|
|
591
|
+
className: "eyebrow",
|
|
592
|
+
children: "Observe"
|
|
593
|
+
}),
|
|
594
|
+
/* @__PURE__ */ s("h1", { children: "Executions" }),
|
|
595
|
+
/* @__PURE__ */ s("p", { children: "Capability work, workflow runs, assignments, and agent decisions as inspectable state." })
|
|
596
|
+
] }),
|
|
597
|
+
/* @__PURE__ */ c("div", {
|
|
598
|
+
className: "model-summary",
|
|
599
|
+
children: [/* @__PURE__ */ c("span", { children: [t?.workflows.length ?? 0, " workflow definitions"] }), /* @__PURE__ */ c("span", { children: [t?.agents.length ?? 0, " autonomous agents"] })]
|
|
600
|
+
}),
|
|
601
|
+
/* @__PURE__ */ s(A, {
|
|
602
|
+
db: e ?? null,
|
|
603
|
+
name: "_flow_executions",
|
|
604
|
+
label: "Capability executions"
|
|
605
|
+
}),
|
|
606
|
+
/* @__PURE__ */ s(A, {
|
|
607
|
+
db: e ?? null,
|
|
608
|
+
name: "_flow_workflow_runs",
|
|
609
|
+
label: "Workflow runs"
|
|
610
|
+
}),
|
|
611
|
+
/* @__PURE__ */ s(A, {
|
|
612
|
+
db: e ?? null,
|
|
613
|
+
name: "Assignment",
|
|
614
|
+
label: "Materialized assignments"
|
|
615
|
+
}),
|
|
616
|
+
/* @__PURE__ */ s(A, {
|
|
617
|
+
db: e ?? null,
|
|
618
|
+
name: "Decision",
|
|
619
|
+
label: "Agent decisions"
|
|
620
|
+
}),
|
|
621
|
+
/* @__PURE__ */ s(A, {
|
|
622
|
+
db: e ?? null,
|
|
623
|
+
name: "_flow_agent_executions",
|
|
624
|
+
label: "Agent executions"
|
|
625
|
+
}),
|
|
626
|
+
/* @__PURE__ */ c("div", {
|
|
627
|
+
className: "model-empty execution-empty",
|
|
628
|
+
children: [
|
|
629
|
+
"Execution sections appear as soon as their state is committed. Defined workflows: ",
|
|
630
|
+
t?.workflows.map((e) => e.name).join(", ") || "none",
|
|
631
|
+
"."
|
|
632
|
+
]
|
|
633
|
+
})
|
|
634
|
+
]
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
//#endregion
|
|
638
|
+
//#region src/components/ConflictExplorer.tsx
|
|
639
|
+
function M({ db: e, diagnostics: t }) {
|
|
640
|
+
let n = e?.sync(), r = n?.conflicts_detected ?? 0;
|
|
641
|
+
return /* @__PURE__ */ c("div", {
|
|
642
|
+
className: "studio-model-page",
|
|
643
|
+
children: [
|
|
644
|
+
/* @__PURE__ */ c("header", { children: [
|
|
645
|
+
/* @__PURE__ */ s("span", {
|
|
646
|
+
className: "eyebrow",
|
|
647
|
+
children: "Observe"
|
|
648
|
+
}),
|
|
649
|
+
/* @__PURE__ */ s("h1", { children: "Conflicts" }),
|
|
650
|
+
/* @__PURE__ */ s("p", { children: "Concurrent mutations detected while replicas converge." })
|
|
651
|
+
] }),
|
|
652
|
+
/* @__PURE__ */ c("div", {
|
|
653
|
+
className: "metric-grid",
|
|
654
|
+
children: [
|
|
655
|
+
/* @__PURE__ */ c("article", { children: [/* @__PURE__ */ s("b", { children: r }), /* @__PURE__ */ s("span", { children: "detected" })] }),
|
|
656
|
+
/* @__PURE__ */ c("article", { children: [/* @__PURE__ */ s("b", { children: n?.pending_operations ?? 0 }), /* @__PURE__ */ s("span", { children: "pending operations" })] }),
|
|
657
|
+
/* @__PURE__ */ c("article", { children: [/* @__PURE__ */ s("b", { children: n?.connected_peers.length ?? 0 }), /* @__PURE__ */ s("span", { children: "connected peers" })] })
|
|
658
|
+
]
|
|
659
|
+
}),
|
|
660
|
+
/* @__PURE__ */ c("article", {
|
|
661
|
+
className: "studio-card",
|
|
662
|
+
children: [
|
|
663
|
+
/* @__PURE__ */ s("span", {
|
|
664
|
+
className: "card-kind",
|
|
665
|
+
children: "Convergence"
|
|
666
|
+
}),
|
|
667
|
+
/* @__PURE__ */ s("h2", { children: r ? "Conflict activity detected" : "No conflicts detected" }),
|
|
668
|
+
/* @__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." }),
|
|
669
|
+
/* @__PURE__ */ s("code", { children: "Causal ordering → deterministic materialization → auditable resolution" })
|
|
670
|
+
]
|
|
671
|
+
})
|
|
672
|
+
]
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
//#endregion
|
|
676
|
+
//#region src/components/WorkflowVisualizer.tsx
|
|
677
|
+
function N({ model: t }) {
|
|
678
|
+
let n = t?.workflows ?? [], [r, i] = a(), l = n.find((e) => e.name === r) ?? n[0];
|
|
679
|
+
return /* @__PURE__ */ c("div", {
|
|
680
|
+
className: "studio-model-page",
|
|
681
|
+
children: [/* @__PURE__ */ c("header", { children: [
|
|
682
|
+
/* @__PURE__ */ s("span", {
|
|
683
|
+
className: "eyebrow",
|
|
684
|
+
children: "Design"
|
|
685
|
+
}),
|
|
686
|
+
/* @__PURE__ */ s("h1", { children: "Workflows" }),
|
|
687
|
+
/* @__PURE__ */ s("p", { children: "Durable state transitions declared by the application model." })
|
|
688
|
+
] }), /* @__PURE__ */ c("div", {
|
|
689
|
+
className: "split-browser",
|
|
690
|
+
children: [/* @__PURE__ */ s("aside", { children: n.map((e) => /* @__PURE__ */ c("button", {
|
|
691
|
+
className: e.name === l?.name ? "active" : "",
|
|
692
|
+
onClick: () => i(e.name),
|
|
693
|
+
children: [/* @__PURE__ */ s("strong", { children: e.name }), /* @__PURE__ */ c("span", { children: [e.steps.length, " steps"] })]
|
|
694
|
+
}, e.name)) }), /* @__PURE__ */ s("section", { children: l ? /* @__PURE__ */ c(o, { children: [
|
|
695
|
+
/* @__PURE__ */ s("div", {
|
|
696
|
+
className: "card-kind",
|
|
697
|
+
children: "workflow"
|
|
698
|
+
}),
|
|
699
|
+
/* @__PURE__ */ s("h2", { children: l.name }),
|
|
700
|
+
l.parameters.length > 0 && /* @__PURE__ */ c("code", {
|
|
701
|
+
className: "signature",
|
|
702
|
+
children: [
|
|
703
|
+
"(",
|
|
704
|
+
l.parameters,
|
|
705
|
+
")"
|
|
706
|
+
]
|
|
707
|
+
}),
|
|
708
|
+
/* @__PURE__ */ s("div", {
|
|
709
|
+
className: "workflow-track",
|
|
710
|
+
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))
|
|
711
|
+
})
|
|
712
|
+
] }) : /* @__PURE__ */ s("div", {
|
|
713
|
+
className: "model-empty",
|
|
714
|
+
children: "No workflows are declared."
|
|
715
|
+
}) })]
|
|
716
|
+
})]
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
//#endregion
|
|
720
|
+
//#region src/components/AgentExplorer.tsx
|
|
721
|
+
function P({ model: e }) {
|
|
722
|
+
let t = e?.agents ?? [], [n, r] = a(), i = t.find((e) => e.name === n) ?? t[0];
|
|
723
|
+
return /* @__PURE__ */ c("div", {
|
|
724
|
+
className: "studio-model-page",
|
|
725
|
+
children: [/* @__PURE__ */ c("header", { children: [
|
|
726
|
+
/* @__PURE__ */ s("span", {
|
|
727
|
+
className: "eyebrow",
|
|
728
|
+
children: "Design"
|
|
729
|
+
}),
|
|
730
|
+
/* @__PURE__ */ s("h1", { children: "Agents" }),
|
|
731
|
+
/* @__PURE__ */ s("p", { children: "Autonomous participants whose authority and workflows are part of the model." })
|
|
732
|
+
] }), /* @__PURE__ */ c("div", {
|
|
733
|
+
className: "split-browser",
|
|
734
|
+
children: [/* @__PURE__ */ s("aside", { children: t.map((e) => /* @__PURE__ */ c("button", {
|
|
735
|
+
className: e.name === i?.name ? "active" : "",
|
|
736
|
+
onClick: () => r(e.name),
|
|
737
|
+
children: [/* @__PURE__ */ s("strong", { children: e.name }), /* @__PURE__ */ c("span", { children: [e.statements.length, " bindings"] })]
|
|
738
|
+
}, e.name)) }), /* @__PURE__ */ s("section", { children: i ? /* @__PURE__ */ s(o, { children: /* @__PURE__ */ c("div", {
|
|
739
|
+
className: "agent-orbit",
|
|
740
|
+
children: [/* @__PURE__ */ c("div", {
|
|
741
|
+
className: "agent-core",
|
|
742
|
+
children: [/* @__PURE__ */ s("span", { children: "agent" }), /* @__PURE__ */ s("strong", { children: i.name })]
|
|
743
|
+
}), i.statements.map((e) => /* @__PURE__ */ c("div", {
|
|
744
|
+
className: "agent-binding",
|
|
745
|
+
children: [/* @__PURE__ */ s("span", { children: e.split(" ")[0] }), /* @__PURE__ */ s("strong", { children: e.split(" ").slice(1).join(" ") })]
|
|
746
|
+
}, e))]
|
|
747
|
+
}) }) : /* @__PURE__ */ s("div", {
|
|
748
|
+
className: "model-empty",
|
|
749
|
+
children: "No agents are declared."
|
|
750
|
+
}) })]
|
|
751
|
+
})]
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
//#endregion
|
|
755
|
+
//#region src/components/ProvenanceViewer.tsx
|
|
756
|
+
function F({ db: e, namespace: t = "default", reference: r }) {
|
|
757
|
+
let [i, l] = a(r ?? ""), [u, d] = a(null), [f, p] = a([]), [m, h] = a("Enter a Flow reference to trace it.");
|
|
758
|
+
n(() => {
|
|
759
|
+
r && l(r);
|
|
760
|
+
}, [r]);
|
|
761
|
+
let g = async () => {
|
|
762
|
+
if (!(!e || !i)) try {
|
|
763
|
+
let t = e.provenance(i);
|
|
764
|
+
d(t), h("Causal graph resolved");
|
|
765
|
+
} catch {
|
|
766
|
+
d(null);
|
|
767
|
+
let t = await e.auditEvents(), n = i.split("/"), r = n[n.length - 1] ?? "", a = t.filter((e) => e.key.includes(r));
|
|
768
|
+
p(a), h(a.length ? "Local mutation lineage" : "No local lineage found for this reference");
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
return /* @__PURE__ */ c("div", {
|
|
772
|
+
className: "studio-model-page",
|
|
773
|
+
children: [
|
|
774
|
+
/* @__PURE__ */ c("header", { children: [
|
|
775
|
+
/* @__PURE__ */ s("span", {
|
|
776
|
+
className: "eyebrow",
|
|
777
|
+
children: "Observe"
|
|
778
|
+
}),
|
|
779
|
+
/* @__PURE__ */ s("h1", { children: "Provenance" }),
|
|
780
|
+
/* @__PURE__ */ s("p", { children: "Follow why state exists—from durable mutations to causal workflow and agent edges." })
|
|
781
|
+
] }),
|
|
782
|
+
/* @__PURE__ */ c("div", {
|
|
783
|
+
className: "reference-query",
|
|
784
|
+
children: [/* @__PURE__ */ s("input", {
|
|
785
|
+
value: i,
|
|
786
|
+
onChange: (e) => l(e.target.value),
|
|
787
|
+
placeholder: `flow://${t}/Collection/id`
|
|
788
|
+
}), /* @__PURE__ */ s("button", {
|
|
789
|
+
onClick: () => void g(),
|
|
790
|
+
children: "Trace"
|
|
791
|
+
})]
|
|
792
|
+
}),
|
|
793
|
+
/* @__PURE__ */ c("article", {
|
|
794
|
+
className: "studio-card provenance-result",
|
|
795
|
+
children: [
|
|
796
|
+
/* @__PURE__ */ s("span", {
|
|
797
|
+
className: "card-kind",
|
|
798
|
+
children: "Lineage"
|
|
799
|
+
}),
|
|
800
|
+
/* @__PURE__ */ s("h2", { children: m }),
|
|
801
|
+
u && /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ c("div", {
|
|
802
|
+
className: "model-summary",
|
|
803
|
+
children: [/* @__PURE__ */ c("span", { children: [u.nodes.length, " nodes"] }), /* @__PURE__ */ c("span", { children: [u.edges.length, " edges"] })]
|
|
804
|
+
}), /* @__PURE__ */ s("div", {
|
|
805
|
+
className: "provenance-nodes",
|
|
806
|
+
children: u.nodes.map((e) => /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("b", { children: e.label }), /* @__PURE__ */ s("small", { children: e.type })] }, e.id))
|
|
807
|
+
})] }),
|
|
808
|
+
!u && f.map((e) => /* @__PURE__ */ c("div", {
|
|
809
|
+
className: "provenance-event",
|
|
810
|
+
children: [
|
|
811
|
+
/* @__PURE__ */ s("span", { children: e.sequence }),
|
|
812
|
+
/* @__PURE__ */ c("b", { children: [
|
|
813
|
+
e.type,
|
|
814
|
+
" ",
|
|
815
|
+
e.collection
|
|
816
|
+
] }),
|
|
817
|
+
/* @__PURE__ */ s("code", { children: e.key }),
|
|
818
|
+
/* @__PURE__ */ s("small", { children: new Date(e.timestamp).toLocaleString() })
|
|
819
|
+
]
|
|
820
|
+
}, `${e.sequence}-${e.key}`))
|
|
821
|
+
]
|
|
822
|
+
})
|
|
823
|
+
]
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
//#endregion
|
|
827
|
+
//#region src/components/HealthCenter.tsx
|
|
828
|
+
function I({ diagnostics: e, model: t }) {
|
|
829
|
+
let n = e ? [
|
|
830
|
+
[
|
|
831
|
+
"Runtime",
|
|
832
|
+
e.runtime.status,
|
|
833
|
+
e.runtime.reactive ? "reactive" : "non-reactive"
|
|
834
|
+
],
|
|
835
|
+
[
|
|
836
|
+
"Storage",
|
|
837
|
+
e.storage.status,
|
|
838
|
+
`${e.storage.backend} · ${e.storage.persistent ? "persistent" : "volatile"}`
|
|
839
|
+
],
|
|
840
|
+
[
|
|
841
|
+
"Synchronization",
|
|
842
|
+
e.sync.status,
|
|
843
|
+
`${e.sync.peers} peers · ${e.sync.pendingOperations} pending`
|
|
844
|
+
],
|
|
845
|
+
[
|
|
846
|
+
"Fabric",
|
|
847
|
+
e.fabric.status,
|
|
848
|
+
`${e.fabric.references} references`
|
|
849
|
+
],
|
|
850
|
+
[
|
|
851
|
+
"Capabilities",
|
|
852
|
+
e.capabilities.status,
|
|
853
|
+
`${e.capabilities.available}/${e.capabilities.count} available`
|
|
854
|
+
],
|
|
855
|
+
[
|
|
856
|
+
"Execution",
|
|
857
|
+
e.execution.status,
|
|
858
|
+
`${e.execution.running} running · ${e.execution.failed} failed`
|
|
859
|
+
],
|
|
860
|
+
[
|
|
861
|
+
"Workflows",
|
|
862
|
+
e.workflow.status,
|
|
863
|
+
`${e.workflow.active}/${e.workflow.total} active`
|
|
864
|
+
]
|
|
865
|
+
] : [];
|
|
866
|
+
return /* @__PURE__ */ c("div", {
|
|
867
|
+
className: "studio-model-page",
|
|
868
|
+
children: [
|
|
869
|
+
/* @__PURE__ */ c("header", { children: [
|
|
870
|
+
/* @__PURE__ */ s("span", {
|
|
871
|
+
className: "eyebrow",
|
|
872
|
+
children: "Observe"
|
|
873
|
+
}),
|
|
874
|
+
/* @__PURE__ */ s("h1", { children: "Health" }),
|
|
875
|
+
/* @__PURE__ */ s("p", { children: "Runtime diagnostics, not optimistic defaults." })
|
|
876
|
+
] }),
|
|
877
|
+
/* @__PURE__ */ s("div", {
|
|
878
|
+
className: "health-grid",
|
|
879
|
+
children: n.map(([e, t, n]) => /* @__PURE__ */ c("article", {
|
|
880
|
+
className: `health-item status-${t}`,
|
|
881
|
+
children: [/* @__PURE__ */ s("span", {
|
|
882
|
+
className: "status-icon",
|
|
883
|
+
children: t === "healthy" ? "✓" : "!"
|
|
884
|
+
}), /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("b", { children: e }), /* @__PURE__ */ s("small", { children: n })] })]
|
|
885
|
+
}, e))
|
|
886
|
+
}),
|
|
887
|
+
!e && /* @__PURE__ */ s("div", {
|
|
888
|
+
className: "model-empty",
|
|
889
|
+
children: "Diagnostics are unavailable until Studio connects to a runtime."
|
|
890
|
+
}),
|
|
891
|
+
e?.issues.map((e, t) => /* @__PURE__ */ c("div", {
|
|
892
|
+
className: `health-issue ${e.severity}`,
|
|
893
|
+
children: [
|
|
894
|
+
/* @__PURE__ */ s("b", { children: e.component }),
|
|
895
|
+
" ",
|
|
896
|
+
e.message
|
|
897
|
+
]
|
|
898
|
+
}, t)),
|
|
899
|
+
/* @__PURE__ */ c("div", {
|
|
900
|
+
className: "model-summary",
|
|
901
|
+
children: [
|
|
902
|
+
/* @__PURE__ */ c("span", { children: [t?.collections.length ?? 0, " collections modeled"] }),
|
|
903
|
+
/* @__PURE__ */ c("span", { children: [t?.workflows.length ?? 0, " workflows modeled"] }),
|
|
904
|
+
/* @__PURE__ */ c("span", { children: [t?.agents.length ?? 0, " agents modeled"] })
|
|
905
|
+
]
|
|
906
|
+
})
|
|
907
|
+
]
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
//#endregion
|
|
911
|
+
//#region src/components/SettingsPanel.tsx
|
|
912
|
+
function L({ db: e }) {
|
|
913
|
+
let [t, n] = a("api-keys");
|
|
914
|
+
return /* @__PURE__ */ c("div", {
|
|
915
|
+
className: "settings-panel",
|
|
916
|
+
children: [
|
|
917
|
+
/* @__PURE__ */ s("h2", { children: "Settings" }),
|
|
918
|
+
/* @__PURE__ */ c("div", {
|
|
919
|
+
className: "settings-tabs",
|
|
920
|
+
children: [/* @__PURE__ */ s("button", {
|
|
921
|
+
className: `tab ${t === "api-keys" ? "active" : ""}`,
|
|
922
|
+
onClick: () => n("api-keys"),
|
|
923
|
+
children: "API Keys"
|
|
924
|
+
}), /* @__PURE__ */ s("button", {
|
|
925
|
+
className: `tab ${t === "connection" ? "active" : ""}`,
|
|
926
|
+
onClick: () => n("connection"),
|
|
927
|
+
children: "Connection"
|
|
928
|
+
})]
|
|
929
|
+
}),
|
|
930
|
+
t === "api-keys" && /* @__PURE__ */ c("div", {
|
|
931
|
+
className: "settings-content",
|
|
932
|
+
children: [
|
|
933
|
+
/* @__PURE__ */ s("h3", { children: "API Keys" }),
|
|
934
|
+
/* @__PURE__ */ s("p", { children: "Manage authentication and access control" }),
|
|
935
|
+
/* @__PURE__ */ s("div", {
|
|
936
|
+
className: "keys-list",
|
|
937
|
+
children: /* @__PURE__ */ s("div", {
|
|
938
|
+
className: "empty-message",
|
|
939
|
+
children: "No API keys configured"
|
|
940
|
+
})
|
|
941
|
+
}),
|
|
942
|
+
/* @__PURE__ */ s("button", {
|
|
943
|
+
className: "btn btn-primary",
|
|
944
|
+
children: "Create API Key"
|
|
945
|
+
})
|
|
946
|
+
]
|
|
947
|
+
}),
|
|
948
|
+
t === "connection" && /* @__PURE__ */ c("div", {
|
|
949
|
+
className: "settings-content",
|
|
950
|
+
children: [/* @__PURE__ */ s("h3", { children: "Connection" }), /* @__PURE__ */ c("div", {
|
|
951
|
+
className: "connection-info",
|
|
952
|
+
children: [
|
|
953
|
+
/* @__PURE__ */ c("div", {
|
|
954
|
+
className: "info-row",
|
|
955
|
+
children: [/* @__PURE__ */ s("label", { children: "Runtime Environment" }), /* @__PURE__ */ s("span", { children: "Browser" })]
|
|
956
|
+
}),
|
|
957
|
+
/* @__PURE__ */ c("div", {
|
|
958
|
+
className: "info-row",
|
|
959
|
+
children: [/* @__PURE__ */ s("label", { children: "Storage Backend" }), /* @__PURE__ */ s("span", { children: "OPFS / IndexedDB" })]
|
|
960
|
+
}),
|
|
961
|
+
/* @__PURE__ */ c("div", {
|
|
962
|
+
className: "info-row",
|
|
963
|
+
children: [/* @__PURE__ */ s("label", { children: "Instance ID" }), /* @__PURE__ */ s("span", {
|
|
964
|
+
className: "monospace",
|
|
965
|
+
children: "instance-xxxx"
|
|
966
|
+
})]
|
|
967
|
+
})
|
|
968
|
+
]
|
|
969
|
+
})]
|
|
970
|
+
})
|
|
971
|
+
]
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
//#endregion
|
|
975
|
+
//#region src/components/GlobalSearch.tsx
|
|
976
|
+
function R({ db: e, model: t, onSearch: r }) {
|
|
977
|
+
let [i, o] = a(""), [l, u] = a([]), d = (e) => {
|
|
978
|
+
o(e), r && r(e);
|
|
979
|
+
};
|
|
980
|
+
return n(() => {
|
|
981
|
+
let n = !0;
|
|
982
|
+
return (async () => {
|
|
983
|
+
let r = i.trim().toLowerCase();
|
|
984
|
+
if (!r) {
|
|
985
|
+
u([]);
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
let a = [
|
|
989
|
+
...t?.collections.map((e) => ({
|
|
990
|
+
kind: "collection",
|
|
991
|
+
name: e.name,
|
|
992
|
+
detail: `${e.fields.length} fields`
|
|
993
|
+
})) ?? [],
|
|
994
|
+
...t?.capabilities.map((e) => ({
|
|
995
|
+
kind: "capability",
|
|
996
|
+
name: e.name,
|
|
997
|
+
detail: e.statements.join(" · ")
|
|
998
|
+
})) ?? [],
|
|
999
|
+
...t?.workflows.map((e) => ({
|
|
1000
|
+
kind: "workflow",
|
|
1001
|
+
name: e.name,
|
|
1002
|
+
detail: `${e.steps.length} steps`
|
|
1003
|
+
})) ?? [],
|
|
1004
|
+
...t?.agents.map((e) => ({
|
|
1005
|
+
kind: "agent",
|
|
1006
|
+
name: e.name,
|
|
1007
|
+
detail: e.statements.join(" · ")
|
|
1008
|
+
})) ?? []
|
|
1009
|
+
].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) => ({
|
|
1010
|
+
kind: "object",
|
|
1011
|
+
name: `${t.name}/${String(e.id ?? "record")}`,
|
|
1012
|
+
detail: JSON.stringify(e)
|
|
1013
|
+
}))))).flat() : [];
|
|
1014
|
+
n && u([...a, ...o].slice(0, 12));
|
|
1015
|
+
})(), () => {
|
|
1016
|
+
n = !1;
|
|
1017
|
+
};
|
|
1018
|
+
}, [
|
|
1019
|
+
e,
|
|
1020
|
+
t,
|
|
1021
|
+
i
|
|
1022
|
+
]), /* @__PURE__ */ c("div", {
|
|
1023
|
+
className: "global-search",
|
|
1024
|
+
children: [/* @__PURE__ */ s("input", {
|
|
1025
|
+
type: "text",
|
|
1026
|
+
placeholder: "Search: documents/123, flow://, agent/name, etc.",
|
|
1027
|
+
value: i,
|
|
1028
|
+
onChange: (e) => d(e.target.value),
|
|
1029
|
+
className: "search-input global"
|
|
1030
|
+
}), i && /* @__PURE__ */ s("div", {
|
|
1031
|
+
className: "search-results",
|
|
1032
|
+
children: /* @__PURE__ */ c("div", {
|
|
1033
|
+
className: "results-group",
|
|
1034
|
+
children: [
|
|
1035
|
+
/* @__PURE__ */ s("h4", { children: "Model & runtime" }),
|
|
1036
|
+
l.map((e, t) => /* @__PURE__ */ c("div", {
|
|
1037
|
+
className: "search-result",
|
|
1038
|
+
children: [
|
|
1039
|
+
/* @__PURE__ */ s("b", { children: e.name }),
|
|
1040
|
+
/* @__PURE__ */ s("span", { children: e.kind }),
|
|
1041
|
+
/* @__PURE__ */ s("small", { children: e.detail })
|
|
1042
|
+
]
|
|
1043
|
+
}, `${e.kind}-${e.name}-${t}`)),
|
|
1044
|
+
!l.length && /* @__PURE__ */ s("div", {
|
|
1045
|
+
className: "empty-message",
|
|
1046
|
+
children: "No matches"
|
|
1047
|
+
})
|
|
1048
|
+
]
|
|
1049
|
+
})
|
|
1050
|
+
})]
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
//#endregion
|
|
1054
|
+
//#region src/components/ApplicationDesigner.tsx
|
|
1055
|
+
var z = f({
|
|
1056
|
+
...d("ResearchPlatform"),
|
|
1057
|
+
collections: [{
|
|
1058
|
+
name: "User",
|
|
1059
|
+
fields: [{
|
|
1060
|
+
name: "name",
|
|
1061
|
+
type: "text",
|
|
1062
|
+
optional: !1
|
|
1063
|
+
}, {
|
|
1064
|
+
name: "email",
|
|
1065
|
+
type: "text",
|
|
1066
|
+
optional: !1
|
|
1067
|
+
}],
|
|
1068
|
+
indexes: []
|
|
1069
|
+
}, {
|
|
1070
|
+
name: "Document",
|
|
1071
|
+
fields: [
|
|
1072
|
+
{
|
|
1073
|
+
name: "title",
|
|
1074
|
+
type: "text",
|
|
1075
|
+
optional: !1
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
name: "content",
|
|
1079
|
+
type: "text",
|
|
1080
|
+
optional: !1
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
name: "author",
|
|
1084
|
+
type: "ref User",
|
|
1085
|
+
optional: !1
|
|
1086
|
+
}
|
|
1087
|
+
],
|
|
1088
|
+
indexes: [{
|
|
1089
|
+
name: "search",
|
|
1090
|
+
kind: "fulltext",
|
|
1091
|
+
expression: "(content)"
|
|
1092
|
+
}]
|
|
1093
|
+
}]
|
|
1094
|
+
});
|
|
1095
|
+
function B({ db: e, namespace: t = "default", projectSpec: o, onSpecChange: g }) {
|
|
1096
|
+
let _ = `feltdb:studio:draft:${t}`, v = i((() => {
|
|
1097
|
+
if (typeof window > "u") return z;
|
|
1098
|
+
let e = window.localStorage.getItem(_);
|
|
1099
|
+
if (!e) return z;
|
|
1100
|
+
try {
|
|
1101
|
+
return p(e), e;
|
|
1102
|
+
} catch {
|
|
1103
|
+
return z;
|
|
1104
|
+
}
|
|
1105
|
+
})()), y = i(v.current !== z), [b, x] = a(v.current), [S, C] = a(() => p(v.current)), [w, T] = a([]), [E, D] = a([]), [O, k] = a("Draft is valid"), [A, j] = a(0), [M, N] = a(null), [P, F] = a(null), [I, L] = a(!1), [R, B] = a(!1), [V, H] = a({
|
|
1106
|
+
url: "",
|
|
1107
|
+
namespace: t,
|
|
1108
|
+
token: "",
|
|
1109
|
+
allowDestructive: !1
|
|
1110
|
+
}), U = i(null), W = E.length ? E[E.length - 1].source : f(d(S.app)), G = r(() => u(p(W), S), [W, S]), K = r(() => m(p(W), S), [W, S]);
|
|
1111
|
+
n(() => {
|
|
1112
|
+
if (!e) return;
|
|
1113
|
+
let t = !1;
|
|
1114
|
+
return (async () => {
|
|
1115
|
+
try {
|
|
1116
|
+
let n = await e.collection("_flow_apps").all(), r = n.find((e) => e.status === "active") ?? n[0];
|
|
1117
|
+
if (!r || t) return;
|
|
1118
|
+
let i = f(r.spec);
|
|
1119
|
+
y.current || (C(r.spec), x(i)), j(r.version ?? 0);
|
|
1120
|
+
let a = (await e.collection("_flow_app_versions").all()).filter((e) => e.app === r.app).sort((e, t) => e.version - t.version);
|
|
1121
|
+
t || (D(a.map((e) => ({
|
|
1122
|
+
version: e.version,
|
|
1123
|
+
source: f(e.spec),
|
|
1124
|
+
savedAt: e.deployed_at
|
|
1125
|
+
}))), k(`Loaded ${r.app} v${r.version}`));
|
|
1126
|
+
} catch (e) {
|
|
1127
|
+
t || k(`Could not load deployed model: ${e instanceof Error ? e.message : String(e)}`);
|
|
1128
|
+
}
|
|
1129
|
+
})(), () => {
|
|
1130
|
+
t = !0;
|
|
1131
|
+
};
|
|
1132
|
+
}, [e]), n(() => {
|
|
1133
|
+
let e = window.setTimeout(() => window.localStorage.setItem(_, b), 200);
|
|
1134
|
+
return () => window.clearTimeout(e);
|
|
1135
|
+
}, [_, b]);
|
|
1136
|
+
let q = (e) => {
|
|
1137
|
+
x(e);
|
|
1138
|
+
try {
|
|
1139
|
+
let t = p(e), n = h(t);
|
|
1140
|
+
C(t), g?.(t), T(n), k(n.some((e) => e.severity === "error") ? "Model has validation errors" : "Draft is valid");
|
|
1141
|
+
} catch (e) {
|
|
1142
|
+
T([{
|
|
1143
|
+
severity: "error",
|
|
1144
|
+
message: e instanceof Error ? e.message : String(e)
|
|
1145
|
+
}]), k("DSL parse failed");
|
|
1146
|
+
}
|
|
1147
|
+
};
|
|
1148
|
+
n(() => {
|
|
1149
|
+
if (!o || y.current && S.app === o.app) return;
|
|
1150
|
+
let e = f(o);
|
|
1151
|
+
x(e), C(o), T(h(o)), k(`Loaded ${o.app} project model`);
|
|
1152
|
+
}, [o]);
|
|
1153
|
+
let J = (e) => {
|
|
1154
|
+
C(e), q(f(e));
|
|
1155
|
+
}, Y = () => {
|
|
1156
|
+
if (!P) return F({ name: "" });
|
|
1157
|
+
let e = P.name.trim();
|
|
1158
|
+
if (!/^[A-Z][A-Za-z0-9_]*$/.test(e)) return F({
|
|
1159
|
+
...P,
|
|
1160
|
+
error: "Use a capitalized name with no spaces."
|
|
1161
|
+
});
|
|
1162
|
+
if (S.collections.some((t) => t.name === e)) return F({
|
|
1163
|
+
...P,
|
|
1164
|
+
error: "That collection already exists."
|
|
1165
|
+
});
|
|
1166
|
+
J({
|
|
1167
|
+
...S,
|
|
1168
|
+
collections: [...S.collections, {
|
|
1169
|
+
name: e,
|
|
1170
|
+
fields: [],
|
|
1171
|
+
indexes: []
|
|
1172
|
+
}]
|
|
1173
|
+
}), F(null);
|
|
1174
|
+
}, X = (e) => N({
|
|
1175
|
+
collection: e,
|
|
1176
|
+
name: "",
|
|
1177
|
+
type: "text",
|
|
1178
|
+
reference: S.collections.find((t) => t.name !== e)?.name ?? "",
|
|
1179
|
+
optional: !1
|
|
1180
|
+
}), Z = () => {
|
|
1181
|
+
if (!M) return;
|
|
1182
|
+
let e = M.name.trim(), t = S.collections.find((e) => e.name === M.collection);
|
|
1183
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)) return N({
|
|
1184
|
+
...M,
|
|
1185
|
+
error: "Use a letter-led name with no spaces."
|
|
1186
|
+
});
|
|
1187
|
+
if (t?.fields.some((t) => t.name === e)) return N({
|
|
1188
|
+
...M,
|
|
1189
|
+
error: "That field already exists."
|
|
1190
|
+
});
|
|
1191
|
+
if (M.type === "ref" && !M.reference) return N({
|
|
1192
|
+
...M,
|
|
1193
|
+
error: "Choose a referenced collection."
|
|
1194
|
+
});
|
|
1195
|
+
let n = M.type === "ref" ? `ref ${M.reference}` : M.type;
|
|
1196
|
+
J({
|
|
1197
|
+
...S,
|
|
1198
|
+
collections: S.collections.map((t) => t.name === M.collection ? {
|
|
1199
|
+
...t,
|
|
1200
|
+
fields: [...t.fields, {
|
|
1201
|
+
name: e,
|
|
1202
|
+
type: n,
|
|
1203
|
+
optional: M.optional
|
|
1204
|
+
}]
|
|
1205
|
+
} : t)
|
|
1206
|
+
}), N(null);
|
|
1207
|
+
}, Q = () => {
|
|
1208
|
+
let e = [...E, {
|
|
1209
|
+
version: E.length + 1,
|
|
1210
|
+
source: b,
|
|
1211
|
+
savedAt: Date.now()
|
|
1212
|
+
}];
|
|
1213
|
+
D(e), k(`Saved local revision v${e.length}`);
|
|
1214
|
+
}, $ = async () => {
|
|
1215
|
+
if (!e) return k("Local embedded storage is unavailable");
|
|
1216
|
+
if (w.some((e) => e.severity === "error")) return k("Resolve validation errors before deploying");
|
|
1217
|
+
if (K.filter((e) => e.safety === "destructive").length && !I) return k("Review and approve destructive local changes before applying");
|
|
1218
|
+
try {
|
|
1219
|
+
let t = await e.deployFlowSpec(S, A, I), n = [...E, {
|
|
1220
|
+
version: t.version,
|
|
1221
|
+
source: b,
|
|
1222
|
+
savedAt: Date.now()
|
|
1223
|
+
}];
|
|
1224
|
+
D(n), j(t.version), L(!1), k(`Applied locally as ${t.app} v${t.version}`);
|
|
1225
|
+
} catch (e) {
|
|
1226
|
+
k(`Local apply failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
1227
|
+
}
|
|
1228
|
+
}, ee = async () => {
|
|
1229
|
+
if (!V.url.trim() || !V.token.trim()) return H({
|
|
1230
|
+
...V,
|
|
1231
|
+
error: "Cloud URL and API key are required."
|
|
1232
|
+
});
|
|
1233
|
+
if (w.some((e) => e.severity === "error")) return H({
|
|
1234
|
+
...V,
|
|
1235
|
+
error: "Resolve validation errors before publishing."
|
|
1236
|
+
});
|
|
1237
|
+
H({
|
|
1238
|
+
...V,
|
|
1239
|
+
publishing: !0,
|
|
1240
|
+
error: void 0
|
|
1241
|
+
});
|
|
1242
|
+
let e = l({
|
|
1243
|
+
namespace: V.namespace.trim() || t,
|
|
1244
|
+
server: {
|
|
1245
|
+
url: V.url.trim().replace(/\/$/, ""),
|
|
1246
|
+
token: V.token
|
|
1247
|
+
}
|
|
1248
|
+
});
|
|
1249
|
+
try {
|
|
1250
|
+
let t = await e.collection("_flow_apps").get(S.app), n = m(t?.spec ?? d(S.app), S).filter((e) => e.safety === "destructive");
|
|
1251
|
+
if (n.length && !V.allowDestructive) return H({
|
|
1252
|
+
...V,
|
|
1253
|
+
publishing: !1,
|
|
1254
|
+
destructive: n.map((e) => e.target),
|
|
1255
|
+
error: `Review and approve destructive changes: ${n.map((e) => e.target).join(", ")}`
|
|
1256
|
+
});
|
|
1257
|
+
let r = await e.deployFlowSpec(S, t?.version ?? 0, V.allowDestructive);
|
|
1258
|
+
window.sessionStorage.setItem(`feltdb-token:${V.url.trim()}`, V.token), H({
|
|
1259
|
+
...V,
|
|
1260
|
+
publishing: !1,
|
|
1261
|
+
token: "",
|
|
1262
|
+
error: void 0
|
|
1263
|
+
}), B(!1), k(`Published ${r.app} v${r.version} to cloud`);
|
|
1264
|
+
} catch (e) {
|
|
1265
|
+
H({
|
|
1266
|
+
...V,
|
|
1267
|
+
publishing: !1,
|
|
1268
|
+
error: e instanceof Error ? e.message : String(e)
|
|
1269
|
+
});
|
|
1270
|
+
} finally {
|
|
1271
|
+
await e.close();
|
|
1272
|
+
}
|
|
1273
|
+
}, te = () => {
|
|
1274
|
+
let e = URL.createObjectURL(new Blob([b], { type: "text/plain" })), t = document.createElement("a");
|
|
1275
|
+
t.href = e, t.download = "feltdb.flow", t.click(), URL.revokeObjectURL(e);
|
|
1276
|
+
}, ne = async (e) => {
|
|
1277
|
+
e && q(await e.text());
|
|
1278
|
+
}, re = [
|
|
1279
|
+
["Data", S.collections.map((e) => e.name)],
|
|
1280
|
+
["Capabilities", S.capabilities.map((e) => e.name)],
|
|
1281
|
+
["Agents", S.agents.map((e) => e.name)],
|
|
1282
|
+
["Workflows", S.workflows.map((e) => e.name)],
|
|
1283
|
+
["Triggers", S.triggers.map((e) => e.event)],
|
|
1284
|
+
["Policies", S.policies.map((e) => e.name)],
|
|
1285
|
+
["Schedules", S.schedules.map((e) => e.name)]
|
|
1286
|
+
];
|
|
1287
|
+
return /* @__PURE__ */ c("div", {
|
|
1288
|
+
className: "application-designer",
|
|
1289
|
+
children: [
|
|
1290
|
+
/* @__PURE__ */ c("header", {
|
|
1291
|
+
className: "designer-header",
|
|
1292
|
+
children: [/* @__PURE__ */ c("div", { children: [
|
|
1293
|
+
/* @__PURE__ */ s("span", {
|
|
1294
|
+
className: "eyebrow",
|
|
1295
|
+
children: "Application fabric"
|
|
1296
|
+
}),
|
|
1297
|
+
/* @__PURE__ */ s("h1", { children: S.app }),
|
|
1298
|
+
/* @__PURE__ */ s("p", { children: "One model for state, intelligence, automation, security, and placement." })
|
|
1299
|
+
] }), /* @__PURE__ */ c("div", {
|
|
1300
|
+
className: "designer-actions",
|
|
1301
|
+
children: [
|
|
1302
|
+
/* @__PURE__ */ s("input", {
|
|
1303
|
+
ref: U,
|
|
1304
|
+
hidden: !0,
|
|
1305
|
+
type: "file",
|
|
1306
|
+
accept: ".flow,text/plain",
|
|
1307
|
+
onChange: (e) => void ne(e.target.files?.[0])
|
|
1308
|
+
}),
|
|
1309
|
+
/* @__PURE__ */ s("button", {
|
|
1310
|
+
className: "btn btn-ghost",
|
|
1311
|
+
onClick: () => U.current?.click(),
|
|
1312
|
+
children: "Import"
|
|
1313
|
+
}),
|
|
1314
|
+
/* @__PURE__ */ s("button", {
|
|
1315
|
+
className: "btn btn-ghost",
|
|
1316
|
+
onClick: te,
|
|
1317
|
+
children: "Export"
|
|
1318
|
+
}),
|
|
1319
|
+
/* @__PURE__ */ s("button", {
|
|
1320
|
+
className: "btn btn-ghost",
|
|
1321
|
+
onClick: Q,
|
|
1322
|
+
children: "Version"
|
|
1323
|
+
}),
|
|
1324
|
+
/* @__PURE__ */ s("button", {
|
|
1325
|
+
className: "btn btn-ghost",
|
|
1326
|
+
onClick: () => void $(),
|
|
1327
|
+
children: "Apply locally"
|
|
1328
|
+
}),
|
|
1329
|
+
/* @__PURE__ */ s("button", {
|
|
1330
|
+
className: "btn btn-primary",
|
|
1331
|
+
onClick: () => B((e) => !e),
|
|
1332
|
+
children: "Publish to cloud"
|
|
1333
|
+
})
|
|
1334
|
+
]
|
|
1335
|
+
})]
|
|
1336
|
+
}),
|
|
1337
|
+
K.some((e) => e.safety === "destructive") && /* @__PURE__ */ c("label", {
|
|
1338
|
+
className: "local-destructive",
|
|
1339
|
+
children: [/* @__PURE__ */ s("input", {
|
|
1340
|
+
type: "checkbox",
|
|
1341
|
+
checked: I,
|
|
1342
|
+
onChange: (e) => L(e.target.checked)
|
|
1343
|
+
}), /* @__PURE__ */ c("span", { children: ["Approve destructive local changes: ", K.filter((e) => e.safety === "destructive").map((e) => e.target).join(", ")] })]
|
|
1344
|
+
}),
|
|
1345
|
+
R && /* @__PURE__ */ c("form", {
|
|
1346
|
+
className: "cloud-publisher",
|
|
1347
|
+
onSubmit: (e) => {
|
|
1348
|
+
e.preventDefault(), ee();
|
|
1349
|
+
},
|
|
1350
|
+
children: [
|
|
1351
|
+
/* @__PURE__ */ c("div", {
|
|
1352
|
+
className: "cloud-publisher-heading",
|
|
1353
|
+
children: [/* @__PURE__ */ c("div", { children: [
|
|
1354
|
+
/* @__PURE__ */ s("span", {
|
|
1355
|
+
className: "eyebrow",
|
|
1356
|
+
children: "Cloud release"
|
|
1357
|
+
}),
|
|
1358
|
+
/* @__PURE__ */ s("h2", { children: "Publish this application model" }),
|
|
1359
|
+
/* @__PURE__ */ s("p", { children: "FeltDB compares the cloud version, plans the migration, and publishes atomically." })
|
|
1360
|
+
] }), /* @__PURE__ */ s("button", {
|
|
1361
|
+
type: "button",
|
|
1362
|
+
"aria-label": "Close cloud publisher",
|
|
1363
|
+
onClick: () => B(!1),
|
|
1364
|
+
children: "×"
|
|
1365
|
+
})]
|
|
1366
|
+
}),
|
|
1367
|
+
/* @__PURE__ */ c("div", {
|
|
1368
|
+
className: "cloud-fields",
|
|
1369
|
+
children: [
|
|
1370
|
+
/* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "FeltDB Cloud URL" }), /* @__PURE__ */ s("input", {
|
|
1371
|
+
type: "url",
|
|
1372
|
+
placeholder: "https://your-instance.feltdb.cloud",
|
|
1373
|
+
value: V.url,
|
|
1374
|
+
onChange: (e) => H({
|
|
1375
|
+
...V,
|
|
1376
|
+
url: e.target.value,
|
|
1377
|
+
error: void 0,
|
|
1378
|
+
destructive: void 0,
|
|
1379
|
+
allowDestructive: !1
|
|
1380
|
+
})
|
|
1381
|
+
})] }),
|
|
1382
|
+
/* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "Namespace" }), /* @__PURE__ */ s("input", {
|
|
1383
|
+
value: V.namespace,
|
|
1384
|
+
onChange: (e) => H({
|
|
1385
|
+
...V,
|
|
1386
|
+
namespace: e.target.value,
|
|
1387
|
+
error: void 0,
|
|
1388
|
+
destructive: void 0,
|
|
1389
|
+
allowDestructive: !1
|
|
1390
|
+
})
|
|
1391
|
+
})] }),
|
|
1392
|
+
/* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "API key" }), /* @__PURE__ */ s("input", {
|
|
1393
|
+
type: "password",
|
|
1394
|
+
autoComplete: "off",
|
|
1395
|
+
placeholder: "Stored for this browser session only",
|
|
1396
|
+
value: V.token,
|
|
1397
|
+
onChange: (e) => H({
|
|
1398
|
+
...V,
|
|
1399
|
+
token: e.target.value,
|
|
1400
|
+
error: void 0
|
|
1401
|
+
})
|
|
1402
|
+
})] })
|
|
1403
|
+
]
|
|
1404
|
+
}),
|
|
1405
|
+
(V.destructive?.length || K.some((e) => e.safety === "destructive")) && /* @__PURE__ */ c("label", {
|
|
1406
|
+
className: "cloud-destructive",
|
|
1407
|
+
children: [/* @__PURE__ */ s("input", {
|
|
1408
|
+
type: "checkbox",
|
|
1409
|
+
checked: V.allowDestructive,
|
|
1410
|
+
onChange: (e) => H({
|
|
1411
|
+
...V,
|
|
1412
|
+
allowDestructive: e.target.checked
|
|
1413
|
+
})
|
|
1414
|
+
}), /* @__PURE__ */ c("span", { children: ["I reviewed and approve destructive model changes", V.destructive?.length ? `: ${V.destructive.join(", ")}` : "."] })]
|
|
1415
|
+
}),
|
|
1416
|
+
V.error && /* @__PURE__ */ s("div", {
|
|
1417
|
+
className: "cloud-error",
|
|
1418
|
+
role: "alert",
|
|
1419
|
+
children: V.error
|
|
1420
|
+
}),
|
|
1421
|
+
/* @__PURE__ */ c("div", {
|
|
1422
|
+
className: "cloud-actions",
|
|
1423
|
+
children: [/* @__PURE__ */ s("button", {
|
|
1424
|
+
type: "button",
|
|
1425
|
+
className: "btn btn-ghost",
|
|
1426
|
+
onClick: () => B(!1),
|
|
1427
|
+
children: "Cancel"
|
|
1428
|
+
}), /* @__PURE__ */ s("button", {
|
|
1429
|
+
className: "btn btn-primary",
|
|
1430
|
+
disabled: V.publishing,
|
|
1431
|
+
type: "submit",
|
|
1432
|
+
children: V.publishing ? "Publishing…" : "Review and publish"
|
|
1433
|
+
})]
|
|
1434
|
+
})
|
|
1435
|
+
]
|
|
1436
|
+
}),
|
|
1437
|
+
/* @__PURE__ */ c("div", {
|
|
1438
|
+
className: `designer-status ${w.some((e) => e.severity === "error") ? "error" : ""}`,
|
|
1439
|
+
children: [/* @__PURE__ */ s("span", { children: O }), /* @__PURE__ */ c("span", { children: [
|
|
1440
|
+
S.collections.length,
|
|
1441
|
+
" collections · ",
|
|
1442
|
+
S.workflows.length,
|
|
1443
|
+
" workflows · ",
|
|
1444
|
+
E.length ? `v${E.length}` : "draft"
|
|
1445
|
+
] })]
|
|
1446
|
+
}),
|
|
1447
|
+
/* @__PURE__ */ c("div", {
|
|
1448
|
+
className: "designer-grid",
|
|
1449
|
+
children: [
|
|
1450
|
+
/* @__PURE__ */ c("aside", {
|
|
1451
|
+
className: "model-tree",
|
|
1452
|
+
children: [
|
|
1453
|
+
/* @__PURE__ */ c("div", {
|
|
1454
|
+
className: "panel-title",
|
|
1455
|
+
children: [/* @__PURE__ */ s("span", { children: "Application" }), /* @__PURE__ */ s("button", {
|
|
1456
|
+
"aria-label": "Add collection",
|
|
1457
|
+
onClick: () => F({ name: "" }),
|
|
1458
|
+
children: "+"
|
|
1459
|
+
})]
|
|
1460
|
+
}),
|
|
1461
|
+
P && /* @__PURE__ */ c("form", {
|
|
1462
|
+
className: "collection-editor",
|
|
1463
|
+
onSubmit: (e) => {
|
|
1464
|
+
e.preventDefault(), Y();
|
|
1465
|
+
},
|
|
1466
|
+
onKeyDown: (e) => {
|
|
1467
|
+
e.key === "Escape" && F(null);
|
|
1468
|
+
},
|
|
1469
|
+
children: [
|
|
1470
|
+
/* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "New collection" }), /* @__PURE__ */ s("input", {
|
|
1471
|
+
autoFocus: !0,
|
|
1472
|
+
placeholder: "e.g. Customer",
|
|
1473
|
+
value: P.name,
|
|
1474
|
+
onChange: (e) => F({ name: e.target.value })
|
|
1475
|
+
})] }),
|
|
1476
|
+
P.error && /* @__PURE__ */ s("div", {
|
|
1477
|
+
className: "field-error",
|
|
1478
|
+
role: "alert",
|
|
1479
|
+
children: P.error
|
|
1480
|
+
}),
|
|
1481
|
+
/* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("button", {
|
|
1482
|
+
type: "button",
|
|
1483
|
+
onClick: () => F(null),
|
|
1484
|
+
children: "Cancel"
|
|
1485
|
+
}), /* @__PURE__ */ s("button", {
|
|
1486
|
+
className: "collection-save",
|
|
1487
|
+
type: "submit",
|
|
1488
|
+
children: "Add"
|
|
1489
|
+
})] })
|
|
1490
|
+
]
|
|
1491
|
+
}),
|
|
1492
|
+
re.map(([e, t]) => /* @__PURE__ */ c("section", { children: [/* @__PURE__ */ s("h3", { children: e }), t.length ? t.map((e) => /* @__PURE__ */ s("div", {
|
|
1493
|
+
className: "tree-item",
|
|
1494
|
+
children: e
|
|
1495
|
+
}, e)) : /* @__PURE__ */ s("div", {
|
|
1496
|
+
className: "tree-empty",
|
|
1497
|
+
children: "None"
|
|
1498
|
+
})] }, e))
|
|
1499
|
+
]
|
|
1500
|
+
}),
|
|
1501
|
+
/* @__PURE__ */ c("section", {
|
|
1502
|
+
className: "model-canvas",
|
|
1503
|
+
children: [
|
|
1504
|
+
/* @__PURE__ */ c("div", {
|
|
1505
|
+
className: "panel-title",
|
|
1506
|
+
children: [/* @__PURE__ */ s("span", { children: "Application graph" }), /* @__PURE__ */ s("span", {
|
|
1507
|
+
className: "graph-legend",
|
|
1508
|
+
children: "intent → fabric"
|
|
1509
|
+
})]
|
|
1510
|
+
}),
|
|
1511
|
+
/* @__PURE__ */ c("div", {
|
|
1512
|
+
className: "graph-board",
|
|
1513
|
+
children: [
|
|
1514
|
+
S.collections.map((e) => /* @__PURE__ */ c("article", {
|
|
1515
|
+
className: "model-node",
|
|
1516
|
+
children: [
|
|
1517
|
+
/* @__PURE__ */ s("div", {
|
|
1518
|
+
className: "node-kind",
|
|
1519
|
+
children: "collection"
|
|
1520
|
+
}),
|
|
1521
|
+
/* @__PURE__ */ s("h3", { children: e.name }),
|
|
1522
|
+
e.fields.map((e) => /* @__PURE__ */ c("div", {
|
|
1523
|
+
className: "node-field",
|
|
1524
|
+
children: [/* @__PURE__ */ s("span", { children: e.name }), /* @__PURE__ */ c("code", { children: [e.type, e.optional ? "?" : ""] })]
|
|
1525
|
+
}, e.name)),
|
|
1526
|
+
M?.collection === e.name ? /* @__PURE__ */ c("form", {
|
|
1527
|
+
className: "field-editor",
|
|
1528
|
+
onSubmit: (e) => {
|
|
1529
|
+
e.preventDefault(), Z();
|
|
1530
|
+
},
|
|
1531
|
+
onKeyDown: (e) => {
|
|
1532
|
+
e.key === "Escape" && N(null);
|
|
1533
|
+
},
|
|
1534
|
+
children: [
|
|
1535
|
+
/* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "Field name" }), /* @__PURE__ */ s("input", {
|
|
1536
|
+
autoFocus: !0,
|
|
1537
|
+
value: M.name,
|
|
1538
|
+
placeholder: "e.g. publishedAt",
|
|
1539
|
+
onChange: (e) => N({
|
|
1540
|
+
...M,
|
|
1541
|
+
name: e.target.value,
|
|
1542
|
+
error: void 0
|
|
1543
|
+
})
|
|
1544
|
+
})] }),
|
|
1545
|
+
/* @__PURE__ */ c("div", {
|
|
1546
|
+
className: "field-editor-row",
|
|
1547
|
+
children: [/* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "Type" }), /* @__PURE__ */ c("select", {
|
|
1548
|
+
value: M.type,
|
|
1549
|
+
onChange: (e) => N({
|
|
1550
|
+
...M,
|
|
1551
|
+
type: e.target.value,
|
|
1552
|
+
error: void 0
|
|
1553
|
+
}),
|
|
1554
|
+
children: [
|
|
1555
|
+
/* @__PURE__ */ s("option", {
|
|
1556
|
+
value: "text",
|
|
1557
|
+
children: "Text"
|
|
1558
|
+
}),
|
|
1559
|
+
/* @__PURE__ */ s("option", {
|
|
1560
|
+
value: "number",
|
|
1561
|
+
children: "Number"
|
|
1562
|
+
}),
|
|
1563
|
+
/* @__PURE__ */ s("option", {
|
|
1564
|
+
value: "boolean",
|
|
1565
|
+
children: "Boolean"
|
|
1566
|
+
}),
|
|
1567
|
+
/* @__PURE__ */ s("option", {
|
|
1568
|
+
value: "datetime",
|
|
1569
|
+
children: "Date & time"
|
|
1570
|
+
}),
|
|
1571
|
+
/* @__PURE__ */ s("option", {
|
|
1572
|
+
value: "json",
|
|
1573
|
+
children: "JSON"
|
|
1574
|
+
}),
|
|
1575
|
+
/* @__PURE__ */ s("option", {
|
|
1576
|
+
value: "ref",
|
|
1577
|
+
children: "Reference"
|
|
1578
|
+
})
|
|
1579
|
+
]
|
|
1580
|
+
})] }), M.type === "ref" && /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ s("span", { children: "Collection" }), /* @__PURE__ */ s("select", {
|
|
1581
|
+
value: M.reference,
|
|
1582
|
+
onChange: (e) => N({
|
|
1583
|
+
...M,
|
|
1584
|
+
reference: e.target.value,
|
|
1585
|
+
error: void 0
|
|
1586
|
+
}),
|
|
1587
|
+
children: S.collections.filter((t) => t.name !== e.name).map((e) => /* @__PURE__ */ s("option", {
|
|
1588
|
+
value: e.name,
|
|
1589
|
+
children: e.name
|
|
1590
|
+
}, e.name))
|
|
1591
|
+
})] })]
|
|
1592
|
+
}),
|
|
1593
|
+
/* @__PURE__ */ c("label", {
|
|
1594
|
+
className: "field-optional",
|
|
1595
|
+
children: [/* @__PURE__ */ s("input", {
|
|
1596
|
+
type: "checkbox",
|
|
1597
|
+
checked: M.optional,
|
|
1598
|
+
onChange: (e) => N({
|
|
1599
|
+
...M,
|
|
1600
|
+
optional: e.target.checked
|
|
1601
|
+
})
|
|
1602
|
+
}), /* @__PURE__ */ s("span", { children: "Optional field" })]
|
|
1603
|
+
}),
|
|
1604
|
+
M.error && /* @__PURE__ */ s("div", {
|
|
1605
|
+
className: "field-error",
|
|
1606
|
+
role: "alert",
|
|
1607
|
+
children: M.error
|
|
1608
|
+
}),
|
|
1609
|
+
/* @__PURE__ */ c("div", {
|
|
1610
|
+
className: "field-editor-actions",
|
|
1611
|
+
children: [/* @__PURE__ */ s("button", {
|
|
1612
|
+
type: "button",
|
|
1613
|
+
onClick: () => N(null),
|
|
1614
|
+
children: "Cancel"
|
|
1615
|
+
}), /* @__PURE__ */ s("button", {
|
|
1616
|
+
className: "field-save",
|
|
1617
|
+
type: "submit",
|
|
1618
|
+
children: "Add field"
|
|
1619
|
+
})]
|
|
1620
|
+
})
|
|
1621
|
+
]
|
|
1622
|
+
}) : /* @__PURE__ */ s("button", {
|
|
1623
|
+
className: "node-add",
|
|
1624
|
+
onClick: () => X(e.name),
|
|
1625
|
+
children: "+ field"
|
|
1626
|
+
})
|
|
1627
|
+
]
|
|
1628
|
+
}, e.name)),
|
|
1629
|
+
S.workflows.map((e) => /* @__PURE__ */ c("article", {
|
|
1630
|
+
className: "model-node workflow-node",
|
|
1631
|
+
children: [
|
|
1632
|
+
/* @__PURE__ */ s("div", {
|
|
1633
|
+
className: "node-kind",
|
|
1634
|
+
children: "workflow"
|
|
1635
|
+
}),
|
|
1636
|
+
/* @__PURE__ */ s("h3", { children: e.name }),
|
|
1637
|
+
e.steps.map((e) => /* @__PURE__ */ s("div", {
|
|
1638
|
+
className: "node-step",
|
|
1639
|
+
children: e.name
|
|
1640
|
+
}, e.name))
|
|
1641
|
+
]
|
|
1642
|
+
}, e.name)),
|
|
1643
|
+
S.agents.map((e) => /* @__PURE__ */ c("article", {
|
|
1644
|
+
className: "model-node agent-node",
|
|
1645
|
+
children: [
|
|
1646
|
+
/* @__PURE__ */ s("div", {
|
|
1647
|
+
className: "node-kind",
|
|
1648
|
+
children: "agent"
|
|
1649
|
+
}),
|
|
1650
|
+
/* @__PURE__ */ s("h3", { children: e.name }),
|
|
1651
|
+
e.statements.map((e) => /* @__PURE__ */ s("div", {
|
|
1652
|
+
className: "node-step",
|
|
1653
|
+
children: e
|
|
1654
|
+
}, e))
|
|
1655
|
+
]
|
|
1656
|
+
}, e.name))
|
|
1657
|
+
]
|
|
1658
|
+
}),
|
|
1659
|
+
/* @__PURE__ */ c("div", {
|
|
1660
|
+
className: "change-strip",
|
|
1661
|
+
children: [
|
|
1662
|
+
/* @__PURE__ */ s("strong", { children: "Model diff" }),
|
|
1663
|
+
/* @__PURE__ */ c("span", {
|
|
1664
|
+
className: "added",
|
|
1665
|
+
children: ["+ ", G.added.join(", ") || "none"]
|
|
1666
|
+
}),
|
|
1667
|
+
/* @__PURE__ */ c("span", {
|
|
1668
|
+
className: "changed",
|
|
1669
|
+
children: ["~ ", G.changed.join(", ") || "none"]
|
|
1670
|
+
}),
|
|
1671
|
+
/* @__PURE__ */ c("span", {
|
|
1672
|
+
className: "removed",
|
|
1673
|
+
children: ["− ", G.removed.join(", ") || "none"]
|
|
1674
|
+
})
|
|
1675
|
+
]
|
|
1676
|
+
})
|
|
1677
|
+
]
|
|
1678
|
+
}),
|
|
1679
|
+
/* @__PURE__ */ c("section", {
|
|
1680
|
+
className: "dsl-panel",
|
|
1681
|
+
children: [
|
|
1682
|
+
/* @__PURE__ */ c("div", {
|
|
1683
|
+
className: "panel-title",
|
|
1684
|
+
children: [/* @__PURE__ */ s("span", { children: "Flow DSL" }), /* @__PURE__ */ s("span", { children: "feltdb.flow" })]
|
|
1685
|
+
}),
|
|
1686
|
+
/* @__PURE__ */ s("textarea", {
|
|
1687
|
+
"aria-label": "Flow DSL",
|
|
1688
|
+
spellCheck: !1,
|
|
1689
|
+
value: b,
|
|
1690
|
+
onChange: (e) => q(e.target.value)
|
|
1691
|
+
}),
|
|
1692
|
+
w.length > 0 && /* @__PURE__ */ s("div", {
|
|
1693
|
+
className: "diagnostics",
|
|
1694
|
+
children: w.map((e, t) => /* @__PURE__ */ c("div", {
|
|
1695
|
+
className: e.severity,
|
|
1696
|
+
children: [
|
|
1697
|
+
e.severity,
|
|
1698
|
+
": ",
|
|
1699
|
+
e.message
|
|
1700
|
+
]
|
|
1701
|
+
}, t))
|
|
1702
|
+
})
|
|
1703
|
+
]
|
|
1704
|
+
})
|
|
1705
|
+
]
|
|
1706
|
+
})
|
|
1707
|
+
]
|
|
1708
|
+
});
|
|
1709
|
+
}
|
|
1710
|
+
//#endregion
|
|
1711
|
+
export { _, F as a, y as b, M as c, O as d, D as f, v as g, b as h, I as i, j as l, w as m, R as n, P as o, E as p, L as r, N as s, B as t, k as u, x as v, g as x, S as y };
|