Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/secrets/windows-secret-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ export interface ResolvedWindowsSecretCommand extends WindowsSecretCommand {
readonly launcher: string;
}

/**
* Controls the helper's inherited standard input without changing its checked
* request envelope. The stdio transport uses `pipe` so the Job Object helper
* can proxy an MCP conversation to its contained provider.
*/
export interface WindowsSecretCommandLaunchOptions {
readonly stdin?: "ignore" | "pipe";
readonly cwd?: string;
}

/**
* Resolves both the checked helper and the provider executable before spawn so
* Node never performs a current-directory lookup for a bare command.
Expand All @@ -51,7 +61,10 @@ export async function resolveWindowsSecretCommand(
* before it creates the provider process. Provider command data is carried only
* in the helper's bounded environment envelope, never in its command line.
*/
export function spawnWindowsSecretCommand(command: ResolvedWindowsSecretCommand): ChildProcess {
export function spawnWindowsSecretCommand(
command: ResolvedWindowsSecretCommand,
options: WindowsSecretCommandLaunchOptions = {}
): ChildProcess {
const request = encodeRequest(command);
const standardInput = encodeStandardInput(command.stdin);
if (request === undefined || (command.stdin !== undefined && standardInput === undefined)) {
Expand All @@ -62,7 +75,8 @@ export function spawnWindowsSecretCommand(command: ResolvedWindowsSecretCommand)
env: helperEnvironment(command.environment, request, standardInput),
shell: false,
windowsHide: true,
stdio: ["ignore", "pipe", "pipe"] as const
stdio: [options.stdin ?? "ignore", "pipe", "pipe"] as const,
...(options.cwd === undefined ? {} : { cwd: options.cwd })
});
}

Expand Down
Loading