Download src/reverse-proof.ts from Snapkitty/holy-agents: direct link, hf CLI and curl.
- Browser
- Download file 1.65 kB
-
https://huggingface.co/Snapkitty/holy-agents/resolve/main/src/reverse-proof.ts
- Command line
-
hf download hf://Snapkitty/holy-agents/src/reverse-proof.ts
-
curl -L -o reverse-proof.ts https://huggingface.co/Snapkitty/holy-agents/resolve/main/src/reverse-proof.ts
1.65 kB
| import type { ReverseProof, ReverseProofEntry } from './twins/types.js'; | |
| export function buildReverseProof( | |
| artifacts: string[], | |
| instructionMap: Record<string, string>, | |
| deedClauseMap: Record<string, string>, | |
| agentMap: Record<string, string>, | |
| stateMap: Record<string, string>, | |
| wormMap: Record<string, string> | |
| ): ReverseProof { | |
| const entries: ReverseProofEntry[] = []; | |
| const orphanArtifacts: string[] = []; | |
| for (const artifact of artifacts) { | |
| const instruction = instructionMap[artifact]; | |
| const clause = deedClauseMap[artifact]; | |
| const agent = agentMap[artifact]; | |
| const state = stateMap[artifact]; | |
| const worm = wormMap[artifact]; | |
| if (!instruction || !clause || !agent || !state || !worm) { | |
| orphanArtifacts.push(artifact); | |
| entries.push({ | |
| artifact, | |
| originatingInstruction: instruction || 'UNKNOWN', | |
| trustDeedClause: clause || 'UNKNOWN', | |
| agent: agent || 'UNKNOWN', | |
| stateTransition: state || 'UNKNOWN', | |
| wormEvent: worm || 'UNKNOWN', | |
| verified: false | |
| }); | |
| } else { | |
| entries.push({ | |
| artifact, | |
| originatingInstruction: instruction, | |
| trustDeedClause: clause, | |
| agent, | |
| stateTransition: state, | |
| wormEvent: worm, | |
| verified: true | |
| }); | |
| } | |
| } | |
| return { | |
| entries, | |
| allVerified: entries.every(e => e.verified), | |
| orphanArtifacts | |
| }; | |
| } | |
| export function verifyTraceability(proof: ReverseProof): { valid: boolean; orphans: string[] } { | |
| return { | |
| valid: proof.allVerified, | |
| orphans: proof.orphanArtifacts | |
| }; | |
| } | |