@burdenoff/microfe-botmanor 2026.1118.6 → 2026.1118.7
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.
- package/dist/botlit/components/AgentBindingsPanel.d.ts +4 -0
- package/dist/botlit/components/AgentBindingsPanel.js +305 -0
- package/dist/botlit/components/AgentBindingsPanel.js.map +1 -0
- package/dist/botlit/hooks/index.d.ts +2 -0
- package/dist/botlit/hooks/index.js +8 -7
- package/dist/botlit/hooks/useAgentBindings.d.ts +58 -0
- package/dist/botlit/hooks/useAgentBindings.js +87 -0
- package/dist/botlit/hooks/useAgentBindings.js.map +1 -0
- package/dist/botlit/pages/AgentDetailPage.js +56 -55
- package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
- package/dist/botlit/pages/PromptStudioPage.js +365 -175
- package/dist/botlit/pages/PromptStudioPage.js.map +1 -1
- package/dist/botlit/utils/promptVariables.d.ts +6 -0
- package/dist/botlit/utils/promptVariables.js +20 -0
- package/dist/botlit/utils/promptVariables.js.map +1 -0
- package/dist/generated/wspace-operations.d.ts +314 -0
- package/dist/generated/wspace-operations.js +189 -101
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +139 -0
- package/dist/generated/wspace-types.js +3 -1
- package/dist/generated/wspace-types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,121 +1,201 @@
|
|
|
1
1
|
import { PageLayout as e } from "../components/PageLayout.js";
|
|
2
2
|
import { Card as t, CardContent as n, CardDescription as r, CardHeader as i, CardTitle as a } from "../components/Card.js";
|
|
3
3
|
import { Button as o } from "../components/Button.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { FormField as s, Input as c, Textarea as l } from "../components/Input.js";
|
|
5
|
+
import { BOTMANOR_PERMISSIONS as u } from "../permissions/botmanorPermissions.js";
|
|
6
|
+
import { BotmanorPermissionGate as d } from "../permissions/useBotmanorPermissions.js";
|
|
7
7
|
import { Badge as f } from "../components/Badge.js";
|
|
8
|
-
import { EmptyState as
|
|
9
|
-
import { ErrorState as
|
|
10
|
-
import { useBotlit as
|
|
8
|
+
import { EmptyState as ee } from "../components/EmptyState.js";
|
|
9
|
+
import { ErrorState as te } from "../components/ErrorState.js";
|
|
10
|
+
import { useBotlit as ne } from "../providers/BotlitProvider.js";
|
|
11
11
|
import "../hooks/index.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
12
|
+
import { useLLMModels as re } from "../hooks/useLLMProviders.js";
|
|
13
|
+
import { PromptVersionBump as p } from "../../generated/wspace-types.js";
|
|
14
|
+
import { confirmAction as ie } from "../utils/confirmAction.js";
|
|
15
|
+
import { promptTemplateVariables as m, usePromptTemplates as ae } from "../hooks/usePromptTemplates.js";
|
|
16
|
+
import { usePromptTemplateVersions as oe, useSavePromptTemplateVersion as se, useTestPromptTemplate as ce } from "../hooks/useAgentBindings.js";
|
|
17
|
+
import { graphqlErrorMessage as h } from "../utils/errors.js";
|
|
18
|
+
import { typedVariableValue as le } from "../utils/promptVariables.js";
|
|
19
|
+
import { formatRelativeTime as g } from "../utils/formatters.js";
|
|
15
20
|
import "../permissions/index.js";
|
|
16
|
-
import { useEffect as
|
|
17
|
-
import {
|
|
18
|
-
import { jsx as
|
|
19
|
-
import { Play as
|
|
20
|
-
import { toast as
|
|
21
|
+
import { useEffect as _, useMemo as v, useRef as ue, useState as y } from "react";
|
|
22
|
+
import { PagePurpose as de } from "@burdenoff/fe-libs/ui";
|
|
23
|
+
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
24
|
+
import { GitCompare as fe, History as pe, Play as me, Plus as he, Save as ge } from "lucide-react";
|
|
25
|
+
import { toast as _e } from "sonner";
|
|
21
26
|
// src/botlit/pages/PromptStudioPage.tsx
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
27
|
+
var ve = (e) => e, C = (e) => ({ variables: e }), w = "h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 text-sm", ye = ({ run: e }) => /* @__PURE__ */ S(t, {
|
|
28
|
+
"data-testid": `prompt-run-${e.label.toLowerCase().replace(/\s+/g, "-")}`,
|
|
29
|
+
children: [/* @__PURE__ */ S(i, { children: [/* @__PURE__ */ x(a, {
|
|
30
|
+
className: "text-base",
|
|
31
|
+
children: e.label
|
|
32
|
+
}), e.result && /* @__PURE__ */ S(r, { children: [
|
|
33
|
+
e.result.model,
|
|
34
|
+
" · ",
|
|
35
|
+
e.result.tokensUsed,
|
|
36
|
+
" tokens · ",
|
|
37
|
+
e.result.latencyMs,
|
|
38
|
+
" ms"
|
|
39
|
+
] })] }), /* @__PURE__ */ x(n, {
|
|
40
|
+
className: "space-y-3",
|
|
41
|
+
children: e.error ? /* @__PURE__ */ x("p", {
|
|
42
|
+
role: "alert",
|
|
43
|
+
className: "text-sm text-status-error-text",
|
|
44
|
+
children: e.error
|
|
45
|
+
}) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x("div", {
|
|
46
|
+
className: "whitespace-pre-wrap rounded-lg bg-bg-sunken p-3 text-sm",
|
|
47
|
+
children: e.result?.output
|
|
48
|
+
}), /* @__PURE__ */ S("details", {
|
|
49
|
+
className: "text-xs text-text-secondary",
|
|
50
|
+
children: [/* @__PURE__ */ x("summary", {
|
|
51
|
+
className: "cursor-pointer",
|
|
52
|
+
children: "Rendered prompt"
|
|
53
|
+
}), /* @__PURE__ */ x("pre", {
|
|
54
|
+
className: "mt-2 whitespace-pre-wrap font-mono",
|
|
55
|
+
children: e.result?.renderedPrompt
|
|
56
|
+
})]
|
|
57
|
+
})] })
|
|
58
|
+
})]
|
|
59
|
+
}), T = () => {
|
|
60
|
+
let { navigateTo: b } = ne(), { data: T, loading: be, error: E, refetch: D } = ae(), O = re(), { run: xe, loading: k } = ce(), { save: Se, loading: A } = se(), [j, M] = y(null), [N, P] = y(""), [F, I] = y({}), [L, R] = y(""), [z, Ce] = y(""), [B, V] = y([]), [H, we] = y(p.Patch), [U, Te] = y(""), [W, G] = y(null), K = ue(null);
|
|
61
|
+
_(() => {
|
|
62
|
+
!j && T.length > 0 && M(T[0].id);
|
|
63
|
+
}, [T, j]);
|
|
64
|
+
let q = v(() => T.find((e) => e.id === j), [T, j]), J = oe(q?.id), Ee = v(() => q ? m(W === null ? q : C(W)) : [], [q, W]), Y = v(() => O.data.filter((e) => e.isActive), [O.data]), De = v(() => {
|
|
65
|
+
let e = new Map(Ee.map((e) => [e.name, e]));
|
|
66
|
+
for (let t of J.data) for (let n of m(C(t.variables))) e.has(n.name) || e.set(n.name, n);
|
|
67
|
+
return [...e.values()];
|
|
68
|
+
}, [Ee, J.data]);
|
|
69
|
+
_(() => {
|
|
70
|
+
K.current = q?.id ?? null, P(q?.templateText ?? ""), G(null);
|
|
71
|
+
}, [q?.id, q?.templateText]), _(() => {
|
|
72
|
+
!L && Y.length > 0 && R(Y[0].id);
|
|
73
|
+
}, [Y, L]);
|
|
74
|
+
let X = !!q && (N !== q?.templateText || W !== null), Z = !!(q && L && z.trim()), Oe = (e) => {
|
|
75
|
+
let t = new Map(m(e === null && q ? q : C(e)).map((e) => [e.name, e.type]));
|
|
76
|
+
return Object.fromEntries(Object.entries(F).filter(([e, n]) => n !== "" && t.has(e)).map(([e, n]) => [e, le(t.get(e) ?? "string", n)]));
|
|
77
|
+
}, Q = async (e, t, n = null) => {
|
|
78
|
+
if (!q) return {
|
|
79
|
+
label: e,
|
|
80
|
+
error: "Select a prompt"
|
|
81
|
+
};
|
|
82
|
+
try {
|
|
83
|
+
return {
|
|
84
|
+
label: e,
|
|
85
|
+
result: await xe({
|
|
86
|
+
templateId: q.id,
|
|
87
|
+
input: {
|
|
88
|
+
llmModelId: L,
|
|
89
|
+
userMessage: z,
|
|
90
|
+
variables: Oe(n),
|
|
91
|
+
...t === void 0 ? {} : { templateText: t },
|
|
92
|
+
...n === null ? {} : { variableDefinitions: ve(n) }
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
};
|
|
96
|
+
} catch (t) {
|
|
97
|
+
return {
|
|
98
|
+
label: e,
|
|
99
|
+
error: h(t, "The model run failed")
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}, ke = async (e) => {
|
|
103
|
+
e !== q?.id && (!X || await ie({
|
|
104
|
+
title: "Discard draft?",
|
|
105
|
+
message: "This prompt has an unsaved draft. Discard it and open the other prompt?",
|
|
106
|
+
confirmLabel: "Discard draft",
|
|
107
|
+
cancelLabel: "Keep editing"
|
|
108
|
+
})) && (M(e), I({}), V([]));
|
|
109
|
+
}, $ = (e, t) => {
|
|
110
|
+
e && e === K.current && V(t);
|
|
111
|
+
}, Ae = async () => {
|
|
112
|
+
let e = q?.id;
|
|
113
|
+
$(e, [await Q("Draft", N, W)]);
|
|
114
|
+
}, je = async (e, t, n = null) => {
|
|
115
|
+
let r = q?.id, [i, a] = await Promise.all([Q(e, t, n), Q("Draft", N, W)]);
|
|
116
|
+
$(r, [i, a]);
|
|
117
|
+
}, Me = async () => {
|
|
118
|
+
if (q) try {
|
|
119
|
+
let e = await Se({
|
|
120
|
+
templateId: q.id,
|
|
121
|
+
input: {
|
|
122
|
+
templateText: N,
|
|
123
|
+
...W === null ? {} : { variables: ve(W) },
|
|
124
|
+
bump: H,
|
|
125
|
+
...U.trim() ? { changelog: U.trim() } : {}
|
|
126
|
+
}
|
|
46
127
|
});
|
|
47
|
-
|
|
128
|
+
_e.success(`Saved version ${e.version}`), K.current === e.id && (Te(""), P(e.templateText), G(null)), await D(), K.current === e.id && J.refetch();
|
|
48
129
|
} catch (e) {
|
|
49
|
-
|
|
130
|
+
_e.error(h(e, "Failed to save the prompt version"));
|
|
50
131
|
}
|
|
51
132
|
};
|
|
52
|
-
return /* @__PURE__ */
|
|
133
|
+
return /* @__PURE__ */ x(e, {
|
|
53
134
|
title: "Prompt Studio",
|
|
54
|
-
description: "
|
|
55
|
-
actions: /* @__PURE__ */
|
|
56
|
-
permission:
|
|
57
|
-
children: /* @__PURE__ */
|
|
58
|
-
leftIcon: /* @__PURE__ */
|
|
59
|
-
onClick: () =>
|
|
135
|
+
description: "Write a prompt, run it against a live model, compare and save versions",
|
|
136
|
+
actions: /* @__PURE__ */ x(d, {
|
|
137
|
+
permission: u.PROMPT_TEMPLATE_CREATE,
|
|
138
|
+
children: /* @__PURE__ */ x(o, {
|
|
139
|
+
leftIcon: /* @__PURE__ */ x(he, { size: 16 }),
|
|
140
|
+
onClick: () => b("prompt-templates/new"),
|
|
60
141
|
children: "New Prompt"
|
|
61
142
|
})
|
|
62
143
|
}),
|
|
63
|
-
children: /* @__PURE__ */
|
|
144
|
+
children: /* @__PURE__ */ S("div", {
|
|
64
145
|
className: "space-y-6",
|
|
65
|
-
children: [/* @__PURE__ */
|
|
66
|
-
icon: /* @__PURE__ */
|
|
67
|
-
children: "Prompt Studio is your
|
|
68
|
-
}), /* @__PURE__ */
|
|
69
|
-
className: "grid grid-cols-
|
|
146
|
+
children: [/* @__PURE__ */ x(de, {
|
|
147
|
+
icon: /* @__PURE__ */ x(me, { size: 18 }),
|
|
148
|
+
children: "Prompt Studio is your workbench for prompts. Pick a template, edit the draft, fill in variable values and a test message, then run it against one of your workspace's models. Compare the draft with the saved or an earlier version side by side, and save the draft as the template's next version when it answers the way you want."
|
|
149
|
+
}), /* @__PURE__ */ S("div", {
|
|
150
|
+
className: "grid grid-cols-1 gap-6 lg:grid-cols-12",
|
|
70
151
|
children: [
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
className: "col-span-3",
|
|
73
|
-
children: /* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ x("div", {
|
|
153
|
+
className: "lg:col-span-3",
|
|
154
|
+
children: /* @__PURE__ */ S(t, { children: [/* @__PURE__ */ x(i, { children: /* @__PURE__ */ x(a, {
|
|
74
155
|
className: "text-base",
|
|
75
156
|
children: "Prompts"
|
|
76
|
-
}) }), /* @__PURE__ */
|
|
157
|
+
}) }), /* @__PURE__ */ x(n, {
|
|
77
158
|
className: "p-0",
|
|
78
|
-
children:
|
|
159
|
+
children: be ? /* @__PURE__ */ x("div", {
|
|
79
160
|
className: "space-y-2 p-4",
|
|
80
161
|
children: [
|
|
81
162
|
1,
|
|
82
163
|
2,
|
|
83
164
|
3
|
|
84
|
-
].map((e) => /* @__PURE__ */
|
|
85
|
-
}) :
|
|
165
|
+
].map((e) => /* @__PURE__ */ x("div", { className: "h-14 rounded bg-bg-sunken motion-safe:animate-vc-shimmer" }, e))
|
|
166
|
+
}) : E ? /* @__PURE__ */ x(te, {
|
|
86
167
|
resource: "prompt templates",
|
|
87
|
-
error:
|
|
88
|
-
onRetry: () => void
|
|
168
|
+
error: E,
|
|
169
|
+
onRetry: () => void D(),
|
|
89
170
|
className: "m-4"
|
|
90
|
-
}) :
|
|
171
|
+
}) : T.length === 0 ? /* @__PURE__ */ x("p", {
|
|
91
172
|
className: "p-4 text-sm text-text-secondary",
|
|
92
173
|
children: "No prompt templates yet. Create one to start iterating."
|
|
93
|
-
}) : /* @__PURE__ */
|
|
174
|
+
}) : /* @__PURE__ */ x("div", {
|
|
94
175
|
className: "divide-y divide-border-subtle",
|
|
95
|
-
children:
|
|
176
|
+
children: T.map((e) => /* @__PURE__ */ S("button", {
|
|
96
177
|
type: "button",
|
|
97
|
-
className: `w-full text-left
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
},
|
|
178
|
+
className: `w-full p-4 text-left transition-colors hover:bg-accent ${q?.id === e.id ? "bg-accent" : ""}`,
|
|
179
|
+
disabled: k || A,
|
|
180
|
+
onClick: () => void ke(e.id),
|
|
101
181
|
children: [
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
className: "font-medium
|
|
182
|
+
/* @__PURE__ */ x("p", {
|
|
183
|
+
className: "truncate font-medium",
|
|
104
184
|
children: e.name
|
|
105
185
|
}),
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
className: "text-xs text-text-secondary
|
|
186
|
+
/* @__PURE__ */ S("p", {
|
|
187
|
+
className: "mt-1 truncate text-xs text-text-secondary",
|
|
108
188
|
children: ["v", e.version]
|
|
109
189
|
}),
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
-
className: "flex items-center gap-2
|
|
112
|
-
children: [e.visibility === "PUBLIC" && /* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ S("div", {
|
|
191
|
+
className: "mt-2 flex items-center gap-2",
|
|
192
|
+
children: [e.visibility === "PUBLIC" && /* @__PURE__ */ x(f, {
|
|
113
193
|
variant: "secondary",
|
|
114
194
|
className: "text-[10px]",
|
|
115
195
|
children: "Public"
|
|
116
|
-
}), /* @__PURE__ */
|
|
196
|
+
}), /* @__PURE__ */ S("span", {
|
|
117
197
|
className: "text-xs text-text-secondary",
|
|
118
|
-
children: [
|
|
198
|
+
children: [m(e).length, " vars"]
|
|
119
199
|
})]
|
|
120
200
|
})
|
|
121
201
|
]
|
|
@@ -123,124 +203,234 @@ var P = () => {
|
|
|
123
203
|
})
|
|
124
204
|
})] })
|
|
125
205
|
}),
|
|
126
|
-
/* @__PURE__ */
|
|
127
|
-
className: "col-span-6",
|
|
128
|
-
children:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
children: [/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E(a, { children: G.name }), /* @__PURE__ */ E(r, { children: G.description })] }), /* @__PURE__ */ E(o, {
|
|
135
|
-
size: "sm",
|
|
206
|
+
/* @__PURE__ */ S("div", {
|
|
207
|
+
className: "space-y-6 lg:col-span-6",
|
|
208
|
+
children: [q ? /* @__PURE__ */ S(t, { children: [/* @__PURE__ */ S(i, {
|
|
209
|
+
className: "flex flex-row items-center justify-between",
|
|
210
|
+
children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S(a, { children: [
|
|
211
|
+
q.name,
|
|
212
|
+
" ",
|
|
213
|
+
/* @__PURE__ */ S(f, {
|
|
136
214
|
variant: "outline",
|
|
137
|
-
|
|
138
|
-
children: "
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
215
|
+
className: "ml-2",
|
|
216
|
+
children: ["v", q.version]
|
|
217
|
+
}),
|
|
218
|
+
X && /* @__PURE__ */ x(f, {
|
|
219
|
+
variant: "secondary",
|
|
220
|
+
className: "ml-2",
|
|
221
|
+
children: "Unsaved draft"
|
|
222
|
+
})
|
|
223
|
+
] }), /* @__PURE__ */ x(r, { children: q.description })] }), /* @__PURE__ */ x(o, {
|
|
224
|
+
size: "sm",
|
|
225
|
+
variant: "outline",
|
|
226
|
+
onClick: () => b(`prompt-templates/${q.id}`),
|
|
227
|
+
children: "Open template"
|
|
228
|
+
})]
|
|
229
|
+
}), /* @__PURE__ */ S(n, {
|
|
230
|
+
className: "space-y-4",
|
|
231
|
+
children: [
|
|
232
|
+
/* @__PURE__ */ x(s, {
|
|
233
|
+
label: "Draft prompt",
|
|
234
|
+
children: /* @__PURE__ */ x(l, {
|
|
235
|
+
"aria-label": "Draft prompt",
|
|
236
|
+
readOnly: A || k,
|
|
237
|
+
value: N,
|
|
238
|
+
rows: 12,
|
|
239
|
+
onChange: (e) => P(e.target.value),
|
|
240
|
+
className: "font-mono text-sm"
|
|
241
|
+
})
|
|
242
|
+
}),
|
|
243
|
+
/* @__PURE__ */ x(d, {
|
|
244
|
+
permission: u.PROMPT_TEMPLATE_UPDATE,
|
|
245
|
+
children: /* @__PURE__ */ S("div", {
|
|
246
|
+
className: "grid gap-3 sm:grid-cols-[10rem_1fr_auto] sm:items-end",
|
|
247
|
+
children: [
|
|
248
|
+
/* @__PURE__ */ S("label", {
|
|
249
|
+
className: "grid gap-1 text-sm",
|
|
250
|
+
children: ["Version bump", /* @__PURE__ */ S("select", {
|
|
251
|
+
"aria-label": "Version bump",
|
|
252
|
+
className: w,
|
|
253
|
+
value: H,
|
|
254
|
+
onChange: (e) => we(e.target.value),
|
|
255
|
+
children: [
|
|
256
|
+
/* @__PURE__ */ x("option", {
|
|
257
|
+
value: p.Patch,
|
|
258
|
+
children: "Patch"
|
|
259
|
+
}),
|
|
260
|
+
/* @__PURE__ */ x("option", {
|
|
261
|
+
value: p.Minor,
|
|
262
|
+
children: "Minor"
|
|
263
|
+
}),
|
|
264
|
+
/* @__PURE__ */ x("option", {
|
|
265
|
+
value: p.Major,
|
|
266
|
+
children: "Major"
|
|
267
|
+
})
|
|
268
|
+
]
|
|
180
269
|
})]
|
|
181
|
-
}),
|
|
182
|
-
|
|
183
|
-
className: "
|
|
184
|
-
children:
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
270
|
+
}),
|
|
271
|
+
/* @__PURE__ */ S("label", {
|
|
272
|
+
className: "grid gap-1 text-sm",
|
|
273
|
+
children: ["Change note", /* @__PURE__ */ x(c, {
|
|
274
|
+
"aria-label": "Change note",
|
|
275
|
+
placeholder: "What changed in this version",
|
|
276
|
+
value: U,
|
|
277
|
+
onChange: (e) => Te(e.target.value)
|
|
278
|
+
})]
|
|
279
|
+
}),
|
|
280
|
+
/* @__PURE__ */ x(o, {
|
|
281
|
+
leftIcon: /* @__PURE__ */ x(ge, { size: 16 }),
|
|
282
|
+
onClick: () => void Me(),
|
|
283
|
+
isLoading: A,
|
|
284
|
+
disabled: !X || !N.trim(),
|
|
285
|
+
children: "Save as new version"
|
|
286
|
+
})
|
|
287
|
+
]
|
|
191
288
|
})
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
289
|
+
}),
|
|
290
|
+
/* @__PURE__ */ S("div", {
|
|
291
|
+
className: "text-xs text-text-secondary",
|
|
292
|
+
children: ["Updated ", g(q.updatedAt)]
|
|
293
|
+
})
|
|
294
|
+
]
|
|
295
|
+
})] }) : /* @__PURE__ */ x(ee, {
|
|
195
296
|
illustration: "onboarding",
|
|
196
297
|
title: "Select a prompt",
|
|
197
|
-
description: "Choose a prompt from the list to
|
|
198
|
-
})
|
|
298
|
+
description: "Choose a prompt from the list to iterate on it"
|
|
299
|
+
}), B.length > 0 && /* @__PURE__ */ x("div", {
|
|
300
|
+
className: `grid gap-4 ${B.length > 1 ? "md:grid-cols-2" : ""}`,
|
|
301
|
+
children: B.map((e) => /* @__PURE__ */ x(ye, { run: e }, e.label))
|
|
302
|
+
})]
|
|
199
303
|
}),
|
|
200
|
-
/* @__PURE__ */
|
|
201
|
-
className: "col-span-3",
|
|
202
|
-
children: /* @__PURE__ */
|
|
203
|
-
className: "
|
|
204
|
-
children: [/* @__PURE__ */
|
|
205
|
-
}) }), /* @__PURE__ */
|
|
304
|
+
/* @__PURE__ */ S("div", {
|
|
305
|
+
className: "space-y-6 lg:col-span-3",
|
|
306
|
+
children: [/* @__PURE__ */ S(t, { children: [/* @__PURE__ */ x(i, { children: /* @__PURE__ */ S(a, {
|
|
307
|
+
className: "flex items-center gap-2 text-base",
|
|
308
|
+
children: [/* @__PURE__ */ x(me, { size: 16 }), "Run against a model"]
|
|
309
|
+
}) }), /* @__PURE__ */ S(n, {
|
|
206
310
|
className: "space-y-4",
|
|
207
311
|
children: [
|
|
208
|
-
|
|
312
|
+
/* @__PURE__ */ S("label", {
|
|
313
|
+
className: "grid gap-1 text-sm",
|
|
314
|
+
children: ["Model", /* @__PURE__ */ S("select", {
|
|
315
|
+
"aria-label": "Model",
|
|
316
|
+
disabled: k,
|
|
317
|
+
className: w,
|
|
318
|
+
value: L,
|
|
319
|
+
onChange: (e) => R(e.target.value),
|
|
320
|
+
children: [Y.length === 0 && /* @__PURE__ */ x("option", {
|
|
321
|
+
value: "",
|
|
322
|
+
children: "No active models"
|
|
323
|
+
}), Y.map((e) => /* @__PURE__ */ x("option", {
|
|
324
|
+
value: e.id,
|
|
325
|
+
children: e.name
|
|
326
|
+
}, e.id))]
|
|
327
|
+
})]
|
|
328
|
+
}),
|
|
329
|
+
De.map((e) => /* @__PURE__ */ x(s, {
|
|
209
330
|
label: e.name,
|
|
210
|
-
children: /* @__PURE__ */
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
331
|
+
children: /* @__PURE__ */ x(c, {
|
|
332
|
+
"aria-label": `Value for ${e.name}`,
|
|
333
|
+
readOnly: k,
|
|
334
|
+
placeholder: typeof e.defaultValue == "string" ? `Default: ${e.defaultValue}` : e.description || `Enter ${e.name}`,
|
|
335
|
+
value: F[e.name] || "",
|
|
336
|
+
onChange: (t) => I({
|
|
337
|
+
...F,
|
|
215
338
|
[e.name]: t.target.value
|
|
216
339
|
})
|
|
217
340
|
})
|
|
218
341
|
}, e.name)),
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
-
|
|
221
|
-
children: /* @__PURE__ */
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
342
|
+
/* @__PURE__ */ x(s, {
|
|
343
|
+
label: "Test message",
|
|
344
|
+
children: /* @__PURE__ */ x(l, {
|
|
345
|
+
"aria-label": "Test message",
|
|
346
|
+
readOnly: k,
|
|
347
|
+
rows: 3,
|
|
348
|
+
placeholder: "What a user would ask",
|
|
349
|
+
value: z,
|
|
350
|
+
onChange: (e) => Ce(e.target.value)
|
|
227
351
|
})
|
|
228
352
|
}),
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
children: "
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
353
|
+
/* @__PURE__ */ x(d, {
|
|
354
|
+
permission: u.PROMPT_TEMPLATE_EXECUTE,
|
|
355
|
+
children: /* @__PURE__ */ S("div", {
|
|
356
|
+
className: "grid gap-2",
|
|
357
|
+
children: [/* @__PURE__ */ x(o, {
|
|
358
|
+
onClick: () => void Ae(),
|
|
359
|
+
isLoading: k,
|
|
360
|
+
disabled: !Z,
|
|
361
|
+
children: "Run draft"
|
|
362
|
+
}), /* @__PURE__ */ x(o, {
|
|
363
|
+
variant: "outline",
|
|
364
|
+
leftIcon: /* @__PURE__ */ x(fe, { size: 16 }),
|
|
365
|
+
onClick: () => void je(`Saved v${q?.version}`, q?.templateText ?? ""),
|
|
366
|
+
disabled: !Z || k,
|
|
367
|
+
children: "Compare with saved"
|
|
368
|
+
})]
|
|
369
|
+
})
|
|
370
|
+
})
|
|
236
371
|
]
|
|
237
|
-
})] })
|
|
372
|
+
})] }), /* @__PURE__ */ S(t, { children: [/* @__PURE__ */ x(i, { children: /* @__PURE__ */ S(a, {
|
|
373
|
+
className: "flex items-center gap-2 text-base",
|
|
374
|
+
children: [/* @__PURE__ */ x(pe, { size: 16 }), "Versions"]
|
|
375
|
+
}) }), /* @__PURE__ */ x(n, {
|
|
376
|
+
className: "space-y-3",
|
|
377
|
+
children: J.error ? /* @__PURE__ */ x(te, {
|
|
378
|
+
resource: "prompt versions",
|
|
379
|
+
error: J.error,
|
|
380
|
+
onRetry: () => void J.refetch()
|
|
381
|
+
}) : J.loading && J.data.length === 0 ? /* @__PURE__ */ x("p", {
|
|
382
|
+
className: "text-sm text-text-secondary",
|
|
383
|
+
children: "Loading versions…"
|
|
384
|
+
}) : J.data.length === 0 ? /* @__PURE__ */ x("p", {
|
|
385
|
+
className: "text-sm text-text-secondary",
|
|
386
|
+
children: "No earlier versions. Saving a draft keeps the current one here."
|
|
387
|
+
}) : J.data.map((e) => /* @__PURE__ */ S("div", {
|
|
388
|
+
className: "space-y-2 rounded-lg border border-border-subtle p-3",
|
|
389
|
+
children: [
|
|
390
|
+
/* @__PURE__ */ S("div", {
|
|
391
|
+
className: "flex items-center justify-between",
|
|
392
|
+
children: [/* @__PURE__ */ S(f, {
|
|
393
|
+
variant: "outline",
|
|
394
|
+
children: ["v", e.version]
|
|
395
|
+
}), /* @__PURE__ */ x("span", {
|
|
396
|
+
className: "text-xs text-text-secondary",
|
|
397
|
+
children: g(String(e.savedAt))
|
|
398
|
+
})]
|
|
399
|
+
}),
|
|
400
|
+
e.changelog && /* @__PURE__ */ x("p", {
|
|
401
|
+
className: "text-xs",
|
|
402
|
+
children: e.changelog
|
|
403
|
+
}),
|
|
404
|
+
/* @__PURE__ */ S("div", {
|
|
405
|
+
className: "flex gap-2",
|
|
406
|
+
children: [/* @__PURE__ */ x(o, {
|
|
407
|
+
size: "sm",
|
|
408
|
+
variant: "ghost",
|
|
409
|
+
disabled: k || A,
|
|
410
|
+
onClick: () => {
|
|
411
|
+
P(e.templateText), G(e.variables), I({});
|
|
412
|
+
},
|
|
413
|
+
children: "Load"
|
|
414
|
+
}), /* @__PURE__ */ x(d, {
|
|
415
|
+
permission: u.PROMPT_TEMPLATE_EXECUTE,
|
|
416
|
+
children: /* @__PURE__ */ x(o, {
|
|
417
|
+
size: "sm",
|
|
418
|
+
variant: "outline",
|
|
419
|
+
disabled: !Z || k,
|
|
420
|
+
onClick: () => void je(`v${e.version}`, e.templateText, e.variables),
|
|
421
|
+
children: "Compare"
|
|
422
|
+
})
|
|
423
|
+
})]
|
|
424
|
+
})
|
|
425
|
+
]
|
|
426
|
+
}, `${e.version}-${e.revision}`))
|
|
427
|
+
})] })]
|
|
238
428
|
})
|
|
239
429
|
]
|
|
240
430
|
})]
|
|
241
431
|
})
|
|
242
432
|
});
|
|
243
433
|
};
|
|
244
|
-
export {
|
|
434
|
+
export { T as PromptStudioPage };
|
|
245
435
|
|
|
246
436
|
//# sourceMappingURL=PromptStudioPage.js.map
|