@loopstack/loopstack-studio 0.35.1 → 0.36.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 (34) hide show
  1. package/dist/features/documents/DocumentRenderer.js +7 -7
  2. package/dist/features/documents/renderers/DocumentFormRenderer.js +1 -1
  3. package/dist/features/oauth/OAuthCallbackPage.js +2 -0
  4. package/dist/features/run-view/RunView.js +153 -0
  5. package/dist/features/run-view/Transcript.js +127 -0
  6. package/dist/features/run-view/prompts/FormPrompt.js +129 -0
  7. package/dist/features/run-view/prompts/OAuthPrompt.js +94 -0
  8. package/dist/features/run-view/prompts/SandboxRunButton.js +35 -0
  9. package/dist/features/run-view/prompts/SecretPrompt.js +69 -0
  10. package/dist/features/run-view/prompts/SimplePrompts.js +196 -0
  11. package/dist/features/run-view/prompts/cards.js +90 -0
  12. package/dist/features/run-view/prompts/registry.js +16 -0
  13. package/dist/features/run-view/transcript.js +24 -0
  14. package/dist/features/run-view/useRunPrompts.js +111 -0
  15. package/dist/features/run-view/useRunTree.js +59 -0
  16. package/dist/features/run-view/useTreeLlmStreams.js +91 -0
  17. package/dist/features/secrets/components/WorkbenchSecretsPanel.js +1 -1
  18. package/dist/features/secrets/renderers/SecretInputRenderer.js +1 -1
  19. package/dist/features/workbench/WorkflowList.js +111 -52
  20. package/dist/features/workbench/components/NewRunDialog.js +1 -1
  21. package/dist/features/workbench/index.js +1 -1
  22. package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +4 -1
  23. package/dist/features/workspaces/components/WorkspaceHomePage.js +1 -1
  24. package/dist/index.d.ts +2 -0
  25. package/dist/node_modules/dompurify/dist/purify.es.js +351 -228
  26. package/dist/packages/client/dist/resources/workflows.js +2 -1
  27. package/dist/packages/client/dist/stream/invalidations.js +9 -2
  28. package/dist/packages/client/dist/stream/stream.js +73 -28
  29. package/dist/packages/contracts/dist/park-view/index.js +2 -0
  30. package/dist/packages/contracts/dist/park-view/park-view.rules.js +102 -0
  31. package/dist/packages/contracts/dist/park-view/park-view.types.js +15 -0
  32. package/dist/pages/PreviewWorkbenchPage.js +23 -23
  33. package/dist/providers/StudioPreferencesProvider.js +2 -1
  34. package/package.json +4 -4
@@ -2,19 +2,19 @@ import { useDocumentConfigs } from "../../hooks/useConfig.js";
2
2
  import CompletionMessagePaper_default from "../../components/messages/CompletionMessagePaper.js";
3
3
  import { useFeatureRegistry } from "../feature-registry/FeatureRegistryProvider.js";
4
4
  import "../feature-registry/index.js";
5
- import OAuthPromptRenderer_default from "../oauth/OAuthPromptRenderer.js";
6
- import "../oauth/index.js";
7
5
  import AiMessage_default from "./renderers/AiMessage.js";
8
- import ChoicesRenderer_default from "./renderers/ChoicesRenderer.js";
9
- import ConfirmPromptRenderer_default from "./renderers/ConfirmPromptRenderer.js";
10
6
  import DocumentDebugRenderer_default from "./renderers/DocumentDebugRenderer.js";
11
7
  import DocumentFormRenderer_default from "./renderers/DocumentFormRenderer.js";
12
8
  import DocumentMessageRenderer_default from "./renderers/DocumentMessageRenderer.js";
13
9
  import ErrorMessageRenderer_default from "./renderers/ErrorMessageRenderer.js";
14
- import LinkMessageRenderer_default from "./renderers/LinkMessageRenderer.js";
15
10
  import LlmMessage_default from "./renderers/LlmMessage.js";
16
11
  import MarkdownMessageRenderer_default from "./renderers/MarkdownMessageRenderer.js";
17
12
  import PlainMessageRenderer_default from "./renderers/PlainMessageRenderer.js";
13
+ import OAuthPromptRenderer_default from "../oauth/OAuthPromptRenderer.js";
14
+ import "../oauth/index.js";
15
+ import ChoicesRenderer_default from "./renderers/ChoicesRenderer.js";
16
+ import ConfirmPromptRenderer_default from "./renderers/ConfirmPromptRenderer.js";
17
+ import LinkMessageRenderer_default from "./renderers/LinkMessageRenderer.js";
18
18
  import TextPromptRenderer_default from "./renderers/TextPromptRenderer.js";
19
19
  import { c } from "react/compiler-runtime";
20
20
  import React, { useMemo } from "react";
@@ -52,11 +52,11 @@ var coreRendererRegistry = new Map([
52
52
  workflow: e,
53
53
  document: g
54
54
  })],
55
- ["oauth-prompt", ({ parentWorkflow: e, workflow: g, document: _, isActive: y }) => /* @__PURE__ */ jsx(OAuthPromptRenderer_default, {
55
+ ["oauth-prompt", ({ parentWorkflow: e, workflow: g, document: _, isActive: v }) => /* @__PURE__ */ jsx(OAuthPromptRenderer_default, {
56
56
  parentWorkflow: e,
57
57
  workflow: g,
58
58
  document: _,
59
- isActive: y
59
+ isActive: v
60
60
  })],
61
61
  ["text-prompt", ({ parentWorkflow: e, workflow: g, document: _, isActive: v }) => /* @__PURE__ */ jsx(TextPromptRenderer_default, {
62
62
  parentWorkflow: e,
@@ -1,8 +1,8 @@
1
1
  import { useRunWorkflow } from "../../../packages/react/dist/hooks/mutations.js";
2
2
  import { useDocumentConfigs } from "../../../hooks/useConfig.js";
3
3
  import { Button } from "../../../components/ui/button.js";
4
- import "../../../hooks/useProcessor.js";
5
4
  import Form_default from "../../../components/dynamic-form/Form.js";
5
+ import "../../../hooks/useProcessor.js";
6
6
  import { c } from "react/compiler-runtime";
7
7
  import React, { useEffect } from "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,2 +1,4 @@
1
+ import "../../packages/client/dist/index.js";
2
+ import "../../config.js";
1
3
  import React, { useEffect, useState } from "react";
2
4
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -0,0 +1,153 @@
1
+ import { useRunWorkflow } from "../../packages/react/dist/hooks/mutations.js";
2
+ import "../../packages/react/dist/index.js";
3
+ import { useDocumentConfigs } from "../../hooks/useConfig.js";
4
+ import { BareWaitCard, FailedRunCard, NotSupportedCard } from "./prompts/cards.js";
5
+ import { Transcript } from "./Transcript.js";
6
+ import { SandboxRunButton } from "./prompts/SandboxRunButton.js";
7
+ import { promptRegistry } from "./prompts/registry.js";
8
+ import { composeTranscript } from "./transcript.js";
9
+ import { useRunPrompts } from "./useRunPrompts.js";
10
+ import { useRunTree } from "./useRunTree.js";
11
+ import { useStreamingNodes } from "./useTreeLlmStreams.js";
12
+ import { c } from "react/compiler-runtime";
13
+ import { useMemo } from "react";
14
+ import { jsx, jsxs } from "react/jsx-runtime";
15
+ function resolveWidgetName(t) {
16
+ let m = t;
17
+ return m?.widgets?.[0]?.widget ?? m?.form?.widget;
18
+ }
19
+ function RunView(g) {
20
+ let _ = c(68), { workflowId: v, settings: y } = g, { nodes: b, isLoading: x } = useRunTree(v), S = useRunPrompts(b), C = useDocumentConfigs(), w = useRunWorkflow(), T = useStreamingNodes(b);
21
+ y?.showFullMessageHistory;
22
+ let E;
23
+ if (_[0] !== C || _[1] !== y?.showFullMessageHistory || _[2] !== T) {
24
+ let t;
25
+ _[4] === y?.showFullMessageHistory ? t = _[5] : (t = (t) => ({
26
+ workflowId: t.workflowId,
27
+ depth: t.depth,
28
+ documents: y?.showFullMessageHistory ? t.documents : t.documents.filter(_temp)
29
+ }), _[4] = y?.showFullMessageHistory, _[5] = t);
30
+ let m = T.map(t), h;
31
+ _[6] === C ? h = _[7] : (h = (t) => resolveWidgetName(C.get(t)?.ui), _[6] = C, _[7] = h), E = composeTranscript(m, h), _[0] = C, _[1] = y?.showFullMessageHistory, _[2] = T, _[3] = E;
32
+ } else E = _[3];
33
+ let D = E, O;
34
+ _[8] === b ? O = _[9] : (O = new Map(b.map(_temp2)), _[8] = b, _[9] = O);
35
+ let k = O, A;
36
+ bb0: {
37
+ let t = S.picked?.candidate.document?.content;
38
+ if (!t) {
39
+ A = D;
40
+ break bb0;
41
+ }
42
+ let m;
43
+ if (_[10] !== D || _[11] !== t) {
44
+ let h;
45
+ _[13] === t ? h = _[14] : (h = (m) => m.document.content !== t, _[13] = t, _[14] = h), m = D.filter(h), _[10] = D, _[11] = t, _[12] = m;
46
+ } else m = _[12];
47
+ A = m;
48
+ }
49
+ let j = A, M = S.picked, N;
50
+ _[15] === M ? N = _[16] : (N = M?.view.widget ? promptRegistry.get(M.view.widget) : void 0, _[15] = M, _[16] = N);
51
+ let P = N, F = S.idlePrompt, I;
52
+ _[17] === F ? I = _[18] : (I = F?.view.widget ? promptRegistry.get(F.view.widget) : void 0, _[17] = F, _[18] = I);
53
+ let L = I, R;
54
+ _[19] !== b || _[20] !== M || _[21] !== S.blocked ? (R = !M && !S.blocked ? b.find(_temp3) : void 0, _[19] = b, _[20] = M, _[21] = S.blocked, _[22] = R) : R = _[22];
55
+ let z = R, B;
56
+ _[23] !== M || _[24] !== w ? (B = (t, m) => {
57
+ if (!M) return;
58
+ let h = m ?? M.view.defaultTransition;
59
+ h && w.mutate({
60
+ workflowId: M.view.workflowId,
61
+ payload: { transition: {
62
+ id: h,
63
+ workflowId: M.view.workflowId,
64
+ payload: t
65
+ } }
66
+ });
67
+ }, _[23] = M, _[24] = w, _[25] = B) : B = _[25];
68
+ let V = B, H;
69
+ _[26] === x ? H = _[27] : (H = x && /* @__PURE__ */ jsx("p", {
70
+ className: "text-muted-foreground text-sm",
71
+ children: "Loading run…"
72
+ }), _[26] = x, _[27] = H);
73
+ let U = b[0]?.workflow, W = y?.enableDebugMode, G;
74
+ _[28] !== W || _[29] !== U || _[30] !== j || _[31] !== k ? (G = /* @__PURE__ */ jsx(Transcript, {
75
+ entries: j,
76
+ workflows: k,
77
+ rootWorkflow: U,
78
+ debug: W
79
+ }), _[28] = W, _[29] = U, _[30] = j, _[31] = k, _[32] = G) : G = _[32];
80
+ let K;
81
+ _[33] === S.sandboxSlots ? K = _[34] : (K = S.sandboxSlots.length > 0 && /* @__PURE__ */ jsx("div", {
82
+ className: "flex justify-end gap-2",
83
+ children: S.sandboxSlots.map(_temp4)
84
+ }), _[33] = S.sandboxSlots, _[34] = K);
85
+ let q;
86
+ _[35] !== P || _[36] !== b[0]?.workflow || _[37] !== M || _[38] !== w || _[39] !== V ? (q = M && P && /* @__PURE__ */ jsx("div", {
87
+ className: "bg-background rounded-lg border p-4 shadow-sm",
88
+ children: /* @__PURE__ */ jsx(P, {
89
+ view: M.view,
90
+ submit: V,
91
+ isSubmitting: w.isPending,
92
+ workspaceId: b[0]?.workflow.workspaceId
93
+ })
94
+ }), _[35] = P, _[36] = b[0]?.workflow, _[37] = M, _[38] = w, _[39] = V, _[40] = q) : q = _[40];
95
+ let J;
96
+ _[41] !== L || _[42] !== F || _[43] !== M ? (J = !M && F && L && /* @__PURE__ */ jsx("div", {
97
+ className: "bg-background rounded-lg border p-4 opacity-70 shadow-sm",
98
+ children: /* @__PURE__ */ jsx(L, {
99
+ view: F.view,
100
+ submit: _temp5,
101
+ isSubmitting: !0
102
+ })
103
+ }), _[41] = L, _[42] = F, _[43] = M, _[44] = J) : J = _[44];
104
+ let Y;
105
+ _[45] !== M || _[46] !== S.blocked ? (Y = !M && S.blocked && /* @__PURE__ */ jsx(NotSupportedCard, { view: S.blocked.view }), _[45] = M, _[46] = S.blocked, _[47] = Y) : Y = _[47];
106
+ let X;
107
+ _[48] !== z || _[49] !== w ? (X = z && /* @__PURE__ */ jsx(FailedRunCard, {
108
+ workflowName: z.workflow.title ?? z.workflow.workflowName,
109
+ errorMessage: z.workflow.errorMessage,
110
+ onRetry: () => w.mutate({ workflowId: z.workflowId }),
111
+ isRetrying: w.isPending
112
+ }), _[48] = z, _[49] = w, _[50] = X) : X = _[50];
113
+ let Z;
114
+ _[51] !== z || _[52] !== F || _[53] !== M || _[54] !== S.blocked || _[55] !== S.fallback ? (Z = !M && !F && !S.blocked && !z && S.fallback && /* @__PURE__ */ jsx(BareWaitCard, { view: S.fallback.view }), _[51] = z, _[52] = F, _[53] = M, _[54] = S.blocked, _[55] = S.fallback, _[56] = Z) : Z = _[56];
115
+ let Q;
116
+ _[57] !== K || _[58] !== q || _[59] !== J || _[60] !== Y || _[61] !== X || _[62] !== Z ? (Q = /* @__PURE__ */ jsxs("div", {
117
+ className: "mt-6 space-y-2",
118
+ children: [
119
+ K,
120
+ q,
121
+ J,
122
+ Y,
123
+ X,
124
+ Z
125
+ ]
126
+ }), _[57] = K, _[58] = q, _[59] = J, _[60] = Y, _[61] = X, _[62] = Z, _[63] = Q) : Q = _[63];
127
+ let $;
128
+ return _[64] !== G || _[65] !== Q || _[66] !== H ? ($ = /* @__PURE__ */ jsxs("div", {
129
+ className: "w-full max-w-3xl",
130
+ children: [
131
+ H,
132
+ G,
133
+ Q
134
+ ]
135
+ }), _[64] = G, _[65] = Q, _[66] = H, _[67] = $) : $ = _[67], $;
136
+ }
137
+ function _temp5() {}
138
+ function _temp4(t) {
139
+ return /* @__PURE__ */ jsx(SandboxRunButton, {
140
+ slotId: t.slotId,
141
+ label: t.label
142
+ }, t.slotId ?? "default");
143
+ }
144
+ function _temp3(t) {
145
+ return t.workflow.hasError && t.workflow.status === "failed";
146
+ }
147
+ function _temp2(t) {
148
+ return [t.workflowId, t.workflow];
149
+ }
150
+ function _temp(t) {
151
+ return !t.tags?.includes("internal");
152
+ }
153
+ export { RunView };
@@ -0,0 +1,127 @@
1
+ import { useFeatureRegistry } from "../feature-registry/FeatureRegistryProvider.js";
2
+ import "../feature-registry/index.js";
3
+ import AiMessage_default from "../documents/renderers/AiMessage.js";
4
+ import DocumentDebugRenderer_default from "../documents/renderers/DocumentDebugRenderer.js";
5
+ import DocumentFormRenderer_default from "../documents/renderers/DocumentFormRenderer.js";
6
+ import DocumentMessageRenderer_default from "../documents/renderers/DocumentMessageRenderer.js";
7
+ import ErrorMessageRenderer_default from "../documents/renderers/ErrorMessageRenderer.js";
8
+ import LlmMessage_default from "../documents/renderers/LlmMessage.js";
9
+ import MarkdownMessageRenderer_default from "../documents/renderers/MarkdownMessageRenderer.js";
10
+ import PlainMessageRenderer_default from "../documents/renderers/PlainMessageRenderer.js";
11
+ import { InertPromptEntry } from "./prompts/cards.js";
12
+ import { c } from "react/compiler-runtime";
13
+ import { useMemo } from "react";
14
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
15
+ var displayRenderers = new Map([
16
+ ["ai-message", (e, a) => /* @__PURE__ */ jsx(AiMessage_default, {
17
+ document: e,
18
+ isLastItem: a
19
+ })],
20
+ ["llm-message", (e, i) => /* @__PURE__ */ jsx(LlmMessage_default, {
21
+ document: e,
22
+ isLastItem: i
23
+ })],
24
+ ["message", (e) => /* @__PURE__ */ jsx(DocumentMessageRenderer_default, { document: e })],
25
+ ["error", (e) => /* @__PURE__ */ jsx(ErrorMessageRenderer_default, { document: e })],
26
+ ["plain", (e) => /* @__PURE__ */ jsx(PlainMessageRenderer_default, { document: e })],
27
+ ["markdown", (e) => /* @__PURE__ */ jsx(MarkdownMessageRenderer_default, { document: e })],
28
+ ["debug", (e) => /* @__PURE__ */ jsx(DocumentDebugRenderer_default, { document: e })]
29
+ ]);
30
+ function TranscriptDocument(e) {
31
+ let i = c(26), { entry: a, isLastItem: s, featureRenderers: l, workflows: u, rootWorkflow: d } = e, f;
32
+ if (i[0] !== a.document || i[1] !== a.widget || i[2] !== s) {
33
+ f = Symbol.for("react.early_return_sentinel");
34
+ bb0: {
35
+ let e = a.widget ? displayRenderers.get(a.widget) : void 0;
36
+ if (e) {
37
+ f = /* @__PURE__ */ jsx(Fragment$1, { children: e(a.document, s) });
38
+ break bb0;
39
+ }
40
+ }
41
+ i[0] = a.document, i[1] = a.widget, i[2] = s, i[3] = f;
42
+ } else f = i[3];
43
+ if (f !== Symbol.for("react.early_return_sentinel")) return f;
44
+ let m;
45
+ i[4] !== a.document.workflowId || i[5] !== u ? (m = u.get(a.document.workflowId), i[4] = a.document.workflowId, i[5] = u, i[6] = m) : m = i[6];
46
+ let g = m;
47
+ if (a.widget === "form" && g) {
48
+ let e = d ?? g, s = a.document, l;
49
+ return i[7] !== e || i[8] !== s || i[9] !== g ? (l = /* @__PURE__ */ jsx("div", {
50
+ className: "rounded-md border p-3",
51
+ children: /* @__PURE__ */ jsx(DocumentFormRenderer_default, {
52
+ parentWorkflow: e,
53
+ workflow: g,
54
+ document: s,
55
+ enabled: !1,
56
+ viewOnly: !0
57
+ })
58
+ }), i[7] = e, i[8] = s, i[9] = g, i[10] = l) : l = i[10], l;
59
+ }
60
+ let _;
61
+ i[11] !== a.widget || i[12] !== l ? (_ = a.widget ? l.get(a.widget) : void 0, i[11] = a.widget, i[12] = l, i[13] = _) : _ = i[13];
62
+ let v = _;
63
+ if (v && g) {
64
+ let e = d ?? g, o = a.document, l;
65
+ return i[14] !== v || i[15] !== s || i[16] !== e || i[17] !== o || i[18] !== g ? (l = /* @__PURE__ */ jsx(v, {
66
+ parentWorkflow: e,
67
+ workflow: g,
68
+ document: o,
69
+ isActive: !1,
70
+ isLastItem: s
71
+ }), i[14] = v, i[15] = s, i[16] = e, i[17] = o, i[18] = g, i[19] = l) : l = i[19], l;
72
+ }
73
+ if (a.widget) {
74
+ let e;
75
+ return i[20] === a.document ? e = i[21] : (e = /* @__PURE__ */ jsx(InertPromptEntry, { document: a.document }), i[20] = a.document, i[21] = e), e;
76
+ }
77
+ let y;
78
+ i[22] === a.document.content ? y = i[23] : (y = JSON.stringify(a.document.content, null, 2), i[22] = a.document.content, i[23] = y);
79
+ let b;
80
+ return i[24] === y ? b = i[25] : (b = /* @__PURE__ */ jsx("pre", {
81
+ className: "bg-muted/50 overflow-x-auto rounded-md p-3 font-mono text-xs",
82
+ children: y
83
+ }), i[24] = y, i[25] = b), b;
84
+ }
85
+ function DebugMeta(e) {
86
+ let i = c(8), { entry: a } = e, o = a.widget ?? "no widget", s = `place: ${a.document.place ?? "—"}`, l = `index: ${a.document.index}`, u;
87
+ i[0] !== a.document.documentName || i[1] !== a.document.isInvalidated || i[2] !== o || i[3] !== s || i[4] !== l ? (u = [
88
+ a.document.documentName,
89
+ o,
90
+ s,
91
+ l
92
+ ], a.document.isInvalidated && u.push("invalidated"), i[0] = a.document.documentName, i[1] = a.document.isInvalidated, i[2] = o, i[3] = s, i[4] = l, i[5] = u) : u = i[5];
93
+ let d = u.join(" · "), f;
94
+ return i[6] === d ? f = i[7] : (f = /* @__PURE__ */ jsx("p", {
95
+ className: "text-muted-foreground font-mono text-[10px]",
96
+ children: d
97
+ }), i[6] = d, i[7] = f), f;
98
+ }
99
+ function Transcript(i) {
100
+ let a = c(16), { entries: o, workflows: s, rootWorkflow: l, debug: u } = i, d = useFeatureRegistry(), f;
101
+ if (a[0] !== d) {
102
+ f = /* @__PURE__ */ new Map();
103
+ for (let e of d) for (let [i, a] of Object.entries(e.documentRenderers ?? {})) f.set(i, a);
104
+ a[0] = d, a[1] = f;
105
+ } else f = a[1];
106
+ let p = f, m;
107
+ if (a[2] !== u || a[3] !== o || a[4] !== p || a[5] !== l || a[6] !== s) {
108
+ let e;
109
+ a[8] !== u || a[9] !== o.length || a[10] !== p || a[11] !== l || a[12] !== s ? (e = (e, i) => /* @__PURE__ */ jsxs("div", {
110
+ style: e.depth > 0 ? { marginLeft: e.depth * 20 } : void 0,
111
+ className: e.depth > 0 ? "border-muted border-l-2 pl-3" : void 0,
112
+ children: [u && /* @__PURE__ */ jsx(DebugMeta, { entry: e }), /* @__PURE__ */ jsx(TranscriptDocument, {
113
+ entry: e,
114
+ isLastItem: i === o.length - 1,
115
+ featureRenderers: p,
116
+ workflows: s,
117
+ rootWorkflow: l
118
+ })]
119
+ }, e.document.id), a[8] = u, a[9] = o.length, a[10] = p, a[11] = l, a[12] = s, a[13] = e) : e = a[13], m = o.map(e), a[2] = u, a[3] = o, a[4] = p, a[5] = l, a[6] = s, a[7] = m;
120
+ } else m = a[7];
121
+ let h;
122
+ return a[14] === m ? h = a[15] : (h = /* @__PURE__ */ jsx("div", {
123
+ className: "space-y-3",
124
+ children: m
125
+ }), a[14] = m, a[15] = h), h;
126
+ }
127
+ export { Transcript };
@@ -0,0 +1,129 @@
1
+ import { Button } from "../../../components/ui/button.js";
2
+ import { Checkbox } from "../../../components/ui/checkbox.js";
3
+ import { Input } from "../../../components/ui/input.js";
4
+ import { Label } from "../../../components/ui/label.js";
5
+ import { c } from "react/compiler-runtime";
6
+ import { useMemo, useState } from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ function FormPrompt(l) {
9
+ let d = c(47), { view: f, submit: p, isSubmitting: m } = l, h = f.schema, g;
10
+ d[0] === h?.properties ? g = d[1] : (g = h?.properties ?? {}, d[0] = h?.properties, d[1] = g);
11
+ let _ = g, v;
12
+ d[2] === f.options?.properties ? v = d[3] : (v = f.options?.properties ?? {}, d[2] = f.options?.properties, d[3] = v);
13
+ let y = v, b;
14
+ d[4] === f.content ? b = d[5] : (b = f.content ?? {}, d[4] = f.content, d[5] = b);
15
+ let x = b, S;
16
+ d[6] !== x || d[7] !== _ ? (S = () => {
17
+ let e = { ...x };
18
+ for (let [a, o] of Object.entries(_)) e[a] === void 0 && o.default !== void 0 && (e[a] = o.default);
19
+ return e;
20
+ }, d[6] = x, d[7] = _, d[8] = S) : S = d[8];
21
+ let [C, w] = useState(S), T, E, D, O, k, A;
22
+ if (d[9] !== x || d[10] !== m || d[11] !== _ || d[12] !== p || d[13] !== y || d[14] !== C || d[15] !== f.options?.actions || d[16] !== f.transitions) {
23
+ T = Symbol.for("react.early_return_sentinel");
24
+ bb0: {
25
+ let s;
26
+ d[23] === f.transitions ? s = d[24] : (s = (e) => e.transition && f.transitions.includes(e.transition), d[23] = f.transitions, d[24] = s);
27
+ let l = (f.options?.actions ?? []).filter(s);
28
+ if (l.length === 0) {
29
+ T = null;
30
+ break bb0;
31
+ }
32
+ let u;
33
+ d[25] !== _ || d[26] !== y ? (u = (e) => (y[e]?.readonly ?? _[e]?.readonly) === !0, d[25] = _, d[26] = y, d[27] = u) : u = d[27];
34
+ let h = u, g;
35
+ d[28] === Symbol.for("react.memo_cache_sentinel") ? (g = (e, a) => w((o) => ({
36
+ ...o,
37
+ [e]: a
38
+ })), d[28] = g) : g = d[28];
39
+ let v = g, b = typeof x.markdown == "string" ? x.markdown : void 0;
40
+ if (d[29] !== h || d[30] !== m || d[31] !== b || d[32] !== _ || d[33] !== C) {
41
+ let e = Object.keys(_).filter(_temp);
42
+ O = "space-y-3", d[37] === b ? k = d[38] : (k = b && /* @__PURE__ */ jsx("p", {
43
+ className: "text-sm whitespace-pre-wrap",
44
+ children: b
45
+ }), d[37] = b, d[38] = k), A = e.map((e) => {
46
+ let s = _[e], l = C[e], u = m || h(e), d = s.title ?? e;
47
+ return s.type === "boolean" ? /* @__PURE__ */ jsxs("div", {
48
+ className: "flex items-center gap-2",
49
+ children: [/* @__PURE__ */ jsx(Checkbox, {
50
+ id: `form-${e}`,
51
+ checked: l === !0,
52
+ onCheckedChange: (a) => v(e, a === !0),
53
+ disabled: u
54
+ }), /* @__PURE__ */ jsx(Label, {
55
+ htmlFor: `form-${e}`,
56
+ children: d
57
+ })]
58
+ }, e) : s.type === "number" || s.type === "integer" ? /* @__PURE__ */ jsxs("div", {
59
+ className: "space-y-1",
60
+ children: [/* @__PURE__ */ jsx(Label, {
61
+ htmlFor: `form-${e}`,
62
+ children: d
63
+ }), /* @__PURE__ */ jsx(Input, {
64
+ id: `form-${e}`,
65
+ type: "number",
66
+ value: typeof l == "number" ? l : "",
67
+ onChange: (a) => v(e, a.target.value === "" ? void 0 : Number(a.target.value)),
68
+ disabled: u
69
+ })]
70
+ }, e) : s.type === "string" || l === void 0 || typeof l == "string" ? /* @__PURE__ */ jsxs("div", {
71
+ className: "space-y-1",
72
+ children: [/* @__PURE__ */ jsx(Label, {
73
+ htmlFor: `form-${e}`,
74
+ children: d
75
+ }), /* @__PURE__ */ jsx(Input, {
76
+ id: `form-${e}`,
77
+ value: typeof l == "string" ? l : "",
78
+ onChange: (a) => v(e, a.target.value),
79
+ disabled: u
80
+ })]
81
+ }, e) : /* @__PURE__ */ jsxs("div", {
82
+ className: "space-y-1",
83
+ children: [/* @__PURE__ */ jsxs(Label, {
84
+ htmlFor: `form-${e}`,
85
+ children: [d, " (JSON)"]
86
+ }), /* @__PURE__ */ jsx("textarea", {
87
+ id: `form-${e}`,
88
+ className: "border-input w-full rounded-md border bg-transparent p-2 font-mono text-sm",
89
+ rows: 4,
90
+ defaultValue: JSON.stringify(l, null, 2),
91
+ onChange: (a) => {
92
+ try {
93
+ v(e, JSON.parse(a.target.value));
94
+ } catch {}
95
+ },
96
+ disabled: u
97
+ })]
98
+ }, e);
99
+ }), d[29] = h, d[30] = m, d[31] = b, d[32] = _, d[33] = C, d[34] = O, d[35] = k, d[36] = A;
100
+ } else O = d[34], k = d[35], A = d[36];
101
+ E = "flex gap-2", D = l.map((a) => /* @__PURE__ */ jsx(Button, {
102
+ onClick: () => p(C, a.transition),
103
+ disabled: m,
104
+ variant: a === l[0] ? "default" : "outline",
105
+ children: a.label ?? a.transition
106
+ }, a.transition));
107
+ }
108
+ d[9] = x, d[10] = m, d[11] = _, d[12] = p, d[13] = y, d[14] = C, d[15] = f.options?.actions, d[16] = f.transitions, d[17] = T, d[18] = E, d[19] = D, d[20] = O, d[21] = k, d[22] = A;
109
+ } else T = d[17], E = d[18], D = d[19], O = d[20], k = d[21], A = d[22];
110
+ if (T !== Symbol.for("react.early_return_sentinel")) return T;
111
+ let j;
112
+ d[39] !== E || d[40] !== D ? (j = /* @__PURE__ */ jsx("div", {
113
+ className: E,
114
+ children: D
115
+ }), d[39] = E, d[40] = D, d[41] = j) : j = d[41];
116
+ let M;
117
+ return d[42] !== j || d[43] !== O || d[44] !== k || d[45] !== A ? (M = /* @__PURE__ */ jsxs("div", {
118
+ className: O,
119
+ children: [
120
+ k,
121
+ A,
122
+ j
123
+ ]
124
+ }), d[42] = j, d[43] = O, d[44] = k, d[45] = A, d[46] = M) : M = d[46], M;
125
+ }
126
+ function _temp(e) {
127
+ return e !== "markdown";
128
+ }
129
+ export { FormPrompt };
@@ -0,0 +1,94 @@
1
+ import { Button } from "../../../components/ui/button.js";
2
+ import { useOAuthPopup } from "../../oauth/useOAuthPopup.js";
3
+ import "../../oauth/index.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import { useCallback, useEffect, useRef } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { AlertCircle, CheckCircle2, ExternalLink, Loader2 } from "lucide-react";
8
+ function providerLabel(r) {
9
+ return r ? r.charAt(0).toUpperCase() + r.slice(1) : "Provider";
10
+ }
11
+ function OAuthPrompt(f) {
12
+ let m = c(41), { view: h, submit: g, isSubmitting: _ } = f, v;
13
+ m[0] === h.content ? v = m[1] : (v = h.content ?? {}, m[0] = h.content, m[1] = v);
14
+ let y = v, { result: b, open: x, reset: S } = useOAuthPopup(), C = useRef(!1), w;
15
+ m[2] === y.provider ? w = m[3] : (w = providerLabel(y.provider), m[2] = y.provider, m[3] = w);
16
+ let T = w, E;
17
+ m[4] !== y.authUrl || m[5] !== y.state || m[6] !== x || m[7] !== S ? (E = () => {
18
+ !y.authUrl || !y.state || (C.current = !1, S(), x({
19
+ authUrl: y.authUrl,
20
+ state: y.state
21
+ }));
22
+ }, m[4] = y.authUrl, m[5] = y.state, m[6] = x, m[7] = S, m[8] = E) : E = m[8];
23
+ let D = E, O;
24
+ m[9] !== b.code || m[10] !== b.state || m[11] !== b.status || m[12] !== g ? (O = () => {
25
+ b.status === "success" && !C.current && (C.current = !0, g({
26
+ code: b.code,
27
+ state: b.state
28
+ }));
29
+ }, m[9] = b.code, m[10] = b.state, m[11] = b.status, m[12] = g, m[13] = O) : O = m[13];
30
+ let k;
31
+ if (m[14] !== b || m[15] !== g ? (k = [b, g], m[14] = b, m[15] = g, m[16] = k) : k = m[16], useEffect(O, k), y.status === "success") {
32
+ let r;
33
+ m[17] === Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4 text-green-600" }), m[17] = r) : r = m[17];
34
+ let u;
35
+ return m[18] === T ? u = m[19] : (u = /* @__PURE__ */ jsxs("p", {
36
+ className: "flex items-center gap-2 text-sm",
37
+ children: [
38
+ r,
39
+ " Connected to ",
40
+ T,
41
+ "."
42
+ ]
43
+ }), m[18] = T, m[19] = u), u;
44
+ }
45
+ let A = y.status === "error" ? y.message ?? `Signing in to ${T} failed.` : b.status === "error" ? b.error : b.status === "timeout" ? "The sign-in timed out." : b.status === "blocked" ? "The popup was blocked — allow popups and retry." : void 0;
46
+ if (A) {
47
+ let u;
48
+ m[20] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ jsx(AlertCircle, { className: "text-destructive h-4 w-4" }), m[20] = u) : u = m[20];
49
+ let d;
50
+ m[21] === A ? d = m[22] : (d = /* @__PURE__ */ jsxs("p", {
51
+ className: "flex items-center gap-2 text-sm",
52
+ children: [u, A]
53
+ }), m[21] = A, m[22] = d);
54
+ let f;
55
+ m[23] !== _ || m[24] !== D ? (f = /* @__PURE__ */ jsx(Button, {
56
+ variant: "outline",
57
+ onClick: D,
58
+ disabled: _,
59
+ children: "Retry"
60
+ }), m[23] = _, m[24] = D, m[25] = f) : f = m[25];
61
+ let p;
62
+ return m[26] !== d || m[27] !== f ? (p = /* @__PURE__ */ jsxs("div", {
63
+ className: "space-y-2",
64
+ children: [d, f]
65
+ }), m[26] = d, m[27] = f, m[28] = p) : p = m[28], p;
66
+ }
67
+ let j = _ || b.status === "pending" || b.status === "success", M;
68
+ m[29] === T ? M = m[30] : (M = /* @__PURE__ */ jsxs("p", {
69
+ className: "text-sm font-medium",
70
+ children: [
71
+ "Sign in with ",
72
+ T,
73
+ " to continue."
74
+ ]
75
+ }), m[29] = T, m[30] = M);
76
+ let N = j || !y.authUrl, P;
77
+ m[31] === j ? P = m[32] : (P = j ? /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx(ExternalLink, { className: "mr-2 h-4 w-4" }), m[31] = j, m[32] = P);
78
+ let F;
79
+ m[33] !== T || m[34] !== D || m[35] !== N || m[36] !== P ? (F = /* @__PURE__ */ jsxs(Button, {
80
+ onClick: D,
81
+ disabled: N,
82
+ children: [
83
+ P,
84
+ "Sign in with ",
85
+ T
86
+ ]
87
+ }), m[33] = T, m[34] = D, m[35] = N, m[36] = P, m[37] = F) : F = m[37];
88
+ let I;
89
+ return m[38] !== M || m[39] !== F ? (I = /* @__PURE__ */ jsxs("div", {
90
+ className: "space-y-2",
91
+ children: [M, F]
92
+ }), m[38] = M, m[39] = F, m[40] = I) : I = m[40], I;
93
+ }
94
+ export { OAuthPrompt };
@@ -0,0 +1,35 @@
1
+ import { Button } from "../../../components/ui/button.js";
2
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../../../components/ui/tooltip.js";
3
+ import { useOptionalWorkbenchLayout } from "../../workbench/providers/WorkbenchLayoutProvider.js";
4
+ import "../../workbench/index.js";
5
+ import { c } from "react/compiler-runtime";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { MonitorPlay } from "lucide-react";
8
+ function SandboxRunButton(u) {
9
+ let d = c(14), { slotId: f, label: p } = u, m = useOptionalWorkbenchLayout();
10
+ if (!m || !f) return null;
11
+ let h;
12
+ d[0] !== m.environments || d[1] !== f ? (h = m.environments?.find((e) => e.slotId === f), d[0] = m.environments, d[1] = f, d[2] = h) : h = d[2];
13
+ let g = h;
14
+ if (!g) return null;
15
+ let _;
16
+ d[3] !== m || d[4] !== f ? (_ = () => m.openPreviewWithEnvironment(f), d[3] = m, d[4] = f, d[5] = _) : _ = d[5];
17
+ let v;
18
+ d[6] === Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ jsx(MonitorPlay, { className: "h-4 w-4" }), d[6] = v) : v = d[6];
19
+ let y;
20
+ d[7] === _ ? y = d[8] : (y = /* @__PURE__ */ jsx(TooltipTrigger, {
21
+ asChild: !0,
22
+ children: /* @__PURE__ */ jsx(Button, {
23
+ type: "button",
24
+ variant: "outline",
25
+ size: "icon",
26
+ onClick: _,
27
+ children: v
28
+ })
29
+ }), d[7] = _, d[8] = y);
30
+ let b = p ?? (g.envName ? `Open ${g.envName}` : "Open Sandbox"), x;
31
+ d[9] === b ? x = d[10] : (x = /* @__PURE__ */ jsx(TooltipContent, { children: b }), d[9] = b, d[10] = x);
32
+ let S;
33
+ return d[11] !== y || d[12] !== x ? (S = /* @__PURE__ */ jsxs(Tooltip, { children: [y, x] }), d[11] = y, d[12] = x, d[13] = S) : S = d[13], S;
34
+ }
35
+ export { SandboxRunButton };
@@ -0,0 +1,69 @@
1
+ import { Button } from "../../../components/ui/button.js";
2
+ import { Input } from "../../../components/ui/input.js";
3
+ import { Label } from "../../../components/ui/label.js";
4
+ import { useUpsertSecret } from "../../../hooks/useSecrets.js";
5
+ import { useState } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { Info, KeyRound, Loader2 } from "lucide-react";
8
+ function SecretPrompt({ view: u, submit: d, isSubmitting: f, workspaceId: p }) {
9
+ let m = (u.content?.variables ?? []).filter((e) => e.key?.trim()), h = useUpsertSecret(), [g, _] = useState(() => Object.fromEntries(m.map((e) => [e.key, e.value ?? ""]))), [v, y] = useState(!1), b = typeof u.options?.label == "string" ? u.options.label : "Save & Continue";
10
+ if (m.length === 0 || !p) return null;
11
+ let x = async () => {
12
+ y(!0);
13
+ try {
14
+ let e = [];
15
+ for (let c of m) {
16
+ let l = g[c.key]?.trim();
17
+ l && (await h.mutateAsync({
18
+ workspaceId: p,
19
+ key: c.key,
20
+ value: l
21
+ }), e.push(c.key));
22
+ }
23
+ d({ keys: e });
24
+ } finally {
25
+ y(!1);
26
+ }
27
+ }, S = v || f;
28
+ return /* @__PURE__ */ jsxs("div", {
29
+ className: "space-y-3",
30
+ children: [
31
+ /* @__PURE__ */ jsx("p", {
32
+ className: "text-sm font-medium",
33
+ children: "Secrets"
34
+ }),
35
+ m.map((e) => /* @__PURE__ */ jsxs("div", {
36
+ className: "space-y-1",
37
+ children: [/* @__PURE__ */ jsx(Label, {
38
+ className: "text-muted-foreground text-xs",
39
+ htmlFor: `secret-${e.key}`,
40
+ children: e.key
41
+ }), /* @__PURE__ */ jsx(Input, {
42
+ id: `secret-${e.key}`,
43
+ type: "password",
44
+ placeholder: "Enter value...",
45
+ value: g[e.key] ?? "",
46
+ onChange: (c) => _((l) => ({
47
+ ...l,
48
+ [e.key]: c.target.value
49
+ })),
50
+ disabled: S
51
+ })]
52
+ }, e.key)),
53
+ /* @__PURE__ */ jsxs("div", {
54
+ className: "text-muted-foreground flex items-center gap-2 text-xs",
55
+ children: [/* @__PURE__ */ jsx(Info, { className: "h-3.5 w-3.5 shrink-0" }), /* @__PURE__ */ jsx("span", { children: "Values are stored as workspace secrets — only the saved keys reach the workflow." })]
56
+ }),
57
+ /* @__PURE__ */ jsx("div", {
58
+ className: "flex justify-end",
59
+ children: /* @__PURE__ */ jsxs(Button, {
60
+ onClick: () => void x(),
61
+ disabled: S,
62
+ className: "w-48",
63
+ children: [S ? /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx(KeyRound, { className: "mr-2 h-4 w-4" }), b]
64
+ })
65
+ })
66
+ ]
67
+ });
68
+ }
69
+ export { SecretPrompt };