@burdenoff/microfe-botmanor 2026.1118.6 → 2026.1118.8

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 (43) hide show
  1. package/dist/botlit/components/AgentBindingsPanel.d.ts +4 -0
  2. package/dist/botlit/components/AgentBindingsPanel.js +305 -0
  3. package/dist/botlit/components/AgentBindingsPanel.js.map +1 -0
  4. package/dist/botlit/components/ChannelSelectorSheet.d.ts +9 -2
  5. package/dist/botlit/components/ChannelSelectorSheet.js.map +1 -1
  6. package/dist/botlit/hooks/index.d.ts +3 -1
  7. package/dist/botlit/hooks/index.js +14 -13
  8. package/dist/botlit/hooks/internal/globalWorkspaceScope.d.ts +15 -0
  9. package/dist/botlit/hooks/internal/globalWorkspaceScope.js +21 -0
  10. package/dist/botlit/hooks/internal/globalWorkspaceScope.js.map +1 -0
  11. package/dist/botlit/hooks/internal/workspaceGateway.d.ts +7 -0
  12. package/dist/botlit/hooks/internal/workspaceGateway.js +42 -22
  13. package/dist/botlit/hooks/internal/workspaceGateway.js.map +1 -1
  14. package/dist/botlit/hooks/useAgentBindings.d.ts +58 -0
  15. package/dist/botlit/hooks/useAgentBindings.js +87 -0
  16. package/dist/botlit/hooks/useAgentBindings.js.map +1 -0
  17. package/dist/botlit/hooks/useChannelSetup.d.ts +2 -1
  18. package/dist/botlit/hooks/useChannelSetup.js +61 -52
  19. package/dist/botlit/hooks/useChannelSetup.js.map +1 -1
  20. package/dist/botlit/hooks/useChannels.d.ts +9 -0
  21. package/dist/botlit/hooks/useChannels.js +83 -73
  22. package/dist/botlit/hooks/useChannels.js.map +1 -1
  23. package/dist/botlit/hooks/useUserPlatformConnection.js +98 -78
  24. package/dist/botlit/hooks/useUserPlatformConnection.js.map +1 -1
  25. package/dist/botlit/pages/AgentDetailPage.js +56 -55
  26. package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
  27. package/dist/botlit/pages/BotChannelsTab.js +457 -242
  28. package/dist/botlit/pages/BotChannelsTab.js.map +1 -1
  29. package/dist/botlit/pages/PromptStudioPage.js +365 -175
  30. package/dist/botlit/pages/PromptStudioPage.js.map +1 -1
  31. package/dist/botlit/permissions/index.js +3 -3
  32. package/dist/botlit/permissions/useBotmanorPermissions.js +5 -2
  33. package/dist/botlit/permissions/useBotmanorPermissions.js.map +1 -1
  34. package/dist/botlit/utils/promptVariables.d.ts +6 -0
  35. package/dist/botlit/utils/promptVariables.js +20 -0
  36. package/dist/botlit/utils/promptVariables.js.map +1 -0
  37. package/dist/generated/wspace-operations.d.ts +314 -0
  38. package/dist/generated/wspace-operations.js +189 -101
  39. package/dist/generated/wspace-operations.js.map +1 -1
  40. package/dist/generated/wspace-types.d.ts +139 -0
  41. package/dist/generated/wspace-types.js +3 -1
  42. package/dist/generated/wspace-types.js.map +1 -1
  43. 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 { BOTMANOR_PERMISSIONS as s } from "../permissions/botmanorPermissions.js";
5
- import { BotmanorPermissionGate as c } from "../permissions/useBotmanorPermissions.js";
6
- import { FormField as l, Input as u, Textarea as d } from "../components/Input.js";
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 p } from "../components/EmptyState.js";
9
- import { ErrorState as m } from "../components/ErrorState.js";
10
- import { useBotlit as h } from "../providers/BotlitProvider.js";
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 { graphqlErrorMessage as g } from "../utils/errors.js";
13
- import { formatRelativeTime as _ } from "../utils/formatters.js";
14
- import { promptTemplateVariables as v, usePromptTemplates as y, useRenderPromptTemplate as b } from "../hooks/usePromptTemplates.js";
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 x, useMemo as S, useState as C } from "react";
17
- import { GlassCard as w, PagePurpose as T } from "@burdenoff/fe-libs/ui";
18
- import { jsx as E, jsxs as D } from "react/jsx-runtime";
19
- import { Play as O, Plus as k, Tag as A } from "lucide-react";
20
- import { toast as j } from "sonner";
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
- function M(e) {
23
- if (!e || typeof e != "object" || Array.isArray(e)) return null;
24
- let t = e, n = typeof t.name == "string" ? t.name : void 0;
25
- return n ? {
26
- name: n,
27
- type: typeof t.type == "string" ? t.type : "string",
28
- description: typeof t.description == "string" ? t.description : void 0,
29
- required: t.required === !0,
30
- defaultValue: t.defaultValue
31
- } : null;
32
- }
33
- function N(e) {
34
- return e ? v(e).map(M).filter((e) => e !== null) : [];
35
- }
36
- var P = () => {
37
- let { navigateTo: v } = h(), { data: M, loading: P, error: F, refetch: I } = y(), { render: L, loading: R } = b(), [z, B] = C(null), [V, H] = C({}), [U, W] = C("");
38
- x(() => {
39
- !z && M.length > 0 && B(M[0].id);
40
- }, [M, z]);
41
- let G = S(() => M.find((e) => e.id === z), [M, z]), K = S(() => N(G), [G]), q = async () => {
42
- if (G) try {
43
- let e = await L({
44
- templateId: G.id,
45
- variables: V
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
- W(e);
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
- j.error(g(e, "Failed to render prompt"));
130
+ _e.error(h(e, "Failed to save the prompt version"));
50
131
  }
51
132
  };
52
- return /* @__PURE__ */ E(e, {
133
+ return /* @__PURE__ */ x(e, {
53
134
  title: "Prompt Studio",
54
- description: "Create, test, and manage prompts for your AI agents",
55
- actions: /* @__PURE__ */ E(c, {
56
- permission: s.PROMPT_TEMPLATE_CREATE,
57
- children: /* @__PURE__ */ E(o, {
58
- leftIcon: /* @__PURE__ */ E(k, { size: 16 }),
59
- onClick: () => v("prompt-templates/new"),
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__ */ D("div", {
144
+ children: /* @__PURE__ */ S("div", {
64
145
  className: "space-y-6",
65
- children: [/* @__PURE__ */ E(T, {
66
- icon: /* @__PURE__ */ E(O, { size: 18 }),
67
- children: "Prompt Studio is your interactive workbench for writing and testing prompts before they go live. Pick a prompt, edit its text and variables on the left, then fill in sample values and hit Run Test to preview exactly what the agent will receive — so you can iterate on wording and catch mistakes here instead of in production."
68
- }), /* @__PURE__ */ D("div", {
69
- className: "grid grid-cols-12 gap-6",
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__ */ E("div", {
72
- className: "col-span-3",
73
- children: /* @__PURE__ */ D(t, { children: [/* @__PURE__ */ E(i, { children: /* @__PURE__ */ E(a, {
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__ */ E(n, {
157
+ }) }), /* @__PURE__ */ x(n, {
77
158
  className: "p-0",
78
- children: P ? /* @__PURE__ */ E("div", {
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__ */ E("div", { className: "h-14 bg-bg-sunken motion-safe:animate-vc-shimmer rounded" }, e))
85
- }) : F ? /* @__PURE__ */ E(m, {
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: F,
88
- onRetry: () => void I(),
168
+ error: E,
169
+ onRetry: () => void D(),
89
170
  className: "m-4"
90
- }) : M.length === 0 ? /* @__PURE__ */ E("p", {
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__ */ E("div", {
174
+ }) : /* @__PURE__ */ x("div", {
94
175
  className: "divide-y divide-border-subtle",
95
- children: M.map((e) => /* @__PURE__ */ D("button", {
176
+ children: T.map((e) => /* @__PURE__ */ S("button", {
96
177
  type: "button",
97
- className: `w-full text-left p-4 hover:bg-accent transition-colors ${G?.id === e.id ? "bg-accent" : ""}`,
98
- onClick: () => {
99
- B(e.id), H({}), W("");
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__ */ E("p", {
103
- className: "font-medium truncate",
182
+ /* @__PURE__ */ x("p", {
183
+ className: "truncate font-medium",
104
184
  children: e.name
105
185
  }),
106
- /* @__PURE__ */ D("p", {
107
- className: "text-xs text-text-secondary mt-1 truncate",
186
+ /* @__PURE__ */ S("p", {
187
+ className: "mt-1 truncate text-xs text-text-secondary",
108
188
  children: ["v", e.version]
109
189
  }),
110
- /* @__PURE__ */ D("div", {
111
- className: "flex items-center gap-2 mt-2",
112
- children: [e.visibility === "PUBLIC" && /* @__PURE__ */ E(f, {
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__ */ D("span", {
196
+ }), /* @__PURE__ */ S("span", {
117
197
  className: "text-xs text-text-secondary",
118
- children: [N(e).length, " vars"]
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__ */ E("div", {
127
- className: "col-span-6",
128
- children: G ? /* @__PURE__ */ D(w, {
129
- treatment: "glass",
130
- glow: !0,
131
- className: "overflow-hidden",
132
- children: [/* @__PURE__ */ D(i, {
133
- className: "flex flex-row items-center justify-between",
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
- onClick: () => v(`prompt-templates/${G.id}`),
138
- children: "Open template"
139
- })]
140
- }), /* @__PURE__ */ D(n, {
141
- className: "space-y-4",
142
- children: [
143
- /* @__PURE__ */ D("div", {
144
- className: "flex items-center gap-2",
145
- children: [/* @__PURE__ */ E(A, {
146
- size: 14,
147
- className: "text-text-secondary"
148
- }), G.tags.map((e) => /* @__PURE__ */ E(f, {
149
- variant: "secondary",
150
- children: e
151
- }, e))]
152
- }),
153
- /* @__PURE__ */ E(l, {
154
- label: "Prompt Content",
155
- children: /* @__PURE__ */ E(d, {
156
- value: G.templateText,
157
- rows: 15,
158
- readOnly: !0,
159
- className: "font-mono text-sm"
160
- })
161
- }),
162
- K.length > 0 && /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
163
- className: "text-sm font-medium mb-2",
164
- children: "Variables"
165
- }), /* @__PURE__ */ E("div", {
166
- className: "space-y-2",
167
- children: K.map((e) => /* @__PURE__ */ D("div", {
168
- className: "flex items-center gap-4 p-3 bg-bg-sunken rounded-lg",
169
- children: [/* @__PURE__ */ D("div", {
170
- className: "flex-1",
171
- children: [/* @__PURE__ */ D("p", {
172
- className: "font-medium text-sm",
173
- children: [`{{${e.name}}}`, e.required && /* @__PURE__ */ E("span", {
174
- className: "text-status-error-text ml-1",
175
- children: "*"
176
- })]
177
- }), e.description && /* @__PURE__ */ E("p", {
178
- className: "text-xs text-text-secondary",
179
- children: e.description
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
- }), /* @__PURE__ */ E(f, {
182
- variant: "outline",
183
- className: "capitalize",
184
- children: e.type
185
- })]
186
- }, e.name))
187
- })] }),
188
- /* @__PURE__ */ D("div", {
189
- className: "pt-4 text-xs text-text-secondary",
190
- children: ["Updated ", _(G.updatedAt)]
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
- }) : /* @__PURE__ */ E(p, {
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 view and edit"
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__ */ E("div", {
201
- className: "col-span-3",
202
- children: /* @__PURE__ */ D(t, { children: [/* @__PURE__ */ E(i, { children: /* @__PURE__ */ D(a, {
203
- className: "text-base flex items-center gap-2",
204
- children: [/* @__PURE__ */ E(O, { size: 16 }), "Test Prompt"]
205
- }) }), /* @__PURE__ */ D(n, {
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
- K.map((e) => /* @__PURE__ */ E(l, {
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__ */ E(u, {
211
- placeholder: e.description || `Enter ${e.name}`,
212
- value: V[e.name] || "",
213
- onChange: (t) => H({
214
- ...V,
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__ */ E(c, {
220
- permission: s.PROMPT_TEMPLATE_EXECUTE,
221
- children: /* @__PURE__ */ E(o, {
222
- className: "w-full",
223
- onClick: () => void q(),
224
- isLoading: R,
225
- disabled: !G,
226
- children: "Run Test"
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
- U && /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
230
- className: "text-sm font-medium mb-2",
231
- children: "Output"
232
- }), /* @__PURE__ */ E("div", {
233
- className: "p-3 bg-bg-sunken rounded-lg text-sm whitespace-pre-wrap font-mono max-h-64 overflow-auto",
234
- children: U
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 { P as PromptStudioPage };
434
+ export { T as PromptStudioPage };
245
435
 
246
436
  //# sourceMappingURL=PromptStudioPage.js.map