Skip to content

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

fix: move launch-shape predicates to tuiHandshake to avoid an import cycle (#9612)

Adam Eivycefc93644bdc
diff --git a/server/lib/tuiHandshake.js b/server/lib/tuiHandshake.js
index d412c5a544..aaa1771834 100644
--- a/server/lib/tuiHandshake.js
+++ b/server/lib/tuiHandshake.js
@@ -467,6 +467,22 @@ const OBSERVE_TAIL_MAX_LEN = 4000;
// rolling tail. When supplied, `ready` also requires that marker to have been
// seen (see AGY_INPUT_READY_PATTERN).
//
+/**
+ * Test whether a launch shape owns its own PTY process.
+ * 'runner' and 'direct' shapes own their PTY; 'login-shell' is hosted in a shell.
+ */
+export function shapeHasOwnPty(launchShape) {
+ return launchShape === 'runner' || launchShape === 'direct';
+}
+
+/**
+ * Test whether a launch shape has a login shell to fall back to.
+ * Only 'login-shell' has a persistent shell; 'runner' and 'direct' do not.
+ */
+export function shapeHasLoginShell(launchShape) {
+ return launchShape === 'login-shell';
+}
+
// launchShape: which PTY shape this TUI runs in. 'runner' and 'direct' shapes
// own their PTY from byte zero and have no launch shell, so the shell's
// paste-mode OFF (`ESC[?2004l`) that normally proves "the command is now
@@ -480,7 +496,7 @@ export function createInputReadyTracker({ readyTextPattern = null, launchShape =
let pasteModeOn = false; // LIVE bracketed-paste mode state from the stream
// Shell turned paste mode OFF to run the command. Pre-latched when the TUI
// owns its own PTY (runner/direct shapes), where no shell OFF exists.
- const hasOwnPty = launchShape === 'runner' || launchShape === 'direct';
+ const hasOwnPty = shapeHasOwnPty(launchShape);
let sawCommandRun = hasOwnPty;
let needsTrust = false;
let trustAnswered = false;
diff --git a/server/services/agentTuiSpawning.js b/server/services/agentTuiSpawning.js
index 36655a9cdd..99c458bff9 100644
--- a/server/services/agentTuiSpawning.js
+++ b/server/services/agentTuiSpawning.js
@@ -94,22 +94,6 @@ export function resolveTuiLaunchShape({ useDurableRunner = false, safetyProfile
return isPublicReviewRestrictedProfile(safetyProfile) ? 'direct' : 'login-shell';
}
-/**
- * Test whether a launch shape owns its own PTY process.
- * 'runner' and 'direct' shapes own their PTY; 'login-shell' is hosted in a shell.
- */
-export function shapeHasOwnPty(launchShape) {
- return launchShape === 'runner' || launchShape === 'direct';
-}
-
-/**
- * Test whether a launch shape has a login shell to fall back to.
- * Only 'login-shell' has a persistent shell; 'runner' and 'direct' do not.
- */
-export function shapeHasLoginShell(launchShape) {
- return launchShape === 'login-shell';
-}
-
/**
* Open the agent TUI's PTY and pair the returned session id with its underlying
* pty process, so callers don't have to make a second `getSessionProcess` call
diff --git a/server/services/agentTuiSpawning/sessionController.js b/server/services/agentTuiSpawning/sessionController.js
index 33e8b3f8ad..d3c32fc762 100644
--- a/server/services/agentTuiSpawning/sessionController.js
+++ b/server/services/agentTuiSpawning/sessionController.js
@@ -41,7 +41,6 @@ import { createClaudeSessionLimitBannerDetector, createImmediateFallbackSignalDe
import { isAntigravityCommand } from '../../lib/antigravity.js';
import { isCodexCommand } from '../../lib/codex.js';
import { isClaudeCommand } from '../../lib/providerModels.js';
-import { shapeHasLoginShell } from '../agentTuiSpawning.js';
import { createCodexModelRejectionGate } from './codexModelRejection.js';
import {
READY_POLL_INTERVAL_MS,
@@ -69,6 +68,7 @@ import {
MCP_BOOT_PASTE_DEADLINE_MS,
MCP_BOOT_PASTE_RETRY_DELAY_MS,
createInputReadyTracker,
+ shapeHasLoginShell,
createStartupDialogAnswers,
answerStartupDialogs,
AGY_INPUT_READY_PATTERN,