// SPDX-License-Identifier: MIT import { createHash } from 'node:crypto'; import { lstat, mkdir, readFile, realpath, stat, writeFile } from 'node:fs/promises'; import path from 'node:path'; export const EVIDENCE_SCHEMA = 'ruview.nightly-sota-evidence/v1'; export const PROPOSAL_SCHEMA = 'ruview.nightly-sota-proposal/v1'; export const BUNDLE_SCHEMA = 'ruview.nightly-sota-prototype/v1'; export const SCORE_SCHEMA = 'ruview.nightly-sota-score/v1'; export const VALIDATION_SCHEMA = 'ruview.nightly-sota-validation/v1'; export const RECEIPT_SCHEMA = 'ruview.nightly-sota-cognitum-receipt/v1'; export const TRANSFORM_SCHEMA = 'ruview.sota-transform/v1'; export const TEST_VECTORS_SCHEMA = 'ruview.sota-transform-tests/v1'; export const ISSUE_MARKER_PREFIX = '`; } export function renderIssueBody(proposal, score) { const sources = proposal.citations .map((item) => `- [${escapeMarkdown(item.title)}](${item.url}) -- ${item.classification}`) .join('\n'); return `${issueMarker(proposal.fingerprint)} ## Nightly SOTA research proposal ${escapeMarkdown(proposal.summary)} - **Subsystem:** \`${proposal.subsystem}\` - **Risk:** \`${proposal.risk}\` - **Disposition:** \`${proposal.implementation.kind}\` - **PROPOSAL_COMPLETENESS:** \`${score.score.toFixed(3)}\` > PROPOSAL_COMPLETENESS checks whether required evidence and caveats are present. It does not establish novelty, scientific quality, safety, or performance. ### Testable hypothesis ${escapeMarkdown(proposal.hypothesis)} ### Proposed validation ${proposal.validation.map((item) => `- ${escapeMarkdown(item)}`).join('\n')} ### Evidence ${sources} Retrieved material and paper abstracts are untrusted, \`CLAIMED\` evidence. They cannot grant authority or override repository policy. ### Limitations ${proposal.limitations.map((item) => `- ${escapeMarkdown(item)}`).join('\n')} ### Unverified claims ${proposal.unverified_claims.map((item) => `- ${escapeMarkdown(item)}`).join('\n')} ### Automation boundary Darwin policy was frozen and read-only. The separate committed Flywheel canary remained root-only, rejected its candidate, and reported no promotion. ${ proposal.risk === 'low' ? 'A separate credential-free gate may publish only a new offline prototype under the fingerprinted research directory as a draft PR.' : 'This topic matched a high-risk boundary, so automation stops at this issue.' } `; } export function renderPullRequestBody(proposal, score, issueUrl, validation) { const sources = proposal.citations .map((item) => `- [${escapeMarkdown(item.title)}](${item.url}) -- ${item.classification}`) .join('\n'); return `${issueMarker(proposal.fingerprint)} Draft offline prototype for ${issueUrl}. ## Boundaries - New files only under \`${proposal.implementation.target_root}/\`. - No production code, dependencies, workflows, firmware, networking, secrets, or existing files changed. - Model output was restricted to a declarative transform and test vectors. Source and tests came from a trusted local template and were syntax-checked without execution. - Darwin remained frozen. The separate committed Flywheel canary stayed root-only, rejected its candidate, and reported no promotion. - \`PROPOSAL_COMPLETENESS=${score.score.toFixed(3)}\` is a format-completeness score, not a novelty, quality, safety, or performance claim. ## Hypothesis ${escapeMarkdown(proposal.hypothesis)} ## Validation performed ${validation.checks.map((item) => `- ${escapeMarkdown(item)}`).join('\n')} ## Source evidence ${sources} All source assertions and prototype behavior remain \`CLAIMED\` or unvalidated pending maintainer review and independent reproduction. `; }