mirror of
https://github.com/morluto/rea.git
synced 2026-11-11 01:13:39 +00:00
Declare logical Evidence sources once and resolve exact retained inputs through shared application workflows across 20 composition tools. Preserve domain-owned authentication, source closure, caller choices, coverage and resource admission. Validation includes public CLI/MCP regressions, local Codex terra/high trials and fresh-import real-artifact workflows. Measurements, failed attempts and coverage limits are recorded in docs/verification/evidence-input-composition-2026-10-31.md. Fixes #8293. Fixes #8281. Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
54 lines
1.9 KiB
TypeScript
54 lines
1.9 KiB
TypeScript
import { localPathStringSchema } from "../domain/localPath.js";
|
|
import type { Evidence } from "../domain/evidence.js";
|
|
import type { AnalysisError } from "../domain/analysisErrorBase.js";
|
|
import type { Result } from "../domain/result.js";
|
|
import { ArtifactResourceScope } from "../artifacts/ArtifactResourceScope.js";
|
|
import { absoluteCallerPath } from "../filesystem/callerPath.js";
|
|
import type { EvidenceLookup } from "../application/EvidenceInputResolver.js";
|
|
import { finishAnalysisCommand } from "./finishAnalysisCommand.js";
|
|
|
|
/** Explicit portable lookup context for CLI workflows accepting retained IDs. */
|
|
export const evidenceBundleOption = localPathStringSchema
|
|
.optional()
|
|
.describe(
|
|
"Resolve exact retained Evidence IDs from this local Evidence bundle without reopening an analysis target",
|
|
);
|
|
|
|
/** Own one selected bundle read through workflow execution and final cleanup. */
|
|
export const runEvidenceInputCommand = (
|
|
operation: string,
|
|
bundlePath: string | undefined,
|
|
signal: AbortSignal,
|
|
execute: (
|
|
lookup: EvidenceLookup | undefined,
|
|
resources: ArtifactResourceScope,
|
|
) => Promise<Result<Evidence, AnalysisError>>,
|
|
) => {
|
|
const resources = new ArtifactResourceScope();
|
|
return finishAnalysisCommand(
|
|
async () => {
|
|
let lookup: EvidenceLookup | undefined;
|
|
if (bundlePath !== undefined) {
|
|
const { readImmutableEvidenceBundle } =
|
|
await import("../application/EvidenceBundleFiles.js");
|
|
const bundle = await readImmutableEvidenceBundle(
|
|
absoluteCallerPath(bundlePath),
|
|
signal,
|
|
resources,
|
|
operation,
|
|
);
|
|
if (!bundle.ok) return bundle;
|
|
const records = new Map(
|
|
bundle.value.records.map((record) => [record.evidence_id, record]),
|
|
);
|
|
lookup = (id) => records.get(id);
|
|
}
|
|
return execute(lookup, resources);
|
|
},
|
|
resources,
|
|
"rea",
|
|
operation,
|
|
signal,
|
|
);
|
|
};
|