@loopstack/loopstack-studio 0.22.0 → 0.23.1

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 (98) hide show
  1. package/dist/app/EnvironmentEmbedRoot.js +20 -18
  2. package/dist/components/dynamic-form/Form.js +50 -27
  3. package/dist/components/dynamic-form/InputController.js +3 -1
  4. package/dist/components/dynamic-form/fields/MarkdownViewField.js +20 -0
  5. package/dist/components/feedback/ErrorBoundary.js +43 -0
  6. package/dist/components/{LoadingCentered.js → feedback/LoadingCentered.js} +1 -1
  7. package/dist/components/feedback/index.js +5 -0
  8. package/dist/components/index.js +6 -3
  9. package/dist/components/layout/MainLayout.js +32 -16
  10. package/dist/components/layout/StudioSidebar.js +165 -0
  11. package/dist/components/ui-widgets/widgets/SandboxRun.js +1 -0
  12. package/dist/features/code-explorer/CodeExplorer.js +6 -0
  13. package/dist/features/code-explorer/components/CodeExplorerTree.js +5 -0
  14. package/dist/features/code-explorer/components/CodeExplorerTreeNode.js +82 -0
  15. package/dist/features/code-explorer/components/FileContentViewer.js +1 -0
  16. package/dist/features/code-explorer/components/FileTabsBar.js +3 -190
  17. package/dist/features/code-explorer/components/FileTabsBarBase.js +190 -0
  18. package/dist/features/code-explorer/index.js +4 -0
  19. package/dist/features/code-explorer/providers/CodeExplorerProvider.js +2 -162
  20. package/dist/features/code-explorer/utils/fileIcons.js +7 -4
  21. package/dist/features/debug/components/ConfigFlowViewer.js +1 -1
  22. package/dist/features/debug/components/PipelineFlowViewer.js +47 -46
  23. package/dist/features/debug/components/pipeline-flow/WorkflowGraph.js +19 -19
  24. package/dist/features/debug/index.js +3 -0
  25. package/dist/features/documents/DocumentRenderer.js +58 -0
  26. package/dist/features/{workbench → documents}/components/DocumentItem.js +1 -1
  27. package/dist/features/{workbench → documents}/components/DocumentMetadataPills.js +2 -2
  28. package/dist/features/{workbench/components → documents}/document-details/DocumentDetails.js +3 -3
  29. package/dist/features/{workbench/components → documents}/document-details/PromptDetails.js +3 -3
  30. package/dist/features/documents/index.js +4 -0
  31. package/dist/features/{workbench/components/document-renderer → documents/renderers}/AiMessage.js +5 -5
  32. package/dist/features/documents/renderers/ClaudeMessage.js +96 -0
  33. package/dist/features/{workbench/components/document-renderer → documents/renderers}/DocumentDebugRenderer.js +1 -1
  34. package/dist/features/{workbench/components/document-renderer → documents/renderers}/DocumentFormRenderer.js +3 -3
  35. package/dist/features/{workbench/components/document-renderer → documents/renderers}/DocumentMessageRenderer.js +1 -1
  36. package/dist/features/{workbench/components/document-renderer → documents/renderers}/ErrorMessageRenderer.js +1 -1
  37. package/dist/features/{workbench/components/document-renderer → documents/renderers}/LinkMessageRenderer.js +1 -1
  38. package/dist/features/{workbench/components/document-renderer → documents/renderers}/MarkdownMessageRenderer.js +2 -2
  39. package/dist/features/{workbench/components/document-renderer → documents/renderers}/PlainMessageRenderer.js +1 -1
  40. package/dist/features/health/index.js +1 -0
  41. package/dist/features/workbench/NavigationItems.js +29 -29
  42. package/dist/features/workbench/Workbench.js +71 -99
  43. package/dist/features/workbench/WorkflowItem.js +63 -55
  44. package/dist/features/workbench/WorkflowList.js +52 -81
  45. package/dist/features/workbench/components/NewRunDialog.js +2 -1
  46. package/dist/features/workbench/components/RemoteFileTabsBar.js +18 -0
  47. package/dist/features/workbench/components/RemoteFileTree.js +90 -0
  48. package/dist/features/workbench/components/WorkbenchFilesPanel.js +60 -0
  49. package/dist/features/workbench/components/WorkbenchFlowPanel.js +4 -3
  50. package/dist/features/workbench/components/WorkbenchIconSidebar.js +37 -29
  51. package/dist/features/workbench/components/WorkflowHistoryItem.js +11 -11
  52. package/dist/features/workbench/components/buttons/WorkflowButtons.js +49 -50
  53. package/dist/features/workbench/hooks/useWorkflowData.js +49 -0
  54. package/dist/features/workbench/hooks/useWorkflowListState.js +50 -0
  55. package/dist/features/workbench/index.js +8 -0
  56. package/dist/features/workbench/providers/RemoteFileExplorerProvider.js +145 -0
  57. package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +47 -45
  58. package/dist/features/workspaces/components/CreateWorkspace.js +1 -1
  59. package/dist/features/workspaces/components/ExecutionTimeline.js +1 -1
  60. package/dist/features/workspaces/components/PipelineForm.js +2 -2
  61. package/dist/features/workspaces/components/WorkspaceHomePage.js +93 -0
  62. package/dist/features/workspaces/index.js +3 -0
  63. package/dist/hooks/index.js +3 -2
  64. package/dist/hooks/query-keys.js +138 -0
  65. package/dist/hooks/useAuth.js +43 -42
  66. package/dist/hooks/useConfig.js +31 -35
  67. package/dist/hooks/useDashboard.js +9 -13
  68. package/dist/hooks/useDebounce.js +8 -17
  69. package/dist/hooks/useDocuments.js +4 -9
  70. package/dist/hooks/useFiles.js +1 -51
  71. package/dist/hooks/useNamespaces.js +2 -8
  72. package/dist/hooks/usePipelines.js +132 -155
  73. package/dist/hooks/useProcessor.js +11 -14
  74. package/dist/hooks/useWorkflows.js +40 -62
  75. package/dist/hooks/useWorkspaces.js +105 -110
  76. package/dist/index.d.ts +105 -3
  77. package/dist/index.js +15 -7
  78. package/dist/node_modules/@xyflow/react/dist/esm/index.js +1 -1
  79. package/dist/pages/DashboardPage.js +1 -1
  80. package/dist/pages/DebugWorkflowDetailsPage.js +2 -2
  81. package/dist/pages/EmbedWorkbenchPage.js +4 -3
  82. package/dist/pages/PipelineDebugPage.js +6 -5
  83. package/dist/pages/PreviewWorkbenchPage.js +228 -128
  84. package/dist/pages/RunsListPage.js +52 -24
  85. package/dist/pages/StudioLandingPage.js +1 -0
  86. package/dist/pages/WorkbenchPage.js +3 -2
  87. package/dist/pages/WorkspacePage.js +103 -51
  88. package/dist/pages/WorkspaceRunsPage.js +71 -0
  89. package/dist/providers/InvalidationEventsProvider.js +9 -11
  90. package/dist/providers/StudioProvider.js +2 -2
  91. package/dist/routing/LocalRouter.js +18 -8
  92. package/package.json +2 -2
  93. package/dist/features/workbench/components/DocumentRenderer.js +0 -54
  94. /package/dist/components/{content → feedback}/ErrorAlert.js +0 -0
  95. /package/dist/components/{snackbars → feedback}/ErrorSnackbar.js +0 -0
  96. /package/dist/components/{snackbars → feedback}/Snackbar.js +0 -0
  97. /package/dist/features/{workbench → documents}/components/DocumentList.js +0 -0
  98. /package/dist/features/{workbench/components/document-renderer → documents/renderers}/AiMessageContent.js +0 -0
@@ -1,63 +1,115 @@
1
1
  import { useStudio } from "../providers/StudioProvider.js";
2
+ import { useWorkspaceConfig } from "../hooks/useConfig.js";
2
3
  import { useWorkspace } from "../hooks/useWorkspaces.js";
4
+ import { Button } from "../components/ui/button.js";
3
5
  import MainLayout_default from "../components/layout/MainLayout.js";
4
- import ErrorSnackbar_default from "../components/snackbars/ErrorSnackbar.js";
5
- import ExecutionTimeline_default from "../features/workspaces/components/ExecutionTimeline.js";
6
+ import ErrorSnackbar_default from "../components/feedback/ErrorSnackbar.js";
7
+ import WorkspaceHomePage_default from "../features/workspaces/components/WorkspaceHomePage.js";
6
8
  import { c } from "react/compiler-runtime";
7
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
- import { useParams } from "react-router-dom";
9
- import { Home, Loader2 } from "lucide-react";
10
+ import { Link, useParams } from "react-router-dom";
11
+ import { ArrowRight, Home, Loader2 } from "lucide-react";
10
12
  var WorkspacePage_default = () => {
11
- let p = c(31), { router: m } = useStudio(), { workspaceId: h } = useParams(), g = useWorkspace(h), _;
12
- p[0] === m ? _ = p[1] : (_ = m.getDashboard(), p[0] = m, p[1] = _);
13
- let v;
14
- p[2] === Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ jsx(Home, { className: "h-4 w-4" }), p[2] = v) : v = p[2];
15
- let y;
16
- p[3] === _ ? y = p[4] : (y = {
17
- label: "Dashboard",
18
- href: _,
19
- icon: v
20
- }, p[3] = _, p[4] = y);
21
- let b;
22
- p[5] === m ? b = p[6] : (b = m.getWorkspaces(), p[5] = m, p[6] = b);
23
- let x;
24
- p[7] === b ? x = p[8] : (x = {
25
- label: "Workspaces",
26
- href: b
27
- }, p[7] = b, p[8] = x);
28
- let S = g.data?.title ?? "", C;
29
- p[9] === S ? C = p[10] : (C = {
30
- label: S,
31
- current: !0
32
- }, p[9] = S, p[10] = C);
33
- let w;
34
- p[11] !== y || p[12] !== x || p[13] !== C ? (w = [
35
- y,
36
- x,
37
- C
38
- ], p[11] = y, p[12] = x, p[13] = C, p[14] = w) : w = p[14];
39
- let T = w, E = g.data?.title ?? "", D;
40
- p[15] === E ? D = p[16] : (D = /* @__PURE__ */ jsx("h1", {
41
- className: "mb-4 text-3xl font-bold tracking-tight",
42
- children: E
43
- }), p[15] = E, p[16] = D);
13
+ let v = c(49), { router: y } = useStudio(), { workspaceId: b } = useParams(), x = useWorkspace(b), S = useWorkspaceConfig(), C = x.data, w;
14
+ bb0: {
15
+ if (!C || !S.data) {
16
+ w = void 0;
17
+ break bb0;
18
+ }
19
+ let t;
20
+ if (v[0] !== S.data || v[1] !== C) {
21
+ let _;
22
+ v[3] === C ? _ = v[4] : (_ = (t) => t.blockName === C.blockName, v[3] = C, v[4] = _), t = S.data.find(_)?.ui?.actions?.find(_temp), v[0] = S.data, v[1] = C, v[2] = t;
23
+ } else t = v[2];
24
+ w = t;
25
+ }
26
+ let T = w, E;
27
+ v[5] === y ? E = v[6] : (E = y.getDashboard(), v[5] = y, v[6] = E);
28
+ let D;
29
+ v[7] === Symbol.for("react.memo_cache_sentinel") ? (D = /* @__PURE__ */ jsx(Home, { className: "h-4 w-4" }), v[7] = D) : D = v[7];
44
30
  let O;
45
- p[17] === g.isLoading ? O = p[18] : (O = g.isLoading ? /* @__PURE__ */ jsx(Loader2, { className: "h-6 w-6 animate-spin" }) : "", p[17] = g.isLoading, p[18] = O);
31
+ v[8] === E ? O = v[9] : (O = {
32
+ label: "Dashboard",
33
+ href: E,
34
+ icon: D
35
+ }, v[8] = E, v[9] = O);
46
36
  let k;
47
- p[19] === g.error ? k = p[20] : (k = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: g.error }), p[19] = g.error, p[20] = k);
37
+ v[10] === y ? k = v[11] : (k = y.getWorkspaces(), v[10] = y, v[11] = k);
48
38
  let A;
49
- p[21] === g.data ? A = p[22] : (A = g.data ? /* @__PURE__ */ jsx(ExecutionTimeline_default, { workspace: g.data }) : "", p[21] = g.data, p[22] = A);
50
- let j;
51
- p[23] !== O || p[24] !== k || p[25] !== A || p[26] !== D ? (j = /* @__PURE__ */ jsxs(Fragment, { children: [
52
- D,
39
+ v[12] === k ? A = v[13] : (A = {
40
+ label: "Workspaces",
41
+ href: k
42
+ }, v[12] = k, v[13] = A);
43
+ let j = C?.title ?? "", M;
44
+ v[14] === j ? M = v[15] : (M = {
45
+ label: j,
46
+ current: !0
47
+ }, v[14] = j, v[15] = M);
48
+ let N;
49
+ v[16] !== O || v[17] !== A || v[18] !== M ? (N = [
53
50
  O,
54
- k,
55
- A
56
- ] }), p[23] = O, p[24] = k, p[25] = A, p[26] = D, p[27] = j) : j = p[27];
57
- let M;
58
- return p[28] !== T || p[29] !== j ? (M = /* @__PURE__ */ jsx(MainLayout_default, {
59
- breadcrumbsData: T,
60
- children: j
61
- }), p[28] = T, p[29] = j, p[30] = M) : M = p[30], M;
51
+ A,
52
+ M
53
+ ], v[16] = O, v[17] = A, v[18] = M, v[19] = N) : N = v[19];
54
+ let P = N, F = x.isLoading || S.isLoading, I = C?.title ?? "", L;
55
+ v[20] === I ? L = v[21] : (L = /* @__PURE__ */ jsx("h1", {
56
+ className: "text-3xl font-bold tracking-tight",
57
+ children: I
58
+ }), v[20] = I, v[21] = L);
59
+ let R;
60
+ v[22] !== y || v[23] !== b ? (R = b && /* @__PURE__ */ jsx(Button, {
61
+ variant: "outline",
62
+ size: "sm",
63
+ asChild: !0,
64
+ children: /* @__PURE__ */ jsxs(Link, {
65
+ to: y.getWorkspaceRuns(b),
66
+ children: ["Runs", /* @__PURE__ */ jsx(ArrowRight, { className: "ml-1 h-4 w-4" })]
67
+ })
68
+ }), v[22] = y, v[23] = b, v[24] = R) : R = v[24];
69
+ let z;
70
+ v[25] !== L || v[26] !== R ? (z = /* @__PURE__ */ jsxs("div", {
71
+ className: "mb-4 flex items-center justify-between",
72
+ children: [L, R]
73
+ }), v[25] = L, v[26] = R, v[27] = z) : z = v[27];
74
+ let B;
75
+ v[28] === F ? B = v[29] : (B = F ? /* @__PURE__ */ jsx(Loader2, { className: "h-6 w-6 animate-spin" }) : "", v[28] = F, v[29] = B);
76
+ let V;
77
+ v[30] === x.error ? V = v[31] : (V = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: x.error }), v[30] = x.error, v[31] = V);
78
+ let H;
79
+ v[32] === S.error ? H = v[33] : (H = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: S.error }), v[32] = S.error, v[33] = H);
80
+ let U;
81
+ v[34] !== F || v[35] !== y || v[36] !== T || v[37] !== C || v[38] !== b ? (U = C && T ? /* @__PURE__ */ jsx(WorkspaceHomePage_default, {
82
+ workspace: C,
83
+ action: T
84
+ }) : C && !F ? /* @__PURE__ */ jsxs("div", {
85
+ className: "flex flex-col items-center justify-center py-16",
86
+ children: [/* @__PURE__ */ jsx("p", {
87
+ className: "text-muted-foreground mb-4",
88
+ children: "No home page configured for this workspace."
89
+ }), b && /* @__PURE__ */ jsx(Button, {
90
+ variant: "default",
91
+ asChild: !0,
92
+ children: /* @__PURE__ */ jsxs(Link, {
93
+ to: y.getWorkspaceRuns(b),
94
+ children: ["Go to Runs", /* @__PURE__ */ jsx(ArrowRight, { className: "ml-1 h-4 w-4" })]
95
+ })
96
+ })]
97
+ }) : null, v[34] = F, v[35] = y, v[36] = T, v[37] = C, v[38] = b, v[39] = U) : U = v[39];
98
+ let W;
99
+ v[40] !== z || v[41] !== B || v[42] !== V || v[43] !== H || v[44] !== U ? (W = /* @__PURE__ */ jsxs(Fragment, { children: [
100
+ z,
101
+ B,
102
+ V,
103
+ H,
104
+ U
105
+ ] }), v[40] = z, v[41] = B, v[42] = V, v[43] = H, v[44] = U, v[45] = W) : W = v[45];
106
+ let G;
107
+ return v[46] !== P || v[47] !== W ? (G = /* @__PURE__ */ jsx(MainLayout_default, {
108
+ breadcrumbsData: P,
109
+ children: W
110
+ }), v[46] = P, v[47] = W, v[48] = G) : G = v[48], G;
62
111
  };
112
+ function _temp(t) {
113
+ return t.widget === "start-form";
114
+ }
63
115
  export { WorkspacePage_default as default };
@@ -0,0 +1,71 @@
1
+ import { useStudio } from "../providers/StudioProvider.js";
2
+ import { useWorkspace } from "../hooks/useWorkspaces.js";
3
+ import MainLayout_default from "../components/layout/MainLayout.js";
4
+ import ErrorSnackbar_default from "../components/feedback/ErrorSnackbar.js";
5
+ import ExecutionTimeline_default from "../features/workspaces/components/ExecutionTimeline.js";
6
+ import { c } from "react/compiler-runtime";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { useParams } from "react-router-dom";
9
+ import { Home, Loader2 } from "lucide-react";
10
+ var WorkspaceRunsPage_default = () => {
11
+ let p = c(36), { router: m } = useStudio(), { workspaceId: h } = useParams(), g = useWorkspace(h), _;
12
+ p[0] === m ? _ = p[1] : (_ = m.getDashboard(), p[0] = m, p[1] = _);
13
+ let v;
14
+ p[2] === Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ jsx(Home, { className: "h-4 w-4" }), p[2] = v) : v = p[2];
15
+ let y;
16
+ p[3] === _ ? y = p[4] : (y = {
17
+ label: "Dashboard",
18
+ href: _,
19
+ icon: v
20
+ }, p[3] = _, p[4] = y);
21
+ let b;
22
+ p[5] === m ? b = p[6] : (b = m.getWorkspaces(), p[5] = m, p[6] = b);
23
+ let x;
24
+ p[7] === b ? x = p[8] : (x = {
25
+ label: "Workspaces",
26
+ href: b
27
+ }, p[7] = b, p[8] = x);
28
+ let S = g.data?.title ?? "", C;
29
+ p[9] !== m || p[10] !== h ? (C = h ? m.getWorkspace(h) : void 0, p[9] = m, p[10] = h, p[11] = C) : C = p[11];
30
+ let w;
31
+ p[12] !== S || p[13] !== C ? (w = {
32
+ label: S,
33
+ href: C
34
+ }, p[12] = S, p[13] = C, p[14] = w) : w = p[14];
35
+ let T;
36
+ p[15] === Symbol.for("react.memo_cache_sentinel") ? (T = {
37
+ label: "Runs",
38
+ current: !0
39
+ }, p[15] = T) : T = p[15];
40
+ let E;
41
+ p[16] !== y || p[17] !== x || p[18] !== w ? (E = [
42
+ y,
43
+ x,
44
+ w,
45
+ T
46
+ ], p[16] = y, p[17] = x, p[18] = w, p[19] = E) : E = p[19];
47
+ let D = E, O = g.data?.title ?? "", k;
48
+ p[20] === O ? k = p[21] : (k = /* @__PURE__ */ jsxs("h1", {
49
+ className: "mb-4 text-3xl font-bold tracking-tight",
50
+ children: [O, " — Runs"]
51
+ }), p[20] = O, p[21] = k);
52
+ let A;
53
+ p[22] === g.isLoading ? A = p[23] : (A = g.isLoading ? /* @__PURE__ */ jsx(Loader2, { className: "h-6 w-6 animate-spin" }) : "", p[22] = g.isLoading, p[23] = A);
54
+ let j;
55
+ p[24] === g.error ? j = p[25] : (j = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: g.error }), p[24] = g.error, p[25] = j);
56
+ let M;
57
+ p[26] === g.data ? M = p[27] : (M = g.data ? /* @__PURE__ */ jsx(ExecutionTimeline_default, { workspace: g.data }) : "", p[26] = g.data, p[27] = M);
58
+ let N;
59
+ p[28] !== k || p[29] !== A || p[30] !== j || p[31] !== M ? (N = /* @__PURE__ */ jsxs(Fragment, { children: [
60
+ k,
61
+ A,
62
+ j,
63
+ M
64
+ ] }), p[28] = k, p[29] = A, p[30] = j, p[31] = M, p[32] = N) : N = p[32];
65
+ let P;
66
+ return p[33] !== D || p[34] !== N ? (P = /* @__PURE__ */ jsx(MainLayout_default, {
67
+ breadcrumbsData: D,
68
+ children: N
69
+ }), p[33] = D, p[34] = N, p[35] = P) : P = p[35], P;
70
+ };
71
+ export { WorkspaceRunsPage_default as default };
@@ -1,19 +1,17 @@
1
1
  import { __toESM } from "../_virtual/rolldown_runtime.js";
2
+ import { getDocumentsCacheKey, getNamespacesByPipelineCacheKey, getWorkflowCacheKey, getWorkflowsByPipelineCacheKey, getWorkflowsCacheKey } from "../hooks/query-keys.js";
2
3
  import { SseClientEvents } from "../events/sse-client-events.js";
3
4
  import { eventBus } from "../services/eventEmitter.js";
4
5
  import "../services/index.js";
5
6
  import { useStudio } from "./StudioProvider.js";
6
7
  import { require_debounce } from "../node_modules/lodash/debounce.js";
7
- import { getDocumentsCacheKey } from "../hooks/useDocuments.js";
8
- import { getNamespacesByPipelineCacheKey } from "../hooks/useNamespaces.js";
9
- import { getWorkflowCacheKey, getWorkflowsByPipelineCacheKey, getWorkflowsCacheKey } from "../hooks/useWorkflows.js";
10
8
  import { c } from "react/compiler-runtime";
11
9
  import { useEffect, useRef } from "react";
12
10
  import { QueryClient, useQueryClient } from "@tanstack/react-query";
13
11
  var import_debounce = /* @__PURE__ */ __toESM(require_debounce(), 1), DEBOUNCE_MS = 300;
14
- function createDebouncedInvalidator(e, u) {
12
+ function createDebouncedInvalidator(e, l) {
15
13
  return (0, import_debounce.default)(() => {
16
- e.invalidateQueries({ queryKey: u });
14
+ e.invalidateQueries({ queryKey: l });
17
15
  }, DEBOUNCE_MS);
18
16
  }
19
17
  function InvalidationEventsProvider() {
@@ -23,12 +21,12 @@ function InvalidationEventsProvider() {
23
21
  return e[1] !== f.id || e[2] !== g ? (b = () => {
24
22
  if (!f.id) return;
25
23
  let e = f.id, d = y.current, p = function(e) {
26
- let u = JSON.stringify(e);
27
- d.has(u) || d.set(u, createDebouncedInvalidator(g, e)), d.get(u)();
28
- }, m = eventBus.on(SseClientEvents.WORKFLOW_CREATED, (u) => {
29
- u.namespaceId && p(getWorkflowsCacheKey(e, u.namespaceId)), u.pipelineId && (p(getNamespacesByPipelineCacheKey(e, u.pipelineId)), p(getWorkflowsByPipelineCacheKey(e, u.pipelineId)));
30
- }), h = eventBus.on(SseClientEvents.WORKFLOW_UPDATED, (u) => {
31
- u.id && p(getWorkflowCacheKey(e, u.id)), u.namespaceId && p(getWorkflowsCacheKey(e, u.namespaceId)), u.pipelineId && (p(getNamespacesByPipelineCacheKey(e, u.pipelineId)), p(getWorkflowsByPipelineCacheKey(e, u.pipelineId)));
24
+ let l = JSON.stringify(e);
25
+ d.has(l) || d.set(l, createDebouncedInvalidator(g, e)), d.get(l)();
26
+ }, m = eventBus.on(SseClientEvents.WORKFLOW_CREATED, (l) => {
27
+ l.namespaceId && p(getWorkflowsCacheKey(e, l.namespaceId)), l.pipelineId && (p(getNamespacesByPipelineCacheKey(e, l.pipelineId)), p(getWorkflowsByPipelineCacheKey(e, l.pipelineId)));
28
+ }), h = eventBus.on(SseClientEvents.WORKFLOW_UPDATED, (l) => {
29
+ l.id && p(getWorkflowCacheKey(e, l.id)), l.namespaceId && p(getWorkflowsCacheKey(e, l.namespaceId)), l.pipelineId && (p(getNamespacesByPipelineCacheKey(e, l.pipelineId)), p(getWorkflowsByPipelineCacheKey(e, l.pipelineId)));
32
30
  }), _ = eventBus.on(SseClientEvents.DOCUMENT_CREATED, (u) => {
33
31
  u.workflowId && p(getDocumentsCacheKey(e, u.workflowId));
34
32
  });
@@ -17,5 +17,5 @@ const StudioProvider = (r) => {
17
17
  let e = useContext(StudioContext);
18
18
  if (!e) throw Error("useStudio must be used within StudioProvider");
19
19
  return e;
20
- };
21
- export { StudioProvider, useStudio };
20
+ }, useStudioOptional = () => useContext(StudioContext);
21
+ export { StudioProvider, useStudio, useStudioOptional };
@@ -3,14 +3,18 @@ import { useNavigate } from "react-router-dom";
3
3
  var LocalRouter = class {
4
4
  navigate;
5
5
  envId;
6
- constructor(e, t) {
7
- this.navigate = e, this.envId = t;
6
+ embedPrefix;
7
+ constructor(e, t, n = "/embed") {
8
+ this.navigate = e, this.envId = t, this.embedPrefix = n;
8
9
  }
9
10
  async navigateToHome() {
10
11
  await this.navigate("/");
11
12
  }
13
+ getEnvironmentInfo() {
14
+ return "/info";
15
+ }
12
16
  async navigateToEnvironmentInfo() {
13
- await this.navigate("/info");
17
+ await this.navigate(this.getEnvironmentInfo());
14
18
  }
15
19
  getRuns() {
16
20
  return "/runs";
@@ -63,11 +67,17 @@ var LocalRouter = class {
63
67
  async navigateToPipelineNamespace(e, t, n) {
64
68
  await this.navigate(`/workspaces/${e}/pipelines/${t}/namespaces/${n}`);
65
69
  }
70
+ getWorkspaceRuns(e) {
71
+ return `/workspaces/${e}/runs`;
72
+ }
73
+ async navigateToWorkspaceRuns(e) {
74
+ await this.navigate(this.getWorkspaceRuns(e));
75
+ }
66
76
  getEmbedPipeline(e) {
67
- return `/embed/pipelines/${e}`;
77
+ return `${this.embedPrefix}/pipelines/${e}`;
68
78
  }
69
79
  getPreviewPipeline(e) {
70
- return `/embed/preview/pipelines/${e}`;
80
+ return `${this.embedPrefix}/preview/pipelines/${e}`;
71
81
  }
72
82
  getCurrentEnvironmentId() {
73
83
  return this.envId;
@@ -76,8 +86,8 @@ var LocalRouter = class {
76
86
  return "local";
77
87
  }
78
88
  };
79
- const useRouter = (r) => {
80
- let i = c(3), a = useNavigate(), o;
81
- return i[0] !== r || i[1] !== a ? (o = new LocalRouter(a, r), i[0] = r, i[1] = a, i[2] = o) : o = i[2], o;
89
+ const useRouter = (r, i) => {
90
+ let a = c(4), o = useNavigate(), s;
91
+ return a[0] !== i || a[1] !== r || a[2] !== o ? (s = new LocalRouter(o, r, i), a[0] = i, a[1] = r, a[2] = o, a[3] = s) : s = a[3], s;
82
92
  };
83
93
  export { LocalRouter, useRouter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loopstack/loopstack-studio",
3
- "version": "0.22.0",
3
+ "version": "0.23.1",
4
4
  "repository": "loopstack-ai/loopstack-studio",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "@fontsource/roboto": "^5.2.10",
28
28
  "@hookform/resolvers": "^5.2.2",
29
- "@loopstack/contracts": "^0.23.0",
29
+ "@loopstack/contracts": "^0.23.1",
30
30
  "@radix-ui/react-accordion": "^1.2.12",
31
31
  "@radix-ui/react-alert-dialog": "^1.1.15",
32
32
  "@radix-ui/react-avatar": "^1.1.11",
@@ -1,54 +0,0 @@
1
- import CompletionMessagePaper_default from "../../../components/messages/CompletionMessagePaper.js";
2
- import OAuthPromptRenderer_default from "../../oauth/OAuthPromptRenderer.js";
3
- import "../../oauth/index.js";
4
- import AiMessage_default from "./document-renderer/AiMessage.js";
5
- import LinkMessageRenderer_default from "./document-renderer/LinkMessageRenderer.js";
6
- import DocumentDebugRenderer_default from "./document-renderer/DocumentDebugRenderer.js";
7
- import DocumentFormRenderer_default from "./document-renderer/DocumentFormRenderer.js";
8
- import DocumentMessageRenderer_default from "./document-renderer/DocumentMessageRenderer.js";
9
- import ErrorMessageRenderer_default from "./document-renderer/ErrorMessageRenderer.js";
10
- import MarkdownMessageRenderer_default from "./document-renderer/MarkdownMessageRenderer.js";
11
- import PlainMessageRenderer_default from "./document-renderer/PlainMessageRenderer.js";
12
- import { c } from "react/compiler-runtime";
13
- import React from "react";
14
- import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
15
- var DocumentRenderer_default = (m) => {
16
- let h = c(8), { pipeline: g, workflow: _, document: v, isActive: y, isLastItem: b } = m, x = !y, S = v, C = S.ui?.form?.widget ?? "object-form", w;
17
- return h[0] !== S || h[1] !== y || h[2] !== b || h[3] !== g || h[4] !== x || h[5] !== C || h[6] !== _ ? (w = /* @__PURE__ */ jsx("div", { children: (() => {
18
- switch (C) {
19
- case "ai-message": return /* @__PURE__ */ jsx(AiMessage_default, {
20
- document: S,
21
- isLastItem: b
22
- });
23
- case "debug": return /* @__PURE__ */ jsx("div", {
24
- className: "mb-4 flex",
25
- children: /* @__PURE__ */ jsx(DocumentDebugRenderer_default, { document: S })
26
- });
27
- case "object-form": return /* @__PURE__ */ jsx(CompletionMessagePaper_default, {
28
- role: "document",
29
- fullWidth: !0,
30
- timestamp: new Date(S.createdAt),
31
- children: /* @__PURE__ */ jsx(DocumentFormRenderer_default, {
32
- pipeline: g,
33
- workflow: _,
34
- document: S,
35
- enabled: y,
36
- viewOnly: x
37
- })
38
- });
39
- case "message": return /* @__PURE__ */ jsx(DocumentMessageRenderer_default, { document: S });
40
- case "error": return /* @__PURE__ */ jsx(ErrorMessageRenderer_default, { document: S });
41
- case "plain": return /* @__PURE__ */ jsx(PlainMessageRenderer_default, { document: S });
42
- case "markdown": return /* @__PURE__ */ jsx(MarkdownMessageRenderer_default, { document: S });
43
- case "link": return /* @__PURE__ */ jsx(LinkMessageRenderer_default, { document: S });
44
- case "oauth-prompt": return /* @__PURE__ */ jsx(OAuthPromptRenderer_default, {
45
- pipeline: g,
46
- workflow: _,
47
- document: S,
48
- isActive: y
49
- });
50
- default: return /* @__PURE__ */ jsx(Fragment$1, { children: "unknown document type" });
51
- }
52
- })() }), h[0] = S, h[1] = y, h[2] = b, h[3] = g, h[4] = x, h[5] = C, h[6] = _, h[7] = w) : w = h[7], w;
53
- };
54
- export { DocumentRenderer_default as default };