@loopstack/loopstack-studio 0.23.0 → 0.24.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 (90) hide show
  1. package/dist/api/index.js +12 -10
  2. package/dist/api/secrets.js +16 -0
  3. package/dist/components/dynamic-form/ArrayController.js +68 -64
  4. package/dist/components/dynamic-form/Form.js +56 -27
  5. package/dist/components/dynamic-form/FormElement.js +1 -1
  6. package/dist/components/dynamic-form/FormElementHeader.js +2 -2
  7. package/dist/components/dynamic-form/InputController.js +3 -1
  8. package/dist/components/dynamic-form/ObjectController.js +24 -21
  9. package/dist/components/dynamic-form/fields/BaseFieldWrapper.js +1 -1
  10. package/dist/components/dynamic-form/fields/InputField.js +20 -19
  11. package/dist/components/dynamic-form/fields/MarkdownViewField.js +20 -0
  12. package/dist/components/dynamic-form/fields/RadioField.js +18 -18
  13. package/dist/components/dynamic-form/fields/SelectField.js +19 -19
  14. package/dist/components/dynamic-form/fields/TextareaField.js +17 -17
  15. package/dist/components/layout/MainLayout.js +18 -31
  16. package/dist/components/layout/StudioSidebar.js +168 -108
  17. package/dist/components/page/PageBreadcrumbs.js +79 -32
  18. package/dist/components/ui-widgets/UiWidget.js +36 -27
  19. package/dist/components/ui-widgets/widgets/SecretInput.js +42 -0
  20. package/dist/features/code-explorer/components/CodeExplorerTreeNode.js +80 -4
  21. package/dist/features/code-explorer/components/FileContentViewer.js +47 -30
  22. package/dist/features/code-explorer/components/FileTabsBar.js +3 -190
  23. package/dist/features/code-explorer/components/FileTabsBarBase.js +190 -0
  24. package/dist/features/code-explorer/index.js +2 -2
  25. package/dist/features/code-explorer/providers/CodeExplorerProvider.js +2 -162
  26. package/dist/features/code-explorer/utils/fileIcons.js +7 -4
  27. package/dist/features/debug/components/PipelineFlowViewer.js +46 -45
  28. package/dist/features/debug/components/pipeline-flow/WorkflowGraph.js +19 -19
  29. package/dist/features/documents/DocumentRenderer.js +20 -15
  30. package/dist/features/documents/components/DocumentList.js +5 -1
  31. package/dist/features/documents/renderers/AiMessage.js +11 -11
  32. package/dist/features/documents/renderers/ClaudeMessage.js +96 -0
  33. package/dist/features/documents/renderers/DocumentFormRenderer.js +17 -11
  34. package/dist/features/workbench/Workbench.js +64 -80
  35. package/dist/features/workbench/WorkflowItem.js +5 -5
  36. package/dist/features/workbench/components/RemoteFileTabsBar.js +18 -0
  37. package/dist/features/workbench/components/RemoteFileTree.js +90 -0
  38. package/dist/features/workbench/components/WorkbenchFilesPanel.js +67 -0
  39. package/dist/features/workbench/components/WorkbenchFloatingPanel.js +57 -49
  40. package/dist/features/workbench/components/WorkbenchFlowPanel.js +2 -2
  41. package/dist/features/workbench/components/WorkbenchIconSidebar.js +48 -28
  42. package/dist/features/workbench/components/WorkbenchSecretsPanel.js +182 -0
  43. package/dist/features/workbench/hooks/useWorkflowData.js +4 -4
  44. package/dist/features/workbench/providers/RemoteFileExplorerProvider.js +160 -0
  45. package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +46 -43
  46. package/dist/features/workspaces/components/PipelineForm.js +1 -1
  47. package/dist/features/workspaces/components/WorkspaceHomePage.js +93 -0
  48. package/dist/hooks/index.js +1 -1
  49. package/dist/hooks/query-keys.js +41 -34
  50. package/dist/hooks/useFiles.js +1 -43
  51. package/dist/hooks/useSecrets.js +69 -0
  52. package/dist/index.d.ts +49 -0
  53. package/dist/index.js +3 -2
  54. package/dist/node_modules/@xyflow/react/dist/esm/index.js +1 -1
  55. package/dist/pages/DashboardPage.js +87 -35
  56. package/dist/pages/EmbedWorkbenchPage.js +43 -39
  57. package/dist/pages/PipelineDebugPage.js +1 -1
  58. package/dist/pages/PreviewWorkbenchPage.js +167 -70
  59. package/dist/pages/WorkspacePage.js +102 -50
  60. package/dist/pages/WorkspaceRunsPage.js +71 -0
  61. package/dist/routing/LocalRouter.js +6 -0
  62. package/dist/types/ai.types.js +13 -0
  63. package/package.json +2 -3
  64. package/dist/node_modules/@ai-sdk/provider/dist/index.js +0 -65
  65. package/dist/node_modules/@ai-sdk/provider-utils/dist/index.js +0 -1008
  66. package/dist/node_modules/ai/dist/index.js +0 -1083
  67. package/dist/node_modules/zod/v3/ZodError.js +0 -79
  68. package/dist/node_modules/zod/v3/errors.js +0 -6
  69. package/dist/node_modules/zod/v3/helpers/errorUtil.js +0 -5
  70. package/dist/node_modules/zod/v3/helpers/parseUtil.js +0 -90
  71. package/dist/node_modules/zod/v3/helpers/util.js +0 -72
  72. package/dist/node_modules/zod/v3/locales/en.js +0 -58
  73. package/dist/node_modules/zod/v3/types.js +0 -2425
  74. package/dist/node_modules/zod/v4/classic/errors.js +0 -21
  75. package/dist/node_modules/zod/v4/classic/iso.js +0 -29
  76. package/dist/node_modules/zod/v4/classic/parse.js +0 -4
  77. package/dist/node_modules/zod/v4/classic/schemas.js +0 -392
  78. package/dist/node_modules/zod/v4/core/api.js +0 -532
  79. package/dist/node_modules/zod/v4/core/checks.js +0 -283
  80. package/dist/node_modules/zod/v4/core/core.js +0 -44
  81. package/dist/node_modules/zod/v4/core/doc.js +0 -21
  82. package/dist/node_modules/zod/v4/core/errors.js +0 -40
  83. package/dist/node_modules/zod/v4/core/json-schema-processors.js +0 -305
  84. package/dist/node_modules/zod/v4/core/parse.js +0 -66
  85. package/dist/node_modules/zod/v4/core/regexes.js +0 -28
  86. package/dist/node_modules/zod/v4/core/registries.js +0 -38
  87. package/dist/node_modules/zod/v4/core/schemas.js +0 -863
  88. package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -220
  89. package/dist/node_modules/zod/v4/core/util.js +0 -267
  90. package/dist/node_modules/zod/v4/core/versions.js +0 -6
@@ -1,58 +1,110 @@
1
1
  import { useStudio } from "../providers/StudioProvider.js";
2
- import { Alert } from "../components/ui/alert.js";
2
+ import { Button } from "../components/ui/button.js";
3
+ import { Alert, AlertDescription, AlertTitle } from "../components/ui/alert.js";
3
4
  import MainLayout_default from "../components/layout/MainLayout.js";
4
5
  import LoadingCentered_default from "../components/feedback/LoadingCentered.js";
5
6
  import Dashboard from "../features/dashboard/Dashboard.js";
6
7
  import { useDashboardStats } from "../hooks/useDashboard.js";
7
8
  import { c } from "react/compiler-runtime";
8
9
  import { jsx, jsxs } from "react/jsx-runtime";
9
- import { Home } from "lucide-react";
10
+ import { Home, TriangleAlert } from "lucide-react";
10
11
  function DashboardPage() {
11
- let d = c(17), { environment: f } = useStudio(), { data: p, isLoading: m, error: h } = useDashboardStats();
12
- if (m) {
12
+ let h = c(38), { environment: g } = useStudio(), { data: _, isLoading: v, error: y, refetch: b, isRefetching: x } = useDashboardStats();
13
+ if (v) {
13
14
  let e;
14
- return d[0] === m ? e = d[1] : (e = /* @__PURE__ */ jsx(LoadingCentered_default, { loading: m }), d[0] = m, d[1] = e), e;
15
+ return h[0] === v ? e = h[1] : (e = /* @__PURE__ */ jsx(LoadingCentered_default, { loading: v }), h[0] = v, h[1] = e), e;
15
16
  }
16
- if (h) {
17
+ if (y) {
17
18
  let e;
18
- return d[2] === h.message ? e = d[3] : (e = /* @__PURE__ */ jsxs(Alert, {
19
- className: "w-full p-4 text-red-500",
20
- children: ["Error loading dashboard: ", h.message]
21
- }), d[2] = h.message, d[3] = e), e;
19
+ h[2] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx(Home, { className: "h-4 w-4" }), h[2] = e) : e = h[2];
20
+ let d;
21
+ h[3] === g.name ? d = h[4] : (d = {
22
+ label: g.name,
23
+ href: "#",
24
+ icon: e
25
+ }, h[3] = g.name, h[4] = d);
26
+ let f;
27
+ h[5] === Symbol.for("react.memo_cache_sentinel") ? (f = {
28
+ label: "Dashboard",
29
+ current: !0
30
+ }, h[5] = f) : f = h[5];
31
+ let p;
32
+ h[6] === d ? p = h[7] : (p = [d, f], h[6] = d, h[7] = p);
33
+ let m = p, _;
34
+ h[8] === Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ jsx("h1", {
35
+ className: "mb-4 text-3xl font-bold tracking-tight",
36
+ children: "Dashboard"
37
+ }), h[8] = _) : _ = h[8];
38
+ let v, S;
39
+ h[9] === Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ jsx(TriangleAlert, {}), S = /* @__PURE__ */ jsx(AlertTitle, { children: "Dashboard konnte nicht geladen werden" }), h[9] = v, h[10] = S) : (v = h[9], S = h[10]);
40
+ let C;
41
+ h[11] === y.message ? C = h[12] : (C = /* @__PURE__ */ jsxs("p", {
42
+ className: "wrap-break-word",
43
+ children: ["Bitte versuch’s nochmal. ", y.message]
44
+ }), h[11] = y.message, h[12] = C);
45
+ let w;
46
+ h[13] === b ? w = h[14] : (w = () => void b(), h[13] = b, h[14] = w);
47
+ let T = x ? "Lade neu…" : "Neu versuchen", E;
48
+ h[15] !== x || h[16] !== w || h[17] !== T ? (E = /* @__PURE__ */ jsx("div", {
49
+ className: "mt-3 flex flex-wrap gap-2",
50
+ children: /* @__PURE__ */ jsx(Button, {
51
+ variant: "destructive",
52
+ onClick: w,
53
+ disabled: x,
54
+ children: T
55
+ })
56
+ }), h[15] = x, h[16] = w, h[17] = T, h[18] = E) : E = h[18];
57
+ let D;
58
+ h[19] !== E || h[20] !== C ? (D = /* @__PURE__ */ jsx("div", {
59
+ className: "mx-auto w-full max-w-2xl",
60
+ children: /* @__PURE__ */ jsxs(Alert, {
61
+ variant: "destructive",
62
+ children: [
63
+ v,
64
+ S,
65
+ /* @__PURE__ */ jsxs(AlertDescription, { children: [C, E] })
66
+ ]
67
+ })
68
+ }), h[19] = E, h[20] = C, h[21] = D) : D = h[21];
69
+ let O;
70
+ return h[22] !== m || h[23] !== D ? (O = /* @__PURE__ */ jsxs(MainLayout_default, {
71
+ breadcrumbsData: m,
72
+ children: [_, D]
73
+ }), h[22] = m, h[23] = D, h[24] = O) : O = h[24], O;
22
74
  }
23
- if (!p) {
75
+ if (!_) {
24
76
  let e;
25
- return d[4] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("div", {
77
+ return h[25] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("div", {
26
78
  className: "p-4",
27
79
  children: "No data available"
28
- }), d[4] = e) : e = d[4], e;
80
+ }), h[25] = e) : e = h[25], e;
29
81
  }
30
- let g;
31
- d[5] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ jsx(Home, { className: "h-4 w-4" }), d[5] = g) : g = d[5];
32
- let _;
33
- d[6] === f.name ? _ = d[7] : (_ = {
34
- label: f.name,
82
+ let S;
83
+ h[26] === Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ jsx(Home, { className: "h-4 w-4" }), h[26] = S) : S = h[26];
84
+ let C;
85
+ h[27] === g.name ? C = h[28] : (C = {
86
+ label: g.name,
35
87
  href: "#",
36
- icon: g
37
- }, d[6] = f.name, d[7] = _);
38
- let v;
39
- d[8] === Symbol.for("react.memo_cache_sentinel") ? (v = {
88
+ icon: S
89
+ }, h[27] = g.name, h[28] = C);
90
+ let w;
91
+ h[29] === Symbol.for("react.memo_cache_sentinel") ? (w = {
40
92
  label: "Dashboard",
41
93
  current: !0
42
- }, d[8] = v) : v = d[8];
43
- let y;
44
- d[9] === _ ? y = d[10] : (y = [_, v], d[9] = _, d[10] = y);
45
- let b = y, x;
46
- d[11] === Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ jsx("h1", {
94
+ }, h[29] = w) : w = h[29];
95
+ let T;
96
+ h[30] === C ? T = h[31] : (T = [C, w], h[30] = C, h[31] = T);
97
+ let E = T, D;
98
+ h[32] === Symbol.for("react.memo_cache_sentinel") ? (D = /* @__PURE__ */ jsx("h1", {
47
99
  className: "mb-4 text-3xl font-bold tracking-tight",
48
100
  children: "Dashboard"
49
- }), d[11] = x) : x = d[11];
50
- let S;
51
- d[12] === p ? S = d[13] : (S = /* @__PURE__ */ jsx(Dashboard, { dashboardStats: p }), d[12] = p, d[13] = S);
52
- let C;
53
- return d[14] !== b || d[15] !== S ? (C = /* @__PURE__ */ jsxs(MainLayout_default, {
54
- breadcrumbsData: b,
55
- children: [x, S]
56
- }), d[14] = b, d[15] = S, d[16] = C) : C = d[16], C;
101
+ }), h[32] = D) : D = h[32];
102
+ let O;
103
+ h[33] === _ ? O = h[34] : (O = /* @__PURE__ */ jsx(Dashboard, { dashboardStats: _ }), h[33] = _, h[34] = O);
104
+ let k;
105
+ return h[35] !== E || h[36] !== O ? (k = /* @__PURE__ */ jsxs(MainLayout_default, {
106
+ breadcrumbsData: E,
107
+ children: [D, O]
108
+ }), h[35] = E, h[36] = O, h[37] = k) : k = h[37], k;
57
109
  }
58
110
  export { DashboardPage as default };
@@ -4,6 +4,7 @@ import ErrorSnackbar_default from "../components/feedback/ErrorSnackbar.js";
4
4
  import { require_enums } from "../packages/contracts/dist/enums/index.js";
5
5
  import { useFetchWorkflowsByPipeline } from "../hooks/useWorkflows.js";
6
6
  import WorkflowItem_default from "../features/workbench/WorkflowItem.js";
7
+ import { WorkbenchLayoutProvider } from "../features/workbench/providers/WorkbenchLayoutProvider.js";
7
8
  import "../features/workbench/index.js";
8
9
  import { requireParam } from "../lib/requireParam.js";
9
10
  import { c } from "react/compiler-runtime";
@@ -12,61 +13,64 @@ import { jsx, jsxs } from "react/jsx-runtime";
12
13
  import { useParams } from "react-router-dom";
13
14
  var import_enums = require_enums(), EMBED_MESSAGE_TYPE = "loopstack:embed:workflow-completed", EMBED_RESIZE_MESSAGE_TYPE = "loopstack:embed:resize";
14
15
  function EmbedWorkbenchPage() {
15
- let _ = c(24), v = useParams(), y;
16
- _[0] === v ? y = _[1] : (y = requireParam(v, "pipelineId"), _[0] = v, _[1] = y);
17
- let b = y, x = useRef(null), S = usePipeline(b), C = useFetchWorkflowsByPipeline(b), w = useRef(!1), T, E;
18
- _[2] !== C.data || _[3] !== b ? (T = () => {
19
- !C.data || w.current || C.data.length > 0 && C.data.every(_temp) && window.parent !== window && (w.current = !0, window.parent.postMessage({
16
+ let v = c(24), y = useParams(), b;
17
+ v[0] === y ? b = v[1] : (b = requireParam(y, "pipelineId"), v[0] = y, v[1] = b);
18
+ let x = b, S = useRef(null), C = usePipeline(x), w = useFetchWorkflowsByPipeline(x), T = useRef(!1), E, D;
19
+ v[2] !== w.data || v[3] !== x ? (E = () => {
20
+ !w.data || T.current || w.data.length > 0 && w.data.every(_temp) && window.parent !== window && (T.current = !0, window.parent.postMessage({
20
21
  type: EMBED_MESSAGE_TYPE,
21
- pipelineId: b
22
+ pipelineId: x
22
23
  }, window.location.origin));
23
- }, E = [C.data, b], _[2] = C.data, _[3] = b, _[4] = T, _[5] = E) : (T = _[4], E = _[5]), useEffect(T, E);
24
- let D, O;
25
- _[6] === b ? (D = _[7], O = _[8]) : (D = () => {
26
- if (window.parent === window || !x.current) return;
24
+ }, D = [w.data, x], v[2] = w.data, v[3] = x, v[4] = E, v[5] = D) : (E = v[4], D = v[5]), useEffect(E, D);
25
+ let O, k;
26
+ v[6] === x ? (O = v[7], k = v[8]) : (O = () => {
27
+ if (window.parent === window || !S.current) return;
27
28
  let t = new ResizeObserver(() => {
28
- if (!x.current) return;
29
+ if (!S.current) return;
29
30
  let t = Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);
30
31
  window.parent.postMessage({
31
32
  type: EMBED_RESIZE_MESSAGE_TYPE,
32
- pipelineId: b,
33
+ pipelineId: x,
33
34
  height: t
34
35
  }, window.location.origin);
35
36
  });
36
- return t.observe(x.current), () => t.disconnect();
37
- }, O = [b], _[6] = b, _[7] = D, _[8] = O), useEffect(D, O);
38
- let k = _temp2, A;
39
- _[9] === Symbol.for("react.memo_cache_sentinel") ? (A = {
37
+ return t.observe(S.current), () => t.disconnect();
38
+ }, k = [x], v[6] = x, v[7] = O, v[8] = k), useEffect(O, k);
39
+ let A = _temp2, j;
40
+ v[9] === Symbol.for("react.memo_cache_sentinel") ? (j = {
40
41
  enableDebugMode: !1,
41
42
  showFullMessageHistory: !1
42
- }, _[9] = A) : A = _[9];
43
- let j = A, M;
44
- _[10] === S.error ? M = _[11] : (M = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: S.error }), _[10] = S.error, _[11] = M);
45
- let N;
46
- _[12] === C.error ? N = _[13] : (N = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: C.error }), _[12] = C.error, _[13] = N);
47
- let P = S.isLoading || C.isLoading, F;
48
- _[14] !== S.data || _[15] !== C.data ? (F = S.data && C.data ? C.data.map((t) => /* @__PURE__ */ jsx(WorkflowItem_default, {
49
- pipeline: S.data,
50
- workflowId: t.id,
51
- scrollTo: k,
52
- settings: j,
53
- embed: !0
54
- }, t.id)) : null, _[14] = S.data, _[15] = C.data, _[16] = F) : F = _[16];
55
- let I;
56
- _[17] !== P || _[18] !== F ? (I = /* @__PURE__ */ jsx(LoadingCentered_default, {
57
- loading: P,
58
- children: F
59
- }), _[17] = P, _[18] = F, _[19] = I) : I = _[19];
43
+ }, v[9] = j) : j = v[9];
44
+ let M = j, N;
45
+ v[10] === C.error ? N = v[11] : (N = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: C.error }), v[10] = C.error, v[11] = N);
46
+ let P;
47
+ v[12] === w.error ? P = v[13] : (P = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: w.error }), v[12] = w.error, v[13] = P);
48
+ let F = C.isLoading || w.isLoading, I;
49
+ v[14] !== C.data || v[15] !== w.data ? (I = C.data && w.data ? /* @__PURE__ */ jsx(WorkbenchLayoutProvider, {
50
+ pipeline: C.data,
51
+ children: w.data.map((t) => /* @__PURE__ */ jsx(WorkflowItem_default, {
52
+ pipeline: C.data,
53
+ workflowId: t.id,
54
+ scrollTo: A,
55
+ settings: M,
56
+ embed: !0
57
+ }, t.id))
58
+ }) : null, v[14] = C.data, v[15] = w.data, v[16] = I) : I = v[16];
60
59
  let L;
61
- return _[20] !== I || _[21] !== M || _[22] !== N ? (L = /* @__PURE__ */ jsxs("div", {
62
- ref: x,
60
+ v[17] !== F || v[18] !== I ? (L = /* @__PURE__ */ jsx(LoadingCentered_default, {
61
+ loading: F,
62
+ children: I
63
+ }), v[17] = F, v[18] = I, v[19] = L) : L = v[19];
64
+ let R;
65
+ return v[20] !== L || v[21] !== N || v[22] !== P ? (R = /* @__PURE__ */ jsxs("div", {
66
+ ref: S,
63
67
  className: "overflow-hidden px-6 py-4",
64
68
  children: [
65
- M,
66
69
  N,
67
- I
70
+ P,
71
+ L
68
72
  ]
69
- }), _[20] = I, _[21] = M, _[22] = N, _[23] = L) : L = _[23], L;
73
+ }), v[20] = L, v[21] = N, v[22] = P, v[23] = R) : R = v[23], R;
70
74
  }
71
75
  function _temp2() {}
72
76
  function _temp(t) {
@@ -3,8 +3,8 @@ import { usePipeline, usePipelineConfigByName } from "../hooks/usePipelines.js";
3
3
  import { useWorkspace } from "../hooks/useWorkspaces.js";
4
4
  import MainLayout_default from "../components/layout/MainLayout.js";
5
5
  import ErrorSnackbar_default from "../components/feedback/ErrorSnackbar.js";
6
- import { ReactFlowProvider } from "../node_modules/@xyflow/react/dist/esm/index.js";
7
6
  import { useFetchWorkflowsByPipeline } from "../hooks/useWorkflows.js";
7
+ import { ReactFlowProvider } from "../node_modules/@xyflow/react/dist/esm/index.js";
8
8
  import PipelineFlowViewer_default from "../features/debug/components/PipelineFlowViewer.js";
9
9
  import PipelineDebugHeader_default from "../features/debug/components/PipelineDebugHeader.js";
10
10
  import "../features/debug/index.js";
@@ -7,12 +7,12 @@ import { SidebarMenu, SidebarProvider } from "../components/ui/sidebar.js";
7
7
  import LoadingCentered_default from "../components/feedback/LoadingCentered.js";
8
8
  import ErrorSnackbar_default from "../components/feedback/ErrorSnackbar.js";
9
9
  import { require_enums } from "../packages/contracts/dist/enums/index.js";
10
- import { ReactFlowProvider } from "../node_modules/@xyflow/react/dist/esm/index.js";
11
10
  import { useFetchWorkflowsByPipeline } from "../hooks/useWorkflows.js";
12
- import PipelineFlowViewer_default from "../features/debug/components/PipelineFlowViewer.js";
13
- import "../features/debug/index.js";
14
11
  import WorkflowItem_default from "../features/workbench/WorkflowItem.js";
15
12
  import WorkflowButtons_default from "../features/workbench/components/buttons/WorkflowButtons.js";
13
+ import { ReactFlowProvider } from "../node_modules/@xyflow/react/dist/esm/index.js";
14
+ import PipelineFlowViewer_default from "../features/debug/components/PipelineFlowViewer.js";
15
+ import "../features/debug/index.js";
16
16
  import { useNamespaceTree } from "../hooks/useNamespaceTree.js";
17
17
  import WorkbenchNavigation_default from "../features/workbench/WorkbenchNavigation.js";
18
18
  import PipelineHistoryList_default from "../features/workbench/components/PipelineHistoryList.js";
@@ -21,8 +21,9 @@ import "../features/workbench/index.js";
21
21
  import { c } from "react/compiler-runtime";
22
22
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
23
23
  import { jsx, jsxs } from "react/jsx-runtime";
24
+ import { useQuery } from "@tanstack/react-query";
24
25
  import { useNavigate, useParams } from "react-router-dom";
25
- import { ChevronDown, ChevronRight, ListOrdered, Loader2, Navigation, Play, ScrollText, Workflow } from "lucide-react";
26
+ import { ChevronDown, ChevronRight, ListOrdered, Loader2, Navigation, Play, RefreshCw, ScrollText, Workflow } from "lucide-react";
26
27
  import { formatDistanceToNow } from "date-fns";
27
28
  var import_enums = require_enums(), EMBED_MESSAGE_TYPE = "loopstack:embed:workflow-completed", EMBED_RESIZE_MESSAGE_TYPE = "loopstack:embed:resize", EMBED_NEW_RUN_MESSAGE_TYPE = "loopstack:embed:new-run";
28
29
  function PreviewWorkbenchPage() {
@@ -49,17 +50,17 @@ function PreviewWorkbenchPage() {
49
50
  }), e[3] = t, e[4] = o), o;
50
51
  }
51
52
  function PreviewWorkbenchContent(e) {
52
- let t = c(57), { pipelineId: o, onNewRunSuccess: s } = e, l = useRef(null), [u, d] = useState("output"), [m, y] = useState(!1), b = usePipeline(o), x = useFetchWorkflowsByPipeline(o), C;
53
+ let t = c(61), { pipelineId: o, onNewRunSuccess: s } = e, l = useRef(null), [u, d] = useState("output"), [m, _] = useState(!1), b = usePipeline(o), x = useFetchWorkflowsByPipeline(o), C;
53
54
  t[0] === x.data ? C = t[1] : (C = x.data ?? [], t[0] = x.data, t[1] = C);
54
- let T = C, E = useRef(!1), D = b.data?.workspaceId, ge = useWorkspace(D).data?.blockName, _e = b.data?.blockName, O = usePipelineConfigByName(ge, _e), k, A;
55
- t[2] !== x.data || t[3] !== o ? (k = () => {
55
+ let T = C, E = useRef(!1), _e = b.data?.workspaceId, ve = useWorkspace(_e).data?.blockName, ye = b.data?.blockName, D = usePipelineConfigByName(ve, ye), O, k;
56
+ t[2] !== x.data || t[3] !== o ? (O = () => {
56
57
  !x.data || E.current || x.data.length > 0 && x.data.every(_temp) && window.parent !== window && (E.current = !0, window.parent.postMessage({
57
58
  type: EMBED_MESSAGE_TYPE,
58
59
  pipelineId: o
59
60
  }, window.location.origin));
60
- }, A = [x.data, o], t[2] = x.data, t[3] = o, t[4] = k, t[5] = A) : (k = t[4], A = t[5]), useEffect(k, A);
61
- let j, M;
62
- t[6] === o ? (j = t[7], M = t[8]) : (j = () => {
61
+ }, k = [x.data, o], t[2] = x.data, t[3] = o, t[4] = O, t[5] = k) : (O = t[4], k = t[5]), useEffect(O, k);
62
+ let A, j;
63
+ t[6] === o ? (A = t[7], j = t[8]) : (A = () => {
63
64
  if (window.parent === window || !l.current) return;
64
65
  let e = new ResizeObserver(() => {
65
66
  if (!l.current) return;
@@ -71,66 +72,73 @@ function PreviewWorkbenchContent(e) {
71
72
  }, window.location.origin);
72
73
  });
73
74
  return e.observe(l.current), () => e.disconnect();
74
- }, M = [o], t[6] = o, t[7] = j, t[8] = M), useEffect(j, M);
75
- let N;
76
- t[9] === s ? N = t[10] : (N = (e) => {
77
- y(!1), s(e);
78
- }, t[9] = s, t[10] = N);
79
- let P = N, F = _temp2, I;
80
- t[11] === Symbol.for("react.memo_cache_sentinel") ? (I = {
75
+ }, j = [o], t[6] = o, t[7] = A, t[8] = j), useEffect(A, j);
76
+ let M;
77
+ t[9] === s ? M = t[10] : (M = (e) => {
78
+ _(!1), s(e);
79
+ }, t[9] = s, t[10] = M);
80
+ let N = M, P = _temp2, F;
81
+ t[11] === Symbol.for("react.memo_cache_sentinel") ? (F = {
81
82
  enableDebugMode: !1,
82
83
  showFullMessageHistory: !1
83
- }, t[11] = I) : I = t[11];
84
- let L = I, R;
85
- t[12] === Symbol.for("react.memo_cache_sentinel") ? (R = {
84
+ }, t[11] = F) : F = t[11];
85
+ let I = F, L;
86
+ t[12] === Symbol.for("react.memo_cache_sentinel") ? (L = {
86
87
  value: "output",
87
88
  label: "Output",
88
89
  icon: /* @__PURE__ */ jsx(ScrollText, { className: "h-3.5 w-3.5" })
89
- }, t[12] = R) : R = t[12];
90
- let z;
91
- t[13] === Symbol.for("react.memo_cache_sentinel") ? (z = {
90
+ }, t[12] = L) : L = t[12];
91
+ let R;
92
+ t[13] === Symbol.for("react.memo_cache_sentinel") ? (R = {
92
93
  value: "graph",
93
94
  label: "Graph",
94
95
  icon: /* @__PURE__ */ jsx(Workflow, { className: "h-3.5 w-3.5" })
95
- }, t[13] = z) : z = t[13];
96
+ }, t[13] = R) : R = t[13];
97
+ let z;
98
+ t[14] === Symbol.for("react.memo_cache_sentinel") ? (z = {
99
+ value: "run-log",
100
+ label: "Run Log",
101
+ icon: /* @__PURE__ */ jsx(ListOrdered, { className: "h-3.5 w-3.5" })
102
+ }, t[14] = z) : z = t[14];
96
103
  let B;
97
- t[14] === Symbol.for("react.memo_cache_sentinel") ? (B = [
104
+ t[15] === Symbol.for("react.memo_cache_sentinel") ? (B = [
105
+ L,
98
106
  R,
99
107
  z,
100
108
  {
101
- value: "run-log",
102
- label: "Run Log",
103
- icon: /* @__PURE__ */ jsx(ListOrdered, { className: "h-3.5 w-3.5" })
109
+ value: "logs",
110
+ label: "Logs",
111
+ icon: /* @__PURE__ */ jsx(ScrollText, { className: "h-3.5 w-3.5" })
104
112
  }
105
- ], t[14] = B) : B = t[14];
106
- let V = B, H;
107
- t[15] === u ? H = t[16] : (H = /* @__PURE__ */ jsx("div", {
113
+ ], t[15] = B) : B = t[15];
114
+ let be = B, V;
115
+ t[16] === u ? V = t[17] : (V = /* @__PURE__ */ jsx("div", {
108
116
  className: "bg-background flex items-center rounded-md border p-0.5",
109
- children: V.map((e) => /* @__PURE__ */ jsxs("button", {
117
+ children: be.map((e) => /* @__PURE__ */ jsxs("button", {
110
118
  onClick: () => d(e.value),
111
119
  className: `flex items-center gap-1.5 rounded-sm px-2.5 py-1 text-xs font-medium transition-colors ${u === e.value ? "bg-foreground text-background shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
112
120
  children: [e.icon, e.label]
113
121
  }, e.value))
114
- }), t[15] = u, t[16] = H);
115
- let U;
116
- t[17] === Symbol.for("react.memo_cache_sentinel") ? (U = /* @__PURE__ */ jsxs(Button, {
122
+ }), t[16] = u, t[17] = V);
123
+ let H;
124
+ t[18] === Symbol.for("react.memo_cache_sentinel") ? (H = /* @__PURE__ */ jsxs(Button, {
117
125
  variant: "outline",
118
126
  size: "sm",
119
127
  className: "h-7 gap-1.5",
120
- onClick: () => y(!0),
128
+ onClick: () => _(!0),
121
129
  children: [/* @__PURE__ */ jsx(Play, { className: "h-3 w-3" }), "New Run"]
122
- }), t[17] = U) : U = t[17];
123
- let W;
124
- t[18] === H ? W = t[19] : (W = /* @__PURE__ */ jsxs("div", {
130
+ }), t[18] = H) : H = t[18];
131
+ let U;
132
+ t[19] === V ? U = t[20] : (U = /* @__PURE__ */ jsxs("div", {
125
133
  className: "bg-muted/50 flex h-11 shrink-0 items-center justify-between border-b px-3",
126
- children: [H, U]
127
- }), t[18] = H, t[19] = W);
134
+ children: [V, H]
135
+ }), t[19] = V, t[20] = U);
136
+ let W;
137
+ t[21] === b.error ? W = t[22] : (W = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: b.error }), t[21] = b.error, t[22] = W);
128
138
  let G;
129
- t[20] === b.error ? G = t[21] : (G = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: b.error }), t[20] = b.error, t[21] = G);
139
+ t[23] === x.error ? G = t[24] : (G = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: x.error }), t[23] = x.error, t[24] = G);
130
140
  let K;
131
- t[22] === x.error ? K = t[23] : (K = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: x.error }), t[22] = x.error, t[23] = K);
132
- let q;
133
- t[24] !== u || t[25] !== b.data || t[26] !== b.isLoading || t[27] !== x.data || t[28] !== x.isLoading ? (q = u === "output" && /* @__PURE__ */ jsx("div", {
141
+ t[25] !== u || t[26] !== b.data || t[27] !== b.isLoading || t[28] !== x.data || t[29] !== x.isLoading ? (K = u === "output" && /* @__PURE__ */ jsx("div", {
134
142
  className: "px-4 py-3",
135
143
  children: /* @__PURE__ */ jsx(LoadingCentered_default, {
136
144
  loading: b.isLoading || x.isLoading,
@@ -141,21 +149,22 @@ function PreviewWorkbenchContent(e) {
141
149
  children: /* @__PURE__ */ jsx(WorkflowItem_default, {
142
150
  pipeline: b.data,
143
151
  workflowId: e.id,
144
- scrollTo: F,
145
- settings: L
152
+ scrollTo: P,
153
+ settings: I
146
154
  })
147
155
  }, e.id)) : null
148
156
  })
149
- }), t[24] = u, t[25] = b.data, t[26] = b.isLoading, t[27] = x.data, t[28] = x.isLoading, t[29] = q) : q = t[29];
150
- let J;
151
- t[30] !== u || t[31] !== b.isLoading || t[32] !== O || t[33] !== x.isLoading || t[34] !== o || t[35] !== T ? (J = u === "graph" && /* @__PURE__ */ jsx("div", {
157
+ }), t[25] = u, t[26] = b.data, t[27] = b.isLoading, t[28] = x.data, t[29] = x.isLoading, t[30] = K) : K = t[30];
158
+ let q;
159
+ t[31] !== u || t[32] !== b.isLoading || t[33] !== D || t[34] !== x.isLoading || t[35] !== o || t[36] !== T ? (q = u === "graph" && /* @__PURE__ */ jsx("div", {
152
160
  className: "h-full",
153
161
  children: /* @__PURE__ */ jsx(LoadingCentered_default, {
154
162
  loading: b.isLoading || x.isLoading,
155
163
  children: T.length > 0 ? /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(PipelineFlowViewer_default, {
156
164
  pipelineId: o,
157
165
  workflows: T,
158
- pipelineConfig: O.data
166
+ pipelineConfig: D.data,
167
+ direction: "TB"
159
168
  }) }) : /* @__PURE__ */ jsx("div", {
160
169
  className: "text-muted-foreground flex h-full items-center justify-center",
161
170
  children: /* @__PURE__ */ jsx("p", {
@@ -164,21 +173,24 @@ function PreviewWorkbenchContent(e) {
164
173
  })
165
174
  })
166
175
  })
167
- }), t[30] = u, t[31] = b.isLoading, t[32] = O, t[33] = x.isLoading, t[34] = o, t[35] = T, t[36] = J) : J = t[36];
168
- let Y;
169
- t[37] !== u || t[38] !== b.data ? (Y = u === "run-log" && /* @__PURE__ */ jsx("div", {
176
+ }), t[31] = u, t[32] = b.isLoading, t[33] = D, t[34] = x.isLoading, t[35] = o, t[36] = T, t[37] = q) : q = t[37];
177
+ let J;
178
+ t[38] !== u || t[39] !== b.data ? (J = u === "run-log" && /* @__PURE__ */ jsx("div", {
170
179
  className: "px-4",
171
180
  children: /* @__PURE__ */ jsx(PipelineHistoryList_default, { pipeline: b.data })
172
- }), t[37] = u, t[38] = b.data, t[39] = Y) : Y = t[39];
173
- let X;
174
- t[40] !== u || t[41] !== o ? (X = u === "navigate" && /* @__PURE__ */ jsx("div", {
181
+ }), t[38] = u, t[39] = b.data, t[40] = J) : J = t[40];
182
+ let Y;
183
+ t[41] !== u || t[42] !== o ? (Y = u === "navigate" && /* @__PURE__ */ jsx("div", {
175
184
  className: "px-4 py-2",
176
185
  children: /* @__PURE__ */ jsx(EmbedNavigationContent, { pipelineId: o })
177
- }), t[40] = u, t[41] = o, t[42] = X) : X = t[42];
186
+ }), t[41] = u, t[42] = o, t[43] = Y) : Y = t[43];
187
+ let X;
188
+ t[44] === u ? X = t[45] : (X = u === "logs" && /* @__PURE__ */ jsx(EmbedLogsContent, {}), t[44] = u, t[45] = X);
178
189
  let Z;
179
- t[43] !== G || t[44] !== K || t[45] !== q || t[46] !== J || t[47] !== Y || t[48] !== X ? (Z = /* @__PURE__ */ jsxs("div", {
190
+ t[46] !== W || t[47] !== G || t[48] !== K || t[49] !== q || t[50] !== J || t[51] !== Y || t[52] !== X ? (Z = /* @__PURE__ */ jsxs("div", {
180
191
  className: "flex-1 overflow-auto",
181
192
  children: [
193
+ W,
182
194
  G,
183
195
  K,
184
196
  q,
@@ -186,23 +198,23 @@ function PreviewWorkbenchContent(e) {
186
198
  Y,
187
199
  X
188
200
  ]
189
- }), t[43] = G, t[44] = K, t[45] = q, t[46] = J, t[47] = Y, t[48] = X, t[49] = Z) : Z = t[49];
201
+ }), t[46] = W, t[47] = G, t[48] = K, t[49] = q, t[50] = J, t[51] = Y, t[52] = X, t[53] = Z) : Z = t[53];
190
202
  let Q;
191
- t[50] !== P || t[51] !== m ? (Q = /* @__PURE__ */ jsx(NewRunDialog, {
203
+ t[54] !== N || t[55] !== m ? (Q = /* @__PURE__ */ jsx(NewRunDialog, {
192
204
  open: m,
193
- onOpenChange: y,
194
- onSuccess: P
195
- }), t[50] = P, t[51] = m, t[52] = Q) : Q = t[52];
205
+ onOpenChange: _,
206
+ onSuccess: N
207
+ }), t[54] = N, t[55] = m, t[56] = Q) : Q = t[56];
196
208
  let $;
197
- return t[53] !== W || t[54] !== Z || t[55] !== Q ? ($ = /* @__PURE__ */ jsxs("div", {
209
+ return t[57] !== U || t[58] !== Z || t[59] !== Q ? ($ = /* @__PURE__ */ jsxs("div", {
198
210
  ref: l,
199
211
  className: "flex h-screen flex-col overflow-hidden",
200
212
  children: [
201
- W,
213
+ U,
202
214
  Z,
203
215
  Q
204
216
  ]
205
- }), t[53] = W, t[54] = Z, t[55] = Q, t[56] = $) : $ = t[56], $;
217
+ }), t[57] = U, t[58] = Z, t[59] = Q, t[60] = $) : $ = t[60], $;
206
218
  }
207
219
  function _temp2() {}
208
220
  function _temp(e) {
@@ -381,12 +393,97 @@ function EmbedWorkflowSection(e) {
381
393
  className: "py-1",
382
394
  children: a
383
395
  }) }), t[24] = a, t[25] = g);
384
- let _;
385
- return t[26] !== h || t[27] !== g ? (_ = /* @__PURE__ */ jsxs(Collapsible, {
396
+ let v;
397
+ return t[26] !== h || t[27] !== g ? (v = /* @__PURE__ */ jsxs(Collapsible, {
386
398
  defaultOpen: !0,
387
399
  className: "group/collapsible",
388
400
  children: [h, g]
389
- }), t[26] = h, t[27] = g, t[28] = _) : _ = t[28], _;
401
+ }), t[26] = h, t[27] = g, t[28] = v) : v = t[28], v;
402
+ }
403
+ function stripAnsi(e) {
404
+ return e.replace(/\x1b\[[0-9;]*m/g, "");
405
+ }
406
+ function LogLine(e) {
407
+ let t = c(14), { line: n, index: r } = e, i, a, o;
408
+ if (t[0] !== n) {
409
+ i = stripAnsi(n);
410
+ let e;
411
+ t[4] === Symbol.for("react.memo_cache_sentinel") ? (e = /\bERROR\b/, t[4] = e) : e = t[4], a = e.test(i), o = /\bWARN\b/.test(i) || /\b(Warning|WARNING|DeprecationWarning)\b/.test(i), t[0] = n, t[1] = i, t[2] = a, t[3] = o;
412
+ } else i = t[1], a = t[2], o = t[3];
413
+ let s = o, l = `group flex border-b border-border/30 hover:bg-accent/30 ${a ? "bg-destructive/5" : s ? "bg-yellow-500/5" : ""}`, u = r + 1, d;
414
+ t[5] === u ? d = t[6] : (d = /* @__PURE__ */ jsx("span", {
415
+ className: "w-10 shrink-0 select-none border-r border-border/30 px-2 py-0.5 text-right text-[10px] text-muted-foreground/50",
416
+ children: u
417
+ }), t[5] = u, t[6] = d);
418
+ let f = `flex-1 px-3 py-0.5 text-[11px] leading-5 font-mono ${a ? "text-destructive" : s ? "text-yellow-600 dark:text-yellow-400" : ""}`, p;
419
+ t[7] !== i || t[8] !== f ? (p = /* @__PURE__ */ jsx("span", {
420
+ className: f,
421
+ children: i
422
+ }), t[7] = i, t[8] = f, t[9] = p) : p = t[9];
423
+ let m;
424
+ return t[10] !== l || t[11] !== d || t[12] !== p ? (m = /* @__PURE__ */ jsxs("div", {
425
+ className: l,
426
+ children: [d, p]
427
+ }), t[10] = l, t[11] = d, t[12] = p, t[13] = m) : m = t[13], m;
428
+ }
429
+ function EmbedLogsContent() {
430
+ let e = useRef(null), t = useQuery({
431
+ queryKey: ["remote-agent-app-logs"],
432
+ queryFn: async () => {
433
+ let e = await fetch("http://localhost:8000/api/v1/app/logs?lines=200", { credentials: "include" });
434
+ if (!e.ok) {
435
+ let t = await e.text();
436
+ throw Error(`Failed to fetch logs (${e.status}): ${t}`);
437
+ }
438
+ return await e.json();
439
+ },
440
+ refetchInterval: 5e3
441
+ });
442
+ useEffect(() => {
443
+ e.current?.scrollIntoView({ behavior: "smooth" });
444
+ }, [t.data]);
445
+ let n = useMemo(() => {
446
+ let e = [];
447
+ return t.data?.stdout && e.push(t.data.stdout), t.data?.stderr && e.push(t.data.stderr), e.join("\n").split("\n").filter((e) => e.length > 0);
448
+ }, [t.data]);
449
+ return /* @__PURE__ */ jsxs("div", {
450
+ className: "flex h-full flex-col",
451
+ children: [/* @__PURE__ */ jsxs("div", {
452
+ className: "flex h-9 shrink-0 items-center justify-between border-b bg-muted/30 px-3",
453
+ children: [/* @__PURE__ */ jsx("span", {
454
+ className: "text-xs font-medium text-muted-foreground",
455
+ children: "Application Logs"
456
+ }), /* @__PURE__ */ jsx("button", {
457
+ onClick: () => void t.refetch(),
458
+ className: `text-muted-foreground hover:text-foreground rounded-md p-1 transition-colors hover:cursor-pointer ${t.isFetching ? "animate-spin" : ""}`,
459
+ children: /* @__PURE__ */ jsx(RefreshCw, { className: "h-3 w-3" })
460
+ })]
461
+ }), /* @__PURE__ */ jsx("div", {
462
+ className: "flex-1 overflow-auto bg-background",
463
+ children: t.isLoading && !t.data ? /* @__PURE__ */ jsx("div", {
464
+ className: "flex justify-center py-8",
465
+ children: /* @__PURE__ */ jsx(Loader2, { className: "text-muted-foreground h-4 w-4 animate-spin" })
466
+ }) : t.error ? /* @__PURE__ */ jsx("div", {
467
+ className: "px-4 py-3",
468
+ children: /* @__PURE__ */ jsxs("p", {
469
+ className: "text-sm text-destructive",
470
+ children: ["Error: ", t.error.message]
471
+ })
472
+ }) : n.length > 0 ? /* @__PURE__ */ jsxs("div", {
473
+ className: "font-mono",
474
+ children: [n.map((e, t) => /* @__PURE__ */ jsx(LogLine, {
475
+ line: e,
476
+ index: t
477
+ }, t)), /* @__PURE__ */ jsx("div", { ref: e })]
478
+ }) : /* @__PURE__ */ jsxs("div", {
479
+ className: "flex flex-col items-center justify-center gap-2 py-8 text-muted-foreground",
480
+ children: [/* @__PURE__ */ jsx(ScrollText, { className: "h-5 w-5" }), /* @__PURE__ */ jsx("span", {
481
+ className: "text-xs",
482
+ children: "No logs available"
483
+ })]
484
+ })
485
+ })]
486
+ });
390
487
  }
391
488
  function EmbedNavigationContent(e) {
392
489
  let t = c(4), { pipelineId: n } = e, r = useNamespaceTree(n);