agent-relay-server 0.105.0 → 0.105.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/docs/openapi.json +1 -1
- package/package.json +4 -2
- package/public/assets/{MessageBubble-CHor4Sxp.js → MessageBubble-CPYQQLDI.js} +2 -2
- package/public/assets/{MessageBubble-CHor4Sxp.js.map → MessageBubble-CPYQQLDI.js.map} +1 -1
- package/public/assets/{PlanGraphPanel-jHfkQBX6.js → PlanGraphPanel-B7xZt5DI.js} +2 -2
- package/public/assets/{PlanGraphPanel-jHfkQBX6.js.map → PlanGraphPanel-B7xZt5DI.js.map} +1 -1
- package/public/assets/{activity-DDXS6LsX.js → activity-UKQrQ8_0.js} +2 -2
- package/public/assets/{activity-DDXS6LsX.js.map → activity-UKQrQ8_0.js.map} +1 -1
- package/public/assets/{agent-profiles-Cn8lCTkg.js → agent-profiles-Zr_5nNEJ.js} +2 -2
- package/public/assets/{agent-profiles-Cn8lCTkg.js.map → agent-profiles-Zr_5nNEJ.js.map} +1 -1
- package/public/assets/{agents-DBTdcFFz.js → agents-FdrfmJsj.js} +2 -2
- package/public/assets/{agents-DBTdcFFz.js.map → agents-FdrfmJsj.js.map} +1 -1
- package/public/assets/{automation-L9wq4y5F.js → automation-DlEcJvgu.js} +2 -2
- package/public/assets/{automation-L9wq4y5F.js.map → automation-DlEcJvgu.js.map} +1 -1
- package/public/assets/{chat-BzMj_PO6.js → chat-D1bunuI-.js} +2 -2
- package/public/assets/{chat-BzMj_PO6.js.map → chat-D1bunuI-.js.map} +1 -1
- package/public/assets/{formatted-body-impl-CFWHLkCY.js → formatted-body-impl-4v9SkUD1.js} +2 -2
- package/public/assets/{formatted-body-impl-CFWHLkCY.js.map → formatted-body-impl-4v9SkUD1.js.map} +1 -1
- package/public/assets/{index-aCfZQ7LY.js → index-Vmhw442d.js} +5 -5
- package/public/assets/{index-aCfZQ7LY.js.map → index-Vmhw442d.js.map} +1 -1
- package/public/assets/{insights-BuPFE0tf.js → insights-CntgHcTp.js} +2 -2
- package/public/assets/{insights-BuPFE0tf.js.map → insights-CntgHcTp.js.map} +1 -1
- package/public/assets/{maintenance-wYwJ7w6h.js → maintenance-Dw7frQtu.js} +2 -2
- package/public/assets/{maintenance-wYwJ7w6h.js.map → maintenance-Dw7frQtu.js.map} +1 -1
- package/public/assets/{managed-agents-CKaYD93I.js → managed-agents-Bj--bFmZ.js} +2 -2
- package/public/assets/{managed-agents-CKaYD93I.js.map → managed-agents-Bj--bFmZ.js.map} +1 -1
- package/public/assets/{markdown-preview-impl-bf4eDQUM.js → markdown-preview-impl-DGLCocU8.js} +2 -2
- package/public/assets/{markdown-preview-impl-bf4eDQUM.js.map → markdown-preview-impl-DGLCocU8.js.map} +1 -1
- package/public/assets/{memory-DIneEza9.js → memory-yj2MIxUA.js} +2 -2
- package/public/assets/{memory-DIneEza9.js.map → memory-yj2MIxUA.js.map} +1 -1
- package/public/assets/{messages-DP9Vv_wh.js → messages-BT5mL7iz.js} +2 -2
- package/public/assets/{messages-DP9Vv_wh.js.map → messages-BT5mL7iz.js.map} +1 -1
- package/public/assets/{orchestrators-CAnKjxdO.js → orchestrators-BVDAhrPk.js} +2 -2
- package/public/assets/{orchestrators-CAnKjxdO.js.map → orchestrators-BVDAhrPk.js.map} +1 -1
- package/public/assets/{overview-B98U3C-y.js → overview-DlqJIqYK.js} +2 -2
- package/public/assets/{overview-B98U3C-y.js.map → overview-DlqJIqYK.js.map} +1 -1
- package/public/assets/{pairs-DVeeuxhY.js → pairs-DQ4tNCo3.js} +2 -2
- package/public/assets/{pairs-DVeeuxhY.js.map → pairs-DQ4tNCo3.js.map} +1 -1
- package/public/assets/prompt-settings-DlsqOP0C.js +2 -0
- package/public/assets/prompt-settings-DlsqOP0C.js.map +1 -0
- package/public/assets/{registry-DlLZyW7_.js → registry-Cw2fdWrn.js} +2 -2
- package/public/assets/{registry-DlLZyW7_.js.map → registry-Cw2fdWrn.js.map} +1 -1
- package/public/assets/{security-Bo4Ty3lz.js → security-ucr7IT1V.js} +2 -2
- package/public/assets/{security-Bo4Ty3lz.js.map → security-ucr7IT1V.js.map} +1 -1
- package/public/assets/{select-BguZ80M8.js → select-D8UWCtYZ.js} +2 -2
- package/public/assets/{select-BguZ80M8.js.map → select-D8UWCtYZ.js.map} +1 -1
- package/public/assets/{settings-CpX9Xw2j.js → settings-Dvf_ps1B.js} +2 -2
- package/public/assets/{settings-CpX9Xw2j.js.map → settings-Dvf_ps1B.js.map} +1 -1
- package/public/assets/{tasks-Cg1HXY9l.js → tasks-jRUvxUd5.js} +2 -2
- package/public/assets/{tasks-Cg1HXY9l.js.map → tasks-jRUvxUd5.js.map} +1 -1
- package/public/assets/{teams-BFcYunxB.js → teams-Dn0yggD-.js} +2 -2
- package/public/assets/{teams-BFcYunxB.js.map → teams-Dn0yggD-.js.map} +1 -1
- package/public/assets/{terminal-viewer-impl-CF2EBa2K.js → terminal-viewer-impl-fLly20IP.js} +2 -2
- package/public/assets/{terminal-viewer-impl-CF2EBa2K.js.map → terminal-viewer-impl-fLly20IP.js.map} +1 -1
- package/public/assets/{user-avatar-D1ffSClz.js → user-avatar-BWLUHt2e.js} +2 -2
- package/public/assets/{user-avatar-D1ffSClz.js.map → user-avatar-BWLUHt2e.js.map} +1 -1
- package/public/assets/{work-queue-DV36cxjp.js → work-queue-BAnNY0xE.js} +2 -2
- package/public/assets/{work-queue-DV36cxjp.js.map → work-queue-BAnNY0xE.js.map} +1 -1
- package/public/index.html +1 -1
- package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/runner/plugins/claude/monitors/relay-monitor.provisioned.mjs +2 -2
- package/src/db/prompt-templates.ts +5 -10
- package/src/prompt-resolver.ts +24 -24
- package/public/assets/prompt-settings-Df-0ZMJ5.js +0 -2
- package/public/assets/prompt-settings-Df-0ZMJ5.js.map +0 -1
- package/src/prompt-template-defaults-runner.ts +0 -136
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{$n as t,Yn as n,Zn as r,ur as i}from"./lucide-react-C4eXYCwx.js";import{_ as a,rt as o}from"./display-BWi8DQCp.js";import{D as s}from"./index-
|
|
2
|
-
//# sourceMappingURL=user-avatar-
|
|
1
|
+
import{r as e}from"./chunk-CilyBKbf.js";import{$n as t,Yn as n,Zn as r,ur as i}from"./lucide-react-C4eXYCwx.js";import{_ as a,rt as o}from"./display-BWi8DQCp.js";import{D as s}from"./index-Vmhw442d.js";var c=e(i(),1),l=r(),u={id:o};function d({user:e,address:r,distinct:i=!1,className:o}){let d=e?.avatarUrl??(e?.avatarArtifactId?`/artifacts/${encodeURIComponent(e.avatarArtifactId)}/content`:null),[f,p]=(0,c.useState)(null);(0,c.useEffect)(()=>{if(!d){p(null);return}let e=!1,n=null;return(async()=>{try{let r=await t(d);if(e)return;n=URL.createObjectURL(r),p(n)}catch{e||p(null)}})(),()=>{e=!0,n&&URL.revokeObjectURL(n)}},[d]);let m=e?.displayName||e?.handle||`User`;if(f)return(0,l.jsx)(`img`,{src:f,alt:m,title:m,className:n(`w-7 h-7 rounded-md object-cover`,o)});if(i){let e=(m.trim()[0]||`U`).toUpperCase();return(0,l.jsx)(`span`,{title:m,className:n(`inline-flex w-7 h-7 items-center justify-center rounded-md bg-muted text-xs font-semibold ring-1 ring-foreground/10`,a(r),o),children:e})}return(0,l.jsx)(s,{agent:u,className:o})}export{d as t};
|
|
2
|
+
//# sourceMappingURL=user-avatar-BWLUHt2e.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-avatar-
|
|
1
|
+
{"version":3,"file":"user-avatar-BWLUHt2e.js","names":[],"sources":["../../dashboard/src/components/shared/user-avatar.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { AgentTypeIcon } from '@/components/shared/agent-type-icon'\nimport { apiBlob } from '@/lib/api'\nimport { humanAccentClass } from '@/lib/display'\nimport { HUMAN_AGENT_ID } from '@/lib/constants'\nimport { cn } from '@/lib/utils'\nimport type { Agent, User } from '@/types'\n\n// Minimal stub so AgentTypeIcon resolves the generic 'user' face when no avatar exists.\nconst HUMAN_AGENT_STUB = { id: HUMAN_AGENT_ID } as unknown as Agent\n\n// A human's face (#390). Renders, in order of preference: the user's content-addressed avatar\n// image (the FK lands fully in #630 — until then `avatarArtifactId` is null and this path is\n// dormant), then a colored initial when we need to distinguish multiple operators, then the\n// generic operator icon. Degrades gracefully at every step so a single seeded user looks\n// exactly as before.\nexport function UserAvatar({\n user,\n address,\n distinct = false,\n className,\n}: {\n user: User | undefined\n /** The human address (`user` / `user:<id>`) — drives the deterministic accent color. */\n address?: string\n /** When true (multiple humans in view), fall back to a colored initial instead of the icon. */\n distinct?: boolean\n className?: string\n}) {\n const avatarUrl = user?.avatarUrl ?? (user?.avatarArtifactId ? `/artifacts/${encodeURIComponent(user.avatarArtifactId)}/content` : null)\n const [objectUrl, setObjectUrl] = useState<string | null>(null)\n\n useEffect(() => {\n if (!avatarUrl) { setObjectUrl(null); return }\n let cancelled = false\n let url: string | null = null\n void (async () => {\n try {\n const blob = await apiBlob(avatarUrl)\n if (cancelled) return\n url = URL.createObjectURL(blob)\n setObjectUrl(url)\n } catch {\n if (!cancelled) setObjectUrl(null)\n }\n })()\n return () => { cancelled = true; if (url) URL.revokeObjectURL(url) }\n }, [avatarUrl])\n\n const title = user?.displayName || user?.handle || 'User'\n\n if (objectUrl) {\n return <img src={objectUrl} alt={title} title={title} className={cn('w-7 h-7 rounded-md object-cover', className)} />\n }\n if (distinct) {\n const initial = (title.trim()[0] || 'U').toUpperCase()\n return (\n <span\n title={title}\n className={cn('inline-flex w-7 h-7 items-center justify-center rounded-md bg-muted text-xs font-semibold ring-1 ring-foreground/10', humanAccentClass(address), className)}\n >\n {initial}\n </span>\n )\n }\n return <AgentTypeIcon agent={HUMAN_AGENT_STUB} className={className} />\n}\n"],"mappings":"+NASM,EAAmB,CAAE,GAAI,EAAgB,CAO/C,SAAgB,EAAW,CACzB,OACA,UACA,WAAW,GACX,aAQC,CACD,IAAM,EAAY,GAAM,YAAc,GAAM,iBAAmB,cAAc,mBAAmB,EAAK,iBAAiB,CAAC,UAAY,MAC7H,CAAC,EAAW,IAAA,EAAA,EAAA,UAAwC,KAAK,EAE/D,EAAA,EAAA,eAAgB,CACd,GAAI,CAAC,EAAW,CAAE,EAAa,KAAK,CAAE,OACtC,IAAI,EAAY,GACZ,EAAqB,KAWzB,OAVM,SAAY,CAChB,GAAI,CACF,IAAM,EAAO,MAAM,EAAQ,EAAU,CACrC,GAAI,EAAW,OACf,EAAM,IAAI,gBAAgB,EAAK,CAC/B,EAAa,EAAI,MACX,CACD,GAAW,EAAa,KAAK,KAElC,KACS,CAAE,EAAY,GAAU,GAAK,IAAI,gBAAgB,EAAI,GACjE,CAAC,EAAU,CAAC,CAEf,IAAM,EAAQ,GAAM,aAAe,GAAM,QAAU,OAEnD,GAAI,EACF,OAAO,EAAA,EAAA,KAAC,MAAD,CAAK,IAAK,EAAW,IAAK,EAAc,QAAO,UAAW,EAAG,kCAAmC,EAAU,CAAI,CAAA,CAEvH,GAAI,EAAU,CACZ,IAAM,GAAW,EAAM,MAAM,CAAC,IAAM,KAAK,aAAa,CACtD,OACE,EAAA,EAAA,KAAC,OAAD,CACS,QACP,UAAW,EAAG,sHAAuH,EAAiB,EAAQ,CAAE,EAAU,UAEzK,EACI,CAAA,CAGX,OAAO,EAAA,EAAA,KAAC,EAAD,CAAe,MAAO,EAA6B,YAAa,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Dn as e,Zn as t,hn as n,i as r,pt as i}from"./lucide-react-C4eXYCwx.js";import{f as a,t as o}from"./store-DUfrGvOE.js";import{K as s,ct as c,d as l}from"./display-BWi8DQCp.js";import{t as u}from"./badge-D8fABzMs.js";import{t as d}from"./button-KASZcscA.js";import{W as f,X as p,u as m}from"./index-
|
|
2
|
-
//# sourceMappingURL=work-queue-
|
|
1
|
+
import{Dn as e,Zn as t,hn as n,i as r,pt as i}from"./lucide-react-C4eXYCwx.js";import{f as a,t as o}from"./store-DUfrGvOE.js";import{K as s,ct as c,d as l}from"./display-BWi8DQCp.js";import{t as u}from"./badge-D8fABzMs.js";import{t as d}from"./button-KASZcscA.js";import{W as f,X as p,u as m}from"./index-Vmhw442d.js";import{r as h,t as g}from"./card-Cds0MWME.js";var _=t(),v={open:`bg-blue-500/10 text-blue-400 border-blue-500/20`,blocked:`bg-yellow-500/10 text-yellow-400 border-yellow-500/20`,claimed:`bg-emerald-500/10 text-emerald-400 border-emerald-500/20`,in_progress:`bg-purple-500/10 text-purple-400 border-purple-500/20`};function y(){let e=a(),t=o(e=>e.agentsById),n=o(e=>e.compose),r=o(e=>e.set),s=o(e=>e.doClaimTask),c=o(e=>e.doClaim),d=o(e=>e.openTaskEvents),h=o(e=>e.showError),g=o(e=>e.openConfirm),v=o(e=>e.doDeleteMessage),y=o(e=>e.doUpdateTaskStatus),x=f(),S=p(),C=S.filter(e=>e.claimable).length;function w(e){if(!n.from){h(`Validation`,`Select a "Claim as" agent first.`);return}e.sourceType===`task`&&e.task?s(e.task.id):e.sourceType===`message`&&e.message&&c(e.message.id)}function T(e){g(`Cancel Item`,`Cancel "${e.title||(e.sourceType===`task`?`Task #${e.id}`:`Message #${e.id}`)}"? This cannot be undone.`,()=>{e.sourceType===`task`&&e.task?y(e.task,`canceled`):e.sourceType===`message`&&e.message&&v(e.message.id)})}function E(e){e.task&&d(e.task)}return(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(i,{className:`w-5 h-5 text-muted-foreground`}),(0,_.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Work Queue`}),C>0&&(0,_.jsxs)(u,{className:`bg-orange-500/20 text-orange-400 border-orange-500/30 border`,children:[C,` claimable`]})]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`label`,{className:`text-xs text-muted-foreground shrink-0`,children:`Claim as`}),(0,_.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm`,value:n.from,onChange:e=>r({compose:{...n,from:e.target.value}}),children:[(0,_.jsx)(`option`,{value:``,children:`Select agent...`}),x.map(e=>(0,_.jsx)(`option`,{value:e.id,children:l(e)},e.id))]})]})]}),(0,_.jsx)(m,{className:`h-[calc(100dvh-11rem)]`,children:(0,_.jsxs)(`div`,{className:`space-y-2 pr-2`,children:[S.length===0&&(0,_.jsx)(`div`,{className:`text-center text-muted-foreground py-16 text-sm`,children:`Work queue is empty`}),S.map(n=>(0,_.jsx)(b,{item:n,now:e,agentName:e=>t[e]?l(t[e]):e.slice(-10),onClaim:()=>w(n),onCancel:()=>T(n),onEvents:n.task?()=>E(n):void 0},n.id))]})})]})}function b({item:t,now:i,agentName:a,onClaim:o,onCancel:l,onEvents:f}){let p=c[t.severity]||c.info,m=v[t.status]||`bg-zinc-500/10 text-zinc-400 border-zinc-500/20`;return(0,_.jsx)(g,{className:t.claimable?`ring-1 ring-orange-500/30`:``,children:(0,_.jsx)(h,{className:`p-3`,children:(0,_.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,_.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap mb-1`,children:[(0,_.jsx)(`span`,{className:`font-medium text-sm truncate`,children:t.title}),(0,_.jsx)(u,{variant:`outline`,className:`text-xs px-1.5 py-0 border ${p}`,children:t.severity}),(0,_.jsx)(u,{variant:`outline`,className:`text-xs px-1.5 py-0 border ${m}`,children:t.status}),t.sourceType===`message`&&(0,_.jsx)(u,{variant:`outline`,className:`text-xs px-1.5 py-0 border border-zinc-500/20 text-zinc-400`,children:`msg`})]}),t.body&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2 mb-2`,children:t.body}),(0,_.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground flex-wrap`,children:[t.owner&&(0,_.jsxs)(`span`,{title:`Owner`,children:[(0,_.jsx)(n,{className:`w-3 h-3 inline mr-1`}),a(t.owner)]}),t.source&&(0,_.jsx)(`span`,{className:`font-mono`,children:t.source}),(0,_.jsxs)(`span`,{title:String(t.updatedAt),children:[(0,_.jsx)(e,{className:`w-3 h-3 inline mr-1`}),s(i,t.updatedAt)]})]})]}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-1 shrink-0`,children:[t.claimable&&(0,_.jsxs)(d,{size:`sm`,className:`h-7 text-xs bg-orange-600 hover:bg-orange-700 text-white`,onClick:o,children:[(0,_.jsx)(n,{className:`w-3.5 h-3.5 mr-1`}),` Claim`]}),f&&(0,_.jsx)(d,{size:`sm`,variant:`outline`,className:`h-7 text-xs`,onClick:f,children:`Events`}),(0,_.jsxs)(d,{size:`sm`,variant:`outline`,className:`h-7 text-xs text-red-400 hover:text-red-300 hover:bg-red-500/10 border-red-500/20`,onClick:l,children:[(0,_.jsx)(r,{className:`w-3.5 h-3.5 mr-1`}),` Cancel`]})]})]})})})}export{y as WorkQueueView};
|
|
2
|
+
//# sourceMappingURL=work-queue-BAnNY0xE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"work-queue-DV36cxjp.js","names":[],"sources":["../../dashboard/src/components/views/work-queue.tsx"],"sourcesContent":["import { useRelayStore, useNow } from '@/store'\nimport { useWorkQueueItems, useComposeAgents } from '@/hooks/use-selectors'\nimport { Card, CardContent } from '@/components/ui/card'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { ScrollArea } from '@/components/ui/scroll-area'\nimport { ListChecks, CheckCircle2, Calendar, X } from 'lucide-react'\nimport { displayName, timeAgo } from '@/lib/display'\nimport { SEVERITY_COLORS } from '@/lib/constants'\nimport type { WorkQueueItem } from '@/types'\n\nconst STATUS_COLORS: Record<string, string> = {\n open: 'bg-blue-500/10 text-blue-400 border-blue-500/20',\n blocked: 'bg-yellow-500/10 text-yellow-400 border-yellow-500/20',\n claimed: 'bg-emerald-500/10 text-emerald-400 border-emerald-500/20',\n in_progress: 'bg-purple-500/10 text-purple-400 border-purple-500/20',\n}\n\nexport function WorkQueueView() {\n const now = useNow()\n const agentsById = useRelayStore((s) => s.agentsById)\n const compose = useRelayStore((s) => s.compose)\n const set = useRelayStore((s) => s.set)\n const doClaimTask = useRelayStore((s) => s.doClaimTask)\n const doClaim = useRelayStore((s) => s.doClaim)\n const openTaskEvents = useRelayStore((s) => s.openTaskEvents)\n const showError = useRelayStore((s) => s.showError)\n const openConfirm = useRelayStore((s) => s.openConfirm)\n const doDeleteMessage = useRelayStore((s) => s.doDeleteMessage)\n const doUpdateTaskStatus = useRelayStore((s) => s.doUpdateTaskStatus)\n\n const composeAgents = useComposeAgents()\n const items = useWorkQueueItems()\n\n const claimableCount = items.filter((i) => i.claimable).length\n\n function handleClaim(item: WorkQueueItem) {\n if (!compose.from) { showError('Validation', 'Select a \"Claim as\" agent first.'); return }\n if (item.sourceType === 'task' && item.task) doClaimTask(item.task.id)\n else if (item.sourceType === 'message' && item.message) doClaim(item.message.id)\n }\n\n function handleCancel(item: WorkQueueItem) {\n const label = item.title || (item.sourceType === 'task' ? `Task #${item.id}` : `Message #${item.id}`)\n openConfirm('Cancel Item', `Cancel \"${label}\"? This cannot be undone.`, () => {\n if (item.sourceType === 'task' && item.task) doUpdateTaskStatus(item.task, 'canceled')\n else if (item.sourceType === 'message' && item.message) doDeleteMessage(item.message.id)\n })\n }\n\n function handleEvents(item: WorkQueueItem) {\n if (item.task) openTaskEvents(item.task)\n }\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex items-center justify-between flex-wrap gap-2\">\n <div className=\"flex items-center gap-2\">\n <ListChecks className=\"w-5 h-5 text-muted-foreground\" />\n <h2 className=\"text-lg font-semibold\">Work Queue</h2>\n {claimableCount > 0 && (\n <Badge className=\"bg-orange-500/20 text-orange-400 border-orange-500/30 border\">\n {claimableCount} claimable\n </Badge>\n )}\n </div>\n <div className=\"flex items-center gap-2\">\n <label className=\"text-xs text-muted-foreground shrink-0\">Claim as</label>\n <select\n className=\"rounded-md border border-input bg-background px-3 py-1.5 text-sm\"\n value={compose.from}\n onChange={(e) => set({ compose: { ...compose, from: e.target.value } })}\n >\n <option value=\"\">Select agent...</option>\n {composeAgents.map((a) => <option key={a.id} value={a.id}>{displayName(a)}</option>)}\n </select>\n </div>\n </div>\n\n <ScrollArea className=\"h-[calc(100dvh-11rem)]\">\n <div className=\"space-y-2 pr-2\">\n {items.length === 0 && (\n <div className=\"text-center text-muted-foreground py-16 text-sm\">Work queue is empty</div>\n )}\n {items.map((item) => (\n <WorkQueueCard\n key={item.id}\n item={item}\n now={now}\n agentName={(id) => agentsById[id] ? displayName(agentsById[id]) : id.slice(-10)}\n onClaim={() => handleClaim(item)}\n onCancel={() => handleCancel(item)}\n onEvents={item.task ? () => handleEvents(item) : undefined}\n />\n ))}\n </div>\n </ScrollArea>\n </div>\n )\n}\n\nfunction WorkQueueCard({\n item, now, agentName, onClaim, onCancel, onEvents,\n}: {\n item: WorkQueueItem\n now: number\n agentName: (id: string) => string\n onClaim: () => void\n onCancel: () => void\n onEvents?: () => void\n}) {\n const severityClass = SEVERITY_COLORS[item.severity] || SEVERITY_COLORS.info\n const statusClass = STATUS_COLORS[item.status] || 'bg-zinc-500/10 text-zinc-400 border-zinc-500/20'\n\n return (\n <Card className={item.claimable ? 'ring-1 ring-orange-500/30' : ''}>\n <CardContent className=\"p-3\">\n <div className=\"flex items-start gap-3\">\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 flex-wrap mb-1\">\n <span className=\"font-medium text-sm truncate\">{item.title}</span>\n <Badge variant=\"outline\" className={`text-xs px-1.5 py-0 border ${severityClass}`}>{item.severity}</Badge>\n <Badge variant=\"outline\" className={`text-xs px-1.5 py-0 border ${statusClass}`}>{item.status}</Badge>\n {item.sourceType === 'message' && (\n <Badge variant=\"outline\" className=\"text-xs px-1.5 py-0 border border-zinc-500/20 text-zinc-400\">msg</Badge>\n )}\n </div>\n {item.body && (\n <p className=\"text-xs text-muted-foreground line-clamp-2 mb-2\">{item.body}</p>\n )}\n <div className=\"flex items-center gap-3 text-xs text-muted-foreground flex-wrap\">\n {item.owner && (\n <span title=\"Owner\">\n <CheckCircle2 className=\"w-3 h-3 inline mr-1\" />{agentName(item.owner)}\n </span>\n )}\n {item.source && (\n <span className=\"font-mono\">{item.source}</span>\n )}\n <span title={String(item.updatedAt)}>\n <Calendar className=\"w-3 h-3 inline mr-1\" />{timeAgo(now, item.updatedAt)}\n </span>\n </div>\n </div>\n <div className=\"flex flex-col gap-1 shrink-0\">\n {item.claimable && (\n <Button size=\"sm\" className=\"h-7 text-xs bg-orange-600 hover:bg-orange-700 text-white\" onClick={onClaim}>\n <CheckCircle2 className=\"w-3.5 h-3.5 mr-1\" /> Claim\n </Button>\n )}\n {onEvents && (\n <Button size=\"sm\" variant=\"outline\" className=\"h-7 text-xs\" onClick={onEvents}>\n Events\n </Button>\n )}\n <Button size=\"sm\" variant=\"outline\" className=\"h-7 text-xs text-red-400 hover:text-red-300 hover:bg-red-500/10 border-red-500/20\" onClick={onCancel}>\n <X className=\"w-3.5 h-3.5 mr-1\" /> Cancel\n </Button>\n </div>\n </div>\n </CardContent>\n </Card>\n )\n}\n"],"mappings":"sXAWM,EAAwC,CAC5C,KAAM,kDACN,QAAS,wDACT,QAAS,2DACT,YAAa,wDACd,CAED,SAAgB,GAAgB,CAC9B,IAAM,EAAM,GAAQ,CACd,EAAa,EAAe,GAAM,EAAE,WAAW,CAC/C,EAAU,EAAe,GAAM,EAAE,QAAQ,CACzC,EAAM,EAAe,GAAM,EAAE,IAAI,CACjC,EAAc,EAAe,GAAM,EAAE,YAAY,CACjD,EAAU,EAAe,GAAM,EAAE,QAAQ,CACzC,EAAiB,EAAe,GAAM,EAAE,eAAe,CACvD,EAAY,EAAe,GAAM,EAAE,UAAU,CAC7C,EAAc,EAAe,GAA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,UAAU,mBAAqB,CAAA,CAAA,UAC3B,GACL,GACF,GACM,CAAA,CACT,CAAA"}
|
|
1
|
+
{"version":3,"file":"work-queue-BAnNY0xE.js","names":[],"sources":["../../dashboard/src/components/views/work-queue.tsx"],"sourcesContent":["import { useRelayStore, useNow } from '@/store'\nimport { useWorkQueueItems, useComposeAgents } from '@/hooks/use-selectors'\nimport { Card, CardContent } from '@/components/ui/card'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { ScrollArea } from '@/components/ui/scroll-area'\nimport { ListChecks, CheckCircle2, Calendar, X } from 'lucide-react'\nimport { displayName, timeAgo } from '@/lib/display'\nimport { SEVERITY_COLORS } from '@/lib/constants'\nimport type { WorkQueueItem } from '@/types'\n\nconst STATUS_COLORS: Record<string, string> = {\n open: 'bg-blue-500/10 text-blue-400 border-blue-500/20',\n blocked: 'bg-yellow-500/10 text-yellow-400 border-yellow-500/20',\n claimed: 'bg-emerald-500/10 text-emerald-400 border-emerald-500/20',\n in_progress: 'bg-purple-500/10 text-purple-400 border-purple-500/20',\n}\n\nexport function WorkQueueView() {\n const now = useNow()\n const agentsById = useRelayStore((s) => s.agentsById)\n const compose = useRelayStore((s) => s.compose)\n const set = useRelayStore((s) => s.set)\n const doClaimTask = useRelayStore((s) => s.doClaimTask)\n const doClaim = useRelayStore((s) => s.doClaim)\n const openTaskEvents = useRelayStore((s) => s.openTaskEvents)\n const showError = useRelayStore((s) => s.showError)\n const openConfirm = useRelayStore((s) => s.openConfirm)\n const doDeleteMessage = useRelayStore((s) => s.doDeleteMessage)\n const doUpdateTaskStatus = useRelayStore((s) => s.doUpdateTaskStatus)\n\n const composeAgents = useComposeAgents()\n const items = useWorkQueueItems()\n\n const claimableCount = items.filter((i) => i.claimable).length\n\n function handleClaim(item: WorkQueueItem) {\n if (!compose.from) { showError('Validation', 'Select a \"Claim as\" agent first.'); return }\n if (item.sourceType === 'task' && item.task) doClaimTask(item.task.id)\n else if (item.sourceType === 'message' && item.message) doClaim(item.message.id)\n }\n\n function handleCancel(item: WorkQueueItem) {\n const label = item.title || (item.sourceType === 'task' ? `Task #${item.id}` : `Message #${item.id}`)\n openConfirm('Cancel Item', `Cancel \"${label}\"? This cannot be undone.`, () => {\n if (item.sourceType === 'task' && item.task) doUpdateTaskStatus(item.task, 'canceled')\n else if (item.sourceType === 'message' && item.message) doDeleteMessage(item.message.id)\n })\n }\n\n function handleEvents(item: WorkQueueItem) {\n if (item.task) openTaskEvents(item.task)\n }\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex items-center justify-between flex-wrap gap-2\">\n <div className=\"flex items-center gap-2\">\n <ListChecks className=\"w-5 h-5 text-muted-foreground\" />\n <h2 className=\"text-lg font-semibold\">Work Queue</h2>\n {claimableCount > 0 && (\n <Badge className=\"bg-orange-500/20 text-orange-400 border-orange-500/30 border\">\n {claimableCount} claimable\n </Badge>\n )}\n </div>\n <div className=\"flex items-center gap-2\">\n <label className=\"text-xs text-muted-foreground shrink-0\">Claim as</label>\n <select\n className=\"rounded-md border border-input bg-background px-3 py-1.5 text-sm\"\n value={compose.from}\n onChange={(e) => set({ compose: { ...compose, from: e.target.value } })}\n >\n <option value=\"\">Select agent...</option>\n {composeAgents.map((a) => <option key={a.id} value={a.id}>{displayName(a)}</option>)}\n </select>\n </div>\n </div>\n\n <ScrollArea className=\"h-[calc(100dvh-11rem)]\">\n <div className=\"space-y-2 pr-2\">\n {items.length === 0 && (\n <div className=\"text-center text-muted-foreground py-16 text-sm\">Work queue is empty</div>\n )}\n {items.map((item) => (\n <WorkQueueCard\n key={item.id}\n item={item}\n now={now}\n agentName={(id) => agentsById[id] ? displayName(agentsById[id]) : id.slice(-10)}\n onClaim={() => handleClaim(item)}\n onCancel={() => handleCancel(item)}\n onEvents={item.task ? () => handleEvents(item) : undefined}\n />\n ))}\n </div>\n </ScrollArea>\n </div>\n )\n}\n\nfunction WorkQueueCard({\n item, now, agentName, onClaim, onCancel, onEvents,\n}: {\n item: WorkQueueItem\n now: number\n agentName: (id: string) => string\n onClaim: () => void\n onCancel: () => void\n onEvents?: () => void\n}) {\n const severityClass = SEVERITY_COLORS[item.severity] || SEVERITY_COLORS.info\n const statusClass = STATUS_COLORS[item.status] || 'bg-zinc-500/10 text-zinc-400 border-zinc-500/20'\n\n return (\n <Card className={item.claimable ? 'ring-1 ring-orange-500/30' : ''}>\n <CardContent className=\"p-3\">\n <div className=\"flex items-start gap-3\">\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 flex-wrap mb-1\">\n <span className=\"font-medium text-sm truncate\">{item.title}</span>\n <Badge variant=\"outline\" className={`text-xs px-1.5 py-0 border ${severityClass}`}>{item.severity}</Badge>\n <Badge variant=\"outline\" className={`text-xs px-1.5 py-0 border ${statusClass}`}>{item.status}</Badge>\n {item.sourceType === 'message' && (\n <Badge variant=\"outline\" className=\"text-xs px-1.5 py-0 border border-zinc-500/20 text-zinc-400\">msg</Badge>\n )}\n </div>\n {item.body && (\n <p className=\"text-xs text-muted-foreground line-clamp-2 mb-2\">{item.body}</p>\n )}\n <div className=\"flex items-center gap-3 text-xs text-muted-foreground flex-wrap\">\n {item.owner && (\n <span title=\"Owner\">\n <CheckCircle2 className=\"w-3 h-3 inline mr-1\" />{agentName(item.owner)}\n </span>\n )}\n {item.source && (\n <span className=\"font-mono\">{item.source}</span>\n )}\n <span title={String(item.updatedAt)}>\n <Calendar className=\"w-3 h-3 inline mr-1\" />{timeAgo(now, item.updatedAt)}\n </span>\n </div>\n </div>\n <div className=\"flex flex-col gap-1 shrink-0\">\n {item.claimable && (\n <Button size=\"sm\" className=\"h-7 text-xs bg-orange-600 hover:bg-orange-700 text-white\" onClick={onClaim}>\n <CheckCircle2 className=\"w-3.5 h-3.5 mr-1\" /> Claim\n </Button>\n )}\n {onEvents && (\n <Button size=\"sm\" variant=\"outline\" className=\"h-7 text-xs\" onClick={onEvents}>\n Events\n </Button>\n )}\n <Button size=\"sm\" variant=\"outline\" className=\"h-7 text-xs text-red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AAnC,EACE,EAAA,EAAA,KAAC,EAAD,CAAU,UAAU,sBAAwB,CAAA,CAAC,EAAQ,EAAK,EAAK,UAAU,CACpE,GACH,GACF,IACN,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,wCAAf,CACG,EAAK,YACJ,EAAA,EAAA,MAAC,EAAD,CAAQ,KAAK,KAAK,UAAU,2DAA2D,QAAS,WAAhG,EACE,EAAA,EAAA,KAAC,EAAD,CAAc,UAAU,mBAAqB,CAAA,CAAA,SACtC,GAEV,IACC,EAAA,EAAA,KAAC,EAAD,CAAQ,KAAK,KAAK,QAAQ,UAAU,UAAU,cAAc,QAAS,WAAU,SAEtE,CAAA,EAEX,EAAA,EAAA,MAAC,EAAD,CAAQ,KAAK,KAAK,QAAQ,UAAU,UAAU,oFAAoF,QAAS,WAA3I,EACE,EAAA,EAAA,KAAC,EAAD,CAAG,UAAU,mBAAqB,CAAA,CAAA,UAC3B,GACL,GACF,GACM,CAAA,CACT,CAAA"}
|
package/public/index.html
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='6' fill='%2309090b'/%3E%3Ccircle cx='16' cy='16' r='4.5' fill='%2358a6ff'/%3E%3Ccircle cx='6' cy='8' r='2.5' fill='%233fb950'/%3E%3Ccircle cx='26' cy='8' r='2.5' fill='%233fb950'/%3E%3Ccircle cx='6' cy='24' r='2.5' fill='%233fb950'/%3E%3Ccircle cx='26' cy='24' r='2.5' fill='%233fb950'/%3E%3Cline x1='8' y1='9.5' x2='13' y2='14' stroke='%2330363d' stroke-width='1.5'/%3E%3Cline x1='24' y1='9.5' x2='19' y2='14' stroke='%2330363d' stroke-width='1.5'/%3E%3Cline x1='8' y1='22.5' x2='13' y2='18' stroke='%2330363d' stroke-width='1.5'/%3E%3Cline x1='24' y1='22.5' x2='19' y2='18' stroke='%2330363d' stroke-width='1.5'/%3E%3C/svg%3E">
|
|
13
13
|
<link rel="manifest" href="manifest.webmanifest">
|
|
14
14
|
<link rel="apple-touch-icon" href="icons/agent-relay-192.png">
|
|
15
|
-
<script type="module" crossorigin src="./assets/index-
|
|
15
|
+
<script type="module" crossorigin src="./assets/index-Vmhw442d.js"></script>
|
|
16
16
|
<link rel="modulepreload" crossorigin href="./assets/chunk-CilyBKbf.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-C_JMBXql.js">
|
|
18
18
|
<link rel="modulepreload" crossorigin href="./assets/lucide-react-C4eXYCwx.js">
|
|
@@ -847,7 +847,7 @@ function messageBodyMaxCharsFromEnv() {
|
|
|
847
847
|
return process.env.AGENT_RELAY_MESSAGE_BODY_MAX_CHARS;
|
|
848
848
|
}
|
|
849
849
|
|
|
850
|
-
// src/prompt-template-defaults
|
|
850
|
+
// sdk/src/prompt-template-defaults.ts
|
|
851
851
|
function lines(...parts) {
|
|
852
852
|
return parts.join(`
|
|
853
853
|
`);
|
|
@@ -923,7 +923,7 @@ var RUNNER_PROMPT_TEMPLATE_DEFAULTS = [
|
|
|
923
923
|
description: "Write-through symlink caveat injected by the runner.",
|
|
924
924
|
template: "[agent-relay] Isolated workspace: these untracked paths are SYMLINKED from the main checkout: {{linked}}. They resolve to the real files in main, so editing or deleting them writes THROUGH to main \u2014 treat them as read-only unless you intend to change main.",
|
|
925
925
|
defaultTemplate: "[agent-relay] Isolated workspace: these untracked paths are SYMLINKED from the main checkout: {{linked}}. They resolve to the real files in main, so editing or deleting them writes THROUGH to main \u2014 treat them as read-only unless you intend to change main.",
|
|
926
|
-
variables: [
|
|
926
|
+
variables: []
|
|
927
927
|
}
|
|
928
928
|
];
|
|
929
929
|
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { PromptTemplate } from "../types";
|
|
2
2
|
import { ValidationError, getDb } from "./connection.ts";
|
|
3
3
|
|
|
4
|
+
// SeedTemplate is owned by the SDK (alongside RUNNER_PROMPT_TEMPLATE_DEFAULTS) so the
|
|
5
|
+
// published runner can consume the seed data without crossing a package boundary (#802).
|
|
6
|
+
import type { SeedTemplate } from "agent-relay-sdk/prompt-template-defaults";
|
|
7
|
+
export type { SeedTemplate };
|
|
8
|
+
|
|
4
9
|
interface PromptTemplateRow {
|
|
5
10
|
slug: string;
|
|
6
11
|
category: string;
|
|
@@ -13,16 +18,6 @@ interface PromptTemplateRow {
|
|
|
13
18
|
created_at: number;
|
|
14
19
|
}
|
|
15
20
|
|
|
16
|
-
export interface SeedTemplate {
|
|
17
|
-
slug: string;
|
|
18
|
-
category: string;
|
|
19
|
-
title: string;
|
|
20
|
-
description?: string;
|
|
21
|
-
template: string;
|
|
22
|
-
defaultTemplate: string;
|
|
23
|
-
variables: string[];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
21
|
export type PromptTemplateRecord = PromptTemplate;
|
|
27
22
|
|
|
28
23
|
function rowToPromptTemplate(row: PromptTemplateRow): PromptTemplateRecord {
|
package/src/prompt-resolver.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SeedTemplate } from "./db/prompt-templates";
|
|
2
2
|
import { getTemplate } from "./db/prompt-templates";
|
|
3
|
-
import { RUNNER_PROMPT_TEMPLATE_DEFAULTS } from "
|
|
3
|
+
import { RUNNER_PROMPT_TEMPLATE_DEFAULTS } from "agent-relay-sdk/prompt-template-defaults";
|
|
4
4
|
|
|
5
5
|
function lines(...parts: string[]): string {
|
|
6
6
|
return parts.join("\n");
|
|
@@ -265,7 +265,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
265
265
|
...RUNNER_PROMPT_TEMPLATE_DEFAULTS,
|
|
266
266
|
{
|
|
267
267
|
slug: "notify.agent.ready",
|
|
268
|
-
category: "
|
|
268
|
+
category: "lifecycle",
|
|
269
269
|
title: "Spawned Agent Ready",
|
|
270
270
|
description: "Notification body sent when a spawned child becomes ready.",
|
|
271
271
|
template: "✅ Your spawned agent {{label}} is ready and idle — send it work with relay_send_message to `{{childId}}`.",
|
|
@@ -274,7 +274,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
274
274
|
},
|
|
275
275
|
{
|
|
276
276
|
slug: "notify.agent.exited",
|
|
277
|
-
category: "
|
|
277
|
+
category: "lifecycle",
|
|
278
278
|
title: "Spawned Agent Exited",
|
|
279
279
|
description: "Notification body sent when a spawned child exits after becoming ready.",
|
|
280
280
|
template: "⏹ Your spawned agent {{label}} exited — {{reason}}{{diagnosis}}.",
|
|
@@ -283,7 +283,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
283
283
|
},
|
|
284
284
|
{
|
|
285
285
|
slug: "notify.agent.never-ready",
|
|
286
|
-
category: "
|
|
286
|
+
category: "lifecycle",
|
|
287
287
|
title: "Spawned Agent Never Ready",
|
|
288
288
|
description: "Notification body sent when a spawned child dies before becoming ready.",
|
|
289
289
|
template: "❌ Your spawned agent {{label}} went offline before ever becoming ready — {{reason}}{{diagnosis}}. Likely a crash-loop, onboarding gate, or bad launch; call relay_spawn_targets to re-check provider availability before retrying.",
|
|
@@ -292,7 +292,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
292
292
|
},
|
|
293
293
|
{
|
|
294
294
|
slug: "notify.spawn.failed",
|
|
295
|
-
category: "
|
|
295
|
+
category: "lifecycle",
|
|
296
296
|
title: "Spawn Failed",
|
|
297
297
|
description: "Notification body sent when a spawn command fails outright.",
|
|
298
298
|
template: "❌ Your spawn request{{spawnRequestId}} failed — {{reason}}. Call relay_spawn_targets to check live provider/host availability before retrying.",
|
|
@@ -301,7 +301,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
301
301
|
},
|
|
302
302
|
{
|
|
303
303
|
slug: "notify.spawn.recovered",
|
|
304
|
-
category: "
|
|
304
|
+
category: "lifecycle",
|
|
305
305
|
title: "Spawn Recovered",
|
|
306
306
|
description: "Correction sent when a spawn-failed report is later superseded by readiness.",
|
|
307
307
|
template: "♻️ Correction: your earlier spawn failure{{spawnRequestId}} was a false alarm — {{label}} actually registered and is ready and idle. Disregard the failure and do NOT retry; send it work with relay_send_message to `{{childId}}`.",
|
|
@@ -310,7 +310,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
310
310
|
},
|
|
311
311
|
{
|
|
312
312
|
slug: "notify.land.success",
|
|
313
|
-
category: "
|
|
313
|
+
category: "land",
|
|
314
314
|
title: "Branch Landed",
|
|
315
315
|
description: "Owner notification body when a branch lands successfully.",
|
|
316
316
|
template: "✅ {{branch}} landed on `{{base}}`{{sha}}.{{publishLabel}}{{continueLabel}}",
|
|
@@ -319,7 +319,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
319
319
|
},
|
|
320
320
|
{
|
|
321
321
|
slug: "notify.land.failure",
|
|
322
|
-
category: "
|
|
322
|
+
category: "land",
|
|
323
323
|
title: "Branch Land Failure",
|
|
324
324
|
description: "Owner wake sent when landing fails fatally.",
|
|
325
325
|
template: "❌ {{branch}} did not land on `{{base}}`: {{reason}}. You were woken by `landed-failure`; inspect workspace status before doing more work. Do NOT push, rebase, merge, or touch the main checkout yourself.",
|
|
@@ -328,7 +328,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
328
328
|
},
|
|
329
329
|
{
|
|
330
330
|
slug: "notify.land.steward-taken",
|
|
331
|
-
category: "
|
|
331
|
+
category: "land",
|
|
332
332
|
title: "Steward Took Over Merge",
|
|
333
333
|
description: "Owner-facing notice that a steward took over the merge.",
|
|
334
334
|
template: "🛟 {{branch}} couldn't be auto-merged to `{{base}}` and is now being handled by steward agent `{{stewardId}}`{{reasonLabel}}. The steward will rebase/resolve and land it. Do NOT push, rebase, merge, or touch the main checkout yourself; stay idle until you're woken with the result.",
|
|
@@ -337,7 +337,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
337
337
|
},
|
|
338
338
|
{
|
|
339
339
|
slug: "notify.land.steward-taken.coordinator",
|
|
340
|
-
category: "
|
|
340
|
+
category: "land",
|
|
341
341
|
title: "Steward Took Over Merge (Coordinator)",
|
|
342
342
|
description: "Coordinator-facing notice that a steward took over a branch agent's merge.",
|
|
343
343
|
template: "🛟 Your branch agent `{{owner}}`'s merge ({{branch}} → `{{base}}`) couldn't be auto-merged and is now with steward agent `{{stewardId}}`{{reasonLabel}}. The steward will land it or escalate to you if it can't.",
|
|
@@ -346,7 +346,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
346
346
|
},
|
|
347
347
|
{
|
|
348
348
|
slug: "workspace.phase.active.headline",
|
|
349
|
-
category: "workspace",
|
|
349
|
+
category: "workspace-phase",
|
|
350
350
|
title: "Workspace Active Headline",
|
|
351
351
|
description: "Workspace status headline for active isolated work.",
|
|
352
352
|
template: "Your isolated branch — work in progress.",
|
|
@@ -355,7 +355,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
355
355
|
},
|
|
356
356
|
{
|
|
357
357
|
slug: "workspace.phase.active.hint",
|
|
358
|
-
category: "workspace",
|
|
358
|
+
category: "workspace-phase",
|
|
359
359
|
title: "Workspace Active Hint",
|
|
360
360
|
description: "Workspace status hint for active isolated work.",
|
|
361
361
|
template: "Commit your work in this worktree, then mark it ready. Relay rebases onto the latest base, lands, and pushes for you — do NOT push, rebase, or merge yourself, and never touch the main checkout.",
|
|
@@ -364,7 +364,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
364
364
|
},
|
|
365
365
|
{
|
|
366
366
|
slug: "workspace.phase.ready.headline",
|
|
367
|
-
category: "workspace",
|
|
367
|
+
category: "workspace-phase",
|
|
368
368
|
title: "Workspace Ready Headline",
|
|
369
369
|
description: "Workspace status headline for healthy handoff states.",
|
|
370
370
|
template: "Handed off — stop this turn and go idle while Relay lands your branch. This is the normal, healthy post-ready state (not an escalation).",
|
|
@@ -373,7 +373,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
373
373
|
},
|
|
374
374
|
{
|
|
375
375
|
slug: "workspace.phase.ready.hint",
|
|
376
|
-
category: "workspace",
|
|
376
|
+
category: "workspace-phase",
|
|
377
377
|
title: "Workspace Ready Hint",
|
|
378
378
|
description: "Workspace status hint for healthy handoff states.",
|
|
379
379
|
template: "No action needed. Stop your turn now; do not poll or wait on the steward queue. Relay will wake you with a `landed-success` notification when the merge lands and your branch is refreshed, or `landed-failure` if landing fatally fails. Do NOT merge, push, resolve anything, or touch the main checkout.",
|
|
@@ -382,7 +382,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
382
382
|
},
|
|
383
383
|
{
|
|
384
384
|
slug: "workspace.phase.merge-planned.headline",
|
|
385
|
-
category: "workspace",
|
|
385
|
+
category: "workspace-phase",
|
|
386
386
|
title: "Workspace Merge Planned Headline",
|
|
387
387
|
description: "Workspace status headline for merge dispatch.",
|
|
388
388
|
template: "Merge dispatched — landing your branch on the base now.",
|
|
@@ -391,7 +391,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
391
391
|
},
|
|
392
392
|
{
|
|
393
393
|
slug: "workspace.phase.merge-planned.hint",
|
|
394
|
-
category: "workspace",
|
|
394
|
+
category: "workspace-phase",
|
|
395
395
|
title: "Workspace Merge Planned Hint",
|
|
396
396
|
description: "Workspace status hint for merge dispatch.",
|
|
397
397
|
template: "No action needed. When it completes you'll be moved onto a fresh rebased branch (the name gains a `--N` suffix — expected) to keep working.",
|
|
@@ -400,7 +400,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
400
400
|
},
|
|
401
401
|
{
|
|
402
402
|
slug: "workspace.phase.conflict.headline",
|
|
403
|
-
category: "workspace",
|
|
403
|
+
category: "workspace-phase",
|
|
404
404
|
title: "Workspace Conflict Headline",
|
|
405
405
|
description: "Workspace status headline when a steward is reconciling a conflict.",
|
|
406
406
|
template: "Auto-merge hit a conflict — a steward agent is reconciling it. Resolving it is NOT your job.",
|
|
@@ -409,7 +409,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
409
409
|
},
|
|
410
410
|
{
|
|
411
411
|
slug: "workspace.phase.conflict.hint",
|
|
412
|
-
category: "workspace",
|
|
412
|
+
category: "workspace-phase",
|
|
413
413
|
title: "Workspace Conflict Hint",
|
|
414
414
|
description: "Workspace status hint when a steward is reconciling a conflict.",
|
|
415
415
|
template: "Do not resolve the conflict, rebase, merge, or push yourself. The steward rebases and lands it, escalating to the human only if it truly can't. You can keep working or wait for it to land.",
|
|
@@ -418,7 +418,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
418
418
|
},
|
|
419
419
|
{
|
|
420
420
|
slug: "workspace.phase.merged.headline",
|
|
421
|
-
category: "workspace",
|
|
421
|
+
category: "workspace-phase",
|
|
422
422
|
title: "Workspace Merged Headline",
|
|
423
423
|
description: "Workspace status headline after a successful land.",
|
|
424
424
|
template: "✅ Landed — your commits are on the base.",
|
|
@@ -427,7 +427,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
427
427
|
},
|
|
428
428
|
{
|
|
429
429
|
slug: "workspace.phase.merged.hint",
|
|
430
|
-
category: "workspace",
|
|
430
|
+
category: "workspace-phase",
|
|
431
431
|
title: "Workspace Merged Hint",
|
|
432
432
|
description: "Workspace status hint after a successful land.",
|
|
433
433
|
template: "A fresh rebased branch is being prepared; you'll continue on it (the branch name gains a `--N` suffix — expected, not an error). Keep working.",
|
|
@@ -436,7 +436,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
436
436
|
},
|
|
437
437
|
{
|
|
438
438
|
slug: "workspace.phase.abandoned.headline",
|
|
439
|
-
category: "workspace",
|
|
439
|
+
category: "workspace-phase",
|
|
440
440
|
title: "Workspace Closed Headline",
|
|
441
441
|
description: "Workspace status headline when the worktree is being torn down.",
|
|
442
442
|
template: "This workspace is being torn down.",
|
|
@@ -445,7 +445,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
445
445
|
},
|
|
446
446
|
{
|
|
447
447
|
slug: "workspace.phase.abandoned.hint",
|
|
448
|
-
category: "workspace",
|
|
448
|
+
category: "workspace-phase",
|
|
449
449
|
title: "Workspace Closed Hint",
|
|
450
450
|
description: "Workspace status hint when the worktree is being torn down.",
|
|
451
451
|
template: "No further branch work happens here. If you still have work to do, the host will spawn you into a fresh workspace.",
|
|
@@ -481,7 +481,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
481
481
|
},
|
|
482
482
|
{
|
|
483
483
|
slug: "notify.routing.policy-changed",
|
|
484
|
-
category: "
|
|
484
|
+
category: "routing",
|
|
485
485
|
title: "Routing Policy Changed",
|
|
486
486
|
description: "Notification body sent to live spawn-capable agents after a routing policy save.",
|
|
487
487
|
template: "🗺 Routing policy updated{{updatedBy}}. Ingest this delta now — spawn routing decisions take effect immediately without respawn. Re-read relay_spawn_targets for live provider/model options.",
|
|
@@ -490,7 +490,7 @@ const DEFAULT_PROMPT_TEMPLATES = [
|
|
|
490
490
|
},
|
|
491
491
|
{
|
|
492
492
|
slug: "notify.automation.budget-warning",
|
|
493
|
-
category: "
|
|
493
|
+
category: "automation",
|
|
494
494
|
title: "Automation Runtime Budget Warning",
|
|
495
495
|
description: "Fallback automation runtime budget warning body.",
|
|
496
496
|
template: "Runtime budget warning: this automation run will be shut down in about {{remainingMinutes}}. Finish current work, commit and push anything worth keeping, then stop cleanly before the deadline.",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{A as t,I as n,Mn as r,N as i,Qn as a,Vt as o,Yn as s,Zn as c,_n as l,ur as u}from"./lucide-react-C4eXYCwx.js";import{a as d}from"./types-DorDDvEb.js";import{K as f}from"./display-BWi8DQCp.js";import{t as p}from"./badge-D8fABzMs.js";import{t as m}from"./button-KASZcscA.js";import{r as h}from"./index-aCfZQ7LY.js";import{a as g,i as _,o as v,r as y,s as ee,t as b}from"./card-Cds0MWME.js";var x=e(u(),1),S=c(),C=`all`;function w(e){return e.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function T(e){return[...e].sort((e,t)=>{let n=e.category.localeCompare(t.category);if(n!==0)return n;let r=e.title.localeCompare(t.title);return r===0?e.slug.localeCompare(t.slug):r})}function E(){let[e,c]=(0,x.useState)([]),[u,E]=(0,x.useState)(!0),[D,O]=(0,x.useState)(``),[k,A]=(0,x.useState)(``),[j,M]=(0,x.useState)(``),[N,P]=(0,x.useState)(C),[F,I]=(0,x.useState)(``),[L,R]=(0,x.useState)({}),[z,B]=(0,x.useState)(``),[V,H]=(0,x.useState)(()=>Date.now());async function U(){E(!0),O(``);try{c(T(await a(`GET`,`/settings/prompts`))),H(Date.now())}catch(e){O(d(e))}finally{E(!1)}}(0,x.useEffect)(()=>{U()},[]);let W=(0,x.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.category,(t.get(n.category)??0)+1);return[...t.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({key:e,count:t,label:w(e)}))},[e]),G=N===C||W.some(e=>e.key===N)?N:C,K=(0,x.useMemo)(()=>G===C?e:e.filter(e=>e.category===G),[G,e]),q=K.some(e=>e.slug===F)?F:K[0]?.slug??``,J=K.find(e=>e.slug===q)??null,Y=J?L[J.slug]??J.template:``,X=J?Y!==J.template:!1,Z=e.filter(e=>e.template!==e.defaultTemplate).length,Q=J?z===J.slug:!1;function te(e){I(e),A(``),M(``)}function $(e){c(t=>T(t.map(t=>t.slug===e.slug?e:t))),R(t=>({...t,[e.slug]:e.template})),H(Date.now())}async function ne(){if(!(!J||!X)){B(J.slug),A(``),M(``);try{let e=await a(`PUT`,`/settings/prompts/${encodeURIComponent(J.slug)}`,{template:Y});$(e),M(`Saved ${e.title}.`)}catch(e){A(d(e))}finally{B(``)}}}async function re(){if(!(!J||J.template===J.defaultTemplate)){B(J.slug),A(``),M(``);try{let e=await a(`POST`,`/settings/prompts/${encodeURIComponent(J.slug)}/reset`);$(e),M(`Reset ${e.title} to the built-in default.`)}catch(e){A(d(e))}finally{B(``)}}}function ie(){J&&(R(e=>({...e,[J.slug]:J.template})),A(``),M(`Unsaved edits discarded.`))}return(0,S.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Prompts`}),(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`View and edit the externalized prompt templates used across Relay lifecycle, routing, workspace, and automation flows.`})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsxs)(p,{variant:`outline`,className:`gap-1`,children:[(0,S.jsx)(o,{className:`size-3`}),e.length,` template`,e.length===1?``:`s`]}),(0,S.jsxs)(p,{variant:`outline`,className:s(`gap-1`,Z>0&&`border-amber-500/40 bg-amber-500/10 text-amber-300`),children:[Z,` modified`]}),(0,S.jsxs)(m,{variant:`outline`,size:`sm`,onClick:()=>void U(),disabled:u,children:[(0,S.jsx)(n,{className:s(`size-4`,u&&`animate-spin`)}),`Refresh`]})]})]}),D&&(0,S.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,S.jsx)(l,{className:`mt-0.5 size-4`}),(0,S.jsx)(`span`,{children:D})]}),u&&e.length===0?(0,S.jsx)(b,{size:`sm`,children:(0,S.jsx)(y,{className:`text-sm text-muted-foreground`,children:`Loading prompt templates…`})}):e.length===0?(0,S.jsx)(b,{children:(0,S.jsx)(y,{className:`py-10 text-center text-sm text-muted-foreground`,children:`No prompt templates are available yet.`})}):(0,S.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[220px_minmax(0,0.9fr)_minmax(0,1.1fr)]`,children:[(0,S.jsxs)(`nav`,{className:`space-y-1 xl:sticky xl:top-4 xl:self-start`,children:[(0,S.jsxs)(`button`,{type:`button`,className:s(`w-full rounded-md border px-3 py-2 text-left text-sm transition-colors`,G===C?`border-primary/50 bg-primary/10 text-foreground`:`border-transparent hover:border-border hover:bg-accent`),onClick:()=>P(C),children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium`,children:`All`}),(0,S.jsx)(p,{variant:`outline`,className:`ml-auto h-4 px-1 text-[10px]`,children:e.length})]}),(0,S.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:`Every externalized prompt template`})]}),W.map(e=>(0,S.jsxs)(`button`,{type:`button`,className:s(`w-full rounded-md border px-3 py-2 text-left text-sm transition-colors`,G===e.key?`border-primary/50 bg-primary/10 text-foreground`:`border-transparent hover:border-border hover:bg-accent`),onClick:()=>P(e.key),children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,S.jsx)(p,{variant:`outline`,className:`ml-auto h-4 px-1 text-[10px]`,children:e.count})]}),(0,S.jsx)(`span`,{className:`block truncate text-xs font-mono text-muted-foreground`,children:e.key})]},e.key))]}),(0,S.jsxs)(`div`,{className:`min-w-0 space-y-3`,children:[(0,S.jsx)(`div`,{className:`flex items-center justify-between gap-2 px-1`,children:(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h2`,{className:`text-sm font-semibold`,children:G===C?`All templates`:`${w(G)} templates`}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[K.length,` template`,K.length===1?``:`s`,` in this view`]})]})}),K.map(e=>{let t=e.slug===q,n=e.template!==e.defaultTemplate;return(0,S.jsx)(`button`,{type:`button`,className:s(`w-full rounded-xl border p-4 text-left transition-colors`,t?`border-primary/50 bg-primary/10 ring-1 ring-primary/20`:`border-border bg-card hover:border-primary/30 hover:bg-accent`),onClick:()=>te(e.slug),children:(0,S.jsx)(`div`,{className:`flex flex-wrap items-start gap-2`,children:(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:e.title}),n&&(0,S.jsx)(p,{className:`bg-amber-500/15 text-amber-300 hover:bg-amber-500/15`,children:`Modified`}),(0,S.jsx)(p,{variant:`outline`,className:`text-[10px]`,children:w(e.category)})]}),(0,S.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground`,children:e.slug}),e.description&&(0,S.jsx)(`p`,{className:`mt-2 line-clamp-2 text-sm text-muted-foreground`,children:e.description}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-[11px] text-muted-foreground`,children:[(0,S.jsxs)(`span`,{children:[e.variables.length,` variable`,e.variables.length===1?``:`s`]}),(0,S.jsxs)(`span`,{children:[`Updated `,f(V,e.updatedAt)]})]})]})})},e.slug)})]}),(0,S.jsx)(`div`,{className:`min-w-0`,children:J?(0,S.jsxs)(b,{children:[(0,S.jsxs)(v,{className:`border-b border-border`,children:[(0,S.jsxs)(ee,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{children:J.title}),J.template!==J.defaultTemplate&&(0,S.jsx)(p,{className:`bg-amber-500/15 text-amber-300 hover:bg-amber-500/15`,children:`Customized`}),X&&(0,S.jsx)(p,{variant:`outline`,children:`Unsaved`})]}),(0,S.jsxs)(_,{className:`space-y-1`,children:[(0,S.jsx)(`div`,{className:`font-mono text-[11px]`,children:J.slug}),J.description&&(0,S.jsx)(`div`,{children:J.description})]})]}),(0,S.jsxs)(y,{className:`space-y-4 pt-4`,children:[k&&(0,S.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-2 text-xs text-destructive`,children:[(0,S.jsx)(l,{className:`mt-0.5 size-3.5`}),(0,S.jsx)(`span`,{children:k})]}),j&&(0,S.jsx)(`div`,{className:`rounded-md border border-emerald-500/30 bg-emerald-500/10 px-3 py-2 text-xs text-emerald-300`,children:j}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,S.jsx)(r,{className:`size-3.5`}),`Available variables`]}),J.variables.length>0?(0,S.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:J.variables.map(e=>(0,S.jsx)(p,{variant:`secondary`,className:`font-mono text-[11px]`,children:`{{${e}}}`},e))}):(0,S.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`This template has no placeholder variables.`})]}),J.template!==J.defaultTemplate&&(0,S.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-200`,children:`This template differs from the built-in default. Reset will restore the original text.`}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(`label`,{htmlFor:`prompt-template-editor`,className:`text-xs font-medium text-muted-foreground`,children:`Template text`}),(0,S.jsx)(h,{id:`prompt-template-editor`,value:Y,onChange:e=>{let t=e.target.value;R(e=>({...e,[J.slug]:t})),k&&A(``),j&&M(``)},rows:18,spellCheck:!1,className:`min-h-[360px] resize-y font-mono text-xs leading-5`})]})]}),(0,S.jsxs)(g,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,S.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:X?`Editing local changes.`:`Updated ${f(V,J.updatedAt)}.`}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[J.template!==J.defaultTemplate&&(0,S.jsxs)(m,{variant:`outline`,size:`sm`,onClick:()=>void re(),disabled:Q,children:[(0,S.jsx)(i,{className:`size-4`}),`Reset to default`]}),(0,S.jsx)(m,{variant:`outline`,size:`sm`,onClick:ie,disabled:!X||Q,children:`Cancel`}),(0,S.jsxs)(m,{size:`sm`,onClick:()=>void ne(),disabled:!X||Q,children:[(0,S.jsx)(t,{className:`size-4`}),`Save`]})]})]})]}):(0,S.jsx)(b,{size:`sm`,children:(0,S.jsx)(y,{className:`text-sm text-muted-foreground`,children:`Select a prompt template to edit it.`})})})]})]})}export{E as PromptSettingsView};
|
|
2
|
-
//# sourceMappingURL=prompt-settings-Df-0ZMJ5.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-settings-Df-0ZMJ5.js","names":[],"sources":["../../dashboard/src/components/views/prompt-settings.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react'\nimport { api } from '@/lib/api'\nimport { cn } from '@/lib/utils'\nimport { timeAgo } from '@/lib/display'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'\nimport { Textarea } from '@/components/ui/textarea'\nimport { AlertCircle, Braces, FileText, RefreshCw, RotateCcw, Save } from 'lucide-react'\nimport { errMessage } from 'agent-relay-sdk/types'\n\ninterface PromptTemplate {\n slug: string\n category: string\n title: string\n description?: string\n template: string\n defaultTemplate: string\n variables: string[]\n updatedAt: number\n createdAt: number\n}\n\nconst ALL_CATEGORY = 'all'\n\n\nfunction titleCaseCategory(category: string): string {\n return category\n .split(/[^a-zA-Z0-9]+/)\n .filter(Boolean)\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(' ')\n}\n\nfunction sortTemplates(items: PromptTemplate[]): PromptTemplate[] {\n return [...items].sort((a, b) => {\n const category = a.category.localeCompare(b.category)\n if (category !== 0) return category\n const title = a.title.localeCompare(b.title)\n if (title !== 0) return title\n return a.slug.localeCompare(b.slug)\n })\n}\n\nexport function PromptSettingsView() {\n const [templates, setTemplates] = useState<PromptTemplate[]>([])\n const [loading, setLoading] = useState(true)\n const [loadError, setLoadError] = useState('')\n const [actionError, setActionError] = useState('')\n const [notice, setNotice] = useState('')\n const [activeCategory, setActiveCategory] = useState(ALL_CATEGORY)\n const [selectedSlug, setSelectedSlug] = useState('')\n const [drafts, setDrafts] = useState<Record<string, string>>({})\n const [savingSlug, setSavingSlug] = useState('')\n const [now, setNow] = useState(() => Date.now())\n\n async function reload() {\n setLoading(true)\n setLoadError('')\n try {\n const result = await api<PromptTemplate[]>('GET', '/settings/prompts')\n setTemplates(sortTemplates(result))\n setNow(Date.now())\n } catch (error) {\n setLoadError(errMessage(error))\n } finally {\n setLoading(false)\n }\n }\n\n useEffect(() => {\n void reload()\n }, [])\n\n const categories = useMemo(() => {\n const counts = new Map<string, number>()\n for (const template of templates) counts.set(template.category, (counts.get(template.category) ?? 0) + 1)\n return [...counts.entries()]\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([key, count]) => ({ key, count, label: titleCaseCategory(key) }))\n }, [templates])\n\n const effectiveCategory = activeCategory === ALL_CATEGORY || categories.some((item) => item.key === activeCategory)\n ? activeCategory\n : ALL_CATEGORY\n\n const visibleTemplates = useMemo(() => {\n if (effectiveCategory === ALL_CATEGORY) return templates\n return templates.filter((template) => template.category === effectiveCategory)\n }, [effectiveCategory, templates])\n\n const resolvedSelectedSlug = visibleTemplates.some((template) => template.slug === selectedSlug)\n ? selectedSlug\n : (visibleTemplates[0]?.slug ?? '')\n\n const selectedTemplate = visibleTemplates.find((template) => template.slug === resolvedSelectedSlug) ?? null\n const draft = selectedTemplate ? (drafts[selectedTemplate.slug] ?? selectedTemplate.template) : ''\n const hasUnsavedChanges = selectedTemplate ? draft !== selectedTemplate.template : false\n const modifiedCount = templates.filter((template) => template.template !== template.defaultTemplate).length\n const saving = selectedTemplate ? savingSlug === selectedTemplate.slug : false\n\n function selectTemplate(slug: string) {\n setSelectedSlug(slug)\n setActionError('')\n setNotice('')\n }\n\n function replaceTemplate(updated: PromptTemplate) {\n setTemplates((current) => sortTemplates(current.map((template) => template.slug === updated.slug ? updated : template)))\n setDrafts((current) => ({ ...current, [updated.slug]: updated.template }))\n setNow(Date.now())\n }\n\n async function saveTemplate() {\n if (!selectedTemplate || !hasUnsavedChanges) return\n setSavingSlug(selectedTemplate.slug)\n setActionError('')\n setNotice('')\n try {\n const updated = await api<PromptTemplate>('PUT', `/settings/prompts/${encodeURIComponent(selectedTemplate.slug)}`, {\n template: draft,\n })\n replaceTemplate(updated)\n setNotice(`Saved ${updated.title}.`)\n } catch (error) {\n setActionError(errMessage(error))\n } finally {\n setSavingSlug('')\n }\n }\n\n async function resetTemplate() {\n if (!selectedTemplate || selectedTemplate.template === selectedTemplate.defaultTemplate) return\n setSavingSlug(selectedTemplate.slug)\n setActionError('')\n setNotice('')\n try {\n const updated = await api<PromptTemplate>('POST', `/settings/prompts/${encodeURIComponent(selectedTemplate.slug)}/reset`)\n replaceTemplate(updated)\n setNotice(`Reset ${updated.title} to the built-in default.`)\n } catch (error) {\n setActionError(errMessage(error))\n } finally {\n setSavingSlug('')\n }\n }\n\n function cancelDraft() {\n if (!selectedTemplate) return\n setDrafts((current) => ({ ...current, [selectedTemplate.slug]: selectedTemplate.template }))\n setActionError('')\n setNotice('Unsaved edits discarded.')\n }\n\n return (\n <div className=\"space-y-4 p-4\">\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div>\n <h1 className=\"text-lg font-semibold\">Prompts</h1>\n <p className=\"text-sm text-muted-foreground\">View and edit the externalized prompt templates used across Relay lifecycle, routing, workspace, and automation flows.</p>\n </div>\n <div className=\"flex flex-wrap items-center gap-2\">\n <Badge variant=\"outline\" className=\"gap-1\">\n <FileText className=\"size-3\" />\n {templates.length} template{templates.length === 1 ? '' : 's'}\n </Badge>\n <Badge variant=\"outline\" className={cn('gap-1', modifiedCount > 0 && 'border-amber-500/40 bg-amber-500/10 text-amber-300')}>\n {modifiedCount} modified\n </Badge>\n <Button variant=\"outline\" size=\"sm\" onClick={() => void reload()} disabled={loading}>\n <RefreshCw className={cn('size-4', loading && 'animate-spin')} />\n Refresh\n </Button>\n </div>\n </div>\n\n {loadError && (\n <div className=\"flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive\">\n <AlertCircle className=\"mt-0.5 size-4\" />\n <span>{loadError}</span>\n </div>\n )}\n\n {loading && templates.length === 0 ? (\n <Card size=\"sm\">\n <CardContent className=\"text-sm text-muted-foreground\">Loading prompt templates…</CardContent>\n </Card>\n ) : templates.length === 0 ? (\n <Card>\n <CardContent className=\"py-10 text-center text-sm text-muted-foreground\">\n No prompt templates are available yet.\n </CardContent>\n </Card>\n ) : (\n <div className=\"grid gap-4 xl:grid-cols-[220px_minmax(0,0.9fr)_minmax(0,1.1fr)]\">\n <nav className=\"space-y-1 xl:sticky xl:top-4 xl:self-start\">\n <button\n type=\"button\"\n className={cn(\n 'w-full rounded-md border px-3 py-2 text-left text-sm transition-colors',\n effectiveCategory === ALL_CATEGORY ? 'border-primary/50 bg-primary/10 text-foreground' : 'border-transparent hover:border-border hover:bg-accent',\n )}\n onClick={() => setActiveCategory(ALL_CATEGORY)}\n >\n <span className=\"flex items-center gap-2\">\n <span className=\"font-medium\">All</span>\n <Badge variant=\"outline\" className=\"ml-auto h-4 px-1 text-[10px]\">{templates.length}</Badge>\n </span>\n <span className=\"block truncate text-xs text-muted-foreground\">Every externalized prompt template</span>\n </button>\n\n {categories.map((category) => (\n <button\n key={category.key}\n type=\"button\"\n className={cn(\n 'w-full rounded-md border px-3 py-2 text-left text-sm transition-colors',\n effectiveCategory === category.key ? 'border-primary/50 bg-primary/10 text-foreground' : 'border-transparent hover:border-border hover:bg-accent',\n )}\n onClick={() => setActiveCategory(category.key)}\n >\n <span className=\"flex items-center gap-2\">\n <span className=\"font-medium\">{category.label}</span>\n <Badge variant=\"outline\" className=\"ml-auto h-4 px-1 text-[10px]\">{category.count}</Badge>\n </span>\n <span className=\"block truncate text-xs font-mono text-muted-foreground\">{category.key}</span>\n </button>\n ))}\n </nav>\n\n <div className=\"min-w-0 space-y-3\">\n <div className=\"flex items-center justify-between gap-2 px-1\">\n <div>\n <h2 className=\"text-sm font-semibold\">\n {effectiveCategory === ALL_CATEGORY ? 'All templates' : `${titleCaseCategory(effectiveCategory)} templates`}\n </h2>\n <p className=\"text-xs text-muted-foreground\">{visibleTemplates.length} template{visibleTemplates.length === 1 ? '' : 's'} in this view</p>\n </div>\n </div>\n\n {visibleTemplates.map((template) => {\n const selected = template.slug === resolvedSelectedSlug\n const modified = template.template !== template.defaultTemplate\n return (\n <button\n key={template.slug}\n type=\"button\"\n className={cn(\n 'w-full rounded-xl border p-4 text-left transition-colors',\n selected ? 'border-primary/50 bg-primary/10 ring-1 ring-primary/20' : 'border-border bg-card hover:border-primary/30 hover:bg-accent',\n )}\n onClick={() => selectTemplate(template.slug)}\n >\n <div className=\"flex flex-wrap items-start gap-2\">\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"font-medium text-foreground\">{template.title}</span>\n {modified && (\n <Badge className=\"bg-amber-500/15 text-amber-300 hover:bg-amber-500/15\">Modified</Badge>\n )}\n <Badge variant=\"outline\" className=\"text-[10px]\">{titleCaseCategory(template.category)}</Badge>\n </div>\n <div className=\"mt-1 font-mono text-[11px] text-muted-foreground\">{template.slug}</div>\n {template.description && (\n <p className=\"mt-2 line-clamp-2 text-sm text-muted-foreground\">{template.description}</p>\n )}\n <div className=\"mt-3 flex flex-wrap items-center gap-3 text-[11px] text-muted-foreground\">\n <span>{template.variables.length} variable{template.variables.length === 1 ? '' : 's'}</span>\n <span>Updated {timeAgo(now, template.updatedAt)}</span>\n </div>\n </div>\n </div>\n </button>\n )\n })}\n </div>\n\n <div className=\"min-w-0\">\n {selectedTemplate ? (\n <Card>\n <CardHeader className=\"border-b border-border\">\n <CardTitle className=\"flex flex-wrap items-center gap-2\">\n <span>{selectedTemplate.title}</span>\n {selectedTemplate.template !== selectedTemplate.defaultTemplate && (\n <Badge className=\"bg-amber-500/15 text-amber-300 hover:bg-amber-500/15\">Customized</Badge>\n )}\n {hasUnsavedChanges && <Badge variant=\"outline\">Unsaved</Badge>}\n </CardTitle>\n <CardDescription className=\"space-y-1\">\n <div className=\"font-mono text-[11px]\">{selectedTemplate.slug}</div>\n {selectedTemplate.description && <div>{selectedTemplate.description}</div>}\n </CardDescription>\n </CardHeader>\n\n <CardContent className=\"space-y-4 pt-4\">\n {actionError && (\n <div className=\"flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-2 text-xs text-destructive\">\n <AlertCircle className=\"mt-0.5 size-3.5\" />\n <span>{actionError}</span>\n </div>\n )}\n\n {notice && (\n <div className=\"rounded-md border border-emerald-500/30 bg-emerald-500/10 px-3 py-2 text-xs text-emerald-300\">\n {notice}\n </div>\n )}\n\n <div className=\"space-y-2\">\n <div className=\"flex items-center gap-2 text-xs font-medium text-muted-foreground\">\n <Braces className=\"size-3.5\" />\n Available variables\n </div>\n {selectedTemplate.variables.length > 0 ? (\n <div className=\"flex flex-wrap gap-1.5\">\n {selectedTemplate.variables.map((variable) => (\n <Badge key={variable} variant=\"secondary\" className=\"font-mono text-[11px]\">\n {`{{${variable}}}`}\n </Badge>\n ))}\n </div>\n ) : (\n <div className=\"text-xs text-muted-foreground\">This template has no placeholder variables.</div>\n )}\n </div>\n\n {selectedTemplate.template !== selectedTemplate.defaultTemplate && (\n <div className=\"rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-200\">\n This template differs from the built-in default. Reset will restore the original text.\n </div>\n )}\n\n <div className=\"space-y-1.5\">\n <label htmlFor=\"prompt-template-editor\" className=\"text-xs font-medium text-muted-foreground\">\n Template text\n </label>\n <Textarea\n id=\"prompt-template-editor\"\n value={draft}\n onChange={(event) => {\n const next = event.target.value\n setDrafts((current) => ({ ...current, [selectedTemplate.slug]: next }))\n if (actionError) setActionError('')\n if (notice) setNotice('')\n }}\n rows={18}\n spellCheck={false}\n className=\"min-h-[360px] resize-y font-mono text-xs leading-5\"\n />\n </div>\n </CardContent>\n\n <CardFooter className=\"flex flex-wrap items-center justify-between gap-2\">\n <div className=\"text-xs text-muted-foreground\">\n {hasUnsavedChanges ? 'Editing local changes.' : `Updated ${timeAgo(now, selectedTemplate.updatedAt)}.`}\n </div>\n <div className=\"flex flex-wrap items-center gap-2\">\n {selectedTemplate.template !== selectedTemplate.defaultTemplate && (\n <Button variant=\"outline\" size=\"sm\" onClick={() => void resetTemplate()} disabled={saving}>\n <RotateCcw className=\"size-4\" />\n Reset to default\n </Button>\n )}\n <Button variant=\"outline\" size=\"sm\" onClick={cancelDraft} disabled={!hasUnsavedChanges || saving}>\n Cancel\n </Button>\n <Button size=\"sm\" onClick={() => void saveTemplate()} disabled={!hasUnsavedChanges || saving}>\n <Save className=\"size-4\" />\n Save\n </Button>\n </div>\n </CardFooter>\n </Card>\n ) : (\n <Card size=\"sm\">\n <CardContent className=\"text-sm text-muted-foreground\">\n Select a prompt template to edit it.\n </CardContent>\n </Card>\n )}\n </div>\n </div>\n )}\n </div>\n )\n}\n"],"mappings":"wcAuBM,EAAe,MAGrB,SAAS,EAAkB,EAA0B,CACnD,OAAO,EACJ,MAAM,gBAAgB,CACtB,OAAO,QAAQ,CACf,IAAK,GAAS,EAAK,OAAO,EAAE,CAAC,aAAa,CAAG,EAAK,MAAM,EAAE,CAAC,CAC3D,KAAK,IAAI,CAGd,SAAS,EAAc,EAA2C,CAChE,MAAO,CAAC,GAAG,EAAM,CAAC,MAAM,EAAG,IAAM,CAC/B,IAAM,EAAW,EAAE,SAAS,cAAc,EAAE,SAAS,CACrD,GAAI,IAAa,EAAG,OAAO,EAC3B,IAAM,EAAQ,EAAE,MAAM,cAAc,EAAE,MAAM,CAE5C,OADI,IAAU,EACP,EAAE,KAAK,cAAc,EAAE,KAAK,CADX,GAExB,CAGJ,SAAgB,GAAqB,CACnC,GAAM,CAAC,EAAW,IAAA,EAAA,EAAA,UAA2C,EAAE,CAAC,CAC1D,CAAC,EAAS,IAAA,EAAA,EAAA,UAAuB,GAAK,CACtC,CAAC,EAAW,IAAA,EAAA,EAAA,UAAyB,GAAG,CACxC,CAAC,EAAa,IAAA,EAAA,EAAA,UAA2B,GAAG,CAC5C,CAAC,EAAQ,IAAA,EAAA,EAAA,UAAsB,GAAG,CAClC,CAAC,EAAgB,IAAA,EAAA,EAAA,UAA8B,EAAa,CAC5D,CAAC,EAAc,IAAA,EAAA,EA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