@loopstack/loopstack-studio 0.29.5 → 0.30.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 (113) hide show
  1. package/dist/_virtual/rolldown_runtime.js +3 -1
  2. package/dist/api/config.js +5 -4
  3. package/dist/api/environments.js +5 -1
  4. package/dist/api/processor.js +4 -1
  5. package/dist/app/EnvironmentEmbedRoot.js +22 -30
  6. package/dist/components/ai-elements/code-block.js +4 -4
  7. package/dist/components/dynamic-form/CodeContent.js +1 -1
  8. package/dist/components/dynamic-form/FormBody.js +1 -1
  9. package/dist/components/motion/FadeIn.js +72 -0
  10. package/dist/components/motion/StreamingText.js +49 -0
  11. package/dist/components/ui/accordion.js +2 -2
  12. package/dist/components/ui-widgets/UiWidget.js +11 -10
  13. package/dist/components/ui-widgets/widgets/AiPromptInput.js +31 -28
  14. package/dist/events/sse-client-events.js +7 -1
  15. package/dist/features/code-explorer/components/FileContentViewer.js +2 -2
  16. package/dist/features/debug/components/WorkflowFlowViewer.js +49 -51
  17. package/dist/features/documents/DocumentRenderer.js +18 -17
  18. package/dist/features/documents/components/DocumentItem.js +42 -20
  19. package/dist/features/documents/components/DocumentList.js +34 -36
  20. package/dist/features/documents/components/DocumentMetadataPills.js +102 -49
  21. package/dist/features/documents/document-details/DocumentDetails.js +577 -377
  22. package/dist/features/documents/document-details/PromptDetails.js +118 -130
  23. package/dist/features/documents/document-details/document-debug-utils.js +100 -0
  24. package/dist/features/documents/renderers/ChoicesRenderer.js +41 -38
  25. package/dist/features/documents/renderers/ConfirmPromptRenderer.js +31 -28
  26. package/dist/features/documents/renderers/DocumentFormRenderer.js +62 -70
  27. package/dist/features/documents/renderers/LlmMessage.js +52 -47
  28. package/dist/features/documents/renderers/TextPromptRenderer.js +32 -29
  29. package/dist/features/documents/renderers/useDocumentTransition.js +4 -4
  30. package/dist/features/feature-registry/FeatureRegistryProvider.js +32 -10
  31. package/dist/features/feature-registry/available-features.js +12 -0
  32. package/dist/features/feature-registry/index.js +2 -1
  33. package/dist/features/file-explorer/components/FileExplorerPanel.js +55 -51
  34. package/dist/features/git/components/GitBranchBadge.js +31 -0
  35. package/dist/features/git/components/GitCommitList.js +46 -0
  36. package/dist/features/git/components/GitRemoteStatus.js +84 -0
  37. package/dist/features/git/components/WorkbenchGitPanel.js +81 -0
  38. package/dist/features/git/git-feature.js +12 -0
  39. package/dist/features/git/hooks/useGit.js +78 -0
  40. package/dist/features/git/index.js +1 -0
  41. package/dist/features/oauth/OAuthPromptRenderer.js +137 -142
  42. package/dist/features/runs/Runs.js +4 -4
  43. package/dist/features/secrets/components/WorkbenchSecretsPanel.js +1 -1
  44. package/dist/features/secrets/renderers/SecretInputRenderer.js +30 -29
  45. package/dist/features/workbench/Workbench.js +25 -33
  46. package/dist/features/workbench/WorkflowItem.js +9 -9
  47. package/dist/features/workbench/WorkflowList.js +61 -62
  48. package/dist/features/workbench/components/NewRunDialog.js +237 -209
  49. package/dist/features/workbench/components/RecentRunItem.js +3 -3
  50. package/dist/features/workbench/components/WorkbenchEnvironmentPanel.js +8 -8
  51. package/dist/features/workbench/components/WorkbenchIconSidebar.js +1 -1
  52. package/dist/features/workbench/components/WorkbenchSidebarShell.js +3 -3
  53. package/dist/features/workbench/components/WorkflowForms.js +11 -10
  54. package/dist/features/workbench/components/WorkflowHistoryItem.js +16 -36
  55. package/dist/features/workbench/components/WorkflowHistoryList.js +19 -17
  56. package/dist/features/workbench/components/buttons/WorkflowButtons.js +3 -3
  57. package/dist/features/workbench/hooks/useLlmStreamingDocuments.js +159 -0
  58. package/dist/features/workbench/hooks/useWorkflowData.js +58 -31
  59. package/dist/features/workbench/index.js +2 -2
  60. package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +53 -53
  61. package/dist/features/workspaces/Workspaces.js +134 -125
  62. package/dist/features/workspaces/components/CreateWorkspace.js +115 -107
  63. package/dist/features/workspaces/components/ExecutionTimeline.js +2 -2
  64. package/dist/features/workspaces/components/WorkflowRunForm.js +127 -104
  65. package/dist/features/workspaces/components/WorkspaceHomePage.js +6 -89
  66. package/dist/features/workspaces/components/workflow-form/ArgumentsView.js +1 -1
  67. package/dist/features/workspaces/components/workflow-form/SelectionView.js +15 -15
  68. package/dist/hooks/index.js +3 -2
  69. package/dist/hooks/query-keys.js +43 -30
  70. package/dist/hooks/useConfig.js +28 -22
  71. package/dist/hooks/useEnvironments.js +27 -2
  72. package/dist/hooks/useProcessor.js +14 -1
  73. package/dist/hooks/useWorkflows.js +4 -4
  74. package/dist/index.d.ts +116 -15
  75. package/dist/index.js +9 -8
  76. package/dist/node_modules/d3/src/index.js +13 -13
  77. package/dist/node_modules/d3-scale/src/continuous.js +16 -16
  78. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-3BPJPVTR.js +43 -43
  79. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/blockDiagram-GPEHLZMM.js +270 -270
  80. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-AAUBKEIU.js +90 -90
  81. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-3OPIFGDE.js +458 -458
  82. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-55IACEB6.js +3 -3
  83. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-5ZQYHXKU.js +37 -37
  84. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-727SXJPM.js +208 -208
  85. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-KSCS5N6A.js +145 -145
  86. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ND2GUHAM.js +7 -7
  87. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-O5CBEL6O.js +41 -41
  88. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-WU5MYG2G.js +3 -3
  89. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/cose-bilkent-S5V4N54A.js +6 -6
  90. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-KO2AKTUF.js +30 -30
  91. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-OG6HWLK6.js +82 -82
  92. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/erDiagram-TEJ5UH35.js +65 -65
  93. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-I6XJVG4X.js +227 -227
  94. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-6RSMTGT7.js +104 -104
  95. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-PVQCEYII.js +104 -104
  96. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/journeyDiagram-JHISSGLW.js +49 -49
  97. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/quadrantDiagram-W4KKPZXB.js +101 -101
  98. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sankeyDiagram-5OEKKPKP.js +20 -20
  99. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-3UESZ5HK.js +354 -354
  100. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-AJRCARHV.js +53 -53
  101. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-PNZ67QCA.js +113 -113
  102. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/vennDiagram-CIIHVFJN.js +90 -90
  103. package/dist/node_modules/mermaid/dist/mermaid.core.js +156 -156
  104. package/dist/node_modules/motion/dist/es/react.js +9 -2
  105. package/dist/pages/DebugWorkflowDetailsPage.js +2 -2
  106. package/dist/pages/DebugWorkflowsPage.js +76 -106
  107. package/dist/pages/EmbedWorkbenchPage.js +1 -1
  108. package/dist/pages/PreviewWorkbenchPage.js +6 -6
  109. package/dist/pages/WorkbenchPage.js +43 -47
  110. package/dist/pages/WorkflowDebugPage.js +6 -12
  111. package/dist/pages/WorkspacePage.js +40 -66
  112. package/dist/pages/WorkspaceRunsPage.js +24 -31
  113. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
+ import { useResetEnvironment } from "../../../hooks/useEnvironments.js";
1
2
  import { Button } from "../../../components/ui/button.js";
2
3
  import { useWorkbenchLayout } from "../providers/WorkbenchLayoutProvider.js";
3
- import { useResetEnvironment } from "../../../hooks/useEnvironments.js";
4
4
  import { SidebarPanel } from "./SidebarPanel.js";
5
5
  import { useState } from "react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -30,18 +30,18 @@ function WorkbenchEnvironmentPanel(d) {
30
30
  className: "flex-1 overflow-y-auto px-4 py-3",
31
31
  children: /* @__PURE__ */ jsxs("div", {
32
32
  className: "space-y-2",
33
- children: [y.map((u) => /* @__PURE__ */ jsxs("div", {
33
+ children: [y.map((e) => /* @__PURE__ */ jsxs("div", {
34
34
  className: "bg-muted/50 rounded-md px-3 py-3",
35
35
  children: [/* @__PURE__ */ jsxs("div", {
36
36
  className: "mb-2",
37
37
  children: [/* @__PURE__ */ jsx("div", {
38
38
  className: "text-sm font-medium",
39
- children: u.envName || u.slotId
39
+ children: e.envName || e.slotId
40
40
  }), /* @__PURE__ */ jsx("div", {
41
41
  className: "text-muted-foreground text-xs",
42
- children: u.type || "remote"
42
+ children: e.type || "remote"
43
43
  })]
44
- }), _ === u.slotId ? /* @__PURE__ */ jsxs("div", {
44
+ }), _ === e.slotId ? /* @__PURE__ */ jsxs("div", {
45
45
  className: "space-y-2",
46
46
  children: [/* @__PURE__ */ jsx("p", {
47
47
  className: "text-destructive text-xs",
@@ -53,7 +53,7 @@ function WorkbenchEnvironmentPanel(d) {
53
53
  variant: "destructive",
54
54
  className: "h-7 text-xs",
55
55
  disabled: g.isPending,
56
- onClick: () => void b(u.slotId),
56
+ onClick: () => void b(e.slotId),
57
57
  children: [g.isPending ? /* @__PURE__ */ jsx(Loader2, { className: "mr-1 h-3 w-3 animate-spin" }) : /* @__PURE__ */ jsx(RotateCcw, { className: "mr-1 h-3 w-3" }), "Confirm Reset"]
58
58
  }), /* @__PURE__ */ jsx(Button, {
59
59
  size: "sm",
@@ -68,10 +68,10 @@ function WorkbenchEnvironmentPanel(d) {
68
68
  size: "sm",
69
69
  variant: "outline",
70
70
  className: "h-7 text-xs",
71
- onClick: () => v(u.slotId),
71
+ onClick: () => v(e.slotId),
72
72
  children: [/* @__PURE__ */ jsx(RotateCcw, { className: "mr-1 h-3 w-3" }), "Reset Environment"]
73
73
  })]
74
- }, u.slotId)), y.length === 0 && /* @__PURE__ */ jsx("p", {
74
+ }, e.slotId)), y.length === 0 && /* @__PURE__ */ jsx("p", {
75
75
  className: "text-muted-foreground py-4 text-center text-sm",
76
76
  children: "No remote environments configured."
77
77
  })]
@@ -1,9 +1,9 @@
1
1
  import { useStudio } from "../../../providers/StudioProvider.js";
2
2
  import { cn } from "../../../lib/utils.js";
3
3
  import { Tooltip, TooltipContent, TooltipTrigger } from "../../../components/ui/tooltip.js";
4
+ import { useWorkbenchLayout } from "../providers/WorkbenchLayoutProvider.js";
4
5
  import { useFeatureRegistry } from "../../feature-registry/FeatureRegistryProvider.js";
5
6
  import "../../feature-registry/index.js";
6
- import { useWorkbenchLayout } from "../providers/WorkbenchLayoutProvider.js";
7
7
  import { c } from "react/compiler-runtime";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
9
  import { Link, useLocation } from "react-router-dom";
@@ -1,6 +1,6 @@
1
+ import { useWorkbenchLayout } from "../providers/WorkbenchLayoutProvider.js";
1
2
  import { useFeatureRegistry } from "../../feature-registry/FeatureRegistryProvider.js";
2
3
  import "../../feature-registry/index.js";
3
- import { useWorkbenchLayout } from "../providers/WorkbenchLayoutProvider.js";
4
4
  import { WorkbenchEnvironmentPanel } from "./WorkbenchEnvironmentPanel.js";
5
5
  import { WorkbenchIconSidebar } from "./WorkbenchIconSidebar.js";
6
6
  import { WorkbenchPreviewPanel } from "./WorkbenchPreviewPanel.js";
@@ -49,8 +49,8 @@ function ActivePanelContent() {
49
49
  }
50
50
  }
51
51
  }
52
- function SidebarContent(e) {
53
- let i = c(12), { children: o } = e, { activePanel: s, panelSize: p } = useWorkbenchLayout(), m = `${s ? CONTENT_WIDTH[p] : "w-full"} overflow-hidden`, h;
52
+ function SidebarContent(r) {
53
+ let i = c(12), { children: o } = r, { activePanel: s, panelSize: p } = useWorkbenchLayout(), m = `${s ? CONTENT_WIDTH[p] : "w-full"} overflow-hidden`, h;
54
54
  i[0] !== o || i[1] !== m ? (h = /* @__PURE__ */ jsx("div", {
55
55
  className: m,
56
56
  children: o
@@ -6,18 +6,19 @@ import { c } from "react/compiler-runtime";
6
6
  import React from "react";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  var WorkflowForms_default = (o) => {
9
- let s = c(8), { workflow: l, onSubmit: u } = o, d = useWorkflowConfigByName(l.className ?? void 0).data?.ui, f = d?.widgets ?? d?.actions;
10
- if (!f?.length) return null;
11
- let p;
12
- s[0] === l.availableTransitions ? p = s[1] : (p = l.availableTransitions?.map(_temp) ?? [], s[0] = l.availableTransitions, s[1] = p);
13
- let m = p, h = f, g = l.status === WorkflowState.Completed, _;
14
- return s[2] !== m || s[3] !== u || s[4] !== h || s[5] !== g || s[6] !== l.place ? (_ = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(UiActions_default, {
15
- actions: h,
16
- availableTransitions: m,
9
+ let s = c(9), { workflow: l, onSubmit: u, isLoading: d } = o, f = useWorkflowConfigByName(l.workflowName).data?.ui, p = f?.widgets ?? f?.actions;
10
+ if (!p?.length) return null;
11
+ let m;
12
+ s[0] === l.availableTransitions ? m = s[1] : (m = l.availableTransitions?.map(_temp) ?? [], s[0] = l.availableTransitions, s[1] = m);
13
+ let h = m, g = p, _ = l.status === WorkflowState.Completed, v;
14
+ return s[2] !== h || s[3] !== d || s[4] !== u || s[5] !== g || s[6] !== _ || s[7] !== l.place ? (v = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(UiActions_default, {
15
+ actions: g,
16
+ availableTransitions: h,
17
17
  currentPlace: l.place,
18
- disabled: g,
18
+ disabled: _,
19
+ isLoading: d,
19
20
  onSubmit: u
20
- }) }), s[2] = m, s[3] = u, s[4] = h, s[5] = g, s[6] = l.place, s[7] = _) : _ = s[7], _;
21
+ }) }), s[2] = h, s[3] = d, s[4] = u, s[5] = g, s[6] = _, s[7] = l.place, s[8] = v) : v = s[8], v;
21
22
  };
22
23
  function _temp(e) {
23
24
  return e.id;
@@ -7,7 +7,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { ChevronRight, Clock, Loader2, Play } from "lucide-react";
8
8
  import { format } from "date-fns";
9
9
  var WorkflowHistoryItem_default = (m) => {
10
- let h = c(19), { workflowId: g, workflow: _ } = m, v = useWorkflowCheckpoints(g), y = v.data;
10
+ let h = c(17), { workflowId: g, workflow: _ } = m, v = useWorkflowCheckpoints(g), y = v.data;
11
11
  if (v.isLoading) {
12
12
  let e;
13
13
  return h[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("li", {
@@ -24,7 +24,7 @@ var WorkflowHistoryItem_default = (m) => {
24
24
  if (!y?.length) return null;
25
25
  let b;
26
26
  h[1] === Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ jsx(Play, { className: "text-primary h-3.5 w-3.5 fill-current" }), h[1] = b) : b = h[1];
27
- let x = _.title ?? _.alias, S;
27
+ let x = _.title ?? _.workflowName, S;
28
28
  h[2] === x ? S = h[3] : (S = /* @__PURE__ */ jsx("span", {
29
29
  className: "truncate text-sm",
30
30
  children: x
@@ -44,27 +44,11 @@ var WorkflowHistoryItem_default = (m) => {
44
44
  })
45
45
  }), h[5] = S, h[6] = w);
46
46
  let T;
47
- h[7] === Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ jsx("div", { className: "from-primary/60 via-primary/30 to-muted/20 absolute top-7 bottom-3 left-1.75 w-0.5 rounded-full bg-linear-to-b" }), h[7] = T) : T = h[7];
47
+ h[7] === Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ jsx("div", { className: "from-primary/60 via-primary/30 to-muted/20 absolute top-3 bottom-3 left-1.75 w-0.5 rounded-full bg-linear-to-b" }), h[7] = T) : T = h[7];
48
48
  let E;
49
- h[8] === Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ jsx("div", {
50
- className: "relative z-10 flex shrink-0 items-center justify-center",
51
- children: /* @__PURE__ */ jsx("div", { className: "border-primary/60 bg-primary/20 flex h-4 w-4 items-center justify-center rounded-full border-2" })
52
- }), h[8] = E) : E = h[8];
53
- let D;
54
- h[9] === Symbol.for("react.memo_cache_sentinel") ? (D = /* @__PURE__ */ jsxs("div", {
55
- className: "group/entry relative flex gap-3 py-1 pl-0",
56
- children: [E, /* @__PURE__ */ jsx("div", {
57
- className: "flex min-w-0 flex-1 items-center gap-1.5",
58
- children: /* @__PURE__ */ jsx("span", {
59
- className: "bg-muted text-foreground w-fit truncate rounded px-1.5 py-0.5 font-mono text-xs font-medium",
60
- children: "start"
61
- })
62
- })]
63
- }), h[9] = D) : D = h[9];
64
- let O;
65
- if (h[10] !== y) {
49
+ if (h[8] !== y) {
66
50
  let e;
67
- h[12] === y.length ? e = h[13] : (e = (e, u) => {
51
+ h[10] === y.length ? e = h[11] : (e = (e, u) => {
68
52
  let d = u === y.length - 1, f = e.place ?? "unknown", p = e.transitionId;
69
53
  return /* @__PURE__ */ jsxs("div", {
70
54
  className: "group/entry relative flex gap-3 py-1 pl-0",
@@ -100,29 +84,25 @@ var WorkflowHistoryItem_default = (m) => {
100
84
  })
101
85
  })]
102
86
  })]
103
- }, e.version);
104
- }, h[12] = y.length, h[13] = e), O = y.map(e), h[10] = y, h[11] = O;
105
- } else O = h[11];
106
- let k;
107
- h[14] === O ? k = h[15] : (k = /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("ul", {
87
+ }, e.id);
88
+ }, h[10] = y.length, h[11] = e), E = y.map(e), h[8] = y, h[9] = E;
89
+ } else E = h[9];
90
+ let D;
91
+ h[12] === E ? D = h[13] : (D = /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("ul", {
108
92
  className: "ml-2 flex min-w-0 flex-col gap-1 pl-0",
109
93
  children: /* @__PURE__ */ jsxs("div", {
110
94
  className: "relative py-2",
111
- children: [
112
- T,
113
- D,
114
- O
115
- ]
95
+ children: [T, E]
116
96
  })
117
- }) }), h[14] = O, h[15] = k);
118
- let A;
119
- return h[16] !== k || h[17] !== w ? (A = /* @__PURE__ */ jsx(Collapsible, {
97
+ }) }), h[12] = E, h[13] = D);
98
+ let O;
99
+ return h[14] !== w || h[15] !== D ? (O = /* @__PURE__ */ jsx(Collapsible, {
120
100
  defaultOpen: !0,
121
101
  className: "group/collapsible",
122
102
  children: /* @__PURE__ */ jsxs("li", {
123
103
  className: "group/menu-item relative list-none",
124
- children: [w, k]
104
+ children: [w, D]
125
105
  })
126
- }), h[16] = k, h[17] = w, h[18] = A) : A = h[18], A;
106
+ }), h[14] = w, h[15] = D, h[16] = O) : O = h[16], O;
127
107
  };
128
108
  export { WorkflowHistoryItem_default as default };
@@ -5,47 +5,49 @@ import React, { useMemo } from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { Clock, Loader2 } from "lucide-react";
7
7
  var WorkflowHistoryList_default = (s) => {
8
- let l = c(10), { workflow: u } = s, d = useChildWorkflows(u?.id), f;
8
+ let l = c(13), { workflow: u } = s, d = useChildWorkflows(u?.id), f;
9
9
  l[0] === d.data ? f = l[1] : (f = d.data ?? [], l[0] = d.data, l[1] = f);
10
- let p = f;
10
+ let p = f, m;
11
+ l[2] !== p || l[3] !== u ? (m = u ? [u, ...p] : p, l[2] = p, l[3] = u, l[4] = m) : m = l[4];
12
+ let h = m;
11
13
  if (!u) {
12
14
  let e;
13
- return l[2] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("div", {
15
+ return l[5] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("div", {
14
16
  className: "text-muted-foreground flex items-center justify-center py-8 text-sm",
15
17
  children: "No workflow selected"
16
- }), l[2] = e) : e = l[2], e;
18
+ }), l[5] = e) : e = l[5], e;
17
19
  }
18
20
  if (d.isLoading) {
19
21
  let e;
20
- return l[3] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("div", {
22
+ return l[6] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("div", {
21
23
  className: "flex items-center justify-center py-8",
22
24
  children: /* @__PURE__ */ jsx(Loader2, { className: "text-muted-foreground h-5 w-5 animate-spin" })
23
- }), l[3] = e) : e = l[3], e;
25
+ }), l[6] = e) : e = l[6], e;
24
26
  }
25
27
  if (d.error) {
26
28
  let e;
27
- return l[4] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("div", {
29
+ return l[7] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("div", {
28
30
  className: "text-destructive px-2 py-4 text-sm",
29
31
  children: "Failed to load history"
30
- }), l[4] = e) : e = l[4], e;
32
+ }), l[7] = e) : e = l[7], e;
31
33
  }
32
- if (p.length === 0) {
34
+ if (h.length === 0) {
33
35
  let e;
34
- return l[5] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsxs("div", {
36
+ return l[8] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsxs("div", {
35
37
  className: "text-muted-foreground flex flex-col items-center justify-center gap-2 py-8",
36
38
  children: [/* @__PURE__ */ jsx(Clock, { className: "h-6 w-6" }), /* @__PURE__ */ jsx("span", {
37
39
  className: "text-sm",
38
40
  children: "No workflow history"
39
41
  })]
40
- }), l[5] = e) : e = l[5], e;
42
+ }), l[8] = e) : e = l[8], e;
41
43
  }
42
- let m;
43
- l[6] === p ? m = l[7] : (m = p.map(_temp), l[6] = p, l[7] = m);
44
- let h;
45
- return l[8] === m ? h = l[9] : (h = /* @__PURE__ */ jsx("div", {
44
+ let g;
45
+ l[9] === h ? g = l[10] : (g = h.map(_temp), l[9] = h, l[10] = g);
46
+ let _;
47
+ return l[11] === g ? _ = l[12] : (_ = /* @__PURE__ */ jsx("div", {
46
48
  className: "flex flex-col gap-1 py-2",
47
- children: m
48
- }), l[8] = m, l[9] = h), h;
49
+ children: g
50
+ }), l[11] = g, l[12] = _), _;
49
51
  };
50
52
  function _temp(e) {
51
53
  return /* @__PURE__ */ jsx(WorkflowHistoryItem_default, {
@@ -10,9 +10,9 @@ import { jsx, jsxs } from "react/jsx-runtime";
10
10
  import { LockOpen, Repeat } from "lucide-react";
11
11
  var WorkflowButtons_default = (T) => {
12
12
  let E = c(34), { workflow: D, workflowId: O } = T, { router: k } = useStudio(), A = useWorkflow(O).data, j = useCreateWorkflow(), M = useRunWorkflow(), N = j.isPending || M.isPending, P;
13
- E[0] !== j || E[1] !== k || E[2] !== M || E[3] !== D.alias || E[4] !== D.args || E[5] !== D.workspaceId ? (P = () => {
13
+ E[0] !== j || E[1] !== k || E[2] !== M || E[3] !== D.args || E[4] !== D.workflowName || E[5] !== D.workspaceId ? (P = () => {
14
14
  j.mutate({ workflowCreateDto: {
15
- alias: D.alias,
15
+ workflowName: D.workflowName,
16
16
  title: null,
17
17
  workspaceId: D.workspaceId,
18
18
  transition: null,
@@ -26,7 +26,7 @@ var WorkflowButtons_default = (T) => {
26
26
  k.navigateToWorkflow(t.id);
27
27
  } });
28
28
  } });
29
- }, E[0] = j, E[1] = k, E[2] = M, E[3] = D.alias, E[4] = D.args, E[5] = D.workspaceId, E[6] = P) : P = E[6];
29
+ }, E[0] = j, E[1] = k, E[2] = M, E[3] = D.args, E[4] = D.workflowName, E[5] = D.workspaceId, E[6] = P) : P = E[6];
30
30
  let F = P, I;
31
31
  E[7] !== M || E[8] !== D.id || E[9] !== O ? (I = () => {
32
32
  M.mutate({
@@ -0,0 +1,159 @@
1
+ import { SseClientEvents } from "../../../events/sse-client-events.js";
2
+ import { eventBus } from "../../../services/eventEmitter.js";
3
+ import "../../../services/index.js";
4
+ import { useEffect, useMemo, useRef, useState } from "react";
5
+ var WORD_DRAIN_INTERVAL_MS = 35;
6
+ function takeNextWord(e) {
7
+ let r = e.match(/^(\s*\S+\s*)/)?.[0] ?? e.slice(0, 1);
8
+ return {
9
+ word: r,
10
+ remaining: e.slice(r.length)
11
+ };
12
+ }
13
+ function createStreamingDocument(e, r, i) {
14
+ let a = [];
15
+ i.thinking && a.push({
16
+ type: "thinking",
17
+ text: i.thinking
18
+ }), a.push({
19
+ type: "text",
20
+ text: i.error ? `Error while streaming response: ${i.error}` : i.text
21
+ }), a.push(...i.toolCalls);
22
+ let o = /* @__PURE__ */ new Date();
23
+ return {
24
+ id: `streaming-${i.messageId}`,
25
+ documentName: "llm_message",
26
+ content: {
27
+ id: i.messageId,
28
+ role: "assistant",
29
+ content: a
30
+ },
31
+ validationError: null,
32
+ meta: {
33
+ streaming: !i.readyForFinal && !i.error,
34
+ streamReadyForFinal: i.readyForFinal
35
+ },
36
+ isInvalidated: !1,
37
+ index: 2 ** 53 - 1,
38
+ transition: null,
39
+ place: r,
40
+ labels: [],
41
+ tags: ["message"],
42
+ createdAt: o,
43
+ updatedAt: o,
44
+ workspaceId: "",
45
+ workflowId: e
46
+ };
47
+ }
48
+ function useLlmStreamingDocuments(l, u) {
49
+ let [d, f] = useState({}), p = useRef({}), m = useRef(null);
50
+ return useEffect(() => {
51
+ function i() {
52
+ m.current === null && (m.current = window.setTimeout(() => {
53
+ m.current = null, a();
54
+ }, WORD_DRAIN_INTERVAL_MS));
55
+ }
56
+ function a(e) {
57
+ let r = Object.entries(p.current).filter(([r]) => !e || r === e);
58
+ if (!r.length) return;
59
+ let a = {};
60
+ for (let [e, i] of r) {
61
+ if (a[e] = {
62
+ text: "",
63
+ thinking: ""
64
+ }, i.thinking) {
65
+ let r = takeNextWord(i.thinking);
66
+ a[e].thinking = r.word, i.thinking = r.remaining;
67
+ } else if (i.text) {
68
+ let r = takeNextWord(i.text);
69
+ a[e].text = r.word, i.text = r.remaining;
70
+ }
71
+ !i.text && !i.thinking && delete p.current[e];
72
+ }
73
+ let o = Object.values(p.current).some((e) => e.text || e.thinking);
74
+ f((e) => {
75
+ let r = { ...e };
76
+ for (let [e, i] of Object.entries(a)) {
77
+ let a = r[e] ?? {
78
+ messageId: e,
79
+ text: "",
80
+ thinking: "",
81
+ toolCalls: [],
82
+ completed: !1,
83
+ readyForFinal: !1
84
+ }, o = !p.current[e]?.text && !p.current[e]?.thinking;
85
+ r[e] = {
86
+ ...a,
87
+ text: a.text + i.text,
88
+ thinking: a.thinking + i.thinking,
89
+ readyForFinal: a.completed && o
90
+ };
91
+ }
92
+ return r;
93
+ }), o && i();
94
+ }
95
+ function o(e, r) {
96
+ if (e.workflowId !== l || !e.messageId || !e.delta) return;
97
+ let a = p.current[e.messageId] ?? {
98
+ text: "",
99
+ thinking: ""
100
+ };
101
+ a[r] += e.delta, p.current[e.messageId] = a, i();
102
+ }
103
+ function s(e, r) {
104
+ e.workflowId !== l || !e.messageId || f((i) => ({
105
+ ...i,
106
+ [e.messageId]: r(i[e.messageId] ?? {
107
+ messageId: e.messageId,
108
+ text: "",
109
+ thinking: "",
110
+ toolCalls: [],
111
+ completed: !1,
112
+ readyForFinal: !1
113
+ })
114
+ }));
115
+ }
116
+ let c = eventBus.on(SseClientEvents.LLM_RESPONSE_START, (e) => {
117
+ s(e, (e) => ({
118
+ ...e,
119
+ completed: !1,
120
+ readyForFinal: !1,
121
+ error: void 0
122
+ }));
123
+ }), u = eventBus.on(SseClientEvents.LLM_RESPONSE_TEXT_DELTA, (e) => {
124
+ o(e, "text");
125
+ }), d = eventBus.on(SseClientEvents.LLM_RESPONSE_THINKING_DELTA, (e) => {
126
+ o(e, "thinking");
127
+ }), h = eventBus.on(SseClientEvents.LLM_RESPONSE_TOOL_CALL, (e) => {
128
+ s(e, (r) => ({
129
+ ...r,
130
+ toolCalls: e.id ? [...r.toolCalls, {
131
+ type: "tool_call",
132
+ id: e.id,
133
+ name: e.name ?? "tool",
134
+ args: e.args ?? {}
135
+ }] : r.toolCalls
136
+ }));
137
+ }), g = eventBus.on(SseClientEvents.LLM_RESPONSE_DONE, (e) => {
138
+ s(e, (r) => ({
139
+ ...r,
140
+ completed: !0,
141
+ readyForFinal: !e.messageId || !p.current[e.messageId]
142
+ }));
143
+ }), _ = eventBus.on(SseClientEvents.LLM_RESPONSE_ERROR, (e) => {
144
+ s(e, (r) => ({
145
+ ...r,
146
+ completed: !0,
147
+ error: e.error ?? "Unknown error"
148
+ }));
149
+ });
150
+ return () => {
151
+ c(), u(), d(), h(), g(), _(), m.current !== null && (window.clearTimeout(m.current), m.current = null), p.current = {};
152
+ };
153
+ }, [l]), useMemo(() => Object.values(d).map((e) => createStreamingDocument(l, u ?? "", e)), [
154
+ u,
155
+ d,
156
+ l
157
+ ]);
158
+ }
159
+ export { useLlmStreamingDocuments };
@@ -1,49 +1,76 @@
1
+ import { useDocumentConfigs } from "../../../hooks/useConfig.js";
1
2
  import { useWorkflow } from "../../../hooks/useWorkflows.js";
2
3
  import { WorkflowState } from "../../../packages/contracts/dist/enums/workflow-state.enum.js";
3
4
  import "../../../packages/contracts/dist/enums/index.js";
4
5
  import { useRunWorkflow } from "../../../hooks/useProcessor.js";
5
6
  import { useFilterDocuments } from "../../../hooks/useDocuments.js";
7
+ import { useLlmStreamingDocuments } from "./useLlmStreamingDocuments.js";
6
8
  import { c } from "react/compiler-runtime";
7
9
  import { useCallback, useMemo } from "react";
8
- function useWorkflowData(a) {
9
- let o = c(21), { workflowId: s, showFullMessageHistory: l } = a, u = useWorkflow(s), d = useFilterDocuments(s), f = useRunWorkflow(), p;
10
- o[0] !== u.data?.place || o[1] !== l ? (p = (e) => {
11
- let n = e.meta, r = e.ui, i = n?.hidden || r?.hidden || !!n?.hideAtPlaces?.includes(u.data?.place ?? "");
12
- return !l && e.tags?.includes("internal") && (i = !0), !i;
13
- }, o[0] = u.data?.place, o[1] = l, o[2] = p) : p = o[2];
14
- let m = p, h;
10
+ function getLlmMessageId(e) {
11
+ let s = e.content;
12
+ return e.documentName === "llm_message" && typeof s?.id == "string" ? s.id : void 0;
13
+ }
14
+ function isStreamReadyForFinal(e) {
15
+ return !!e.meta?.streamReadyForFinal;
16
+ }
17
+ function useWorkflowData(p) {
18
+ let m = c(22), { workflowId: h, showFullMessageHistory: g } = p, _ = useWorkflow(h), v = useFilterDocuments(h), y = useRunWorkflow(), b = useLlmStreamingDocuments(h, _.data?.place), x = useDocumentConfigs(), S;
19
+ m[0] !== x || m[1] !== _.data?.place || m[2] !== g ? (S = (e) => {
20
+ let s = x.get(e.documentName)?.meta, l = s?.hidden || !!s?.hideAtPlaces?.includes(_.data?.place ?? "");
21
+ return !g && e.tags?.includes("internal") && (l = !0), !l;
22
+ }, m[0] = x, m[1] = _.data?.place, m[2] = g, m[3] = S) : S = m[3];
23
+ let C = S, w;
15
24
  bb0: {
16
- if (!d.data) {
17
- let e;
18
- o[3] === Symbol.for("react.memo_cache_sentinel") ? (e = [], o[3] = e) : e = o[3], h = e;
25
+ if (!v.data) {
26
+ w = b;
19
27
  break bb0;
20
28
  }
21
29
  let e;
22
- o[4] !== d.data || o[5] !== m ? (e = d.data.filter(m), o[4] = d.data, o[5] = m, o[6] = e) : e = o[6], h = e;
30
+ if (m[4] !== v.data || m[5] !== C || m[6] !== b) {
31
+ let s = v.data.filter(C), l = new Map(b.map(_temp).filter(_temp2)), u = s.filter((e) => {
32
+ let s = getLlmMessageId(e), u = s ? l.get(s) : void 0;
33
+ return !u || isStreamReadyForFinal(u);
34
+ }), d = new Set(u.map(getLlmMessageId).filter(_temp3)), f = b.filter((e) => {
35
+ let s = getLlmMessageId(e);
36
+ return !s || !d.has(s);
37
+ });
38
+ e = [...u, ...f], m[4] = v.data, m[5] = C, m[6] = b, m[7] = e;
39
+ } else e = m[7];
40
+ w = e;
23
41
  }
24
- let g = h, _;
25
- o[7] !== f || o[8] !== s ? (_ = (e, n) => {
26
- f.mutate({
27
- workflowId: s,
42
+ let T = w, E;
43
+ m[8] !== y || m[9] !== h ? (E = (e, s) => {
44
+ y.mutate({
45
+ workflowId: h,
28
46
  runWorkflowPayloadDto: { transition: {
29
47
  id: e,
30
- workflowId: s,
31
- payload: n
48
+ workflowId: h,
49
+ payload: s
32
50
  } }
33
51
  });
34
- }, o[7] = f, o[8] = s, o[9] = _) : _ = o[9];
35
- let v = _, y = f.isPending || u.data?.status === WorkflowState.Running, b = u.data?.errorMessage, x;
36
- return o[10] !== g || o[11] !== d.error || o[12] !== d.isLoading || o[13] !== d.isSuccess || o[14] !== u.data || o[15] !== u.isLoading || o[16] !== u.isSuccess || o[17] !== v || o[18] !== y || o[19] !== b ? (x = {
37
- workflow: u.data,
38
- workflowLoading: u.isLoading,
39
- workflowReady: u.isSuccess,
40
- workflowError: b,
41
- documents: g,
42
- documentsLoading: d.isLoading,
43
- documentsReady: d.isSuccess,
44
- documentsError: d.error,
45
- isLoading: y,
46
- handleRun: v
47
- }, o[10] = g, o[11] = d.error, o[12] = d.isLoading, o[13] = d.isSuccess, o[14] = u.data, o[15] = u.isLoading, o[16] = u.isSuccess, o[17] = v, o[18] = y, o[19] = b, o[20] = x) : x = o[20], x;
52
+ }, m[8] = y, m[9] = h, m[10] = E) : E = m[10];
53
+ let D = E, O = y.isPending || _.data?.status === WorkflowState.Running, k = _.data?.errorMessage, A;
54
+ return m[11] !== T || m[12] !== v.error || m[13] !== v.isLoading || m[14] !== v.isSuccess || m[15] !== _.data || m[16] !== _.isLoading || m[17] !== _.isSuccess || m[18] !== D || m[19] !== O || m[20] !== k ? (A = {
55
+ workflow: _.data,
56
+ workflowLoading: _.isLoading,
57
+ workflowReady: _.isSuccess,
58
+ workflowError: k,
59
+ documents: T,
60
+ documentsLoading: v.isLoading,
61
+ documentsReady: v.isSuccess,
62
+ documentsError: v.error,
63
+ isLoading: O,
64
+ handleRun: D
65
+ }, m[11] = T, m[12] = v.error, m[13] = v.isLoading, m[14] = v.isSuccess, m[15] = _.data, m[16] = _.isLoading, m[17] = _.isSuccess, m[18] = D, m[19] = O, m[20] = k, m[21] = A) : A = m[21], A;
66
+ }
67
+ function _temp3(e) {
68
+ return !!e;
69
+ }
70
+ function _temp2(e) {
71
+ return !!e[0];
72
+ }
73
+ function _temp(e) {
74
+ return [getLlmMessageId(e), e];
48
75
  }
49
76
  export { useWorkflowData };
@@ -1,12 +1,12 @@
1
- import { useWorkbenchLayout } from "./providers/WorkbenchLayoutProvider.js";
2
- import { WorkbenchSidebarShell } from "./components/WorkbenchSidebarShell.js";
3
1
  import WorkflowItem_default from "./WorkflowItem.js";
4
2
  import WorkflowHistoryList_default from "./components/WorkflowHistoryList.js";
5
3
  import WorkflowButtons_default from "./components/buttons/WorkflowButtons.js";
6
4
  import WorkflowList_default from "./WorkflowList.js";
5
+ import { useWorkbenchLayout } from "./providers/WorkbenchLayoutProvider.js";
7
6
  import Workbench from "./Workbench.js";
8
7
  import { NewRunDialog } from "./components/NewRunDialog.js";
9
8
  import "./hooks/useEmbedBridge.js";
10
9
  import "./components/PreviewWorkbench.js";
11
10
  import { RecentRunItem } from "./components/RecentRunItem.js";
12
11
  import "./components/PreviewEmptyState.js";
12
+ import { WorkbenchSidebarShell } from "./components/WorkbenchSidebarShell.js";