@loopstack/loopstack-studio 0.35.1 → 0.37.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 (43) hide show
  1. package/dist/features/documents/DocumentRenderer.js +7 -7
  2. package/dist/features/documents/renderers/DocumentFormRenderer.js +1 -1
  3. package/dist/features/documents/renderers/DocumentMessageRenderer.js +23 -9
  4. package/dist/features/documents/renderers/LlmMessage.js +90 -50
  5. package/dist/features/file-explorer/components/FileExplorerPanel.js +66 -73
  6. package/dist/features/file-explorer/hooks/useFileExplorer.js +29 -25
  7. package/dist/features/file-explorer/providers/FileExplorerProvider.js +53 -53
  8. package/dist/features/git/components/WorkbenchGitPanel.js +36 -33
  9. package/dist/features/git/hooks/useGit.js +36 -33
  10. package/dist/features/oauth/OAuthCallbackPage.js +2 -0
  11. package/dist/features/run-view/RunView.js +153 -0
  12. package/dist/features/run-view/Transcript.js +127 -0
  13. package/dist/features/run-view/prompts/FormPrompt.js +129 -0
  14. package/dist/features/run-view/prompts/OAuthPrompt.js +94 -0
  15. package/dist/features/run-view/prompts/SandboxRunButton.js +35 -0
  16. package/dist/features/run-view/prompts/SecretPrompt.js +69 -0
  17. package/dist/features/run-view/prompts/SimplePrompts.js +196 -0
  18. package/dist/features/run-view/prompts/cards.js +90 -0
  19. package/dist/features/run-view/prompts/registry.js +16 -0
  20. package/dist/features/run-view/transcript.js +24 -0
  21. package/dist/features/run-view/useRunPrompts.js +111 -0
  22. package/dist/features/run-view/useRunTree.js +59 -0
  23. package/dist/features/run-view/useTreeLlmStreams.js +91 -0
  24. package/dist/features/secrets/components/WorkbenchSecretsPanel.js +1 -1
  25. package/dist/features/secrets/renderers/SecretInputRenderer.js +1 -1
  26. package/dist/features/workbench/WorkflowList.js +111 -52
  27. package/dist/features/workbench/components/EnvironmentSelector.js +46 -0
  28. package/dist/features/workbench/components/NewRunDialog.js +1 -1
  29. package/dist/features/workbench/index.js +1 -1
  30. package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +68 -56
  31. package/dist/features/workspaces/components/WorkspaceHomePage.js +1 -1
  32. package/dist/index.d.ts +2 -0
  33. package/dist/node_modules/dompurify/dist/purify.es.js +351 -228
  34. package/dist/packages/client/dist/resources/workflows.js +2 -1
  35. package/dist/packages/client/dist/stream/invalidations.js +9 -2
  36. package/dist/packages/client/dist/stream/stream.js +73 -28
  37. package/dist/packages/contracts/dist/park-view/index.js +2 -0
  38. package/dist/packages/contracts/dist/park-view/park-view.rules.js +102 -0
  39. package/dist/packages/contracts/dist/park-view/park-view.types.js +15 -0
  40. package/dist/packages/contracts/dist/types/types/ui-message.type.js +15 -2
  41. package/dist/pages/PreviewWorkbenchPage.js +23 -23
  42. package/dist/providers/StudioPreferencesProvider.js +2 -1
  43. package/package.json +4 -4
@@ -0,0 +1,111 @@
1
+ import { useLoopstackClient } from "../../packages/react/dist/provider.js";
2
+ import "../../packages/react/dist/index.js";
3
+ import { useDocumentConfigs } from "../../hooks/useConfig.js";
4
+ import { promptRegistry } from "./prompts/registry.js";
5
+ import { evaluateWorkflowPrompts, isAnswered, pickPrompt, toParkView } from "../../packages/contracts/dist/park-view/park-view.rules.js";
6
+ import "../../packages/contracts/dist/park-view/index.js";
7
+ import { useMemo } from "react";
8
+ import { useQueries } from "@tanstack/react-query";
9
+ function toWidgetConfig(e) {
10
+ let o = e.ui?.widgets?.[0];
11
+ if (!o) return;
12
+ let s = e.meta;
13
+ return {
14
+ widget: o.widget,
15
+ options: o.options,
16
+ enabledWhen: o.enabledWhen,
17
+ showWhen: o.showWhen,
18
+ schema: e.schema,
19
+ enableAtPlaces: s?.enableAtPlaces,
20
+ hideAtPlaces: s?.hideAtPlaces,
21
+ internal: e.tags?.includes("internal") || void 0
22
+ };
23
+ }
24
+ function toWorkflowInput(e) {
25
+ return {
26
+ id: e.id,
27
+ workflowName: e.workflowName,
28
+ status: e.status,
29
+ place: e.place ?? null,
30
+ availableTransitions: e.availableTransitions?.map((e) => e.id) ?? []
31
+ };
32
+ }
33
+ function useRunPrompts(d) {
34
+ let f = useLoopstackClient(), p = useDocumentConfigs(), m = useMemo(() => {
35
+ let e = /* @__PURE__ */ new Map();
36
+ for (let [o, s] of p) {
37
+ let c = toWidgetConfig(s);
38
+ c && e.set(o, c);
39
+ }
40
+ return e;
41
+ }, [p]), h = useMemo(() => [...new Set(d.map((e) => e.workflow.workflowName))], [d]), g = useQueries({ queries: h.map((e) => ({
42
+ ...f.queries.workflowConfig(e),
43
+ staleTime: 6e4
44
+ })) }), _ = useMemo(() => {
45
+ let e = /* @__PURE__ */ new Map();
46
+ return h.forEach((o, s) => {
47
+ let c = g[s]?.data?.ui?.widgets ?? [];
48
+ e.set(o, c.map((e) => ({
49
+ widget: e.widget,
50
+ options: e.options,
51
+ enabledWhen: e.enabledWhen,
52
+ showWhen: e.showWhen
53
+ })));
54
+ }), e;
55
+ }, [h, ...g.map((e) => e.data)]);
56
+ return useMemo(() => {
57
+ let e = pickPrompt(d.flatMap((e) => {
58
+ let o = e.documents.filter((e) => !e.isInvalidated).map((e) => ({
59
+ documentName: e.documentName,
60
+ place: e.place ?? null,
61
+ content: e.content ?? null,
62
+ tags: e.tags
63
+ }));
64
+ return evaluateWorkflowPrompts(toWorkflowInput(e.workflow), o, m, _.get(e.workflow.workflowName) ?? []);
65
+ }), (e) => !!e.widget && promptRegistry.has(e.widget.widget)), o = (e) => e ? {
66
+ candidate: e,
67
+ view: toParkView(e)
68
+ } : void 0, l;
69
+ if (!e.prompt && !e.blocked) {
70
+ for (let e of d) if (!(e.workflow.status !== "running" && e.workflow.status !== "pending")) {
71
+ for (let o of _.get(e.workflow.workflowName) ?? []) {
72
+ if (!promptRegistry.has(o.widget) || o.showWhen && !o.showWhen.includes(e.workflow.place ?? "")) continue;
73
+ let c = {
74
+ kind: "workflow",
75
+ workflow: toWorkflowInput(e.workflow),
76
+ widget: o,
77
+ state: "disabled"
78
+ };
79
+ l = {
80
+ candidate: c,
81
+ view: toParkView(c)
82
+ };
83
+ break;
84
+ }
85
+ if (l) break;
86
+ }
87
+ }
88
+ let u = /* @__PURE__ */ new Map();
89
+ for (let e of d) if (e.workflow.status !== "completed") for (let o of _.get(e.workflow.workflowName) ?? []) {
90
+ if (o.widget !== "sandbox-run" || o.showWhen && !o.showWhen.includes(e.workflow.place ?? "")) continue;
91
+ let s = o.options;
92
+ u.set(s?.slotId ?? "", {
93
+ slotId: s?.slotId,
94
+ label: s?.label
95
+ });
96
+ }
97
+ return {
98
+ picked: o(e.prompt),
99
+ blocked: o(e.blocked),
100
+ fallback: o(e.fallback),
101
+ idlePrompt: l,
102
+ answered: (e) => isAnswered(e.content),
103
+ sandboxSlots: [...u.values()]
104
+ };
105
+ }, [
106
+ d,
107
+ m,
108
+ _
109
+ ]);
110
+ }
111
+ export { useRunPrompts };
@@ -0,0 +1,59 @@
1
+ import { useLoopstackClient } from "../../packages/react/dist/provider.js";
2
+ import { SortOrder } from "../../packages/contracts/dist/enums/sort-order.enum.js";
3
+ import "../../packages/contracts/dist/enums/index.js";
4
+ import "../../packages/react/dist/index.js";
5
+ import { useEffect, useMemo, useState } from "react";
6
+ import { useQueries } from "@tanstack/react-query";
7
+ var DOCUMENTS_PAGE_SIZE = 100, DOCUMENTS_MAX_PAGES = 5;
8
+ function allDocumentsQuery(e, r) {
9
+ return {
10
+ queryKey: [...e.queries.documents(r).queryKey, "all"],
11
+ queryFn: async () => {
12
+ let i = [];
13
+ for (let a = 0; a < DOCUMENTS_MAX_PAGES; a++) {
14
+ let o = await e.documents.list({
15
+ filter: { workflowId: r },
16
+ sortBy: [{
17
+ field: "index",
18
+ order: SortOrder.ASC
19
+ }],
20
+ page: a,
21
+ limit: DOCUMENTS_PAGE_SIZE
22
+ });
23
+ if (i.push(...o.data), o.data.length < DOCUMENTS_PAGE_SIZE) break;
24
+ }
25
+ return i;
26
+ }
27
+ };
28
+ }
29
+ function useRunTree(n) {
30
+ let s = useLoopstackClient(), [c, l] = useState(n ? [n] : []), u = useMemo(() => new Map(n ? [[n, 0]] : []), [n]);
31
+ useEffect(() => {
32
+ l(n ? [n] : []);
33
+ }, [n]);
34
+ let d = useQueries({ queries: c.map((e) => ({ ...s.queries.workflow(e) })) }), f = useQueries({ queries: c.map((e) => ({ ...s.queries.childWorkflows(e) })) }), p = useQueries({ queries: c.map((e) => allDocumentsQuery(s, e)) });
35
+ return useEffect(() => {
36
+ let e = new Set(c), n = [];
37
+ c.forEach((r, i) => {
38
+ let a = f[i]?.data?.data ?? [];
39
+ for (let i of a) e.has(i.id) || (e.add(i.id), u.set(i.id, (u.get(r) ?? 0) + 1), n.push(i.id));
40
+ }), n.length > 0 && l((e) => [...e, ...n]);
41
+ }, [c, ...f.map((e) => e.data)]), {
42
+ nodes: useMemo(() => c.map((e, n) => {
43
+ let r = d[n]?.data;
44
+ if (r) return {
45
+ workflowId: e,
46
+ depth: u.get(e) ?? 0,
47
+ workflow: r,
48
+ documents: p[n]?.data ?? []
49
+ };
50
+ }).filter((e) => e !== void 0), [
51
+ c,
52
+ u,
53
+ ...d.map((e) => e.data),
54
+ ...p.map((e) => e.data)
55
+ ]),
56
+ isLoading: d[0]?.isLoading ?? !0
57
+ };
58
+ }
59
+ export { useRunTree };
@@ -0,0 +1,91 @@
1
+ import { useLoopstackClient } from "../../packages/react/dist/provider.js";
2
+ import { isLlmResponseEvent } from "../../packages/contracts/dist/events/client-message.schema.js";
3
+ import "../../packages/contracts/dist/events/index.js";
4
+ import { reduceLlmStream } from "../../packages/client/dist/stream/llm-reducer.js";
5
+ import "../../packages/client/dist/index.js";
6
+ import "../../packages/react/dist/index.js";
7
+ import { c } from "react/compiler-runtime";
8
+ import { useEffect, useMemo, useState } from "react";
9
+ function useTreeLlmStreams(a) {
10
+ let s = c(9), l = useLoopstackClient(), u;
11
+ s[0] === Symbol.for("react.memo_cache_sentinel") ? (u = {}, s[0] = u) : u = s[0];
12
+ let [d, f] = useState(u), p;
13
+ s[1] === a ? p = s[2] : (p = a.join(","), s[1] = a, s[2] = p);
14
+ let m = p, h;
15
+ s[3] !== l.stream || s[4] !== m ? (h = () => {
16
+ let e = new Set(m.split(",").filter(Boolean));
17
+ return l.stream.onAny((r) => {
18
+ "userId" in r && isLlmResponseEvent(r) && e.has(r.workflowId) && f((e) => ({
19
+ ...e,
20
+ [r.workflowId]: reduceLlmStream(e[r.workflowId] ?? {}, r)
21
+ }));
22
+ });
23
+ }, s[3] = l.stream, s[4] = m, s[5] = h) : h = s[5];
24
+ let g;
25
+ return s[6] !== l || s[7] !== m ? (g = [l, m], s[6] = l, s[7] = m, s[8] = g) : g = s[8], useEffect(h, g), d;
26
+ }
27
+ function getLlmMessageId(e) {
28
+ let t = e.content;
29
+ return e.documentName === "llm_message" && typeof t?.id == "string" ? t.id : void 0;
30
+ }
31
+ function toStreamingDocument(e, t, n) {
32
+ let r = n.error ? `Error while streaming response: ${n.error}` : n.text, i = [
33
+ ...n.thinking ? [{
34
+ type: "thinking",
35
+ text: n.thinking
36
+ }] : [],
37
+ {
38
+ type: "text",
39
+ text: r
40
+ },
41
+ ...n.toolCalls.map((e) => ({
42
+ type: "tool_call",
43
+ ...e
44
+ }))
45
+ ], a = (/* @__PURE__ */ new Date()).toISOString();
46
+ return {
47
+ id: `streaming-${n.messageId}`,
48
+ documentName: "llm_message",
49
+ content: {
50
+ id: n.messageId,
51
+ role: "assistant",
52
+ text: r,
53
+ blocks: i
54
+ },
55
+ validationError: null,
56
+ meta: { streaming: !n.completed && !n.error },
57
+ isInvalidated: !1,
58
+ index: 2 ** 53 - 1,
59
+ transition: null,
60
+ place: t,
61
+ labels: [],
62
+ tags: ["message"],
63
+ createdAt: a,
64
+ updatedAt: a,
65
+ workspaceId: "",
66
+ workflowId: e
67
+ };
68
+ }
69
+ function mergeStreamingDocuments(e, t, n, r) {
70
+ let i = Object.values(r ?? {});
71
+ if (i.length === 0) return n;
72
+ let a = new Set(n.map(getLlmMessageId).filter((e) => !!e)), o = i.filter((e) => !a.has(e.messageId)).map((n) => toStreamingDocument(e, t ?? "", n));
73
+ return o.length > 0 ? [...n, ...o] : n;
74
+ }
75
+ function useStreamingNodes(e) {
76
+ let t = c(7), n;
77
+ t[0] === e ? n = t[1] : (n = e.map(_temp), t[0] = e, t[1] = n);
78
+ let i = useTreeLlmStreams(n), a;
79
+ if (t[2] !== e || t[3] !== i) {
80
+ let n;
81
+ t[5] === i ? n = t[6] : (n = (e) => ({
82
+ ...e,
83
+ documents: mergeStreamingDocuments(e.workflowId, e.workflow.place ?? null, e.documents, i[e.workflowId])
84
+ }), t[5] = i, t[6] = n), a = e.map(n), t[2] = e, t[3] = i, t[4] = a;
85
+ } else a = t[4];
86
+ return a;
87
+ }
88
+ function _temp(e) {
89
+ return e.workflowId;
90
+ }
91
+ export { useStreamingNodes };
@@ -1,10 +1,10 @@
1
1
  import { Button } from "../../../components/ui/button.js";
2
2
  import { Input } from "../../../components/ui/input.js";
3
3
  import { Label } from "../../../components/ui/label.js";
4
+ import { useCreateSecret, useDeleteSecret, useUpdateSecret, useWorkspaceSecrets } from "../../../hooks/useSecrets.js";
4
5
  import { useWorkbenchLayout } from "../../workbench/providers/WorkbenchLayoutProvider.js";
5
6
  import { SidebarPanel } from "../../workbench/components/SidebarPanel.js";
6
7
  import "../../workbench/index.js";
7
- import { useCreateSecret, useDeleteSecret, useUpdateSecret, useWorkspaceSecrets } from "../../../hooks/useSecrets.js";
8
8
  import { c } from "react/compiler-runtime";
9
9
  import { useState } from "react";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -5,9 +5,9 @@ import { Input } from "../../../components/ui/input.js";
5
5
  import { Label } from "../../../components/ui/label.js";
6
6
  import CompletionMessagePaper_default from "../../../components/messages/CompletionMessagePaper.js";
7
7
  import "../../../hooks/useProcessor.js";
8
+ import { useUpsertSecret } from "../../../hooks/useSecrets.js";
8
9
  import { useWorkbenchLayout } from "../../workbench/providers/WorkbenchLayoutProvider.js";
9
10
  import "../../workbench/index.js";
10
- import { useUpsertSecret } from "../../../hooks/useSecrets.js";
11
11
  import React, { useState } from "react";
12
12
  import { jsx, jsxs } from "react/jsx-runtime";
13
13
  import { Info, KeyRound, Loader2 } from "lucide-react";
@@ -1,10 +1,13 @@
1
1
  import { useChildWorkflows, useWorkflowConfigByName } from "../../hooks/useWorkflows.js";
2
+ import { useOptionalStudioPreferences } from "../../providers/StudioPreferencesProvider.js";
3
+ import { cn } from "../../lib/utils.js";
2
4
  import { Button } from "../../components/ui/button.js";
3
5
  import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "../../components/ui/dialog.js";
4
6
  import { Tooltip, TooltipContent, TooltipTrigger } from "../../components/ui/tooltip.js";
5
7
  import { ReactFlowProvider } from "../../node_modules/@xyflow/react/dist/esm/index.js";
6
8
  import WorkflowFlowViewer_default from "../debug/components/WorkflowFlowViewer.js";
7
9
  import "../debug/index.js";
10
+ import { RunView } from "../run-view/RunView.js";
8
11
  import WorkflowItem_default from "./WorkflowItem.js";
9
12
  import WorkbenchSettingsModal_default from "./components/WorkbenchSettingsModal.js";
10
13
  import WorkflowHistoryList_default from "./components/WorkflowHistoryList.js";
@@ -13,35 +16,84 @@ import { useWorkflowListState } from "./hooks/useWorkflowListState.js";
13
16
  import { c } from "react/compiler-runtime";
14
17
  import React, { useState } from "react";
15
18
  import { jsx, jsxs } from "react/jsx-runtime";
16
- import { ArrowDownIcon, ListOrdered, Workflow } from "lucide-react";
17
- var WorkflowList_default = (S) => {
18
- let C = c(43), { workflow: w } = S, [T, E] = useState(!1), D;
19
- C[0] === Symbol.for("react.memo_cache_sentinel") ? (D = {
19
+ import { ArrowDownIcon, Layers, ListOrdered, ListVideo, Workflow } from "lucide-react";
20
+ var WorkflowList_default = (t) => {
21
+ let n = c(72), { workflow: r } = t, [i, a] = useState(!1), o;
22
+ n[0] === Symbol.for("react.memo_cache_sentinel") ? (o = {
20
23
  enableDebugMode: !1,
21
24
  showFullMessageHistory: !1
22
- }, C[0] = D) : D = C[0];
23
- let [O, k] = useState(D), { listRef: A, scrollTo: j, canScrollDown: M, scrollToBottom: N } = useWorkflowListState(), P = useWorkflowConfigByName(w.workflowName), F = useChildWorkflows(w.id), I;
24
- C[1] === F.data ? I = C[2] : (I = F.data ?? [], C[1] = F.data, C[2] = I);
25
- let L = I, R;
26
- C[3] !== M || C[4] !== N ? (R = M && /* @__PURE__ */ jsx(Button, {
25
+ }, n[0] = o) : o = n[0];
26
+ let [s, l] = useState(o), u = useOptionalStudioPreferences(), [ke, d] = useState("classic"), f = u?.preferences.workbenchView ?? ke, p;
27
+ n[1] === u ? p = n[2] : (p = (e) => u ? u.setPreference("workbenchView", e) : d(e), n[1] = u, n[2] = p);
28
+ let m = p, { listRef: h, scrollTo: g, canScrollDown: _, scrollToBottom: v } = useWorkflowListState(), y = useWorkflowConfigByName(r.workflowName), b = useChildWorkflows(r.id), x;
29
+ n[3] === b.data ? x = n[4] : (x = b.data ?? [], n[3] = b.data, n[4] = x);
30
+ let S = x, C;
31
+ n[5] !== _ || n[6] !== v ? (C = _ && /* @__PURE__ */ jsx(Button, {
27
32
  variant: "outline",
28
33
  size: "icon",
29
- onClick: N,
34
+ onClick: v,
30
35
  className: "bg-background/80 fixed right-[calc(var(--sidebar-width)+1.5rem)] bottom-6 z-50 rounded-full shadow-md backdrop-blur-sm",
31
36
  children: /* @__PURE__ */ jsx(ArrowDownIcon, { className: "size-4" })
32
- }), C[3] = M, C[4] = N, C[5] = R) : R = C[5];
33
- let z = P.data?.title ?? w.workflowName, B;
34
- C[6] === z ? B = C[7] : (B = /* @__PURE__ */ jsx("span", {
37
+ }), n[5] = _, n[6] = v, n[7] = C) : C = n[7];
38
+ let w = y.data?.title ?? r.workflowName, T;
39
+ n[8] === w ? T = n[9] : (T = /* @__PURE__ */ jsx("span", {
35
40
  className: "flex-1 truncate text-sm",
36
- children: z
37
- }), C[6] = z, C[7] = B);
41
+ children: w
42
+ }), n[8] = w, n[9] = T);
43
+ let E = f === "classic" && "bg-accent text-accent-foreground", D;
44
+ n[10] === E ? D = n[11] : (D = cn("h-6 w-6", E), n[10] = E, n[11] = D);
45
+ let O;
46
+ n[12] === m ? O = n[13] : (O = () => m("classic"), n[12] = m, n[13] = O);
47
+ let k;
48
+ n[14] === Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ jsx(Layers, { className: "h-3.5 w-3.5" }), n[14] = k) : k = n[14];
49
+ let A;
50
+ n[15] !== D || n[16] !== O ? (A = /* @__PURE__ */ jsx(TooltipTrigger, {
51
+ asChild: !0,
52
+ children: /* @__PURE__ */ jsx(Button, {
53
+ variant: "ghost",
54
+ size: "icon",
55
+ className: D,
56
+ onClick: O,
57
+ children: k
58
+ })
59
+ }), n[15] = D, n[16] = O, n[17] = A) : A = n[17];
60
+ let j;
61
+ n[18] === Symbol.for("react.memo_cache_sentinel") ? (j = /* @__PURE__ */ jsx(TooltipContent, { children: "Classic view" }), n[18] = j) : j = n[18];
62
+ let M;
63
+ n[19] === A ? M = n[20] : (M = /* @__PURE__ */ jsxs(Tooltip, { children: [A, j] }), n[19] = A, n[20] = M);
64
+ let N = f === "run" && "bg-accent text-accent-foreground", P;
65
+ n[21] === N ? P = n[22] : (P = cn("h-6 w-6", N), n[21] = N, n[22] = P);
66
+ let F;
67
+ n[23] === m ? F = n[24] : (F = () => m("run"), n[23] = m, n[24] = F);
68
+ let I;
69
+ n[25] === Symbol.for("react.memo_cache_sentinel") ? (I = /* @__PURE__ */ jsx(ListVideo, { className: "h-3.5 w-3.5" }), n[25] = I) : I = n[25];
70
+ let L;
71
+ n[26] !== P || n[27] !== F ? (L = /* @__PURE__ */ jsx(TooltipTrigger, {
72
+ asChild: !0,
73
+ children: /* @__PURE__ */ jsx(Button, {
74
+ variant: "ghost",
75
+ size: "icon",
76
+ className: P,
77
+ onClick: F,
78
+ children: I
79
+ })
80
+ }), n[26] = P, n[27] = F, n[28] = L) : L = n[28];
81
+ let R;
82
+ n[29] === Symbol.for("react.memo_cache_sentinel") ? (R = /* @__PURE__ */ jsx(TooltipContent, { children: "Run view" }), n[29] = R) : R = n[29];
83
+ let z;
84
+ n[30] === L ? z = n[31] : (z = /* @__PURE__ */ jsxs(Tooltip, { children: [L, R] }), n[30] = L, n[31] = z);
85
+ let B;
86
+ n[32] !== M || n[33] !== z ? (B = /* @__PURE__ */ jsxs("div", {
87
+ className: "border-input mr-1 flex items-center rounded-md border p-0.5",
88
+ children: [M, z]
89
+ }), n[32] = M, n[33] = z, n[34] = B) : B = n[34];
38
90
  let V;
39
- C[8] === w ? V = C[9] : (V = /* @__PURE__ */ jsx(WorkflowButtons_default, {
40
- workflow: w,
41
- workflowId: w.id
42
- }), C[8] = w, C[9] = V);
91
+ n[35] === r ? V = n[36] : (V = /* @__PURE__ */ jsx(WorkflowButtons_default, {
92
+ workflow: r,
93
+ workflowId: r.id
94
+ }), n[35] = r, n[36] = V);
43
95
  let H;
44
- C[10] === Symbol.for("react.memo_cache_sentinel") ? (H = /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
96
+ n[37] === Symbol.for("react.memo_cache_sentinel") ? (H = /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
45
97
  asChild: !0,
46
98
  children: /* @__PURE__ */ jsx(DialogTrigger, {
47
99
  asChild: !0,
@@ -52,19 +104,19 @@ var WorkflowList_default = (S) => {
52
104
  children: /* @__PURE__ */ jsx(ListOrdered, { className: "h-5 w-5" })
53
105
  })
54
106
  })
55
- }), /* @__PURE__ */ jsx(TooltipContent, { children: "Run Log" })] }), C[10] = H) : H = C[10];
107
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: "Run Log" })] }), n[37] = H) : H = n[37];
56
108
  let U;
57
- C[11] === Symbol.for("react.memo_cache_sentinel") ? (U = /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: "Run Log" }) }), C[11] = U) : U = C[11];
109
+ n[38] === Symbol.for("react.memo_cache_sentinel") ? (U = /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: "Run Log" }) }), n[38] = U) : U = n[38];
58
110
  let W;
59
- C[12] === w ? W = C[13] : (W = /* @__PURE__ */ jsxs(Dialog, { children: [H, /* @__PURE__ */ jsxs(DialogContent, {
111
+ n[39] === r ? W = n[40] : (W = /* @__PURE__ */ jsxs(Dialog, { children: [H, /* @__PURE__ */ jsxs(DialogContent, {
60
112
  className: "sm:max-w-lg max-h-[80vh] overflow-hidden flex flex-col",
61
113
  children: [U, /* @__PURE__ */ jsx("div", {
62
114
  className: "flex-1 overflow-auto",
63
- children: /* @__PURE__ */ jsx(WorkflowHistoryList_default, { workflow: w })
115
+ children: /* @__PURE__ */ jsx(WorkflowHistoryList_default, { workflow: r })
64
116
  })]
65
- })] }), C[12] = w, C[13] = W);
117
+ })] }), n[39] = r, n[40] = W);
66
118
  let G;
67
- C[14] === Symbol.for("react.memo_cache_sentinel") ? (G = /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
119
+ n[41] === Symbol.for("react.memo_cache_sentinel") ? (G = /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
68
120
  asChild: !0,
69
121
  children: /* @__PURE__ */ jsx(DialogTrigger, {
70
122
  asChild: !0,
@@ -75,36 +127,37 @@ var WorkflowList_default = (S) => {
75
127
  children: /* @__PURE__ */ jsx(Workflow, { className: "h-5 w-5" })
76
128
  })
77
129
  })
78
- }), /* @__PURE__ */ jsx(TooltipContent, { children: "Graph" })] }), C[14] = G) : G = C[14];
130
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: "Graph" })] }), n[41] = G) : G = n[41];
79
131
  let K;
80
- C[15] === Symbol.for("react.memo_cache_sentinel") ? (K = /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: "Graph" }) }), C[15] = K) : K = C[15];
132
+ n[42] === Symbol.for("react.memo_cache_sentinel") ? (K = /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: "Graph" }) }), n[42] = K) : K = n[42];
81
133
  let q;
82
- C[16] !== L || C[17] !== w ? (q = [w, ...L], C[16] = L, C[17] = w, C[18] = q) : q = C[18];
134
+ n[43] !== S || n[44] !== r ? (q = [r, ...S], n[43] = S, n[44] = r, n[45] = q) : q = n[45];
83
135
  let J;
84
- C[19] !== P.data || C[20] !== q || C[21] !== w.id ? (J = /* @__PURE__ */ jsxs(Dialog, { children: [G, /* @__PURE__ */ jsxs(DialogContent, {
136
+ n[46] !== y.data || n[47] !== q || n[48] !== r.id ? (J = /* @__PURE__ */ jsxs(Dialog, { children: [G, /* @__PURE__ */ jsxs(DialogContent, {
85
137
  className: "sm:max-w-4xl h-[70vh] overflow-hidden flex flex-col",
86
138
  children: [K, /* @__PURE__ */ jsx("div", {
87
139
  className: "flex-1 overflow-hidden",
88
140
  children: /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(WorkflowFlowViewer_default, {
89
- workflowId: w.id,
141
+ workflowId: r.id,
90
142
  workflows: q,
91
- workflowConfig: P.data
143
+ workflowConfig: y.data
92
144
  }) })
93
145
  })]
94
- })] }), C[19] = P.data, C[20] = q, C[21] = w.id, C[22] = J) : J = C[22];
146
+ })] }), n[46] = y.data, n[47] = q, n[48] = r.id, n[49] = J) : J = n[49];
95
147
  let Y;
96
- C[23] !== T || C[24] !== O ? (Y = /* @__PURE__ */ jsx(WorkbenchSettingsModal_default, {
97
- settings: O,
98
- onSettingsChange: k,
99
- open: T,
100
- onOpenChange: E
101
- }), C[23] = T, C[24] = O, C[25] = Y) : Y = C[25];
148
+ n[50] !== i || n[51] !== s ? (Y = /* @__PURE__ */ jsx(WorkbenchSettingsModal_default, {
149
+ settings: s,
150
+ onSettingsChange: l,
151
+ open: i,
152
+ onOpenChange: a
153
+ }), n[50] = i, n[51] = s, n[52] = Y) : Y = n[52];
102
154
  let X;
103
- C[26] !== J || C[27] !== Y || C[28] !== B || C[29] !== V || C[30] !== W ? (X = /* @__PURE__ */ jsx("div", {
155
+ n[53] !== B || n[54] !== V || n[55] !== W || n[56] !== J || n[57] !== Y || n[58] !== T ? (X = /* @__PURE__ */ jsx("div", {
104
156
  className: "bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-10 backdrop-blur",
105
157
  children: /* @__PURE__ */ jsxs("div", {
106
158
  className: "flex w-full items-center gap-2 rounded-md p-2 px-3 text-left text-sm font-medium",
107
159
  children: [
160
+ T,
108
161
  B,
109
162
  V,
110
163
  W,
@@ -112,24 +165,30 @@ var WorkflowList_default = (S) => {
112
165
  Y
113
166
  ]
114
167
  })
115
- }), C[26] = J, C[27] = Y, C[28] = B, C[29] = V, C[30] = W, C[31] = X) : X = C[31];
168
+ }), n[53] = B, n[54] = V, n[55] = W, n[56] = J, n[57] = Y, n[58] = T, n[59] = X) : X = n[59];
116
169
  let Z;
117
- C[32] !== j || C[33] !== O || C[34] !== w ? (Z = /* @__PURE__ */ jsx("div", {
170
+ n[60] !== g || n[61] !== s || n[62] !== f || n[63] !== r ? (Z = /* @__PURE__ */ jsx("div", {
118
171
  className: "max-w-4xl py-1",
119
- children: /* @__PURE__ */ jsx(WorkflowItem_default, {
120
- workflow: w,
121
- workflowId: w.id,
122
- scrollTo: j,
123
- settings: O
172
+ children: f === "run" ? /* @__PURE__ */ jsx("div", {
173
+ className: "p-4",
174
+ children: /* @__PURE__ */ jsx(RunView, {
175
+ workflowId: r.id,
176
+ settings: s
177
+ })
178
+ }) : /* @__PURE__ */ jsx(WorkflowItem_default, {
179
+ workflow: r,
180
+ workflowId: r.id,
181
+ scrollTo: g,
182
+ settings: s
124
183
  })
125
- }), C[32] = j, C[33] = O, C[34] = w, C[35] = Z) : Z = C[35];
184
+ }), n[60] = g, n[61] = s, n[62] = f, n[63] = r, n[64] = Z) : Z = n[64];
126
185
  let Q;
127
- C[36] !== A || C[37] !== X || C[38] !== Z ? (Q = /* @__PURE__ */ jsxs("div", {
186
+ n[65] !== h || n[66] !== X || n[67] !== Z ? (Q = /* @__PURE__ */ jsxs("div", {
128
187
  className: "mb-10",
129
- ref: A,
188
+ ref: h,
130
189
  children: [X, Z]
131
- }), C[36] = A, C[37] = X, C[38] = Z, C[39] = Q) : Q = C[39];
190
+ }), n[65] = h, n[66] = X, n[67] = Z, n[68] = Q) : Q = n[68];
132
191
  let $;
133
- return C[40] !== Q || C[41] !== R ? ($ = /* @__PURE__ */ jsxs("div", { children: [R, Q] }), C[40] = Q, C[41] = R, C[42] = $) : $ = C[42], $;
192
+ return n[69] !== Q || n[70] !== C ? ($ = /* @__PURE__ */ jsxs("div", { children: [C, Q] }), n[69] = Q, n[70] = C, n[71] = $) : $ = n[71], $;
134
193
  };
135
194
  export { WorkflowList_default as default };
@@ -0,0 +1,46 @@
1
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../components/ui/select.js";
2
+ import { useWorkbenchLayout } from "../providers/WorkbenchLayoutProvider.js";
3
+ import { c } from "react/compiler-runtime";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ function EnvironmentSelector() {
6
+ let u = c(11), { environments: d, selectedSlotId: f, setSelectedSlotId: p } = useWorkbenchLayout(), m;
7
+ u[0] === d ? m = u[1] : (m = d ?? [], u[0] = d, u[1] = m);
8
+ let h = m;
9
+ if (h.length <= 1) return null;
10
+ let g;
11
+ u[2] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ jsx(SelectTrigger, {
12
+ className: "h-7 text-xs",
13
+ children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select environment" })
14
+ }), u[2] = g) : g = u[2];
15
+ let _;
16
+ u[3] === h ? _ = u[4] : (_ = h.map(_temp), u[3] = h, u[4] = _);
17
+ let v;
18
+ u[5] === _ ? v = u[6] : (v = /* @__PURE__ */ jsx(SelectContent, { children: _ }), u[5] = _, u[6] = v);
19
+ let y;
20
+ return u[7] !== f || u[8] !== p || u[9] !== v ? (y = /* @__PURE__ */ jsx("div", {
21
+ className: "border-b px-3 py-2",
22
+ children: /* @__PURE__ */ jsxs(Select, {
23
+ value: f,
24
+ onValueChange: p,
25
+ children: [g, v]
26
+ })
27
+ }), u[7] = f, u[8] = p, u[9] = v, u[10] = y) : y = u[10], y;
28
+ }
29
+ function _temp(e) {
30
+ return /* @__PURE__ */ jsx(SelectItem, {
31
+ value: e.slotId,
32
+ className: "text-xs",
33
+ children: /* @__PURE__ */ jsxs("span", {
34
+ className: "flex items-center gap-2",
35
+ children: [
36
+ /* @__PURE__ */ jsx("span", { className: `h-1.5 w-1.5 rounded-full ${e.status === "running" ? "bg-green-500" : "bg-muted-foreground/40"}` }),
37
+ e.envName || e.slotId,
38
+ e.status !== "running" && /* @__PURE__ */ jsx("span", {
39
+ className: "text-muted-foreground",
40
+ children: "(stopped)"
41
+ })
42
+ ]
43
+ })
44
+ }, e.slotId);
45
+ }
46
+ export { EnvironmentSelector };
@@ -8,8 +8,8 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../co
8
8
  import { Dialog, DialogContent, DialogTitle } from "../../../components/ui/dialog.js";
9
9
  import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../components/ui/select.js";
10
10
  import ErrorSnackbar_default from "../../../components/feedback/ErrorSnackbar.js";
11
- import "../../../hooks/useProcessor.js";
12
11
  import Form_default from "../../../components/dynamic-form/Form.js";
12
+ import "../../../hooks/useProcessor.js";
13
13
  import CreateWorkspace_default from "../../workspaces/components/CreateWorkspace.js";
14
14
  import "../../workspaces/index.js";
15
15
  import { c } from "react/compiler-runtime";
@@ -2,7 +2,7 @@ import WorkflowItem_default from "./WorkflowItem.js";
2
2
  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
- import { useWorkbenchLayout } from "./providers/WorkbenchLayoutProvider.js";
5
+ import { useOptionalWorkbenchLayout, useWorkbenchLayout } from "./providers/WorkbenchLayoutProvider.js";
6
6
  import { WorkbenchSidebarShell } from "./components/WorkbenchSidebarShell.js";
7
7
  import Workbench from "./Workbench.js";
8
8
  import { NewRunDialog } from "./components/NewRunDialog.js";