Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/styles.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/exe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function herdrAgentStatus(body: string): string | null {
}

export function agentOutputCommand(connection: ExeConnection, agentName: string): string {
return `${herdrPrefix(connection)} && ${herdrBinary(connection)} agent read ${shellAtom(agentName)} --source recent --lines 40 --format text`;
return `${herdrPrefix(connection)} && ${herdrBinary(connection)} agent read ${shellAtom(agentName)} --source recent --format text`;
}

export function herdrCheckCommand(connection: ExeConnection): string {
Expand Down
2 changes: 1 addition & 1 deletion src/tenant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ export class Tenant extends DurableObject<Env> {
}
if (agentStatus !== "done" && agentStatus !== "idle") return;
const output = await exec(connection, agentOutputCommand(connection, String(run.agent_name)));
await this.finishRun(run, "done", output.ok ? output.body.slice(-6000) : "Agent completed; terminal output could not be read.");
await this.finishRun(run, "done", output.ok ? output.body : "Agent completed; terminal output could not be read.");
}

private async finishRun(run: Row, state: Extract<RunState, "done" | "failed">, result: string): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion src/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ 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=>'<article class="border-t border-stone-200 px-6 py-5 dark:border-slate-800"><div class="flex items-center justify-between gap-4"><span class="font-medium">'+esc(run.agent_name)+'</span><span class="text-sm text-slate-500">'+(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))+'</span></div>'+(run.exec_status!=null?'<div class="mt-4 grid gap-4 lg:grid-cols-2"><div><p class="mb-1 text-xs font-semibold uppercase tracking-wide text-slate-500">Exact command submitted to exe.dev</p><pre class="overflow-x-auto whitespace-pre-wrap rounded-lg bg-slate-950 p-3 text-xs text-slate-100">'+esc(run.exec_request)+'</pre></div><div><p class="mb-1 text-xs font-semibold uppercase tracking-wide text-slate-500">Actual exe.dev response</p><pre class="overflow-x-auto whitespace-pre-wrap rounded-lg bg-slate-950 p-3 text-xs text-slate-100">'+esc(run.exec_response)+'</pre></div></div>':'<p class="mt-4 rounded-lg bg-amber-50 p-3 text-sm text-amber-800 dark:bg-amber-950/40 dark:text-amber-200">No exe.dev request or response was recorded for this run. It did not reach the VM-command step.</p>')+(run.result?'<div class="mt-4"><p class="mb-1 text-xs font-semibold uppercase tracking-wide text-slate-500">Herdr agent output</p><pre class="overflow-x-auto whitespace-pre-wrap rounded-lg bg-slate-950 p-3 text-xs text-slate-100">'+esc(run.result)+'</pre></div>':'')+'</article>').join('');root.insertAdjacentHTML('beforeend','<section class="mt-6 overflow-hidden rounded-2xl border border-stone-200 bg-white shadow-sm dark:border-slate-800 dark:bg-slate-900"><div class="border-b border-stone-200 px-6 py-5 dark:border-slate-800"><h2 class="font-semibold">Actual exe.dev command results</h2><p class="mt-1 text-sm text-slate-500 dark:text-slate-400">Only real agent runs appear here. The bearer token is never shown.</p></div>'+diagnostics+'</section>')};
// Keep run details with the run they belong to. The native disclosure control
// makes the command and response available without expanding every run.
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'),runSection=Array.from(root.querySelectorAll('section')).find(section=>section.querySelector('h2')?.textContent==='Agent runs'),webhookSection=Array.from(root.querySelectorAll('section')).find(section=>section.querySelector('h2')?.textContent==='Webhook activity');if(!runSection)return;const panels=runs.map(run=>{const command=run.exec_status!=null?'<div class="mt-4 grid gap-4 lg:grid-cols-2"><div><p class="mb-1 text-xs font-semibold uppercase tracking-wide text-slate-500">Exact command submitted to exe.dev</p><pre class="overflow-x-auto whitespace-pre-wrap rounded-lg bg-slate-950 p-3 text-xs text-slate-100">'+esc(run.exec_request)+'</pre></div><div><p class="mb-1 text-xs font-semibold uppercase tracking-wide text-slate-500">Actual exe.dev response</p><pre class="overflow-x-auto whitespace-pre-wrap rounded-lg bg-slate-950 p-3 text-xs text-slate-100">'+esc(run.exec_response)+'</pre></div></div>':'<p class="mt-4 rounded-lg bg-amber-50 p-3 text-sm text-amber-800 dark:bg-amber-950/40 dark:text-amber-200">No exe.dev request or response was recorded for this run. It did not reach the VM-command step.</p>';const prompt=run.prompt?'<div class="mt-4"><p class="mb-1 text-xs font-semibold uppercase tracking-wide text-slate-500">Prompt sent to agent</p><pre class="overflow-x-auto whitespace-pre-wrap rounded-lg bg-slate-950 p-3 text-xs text-slate-100">'+esc(run.prompt)+'</pre></div>':'';const output=run.result?'<div class="mt-4"><p class="mb-1 text-xs font-semibold uppercase tracking-wide text-slate-500">Herdr agent output</p><pre class="overflow-x-auto whitespace-pre-wrap rounded-lg bg-slate-950 p-3 text-xs text-slate-100">'+esc(run.result)+'</pre></div>':'';return '<details class="border-t border-stone-200 first:border-t-0 dark:border-slate-800"><summary class="flex cursor-pointer list-none flex-wrap items-center justify-between gap-3 px-6 py-4 hover:bg-stone-50 dark:hover:bg-slate-800/60"><span><span class="font-medium">'+issueLink(run.issue_id,run.issue_url)+'</span><span class="ml-3 text-sm text-slate-500 dark:text-slate-400">'+esc(run.agent_kind||data.flow.agent_kind||'Herdr agent')+' · '+esc(run.agent_name)+'</span></span><span class="flex items-center gap-3">'+badge(run.state,['queued','starting','running','done'].includes(run.state))+'<span class="text-xs text-slate-500">'+time(run.updated_at)+'</span></span></summary><div class="border-t border-stone-200 px-6 pb-5 dark:border-slate-800">'+prompt+command+output+'</div></details>'}).join('')||'<p class="px-6 py-8 text-sm text-slate-500 dark:text-slate-400">No agent runs yet.</p>';runSection.innerHTML='<div class="border-b border-stone-200 px-6 py-5 dark:border-slate-800"><h2 class="font-semibold">Agent runs</h2><p class="mt-1 text-sm text-slate-500 dark:text-slate-400">Open a run to inspect its exe.dev command and response.</p></div>'+panels;if(webhookSection)webhookSection.before(runSection)};
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'),runSection=Array.from(root.querySelectorAll('section')).find(section=>section.querySelector('h2')?.textContent==='Agent runs'),webhookSection=Array.from(root.querySelectorAll('section')).find(section=>section.querySelector('h2')?.textContent==='Webhook activity');if(!runSection)return;const panels=runs.map(run=>{const command=run.exec_status!=null?'<div class="mt-4 grid gap-4 lg:grid-cols-2"><div><p class="mb-1 text-xs font-semibold uppercase tracking-wide text-slate-500">Exact command submitted to exe.dev</p><pre class="overflow-x-auto whitespace-pre-wrap rounded-lg bg-slate-950 p-3 text-xs text-slate-100">'+esc(run.exec_request)+'</pre></div><div><p class="mb-1 text-xs font-semibold uppercase tracking-wide text-slate-500">Actual exe.dev response</p><pre class="overflow-x-auto whitespace-pre-wrap rounded-lg bg-slate-950 p-3 text-xs text-slate-100">'+esc(run.exec_response)+'</pre></div></div>':'<p class="mt-4 rounded-lg bg-amber-50 p-3 text-sm text-amber-800 dark:bg-amber-950/40 dark:text-amber-200">No exe.dev request or response was recorded for this run. It did not reach the VM-command step.</p>';const prompt=run.prompt?'<div class="mt-4"><p class="mb-1 text-xs font-semibold uppercase tracking-wide text-slate-500">Prompt sent to agent</p><pre class="overflow-x-auto whitespace-pre-wrap rounded-lg bg-slate-950 p-3 text-xs text-slate-100">'+esc(run.prompt)+'</pre></div>':'';const output=run.result?'<div class="mt-4"><p class="mb-1 text-xs font-semibold uppercase tracking-wide text-slate-500">Full agent output</p><pre class="max-h-[32rem] overflow-auto whitespace-pre-wrap rounded-lg bg-slate-950 p-3 text-xs text-slate-100" tabindex="0">'+esc(run.result)+'</pre></div>':'';return '<details class="border-t border-stone-200 first:border-t-0 dark:border-slate-800"><summary class="flex cursor-pointer list-none flex-wrap items-center justify-between gap-3 px-6 py-4 hover:bg-stone-50 dark:hover:bg-slate-800/60"><span><span class="font-medium">'+issueLink(run.issue_id,run.issue_url)+'</span><span class="ml-3 text-sm text-slate-500 dark:text-slate-400">'+esc(run.agent_kind||data.flow.agent_kind||'Herdr agent')+' · '+esc(run.agent_name)+'</span></span><span class="flex items-center gap-3">'+badge(run.state,['queued','starting','running','done'].includes(run.state))+'<span class="text-xs text-slate-500">'+time(run.updated_at)+'</span></span></summary><div class="border-t border-stone-200 px-6 pb-5 dark:border-slate-800">'+prompt+command+output+'</div></details>'}).join('')||'<p class="px-6 py-8 text-sm text-slate-500 dark:text-slate-400">No agent runs yet.</p>';runSection.innerHTML='<div class="border-b border-stone-200 px-6 py-5 dark:border-slate-800"><h2 class="font-semibold">Agent runs</h2><p class="mt-1 text-sm text-slate-500 dark:text-slate-400">Open a completed run to inspect its full, scrollable output.</p></div>'+panels;if(webhookSection)webhookSection.before(runSection)};
load();
`);

Expand Down
16 changes: 16 additions & 0 deletions test/exe.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { describe, expect, it } from "vitest";
import { agentOutputCommand } from "../src/exe";

describe("agent output command", () => {
it("requests the complete available transcript without a line limit", () => {
const command = agentOutputCommand({
vmName: "factorize-vm",
apiToken: "secret",
agentKind: "codex",
cwd: "/workspace",
}, "factorize-1");

expect(command).toContain("agent read 'factorize-1' --source recent --format text");
expect(command).not.toContain("--lines");
});
});
2 changes: 2 additions & 0 deletions test/ui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ describe("pages", () => {
expect(html).toContain("Edit Flow");
expect(html).toContain("issueLink");
expect(html).toContain("Prompt sent to agent");
expect(html).toContain("Full agent output");
expect(html).toContain('max-h-[32rem] overflow-auto');
});

it("escapes profile data", () => {
Expand Down
Loading