From 8eb34449e539fd0fe2152e7be96f2d6d3fdd76a7 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 29 Jun 2026 21:02:43 -0500 Subject: [PATCH 1/3] refac --- cptr/utils/agents/acp.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cptr/utils/agents/acp.py b/cptr/utils/agents/acp.py index b3088b9..7870469 100644 --- a/cptr/utils/agents/acp.py +++ b/cptr/utils/agents/acp.py @@ -164,9 +164,8 @@ async def _open_session(self) -> None: async def _send(self, payload: dict[str, Any]) -> None: assert self.proc is not None and self.proc.stdin is not None - data = json.dumps(payload, separators=(",", ":")).encode() - framed = b"Content-Length: " + str(len(data)).encode() + b"\r\n\r\n" + data - self.proc.stdin.write(framed) + data = json.dumps(payload, separators=(",", ":")).encode() + b"\n" + self.proc.stdin.write(data) await self.proc.stdin.drain() async def _reader_loop(self) -> None: From 8e8bcb7a9b4f4396a0dd14e0a50ffe8e014d9a28 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 29 Jun 2026 21:07:52 -0500 Subject: [PATCH 2/3] refac --- .../src/lib/components/Admin/Models.svelte | 2 +- .../src/lib/components/chat/PlusMenu.svelte | 2 +- .../chat/ToolCallCollapsible.svelte | 24 ++++++++++++------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/cptr/frontend/src/lib/components/Admin/Models.svelte b/cptr/frontend/src/lib/components/Admin/Models.svelte index cd580f8..ffc11ec 100644 --- a/cptr/frontend/src/lib/components/Admin/Models.svelte +++ b/cptr/frontend/src/lib/components/Admin/Models.svelte @@ -85,7 +85,7 @@ Files: if (!rp || typeof rp !== 'object') return []; return Object.entries(rp).map(([key, value]) => ({ key, - value: typeof value === 'object' ? JSON.stringify(value) : String(value) + value: typeof value === 'object' ? JSON.stringify(value, null, 2) : String(value) })); } diff --git a/cptr/frontend/src/lib/components/chat/PlusMenu.svelte b/cptr/frontend/src/lib/components/chat/PlusMenu.svelte index dcb671d..37d64b6 100644 --- a/cptr/frontend/src/lib/components/chat/PlusMenu.svelte +++ b/cptr/frontend/src/lib/components/chat/PlusMenu.svelte @@ -35,7 +35,7 @@ let paramRows = $state>( Object.entries($requestParams).map(([key, value]) => ({ key, - value: typeof value === 'object' ? JSON.stringify(value) : String(value) + value: typeof value === 'object' ? JSON.stringify(value, null, 2) : String(value) })) ); diff --git a/cptr/frontend/src/lib/components/chat/ToolCallCollapsible.svelte b/cptr/frontend/src/lib/components/chat/ToolCallCollapsible.svelte index cb90c6e..880ae73 100644 --- a/cptr/frontend/src/lib/components/chat/ToolCallCollapsible.svelte +++ b/cptr/frontend/src/lib/components/chat/ToolCallCollapsible.svelte @@ -38,6 +38,14 @@ return null; } }); + const formattedOutput = $derived.by(() => { + if (!pairedOutput?.output) return ''; + try { + return JSON.stringify(JSON.parse(pairedOutput.output), null, 2); + } catch { + return pairedOutput.output; + } + }); function toggleExpanded() { expanded = !expanded; @@ -240,8 +248,8 @@ {#each Object.entries(args) as [key, value]}
{key} - - {typeof value === 'object' ? JSON.stringify(value) : value} + + {typeof value === 'object' ? JSON.stringify(value, null, 2) : value}
{/each} @@ -268,15 +276,15 @@ {:else}
{pairedOutput
-										.output.length > 10000
-										? pairedOutput.output.slice(0, 10000)
-										: pairedOutput.output}
+ class="text-xs text-gray-600 dark:text-gray-300 whitespace-pre-wrap break-words font-mono max-h-64 overflow-auto leading-relaxed">{formattedOutput.length > + 10000 + ? formattedOutput.slice(0, 10000) + : formattedOutput} {/if} - {#if !imageToolOutput?.length && pairedOutput.output.length > 10000} + {#if !imageToolOutput?.length && formattedOutput.length > 10000}
{$t('chat.totalChars', { - count: pairedOutput.output.length.toLocaleString() + count: formattedOutput.length.toLocaleString() })}
{/if} From 33180fd4a7bd8f13081355387806b1b50f944806 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 29 Jun 2026 21:09:11 -0500 Subject: [PATCH 3/3] refac --- CHANGELOG.md | 7 +++++++ pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c51db2..86e60df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.7.2] - 2026-06-29 + +### Changed + +- 🔧 **Better formatting for tool call output.** JSON data shown in tool call results and request parameters is now pretty-printed with proper indentation, making it much easier to read at a glance. +- 🤖 **More compatible agent communication.** Fixed how Computer talks to coding agents so it works with a wider range of agent versions. + ## [0.7.1] - 2026-06-26 ### Changed diff --git a/pyproject.toml b/pyproject.toml index 8a6aab4..81c6ddb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "cptr" -version = "0.7.1" +version = "0.7.2" description = "Your computer, from anywhere. Code, manage, and control your machine from the web." license = {file = "LICENSE"} readme = "README.md"