@loopstack/loopstack-studio 0.23.0 → 0.24.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 (90) hide show
  1. package/dist/api/index.js +12 -10
  2. package/dist/api/secrets.js +16 -0
  3. package/dist/components/dynamic-form/ArrayController.js +68 -64
  4. package/dist/components/dynamic-form/Form.js +56 -27
  5. package/dist/components/dynamic-form/FormElement.js +1 -1
  6. package/dist/components/dynamic-form/FormElementHeader.js +2 -2
  7. package/dist/components/dynamic-form/InputController.js +3 -1
  8. package/dist/components/dynamic-form/ObjectController.js +24 -21
  9. package/dist/components/dynamic-form/fields/BaseFieldWrapper.js +1 -1
  10. package/dist/components/dynamic-form/fields/InputField.js +20 -19
  11. package/dist/components/dynamic-form/fields/MarkdownViewField.js +20 -0
  12. package/dist/components/dynamic-form/fields/RadioField.js +18 -18
  13. package/dist/components/dynamic-form/fields/SelectField.js +19 -19
  14. package/dist/components/dynamic-form/fields/TextareaField.js +17 -17
  15. package/dist/components/layout/MainLayout.js +18 -31
  16. package/dist/components/layout/StudioSidebar.js +168 -108
  17. package/dist/components/page/PageBreadcrumbs.js +79 -32
  18. package/dist/components/ui-widgets/UiWidget.js +36 -27
  19. package/dist/components/ui-widgets/widgets/SecretInput.js +42 -0
  20. package/dist/features/code-explorer/components/CodeExplorerTreeNode.js +80 -4
  21. package/dist/features/code-explorer/components/FileContentViewer.js +47 -30
  22. package/dist/features/code-explorer/components/FileTabsBar.js +3 -190
  23. package/dist/features/code-explorer/components/FileTabsBarBase.js +190 -0
  24. package/dist/features/code-explorer/index.js +2 -2
  25. package/dist/features/code-explorer/providers/CodeExplorerProvider.js +2 -162
  26. package/dist/features/code-explorer/utils/fileIcons.js +7 -4
  27. package/dist/features/debug/components/PipelineFlowViewer.js +46 -45
  28. package/dist/features/debug/components/pipeline-flow/WorkflowGraph.js +19 -19
  29. package/dist/features/documents/DocumentRenderer.js +20 -15
  30. package/dist/features/documents/components/DocumentList.js +5 -1
  31. package/dist/features/documents/renderers/AiMessage.js +11 -11
  32. package/dist/features/documents/renderers/ClaudeMessage.js +96 -0
  33. package/dist/features/documents/renderers/DocumentFormRenderer.js +17 -11
  34. package/dist/features/workbench/Workbench.js +64 -80
  35. package/dist/features/workbench/WorkflowItem.js +5 -5
  36. package/dist/features/workbench/components/RemoteFileTabsBar.js +18 -0
  37. package/dist/features/workbench/components/RemoteFileTree.js +90 -0
  38. package/dist/features/workbench/components/WorkbenchFilesPanel.js +67 -0
  39. package/dist/features/workbench/components/WorkbenchFloatingPanel.js +57 -49
  40. package/dist/features/workbench/components/WorkbenchFlowPanel.js +2 -2
  41. package/dist/features/workbench/components/WorkbenchIconSidebar.js +48 -28
  42. package/dist/features/workbench/components/WorkbenchSecretsPanel.js +182 -0
  43. package/dist/features/workbench/hooks/useWorkflowData.js +4 -4
  44. package/dist/features/workbench/providers/RemoteFileExplorerProvider.js +160 -0
  45. package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +46 -43
  46. package/dist/features/workspaces/components/PipelineForm.js +1 -1
  47. package/dist/features/workspaces/components/WorkspaceHomePage.js +93 -0
  48. package/dist/hooks/index.js +1 -1
  49. package/dist/hooks/query-keys.js +41 -34
  50. package/dist/hooks/useFiles.js +1 -43
  51. package/dist/hooks/useSecrets.js +69 -0
  52. package/dist/index.d.ts +49 -0
  53. package/dist/index.js +3 -2
  54. package/dist/node_modules/@xyflow/react/dist/esm/index.js +1 -1
  55. package/dist/pages/DashboardPage.js +87 -35
  56. package/dist/pages/EmbedWorkbenchPage.js +43 -39
  57. package/dist/pages/PipelineDebugPage.js +1 -1
  58. package/dist/pages/PreviewWorkbenchPage.js +167 -70
  59. package/dist/pages/WorkspacePage.js +102 -50
  60. package/dist/pages/WorkspaceRunsPage.js +71 -0
  61. package/dist/routing/LocalRouter.js +6 -0
  62. package/dist/types/ai.types.js +13 -0
  63. package/package.json +2 -3
  64. package/dist/node_modules/@ai-sdk/provider/dist/index.js +0 -65
  65. package/dist/node_modules/@ai-sdk/provider-utils/dist/index.js +0 -1008
  66. package/dist/node_modules/ai/dist/index.js +0 -1083
  67. package/dist/node_modules/zod/v3/ZodError.js +0 -79
  68. package/dist/node_modules/zod/v3/errors.js +0 -6
  69. package/dist/node_modules/zod/v3/helpers/errorUtil.js +0 -5
  70. package/dist/node_modules/zod/v3/helpers/parseUtil.js +0 -90
  71. package/dist/node_modules/zod/v3/helpers/util.js +0 -72
  72. package/dist/node_modules/zod/v3/locales/en.js +0 -58
  73. package/dist/node_modules/zod/v3/types.js +0 -2425
  74. package/dist/node_modules/zod/v4/classic/errors.js +0 -21
  75. package/dist/node_modules/zod/v4/classic/iso.js +0 -29
  76. package/dist/node_modules/zod/v4/classic/parse.js +0 -4
  77. package/dist/node_modules/zod/v4/classic/schemas.js +0 -392
  78. package/dist/node_modules/zod/v4/core/api.js +0 -532
  79. package/dist/node_modules/zod/v4/core/checks.js +0 -283
  80. package/dist/node_modules/zod/v4/core/core.js +0 -44
  81. package/dist/node_modules/zod/v4/core/doc.js +0 -21
  82. package/dist/node_modules/zod/v4/core/errors.js +0 -40
  83. package/dist/node_modules/zod/v4/core/json-schema-processors.js +0 -305
  84. package/dist/node_modules/zod/v4/core/parse.js +0 -66
  85. package/dist/node_modules/zod/v4/core/regexes.js +0 -28
  86. package/dist/node_modules/zod/v4/core/registries.js +0 -38
  87. package/dist/node_modules/zod/v4/core/schemas.js +0 -863
  88. package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -220
  89. package/dist/node_modules/zod/v4/core/util.js +0 -267
  90. package/dist/node_modules/zod/v4/core/versions.js +0 -6
@@ -9,23 +9,23 @@ import React, { useCallback, useEffect, useRef, useState } from "react";
9
9
  import { jsx, jsxs } from "react/jsx-runtime";
10
10
  import { Loader2 } from "lucide-react";
11
11
  var nodeTypes = { stateNode: StateNode_default }, edgeTypes = { workflowTransition: WorkflowTransitionEdge_default }, PipelineFlowViewer_default = (b) => {
12
- let x = c(28), { pipelineId: S, workflows: C, pipelineConfig: w } = b, { data: T } = usePipeline(S), E;
13
- x[0] === Symbol.for("react.memo_cache_sentinel") ? (E = [], x[0] = E) : E = x[0];
14
- let [D, O, k] = useNodesState(E), A;
15
- x[1] === Symbol.for("react.memo_cache_sentinel") ? (A = [], x[1] = A) : A = x[1];
16
- let [j, M, N] = useEdgesState(A), { fitView: P } = useReactFlow(), F = useRef(!1), I;
17
- x[2] === Symbol.for("react.memo_cache_sentinel") ? (I = {}, x[2] = I) : I = x[2];
18
- let [L, R] = useState(I), z;
19
- x[3] === Symbol.for("react.memo_cache_sentinel") ? (z = /* @__PURE__ */ new Map(), x[3] = z) : z = x[3];
20
- let B = useRef(z), V = Object.values(L).some(_temp), H;
21
- x[4] === Symbol.for("react.memo_cache_sentinel") ? (H = (e, m) => {
22
- R((h) => h[e] === m ? h : {
12
+ let x = c(29), { pipelineId: S, workflows: C, pipelineConfig: w, direction: T } = b, E = T === void 0 ? "LR" : T, { data: D } = usePipeline(S), O;
13
+ x[0] === Symbol.for("react.memo_cache_sentinel") ? (O = [], x[0] = O) : O = x[0];
14
+ let [k, A, j] = useNodesState(O), M;
15
+ x[1] === Symbol.for("react.memo_cache_sentinel") ? (M = [], x[1] = M) : M = x[1];
16
+ let [N, P, F] = useEdgesState(M), { fitView: I } = useReactFlow(), L = useRef(!1), R;
17
+ x[2] === Symbol.for("react.memo_cache_sentinel") ? (R = {}, x[2] = R) : R = x[2];
18
+ let [z, B] = useState(R), V;
19
+ x[3] === Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ new Map(), x[3] = V) : V = x[3];
20
+ let H = useRef(V), U = Object.values(z).some(_temp), W;
21
+ x[4] === Symbol.for("react.memo_cache_sentinel") ? (W = (e, m) => {
22
+ B((h) => h[e] === m ? h : {
23
23
  ...h,
24
24
  [e]: m
25
25
  });
26
- }, x[4] = H) : H = x[4];
27
- let U = H, W;
28
- x[5] !== M || x[6] !== O || x[7] !== C ? (W = (e, m, h) => {
26
+ }, x[4] = W) : W = x[4];
27
+ let G = W, K;
28
+ x[5] !== P || x[6] !== A || x[7] !== C ? (K = (e, m, h) => {
29
29
  let g = C.findIndex((m) => m.id === e) * 250, _ = m.map((e) => ({
30
30
  ...e,
31
31
  position: {
@@ -33,56 +33,57 @@ var nodeTypes = { stateNode: StateNode_default }, edgeTypes = { workflowTransiti
33
33
  y: e.position.y + g
34
34
  }
35
35
  }));
36
- B.current.set(e, {
36
+ H.current.set(e, {
37
37
  nodes: _,
38
38
  edges: h
39
39
  });
40
40
  let v = [], y = [];
41
- B.current.forEach((e) => {
41
+ H.current.forEach((e) => {
42
42
  let { nodes: m, edges: h } = e;
43
43
  v.push(...m), y.push(...h);
44
- }), O(v), M(y);
45
- }, x[5] = M, x[6] = O, x[7] = C, x[8] = W) : W = x[8];
46
- let G = W, K, q;
47
- if (x[9] !== P || x[10] !== V || x[11] !== D.length ? (K = () => {
48
- if (!V && D.length > 0 && !F.current) {
49
- F.current = !0;
44
+ }), A(v), P(y);
45
+ }, x[5] = P, x[6] = A, x[7] = C, x[8] = K) : K = x[8];
46
+ let q = K, J, Y;
47
+ if (x[9] !== I || x[10] !== U || x[11] !== k.length ? (J = () => {
48
+ if (!U && k.length > 0 && !L.current) {
49
+ L.current = !0;
50
50
  let e = setTimeout(() => {
51
- P({ padding: .2 });
51
+ I({ padding: .2 });
52
52
  }, 150);
53
53
  return () => clearTimeout(e);
54
54
  }
55
- }, q = [
56
- V,
57
- D.length,
58
- P
59
- ], x[9] = P, x[10] = V, x[11] = D.length, x[12] = K, x[13] = q) : (K = x[12], q = x[13]), useEffect(K, q), V && D.length === 0) {
55
+ }, Y = [
56
+ U,
57
+ k.length,
58
+ I
59
+ ], x[9] = I, x[10] = U, x[11] = k.length, x[12] = J, x[13] = Y) : (J = x[12], Y = x[13]), useEffect(J, Y), U && k.length === 0) {
60
60
  let e;
61
61
  return x[14] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("div", {
62
62
  className: "flex h-full items-center justify-center",
63
63
  children: /* @__PURE__ */ jsx(Loader2, { className: "text-muted-foreground h-8 w-8 animate-spin" })
64
64
  }), x[14] = e) : e = x[14], e;
65
65
  }
66
- let J;
67
- x[15] !== G || x[16] !== T || x[17] !== w || x[18] !== C ? (J = T && C.map((e) => /* @__PURE__ */ jsx(WorkflowGraph_default, {
68
- pipeline: T,
66
+ let X;
67
+ x[15] !== E || x[16] !== q || x[17] !== D || x[18] !== w || x[19] !== C ? (X = D && C.map((e) => /* @__PURE__ */ jsx(WorkflowGraph_default, {
68
+ pipeline: D,
69
69
  workflow: e,
70
70
  pipelineConfig: w,
71
- onGraphReady: G,
72
- onLoadingChange: U
73
- }, e.id)), x[15] = G, x[16] = T, x[17] = w, x[18] = C, x[19] = J) : J = x[19];
74
- let Y;
75
- x[20] !== j || x[21] !== D || x[22] !== N || x[23] !== k ? (Y = D.length === 0 ? /* @__PURE__ */ jsx("div", {
71
+ onGraphReady: q,
72
+ onLoadingChange: G,
73
+ direction: E
74
+ }, e.id)), x[15] = E, x[16] = q, x[17] = D, x[18] = w, x[19] = C, x[20] = X) : X = x[20];
75
+ let Z;
76
+ x[21] !== N || x[22] !== k || x[23] !== F || x[24] !== j ? (Z = k.length === 0 ? /* @__PURE__ */ jsx("div", {
76
77
  className: "text-muted-foreground flex h-full items-center justify-center",
77
78
  children: /* @__PURE__ */ jsx("p", {
78
79
  className: "font-medium",
79
80
  children: "No workflow transitions available"
80
81
  })
81
82
  }) : /* @__PURE__ */ jsxs(index, {
82
- nodes: D,
83
- edges: j,
84
- onNodesChange: k,
85
- onEdgesChange: N,
83
+ nodes: k,
84
+ edges: N,
85
+ onNodesChange: j,
86
+ onEdgesChange: F,
86
87
  nodeTypes,
87
88
  edgeTypes,
88
89
  fitView: !0,
@@ -96,12 +97,12 @@ var nodeTypes = { stateNode: StateNode_default }, edgeTypes = { workflowTransiti
96
97
  size: 1,
97
98
  className: "opacity-[0.15]"
98
99
  }), /* @__PURE__ */ jsx(Controls, { className: "bg-card border-border rounded-lg border shadow-md" })]
99
- }), x[20] = j, x[21] = D, x[22] = N, x[23] = k, x[24] = Y) : Y = x[24];
100
- let X;
101
- return x[25] !== Y || x[26] !== J ? (X = /* @__PURE__ */ jsxs("div", {
100
+ }), x[21] = N, x[22] = k, x[23] = F, x[24] = j, x[25] = Z) : Z = x[25];
101
+ let Q;
102
+ return x[26] !== X || x[27] !== Z ? (Q = /* @__PURE__ */ jsxs("div", {
102
103
  className: "h-full w-full",
103
- children: [J, Y]
104
- }), x[25] = Y, x[26] = J, x[27] = X) : X = x[27], X;
104
+ children: [X, Z]
105
+ }), x[26] = X, x[27] = Z, x[28] = Q) : Q = x[28], Q;
105
106
  };
106
107
  function _temp(e) {
107
108
  return e;
@@ -6,36 +6,36 @@ function countTransitions(e) {
6
6
  return e ? getTransitions(e).length : 0;
7
7
  }
8
8
  var WorkflowGraph_default = (s) => {
9
- let l = c(17), { pipeline: u, workflow: d, pipelineConfig: f, onGraphReady: p, onLoadingChange: m } = s, h = useWorkflow(d.id), g = h.data, _ = useRef(null), v, y;
10
- l[0] !== h.isLoading || l[1] !== m || l[2] !== d.id ? (v = () => {
11
- m(d.id, h.isLoading);
12
- }, y = [
9
+ let l = c(18), { pipeline: u, workflow: d, pipelineConfig: f, onGraphReady: p, onLoadingChange: m, direction: h } = s, g = h === void 0 ? "LR" : h, _ = useWorkflow(d.id), v = _.data, y = useRef(null), b, x;
10
+ l[0] !== _.isLoading || l[1] !== m || l[2] !== d.id ? (b = () => {
11
+ m(d.id, _.isLoading);
12
+ }, x = [
13
13
  d.id,
14
- h.isLoading,
14
+ _.isLoading,
15
15
  m
16
- ], l[0] = h.isLoading, l[1] = m, l[2] = d.id, l[3] = v, l[4] = y) : (v = l[3], y = l[4]), useEffect(v, y);
17
- let b;
18
- l[5] !== p || l[6] !== u || l[7] !== f || l[8] !== d.id || l[9] !== g ? (b = () => {
16
+ ], l[0] = _.isLoading, l[1] = m, l[2] = d.id, l[3] = b, l[4] = x) : (b = l[3], x = l[4]), useEffect(b, x);
17
+ let S;
18
+ l[5] !== g || l[6] !== p || l[7] !== u || l[8] !== f || l[9] !== d.id || l[10] !== v ? (S = () => {
19
19
  let e = f ? getTransitions(f) : [], o = JSON.stringify({
20
20
  p: countTransitions(u),
21
- w: countTransitions(g),
21
+ w: countTransitions(v),
22
22
  c: e.length,
23
- history: g?.history?.length,
24
- place: g?.place
23
+ history: v?.history?.length,
24
+ place: v?.place
25
25
  });
26
- if (o !== _.current) {
27
- _.current = o;
28
- let { nodes: a, edges: s } = buildWorkflowGraph(u, g, d.id, e, "LR");
26
+ if (o !== y.current) {
27
+ y.current = o;
28
+ let { nodes: a, edges: s } = buildWorkflowGraph(u, v, d.id, e, g);
29
29
  p(d.id, a, s);
30
30
  }
31
- }, l[5] = p, l[6] = u, l[7] = f, l[8] = d.id, l[9] = g, l[10] = b) : b = l[10];
32
- let x;
33
- return l[11] !== p || l[12] !== u || l[13] !== f || l[14] !== d || l[15] !== g ? (x = [
31
+ }, l[5] = g, l[6] = p, l[7] = u, l[8] = f, l[9] = d.id, l[10] = v, l[11] = S) : S = l[11];
32
+ let C;
33
+ return l[12] !== p || l[13] !== u || l[14] !== f || l[15] !== d || l[16] !== v ? (C = [
34
34
  u,
35
35
  d,
36
- g,
36
+ v,
37
37
  f,
38
38
  p
39
- ], l[11] = p, l[12] = u, l[13] = f, l[14] = d, l[15] = g, l[16] = x) : x = l[16], useEffect(b, x), null;
39
+ ], l[12] = p, l[13] = u, l[14] = f, l[15] = d, l[16] = v, l[17] = C) : C = l[17], useEffect(S, C), null;
40
40
  };
41
41
  export { WorkflowGraph_default as default };
@@ -2,6 +2,7 @@ import CompletionMessagePaper_default from "../../components/messages/Completion
2
2
  import OAuthPromptRenderer_default from "../oauth/OAuthPromptRenderer.js";
3
3
  import "../oauth/index.js";
4
4
  import AiMessage_default from "./renderers/AiMessage.js";
5
+ import ClaudeMessage_default from "./renderers/ClaudeMessage.js";
5
6
  import DocumentDebugRenderer_default from "./renderers/DocumentDebugRenderer.js";
6
7
  import DocumentFormRenderer_default from "./renderers/DocumentFormRenderer.js";
7
8
  import DocumentMessageRenderer_default from "./renderers/DocumentMessageRenderer.js";
@@ -13,22 +14,26 @@ import { c } from "react/compiler-runtime";
13
14
  import React from "react";
14
15
  import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
15
16
  var rendererRegistry = new Map([
16
- ["ai-message", ({ document: e, isLastItem: f }) => /* @__PURE__ */ jsx(AiMessage_default, {
17
+ ["ai-message", ({ document: e, isLastItem: p }) => /* @__PURE__ */ jsx(AiMessage_default, {
17
18
  document: e,
18
- isLastItem: f
19
+ isLastItem: p
20
+ })],
21
+ ["claude-message", ({ document: e, isLastItem: p }) => /* @__PURE__ */ jsx(ClaudeMessage_default, {
22
+ document: e,
23
+ isLastItem: p
19
24
  })],
20
25
  ["debug", ({ document: e }) => /* @__PURE__ */ jsx("div", {
21
26
  className: "mb-4 flex",
22
27
  children: /* @__PURE__ */ jsx(DocumentDebugRenderer_default, { document: e })
23
28
  })],
24
- ["object-form", ({ pipeline: f, workflow: p, document: m, isActive: g }) => /* @__PURE__ */ jsx(CompletionMessagePaper_default, {
29
+ ["object-form", ({ pipeline: p, workflow: m, document: h, isActive: g }) => /* @__PURE__ */ jsx(CompletionMessagePaper_default, {
25
30
  role: "document",
26
31
  fullWidth: !0,
27
- timestamp: new Date(m.createdAt),
32
+ timestamp: new Date(h.createdAt),
28
33
  children: /* @__PURE__ */ jsx(DocumentFormRenderer_default, {
29
- pipeline: f,
30
- workflow: p,
31
- document: m,
34
+ pipeline: p,
35
+ workflow: m,
36
+ document: h,
32
37
  enabled: g,
33
38
  viewOnly: !g
34
39
  })
@@ -38,16 +43,16 @@ var rendererRegistry = new Map([
38
43
  ["plain", ({ document: e }) => /* @__PURE__ */ jsx(PlainMessageRenderer_default, { document: e })],
39
44
  ["markdown", ({ document: e }) => /* @__PURE__ */ jsx(MarkdownMessageRenderer_default, { document: e })],
40
45
  ["link", ({ document: e }) => /* @__PURE__ */ jsx(LinkMessageRenderer_default, { document: e })],
41
- ["oauth-prompt", ({ pipeline: e, workflow: p, document: m, isActive: h }) => /* @__PURE__ */ jsx(OAuthPromptRenderer_default, {
46
+ ["oauth-prompt", ({ pipeline: e, workflow: m, document: h, isActive: g }) => /* @__PURE__ */ jsx(OAuthPromptRenderer_default, {
42
47
  pipeline: e,
43
- workflow: p,
44
- document: m,
45
- isActive: h
48
+ workflow: m,
49
+ document: h,
50
+ isActive: g
46
51
  })]
47
52
  ]), DocumentRenderer_default = (e) => {
48
- let f = c(5), p = e.document.ui?.form?.widget ?? "object-form", m;
49
- f[0] === p ? m = f[1] : (m = rendererRegistry.get(p), f[0] = p, f[1] = m);
50
- let h = m, g;
51
- return f[2] !== h || f[3] !== e ? (g = /* @__PURE__ */ jsx("div", { children: h ? /* @__PURE__ */ jsx(h, { ...e }) : /* @__PURE__ */ jsx(Fragment$1, { children: "unknown document type" }) }), f[2] = h, f[3] = e, f[4] = g) : g = f[4], g;
53
+ let p = c(5), m = e.document.ui?.form?.widget ?? "object-form", h;
54
+ p[0] === m ? h = p[1] : (h = rendererRegistry.get(m), p[0] = m, p[1] = h);
55
+ let g = h, _;
56
+ return p[2] !== g || p[3] !== e ? (_ = /* @__PURE__ */ jsx("div", { children: g ? /* @__PURE__ */ jsx(g, { ...e }) : /* @__PURE__ */ jsx(Fragment$1, { children: "unknown document type" }) }), p[2] = g, p[3] = e, p[4] = _) : _ = p[4], _;
52
57
  };
53
58
  export { DocumentRenderer_default as default };
@@ -21,7 +21,11 @@ var import_enums = require_enums(), DocumentList_default = (e) => {
21
21
  let e;
22
22
  o[15] !== d.length || o[16] !== v || o[17] !== l || o[18] !== p || o[19] !== u ? (e = (e, a) => {
23
23
  let o = e, s = e.place === u.place || !!o.meta?.enableAtPlaces?.includes(u.place);
24
- return /* @__PURE__ */ jsx(DocumentItem_default, {
24
+ return console.log({
25
+ isDocumentActive: s,
26
+ enableAtPlaces: o.meta?.enableAtPlaces,
27
+ place: u.place
28
+ }), /* @__PURE__ */ jsx(DocumentItem_default, {
25
29
  document: e,
26
30
  workflow: u,
27
31
  pipeline: l,
@@ -1,23 +1,23 @@
1
- import { getToolOrDynamicToolName, isReasoningUIPart, isTextUIPart, isToolOrDynamicToolUIPart } from "../../../node_modules/ai/dist/index.js";
2
1
  import { Message, MessageAction, MessageActions, MessageContent, MessageResponse } from "../../../components/ai-elements/message.js";
3
2
  import { Reasoning, ReasoningContent, ReasoningTrigger } from "../../../components/ai-elements/reasoning.js";
4
3
  import { Source, Sources, SourcesContent, SourcesTrigger } from "../../../components/ai-elements/sources.js";
5
4
  import { Tool, ToolContent, ToolHeader, ToolInput, ToolOutput } from "../../../components/ai-elements/tool.js";
5
+ import { getToolOrDynamicToolName, isReasoningUIPart, isTextUIPart, isToolOrDynamicToolUIPart } from "../../../types/ai.types.js";
6
6
  import { c } from "react/compiler-runtime";
7
7
  import { Fragment } from "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
9
  import { CopyIcon } from "lucide-react";
10
10
  var AiMessage_default = (O) => {
11
- let k = c(13), { document: A } = O, j = A.content, M, N;
11
+ let k = c(13), { document: A } = O, j = A.content, M = _temp, N, P;
12
12
  if (k[0] !== j.id || k[1] !== j.parts || k[2] !== j.role) {
13
- let n = j.parts?.filter(_temp) ?? [];
14
- M = Fragment, N = j.role === "assistant" && n.length > 0 && /* @__PURE__ */ jsxs(Sources, { children: [/* @__PURE__ */ jsx(SourcesTrigger, { count: n.length }), n.map((n, T) => /* @__PURE__ */ jsx(SourcesContent, { children: /* @__PURE__ */ jsx(Source, {
13
+ let n = j.parts?.filter(M) ?? [];
14
+ N = Fragment, P = j.role === "assistant" && n.length > 0 && /* @__PURE__ */ jsxs(Sources, { children: [/* @__PURE__ */ jsx(SourcesTrigger, { count: n.length }), n.map((n, T) => /* @__PURE__ */ jsx(SourcesContent, { children: /* @__PURE__ */ jsx(Source, {
15
15
  href: n.url,
16
16
  title: n.url
17
- }) }, `${j.id}-source-${T}`))] }), k[0] = j.id, k[1] = j.parts, k[2] = j.role, k[3] = M, k[4] = N;
18
- } else M = k[3], N = k[4];
19
- let P;
20
- k[5] !== j.id || k[6] !== j.parts || k[7] !== j.role ? (P = j.parts?.map((E, D) => {
17
+ }) }, `${j.id}-source-${T}`))] }), k[0] = j.id, k[1] = j.parts, k[2] = j.role, k[3] = N, k[4] = P;
18
+ } else N = k[3], P = k[4];
19
+ let F;
20
+ k[5] !== j.id || k[6] !== j.parts || k[7] !== j.role ? (F = j.parts?.map((E, D) => {
21
21
  if (isTextUIPart(E)) return /* @__PURE__ */ jsxs(Message, {
22
22
  from: j.role,
23
23
  children: [/* @__PURE__ */ jsx(MessageContent, { children: /* @__PURE__ */ jsx(MessageResponse, { children: E.text }) }), j.role === "assistant" && /* @__PURE__ */ jsx(MessageActions, { children: /* @__PURE__ */ jsx(MessageAction, {
@@ -46,9 +46,9 @@ var AiMessage_default = (O) => {
46
46
  }, `${j.id}-${D}`);
47
47
  }
48
48
  return null;
49
- }), k[5] = j.id, k[6] = j.parts, k[7] = j.role, k[8] = P) : P = k[8];
50
- let F;
51
- return k[9] !== M || k[10] !== N || k[11] !== P ? (F = /* @__PURE__ */ jsxs(M, { children: [N, P] }), k[9] = M, k[10] = N, k[11] = P, k[12] = F) : F = k[12], F;
49
+ }), k[5] = j.id, k[6] = j.parts, k[7] = j.role, k[8] = F) : F = k[8];
50
+ let I;
51
+ return k[9] !== N || k[10] !== P || k[11] !== F ? (I = /* @__PURE__ */ jsxs(N, { children: [P, F] }), k[9] = N, k[10] = P, k[11] = F, k[12] = I) : I = k[12], I;
52
52
  };
53
53
  function _temp(n) {
54
54
  return n.type === "source-url";
@@ -0,0 +1,96 @@
1
+ import { Message, MessageAction, MessageActions, MessageContent, MessageResponse } from "../../../components/ai-elements/message.js";
2
+ import { Reasoning, ReasoningContent, ReasoningTrigger } from "../../../components/ai-elements/reasoning.js";
3
+ import { Tool, ToolContent, ToolHeader, ToolInput, ToolOutput } from "../../../components/ai-elements/tool.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import { Fragment } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { CopyIcon } from "lucide-react";
8
+ var ClaudeMessage_default = (y) => {
9
+ let b = c(19), { document: x } = y, S = x.content, C = S.id ?? x.id, w, T, E;
10
+ if (b[0] !== S.content || b[1] !== S.role || b[2] !== S.toolResults || b[3] !== C) {
11
+ E = Symbol.for("react.early_return_sentinel");
12
+ bb0: {
13
+ let _ = /* @__PURE__ */ new Map();
14
+ if (S.toolResults) for (let n of S.toolResults) _.set(n.tool_use_id, n);
15
+ if (typeof S.content == "string") {
16
+ let m;
17
+ b[7] === S.content ? m = b[8] : (m = /* @__PURE__ */ jsx(MessageContent, { children: /* @__PURE__ */ jsx(MessageResponse, { children: S.content }) }), b[7] = S.content, b[8] = m);
18
+ let h;
19
+ b[9] !== S.content || b[10] !== S.role ? (h = S.role === "assistant" && /* @__PURE__ */ jsx(MessageActions, { children: /* @__PURE__ */ jsx(MessageAction, {
20
+ onClick: () => void navigator.clipboard.writeText(S.content),
21
+ label: "Copy",
22
+ children: /* @__PURE__ */ jsx(CopyIcon, { className: "size-3" })
23
+ }) }), b[9] = S.content, b[10] = S.role, b[11] = h) : h = b[11];
24
+ let g;
25
+ b[12] !== S.role || b[13] !== m || b[14] !== h ? (g = /* @__PURE__ */ jsxs(Message, {
26
+ from: S.role,
27
+ children: [m, h]
28
+ }), b[12] = S.role, b[13] = m, b[14] = h, b[15] = g) : g = b[15], E = g;
29
+ break bb0;
30
+ }
31
+ let y = S.content;
32
+ w = Fragment, T = y.map((v, y) => {
33
+ switch (v.type) {
34
+ case "text": return /* @__PURE__ */ jsxs(Message, {
35
+ from: S.role,
36
+ children: [/* @__PURE__ */ jsx(MessageContent, { children: /* @__PURE__ */ jsx(MessageResponse, { children: v.text }) }), S.role === "assistant" && /* @__PURE__ */ jsx(MessageActions, { children: /* @__PURE__ */ jsx(MessageAction, {
37
+ onClick: () => void navigator.clipboard.writeText(v.text),
38
+ label: "Copy",
39
+ children: /* @__PURE__ */ jsx(CopyIcon, { className: "size-3" })
40
+ }) })]
41
+ }, `${C}-${y}`);
42
+ case "thinking": return /* @__PURE__ */ jsxs(Reasoning, {
43
+ className: "w-full",
44
+ isStreaming: !1,
45
+ children: [/* @__PURE__ */ jsx(ReasoningTrigger, {}), /* @__PURE__ */ jsx(ReasoningContent, { children: v.thinking })]
46
+ }, `${C}-${y}`);
47
+ case "tool_use": {
48
+ let f = _.get(v.id), p;
49
+ if (f) try {
50
+ p = JSON.parse(f.content);
51
+ } catch {
52
+ p = f.content;
53
+ }
54
+ return /* @__PURE__ */ jsx(Message, {
55
+ from: "assistant",
56
+ children: /* @__PURE__ */ jsxs(Tool, { children: [/* @__PURE__ */ jsx(ToolHeader, {
57
+ state: f ? f.is_error ? "output-error" : "output-available" : "input-available",
58
+ title: v.name,
59
+ type: "tool-call"
60
+ }), /* @__PURE__ */ jsxs(ToolContent, { children: [/* @__PURE__ */ jsx(ToolInput, { input: v.input }), f && /* @__PURE__ */ jsx(ToolOutput, {
61
+ output: p,
62
+ errorText: f.is_error ? f.content : ""
63
+ })] })] })
64
+ }, `${C}-${y}`);
65
+ }
66
+ case "tool_result": {
67
+ if (_.size > 0) return null;
68
+ let f;
69
+ try {
70
+ f = JSON.parse(v.content);
71
+ } catch {
72
+ f = v.content;
73
+ }
74
+ return /* @__PURE__ */ jsx(Message, {
75
+ from: "assistant",
76
+ children: /* @__PURE__ */ jsxs(Tool, { children: [/* @__PURE__ */ jsx(ToolHeader, {
77
+ state: v.is_error ? "output-error" : "output-available",
78
+ title: "Tool Result",
79
+ type: "tool-result"
80
+ }), /* @__PURE__ */ jsx(ToolContent, { children: /* @__PURE__ */ jsx(ToolOutput, {
81
+ output: f,
82
+ errorText: v.is_error ? v.content : ""
83
+ }) })] })
84
+ }, `${C}-${y}`);
85
+ }
86
+ default: return null;
87
+ }
88
+ });
89
+ }
90
+ b[0] = S.content, b[1] = S.role, b[2] = S.toolResults, b[3] = C, b[4] = w, b[5] = T, b[6] = E;
91
+ } else w = b[4], T = b[5], E = b[6];
92
+ if (E !== Symbol.for("react.early_return_sentinel")) return E;
93
+ let D;
94
+ return b[16] !== w || b[17] !== T ? (D = /* @__PURE__ */ jsx(w, { children: T }), b[16] = w, b[17] = T, b[18] = D) : D = b[18], D;
95
+ };
96
+ export { ClaudeMessage_default as default };
@@ -7,7 +7,7 @@ import { jsx } from "react/jsx-runtime";
7
7
  import { useForm } from "react-hook-form";
8
8
  import "zod";
9
9
  var DocumentFormRenderer_default = (l) => {
10
- let u = c(39), { pipeline: d, workflow: f, document: p, enabled: m, viewOnly: h } = l, g = useRunPipeline(), _;
10
+ let u = c(40), { pipeline: d, workflow: f, document: p, enabled: m, viewOnly: h } = l, g = useRunPipeline(), _;
11
11
  u[0] !== p.content || u[1] !== p.schema.type ? (_ = p.schema.type === "object" ? p.content : { raw: p.content }, u[0] = p.content, u[1] = p.schema.type, u[2] = _) : _ = u[2];
12
12
  let v;
13
13
  u[3] === _ ? v = u[4] : (v = {
@@ -46,22 +46,28 @@ var DocumentFormRenderer_default = (l) => {
46
46
  p.schema.type === "object" ? T(e, s) : T(e, s.raw);
47
47
  }, u[16] = p.schema.type, u[17] = T, u[18] = E) : E = u[18];
48
48
  let D = E, O;
49
- u[19] !== y || u[20] !== D ? (O = (e) => {
50
- y.handleSubmit(D(e))();
51
- }, u[19] = y, u[20] = D, u[21] = O) : O = u[21];
52
- let k = O, A = p.ui, j = p.schema, M = A?.form?.disabled, N = !m || M || !1, P;
53
- u[22] === p.ui?.actions ? P = u[23] : (P = p.ui?.actions ?? [], u[22] = p.ui?.actions, u[23] = P);
54
- let F = P, I = A ?? void 0, L = p.meta?.mimeType, R;
55
- u[24] !== F || u[25] !== C || u[26] !== N || u[27] !== k || u[28] !== g.isPending || u[29] !== f.place ? (R = /* @__PURE__ */ jsx(UiActions_default, {
49
+ u[19] !== T || u[20] !== y || u[21] !== D ? (O = (e, s) => {
50
+ s === void 0 ? y.handleSubmit(D(e))() : T(e, s);
51
+ }, u[19] = T, u[20] = y, u[21] = D, u[22] = O) : O = u[22];
52
+ let k = O, A = p.ui, j = p.schema, M = !!A?.form?.disabled, N = !m || M || !1, P;
53
+ u[23] === p.ui?.actions ? P = u[24] : (P = p.ui?.actions ?? [], u[23] = p.ui?.actions, u[24] = P);
54
+ let F = P;
55
+ console.log({
56
+ document: p,
57
+ formDisabled: M,
58
+ enabled: m
59
+ });
60
+ let I = A ?? void 0, L = p.meta?.mimeType, R;
61
+ u[25] !== F || u[26] !== C || u[27] !== N || u[28] !== k || u[29] !== g.isPending || u[30] !== f.place ? (R = /* @__PURE__ */ jsx(UiActions_default, {
56
62
  actions: F,
57
63
  onSubmit: k,
58
64
  availableTransitions: C,
59
65
  currentPlace: f.place,
60
66
  disabled: N,
61
67
  isLoading: g.isPending
62
- }), u[24] = F, u[25] = C, u[26] = N, u[27] = k, u[28] = g.isPending, u[29] = f.place, u[30] = R) : R = u[30];
68
+ }), u[25] = F, u[26] = C, u[27] = N, u[28] = k, u[29] = g.isPending, u[30] = f.place, u[31] = R) : R = u[31];
63
69
  let z;
64
- return u[31] !== N || u[32] !== y || u[33] !== j || u[34] !== I || u[35] !== L || u[36] !== R || u[37] !== h ? (z = /* @__PURE__ */ jsx("div", {
70
+ return u[32] !== N || u[33] !== y || u[34] !== j || u[35] !== I || u[36] !== L || u[37] !== R || u[38] !== h ? (z = /* @__PURE__ */ jsx("div", {
65
71
  className: "flex",
66
72
  children: /* @__PURE__ */ jsx(Form_default, {
67
73
  form: y,
@@ -72,7 +78,7 @@ var DocumentFormRenderer_default = (l) => {
72
78
  viewOnly: h,
73
79
  actions: R
74
80
  })
75
- }), u[31] = N, u[32] = y, u[33] = j, u[34] = I, u[35] = L, u[36] = R, u[37] = h, u[38] = z) : z = u[38], z;
81
+ }), u[32] = N, u[33] = y, u[34] = j, u[35] = I, u[36] = L, u[37] = R, u[38] = h, u[39] = z) : z = u[39], z;
76
82
  };
77
83
  function _temp(e) {
78
84
  return e.id;