agent-relay-server 0.105.2 → 0.107.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.
Files changed (82) hide show
  1. package/docs/openapi.json +29 -1
  2. package/package.json +5 -3
  3. package/public/assets/{MessageBubble-CPYQQLDI.js → MessageBubble-PEdvVh_m.js} +2 -2
  4. package/public/assets/{MessageBubble-CPYQQLDI.js.map → MessageBubble-PEdvVh_m.js.map} +1 -1
  5. package/public/assets/{PlanGraphPanel-B7xZt5DI.js → PlanGraphPanel-DSts7Rtq.js} +2 -2
  6. package/public/assets/{PlanGraphPanel-B7xZt5DI.js.map → PlanGraphPanel-DSts7Rtq.js.map} +1 -1
  7. package/public/assets/{activity-UKQrQ8_0.js → activity-BcYf8YNO.js} +2 -2
  8. package/public/assets/{activity-UKQrQ8_0.js.map → activity-BcYf8YNO.js.map} +1 -1
  9. package/public/assets/{agent-profiles-Zr_5nNEJ.js → agent-profiles-CuTQtmV6.js} +2 -2
  10. package/public/assets/{agent-profiles-Zr_5nNEJ.js.map → agent-profiles-CuTQtmV6.js.map} +1 -1
  11. package/public/assets/{agents-FdrfmJsj.js → agents-CgRFJyks.js} +2 -2
  12. package/public/assets/{agents-FdrfmJsj.js.map → agents-CgRFJyks.js.map} +1 -1
  13. package/public/assets/{analytics-VximqXQ9.js → analytics-C3OTFIXo.js} +18 -18
  14. package/public/assets/{analytics-VximqXQ9.js.map → analytics-C3OTFIXo.js.map} +1 -1
  15. package/public/assets/{automation-DlEcJvgu.js → automation-CH9YGYoE.js} +2 -2
  16. package/public/assets/{automation-DlEcJvgu.js.map → automation-CH9YGYoE.js.map} +1 -1
  17. package/public/assets/{chat-D1bunuI-.js → chat-BLcm2Aht.js} +2 -2
  18. package/public/assets/{chat-D1bunuI-.js.map → chat-BLcm2Aht.js.map} +1 -1
  19. package/public/assets/{formatted-body-impl-4v9SkUD1.js → formatted-body-impl-BJTthVHg.js} +2 -2
  20. package/public/assets/{formatted-body-impl-4v9SkUD1.js.map → formatted-body-impl-BJTthVHg.js.map} +1 -1
  21. package/public/assets/{index-Vmhw442d.js → index-3ydeNO0c.js} +6 -6
  22. package/public/assets/index-3ydeNO0c.js.map +1 -0
  23. package/public/assets/{insights-CntgHcTp.js → insights-DklrIhb6.js} +2 -2
  24. package/public/assets/{insights-CntgHcTp.js.map → insights-DklrIhb6.js.map} +1 -1
  25. package/public/assets/{maintenance-Dw7frQtu.js → maintenance-FAAMGpuZ.js} +2 -2
  26. package/public/assets/{maintenance-Dw7frQtu.js.map → maintenance-FAAMGpuZ.js.map} +1 -1
  27. package/public/assets/{managed-agents-Bj--bFmZ.js → managed-agents-CVca-s3t.js} +2 -2
  28. package/public/assets/{managed-agents-Bj--bFmZ.js.map → managed-agents-CVca-s3t.js.map} +1 -1
  29. package/public/assets/{markdown-preview-impl-DGLCocU8.js → markdown-preview-impl-BPW4OQo9.js} +2 -2
  30. package/public/assets/{markdown-preview-impl-DGLCocU8.js.map → markdown-preview-impl-BPW4OQo9.js.map} +1 -1
  31. package/public/assets/{memory-yj2MIxUA.js → memory-BzuDTHC5.js} +2 -2
  32. package/public/assets/{memory-yj2MIxUA.js.map → memory-BzuDTHC5.js.map} +1 -1
  33. package/public/assets/{messages-BT5mL7iz.js → messages-_W24PNvT.js} +2 -2
  34. package/public/assets/{messages-BT5mL7iz.js.map → messages-_W24PNvT.js.map} +1 -1
  35. package/public/assets/{orchestrators-BVDAhrPk.js → orchestrators-Du6I_n8i.js} +2 -2
  36. package/public/assets/{orchestrators-BVDAhrPk.js.map → orchestrators-Du6I_n8i.js.map} +1 -1
  37. package/public/assets/{overview-DlqJIqYK.js → overview-Dyvm1qpT.js} +2 -2
  38. package/public/assets/{overview-DlqJIqYK.js.map → overview-Dyvm1qpT.js.map} +1 -1
  39. package/public/assets/{pairs-DQ4tNCo3.js → pairs-B8x1RCNd.js} +2 -2
  40. package/public/assets/{pairs-DQ4tNCo3.js.map → pairs-B8x1RCNd.js.map} +1 -1
  41. package/public/assets/{prompt-settings-DlsqOP0C.js → prompt-settings-xVXmvxB5.js} +2 -2
  42. package/public/assets/{prompt-settings-DlsqOP0C.js.map → prompt-settings-xVXmvxB5.js.map} +1 -1
  43. package/public/assets/{registry-Cw2fdWrn.js → registry-ypiICauZ.js} +2 -2
  44. package/public/assets/{registry-Cw2fdWrn.js.map → registry-ypiICauZ.js.map} +1 -1
  45. package/public/assets/{security-ucr7IT1V.js → security-BfOQ6T5r.js} +2 -2
  46. package/public/assets/{security-ucr7IT1V.js.map → security-BfOQ6T5r.js.map} +1 -1
  47. package/public/assets/{select-D8UWCtYZ.js → select-Dx8Ro-A3.js} +2 -2
  48. package/public/assets/{select-D8UWCtYZ.js.map → select-Dx8Ro-A3.js.map} +1 -1
  49. package/public/assets/settings-87clTx4N.js +6 -0
  50. package/public/assets/settings-87clTx4N.js.map +1 -0
  51. package/public/assets/{tasks-jRUvxUd5.js → tasks-1Kvp53wh.js} +2 -2
  52. package/public/assets/{tasks-jRUvxUd5.js.map → tasks-1Kvp53wh.js.map} +1 -1
  53. package/public/assets/{teams-Dn0yggD-.js → teams-DJWp4AKi.js} +2 -2
  54. package/public/assets/{teams-Dn0yggD-.js.map → teams-DJWp4AKi.js.map} +1 -1
  55. package/public/assets/{terminal-viewer-impl-fLly20IP.js → terminal-viewer-impl-DgMuRAe_.js} +2 -2
  56. package/public/assets/{terminal-viewer-impl-fLly20IP.js.map → terminal-viewer-impl-DgMuRAe_.js.map} +1 -1
  57. package/public/assets/types-DorDDvEb.js.map +1 -1
  58. package/public/assets/{user-avatar-BWLUHt2e.js → user-avatar-CfAUS3PZ.js} +2 -2
  59. package/public/assets/{user-avatar-BWLUHt2e.js.map → user-avatar-CfAUS3PZ.js.map} +1 -1
  60. package/public/assets/{work-queue-BAnNY0xE.js → work-queue-D-Otxd9u.js} +2 -2
  61. package/public/assets/{work-queue-BAnNY0xE.js.map → work-queue-D-Otxd9u.js.map} +1 -1
  62. package/public/index.html +1 -1
  63. package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
  64. package/runner/plugins/claude/monitors/relay-monitor.provisioned.mjs +15 -3
  65. package/runner/src/adapter.ts +14 -3
  66. package/src/branch-landed.ts +76 -1
  67. package/src/connectors.ts +116 -4
  68. package/src/db/provider-quotas.ts +6 -0
  69. package/src/mcp-egress-tools.ts +3 -2
  70. package/src/notification-router.ts +6 -1
  71. package/src/notification-types.ts +2 -0
  72. package/src/notify.ts +4 -4
  73. package/src/quota-band-transition.ts +6 -0
  74. package/src/routes/commands.ts +17 -1
  75. package/src/routes/index.ts +2 -1
  76. package/src/routes/provider-quotas.ts +13 -1
  77. package/src/security.ts +2 -0
  78. package/src/services/transient-agent-reaper.ts +16 -1
  79. package/src/token-db.ts +3 -3
  80. package/public/assets/index-Vmhw442d.js.map +0 -1
  81. package/public/assets/settings-Dvf_ps1B.js +0 -6
  82. package/public/assets/settings-Dvf_ps1B.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-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
+ 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-3ydeNO0c.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-CfAUS3PZ.js.map
@@ -1 +1 @@
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
+ {"version":3,"file":"user-avatar-CfAUS3PZ.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-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
+ 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-3ydeNO0c.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-D-Otxd9u.js.map
@@ -1 +1 @@
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,w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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"}
1
+ {"version":3,"file":"work-queue-D-Otxd9u.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,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AAA,MAAC,MAAD,CAAK,UAAU,2EAAf,CACG,EAAK,QACJ,EAAA,EAAA,MAAC,OAAD,CAAM,MAAM,iBAAZ,EACE,EAAA,EAAA,KAAC,EAAD,CAAc,UAAU,sBAAwB,CAAA,CAAC,EAAU,EAAK,MAAM,CACjE,GAER,EAAK,SACJ,EAAA,EAAA,KAAC,OAAD,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-Vmhw442d.js"></script>
15
+ <script type="module" crossorigin src="./assets/index-3ydeNO0c.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">
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agent-relay-runner",
3
3
  "description": "Thin Agent Relay runner bridge for Claude Code",
4
- "version": "0.105.2",
4
+ "version": "0.107.0",
5
5
  "agentRelayContracts": {
6
6
  "providerPluginProtocol": 1
7
7
  }
@@ -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 sections = messages2.map((message) => formatMessage(message, relaySurface));
1169
- const replyable = latestReplyableMessage(messages2);
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 && messages2.some(isNotificationMessage)) {
1184
+ } else if (relaySurface && !replyable && uniqueMessages.some(isNotificationMessage)) {
1173
1185
  sections.push(NOTIFICATION_NUDGE);
1174
1186
  }
1175
1187
  return sections.join(`
@@ -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 replyable = latestReplyableMessage(messages);
369
+ const uniqueMessages = dedupePersistedMessages(messages);
370
+ const replyable = latestReplyableMessage(uniqueMessages);
360
371
  const maxChars = providerMessageBodyMaxChars();
361
- const sections = messages
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 (messages.some(isNotificationMessage)) {
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
  }
@@ -1,9 +1,11 @@
1
- import { errMessage } from "agent-relay-sdk";
1
+ import { errMessage, type BaseWorktreeSyncResult } from "agent-relay-sdk";
2
2
  import { emitRelayEvent } from "./events";
3
3
  import { routeNotification, INFORMATIONAL_TTL_MS } from "./notification-router";
4
4
  import { registerDefaultAudienceRules, audiencePredicates } from "./notification-rules";
5
5
  import { createActivityEvent, getAgent, updateWorkspaceStatus } from "./db";
6
6
  import { renderTemplate } from "./prompt-resolver";
7
+ import { resolveCoordinatorAgentId } from "./steward-identity";
8
+ import { stewardFallbackTarget } from "./config";
7
9
  import { handleLandedIssueLifecycle } from "./services/issue-lifecycle";
8
10
  import type { WorkspaceMergePreview, WorkspaceRecord } from "./types";
9
11
 
@@ -207,6 +209,79 @@ export function notifyBranchLanded(input: BranchLandedInput): void {
207
209
  });
208
210
  }
209
211
 
212
+ /**
213
+ * #824 — a dirty base checkout left in a MIXED state after a land (HEAD advanced via ref
214
+ * plumbing, but the shared/primary working files did NOT catch up for some landed paths).
215
+ * The land itself SUCCEEDED — this is not a land failure — but the shared checkout now serves
216
+ * STALE content for those paths, which previously shipped a reverted file into a bootstrap
217
+ * publish (#823). The old behavior was a swallowed host-side `console.error`; this raises a
218
+ * LOUD, operator-visible signal (activity alert + a durable push to the owner and its
219
+ * coordinator) so the mixed state is reconciled before anything reads/builds/publishes from
220
+ * the checkout. Human WIP is never auto-clobbered; `preservedWipPaths` flags paths to merge by
221
+ * hand rather than blind-restore.
222
+ */
223
+ export function notifyBaseWorktreeStrand(input: {
224
+ workspace: Pick<WorkspaceRecord, "id" | "repoRoot" | "branch" | "baseRef" | "ownerAgentId">;
225
+ sync: BaseWorktreeSyncResult;
226
+ }): void {
227
+ const { workspace, sync } = input;
228
+ if (sync.reconciled) return;
229
+ const base = workspace.baseRef ?? "base";
230
+ const owner = workspace.ownerAgentId;
231
+ const coordinator = resolveCoordinatorAgentId(owner ?? undefined);
232
+ const fallback = stewardFallbackTarget();
233
+ const unsynced = sync.unsyncedPaths ?? [];
234
+ const preservedWip = sync.preservedWipPaths ?? [];
235
+ const pathLabel = unsynced.length ? unsynced.map((p) => `\`${p}\``).join(", ") : "(unknown paths)";
236
+ const wipLabel = preservedWip.length
237
+ ? ` Some carry uncommitted human WIP and were preserved (merge by hand, do NOT blind-restore): ${preservedWip.map((p) => `\`${p}\``).join(", ")}.`
238
+ : "";
239
+ const body = `⚠️ The shared \`${base}\` checkout under \`${workspace.repoRoot}\` is in a MIXED state after a land: HEAD advanced but these working files did NOT catch up — ${pathLabel}. Reads/builds/publishes from this checkout will see STALE content until reconciled (\`git -C ${workspace.repoRoot} restore --staged --worktree -- <path>\` for non-WIP paths).${wipLabel}`;
240
+
241
+ const payload = {
242
+ kind: "workspace.base-checkout-strand",
243
+ workspaceId: workspace.id,
244
+ repoRoot: workspace.repoRoot,
245
+ branch: workspace.branch,
246
+ base,
247
+ author: owner,
248
+ unsyncedPaths: unsynced,
249
+ preservedWipPaths: preservedWip,
250
+ reconciled: false,
251
+ };
252
+
253
+ emitRelayEvent({ type: "workspace.base_checkout_strand", source: "server", subject: workspace.id, data: payload });
254
+
255
+ createActivityEvent({
256
+ clientId: `workspace-base-strand-${workspace.id}-${Date.now()}`,
257
+ kind: "state",
258
+ title: "Base checkout stranded after land (mixed state)",
259
+ body: `${base} (${workspace.repoRoot}) — ${unsynced.length} landed path(s) out of sync with HEAD${preservedWip.length ? `, ${preservedWip.length} with human WIP` : ""}: ${unsynced.join(", ")}`,
260
+ meta: workspace.branch ?? workspace.id,
261
+ icon: "ti-alert-octagon",
262
+ view: "orchestrators",
263
+ metadata: { source: "server", maintenanceJobId: "workspace-base-strand", workspaceId: workspace.id, repoRoot: workspace.repoRoot, unsyncedPaths: unsynced, preservedWipPaths: preservedWip },
264
+ });
265
+
266
+ // Durable (ttl null) push to the owner and its coordinator — whoever works in the shared
267
+ // checkout must learn it's stale before acting on it. Fallback steward covers a teamless land.
268
+ const recipients = [...new Set([owner, coordinator, fallback].filter((r): r is string => Boolean(r)))];
269
+ if (recipients.length) {
270
+ routeNotification({
271
+ type: "workspace.base_checkout_strand",
272
+ scope: { author: owner, parent: coordinator ?? undefined, repoRoot: workspace.repoRoot, workspaceId: workspace.id },
273
+ recipients,
274
+ ttlMs: null,
275
+ message: {
276
+ subject: "Base checkout left stale after land — reconcile before publishing",
277
+ body,
278
+ payload: { ...payload, notification: "base-checkout-strand" },
279
+ replyExpected: false,
280
+ },
281
+ });
282
+ }
283
+ }
284
+
210
285
  /**
211
286
  * Fatal land failure wake-up for the branch owner (#538). This is intentionally separate from
212
287
  * steward-task/conflict pings: it tells the worker that its post-ready idle wait ended without
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
- // Relaunch connectors that were running before this process restarted (e.g. a
252
- // deploy that took down the relay/orchestrator tree) BEFORE the first status
253
- // poll overwrites their persisted "running" flag with the now-dead reality.
254
- void reconcileConnectorsOnBoot().finally(() => void refreshAllConnectorStatuses());
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
@@ -237,6 +237,12 @@ function quotaFingerprint(quota: QuotaState): string {
237
237
  name: window.name,
238
238
  unit: window.unit,
239
239
  utilization: window.utilization,
240
+ // Include resetsAt (coarsened to 5-minute buckets) so an idle provider crossing a
241
+ // window reset records a new snapshot even when utilization stays 0. Without this,
242
+ // Codex idle across a 5h boundary had no snapshot in the new window → burn
243
+ // computation found 0 same-boundary samples → low confidence → "building burn history."
244
+ // 5-min buckets absorb inter-agent resetsAt drift while distinguishing actual resets.
245
+ resetBucket: typeof window.resetsAt === "number" && Number.isFinite(window.resetsAt) ? Math.floor(window.resetsAt / 300_000) : undefined,
240
246
  })).sort((a, b) => a.name.localeCompare(b.name) || a.unit.localeCompare(b.unit)));
241
247
  }
242
248
 
@@ -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
- // Both tools use notifications:write scope (aliased; DECISION LOCKED — #773).
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: ["notifications:write"],
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[] = [];
@@ -23,6 +23,7 @@ export type NotificationType =
23
23
  | "workspace.conflict"
24
24
  | "workspace.steward_reassigned"
25
25
  | "workspace.stranded_escalation"
26
+ | "workspace.base_checkout_strand"
26
27
  | "workspace.auto_abandoned"
27
28
  | "workspace.review_request"
28
29
  | "workspace.review_changes_requested"
@@ -93,6 +94,7 @@ export const DEFAULT_TTL_MS: Record<NotificationType, number | null> = {
93
94
  "workspace.conflict": null,
94
95
  "workspace.steward_reassigned": null,
95
96
  "workspace.stranded_escalation": null,
97
+ "workspace.base_checkout_strand": null,
96
98
  "workspace.auto_abandoned": null,
97
99
  "workspace.review_request": null,
98
100
  "workspace.review_changes_requested": null,
package/src/notify.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { sendMessage } from "./db";
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 msg = sendMessage({
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(msg);
49
- return msg;
48
+ if (result.created || result.updated) emitNewMessage(result.message);
49
+ return result.message;
50
50
  }
@@ -247,6 +247,7 @@ function emitBandTransition(input: {
247
247
 
248
248
  const recipients = getSpawnCapableAgentIds();
249
249
  if (recipients.length === 0) return;
250
+ if (!shouldPushBandTransition(window.band, direction)) return;
250
251
 
251
252
  routeNotification({
252
253
  type: "routing.quota.band_transition",
@@ -256,12 +257,17 @@ function emitBandTransition(input: {
256
257
  subject: `${providerLabel(provider)} ${window.role} quota band → ${window.band}`,
257
258
  body: buildBody(input),
258
259
  payload,
260
+ idempotencyKey: `routing.quota.band_transition:${provider}:${window.role}:${window.band}`,
259
261
  replyExpected: false,
260
262
  },
261
263
  emittedAt: now,
262
264
  });
263
265
  }
264
266
 
267
+ function shouldPushBandTransition(newBand: QuotaBand, direction: "degraded" | "recovered"): boolean {
268
+ return direction === "degraded" && bandRank(newBand) >= bandRank("caution");
269
+ }
270
+
265
271
  function buildBody(input: {
266
272
  provider: string;
267
273
  window: ProviderBandWindow;
@@ -12,7 +12,7 @@ import { isRecord } from "agent-relay-sdk";
12
12
  import { authContextFromRequest } from "../services/auth-context";
13
13
  import { commandAuthorizationResource as dispatchCommandAuthorizationResource, dispatchCommand } from "../services/dispatch-command";
14
14
  import { ServiceAuthError } from "../services/errors";
15
- import { notifyBranchLandFailed, notifyBranchLanded } from "../branch-landed";
15
+ import { notifyBaseWorktreeStrand, notifyBranchLandFailed, notifyBranchLanded } from "../branch-landed";
16
16
  import { applyIdleRefreshResult } from "../maintenance/workspaces";
17
17
  import { seedProviderConfigs } from "../provider-config-store";
18
18
  import { notifyAgentSpawnFailed } from "../agent-lifecycle-events";
@@ -253,6 +253,22 @@ export const patchCommand: Handler = async (req, params) => {
253
253
  // on the remote: the relay carries that ground truth in `params.prLanded`, so the
254
254
  // notice fires from it with the recycled `newBranch` — full rebase-ff parity.
255
255
  const prLanded = isRecord(command.params.prLanded) ? command.params.prLanded : undefined;
256
+ // #824 — the land advanced a DIRTY base by ref plumbing and the shared checkout was
257
+ // left in a MIXED state (HEAD moved, some landed working files didn't). The land
258
+ // succeeded, but surface the strand LOUDLY so it's reconciled before anything reads/
259
+ // builds/publishes from the stale checkout — never silently as before.
260
+ const baseWorktreeSync = isRecord(command.result.baseWorktreeSync) ? command.result.baseWorktreeSync : undefined;
261
+ if (baseWorktreeSync && baseWorktreeSync.reconciled === false && landedWorkspace) {
262
+ notifyBaseWorktreeStrand({
263
+ workspace: landedWorkspace,
264
+ sync: {
265
+ reconciled: false,
266
+ unsyncedPaths: Array.isArray(baseWorktreeSync.unsyncedPaths) ? baseWorktreeSync.unsyncedPaths.filter((p): p is string => typeof p === "string") : undefined,
267
+ preservedWipPaths: Array.isArray(baseWorktreeSync.preservedWipPaths) ? baseWorktreeSync.preservedWipPaths.filter((p): p is string => typeof p === "string") : undefined,
268
+ message: typeof baseWorktreeSync.message === "string" ? baseWorktreeSync.message : undefined,
269
+ },
270
+ });
271
+ }
256
272
  if ((command.result.merged === true || prLanded) && landedWorkspace) {
257
273
  notifyBranchLanded({
258
274
  workspace: landedWorkspace,
@@ -6,7 +6,7 @@ import { deleteMyAvatar, deleteUserAvatarById, getMe, getUserAvatar, getUsers, h
6
6
  import { deleteArtifactById, getArtifactById, getArtifactContent, getArtifacts, headArtifactContent, postArtifact } from "./artifacts";
7
7
  import { deleteAutomationById, getAutomationById, getAutomationRuns, getAutomations, patchAutomation, postAutomation, postAutomationRun } from "./automations";
8
8
  import { deleteCommandById, deleteProviderModelRoute, getProviderConfigRoute, getProviderConfigsRoute, getProvidersRoute, patchProviderModelRoute, postProviderConfigTestRoute, putProviderConfigRoute, putProviderModelRoute } from "./provider-config";
9
- import { getProviderQuotaAdvisoryRoute, getProviderQuotasRoute, postProviderQuotaLeaseAcquireRoute, postProviderQuotaLeaseReleaseRoute, postProviderQuotaPublisherLeaseAcquireRoute, postProviderQuotaPublisherLeaseReleaseRoute, postProviderQuotaRoute } from "./provider-quotas";
9
+ import { getProviderQuotaAdvisoryRoute, getProviderQuotaHistoryRoute, getProviderQuotasRoute, postProviderQuotaLeaseAcquireRoute, postProviderQuotaLeaseReleaseRoute, postProviderQuotaPublisherLeaseAcquireRoute, postProviderQuotaPublisherLeaseReleaseRoute, postProviderQuotaRoute } from "./provider-quotas";
10
10
  import { getProviderQuotaConfigRoute, getProviderQuotaConfigsRoute, putProviderQuotaConfigRoute } from "./provider-quota-config";
11
11
  import { getRoutingPolicyRoute, putRoutingPolicyRoute } from "./routing-policy";
12
12
  import { deleteProvisioningCapabilityRoute, getProvisioningCapabilitiesRoute, getProvisioningCapabilityRoute, patchProvisioningCapabilityRoute, patchProvisioningVariantRoute, postProvisioningCapabilityRoute, postProvisioningVariantImportRoute, postProvisioningVariantMcpRoute, postProvisioningVariantUpdateRoute, postProvisioningVariantValidateRoute } from "./provisioning-registry";
@@ -115,6 +115,7 @@ const routes: Route[] = [
115
115
  route("GET", "/api/agents/find", findAgents),
116
116
  route("POST", "/api/route", postRouteAdvice),
117
117
  route("GET", "/api/provider-quotas/advisory", getProviderQuotaAdvisoryRoute),
118
+ route("GET", "/api/provider-quotas/history", getProviderQuotaHistoryRoute),
118
119
  route("GET", "/api/provider-quotas", getProviderQuotasRoute),
119
120
  route("POST", "/api/provider-quotas", postProviderQuotaRoute),
120
121
  route("POST", "/api/provider-quota-leases/acquire", postProviderQuotaPublisherLeaseAcquireRoute),