@loopstack/loopstack-studio 0.24.0 → 0.25.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/api/config.js +3 -3
- package/dist/api/index.js +9 -13
- package/dist/api/processor.js +1 -1
- package/dist/api/workflows.js +7 -1
- package/dist/components/dynamic-form/CodeContent.js +3 -3
- package/dist/components/dynamic-form/fields/CodeViewField.js +36 -36
- package/dist/components/feedback/LoadingCentered.js +1 -1
- package/dist/components/layout/StudioSidebar.js +2 -2
- package/dist/components/loopstack-elements/link.js +77 -76
- package/dist/components/loopstack-elements/tool.js +171 -0
- package/dist/components/ui-widgets/UiActions.js +10 -4
- package/dist/components/ui-widgets/UiWidget.js +27 -36
- package/dist/components/ui-widgets/widgets/ButtonFullWidth.js +8 -6
- package/dist/components/ui-widgets/widgets/SubmitButton.js +8 -6
- package/dist/features/code-explorer/components/FileContentViewer.js +87 -112
- package/dist/features/dashboard/RunItem.js +1 -1
- package/dist/features/debug/components/ConfigFlowViewer.js +2 -2
- package/dist/features/debug/components/{PipelineDebugHeader.js → WorkflowDebugHeader.js} +5 -5
- package/dist/features/debug/components/{PipelineDebugLegend.js → WorkflowDebugLegend.js} +2 -2
- package/dist/features/debug/components/{PipelineFlowViewer.js → WorkflowFlowViewer.js} +9 -9
- package/dist/features/debug/components/workflow-flow/WorkflowGraph.js +46 -0
- package/dist/features/debug/index.js +2 -2
- package/dist/features/debug/lib/flow-utils.js +142 -150
- package/dist/features/documents/DocumentRenderer.js +66 -30
- package/dist/features/documents/components/DocumentItem.js +2 -2
- package/dist/features/documents/components/DocumentList.js +15 -12
- package/dist/features/documents/document-details/DocumentDetails.js +4 -4
- package/dist/features/documents/renderers/AiMessage.js +1 -1
- package/dist/features/documents/renderers/ChoicesRenderer.js +92 -0
- package/dist/features/documents/renderers/ClaudeMessage.js +1 -1
- package/dist/features/documents/renderers/ConfirmPromptRenderer.js +56 -0
- package/dist/features/documents/renderers/DocumentFormRenderer.js +95 -71
- package/dist/features/documents/renderers/LinkMessageRenderer.js +8 -10
- package/dist/features/documents/renderers/SecretInputRenderer.js +87 -0
- package/dist/features/documents/renderers/TextPromptRenderer.js +57 -0
- package/dist/features/documents/renderers/useDocumentTransition.js +30 -0
- package/dist/features/oauth/OAuthPromptRenderer.js +20 -20
- package/dist/features/runs/Runs.js +8 -8
- package/dist/features/workbench/Workbench.js +35 -35
- package/dist/features/workbench/WorkflowItem.js +10 -9
- package/dist/features/workbench/WorkflowList.js +56 -73
- package/dist/features/workbench/components/NewRunDialog.js +18 -18
- package/dist/features/workbench/components/WorkbenchFilesPanel.js +1 -1
- package/dist/features/workbench/components/WorkbenchFloatingPanel.js +33 -72
- package/dist/features/workbench/components/WorkbenchFlowPanel.js +27 -29
- package/dist/features/workbench/components/WorkbenchIconSidebar.js +30 -42
- package/dist/features/workbench/components/WorkbenchPreviewPanel.js +2 -2
- package/dist/features/workbench/components/WorkbenchSecretsPanel.js +1 -1
- package/dist/features/workbench/components/WorkbenchSettingsModal.js +16 -41
- package/dist/features/workbench/components/WorkflowForms.js +14 -13
- package/dist/features/workbench/components/WorkflowHistoryItem.js +60 -81
- package/dist/features/workbench/components/{PipelineHistoryList.js → WorkflowHistoryList.js} +5 -5
- package/dist/features/workbench/components/buttons/WorkflowButtons.js +56 -54
- package/dist/features/workbench/hooks/useWorkflowData.js +10 -10
- package/dist/features/workbench/hooks/useWorkflowListState.js +8 -45
- package/dist/features/workbench/index.js +2 -3
- package/dist/features/workbench/providers/ScrollProvider.js +2 -2
- package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +4 -4
- package/dist/features/workspaces/Workspaces.js +1 -1
- package/dist/features/workspaces/components/CreateWorkspace.js +12 -12
- package/dist/features/workspaces/components/ExecutionTimeline.js +22 -21
- package/dist/features/workspaces/components/{NewPipelineRunDialog.js → NewWorkflowRunDialog.js} +6 -6
- package/dist/features/workspaces/components/{PipelineForm.js → WorkflowRunForm.js} +31 -31
- package/dist/features/workspaces/components/WorkspaceHomePage.js +11 -11
- package/dist/features/workspaces/components/{pipeline-form → workflow-form}/ArgumentsView.js +1 -1
- package/dist/features/workspaces/components/{pipeline-form → workflow-form}/SelectionView.js +16 -16
- package/dist/hooks/index.js +3 -3
- package/dist/hooks/query-keys.js +31 -72
- package/dist/hooks/useConfig.js +5 -5
- package/dist/hooks/useProcessor.js +5 -5
- package/dist/hooks/useWorkflows.js +155 -68
- package/dist/index.d.ts +127 -128
- package/dist/index.js +5 -5
- package/dist/packages/contracts/dist/enums/index.js +11 -12
- package/dist/packages/contracts/dist/enums/workflow-state.enum.js +1 -1
- package/dist/pages/DebugWorkflowDetailsPage.js +8 -8
- package/dist/pages/DebugWorkflowsPage.js +10 -10
- package/dist/pages/EmbedWorkbenchPage.js +42 -52
- package/dist/pages/PreviewWorkbenchPage.js +130 -255
- package/dist/pages/RunsListPage.js +1 -1
- package/dist/pages/StudioLandingPage.js +13 -13
- package/dist/pages/WorkbenchPage.js +6 -6
- package/dist/pages/WorkflowDebugPage.js +114 -0
- package/dist/pages/WorkspacePage.js +4 -2
- package/dist/providers/InvalidationEventsProvider.js +19 -19
- package/dist/providers/SseProvider.js +0 -1
- package/dist/routing/LocalRouter.js +14 -17
- package/package.json +2 -2
- package/dist/api/namespaces.js +0 -7
- package/dist/api/pipelines.js +0 -13
- package/dist/components/ai-elements/tool.js +0 -158
- package/dist/components/ui-widgets/widgets/SecretInput.js +0 -42
- package/dist/features/debug/components/pipeline-flow/WorkflowGraph.js +0 -41
- package/dist/features/workbench/NavigationItems.js +0 -52
- package/dist/features/workbench/WorkbenchNavigation.js +0 -38
- package/dist/features/workbench/components/NavigationItem.js +0 -68
- package/dist/features/workbench/hooks/useIntersectionObserver.js +0 -44
- package/dist/hooks/useNamespaceTree.js +0 -27
- package/dist/hooks/useNamespaces.js +0 -25
- package/dist/hooks/usePipelines.js +0 -161
- package/dist/packages/contracts/dist/enums/pipeline-state.js +0 -10
- package/dist/pages/PipelineDebugPage.js +0 -115
- /package/dist/features/debug/components/{pipeline-flow → workflow-flow}/StateNode.js +0 -0
- /package/dist/features/debug/components/{pipeline-flow → workflow-flow}/WorkflowTransitionEdge.js +0 -0
- /package/dist/features/workspaces/components/{pipeline-form → workflow-form}/HeaderSection.js +0 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Button } from "../../../components/ui/button.js";
|
|
2
|
+
import { Label } from "../../../components/ui/label.js";
|
|
3
|
+
import { RadioGroup, RadioGroupItem } from "../../../components/ui/radio-group.js";
|
|
4
|
+
import { Textarea } from "../../../components/ui/textarea.js";
|
|
5
|
+
import CompletionMessagePaper_default from "../../../components/messages/CompletionMessagePaper.js";
|
|
6
|
+
import MarkdownContent_default from "../../../components/dynamic-form/MarkdownContent.js";
|
|
7
|
+
import { useDocumentTransition } from "./useDocumentTransition.js";
|
|
8
|
+
import { c } from "react/compiler-runtime";
|
|
9
|
+
import React, { useState } from "react";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Loader2 } from "lucide-react";
|
|
12
|
+
var ChoicesRenderer_default = (g) => {
|
|
13
|
+
let _ = c(26), { parentWorkflow: v, workflow: y, document: b, isActive: x } = g, S = b.content, { submit: C, canSubmit: w, isLoading: T } = useDocumentTransition(v, y, b.ui), [E, D] = useState(S.answer ?? ""), [O, k] = useState(""), A = E === "__custom__", j = !!S.answer, M;
|
|
14
|
+
_[0] !== O || _[1] !== A || _[2] !== E || _[3] !== C ? (M = () => {
|
|
15
|
+
let t = A ? O.trim() : E;
|
|
16
|
+
t && C({ answer: t });
|
|
17
|
+
}, _[0] = O, _[1] = A, _[2] = E, _[3] = C, _[4] = M) : M = _[4];
|
|
18
|
+
let N = M, P = !x || !w || j, F;
|
|
19
|
+
_[5] === b.createdAt ? F = _[6] : (F = new Date(b.createdAt), _[5] = b.createdAt, _[6] = F);
|
|
20
|
+
let I;
|
|
21
|
+
_[7] === S.question ? I = _[8] : (I = /* @__PURE__ */ jsx(MarkdownContent_default, { content: S.question }), _[7] = S.question, _[8] = I);
|
|
22
|
+
let L;
|
|
23
|
+
_[9] !== S.allowCustomAnswer || _[10] !== S.answer || _[11] !== S.options || _[12] !== O || _[13] !== P || _[14] !== N || _[15] !== j || _[16] !== A || _[17] !== T || _[18] !== E ? (L = j ? /* @__PURE__ */ jsxs("div", {
|
|
24
|
+
className: "text-muted-foreground text-sm",
|
|
25
|
+
children: ["Answered: ", /* @__PURE__ */ jsx("span", {
|
|
26
|
+
className: "text-foreground font-medium",
|
|
27
|
+
children: S.answer
|
|
28
|
+
})]
|
|
29
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
30
|
+
/* @__PURE__ */ jsxs(RadioGroup, {
|
|
31
|
+
value: E,
|
|
32
|
+
onValueChange: D,
|
|
33
|
+
disabled: P,
|
|
34
|
+
children: [S.options.map(_temp), S.allowCustomAnswer && /* @__PURE__ */ jsxs("div", {
|
|
35
|
+
className: "flex items-center gap-3",
|
|
36
|
+
children: [/* @__PURE__ */ jsx(RadioGroupItem, {
|
|
37
|
+
value: "__custom__",
|
|
38
|
+
id: "option-custom"
|
|
39
|
+
}), /* @__PURE__ */ jsx(Label, {
|
|
40
|
+
htmlFor: "option-custom",
|
|
41
|
+
className: "cursor-pointer text-sm font-normal",
|
|
42
|
+
children: "Other"
|
|
43
|
+
})]
|
|
44
|
+
})]
|
|
45
|
+
}),
|
|
46
|
+
A && /* @__PURE__ */ jsx(Textarea, {
|
|
47
|
+
placeholder: "Type your answer...",
|
|
48
|
+
value: O,
|
|
49
|
+
onChange: (t) => k(t.target.value),
|
|
50
|
+
disabled: P,
|
|
51
|
+
className: "min-h-10",
|
|
52
|
+
rows: 2
|
|
53
|
+
}),
|
|
54
|
+
/* @__PURE__ */ jsx("div", {
|
|
55
|
+
className: "flex justify-end",
|
|
56
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
57
|
+
type: "button",
|
|
58
|
+
variant: "default",
|
|
59
|
+
disabled: P || T || !E || A && !O.trim(),
|
|
60
|
+
onClick: N,
|
|
61
|
+
className: "w-48",
|
|
62
|
+
children: [T && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }), "Submit"]
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
] }), _[9] = S.allowCustomAnswer, _[10] = S.answer, _[11] = S.options, _[12] = O, _[13] = P, _[14] = N, _[15] = j, _[16] = A, _[17] = T, _[18] = E, _[19] = L) : L = _[19];
|
|
66
|
+
let R;
|
|
67
|
+
_[20] !== I || _[21] !== L ? (R = /* @__PURE__ */ jsxs("div", {
|
|
68
|
+
className: "flex flex-col gap-4 p-1",
|
|
69
|
+
children: [I, L]
|
|
70
|
+
}), _[20] = I, _[21] = L, _[22] = R) : R = _[22];
|
|
71
|
+
let z;
|
|
72
|
+
return _[23] !== F || _[24] !== R ? (z = /* @__PURE__ */ jsx(CompletionMessagePaper_default, {
|
|
73
|
+
role: "document",
|
|
74
|
+
fullWidth: !0,
|
|
75
|
+
timestamp: F,
|
|
76
|
+
children: R
|
|
77
|
+
}), _[23] = F, _[24] = R, _[25] = z) : z = _[25], z;
|
|
78
|
+
};
|
|
79
|
+
function _temp(t, h) {
|
|
80
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
81
|
+
className: "flex items-center gap-3",
|
|
82
|
+
children: [/* @__PURE__ */ jsx(RadioGroupItem, {
|
|
83
|
+
value: t,
|
|
84
|
+
id: `option-${h}`
|
|
85
|
+
}), /* @__PURE__ */ jsx(Label, {
|
|
86
|
+
htmlFor: `option-${h}`,
|
|
87
|
+
className: "cursor-pointer text-sm font-normal",
|
|
88
|
+
children: t
|
|
89
|
+
})]
|
|
90
|
+
}, h);
|
|
91
|
+
}
|
|
92
|
+
export { ChoicesRenderer_default as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Message, MessageAction, MessageActions, MessageContent, MessageResponse } from "../../../components/ai-elements/message.js";
|
|
2
2
|
import { Reasoning, ReasoningContent, ReasoningTrigger } from "../../../components/ai-elements/reasoning.js";
|
|
3
|
-
import { Tool, ToolContent, ToolHeader, ToolInput, ToolOutput } from "../../../components/
|
|
3
|
+
import { Tool, ToolContent, ToolHeader, ToolInput, ToolOutput } from "../../../components/loopstack-elements/tool.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
5
|
import { Fragment } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Button } from "../../../components/ui/button.js";
|
|
2
|
+
import CompletionMessagePaper_default from "../../../components/messages/CompletionMessagePaper.js";
|
|
3
|
+
import MarkdownContent_default from "../../../components/dynamic-form/MarkdownContent.js";
|
|
4
|
+
import { useDocumentTransition } from "./useDocumentTransition.js";
|
|
5
|
+
import { c } from "react/compiler-runtime";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Loader2 } from "lucide-react";
|
|
9
|
+
var ConfirmPromptRenderer_default = (l) => {
|
|
10
|
+
let u = c(18), { parentWorkflow: d, workflow: f, document: p, isActive: m } = l, h = p.content, { submit: g, canSubmit: _, isLoading: v } = useDocumentTransition(d, f, p.ui), y = !!h.answer, b = !m || !_ || y, x;
|
|
11
|
+
u[0] === g ? x = u[1] : (x = (t) => {
|
|
12
|
+
g({ answer: t });
|
|
13
|
+
}, u[0] = g, u[1] = x);
|
|
14
|
+
let S = x, C;
|
|
15
|
+
u[2] === p.createdAt ? C = u[3] : (C = new Date(p.createdAt), u[2] = p.createdAt, u[3] = C);
|
|
16
|
+
let w;
|
|
17
|
+
u[4] === h.question ? w = u[5] : (w = /* @__PURE__ */ jsx(MarkdownContent_default, { content: h.question }), u[4] = h.question, u[5] = w);
|
|
18
|
+
let T;
|
|
19
|
+
u[6] !== h.answer || u[7] !== b || u[8] !== S || u[9] !== y || u[10] !== v ? (T = y ? /* @__PURE__ */ jsxs("div", {
|
|
20
|
+
className: "text-muted-foreground text-sm",
|
|
21
|
+
children: ["Answered: ", /* @__PURE__ */ jsx("span", {
|
|
22
|
+
className: "text-foreground font-medium",
|
|
23
|
+
children: h.answer === "yes" ? "Yes" : "No"
|
|
24
|
+
})]
|
|
25
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
26
|
+
className: "flex justify-end gap-3",
|
|
27
|
+
children: [/* @__PURE__ */ jsxs(Button, {
|
|
28
|
+
type: "button",
|
|
29
|
+
variant: "outline",
|
|
30
|
+
disabled: b || v,
|
|
31
|
+
onClick: () => S("no"),
|
|
32
|
+
className: "w-32",
|
|
33
|
+
children: [v && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }), "No"]
|
|
34
|
+
}), /* @__PURE__ */ jsxs(Button, {
|
|
35
|
+
type: "button",
|
|
36
|
+
variant: "default",
|
|
37
|
+
disabled: b || v,
|
|
38
|
+
onClick: () => S("yes"),
|
|
39
|
+
className: "w-32",
|
|
40
|
+
children: [v && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }), "Yes"]
|
|
41
|
+
})]
|
|
42
|
+
}), u[6] = h.answer, u[7] = b, u[8] = S, u[9] = y, u[10] = v, u[11] = T) : T = u[11];
|
|
43
|
+
let E;
|
|
44
|
+
u[12] !== w || u[13] !== T ? (E = /* @__PURE__ */ jsxs("div", {
|
|
45
|
+
className: "flex flex-col gap-4 p-1",
|
|
46
|
+
children: [w, T]
|
|
47
|
+
}), u[12] = w, u[13] = T, u[14] = E) : E = u[14];
|
|
48
|
+
let D;
|
|
49
|
+
return u[15] !== C || u[16] !== E ? (D = /* @__PURE__ */ jsx(CompletionMessagePaper_default, {
|
|
50
|
+
role: "document",
|
|
51
|
+
fullWidth: !0,
|
|
52
|
+
timestamp: C,
|
|
53
|
+
children: E
|
|
54
|
+
}), u[15] = C, u[16] = E, u[17] = D) : D = u[17], D;
|
|
55
|
+
};
|
|
56
|
+
export { ConfirmPromptRenderer_default as default };
|
|
@@ -1,86 +1,110 @@
|
|
|
1
|
+
import { Button } from "../../../components/ui/button.js";
|
|
1
2
|
import Form_default from "../../../components/dynamic-form/Form.js";
|
|
2
|
-
import {
|
|
3
|
-
import UiActions_default from "../../../components/ui-widgets/UiActions.js";
|
|
3
|
+
import { useRunWorkflow } from "../../../hooks/useProcessor.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
5
|
import React, { useEffect } from "react";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Loader2 } from "lucide-react";
|
|
7
8
|
import { useForm } from "react-hook-form";
|
|
8
9
|
import "zod";
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
function resolveFormConfig(e) {
|
|
11
|
+
let s = e, l = (s?.widgets)?.find((e) => e.widget === "form");
|
|
12
|
+
if (l?.options) {
|
|
13
|
+
let e = l.options;
|
|
14
|
+
return {
|
|
15
|
+
formUi: { form: {
|
|
16
|
+
properties: e.properties,
|
|
17
|
+
order: e.order,
|
|
18
|
+
title: e.title,
|
|
19
|
+
description: e.description,
|
|
20
|
+
disabled: e.disabled
|
|
21
|
+
} },
|
|
22
|
+
actions: e.actions ?? []
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
formUi: e,
|
|
27
|
+
actions: (s?.actions ?? []).map((e) => ({
|
|
28
|
+
type: "button",
|
|
29
|
+
transition: e.options?.transition,
|
|
30
|
+
label: e.options?.label
|
|
31
|
+
}))
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
var DocumentFormRenderer_default = (d) => {
|
|
35
|
+
let m = c(40), { parentWorkflow: h, workflow: g, document: _, enabled: v, viewOnly: y } = d, b = useRunWorkflow(), x;
|
|
36
|
+
m[0] !== _.content || m[1] !== _.schema.type ? (x = _.schema.type === "object" ? _.content : { raw: _.content }, m[0] = _.content, m[1] = _.schema.type, m[2] = x) : x = m[2];
|
|
37
|
+
let S;
|
|
38
|
+
m[3] === x ? S = m[4] : (S = {
|
|
39
|
+
defaultValues: x,
|
|
15
40
|
mode: "onChange"
|
|
16
|
-
},
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
|
|
41
|
+
}, m[3] = x, m[4] = S);
|
|
42
|
+
let C = useForm(S), w, T;
|
|
43
|
+
m[5] !== _.validationError || m[6] !== C ? (w = () => {
|
|
44
|
+
_.validationError ? _.validationError.issues.forEach((e) => {
|
|
20
45
|
let s = e.path.join(".");
|
|
21
|
-
|
|
46
|
+
C.setError(s, {
|
|
22
47
|
type: e.code,
|
|
23
48
|
message: e.message
|
|
24
49
|
});
|
|
25
|
-
}) :
|
|
26
|
-
},
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
p
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
viewOnly: h,
|
|
79
|
-
actions: R
|
|
80
|
-
})
|
|
81
|
-
}), u[32] = N, u[33] = y, u[34] = j, u[35] = I, u[36] = L, u[37] = R, u[38] = h, u[39] = z) : z = u[39], z;
|
|
50
|
+
}) : C.clearErrors();
|
|
51
|
+
}, T = [_.validationError, C], m[5] = _.validationError, m[6] = C, m[7] = w, m[8] = T) : (w = m[7], T = m[8]), useEffect(w, T);
|
|
52
|
+
let E, D, O, k, A, j, M, N, P;
|
|
53
|
+
if (m[9] !== _.meta || m[10] !== _.schema || m[11] !== _.ui || m[12] !== v || m[13] !== C || m[14] !== h || m[15] !== b || m[16] !== y || m[17] !== g.availableTransitions || m[18] !== g.id) {
|
|
54
|
+
let l = g.availableTransitions?.map(_temp) ?? [], u = (e, s) => {
|
|
55
|
+
if (!l.includes(e)) {
|
|
56
|
+
console.error(`Transition ${e} not available.`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
b.mutate({
|
|
60
|
+
workflowId: h.id,
|
|
61
|
+
runWorkflowPayloadDto: { transition: {
|
|
62
|
+
id: e,
|
|
63
|
+
workflowId: g.id,
|
|
64
|
+
payload: s
|
|
65
|
+
} }
|
|
66
|
+
});
|
|
67
|
+
}, d = (e) => (s) => {
|
|
68
|
+
_.schema.type === "object" ? u(e, s) : u(e, s.raw);
|
|
69
|
+
}, f = (e) => {
|
|
70
|
+
e.transition && C.handleSubmit((s) => d(e.transition)(s), _temp2)();
|
|
71
|
+
}, { formUi: p, actions: x } = resolveFormConfig(_.ui), S = _.schema, w = !!p?.form?.disabled, T = !v || w || !1;
|
|
72
|
+
k = "flex", E = Form_default, A = C, j = S, M = p ?? void 0, N = _.meta?.mimeType, P = T, D = y, O = !y && x.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
73
|
+
className: "flex w-full flex-col items-end gap-4",
|
|
74
|
+
children: x.map((s, u) => {
|
|
75
|
+
let d = T || s.transition !== void 0 && !l.includes(s.transition);
|
|
76
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
77
|
+
type: "button",
|
|
78
|
+
variant: s.variant ?? "default",
|
|
79
|
+
disabled: d || b.isPending,
|
|
80
|
+
onClick: () => f(s),
|
|
81
|
+
className: s.type === "button-full-w" ? "w-full" : "w-48",
|
|
82
|
+
...s.props ?? {},
|
|
83
|
+
children: [b.isPending && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }), s.label ?? "Submit"]
|
|
84
|
+
}, u);
|
|
85
|
+
})
|
|
86
|
+
}) : void 0, m[9] = _.meta, m[10] = _.schema, m[11] = _.ui, m[12] = v, m[13] = C, m[14] = h, m[15] = b, m[16] = y, m[17] = g.availableTransitions, m[18] = g.id, m[19] = E, m[20] = D, m[21] = O, m[22] = k, m[23] = A, m[24] = j, m[25] = M, m[26] = N, m[27] = P;
|
|
87
|
+
} else E = m[19], D = m[20], O = m[21], k = m[22], A = m[23], j = m[24], M = m[25], N = m[26], P = m[27];
|
|
88
|
+
let F;
|
|
89
|
+
m[28] !== E || m[29] !== D || m[30] !== O || m[31] !== A || m[32] !== j || m[33] !== M || m[34] !== N || m[35] !== P ? (F = /* @__PURE__ */ jsx(E, {
|
|
90
|
+
form: A,
|
|
91
|
+
schema: j,
|
|
92
|
+
ui: M,
|
|
93
|
+
mimeType: N,
|
|
94
|
+
disabled: P,
|
|
95
|
+
viewOnly: D,
|
|
96
|
+
actions: O
|
|
97
|
+
}), m[28] = E, m[29] = D, m[30] = O, m[31] = A, m[32] = j, m[33] = M, m[34] = N, m[35] = P, m[36] = F) : F = m[36];
|
|
98
|
+
let I;
|
|
99
|
+
return m[37] !== k || m[38] !== F ? (I = /* @__PURE__ */ jsx("div", {
|
|
100
|
+
className: k,
|
|
101
|
+
children: F
|
|
102
|
+
}), m[37] = k, m[38] = F, m[39] = I) : I = m[39], I;
|
|
82
103
|
};
|
|
83
104
|
function _temp(e) {
|
|
84
105
|
return e.id;
|
|
85
106
|
}
|
|
107
|
+
function _temp2(e) {
|
|
108
|
+
return console.error("[DocumentFormRenderer] validation failed", e);
|
|
109
|
+
}
|
|
86
110
|
export { DocumentFormRenderer_default as default };
|
|
@@ -3,15 +3,13 @@ import { c } from "react/compiler-runtime";
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
var LinkMessageRenderer_default = (r) => {
|
|
6
|
-
let i = c(
|
|
7
|
-
return i[0] !== u || i[1] !==
|
|
8
|
-
href:
|
|
9
|
-
label:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
defaultExpanded: p
|
|
15
|
-
}), i[0] = u, i[1] = f, i[2] = p, i[3] = d, i[4] = l, i[5] = m, i[6] = s, i[7] = h) : h = i[7], h;
|
|
6
|
+
let i = c(6), { document: a } = r, { status: o, label: s, workflowId: l, embed: u, expanded: d } = a.content, f = l ? `/workflows/${l}` : void 0, p;
|
|
7
|
+
return i[0] !== u || i[1] !== d || i[2] !== f || i[3] !== s || i[4] !== o ? (p = /* @__PURE__ */ jsx(link_default, {
|
|
8
|
+
href: f,
|
|
9
|
+
label: s,
|
|
10
|
+
status: o,
|
|
11
|
+
embed: u,
|
|
12
|
+
defaultExpanded: d
|
|
13
|
+
}), i[0] = u, i[1] = d, i[2] = f, i[3] = s, i[4] = o, i[5] = p) : p = i[5], p;
|
|
16
14
|
};
|
|
17
15
|
export { LinkMessageRenderer_default as default };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Button } from "../../../components/ui/button.js";
|
|
2
|
+
import { Input } from "../../../components/ui/input.js";
|
|
3
|
+
import { Label } from "../../../components/ui/label.js";
|
|
4
|
+
import CompletionMessagePaper_default from "../../../components/messages/CompletionMessagePaper.js";
|
|
5
|
+
import { useRunWorkflow } from "../../../hooks/useProcessor.js";
|
|
6
|
+
import { useUpsertSecret } from "../../../hooks/useSecrets.js";
|
|
7
|
+
import { useWorkbenchLayout } from "../../workbench/providers/WorkbenchLayoutProvider.js";
|
|
8
|
+
import "../../workbench/index.js";
|
|
9
|
+
import React, { useState } from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Info, KeyRound, Loader2 } from "lucide-react";
|
|
12
|
+
var SecretInputRenderer_default = ({ parentWorkflow: p, workflow: m, document: h, isActive: g }) => {
|
|
13
|
+
let _ = h.content.variables ?? [], v = (h.ui?.widgets)?.[0]?.options, y = v?.transition, b = v?.label ?? "Save & Continue", { workflow: x } = useWorkbenchLayout(), S = x?.workspaceId, C = useRunWorkflow(), w = useUpsertSecret(), T = m.availableTransitions?.map((e) => e.id) ?? [], [E, D] = useState(() => {
|
|
14
|
+
let e = {};
|
|
15
|
+
for (let d of _) e[d.key] = d.value ?? "";
|
|
16
|
+
return e;
|
|
17
|
+
}), [O, k] = useState(!1), A = !!y && T.includes(y), j = !g || !A, M = async () => {
|
|
18
|
+
if (!(!S || !y)) {
|
|
19
|
+
k(!0);
|
|
20
|
+
try {
|
|
21
|
+
let e = [];
|
|
22
|
+
for (let d of _) {
|
|
23
|
+
let f = E[d.key]?.trim();
|
|
24
|
+
!d.key.trim() || !f || (await w.mutateAsync({
|
|
25
|
+
workspaceId: S,
|
|
26
|
+
key: d.key,
|
|
27
|
+
value: f
|
|
28
|
+
}), e.push(d.key));
|
|
29
|
+
}
|
|
30
|
+
C.mutate({
|
|
31
|
+
workflowId: p.id,
|
|
32
|
+
runWorkflowPayloadDto: { transition: {
|
|
33
|
+
id: y,
|
|
34
|
+
workflowId: m.id,
|
|
35
|
+
payload: { keys: e }
|
|
36
|
+
} }
|
|
37
|
+
});
|
|
38
|
+
} finally {
|
|
39
|
+
k(!1);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return /* @__PURE__ */ jsx(CompletionMessagePaper_default, {
|
|
44
|
+
role: "document",
|
|
45
|
+
fullWidth: !0,
|
|
46
|
+
timestamp: new Date(h.createdAt),
|
|
47
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
48
|
+
className: "flex flex-col gap-4 p-1",
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsx("div", {
|
|
51
|
+
className: "text-sm font-medium",
|
|
52
|
+
children: "Secrets"
|
|
53
|
+
}),
|
|
54
|
+
_.map((e) => /* @__PURE__ */ jsxs("div", {
|
|
55
|
+
className: "flex flex-col gap-1.5",
|
|
56
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
57
|
+
className: "text-muted-foreground text-xs",
|
|
58
|
+
children: e.key
|
|
59
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
60
|
+
type: "password",
|
|
61
|
+
placeholder: "Enter value...",
|
|
62
|
+
value: E[e.key] ?? "",
|
|
63
|
+
onChange: (d) => D((f) => ({
|
|
64
|
+
...f,
|
|
65
|
+
[e.key]: d.target.value
|
|
66
|
+
})),
|
|
67
|
+
disabled: j
|
|
68
|
+
})]
|
|
69
|
+
}, e.key)),
|
|
70
|
+
/* @__PURE__ */ jsxs("div", {
|
|
71
|
+
className: "text-muted-foreground flex items-center gap-2 text-xs",
|
|
72
|
+
children: [/* @__PURE__ */ jsx(Info, { className: "h-3.5 w-3.5 shrink-0" }), /* @__PURE__ */ jsx("span", { children: "To add or remove other secrets, use the Secrets panel in the right sidebar." })]
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ jsx("div", {
|
|
75
|
+
className: "flex justify-end",
|
|
76
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
77
|
+
onClick: () => void M(),
|
|
78
|
+
disabled: j || O,
|
|
79
|
+
className: "w-48",
|
|
80
|
+
children: [O ? /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx(KeyRound, { className: "mr-2 h-4 w-4" }), b]
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
})
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
export { SecretInputRenderer_default as default };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Button } from "../../../components/ui/button.js";
|
|
2
|
+
import { Textarea } from "../../../components/ui/textarea.js";
|
|
3
|
+
import CompletionMessagePaper_default from "../../../components/messages/CompletionMessagePaper.js";
|
|
4
|
+
import MarkdownContent_default from "../../../components/dynamic-form/MarkdownContent.js";
|
|
5
|
+
import { useDocumentTransition } from "./useDocumentTransition.js";
|
|
6
|
+
import { c } from "react/compiler-runtime";
|
|
7
|
+
import React, { useState } from "react";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Loader2 } from "lucide-react";
|
|
10
|
+
var TextPromptRenderer_default = (f) => {
|
|
11
|
+
let p = c(20), { parentWorkflow: m, workflow: h, document: g, isActive: _ } = f, v = g.content, { submit: y, canSubmit: b, isLoading: x } = useDocumentTransition(m, h, g.ui), [S, C] = useState(""), w = !!v.answer, T = !_ || !b || w, E;
|
|
12
|
+
p[0] !== y || p[1] !== S ? (E = () => {
|
|
13
|
+
let e = S.trim();
|
|
14
|
+
e && y({ answer: e });
|
|
15
|
+
}, p[0] = y, p[1] = S, p[2] = E) : E = p[2];
|
|
16
|
+
let D = E, O;
|
|
17
|
+
p[3] === g.createdAt ? O = p[4] : (O = new Date(g.createdAt), p[3] = g.createdAt, p[4] = O);
|
|
18
|
+
let k;
|
|
19
|
+
p[5] === v.question ? k = p[6] : (k = /* @__PURE__ */ jsx(MarkdownContent_default, { content: v.question }), p[5] = v.question, p[6] = k);
|
|
20
|
+
let A;
|
|
21
|
+
p[7] !== v.answer || p[8] !== T || p[9] !== D || p[10] !== w || p[11] !== x || p[12] !== S ? (A = w ? /* @__PURE__ */ jsxs("div", {
|
|
22
|
+
className: "text-muted-foreground text-sm",
|
|
23
|
+
children: ["Answered: ", /* @__PURE__ */ jsx("span", {
|
|
24
|
+
className: "text-foreground font-medium",
|
|
25
|
+
children: v.answer
|
|
26
|
+
})]
|
|
27
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Textarea, {
|
|
28
|
+
placeholder: "Type your answer...",
|
|
29
|
+
value: S,
|
|
30
|
+
onChange: (e) => C(e.target.value),
|
|
31
|
+
disabled: T,
|
|
32
|
+
rows: 3
|
|
33
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
34
|
+
className: "flex justify-end",
|
|
35
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
36
|
+
type: "button",
|
|
37
|
+
variant: "default",
|
|
38
|
+
disabled: T || x || !S.trim(),
|
|
39
|
+
onClick: D,
|
|
40
|
+
className: "w-48",
|
|
41
|
+
children: [x && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }), "Submit"]
|
|
42
|
+
})
|
|
43
|
+
})] }), p[7] = v.answer, p[8] = T, p[9] = D, p[10] = w, p[11] = x, p[12] = S, p[13] = A) : A = p[13];
|
|
44
|
+
let j;
|
|
45
|
+
p[14] !== k || p[15] !== A ? (j = /* @__PURE__ */ jsxs("div", {
|
|
46
|
+
className: "flex flex-col gap-4 p-1",
|
|
47
|
+
children: [k, A]
|
|
48
|
+
}), p[14] = k, p[15] = A, p[16] = j) : j = p[16];
|
|
49
|
+
let M;
|
|
50
|
+
return p[17] !== O || p[18] !== j ? (M = /* @__PURE__ */ jsx(CompletionMessagePaper_default, {
|
|
51
|
+
role: "document",
|
|
52
|
+
fullWidth: !0,
|
|
53
|
+
timestamp: O,
|
|
54
|
+
children: j
|
|
55
|
+
}), p[17] = O, p[18] = j, p[19] = M) : M = p[19], M;
|
|
56
|
+
};
|
|
57
|
+
export { TextPromptRenderer_default as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useRunWorkflow } from "../../../hooks/useProcessor.js";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
function resolveTransition(e) {
|
|
4
|
+
let t = e, n = t?.widgets;
|
|
5
|
+
return n?.[0]?.options?.transition ? n[0].options.transition : (t?.actions)?.map((e) => e.options?.transition).find((e) => !!e);
|
|
6
|
+
}
|
|
7
|
+
function useDocumentTransition(r, i, a) {
|
|
8
|
+
let o = useRunWorkflow(), s = i.availableTransitions?.map((e) => e.id) ?? [], c = resolveTransition(a), l = !!c && s.includes(c);
|
|
9
|
+
return {
|
|
10
|
+
submit: useCallback((e) => {
|
|
11
|
+
!c || !l || o.mutate({
|
|
12
|
+
workflowId: r.id,
|
|
13
|
+
runWorkflowPayloadDto: { transition: {
|
|
14
|
+
id: c,
|
|
15
|
+
workflowId: i.id,
|
|
16
|
+
payload: e
|
|
17
|
+
} }
|
|
18
|
+
});
|
|
19
|
+
}, [
|
|
20
|
+
c,
|
|
21
|
+
l,
|
|
22
|
+
o,
|
|
23
|
+
r.id,
|
|
24
|
+
i.id
|
|
25
|
+
]),
|
|
26
|
+
canSubmit: l,
|
|
27
|
+
isLoading: o.isPending
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export { useDocumentTransition };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import CompletionMessagePaper_default from "../../components/messages/CompletionMessagePaper.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useRunWorkflow } from "../../hooks/useProcessor.js";
|
|
3
3
|
import { useOAuthPopup } from "./useOAuthPopup.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
5
|
import React, { useCallback, useEffect, useRef } from "react";
|
|
6
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
var OAuthPromptRenderer = ({
|
|
8
|
-
let g = m.content, _ =
|
|
9
|
-
!
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
id:
|
|
7
|
+
var OAuthPromptRenderer = ({ parentWorkflow: l, workflow: u, document: m, isActive: h }) => {
|
|
8
|
+
let g = m.content, _ = m.ui, v = (_?.widgets)?.[0]?.options?.transition ?? (_?.actions)?.map((e) => e.options?.transition).find((e) => !!e), y = useRunWorkflow(), { result: b, open: x, reset: S } = useOAuthPopup(), C = useRef(!1), w = u.availableTransitions?.map((e) => e.id) ?? [], T = useCallback((e, o) => {
|
|
9
|
+
!v || !w.includes(v) || y.mutate({
|
|
10
|
+
workflowId: l.id,
|
|
11
|
+
runWorkflowPayloadDto: { transition: {
|
|
12
|
+
id: v,
|
|
13
13
|
workflowId: u.id,
|
|
14
14
|
payload: {
|
|
15
15
|
code: e,
|
|
@@ -18,22 +18,22 @@ var OAuthPromptRenderer = ({ pipeline: l, workflow: u, document: m, isActive: h
|
|
|
18
18
|
} }
|
|
19
19
|
});
|
|
20
20
|
}, [
|
|
21
|
-
_,
|
|
22
|
-
C,
|
|
23
21
|
v,
|
|
22
|
+
w,
|
|
23
|
+
y,
|
|
24
24
|
l.id,
|
|
25
25
|
u.id
|
|
26
26
|
]);
|
|
27
27
|
useEffect(() => {
|
|
28
|
-
|
|
29
|
-
}, [
|
|
30
|
-
let
|
|
31
|
-
|
|
28
|
+
b.status === "success" && !C.current && (C.current = !0, T(b.code, b.state));
|
|
29
|
+
}, [b, T]);
|
|
30
|
+
let E = () => {
|
|
31
|
+
C.current = !1, x({
|
|
32
32
|
authUrl: g.authUrl,
|
|
33
33
|
state: g.state
|
|
34
34
|
});
|
|
35
|
-
},
|
|
36
|
-
|
|
35
|
+
}, D = () => {
|
|
36
|
+
S(), C.current = !1, x({
|
|
37
37
|
authUrl: g.authUrl,
|
|
38
38
|
state: g.state
|
|
39
39
|
});
|
|
@@ -46,13 +46,13 @@ var OAuthPromptRenderer = ({ pipeline: l, workflow: u, document: m, isActive: h
|
|
|
46
46
|
status: "error",
|
|
47
47
|
provider: g.provider,
|
|
48
48
|
message: g.message
|
|
49
|
-
}), h && /* @__PURE__ */ jsx(RetryButton, { onClick:
|
|
50
|
-
result:
|
|
49
|
+
}), h && /* @__PURE__ */ jsx(RetryButton, { onClick: D })] }) : /* @__PURE__ */ jsx(CompletionMessagePaper_default, { children: /* @__PURE__ */ jsx(PopupResultView, {
|
|
50
|
+
result: b,
|
|
51
51
|
provider: g.provider,
|
|
52
52
|
isActive: h,
|
|
53
|
-
isSubmitting:
|
|
54
|
-
onSignIn:
|
|
55
|
-
onRetry:
|
|
53
|
+
isSubmitting: y.isPending,
|
|
54
|
+
onSignIn: E,
|
|
55
|
+
onRetry: D
|
|
56
56
|
}) });
|
|
57
57
|
}, ProviderLabel = (e) => {
|
|
58
58
|
let o = c(2), { provider: s } = e, u = s.charAt(0).toUpperCase() + s.slice(1), d;
|