@loopstack/loopstack-studio 0.24.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/api/config.js +3 -3
  2. package/dist/api/index.js +9 -13
  3. package/dist/api/processor.js +1 -1
  4. package/dist/api/workflows.js +7 -1
  5. package/dist/components/dynamic-form/CodeContent.js +3 -3
  6. package/dist/components/dynamic-form/fields/CodeViewField.js +36 -36
  7. package/dist/components/feedback/LoadingCentered.js +1 -1
  8. package/dist/components/layout/StudioSidebar.js +2 -2
  9. package/dist/components/loopstack-elements/link.js +77 -76
  10. package/dist/components/loopstack-elements/tool.js +171 -0
  11. package/dist/components/ui-widgets/UiActions.js +10 -4
  12. package/dist/components/ui-widgets/UiWidget.js +27 -36
  13. package/dist/components/ui-widgets/widgets/ButtonFullWidth.js +8 -6
  14. package/dist/components/ui-widgets/widgets/SubmitButton.js +8 -6
  15. package/dist/features/code-explorer/components/FileContentViewer.js +87 -112
  16. package/dist/features/dashboard/RunItem.js +1 -1
  17. package/dist/features/debug/components/ConfigFlowViewer.js +2 -2
  18. package/dist/features/debug/components/{PipelineDebugHeader.js → WorkflowDebugHeader.js} +5 -5
  19. package/dist/features/debug/components/{PipelineDebugLegend.js → WorkflowDebugLegend.js} +2 -2
  20. package/dist/features/debug/components/{PipelineFlowViewer.js → WorkflowFlowViewer.js} +9 -9
  21. package/dist/features/debug/components/workflow-flow/WorkflowGraph.js +46 -0
  22. package/dist/features/debug/index.js +2 -2
  23. package/dist/features/debug/lib/flow-utils.js +142 -150
  24. package/dist/features/documents/DocumentRenderer.js +66 -30
  25. package/dist/features/documents/components/DocumentItem.js +2 -2
  26. package/dist/features/documents/components/DocumentList.js +15 -12
  27. package/dist/features/documents/document-details/DocumentDetails.js +4 -4
  28. package/dist/features/documents/renderers/AiMessage.js +1 -1
  29. package/dist/features/documents/renderers/ChoicesRenderer.js +92 -0
  30. package/dist/features/documents/renderers/ClaudeMessage.js +1 -1
  31. package/dist/features/documents/renderers/ConfirmPromptRenderer.js +56 -0
  32. package/dist/features/documents/renderers/DocumentFormRenderer.js +95 -71
  33. package/dist/features/documents/renderers/LinkMessageRenderer.js +8 -10
  34. package/dist/features/documents/renderers/SecretInputRenderer.js +87 -0
  35. package/dist/features/documents/renderers/TextPromptRenderer.js +57 -0
  36. package/dist/features/documents/renderers/useDocumentTransition.js +30 -0
  37. package/dist/features/oauth/OAuthPromptRenderer.js +20 -20
  38. package/dist/features/runs/Runs.js +8 -8
  39. package/dist/features/workbench/Workbench.js +35 -35
  40. package/dist/features/workbench/WorkflowItem.js +10 -9
  41. package/dist/features/workbench/WorkflowList.js +56 -73
  42. package/dist/features/workbench/components/NewRunDialog.js +18 -18
  43. package/dist/features/workbench/components/WorkbenchFilesPanel.js +1 -1
  44. package/dist/features/workbench/components/WorkbenchFloatingPanel.js +33 -72
  45. package/dist/features/workbench/components/WorkbenchFlowPanel.js +27 -29
  46. package/dist/features/workbench/components/WorkbenchIconSidebar.js +30 -42
  47. package/dist/features/workbench/components/WorkbenchPreviewPanel.js +2 -2
  48. package/dist/features/workbench/components/WorkbenchSecretsPanel.js +1 -1
  49. package/dist/features/workbench/components/WorkbenchSettingsModal.js +16 -41
  50. package/dist/features/workbench/components/WorkflowForms.js +14 -13
  51. package/dist/features/workbench/components/WorkflowHistoryItem.js +60 -81
  52. package/dist/features/workbench/components/{PipelineHistoryList.js → WorkflowHistoryList.js} +5 -5
  53. package/dist/features/workbench/components/buttons/WorkflowButtons.js +56 -54
  54. package/dist/features/workbench/hooks/useWorkflowData.js +10 -10
  55. package/dist/features/workbench/hooks/useWorkflowListState.js +8 -45
  56. package/dist/features/workbench/index.js +2 -3
  57. package/dist/features/workbench/providers/ScrollProvider.js +2 -2
  58. package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +4 -4
  59. package/dist/features/workspaces/Workspaces.js +1 -1
  60. package/dist/features/workspaces/components/CreateWorkspace.js +12 -12
  61. package/dist/features/workspaces/components/ExecutionTimeline.js +22 -21
  62. package/dist/features/workspaces/components/{NewPipelineRunDialog.js → NewWorkflowRunDialog.js} +6 -6
  63. package/dist/features/workspaces/components/{PipelineForm.js → WorkflowRunForm.js} +31 -31
  64. package/dist/features/workspaces/components/WorkspaceHomePage.js +11 -11
  65. package/dist/features/workspaces/components/{pipeline-form → workflow-form}/ArgumentsView.js +1 -1
  66. package/dist/features/workspaces/components/{pipeline-form → workflow-form}/SelectionView.js +16 -16
  67. package/dist/hooks/index.js +3 -3
  68. package/dist/hooks/query-keys.js +31 -72
  69. package/dist/hooks/useConfig.js +5 -5
  70. package/dist/hooks/useProcessor.js +5 -5
  71. package/dist/hooks/useWorkflows.js +155 -68
  72. package/dist/index.d.ts +127 -128
  73. package/dist/index.js +5 -5
  74. package/dist/packages/contracts/dist/enums/index.js +11 -12
  75. package/dist/packages/contracts/dist/enums/workflow-state.enum.js +1 -1
  76. package/dist/pages/DebugWorkflowDetailsPage.js +8 -8
  77. package/dist/pages/DebugWorkflowsPage.js +10 -10
  78. package/dist/pages/EmbedWorkbenchPage.js +42 -52
  79. package/dist/pages/PreviewWorkbenchPage.js +130 -255
  80. package/dist/pages/RunsListPage.js +1 -1
  81. package/dist/pages/StudioLandingPage.js +13 -13
  82. package/dist/pages/WorkbenchPage.js +6 -6
  83. package/dist/pages/WorkflowDebugPage.js +114 -0
  84. package/dist/pages/WorkspacePage.js +4 -2
  85. package/dist/providers/InvalidationEventsProvider.js +19 -19
  86. package/dist/providers/SseProvider.js +0 -1
  87. package/dist/routing/LocalRouter.js +14 -17
  88. package/package.json +2 -2
  89. package/dist/api/namespaces.js +0 -7
  90. package/dist/api/pipelines.js +0 -13
  91. package/dist/components/ai-elements/tool.js +0 -158
  92. package/dist/components/ui-widgets/widgets/SecretInput.js +0 -42
  93. package/dist/features/debug/components/pipeline-flow/WorkflowGraph.js +0 -41
  94. package/dist/features/workbench/NavigationItems.js +0 -52
  95. package/dist/features/workbench/WorkbenchNavigation.js +0 -38
  96. package/dist/features/workbench/components/NavigationItem.js +0 -68
  97. package/dist/features/workbench/hooks/useIntersectionObserver.js +0 -44
  98. package/dist/hooks/useNamespaceTree.js +0 -27
  99. package/dist/hooks/useNamespaces.js +0 -25
  100. package/dist/hooks/usePipelines.js +0 -161
  101. package/dist/packages/contracts/dist/enums/pipeline-state.js +0 -10
  102. package/dist/pages/PipelineDebugPage.js +0 -115
  103. /package/dist/features/debug/components/{pipeline-flow → workflow-flow}/StateNode.js +0 -0
  104. /package/dist/features/debug/components/{pipeline-flow → workflow-flow}/WorkflowTransitionEdge.js +0 -0
  105. /package/dist/features/workspaces/components/{pipeline-form → workflow-form}/HeaderSection.js +0 -0
@@ -1,9 +1,9 @@
1
1
  function createConfigApi(e) {
2
2
  return {
3
3
  getWorkspaceTypes: () => e.get("/api/v1/config/workspaces").then((e) => e.data),
4
- getPipelineTypesByWorkspace: (t) => e.get(`/api/v1/config/workspaces/${encodeURIComponent(t.workspaceBlockName)}/pipelines`).then((e) => e.data),
5
- getPipelineConfigByName: (t) => e.get(`/api/v1/config/workspaces/${encodeURIComponent(t.workspaceBlockName)}/pipelines/${encodeURIComponent(t.pipelineName)}`).then((e) => e.data),
6
- getPipelineSourceByName: (t) => e.get(`/api/v1/config/workspaces/${encodeURIComponent(t.workspaceBlockName)}/pipelines/${encodeURIComponent(t.pipelineName)}/source`).then((e) => e.data),
4
+ getWorkflowTypesByWorkspace: (t) => e.get(`/api/v1/config/workspaces/${encodeURIComponent(t.workspaceBlockName)}/workflows`).then((e) => e.data),
5
+ getWorkflowConfig: (t) => e.get(`/api/v1/config/workflows/${encodeURIComponent(t.alias)}`).then((e) => e.data),
6
+ getWorkflowSource: (t) => e.get(`/api/v1/config/workflows/${encodeURIComponent(t.alias)}/source`).then((e) => e.data),
7
7
  getAvailableEnvironments: () => e.get("/api/v1/config/environments").then((e) => e.data)
8
8
  };
9
9
  }
package/dist/api/index.js CHANGED
@@ -2,25 +2,21 @@ import { createAuthApi } from "./auth.js";
2
2
  import { createConfigApi } from "./config.js";
3
3
  import { createDashboardApi } from "./dashboard.js";
4
4
  import { createDocumentsApi } from "./documents.js";
5
- import { createNamespacesApi } from "./namespaces.js";
6
- import { createPipelinesApi } from "./pipelines.js";
7
5
  import { createProcessorApi } from "./processor.js";
8
6
  import { createSecretsApi } from "./secrets.js";
9
7
  import { createWorkflowsApi } from "./workflows.js";
10
8
  import { createWorkspacesApi } from "./workspaces.js";
11
9
  import { createAxiosClient } from "./client.js";
12
- function createApi(d) {
10
+ function createApi(l) {
13
11
  return {
14
- auth: createAuthApi(d),
15
- config: createConfigApi(d),
16
- dashboard: createDashboardApi(d),
17
- documents: createDocumentsApi(d),
18
- namespaces: createNamespacesApi(d),
19
- pipelines: createPipelinesApi(d),
20
- processor: createProcessorApi(d),
21
- secrets: createSecretsApi(d),
22
- workflows: createWorkflowsApi(d),
23
- workspaces: createWorkspacesApi(d)
12
+ auth: createAuthApi(l),
13
+ config: createConfigApi(l),
14
+ dashboard: createDashboardApi(l),
15
+ documents: createDocumentsApi(l),
16
+ processor: createProcessorApi(l),
17
+ secrets: createSecretsApi(l),
18
+ workflows: createWorkflowsApi(l),
19
+ workspaces: createWorkspacesApi(l)
24
20
  };
25
21
  }
26
22
  export { createApi };
@@ -1,4 +1,4 @@
1
1
  function createProcessorApi(e) {
2
- return { runPipeline: (t) => e.post(`/api/v1/processor/run/${t.pipelineId}`, t.runPipelinePayloadDto, t.force === void 0 ? void 0 : { params: { force: t.force } }).then((e) => e.data) };
2
+ return { runWorkflow: (t) => e.post(`/api/v1/processor/run/${t.workflowId}`, t.runWorkflowPayloadDto, t.force === void 0 ? void 0 : { params: { force: t.force } }).then((e) => e.data) };
3
3
  }
4
4
  export { createProcessorApi };
@@ -2,7 +2,13 @@ function createWorkflowsApi(e) {
2
2
  return {
3
3
  getById: (t) => e.get(`/api/v1/workflows/${t.id}`).then((e) => e.data),
4
4
  getAll: (t) => e.get("/api/v1/workflows", { params: t }).then((e) => e.data),
5
- delete: (t) => e.delete(`/api/v1/workflows/${t.id}`).then((e) => e.data)
5
+ create: (t) => e.post("/api/v1/workflows", t.workflowCreateDto).then((e) => e.data),
6
+ update: (t) => e.put(`/api/v1/workflows/${t.id}`, t.workflowUpdateDto).then((e) => e.data),
7
+ delete: (t) => e.delete(`/api/v1/workflows/id/${t.id}`).then((e) => e.data),
8
+ batchDelete: (t) => e.delete("/api/v1/workflows/batch", { data: { ids: t.ids } }).then((e) => e.data),
9
+ getFileTree: (t) => e.get(`/api/v1/files/workflows/${t.workflowId}`).then((e) => e.data),
10
+ getFileContent: (t) => e.get(`/api/v1/files/workflows/${t.workflowId}/${t.filePath}`).then((e) => e.data),
11
+ getCheckpoints: (t) => e.get(`/api/v1/workflows/${t.id}/checkpoints`).then((e) => e.data)
6
12
  };
7
13
  }
8
14
  export { createWorkflowsApi };
@@ -148,10 +148,10 @@ var adaptedPrism = {
148
148
  });
149
149
  },
150
150
  code(e) {
151
- let { className: a, children: s, ...l } = e, u = /language-(\w+)/.exec(a ?? ""), d = Array.isArray(s) ? s.map(_temp).join("") : typeof s == "string" ? s : "";
152
- return u ? /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Prism, {
151
+ let { className: a, children: s, ...l } = e, u = /language-(\w+)/.exec(a ?? ""), d = Array.isArray(s) ? s.map(_temp).join("") : typeof s == "string" ? s : "", f = d.includes("\n");
152
+ return u || f ? /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Prism, {
153
153
  style: adaptedPrism,
154
- language: u[1],
154
+ language: u?.[1] ?? "text",
155
155
  PreTag: "div",
156
156
  ...l,
157
157
  children: d.replace(/\n$/, "")
@@ -6,58 +6,58 @@ import React from "react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { Check, Copy } from "lucide-react";
8
8
  import { Controller } from "react-hook-form";
9
- var stripCodeFence = (e) => {
10
- let u = e.match(/^```[\w-]*\n?([\s\S]*?)\n?```$/);
11
- return u ? u[1] : e;
12
- };
13
- const CodeViewField = (f) => {
14
- let p = c(11), { name: m, schema: h, ui: g, required: _, form: v, disabled: y } = f, [b, x] = React.useState(!1), S = useFieldConfig(m, h, g, y), C;
15
- p[0] === Symbol.for("react.memo_cache_sentinel") ? (C = async (e) => {
9
+ var codeFenceRegex = /^```[\w-]*\n?([\s\S]*?)\n?```$/, stripCodeFence = (e) => {
10
+ let d = e.match(codeFenceRegex);
11
+ return d ? d[1] : e;
12
+ }, ensureCodeFenced = (e) => !e || codeFenceRegex.test(e.trim()) ? e : "```\n" + e + "\n```";
13
+ const CodeViewField = (p) => {
14
+ let m = c(11), { name: h, schema: g, ui: _, required: v, form: y, disabled: b } = p, [x, S] = React.useState(!1), C = useFieldConfig(h, g, _, b), w;
15
+ m[0] === Symbol.for("react.memo_cache_sentinel") ? (w = async (e) => {
16
16
  try {
17
- let u = stripCodeFence(e);
18
- await navigator.clipboard.writeText(u), x(!0), setTimeout(() => x(!1), 2e3);
17
+ let d = stripCodeFence(e);
18
+ await navigator.clipboard.writeText(d), S(!0), setTimeout(() => S(!1), 2e3);
19
19
  } catch (e) {
20
- let u = e;
21
- console.error("Failed to copy:", u);
20
+ let d = e;
21
+ console.error("Failed to copy:", d);
22
22
  }
23
- }, p[0] = C) : C = p[0];
24
- let w = C, T = S.defaultValue || "", E;
25
- p[1] !== S || p[2] !== b || p[3] !== m || p[4] !== _ ? (E = (u) => {
26
- let { field: d } = u;
23
+ }, m[0] = w) : w = m[0];
24
+ let T = w, E = C.defaultValue || "", D;
25
+ m[1] !== C || m[2] !== x || m[3] !== h || m[4] !== v ? (D = (d) => {
26
+ let { field: f } = d;
27
27
  return /* @__PURE__ */ jsx(BaseFieldWrapper, {
28
- name: m,
29
- label: S.fieldLabel,
30
- required: _,
31
- error: S.error,
32
- helpText: S.helpText,
33
- description: S.description,
28
+ name: h,
29
+ label: C.fieldLabel,
30
+ required: v,
31
+ error: C.error,
32
+ helpText: C.helpText,
33
+ description: C.description,
34
34
  children: /* @__PURE__ */ jsxs("div", {
35
35
  className: "relative w-full overflow-hidden rounded-md border",
36
- ...S.getAriaProps(),
36
+ ...C.getAriaProps(),
37
37
  children: [/* @__PURE__ */ jsx("button", {
38
38
  type: "button",
39
- onClick: () => void w(String(d.value ?? "")),
40
- disabled: S.isDisabled || !d.value,
39
+ onClick: () => void T(String(f.value ?? "")),
40
+ disabled: !f.value,
41
41
  className: "bg-background/80 hover:bg-background absolute top-2 right-2 z-10 rounded-md border p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50",
42
- title: b ? "Copied!" : "Copy to clipboard",
43
- "aria-label": b ? "Copied to clipboard" : "Copy code to clipboard",
44
- children: b ? /* @__PURE__ */ jsx(Check, {
42
+ title: x ? "Copied!" : "Copy to clipboard",
43
+ "aria-label": x ? "Copied to clipboard" : "Copy code to clipboard",
44
+ children: x ? /* @__PURE__ */ jsx(Check, {
45
45
  className: "h-4 w-4 text-green-600",
46
46
  "aria-hidden": "true"
47
47
  }) : /* @__PURE__ */ jsx(Copy, {
48
48
  className: "h-4 w-4",
49
49
  "aria-hidden": "true"
50
50
  })
51
- }), /* @__PURE__ */ jsx(CodeContent_default, { content: String(d.value ?? "") })]
51
+ }), /* @__PURE__ */ jsx(CodeContent_default, { content: ensureCodeFenced(String(f.value ?? "")) })]
52
52
  })
53
53
  });
54
- }, p[1] = S, p[2] = b, p[3] = m, p[4] = _, p[5] = E) : E = p[5];
55
- let D;
56
- return p[6] !== v.control || p[7] !== m || p[8] !== T || p[9] !== E ? (D = /* @__PURE__ */ jsx(Controller, {
57
- name: m,
58
- control: v.control,
59
- defaultValue: T,
60
- render: E
61
- }), p[6] = v.control, p[7] = m, p[8] = T, p[9] = E, p[10] = D) : D = p[10], D;
54
+ }, m[1] = C, m[2] = x, m[3] = h, m[4] = v, m[5] = D) : D = m[5];
55
+ let O;
56
+ return m[6] !== y.control || m[7] !== h || m[8] !== E || m[9] !== D ? (O = /* @__PURE__ */ jsx(Controller, {
57
+ name: h,
58
+ control: y.control,
59
+ defaultValue: E,
60
+ render: D
61
+ }), m[6] = y.control, m[7] = h, m[8] = E, m[9] = D, m[10] = O) : O = m[10], O;
62
62
  };
63
63
  export { CodeViewField };
@@ -9,7 +9,7 @@ var LoadingCentered_default = (i) => {
9
9
  let p = u === void 0 ? !1 : u, m = d === void 0 ? 24 : d, h = f === void 0 ? null : f;
10
10
  if (p) {
11
11
  let r;
12
- o[6] === s ? r = o[7] : (r = cn("flex items-center justify-center", s), o[6] = s, o[7] = r);
12
+ o[6] === s ? r = o[7] : (r = cn("mt-12 flex items-center justify-center", s), o[6] = s, o[7] = r);
13
13
  let i;
14
14
  o[8] === m ? i = o[9] : (i = /* @__PURE__ */ jsx(Loader2, {
15
15
  className: "animate-spin",
@@ -1,5 +1,5 @@
1
1
  import { useStudio, useStudioOptional } from "../../providers/StudioProvider.js";
2
- import { useFilterPipelines } from "../../hooks/usePipelines.js";
2
+ import { useFilterWorkflows } from "../../hooks/useWorkflows.js";
3
3
  import { useComponentOverrides } from "../../providers/ComponentOverridesProvider.js";
4
4
  import { cn } from "../../lib/utils.js";
5
5
  import { Button } from "../ui/button.js";
@@ -94,7 +94,7 @@ var DefaultSidebarHeader = () => {
94
94
  parentId: null,
95
95
  status: "paused"
96
96
  }, l[2] = g) : g = l[2];
97
- let b = useFilterPipelines(void 0, g, "createdAt", "DESC", 0, 1).data?.total ?? 0, T;
97
+ let b = useFilterWorkflows(void 0, g, "createdAt", "DESC", 0, 1).data?.total ?? 0, T;
98
98
  l[3] === Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ jsx(SidebarGroupLabel, { children: "Runs" }), l[3] = T) : T = l[3];
99
99
  let E = d.pathname === p || d.pathname === p + "/", D, O;
100
100
  l[4] === Symbol.for("react.memo_cache_sentinel") ? (D = /* @__PURE__ */ jsx(Play, {}), O = /* @__PURE__ */ jsx("span", { children: "Overview" }), l[4] = D, l[5] = O) : (D = l[4], O = l[5]);
@@ -1,115 +1,116 @@
1
1
  "use client";
2
2
  import { useStudio } from "../../providers/StudioProvider.js";
3
3
  import { cn } from "../../lib/utils.js";
4
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip.js";
4
5
  import { c } from "react/compiler-runtime";
5
6
  import { useEffect, useState } from "react";
6
7
  import { jsx, jsxs } from "react/jsx-runtime";
7
- import { ChevronDownIcon, ChevronUpIcon, ExternalLinkIcon, LinkIcon, icons } from "lucide-react";
8
- var EMBED_RESIZE_MESSAGE_TYPE = "loopstack:embed:resize", PIPELINE_HREF_PATTERN = /^\/pipelines\/([a-zA-Z0-9_-]+)$/, link_default = (m) => {
9
- let h = c(53), { className: g, href: _, label: v, caption: y, icon: b, type: x, embed: S, defaultExpanded: C, iconClassName: w } = m, { router: T } = useStudio(), [E, D] = useState(C ?? !1), [O, k] = useState(0), A = b && icons[b] ? icons[b] : LinkIcon, j;
10
- h[0] !== _ || h[1] !== v ? (j = v || (() => {
11
- if (!_) return "";
8
+ import { ChevronDownIcon, ChevronUpIcon, ExternalLinkIcon, FolderClosedIcon, FolderOpenIcon } from "lucide-react";
9
+ var EMBED_RESIZE_MESSAGE_TYPE = "loopstack:embed:resize", statusColorMap = {
10
+ pending: "text-muted-foreground",
11
+ success: "text-green-600",
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 "";
12
17
  try {
13
- return new URL(_).hostname.replace("www.", "");
18
+ return new URL(v).hostname.replace("www.", "");
14
19
  } catch {
15
- return _;
20
+ return v;
16
21
  }
17
- })(), h[0] = _, h[1] = v, h[2] = j) : j = h[2];
18
- let M = j, N = x === "success", P, F;
19
- h[3] !== S || h[4] !== _ || h[5] !== T ? (P = _?.match(PIPELINE_HREF_PATTERN)?.[1] ?? null, F = S === !0 && P != null ? T.getEmbedPipeline(P) : null, h[3] = S, h[4] = _, h[5] = T, h[6] = P, h[7] = F) : (P = h[6], F = h[7]);
20
- let I = F, L, R;
21
- h[8] !== E || h[9] !== P ? (L = () => {
22
- if (!P || !E) return;
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;
23
28
  let t = (t) => {
24
29
  if (t.origin !== window.location.origin) return;
25
- let f = t.data;
26
- if (f?.type !== EMBED_RESIZE_MESSAGE_TYPE || f?.pipelineId !== P) return;
27
- let p = f?.height;
28
- typeof p == "number" && p > 0 && k(p);
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);
29
34
  };
30
35
  return window.addEventListener("message", t), () => window.removeEventListener("message", t);
31
- }, R = [P, E], h[8] = E, h[9] = P, h[10] = L, h[11] = R) : (L = h[10], R = h[11]), useEffect(L, R);
32
- let z;
33
- h[12] === g ? z = h[13] : (z = cn("not-prose flex w-full flex-col rounded-md border bg-background", g), h[12] = g, h[13] = z);
34
- let B = N ? "bg-green-50 text-green-600 border-green-200" : "text-muted-foreground bg-muted/50", V;
35
- h[14] === B ? V = h[15] : (V = cn("flex size-8 shrink-0 items-center justify-center rounded-md border", B), h[14] = B, h[15] = V);
36
- let H;
37
- h[16] === w ? H = h[17] : (H = cn("size-4", w), h[16] = w, h[17] = H);
38
- let U;
39
- h[18] !== A || h[19] !== H ? (U = /* @__PURE__ */ jsx(A, { className: H }), h[18] = A, h[19] = H, h[20] = U) : U = h[20];
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);
37
+ let I;
38
+ g[12] === _ ? I = g[13] : (I = cn("not-prose flex w-full cursor-pointer flex-col", _), g[12] = _, g[13] = I);
39
+ 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);
43
+ let B;
44
+ g[18] === T ? B = g[19] : (B = jsx(T ? FolderOpenIcon : FolderClosedIcon, { className: "size-4" }), g[18] = T, g[19] = B);
45
+ let V;
46
+ g[20] !== B || g[21] !== z ? (V = /* @__PURE__ */ jsx(TooltipTrigger, {
47
+ asChild: !0,
48
+ children: /* @__PURE__ */ jsx("span", {
49
+ className: z,
50
+ children: B
51
+ })
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, {
55
+ side: "top",
56
+ children: H
57
+ }), g[23] = H, g[24] = U);
40
58
  let W;
41
- h[21] !== V || h[22] !== U ? (W = /* @__PURE__ */ jsx("div", {
42
- className: V,
43
- children: U
44
- }), h[21] = V, h[22] = U, h[23] = W) : W = h[23];
45
- let G;
46
- h[24] === M ? G = h[25] : (G = /* @__PURE__ */ jsx("span", {
47
- className: "truncate text-sm font-medium",
48
- children: M
49
- }), h[24] = M, h[25] = G);
50
- let K;
51
- h[26] !== y || h[27] !== _ ? (K = y ? /* @__PURE__ */ jsx("span", {
52
- className: "text-muted-foreground truncate text-xs",
53
- children: y
54
- }) : _ && /* @__PURE__ */ jsx("a", {
55
- href: _,
56
- target: "_blank",
57
- rel: "noopener noreferrer",
58
- className: "text-muted-foreground truncate text-xs hover:underline",
59
- children: _
60
- }), h[26] = y, h[27] = _, h[28] = K) : K = h[28];
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);
61
62
  let q;
62
- h[29] !== G || h[30] !== K ? (q = /* @__PURE__ */ jsxs("div", {
63
- className: "flex min-w-0 flex-1 flex-col",
64
- children: [G, K]
65
- }), h[29] = G, h[30] = K, h[31] = q) : q = h[31];
63
+ g[30] !== A || g[31] !== K ? (q = /* @__PURE__ */ jsx("span", {
64
+ className: K,
65
+ children: A
66
+ }), g[30] = A, g[31] = K, g[32] = q) : q = g[32];
66
67
  let J;
67
- h[32] !== I || h[33] !== E ? (J = I && /* @__PURE__ */ jsx("button", {
68
- type: "button",
69
- onClick: () => D(_temp),
70
- className: "text-muted-foreground hover:text-foreground flex size-7 items-center justify-center rounded-md transition-colors hover:bg-muted/50",
71
- children: jsx(E ? ChevronUpIcon : ChevronDownIcon, { className: "size-4" })
72
- }), h[32] = I, h[33] = E, h[34] = J) : J = h[34];
73
- let Y;
74
- h[35] === _ ? Y = h[36] : (Y = _ && /* @__PURE__ */ jsx("a", {
75
- href: _,
68
+ g[33] === v ? J = g[34] : (J = v && /* @__PURE__ */ jsx("a", {
69
+ href: v,
76
70
  target: "_blank",
77
71
  rel: "noopener noreferrer",
78
- className: "text-muted-foreground hover:text-foreground flex size-7 items-center justify-center rounded-md transition-colors hover:bg-muted/50",
79
- children: /* @__PURE__ */ jsx(ExternalLinkIcon, { className: "size-4" })
80
- }), h[35] = _, h[36] = Y);
72
+ onClick: _temp2,
73
+ className: "text-muted-foreground hover:text-foreground flex items-center justify-center transition-colors",
74
+ children: /* @__PURE__ */ jsx(ExternalLinkIcon, { className: "size-3.5" })
75
+ }), g[33] = v, g[34] = J);
76
+ 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];
81
78
  let X;
82
- h[37] !== J || h[38] !== Y ? (X = /* @__PURE__ */ jsxs("div", {
79
+ g[38] !== J || g[39] !== Y ? (X = /* @__PURE__ */ jsxs("div", {
83
80
  className: "flex shrink-0 items-center gap-1",
84
81
  children: [J, Y]
85
- }), h[37] = J, h[38] = Y, h[39] = X) : X = h[39];
82
+ }), g[38] = J, g[39] = Y, g[40] = X) : X = g[40];
86
83
  let Z;
87
- h[40] !== W || h[41] !== q || h[42] !== X ? (Z = /* @__PURE__ */ jsxs("div", {
88
- className: "flex w-full items-center gap-3 p-3",
84
+ g[41] !== W || g[42] !== q || g[43] !== X ? (Z = /* @__PURE__ */ jsxs("div", {
85
+ className: "flex w-full items-center gap-1.5 py-1",
89
86
  children: [
90
87
  W,
91
88
  q,
92
89
  X
93
90
  ]
94
- }), h[40] = W, h[41] = q, h[42] = X, h[43] = Z) : Z = h[43];
91
+ }), g[41] = W, g[42] = q, g[43] = X, g[44] = Z) : Z = g[44];
95
92
  let Q;
96
- h[44] !== M || h[45] !== I || h[46] !== E || h[47] !== O ? (Q = E && I && /* @__PURE__ */ jsx("div", {
97
- className: "border-t",
93
+ g[45] !== A || g[46] !== N || g[47] !== T || g[48] !== D ? (Q = T && N && /* @__PURE__ */ jsx("div", {
94
+ className: "mt-2 border-t",
98
95
  children: /* @__PURE__ */ jsx("iframe", {
99
- src: I,
96
+ src: N,
100
97
  className: "w-full overflow-hidden border-0",
101
- style: { height: `${O}px` },
98
+ style: { height: `${D}px` },
102
99
  scrolling: "no",
103
- title: M
100
+ title: A
104
101
  })
105
- }), h[44] = M, h[45] = I, h[46] = E, h[47] = O, h[48] = Q) : Q = h[48];
102
+ }), g[45] = A, g[46] = N, g[47] = T, g[48] = D, g[49] = Q) : Q = g[49];
106
103
  let $;
107
- return h[49] !== Z || h[50] !== Q || h[51] !== z ? ($ = /* @__PURE__ */ jsxs("div", {
108
- className: z,
104
+ return g[50] !== Z || g[51] !== Q || g[52] !== I || g[53] !== L ? ($ = /* @__PURE__ */ jsxs("div", {
105
+ className: I,
106
+ onClick: L,
109
107
  children: [Z, Q]
110
- }), h[49] = Z, h[50] = Q, h[51] = z, h[52] = $) : $ = h[52], $;
108
+ }), g[50] = Z, g[51] = Q, g[52] = I, g[53] = L, g[54] = $) : $ = g[54], $;
111
109
  };
112
110
  function _temp(t) {
113
111
  return !t;
114
112
  }
113
+ function _temp2(t) {
114
+ return t.stopPropagation();
115
+ }
115
116
  export { link_default as default };
@@ -0,0 +1,171 @@
1
+ "use client";
2
+ import { cn } from "../../lib/utils.js";
3
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../ui/collapsible.js";
4
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip.js";
5
+ import { CodeBlock } from "../ai-elements/code-block.js";
6
+ import { c } from "react/compiler-runtime";
7
+ import { isValidElement } from "react";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { CheckCircleIcon, ChevronDownIcon, CircleIcon, ClockIcon, XCircleIcon } from "lucide-react";
10
+ const Tool = (a) => {
11
+ let o = c(8), s, l;
12
+ o[0] === a ? (s = o[1], l = o[2]) : ({className: s, ...l} = a, o[0] = a, o[1] = s, o[2] = l);
13
+ let u;
14
+ o[3] === s ? u = o[4] : (u = cn("not-prose mt-3 w-full", s), o[3] = s, o[4] = u);
15
+ let d;
16
+ return o[5] !== l || o[6] !== u ? (d = /* @__PURE__ */ jsx(Collapsible, {
17
+ className: u,
18
+ ...l
19
+ }), o[5] = l, o[6] = u, o[7] = d) : d = o[7], d;
20
+ };
21
+ var statusConfig = {
22
+ "input-streaming": {
23
+ label: "Pending",
24
+ icon: /* @__PURE__ */ jsx(CircleIcon, { className: "size-4" })
25
+ },
26
+ "input-available": {
27
+ label: "Running",
28
+ icon: /* @__PURE__ */ jsx(ClockIcon, { className: "size-4 animate-pulse" })
29
+ },
30
+ "approval-requested": {
31
+ label: "Awaiting Approval",
32
+ icon: /* @__PURE__ */ jsx(ClockIcon, { className: "size-4 text-yellow-600" })
33
+ },
34
+ "approval-responded": {
35
+ label: "Responded",
36
+ icon: /* @__PURE__ */ jsx(CheckCircleIcon, { className: "size-4 text-blue-600" })
37
+ },
38
+ "output-available": {
39
+ label: "Completed",
40
+ icon: /* @__PURE__ */ jsx(CheckCircleIcon, { className: "size-4 text-green-600" })
41
+ },
42
+ "output-error": {
43
+ label: "Error",
44
+ icon: /* @__PURE__ */ jsx(XCircleIcon, { className: "size-4 text-red-600" })
45
+ },
46
+ "output-denied": {
47
+ label: "Denied",
48
+ icon: /* @__PURE__ */ jsx(XCircleIcon, { className: "size-4 text-orange-600" })
49
+ }
50
+ };
51
+ const ToolHeader = (i) => {
52
+ let a = c(28), d, f, p, h, g;
53
+ a[0] === i ? (d = a[1], f = a[2], p = a[3], h = a[4], g = a[5]) : ({className: d, title: h, type: g, state: p, ...f} = i, a[0] = i, a[1] = d, a[2] = f, a[3] = p, a[4] = h, a[5] = g);
54
+ let _;
55
+ a[6] === d ? _ = a[7] : (_ = cn("flex w-full items-center justify-between gap-3 py-1", d), a[6] = d, a[7] = _);
56
+ let v = statusConfig[p], b;
57
+ a[8] === v.icon ? b = a[9] : (b = /* @__PURE__ */ jsx(TooltipTrigger, {
58
+ asChild: !0,
59
+ children: /* @__PURE__ */ jsx("span", {
60
+ className: "text-muted-foreground flex shrink-0 items-center",
61
+ children: v.icon
62
+ })
63
+ }), a[8] = v.icon, a[9] = b);
64
+ let x = statusConfig[p], S;
65
+ a[10] === x.label ? S = a[11] : (S = /* @__PURE__ */ jsx(TooltipContent, {
66
+ side: "top",
67
+ children: x.label
68
+ }), a[10] = x.label, a[11] = S);
69
+ let C;
70
+ a[12] !== b || a[13] !== S ? (C = /* @__PURE__ */ jsxs(Tooltip, { children: [b, S] }), a[12] = b, a[13] = S, a[14] = C) : C = a[14];
71
+ let w;
72
+ a[15] !== h || a[16] !== g ? (w = h ?? g.split("-").slice(1).join("-"), a[15] = h, a[16] = g, a[17] = w) : w = a[17];
73
+ let T;
74
+ a[18] === w ? T = a[19] : (T = /* @__PURE__ */ jsx("span", {
75
+ className: "text-muted-foreground text-sm",
76
+ children: w
77
+ }), a[18] = w, a[19] = T);
78
+ let E;
79
+ a[20] !== C || a[21] !== T ? (E = /* @__PURE__ */ jsxs("div", {
80
+ className: "flex items-center gap-1.5",
81
+ children: [C, T]
82
+ }), a[20] = C, a[21] = T, a[22] = E) : E = a[22];
83
+ let D;
84
+ a[23] === Symbol.for("react.memo_cache_sentinel") ? (D = /* @__PURE__ */ jsx(ChevronDownIcon, { className: "text-muted-foreground size-4 transition-transform group-data-[state=open]:rotate-180" }), a[23] = D) : D = a[23];
85
+ let O;
86
+ return a[24] !== f || a[25] !== _ || a[26] !== E ? (O = /* @__PURE__ */ jsxs(CollapsibleTrigger, {
87
+ className: _,
88
+ ...f,
89
+ children: [E, D]
90
+ }), a[24] = f, a[25] = _, a[26] = E, a[27] = O) : O = a[27], O;
91
+ }, ToolContent = (i) => {
92
+ let o = c(8), s, l;
93
+ o[0] === i ? (s = o[1], l = o[2]) : ({className: s, ...l} = i, o[0] = i, o[1] = s, o[2] = l);
94
+ let u;
95
+ o[3] === s ? u = o[4] : (u = cn("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground data-[state=closed]:animate-out data-[state=open]:animate-in outline-none", s), o[3] = s, o[4] = u);
96
+ let d;
97
+ return o[5] !== l || o[6] !== u ? (d = /* @__PURE__ */ jsx(CollapsibleContent, {
98
+ className: u,
99
+ ...l
100
+ }), o[5] = l, o[6] = u, o[7] = d) : d = o[7], d;
101
+ }, ToolInput = (i) => {
102
+ let a = c(15), o, s, l;
103
+ a[0] === i ? (o = a[1], s = a[2], l = a[3]) : ({className: o, input: s, ...l} = i, a[0] = i, a[1] = o, a[2] = s, a[3] = l);
104
+ let u;
105
+ a[4] === o ? u = a[5] : (u = cn("space-y-2 overflow-hidden py-2", o), a[4] = o, a[5] = u);
106
+ let f;
107
+ a[6] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ jsx("h4", {
108
+ className: "text-muted-foreground text-xs font-medium tracking-wide uppercase",
109
+ children: "Parameters"
110
+ }), a[6] = f) : f = a[6];
111
+ let p;
112
+ a[7] === s ? p = a[8] : (p = JSON.stringify(s, null, 2), a[7] = s, a[8] = p);
113
+ let m;
114
+ a[9] === p ? m = a[10] : (m = /* @__PURE__ */ jsx("div", {
115
+ className: "bg-muted/50 rounded-md",
116
+ children: /* @__PURE__ */ jsx(CodeBlock, {
117
+ code: p,
118
+ language: "json"
119
+ })
120
+ }), a[9] = p, a[10] = m);
121
+ let h;
122
+ return a[11] !== l || a[12] !== u || a[13] !== m ? (h = /* @__PURE__ */ jsxs("div", {
123
+ className: u,
124
+ ...l,
125
+ children: [f, m]
126
+ }), a[11] = l, a[12] = u, a[13] = m, a[14] = h) : h = a[14], h;
127
+ }, ToolOutput = (i) => {
128
+ let a = c(30), o, s, l, u;
129
+ if (a[0] === i ? (o = a[1], s = a[2], l = a[3], u = a[4]) : ({className: o, output: l, errorText: s, ...u} = i, a[0] = i, a[1] = o, a[2] = s, a[3] = l, a[4] = u), !(l || s)) return null;
130
+ let p = l, m;
131
+ a[5] === p ? m = a[6] : (m = /* @__PURE__ */ jsx("div", { children: p }), a[5] = p, a[6] = m);
132
+ let h = m;
133
+ if (typeof l == "object" && !isValidElement(l)) {
134
+ let e;
135
+ a[7] === l ? e = a[8] : (e = JSON.stringify(l, null, 2), a[7] = l, a[8] = e);
136
+ let i;
137
+ a[9] === e ? i = a[10] : (i = /* @__PURE__ */ jsx(CodeBlock, {
138
+ code: e,
139
+ language: "json"
140
+ }), a[9] = e, a[10] = i), h = i;
141
+ } else if (typeof l == "string") {
142
+ let e;
143
+ a[11] === l ? e = a[12] : (e = /* @__PURE__ */ jsx(CodeBlock, {
144
+ code: l,
145
+ language: "json"
146
+ }), a[11] = l, a[12] = e), h = e;
147
+ }
148
+ let g;
149
+ a[13] === o ? g = a[14] : (g = cn("space-y-2 py-2", o), a[13] = o, a[14] = g);
150
+ let _ = s ? "Error" : "Result", v;
151
+ a[15] === _ ? v = a[16] : (v = /* @__PURE__ */ jsx("h4", {
152
+ className: "text-muted-foreground text-xs font-medium tracking-wide uppercase",
153
+ children: _
154
+ }), a[15] = _, a[16] = v);
155
+ let y = s ? "bg-destructive/10 text-destructive" : "bg-muted/50 text-foreground", b;
156
+ a[17] === y ? b = a[18] : (b = cn("overflow-x-auto rounded-md text-xs [&_table]:w-full", y), a[17] = y, a[18] = b);
157
+ let x;
158
+ a[19] === s ? x = a[20] : (x = s && /* @__PURE__ */ jsx("div", { children: s }), a[19] = s, a[20] = x);
159
+ let S;
160
+ a[21] !== h || a[22] !== b || a[23] !== x ? (S = /* @__PURE__ */ jsxs("div", {
161
+ className: b,
162
+ children: [x, h]
163
+ }), a[21] = h, a[22] = b, a[23] = x, a[24] = S) : S = a[24];
164
+ let C;
165
+ return a[25] !== u || a[26] !== g || a[27] !== v || a[28] !== S ? (C = /* @__PURE__ */ jsxs("div", {
166
+ className: g,
167
+ ...u,
168
+ children: [v, S]
169
+ }), a[25] = u, a[26] = g, a[27] = v, a[28] = S, a[29] = C) : C = a[29], C;
170
+ };
171
+ export { Tool, ToolContent, ToolHeader, ToolInput, ToolOutput };
@@ -7,17 +7,23 @@ var UiActions_default = (i) => {
7
7
  if (a[0] !== o || a[1] !== s || a[2] !== l || a[3] !== u || a[4] !== f || a[5] !== d) {
8
8
  let r;
9
9
  a[7] !== s || a[8] !== l || a[9] !== u || a[10] !== f || a[11] !== d ? (r = (r, i) => {
10
- let { enabledWhen: a } = r, o = r.options?.transition;
10
+ let { enabledWhen: a } = r, o = r.options?.transition, p = u || a !== void 0 && (!l || !a.includes(l)) || o !== void 0 && !s.includes(o);
11
11
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(UiWidget_default, {
12
12
  config: r,
13
13
  onSubmit: (e) => {
14
- if (!o) {
15
- console.error(`[UiActions] Widget "${r.widget ?? r.type}" has no transition configured.`);
14
+ if (console.log("[UiActions] handleSubmit called", {
15
+ transition: o,
16
+ data: e,
17
+ isDisabled: p,
18
+ currentPlace: l,
19
+ availableTransitions: s
20
+ }), !o) {
21
+ console.error(`[UiActions] Widget "${r.widget}" has no transition configured.`);
16
22
  return;
17
23
  }
18
24
  d(o, e);
19
25
  },
20
- disabled: u || a !== void 0 && (!l || !a.includes(l)) || o !== void 0 && !s.includes(o),
26
+ disabled: p,
21
27
  isLoading: f
22
28
  }) }, `ui-widget-${i}-${o ?? r.widget}`);
23
29
  }, a[7] = s, a[8] = l, a[9] = u, a[10] = f, a[11] = d, a[12] = r) : r = a[12], p = o.map(r), a[0] = o, a[1] = s, a[2] = l, a[3] = u, a[4] = f, a[5] = d, a[6] = p;