mirror of
https://github.com/morluto/rea.git
synced 2026-11-09 08:17:02 +00:00
Carry caller-selected target identity separately from launcher selection. Only fully collected ordinary nonzero decode exits represent target refusals; startup, preparation, capture and signal failures retain provider attribution. Reuse one command/preparation output projection for probe and decode errors. Adapt the target-path correction from PR #3462 (08d3d0d3a0) and extend its producer-boundary classification and regression coverage. Validation: 131 focused tests in 12 files, final 50 source checks, build, typecheck/lint and docs. Ten regression controls fail on baseline4844ae812. Twenty-four tiny actual CLI/stdio MCP refusal tasks preserve every projected field except the corrected message/path. Authored launchers only; no real Apktool/JVM or native Windows claim. Heavy stress/profiling remained stopped. Closes #3340 Co-authored-by: Peter <304086198+peter-research@users.noreply.github.com>
32 lines
1.3 KiB
TypeScript
32 lines
1.3 KiB
TypeScript
import { OwnedCommandFailure } from "../process/OwnedCommand.js";
|
|
import { DarwinProcessOwnershipInspectionError } from "../process/DarwinProcessRunTokenReader.js";
|
|
import type { AnalysisCapturedOutput } from "../domain/analysisErrorBase.js";
|
|
import type { ProviderProcessSnapshot } from "../process/ProviderProcess.js";
|
|
|
|
/** Project the command owner's bounded output without losing examined byte counts. */
|
|
const capturedApktoolCommandOutput = (
|
|
output: ProviderProcessSnapshot,
|
|
): AnalysisCapturedOutput => ({
|
|
stdout: output.stdout.text,
|
|
stderr: output.stderr.text,
|
|
truncated:
|
|
output.diagnosticTruncated === true || output.outputIncomplete === true,
|
|
stdout_bytes: output.stdout.observedBytes,
|
|
stderr_bytes: output.stderr.observedBytes,
|
|
exit_code: output.exitCode ?? null,
|
|
signal: output.signal ?? null,
|
|
});
|
|
|
|
/** The command owner selects command output or preparation output, once. */
|
|
export const capturedApktoolFailureOutput = (
|
|
cause: unknown,
|
|
): AnalysisCapturedOutput | undefined => {
|
|
if (cause instanceof OwnedCommandFailure)
|
|
return cause.snapshot === null
|
|
? cause.preparationFailure?.capturedOutput
|
|
: capturedApktoolCommandOutput(cause.snapshot);
|
|
return cause instanceof DarwinProcessOwnershipInspectionError
|
|
? cause.capturedOutput
|
|
: undefined;
|
|
};
|