@burdenoff/microfe-botmanor 2026.1101.1 → 2026.1101.2
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/hooks/internal/workspaceGateway.js +39 -37
- package/dist/botlit/hooks/internal/workspaceGateway.js.map +1 -1
- package/dist/botlit/pages/PromptStudioPage.js +41 -41
- package/dist/botlit/pages/PromptTemplateDetailPage.js +107 -107
- package/dist/botlit/pages/PromptTemplateDetailPage.js.map +1 -1
- package/dist/botlit/utils/errors.js +22 -11
- package/dist/botlit/utils/errors.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { useBotlit as e } from "../providers/BotlitProvider.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { graphqlErrorMessage as t } from "../utils/errors.js";
|
|
3
|
+
import { formatRelativeTime as n } from "../utils/formatters.js";
|
|
4
|
+
import { BOTMANOR_PERMISSIONS as r } from "../permissions/botmanorPermissions.js";
|
|
5
|
+
import { BotmanorPermissionGate as i } from "../permissions/useBotmanorPermissions.js";
|
|
6
|
+
import { PageLayout as a } from "../components/PageLayout.js";
|
|
7
|
+
import { Button as o } from "../components/Button.js";
|
|
7
8
|
import "../permissions/index.js";
|
|
8
|
-
import { Card as
|
|
9
|
-
import { Badge as
|
|
10
|
-
import { isNative as
|
|
9
|
+
import { Card as s, CardContent as c, CardDescription as l, CardHeader as u, CardTitle as d } from "../components/Card.js";
|
|
10
|
+
import { Badge as f, StatusBadge as ee } from "../components/Badge.js";
|
|
11
|
+
import { isNative as p, nativeCopyText as te, nativeImpact as ne, nativeNotify as m, nativeToast as re } from "../../utils/nativeBridge.js";
|
|
11
12
|
import { EmptyState as ie } from "../components/EmptyState.js";
|
|
12
|
-
import { FormField as
|
|
13
|
-
import { toUnion as
|
|
14
|
-
import { promptTemplateExamples as
|
|
13
|
+
import { FormField as h, Input as g, Textarea as _ } from "../components/Input.js";
|
|
14
|
+
import { toUnion as v } from "../utils/unions.js";
|
|
15
|
+
import { promptTemplateExamples as ae, promptTemplateVariables as oe, useCreatePromptTemplate as se, useDeletePromptTemplate as ce, usePromptTemplate as le, useRenderPromptTemplate as ue, useUpdatePromptTemplate as de } from "../hooks/usePromptTemplates.js";
|
|
15
16
|
import "../hooks/index.js";
|
|
16
|
-
import { graphqlErrorMessage as de } from "../utils/errors.js";
|
|
17
17
|
import { useMemo as fe, useState as y } from "react";
|
|
18
18
|
import { PagePurpose as pe } from "@burdenoff/fe-libs/ui";
|
|
19
19
|
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
@@ -32,7 +32,7 @@ var j = [
|
|
|
32
32
|
"WORKSPACE",
|
|
33
33
|
"PUBLIC"
|
|
34
34
|
], M = ({ isNew: M }) => {
|
|
35
|
-
let { templateId: xe } = me(), { navigateTo: N } = e(), { data: P, loading: Se } =
|
|
35
|
+
let { templateId: xe } = me(), { navigateTo: N } = e(), { data: P, loading: Se } = le(M ? void 0 : xe), { create: Ce, loading: we } = se(), { update: Te, loading: Ee } = de(), { remove: De, loading: Oe } = ce(), { render: ke, loading: Ae } = ue(), [F, I] = y("edit"), [L, R] = y(!1), [z, je] = y({}), [B, V] = y(null), [H, U] = y(null), [W, G] = y(!1), [Me, K] = y(!1), [q, J] = y({
|
|
36
36
|
name: "",
|
|
37
37
|
slug: "",
|
|
38
38
|
description: "",
|
|
@@ -99,21 +99,21 @@ var j = [
|
|
|
99
99
|
variables: z
|
|
100
100
|
}));
|
|
101
101
|
} catch (e) {
|
|
102
|
-
let
|
|
103
|
-
V(null), U(
|
|
102
|
+
let n = t(e, "Failed to render prompt template");
|
|
103
|
+
V(null), U(n), A.error(n);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
}, Le = async () => {
|
|
107
|
-
await te(P?.templateText || q.templateText), R(!0),
|
|
107
|
+
await te(P?.templateText || q.templateText), R(!0), p() && re("Copied"), setTimeout(() => R(!1), 2e3);
|
|
108
108
|
}, Re = () => {
|
|
109
109
|
P && (J({
|
|
110
110
|
name: P.name,
|
|
111
111
|
slug: P.slug,
|
|
112
112
|
description: P.description || "",
|
|
113
|
-
visibility:
|
|
113
|
+
visibility: v(P.visibility, be, "PRIVATE"),
|
|
114
114
|
templateText: P.templateText,
|
|
115
|
-
variables:
|
|
116
|
-
exampleInputs:
|
|
115
|
+
variables: oe(P),
|
|
116
|
+
exampleInputs: ae(P)
|
|
117
117
|
}), G(!0));
|
|
118
118
|
}, ze = async () => {
|
|
119
119
|
if (!(!P || !q.name || !q.slug)) {
|
|
@@ -138,21 +138,21 @@ var j = [
|
|
|
138
138
|
}
|
|
139
139
|
}, Be = async () => {
|
|
140
140
|
if (P) try {
|
|
141
|
-
await De(P.id),
|
|
141
|
+
await De(P.id), p() && m("success"), N("prompt-templates");
|
|
142
142
|
} catch (e) {
|
|
143
|
-
throw
|
|
143
|
+
throw p() && m("error"), e;
|
|
144
144
|
}
|
|
145
145
|
}, Z = (e) => e.replace(/\{\{(\w+)\}\}/g, "<span class=\"bg-action-primary-bg/20 text-primary px-1 rounded font-mono\">{{$1}}</span>");
|
|
146
|
-
if (M) return /* @__PURE__ */ x(
|
|
146
|
+
if (M) return /* @__PURE__ */ x(a, {
|
|
147
147
|
title: "Create Prompt Template",
|
|
148
148
|
description: "Define a reusable prompt template with variables",
|
|
149
149
|
actions: /* @__PURE__ */ S("div", {
|
|
150
150
|
className: "flex gap-2",
|
|
151
|
-
children: [/* @__PURE__ */ x(
|
|
151
|
+
children: [/* @__PURE__ */ x(o, {
|
|
152
152
|
variant: "outline",
|
|
153
153
|
onClick: () => N("prompt-templates"),
|
|
154
154
|
children: "Cancel"
|
|
155
|
-
}), /* @__PURE__ */ x(
|
|
155
|
+
}), /* @__PURE__ */ x(o, {
|
|
156
156
|
leftIcon: /* @__PURE__ */ x(D, { size: 16 }),
|
|
157
157
|
onClick: Ne,
|
|
158
158
|
isLoading: we,
|
|
@@ -165,15 +165,15 @@ var j = [
|
|
|
165
165
|
children: [/* @__PURE__ */ S("div", {
|
|
166
166
|
className: "lg:col-span-2 space-y-6",
|
|
167
167
|
children: [
|
|
168
|
-
/* @__PURE__ */ S(
|
|
168
|
+
/* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(u, { children: /* @__PURE__ */ x(d, { children: "Basic Information" }) }), /* @__PURE__ */ S(c, {
|
|
169
169
|
className: "space-y-4",
|
|
170
170
|
children: [
|
|
171
171
|
/* @__PURE__ */ S("div", {
|
|
172
172
|
className: "grid grid-cols-2 gap-4",
|
|
173
|
-
children: [/* @__PURE__ */ x(
|
|
173
|
+
children: [/* @__PURE__ */ x(h, {
|
|
174
174
|
label: "Template Name",
|
|
175
175
|
required: !0,
|
|
176
|
-
children: /* @__PURE__ */ x(
|
|
176
|
+
children: /* @__PURE__ */ x(g, {
|
|
177
177
|
placeholder: "e.g., Technical Support Template",
|
|
178
178
|
value: q.name,
|
|
179
179
|
onChange: (e) => J({
|
|
@@ -181,11 +181,11 @@ var j = [
|
|
|
181
181
|
name: e.target.value
|
|
182
182
|
})
|
|
183
183
|
})
|
|
184
|
-
}), /* @__PURE__ */ x(
|
|
184
|
+
}), /* @__PURE__ */ x(h, {
|
|
185
185
|
label: "Slug",
|
|
186
186
|
required: !0,
|
|
187
187
|
description: "Unique identifier (lowercase, dashes)",
|
|
188
|
-
children: /* @__PURE__ */ x(
|
|
188
|
+
children: /* @__PURE__ */ x(g, {
|
|
189
189
|
placeholder: "e.g., technical-support",
|
|
190
190
|
value: q.slug,
|
|
191
191
|
onChange: (e) => J({
|
|
@@ -195,9 +195,9 @@ var j = [
|
|
|
195
195
|
})
|
|
196
196
|
})]
|
|
197
197
|
}),
|
|
198
|
-
/* @__PURE__ */ x(
|
|
198
|
+
/* @__PURE__ */ x(h, {
|
|
199
199
|
label: "Description",
|
|
200
|
-
children: /* @__PURE__ */ x(
|
|
200
|
+
children: /* @__PURE__ */ x(_, {
|
|
201
201
|
placeholder: "What is this template used for?",
|
|
202
202
|
value: q.description,
|
|
203
203
|
onChange: (e) => J({
|
|
@@ -207,7 +207,7 @@ var j = [
|
|
|
207
207
|
rows: 2
|
|
208
208
|
})
|
|
209
209
|
}),
|
|
210
|
-
/* @__PURE__ */ x(
|
|
210
|
+
/* @__PURE__ */ x(h, {
|
|
211
211
|
label: "Visibility",
|
|
212
212
|
children: /* @__PURE__ */ S("select", {
|
|
213
213
|
className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
|
|
@@ -234,14 +234,14 @@ var j = [
|
|
|
234
234
|
})
|
|
235
235
|
]
|
|
236
236
|
})] }),
|
|
237
|
-
/* @__PURE__ */ S(
|
|
237
|
+
/* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ S(d, {
|
|
238
238
|
className: "flex items-center gap-2",
|
|
239
239
|
children: [/* @__PURE__ */ x(C, { size: 18 }), "Template Content"]
|
|
240
|
-
}), /* @__PURE__ */ S(
|
|
240
|
+
}), /* @__PURE__ */ S(l, { children: [
|
|
241
241
|
"Use ",
|
|
242
242
|
"{{variable_name}}",
|
|
243
243
|
" syntax for variables"
|
|
244
|
-
] })] }), /* @__PURE__ */ S(
|
|
244
|
+
] })] }), /* @__PURE__ */ S(c, { children: [/* @__PURE__ */ x(_, {
|
|
245
245
|
className: "font-mono text-sm min-h-[300px]",
|
|
246
246
|
placeholder: "You are a helpful assistant for {{company_name}}.\n\nYour role is to help users with {{task_type}}.\n\nGuidelines:\n- Be helpful and friendly\n- Provide accurate information\n- Reference: {{docs_url}}",
|
|
247
247
|
value: q.templateText,
|
|
@@ -254,54 +254,54 @@ var j = [
|
|
|
254
254
|
children: [/* @__PURE__ */ x("span", {
|
|
255
255
|
className: "text-sm text-text-secondary",
|
|
256
256
|
children: "Detected variables:"
|
|
257
|
-
}), Y.map((e) => /* @__PURE__ */ x(
|
|
257
|
+
}), Y.map((e) => /* @__PURE__ */ x(f, {
|
|
258
258
|
variant: "secondary",
|
|
259
259
|
className: "font-mono",
|
|
260
260
|
children: e
|
|
261
261
|
}, e))]
|
|
262
262
|
})] })] }),
|
|
263
|
-
/* @__PURE__ */ S(
|
|
263
|
+
/* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ S(d, {
|
|
264
264
|
className: "flex items-center justify-between",
|
|
265
265
|
children: [/* @__PURE__ */ S("span", {
|
|
266
266
|
className: "flex items-center gap-2",
|
|
267
267
|
children: [/* @__PURE__ */ x(k, { size: 18 }), "Variables"]
|
|
268
|
-
}), /* @__PURE__ */ x(
|
|
268
|
+
}), /* @__PURE__ */ x(o, {
|
|
269
269
|
variant: "outline",
|
|
270
270
|
size: "sm",
|
|
271
271
|
onClick: Pe,
|
|
272
272
|
children: "Add Variable"
|
|
273
273
|
})]
|
|
274
|
-
}), /* @__PURE__ */ x(
|
|
274
|
+
}), /* @__PURE__ */ x(l, { children: "Define the variables used in your template" })] }), /* @__PURE__ */ x(c, { children: q.variables.length > 0 ? /* @__PURE__ */ x("div", {
|
|
275
275
|
className: "space-y-4",
|
|
276
276
|
children: q.variables.map((e, t) => /* @__PURE__ */ S("div", {
|
|
277
277
|
className: "p-4 border rounded-lg bg-bg-sunken/30 space-y-3",
|
|
278
278
|
children: [/* @__PURE__ */ S("div", {
|
|
279
279
|
className: "grid grid-cols-4 gap-3",
|
|
280
280
|
children: [
|
|
281
|
-
/* @__PURE__ */ x(
|
|
281
|
+
/* @__PURE__ */ x(h, {
|
|
282
282
|
label: "Name",
|
|
283
|
-
children: /* @__PURE__ */ x(
|
|
283
|
+
children: /* @__PURE__ */ x(g, {
|
|
284
284
|
className: "font-mono",
|
|
285
285
|
placeholder: "variable_name",
|
|
286
286
|
value: e.name,
|
|
287
287
|
onChange: (e) => X(t, { name: e.target.value })
|
|
288
288
|
})
|
|
289
289
|
}),
|
|
290
|
-
/* @__PURE__ */ x(
|
|
290
|
+
/* @__PURE__ */ x(h, {
|
|
291
291
|
label: "Type",
|
|
292
292
|
children: /* @__PURE__ */ x("select", {
|
|
293
293
|
className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
|
|
294
294
|
value: e.type,
|
|
295
|
-
onChange: (e) => X(t, { type:
|
|
295
|
+
onChange: (e) => X(t, { type: v(e.target.value, j, "string") }),
|
|
296
296
|
children: j.map((e) => /* @__PURE__ */ x("option", {
|
|
297
297
|
value: e,
|
|
298
298
|
children: e
|
|
299
299
|
}, e))
|
|
300
300
|
})
|
|
301
301
|
}),
|
|
302
|
-
/* @__PURE__ */ x(
|
|
302
|
+
/* @__PURE__ */ x(h, {
|
|
303
303
|
label: "Default Value",
|
|
304
|
-
children: /* @__PURE__ */ x(
|
|
304
|
+
children: /* @__PURE__ */ x(g, {
|
|
305
305
|
placeholder: "Optional",
|
|
306
306
|
value: String(e.defaultValue || ""),
|
|
307
307
|
onChange: (e) => X(t, { defaultValue: e.target.value || void 0 })
|
|
@@ -320,7 +320,7 @@ var j = [
|
|
|
320
320
|
className: "text-sm",
|
|
321
321
|
children: "Required"
|
|
322
322
|
})]
|
|
323
|
-
}), /* @__PURE__ */ x(
|
|
323
|
+
}), /* @__PURE__ */ x(o, {
|
|
324
324
|
variant: "ghost",
|
|
325
325
|
size: "sm",
|
|
326
326
|
className: "text-status-error-text",
|
|
@@ -329,9 +329,9 @@ var j = [
|
|
|
329
329
|
})]
|
|
330
330
|
})
|
|
331
331
|
]
|
|
332
|
-
}), /* @__PURE__ */ x(
|
|
332
|
+
}), /* @__PURE__ */ x(h, {
|
|
333
333
|
label: "Description",
|
|
334
|
-
children: /* @__PURE__ */ x(
|
|
334
|
+
children: /* @__PURE__ */ x(g, {
|
|
335
335
|
placeholder: "What is this variable for?",
|
|
336
336
|
value: e.description || "",
|
|
337
337
|
onChange: (e) => X(t, { description: e.target.value })
|
|
@@ -356,13 +356,13 @@ var j = [
|
|
|
356
356
|
]
|
|
357
357
|
}), /* @__PURE__ */ S("div", {
|
|
358
358
|
className: "space-y-6",
|
|
359
|
-
children: [/* @__PURE__ */ S(
|
|
359
|
+
children: [/* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(u, { children: /* @__PURE__ */ S(d, {
|
|
360
360
|
className: "flex items-center gap-2",
|
|
361
361
|
children: [/* @__PURE__ */ x(w, { size: 18 }), "Preview"]
|
|
362
|
-
}) }), /* @__PURE__ */ x(
|
|
362
|
+
}) }), /* @__PURE__ */ x(c, { children: /* @__PURE__ */ x("div", {
|
|
363
363
|
className: "p-4 bg-bg-sunken rounded-lg text-sm whitespace-pre-wrap font-mono",
|
|
364
364
|
dangerouslySetInnerHTML: { __html: Z(q.templateText || "Enter template text...") }
|
|
365
|
-
}) })] }), /* @__PURE__ */ S(
|
|
365
|
+
}) })] }), /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(u, { children: /* @__PURE__ */ x(d, { children: "Quick Tips" }) }), /* @__PURE__ */ S(c, {
|
|
366
366
|
className: "text-sm space-y-2",
|
|
367
367
|
children: [
|
|
368
368
|
/* @__PURE__ */ S("p", { children: [
|
|
@@ -386,28 +386,28 @@ var j = [
|
|
|
386
386
|
})]
|
|
387
387
|
})
|
|
388
388
|
});
|
|
389
|
-
if (Se) return /* @__PURE__ */ x(
|
|
389
|
+
if (Se) return /* @__PURE__ */ x(a, {
|
|
390
390
|
title: "Loading...",
|
|
391
391
|
children: /* @__PURE__ */ x("div", { className: "h-96 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" })
|
|
392
392
|
});
|
|
393
|
-
if (!P) return /* @__PURE__ */ x(
|
|
393
|
+
if (!P) return /* @__PURE__ */ x(a, {
|
|
394
394
|
title: "Template Not Found",
|
|
395
395
|
children: /* @__PURE__ */ x(ie, {
|
|
396
396
|
illustration: "empty-files",
|
|
397
397
|
title: "Template Not Found",
|
|
398
398
|
description: "This prompt template doesn't exist.",
|
|
399
|
-
action: /* @__PURE__ */ x(
|
|
399
|
+
action: /* @__PURE__ */ x(o, {
|
|
400
400
|
onClick: () => N("prompt-templates"),
|
|
401
401
|
children: "Back to Templates"
|
|
402
402
|
})
|
|
403
403
|
})
|
|
404
404
|
});
|
|
405
|
-
let Q =
|
|
406
|
-
return /* @__PURE__ */ x(
|
|
405
|
+
let Q = oe(P), $ = ae(P);
|
|
406
|
+
return /* @__PURE__ */ x(a, {
|
|
407
407
|
title: /* @__PURE__ */ S("div", {
|
|
408
408
|
className: "flex items-center gap-3",
|
|
409
409
|
children: [
|
|
410
|
-
/* @__PURE__ */ x(
|
|
410
|
+
/* @__PURE__ */ x(o, {
|
|
411
411
|
variant: "ghost",
|
|
412
412
|
size: "icon",
|
|
413
413
|
onClick: () => N("prompt-templates"),
|
|
@@ -422,7 +422,7 @@ var j = [
|
|
|
422
422
|
children: [
|
|
423
423
|
/* @__PURE__ */ x("span", { children: P.name }),
|
|
424
424
|
/* @__PURE__ */ x(ee, { status: P.status }),
|
|
425
|
-
/* @__PURE__ */ S(
|
|
425
|
+
/* @__PURE__ */ S(f, {
|
|
426
426
|
variant: "secondary",
|
|
427
427
|
className: "font-mono",
|
|
428
428
|
children: ["v", P.version]
|
|
@@ -440,26 +440,26 @@ var j = [
|
|
|
440
440
|
}),
|
|
441
441
|
actions: /* @__PURE__ */ S("div", {
|
|
442
442
|
className: "flex gap-2",
|
|
443
|
-
children: [/* @__PURE__ */ x(
|
|
443
|
+
children: [/* @__PURE__ */ x(o, {
|
|
444
444
|
variant: "outline",
|
|
445
445
|
leftIcon: x(L ? ge : _e, { size: 16 }),
|
|
446
446
|
onClick: Le,
|
|
447
447
|
children: L ? "Copied!" : "Copy"
|
|
448
|
-
}), W ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(
|
|
448
|
+
}), W ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(o, {
|
|
449
449
|
variant: "outline",
|
|
450
450
|
onClick: () => G(!1),
|
|
451
451
|
children: "Cancel"
|
|
452
|
-
}), /* @__PURE__ */ x(
|
|
452
|
+
}), /* @__PURE__ */ x(o, {
|
|
453
453
|
leftIcon: /* @__PURE__ */ x(D, { size: 16 }),
|
|
454
454
|
onClick: ze,
|
|
455
455
|
isLoading: Ee,
|
|
456
456
|
disabled: !q.name || !q.slug,
|
|
457
457
|
children: "Save Changes"
|
|
458
|
-
})] }) : Me ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(
|
|
458
|
+
})] }) : Me ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(o, {
|
|
459
459
|
variant: "outline",
|
|
460
460
|
onClick: () => K(!1),
|
|
461
461
|
children: "Cancel"
|
|
462
|
-
}), /* @__PURE__ */ x(
|
|
462
|
+
}), /* @__PURE__ */ x(o, {
|
|
463
463
|
variant: "destructive",
|
|
464
464
|
leftIcon: /* @__PURE__ */ x(O, { size: 16 }),
|
|
465
465
|
onClick: () => {
|
|
@@ -467,17 +467,17 @@ var j = [
|
|
|
467
467
|
},
|
|
468
468
|
isLoading: Oe,
|
|
469
469
|
children: "Confirm Delete"
|
|
470
|
-
})] }) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(
|
|
471
|
-
permission:
|
|
472
|
-
children: /* @__PURE__ */ x(
|
|
470
|
+
})] }) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(i, {
|
|
471
|
+
permission: r.PROMPT_TEMPLATE_UPDATE,
|
|
472
|
+
children: /* @__PURE__ */ x(o, {
|
|
473
473
|
variant: "outline",
|
|
474
474
|
leftIcon: /* @__PURE__ */ x(ve, { size: 16 }),
|
|
475
475
|
onClick: Re,
|
|
476
476
|
children: "Edit Template"
|
|
477
477
|
})
|
|
478
|
-
}), /* @__PURE__ */ x(
|
|
479
|
-
permission:
|
|
480
|
-
children: /* @__PURE__ */ x(
|
|
478
|
+
}), /* @__PURE__ */ x(i, {
|
|
479
|
+
permission: r.PROMPT_TEMPLATE_DELETE,
|
|
480
|
+
children: /* @__PURE__ */ x(o, {
|
|
481
481
|
variant: "outline",
|
|
482
482
|
leftIcon: /* @__PURE__ */ x(O, { size: 16 }),
|
|
483
483
|
onClick: () => K(!0),
|
|
@@ -497,15 +497,15 @@ var j = [
|
|
|
497
497
|
", its declared variables and example inputs, and its version history. Edit and preview it here to perfect the instructions, then reuse it across agents so they share consistent, version-controlled behaviour."
|
|
498
498
|
]
|
|
499
499
|
}),
|
|
500
|
-
W && /* @__PURE__ */ S(
|
|
500
|
+
W && /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ x(d, { children: "Edit Template" }), /* @__PURE__ */ x(l, { children: "Update template details and content" })] }), /* @__PURE__ */ S(c, {
|
|
501
501
|
className: "space-y-4",
|
|
502
502
|
children: [
|
|
503
503
|
/* @__PURE__ */ S("div", {
|
|
504
504
|
className: "grid grid-cols-2 gap-4",
|
|
505
|
-
children: [/* @__PURE__ */ x(
|
|
505
|
+
children: [/* @__PURE__ */ x(h, {
|
|
506
506
|
label: "Template Name",
|
|
507
507
|
required: !0,
|
|
508
|
-
children: /* @__PURE__ */ x(
|
|
508
|
+
children: /* @__PURE__ */ x(g, {
|
|
509
509
|
placeholder: "e.g., Technical Support Template",
|
|
510
510
|
value: q.name,
|
|
511
511
|
onChange: (e) => J({
|
|
@@ -513,11 +513,11 @@ var j = [
|
|
|
513
513
|
name: e.target.value
|
|
514
514
|
})
|
|
515
515
|
})
|
|
516
|
-
}), /* @__PURE__ */ x(
|
|
516
|
+
}), /* @__PURE__ */ x(h, {
|
|
517
517
|
label: "Slug",
|
|
518
518
|
required: !0,
|
|
519
519
|
description: "Unique identifier (lowercase, dashes)",
|
|
520
|
-
children: /* @__PURE__ */ x(
|
|
520
|
+
children: /* @__PURE__ */ x(g, {
|
|
521
521
|
placeholder: "e.g., technical-support",
|
|
522
522
|
value: q.slug,
|
|
523
523
|
onChange: (e) => J({
|
|
@@ -527,9 +527,9 @@ var j = [
|
|
|
527
527
|
})
|
|
528
528
|
})]
|
|
529
529
|
}),
|
|
530
|
-
/* @__PURE__ */ x(
|
|
530
|
+
/* @__PURE__ */ x(h, {
|
|
531
531
|
label: "Description",
|
|
532
|
-
children: /* @__PURE__ */ x(
|
|
532
|
+
children: /* @__PURE__ */ x(_, {
|
|
533
533
|
placeholder: "What is this template used for?",
|
|
534
534
|
value: q.description,
|
|
535
535
|
onChange: (e) => J({
|
|
@@ -539,7 +539,7 @@ var j = [
|
|
|
539
539
|
rows: 2
|
|
540
540
|
})
|
|
541
541
|
}),
|
|
542
|
-
/* @__PURE__ */ x(
|
|
542
|
+
/* @__PURE__ */ x(h, {
|
|
543
543
|
label: "Visibility",
|
|
544
544
|
children: /* @__PURE__ */ S("select", {
|
|
545
545
|
className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
|
|
@@ -564,10 +564,10 @@ var j = [
|
|
|
564
564
|
]
|
|
565
565
|
})
|
|
566
566
|
}),
|
|
567
|
-
/* @__PURE__ */ x(
|
|
567
|
+
/* @__PURE__ */ x(h, {
|
|
568
568
|
label: "Template Content",
|
|
569
569
|
description: "Use {{variable_name}} syntax for variables",
|
|
570
|
-
children: /* @__PURE__ */ x(
|
|
570
|
+
children: /* @__PURE__ */ x(_, {
|
|
571
571
|
className: "font-mono text-sm min-h-[200px]",
|
|
572
572
|
value: q.templateText,
|
|
573
573
|
onChange: (e) => J({
|
|
@@ -581,7 +581,7 @@ var j = [
|
|
|
581
581
|
children: [/* @__PURE__ */ x("span", {
|
|
582
582
|
className: "text-sm text-text-secondary",
|
|
583
583
|
children: "Detected variables:"
|
|
584
|
-
}), Y.map((e) => /* @__PURE__ */ x(
|
|
584
|
+
}), Y.map((e) => /* @__PURE__ */ x(f, {
|
|
585
585
|
variant: "secondary",
|
|
586
586
|
className: "font-mono",
|
|
587
587
|
children: e
|
|
@@ -592,10 +592,10 @@ var j = [
|
|
|
592
592
|
/* @__PURE__ */ S("div", {
|
|
593
593
|
className: "grid grid-cols-2 md:grid-cols-4 gap-4",
|
|
594
594
|
children: [
|
|
595
|
-
/* @__PURE__ */ x(
|
|
595
|
+
/* @__PURE__ */ x(s, {
|
|
596
596
|
treatment: "glass",
|
|
597
597
|
glow: !0,
|
|
598
|
-
children: /* @__PURE__ */ S(
|
|
598
|
+
children: /* @__PURE__ */ S(c, {
|
|
599
599
|
className: "pt-6 text-center",
|
|
600
600
|
children: [/* @__PURE__ */ x("p", {
|
|
601
601
|
className: "text-3xl font-bold text-text-primary",
|
|
@@ -606,7 +606,7 @@ var j = [
|
|
|
606
606
|
})]
|
|
607
607
|
})
|
|
608
608
|
}),
|
|
609
|
-
/* @__PURE__ */ x(
|
|
609
|
+
/* @__PURE__ */ x(s, { children: /* @__PURE__ */ S(c, {
|
|
610
610
|
className: "pt-6 text-center",
|
|
611
611
|
children: [/* @__PURE__ */ x("p", {
|
|
612
612
|
className: "text-3xl font-bold text-text-primary",
|
|
@@ -616,7 +616,7 @@ var j = [
|
|
|
616
616
|
children: "Examples"
|
|
617
617
|
})]
|
|
618
618
|
}) }),
|
|
619
|
-
/* @__PURE__ */ x(
|
|
619
|
+
/* @__PURE__ */ x(s, { children: /* @__PURE__ */ S(c, {
|
|
620
620
|
className: "pt-6 text-center",
|
|
621
621
|
children: [/* @__PURE__ */ x("p", {
|
|
622
622
|
className: "text-3xl font-bold text-text-primary",
|
|
@@ -626,7 +626,7 @@ var j = [
|
|
|
626
626
|
children: "Revision"
|
|
627
627
|
})]
|
|
628
628
|
}) }),
|
|
629
|
-
/* @__PURE__ */ x(
|
|
629
|
+
/* @__PURE__ */ x(s, { children: /* @__PURE__ */ S(c, {
|
|
630
630
|
className: "pt-6 text-center",
|
|
631
631
|
children: [/* @__PURE__ */ x("p", {
|
|
632
632
|
className: "text-lg font-bold text-text-primary capitalize",
|
|
@@ -641,17 +641,17 @@ var j = [
|
|
|
641
641
|
/* @__PURE__ */ S("div", {
|
|
642
642
|
className: "flex gap-2 border-b",
|
|
643
643
|
children: [
|
|
644
|
-
/* @__PURE__ */ S(
|
|
644
|
+
/* @__PURE__ */ S(o, {
|
|
645
645
|
variant: F === "edit" ? "default" : "ghost",
|
|
646
646
|
onClick: () => I("edit"),
|
|
647
647
|
children: [/* @__PURE__ */ x(C, { className: "h-4 w-4 mr-2" }), "Template"]
|
|
648
648
|
}),
|
|
649
|
-
/* @__PURE__ */ S(
|
|
649
|
+
/* @__PURE__ */ S(o, {
|
|
650
650
|
variant: F === "preview" ? "default" : "ghost",
|
|
651
651
|
onClick: () => I("preview"),
|
|
652
652
|
children: [/* @__PURE__ */ x(w, { className: "h-4 w-4 mr-2" }), "Preview"]
|
|
653
653
|
}),
|
|
654
|
-
/* @__PURE__ */ S(
|
|
654
|
+
/* @__PURE__ */ S(o, {
|
|
655
655
|
variant: F === "test" ? "default" : "ghost",
|
|
656
656
|
onClick: () => I("test"),
|
|
657
657
|
children: [/* @__PURE__ */ x(E, { className: "h-4 w-4 mr-2" }), "Test"]
|
|
@@ -662,11 +662,11 @@ var j = [
|
|
|
662
662
|
className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
|
|
663
663
|
children: [/* @__PURE__ */ x("div", {
|
|
664
664
|
className: "lg:col-span-2",
|
|
665
|
-
children: /* @__PURE__ */ S(
|
|
665
|
+
children: /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(u, { children: /* @__PURE__ */ x(d, { children: "Template Content" }) }), /* @__PURE__ */ x(c, { children: /* @__PURE__ */ x("div", {
|
|
666
666
|
className: "p-4 bg-bg-sunken rounded-lg font-mono text-sm whitespace-pre-wrap",
|
|
667
667
|
children: /* @__PURE__ */ x("div", { dangerouslySetInnerHTML: { __html: Z(P.templateText) } })
|
|
668
668
|
}) })] })
|
|
669
|
-
}), /* @__PURE__ */ x("div", { children: /* @__PURE__ */ S(
|
|
669
|
+
}), /* @__PURE__ */ x("div", { children: /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(u, { children: /* @__PURE__ */ S(d, {
|
|
670
670
|
className: "flex items-center gap-2",
|
|
671
671
|
children: [
|
|
672
672
|
/* @__PURE__ */ x(k, { size: 18 }),
|
|
@@ -674,7 +674,7 @@ var j = [
|
|
|
674
674
|
Q.length,
|
|
675
675
|
")"
|
|
676
676
|
]
|
|
677
|
-
}) }), /* @__PURE__ */ x(
|
|
677
|
+
}) }), /* @__PURE__ */ x(c, { children: Q.length > 0 ? /* @__PURE__ */ x("div", {
|
|
678
678
|
className: "space-y-3",
|
|
679
679
|
children: Q.map((e, t) => /* @__PURE__ */ S("div", {
|
|
680
680
|
className: "p-3 border rounded-lg",
|
|
@@ -686,11 +686,11 @@ var j = [
|
|
|
686
686
|
children: e.name
|
|
687
687
|
}), /* @__PURE__ */ S("div", {
|
|
688
688
|
className: "flex gap-1",
|
|
689
|
-
children: [/* @__PURE__ */ x(
|
|
689
|
+
children: [/* @__PURE__ */ x(f, {
|
|
690
690
|
variant: "outline",
|
|
691
691
|
className: "text-xs",
|
|
692
692
|
children: e.type
|
|
693
|
-
}), e.required && /* @__PURE__ */ x(
|
|
693
|
+
}), e.required && /* @__PURE__ */ x(f, {
|
|
694
694
|
variant: "destructive",
|
|
695
695
|
className: "text-xs",
|
|
696
696
|
children: "required"
|
|
@@ -719,7 +719,7 @@ var j = [
|
|
|
719
719
|
children: "No variables defined"
|
|
720
720
|
}) })] }) })]
|
|
721
721
|
}),
|
|
722
|
-
F === "preview" && /* @__PURE__ */ S(
|
|
722
|
+
F === "preview" && /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ x(d, { children: "Rendered Preview" }), /* @__PURE__ */ x(l, { children: "Preview with example inputs (first example set)" })] }), /* @__PURE__ */ x(c, { children: /* @__PURE__ */ x("div", {
|
|
723
723
|
className: "p-4 bg-bg-sunken rounded-lg font-mono text-sm whitespace-pre-wrap",
|
|
724
724
|
children: $[0] ? P.templateText.replace(/\{\{(\w+)\}\}/g, (e, t) => {
|
|
725
725
|
let n = $[0][t];
|
|
@@ -731,12 +731,12 @@ var j = [
|
|
|
731
731
|
}) })] }),
|
|
732
732
|
F === "test" && /* @__PURE__ */ S("div", {
|
|
733
733
|
className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
|
|
734
|
-
children: [/* @__PURE__ */ S(
|
|
734
|
+
children: [/* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ x(d, { children: "Test Inputs" }), /* @__PURE__ */ x(l, { children: "Enter values to test the template" })] }), /* @__PURE__ */ S(c, {
|
|
735
735
|
className: "space-y-4",
|
|
736
|
-
children: [Q.map((e) => /* @__PURE__ */ S(
|
|
736
|
+
children: [Q.map((e) => /* @__PURE__ */ S(h, {
|
|
737
737
|
label: e.name,
|
|
738
738
|
required: e.required,
|
|
739
|
-
children: [/* @__PURE__ */ x(
|
|
739
|
+
children: [/* @__PURE__ */ x(g, {
|
|
740
740
|
placeholder: e.defaultValue ? String(e.defaultValue) : `Enter ${e.name}`,
|
|
741
741
|
value: z[e.name] || "",
|
|
742
742
|
onChange: (t) => je({
|
|
@@ -747,9 +747,9 @@ var j = [
|
|
|
747
747
|
className: "text-xs text-text-secondary mt-1",
|
|
748
748
|
children: e.description
|
|
749
749
|
})]
|
|
750
|
-
}, e.name)), /* @__PURE__ */ x(
|
|
751
|
-
permission:
|
|
752
|
-
children: /* @__PURE__ */ x(
|
|
750
|
+
}, e.name)), /* @__PURE__ */ x(i, {
|
|
751
|
+
permission: r.PROMPT_TEMPLATE_EXECUTE,
|
|
752
|
+
children: /* @__PURE__ */ x(o, {
|
|
753
753
|
className: "w-full",
|
|
754
754
|
leftIcon: /* @__PURE__ */ x(E, { size: 16 }),
|
|
755
755
|
onClick: Ie,
|
|
@@ -757,7 +757,7 @@ var j = [
|
|
|
757
757
|
children: "Render Template"
|
|
758
758
|
})
|
|
759
759
|
})]
|
|
760
|
-
})] }), /* @__PURE__ */ S(
|
|
760
|
+
})] }), /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(u, { children: /* @__PURE__ */ x(d, { children: "Output" }) }), /* @__PURE__ */ x(c, { children: H ? /* @__PURE__ */ x("div", {
|
|
761
761
|
role: "alert",
|
|
762
762
|
className: "flex items-start gap-2 rounded-lg border border-status-error-border/40 bg-status-error-bg/10 px-3 py-2 text-sm text-status-error-text",
|
|
763
763
|
children: /* @__PURE__ */ x("p", { children: H })
|
|
@@ -769,7 +769,7 @@ var j = [
|
|
|
769
769
|
children: [/* @__PURE__ */ x(E, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }), /* @__PURE__ */ x("p", { children: "Enter inputs and click \"Render Template\" to see output" })]
|
|
770
770
|
}) })] })]
|
|
771
771
|
}),
|
|
772
|
-
$.length > 0 && F === "edit" && /* @__PURE__ */ S(
|
|
772
|
+
$.length > 0 && F === "edit" && /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ x(d, { children: "Example Inputs" }), /* @__PURE__ */ x(l, { children: "Pre-defined inputs for testing and documentation" })] }), /* @__PURE__ */ x(c, { children: /* @__PURE__ */ x("div", {
|
|
773
773
|
className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",
|
|
774
774
|
children: $.map((e, t) => /* @__PURE__ */ S("div", {
|
|
775
775
|
className: "p-4 border rounded-lg bg-bg-sunken/30",
|
|
@@ -791,10 +791,10 @@ var j = [
|
|
|
791
791
|
})]
|
|
792
792
|
}, t))
|
|
793
793
|
}) })] }),
|
|
794
|
-
/* @__PURE__ */ S(
|
|
794
|
+
/* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(u, { children: /* @__PURE__ */ S(d, {
|
|
795
795
|
className: "flex items-center gap-2",
|
|
796
796
|
children: [/* @__PURE__ */ x(ye, { size: 18 }), "Metadata"]
|
|
797
|
-
}) }), /* @__PURE__ */ x(
|
|
797
|
+
}) }), /* @__PURE__ */ x(c, { children: /* @__PURE__ */ S("div", {
|
|
798
798
|
className: "grid grid-cols-2 md:grid-cols-4 gap-6 text-sm",
|
|
799
799
|
children: [
|
|
800
800
|
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
|
|
@@ -802,21 +802,21 @@ var j = [
|
|
|
802
802
|
children: "Created"
|
|
803
803
|
}), /* @__PURE__ */ x("p", {
|
|
804
804
|
className: "font-medium",
|
|
805
|
-
children:
|
|
805
|
+
children: n(P.createdAt)
|
|
806
806
|
})] }),
|
|
807
807
|
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
|
|
808
808
|
className: "text-text-secondary",
|
|
809
809
|
children: "Updated"
|
|
810
810
|
}), /* @__PURE__ */ x("p", {
|
|
811
811
|
className: "font-medium",
|
|
812
|
-
children:
|
|
812
|
+
children: n(P.updatedAt)
|
|
813
813
|
})] }),
|
|
814
814
|
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
|
|
815
815
|
className: "text-text-secondary",
|
|
816
816
|
children: "Tags"
|
|
817
817
|
}), /* @__PURE__ */ x("div", {
|
|
818
818
|
className: "flex gap-1",
|
|
819
|
-
children: P.tags.length > 0 ? P.tags.map((e) => /* @__PURE__ */ x(
|
|
819
|
+
children: P.tags.length > 0 ? P.tags.map((e) => /* @__PURE__ */ x(f, {
|
|
820
820
|
variant: "secondary",
|
|
821
821
|
className: "text-xs",
|
|
822
822
|
children: e
|