@loopstack/loopstack-studio 0.31.1 → 0.33.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.
@@ -1,6 +1,7 @@
1
1
  function createWorkflowsApi(e) {
2
2
  return {
3
3
  getById: (t) => e.get(`/api/v1/workflows/${t.id}`).then((e) => e.data),
4
+ getStatusById: (t) => e.get(`/api/v1/workflows/${t.id}/status`).then((e) => e.data),
4
5
  getAll: (t) => e.get("/api/v1/workflows", { params: t }).then((e) => e.data),
5
6
  create: (t) => e.post("/api/v1/workflows", t.workflowCreateDto).then((e) => e.data),
6
7
  update: (t) => e.put(`/api/v1/workflows/${t.id}`, t.workflowUpdateDto).then((e) => e.data),
@@ -3,114 +3,122 @@ import { useStudio } from "../../providers/StudioProvider.js";
3
3
  import { cn } from "../../lib/utils.js";
4
4
  import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip.js";
5
5
  import { c } from "react/compiler-runtime";
6
- import { useEffect, useState } from "react";
6
+ import { useEffect, useRef, useState } from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { ChevronDownIcon, ChevronUpIcon, ExternalLinkIcon, FolderClosedIcon, FolderOpenIcon } from "lucide-react";
9
9
  var EMBED_RESIZE_MESSAGE_TYPE = "loopstack:embed:resize", statusColorMap = {
10
10
  pending: "text-muted-foreground",
11
11
  success: "text-green-600",
12
12
  failure: "text-red-600"
13
- }, WORKFLOW_HREF_PATTERN = /^\/workflows\/([a-zA-Z0-9_-]+)$/, link_default = (h) => {
14
- let g = c(55), { className: _, href: v, label: y, status: b, embed: x, defaultExpanded: S } = h, C = b === void 0 ? "pending" : b, { router: w } = useStudio(), [T, E] = useState(S ?? !1), [D, O] = useState(0), k;
15
- g[0] !== v || g[1] !== y ? (k = y || (() => {
16
- if (!v) return "";
13
+ }, WORKFLOW_HREF_PATTERN = /^\/workflows\/([a-zA-Z0-9_-]+)$/, link_default = (u) => {
14
+ let d = c(61), { className: f, href: p, label: m, status: h, embed: g, defaultExpanded: _ } = u, v = h === void 0 ? "pending" : h, { router: y } = useStudio(), [b, x] = useState(_ ?? !1), [S, C] = useState(0), w = useRef(_ !== void 0), T, E;
15
+ d[0] === _ ? (T = d[1], E = d[2]) : (T = () => {
16
+ w.current || _ === void 0 || (x(_), w.current = !0);
17
+ }, E = [_], d[0] = _, d[1] = T, d[2] = E), useEffect(T, E);
18
+ let D;
19
+ d[3] !== p || d[4] !== m ? (D = m || (() => {
20
+ if (!p) return "";
17
21
  try {
18
- return new URL(v).hostname.replace("www.", "");
22
+ return new URL(p).hostname.replace("www.", "");
19
23
  } catch {
20
- return v;
24
+ return p;
21
25
  }
22
- })(), g[0] = v, g[1] = y, g[2] = k) : k = g[2];
23
- let A = k, j, M;
24
- g[3] !== x || g[4] !== v || g[5] !== w ? (M = v?.match(WORKFLOW_HREF_PATTERN)?.[1] ?? null, j = x === !0 && M != null ? w.getEmbedWorkflow(M) : null, g[3] = x, g[4] = v, g[5] = w, g[6] = j, g[7] = M) : (j = g[6], M = g[7]);
25
- let N = j, P, F;
26
- g[8] !== T || g[9] !== M ? (P = () => {
27
- if (!M || !T) return;
28
- let t = (t) => {
29
- if (t.origin !== window.location.origin) return;
30
- let p = t.data;
31
- if (p?.type !== EMBED_RESIZE_MESSAGE_TYPE || p?.workflowId !== M) return;
32
- let m = p?.height;
33
- typeof m == "number" && m > 0 && O(m);
26
+ })(), d[3] = p, d[4] = m, d[5] = D) : D = d[5];
27
+ let O = D, k, A;
28
+ d[6] !== g || d[7] !== p || d[8] !== y ? (A = p?.match(WORKFLOW_HREF_PATTERN)?.[1] ?? null, k = g === !0 && A != null ? y.getEmbedWorkflow(A) : null, d[6] = g, d[7] = p, d[8] = y, d[9] = k, d[10] = A) : (k = d[9], A = d[10]);
29
+ let j = k, M, N;
30
+ d[11] === v ? (M = d[12], N = d[13]) : (M = () => {
31
+ (v === "success" || v === "failure") && x(!1);
32
+ }, N = [v], d[11] = v, d[12] = M, d[13] = N), useEffect(M, N);
33
+ let P, F;
34
+ d[14] !== b || d[15] !== A ? (P = () => {
35
+ if (!A || !b) return;
36
+ let e = (e) => {
37
+ if (e.origin !== window.location.origin) return;
38
+ let s = e.data;
39
+ if (s?.type !== EMBED_RESIZE_MESSAGE_TYPE || s?.workflowId !== A) return;
40
+ let l = s?.height;
41
+ typeof l == "number" && l > 0 && C(l);
34
42
  };
35
- return window.addEventListener("message", t), () => window.removeEventListener("message", t);
36
- }, F = [M, T], g[8] = T, g[9] = M, g[10] = P, g[11] = F) : (P = g[10], F = g[11]), useEffect(P, F);
43
+ return window.addEventListener("message", e), () => window.removeEventListener("message", e);
44
+ }, F = [A, b], d[14] = b, d[15] = A, d[16] = P, d[17] = F) : (P = d[16], F = d[17]), useEffect(P, F);
37
45
  let I;
38
- g[12] === _ ? I = g[13] : (I = cn("not-prose flex w-full cursor-pointer flex-col", _), g[12] = _, g[13] = I);
46
+ d[18] === f ? I = d[19] : (I = cn("not-prose flex w-full cursor-pointer flex-col", f), d[18] = f, d[19] = I);
39
47
  let L;
40
- g[14] === N ? L = g[15] : (L = () => N && E(_temp), g[14] = N, g[15] = L);
41
- let R = statusColorMap[C], z;
42
- g[16] === R ? z = g[17] : (z = cn("flex shrink-0 items-center", R), g[16] = R, g[17] = z);
48
+ d[20] === j ? L = d[21] : (L = () => j && x(_temp), d[20] = j, d[21] = L);
49
+ let R = statusColorMap[v], z;
50
+ d[22] === R ? z = d[23] : (z = cn("flex shrink-0 items-center", R), d[22] = R, d[23] = z);
43
51
  let B;
44
- g[18] === T ? B = g[19] : (B = jsx(T ? FolderOpenIcon : FolderClosedIcon, { className: "size-4" }), g[18] = T, g[19] = B);
52
+ d[24] === b ? B = d[25] : (B = jsx(b ? FolderOpenIcon : FolderClosedIcon, { className: "size-4" }), d[24] = b, d[25] = B);
45
53
  let V;
46
- g[20] !== B || g[21] !== z ? (V = /* @__PURE__ */ jsx(TooltipTrigger, {
54
+ d[26] !== z || d[27] !== B ? (V = /* @__PURE__ */ jsx(TooltipTrigger, {
47
55
  asChild: !0,
48
56
  children: /* @__PURE__ */ jsx("span", {
49
57
  className: z,
50
58
  children: B
51
59
  })
52
- }), g[20] = B, g[21] = z, g[22] = V) : V = g[22];
53
- let H = T ? "Collapse" : "Expand", U;
54
- g[23] === H ? U = g[24] : (U = /* @__PURE__ */ jsx(TooltipContent, {
60
+ }), d[26] = z, d[27] = B, d[28] = V) : V = d[28];
61
+ let H = b ? "Collapse" : "Expand", U;
62
+ d[29] === H ? U = d[30] : (U = /* @__PURE__ */ jsx(TooltipContent, {
55
63
  side: "top",
56
64
  children: H
57
- }), g[23] = H, g[24] = U);
65
+ }), d[29] = H, d[30] = U);
58
66
  let W;
59
- g[25] !== V || g[26] !== U ? (W = /* @__PURE__ */ jsxs(Tooltip, { children: [V, U] }), g[25] = V, g[26] = U, g[27] = W) : W = g[27];
60
- let G = T ? "font-medium" : "text-muted-foreground", K;
61
- g[28] === G ? K = g[29] : (K = cn("min-w-0 flex-1 truncate text-sm", G), g[28] = G, g[29] = K);
67
+ d[31] !== V || d[32] !== U ? (W = /* @__PURE__ */ jsxs(Tooltip, { children: [V, U] }), d[31] = V, d[32] = U, d[33] = W) : W = d[33];
68
+ let G = b ? "font-medium" : "text-muted-foreground", K;
69
+ d[34] === G ? K = d[35] : (K = cn("min-w-0 flex-1 truncate text-sm", G), d[34] = G, d[35] = K);
62
70
  let q;
63
- g[30] !== A || g[31] !== K ? (q = /* @__PURE__ */ jsx("span", {
71
+ d[36] !== O || d[37] !== K ? (q = /* @__PURE__ */ jsx("span", {
64
72
  className: K,
65
- children: A
66
- }), g[30] = A, g[31] = K, g[32] = q) : q = g[32];
73
+ children: O
74
+ }), d[36] = O, d[37] = K, d[38] = q) : q = d[38];
67
75
  let J;
68
- g[33] === v ? J = g[34] : (J = v && /* @__PURE__ */ jsx("a", {
69
- href: v,
76
+ d[39] === p ? J = d[40] : (J = p && /* @__PURE__ */ jsx("a", {
77
+ href: p,
70
78
  target: "_blank",
71
79
  rel: "noopener noreferrer",
72
80
  onClick: _temp2,
73
81
  className: "text-muted-foreground hover:text-foreground flex items-center justify-center transition-colors",
74
82
  children: /* @__PURE__ */ jsx(ExternalLinkIcon, { className: "size-3.5" })
75
- }), g[33] = v, g[34] = J);
83
+ }), d[39] = p, d[40] = J);
76
84
  let Y;
77
- g[35] !== N || g[36] !== T ? (Y = N && jsx(T ? ChevronUpIcon : ChevronDownIcon, { className: "text-muted-foreground size-3.5" }), g[35] = N, g[36] = T, g[37] = Y) : Y = g[37];
85
+ d[41] !== j || d[42] !== b ? (Y = j && jsx(b ? ChevronUpIcon : ChevronDownIcon, { className: "text-muted-foreground size-3.5" }), d[41] = j, d[42] = b, d[43] = Y) : Y = d[43];
78
86
  let X;
79
- g[38] !== J || g[39] !== Y ? (X = /* @__PURE__ */ jsxs("div", {
87
+ d[44] !== J || d[45] !== Y ? (X = /* @__PURE__ */ jsxs("div", {
80
88
  className: "flex shrink-0 items-center gap-1",
81
89
  children: [J, Y]
82
- }), g[38] = J, g[39] = Y, g[40] = X) : X = g[40];
90
+ }), d[44] = J, d[45] = Y, d[46] = X) : X = d[46];
83
91
  let Z;
84
- g[41] !== W || g[42] !== q || g[43] !== X ? (Z = /* @__PURE__ */ jsxs("div", {
92
+ d[47] !== W || d[48] !== q || d[49] !== X ? (Z = /* @__PURE__ */ jsxs("div", {
85
93
  className: "flex w-full items-center gap-1.5 py-1",
86
94
  children: [
87
95
  W,
88
96
  q,
89
97
  X
90
98
  ]
91
- }), g[41] = W, g[42] = q, g[43] = X, g[44] = Z) : Z = g[44];
99
+ }), d[47] = W, d[48] = q, d[49] = X, d[50] = Z) : Z = d[50];
92
100
  let Q;
93
- g[45] !== A || g[46] !== N || g[47] !== T || g[48] !== D ? (Q = T && N && /* @__PURE__ */ jsx("div", {
101
+ d[51] !== O || d[52] !== j || d[53] !== b || d[54] !== S ? (Q = b && j && /* @__PURE__ */ jsx("div", {
94
102
  className: "mt-2 border-t",
95
103
  children: /* @__PURE__ */ jsx("iframe", {
96
- src: N,
104
+ src: j,
97
105
  className: "w-full overflow-hidden border-0",
98
- style: { height: `${D}px` },
106
+ style: { height: `${S}px` },
99
107
  scrolling: "no",
100
- title: A
108
+ title: O
101
109
  })
102
- }), g[45] = A, g[46] = N, g[47] = T, g[48] = D, g[49] = Q) : Q = g[49];
110
+ }), d[51] = O, d[52] = j, d[53] = b, d[54] = S, d[55] = Q) : Q = d[55];
103
111
  let $;
104
- return g[50] !== Z || g[51] !== Q || g[52] !== I || g[53] !== L ? ($ = /* @__PURE__ */ jsxs("div", {
112
+ return d[56] !== I || d[57] !== L || d[58] !== Z || d[59] !== Q ? ($ = /* @__PURE__ */ jsxs("div", {
105
113
  className: I,
106
114
  onClick: L,
107
115
  children: [Z, Q]
108
- }), g[50] = Z, g[51] = Q, g[52] = I, g[53] = L, g[54] = $) : $ = g[54], $;
116
+ }), d[56] = I, d[57] = L, d[58] = Z, d[59] = Q, d[60] = $) : $ = d[60], $;
109
117
  };
110
- function _temp(t) {
111
- return !t;
118
+ function _temp(e) {
119
+ return !e;
112
120
  }
113
- function _temp2(t) {
114
- return t.stopPropagation();
121
+ function _temp2(e) {
122
+ return e.stopPropagation();
115
123
  }
116
124
  export { link_default as default };
@@ -48,7 +48,10 @@ var coreRendererRegistry = new Map([
48
48
  ["error", ({ document: e }) => /* @__PURE__ */ jsx(ErrorMessageRenderer_default, { document: e })],
49
49
  ["plain", ({ document: e }) => /* @__PURE__ */ jsx(PlainMessageRenderer_default, { document: e })],
50
50
  ["markdown", ({ document: e }) => /* @__PURE__ */ jsx(MarkdownMessageRenderer_default, { document: e })],
51
- ["link", ({ document: e }) => /* @__PURE__ */ jsx(LinkMessageRenderer_default, { document: e })],
51
+ ["link", ({ workflow: e, document: _ }) => /* @__PURE__ */ jsx(LinkMessageRenderer_default, {
52
+ workflow: e,
53
+ document: _
54
+ })],
52
55
  ["oauth-prompt", ({ parentWorkflow: e, workflow: _, document: y, isActive: b }) => /* @__PURE__ */ jsx(OAuthPromptRenderer_default, {
53
56
  parentWorkflow: e,
54
57
  workflow: _,
@@ -10,37 +10,38 @@ function summarizeDocumentContent(e) {
10
10
  };
11
11
  if (typeof e != "object") return { kind: "unknown" };
12
12
  let t = e;
13
- if ("role" in t && "content" in t) {
14
- let e = String(t.role), n = typeof t.id == "string" ? t.id : void 0, r = typeof t.stopReason == "string" ? t.stopReason : void 0, i = t.content;
15
- if (typeof i == "string") return {
16
- kind: "ui-message",
17
- role: e,
18
- messageId: n,
19
- stopReason: r,
20
- charCount: i.length
21
- };
22
- if (Array.isArray(i)) {
23
- let t = i, a = /* @__PURE__ */ new Map();
24
- for (let e of t) {
25
- let t = a.get(e.type) ?? {
13
+ if ("role" in t && ("text" in t || "blocks" in t)) {
14
+ let e = String(t.role), n = typeof t.id == "string" ? t.id : void 0, r = typeof t.stopReason == "string" ? t.stopReason : void 0, i = typeof t.text == "string" ? t.text : void 0, a = Array.isArray(t.blocks) ? t.blocks : void 0;
15
+ if (a && a.length > 0) {
16
+ let t = /* @__PURE__ */ new Map();
17
+ for (let e of a) {
18
+ let n = t.get(e.type) ?? {
26
19
  count: 0,
27
20
  labels: []
28
21
  };
29
- t.count += 1, (e.type === "tool_call" || e.type === "server_tool_use") && t.labels.push(e.name), a.set(e.type, t);
22
+ n.count += 1, (e.type === "tool_call" || e.type === "server_tool_use") && n.labels.push(e.name), t.set(e.type, n);
30
23
  }
24
+ let o = a.reduce((e, t) => t.type === "text" || t.type === "thinking" ? e + t.text.length : t.type === "tool_result" ? e + t.content.length : e, 0);
31
25
  return {
32
26
  kind: "ui-message",
33
27
  role: e,
34
28
  messageId: n,
35
29
  stopReason: r,
36
- charCount: t.reduce((e, t) => t.type === "text" || t.type === "thinking" ? e + t.text.length : t.type === "tool_result" ? e + t.content.length : e, 0),
37
- blocks: [...a.entries()].map(([e, { count: t, labels: n }]) => ({
30
+ charCount: i?.length ?? o,
31
+ blocks: [...t.entries()].map(([e, { count: t, labels: n }]) => ({
38
32
  type: e,
39
33
  count: t,
40
34
  labels: n.length > 0 ? n : void 0
41
35
  }))
42
36
  };
43
37
  }
38
+ return {
39
+ kind: "ui-message",
40
+ role: e,
41
+ messageId: n,
42
+ stopReason: r,
43
+ charCount: i?.length ?? 0
44
+ };
44
45
  }
45
46
  return {
46
47
  kind: "object",
@@ -1,10 +1,22 @@
1
1
  import CompletionMessagePaper_default from "../../../components/messages/CompletionMessagePaper.js";
2
- import AiMessageContent_default from "./AiMessageContent.js";
2
+ import MarkdownContent_default from "../../../components/dynamic-form/MarkdownContent.js";
3
3
  import { c } from "react/compiler-runtime";
4
4
  import React from "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
- var DocumentMessageRenderer_default = (i) => {
7
- let a = c(2), { document: o } = i, s = o.content, l;
8
- return a[0] === s ? l = a[1] : (l = /* @__PURE__ */ jsx(CompletionMessagePaper_default, { children: /* @__PURE__ */ jsx(AiMessageContent_default, { message: s }) }), a[0] = s, a[1] = l), l;
6
+ var KNOWN_ROLES = [
7
+ "system",
8
+ "user",
9
+ "assistant",
10
+ "tool",
11
+ "error",
12
+ "document"
13
+ ], DocumentMessageRenderer_default = (a) => {
14
+ let o = c(5), { document: s } = a, { role: l, text: u } = s.content, d = KNOWN_ROLES.includes(l ?? "") ? l : void 0, f = u ?? "", p;
15
+ o[0] === f ? p = o[1] : (p = /* @__PURE__ */ jsx(MarkdownContent_default, { content: f }), o[0] = f, o[1] = p);
16
+ let m;
17
+ return o[2] !== d || o[3] !== p ? (m = /* @__PURE__ */ jsx(CompletionMessagePaper_default, {
18
+ role: d,
19
+ children: p
20
+ }), o[2] = d, o[3] = p, o[4] = m) : m = o[4], m;
9
21
  };
10
22
  export { DocumentMessageRenderer_default as default };
@@ -1,15 +1,28 @@
1
+ import { useWorkflowStatus } from "../../../hooks/useWorkflows.js";
2
+ import { WorkflowState } from "../../../packages/contracts/dist/enums/workflow-state.enum.js";
3
+ import "../../../packages/contracts/dist/enums/index.js";
1
4
  import link_default from "../../../components/loopstack-elements/link.js";
2
5
  import { c } from "react/compiler-runtime";
3
6
  import React from "react";
4
7
  import { jsx } from "react/jsx-runtime";
5
- var LinkMessageRenderer_default = (r) => {
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;
8
+ function mapWorkflowStateToStatus(e) {
9
+ switch (e) {
10
+ case WorkflowState.Completed: return "success";
11
+ case WorkflowState.Failed:
12
+ case WorkflowState.Canceled: return "failure";
13
+ default: return "pending";
14
+ }
15
+ }
16
+ var LinkMessageRenderer_default = (a) => {
17
+ let o = c(8), { document: s } = a, { label: l, workflowId: u, embed: d, expanded: f } = s.content, p = u ? `/workflows/${u}` : void 0, m = useWorkflowStatus(u), h = m.data?.status, g;
18
+ o[0] === h ? g = o[1] : (g = mapWorkflowStateToStatus(h), o[0] = h, o[1] = g);
19
+ let _ = g, v = m.isSuccess ? f === !0 && _ === "pending" : void 0, y;
20
+ return o[2] !== d || o[3] !== p || o[4] !== v || o[5] !== l || o[6] !== _ ? (y = /* @__PURE__ */ jsx(link_default, {
21
+ href: p,
22
+ label: l,
23
+ status: _,
24
+ embed: d,
25
+ defaultExpanded: v
26
+ }), o[2] = d, o[3] = p, o[4] = v, o[5] = l, o[6] = _, o[7] = y) : y = o[7], y;
14
27
  };
15
28
  export { LinkMessageRenderer_default as default };
@@ -8,87 +8,98 @@ import { Fragment } from "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
9
  import { CopyIcon } from "lucide-react";
10
10
  var CopyActions = (e) => {
11
- let g = c(5), { text: _ } = e, v;
12
- g[0] === _ ? v = g[1] : (v = () => void navigator.clipboard.writeText(_), g[0] = _, g[1] = v);
13
- let y;
14
- g[2] === Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ jsx(CopyIcon, { className: "size-3" }), g[2] = y) : y = g[2];
11
+ let _ = c(5), { text: v } = e, y;
12
+ _[0] === v ? y = _[1] : (y = () => void navigator.clipboard.writeText(v), _[0] = v, _[1] = y);
15
13
  let b;
16
- return g[3] === v ? b = g[4] : (b = /* @__PURE__ */ jsx(FadeInBlock, { children: /* @__PURE__ */ jsx(MessageActions, { children: /* @__PURE__ */ jsx(MessageAction, {
17
- onClick: v,
14
+ _[2] === Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ jsx(CopyIcon, { className: "size-3" }), _[2] = b) : b = _[2];
15
+ let x;
16
+ return _[3] === y ? x = _[4] : (x = /* @__PURE__ */ jsx(FadeInBlock, { children: /* @__PURE__ */ jsx(MessageActions, { children: /* @__PURE__ */ jsx(MessageAction, {
17
+ onClick: y,
18
18
  label: "Copy",
19
- children: y
20
- }) }) }), g[3] = v, g[4] = b), b;
21
- }, LlmMessage_default = (m) => {
22
- let h = c(18), { document: x } = m, S = x.content, C = S.id ?? x.id, w = !!x.meta?.streaming;
23
- if (typeof S.content == "string") {
24
- let m;
25
- h[0] !== w || h[1] !== S.content ? (m = /* @__PURE__ */ jsx(MessageContent, { children: w ? /* @__PURE__ */ jsx(StreamingText, { text: S.content }) : /* @__PURE__ */ jsx(MessageResponse, { children: S.content }) }), h[0] = w, h[1] = S.content, h[2] = m) : m = h[2];
26
- let v;
27
- h[3] !== w || h[4] !== S.content || h[5] !== S.role ? (v = S.role === "assistant" && !w && /* @__PURE__ */ jsx(CopyActions, { text: S.content }), h[3] = w, h[4] = S.content, h[5] = S.role, h[6] = v) : v = h[6];
28
- let y;
29
- return h[7] !== S.role || h[8] !== m || h[9] !== v ? (y = /* @__PURE__ */ jsxs(Message, {
30
- from: S.role,
31
- children: [m, v]
32
- }), h[7] = S.role, h[8] = m, h[9] = v, h[10] = y) : y = h[10], y;
19
+ children: b
20
+ }) }) }), _[3] = y, _[4] = x), x;
21
+ };
22
+ function hasStructuredBlocks(e) {
23
+ return !!e?.some((e) => e.type !== "text");
24
+ }
25
+ function textFromBlocks(e) {
26
+ return (e ?? []).filter((e) => e.type === "text").map((e) => e.text).join("\n");
27
+ }
28
+ var LlmMessage_default = (h) => {
29
+ let g = c(23), { document: C } = h, w = C.content, T = w.id ?? C.id, E = !!C.meta?.streaming;
30
+ if (!hasStructuredBlocks(w.blocks)) {
31
+ let h;
32
+ g[0] !== w.blocks || g[1] !== w.text ? (h = w.text ?? textFromBlocks(w.blocks), g[0] = w.blocks, g[1] = w.text, g[2] = h) : h = g[2];
33
+ let y = h, b;
34
+ g[3] !== E || g[4] !== y ? (b = /* @__PURE__ */ jsx(MessageContent, { children: E ? /* @__PURE__ */ jsx(StreamingText, { text: y }) : /* @__PURE__ */ jsx(MessageResponse, { children: y }) }), g[3] = E, g[4] = y, g[5] = b) : b = g[5];
35
+ let x;
36
+ g[6] !== E || g[7] !== w.role || g[8] !== y ? (x = w.role === "assistant" && !E && /* @__PURE__ */ jsx(CopyActions, { text: y }), g[6] = E, g[7] = w.role, g[8] = y, g[9] = x) : x = g[9];
37
+ let S;
38
+ return g[10] !== w.role || g[11] !== b || g[12] !== x ? (S = /* @__PURE__ */ jsxs(Message, {
39
+ from: w.role,
40
+ children: [b, x]
41
+ }), g[10] = w.role, g[11] = b, g[12] = x, g[13] = S) : S = g[13], S;
33
42
  }
34
- let T = S.content, E;
35
- h[11] !== T || h[12] !== w || h[13] !== S.role || h[14] !== C ? (E = T.map((m, h) => {
36
- switch (m.type) {
43
+ let D;
44
+ g[14] === w.blocks ? D = g[15] : (D = w.blocks ?? [], g[14] = w.blocks, g[15] = D);
45
+ let O = D, k;
46
+ g[16] !== O || g[17] !== E || g[18] !== w.role || g[19] !== T ? (k = O.map((h, g) => {
47
+ switch (h.type) {
37
48
  case "text": return /* @__PURE__ */ jsxs(Message, {
38
- from: S.role,
39
- children: [/* @__PURE__ */ jsx(MessageContent, { children: w ? /* @__PURE__ */ jsx(StreamingText, { text: m.text }) : /* @__PURE__ */ jsx(MessageResponse, { children: m.text }) }), S.role === "assistant" && !w && /* @__PURE__ */ jsx(CopyActions, { text: m.text })]
40
- }, `${C}-${h}`);
49
+ from: w.role,
50
+ children: [/* @__PURE__ */ jsx(MessageContent, { children: E ? /* @__PURE__ */ jsx(StreamingText, { text: h.text }) : /* @__PURE__ */ jsx(MessageResponse, { children: h.text }) }), w.role === "assistant" && !E && /* @__PURE__ */ jsx(CopyActions, { text: h.text })]
51
+ }, `${T}-${g}`);
41
52
  case "thinking": return /* @__PURE__ */ jsxs(Reasoning, {
42
53
  className: "w-full",
43
- isStreaming: w,
44
- children: [/* @__PURE__ */ jsx(ReasoningTrigger, {}), /* @__PURE__ */ jsx(ReasoningContent, { children: m.text })]
45
- }, `${C}-${h}`);
54
+ isStreaming: E,
55
+ children: [/* @__PURE__ */ jsx(ReasoningTrigger, {}), /* @__PURE__ */ jsx(ReasoningContent, { children: h.text })]
56
+ }, `${T}-${g}`);
46
57
  case "tool_call": return /* @__PURE__ */ jsx(FadeInBlock, { children: /* @__PURE__ */ jsx(Message, {
47
58
  from: "assistant",
48
59
  children: /* @__PURE__ */ jsxs(Tool, { children: [/* @__PURE__ */ jsx(ToolHeader, {
49
60
  state: "input-available",
50
- title: m.name,
61
+ title: h.name,
51
62
  type: "tool-call"
52
- }), /* @__PURE__ */ jsx(ToolContent, { children: /* @__PURE__ */ jsx(ToolInput, { input: m.args }) })] })
53
- }) }, `${C}-${h}`);
63
+ }), /* @__PURE__ */ jsx(ToolContent, { children: /* @__PURE__ */ jsx(ToolInput, { input: h.args }) })] })
64
+ }) }, `${T}-${g}`);
54
65
  case "tool_result": {
55
- let g;
66
+ let _;
56
67
  try {
57
- g = JSON.parse(m.content);
68
+ _ = JSON.parse(h.content);
58
69
  } catch {
59
- g = m.content;
70
+ _ = h.content;
60
71
  }
61
72
  return /* @__PURE__ */ jsx(FadeInBlock, { children: /* @__PURE__ */ jsx(Message, {
62
73
  from: "assistant",
63
74
  children: /* @__PURE__ */ jsxs(Tool, { children: [/* @__PURE__ */ jsx(ToolHeader, {
64
- state: m.isError ? "output-error" : "output-available",
75
+ state: h.isError ? "output-error" : "output-available",
65
76
  title: "Tool Result",
66
77
  type: "tool-call"
67
78
  }), /* @__PURE__ */ jsx(ToolContent, { children: /* @__PURE__ */ jsx(ToolOutput, {
68
- output: g,
69
- errorText: m.isError ? m.content : ""
79
+ output: _,
80
+ errorText: h.isError ? h.content : ""
70
81
  }) })] })
71
- }) }, `${C}-${h}`);
82
+ }) }, `${T}-${g}`);
72
83
  }
73
84
  case "server_tool_use": {
74
- let g = T.find((e) => e.type === "server_tool_result" && e.toolUseId === m.id);
85
+ let _ = O.find((e) => e.type === "server_tool_result" && e.toolUseId === h.id);
75
86
  return /* @__PURE__ */ jsx(FadeInBlock, { children: /* @__PURE__ */ jsx(Message, {
76
87
  from: "assistant",
77
88
  children: /* @__PURE__ */ jsxs(Tool, { children: [/* @__PURE__ */ jsx(ToolHeader, {
78
- state: g ? "output-available" : "input-available",
79
- title: m.name,
89
+ state: _ ? "output-available" : "input-available",
90
+ title: h.name,
80
91
  type: "tool-call"
81
- }), /* @__PURE__ */ jsxs(ToolContent, { children: [/* @__PURE__ */ jsx(ToolInput, { input: m.input }), g && /* @__PURE__ */ jsx(ToolOutput, {
82
- output: g.content,
92
+ }), /* @__PURE__ */ jsxs(ToolContent, { children: [/* @__PURE__ */ jsx(ToolInput, { input: h.input }), _ && /* @__PURE__ */ jsx(ToolOutput, {
93
+ output: _.content,
83
94
  errorText: ""
84
95
  })] })] })
85
- }) }, `${C}-${h}`);
96
+ }) }, `${T}-${g}`);
86
97
  }
87
98
  case "server_tool_result": return null;
88
99
  default: return null;
89
100
  }
90
- }), h[11] = T, h[12] = w, h[13] = S.role, h[14] = C, h[15] = E) : E = h[15];
91
- let D;
92
- return h[16] === E ? D = h[17] : (D = /* @__PURE__ */ jsx(Fragment, { children: E }), h[16] = E, h[17] = D), D;
101
+ }), g[16] = O, g[17] = E, g[18] = w.role, g[19] = T, g[20] = k) : k = g[20];
102
+ let A;
103
+ return g[21] === k ? A = g[22] : (A = /* @__PURE__ */ jsx(Fragment, { children: k }), g[21] = k, g[22] = A), A;
93
104
  };
94
105
  export { LlmMessage_default as default };
@@ -15,18 +15,21 @@ function createStreamingDocument(e, r, i) {
15
15
  i.thinking && a.push({
16
16
  type: "thinking",
17
17
  text: i.thinking
18
- }), a.push({
18
+ });
19
+ let o = i.error ? `Error while streaming response: ${i.error}` : i.text;
20
+ a.push({
19
21
  type: "text",
20
- text: i.error ? `Error while streaming response: ${i.error}` : i.text
22
+ text: o
21
23
  }), a.push(...i.toolCalls);
22
- let o = /* @__PURE__ */ new Date();
24
+ let s = /* @__PURE__ */ new Date();
23
25
  return {
24
26
  id: `streaming-${i.messageId}`,
25
27
  documentName: "llm_message",
26
28
  content: {
27
29
  id: i.messageId,
28
30
  role: "assistant",
29
- content: a
31
+ text: o,
32
+ blocks: a
30
33
  },
31
34
  validationError: null,
32
35
  meta: {
@@ -39,8 +42,8 @@ function createStreamingDocument(e, r, i) {
39
42
  place: r,
40
43
  labels: [],
41
44
  tags: ["message"],
42
- createdAt: o,
43
- updatedAt: o,
45
+ createdAt: s,
46
+ updatedAt: s,
44
47
  workspaceId: "",
45
48
  workflowId: e
46
49
  };
@@ -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, getWorkflowTypesCacheKey, getWorkflowsCacheKey, getWorkspaceCacheKey, getWorkspacesCacheKey } from "./query-keys.js";
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
2
  import { useApiClient } from "./useApi.js";
3
3
  import { useIsMobile } from "./use-mobile.js";
4
4
  import { useAppsConfig, useAvailableEnvironments, useDocumentConfigs } from "./useConfig.js";
5
5
  import { useReplaceEnvironments, useResetEnvironment, useWorkspaceEnvironments } from "./useEnvironments.js";
6
- import { useBatchDeleteWorkflows, useChildWorkflows, useCreateWorkflow, useDeleteWorkflow, useFilterWorkflows, useUpdateWorkflow, useWorkflow, useWorkflowCheckpoints, useWorkflowConfigByName, useWorkflowSource } from "./useWorkflows.js";
6
+ import { useBatchDeleteWorkflows, useChildWorkflows, useCreateWorkflow, useDeleteWorkflow, useFilterWorkflows, useUpdateWorkflow, useWorkflow, useWorkflowCheckpoints, useWorkflowConfigByName, useWorkflowSource, useWorkflowStatus } from "./useWorkflows.js";
7
7
  import { useBatchDeleteWorkspaces, useCreateWorkspace, useDeleteWorkspace, useFilterWorkspaces, useSetFavouriteWorkspace, useUpdateWorkspace, useWorkspace } from "./useWorkspaces.js";
@@ -7,11 +7,11 @@ function getHealthCacheKey(e) {
7
7
  function getAppTypesCacheKey(e) {
8
8
  return ["app-types", e];
9
9
  }
10
- function getWorkflowTypesCacheKey(e, S) {
10
+ function getWorkflowTypesCacheKey(e, C) {
11
11
  return [
12
12
  "workflowTypes",
13
13
  e,
14
- S
14
+ C
15
15
  ];
16
16
  }
17
17
  function getStudioAppsCacheKey(e) {
@@ -27,112 +27,119 @@ function getDashboardStatsCacheKey(e) {
27
27
  e
28
28
  ];
29
29
  }
30
- function getWorkflowCacheKey(e, S) {
30
+ function getWorkflowCacheKey(e, C) {
31
31
  return [
32
32
  "workflow",
33
33
  e,
34
- S
34
+ C
35
+ ];
36
+ }
37
+ function getWorkflowStatusCacheKey(e, C) {
38
+ return [
39
+ "workflowStatus",
40
+ e,
41
+ C
35
42
  ];
36
43
  }
37
44
  function getWorkflowsCacheKey(e) {
38
45
  return ["workflows", e];
39
46
  }
40
- function getChildWorkflowsCacheKey(e, S) {
47
+ function getChildWorkflowsCacheKey(e, C) {
41
48
  return [
42
49
  "childWorkflows",
43
50
  e,
44
- S
51
+ C
45
52
  ];
46
53
  }
47
54
  function getToolConfigsCacheKey(e) {
48
55
  return ["toolConfigs", e];
49
56
  }
50
- function getToolConfigCacheKey(e, S) {
57
+ function getToolConfigCacheKey(e, C) {
51
58
  return [
52
59
  "toolConfig",
53
60
  e,
54
- S
61
+ C
55
62
  ];
56
63
  }
57
- function getWorkflowConfigCacheKey(e, S) {
64
+ function getWorkflowConfigCacheKey(e, C) {
58
65
  return [
59
66
  "workflowConfig",
60
67
  e,
61
- S
68
+ C
62
69
  ];
63
70
  }
64
- function getWorkflowSourceCacheKey(e, S) {
71
+ function getWorkflowSourceCacheKey(e, C) {
65
72
  return [
66
73
  "workflowSource",
67
74
  e,
68
- S
75
+ C
69
76
  ];
70
77
  }
71
- function getWorkspaceCacheKey(e, S) {
78
+ function getWorkspaceCacheKey(e, C) {
72
79
  return [
73
80
  "workspace",
74
81
  e,
75
- S
82
+ C
76
83
  ];
77
84
  }
78
85
  function getWorkspacesCacheKey(e) {
79
86
  return ["workspaces", e];
80
87
  }
81
- function getDocumentCacheKey(e, S) {
88
+ function getDocumentCacheKey(e, C) {
82
89
  return [
83
90
  "document",
84
91
  e,
85
- S
92
+ C
86
93
  ];
87
94
  }
88
- function getDocumentsCacheKey(e, S) {
95
+ function getDocumentsCacheKey(e, C) {
89
96
  return [
90
97
  "documents",
91
98
  e,
92
- S
99
+ C
93
100
  ];
94
101
  }
95
- function getSecretsCacheKey(e, S) {
102
+ function getSecretsCacheKey(e, C) {
96
103
  return [
97
104
  "secrets",
98
105
  e,
99
- S
106
+ C
100
107
  ];
101
108
  }
102
- function getGitStatusCacheKey(e, S) {
109
+ function getGitStatusCacheKey(e, C) {
103
110
  return [
104
111
  "gitStatus",
105
112
  e,
106
- S
113
+ C
107
114
  ];
108
115
  }
109
- function getGitLogCacheKey(e, S) {
116
+ function getGitLogCacheKey(e, C) {
110
117
  return [
111
118
  "gitLog",
112
119
  e,
113
- S
120
+ C
114
121
  ];
115
122
  }
116
- function getGitRemoteCacheKey(e, S) {
123
+ function getGitRemoteCacheKey(e, C) {
117
124
  return [
118
125
  "gitRemote",
119
126
  e,
120
- S
127
+ C
121
128
  ];
122
129
  }
123
- function getFileTreeCacheKey(e, S) {
130
+ function getFileTreeCacheKey(e, C) {
124
131
  return [
125
132
  "fileTree",
126
133
  e,
127
- S
134
+ C
128
135
  ];
129
136
  }
130
- function getFileContentCacheKey(e, S, C) {
137
+ function getFileContentCacheKey(e, C, w) {
131
138
  return [
132
139
  "fileContent",
133
140
  e,
134
- S,
135
- C
141
+ C,
142
+ w
136
143
  ];
137
144
  }
138
- export { getAppTypesCacheKey, getAvailableEnvironmentsCacheKey, getChildWorkflowsCacheKey, getDashboardStatsCacheKey, getDocumentCacheKey, getDocumentsCacheKey, getFileContentCacheKey, getFileTreeCacheKey, getGitLogCacheKey, getGitRemoteCacheKey, getGitStatusCacheKey, getHealthCacheKey, getMeCacheKey, getSecretsCacheKey, getStudioAppsCacheKey, getToolConfigCacheKey, getToolConfigsCacheKey, getWorkflowCacheKey, getWorkflowConfigCacheKey, getWorkflowSourceCacheKey, getWorkflowTypesCacheKey, getWorkflowsCacheKey, getWorkspaceCacheKey, getWorkspacesCacheKey };
145
+ export { 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 };
@@ -1,21 +1,33 @@
1
- import { getChildWorkflowsCacheKey, getWorkflowCacheKey, getWorkflowConfigCacheKey, getWorkflowSourceCacheKey, getWorkflowsCacheKey } from "./query-keys.js";
1
+ import { getChildWorkflowsCacheKey, getWorkflowCacheKey, getWorkflowConfigCacheKey, getWorkflowSourceCacheKey, getWorkflowStatusCacheKey, getWorkflowsCacheKey } from "./query-keys.js";
2
2
  import { useApiClient } from "./useApi.js";
3
3
  import { c } from "react/compiler-runtime";
4
4
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
5
5
  function useWorkflow(e) {
6
6
  let i = c(10), { envKey: a, api: o } = useApiClient(), s;
7
7
  i[0] !== a || i[1] !== e ? (s = getWorkflowCacheKey(a, e), i[0] = a, i[1] = e, i[2] = s) : s = i[2];
8
- let u;
9
- i[3] !== o || i[4] !== e ? (u = () => o.workflows.getById({ id: e }), i[3] = o, i[4] = e, i[5] = u) : u = i[5];
8
+ let l;
9
+ i[3] !== o || i[4] !== e ? (l = () => o.workflows.getById({ id: e }), i[3] = o, i[4] = e, i[5] = l) : l = i[5];
10
+ let d = !!e, f;
11
+ return i[6] !== s || i[7] !== l || i[8] !== d ? (f = {
12
+ queryKey: s,
13
+ queryFn: l,
14
+ enabled: d
15
+ }, i[6] = s, i[7] = l, i[8] = d, i[9] = f) : f = i[9], useQuery(f);
16
+ }
17
+ function useWorkflowStatus(e) {
18
+ let r = c(10), { envKey: i, api: a } = useApiClient(), s;
19
+ r[0] !== i || r[1] !== e ? (s = getWorkflowStatusCacheKey(i, e), r[0] = i, r[1] = e, r[2] = s) : s = r[2];
20
+ let l;
21
+ r[3] !== a || r[4] !== e ? (l = () => a.workflows.getStatusById({ id: e }), r[3] = a, r[4] = e, r[5] = l) : l = r[5];
10
22
  let d = !!e, f;
11
- return i[6] !== s || i[7] !== u || i[8] !== d ? (f = {
23
+ return r[6] !== s || r[7] !== l || r[8] !== d ? (f = {
12
24
  queryKey: s,
13
- queryFn: u,
25
+ queryFn: l,
14
26
  enabled: d
15
- }, i[6] = s, i[7] = u, i[8] = d, i[9] = f) : f = i[9], useQuery(f);
27
+ }, r[6] = s, r[7] = l, r[8] = d, r[9] = f) : f = r[9], useQuery(f);
16
28
  }
17
- function useFilterWorkflows(e, r, i, a, s, u) {
18
- let d = c(32), f = i === void 0 ? "id" : i, p = a === void 0 ? "DESC" : a, m = s === void 0 ? 0 : s, h = u === void 0 ? 10 : u, { envKey: g, api: _ } = useApiClient(), v;
29
+ function useFilterWorkflows(e, r, i, a, o, l) {
30
+ let d = c(32), f = i === void 0 ? "id" : i, p = a === void 0 ? "DESC" : a, m = o === void 0 ? 0 : o, h = l === void 0 ? 10 : l, { envKey: g, api: _ } = useApiClient(), v;
19
31
  d[0] === r ? v = d[1] : (v = Object.keys(r), d[0] = r, d[1] = v);
20
32
  let y = v.length > 0, b;
21
33
  d[2] !== r || d[3] !== y ? (b = y ? JSON.stringify(r) : void 0, d[2] = r, d[3] = y, d[4] = b) : b = d[4];
@@ -59,62 +71,62 @@ function useFilterWorkflows(e, r, i, a, s, u) {
59
71
  }, d[29] = D, d[30] = O, d[31] = k) : k = d[31], useQuery(k);
60
72
  }
61
73
  function useCreateWorkflow() {
62
- let e = c(8), { envKey: r, api: i } = useApiClient(), a = useQueryClient(), l;
63
- e[0] === i ? l = e[1] : (l = (e) => i.workflows.create(e), e[0] = i, e[1] = l);
64
- let d;
65
- e[2] !== r || e[3] !== a ? (d = () => {
74
+ let e = c(8), { envKey: r, api: i } = useApiClient(), a = useQueryClient(), o;
75
+ e[0] === i ? o = e[1] : (o = (e) => i.workflows.create(e), e[0] = i, e[1] = o);
76
+ let u;
77
+ e[2] !== r || e[3] !== a ? (u = () => {
66
78
  a.invalidateQueries({ queryKey: getWorkflowsCacheKey(r) });
67
- }, e[2] = r, e[3] = a, e[4] = d) : d = e[4];
79
+ }, e[2] = r, e[3] = a, e[4] = u) : u = e[4];
68
80
  let f;
69
- return e[5] !== l || e[6] !== d ? (f = {
70
- mutationFn: l,
71
- onSuccess: d
72
- }, e[5] = l, e[6] = d, e[7] = f) : f = e[7], useMutation(f);
81
+ return e[5] !== o || e[6] !== u ? (f = {
82
+ mutationFn: o,
83
+ onSuccess: u
84
+ }, e[5] = o, e[6] = u, e[7] = f) : f = e[7], useMutation(f);
73
85
  }
74
86
  function useUpdateWorkflow() {
75
- let e = c(8), { envKey: i, api: a } = useApiClient(), l = useQueryClient(), d;
76
- e[0] === a ? d = e[1] : (d = (e) => a.workflows.update(e), e[0] = a, e[1] = d);
87
+ let e = c(8), { envKey: i, api: a } = useApiClient(), o = useQueryClient(), u;
88
+ e[0] === a ? u = e[1] : (u = (e) => a.workflows.update(e), e[0] = a, e[1] = u);
77
89
  let f;
78
- e[2] !== i || e[3] !== l ? (f = (e, a) => {
79
- l.invalidateQueries({ queryKey: getWorkflowCacheKey(i, a.id) }), l.invalidateQueries({ queryKey: getWorkflowsCacheKey(i) });
80
- }, e[2] = i, e[3] = l, e[4] = f) : f = e[4];
90
+ e[2] !== i || e[3] !== o ? (f = (e, a) => {
91
+ o.invalidateQueries({ queryKey: getWorkflowCacheKey(i, a.id) }), o.invalidateQueries({ queryKey: getWorkflowsCacheKey(i) });
92
+ }, e[2] = i, e[3] = o, e[4] = f) : f = e[4];
81
93
  let p;
82
- return e[5] !== d || e[6] !== f ? (p = {
83
- mutationFn: d,
94
+ return e[5] !== u || e[6] !== f ? (p = {
95
+ mutationFn: u,
84
96
  onSuccess: f
85
- }, e[5] = d, e[6] = f, e[7] = p) : p = e[7], useMutation(p);
97
+ }, e[5] = u, e[6] = f, e[7] = p) : p = e[7], useMutation(p);
86
98
  }
87
99
  function useDeleteWorkflow() {
88
- let e = c(8), { envKey: i, api: a } = useApiClient(), l = useQueryClient(), d;
89
- e[0] === a ? d = e[1] : (d = (e) => a.workflows.delete({ id: e }), e[0] = a, e[1] = d);
100
+ let e = c(8), { envKey: i, api: a } = useApiClient(), o = useQueryClient(), u;
101
+ e[0] === a ? u = e[1] : (u = (e) => a.workflows.delete({ id: e }), e[0] = a, e[1] = u);
90
102
  let f;
91
- e[2] !== i || e[3] !== l ? (f = (e, a) => {
92
- l.removeQueries({ queryKey: getWorkflowCacheKey(i, a) }), l.invalidateQueries({ queryKey: getWorkflowsCacheKey(i) });
93
- }, e[2] = i, e[3] = l, e[4] = f) : f = e[4];
103
+ e[2] !== i || e[3] !== o ? (f = (e, a) => {
104
+ o.removeQueries({ queryKey: getWorkflowCacheKey(i, a) }), o.invalidateQueries({ queryKey: getWorkflowsCacheKey(i) });
105
+ }, e[2] = i, e[3] = o, e[4] = f) : f = e[4];
94
106
  let p;
95
- return e[5] !== d || e[6] !== f ? (p = {
96
- mutationFn: d,
107
+ return e[5] !== u || e[6] !== f ? (p = {
108
+ mutationFn: u,
97
109
  onSuccess: f
98
- }, e[5] = d, e[6] = f, e[7] = p) : p = e[7], useMutation(p);
110
+ }, e[5] = u, e[6] = f, e[7] = p) : p = e[7], useMutation(p);
99
111
  }
100
112
  function useBatchDeleteWorkflows() {
101
- let e = c(8), { envKey: r, api: i } = useApiClient(), a = useQueryClient(), l;
102
- e[0] === i ? l = e[1] : (l = (e) => i.workflows.batchDelete({ ids: e }), e[0] = i, e[1] = l);
103
- let d;
104
- e[2] !== r || e[3] !== a ? (d = () => {
113
+ let e = c(8), { envKey: r, api: i } = useApiClient(), a = useQueryClient(), o;
114
+ e[0] === i ? o = e[1] : (o = (e) => i.workflows.batchDelete({ ids: e }), e[0] = i, e[1] = o);
115
+ let u;
116
+ e[2] !== r || e[3] !== a ? (u = () => {
105
117
  a.invalidateQueries({ queryKey: getWorkflowsCacheKey(r) });
106
- }, e[2] = r, e[3] = a, e[4] = d) : d = e[4];
118
+ }, e[2] = r, e[3] = a, e[4] = u) : u = e[4];
107
119
  let f;
108
- return e[5] !== l || e[6] !== d ? (f = {
109
- mutationFn: l,
110
- onSuccess: d
111
- }, e[5] = l, e[6] = d, e[7] = f) : f = e[7], useMutation(f);
120
+ return e[5] !== o || e[6] !== u ? (f = {
121
+ mutationFn: o,
122
+ onSuccess: u
123
+ }, e[5] = o, e[6] = u, e[7] = f) : f = e[7], useMutation(f);
112
124
  }
113
125
  function useChildWorkflows(r, i) {
114
- let a = c(10), o = i === void 0 ? !0 : i, { envKey: s, api: u } = useApiClient(), d;
126
+ let a = c(10), o = i === void 0 ? !0 : i, { envKey: s, api: l } = useApiClient(), d;
115
127
  a[0] !== s || a[1] !== r ? (d = getChildWorkflowsCacheKey(s, r), a[0] = s, a[1] = r, a[2] = d) : d = a[2];
116
128
  let f;
117
- a[3] !== u || a[4] !== r ? (f = () => u.workflows.getAll({
129
+ a[3] !== l || a[4] !== r ? (f = () => l.workflows.getAll({
118
130
  filter: JSON.stringify({ parentId: r }),
119
131
  sortBy: JSON.stringify([{
120
132
  field: "createdAt",
@@ -122,7 +134,7 @@ function useChildWorkflows(r, i) {
122
134
  }]),
123
135
  page: 0,
124
136
  limit: 100
125
- }), a[3] = u, a[4] = r, a[5] = f) : f = a[5];
137
+ }), a[3] = l, a[4] = r, a[5] = f) : f = a[5];
126
138
  let p = o && !!r, m;
127
139
  return a[6] !== d || a[7] !== f || a[8] !== p ? (m = {
128
140
  queryKey: d,
@@ -137,37 +149,37 @@ function _temp(e) {
137
149
  function useWorkflowConfigByName(e) {
138
150
  let r = c(10), { envKey: a, api: o } = useApiClient(), s;
139
151
  r[0] !== a || r[1] !== e ? (s = getWorkflowConfigCacheKey(a, e), r[0] = a, r[1] = e, r[2] = s) : s = r[2];
140
- let u;
141
- r[3] !== o || r[4] !== e ? (u = () => o.config.getWorkflowConfig({ workflowName: e }), r[3] = o, r[4] = e, r[5] = u) : u = r[5];
152
+ let l;
153
+ r[3] !== o || r[4] !== e ? (l = () => o.config.getWorkflowConfig({ workflowName: e }), r[3] = o, r[4] = e, r[5] = l) : l = r[5];
142
154
  let d = !!e, f;
143
- return r[6] !== s || r[7] !== u || r[8] !== d ? (f = {
155
+ return r[6] !== s || r[7] !== l || r[8] !== d ? (f = {
144
156
  queryKey: s,
145
- queryFn: u,
157
+ queryFn: l,
146
158
  enabled: d
147
- }, r[6] = s, r[7] = u, r[8] = d, r[9] = f) : f = r[9], useQuery(f);
159
+ }, r[6] = s, r[7] = l, r[8] = d, r[9] = f) : f = r[9], useQuery(f);
148
160
  }
149
161
  function useWorkflowSource(e) {
150
162
  let r = c(10), { envKey: i, api: o } = useApiClient(), s;
151
163
  r[0] !== i || r[1] !== e ? (s = getWorkflowSourceCacheKey(i, e), r[0] = i, r[1] = e, r[2] = s) : s = r[2];
152
- let u;
153
- r[3] !== o || r[4] !== e ? (u = () => o.config.getWorkflowSource({ workflowName: e }), r[3] = o, r[4] = e, r[5] = u) : u = r[5];
164
+ let l;
165
+ r[3] !== o || r[4] !== e ? (l = () => o.config.getWorkflowSource({ workflowName: e }), r[3] = o, r[4] = e, r[5] = l) : l = r[5];
154
166
  let d = !!e, f;
155
- return r[6] !== s || r[7] !== u || r[8] !== d ? (f = {
167
+ return r[6] !== s || r[7] !== l || r[8] !== d ? (f = {
156
168
  queryKey: s,
157
- queryFn: u,
169
+ queryFn: l,
158
170
  enabled: d
159
- }, r[6] = s, r[7] = u, r[8] = d, r[9] = f) : f = r[9], useQuery(f);
171
+ }, r[6] = s, r[7] = l, r[8] = d, r[9] = f) : f = r[9], useQuery(f);
160
172
  }
161
173
  function useWorkflowCheckpoints(e) {
162
174
  let i = c(10), { envKey: a, api: o } = useApiClient(), s;
163
175
  i[0] !== a || i[1] !== e ? (s = [...getWorkflowCacheKey(a, e), "checkpoints"], i[0] = a, i[1] = e, i[2] = s) : s = i[2];
164
- let u;
165
- i[3] !== o || i[4] !== e ? (u = () => o.workflows.getCheckpoints({ id: e }), i[3] = o, i[4] = e, i[5] = u) : u = i[5];
176
+ let l;
177
+ i[3] !== o || i[4] !== e ? (l = () => o.workflows.getCheckpoints({ id: e }), i[3] = o, i[4] = e, i[5] = l) : l = i[5];
166
178
  let d = !!e, f;
167
- return i[6] !== s || i[7] !== u || i[8] !== d ? (f = {
179
+ return i[6] !== s || i[7] !== l || i[8] !== d ? (f = {
168
180
  queryKey: s,
169
- queryFn: u,
181
+ queryFn: l,
170
182
  enabled: d
171
- }, i[6] = s, i[7] = u, i[8] = d, i[9] = f) : f = i[9], useQuery(f);
183
+ }, i[6] = s, i[7] = l, i[8] = d, i[9] = f) : f = i[9], useQuery(f);
172
184
  }
173
- export { useBatchDeleteWorkflows, useChildWorkflows, useCreateWorkflow, useDeleteWorkflow, useFilterWorkflows, useUpdateWorkflow, useWorkflow, useWorkflowCheckpoints, useWorkflowConfigByName, useWorkflowSource };
185
+ export { useBatchDeleteWorkflows, useChildWorkflows, useCreateWorkflow, useDeleteWorkflow, useFilterWorkflows, useUpdateWorkflow, useWorkflow, useWorkflowCheckpoints, useWorkflowConfigByName, useWorkflowSource, useWorkflowStatus };
package/dist/index.d.ts CHANGED
@@ -49,6 +49,7 @@ import { WorkflowCreateInterface } from '@loopstack/contracts/api';
49
49
  import { WorkflowFullInterface } from '@loopstack/contracts/api';
50
50
  import { WorkflowItemInterface } from '@loopstack/contracts/api';
51
51
  import { WorkflowSourceInterface } from '@loopstack/contracts/api';
52
+ import { WorkflowStatusInterface } from '@loopstack/contracts/api';
52
53
  import { WorkflowUpdateInterface } from '@loopstack/contracts/api';
53
54
  import { WorkspaceCreateInterface } from '@loopstack/contracts/api';
54
55
  import { WorkspaceEnvironmentInterface } from '@loopstack/contracts/api';
@@ -367,6 +368,9 @@ declare function createApi(http: AxiosInstance): {
367
368
  getById: (params: {
368
369
  id: string;
369
370
  }) => Promise<WorkflowFullInterface>;
371
+ getStatusById: (params: {
372
+ id: string;
373
+ }) => Promise<WorkflowStatusInterface>;
370
374
  getAll: (params?: {
371
375
  filter?: string;
372
376
  sortBy?: string;
@@ -817,6 +821,8 @@ export declare function getWorkflowsCacheKey(envKey: string): string[];
817
821
 
818
822
  export declare function getWorkflowSourceCacheKey(envKey: string, alias: string): string[];
819
823
 
824
+ export declare function getWorkflowStatusCacheKey(envKey: string, id: string): string[];
825
+
820
826
  export declare function getWorkflowTypesCacheKey(envKey: string, appBlockName: string): string[];
821
827
 
822
828
  export declare function getWorkspaceCacheKey(envKey: string, id: string): string[];
@@ -1506,6 +1512,12 @@ export declare function useWorkflowConfigByName(workflowName: string | undefined
1506
1512
  */
1507
1513
  export declare function useWorkflowSource(workflowName: string | undefined): UseQueryResult<WorkflowSourceInterface, Error>;
1508
1514
 
1515
+ /**
1516
+ * Fetch the slim live status for a single workflow — used by embedded sub-workflow link cards
1517
+ * to react to state changes without pulling the full workflow payload.
1518
+ */
1519
+ export declare function useWorkflowStatus(id: string | undefined): UseQueryResult<WorkflowStatusInterface, Error>;
1520
+
1509
1521
  export declare function useWorkspace(id: string | undefined): UseQueryResult<WorkspaceInterface, Error>;
1510
1522
 
1511
1523
  export declare function useWorkspaceEnvironments(workspaceId?: string): UseQueryResult<WorkspaceEnvironmentInterface[], Error>;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getAppTypesCacheKey, getAvailableEnvironmentsCacheKey, getChildWorkflowsCacheKey, getDashboardStatsCacheKey, getDocumentCacheKey, getDocumentsCacheKey, getFileContentCacheKey, getFileTreeCacheKey, getGitLogCacheKey, getGitRemoteCacheKey, getGitStatusCacheKey, getHealthCacheKey, getMeCacheKey, getSecretsCacheKey, getStudioAppsCacheKey, getToolConfigCacheKey, getToolConfigsCacheKey, getWorkflowCacheKey, getWorkflowConfigCacheKey, getWorkflowSourceCacheKey, getWorkflowTypesCacheKey, getWorkflowsCacheKey, getWorkspaceCacheKey, getWorkspacesCacheKey } from "./hooks/query-keys.js";
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 "./hooks/query-keys.js";
2
2
  import { createApiClient } from "./services/createApiClient.js";
3
3
  import { eventBus } from "./services/eventEmitter.js";
4
4
  import "./services/index.js";
@@ -7,7 +7,7 @@ import { useApiClient } from "./hooks/useApi.js";
7
7
  import { useIsMobile } from "./hooks/use-mobile.js";
8
8
  import { useAppsConfig, useAvailableEnvironments, useDocumentConfigs } from "./hooks/useConfig.js";
9
9
  import { useReplaceEnvironments, useResetEnvironment, useWorkspaceEnvironments } from "./hooks/useEnvironments.js";
10
- import { useBatchDeleteWorkflows, useChildWorkflows, useCreateWorkflow, useDeleteWorkflow, useFilterWorkflows, useUpdateWorkflow, useWorkflow, useWorkflowCheckpoints, useWorkflowConfigByName, useWorkflowSource } from "./hooks/useWorkflows.js";
10
+ import { useBatchDeleteWorkflows, useChildWorkflows, useCreateWorkflow, useDeleteWorkflow, useFilterWorkflows, useUpdateWorkflow, useWorkflow, useWorkflowCheckpoints, useWorkflowConfigByName, useWorkflowSource, useWorkflowStatus } from "./hooks/useWorkflows.js";
11
11
  import { useBatchDeleteWorkspaces, useCreateWorkspace, useDeleteWorkspace, useFilterWorkspaces, useSetFavouriteWorkspace, useUpdateWorkspace, useWorkspace } from "./hooks/useWorkspaces.js";
12
12
  import "./hooks/index.js";
13
13
  import { StudioPreferencesProvider, useOptionalStudioPreferences, useStudioPreferences } from "./providers/StudioPreferencesProvider.js";
@@ -90,4 +90,4 @@ import LocalHealthCheck_default from "./features/health/LocalHealthCheck.js";
90
90
  import EnvironmentEmbedRoot from "./app/EnvironmentEmbedRoot.js";
91
91
  import { StudioSidebar } from "./components/layout/StudioSidebar.js";
92
92
  import "./features/health/index.js";
93
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, CompletionMessagePaper_default as CompletionMessagePaper, ComponentOverridesProvider, ConfirmDialog_default as ConfirmDialog, CreateWorkspace_default as CreateWorkspace, CustomListView_default as CustomItemListView, DashboardPage, DataList, DataTable, DataTableBatchAction_default as DataTableBatchActions, DataTableFilters_default as DataTableFilters, DataTablePagination_default as DataTablePagination, DataTableToolbar_default as DataTableToolbar, DebugPage_default as DebugPage, DebugWorkflowDetailsPage, DebugWorkflowsPage, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiscordLogo, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmbedWorkbenchPage, EnvironmentEmbedRoot, EnvironmentSlotSelector, ErrorAlert_default as ErrorAlert, ErrorBoundary, ErrorSnackbar_default as ErrorSnackbar, FeatureRegistryProvider, GoogleLogo, Input, InvalidationEventsProvider, ListView_default as ItemListView, Label, LoadingCentered_default as LoadingCentered, LocalHealthCheck_default as LocalHealthCheck, LocalRouter, MainLayout_default as MainLayout, PageBreadcrumbs_default as PageBreadcrumbs, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PreviewWorkbenchPage, RadioGroup, RadioGroupItem, RunsListPage, RunsPage, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarInsetDiv, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuDiv, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Snackbar_default as Snackbar, SseProvider, StudioLandingPage, StudioPreferencesProvider, StudioProvider, StudioSidebar, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, WorkbenchPage, WorkflowDebugPage_default as WorkflowDebugPage, WorkspacePage_default as WorkspacePage, WorkspaceRunsPage_default as WorkspaceRunsPage, WorkspacesPage, badgeVariants, buttonVariants, createApiClient, eventBus, fileExplorerFeature, getAppTypesCacheKey, getAvailableEnvironmentsCacheKey, getChildWorkflowsCacheKey, getDashboardStatsCacheKey, getDocumentCacheKey, getDocumentsCacheKey, getFileContentCacheKey, getFileTreeCacheKey, getGitLogCacheKey, getGitRemoteCacheKey, getGitStatusCacheKey, getHealthCacheKey, getMeCacheKey, getSecretsCacheKey, getStudioAppsCacheKey, getToolConfigCacheKey, getToolConfigsCacheKey, getWorkflowCacheKey, getWorkflowConfigCacheKey, getWorkflowSourceCacheKey, getWorkflowTypesCacheKey, getWorkflowsCacheKey, getWorkspaceCacheKey, getWorkspacesCacheKey, secretsFeature, useApiClient, useAppsConfig, useAvailableEnvironments, useBatchDeleteWorkflows, useBatchDeleteWorkspaces, useChildWorkflows, useComponentOverrides, useCreateWorkflow, useCreateWorkspace, useDeleteWorkflow, useDeleteWorkspace, useDocumentConfigs, useFilterWorkflows, useFilterWorkspaces, useIsMobile, useOptionalStudioPreferences, useReplaceEnvironments, useResetEnvironment, useRouter, useSetFavouriteWorkspace, useSidebar, useStudio, useStudioOptional, useStudioPreferences, useUpdateWorkflow, useUpdateWorkspace, useWorkflow, useWorkflowCheckpoints, useWorkflowConfigByName, useWorkflowSource, useWorkspace, useWorkspaceEnvironments };
93
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, CompletionMessagePaper_default as CompletionMessagePaper, ComponentOverridesProvider, ConfirmDialog_default as ConfirmDialog, CreateWorkspace_default as CreateWorkspace, CustomListView_default as CustomItemListView, DashboardPage, DataList, DataTable, DataTableBatchAction_default as DataTableBatchActions, DataTableFilters_default as DataTableFilters, DataTablePagination_default as DataTablePagination, DataTableToolbar_default as DataTableToolbar, DebugPage_default as DebugPage, DebugWorkflowDetailsPage, DebugWorkflowsPage, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiscordLogo, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmbedWorkbenchPage, EnvironmentEmbedRoot, EnvironmentSlotSelector, ErrorAlert_default as ErrorAlert, ErrorBoundary, ErrorSnackbar_default as ErrorSnackbar, FeatureRegistryProvider, GoogleLogo, Input, InvalidationEventsProvider, ListView_default as ItemListView, Label, LoadingCentered_default as LoadingCentered, LocalHealthCheck_default as LocalHealthCheck, LocalRouter, MainLayout_default as MainLayout, PageBreadcrumbs_default as PageBreadcrumbs, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PreviewWorkbenchPage, RadioGroup, RadioGroupItem, RunsListPage, RunsPage, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarInsetDiv, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuDiv, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Snackbar_default as Snackbar, SseProvider, StudioLandingPage, StudioPreferencesProvider, StudioProvider, StudioSidebar, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, WorkbenchPage, WorkflowDebugPage_default as WorkflowDebugPage, WorkspacePage_default as WorkspacePage, WorkspaceRunsPage_default as WorkspaceRunsPage, WorkspacesPage, badgeVariants, buttonVariants, createApiClient, eventBus, fileExplorerFeature, 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, secretsFeature, useApiClient, useAppsConfig, useAvailableEnvironments, useBatchDeleteWorkflows, useBatchDeleteWorkspaces, useChildWorkflows, useComponentOverrides, useCreateWorkflow, useCreateWorkspace, useDeleteWorkflow, useDeleteWorkspace, useDocumentConfigs, useFilterWorkflows, useFilterWorkspaces, useIsMobile, useOptionalStudioPreferences, useReplaceEnvironments, useResetEnvironment, useRouter, useSetFavouriteWorkspace, useSidebar, useStudio, useStudioOptional, useStudioPreferences, useUpdateWorkflow, useUpdateWorkspace, useWorkflow, useWorkflowCheckpoints, useWorkflowConfigByName, useWorkflowSource, useWorkflowStatus, useWorkspace, useWorkspaceEnvironments };
@@ -1,5 +1,5 @@
1
1
  import { __toESM } from "../_virtual/rolldown_runtime.js";
2
- import { getChildWorkflowsCacheKey, getDocumentsCacheKey, getWorkflowCacheKey } from "../hooks/query-keys.js";
2
+ import { getChildWorkflowsCacheKey, getDocumentsCacheKey, getWorkflowCacheKey, getWorkflowStatusCacheKey } from "../hooks/query-keys.js";
3
3
  import { SseClientEvents } from "../events/sse-client-events.js";
4
4
  import { eventBus } from "../services/eventEmitter.js";
5
5
  import "../services/index.js";
@@ -9,31 +9,31 @@ import { c } from "react/compiler-runtime";
9
9
  import { useEffect, useRef } from "react";
10
10
  import { QueryClient, useQueryClient } from "@tanstack/react-query";
11
11
  var import_debounce = /* @__PURE__ */ __toESM(require_debounce(), 1), DEBOUNCE_MS = 300;
12
- function createDebouncedInvalidator(e, o) {
12
+ function createDebouncedInvalidator(e, s) {
13
13
  return (0, import_debounce.default)(() => {
14
- e.invalidateQueries({ queryKey: o });
14
+ e.invalidateQueries({ queryKey: s });
15
15
  }, DEBOUNCE_MS);
16
16
  }
17
17
  function InvalidationEventsProvider() {
18
- let e = c(5), { environment: u } = useStudio(), m = useQueryClient(), g;
19
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ new Map(), e[0] = g) : g = e[0];
20
- let _ = useRef(g), v, y;
21
- return e[1] !== u.id || e[2] !== m ? (v = () => {
22
- if (!u.id) return;
23
- let e = u.id, l = _.current, d = function(e) {
24
- let o = JSON.stringify(e);
25
- l.has(o) || l.set(o, createDebouncedInvalidator(m, e)), l.get(o)();
26
- }, f = eventBus.on(SseClientEvents.WORKFLOW_CREATED, (s) => {
27
- s.parentId && d(getChildWorkflowsCacheKey(e, s.parentId));
28
- }), p = eventBus.on(SseClientEvents.WORKFLOW_UPDATED, (s) => {
29
- s.id && d(getWorkflowCacheKey(e, s.id)), s.parentId && d(getChildWorkflowsCacheKey(e, s.parentId));
30
- }), h = eventBus.on(SseClientEvents.DOCUMENT_CREATED, (o) => {
31
- o.workflowId && d(getDocumentsCacheKey(e, o.workflowId));
18
+ let e = c(5), { environment: d } = useStudio(), h = useQueryClient(), _;
19
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ new Map(), e[0] = _) : _ = e[0];
20
+ let v = useRef(_), y, b;
21
+ return e[1] !== d.id || e[2] !== h ? (y = () => {
22
+ if (!d.id) return;
23
+ let e = d.id, u = v.current, f = function(e) {
24
+ let s = JSON.stringify(e);
25
+ u.has(s) || u.set(s, createDebouncedInvalidator(h, e)), u.get(s)();
26
+ }, p = eventBus.on(SseClientEvents.WORKFLOW_CREATED, (l) => {
27
+ l.parentId && f(getChildWorkflowsCacheKey(e, l.parentId));
28
+ }), m = eventBus.on(SseClientEvents.WORKFLOW_UPDATED, (l) => {
29
+ l.id && (f(getWorkflowCacheKey(e, l.id)), f(getWorkflowStatusCacheKey(e, l.id))), l.parentId && f(getChildWorkflowsCacheKey(e, l.parentId));
30
+ }), g = eventBus.on(SseClientEvents.DOCUMENT_CREATED, (s) => {
31
+ s.workflowId && f(getDocumentsCacheKey(e, s.workflowId));
32
32
  });
33
33
  return () => {
34
- f(), p(), h(), l.forEach(_temp), l.clear();
34
+ p(), m(), g(), u.forEach(_temp), u.clear();
35
35
  };
36
- }, y = [m, u.id], e[1] = u.id, e[2] = m, e[3] = v, e[4] = y) : (v = e[3], y = e[4]), useEffect(v, y), null;
36
+ }, b = [h, d.id], e[1] = d.id, e[2] = h, e[3] = y, e[4] = b) : (y = e[3], b = e[4]), useEffect(y, b), null;
37
37
  }
38
38
  function _temp(e) {
39
39
  return e.cancel();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loopstack/loopstack-studio",
3
- "version": "0.31.1",
3
+ "version": "0.33.0",
4
4
  "repository": "loopstack-ai/loopstack-studio",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "@fontsource/roboto": "^5.2.10",
28
28
  "@hookform/resolvers": "^5.2.2",
29
- "@loopstack/contracts": "^0.32.0",
29
+ "@loopstack/contracts": "^0.35.0",
30
30
  "@radix-ui/react-accordion": "^1.2.12",
31
31
  "@radix-ui/react-alert-dialog": "^1.1.15",
32
32
  "@radix-ui/react-avatar": "^1.1.11",
@@ -1,172 +0,0 @@
1
- import MarkdownContent_default from "../../../components/dynamic-form/MarkdownContent.js";
2
- import { c } from "react/compiler-runtime";
3
- import React from "react";
4
- import { jsx, jsxs } from "react/jsx-runtime";
5
- var getDataUrl = (e, r) => e instanceof URL ? e.toString() : typeof e == "string" ? `data:${r || "application/octet-stream"};base64,${e}` : "#", TextPartRenderer = (e) => {
6
- let i = c(2), { part: a } = e, o;
7
- return i[0] === a.text ? o = i[1] : (o = /* @__PURE__ */ jsx("div", {
8
- className: "text-sm leading-relaxed whitespace-pre-wrap",
9
- children: a.text
10
- }), i[0] = a.text, i[1] = o), o;
11
- }, ImagePartRenderer = (e) => {
12
- let i = c(11), { part: s } = e, l;
13
- i[0] !== s.image || i[1] !== s.mediaType ? (l = getDataUrl(s.image, s.mediaType), i[0] = s.image, i[1] = s.mediaType, i[2] = l) : l = i[2];
14
- let u;
15
- i[3] === Symbol.for("react.memo_cache_sentinel") ? (u = { maxHeight: "400px" }, i[3] = u) : u = i[3];
16
- let d;
17
- i[4] === l ? d = i[5] : (d = /* @__PURE__ */ jsx("img", {
18
- src: l,
19
- alt: "Uploaded image",
20
- className: "h-auto max-w-full rounded-lg border shadow-sm",
21
- style: u
22
- }), i[4] = l, i[5] = d);
23
- let f;
24
- i[6] === s.mediaType ? f = i[7] : (f = s.mediaType && /* @__PURE__ */ jsxs("div", {
25
- className: "mt-1 text-xs text-gray-500",
26
- children: ["Type: ", s.mediaType]
27
- }), i[6] = s.mediaType, i[7] = f);
28
- let p;
29
- return i[8] !== d || i[9] !== f ? (p = /* @__PURE__ */ jsxs("div", { children: [d, f] }), i[8] = d, i[9] = f, i[10] = p) : p = i[10], p;
30
- }, FilePartRenderer = (e) => {
31
- let i = c(8), { part: o } = e, s;
32
- i[0] === Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ jsx("div", {
33
- className: "text-2xl",
34
- children: "📎"
35
- }), i[0] = s) : s = i[0];
36
- let l = o.filename || "Unnamed file", u;
37
- i[1] === l ? u = i[2] : (u = /* @__PURE__ */ jsx("div", {
38
- className: "text-sm font-medium",
39
- children: l
40
- }), i[1] = l, i[2] = u);
41
- let d;
42
- i[3] === o.mediaType ? d = i[4] : (d = /* @__PURE__ */ jsx("div", {
43
- className: "text-xs text-gray-500",
44
- children: o.mediaType
45
- }), i[3] = o.mediaType, i[4] = d);
46
- let f;
47
- return i[5] !== u || i[6] !== d ? (f = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
48
- className: "flex items-center space-x-2",
49
- children: [s, /* @__PURE__ */ jsxs("div", { children: [u, d] })]
50
- }) }), i[5] = u, i[6] = d, i[7] = f) : f = i[7], f;
51
- }, ReasoningPartRenderer = (e) => {
52
- let i = c(2), { part: o } = e, s;
53
- return i[0] === o.text ? s = i[1] : (s = o.text ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
54
- className: "mb-2 flex items-center space-x-2",
55
- children: /* @__PURE__ */ jsx("div", {
56
- className: "text-sm font-medium text-purple-600",
57
- children: "Reasoning"
58
- })
59
- }), /* @__PURE__ */ jsx("div", {
60
- className: "text-sm whitespace-pre-wrap text-purple-800",
61
- children: o.text
62
- })] }) : "", i[0] = o.text, i[1] = s), s;
63
- }, ToolCallPartRenderer = (e) => {
64
- let i = c(17), { part: o } = e, s;
65
- i[0] === o.toolName ? s = i[1] : (s = /* @__PURE__ */ jsx("div", {
66
- className: "text-sm font-medium",
67
- children: o.toolName
68
- }), i[0] = o.toolName, i[1] = s);
69
- let l;
70
- i[2] === o.providerExecuted ? l = i[3] : (l = o.providerExecuted && /* @__PURE__ */ jsx("span", {
71
- className: "rounded bg-green-100 px-2 py-1 text-xs text-green-800",
72
- children: "Executed"
73
- }), i[2] = o.providerExecuted, i[3] = l);
74
- let u;
75
- i[4] !== s || i[5] !== l ? (u = /* @__PURE__ */ jsxs("div", {
76
- className: "flex items-center space-x-2",
77
- children: [s, l]
78
- }), i[4] = s, i[5] = l, i[6] = u) : u = i[6];
79
- let d;
80
- i[7] === o.toolCallId ? d = i[8] : (d = /* @__PURE__ */ jsxs("div", {
81
- className: "ml-5 font-mono text-xs text-gray-500",
82
- children: ["ID: ", o.toolCallId]
83
- }), i[7] = o.toolCallId, i[8] = d);
84
- let f;
85
- i[9] !== u || i[10] !== d ? (f = /* @__PURE__ */ jsxs("div", {
86
- className: "mb-2 flex items-center justify-between",
87
- children: [u, d]
88
- }), i[9] = u, i[10] = d, i[11] = f) : f = i[11];
89
- let p;
90
- i[12] === o.input ? p = i[13] : (p = o.input ? /* @__PURE__ */ jsxs("div", {
91
- className: "rounded border bg-white p-2 text-xs",
92
- children: [/* @__PURE__ */ jsx("div", {
93
- className: "mb-1 text-gray-600",
94
- children: "Input:"
95
- }), /* @__PURE__ */ jsx("pre", {
96
- className: "overflow-x-auto whitespace-pre-wrap",
97
- children: JSON.stringify(o.input, null, 2)
98
- })]
99
- }) : "", i[12] = o.input, i[13] = p);
100
- let m;
101
- return i[14] !== f || i[15] !== p ? (m = /* @__PURE__ */ jsxs("div", { children: [f, p] }), i[14] = f, i[15] = p, i[16] = m) : m = i[16], m;
102
- }, ToolResultPartRenderer = (e) => {
103
- let i = c(14), { part: o } = e, s;
104
- i[0] === o.toolName ? s = i[1] : (s = /* @__PURE__ */ jsxs("div", {
105
- className: "text-sm font-medium",
106
- children: [o.toolName, " Result"]
107
- }), i[0] = o.toolName, i[1] = s);
108
- let l;
109
- i[2] === o.toolCallId ? l = i[3] : (l = /* @__PURE__ */ jsxs("div", {
110
- className: "ml-5 font-mono text-xs text-gray-500",
111
- children: ["ID: ", o.toolCallId]
112
- }), i[2] = o.toolCallId, i[3] = l);
113
- let u;
114
- i[4] !== s || i[5] !== l ? (u = /* @__PURE__ */ jsxs("div", {
115
- className: "mb-2 flex items-center justify-between",
116
- children: [s, l]
117
- }), i[4] = s, i[5] = l, i[6] = u) : u = i[6];
118
- let d;
119
- i[7] === o.output ? d = i[8] : (d = JSON.stringify(o.output, null, 2), i[7] = o.output, i[8] = d);
120
- let f;
121
- i[9] === d ? f = i[10] : (f = /* @__PURE__ */ jsx("div", {
122
- className: "rounded border bg-white p-2 text-xs",
123
- children: /* @__PURE__ */ jsx("pre", {
124
- className: "overflow-x-auto whitespace-pre-wrap",
125
- children: d
126
- })
127
- }), i[9] = d, i[10] = f);
128
- let p;
129
- return i[11] !== u || i[12] !== f ? (p = /* @__PURE__ */ jsxs("div", { children: [u, f] }), i[11] = u, i[12] = f, i[13] = p) : p = i[13], p;
130
- }, AiMessageContent_default = (i) => {
131
- let o = c(4), { message: s } = i, l = _temp, u;
132
- o[0] === s ? u = o[1] : (u = () => {
133
- if (s.role === "system") return /* @__PURE__ */ jsxs("div", {
134
- className: "rounded-lg border-l-4 border-gray-400 bg-gray-50 p-3 text-sm text-gray-600 italic",
135
- children: [/* @__PURE__ */ jsx("div", {
136
- className: "mb-1 font-medium",
137
- children: "System"
138
- }), /* @__PURE__ */ jsx("div", {
139
- className: "whitespace-pre-wrap",
140
- children: s.content
141
- })]
142
- });
143
- let { content: r } = s;
144
- return typeof r == "string" ? /* @__PURE__ */ jsx(MarkdownContent_default, { content: r }) : Array.isArray(r) ? /* @__PURE__ */ jsx("div", {
145
- className: "space-y-2",
146
- children: r.map((e, r) => l(e, r))
147
- }) : /* @__PURE__ */ jsx("div", {
148
- className: "text-sm text-red-600",
149
- children: "Invalid content format"
150
- });
151
- }, o[0] = s, o[1] = u);
152
- let d = u, f;
153
- return o[2] === d ? f = o[3] : (f = /* @__PURE__ */ jsx("div", {
154
- className: "message-content",
155
- children: d()
156
- }), o[2] = d, o[3] = f), f;
157
- };
158
- function _temp(e, r) {
159
- switch (e.type) {
160
- case "text": return /* @__PURE__ */ jsx(TextPartRenderer, { part: e }, r);
161
- case "image": return /* @__PURE__ */ jsx(ImagePartRenderer, { part: e }, r);
162
- case "file": return /* @__PURE__ */ jsx(FilePartRenderer, { part: e }, r);
163
- case "reasoning": return /* @__PURE__ */ jsx(ReasoningPartRenderer, { part: e }, r);
164
- case "tool-call": return /* @__PURE__ */ jsx(ToolCallPartRenderer, { part: e }, r);
165
- case "tool-result": return /* @__PURE__ */ jsx(ToolResultPartRenderer, { part: e }, r);
166
- default: return /* @__PURE__ */ jsxs("div", {
167
- className: "rounded bg-gray-100 p-2 text-sm",
168
- children: ["Unknown content type: ", e.type]
169
- }, r);
170
- }
171
- }
172
- export { AiMessageContent_default as default };