Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: let runner-launched TUI agents detect claude's input prompt
[._.]/ Adam Eivy6ac4a4bbc370
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 6085ca6500..f626533ffe 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -61,6 +61,7 @@## Fixed+- **CoS TUI agents detect claude's input prompt again.** The restart-survival work (issue 3202) moved TUI agents onto a runner that launches the coding CLI directly on its own PTY — no wrapping shell. Two startup checks still assumed the old shell-wrapped launch: input-readiness waited for the launch shell to toggle bracketed-paste mode off before the CLI's own "input ready" signal counted (so every runner-launched claude died `tui-not-ready` after 45s with a live input box on screen), and the pre-paste liveness probe asked whether the shell had a live child process — a question that misreads a healthy directly-launched CLI as exited. Both now recognize the direct-launch mode: the CLI's own paste-mode signal is trusted as ready, and liveness is left to the PTY exit event.- **[issue-3223] Published sprite atlases now expose frame counts uniformly for custom animation tracks.** A consuming game can read a user-authored track's declared frame-count field from both the atlas manifest and its layout sidecar, just as it already could for walk, scanner, and ambient tracks; tracks with no known count remain omitted.- **Sprite correction notes are no longer ignored on regenerate.** Typing a correction on a sprite re-roll ("hip bag should be on the other leg") and hitting Regenerate produced a render essentially identical to the one you'd just rejected. The note was being sent — it was losing an argument inside the prompt. Every regenerate prompt spends several sentences pinning the render to the attached reference ("keep accessories on the same anatomical side", "treat the turnaround panels as the source of truth"), and the correction was one trailing sentence asking to change exactly that, phrased as an edit to the *attached* image rather than a fix in the image being produced — so the model sided with the bulk of the prompt. Corrections now frame the render up front, before any preservation rule is read, and close it with an explicit override. Verified on the reported case: the note that had left the sprite unchanged now moves the bag on both samples. A blank note still produces a byte-identical blind regenerate on every surface (turnaround, main, the 7 directional anchors, walk, and every animation track including user-defined ones).- **Sprite reference reopen warnings now name the animations you actually have, instead of assuming a "scanner".** Reopening a locked main reference asked "Reopen the main reference and its south walk/scanner?" — but `scanner` stopped being a built-in some releases ago and is now just a seeded row you can retune or delete like any other animation type. So the warning was wrong in both directions: if you'd deleted the scanner it named an animation you don't have, and if you'd authored your own directional animation it never mentioned the approvals it was about to drop. The main-reference and turnaround warnings now list this character's own directional animation types by name (non-directional ones aren't affected by a reference reopen, so they're correctly left out), falling back to the plain word "animations" when there are none to name. Two toasts were under-reporting the same way: unlocking a single directional anchor only mentioned the walk it reopened, and unlocking the turnaround counted only reopened walks — both now cover every animation type the reopen actually dropped.diff --git a/server/lib/tuiHandshake.js b/server/lib/tuiHandshake.jsindex 10ee15f5c0..dfd81dc071 100644--- a/server/lib/tuiHandshake.js+++ b/server/lib/tuiHandshake.js@@ -300,9 +300,19 @@ const OBSERVE_TAIL_MAX_LEN = 4000;// readyTextPattern: optional extra positive gate, tested against the stripped// rolling tail. When supplied, `ready` also requires that marker to have been// seen (see AGY_INPUT_READY_PATTERN).-export function createInputReadyTracker({ readyTextPattern = null } = {}) {+//+// directLaunch: the TUI was pty.spawn'd DIRECTLY — there is no launch shell on+// the PTY, so the shell's paste-mode OFF (`ESC[?2004l`) that normally proves+// "the command is now running" never occurs; the first `ESC[?2004h` in the+// stream comes from the TUI itself and IS the ready signal. Without this flag a+// direct-launch session can never become ready (the durable-runner regression:+// every runner-tui claude agent died `tui-not-ready` at the 45s deadline while+// its input box sat live on screen).+export function createInputReadyTracker({ readyTextPattern = null, directLaunch = false } = {}) {let pasteModeOn = false; // LIVE bracketed-paste mode state from the stream- let sawCommandRun = false; // shell turned paste mode OFF to run the command+ // Shell turned paste mode OFF to run the command. Pre-latched for direct+ // launches, where the TUI owns the PTY from byte zero and no shell OFF exists.+ let sawCommandRun = directLaunch;let needsTrust = false;let sawReadyText = false;let tail = '';diff --git a/server/lib/tuiHandshake.test.js b/server/lib/tuiHandshake.test.jsindex 4faad30422..b7684a29fb 100644--- a/server/lib/tuiHandshake.test.js+++ b/server/lib/tuiHandshake.test.js@@ -883,6 +883,25 @@ describe('createInputReadyTracker', () => {tracker.observe('', '? for shortcuts');expect(tracker.ready).toBe(false);});++ // The durable runner pty.spawns the TUI directly — no launch shell, so the+ // shell's paste-mode OFF never appears in the stream. The TUI's own first ON+ // is the ready signal (regression: every runner-tui claude agent died+ // `tui-not-ready` at the deadline with a live input box on screen).+ it('directLaunch: ready on the TUI\'s own first paste-mode ON, with no shell OFF ever seen', () => {+ const tracker = createInputReadyTracker({ directLaunch: true });+ expect(tracker.ready).toBe(false); // banner painting, paste mode not yet on+ tracker.observe(PASTE_ON, '');+ expect(tracker.ready).toBe(true);+ });++ it('directLaunch + readyTextPattern: still waits for the composer marker', () => {+ const tracker = createInputReadyTracker({ readyTextPattern: AGY_INPUT_READY_PATTERN, directLaunch: true });+ tracker.observe(PASTE_ON, 'Signing in...');+ expect(tracker.ready).toBe(false);+ tracker.observe('', '? for shortcuts');+ expect(tracker.ready).toBe(true);+ });});describe('tuiHandshake.verifyPasteRendered', () => {diff --git a/server/services/agentTuiSpawning.js b/server/services/agentTuiSpawning.jsindex 1e6214e86c..ace5cc47e9 100644--- a/server/services/agentTuiSpawning.js+++ b/server/services/agentTuiSpawning.js@@ -383,9 +383,12 @@ export async function spawnTuiAgent({// paste into a startup banner, a trust menu, or a returned shell prompt.// agy enables bracketed paste on alt-screen entry, before its composer (and// before its trust gate) exists, so it needs the extra composer-footer gate.- const inputReady = createInputReadyTracker(- isAntigravityCommand(tuiConfig.command) ? { readyTextPattern: AGY_INPUT_READY_PATTERN } : {},- );+ // The durable runner pty.spawns the TUI directly (no launch shell), so the+ // tracker must not wait for a shell paste-mode OFF that will never come.+ const inputReady = createInputReadyTracker({+ ...(isAntigravityCommand(tuiConfig.command) ? { readyTextPattern: AGY_INPUT_READY_PATTERN } : {}),+ directLaunch: useDurableRunner,+ });let trustAccepted = false;// True once shell.js actually injects the `claude` command (after its// round-trip readiness probe). The probe runs its OWN shell command first,@@ -1022,7 +1025,12 @@ export async function spawnTuiAgent({// would dump the bracketed-paste prompt into the bare shell — the wedged// `^[[200~ …` session. If the shell has no live child, the command is gone:// fail loudly with whatever it printed instead of pasting into the shell.- if (!(await shellHasLiveChild(pid))) {+ //+ // Runner mode has no launch shell — the TUI IS the PTY process — so "does+ // this pid have a live child?" is the wrong question (claude may have zero+ // children at paste time) and a TUI exit kills the PTY, firing onExit. Skip+ // the probe there.+ if (!useDurableRunner && !(await shellHasLiveChild(pid))) {if (finalized) return; // a real onExit may have finalized during the probe awaitawait finishStartupFailure('tui-exited-early',diff --git a/server/services/agentTuiSpawning.test.js b/server/services/agentTuiSpawning.test.jsindex 2f7f62b5a3..4c62cad6fa 100644--- a/server/services/agentTuiSpawning.test.js+++ b/server/services/agentTuiSpawning.test.js@@ -1287,6 +1287,34 @@ describe('spawnTuiAgent runtime', () => {expect(pasteCount()).toBe(1);});+ // Regression (#3202 durable runner): the runner pty.spawns claude DIRECTLY —+ // no launch shell — so the shell's paste-mode OFF never appears in the+ // stream. The tracker must treat claude's own first ON as ready; before the+ // fix every runner-tui claude agent died `tui-not-ready` at the 45s deadline+ // with a live input box on screen (agent-ade9a664 / agent-29ca86ef).+ it('claude input-ready (runner mode): pastes on claude\'s own paste-mode ON with no shell OFF ever seen', async () => {+ // Runner mode must also SKIP the shell-child liveness probe: the TUI is the+ // PTY process itself (no launch shell), so a ps listing where the pid has no+ // children does not mean the TUI exited. Make ps return no child of pid 4321+ // to prove the probe can't veto the paste.+ vi.mocked(execFile).mockImplementation((_file, _args, _opts, cb) => cb(null, '1\n1\n999\n'));+ runSpawn({ tuiConfig: claudeTuiConfig, useDurableRunner: true });+ await flushMicrotasks();++ // Startup banner only — no bracketed-paste OFF precedes it in runner mode.+ await capturedOnData(Buffer.from('Claude Code v2.1.220\nOpus 5 with high effort\n'));+ await flushMicrotasks();+ await vi.advanceTimersByTimeAsync(2000);+ await flushMicrotasks();+ expect(pasteCount()).toBe(0); // banner alone is still not "input ready"++ await capturedOnData(Buffer.from(PASTE_ON));+ await flushMicrotasks();+ await vi.advanceTimersByTimeAsync(400);+ await flushMicrotasks();+ expect(pasteCount()).toBe(1);+ });+it('claude trust gate: auto-confirms the folder-trust prompt with Enter, then pastes once ready', async () => {runSpawn({ tuiConfig: claudeTuiConfig });await flushMicrotasks();