Files
openclaw/src/plugin-sdk/node-host.ts
T
Peter Steinberger 57d926b4fd fix: connect resumed native terminals reliably (#107688)
* fix: render resumed paired-node terminals

* fix(control-ui): connect native catalog terminals reliably

* chore: keep release notes in PR body

* fix(control-ui): require terminal reconnect cancellation

* fix(gateway): cancel timed-out terminal opens safely

* fix(control-ui): recover stalled terminal opens

* chore(ui): refresh i18n fallback baseline

* fix: preserve login shell path for resumed terminals

* refactor(plugin-sdk): avoid extra resolver export

* fix(gateway): normalize terminal open failures

* test(control-ui): split terminal readiness coverage

* docs: explain catalog terminal PATH restoration

* fix(control-ui): complete terminal readiness release gates

* fix(ci): remove unused shell resolver exports

* chore(plugin-sdk): refresh API baseline after rebase
2026-07-14 19:18:19 -07:00

59 lines
2.1 KiB
TypeScript

import { resolveExecutableFromPathEnv as resolveExecutableFromPathEnvDirect } from "../infra/executable-path.js";
import { resolveExecutableFromUserShellPathWithPathEnv } from "../infra/shell-env.js";
export {
decodeNodePtyResumeParams,
runNodePtyCommand,
type NodePtyCommandResult,
type NodePtyResumeParams,
} from "../node-host/pty-command.js";
export { validateClaudeSessionId } from "../node-host/invoke-agent-cli-claude-params.js";
export type { OpenClawPluginNodeHostCommandIo } from "../plugins/types.js";
export function resolveExecutableFromPathEnv(
executable: string,
pathEnv: string,
env: NodeJS.ProcessEnv | undefined,
options: {
includeExtensionless?: boolean;
fallbackToLoginShell?: boolean;
withPathEnv: true;
},
): { executable: string; pathEnv?: string } | undefined;
export function resolveExecutableFromPathEnv(
executable: string,
pathEnv: string,
env?: NodeJS.ProcessEnv,
options?: {
includeExtensionless?: boolean;
fallbackToLoginShell?: boolean;
withPathEnv?: false;
},
): string | undefined;
export function resolveExecutableFromPathEnv(
executable: string,
pathEnv: string,
env?: NodeJS.ProcessEnv,
options?: {
includeExtensionless?: boolean;
fallbackToLoginShell?: boolean;
withPathEnv?: boolean;
},
): string | { executable: string; pathEnv?: string } | undefined {
let resolution: { executable: string; pathEnv?: string } | undefined;
if (!options?.fallbackToLoginShell) {
const resolved = resolveExecutableFromPathEnvDirect(executable, pathEnv, env, options);
resolution = resolved ? { executable: resolved } : undefined;
} else {
// Local catalog terminals launch with this same login-shell PATH. Carry it
// forward because npm-style launchers may use `#!/usr/bin/env node`.
const shellEnv = env ?? process.env;
resolution = resolveExecutableFromUserShellPathWithPathEnv(executable, {
env: shellEnv,
pathEnv,
includeExtensionless: options.includeExtensionless,
});
}
return options?.withPathEnv ? resolution : resolution?.executable;
}