mirror of
https://github.com/morluto/rea.git
synced 2026-11-03 05:16:16 +00:00
Add evidence-backed investigation workflows
This commit is contained in:
1 parent
4110a4d717
commit
4ff4c11a00
178 files changed
+26320
-1222
No files matched your search
@@ -0,0 +1,67 @@
|
||||
import { enhancedInputSchemas } from "./enhancedInputs.js";
|
||||
import { createEvidence } from "../domain/evidence.js";
|
||||
import { jsonValueSchema } from "../domain/jsonValue.js";
|
||||
|
||||
const bounded = <Item>(items: readonly Item[]) => ({
|
||||
items,
|
||||
total: items.length,
|
||||
returned: items.length,
|
||||
truncated: false,
|
||||
next_offset: null,
|
||||
});
|
||||
|
||||
const dossier = (text: string) =>
|
||||
jsonValueSchema.parse({
|
||||
procedure: {
|
||||
address: "0x1000",
|
||||
name: "main",
|
||||
signature: "int main(void)",
|
||||
locals: [],
|
||||
},
|
||||
pseudocode: {
|
||||
text,
|
||||
total_chars: [...text].length,
|
||||
returned_chars: [...text].length,
|
||||
truncated: false,
|
||||
next_offset: null,
|
||||
},
|
||||
assembly: bounded([]),
|
||||
comments: bounded([]),
|
||||
callers: bounded([]),
|
||||
callees: bounded([]),
|
||||
incoming_references: bounded([]),
|
||||
outgoing_references: bounded([]),
|
||||
referenced_strings: bounded([]),
|
||||
referenced_names: bounded([]),
|
||||
basic_blocks: bounded([{ start: "0x1000", end: "0x1001", successors: [] }]),
|
||||
instruction_scan: { scanned: 1, truncated: false },
|
||||
});
|
||||
|
||||
const observe = (digit: string, text: string) =>
|
||||
createEvidence(
|
||||
{
|
||||
path: `/tmp/function-${digit}`,
|
||||
sha256: digit.repeat(64),
|
||||
format: "mach-o",
|
||||
},
|
||||
{
|
||||
id: "rea-workflow",
|
||||
name: "REA composed investigation workflow",
|
||||
version: "1",
|
||||
},
|
||||
{
|
||||
operation: "analyze_function",
|
||||
parameters: enhancedInputSchemas.analyze_function.parse({
|
||||
procedure: "main",
|
||||
}),
|
||||
result: dossier(text),
|
||||
confidence: "derived",
|
||||
authority: "shipped-artifact",
|
||||
},
|
||||
);
|
||||
|
||||
/** Canonical explicit function pair used in public contract examples. */
|
||||
export const FUNCTION_COMPARISON_EXAMPLE = {
|
||||
left: observe("0", "return 0;"),
|
||||
right: observe("1", "return 1;"),
|
||||
} as const;
|
||||
Reference in new issue
Block a user