Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

716 B
Raw Blame
import type { EvidenceWriter } from "../application/investigation/InvestigationRecordPort.js";
import { EvidenceIntegrityError } from "../domain/evidenceErrors.js";
import type { Evidence } from "../domain/evidence.js";
import { ok, type Result } from "../domain/result.js";

/** Record source evidence in order, stopping at the first session rejection. */
export const recordSessionEvidenceSources = (
  recordEvidence: EvidenceWriter["recordEvidence"] | undefined,
  sources: readonly Evidence[],
): Result<null, EvidenceIntegrityError> => {
  for (const source of sources) {
    const recorded = recordEvidence?.(source);
    if (recorded !== undefined && !recorded.ok) return recorded;
  }
  return ok(null);
};