refactor: hide subagent implementation helpers

This commit is contained in:
Tianyi Cui
2026-07-14 02:41:23 +08:00
parent 225796c90d
commit f85b831bd2
9 changed files with 54 additions and 87 deletions

View File

@@ -32,7 +32,7 @@ import { join } from 'node:path'
* the scrub, so an intended `DEEPSEEK_API_KEY` survives while an incidental
* `AWS_SECRET_ACCESS_KEY` does not.
*/
export const SENSITIVE_ENV_PATTERN = /KEY|SECRET|TOKEN/i
const SENSITIVE_ENV_PATTERN = /KEY|SECRET|TOKEN/i
/**
* The ambient env minus credential-shaped vars, plus the caller's explicit
@@ -72,7 +72,7 @@ export function spawnFailure(child: ChildProcess): Promise<Error> {
* already gone.
* @param child - the child process to await.
*/
export function waitForExit(child: ChildProcess): Promise<void> {
function waitForExit(child: ChildProcess): Promise<void> {
if (child.exitCode !== null || child.signalCode !== null) return Promise.resolve()
return new Promise<void>(resolve => child.once('exit', () => { resolve() }))
}
@@ -87,7 +87,7 @@ export function waitForExit(child: ChildProcess): Promise<void> {
* @returns `true` if the child exits within `ms` (immediately if it is
* already gone), `false` on timeout.
*/
export function exitsWithin(child: ChildProcess, ms: number): Promise<boolean> {
function exitsWithin(child: ChildProcess, ms: number): Promise<boolean> {
if (child.exitCode !== null || child.signalCode !== null) return Promise.resolve(true)
return new Promise<boolean>((resolve) => {
const onExit = (): void => {