fix(cli): restored piped session persistence
- Treated undefined stdin TTY state as redirected input. - Honored PI_CODING_AGENT_SESSION_DIR with CLI precedence. Fixes #7378
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* CLI argument parsing and help display
|
||||
*/
|
||||
import { APP_NAME, CONFIG_DIR_NAME, logger } from "@oh-my-pi/pi-utils";
|
||||
import { $env, APP_NAME, CONFIG_DIR_NAME, logger } from "@oh-my-pi/pi-utils";
|
||||
import chalk from "chalk";
|
||||
import { CLI_THINKING_LEVELS, type ConfiguredThinkingLevel, parseCliThinkingLevel } from "../thinking";
|
||||
import { BUILTIN_TOOL_NAMES, HIDDEN_TOOL_NAMES, normalizeToolNames } from "../tools/builtin-names";
|
||||
@@ -145,6 +145,7 @@ export function parseArgs(inputArgs: string[], extensionFlags?: Map<string, { ty
|
||||
fileArgs: [],
|
||||
unknownFlags: new Map(),
|
||||
unrecognizedFlags: [],
|
||||
sessionDir: $env.PI_CODING_AGENT_SESSION_DIR || undefined,
|
||||
};
|
||||
|
||||
// `--` ends option parsing (POSIX end-of-options). Everything after it is
|
||||
|
||||
@@ -188,8 +188,9 @@ function applyAcpDefaultSettingOverrides(targetSettings: Settings = settings): v
|
||||
applyDefaultSettingOverrides(HOST_DEFAULTED_SETTING_PATHS, targetSettings);
|
||||
}
|
||||
|
||||
async function readPipedInput(): Promise<string | undefined> {
|
||||
if (process.stdin.isTTY !== false) return undefined;
|
||||
/** Reads a non-TTY stdin stream as prompt text. */
|
||||
export async function readPipedInput(): Promise<string | undefined> {
|
||||
if (process.stdin.isTTY === true) return undefined;
|
||||
// stdin is a pipe: a producer that never writes nor closes would block
|
||||
// startup forever with zero output. Say what we're blocked on after 1s.
|
||||
const notice = setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user