From 91d78d64b893635712aae0aab220e26e6877a0ba Mon Sep 17 00:00:00 2001 From: Brendan Date: Sat, 12 Sep 2026 16:47:13 +0000 Subject: [PATCH] Fix flow activity frontend syntax error --- src/ui.ts | 2 +- test/ui.test.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ui.ts b/src/ui.ts index 60a38ec7..7e6cbd78 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -135,7 +135,7 @@ const root=document.querySelector('#flow-detail'),flowId=root.dataset.flowId; const esc=v=>{const d=document.createElement('div');d.textContent=v??'';return d.innerHTML}; const time=v=>new Date(v).toLocaleString(); const badge=(value,good)=>''+esc(value)+''; -const issueLink=(id,url)=>{if(!id)return '—';const trusted=typeof url==='string'&&(url.startsWith('https://linear.app/')||/^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\/pull\/\d+$/.test(url));const href=trusted?url:'https://linear.app/issue/'+encodeURIComponent(id);return ''+esc(id)+' ↗'}; +const issueLink=(id,url)=>{if(!id)return '—';const trusted=typeof url==='string'&&(url.startsWith('https://linear.app/')||/^https:\\/\\/github\\.com\\/[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+\\/pull\\/\\d+$/.test(url));const href=trusted?url:'https://linear.app/issue/'+encodeURIComponent(id);return ''+esc(id)+' ↗'}; async function load(){const response=await fetch('/api/pipes/'+encodeURIComponent(flowId));if(response.status===401)return location.href='/auth/linear';if(!response.ok){root.innerHTML='

Could not load this flow.

';return}const data=await response.json(),flow=data.flow,events=data.events||[],runs=data.runs||[];const eventRows=events.map(event=>''+time(event.received_at)+''+issueLink(event.issue_id,event.issue_url)+''+esc(event.event_type)+' · '+esc(event.event_action)+''+badge(event.outcome,event.outcome==='triggered')+''+esc(event.detail)+'').join('')||'No relevant webhooks yet. Update an issue in this flow’s Linear project to see it here.';const runRows=runs.map(run=>''+issueLink(run.issue_id,run.issue_url)+''+esc(run.agent_kind||flow.agent_kind||'Herdr agent')+''+esc(run.agent_name)+''+esc(run.workspace_name||flow.workspace_name||'—')+''+badge(run.state,['queued','starting','running','done'].includes(run.state))+''+time(run.updated_at)+'').join('')||'No agent runs yet.';root.innerHTML='

'+esc(flow.name)+'

'+esc(flow.filter_type)+' trigger · '+esc(flow.max_concurrency)+' concurrent agents · '+esc(flow.agent_kind||'Herdr agent')+' · workspace '+esc(flow.workspace_name||'—')+'

Edit Flow

Webhook activity

Relevant Linear webhooks and whether they queued an agent.

'+eventRows+'
ReceivedIssueEventResultDetails

Agent runs

'+runRows+'
IssueHerdr agentWorkspaceStateUpdated
'} const renderActivity=load; load=async()=>{await renderActivity();const response=await fetch('/api/pipes/'+encodeURIComponent(flowId));if(!response.ok)return;const data=await response.json(),runs=(data.runs||[]).filter(run=>run.state!=='ignored');if(!runs.length)return;const diagnostics=runs.map(run=>'
'+esc(run.agent_name)+''+(run.exec_status!=null?'HTTP '+esc(String(run.exec_status))+(run.exec_exit_code!=null?' · VM exit '+esc(String(run.exec_exit_code)):'' ):esc(run.state))+'
'+(run.exec_status!=null?'

Exact command submitted to exe.dev

'+esc(run.exec_request)+'

Actual exe.dev response

'+esc(run.exec_response)+'
':'

No exe.dev request or response was recorded for this run. It did not reach the VM-command step.

')+(run.result?'

Herdr agent output

'+esc(run.result)+'
':'')+'
').join('');root.insertAdjacentHTML('beforeend','

Actual exe.dev command results

Only real agent runs appear here. The bearer token is never shown.

'+diagnostics+'
')}; diff --git a/test/ui.test.ts b/test/ui.test.ts index 2e208528..85dd6d2a 100644 --- a/test/ui.test.ts +++ b/test/ui.test.ts @@ -2,6 +2,12 @@ import { describe, expect, it } from "vitest"; import { flowDetailPage, flowPage, landingPage } from "../src/ui"; describe("pages", () => { + const expectInlineScriptsToParse = (html: string) => { + const scripts = [...html.matchAll(/