docs: document process helpers

This commit is contained in:
Peter Steinberger
2026-06-04 20:14:34 -04:00
parent ef08c83e17
commit a628a66e4d
28 changed files with 28 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
// Child process bridge adapts child process events into typed lifecycle callbacks.
import type { ChildProcess } from "node:child_process";
import process from "node:process";

View File

@@ -1,3 +1,4 @@
// Command queue tests cover bounded command execution and queue ordering.
import { importFreshModule } from "openclaw/plugin-sdk/test-fixtures";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { CommandLane } from "./lanes.js";

View File

@@ -1,3 +1,4 @@
// Command queue serializes and limits process execution for shared command lanes.
import {
diagnosticLogger as diag,
logLaneDequeue,

View File

@@ -1,3 +1,4 @@
// No-output timer tests cover idle command timeout and output reset behavior.
import type { ChildProcess } from "node:child_process";
import { EventEmitter } from "node:events";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";

View File

@@ -1,3 +1,4 @@
// Exec tests cover command execution, output capture, and cancellation behavior.
import type { ChildProcess } from "node:child_process";
import { EventEmitter } from "node:events";
import process from "node:process";

View File

@@ -1,3 +1,4 @@
// Exec helpers run subprocesses with normalized output, timeout, and abort handling.
import { execFile, spawn } from "node:child_process";
import fs from "node:fs";
import path from "node:path";

View File

@@ -1,3 +1,4 @@
// Windows exec tests cover command invocation behavior on Windows paths.
import type { execFile as execFileType } from "node:child_process";
import { EventEmitter } from "node:events";
import fs from "node:fs";

View File

@@ -1,3 +1,4 @@
// Kill tree tests cover process tree termination and platform-specific fallbacks.
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { withMockedPlatform } from "../test-utils/vitest-spies.js";

View File

@@ -1,3 +1,4 @@
// Linux OOM score tests cover best-effort process OOM score adjustment.
import { describe, expect, it } from "vitest";
import {
hardenedEnvForChildOomWrap,

View File

@@ -1,3 +1,4 @@
// Linux OOM score helpers adjust child process OOM priority when supported.
import fs from "node:fs";
/**

View File

@@ -1,3 +1,4 @@
// Respawn child runner restarts child processes after configured exits.
import type { ChildProcess, spawn } from "node:child_process";
import type { attachChildProcessBridge } from "./child-process-bridge.js";

View File

@@ -1,3 +1,4 @@
// Spawn utility tests cover child process setup and stream handling helpers.
import type { ChildProcess } from "node:child_process";
import { EventEmitter } from "node:events";
import { PassThrough } from "node:stream";

View File

@@ -1,3 +1,4 @@
// Spawn utilities configure child processes and normalize spawned process handles.
import type { ChildProcess, SpawnOptions } from "node:child_process";
import { spawn } from "node:child_process";

View File

@@ -1,3 +1,4 @@
// Child adapter tests cover adapting child processes to supervisor runs.
import type { ChildProcess } from "node:child_process";
import { EventEmitter } from "node:events";
import { PassThrough } from "node:stream";

View File

@@ -1,3 +1,4 @@
// Child process adapter wraps spawned child processes for the supervisor.
import type { ChildProcessWithoutNullStreams, SpawnOptions } from "node:child_process";
import { createWindowsOutputDecoder } from "../../../infra/windows-encoding.js";
import { signalProcessTree } from "../../kill-tree.js";

View File

@@ -1,3 +1,4 @@
// PTY adapter tests cover PTY lifecycle and termination behavior.
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import {
expectRealExitWinsOverSigkillFallback,

View File

@@ -1,3 +1,4 @@
// PTY adapter wraps pseudo-terminal processes for the process supervisor.
import { signalProcessTree } from "../../kill-tree.js";
import { prepareOomScoreAdjustedSpawn } from "../../linux-oom-score.js";
import type { ManagedRunStdin, SpawnProcessAdapter } from "../types.js";

View File

@@ -1,3 +1,4 @@
// Supervisor adapter test support builds mock process handles for adapter tests.
import { expect, vi } from "vitest";
/**

View File

@@ -1,3 +1,4 @@
// Process supervisor barrel exposes the supervised process API.
import { createProcessSupervisor } from "./supervisor.js";
import type { ProcessSupervisor } from "./types.js";

View File

@@ -1,3 +1,4 @@
// Supervisor registry tests cover run registration, lookup, and pruning behavior.
import { describe, expect, it } from "vitest";
import { createRunRegistry } from "./registry.js";

View File

@@ -1,3 +1,4 @@
// Supervisor registry tracks active and historical supervised process runs.
import type { RunRecord, RunState, TerminationReason } from "./types.js";
/** In-memory run index for the supervisor; callers receive detached snapshots. */

View File

@@ -1,3 +1,4 @@
// Supervisor log runtime bridges supervisor events into subsystem logging.
import { createSubsystemLogger } from "../../logging/subsystem.js";
/** Runtime logging boundary for lazy supervisor paths and focused test mocks. */

View File

@@ -1,3 +1,4 @@
// PTY command supervisor tests cover supervised terminal command lifecycles.
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
const { createPtyAdapterMock } = vi.hoisted(() => ({

View File

@@ -1,3 +1,4 @@
// Process supervisor tests cover lifecycle, restart, and termination behavior.
import { performance } from "node:perf_hooks";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { SpawnProcessAdapter } from "./types.js";

View File

@@ -1,3 +1,4 @@
// Process supervisor manages long-running child and PTY process lifecycles.
import crypto from "node:crypto";
import { performance } from "node:perf_hooks";
import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce";

View File

@@ -1,3 +1,4 @@
// Process supervisor types describe supervised runs, states, and termination reasons.
export type RunState = "starting" | "running" | "exiting" | "exited";
export type TerminationReason =

View File

@@ -1,3 +1,4 @@
// Windows command tests cover command quoting and shell resolution on Windows.
import { describe, expect, it } from "vitest";
import { resolveWindowsCommandShim } from "./windows-command.js";

View File

@@ -1,3 +1,4 @@
// Windows command helpers resolve executable and shell invocation details.
import path from "node:path";
import process from "node:process";
import { normalizeLowercaseStringOrEmpty } from "@openclaw/normalization-core/string-coerce";