spb/autoscholar
Public
1import { CONTRACT_PATHS, type ModeProfile, type ResearchMode } from "@autoscholar/schemas";23const P = CONTRACT_PATHS;45const BASE_REQUIRED = [6 P.instruction,7 P.manifest,8 P.plan,9 P.feasibility,10 P.sources,11 P.sourceMap,12 P.referencesBib,13 P.mainTex,14 P.manuscriptBib,15 P.mainPdf,16 P.abstract,17 P.metadata,18 P.review1,19 P.revisions,20 P.events,21 P.runSummary,22 P.checksums,23];2425export const MODE_PROFILES: Record<ResearchMode, ModeProfile> = {26 empirical: {27 mode: "empirical",28 requiredArtifacts: [29 ...BASE_REQUIRED,30 P.dataReadme,31 P.dataManifest,32 P.codeReadme,33 P.metrics,34 P.robustness,35 P.experimentLog,36 ],37 requiredEvidence: ["real-data-manifest", "executed-analysis", "robustness", "reported-values-trace"],38 autoPublishAllowed: true,39 humanReviewRequired: false,40 description: "Data-driven analysis with documented data provenance, executed code and robustness checks.",41 },42 computational: {43 mode: "computational",44 requiredArtifacts: [...BASE_REQUIRED, P.codeReadme, P.metrics, P.robustness, P.experimentLog],45 requiredEvidence: ["executed-benchmark", "baselines", "seeds", "reported-values-trace"],46 autoPublishAllowed: true,47 humanReviewRequired: false,48 description: "Algorithms, systems and AI research with executable benchmarks, baselines and seeds.",49 },50 theoretical: {51 mode: "theoretical",52 requiredArtifacts: [...BASE_REQUIRED, P.robustness],53 requiredEvidence: ["formal-statements", "derivations-or-proofs", "counterexample-search"],54 autoPublishAllowed: true,55 humanReviewRequired: false,56 description:57 "Mathematical and model-based results with explicit assumptions, derivations and proof checking.",58 },59 review: {60 mode: "review",61 requiredArtifacts: [...BASE_REQUIRED, P.dataManifest, P.robustness],62 requiredEvidence: ["search-protocol", "screening-records", "verified-references"],63 autoPublishAllowed: true,64 humanReviewRequired: false,65 description:66 "Systematic or narrative literature synthesis with a documented search and screening protocol.",67 },68 experimental: {69 mode: "experimental",70 requiredArtifacts: [71 ...BASE_REQUIRED,72 P.dataReadme,73 P.dataManifest,74 P.codeReadme,75 P.metrics,76 P.robustness,77 P.experimentLog,78 ],79 requiredEvidence: ["protocol", "observed-vs-synthetic", "uncertainty", "reported-values-trace"],80 autoPublishAllowed: false,81 humanReviewRequired: true,82 description: "Simulations or authorized experiments; requires human review before publication.",83 },84 humanities: {85 mode: "humanities",86 requiredArtifacts: [...BASE_REQUIRED, P.dataManifest, P.robustness],87 requiredEvidence: ["primary-source-provenance", "interpretation-justification"],88 autoPublishAllowed: true,89 humanReviewRequired: false,90 description: "Qualitative, textual or interpretive inquiry grounded in primary sources with provenance.",91 },92};9394export const QUALITY_POLICY_VERSION = "2026.10-1";9596/** Disciplines with regulatory sensitivity: never auto-publish without human review. */97export const HUMAN_REVIEW_DISCIPLINES = new Set(["medicine", "biology", "law", "psychology"]);9899export function effectiveAutoPublish(100 mode: ResearchMode,101 discipline: string,102 requested: boolean,103): { allowed: boolean; reason?: string } {104 const prof = MODE_PROFILES[mode];105 if (!prof.autoPublishAllowed) return { allowed: false, reason: `mode ${mode} requires human review` };106 if (HUMAN_REVIEW_DISCIPLINES.has(discipline))107 return { allowed: false, reason: `discipline ${discipline} requires human review` };108 return { allowed: requested };109}110