agent-relay-server 0.105.1 → 0.106.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/openapi.json +1 -1
- package/package.json +3 -1
- 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 +15 -3
- package/runner/src/adapter.ts +14 -3
- package/src/connectors.ts +116 -4
- package/src/mcp-egress-tools.ts +3 -2
- package/src/notification-router.ts +6 -1
- package/src/notify.ts +4 -4
- package/src/prompt-resolver.ts +23 -23
- package/src/quota-band-transition.ts +6 -0
- package/src/token-db.ts +3 -3
- package/public/assets/prompt-settings-Df-0ZMJ5.js +0 -2
- package/public/assets/prompt-settings-Df-0ZMJ5.js.map +0 -1
|
@@ -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,QA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,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"}
|
|
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-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,GAAM,EAAE,YAAY,CACjD,EAAkB,EAAe,GAAM,EAAE,gBAAgB,CACzD,EAAqB,EAAe,GAAM,EAAE,mBAAmB,CAE/D,EAAgB,GAAkB,CAClC,EAAQ,GAAmB,CAE3B,EAAiB,EAAM,OAAQ,GAAM,EAAE,UAAU,CAAC,OAExD,SAAS,EAAY,EAAqB,CACxC,GAAI,CAAC,EAAQ,KAAM,CAAE,EAAU,aAAc,mCAAmC,CAAE,OAC9E,EAAK,aAAe,QAAU,EAAK,KAAM,EAAY,EAAK,KAAK,GAAG,CAC7D,EAAK,aAAe,WAAa,EAAK,SAAS,EAAQ,EAAK,QAAQ,GAAG,CAGlF,SAAS,EAAa,EAAqB,CAEzC,EAAY,cAAe,WADb,EAAK,QAAU,EAAK,aAAe,OAAS,SAAS,EAAK,KAAO,YAAY,EAAK,MACpD,+BAAkC,CACxE,EAAK,aAAe,QAAU,EAAK,KAAM,EAAmB,EAAK,KAAM,WAAW,CA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D,CAAM,UAAU,qBAAa,EAAK,OAAc,CAAA,EAElD,EAAA,EAAA,MAAC,OAAD,CAAM,MAAO,OAAO,EAAK,UAAU,UAAnC,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">
|
|
@@ -1035,6 +1035,17 @@ var NOTIFICATION_NUDGE = "\u21AA Notification \u2014 no reply needed.";
|
|
|
1035
1035
|
function isNotificationMessage(message) {
|
|
1036
1036
|
return isPersistedRelayMessage(message) && message.replyExpected === false;
|
|
1037
1037
|
}
|
|
1038
|
+
function dedupePersistedMessages(messages2) {
|
|
1039
|
+
const seen = new Set;
|
|
1040
|
+
return messages2.filter((message) => {
|
|
1041
|
+
if (!isPersistedRelayMessage(message))
|
|
1042
|
+
return true;
|
|
1043
|
+
if (seen.has(message.id))
|
|
1044
|
+
return false;
|
|
1045
|
+
seen.add(message.id);
|
|
1046
|
+
return true;
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1038
1049
|
function providerAttachmentText(message) {
|
|
1039
1050
|
const refs = attachmentRefs(message);
|
|
1040
1051
|
if (!refs.length)
|
|
@@ -1165,11 +1176,12 @@ function replyReminder(message, readOnly) {
|
|
|
1165
1176
|
}
|
|
1166
1177
|
function claudeProviderMessageText(messages2, options) {
|
|
1167
1178
|
const relaySurface = options.relaySurface !== false;
|
|
1168
|
-
const
|
|
1169
|
-
const
|
|
1179
|
+
const uniqueMessages = dedupePersistedMessages(messages2);
|
|
1180
|
+
const sections = uniqueMessages.map((message) => formatMessage(message, relaySurface));
|
|
1181
|
+
const replyable = latestReplyableMessage(uniqueMessages);
|
|
1170
1182
|
if (relaySurface && replyable && shouldShowReplyReminder(options.deliveryCount)) {
|
|
1171
1183
|
sections.push(replyReminder(replyable, options.readOnly === true));
|
|
1172
|
-
} else if (relaySurface && !replyable &&
|
|
1184
|
+
} else if (relaySurface && !replyable && uniqueMessages.some(isNotificationMessage)) {
|
|
1173
1185
|
sections.push(NOTIFICATION_NUDGE);
|
|
1174
1186
|
}
|
|
1175
1187
|
return sections.join(`
|
package/runner/src/adapter.ts
CHANGED
|
@@ -304,6 +304,16 @@ function latestReplyableMessage(messages: Message[]): Message | undefined {
|
|
|
304
304
|
.at(-1);
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
+
export function dedupePersistedMessages(messages: Message[]): Message[] {
|
|
308
|
+
const seen = new Set<number>();
|
|
309
|
+
return messages.filter((message) => {
|
|
310
|
+
if (!isPersistedRelayMessage(message)) return true;
|
|
311
|
+
if (seen.has(message.id)) return false;
|
|
312
|
+
seen.add(message.id);
|
|
313
|
+
return true;
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
|
|
307
317
|
function providerSenderLabel(message: Message): string {
|
|
308
318
|
if (message.from === "user") return "human user";
|
|
309
319
|
const source = isRecord(message.payload?.source) ? message.payload.source : undefined;
|
|
@@ -356,9 +366,10 @@ export function providerAttachmentText(message: Message): string | undefined {
|
|
|
356
366
|
}
|
|
357
367
|
|
|
358
368
|
export function providerMessageText(messages: Message[]): string {
|
|
359
|
-
const
|
|
369
|
+
const uniqueMessages = dedupePersistedMessages(messages);
|
|
370
|
+
const replyable = latestReplyableMessage(uniqueMessages);
|
|
360
371
|
const maxChars = providerMessageBodyMaxChars();
|
|
361
|
-
const sections =
|
|
372
|
+
const sections = uniqueMessages
|
|
362
373
|
.map((message) => {
|
|
363
374
|
const subject = message.subject ? `Subject: ${message.subject}\n` : "";
|
|
364
375
|
const isMemoryContext = isMemoryInjection(message);
|
|
@@ -404,7 +415,7 @@ export function providerMessageText(messages: Message[]): string {
|
|
|
404
415
|
"If you already delivered the useful response through Relay, do not send a separate status-only confirmation.",
|
|
405
416
|
"If multiple messages arrived together, cover them in one reply instead of answering each line separately.",
|
|
406
417
|
].join("\n"));
|
|
407
|
-
} else if (
|
|
418
|
+
} else if (uniqueMessages.some(isNotificationMessage)) {
|
|
408
419
|
// #283 — pure notification batch: no scaffold, just the one-line no-reply nudge.
|
|
409
420
|
sections.push(NOTIFICATION_NUDGE);
|
|
410
421
|
}
|
package/src/connectors.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { ValidationError } from "./db";
|
|
|
6
6
|
import { isRecord } from "agent-relay-sdk";
|
|
7
7
|
import { registerConnectorConfigSetting, validateConnectorConfig } from "./settings/modules";
|
|
8
8
|
import { connectorActionTimeoutMs as configuredConnectorActionTimeoutMs, connectorsDirFromEnv } from "./config";
|
|
9
|
+
import { getConfig } from "./config-store";
|
|
9
10
|
|
|
10
11
|
const CONNECTOR_SCHEMA = "agent-relay.connector.v1";
|
|
11
12
|
const VALID_KINDS = new Set(["channel", "event", "provider", "orchestrator"]);
|
|
@@ -248,13 +249,124 @@ async function refreshConnectorStatus(id: string): Promise<void> {
|
|
|
248
249
|
}
|
|
249
250
|
|
|
250
251
|
export function startConnectorStatusPoller(): void {
|
|
251
|
-
//
|
|
252
|
-
// deploy
|
|
253
|
-
//
|
|
254
|
-
|
|
252
|
+
// 1. Auto-register + auto-start the bundled channels host so ntfy/webhook egress
|
|
253
|
+
// survives a deploy/restart with NO manual `register`/`start` (issue #794). Core
|
|
254
|
+
// removed its in-core ntfy transport (v0.102.0), so this connector IS the egress
|
|
255
|
+
// path now. Runs BEFORE reconcile so a fresh install is registered before the
|
|
256
|
+
// boot relaunch + first status poll observe it.
|
|
257
|
+
// 2. Relaunch connectors that were running before this process restarted (e.g. a
|
|
258
|
+
// deploy that took down the relay/orchestrator tree) BEFORE the first status
|
|
259
|
+
// poll overwrites their persisted "running" flag with the now-dead reality.
|
|
260
|
+
void ensureChannelsHostConnector()
|
|
261
|
+
.catch(() => {})
|
|
262
|
+
.finally(() => void reconcileConnectorsOnBoot().finally(() => void refreshAllConnectorStatuses()));
|
|
255
263
|
setInterval(() => void refreshAllConnectorStatuses(), STATUS_POLL_INTERVAL_MS);
|
|
256
264
|
}
|
|
257
265
|
|
|
266
|
+
const CHANNELS_HOST_ID = "channels-host";
|
|
267
|
+
const CHANNELS_HOST_PACKAGE = "agent-relay-channels-host";
|
|
268
|
+
// The legacy in-core ntfy channel persisted its settings here (src/ntfy.ts, removed in
|
|
269
|
+
// v0.102.0). We migrate that value into the channels-host connector config on first
|
|
270
|
+
// registration so an operator's existing ntfy setup keeps working after the cutover.
|
|
271
|
+
const LEGACY_NTFY_NAMESPACE = "channel-type";
|
|
272
|
+
const LEGACY_NTFY_KEY = "ntfy";
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Resolve the DEPLOYED channels-host CLI entry. In the published runtime it lives at
|
|
276
|
+
* `~/.agent-relay/runtime/node_modules/agent-relay-channels-host` (a dependency of
|
|
277
|
+
* agent-relay-server); in the dev tree it resolves to the workspace symlink. Returns
|
|
278
|
+
* null when the package isn't installed (e.g. a server checkout without the workspace
|
|
279
|
+
* dep) so boot stays a no-op rather than throwing.
|
|
280
|
+
*/
|
|
281
|
+
function resolveChannelsHostEntry(): string | null {
|
|
282
|
+
try {
|
|
283
|
+
const pkgJsonPath = Bun.resolveSync(`${CHANNELS_HOST_PACKAGE}/package.json`, import.meta.dir);
|
|
284
|
+
const pkgDir = dirname(pkgJsonPath);
|
|
285
|
+
const pkg = JSON.parse(readFileSync(pkgJsonPath, "utf8")) as { bin?: Record<string, string> | string };
|
|
286
|
+
const binRel = typeof pkg.bin === "string" ? pkg.bin : pkg.bin?.[CHANNELS_HOST_PACKAGE] ?? "src/index.ts";
|
|
287
|
+
return join(pkgDir, binRel);
|
|
288
|
+
} catch {
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** Ask the deployed binary for its aggregated connector manifest (single source of truth). */
|
|
294
|
+
async function loadChannelsHostManifest(entry: string): Promise<ConnectorManifest | null> {
|
|
295
|
+
try {
|
|
296
|
+
const proc = Bun.spawn({
|
|
297
|
+
cmd: ["bun", entry, "manifest"],
|
|
298
|
+
stdout: "pipe",
|
|
299
|
+
stderr: "ignore",
|
|
300
|
+
env: { ...process.env, AGENT_RELAY_CONNECTOR_ID: CHANNELS_HOST_ID, AGENT_RELAY_CONNECTORS_DIR: connectorRegistryDir() },
|
|
301
|
+
});
|
|
302
|
+
const timeout = setTimeout(() => proc.kill(), connectorActionTimeoutMs());
|
|
303
|
+
const [exitCode, stdout] = await Promise.all([proc.exited, new Response(proc.stdout).text()]);
|
|
304
|
+
clearTimeout(timeout);
|
|
305
|
+
if (exitCode !== 0) return null;
|
|
306
|
+
const parsed = parseJsonMaybe(stdout.trim());
|
|
307
|
+
const manifest = isRecord(parsed) && isRecord(parsed.manifest) ? parsed.manifest : parsed;
|
|
308
|
+
return normalizeConnectorManifest(manifest);
|
|
309
|
+
} catch {
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Migrate the legacy core ntfy settings (`channel-type/ntfy`) into channels-host
|
|
316
|
+
* connector config keys. Only an ENABLED legacy channel is migrated — a disabled one
|
|
317
|
+
* stays disabled (channels-host treats a missing NTFY_TOPIC as "off"), preserving
|
|
318
|
+
* operator intent. Returns undefined when there's nothing (active) to carry over.
|
|
319
|
+
*/
|
|
320
|
+
export function migrateLegacyNtfyConfig(): Record<string, unknown> | undefined {
|
|
321
|
+
const legacy = getConfig<Record<string, unknown>>(LEGACY_NTFY_NAMESPACE, LEGACY_NTFY_KEY)?.value;
|
|
322
|
+
if (!isRecord(legacy) || legacy.enabled !== true) return undefined;
|
|
323
|
+
const config: Record<string, string> = {};
|
|
324
|
+
const topic = typeof legacy.topic === "string" ? legacy.topic.trim() : "";
|
|
325
|
+
if (!topic) return undefined; // no topic → nothing the adapter can act on
|
|
326
|
+
config.NTFY_TOPIC = topic;
|
|
327
|
+
if (typeof legacy.serverUrl === "string" && legacy.serverUrl.trim()) config.NTFY_SERVER_URL = legacy.serverUrl.trim();
|
|
328
|
+
if (Array.isArray(legacy.defaultTags) && legacy.defaultTags.length) {
|
|
329
|
+
config.NTFY_DEFAULT_TAGS = legacy.defaultTags.filter((t): t is string => typeof t === "string").join(",");
|
|
330
|
+
}
|
|
331
|
+
if (typeof legacy.defaultClick === "string" && legacy.defaultClick.trim()) config.NTFY_DEFAULT_CLICK = legacy.defaultClick.trim();
|
|
332
|
+
if (typeof legacy.timeoutMs === "number" && Number.isFinite(legacy.timeoutMs)) config.NTFY_TIMEOUT_MS = String(legacy.timeoutMs);
|
|
333
|
+
// The legacy config stored the *name* of an env var holding the token, not the token
|
|
334
|
+
// itself; resolve it if that env var is present so the credential carries over.
|
|
335
|
+
if (typeof legacy.tokenEnv === "string" && legacy.tokenEnv.trim()) {
|
|
336
|
+
const token = process.env[legacy.tokenEnv.trim()];
|
|
337
|
+
if (token && token.trim()) config.NTFY_TOKEN = token.trim();
|
|
338
|
+
}
|
|
339
|
+
return config;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Auto-register and auto-start the channels host on boot (issue #794). Idempotent:
|
|
344
|
+
* - registers/refreshes the manifest from the deployed binary every boot (keeps the
|
|
345
|
+
* binary path + version current across upgrades) without clobbering existing config;
|
|
346
|
+
* - seeds config from the legacy core ntfy setting only on first registration;
|
|
347
|
+
* - starts the daemon unless an operator deliberately stopped it (state.running === false).
|
|
348
|
+
*/
|
|
349
|
+
export async function ensureChannelsHostConnector(): Promise<void> {
|
|
350
|
+
const entry = resolveChannelsHostEntry();
|
|
351
|
+
if (!entry) return; // package not installed in this runtime — nothing to bring up
|
|
352
|
+
const existing = getConnector(CHANNELS_HOST_ID);
|
|
353
|
+
const manifest = await loadChannelsHostManifest(entry);
|
|
354
|
+
if (!manifest) return;
|
|
355
|
+
|
|
356
|
+
const hasConfig = isRecord(existing?.config) && Object.keys(existing.config).length > 0;
|
|
357
|
+
const seedConfig = hasConfig ? undefined : migrateLegacyNtfyConfig();
|
|
358
|
+
registerConnectorManifest(manifest, seedConfig ? { config: seedConfig } : {});
|
|
359
|
+
|
|
360
|
+
// Bring it up by default; respect a deliberate stop (persisted running:false).
|
|
361
|
+
const deliberatelyStopped = existing?.state?.running === false;
|
|
362
|
+
if (deliberatelyStopped) return;
|
|
363
|
+
try {
|
|
364
|
+
await runConnectorAction(CHANNELS_HOST_ID, "start");
|
|
365
|
+
} catch {
|
|
366
|
+
/* best-effort; the status poll surfaces failures */
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
258
370
|
// On boot, bring back any connector whose last persisted state says it was
|
|
259
371
|
// running. `start` is idempotent — a daemon that survived the restart reports
|
|
260
372
|
// "already running"; one that died with the process tree is relaunched. A
|
package/src/mcp-egress-tools.ts
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
// the ntfy event payload { title, body, priority?, tags?, click? }. Same tool name
|
|
9
9
|
// and args as before; async ("accepted for delivery"). Zero ntfy HTTP transport in core.
|
|
10
10
|
//
|
|
11
|
-
//
|
|
11
|
+
// relay_send_to_channel uses channel:egress (least-privilege split — #792).
|
|
12
|
+
// relay_notify_ntfy stays on notifications:write (operator-notification shim — #773).
|
|
12
13
|
|
|
13
14
|
import { MAX_BODY_BYTES } from "./config";
|
|
14
15
|
import { getChannel, sendMessage, ValidationError } from "./db";
|
|
@@ -27,7 +28,7 @@ export const EGRESS_TOOLS: ToolDefinition[] = [
|
|
|
27
28
|
{
|
|
28
29
|
name: "relay_send_to_channel",
|
|
29
30
|
description: "Send an outbound message to a registered channel agent (e.g. ntfy, webhook). channelId is the channel agent ID; event is an opaque payload the adapter interprets.",
|
|
30
|
-
requiredScopes: ["
|
|
31
|
+
requiredScopes: ["channel:egress"],
|
|
31
32
|
inputSchema: {
|
|
32
33
|
type: "object",
|
|
33
34
|
properties: {
|
|
@@ -100,7 +100,7 @@ export function routeNotification(input: RouteNotificationInput): Message[] {
|
|
|
100
100
|
subject: input.message.subject,
|
|
101
101
|
body: input.message.body,
|
|
102
102
|
payload: { ...(input.message.payload ?? {}), routing: compactRoutingExplanation(routing) },
|
|
103
|
-
idempotencyKey: input.message.idempotencyKey,
|
|
103
|
+
idempotencyKey: recipientScopedIdempotencyKey(input.message.idempotencyKey, routing.recipient),
|
|
104
104
|
kind: input.message.kind,
|
|
105
105
|
from: input.message.from,
|
|
106
106
|
replyExpected: input.message.replyExpected,
|
|
@@ -111,6 +111,11 @@ export function routeNotification(input: RouteNotificationInput): Message[] {
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
function recipientScopedIdempotencyKey(key: string | undefined, recipient: string): string | undefined {
|
|
115
|
+
if (!key) return undefined;
|
|
116
|
+
return `${key}:recipient:${recipient}`;
|
|
117
|
+
}
|
|
118
|
+
|
|
114
119
|
export function previewNotificationRouting(input: Pick<RouteNotificationInput, "type" | "scope" | "recipients">): NotificationRoutingPreview {
|
|
115
120
|
const candidates = normalizeRoutingRecipients(input);
|
|
116
121
|
const recipients: NotificationRoutingExplanation[] = [];
|
package/src/notify.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sendMessageWithResult } from "./db";
|
|
2
2
|
import { emitNewMessage } from "./sse";
|
|
3
3
|
import type { Message, MessageKind } from "./types";
|
|
4
4
|
|
|
@@ -34,7 +34,7 @@ interface SystemNotifyOptions {
|
|
|
34
34
|
* recipient is offline (#234). Used by the GC sweep (maintenance) and lifecycle events (#239).
|
|
35
35
|
*/
|
|
36
36
|
export function notifySystemMessage(to: string, opts: SystemNotifyOptions): Message {
|
|
37
|
-
const
|
|
37
|
+
const result = sendMessageWithResult({
|
|
38
38
|
from: opts.from ?? "system",
|
|
39
39
|
to,
|
|
40
40
|
kind: opts.kind ?? "system",
|
|
@@ -45,6 +45,6 @@ export function notifySystemMessage(to: string, opts: SystemNotifyOptions): Mess
|
|
|
45
45
|
replyExpected: opts.replyExpected,
|
|
46
46
|
maxAgeSeconds: opts.maxAgeSeconds,
|
|
47
47
|
});
|
|
48
|
-
emitNewMessage(
|
|
49
|
-
return
|
|
48
|
+
if (result.created || result.updated) emitNewMessage(result.message);
|
|
49
|
+
return result.message;
|
|
50
50
|
}
|
package/src/prompt-resolver.ts
CHANGED
|
@@ -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.",
|