@loopstack/loopstack-studio 0.33.0 → 0.35.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 (146) hide show
  1. package/dist/app/EnvironmentEmbedRoot.js +17 -25
  2. package/dist/components/layout/StudioSidebar.js +34 -34
  3. package/dist/components/messages/CompletionMessagePaper.js +25 -29
  4. package/dist/events/api-client-events.js +13 -1
  5. package/dist/events/index.js +1 -0
  6. package/dist/features/code-explorer/components/FileTabsBarBase.js +1 -1
  7. package/dist/features/code-explorer/index.js +0 -3
  8. package/dist/features/dashboard/AppLauncher.js +111 -64
  9. package/dist/features/debug/components/WorkflowFlowViewer.js +2 -1
  10. package/dist/features/debug/components/workflow-flow/WorkflowGraph.js +2 -1
  11. package/dist/features/documents/DocumentRenderer.js +42 -42
  12. package/dist/features/documents/components/DocumentList.js +1 -1
  13. package/dist/features/documents/document-details/DocumentDetails.js +0 -5
  14. package/dist/features/documents/renderers/DocumentFormRenderer.js +13 -12
  15. package/dist/features/documents/renderers/LinkMessageRenderer.js +2 -1
  16. package/dist/features/documents/renderers/useDocumentTransition.js +3 -2
  17. package/dist/features/feature-registry/FeatureRegistryProvider.js +17 -18
  18. package/dist/features/feature-registry/available-features.js +3 -2
  19. package/dist/features/feature-registry/index.js +1 -1
  20. package/dist/features/file-explorer/components/FileExplorerPanel.js +64 -43
  21. package/dist/features/file-explorer/components/FileTabsBar.js +1 -1
  22. package/dist/features/file-explorer/components/FileTree.js +1 -1
  23. package/dist/features/file-explorer/file-explorer-feature.js +15 -7
  24. package/dist/features/file-explorer/hooks/useFileExplorer.js +41 -34
  25. package/dist/features/file-explorer/index.js +1 -1
  26. package/dist/features/file-explorer/providers/FileExplorerProvider.js +91 -89
  27. package/dist/features/git/components/WorkbenchGitPanel.js +7 -10
  28. package/dist/features/git/hooks/useGit.js +55 -57
  29. package/dist/features/health/LocalHealthCheck.js +46 -47
  30. package/dist/features/oauth/OAuthPromptRenderer.js +6 -5
  31. package/dist/features/runs/Runs.js +3 -2
  32. package/dist/features/secrets/components/WorkbenchSecretsPanel.js +1 -1
  33. package/dist/features/secrets/renderers/SecretInputRenderer.js +3 -2
  34. package/dist/features/workbench/Workbench.js +16 -16
  35. package/dist/features/workbench/WorkflowItem.js +5 -8
  36. package/dist/features/workbench/components/NewRunDialog.js +173 -171
  37. package/dist/features/workbench/components/PreviewEmptyState.js +1 -1
  38. package/dist/features/workbench/components/WorkbenchIconSidebar.js +1 -1
  39. package/dist/features/workbench/components/WorkbenchRunsPanel.js +2 -1
  40. package/dist/features/workbench/components/WorkbenchSidebarShell.js +3 -3
  41. package/dist/features/workbench/components/WorkflowForms.js +1 -1
  42. package/dist/features/workbench/components/WorkflowHistoryItem.js +2 -1
  43. package/dist/features/workbench/components/buttons/WorkflowButtons.js +8 -14
  44. package/dist/features/workbench/hooks/useLlmStreamingDocuments.js +65 -132
  45. package/dist/features/workbench/hooks/useWorkflowData.js +8 -6
  46. package/dist/features/workbench/index.js +1 -1
  47. package/dist/features/workspaces/Workspaces.js +5 -3
  48. package/dist/features/workspaces/components/CreateWorkspace.js +7 -5
  49. package/dist/features/workspaces/components/ExecutionTimeline.js +69 -65
  50. package/dist/features/workspaces/components/WorkflowRunForm.js +6 -4
  51. package/dist/features/workspaces/components/WorkspaceHomePage.js +1 -1
  52. package/dist/hooks/index.js +5 -5
  53. package/dist/hooks/useAuth.js +14 -53
  54. package/dist/hooks/useConfig.js +13 -37
  55. package/dist/hooks/useDocuments.js +5 -30
  56. package/dist/hooks/useEnvironments.js +34 -24
  57. package/dist/hooks/useProcessor.js +2 -31
  58. package/dist/hooks/useSecrets.js +71 -53
  59. package/dist/hooks/useWorkflows.js +43 -172
  60. package/dist/hooks/useWorkspaces.js +24 -130
  61. package/dist/index.d.ts +137 -481
  62. package/dist/index.js +15 -17
  63. package/dist/loopstack-studio.css +1 -1
  64. package/dist/packages/client/dist/client.js +35 -0
  65. package/dist/packages/client/dist/http.js +47 -0
  66. package/dist/packages/client/dist/index.js +15 -0
  67. package/dist/packages/client/dist/queries/query-keys.js +94 -0
  68. package/dist/packages/client/dist/queries/query-options.js +97 -0
  69. package/dist/packages/client/dist/resources/auth.js +10 -0
  70. package/dist/packages/client/dist/resources/config.js +11 -0
  71. package/dist/packages/client/dist/resources/dashboard.js +4 -0
  72. package/dist/packages/client/dist/resources/documents.js +7 -0
  73. package/dist/packages/client/dist/resources/processor.js +7 -0
  74. package/dist/packages/client/dist/resources/workflows.js +13 -0
  75. package/dist/packages/client/dist/resources/workspaces.js +12 -0
  76. package/dist/packages/client/dist/stream/invalidations.js +20 -0
  77. package/dist/packages/client/dist/stream/llm-reducer.js +65 -0
  78. package/dist/packages/client/dist/stream/sse-parser.js +40 -0
  79. package/dist/packages/client/dist/stream/stream.js +147 -0
  80. package/dist/packages/contracts/dist/events/client-message-base.schema.js +6 -0
  81. package/dist/packages/contracts/dist/events/client-message.schema.js +24 -0
  82. package/dist/packages/contracts/dist/events/index.js +6 -0
  83. package/dist/packages/contracts/dist/events/llm-events.schema.js +44 -0
  84. package/dist/packages/contracts/dist/events/stream-events.schema.js +4 -0
  85. package/dist/packages/contracts/dist/events/workflow-events.schema.js +20 -0
  86. package/dist/packages/contracts/dist/events/workspace-events.schema.js +5 -0
  87. package/dist/packages/contracts/dist/types/types/ui-message.type.js +39 -0
  88. package/dist/packages/react/dist/hooks/mutations.js +175 -0
  89. package/dist/packages/react/dist/hooks/queries.js +139 -0
  90. package/dist/packages/react/dist/hooks/use-live-invalidation.js +39 -0
  91. package/dist/packages/react/dist/hooks/use-llm-stream.js +18 -0
  92. package/dist/packages/react/dist/index.js +5 -0
  93. package/dist/packages/react/dist/provider.js +15 -0
  94. package/dist/pages/DashboardPage.js +2 -1
  95. package/dist/pages/DebugWorkflowDetailsPage.js +2 -1
  96. package/dist/pages/DebugWorkflowsPage.js +2 -1
  97. package/dist/pages/EmbedWorkbenchPage.js +50 -43
  98. package/dist/pages/PreviewWorkbenchPage.js +60 -59
  99. package/dist/pages/StudioLandingPage.js +1 -1
  100. package/dist/pages/WorkbenchPage.js +53 -47
  101. package/dist/pages/WorkflowDebugPage.js +3 -2
  102. package/dist/pages/WorkspacePage.js +42 -27
  103. package/dist/pages/WorkspaceRunsPage.js +36 -27
  104. package/dist/providers/LoopstackClientProvider.js +31 -0
  105. package/dist/services/createApiClient.js +9 -3
  106. package/dist/services/index.js +0 -1
  107. package/dist/services/reporting-fetch.js +13 -0
  108. package/package.json +4 -3
  109. package/dist/api/auth.js +0 -10
  110. package/dist/api/client.js +0 -13
  111. package/dist/api/config.js +0 -11
  112. package/dist/api/dashboard.js +0 -4
  113. package/dist/api/documents.js +0 -7
  114. package/dist/api/environments.js +0 -8
  115. package/dist/api/index.js +0 -28
  116. package/dist/api/processor.js +0 -7
  117. package/dist/api/secrets.js +0 -16
  118. package/dist/api/workflows.js +0 -15
  119. package/dist/api/workspaces.js +0 -12
  120. package/dist/events/sse-client-events.js +0 -13
  121. package/dist/features/code-explorer/CodeExplorer.js +0 -6
  122. package/dist/features/code-explorer/components/CodeExplorerTree.js +0 -6
  123. package/dist/features/code-explorer/components/FileTabsBar.js +0 -4
  124. package/dist/features/code-explorer/providers/CodeExplorerProvider.js +0 -5
  125. package/dist/features/file-explorer/api/files.js +0 -7
  126. package/dist/features/git/api/git.js +0 -9
  127. package/dist/hooks/query-keys.js +0 -145
  128. package/dist/hooks/useApi.js +0 -15
  129. package/dist/hooks/useFiles.js +0 -3
  130. package/dist/node_modules/lodash/_Symbol.js +0 -7
  131. package/dist/node_modules/lodash/_baseGetTag.js +0 -13
  132. package/dist/node_modules/lodash/_baseTrim.js +0 -11
  133. package/dist/node_modules/lodash/_freeGlobal.js +0 -6
  134. package/dist/node_modules/lodash/_getRawTag.js +0 -17
  135. package/dist/node_modules/lodash/_objectToString.js +0 -10
  136. package/dist/node_modules/lodash/_root.js +0 -8
  137. package/dist/node_modules/lodash/_trimmedEndIndex.js +0 -11
  138. package/dist/node_modules/lodash/debounce.js +0 -53
  139. package/dist/node_modules/lodash/isObject.js +0 -10
  140. package/dist/node_modules/lodash/isObjectLike.js +0 -9
  141. package/dist/node_modules/lodash/isSymbol.js +0 -12
  142. package/dist/node_modules/lodash/now.js +0 -10
  143. package/dist/node_modules/lodash/toNumber.js +0 -22
  144. package/dist/providers/InvalidationEventsProvider.js +0 -41
  145. package/dist/providers/SseProvider.js +0 -37
  146. package/dist/services/eventEmitter.js +0 -12
@@ -1,6 +1,6 @@
1
- import { useWorkbenchLayout } from "../providers/WorkbenchLayoutProvider.js";
2
1
  import { useFeatureRegistry } from "../../feature-registry/FeatureRegistryProvider.js";
3
2
  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(r) {
53
- let i = c(12), { children: o } = r, { activePanel: s, panelSize: p } = useWorkbenchLayout(), m = `${s ? CONTENT_WIDTH[p] : "w-full"} overflow-hidden`, h;
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;
54
54
  i[0] !== o || i[1] !== m ? (h = /* @__PURE__ */ jsx("div", {
55
55
  className: m,
56
56
  children: o
@@ -1,6 +1,6 @@
1
- import { useWorkflowConfigByName } from "../../../hooks/useWorkflows.js";
2
1
  import { WorkflowState } from "../../../packages/contracts/dist/enums/workflow-state.enum.js";
3
2
  import "../../../packages/contracts/dist/enums/index.js";
3
+ import { useWorkflowConfigByName } from "../../../hooks/useWorkflows.js";
4
4
  import UiActions_default from "../../../components/ui-widgets/UiActions.js";
5
5
  import { c } from "react/compiler-runtime";
6
6
  import React from "react";
@@ -1,4 +1,5 @@
1
- import { useWorkflowCheckpoints } from "../../../hooks/useWorkflows.js";
1
+ import { useWorkflowCheckpoints } from "../../../packages/react/dist/hooks/queries.js";
2
+ import "../../../hooks/useWorkflows.js";
2
3
  import { cn } from "../../../lib/utils.js";
3
4
  import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../components/ui/collapsible.js";
4
5
  import { c } from "react/compiler-runtime";
@@ -1,9 +1,11 @@
1
+ import { useWorkflow } from "../../../../packages/react/dist/hooks/queries.js";
2
+ import { useCreateWorkflow, useRunWorkflow } from "../../../../packages/react/dist/hooks/mutations.js";
3
+ import "../../../../hooks/useWorkflows.js";
1
4
  import { useStudio } from "../../../../providers/StudioProvider.js";
2
- import { useCreateWorkflow, useWorkflow } from "../../../../hooks/useWorkflows.js";
3
5
  import { Button } from "../../../../components/ui/button.js";
4
6
  import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "../../../../components/ui/alert-dialog.js";
5
7
  import { Tooltip, TooltipContent, TooltipTrigger } from "../../../../components/ui/tooltip.js";
6
- import { useRunWorkflow } from "../../../../hooks/useProcessor.js";
8
+ import "../../../../hooks/useProcessor.js";
7
9
  import { c } from "react/compiler-runtime";
8
10
  import React from "react";
9
11
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -11,18 +13,14 @@ import { LockOpen, Repeat } from "lucide-react";
11
13
  var WorkflowButtons_default = (T) => {
12
14
  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
15
  E[0] !== j || E[1] !== k || E[2] !== M || E[3] !== D.args || E[4] !== D.workflowName || E[5] !== D.workspaceId ? (P = () => {
14
- j.mutate({ workflowCreateDto: {
16
+ j.mutate({
15
17
  workflowName: D.workflowName,
16
18
  title: null,
17
19
  workspaceId: D.workspaceId,
18
20
  transition: null,
19
21
  args: D.args ?? {}
20
- } }, { onSuccess: (t) => {
21
- M.mutate({
22
- workflowId: t.id,
23
- runWorkflowPayloadDto: {},
24
- force: !0
25
- }, { onSuccess: () => {
22
+ }, { onSuccess: (t) => {
23
+ M.mutate({ workflowId: t.id }, { onSuccess: () => {
26
24
  k.navigateToWorkflow(t.id);
27
25
  } });
28
26
  } });
@@ -31,11 +29,7 @@ var WorkflowButtons_default = (T) => {
31
29
  E[7] !== M || E[8] !== D.id || E[9] !== O ? (I = () => {
32
30
  M.mutate({
33
31
  workflowId: D.id,
34
- runWorkflowPayloadDto: { transition: {
35
- name: "unlock",
36
- workflowId: O
37
- } },
38
- force: !1
32
+ payload: { transition: { workflowId: O } }
39
33
  });
40
34
  }, E[7] = M, E[8] = D.id, E[9] = O, E[10] = I) : I = E[10];
41
35
  let L = I;
@@ -1,162 +1,95 @@
1
- import { SseClientEvents } from "../../../events/sse-client-events.js";
2
- import { eventBus } from "../../../services/eventEmitter.js";
3
- import "../../../services/index.js";
1
+ import { useLlmStream } from "../../../packages/react/dist/hooks/use-llm-stream.js";
2
+ import "../../../packages/react/dist/index.js";
3
+ import { c } from "react/compiler-runtime";
4
4
  import { useEffect, useMemo, useRef, useState } from "react";
5
5
  var WORD_DRAIN_INTERVAL_MS = 35;
6
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
- };
7
+ return e.match(/^(\s*\S+\s*)/)?.[0] ?? e.slice(0, 1);
12
8
  }
13
- function createStreamingDocument(e, r, i) {
14
- let a = [];
15
- i.thinking && a.push({
9
+ function isFullyRevealed(e, n) {
10
+ return (n?.text.length ?? 0) >= e.text.length && (n?.thinking.length ?? 0) >= e.thinking.length;
11
+ }
12
+ function createStreamingDocument(e, n, r, i) {
13
+ let a = r.completed && isFullyRevealed(r, i), o = [], s = i?.thinking ?? "";
14
+ s && o.push({
16
15
  type: "thinking",
17
- text: i.thinking
16
+ text: s
18
17
  });
19
- let o = i.error ? `Error while streaming response: ${i.error}` : i.text;
20
- a.push({
18
+ let l = r.error ? `Error while streaming response: ${r.error}` : i?.text ?? "";
19
+ o.push({
21
20
  type: "text",
22
- text: o
23
- }), a.push(...i.toolCalls);
24
- let s = /* @__PURE__ */ new Date();
21
+ text: l
22
+ }), o.push(...r.toolCalls.map((e) => ({
23
+ type: "tool_call",
24
+ ...e
25
+ })));
26
+ let u = (/* @__PURE__ */ new Date()).toISOString();
25
27
  return {
26
- id: `streaming-${i.messageId}`,
28
+ id: `streaming-${r.messageId}`,
27
29
  documentName: "llm_message",
28
30
  content: {
29
- id: i.messageId,
31
+ id: r.messageId,
30
32
  role: "assistant",
31
- text: o,
32
- blocks: a
33
+ text: l,
34
+ blocks: o
33
35
  },
34
36
  validationError: null,
35
37
  meta: {
36
- streaming: !i.readyForFinal && !i.error,
37
- streamReadyForFinal: i.readyForFinal
38
+ streaming: !a && !r.error,
39
+ streamReadyForFinal: a
38
40
  },
39
41
  isInvalidated: !1,
40
42
  index: 2 ** 53 - 1,
41
43
  transition: null,
42
- place: r,
44
+ place: n,
43
45
  labels: [],
44
46
  tags: ["message"],
45
- createdAt: s,
46
- updatedAt: s,
47
+ createdAt: u,
48
+ updatedAt: u,
47
49
  workspaceId: "",
48
50
  workflowId: e
49
51
  };
50
52
  }
51
- function useLlmStreamingDocuments(l, u) {
52
- let [d, f] = useState({}), p = useRef({}), m = useRef(null);
53
- return useEffect(() => {
54
- function i() {
55
- m.current === null && (m.current = window.setTimeout(() => {
56
- m.current = null, a();
57
- }, WORD_DRAIN_INTERVAL_MS));
58
- }
59
- function a(e) {
60
- let r = Object.entries(p.current).filter(([r]) => !e || r === e);
61
- if (!r.length) return;
62
- let a = {};
63
- for (let [e, i] of r) {
64
- if (a[e] = {
65
- text: "",
66
- thinking: ""
67
- }, i.thinking) {
68
- let r = takeNextWord(i.thinking);
69
- a[e].thinking = r.word, i.thinking = r.remaining;
70
- } else if (i.text) {
71
- let r = takeNextWord(i.text);
72
- a[e].text = r.word, i.text = r.remaining;
73
- }
74
- !i.text && !i.thinking && delete p.current[e];
75
- }
76
- let o = Object.values(p.current).some((e) => e.text || e.thinking);
77
- f((e) => {
78
- let r = { ...e };
79
- for (let [e, i] of Object.entries(a)) {
80
- let a = r[e] ?? {
81
- messageId: e,
53
+ function useLlmStreamingDocuments(i, d) {
54
+ let f = c(13), p = useLlmStream(i), m;
55
+ f[0] === Symbol.for("react.memo_cache_sentinel") ? (m = {}, f[0] = m) : m = f[0];
56
+ let [h, g] = useState(m), _ = useRef(null), v;
57
+ f[1] === Symbol.for("react.memo_cache_sentinel") ? (v = () => {
58
+ g({});
59
+ }, f[1] = v) : v = f[1];
60
+ let y;
61
+ f[2] === i ? y = f[3] : (y = [i], f[2] = i, f[3] = y), useEffect(v, y);
62
+ let b, x;
63
+ f[4] !== h || f[5] !== p ? (b = () => {
64
+ if (!(!Object.values(p).some((e) => !isFullyRevealed(e, h[e.messageId])) || _.current !== null)) return _.current = window.setTimeout(() => {
65
+ _.current = null, g((e) => {
66
+ let n = { ...e };
67
+ for (let e of Object.values(p)) {
68
+ let r = n[e.messageId] ?? {
82
69
  text: "",
83
- thinking: "",
84
- toolCalls: [],
85
- completed: !1,
86
- readyForFinal: !1
87
- }, o = !p.current[e]?.text && !p.current[e]?.thinking;
88
- r[e] = {
89
- ...a,
90
- text: a.text + i.text,
91
- thinking: a.thinking + i.thinking,
92
- readyForFinal: a.completed && o
70
+ thinking: ""
93
71
  };
72
+ if (r.thinking.length < e.thinking.length) {
73
+ let i = takeNextWord(e.thinking.slice(r.thinking.length));
74
+ n[e.messageId] = {
75
+ ...r,
76
+ thinking: r.thinking + i
77
+ };
78
+ } else if (r.text.length < e.text.length) {
79
+ let i = takeNextWord(e.text.slice(r.text.length));
80
+ n[e.messageId] = {
81
+ ...r,
82
+ text: r.text + i
83
+ };
84
+ }
94
85
  }
95
- return r;
96
- }), o && i();
97
- }
98
- function o(e, r) {
99
- if (e.workflowId !== l || !e.messageId || !e.delta) return;
100
- let a = p.current[e.messageId] ?? {
101
- text: "",
102
- thinking: ""
103
- };
104
- a[r] += e.delta, p.current[e.messageId] = a, i();
105
- }
106
- function s(e, r) {
107
- e.workflowId !== l || !e.messageId || f((i) => ({
108
- ...i,
109
- [e.messageId]: r(i[e.messageId] ?? {
110
- messageId: e.messageId,
111
- text: "",
112
- thinking: "",
113
- toolCalls: [],
114
- completed: !1,
115
- readyForFinal: !1
116
- })
117
- }));
118
- }
119
- let c = eventBus.on(SseClientEvents.LLM_RESPONSE_START, (e) => {
120
- s(e, (e) => ({
121
- ...e,
122
- completed: !1,
123
- readyForFinal: !1,
124
- error: void 0
125
- }));
126
- }), u = eventBus.on(SseClientEvents.LLM_RESPONSE_TEXT_DELTA, (e) => {
127
- o(e, "text");
128
- }), d = eventBus.on(SseClientEvents.LLM_RESPONSE_THINKING_DELTA, (e) => {
129
- o(e, "thinking");
130
- }), h = eventBus.on(SseClientEvents.LLM_RESPONSE_TOOL_CALL, (e) => {
131
- s(e, (r) => ({
132
- ...r,
133
- toolCalls: e.id ? [...r.toolCalls, {
134
- type: "tool_call",
135
- id: e.id,
136
- name: e.name ?? "tool",
137
- args: e.args ?? {}
138
- }] : r.toolCalls
139
- }));
140
- }), g = eventBus.on(SseClientEvents.LLM_RESPONSE_DONE, (e) => {
141
- s(e, (r) => ({
142
- ...r,
143
- completed: !0,
144
- readyForFinal: !e.messageId || !p.current[e.messageId]
145
- }));
146
- }), _ = eventBus.on(SseClientEvents.LLM_RESPONSE_ERROR, (e) => {
147
- s(e, (r) => ({
148
- ...r,
149
- completed: !0,
150
- error: e.error ?? "Unknown error"
151
- }));
152
- });
153
- return () => {
154
- c(), u(), d(), h(), g(), _(), m.current !== null && (window.clearTimeout(m.current), m.current = null), p.current = {};
86
+ return n;
87
+ });
88
+ }, WORD_DRAIN_INTERVAL_MS), () => {
89
+ _.current !== null && (window.clearTimeout(_.current), _.current = null);
155
90
  };
156
- }, [l]), useMemo(() => Object.values(d).map((e) => createStreamingDocument(l, u ?? "", e)), [
157
- u,
158
- d,
159
- l
160
- ]);
91
+ }, x = [p, h], f[4] = h, f[5] = p, f[6] = b, f[7] = x) : (b = f[6], x = f[7]), useEffect(b, x);
92
+ let S;
93
+ return f[8] !== d || f[9] !== h || f[10] !== p || f[11] !== i ? (S = Object.values(p).map((e) => createStreamingDocument(i, d ?? "", e, h[e.messageId])), f[8] = d, f[9] = h, f[10] = p, f[11] = i, f[12] = S) : S = f[12], S;
161
94
  }
162
95
  export { useLlmStreamingDocuments };
@@ -1,8 +1,10 @@
1
- import { useDocumentConfigs } from "../../../hooks/useConfig.js";
2
- import { useWorkflow } from "../../../hooks/useWorkflows.js";
1
+ import { useWorkflow } from "../../../packages/react/dist/hooks/queries.js";
3
2
  import { WorkflowState } from "../../../packages/contracts/dist/enums/workflow-state.enum.js";
4
3
  import "../../../packages/contracts/dist/enums/index.js";
5
- import { useRunWorkflow } from "../../../hooks/useProcessor.js";
4
+ import { useRunWorkflow } from "../../../packages/react/dist/hooks/mutations.js";
5
+ import { useDocumentConfigs } from "../../../hooks/useConfig.js";
6
+ import "../../../hooks/useWorkflows.js";
7
+ import "../../../hooks/useProcessor.js";
6
8
  import { useFilterDocuments } from "../../../hooks/useDocuments.js";
7
9
  import { useLlmStreamingDocuments } from "./useLlmStreamingDocuments.js";
8
10
  import { c } from "react/compiler-runtime";
@@ -17,8 +19,8 @@ function isStreamReadyForFinal(e) {
17
19
  function useWorkflowData(p) {
18
20
  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
21
  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
+ let s = !!(x.get(e.documentName)?.meta)?.hideAtPlaces?.includes(_.data?.place ?? "");
23
+ return !g && e.tags?.includes("internal") && (s = !0), !s;
22
24
  }, m[0] = x, m[1] = _.data?.place, m[2] = g, m[3] = S) : S = m[3];
23
25
  let C = S, w;
24
26
  bb0: {
@@ -43,7 +45,7 @@ function useWorkflowData(p) {
43
45
  m[8] !== y || m[9] !== h ? (E = (e, s) => {
44
46
  y.mutate({
45
47
  workflowId: h,
46
- runWorkflowPayloadDto: { transition: {
48
+ payload: { transition: {
47
49
  id: e,
48
50
  workflowId: h,
49
51
  payload: s
@@ -3,10 +3,10 @@ import WorkflowHistoryList_default from "./components/WorkflowHistoryList.js";
3
3
  import WorkflowButtons_default from "./components/buttons/WorkflowButtons.js";
4
4
  import WorkflowList_default from "./WorkflowList.js";
5
5
  import { useWorkbenchLayout } from "./providers/WorkbenchLayoutProvider.js";
6
+ import { WorkbenchSidebarShell } from "./components/WorkbenchSidebarShell.js";
6
7
  import Workbench from "./Workbench.js";
7
8
  import { NewRunDialog } from "./components/NewRunDialog.js";
8
9
  import "./hooks/useEmbedBridge.js";
9
10
  import "./components/PreviewWorkbench.js";
10
11
  import { RecentRunItem } from "./components/RecentRunItem.js";
11
12
  import "./components/PreviewEmptyState.js";
12
- import { WorkbenchSidebarShell } from "./components/WorkbenchSidebarShell.js";
@@ -1,13 +1,15 @@
1
+ import { useAppsConfig } from "../../packages/react/dist/hooks/queries.js";
2
+ import { useBatchDeleteWorkspaces, useDeleteWorkspace, useSetFavouriteWorkspace } from "../../packages/react/dist/hooks/mutations.js";
3
+ import "../../hooks/useConfig.js";
4
+ import { useFilterWorkspaces } from "../../hooks/useWorkspaces.js";
1
5
  import { useStudio } from "../../providers/StudioProvider.js";
2
- import { useAppsConfig } from "../../hooks/useConfig.js";
3
- import { useBatchDeleteWorkspaces, useDeleteWorkspace, useFilterWorkspaces, useSetFavouriteWorkspace } from "../../hooks/useWorkspaces.js";
4
6
  import { useComponentOverrides } from "../../providers/ComponentOverridesProvider.js";
5
7
  import { Badge } from "../../components/ui/badge.js";
6
8
  import { Dialog, DialogContent } from "../../components/ui/dialog.js";
7
9
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../components/ui/tooltip.js";
8
10
  import ListView_default from "../../components/lists/ListView.js";
9
- import CreateWorkspace_default from "./components/CreateWorkspace.js";
10
11
  import { useDebounce } from "../../hooks/useDebounce.js";
12
+ import CreateWorkspace_default from "./components/CreateWorkspace.js";
11
13
  import { c } from "react/compiler-runtime";
12
14
  import { useEffect, useMemo, useState } from "react";
13
15
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -1,6 +1,8 @@
1
- import { useAvailableEnvironments } from "../../../hooks/useConfig.js";
1
+ import { useAvailableEnvironments } from "../../../packages/react/dist/hooks/queries.js";
2
+ import { useCreateWorkspace, useUpdateWorkspace } from "../../../packages/react/dist/hooks/mutations.js";
3
+ import "../../../hooks/useConfig.js";
2
4
  import { useReplaceEnvironments, useWorkspaceEnvironments } from "../../../hooks/useEnvironments.js";
3
- import { useCreateWorkspace, useUpdateWorkspace } from "../../../hooks/useWorkspaces.js";
5
+ import "../../../hooks/useWorkspaces.js";
4
6
  import { Button } from "../../../components/ui/button.js";
5
7
  import { DialogHeader } from "../../../components/ui/dialog.js";
6
8
  import { Input } from "../../../components/ui/input.js";
@@ -101,7 +103,7 @@ var CreateWorkspace_default = (xe) => {
101
103
  let t = new FormData(e.currentTarget).get("name");
102
104
  !t || !s || d.mutate({
103
105
  id: s.id,
104
- workspaceUpdateDto: {
106
+ payload: {
105
107
  title: t,
106
108
  isFavourite: h
107
109
  }
@@ -113,11 +115,11 @@ var CreateWorkspace_default = (xe) => {
113
115
  a[38] !== u || a[39] !== h || a[40] !== l || a[41] !== P || a[42] !== m ? (I = (e) => {
114
116
  e.preventDefault();
115
117
  let t = new FormData(e.currentTarget).get("name");
116
- m && u.mutate({ workspaceCreateDto: {
118
+ m && u.mutate({
117
119
  title: t || void 0,
118
120
  appName: m,
119
121
  isFavourite: h || void 0
120
- } }, { onSuccess: async (e) => {
122
+ }, { onSuccess: async (e) => {
121
123
  await P(e.id), l(e);
122
124
  } });
123
125
  }, a[38] = u, a[39] = h, a[40] = l, a[41] = P, a[42] = m, a[43] = I) : I = a[43];
@@ -1,10 +1,14 @@
1
- import { useStudio } from "../../../providers/StudioProvider.js";
1
+ import { useLoopstackClient } from "../../../packages/react/dist/provider.js";
2
+ import { WorkflowState } from "../../../packages/contracts/dist/enums/workflow-state.enum.js";
3
+ import "../../../packages/contracts/dist/enums/index.js";
4
+ import { queryKeys } from "../../../packages/client/dist/queries/query-keys.js";
5
+ import "../../../packages/client/dist/index.js";
6
+ import "../../../packages/react/dist/index.js";
2
7
  import { useBatchDeleteWorkflows, useChildWorkflows, useFilterWorkflows } from "../../../hooks/useWorkflows.js";
8
+ import { useStudio } from "../../../providers/StudioProvider.js";
3
9
  import { Badge } from "../../../components/ui/badge.js";
4
10
  import CustomListView_default from "../../../components/lists/CustomListView.js";
5
11
  import ErrorSnackbar_default from "../../../components/feedback/ErrorSnackbar.js";
6
- import { WorkflowState } from "../../../packages/contracts/dist/enums/workflow-state.enum.js";
7
- import "../../../packages/contracts/dist/enums/index.js";
8
12
  import NewWorkflowRunDialog_default from "./NewWorkflowRunDialog.js";
9
13
  import { c } from "react/compiler-runtime";
10
14
  import React, { useEffect, useState } from "react";
@@ -13,31 +17,31 @@ import { useQueryClient } from "@tanstack/react-query";
13
17
  import { ChevronDown, ChevronRight, Loader2 } from "lucide-react";
14
18
  import { format, formatDistanceToNow, isToday, isYesterday, parseISO } from "date-fns";
15
19
  var ChildWorkflowList = (e) => {
16
- let n = c(15), { parentId: i, formatUpdatedTime: a, getWorkflowStateColor: o, onChildClick: s } = e, { data: l, isPending: u } = useChildWorkflows(i, !0);
17
- if (u) {
20
+ let t = c(15), { parentId: n, formatUpdatedTime: r, getWorkflowStateColor: a, onChildClick: o } = e, { data: s, isPending: l } = useChildWorkflows(n, !0);
21
+ if (l) {
18
22
  let e;
19
- return n[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("div", {
23
+ return t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("div", {
20
24
  className: "flex items-center py-2 pl-8",
21
25
  children: /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" })
22
- }), n[0] = e) : e = n[0], e;
26
+ }), t[0] = e) : e = t[0], e;
23
27
  }
24
- let d;
25
- n[1] === l ? d = n[2] : (d = l ?? [], n[1] = l, n[2] = d);
26
- let f = d;
27
- if (f.length === 0) {
28
+ let u;
29
+ t[1] === s ? u = t[2] : (u = s ?? [], t[1] = s, t[2] = u);
30
+ let d = u;
31
+ if (d.length === 0) {
28
32
  let e;
29
- return n[3] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("p", {
33
+ return t[3] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("p", {
30
34
  className: "py-1 pl-8 text-xs text-gray-400",
31
35
  children: "No child workflows"
32
- }), n[3] = e) : e = n[3], e;
36
+ }), t[3] = e) : e = t[3], e;
33
37
  }
34
- let p;
35
- if (n[4] !== f || n[5] !== a || n[6] !== o || n[7] !== s) {
38
+ let f;
39
+ if (t[4] !== d || t[5] !== r || t[6] !== a || t[7] !== o) {
36
40
  let e;
37
- n[9] !== a || n[10] !== o || n[11] !== s ? (e = (e) => /* @__PURE__ */ jsxs("div", {
41
+ t[9] !== r || t[10] !== a || t[11] !== o ? (e = (e) => /* @__PURE__ */ jsxs("div", {
38
42
  className: "hover:bg-muted/50 flex cursor-pointer items-center justify-between rounded px-2 py-1.5",
39
- onClick: (n) => {
40
- n.stopPropagation(), s(e.id);
43
+ onClick: (t) => {
44
+ t.stopPropagation(), o(e.id);
41
45
  },
42
46
  children: [/* @__PURE__ */ jsxs("div", { children: [
43
47
  /* @__PURE__ */ jsxs("p", {
@@ -55,59 +59,59 @@ var ChildWorkflowList = (e) => {
55
59
  }),
56
60
  /* @__PURE__ */ jsx("p", {
57
61
  className: "text-xs text-gray-400",
58
- children: a(e.updatedAt)
62
+ children: r(e.updatedAt)
59
63
  })
60
64
  ] }), /* @__PURE__ */ jsx(Badge, {
61
65
  variant: "default",
62
- className: o(e.status),
66
+ className: a(e.status),
63
67
  children: e.status
64
68
  })]
65
- }, e.id), n[9] = a, n[10] = o, n[11] = s, n[12] = e) : e = n[12], p = f.map(e), n[4] = f, n[5] = a, n[6] = o, n[7] = s, n[8] = p;
66
- } else p = n[8];
67
- let m;
68
- return n[13] === p ? m = n[14] : (m = /* @__PURE__ */ jsx("div", {
69
+ }, e.id), t[9] = r, t[10] = a, t[11] = o, t[12] = e) : e = t[12], f = d.map(e), t[4] = d, t[5] = r, t[6] = a, t[7] = o, t[8] = f;
70
+ } else f = t[8];
71
+ let p;
72
+ return t[13] === f ? p = t[14] : (p = /* @__PURE__ */ jsx("div", {
69
73
  className: "mt-4 border-t pt-3 pl-8",
70
- children: p
71
- }), n[13] = p, n[14] = m), m;
72
- }, ExecutionTimeline_default = (r) => {
73
- let s = c(40), { workspace: u } = r, { router: h } = useStudio(), g = useQueryClient(), [_, v] = useState(0), [y, b] = useState(25), [x, S] = useState(!1), C;
74
- s[0] === Symbol.for("react.memo_cache_sentinel") ? (C = /* @__PURE__ */ new Set(), s[0] = C) : C = s[0];
74
+ children: f
75
+ }), t[13] = f, t[14] = p), p;
76
+ }, ExecutionTimeline_default = (t) => {
77
+ let i = c(41), { workspace: d } = t, { router: m } = useStudio(), h = useQueryClient(), g = useLoopstackClient(), [_, v] = useState(0), [y, b] = useState(25), [x, S] = useState(!1), C;
78
+ i[0] === Symbol.for("react.memo_cache_sentinel") ? (C = /* @__PURE__ */ new Set(), i[0] = C) : C = i[0];
75
79
  let [w, T] = useState(C), E;
76
- s[1] === Symbol.for("react.memo_cache_sentinel") ? (E = (e, n) => {
77
- n.stopPropagation(), T((n) => {
78
- let r = new Set(n);
79
- return r.has(e) ? r.delete(e) : r.add(e), r;
80
+ i[1] === Symbol.for("react.memo_cache_sentinel") ? (E = (e, t) => {
81
+ t.stopPropagation(), T((t) => {
82
+ let n = new Set(t);
83
+ return n.has(e) ? n.delete(e) : n.add(e), n;
80
84
  });
81
- }, s[1] = E) : E = s[1];
85
+ }, i[1] = E) : E = i[1];
82
86
  let D = E, O, k;
83
- s[2] === g ? (O = s[3], k = s[4]) : (O = () => {
84
- g.invalidateQueries({ queryKey: ["workflows"] });
85
- }, k = [g], s[2] = g, s[3] = O, s[4] = k), useEffect(O, k);
87
+ i[2] !== g.envKey || i[3] !== h ? (O = () => {
88
+ h.invalidateQueries({ queryKey: queryKeys.workflows(g.envKey) });
89
+ }, k = [g.envKey, h], i[2] = g.envKey, i[3] = h, i[4] = O, i[5] = k) : (O = i[4], k = i[5]), useEffect(O, k);
86
90
  let A = _temp, j;
87
- s[5] === u.id ? j = s[6] : (j = {
88
- workspaceId: u.id,
91
+ i[6] === d.id ? j = i[7] : (j = {
92
+ workspaceId: d.id,
89
93
  parentId: null
90
- }, s[5] = u.id, s[6] = j);
94
+ }, i[6] = d.id, i[7] = j);
91
95
  let M = useFilterWorkflows(void 0, j, "createdAt", "DESC", _, y), N = useBatchDeleteWorkflows(), P;
92
- s[7] === N ? P = s[8] : (P = (e) => {
96
+ i[8] === N ? P = i[9] : (P = (e) => {
93
97
  N.mutate(e);
94
- }, s[7] = N, s[8] = P);
98
+ }, i[8] = N, i[9] = P);
95
99
  let F = P, I;
96
- s[9] === Symbol.for("react.memo_cache_sentinel") ? (I = () => {
100
+ i[10] === Symbol.for("react.memo_cache_sentinel") ? (I = () => {
97
101
  S(!0);
98
- }, s[9] = I) : I = s[9];
102
+ }, i[10] = I) : I = i[10];
99
103
  let L = I, R;
100
- s[10] === Symbol.for("react.memo_cache_sentinel") ? (R = () => {
104
+ i[11] === Symbol.for("react.memo_cache_sentinel") ? (R = () => {
101
105
  S(!1);
102
- }, s[10] = R) : R = s[10];
106
+ }, i[11] = R) : R = i[11];
103
107
  let z = R, B;
104
- s[11] === h ? B = s[12] : (B = (e) => {
105
- h.navigateToWorkflow(e);
106
- }, s[11] = h, s[12] = B);
108
+ i[12] === m ? B = i[13] : (B = (e) => {
109
+ m.navigateToWorkflow(e);
110
+ }, i[12] = m, i[13] = B);
107
111
  let V = B, H = _temp2, U;
108
- s[13] === M.data?.data ? U = s[14] : (U = M.data?.data ?? [], s[13] = M.data?.data, s[14] = U);
112
+ i[14] === M.data?.data ? U = i[15] : (U = M.data?.data ?? [], i[14] = M.data?.data, i[15] = U);
109
113
  let W = U, G = M.data?.total ?? 0, K;
110
- s[15] !== w || s[16] !== V ? (K = (e) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
114
+ i[16] !== w || i[17] !== V ? (K = (e) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
111
115
  className: "flex items-center justify-between space-x-3",
112
116
  children: [/* @__PURE__ */ jsxs("div", { children: [
113
117
  /* @__PURE__ */ jsxs("h3", {
@@ -124,7 +128,7 @@ var ChildWorkflowList = (e) => {
124
128
  children: e.workflowName
125
129
  }),
126
130
  e.hasChildren > 0 && /* @__PURE__ */ jsxs("button", {
127
- onClick: (n) => D(e.id, n),
131
+ onClick: (t) => D(e.id, t),
128
132
  className: "hover:bg-muted mt-2 flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-gray-400",
129
133
  children: [
130
134
  w.has(e.id) ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3" }),
@@ -149,16 +153,16 @@ var ChildWorkflowList = (e) => {
149
153
  formatUpdatedTime: A,
150
154
  getWorkflowStateColor: H,
151
155
  onChildClick: V
152
- })] }), s[15] = w, s[16] = V, s[17] = K) : K = s[17];
156
+ })] }), i[16] = w, i[17] = V, i[18] = K) : K = i[18];
153
157
  let q = K, J;
154
- s[18] === M.error ? J = s[19] : (J = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: M.error }), s[18] = M.error, s[19] = J);
158
+ i[19] === M.error ? J = i[20] : (J = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: M.error }), i[19] = M.error, i[20] = J);
155
159
  let Y;
156
- s[20] === M.isPending ? Y = s[21] : (Y = M.isPending ? /* @__PURE__ */ jsx("div", {
160
+ i[21] === M.isPending ? Y = i[22] : (Y = M.isPending ? /* @__PURE__ */ jsx("div", {
157
161
  className: "flex items-center justify-center py-8",
158
162
  children: /* @__PURE__ */ jsx(Loader2, { className: "h-8 w-8 animate-spin" })
159
- }) : "", s[20] = M.isPending, s[21] = Y);
163
+ }) : "", i[21] = M.isPending, i[22] = Y);
160
164
  let X = M.error ?? null, Z;
161
- s[22] !== M.isPending || s[23] !== F || s[24] !== V || s[25] !== _ || s[26] !== q || s[27] !== y || s[28] !== X || s[29] !== G || s[30] !== W ? (Z = /* @__PURE__ */ jsx(CustomListView_default, {
165
+ i[23] !== M.isPending || i[24] !== F || i[25] !== V || i[26] !== _ || i[27] !== q || i[28] !== y || i[29] !== X || i[30] !== G || i[31] !== W ? (Z = /* @__PURE__ */ jsx(CustomListView_default, {
162
166
  loading: M.isPending,
163
167
  error: X,
164
168
  items: W,
@@ -173,25 +177,25 @@ var ChildWorkflowList = (e) => {
173
177
  batchDelete: F,
174
178
  itemRenderer: q,
175
179
  newButtonLabel: "Run"
176
- }), s[22] = M.isPending, s[23] = F, s[24] = V, s[25] = _, s[26] = q, s[27] = y, s[28] = X, s[29] = G, s[30] = W, s[31] = Z) : Z = s[31];
180
+ }), i[23] = M.isPending, i[24] = F, i[25] = V, i[26] = _, i[27] = q, i[28] = y, i[29] = X, i[30] = G, i[31] = W, i[32] = Z) : Z = i[32];
177
181
  let Q;
178
- s[32] !== x || s[33] !== u ? (Q = /* @__PURE__ */ jsx(NewWorkflowRunDialog_default, {
182
+ i[33] !== x || i[34] !== d ? (Q = /* @__PURE__ */ jsx(NewWorkflowRunDialog_default, {
179
183
  isOpen: x,
180
184
  onOpenChange: S,
181
- workspace: u,
185
+ workspace: d,
182
186
  onSuccess: z
183
- }), s[32] = x, s[33] = u, s[34] = Q) : Q = s[34];
187
+ }), i[33] = x, i[34] = d, i[35] = Q) : Q = i[35];
184
188
  let $;
185
- return s[35] !== J || s[36] !== Y || s[37] !== Z || s[38] !== Q ? ($ = /* @__PURE__ */ jsxs("div", { children: [
189
+ return i[36] !== J || i[37] !== Y || i[38] !== Z || i[39] !== Q ? ($ = /* @__PURE__ */ jsxs("div", { children: [
186
190
  J,
187
191
  Y,
188
192
  Z,
189
193
  Q
190
- ] }), s[35] = J, s[36] = Y, s[37] = Z, s[38] = Q, s[39] = $) : $ = s[39], $;
194
+ ] }), i[36] = J, i[37] = Y, i[38] = Z, i[39] = Q, i[40] = $) : $ = i[40], $;
191
195
  };
192
196
  function _temp(e) {
193
- let n = parseISO(e);
194
- return isToday(n) ? formatDistanceToNow(n, { addSuffix: !0 }) : isYesterday(n) ? `Yesterday at ${format(n, "h:mm a")}` : format(n, "MMM d, yyyy h:mm a");
197
+ let t = parseISO(e);
198
+ return isToday(t) ? formatDistanceToNow(t, { addSuffix: !0 }) : isYesterday(t) ? `Yesterday at ${format(t, "h:mm a")}` : format(t, "MMM d, yyyy h:mm a");
195
199
  }
196
200
  function _temp2(e) {
197
201
  switch (e) {