@loopstack/loopstack-studio 0.34.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.
- package/dist/app/EnvironmentEmbedRoot.js +18 -24
- package/dist/components/layout/StudioSidebar.js +34 -34
- package/dist/events/api-client-events.js +13 -1
- package/dist/events/index.js +1 -0
- package/dist/features/code-explorer/components/FileTabsBarBase.js +1 -1
- package/dist/features/code-explorer/index.js +0 -3
- package/dist/features/dashboard/AppLauncher.js +1 -1
- package/dist/features/debug/components/WorkflowFlowViewer.js +2 -1
- package/dist/features/debug/components/workflow-flow/WorkflowGraph.js +2 -1
- package/dist/features/documents/components/DocumentList.js +1 -1
- package/dist/features/documents/document-details/DocumentDetails.js +0 -5
- package/dist/features/documents/renderers/DocumentFormRenderer.js +13 -12
- package/dist/features/documents/renderers/LinkMessageRenderer.js +2 -1
- package/dist/features/documents/renderers/useDocumentTransition.js +3 -2
- package/dist/features/feature-registry/FeatureRegistryProvider.js +2 -1
- package/dist/features/file-explorer/components/FileTabsBar.js +1 -1
- package/dist/features/file-explorer/components/FileTree.js +1 -1
- package/dist/features/file-explorer/hooks/useFileExplorer.js +36 -31
- package/dist/features/file-explorer/providers/FileExplorerProvider.js +94 -92
- package/dist/features/git/components/WorkbenchGitPanel.js +6 -9
- package/dist/features/git/hooks/useGit.js +55 -57
- package/dist/features/health/LocalHealthCheck.js +46 -47
- package/dist/features/oauth/OAuthPromptRenderer.js +6 -5
- package/dist/features/runs/Runs.js +3 -2
- package/dist/features/secrets/renderers/SecretInputRenderer.js +3 -2
- package/dist/features/workbench/WorkflowItem.js +5 -8
- package/dist/features/workbench/components/NewRunDialog.js +172 -170
- package/dist/features/workbench/components/PreviewEmptyState.js +1 -1
- package/dist/features/workbench/components/WorkbenchRunsPanel.js +2 -1
- package/dist/features/workbench/components/WorkflowForms.js +1 -1
- package/dist/features/workbench/components/WorkflowHistoryItem.js +2 -1
- package/dist/features/workbench/components/buttons/WorkflowButtons.js +8 -14
- package/dist/features/workbench/hooks/useLlmStreamingDocuments.js +65 -132
- package/dist/features/workbench/hooks/useWorkflowData.js +8 -6
- package/dist/features/workspaces/Workspaces.js +4 -2
- package/dist/features/workspaces/components/CreateWorkspace.js +7 -5
- package/dist/features/workspaces/components/ExecutionTimeline.js +69 -65
- package/dist/features/workspaces/components/WorkflowRunForm.js +6 -4
- package/dist/features/workspaces/components/WorkspaceHomePage.js +1 -1
- package/dist/hooks/index.js +5 -5
- package/dist/hooks/useAuth.js +14 -53
- package/dist/hooks/useConfig.js +13 -37
- package/dist/hooks/useDocuments.js +5 -30
- package/dist/hooks/useEnvironments.js +34 -24
- package/dist/hooks/useProcessor.js +2 -31
- package/dist/hooks/useSecrets.js +78 -24
- package/dist/hooks/useWorkflows.js +43 -172
- package/dist/hooks/useWorkspaces.js +24 -130
- package/dist/index.d.ts +130 -488
- package/dist/index.js +10 -12
- package/dist/packages/client/dist/client.js +35 -0
- package/dist/packages/client/dist/http.js +47 -0
- package/dist/packages/client/dist/index.js +15 -0
- package/dist/packages/client/dist/queries/query-keys.js +94 -0
- package/dist/packages/client/dist/queries/query-options.js +97 -0
- package/dist/packages/client/dist/resources/auth.js +10 -0
- package/dist/packages/client/dist/resources/config.js +11 -0
- package/dist/packages/client/dist/resources/dashboard.js +4 -0
- package/dist/packages/client/dist/resources/documents.js +7 -0
- package/dist/packages/client/dist/resources/processor.js +7 -0
- package/dist/packages/client/dist/resources/workflows.js +13 -0
- package/dist/packages/client/dist/resources/workspaces.js +12 -0
- package/dist/packages/client/dist/stream/invalidations.js +20 -0
- package/dist/packages/client/dist/stream/llm-reducer.js +65 -0
- package/dist/packages/client/dist/stream/sse-parser.js +40 -0
- package/dist/packages/client/dist/stream/stream.js +147 -0
- package/dist/packages/contracts/dist/events/client-message-base.schema.js +6 -0
- package/dist/packages/contracts/dist/events/client-message.schema.js +24 -0
- package/dist/packages/contracts/dist/events/index.js +6 -0
- package/dist/packages/contracts/dist/events/llm-events.schema.js +44 -0
- package/dist/packages/contracts/dist/events/stream-events.schema.js +4 -0
- package/dist/packages/contracts/dist/events/workflow-events.schema.js +20 -0
- package/dist/packages/contracts/dist/events/workspace-events.schema.js +5 -0
- package/dist/packages/contracts/dist/types/types/ui-message.type.js +39 -0
- package/dist/packages/react/dist/hooks/mutations.js +175 -0
- package/dist/packages/react/dist/hooks/queries.js +139 -0
- package/dist/packages/react/dist/hooks/use-live-invalidation.js +39 -0
- package/dist/packages/react/dist/hooks/use-llm-stream.js +18 -0
- package/dist/packages/react/dist/index.js +5 -0
- package/dist/packages/react/dist/provider.js +15 -0
- package/dist/pages/DashboardPage.js +2 -1
- package/dist/pages/DebugWorkflowDetailsPage.js +2 -1
- package/dist/pages/DebugWorkflowsPage.js +2 -1
- package/dist/pages/EmbedWorkbenchPage.js +5 -4
- package/dist/pages/PreviewWorkbenchPage.js +60 -59
- package/dist/pages/StudioLandingPage.js +1 -1
- package/dist/pages/WorkbenchPage.js +3 -2
- package/dist/pages/WorkflowDebugPage.js +3 -2
- package/dist/pages/WorkspacePage.js +3 -2
- package/dist/pages/WorkspaceRunsPage.js +2 -1
- package/dist/providers/LoopstackClientProvider.js +31 -0
- package/dist/services/createApiClient.js +9 -3
- package/dist/services/index.js +0 -1
- package/dist/services/reporting-fetch.js +13 -0
- package/package.json +4 -3
- package/dist/api/auth.js +0 -10
- package/dist/api/client.js +0 -13
- package/dist/api/config.js +0 -11
- package/dist/api/dashboard.js +0 -4
- package/dist/api/documents.js +0 -7
- package/dist/api/environments.js +0 -8
- package/dist/api/index.js +0 -31
- package/dist/api/processor.js +0 -7
- package/dist/api/secrets.js +0 -16
- package/dist/api/workflows.js +0 -15
- package/dist/api/workspaces.js +0 -12
- package/dist/events/sse-client-events.js +0 -15
- package/dist/features/code-explorer/CodeExplorer.js +0 -6
- package/dist/features/code-explorer/components/CodeExplorerTree.js +0 -6
- package/dist/features/code-explorer/components/FileTabsBar.js +0 -4
- package/dist/features/code-explorer/providers/CodeExplorerProvider.js +0 -5
- package/dist/features/file-explorer/api/files.js +0 -12
- package/dist/features/git/api/git.js +0 -9
- package/dist/hooks/query-keys.js +0 -145
- package/dist/hooks/useApi.js +0 -15
- package/dist/hooks/useFiles.js +0 -3
- package/dist/node_modules/lodash/_Symbol.js +0 -7
- package/dist/node_modules/lodash/_baseGetTag.js +0 -13
- package/dist/node_modules/lodash/_baseTrim.js +0 -11
- package/dist/node_modules/lodash/_freeGlobal.js +0 -6
- package/dist/node_modules/lodash/_getRawTag.js +0 -17
- package/dist/node_modules/lodash/_objectToString.js +0 -10
- package/dist/node_modules/lodash/_root.js +0 -8
- package/dist/node_modules/lodash/_trimmedEndIndex.js +0 -11
- package/dist/node_modules/lodash/debounce.js +0 -53
- package/dist/node_modules/lodash/isObject.js +0 -10
- package/dist/node_modules/lodash/isObjectLike.js +0 -9
- package/dist/node_modules/lodash/isSymbol.js +0 -12
- package/dist/node_modules/lodash/now.js +0 -10
- package/dist/node_modules/lodash/toNumber.js +0 -22
- package/dist/providers/InvalidationEventsProvider.js +0 -43
- package/dist/providers/SseProvider.js +0 -37
- package/dist/services/eventEmitter.js +0 -12
|
@@ -1,162 +1,95 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import "
|
|
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
|
-
|
|
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
|
|
14
|
-
|
|
15
|
-
|
|
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:
|
|
16
|
+
text: s
|
|
18
17
|
});
|
|
19
|
-
let
|
|
20
|
-
|
|
18
|
+
let l = r.error ? `Error while streaming response: ${r.error}` : i?.text ?? "";
|
|
19
|
+
o.push({
|
|
21
20
|
type: "text",
|
|
22
|
-
text:
|
|
23
|
-
}),
|
|
24
|
-
|
|
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-${
|
|
28
|
+
id: `streaming-${r.messageId}`,
|
|
27
29
|
documentName: "llm_message",
|
|
28
30
|
content: {
|
|
29
|
-
id:
|
|
31
|
+
id: r.messageId,
|
|
30
32
|
role: "assistant",
|
|
31
|
-
text:
|
|
32
|
-
blocks:
|
|
33
|
+
text: l,
|
|
34
|
+
blocks: o
|
|
33
35
|
},
|
|
34
36
|
validationError: null,
|
|
35
37
|
meta: {
|
|
36
|
-
streaming: !
|
|
37
|
-
streamReadyForFinal:
|
|
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:
|
|
44
|
+
place: n,
|
|
43
45
|
labels: [],
|
|
44
46
|
tags: ["message"],
|
|
45
|
-
createdAt:
|
|
46
|
-
updatedAt:
|
|
47
|
+
createdAt: u,
|
|
48
|
+
updatedAt: u,
|
|
47
49
|
workspaceId: "",
|
|
48
50
|
workflowId: e
|
|
49
51
|
};
|
|
50
52
|
}
|
|
51
|
-
function useLlmStreamingDocuments(
|
|
52
|
-
let
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
|
96
|
-
})
|
|
97
|
-
}
|
|
98
|
-
|
|
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
|
-
}, [
|
|
157
|
-
|
|
158
|
-
|
|
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 {
|
|
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/
|
|
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
|
|
21
|
-
return !g && e.tags?.includes("internal") && (
|
|
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
|
-
|
|
48
|
+
payload: { transition: {
|
|
47
49
|
id: e,
|
|
48
50
|
workflowId: h,
|
|
49
51
|
payload: s
|
|
@@ -1,6 +1,8 @@
|
|
|
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";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { useAvailableEnvironments } from "../../../hooks/
|
|
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
|
|
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
|
-
|
|
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({
|
|
118
|
+
m && u.mutate({
|
|
117
119
|
title: t || void 0,
|
|
118
120
|
appName: m,
|
|
119
121
|
isFavourite: h || void 0
|
|
120
|
-
}
|
|
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 {
|
|
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
|
|
17
|
-
if (
|
|
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
|
|
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
|
-
}),
|
|
26
|
+
}), t[0] = e) : e = t[0], e;
|
|
23
27
|
}
|
|
24
|
-
let
|
|
25
|
-
|
|
26
|
-
let
|
|
27
|
-
if (
|
|
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
|
|
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
|
-
}),
|
|
36
|
+
}), t[3] = e) : e = t[3], e;
|
|
33
37
|
}
|
|
34
|
-
let
|
|
35
|
-
if (
|
|
38
|
+
let f;
|
|
39
|
+
if (t[4] !== d || t[5] !== r || t[6] !== a || t[7] !== o) {
|
|
36
40
|
let e;
|
|
37
|
-
|
|
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: (
|
|
40
|
-
|
|
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:
|
|
62
|
+
children: r(e.updatedAt)
|
|
59
63
|
})
|
|
60
64
|
] }), /* @__PURE__ */ jsx(Badge, {
|
|
61
65
|
variant: "default",
|
|
62
|
-
className:
|
|
66
|
+
className: a(e.status),
|
|
63
67
|
children: e.status
|
|
64
68
|
})]
|
|
65
|
-
}, e.id),
|
|
66
|
-
} else
|
|
67
|
-
let
|
|
68
|
-
return
|
|
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:
|
|
71
|
-
}),
|
|
72
|
-
}, ExecutionTimeline_default = (
|
|
73
|
-
let
|
|
74
|
-
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
let
|
|
79
|
-
return
|
|
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
|
-
},
|
|
85
|
+
}, i[1] = E) : E = i[1];
|
|
82
86
|
let D = E, O, k;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}, k = [g],
|
|
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
|
-
|
|
88
|
-
workspaceId:
|
|
91
|
+
i[6] === d.id ? j = i[7] : (j = {
|
|
92
|
+
workspaceId: d.id,
|
|
89
93
|
parentId: null
|
|
90
|
-
},
|
|
94
|
+
}, i[6] = d.id, i[7] = j);
|
|
91
95
|
let M = useFilterWorkflows(void 0, j, "createdAt", "DESC", _, y), N = useBatchDeleteWorkflows(), P;
|
|
92
|
-
|
|
96
|
+
i[8] === N ? P = i[9] : (P = (e) => {
|
|
93
97
|
N.mutate(e);
|
|
94
|
-
},
|
|
98
|
+
}, i[8] = N, i[9] = P);
|
|
95
99
|
let F = P, I;
|
|
96
|
-
|
|
100
|
+
i[10] === Symbol.for("react.memo_cache_sentinel") ? (I = () => {
|
|
97
101
|
S(!0);
|
|
98
|
-
},
|
|
102
|
+
}, i[10] = I) : I = i[10];
|
|
99
103
|
let L = I, R;
|
|
100
|
-
|
|
104
|
+
i[11] === Symbol.for("react.memo_cache_sentinel") ? (R = () => {
|
|
101
105
|
S(!1);
|
|
102
|
-
},
|
|
106
|
+
}, i[11] = R) : R = i[11];
|
|
103
107
|
let z = R, B;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
},
|
|
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
|
-
|
|
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
|
-
|
|
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: (
|
|
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
|
-
})] }),
|
|
156
|
+
})] }), i[16] = w, i[17] = V, i[18] = K) : K = i[18];
|
|
153
157
|
let q = K, J;
|
|
154
|
-
|
|
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
|
-
|
|
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
|
-
}) : "",
|
|
163
|
+
}) : "", i[21] = M.isPending, i[22] = Y);
|
|
160
164
|
let X = M.error ?? null, Z;
|
|
161
|
-
|
|
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
|
-
}),
|
|
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
|
-
|
|
182
|
+
i[33] !== x || i[34] !== d ? (Q = /* @__PURE__ */ jsx(NewWorkflowRunDialog_default, {
|
|
179
183
|
isOpen: x,
|
|
180
184
|
onOpenChange: S,
|
|
181
|
-
workspace:
|
|
185
|
+
workspace: d,
|
|
182
186
|
onSuccess: z
|
|
183
|
-
}),
|
|
187
|
+
}), i[33] = x, i[34] = d, i[35] = Q) : Q = i[35];
|
|
184
188
|
let $;
|
|
185
|
-
return
|
|
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
|
-
] }),
|
|
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
|
|
194
|
-
return isToday(
|
|
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) {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { useAppsConfig } from "../../../packages/react/dist/hooks/queries.js";
|
|
2
|
+
import { useStartWorkflow } from "../../../packages/react/dist/hooks/mutations.js";
|
|
3
|
+
import "../../../hooks/useConfig.js";
|
|
1
4
|
import { useStudio } from "../../../providers/StudioProvider.js";
|
|
2
|
-
import { useAppsConfig } from "../../../hooks/useConfig.js";
|
|
3
5
|
import ErrorSnackbar_default from "../../../components/feedback/ErrorSnackbar.js";
|
|
4
|
-
import
|
|
6
|
+
import "../../../hooks/useProcessor.js";
|
|
5
7
|
import ArgumentsView_default from "./workflow-form/ArgumentsView.js";
|
|
6
8
|
import SelectionView_default from "./workflow-form/SelectionView.js";
|
|
7
9
|
import { c } from "react/compiler-runtime";
|
|
@@ -84,11 +86,11 @@ var WorkflowRunForm_default = (a) => {
|
|
|
84
86
|
}), !1), o[24] = g.workflowName, o[25] = F);
|
|
85
87
|
let I = F, L;
|
|
86
88
|
o[26] !== u || o[27] !== O || o[28] !== f || o[29] !== l.id ? (L = (e, r) => {
|
|
87
|
-
O && f.mutate({
|
|
89
|
+
O && f.mutate({
|
|
88
90
|
workflowName: O.workflowName,
|
|
89
91
|
workspaceId: l.id,
|
|
90
92
|
args: r ?? {}
|
|
91
|
-
}
|
|
93
|
+
}, { onSuccess: (e) => void u.navigateToWorkflow(e.workflowId) });
|
|
92
94
|
}, o[26] = u, o[27] = O, o[28] = f, o[29] = l.id, o[30] = L) : L = o[30];
|
|
93
95
|
let R = L, z;
|
|
94
96
|
o[31] !== j || o[32] !== R || o[33] !== I ? (z = () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../../providers/StudioProvider.js";
|
|
2
1
|
import "../../../hooks/useWorkflows.js";
|
|
2
|
+
import "../../../providers/StudioProvider.js";
|
|
3
3
|
import "../../../components/ui/button.js";
|
|
4
4
|
import "../../../components/feedback/ErrorSnackbar.js";
|
|
5
5
|
import "../../../hooks/useProcessor.js";
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getAppTypesCacheKey, getAvailableEnvironmentsCacheKey, getChildWorkflowsCacheKey, getDashboardStatsCacheKey, getDocumentCacheKey, getDocumentsCacheKey, getFileContentCacheKey, getFileTreeCacheKey, getGitLogCacheKey, getGitRemoteCacheKey, getGitStatusCacheKey, getHealthCacheKey, getMeCacheKey, getSecretsCacheKey, getStudioAppsCacheKey, getToolConfigCacheKey, getToolConfigsCacheKey, getWorkflowCacheKey, getWorkflowConfigCacheKey, getWorkflowSourceCacheKey, getWorkflowStatusCacheKey, getWorkflowTypesCacheKey, getWorkflowsCacheKey, getWorkspaceCacheKey, getWorkspacesCacheKey } from "./query-keys.js";
|
|
2
|
-
import { useApiClient } from "./useApi.js";
|
|
3
1
|
import { useIsMobile } from "./use-mobile.js";
|
|
4
|
-
import { useAppsConfig, useAvailableEnvironments,
|
|
2
|
+
import { useAppsConfig, useAvailableEnvironments, useWorkflow, useWorkflowCheckpoints, useWorkflowSource, useWorkflowStatus, useWorkspace } from "../packages/react/dist/hooks/queries.js";
|
|
3
|
+
import { useBatchDeleteWorkspaces, useCreateWorkflow, useCreateWorkspace, useDeleteWorkflow, useDeleteWorkspace, useSetFavouriteWorkspace, useUpdateWorkflow, useUpdateWorkspace } from "../packages/react/dist/hooks/mutations.js";
|
|
4
|
+
import { useDocumentConfigs } from "./useConfig.js";
|
|
5
5
|
import { useReplaceEnvironments, useResetEnvironment, useWorkspaceEnvironments } from "./useEnvironments.js";
|
|
6
|
-
import { useBatchDeleteWorkflows, useChildWorkflows,
|
|
7
|
-
import {
|
|
6
|
+
import { useBatchDeleteWorkflows, useChildWorkflows, useFilterWorkflows, useWorkflowConfigByName } from "./useWorkflows.js";
|
|
7
|
+
import { useFilterWorkspaces } from "./useWorkspaces.js";
|