fix(process)!: require current captures and preserve cleanup failures

Remove v3 capture conversion and require explicit executable identity and event journals. Preserve cancellation, execution diagnostics, snapshots, and cleanup outcomes from preparation through CLI delivery.
This commit is contained in:
morluto
2026-10-09 20:12:07 +08:00
parent abc4f47683
commit 2a7746998d
18 changed files with 419 additions and 353 deletions
@@ -1,3 +1,4 @@
import { DarwinProcessOwnershipInspectionError } from "../DarwinProcessRunTokenReader.js";
import { AnalysisError } from "../../domain/analysisErrorBase.js";
import type {
PartialProcessCaptureObservation,
@@ -61,3 +62,20 @@ export const processCaptureCancelled = (): ProcessCaptureError =>
reason: "cancelled",
userMessage: "Process capture was cancelled. Start it again when ready.",
});
/** Preserve typed process-inspection preflight failures at the capture boundary. */
export const normalizeCaptureFailure = (
cause: unknown,
signal: AbortSignal | undefined,
): unknown => {
if (cause instanceof ProcessCaptureError) return cause;
if (cause instanceof DarwinProcessOwnershipInspectionError)
return new ProcessCaptureError(cause.message, { cause });
if (
signal?.aborted === true &&
(cause === signal.reason ||
(cause instanceof Error && cause.name === "AbortError"))
)
return processCaptureCancelled();
return cause;
};