@loopstack/loopstack-studio 0.21.3 → 0.22.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 (86) hide show
  1. package/dist/api/auth.js +10 -0
  2. package/dist/api/client.js +13 -0
  3. package/dist/api/config.js +10 -0
  4. package/dist/api/dashboard.js +4 -0
  5. package/dist/api/documents.js +7 -0
  6. package/dist/api/index.js +24 -0
  7. package/dist/api/namespaces.js +7 -0
  8. package/dist/api/pipelines.js +13 -0
  9. package/dist/api/processor.js +4 -0
  10. package/dist/api/workflows.js +8 -0
  11. package/dist/api/workspaces.js +12 -0
  12. package/dist/app/EnvironmentEmbedRoot.js +33 -0
  13. package/dist/components/data-table/DataTableFilters.js +74 -63
  14. package/dist/components/layout/MainLayout.js +7 -4
  15. package/dist/components/page/PageBreadcrumbs.js +1 -1
  16. package/dist/components/ui/sidebar.js +359 -359
  17. package/dist/components/ui-widgets/UiActions.js +22 -15
  18. package/dist/components/ui-widgets/UiWidget.js +31 -26
  19. package/dist/components/ui-widgets/widgets/AiPromptInput.js +27 -27
  20. package/dist/components/ui-widgets/widgets/ButtonFullWidth.js +12 -12
  21. package/dist/components/ui-widgets/widgets/SandboxRun.js +32 -0
  22. package/dist/components/ui-widgets/widgets/SubmitButton.js +11 -11
  23. package/dist/features/code-explorer/utils/fileIcons.js +4 -7
  24. package/dist/features/oauth/OAuthPromptRenderer.js +1 -1
  25. package/dist/features/runs/Runs.js +197 -0
  26. package/dist/features/workbench/NavigationItems.js +1 -1
  27. package/dist/features/workbench/Workbench.js +109 -75
  28. package/dist/features/workbench/WorkflowItem.js +8 -11
  29. package/dist/features/workbench/WorkflowList.js +29 -20
  30. package/dist/features/workbench/components/DocumentList.js +20 -20
  31. package/dist/features/workbench/components/NewRunDialog.js +328 -0
  32. package/dist/features/workbench/components/WorkbenchFloatingPanel.js +88 -0
  33. package/dist/features/workbench/components/WorkbenchFlowPanel.js +48 -0
  34. package/dist/features/workbench/components/WorkbenchIconSidebar.js +68 -0
  35. package/dist/features/workbench/components/WorkbenchPreviewPanel.js +128 -0
  36. package/dist/features/workbench/components/WorkflowForms.js +7 -6
  37. package/dist/features/workbench/components/WorkflowHistoryItem.js +68 -63
  38. package/dist/features/workbench/components/buttons/WorkflowButtons.js +79 -61
  39. package/dist/features/workbench/components/document-renderer/DocumentFormRenderer.js +6 -5
  40. package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +77 -0
  41. package/dist/features/workspaces/Workspaces.js +2 -2
  42. package/dist/features/workspaces/components/CreateWorkspace.js +164 -81
  43. package/dist/features/workspaces/components/EnvironmentSlotSelector.js +63 -0
  44. package/dist/features/workspaces/components/ExecutionTimeline.js +69 -68
  45. package/dist/features/workspaces/components/PipelineForm.js +4 -4
  46. package/dist/hooks/index.js +2 -0
  47. package/dist/hooks/useApi.js +9 -33
  48. package/dist/hooks/useAuth.js +18 -38
  49. package/dist/hooks/useConfig.js +31 -33
  50. package/dist/hooks/useDashboard.js +1 -4
  51. package/dist/hooks/useDocuments.js +4 -8
  52. package/dist/hooks/useFiles.js +31 -41
  53. package/dist/hooks/useNamespaces.js +5 -8
  54. package/dist/hooks/usePipelines.js +98 -108
  55. package/dist/hooks/useProcessor.js +1 -4
  56. package/dist/hooks/useWorkflows.js +25 -41
  57. package/dist/hooks/useWorkspaces.js +45 -72
  58. package/dist/index.d.ts +266 -48
  59. package/dist/index.js +10 -2
  60. package/dist/packages/contracts/dist/enums/index.js +25 -0
  61. package/dist/packages/contracts/dist/enums/pipeline-state.js +10 -0
  62. package/dist/packages/contracts/dist/enums/registry.enum.js +20 -0
  63. package/dist/packages/contracts/dist/enums/sort-order.enum.js +10 -0
  64. package/dist/packages/contracts/dist/enums/user-type.enum.js +10 -0
  65. package/dist/packages/contracts/dist/enums/workflow-state.enum.js +10 -0
  66. package/dist/pages/DebugPage.js +12 -14
  67. package/dist/pages/DebugWorkflowDetailsPage.js +1 -1
  68. package/dist/pages/DebugWorkflowsPage.js +3 -4
  69. package/dist/pages/EmbedWorkbenchPage.js +4 -3
  70. package/dist/pages/PipelineDebugPage.js +2 -2
  71. package/dist/pages/PreviewWorkbenchPage.js +416 -0
  72. package/dist/pages/RunsListPage.js +36 -0
  73. package/dist/pages/RunsPage.js +49 -0
  74. package/dist/pages/StudioLandingPage.js +145 -0
  75. package/dist/pages/WorkbenchPage.js +75 -51
  76. package/dist/providers/InvalidationEventsProvider.js +7 -7
  77. package/dist/providers/QueryProvider.js +21 -0
  78. package/dist/routing/LocalRouter.js +9 -0
  79. package/dist/services/createApiClient.js +4 -10
  80. package/dist/services/index.js +1 -1
  81. package/package.json +2 -3
  82. package/dist/features/code-explorer/CodeExplorer.js +0 -69
  83. package/dist/features/code-explorer/components/CodeExplorerTree.js +0 -43
  84. package/dist/features/code-explorer/components/CodeExplorerTreeNode.js +0 -82
  85. package/dist/features/workbench/components/WorkbenchSidebar.js +0 -109
  86. package/dist/features/workbench/providers/WorkbenchContextProvider.js +0 -3
@@ -0,0 +1,328 @@
1
+ import { usePipelineConfig, useWorkspaceConfig } from "../../../hooks/useConfig.js";
2
+ import { useCreatePipeline } from "../../../hooks/usePipelines.js";
3
+ import { useFilterWorkspaces } from "../../../hooks/useWorkspaces.js";
4
+ import { useComponentOverrides } from "../../../providers/ComponentOverridesProvider.js";
5
+ import { Button } from "../../../components/ui/button.js";
6
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../components/ui/collapsible.js";
7
+ import { Dialog, DialogContent, DialogTitle } from "../../../components/ui/dialog.js";
8
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../components/ui/select.js";
9
+ import ErrorSnackbar_default from "../../../components/snackbars/ErrorSnackbar.js";
10
+ import CreateWorkspace_default from "../../workspaces/components/CreateWorkspace.js";
11
+ import Form_default from "../../../components/dynamic-form/Form.js";
12
+ import { useRunPipeline } from "../../../hooks/useProcessor.js";
13
+ import { c } from "react/compiler-runtime";
14
+ import { useCallback, useEffect, useMemo, useState } from "react";
15
+ import { jsx, jsxs } from "react/jsx-runtime";
16
+ import { Check, CheckIcon, ChevronDown, Loader2, Plus } from "lucide-react";
17
+ import * as SelectPrimitive from "@radix-ui/react-select";
18
+ import { useForm } from "react-hook-form";
19
+ function NewRunDialog(e) {
20
+ let t = c(8), { open: n, onOpenChange: r, onSuccess: i } = e, a;
21
+ t[0] === Symbol.for("react.memo_cache_sentinel") ? (a = /* @__PURE__ */ jsx(DialogTitle, { children: "New Run" }), t[0] = a) : a = t[0];
22
+ let o;
23
+ t[1] !== i || t[2] !== n ? (o = /* @__PURE__ */ jsxs(DialogContent, {
24
+ className: "max-h-[80vh] min-h-[300px] !max-w-2xl",
25
+ children: [a, /* @__PURE__ */ jsx(NewRunDialogContent, {
26
+ open: n,
27
+ onSuccess: i
28
+ })]
29
+ }), t[1] = i, t[2] = n, t[3] = o) : o = t[3];
30
+ let s;
31
+ return t[4] !== r || t[5] !== n || t[6] !== o ? (s = /* @__PURE__ */ jsx(Dialog, {
32
+ open: n,
33
+ onOpenChange: r,
34
+ children: o
35
+ }), t[4] = r, t[5] = n, t[6] = o, t[7] = s) : s = t[7], s;
36
+ }
37
+ function NewRunDialogContent(o) {
38
+ let s = c(115), { open: l, onSuccess: u } = o, [d, f] = useState("workspace"), [p, g] = useState(!1), [v, me] = useState(""), [y, he] = useState(""), { CreateWorkspace: x } = useComponentOverrides(), _e = x ?? CreateWorkspace_default, ve = useWorkspaceConfig(), ye;
39
+ s[0] === Symbol.for("react.memo_cache_sentinel") ? (ye = {}, s[0] = ye) : ye = s[0];
40
+ let S = useFilterWorkspaces(void 0, ye, "title", "ASC", 0, 100), be;
41
+ s[1] === S.data?.data ? be = s[2] : (be = S.data?.data ?? [], s[1] = S.data?.data, s[2] = be);
42
+ let C = be, xe;
43
+ if (s[3] !== v || s[4] !== C) {
44
+ let e;
45
+ s[6] === v ? e = s[7] : (e = (e) => e.id === v, s[6] = v, s[7] = e), xe = C.find(e), s[3] = v, s[4] = C, s[5] = xe;
46
+ } else xe = s[5];
47
+ let Se = xe, w = usePipelineConfig(Se?.blockName), Ce;
48
+ s[8] === w.data ? Ce = s[9] : (Ce = w.data ?? [], s[8] = w.data, s[9] = Ce);
49
+ let T = Ce, E = useCreatePipeline(), D = useRunPipeline(), O = E.isPending || D.isPending, k;
50
+ s[10] === Symbol.for("react.memo_cache_sentinel") ? (k = {
51
+ defaultValues: {},
52
+ mode: "onChange"
53
+ }, s[10] = k) : k = s[10];
54
+ let A = useForm(k), we;
55
+ bb0: {
56
+ if (!y || !T.length) {
57
+ we = void 0;
58
+ break bb0;
59
+ }
60
+ let e;
61
+ if (s[11] !== T || s[12] !== y) {
62
+ let t;
63
+ s[14] === y ? t = s[15] : (t = (e) => e.blockName === y, s[14] = y, s[15] = t), e = T.find(t), s[11] = T, s[12] = y, s[13] = e;
64
+ } else e = s[13];
65
+ we = e;
66
+ }
67
+ let j = we, M = !!j?.schema, N;
68
+ s[16] !== v || s[17] !== C[0] || s[18] !== C.length ? (N = () => {
69
+ !v && C.length > 0 && me(C[0].id);
70
+ }, s[16] = v, s[17] = C[0], s[18] = C.length, s[19] = N) : N = s[19];
71
+ let P;
72
+ s[20] !== v || s[21] !== C ? (P = [C, v], s[20] = v, s[21] = C, s[22] = P) : P = s[22], useEffect(N, P);
73
+ let F, Te;
74
+ s[23] !== T || s[24] !== y ? (Te = () => {
75
+ T.length > 0 && !T.find((e) => e.blockName === y) && he(T[0].blockName);
76
+ }, F = [T, y], s[23] = T, s[24] = y, s[25] = F, s[26] = Te) : (F = s[25], Te = s[26]), useEffect(Te, F);
77
+ let Ee;
78
+ s[27] !== E || s[28] !== A || s[29] !== l || s[30] !== D ? (Ee = () => {
79
+ l || (f("workspace"), g(!1), me(""), he(""), A.reset({}), E.reset(), D.reset());
80
+ }, s[27] = E, s[28] = A, s[29] = l, s[30] = D, s[31] = Ee) : Ee = s[31];
81
+ let De;
82
+ s[32] === l ? De = s[33] : (De = [l], s[32] = l, s[33] = De), useEffect(Ee, De);
83
+ let Oe;
84
+ s[34] === Symbol.for("react.memo_cache_sentinel") ? (Oe = (e) => {
85
+ me(e), f("automation");
86
+ }, s[34] = Oe) : Oe = s[34];
87
+ let ke = Oe, Ae;
88
+ s[35] === A ? Ae = s[36] : (Ae = (e) => {
89
+ he(e), A.reset({});
90
+ }, s[35] = A, s[36] = Ae);
91
+ let je = Ae, Me, I;
92
+ s[37] !== M || s[38] !== y || s[39] !== j ? (Me = () => {
93
+ y && j && M && f("config");
94
+ }, I = [
95
+ j,
96
+ y,
97
+ M
98
+ ], s[37] = M, s[38] = y, s[39] = j, s[40] = Me, s[41] = I) : (Me = s[40], I = s[41]), useEffect(Me, I);
99
+ let Ne;
100
+ s[42] !== E || s[43] !== u || s[44] !== D || s[45] !== y || s[46] !== v ? (Ne = (e, t) => {
101
+ !v || !y || E.mutate({ pipelineCreateDto: {
102
+ blockName: y,
103
+ title: null,
104
+ workspaceId: v,
105
+ transition: e ?? null,
106
+ args: t ?? {}
107
+ } }, { onSuccess: (e) => {
108
+ D.mutate({
109
+ pipelineId: e.id,
110
+ runPipelinePayloadDto: {},
111
+ force: !0
112
+ }, { onSuccess: () => u(e.id) });
113
+ } });
114
+ }, s[42] = E, s[43] = u, s[44] = D, s[45] = y, s[46] = v, s[47] = Ne) : Ne = s[47];
115
+ let Pe = Ne, Fe;
116
+ s[48] !== Pe || s[49] !== A || s[50] !== M ? (Fe = () => {
117
+ M ? A.handleSubmit((e) => Pe("", e))() : Pe();
118
+ }, s[48] = Pe, s[49] = A, s[50] = M, s[51] = Fe) : Fe = s[51];
119
+ let Ie = Fe, Le = !!v && !!y, Re;
120
+ s[52] === Symbol.for("react.memo_cache_sentinel") ? (Re = (e) => {
121
+ f((t) => t === e ? null : e);
122
+ }, s[52] = Re) : Re = s[52];
123
+ let ze = Re, Be = !!v, L = !!y, R = Be, Ve = L && M, z;
124
+ s[53] === E.error ? z = s[54] : (z = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: E.error }), s[53] = E.error, s[54] = z);
125
+ let B;
126
+ s[55] === D.error ? B = s[56] : (B = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: D.error }), s[55] = D.error, s[56] = B);
127
+ let He = Se?.title, Ue = d === "workspace", We = Be && d !== "workspace", Ge;
128
+ s[57] === Symbol.for("react.memo_cache_sentinel") ? (Ge = () => ze("workspace"), s[57] = Ge) : Ge = s[57];
129
+ let V;
130
+ s[58] !== _e || s[59] !== ve || s[60] !== v || s[61] !== p || s[62] !== C ? (V = p ? /* @__PURE__ */ jsx("div", {
131
+ className: "pt-2",
132
+ children: /* @__PURE__ */ jsx(_e, {
133
+ types: ve.data ?? [],
134
+ onSuccess: () => {
135
+ g(!1);
136
+ }
137
+ })
138
+ }) : /* @__PURE__ */ jsxs("div", {
139
+ className: "flex gap-2 pt-2",
140
+ children: [/* @__PURE__ */ jsxs(Select, {
141
+ value: v,
142
+ onValueChange: ke,
143
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
144
+ id: "workspace",
145
+ className: "flex-1",
146
+ children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select a workspace..." })
147
+ }), /* @__PURE__ */ jsx(SelectContent, { children: C.map(_temp) })]
148
+ }), /* @__PURE__ */ jsx(Button, {
149
+ variant: "outline",
150
+ onClick: () => g(!0),
151
+ className: "px-3",
152
+ title: "Create new workspace",
153
+ children: /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" })
154
+ })]
155
+ }), s[58] = _e, s[59] = ve, s[60] = v, s[61] = p, s[62] = C, s[63] = V) : V = s[63];
156
+ let H;
157
+ s[64] !== S.isLoading || s[65] !== He || s[66] !== Ue || s[67] !== We || s[68] !== V ? (H = /* @__PURE__ */ jsx(StepSection, {
158
+ step: 1,
159
+ title: "Select Workspace",
160
+ summary: He,
161
+ isActive: Ue,
162
+ isComplete: We,
163
+ isEnabled: !0,
164
+ isLoading: S.isLoading,
165
+ onToggle: Ge,
166
+ children: V
167
+ }), s[64] = S.isLoading, s[65] = He, s[66] = Ue, s[67] = We, s[68] = V, s[69] = H) : H = s[69];
168
+ let U;
169
+ s[70] !== L || s[71] !== T || s[72] !== y ? (U = L ? T.find((e) => e.blockName === y)?.title ?? y : void 0, s[70] = L, s[71] = T, s[72] = y, s[73] = U) : U = s[73];
170
+ let Ke = d === "automation", qe = L && d !== "automation", Je = w.isLoading, W;
171
+ s[74] === R ? W = s[75] : (W = () => R && ze("automation"), s[74] = R, s[75] = W);
172
+ let Ye;
173
+ s[76] === Symbol.for("react.memo_cache_sentinel") ? (Ye = /* @__PURE__ */ jsx(SelectTrigger, {
174
+ id: "automation",
175
+ className: "w-full",
176
+ children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select a workflow..." })
177
+ }), s[76] = Ye) : Ye = s[76];
178
+ let G;
179
+ s[77] === T ? G = s[78] : (G = T.map(_temp2), s[77] = T, s[78] = G);
180
+ let K;
181
+ s[79] === G ? K = s[80] : (K = /* @__PURE__ */ jsx(SelectContent, { children: G }), s[79] = G, s[80] = K);
182
+ let q;
183
+ s[81] !== je || s[82] !== O || s[83] !== y || s[84] !== K ? (q = /* @__PURE__ */ jsx("div", {
184
+ className: "pt-2",
185
+ children: /* @__PURE__ */ jsxs(Select, {
186
+ value: y,
187
+ onValueChange: je,
188
+ disabled: O,
189
+ children: [Ye, K]
190
+ })
191
+ }), s[81] = je, s[82] = O, s[83] = y, s[84] = K, s[85] = q) : q = s[85];
192
+ let J;
193
+ s[86] !== R || s[87] !== w.isLoading || s[88] !== U || s[89] !== Ke || s[90] !== qe || s[91] !== W || s[92] !== q ? (J = /* @__PURE__ */ jsx(StepSection, {
194
+ step: 2,
195
+ title: "Select Workflow",
196
+ summary: U,
197
+ isActive: Ke,
198
+ isComplete: qe,
199
+ isEnabled: R,
200
+ isLoading: Je,
201
+ onToggle: W,
202
+ children: q
203
+ }), s[86] = R, s[87] = w.isLoading, s[88] = U, s[89] = Ke, s[90] = qe, s[91] = W, s[92] = q, s[93] = J) : J = s[93];
204
+ let Y;
205
+ s[94] !== d || s[95] !== Ve || s[96] !== A || s[97] !== M || s[98] !== j ? (Y = M && /* @__PURE__ */ jsx(StepSection, {
206
+ step: 3,
207
+ title: "Configuration",
208
+ isActive: d === "config",
209
+ isComplete: !1,
210
+ isEnabled: Ve,
211
+ onToggle: () => Ve && ze("config"),
212
+ children: /* @__PURE__ */ jsx("div", {
213
+ className: "max-h-72 overflow-y-auto pt-2",
214
+ children: j?.schema && /* @__PURE__ */ jsx(Form_default, {
215
+ form: A,
216
+ schema: j.schema,
217
+ ui: j.ui,
218
+ disabled: !1,
219
+ viewOnly: !1
220
+ })
221
+ })
222
+ }), s[94] = d, s[95] = Ve, s[96] = A, s[97] = M, s[98] = j, s[99] = Y) : Y = s[99];
223
+ let X;
224
+ s[100] !== H || s[101] !== J || s[102] !== Y ? (X = /* @__PURE__ */ jsxs("div", {
225
+ className: "space-y-2",
226
+ children: [
227
+ H,
228
+ J,
229
+ Y
230
+ ]
231
+ }), s[100] = H, s[101] = J, s[102] = Y, s[103] = X) : X = s[103];
232
+ let Xe = !Le || O, Z;
233
+ s[104] === O ? Z = s[105] : (Z = O && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }), s[104] = O, s[105] = Z);
234
+ let Q;
235
+ s[106] !== Ie || s[107] !== Xe || s[108] !== Z ? (Q = /* @__PURE__ */ jsx("div", {
236
+ className: "mt-4 flex justify-end border-t pt-4",
237
+ children: /* @__PURE__ */ jsxs(Button, {
238
+ variant: "default",
239
+ disabled: Xe,
240
+ onClick: Ie,
241
+ size: "lg",
242
+ className: "font-medium",
243
+ children: [Z, "Run Now"]
244
+ })
245
+ }), s[106] = Ie, s[107] = Xe, s[108] = Z, s[109] = Q) : Q = s[109];
246
+ let $;
247
+ return s[110] !== z || s[111] !== B || s[112] !== X || s[113] !== Q ? ($ = /* @__PURE__ */ jsxs("div", {
248
+ className: "mt-2 overflow-y-auto",
249
+ children: [
250
+ z,
251
+ B,
252
+ X,
253
+ Q
254
+ ]
255
+ }), s[110] = z, s[111] = B, s[112] = X, s[113] = Q, s[114] = $) : $ = s[114], $;
256
+ }
257
+ function _temp2(e) {
258
+ return /* @__PURE__ */ jsxs(SelectPrimitive.Item, {
259
+ value: e.blockName,
260
+ className: "focus:bg-accent focus:text-accent-foreground relative flex w-full cursor-pointer flex-col gap-0.5 rounded-sm py-2 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
261
+ children: [
262
+ /* @__PURE__ */ jsx("span", {
263
+ className: "absolute right-2 top-2.5 flex size-3.5 items-center justify-center",
264
+ children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) })
265
+ }),
266
+ /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children: e.title ?? e.blockName }),
267
+ e.description && /* @__PURE__ */ jsx("span", {
268
+ className: "text-muted-foreground text-xs leading-snug",
269
+ children: e.description
270
+ })
271
+ ]
272
+ }, e.blockName);
273
+ }
274
+ function _temp(e) {
275
+ return /* @__PURE__ */ jsx(SelectItem, {
276
+ value: e.id,
277
+ children: e.title
278
+ }, e.id);
279
+ }
280
+ function StepSection(e) {
281
+ let t = c(35), { step: n, title: r, summary: i, isActive: a, isComplete: u, isEnabled: d, isLoading: f, onToggle: se, children: ce } = e, p;
282
+ t[0] === se ? p = t[1] : (p = () => se(), t[0] = se, t[1] = p);
283
+ let le = `flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left transition-colors ${d ? "hover:bg-muted/50 cursor-pointer" : "cursor-not-allowed opacity-50"}`, ue = !d, de = `flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-full text-xs font-semibold ${u ? "bg-primary text-primary-foreground" : a ? "border-primary text-primary border-2" : "border-border text-muted-foreground border"}`, m;
284
+ t[2] !== u || t[3] !== n ? (m = u ? /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5" }) : n, t[2] = u, t[3] = n, t[4] = m) : m = t[4];
285
+ let h;
286
+ t[5] !== de || t[6] !== m ? (h = /* @__PURE__ */ jsx("div", {
287
+ className: de,
288
+ children: m
289
+ }), t[5] = de, t[6] = m, t[7] = h) : h = t[7];
290
+ let fe = `flex-1 text-sm font-medium ${d ? "text-foreground" : "text-muted-foreground"}`, g;
291
+ t[8] !== fe || t[9] !== r ? (g = /* @__PURE__ */ jsx("span", {
292
+ className: fe,
293
+ children: r
294
+ }), t[8] = fe, t[9] = r, t[10] = g) : g = t[10];
295
+ let _;
296
+ t[11] !== a || t[12] !== u || t[13] !== i ? (_ = !a && u && i && /* @__PURE__ */ jsx("span", {
297
+ className: "text-muted-foreground mr-1 max-w-48 truncate text-sm",
298
+ children: i
299
+ }), t[11] = a, t[12] = u, t[13] = i, t[14] = _) : _ = t[14];
300
+ let v;
301
+ t[15] !== a || t[16] !== f ? (v = f && a && /* @__PURE__ */ jsx(Loader2, { className: "text-muted-foreground h-4 w-4 animate-spin" }), t[15] = a, t[16] = f, t[17] = v) : v = t[17];
302
+ let pe = `text-muted-foreground h-4 w-4 transition-transform ${a ? "rotate-180" : ""}`, y;
303
+ t[18] === pe ? y = t[19] : (y = /* @__PURE__ */ jsx(ChevronDown, { className: pe }), t[18] = pe, t[19] = y);
304
+ let b;
305
+ t[20] !== v || t[21] !== y || t[22] !== le || t[23] !== ue || t[24] !== h || t[25] !== g || t[26] !== _ ? (b = /* @__PURE__ */ jsxs(CollapsibleTrigger, {
306
+ className: le,
307
+ disabled: ue,
308
+ children: [
309
+ h,
310
+ g,
311
+ _,
312
+ v,
313
+ y
314
+ ]
315
+ }), t[20] = v, t[21] = y, t[22] = le, t[23] = ue, t[24] = h, t[25] = g, t[26] = _, t[27] = b) : b = t[27];
316
+ let x;
317
+ t[28] === ce ? x = t[29] : (x = /* @__PURE__ */ jsx(CollapsibleContent, {
318
+ className: "px-3 pb-3 pl-13",
319
+ children: ce
320
+ }), t[28] = ce, t[29] = x);
321
+ let ge;
322
+ return t[30] !== a || t[31] !== p || t[32] !== b || t[33] !== x ? (ge = /* @__PURE__ */ jsxs(Collapsible, {
323
+ open: a,
324
+ onOpenChange: p,
325
+ children: [b, x]
326
+ }), t[30] = a, t[31] = p, t[32] = b, t[33] = x, t[34] = ge) : ge = t[34], ge;
327
+ }
328
+ export { NewRunDialog };
@@ -0,0 +1,88 @@
1
+ import { cn } from "../../../lib/utils.js";
2
+ import { SidebarMenu, SidebarProvider } from "../../../components/ui/sidebar.js";
3
+ import { useWorkbenchLayout } from "../providers/WorkbenchLayoutProvider.js";
4
+ import { useNamespaceTree } from "../../../hooks/useNamespaceTree.js";
5
+ import WorkbenchNavigation_default from "../WorkbenchNavigation.js";
6
+ import PipelineHistoryList_default from "./PipelineHistoryList.js";
7
+ import { c } from "react/compiler-runtime";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { X } from "lucide-react";
10
+ var PANEL_TITLES = {
11
+ navigation: "Navigate",
12
+ history: "Run Log"
13
+ };
14
+ function NavigationContent() {
15
+ let e = c(3), { pipeline: f } = useWorkbenchLayout(), p;
16
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (p = { "--sidebar-width": "100%" }, e[0] = p) : p = e[0];
17
+ let m;
18
+ return e[1] === f.id ? m = e[2] : (m = /* @__PURE__ */ jsx(SidebarProvider, {
19
+ defaultOpen: !0,
20
+ className: "min-h-0",
21
+ style: p,
22
+ children: /* @__PURE__ */ jsx("div", {
23
+ className: "w-full overflow-auto p-2",
24
+ children: /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(NavigationContentInner, { pipelineId: f.id }) })
25
+ })
26
+ }), e[1] = f.id, e[2] = m), m;
27
+ }
28
+ function NavigationContentInner(e) {
29
+ let l = c(3), { pipelineId: u } = e, d = useNamespaceTree(u);
30
+ if (!d || d.length === 0) {
31
+ let e;
32
+ return l[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("div", {
33
+ className: "text-muted-foreground py-4 text-center text-sm",
34
+ children: "No navigation items"
35
+ }), l[0] = e) : e = l[0], e;
36
+ }
37
+ let m;
38
+ return l[1] === d ? m = l[2] : (m = /* @__PURE__ */ jsx(WorkbenchNavigation_default, {
39
+ namespaceTree: d,
40
+ indent: 0
41
+ }), l[1] = d, l[2] = m), m;
42
+ }
43
+ function HistoryContent() {
44
+ let e = c(2), { pipeline: l } = useWorkbenchLayout(), u;
45
+ return e[0] === l ? u = e[1] : (u = /* @__PURE__ */ jsx("div", {
46
+ className: "overflow-auto p-2",
47
+ children: /* @__PURE__ */ jsx(PipelineHistoryList_default, { pipeline: l })
48
+ }), e[0] = l, e[1] = u), u;
49
+ }
50
+ function WorkbenchFloatingPanel() {
51
+ let l = c(19), { activeFloatingPanel: u, closeFloatingPanel: f } = useWorkbenchLayout();
52
+ if (!u) return null;
53
+ let p;
54
+ l[0] === Symbol.for("react.memo_cache_sentinel") ? (p = cn("border-l bg-background absolute right-0 top-0 bottom-0 z-20 flex w-80 flex-col shadow-lg", "animate-in slide-in-from-right duration-200"), l[0] = p) : p = l[0];
55
+ let m = PANEL_TITLES[u], h;
56
+ l[1] === m ? h = l[2] : (h = /* @__PURE__ */ jsx("span", {
57
+ className: "text-sm font-medium",
58
+ children: m
59
+ }), l[1] = m, l[2] = h);
60
+ let g;
61
+ l[3] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }), l[3] = g) : g = l[3];
62
+ let _;
63
+ l[4] === f ? _ = l[5] : (_ = /* @__PURE__ */ jsx("button", {
64
+ onClick: f,
65
+ className: "text-muted-foreground hover:text-foreground flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:cursor-pointer",
66
+ children: g
67
+ }), l[4] = f, l[5] = _);
68
+ let v;
69
+ l[6] !== h || l[7] !== _ ? (v = /* @__PURE__ */ jsxs("div", {
70
+ className: "border-b flex h-12 shrink-0 items-center justify-between px-3",
71
+ children: [h, _]
72
+ }), l[6] = h, l[7] = _, l[8] = v) : v = l[8];
73
+ let y;
74
+ l[9] === u ? y = l[10] : (y = u === "navigation" && /* @__PURE__ */ jsx(NavigationContent, {}), l[9] = u, l[10] = y);
75
+ let b;
76
+ l[11] === u ? b = l[12] : (b = u === "history" && /* @__PURE__ */ jsx(HistoryContent, {}), l[11] = u, l[12] = b);
77
+ let x;
78
+ l[13] !== y || l[14] !== b ? (x = /* @__PURE__ */ jsxs("div", {
79
+ className: "flex-1 overflow-hidden",
80
+ children: [y, b]
81
+ }), l[13] = y, l[14] = b, l[15] = x) : x = l[15];
82
+ let S;
83
+ return l[16] !== v || l[17] !== x ? (S = /* @__PURE__ */ jsxs("div", {
84
+ className: p,
85
+ children: [v, x]
86
+ }), l[16] = v, l[17] = x, l[18] = S) : S = l[18], S;
87
+ }
88
+ export { WorkbenchFloatingPanel };
@@ -0,0 +1,48 @@
1
+ import { usePipeline, usePipelineConfig } from "../../../hooks/usePipelines.js";
2
+ import { useWorkspace } from "../../../hooks/useWorkspaces.js";
3
+ import { useFetchWorkflowsByPipeline } from "../../../hooks/useWorkflows.js";
4
+ import { ReactFlowProvider } from "../../../node_modules/@xyflow/react/dist/esm/index.js";
5
+ import { useWorkbenchLayout } from "../providers/WorkbenchLayoutProvider.js";
6
+ import PipelineFlowViewer_default from "../../debug/components/PipelineFlowViewer.js";
7
+ import { c } from "react/compiler-runtime";
8
+ import { useMemo } from "react";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { X } from "lucide-react";
11
+ function WorkbenchFlowPanel() {
12
+ let f = c(13), { pipeline: p, closeSidePanel: m } = useWorkbenchLayout(), h = usePipeline(p.id), g = useWorkspace(p.workspaceId), _ = useFetchWorkflowsByPipeline(p.id), v = usePipelineConfig(g.data?.blockName, h.data?.blockName), y;
13
+ f[0] === _.data ? y = f[1] : (y = _.data ?? [], f[0] = _.data, f[1] = y);
14
+ let b = y, x;
15
+ f[2] === Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ jsx("span", {
16
+ className: "text-sm font-medium",
17
+ children: "Graph"
18
+ }), f[2] = x) : x = f[2];
19
+ let S;
20
+ f[3] === Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }), f[3] = S) : S = f[3];
21
+ let C;
22
+ f[4] === m ? C = f[5] : (C = /* @__PURE__ */ jsxs("div", {
23
+ className: "border-b flex h-12 shrink-0 items-center justify-between px-3",
24
+ children: [x, /* @__PURE__ */ jsx("button", {
25
+ onClick: m,
26
+ className: "text-muted-foreground hover:text-foreground flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:cursor-pointer",
27
+ children: S
28
+ })]
29
+ }), f[4] = m, f[5] = C);
30
+ let w;
31
+ f[6] !== v || f[7] !== p.id || f[8] !== b ? (w = /* @__PURE__ */ jsx("div", {
32
+ className: "flex-1 overflow-hidden",
33
+ children: b.length > 0 ? /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(PipelineFlowViewer_default, {
34
+ pipelineId: p.id,
35
+ workflows: b,
36
+ pipelineConfig: v.data
37
+ }) }) : /* @__PURE__ */ jsx("div", {
38
+ className: "text-muted-foreground flex h-full items-center justify-center text-sm",
39
+ children: "No workflows found"
40
+ })
41
+ }), f[6] = v, f[7] = p.id, f[8] = b, f[9] = w) : w = f[9];
42
+ let T;
43
+ return f[10] !== C || f[11] !== w ? (T = /* @__PURE__ */ jsxs("div", {
44
+ className: "border-l bg-background flex w-1/2 shrink-0 flex-col",
45
+ children: [C, w]
46
+ }), f[10] = C, f[11] = w, f[12] = T) : T = f[12], T;
47
+ }
48
+ export { WorkbenchFlowPanel };
@@ -0,0 +1,68 @@
1
+ import { cn } from "../../../lib/utils.js";
2
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../../../components/ui/tooltip.js";
3
+ import { useWorkbenchLayout } from "../providers/WorkbenchLayoutProvider.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { ListOrdered, MonitorPlay, Navigation, Workflow } from "lucide-react";
7
+ function IconButton(s) {
8
+ let l = c(11), { icon: u, label: d, active: f, onClick: p } = s, m = f ? "bg-foreground text-background" : "text-muted-foreground hover:bg-accent/50 hover:text-accent-foreground", h;
9
+ l[0] === m ? h = l[1] : (h = cn("flex h-10 w-10 items-center justify-center rounded-md transition-colors hover:cursor-pointer", m), l[0] = m, l[1] = h);
10
+ let g;
11
+ l[2] !== u || l[3] !== p || l[4] !== h ? (g = /* @__PURE__ */ jsx(TooltipTrigger, {
12
+ asChild: !0,
13
+ children: /* @__PURE__ */ jsx("button", {
14
+ onClick: p,
15
+ className: h,
16
+ children: u
17
+ })
18
+ }), l[2] = u, l[3] = p, l[4] = h, l[5] = g) : g = l[5];
19
+ let _;
20
+ l[6] === d ? _ = l[7] : (_ = /* @__PURE__ */ jsx(TooltipContent, {
21
+ side: "left",
22
+ children: d
23
+ }), l[6] = d, l[7] = _);
24
+ let v;
25
+ return l[8] !== g || l[9] !== _ ? (v = /* @__PURE__ */ jsxs(Tooltip, { children: [g, _] }), l[8] = g, l[9] = _, l[10] = v) : v = l[10], v;
26
+ }
27
+ function WorkbenchIconSidebar() {
28
+ let e = c(20), { previewPanelEnabled: i, isDeveloperMode: a, activeFloatingPanel: o, toggleFloatingPanel: h, activeSidePanel: g, toggleSidePanel: _ } = useWorkbenchLayout(), v;
29
+ e[0] !== g || e[1] !== i || e[2] !== _ ? (v = i && /* @__PURE__ */ jsx(IconButton, {
30
+ icon: /* @__PURE__ */ jsx(MonitorPlay, { className: "h-5 w-5" }),
31
+ label: "Preview",
32
+ active: g === "preview",
33
+ onClick: () => _("preview")
34
+ }), e[0] = g, e[1] = i, e[2] = _, e[3] = v) : v = e[3];
35
+ let y;
36
+ e[4] !== o || e[5] !== g || e[6] !== a || e[7] !== h || e[8] !== _ ? (y = a && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(IconButton, {
37
+ icon: /* @__PURE__ */ jsx(Workflow, { className: "h-5 w-5" }),
38
+ label: "Graph",
39
+ active: g === "flow",
40
+ onClick: () => _("flow")
41
+ }), /* @__PURE__ */ jsx(IconButton, {
42
+ icon: /* @__PURE__ */ jsx(ListOrdered, { className: "h-5 w-5" }),
43
+ label: "Run Log",
44
+ active: o === "history",
45
+ onClick: () => h("history")
46
+ })] }), e[4] = o, e[5] = g, e[6] = a, e[7] = h, e[8] = _, e[9] = y) : y = e[9];
47
+ let b;
48
+ e[10] === Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ jsx(Navigation, { className: "h-5 w-5" }), e[10] = b) : b = e[10];
49
+ let x = o === "navigation", S;
50
+ e[11] === h ? S = e[12] : (S = () => h("navigation"), e[11] = h, e[12] = S);
51
+ let C;
52
+ e[13] !== x || e[14] !== S ? (C = /* @__PURE__ */ jsx(IconButton, {
53
+ icon: b,
54
+ label: "Navigate",
55
+ active: x,
56
+ onClick: S
57
+ }), e[13] = x, e[14] = S, e[15] = C) : C = e[15];
58
+ let w;
59
+ return e[16] !== v || e[17] !== y || e[18] !== C ? (w = /* @__PURE__ */ jsxs("div", {
60
+ className: "border-l bg-background flex w-12 shrink-0 flex-col items-center gap-1 py-2",
61
+ children: [
62
+ v,
63
+ y,
64
+ C
65
+ ]
66
+ }), e[16] = v, e[17] = y, e[18] = C, e[19] = w) : w = e[19], w;
67
+ }
68
+ export { WorkbenchIconSidebar };
@@ -0,0 +1,128 @@
1
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../components/ui/select.js";
2
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../../../components/ui/tooltip.js";
3
+ import { useWorkbenchLayout } from "../providers/WorkbenchLayoutProvider.js";
4
+ import { useEffect, useMemo, useRef, useState } from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { ExternalLink, Loader2, X } from "lucide-react";
7
+ var EMBED_NEW_RUN_MESSAGE_TYPE = "loopstack:embed:new-run";
8
+ function WorkbenchPreviewPanel() {
9
+ let { getEnvironmentPreviewUrl: y, environments: b, closeSidePanel: x, selectedSlotId: S, setSelectedSlotId: C } = useWorkbenchLayout(), w = useRef(null), T = useMemo(() => (b ?? []).filter((e) => !!e.connectionUrl && (!!e.workerId || e.local)), [b]), [E, D] = useState(null);
10
+ useEffect(() => {
11
+ !S && T.length > 0 && C(T[0].slotId);
12
+ }, [
13
+ T,
14
+ S,
15
+ C
16
+ ]);
17
+ let O = useMemo(() => T.find((e) => e.slotId === S), [T, S]), k = useMemo(() => {
18
+ if (!(!y || !O)) return y(O, E ?? void 0);
19
+ }, [
20
+ y,
21
+ O,
22
+ E
23
+ ]);
24
+ return useEffect(() => {
25
+ let e = (e) => {
26
+ if (e.origin !== window.location.origin) return;
27
+ let _ = e.data;
28
+ if (_?.type !== EMBED_NEW_RUN_MESSAGE_TYPE) return;
29
+ let v = _?.pipelineId;
30
+ typeof v == "string" && D(v);
31
+ };
32
+ return window.addEventListener("message", e), () => window.removeEventListener("message", e);
33
+ }, []), b === void 0 ? /* @__PURE__ */ jsxs("div", {
34
+ className: "border-l bg-zinc-950 flex w-1/2 shrink-0 flex-col",
35
+ children: [/* @__PURE__ */ jsxs("div", {
36
+ className: "flex h-12 shrink-0 items-center justify-between px-3",
37
+ children: [/* @__PURE__ */ jsx("span", {
38
+ className: "text-sm font-medium text-white",
39
+ children: "Preview"
40
+ }), /* @__PURE__ */ jsx("button", {
41
+ onClick: x,
42
+ className: "text-zinc-400 hover:text-white flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:cursor-pointer",
43
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
44
+ })]
45
+ }), /* @__PURE__ */ jsx("div", {
46
+ className: "flex flex-1 items-center justify-center",
47
+ children: /* @__PURE__ */ jsx(Loader2, { className: "h-5 w-5 animate-spin text-zinc-400" })
48
+ })]
49
+ }) : !y || T.length === 0 ? /* @__PURE__ */ jsxs("div", {
50
+ className: "border-l bg-zinc-950 flex w-1/2 shrink-0 flex-col",
51
+ children: [/* @__PURE__ */ jsxs("div", {
52
+ className: "flex h-12 shrink-0 items-center justify-between px-3",
53
+ children: [/* @__PURE__ */ jsx("span", {
54
+ className: "text-sm font-medium text-white",
55
+ children: "Preview"
56
+ }), /* @__PURE__ */ jsx("button", {
57
+ onClick: x,
58
+ className: "text-zinc-400 hover:text-white flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:cursor-pointer",
59
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
60
+ })]
61
+ }), /* @__PURE__ */ jsx("div", {
62
+ className: "text-zinc-400 flex flex-1 items-center justify-center text-sm",
63
+ children: "Preview not available"
64
+ })]
65
+ }) : /* @__PURE__ */ jsxs("div", {
66
+ className: "border-l bg-zinc-950 flex w-1/2 shrink-0 flex-col",
67
+ children: [/* @__PURE__ */ jsxs("div", {
68
+ className: "flex h-12 shrink-0 items-center justify-between px-3",
69
+ children: [/* @__PURE__ */ jsxs("div", {
70
+ className: "flex items-center gap-2",
71
+ children: [
72
+ /* @__PURE__ */ jsx("span", {
73
+ className: "text-sm font-medium text-white",
74
+ children: "Preview"
75
+ }),
76
+ T.length > 1 && /* @__PURE__ */ jsxs(Select, {
77
+ value: S,
78
+ onValueChange: (e) => {
79
+ C(e), D(null);
80
+ },
81
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
82
+ className: "h-7 w-40 border-zinc-700 bg-zinc-900 text-zinc-200 text-xs",
83
+ children: /* @__PURE__ */ jsx(SelectValue, {})
84
+ }), /* @__PURE__ */ jsx(SelectContent, { children: T.map((e) => /* @__PURE__ */ jsx(SelectItem, {
85
+ value: e.slotId,
86
+ children: e.envName || e.slotId
87
+ }, e.slotId)) })]
88
+ }),
89
+ T.length === 1 && O && /* @__PURE__ */ jsx("span", {
90
+ className: "text-xs text-zinc-400",
91
+ children: O.envName || O.slotId
92
+ })
93
+ ]
94
+ }), /* @__PURE__ */ jsxs("div", {
95
+ className: "flex items-center gap-1",
96
+ children: [k && /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
97
+ asChild: !0,
98
+ children: /* @__PURE__ */ jsx("a", {
99
+ href: k,
100
+ target: "_blank",
101
+ rel: "noopener noreferrer",
102
+ className: "text-zinc-400 hover:text-white flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:cursor-pointer",
103
+ children: /* @__PURE__ */ jsx(ExternalLink, { className: "h-4 w-4" })
104
+ })
105
+ }), /* @__PURE__ */ jsx(TooltipContent, {
106
+ side: "bottom",
107
+ children: "Open in new tab"
108
+ })] }), /* @__PURE__ */ jsx("button", {
109
+ onClick: x,
110
+ className: "text-zinc-400 hover:text-white flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:cursor-pointer",
111
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
112
+ })]
113
+ })]
114
+ }), k ? /* @__PURE__ */ jsx("div", {
115
+ className: "flex-1 overflow-hidden p-3 pt-0",
116
+ children: /* @__PURE__ */ jsx("iframe", {
117
+ ref: w,
118
+ src: k,
119
+ className: "bg-background h-full w-full rounded-lg",
120
+ title: "Pipeline preview"
121
+ })
122
+ }) : /* @__PURE__ */ jsx("div", {
123
+ className: "text-zinc-400 flex flex-1 items-center justify-center text-sm",
124
+ children: "Preview not available"
125
+ })]
126
+ });
127
+ }
128
+ export { WorkbenchPreviewPanel };