From 199ad46421fbb22c50a6c995666cc7d020f84571 Mon Sep 17 00:00:00 2001 From: Luke Parker <10430890+Hona@users.noreply.github.com> Date: Fri, 23 Oct 2026 10:25:37 +1000 Subject: [PATCH] feat(desktop): capture app and server heap snapshots into one folder (#58259) --- .opencode/skills/opencode-dev/SKILL.md | 4 +- packages/cli/src/commands/commands.ts | 4 + .../src/commands/handlers/debug/heap-dump.ts | 15 ++- packages/cli/test/debug-heap-dump.test.ts | 27 +++++ packages/client/src/effect/api/api.ts | 3 +- .../client/src/effect/generated/client.ts | 7 +- .../client/src/promise/generated/client.ts | 4 +- .../client/src/promise/generated/types.ts | 2 + packages/gui-extensions/README.md | 2 +- packages/gui-extensions/src/debug/contract.ts | 25 ++++ packages/gui-extensions/src/debug/i18n/en.ts | 7 ++ packages/gui-extensions/src/debug/index.ts | 2 + packages/gui-extensions/src/debug/main.ts | 108 ++++++++++++++++++ .../gui-extensions/src/debug/renderer.tsx | 41 ++++++- .../src/debug/server-heap.test.ts | 56 +++++++++ .../gui-extensions/src/debug/server-heap.ts | 58 ++++++++++ packages/gui-extensions/src/main.ts | 2 +- packages/protocol/openapi.json | 21 +++- packages/protocol/src/groups/debug.ts | 15 ++- packages/server/src/handlers/debug.ts | 16 ++- packages/server/test/heap-dump.test.ts | 42 ++++++- services/www/openapi.json | 21 +++- services/www/public/openapi.json | 21 +++- .../www/src/docs/content/cli/commands.mdx | 6 + .../www/src/docs/content/troubleshooting.mdx | 24 ++++ 25 files changed, 508 insertions(+), 25 deletions(-) create mode 100644 packages/gui-extensions/src/debug/contract.ts create mode 100644 packages/gui-extensions/src/debug/main.ts create mode 100644 packages/gui-extensions/src/debug/server-heap.test.ts create mode 100644 packages/gui-extensions/src/debug/server-heap.ts diff --git a/.opencode/skills/opencode-dev/SKILL.md b/.opencode/skills/opencode-dev/SKILL.md index befc8c0177f..3f0c488c78a 100644 --- a/.opencode/skills/opencode-dev/SKILL.md +++ b/.opencode/skills/opencode-dev/SKILL.md @@ -130,7 +130,9 @@ On every platform, including Windows, capture the running background server with opencode debug heap-dump ``` -It discovers the already-running service (never starts or replaces one), calls `POST /api/debug/heap-dump`, waits until the file is complete, and prints its server-local path. Pass `--server ` (with `OPENCODE_PASSWORD`) for a server started with `serve`. A 404 means the running server predates the endpoint. +It discovers the already-running service (never starts or replaces one), calls `POST /api/debug/heap-dump`, waits until the file is complete, and prints its server-local path. Pass `--server ` (with `OPENCODE_PASSWORD`) for a server started with `serve`, and `--directory ` to write somewhere other than the server's log directory (the server creates it; a server that predates the option ignores it and the CLI warns). A 404 means the running server predates the endpoint. + +For desktop memory, run **Capture heap snapshots** from the desktop command palette (`packages/gui-extensions/src/debug/main.ts`). It writes `~/Downloads/opencode-heap-