@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
@@ -8,59 +8,59 @@ var NODE_WIDTH = 130, NODE_HEIGHT = 70, CONDITION_OPERATORS = {
8
8
  ge: ">=",
9
9
  le: "<="
10
10
  };
11
- function getLayoutedElements(e, d, f = "LR") {
12
- let p = new dagre_esm_default.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
13
- p.setGraph({
14
- rankdir: f,
11
+ function getLayoutedElements(e, u, d = "LR") {
12
+ let f = new dagre_esm_default.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
13
+ f.setGraph({
14
+ rankdir: d,
15
15
  nodesep: 100,
16
16
  ranksep: 200
17
17
  });
18
- for (let s of e) p.setNode(s.id, {
18
+ for (let o of e) f.setNode(o.id, {
19
19
  width: NODE_WIDTH,
20
20
  height: NODE_HEIGHT
21
21
  });
22
- for (let e of d) p.setEdge(e.source, e.target);
23
- return dagre_esm_default.layout(p), {
22
+ for (let e of u) f.setEdge(e.source, e.target);
23
+ return dagre_esm_default.layout(f), {
24
24
  nodes: e.map((e) => {
25
- let c = p.node(e.id);
25
+ let s = f.node(e.id);
26
26
  return {
27
27
  ...e,
28
- targetPosition: f === "LR" ? Position.Left : Position.Top,
29
- sourcePosition: f === "LR" ? Position.Right : Position.Bottom,
28
+ targetPosition: d === "LR" ? Position.Left : Position.Top,
29
+ sourcePosition: d === "LR" ? Position.Right : Position.Bottom,
30
30
  position: {
31
- x: c.x - NODE_WIDTH / 2,
32
- y: c.y - NODE_HEIGHT / 2
31
+ x: s.x - NODE_WIDTH / 2,
32
+ y: s.y - NODE_HEIGHT / 2
33
33
  }
34
34
  };
35
35
  }),
36
- edges: d
36
+ edges: u
37
37
  };
38
38
  }
39
- function getTransitions(e, s = /* @__PURE__ */ new Set()) {
40
- if (!e || typeof e != "object" || s.has(e)) return [];
39
+ function getTransitions(e, o = /* @__PURE__ */ new Set()) {
40
+ if (!e || typeof e != "object" || o.has(e)) return [];
41
41
  try {
42
- s.add(e);
42
+ o.add(e);
43
43
  } catch {
44
44
  return [];
45
45
  }
46
- let c = e;
47
- if (Array.isArray(c.transitions)) return c.transitions;
48
- if (c.definition) {
49
- let e = getTransitions(c.definition, s);
46
+ let s = e;
47
+ if (Array.isArray(s.transitions)) return s.transitions;
48
+ if (s.definition) {
49
+ let e = getTransitions(s.definition, o);
50
50
  if (e.length > 0) return e;
51
51
  }
52
- if (c.specification) {
53
- let e = getTransitions(c.specification, s);
52
+ if (s.specification) {
53
+ let e = getTransitions(s.specification, o);
54
54
  if (e.length > 0) return e;
55
55
  }
56
- for (let e in c) {
56
+ for (let e in s) {
57
57
  if (e === "history" || e === "data") continue;
58
- let l = c[e];
59
- if (l && typeof l == "object") {
60
- let e = getTransitions(l, s);
58
+ let c = s[e];
59
+ if (c && typeof c == "object") {
60
+ let e = getTransitions(c, o);
61
61
  if (e.length > 0) return e;
62
- } else if (typeof l == "string" && l.includes("\"transitions\":")) try {
63
- let e = getTransitions(JSON.parse(l), s);
62
+ } else if (typeof c == "string" && c.includes("\"transitions\":")) try {
63
+ let e = getTransitions(JSON.parse(c), o);
64
64
  if (e.length > 0) return e;
65
65
  } catch {}
66
66
  }
@@ -68,125 +68,117 @@ function getTransitions(e, s = /* @__PURE__ */ new Set()) {
68
68
  }
69
69
  function formatCondition(e) {
70
70
  if (!e) return "";
71
- let s = e.replace(/\{\{|\}\}/g, "").trim(), c = s.split(/\s+/);
72
- if (c.length === 3) {
73
- let [e, s, l] = c, u = CONDITION_OPERATORS[e];
74
- if (u) return `${s} ${u} ${l}`;
71
+ let o = e.replace(/\{\{|\}\}/g, "").trim(), s = o.split(/\s+/);
72
+ if (s.length === 3) {
73
+ let [e, o, c] = s, l = CONDITION_OPERATORS[e];
74
+ if (l) return `${o} ${l} ${c}`;
75
75
  }
76
- return s;
76
+ return o;
77
77
  }
78
- function buildWorkflowGraph(e, s, c, l = [], u, d = !1) {
79
- let p = collectTransitions(e, s, l), m = extractHistory(s), h = collectStates(p, m), x = buildExecutedMap(m), S = resolveTransitions(p, m), C = findEndStates(h, S), w = findVisitedStates(m), T = computeStateRanks(S), E = buildNodes(h, {
80
- workflowId: c,
81
- currentPlace: s?.place,
82
- endStates: C,
83
- visitedStates: w,
84
- visitCounts: buildVisitCounts(m),
85
- direction: u,
86
- forceVisible: d
87
- }), D = buildEdges(S, {
88
- workflowId: c,
89
- executedMap: x,
90
- stateRanks: T,
91
- forceVisible: d
78
+ function buildWorkflowGraph(e, o, s, c = [], l, u = !1, f = []) {
79
+ let p = collectTransitions(e, o, c), m = collectStates(p, f), b = buildExecutedMap(f), x = resolveTransitions(p, f), S = findEndStates(m, x), C = findVisitedStates(f), w = computeStateRanks(x), T = buildNodes(m, {
80
+ workflowId: s,
81
+ currentPlace: o?.place,
82
+ endStates: S,
83
+ visitedStates: C,
84
+ visitCounts: buildVisitCounts(f),
85
+ direction: l,
86
+ forceVisible: u
87
+ }), E = buildEdges(x, {
88
+ workflowId: s,
89
+ executedMap: b,
90
+ stateRanks: w,
91
+ forceVisible: u
92
92
  });
93
- return E.length > 1 ? getLayoutedElements(E, D, u) : {
94
- nodes: E,
95
- edges: D
93
+ return T.length > 1 ? getLayoutedElements(T, E, l) : {
94
+ nodes: T,
95
+ edges: E
96
96
  };
97
97
  }
98
- function collectTransitions(e, s, c) {
99
- let l = [...c];
100
- e && l.push(...getTransitions(e)), s && l.push(...getTransitions(s));
101
- let u = /* @__PURE__ */ new Set();
102
- return l.filter((e) => {
103
- let s = Array.isArray(e.from) ? e.from.join(",") : e.from, c = `${e.id}-${s}-${e.to}`;
104
- return u.has(c) ? !1 : (u.add(c), !0);
98
+ function collectTransitions(e, o, s) {
99
+ let c = [...s];
100
+ e && c.push(...getTransitions(e)), o && c.push(...getTransitions(o));
101
+ let l = /* @__PURE__ */ new Set();
102
+ return c.filter((e) => {
103
+ let o = Array.isArray(e.from) ? e.from.join(",") : e.from, s = `${e.id}-${o}-${e.to}`;
104
+ return l.has(s) ? !1 : (l.add(s), !0);
105
105
  });
106
106
  }
107
- function extractHistory(e) {
108
- return e?.history ?? [];
109
- }
110
- function collectStates(e, s) {
111
- let c = new Set(["start"]);
112
- for (let s of e) {
113
- let e = Array.isArray(s.from) ? s.from : [s.from];
114
- for (let s of e) c.add(s ?? "start");
115
- c.add(s.to);
107
+ function collectStates(e, o) {
108
+ let s = new Set(["start"]);
109
+ for (let o of e) {
110
+ let e = Array.isArray(o.from) ? o.from : [o.from];
111
+ for (let o of e) s.add(o ?? "start");
112
+ s.add(o.to);
116
113
  }
117
- for (let e of s) e.data?.place && c.add(e.data.place), e.data?.transition && (c.add(e.data.transition.from ?? "start"), c.add(e.data.transition.to));
118
- return c;
114
+ for (let e of o) e.place && s.add(e.place), e.transitionFrom && s.add(e.transitionFrom);
115
+ return s;
119
116
  }
120
117
  function buildVisitCounts(e) {
121
- let s = new Map([["start", 1]]);
122
- for (let c of e) {
123
- let e = c.data?.place;
124
- e && s.set(e, (s.get(e) ?? 0) + 1);
125
- }
126
- return s;
118
+ let o = new Map([["start", 1]]);
119
+ for (let s of e) s.place && o.set(s.place, (o.get(s.place) ?? 0) + 1);
120
+ return o;
127
121
  }
128
122
  function buildExecutedMap(e) {
129
- let s = /* @__PURE__ */ new Map();
130
- for (let c of e) {
131
- let e = c.data?.transition;
132
- if (!e) continue;
133
- let l = `${e.from ?? "start"}->${e.to}:${e.id}`;
134
- s.set(l, (s.get(l) ?? 0) + 1);
123
+ let o = /* @__PURE__ */ new Map();
124
+ for (let s of e) {
125
+ if (!s.transitionId) continue;
126
+ let e = `${s.transitionFrom ?? "start"}->${s.place}:${s.transitionId}`;
127
+ o.set(e, (o.get(e) ?? 0) + 1);
135
128
  }
136
- return s;
129
+ return o;
137
130
  }
138
- function resolveTransitions(e, s) {
139
- let c = [];
140
- for (let s of e) {
141
- let e = Array.isArray(s.from) ? s.from : [s.from], l = s;
142
- for (let u of e) c.push({
143
- id: s.id,
144
- from: u ?? "start",
145
- to: s.to,
146
- condition: l.if ?? l.condition,
147
- trigger: s.trigger,
148
- call: s.call
131
+ function resolveTransitions(e, o) {
132
+ let s = [];
133
+ for (let o of e) {
134
+ let e = Array.isArray(o.from) ? o.from : [o.from], c = o;
135
+ for (let l of e) s.push({
136
+ id: o.id,
137
+ from: l ?? "start",
138
+ to: o.to,
139
+ condition: c.if ?? c.condition,
140
+ trigger: o.trigger,
141
+ call: o.call
149
142
  });
150
143
  }
151
- for (let e of s) {
152
- let s = e.data?.transition;
153
- if (!s?.id) continue;
154
- let l = s.from ?? "start";
155
- c.some((e) => e.from === l && e.to === s.to && e.id === s.id) || c.push({
156
- id: s.id,
157
- from: l,
158
- to: s.to
144
+ for (let e of o) {
145
+ if (!e.transitionId) continue;
146
+ let o = e.transitionFrom ?? "start";
147
+ s.some((s) => s.from === o && s.to === e.place && s.id === e.transitionId) || s.push({
148
+ id: e.transitionId,
149
+ from: o,
150
+ to: e.place
159
151
  });
160
152
  }
161
- return c;
153
+ return s;
162
154
  }
163
- function findEndStates(e, s) {
164
- let c = new Set(s.map((e) => e.from)), l = /* @__PURE__ */ new Set();
165
- for (let s of e) !c.has(s) && s !== "start" && l.add(s);
166
- return l;
155
+ function findEndStates(e, o) {
156
+ let s = new Set(o.map((e) => e.from)), c = /* @__PURE__ */ new Set();
157
+ for (let o of e) !s.has(o) && o !== "start" && c.add(o);
158
+ return c;
167
159
  }
168
160
  function findVisitedStates(e) {
169
- let s = new Set(["start"]);
170
- for (let c of e) c.data?.place && s.add(c.data.place), c.data?.transition?.to && s.add(c.data.transition.to);
171
- return s;
161
+ let o = new Set(["start"]);
162
+ for (let s of e) s.place && o.add(s.place);
163
+ return o;
172
164
  }
173
165
  function computeStateRanks(e) {
174
- let s = /* @__PURE__ */ new Map();
175
- for (let c of e) {
176
- if (c.from === c.to) continue;
177
- let e = s.get(c.from) ?? [];
178
- e.push(c.to), s.set(c.from, e);
166
+ let o = /* @__PURE__ */ new Map();
167
+ for (let s of e) {
168
+ if (s.from === s.to) continue;
169
+ let e = o.get(s.from) ?? [];
170
+ e.push(s.to), o.set(s.from, e);
179
171
  }
180
- let c = new Map([["start", 0]]), l = ["start"];
181
- for (; l.length > 0;) {
182
- let e = l.shift(), u = c.get(e);
183
- for (let d of s.get(e) ?? []) c.has(d) || (c.set(d, u + 1), l.push(d));
172
+ let s = new Map([["start", 0]]), c = ["start"];
173
+ for (; c.length > 0;) {
174
+ let e = c.shift(), l = s.get(e);
175
+ for (let u of o.get(e) ?? []) s.has(u) || (s.set(u, l + 1), c.push(u));
184
176
  }
185
- return c;
177
+ return s;
186
178
  }
187
- function buildNodes(e, s) {
179
+ function buildNodes(e, o) {
188
180
  return Array.from(e).map((e) => ({
189
- id: `${s.workflowId}-${e}`,
181
+ id: `${o.workflowId}-${e}`,
190
182
  type: "stateNode",
191
183
  position: {
192
184
  x: 0,
@@ -195,53 +187,53 @@ function buildNodes(e, s) {
195
187
  data: {
196
188
  label: e,
197
189
  isStart: e === "start",
198
- isEnd: s.endStates.has(e),
199
- isCurrent: e === s.currentPlace,
200
- isVisited: s.visitedStates.has(e),
201
- visitCount: s.visitCounts.get(e) ?? 0,
202
- direction: s.direction,
203
- forceVisible: s.forceVisible
190
+ isEnd: o.endStates.has(e),
191
+ isCurrent: e === o.currentPlace,
192
+ isVisited: o.visitedStates.has(e),
193
+ visitCount: o.visitCounts.get(e) ?? 0,
194
+ direction: o.direction,
195
+ forceVisible: o.forceVisible
204
196
  }
205
197
  }));
206
198
  }
207
- function buildEdges(s, c) {
208
- let l = /* @__PURE__ */ new Set(), u = [], d = 0;
209
- for (let f of s) {
210
- let s = `${f.from}->${f.to}:${f.id}`;
211
- if (l.has(s)) continue;
212
- l.add(s);
213
- let p = c.executedMap.has(s), m = f.trigger === "onEntry", h = f.from === f.to, g = c.stateRanks.get(f.from) ?? 0, _ = c.stateRanks.get(f.to) ?? 0, v = !h && _ <= g, y = p ? "var(--primary)" : "var(--muted-foreground)", b = {
214
- ...f,
215
- isExecuted: p,
216
- isSelfLoop: h,
217
- isBackEdge: v,
218
- forceVisible: c.forceVisible
199
+ function buildEdges(o, s) {
200
+ let c = /* @__PURE__ */ new Set(), l = [], u = 0;
201
+ for (let d of o) {
202
+ let o = `${d.from}->${d.to}:${d.id}`;
203
+ if (c.has(o)) continue;
204
+ c.add(o);
205
+ let f = s.executedMap.has(o), p = d.trigger === "onEntry", m = d.from === d.to, h = s.stateRanks.get(d.from) ?? 0, g = s.stateRanks.get(d.to) ?? 0, _ = !m && g <= h, v = f ? "var(--primary)" : "var(--muted-foreground)", y = {
206
+ ...d,
207
+ isExecuted: f,
208
+ isSelfLoop: m,
209
+ isBackEdge: _,
210
+ forceVisible: s.forceVisible
219
211
  };
220
- u.push({
221
- id: `edge-${c.workflowId}-${d++}`,
222
- source: `${c.workflowId}-${f.from}`,
223
- target: `${c.workflowId}-${f.to}`,
224
- ...v && {
212
+ l.push({
213
+ id: `edge-${s.workflowId}-${u++}`,
214
+ source: `${s.workflowId}-${d.from}`,
215
+ target: `${s.workflowId}-${d.to}`,
216
+ ..._ && {
225
217
  sourceHandle: "bottom-source",
226
218
  targetHandle: "bottom-target"
227
219
  },
228
220
  type: "workflowTransition",
229
221
  animated: !1,
230
222
  style: {
231
- strokeWidth: p ? 2.5 : 1.5,
232
- stroke: y,
233
- strokeDasharray: m ? "4,4" : p ? void 0 : "5,5",
234
- opacity: p || c.forceVisible ? 1 : .3
223
+ strokeWidth: f ? 2.5 : 1.5,
224
+ stroke: v,
225
+ strokeDasharray: p ? "4,4" : f ? void 0 : "5,5",
226
+ opacity: f || s.forceVisible ? 1 : .3
235
227
  },
236
228
  markerEnd: {
237
229
  type: MarkerType.ArrowClosed,
238
230
  width: 18,
239
231
  height: 18,
240
- color: y
232
+ color: v
241
233
  },
242
- data: b
234
+ data: y
243
235
  });
244
236
  }
245
- return u;
237
+ return l;
246
238
  }
247
239
  export { buildWorkflowGraph, formatCondition, getTransitions };
@@ -2,7 +2,9 @@ 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 ChoicesRenderer_default from "./renderers/ChoicesRenderer.js";
5
6
  import ClaudeMessage_default from "./renderers/ClaudeMessage.js";
7
+ import ConfirmPromptRenderer_default from "./renderers/ConfirmPromptRenderer.js";
6
8
  import DocumentDebugRenderer_default from "./renderers/DocumentDebugRenderer.js";
7
9
  import DocumentFormRenderer_default from "./renderers/DocumentFormRenderer.js";
8
10
  import DocumentMessageRenderer_default from "./renderers/DocumentMessageRenderer.js";
@@ -10,49 +12,83 @@ import ErrorMessageRenderer_default from "./renderers/ErrorMessageRenderer.js";
10
12
  import LinkMessageRenderer_default from "./renderers/LinkMessageRenderer.js";
11
13
  import MarkdownMessageRenderer_default from "./renderers/MarkdownMessageRenderer.js";
12
14
  import PlainMessageRenderer_default from "./renderers/PlainMessageRenderer.js";
15
+ import SecretInputRenderer_default from "./renderers/SecretInputRenderer.js";
16
+ import TextPromptRenderer_default from "./renderers/TextPromptRenderer.js";
13
17
  import { c } from "react/compiler-runtime";
14
18
  import React from "react";
15
19
  import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
16
20
  var rendererRegistry = new Map([
17
- ["ai-message", ({ document: e, isLastItem: p }) => /* @__PURE__ */ jsx(AiMessage_default, {
18
- document: e,
19
- isLastItem: p
21
+ ["ai-message", ({ document: t, isLastItem: v }) => /* @__PURE__ */ jsx(AiMessage_default, {
22
+ document: t,
23
+ isLastItem: v
20
24
  })],
21
- ["claude-message", ({ document: e, isLastItem: p }) => /* @__PURE__ */ jsx(ClaudeMessage_default, {
22
- document: e,
23
- isLastItem: p
25
+ ["claude-message", ({ document: t, isLastItem: v }) => /* @__PURE__ */ jsx(ClaudeMessage_default, {
26
+ document: t,
27
+ isLastItem: v
24
28
  })],
25
- ["debug", ({ document: e }) => /* @__PURE__ */ jsx("div", {
29
+ ["debug", ({ document: t }) => /* @__PURE__ */ jsx("div", {
26
30
  className: "mb-4 flex",
27
- children: /* @__PURE__ */ jsx(DocumentDebugRenderer_default, { document: e })
31
+ children: /* @__PURE__ */ jsx(DocumentDebugRenderer_default, { document: t })
28
32
  })],
29
- ["object-form", ({ pipeline: p, workflow: m, document: h, isActive: g }) => /* @__PURE__ */ jsx(CompletionMessagePaper_default, {
33
+ ["form", ({ parentWorkflow: v, workflow: y, document: b, isActive: x }) => /* @__PURE__ */ jsx(CompletionMessagePaper_default, {
30
34
  role: "document",
31
35
  fullWidth: !0,
32
- timestamp: new Date(h.createdAt),
36
+ timestamp: new Date(b.createdAt),
33
37
  children: /* @__PURE__ */ jsx(DocumentFormRenderer_default, {
34
- pipeline: p,
35
- workflow: m,
36
- document: h,
37
- enabled: g,
38
- viewOnly: !g
38
+ parentWorkflow: v,
39
+ workflow: y,
40
+ document: b,
41
+ enabled: x,
42
+ viewOnly: !x
39
43
  })
40
44
  })],
41
- ["message", ({ document: e }) => /* @__PURE__ */ jsx(DocumentMessageRenderer_default, { document: e })],
42
- ["error", ({ document: e }) => /* @__PURE__ */ jsx(ErrorMessageRenderer_default, { document: e })],
43
- ["plain", ({ document: e }) => /* @__PURE__ */ jsx(PlainMessageRenderer_default, { document: e })],
44
- ["markdown", ({ document: e }) => /* @__PURE__ */ jsx(MarkdownMessageRenderer_default, { document: e })],
45
- ["link", ({ document: e }) => /* @__PURE__ */ jsx(LinkMessageRenderer_default, { document: e })],
46
- ["oauth-prompt", ({ pipeline: e, workflow: m, document: h, isActive: g }) => /* @__PURE__ */ jsx(OAuthPromptRenderer_default, {
47
- pipeline: e,
48
- workflow: m,
49
- document: h,
50
- isActive: g
45
+ ["message", ({ document: t }) => /* @__PURE__ */ jsx(DocumentMessageRenderer_default, { document: t })],
46
+ ["error", ({ document: t }) => /* @__PURE__ */ jsx(ErrorMessageRenderer_default, { document: t })],
47
+ ["plain", ({ document: t }) => /* @__PURE__ */ jsx(PlainMessageRenderer_default, { document: t })],
48
+ ["markdown", ({ document: t }) => /* @__PURE__ */ jsx(MarkdownMessageRenderer_default, { document: t })],
49
+ ["link", ({ document: t }) => /* @__PURE__ */ jsx(LinkMessageRenderer_default, { document: t })],
50
+ ["oauth-prompt", ({ parentWorkflow: t, workflow: y, document: b, isActive: x }) => /* @__PURE__ */ jsx(OAuthPromptRenderer_default, {
51
+ parentWorkflow: t,
52
+ workflow: y,
53
+ document: b,
54
+ isActive: x
55
+ })],
56
+ ["text-prompt", ({ parentWorkflow: t, workflow: v, document: y, isActive: b }) => /* @__PURE__ */ jsx(TextPromptRenderer_default, {
57
+ parentWorkflow: t,
58
+ workflow: v,
59
+ document: y,
60
+ isActive: b
61
+ })],
62
+ ["choices", ({ parentWorkflow: t, workflow: v, document: y, isActive: x }) => /* @__PURE__ */ jsx(ChoicesRenderer_default, {
63
+ parentWorkflow: t,
64
+ workflow: v,
65
+ document: y,
66
+ isActive: x
67
+ })],
68
+ ["confirm-prompt", ({ parentWorkflow: t, workflow: v, document: y, isActive: b }) => /* @__PURE__ */ jsx(ConfirmPromptRenderer_default, {
69
+ parentWorkflow: t,
70
+ workflow: v,
71
+ document: y,
72
+ isActive: b
73
+ })],
74
+ ["secret-input", ({ parentWorkflow: t, workflow: v, document: y, isActive: b }) => /* @__PURE__ */ jsx(SecretInputRenderer_default, {
75
+ parentWorkflow: t,
76
+ workflow: v,
77
+ document: y,
78
+ isActive: b
51
79
  })]
52
- ]), DocumentRenderer_default = (e) => {
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], _;
80
+ ]);
81
+ function resolveDocumentWidget(t) {
82
+ let v = t;
83
+ return v?.widgets?.[0]?.widget ? v.widgets[0].widget : v?.form?.widget ? v.form.widget : "form";
84
+ }
85
+ var DocumentRenderer_default = (t) => {
86
+ let v = c(5), y = t.document, b;
87
+ if (v[0] !== y.ui) {
88
+ let t = resolveDocumentWidget(y.ui);
89
+ b = rendererRegistry.get(t), v[0] = y.ui, v[1] = b;
90
+ } else b = v[1];
91
+ let x = b, S;
92
+ return v[2] !== x || v[3] !== t ? (S = /* @__PURE__ */ jsx("div", { children: x ? /* @__PURE__ */ jsx(x, { ...t }) : /* @__PURE__ */ jsx(Fragment$1, { children: "unknown document type" }) }), v[2] = x, v[3] = t, v[4] = S) : S = v[4], S;
57
93
  };
58
94
  export { DocumentRenderer_default as default };
@@ -5,11 +5,11 @@ import React from "react";
5
5
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { omit } from "lodash";
7
7
  var DocumentItem_default = (s) => {
8
- let l = c(13), { document: u, workflow: d, pipeline: f, isActive: p, isLastItem: m, settings: h } = s, g = u.meta, _;
8
+ let l = c(13), { document: u, workflow: d, parentWorkflow: f, isActive: p, isLastItem: m, settings: h } = s, g = u.meta, _;
9
9
  l[0] !== u || l[1] !== p || l[2] !== m || l[3] !== f || l[4] !== d ? (_ = /* @__PURE__ */ jsx(DocumentRenderer_default, {
10
10
  document: u,
11
11
  workflow: d,
12
- pipeline: f,
12
+ parentWorkflow: f,
13
13
  isActive: p,
14
14
  isLastItem: m
15
15
  }), l[0] = u, l[1] = p, l[2] = m, l[3] = f, l[4] = d, l[5] = _) : _ = l[5];
@@ -5,39 +5,42 @@ import React, { useEffect } from "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { useParams } from "react-router-dom";
7
7
  var import_enums = require_enums(), DocumentList_default = (e) => {
8
- let o = c(23), { pipeline: l, workflow: u, documents: d, scrollTo: f, settings: p } = e, { workflowId: m, clickId: h } = useParams(), g;
9
- o[0] !== m || o[1] !== f || o[2] !== u.id ? (g = () => {
8
+ let o = c(23), { workflow: l, childWorkflow: u, documents: d, scrollTo: f, settings: p } = e, { workflowId: m, clickId: h } = useParams(), g;
9
+ o[0] !== u.id || o[1] !== m || o[2] !== f ? (g = () => {
10
10
  m === u.id && f(u.id);
11
- }, o[0] = m, o[1] = f, o[2] = u.id, o[3] = g) : g = o[3];
11
+ }, o[0] = u.id, o[1] = m, o[2] = f, o[3] = g) : g = o[3];
12
12
  let _;
13
- o[4] !== h || o[5] !== m || o[6] !== f || o[7] !== u.id ? (_ = [
13
+ o[4] !== u.id || o[5] !== h || o[6] !== m || o[7] !== f ? (_ = [
14
14
  u.id,
15
15
  m,
16
16
  h,
17
17
  f
18
- ], o[4] = h, o[5] = m, o[6] = f, o[7] = u.id, o[8] = _) : _ = o[8], useEffect(g, _);
18
+ ], o[4] = u.id, o[5] = h, o[6] = m, o[7] = f, o[8] = _) : _ = o[8], useEffect(g, _);
19
19
  let v = u.status === import_enums.WorkflowState.Waiting, y;
20
- if (o[9] !== d || o[10] !== v || o[11] !== l || o[12] !== p || o[13] !== u) {
20
+ if (o[9] !== u || o[10] !== d || o[11] !== v || o[12] !== p || o[13] !== l) {
21
21
  let e;
22
- o[15] !== d.length || o[16] !== v || o[17] !== l || o[18] !== p || o[19] !== u ? (e = (e, a) => {
22
+ o[15] !== u || o[16] !== d.length || o[17] !== v || o[18] !== p || o[19] !== l ? (e = (e, a) => {
23
23
  let o = e, s = e.place === u.place || !!o.meta?.enableAtPlaces?.includes(u.place);
24
24
  return console.log({
25
25
  isDocumentActive: s,
26
- enableAtPlaces: o.meta?.enableAtPlaces,
27
- place: u.place
26
+ isWorkflowActive: v,
27
+ status: u.status,
28
+ place: u.place,
29
+ documentPlace: e.place,
30
+ availableTransitions: u.availableTransitions
28
31
  }), /* @__PURE__ */ jsx(DocumentItem_default, {
29
32
  document: e,
30
33
  workflow: u,
31
- pipeline: l,
34
+ parentWorkflow: l,
32
35
  isActive: v && s,
33
36
  isLastItem: a === d.length - 1,
34
37
  settings: p
35
38
  }, e.id);
36
- }, o[15] = d.length, o[16] = v, o[17] = l, o[18] = p, o[19] = u, o[20] = e) : e = o[20], y = d.map(e), o[9] = d, o[10] = v, o[11] = l, o[12] = p, o[13] = u, o[14] = y;
39
+ }, o[15] = u, o[16] = d.length, o[17] = v, o[18] = p, o[19] = l, o[20] = e) : e = o[20], y = d.map(e), o[9] = u, o[10] = d, o[11] = v, o[12] = p, o[13] = l, o[14] = y;
37
40
  } else y = o[14];
38
41
  let b;
39
42
  return o[21] === y ? b = o[22] : (b = /* @__PURE__ */ jsx("div", {
40
- className: "flex flex-col gap-6",
43
+ className: "flex flex-col gap-3",
41
44
  children: y
42
45
  }), o[21] = y, o[22] = b), b;
43
46
  };
@@ -178,17 +178,17 @@ var formatDate = (e) => {
178
178
  let M;
179
179
  n[44] === Symbol.for("react.memo_cache_sentinel") ? (M = /* @__PURE__ */ jsx("span", {
180
180
  className: "font-medium",
181
- children: "Pipeline ID:"
181
+ children: "Workflow ID:"
182
182
  }), n[44] = M) : M = n[44];
183
183
  let N;
184
- n[45] === r.pipelineId ? N = n[46] : (N = /* @__PURE__ */ jsxs("div", {
184
+ n[45] === r.workflowId ? N = n[46] : (N = /* @__PURE__ */ jsxs("div", {
185
185
  className: "text-sm",
186
186
  children: [
187
187
  M,
188
188
  " ",
189
- r.pipelineId
189
+ r.workflowId
190
190
  ]
191
- }), n[45] = r.pipelineId, n[46] = N);
191
+ }), n[45] = r.workflowId, n[46] = N);
192
192
  let P;
193
193
  n[47] === Symbol.for("react.memo_cache_sentinel") ? (P = /* @__PURE__ */ jsx("span", {
194
194
  className: "font-medium",
@@ -1,7 +1,7 @@
1
1
  import { Message, MessageAction, MessageActions, MessageContent, MessageResponse } from "../../../components/ai-elements/message.js";
2
2
  import { Reasoning, ReasoningContent, ReasoningTrigger } from "../../../components/ai-elements/reasoning.js";
3
3
  import { Source, Sources, SourcesContent, SourcesTrigger } from "../../../components/ai-elements/sources.js";
4
- import { Tool, ToolContent, ToolHeader, ToolInput, ToolOutput } from "../../../components/ai-elements/tool.js";
4
+ import { Tool, ToolContent, ToolHeader, ToolInput, ToolOutput } from "../../../components/loopstack-elements/tool.js";
5
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";