2sagaco48 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/diagnostics.mjs +141 -0
- package/dist/compute.worker-j5ahIpF-.js +1 -0
- package/dist/graph.worker-DG6iGCB9.js +1 -0
- package/dist/index.html +2314 -0
- package/flatten-guide.md +248 -0
- package/index.html +12 -0
- package/package.json +38 -0
- package/src/App.orig.tsx +204 -0
- package/src/App.orig1.tsx +27 -0
- package/src/App.orig2.tsx +25 -0
- package/src/App.tsx +3 -0
- package/src/BaseApp.tsx +18 -0
- package/src/INTEGRATION_LEDGER.md +22 -0
- package/src/PERSIST_CANARY.orig.txt +1 -0
- package/src/PERSIST_CANARY.txt +1 -0
- package/src/REGRESSION_LEDGER.md +651 -0
- package/src/TEMPLATE_PIPELINE_AUDIT.md +208 -0
- package/src/WILLIAMS_PERSONA_GUIDE.md +62 -0
- package/src/chat/VeritasChat.tsx +69 -0
- package/src/chat/synthesis.ts +31 -0
- package/src/chat/tier.ts +45 -0
- package/src/components/AdaptersPage.orig.tsx +99 -0
- package/src/components/AdaptersPage.tsx +3 -0
- package/src/components/AdversarialPanel.tsx +136 -0
- package/src/components/AnchorBaselinePanel.tsx +75 -0
- package/src/components/AnswerPanel.tsx +60 -0
- package/src/components/ArtifactPanel.tsx +43 -0
- package/src/components/ChatApp.orig.tsx +1582 -0
- package/src/components/ChatApp.orig1.tsx +722 -0
- package/src/components/ChatApp.tsx +95 -0
- package/src/components/ChatAugmentPanels.tsx +73 -0
- package/src/components/CitationLedgerPanel.tsx +313 -0
- package/src/components/ComputeSandboxPanel.tsx +130 -0
- package/src/components/ConfigPanel.tsx +110 -0
- package/src/components/ControlPlanePage.tsx +195 -0
- package/src/components/CreativeTreeLifePage.tsx +234 -0
- package/src/components/CreativeTreeOfLifePanel.tsx +149 -0
- package/src/components/DebugTracePanel.tsx +137 -0
- package/src/components/DeepReasoningTrace.tsx +48 -0
- package/src/components/EntitySheetPanel.tsx +51 -0
- package/src/components/FailureModesPanel.tsx +104 -0
- package/src/components/GBSDashboard.tsx +239 -0
- package/src/components/GraphView.tsx +116 -0
- package/src/components/HUD.tsx +125 -0
- package/src/components/HypothesisPanel.tsx +67 -0
- package/src/components/InnovationGenomeEngine.tsx +792 -0
- package/src/components/InnovationPersonaGuide.tsx +348 -0
- package/src/components/InnovationPersonaPanel.tsx +289 -0
- package/src/components/LiveResourceHUD.tsx +109 -0
- package/src/components/LongWriterPanel.tsx +112 -0
- package/src/components/MainPipelineV10Bridge.tsx +72 -0
- package/src/components/MarkdownLite.tsx +63 -0
- package/src/components/MemoryInspector.tsx +38 -0
- package/src/components/MemoryMonitor.tsx +52 -0
- package/src/components/MemoryStressPanel.tsx +176 -0
- package/src/components/ModulesPage.tsx +171 -0
- package/src/components/PipelineDebugConsole.orig.tsx +1856 -0
- package/src/components/PipelineDebugConsole.tsx +3 -0
- package/src/components/PreFlightHUD.tsx +67 -0
- package/src/components/PrismaFetchTracePanel.tsx +87 -0
- package/src/components/ReportOSPanel.tsx +165 -0
- package/src/components/ResourceEstimatorPage.tsx +327 -0
- package/src/components/RichText.tsx +181 -0
- package/src/components/SagaOsPanel.tsx +605 -0
- package/src/components/SagaOsReference.tsx +421 -0
- package/src/components/SagaOsV2Panel.tsx +594 -0
- package/src/components/SagaStyleTab.tsx +382 -0
- package/src/components/SageBlueprintPanel.tsx +416 -0
- package/src/components/SharedChatInput.tsx +77 -0
- package/src/components/StatFinancePanel.tsx +190 -0
- package/src/components/StylePersonaPanel.tsx +128 -0
- package/src/components/TemplatesPage.tsx +300 -0
- package/src/components/TestPanel.tsx +63 -0
- package/src/components/TraceLog.tsx +89 -0
- package/src/components/V15CalibrationAugment.tsx +1134 -0
- package/src/components/V15CalibrationDialog.tsx +1871 -0
- package/src/components/V15Overlay.orig.tsx +120 -0
- package/src/components/V15Overlay.tsx +4 -0
- package/src/components/V15OverlayWrapper.tsx +362 -0
- package/src/components/V15Toggle.tsx +34 -0
- package/src/console/DiagnosticRecoveryPanel.tsx +358 -0
- package/src/console/EngineeringConsole.tsx +103 -0
- package/src/console/FictionSystemPanels.tsx +882 -0
- package/src/console/InspectorPanels.tsx +254 -0
- package/src/console/ManuscriptGraderPanel.tsx +182 -0
- package/src/console/RecursiveReviserPanel.tsx +245 -0
- package/src/console/SeedControlPanel.tsx +135 -0
- package/src/console/StoryControllerPanel.tsx +443 -0
- package/src/console/engineBridge.ts +258 -0
- package/src/console/gemini.ts +106 -0
- package/src/console/grading.ts +250 -0
- package/src/console/util.ts +45 -0
- package/src/fiction/continuity.ts +372 -0
- package/src/fiction/crash-protection.ts +111 -0
- package/src/fiction/diagnostics.ts +208 -0
- package/src/fiction/diff.ts +74 -0
- package/src/fiction/entity-state-machine.ts +214 -0
- package/src/fiction/nive-engine.ts +404 -0
- package/src/fiction/pipeline-selftest.ts +132 -0
- package/src/fiction/seed-control.ts +193 -0
- package/src/fiction/story-engine.ts +326 -0
- package/src/fiction/types.ts +68 -0
- package/src/flatten-guide.md +379 -0
- package/src/index.css +14 -0
- package/src/index.orig.css +13 -0
- package/src/lib/academic-sources.base.ts +188 -0
- package/src/lib/academic-sources.orig.ts +28 -0
- package/src/lib/academic-sources.ts +10 -0
- package/src/lib/advanced-math.ts +119 -0
- package/src/lib/adversarial-engine.base.ts +409 -0
- package/src/lib/adversarial-engine.ts +82 -0
- package/src/lib/ai-revision.ts +623 -0
- package/src/lib/app-state.tsx +426 -0
- package/src/lib/artifact-registry.ts +97 -0
- package/src/lib/artifacts.ts +180 -0
- package/src/lib/atlas-dr.ts +167 -0
- package/src/lib/browser-mtls.ts +127 -0
- package/src/lib/browser-queue.ts +221 -0
- package/src/lib/browser-search-scraper.base.ts +382 -0
- package/src/lib/browser-search-scraper.orig.ts +90 -0
- package/src/lib/browser-search-scraper.ts +10 -0
- package/src/lib/calc-interceptor.ts +82 -0
- package/src/lib/citation-lane-tap.ts +78 -0
- package/src/lib/citation-ledger-store.ts +369 -0
- package/src/lib/citation-ledger.ts +203 -0
- package/src/lib/compute-sandbox.ts +215 -0
- package/src/lib/compute.worker.ts +153 -0
- package/src/lib/connectors/gemini.ts +120 -0
- package/src/lib/connectors/jina.ts +233 -0
- package/src/lib/connectors/marketdata.ts +51 -0
- package/src/lib/connectors/prismafetch.base.ts +175 -0
- package/src/lib/connectors/prismafetch.ts +1 -0
- package/src/lib/connectors/serpapi.ts +65 -0
- package/src/lib/connectors/wikidata.ts +44 -0
- package/src/lib/constraints.ts +331 -0
- package/src/lib/continuation-detector.base.ts +153 -0
- package/src/lib/continuation-detector.ts +48 -0
- package/src/lib/contradraft.ts +168 -0
- package/src/lib/cors-proxy.ts +120 -0
- package/src/lib/coverage.ts +81 -0
- package/src/lib/debug/architecture-prescription.ts +556 -0
- package/src/lib/debug/covea-repair.ts +543 -0
- package/src/lib/debug/helios-ground.ts +319 -0
- package/src/lib/debug/intent-decomposer.ts +281 -0
- package/src/lib/debug/intent-lattice.ts +349 -0
- package/src/lib/debug/pipeline-diagnosis.ts +1149 -0
- package/src/lib/debug/pipeline-trace-bus.ts +424 -0
- package/src/lib/debug/prompt-forge.ts +678 -0
- package/src/lib/debug/repair-sites.ts +513 -0
- package/src/lib/debug/research-phase.ts +266 -0
- package/src/lib/debug/retrieval-context.ts +76 -0
- package/src/lib/debug/retrieval-hardener.ts +142 -0
- package/src/lib/debug/scraper-debug-runner.ts +576 -0
- package/src/lib/debug/scraper-forensics.ts +418 -0
- package/src/lib/debug/scraper-lane-roadmap.ts +136 -0
- package/src/lib/debug/self-test.ts +415 -0
- package/src/lib/debug/step-attribution.ts +211 -0
- package/src/lib/debug/template-rubric.ts +301 -0
- package/src/lib/debug/unified-innovation.ts +126 -0
- package/src/lib/debug/veritas-hybrid-scraper.ts +335 -0
- package/src/lib/defense-registry.ts +104 -0
- package/src/lib/defenses.ts +162 -0
- package/src/lib/deterministic-citation-ledger.ts +174 -0
- package/src/lib/elo-registry.base.ts +117 -0
- package/src/lib/elo-registry.ts +1 -0
- package/src/lib/entity-resolver.ts +291 -0
- package/src/lib/failure-modes.ts +267 -0
- package/src/lib/feature-registry.ts +69 -0
- package/src/lib/flaw-registry.ts +143 -0
- package/src/lib/flaws/_template.ts +52 -0
- package/src/lib/flaws/builtins.ts +63 -0
- package/src/lib/flaws/finance.ts +169 -0
- package/src/lib/flaws/fixers.ts +10 -0
- package/src/lib/flaws/index.ts +32 -0
- package/src/lib/flaws/legal.ts +157 -0
- package/src/lib/flaws/medical.ts +188 -0
- package/src/lib/flaws/original-defenses-pack.ts +81 -0
- package/src/lib/flaws/sample-declarative-pack.json +38 -0
- package/src/lib/flaws/selftest.ts +201 -0
- package/src/lib/flaws/software-extended.ts +125 -0
- package/src/lib/flaws/software-rn-webgl.ts +182 -0
- package/src/lib/flaws/statistics-advanced.ts +46 -0
- package/src/lib/flaws/statistics.ts +61 -0
- package/src/lib/gbse/config.ts +20 -0
- package/src/lib/gbse/engine.ts +226 -0
- package/src/lib/gbse/graph.ts +118 -0
- package/src/lib/gbse/graph.worker.ts +21 -0
- package/src/lib/gbse/tests.ts +117 -0
- package/src/lib/gbse/tiers.ts +65 -0
- package/src/lib/gbse/types.ts +94 -0
- package/src/lib/innovation-genome-engine-v2.orig.ts +1001 -0
- package/src/lib/innovation-genome-engine-v2.ts +3 -0
- package/src/lib/innovation-genome-engine.orig.ts +330 -0
- package/src/lib/innovation-genome-engine.ts +3 -0
- package/src/lib/innovation-genome-v10.orig.ts +314 -0
- package/src/lib/innovation-genome-v10.ts +2 -0
- package/src/lib/innovation-genome-v3.orig.ts +2015 -0
- package/src/lib/innovation-genome-v3.ts +2 -0
- package/src/lib/innovation-genome-v4.orig.ts +1959 -0
- package/src/lib/innovation-genome-v4.ts +2 -0
- package/src/lib/innovation-genome-v5.orig.ts +1210 -0
- package/src/lib/innovation-genome-v5.ts +2 -0
- package/src/lib/innovation-genome-v7.orig.ts +2549 -0
- package/src/lib/innovation-genome-v7.ts +2 -0
- package/src/lib/innovation-genome-v8.orig.ts +1485 -0
- package/src/lib/innovation-genome-v8.ts +2 -0
- package/src/lib/innovation-genome-v9.orig.ts +643 -0
- package/src/lib/innovation-genome-v9.ts +2 -0
- package/src/lib/jina.base.ts +293 -0
- package/src/lib/jina.ts +1 -0
- package/src/lib/live-telemetry.ts +61 -0
- package/src/lib/longwriter.ts +84 -0
- package/src/lib/manuscript-grade-v2.ts +298 -0
- package/src/lib/memory-governor.ts +173 -0
- package/src/lib/memory-stress-tests.ts +248 -0
- package/src/lib/model-intelligence.ts +48 -0
- package/src/lib/model-rotator.ts +75 -0
- package/src/lib/models.orig.ts +513 -0
- package/src/lib/models.ts +151 -0
- package/src/lib/n-deep.base.ts +592 -0
- package/src/lib/n-deep.ts +51 -0
- package/src/lib/nih-simulator.ts +56 -0
- package/src/lib/nih-vulnerability-fixes.ts +460 -0
- package/src/lib/omega-templates.base.ts +294 -0
- package/src/lib/omega-templates.ts +225 -0
- package/src/lib/omni-nexus.ts +64 -0
- package/src/lib/oracle-adapters.ts +67 -0
- package/src/lib/oracle-registry.ts +163 -0
- package/src/lib/orchestrator.ts +357 -0
- package/src/lib/output-boundary.ts +235 -0
- package/src/lib/overrides/vite-native-chaos-harness.ts +154 -0
- package/src/lib/overrides/vite-native-contract-plane.ts +245 -0
- package/src/lib/overrides/vite-native-doctor-plane.ts +208 -0
- package/src/lib/overrides/vite-native-knowledge-store.ts +267 -0
- package/src/lib/overrides/vite-native-policy-plane.ts +190 -0
- package/src/lib/overrides/vite-native-replay-plane.ts +197 -0
- package/src/lib/overrides/vite-native-runtime-plane.ts +106 -0
- package/src/lib/overrides/vite-native-scraper.ts +848 -0
- package/src/lib/overrides/vite-native-selftest-functional.ts +217 -0
- package/src/lib/overrides/vite-native-selftest.ts +183 -0
- package/src/lib/overrides/vite-native-snapshot-plane.ts +123 -0
- package/src/lib/philosophy-toolkit.ts +75 -0
- package/src/lib/pipeline.orig.ts +659 -0
- package/src/lib/pipeline.ts +42 -0
- package/src/lib/precache.ts +128 -0
- package/src/lib/py-sandbox.ts +205 -0
- package/src/lib/quality-score.ts +96 -0
- package/src/lib/quant-engine.ts +231 -0
- package/src/lib/quant-lib.ts +80 -0
- package/src/lib/reportos.ts +175 -0
- package/src/lib/research-os.ts +306 -0
- package/src/lib/resource-estimator.ts +114 -0
- package/src/lib/rpm-governor.ts +93 -0
- package/src/lib/runtime-estimator.ts +135 -0
- package/src/lib/sage/empty-space-v6.ts +560 -0
- package/src/lib/sage/empty-space-v7.ts +222 -0
- package/src/lib/sage/empty-space.ts +733 -0
- package/src/lib/sage/engine.ts +786 -0
- package/src/lib/sage/index.ts +17 -0
- package/src/lib/sage/judge.ts +246 -0
- package/src/lib/sage/prng.ts +53 -0
- package/src/lib/sage/reality-grounding.ts +380 -0
- package/src/lib/sage/repetition.ts +151 -0
- package/src/lib/sage/saga-os-v2-engines.ts +1870 -0
- package/src/lib/sage/saga-os-v2.ts +274 -0
- package/src/lib/sage/saga-os-v3-core.ts +1491 -0
- package/src/lib/sage/saga-os-v3-release.ts +739 -0
- package/src/lib/sage/saga-os-v4-aureate.ts +1161 -0
- package/src/lib/sage/saga-os-v4.ts +212 -0
- package/src/lib/sage/saga-os-v5.ts +205 -0
- package/src/lib/sage/saga-os-v6.ts +346 -0
- package/src/lib/sage/saga-os-v7.ts +314 -0
- package/src/lib/sage/saga-os-v8.ts +505 -0
- package/src/lib/sage/saga-os.ts +329 -0
- package/src/lib/sage/taxonomy.ts +403 -0
- package/src/lib/sage/unified-roll.ts +524 -0
- package/src/lib/sage/worked-sketches.ts +44 -0
- package/src/lib/sage.ts +166 -0
- package/src/lib/scraper-debug-bus.ts +53 -0
- package/src/lib/scraper-enhanced.orig.ts +153 -0
- package/src/lib/scraper-enhanced.ts +10 -0
- package/src/lib/scraper-hardener.base.orig.ts +155 -0
- package/src/lib/scraper-hardener.base.ts +317 -0
- package/src/lib/scraper-hardener.ts +1 -0
- package/src/lib/scraper-palisade/palisade-adjudicator.orig.ts +419 -0
- package/src/lib/scraper-palisade/palisade-adjudicator.ts +13 -0
- package/src/lib/scraper-vnext/arbiter-omega.orig.ts +688 -0
- package/src/lib/scraper-vnext/arbiter-omega.ts +13 -0
- package/src/lib/scraper-vnext/canonical-portfolio-augments.ts +479 -0
- package/src/lib/scraper-vnext/canonical-portfolio-orchestrator.orig.ts +1529 -0
- package/src/lib/scraper-vnext/canonical-portfolio-orchestrator.ts +13 -0
- package/src/lib/scraper-vnext/conclave-omega.ts +1830 -0
- package/src/lib/scraper-vnext/content-extractor-v2.ts +226 -0
- package/src/lib/scraper-vnext/diagnostics-suite.ts +36 -0
- package/src/lib/scraper-vnext/epistemic-packer.ts +97 -0
- package/src/lib/scraper-vnext/fusion-v2.ts +65 -0
- package/src/lib/scraper-vnext/hydra-reader.orig.ts +1216 -0
- package/src/lib/scraper-vnext/hydra-reader.ts +13 -0
- package/src/lib/scraper-vnext/native-scraper-browser-vnext.orig.ts +91 -0
- package/src/lib/scraper-vnext/native-scraper-browser-vnext.ts +13 -0
- package/src/lib/scraper-vnext/nexus-consensus.orig.ts +905 -0
- package/src/lib/scraper-vnext/nexus-consensus.ts +13 -0
- package/src/lib/scraper-vnext/portfolio-consensus-adjudicator.ts +804 -0
- package/src/lib/scraper-vnext/portfolio-consensus-memory.ts +377 -0
- package/src/lib/scraper-vnext/portfolio-terminal-governor.ts +548 -0
- package/src/lib/scraper-vnext/query-strategist.orig.ts +224 -0
- package/src/lib/scraper-vnext/query-strategist.ts +423 -0
- package/src/lib/scraper-vnext/retrieval-accelerator.ts +708 -0
- package/src/lib/scraper-vnext/retrieval-audit-augments.ts +477 -0
- package/src/lib/scraper-vnext/retrieval-control-plane.ts +904 -0
- package/src/lib/scraper-vnext/retrieval-policy-augments.ts +358 -0
- package/src/lib/scraper-vnext/safe-fetch-v2.ts +157 -0
- package/src/lib/scraper-vnext/sentinel-omega.ts +56 -0
- package/src/lib/scraper-vnext/sentinel-orchestrator.ts +69 -0
- package/src/lib/scraper-vnext/sibyl-oracle.orig.ts +413 -0
- package/src/lib/scraper-vnext/sibyl-oracle.ts +13 -0
- package/src/lib/scraper-vnext/smart-read-v2.ts +55 -0
- package/src/lib/scraper-vnext/spa-rescue-bridge.ts +608 -0
- package/src/lib/scraper-vnext/strata-engine.orig.ts +2666 -0
- package/src/lib/scraper-vnext/strata-engine.ts +13 -0
- package/src/lib/scraper-vnext/structured-source-adapter.orig.ts +369 -0
- package/src/lib/scraper-vnext/structured-source-adapter.ts +34 -0
- package/src/lib/scraper-vnext/terminal-complete.ts +224 -0
- package/src/lib/scraper-vnext/terminal-final.ts +277 -0
- package/src/lib/scraper-vnext/terminal-saturation.ts +345 -0
- package/src/lib/scraper-vnext/terminal-wire.ts +425 -0
- package/src/lib/scraper-vnext/vanguard-titanium.orig.ts +467 -0
- package/src/lib/scraper-vnext/vanguard-titanium.ts +17 -0
- package/src/lib/search-cache.ts +138 -0
- package/src/lib/sloop-runner.base.ts +223 -0
- package/src/lib/sloop-runner.ts +104 -0
- package/src/lib/sloop.ts +114 -0
- package/src/lib/small-model-adapters.ts +82 -0
- package/src/lib/sscp.ts +86 -0
- package/src/lib/system-map.ts +54 -0
- package/src/lib/uni-node.ts +86 -0
- package/src/lib/universal-rigor-guard.ts +433 -0
- package/src/lib/v15-gate-testbed.ts +274 -0
- package/src/lib/v15-gemini.base.ts +89 -0
- package/src/lib/v15-gemini.ts +1 -0
- package/src/lib/v15-grounding.orig.ts +241 -0
- package/src/lib/v15-grounding.ts +79 -0
- package/src/lib/v15-pipeline.base.ts +769 -0
- package/src/lib/v15-pipeline.orig.ts +1154 -0
- package/src/lib/v15-pipeline.ts +674 -0
- package/src/lib/v15-questions.ts +64 -0
- package/src/lib/v15-rate-limiter.orig.ts +91 -0
- package/src/lib/v15-rate-limiter.ts +48 -0
- package/src/lib/v15-state.base.ts +87 -0
- package/src/lib/v15-state.ts +28 -0
- package/src/lib/visual-table-generator.tsx +207 -0
- package/src/lib/wasm-runtime.ts +133 -0
- package/src/lib/williams-persona-guide.ts +265 -0
- package/src/lib/williams-style.base.ts +464 -0
- package/src/lib/williams-style.ts +59 -0
- package/src/lib/worker-pool.ts +96 -0
- package/src/lib/writing-tiers.ts +125 -0
- package/src/main.orig.tsx +10 -0
- package/src/main.tsx +10 -0
- package/src/utils/cn.orig.ts +6 -0
- package/src/utils/cn.ts +6 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.json +31 -0
- package/unify.mjs +537 -0
- package/vite.config.ts +18 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SAGA-OS v6 — original single-vendor stack (fable.canon SYSTEM v17)
|
|
3
|
+
* ---------------------------------------------------------------------------
|
|
4
|
+
* Append-only over v4/v5. Registers the v6 in-house replacement schemas
|
|
5
|
+
* (HELIOS-LEX, KINETICON 60-class matrix, AXIS-FRAMES 200-frame taxonomy,
|
|
6
|
+
* RESONA G2P + prosody, MORPHEA surface realizer, VERIDICT validator,
|
|
7
|
+
* COLLOCA collocation pack, SKYWRIT-ATLAS statistics, GRAMMATON bundle,
|
|
8
|
+
* STYLE-MANIFEST schema, GAUNTLET test harness).
|
|
9
|
+
*
|
|
10
|
+
* Real, deterministic functions included:
|
|
11
|
+
* - populateStyleManifest() — v6 §8.2 populator applied to the actual
|
|
12
|
+
* P5–P7 empty-space bands we already have in this codebase, producing a
|
|
13
|
+
* real per-band StyleManifest and knocking down the "per-row wiring
|
|
14
|
+
* manifest" item that has been on the ledger since P8.
|
|
15
|
+
* - runGauntletA() — hand-traced GAUNTLET-A unit tests over the
|
|
16
|
+
* v5/v6 functions we can honestly run (fractal inheritance determinism,
|
|
17
|
+
* serendipity picker reproducibility, blind-speaker distance sanity,
|
|
18
|
+
* wan-intensifier density, syntax-form selector monotony guard).
|
|
19
|
+
*
|
|
20
|
+
* The source doc's out-of-scope items (full linguistic authoring of 60
|
|
21
|
+
* KINETICON classes, 200 AXIS frames, 480 RESONA rules, 220 VERIDICT rules,
|
|
22
|
+
* full MORPHEA grammar, curated public-domain corpus ingestion) are exported
|
|
23
|
+
* as `SAGA_OS_V6_UNEXECUTED` — the same honest gap list the v6 doc itself
|
|
24
|
+
* carries in its own ledger. Nothing is faked.
|
|
25
|
+
*/
|
|
26
|
+
import type { SagaRow } from "./saga-os";
|
|
27
|
+
import { EMPTY_SPACE_BANDS } from "./empty-space";
|
|
28
|
+
import {
|
|
29
|
+
fractalStyleInherit,
|
|
30
|
+
serendipityPick,
|
|
31
|
+
blindSpeakerDistance,
|
|
32
|
+
} from "./saga-os-v5";
|
|
33
|
+
import { auditWanIntensifiers, selectSyntaxForm } from "./saga-os-v4";
|
|
34
|
+
|
|
35
|
+
function parse(raw: string): SagaRow[] {
|
|
36
|
+
return raw.trim().split(/\n+/).map((l) => l.trim()).filter(Boolean).map((l) => {
|
|
37
|
+
const [id, name, ...rest] = l.split("|").map((p) => p.trim());
|
|
38
|
+
return { id, name, note: rest.join(" | ") };
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ── §2 HELIOS-LEX 45 supersense skeleton (design summary) ───────────────────
|
|
43
|
+
export const HELIOS_LEX_SUPERSENSES: SagaRow[] = parse(`
|
|
44
|
+
entity.living_thing | person, animal, plant | agents and organic subjects
|
|
45
|
+
entity.artifact | tool, vehicle, weapon, document | made objects
|
|
46
|
+
entity.natural_object | landscape, water, stone, sky | non-made physical objects
|
|
47
|
+
entity.abstraction | knowledge, event, fact, quality, relation | intangible referents
|
|
48
|
+
event.natural | combust, bloom, storm, decay | non-agentive events
|
|
49
|
+
event.change_of_state | freeze, mend, wither | state transitions
|
|
50
|
+
event.change_of_location | arrive, depart, cross | spatial transitions
|
|
51
|
+
event.change_of_knowledge | discover, forget, learn | epistemic transitions
|
|
52
|
+
event.communication | speech, writing, gesture | information transfer
|
|
53
|
+
event.emotional | grief, elation, dread | affective states
|
|
54
|
+
state.body | ache, hunger, tire | corporeal conditions
|
|
55
|
+
state.social | trust, loyalty, betrayal | relational conditions
|
|
56
|
+
state.institutional | duty, office, custody | civic conditions
|
|
57
|
+
`);
|
|
58
|
+
|
|
59
|
+
// ── §3 KINETICON 60-class matrix (index only; full frames are v6-doc TODO) ─
|
|
60
|
+
export const KINETICON_CLASSES: SagaRow[] = parse(`
|
|
61
|
+
K.01 | MOTION_TRANSLATIONAL | walk, run, drive, sail
|
|
62
|
+
K.02 | MOTION_MANNER | stagger, skip, tiptoe, lunge
|
|
63
|
+
K.03 | CHANGE_OF_STATE | freeze, melt, break, mend
|
|
64
|
+
K.04 | CHANGE_OF_LOCATION | place, put, carry, deliver
|
|
65
|
+
K.05 | CHANGE_OF_POSSESSION | give, take, buy, sell, inherit
|
|
66
|
+
K.06 | CHANGE_OF_KNOWLEDGE | discover, reveal, learn, forget
|
|
67
|
+
K.07 | COMMUNICATION_SPEECH | say, ask, whisper, shout
|
|
68
|
+
K.08 | COMMUNICATION_WRITTEN | write, sign, note, inscribe
|
|
69
|
+
K.09 | PERCEPTION_VISUAL | see, watch, glance, stare
|
|
70
|
+
K.10 | PERCEPTION_AUDITORY | hear, listen, overhear
|
|
71
|
+
K.11 | PERCEPTION_TACTILE | touch, feel, brush, grip
|
|
72
|
+
K.12 | PERCEPTION_OLFACTORY | smell, sniff, catch-scent-of
|
|
73
|
+
K.13 | PERCEPTION_GUSTATORY | taste, savor, sample
|
|
74
|
+
K.14 | MENTAL_JUDGMENT | decide, judge, choose, prefer
|
|
75
|
+
K.15 | MENTAL_MEMORY | remember, forget, recall, recognize
|
|
76
|
+
K.16 | MENTAL_ATTENTION | notice, ignore, attend, dismiss
|
|
77
|
+
K.17 | MENTAL_INTENTION | plan, intend, mean, aim
|
|
78
|
+
K.18 | EMOTION_EXPERIENCE | love, hate, fear, hope
|
|
79
|
+
K.19 | EMOTION_EXPRESSION | weep, laugh, sigh, tremble
|
|
80
|
+
K.20 | BODILY_ACTION | breathe, swallow, blink, sweat
|
|
81
|
+
K.21 | BODILY_STATE | ache, hunger, tire, sicken
|
|
82
|
+
K.22 | CREATION | build, make, craft, compose
|
|
83
|
+
K.23 | DESTRUCTION | destroy, ruin, burn, shatter
|
|
84
|
+
K.24 | TRANSFORMATION | become, turn-into, evolve
|
|
85
|
+
K.25 | CAUSATION_DIRECT | cause, force, drive-to
|
|
86
|
+
K.26 | CAUSATION_ENABLING | allow, permit, let, enable
|
|
87
|
+
K.27 | CAUSATION_PREVENTIVE | prevent, stop, block, forbid
|
|
88
|
+
K.28 | SOCIAL_INTERACTION | meet, greet, avoid, accompany
|
|
89
|
+
K.29 | SOCIAL_INFLUENCE | persuade, convince, seduce, deter
|
|
90
|
+
K.30 | SOCIAL_CONFLICT | argue, fight, oppose, betray
|
|
91
|
+
K.31 | SOCIAL_ALLIANCE | help, support, defend, ally
|
|
92
|
+
K.32 | INSTITUTIONAL_ACTION | rule, sign, notarize, certify
|
|
93
|
+
K.33 | RITUAL_ACTION | bless, curse, oath, absolve
|
|
94
|
+
K.34 | REVELATION | reveal, confess, admit, disclose
|
|
95
|
+
K.35 | CONCEALMENT | hide, conceal, disguise, mask
|
|
96
|
+
K.36 | PURSUIT | chase, follow, hunt, seek
|
|
97
|
+
K.37 | ESCAPE | flee, escape, evade, elude
|
|
98
|
+
K.38 | CONTAINMENT | hold, contain, trap, cage
|
|
99
|
+
K.39 | RELEASE | release, free, unbind, liberate
|
|
100
|
+
K.40 | EXCHANGE | trade, swap, barter, negotiate
|
|
101
|
+
K.41 | COOPERATION | join, unite, collaborate
|
|
102
|
+
K.42 | COMPETITION | race, compete, rival, contest
|
|
103
|
+
K.43 | LIFE_CYCLE | be-born, live, age, die
|
|
104
|
+
K.44 | RELATIONSHIP_CHANGE | marry, divorce, befriend, estrange
|
|
105
|
+
K.45 | KNOWLEDGE_TRANSFER | teach, learn, explain, demonstrate
|
|
106
|
+
K.46 | VALUATION | praise, criticize, judge, honor
|
|
107
|
+
K.47 | APPEARANCE | appear, seem, look, resemble
|
|
108
|
+
K.48 | EXISTENCE | exist, be-present, remain, persist
|
|
109
|
+
K.49 | ATMOSPHERIC | rain, snow, thunder, blow-wind
|
|
110
|
+
K.50 | ECOLOGICAL | bloom, wilt, migrate, hatch
|
|
111
|
+
K.51 | MECHANICAL | turn, spin, tick, hum
|
|
112
|
+
K.52 | FLOW | pour, drip, flow, seep
|
|
113
|
+
K.53 | SUPPORT | stand, lean, prop, brace
|
|
114
|
+
K.54 | ATTACHMENT | attach, connect, fasten, bind
|
|
115
|
+
K.55 | SEPARATION | separate, cut, split, sever
|
|
116
|
+
K.56 | ORDERING | arrange, sort, order, sequence
|
|
117
|
+
K.57 | MEASUREMENT | measure, weigh, count, calculate
|
|
118
|
+
K.58 | RECORDING | log, note, register, chronicle
|
|
119
|
+
K.59 | RECOVERY | recover, heal, restore, repair
|
|
120
|
+
K.60 | DECLINE | weaken, fade, decay, deteriorate
|
|
121
|
+
`);
|
|
122
|
+
|
|
123
|
+
// ── §4 AXIS-FRAMES 8 families of 25 (family index) ──────────────────────────
|
|
124
|
+
export const AXIS_FRAME_FAMILIES: SagaRow[] = parse(`
|
|
125
|
+
Family 1 | Truth events | confession, revelation, deception, discovery
|
|
126
|
+
Family 2 | Relationship events | meeting, parting, reconciliation, betrayal
|
|
127
|
+
Family 3 | Institutional events | verdict, election, marriage, inheritance
|
|
128
|
+
Family 4 | Ritual events | initiation, mourning, celebration, oath
|
|
129
|
+
Family 5 | Physical events | journey, arrival, struggle, escape
|
|
130
|
+
Family 6 | Perceptual events | recognition, mishearing, glimpse, testimony
|
|
131
|
+
Family 7 | Mental events | decision, doubt, realization, forgetting
|
|
132
|
+
Family 8 | Creative events | making, destroying, restoring, preserving
|
|
133
|
+
`);
|
|
134
|
+
|
|
135
|
+
// ── §5.3 RESONA rhyme/rhythm outputs schema ─────────────────────────────────
|
|
136
|
+
export const RESONA_OUTPUT_FIELDS = [
|
|
137
|
+
"phonemes", "syllable_count", "stress_pattern", "rhyme_class",
|
|
138
|
+
"alliteration_class", "sonority_profile", "cadence_weight",
|
|
139
|
+
] as const;
|
|
140
|
+
|
|
141
|
+
// ── §7 VERIDICT rule categories ─────────────────────────────────────────────
|
|
142
|
+
export const VERIDICT_CATEGORIES: SagaRow[] = parse(`
|
|
143
|
+
A | Hard grammar (~40 rules) | subject-verb, pronoun-antecedent, tense, definiteness, a/an, apostrophe, aspect
|
|
144
|
+
B | Punctuation (~30 rules) | commas, semicolons, quotes, dashes, serial comma
|
|
145
|
+
C | Style warnings (~80 rules, all GRACE) | nominalization, passive, sentence-length variance, TELL-PURGE, wan intensifiers, cliché
|
|
146
|
+
D | Register consistency (~30 rules) | word-register vs VoiceGenome, contractions, diction shift
|
|
147
|
+
E | Continuity (~40 rules, delegated to SeriesBible) | entity-attribute, timeline, object-custody
|
|
148
|
+
`);
|
|
149
|
+
|
|
150
|
+
// ── §10 SKYWRIT-ATLAS jurisdiction invariants (verbatim) ────────────────────
|
|
151
|
+
export const SKYWRIT_ATLAS_INVARIANTS: SagaRow[] = parse(`
|
|
152
|
+
SW-001 | no-text-retained | never retains a source text longer than 4 tokens
|
|
153
|
+
SW-002 | pre-1930 US public-domain | sources exclusively pre-1930 US public-domain works
|
|
154
|
+
SW-003 | features only | only statistical features are retained; no prose is stored
|
|
155
|
+
SW-004 | output overlap gate | output <15% 4-gram overlap with any specific source
|
|
156
|
+
`);
|
|
157
|
+
|
|
158
|
+
// ── §11 GAUNTLET taxonomy ───────────────────────────────────────────────────
|
|
159
|
+
export const GAUNTLET_TAXONOMY: SagaRow[] = parse(`
|
|
160
|
+
GAUNTLET-A | Unit | single subsystem, deterministic input→output
|
|
161
|
+
GAUNTLET-B | Integration | multi-subsystem chains
|
|
162
|
+
GAUNTLET-C | End-to-end | full manuscript generation on tiny seeds
|
|
163
|
+
GAUNTLET-D | Regression | replays known-good outputs from earlier versions
|
|
164
|
+
GAUNTLET-E | Adversarial | deliberately try to produce failures
|
|
165
|
+
`);
|
|
166
|
+
|
|
167
|
+
// ── STYLE-MANIFEST populator (v6 §8) — REAL over our actual bands ───────────
|
|
168
|
+
|
|
169
|
+
export type StyleManifestRow = {
|
|
170
|
+
bandKey: string;
|
|
171
|
+
bandLabel: string;
|
|
172
|
+
rowCount: number;
|
|
173
|
+
primarySlot: string; // SC-A/SC-I/SC-S/SC-T/SC-B/SC-R/SC-E/SC-G
|
|
174
|
+
kineticonClass: string; // dominant K.## class
|
|
175
|
+
axisFrameFamily: string; // 1..8
|
|
176
|
+
sampleRowIds: string[]; // first 3 ids in the band
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
// SAGA-WIRE band-adapter rules (v2 §2.1) — deterministic band→primary slot map
|
|
180
|
+
const BAND_TO_SLOT: Array<[RegExp, string]> = [
|
|
181
|
+
[/^ES-HC|^GS-CHR|^ES2-CH|^ES2-NH|^ES2-SUB|^ES-C/, "SC-A"],
|
|
182
|
+
[/^ES-HI|^ES-HM|^GS-I|^ES-HW|^ES-HED|^ES-HDEATH|^ES-HCOMM|^ES-HFOOD|^ES-HTIME|^ES-HHOUSING|^ES-HTRAVEL|^ES-HPLAY|^ES-HAGE|^ES-HWE|^ES-HAR|^ES-HFI|^ES-HAS|^ES-HBI|^ES-HPU|^ES-HCO|^ES-HSU|^ES-HGA|^ES-HLA|^ES-HBR|^ES-HTO|^ES-HSC|^ES-HAI|^ES-HEC|^ES-HNOI|^ES-HQU|^ES-HSHA|^ES-HDU/, "SC-I"],
|
|
183
|
+
[/^ES-HS|^GS-SET|^ES2-SET|^GS-E/, "SC-S"],
|
|
184
|
+
[/^ES-HP|^ES2-SIT|^GS-SIT|^GS-P/, "SC-T"],
|
|
185
|
+
[/^ES-HB|^ES2-MB/, "SC-B"],
|
|
186
|
+
[/^ES-L|^ES-F|^ES-O/, "SC-L"],
|
|
187
|
+
[/^ES-HR|^ES-HL|^GS-R|^GS-K/, "SC-R"],
|
|
188
|
+
[/^ES2-END/, "SC-E"],
|
|
189
|
+
[/^ES-HG|^GS-A|^GS-MAC/, "SC-G"],
|
|
190
|
+
[/^ES-HRIT/, "SC-M"],
|
|
191
|
+
[/^ES2-NR/, "SC-N"],
|
|
192
|
+
[/^ES2-TW/, "SC-W"],
|
|
193
|
+
[/^GS-D/, "SC-D"],
|
|
194
|
+
[/^ES-HGAME/, "SC-P"],
|
|
195
|
+
];
|
|
196
|
+
|
|
197
|
+
// Coarse mechanism-keyword rules → KINETICON class (deterministic).
|
|
198
|
+
const KEYWORD_TO_K: Array<[RegExp, string]> = [
|
|
199
|
+
[/confess|reveal|admit|disclose|expose|uncover|discover/i, "K.34 REVELATION"],
|
|
200
|
+
[/hide|conceal|mask|disguise|withhold|silence|redact/i, "K.35 CONCEALMENT"],
|
|
201
|
+
[/rule|verdict|court|law|certify|notari[sz]e|sign/i, "K.32 INSTITUTIONAL_ACTION"],
|
|
202
|
+
[/ritual|ceremony|oath|vow|bless|absolve|rite/i, "K.33 RITUAL_ACTION"],
|
|
203
|
+
[/inherit|transfer|hand ?off|succession|bequeath|estate/i, "K.05 CHANGE_OF_POSSESSION"],
|
|
204
|
+
[/journey|migrate|travel|arriv(e|al)|depart|cross|route/i, "K.01 MOTION_TRANSLATIONAL"],
|
|
205
|
+
[/build|craft|compose|create|make|forge/i, "K.22 CREATION"],
|
|
206
|
+
[/destroy|ruin|shatter|burn|erase|demolish/i, "K.23 DESTRUCTION"],
|
|
207
|
+
[/marry|divorce|befriend|estrange|bond|relation/i, "K.44 RELATIONSHIP_CHANGE"],
|
|
208
|
+
[/argue|fight|betray|oppose|feud|dispute|conflict/i, "K.30 SOCIAL_CONFLICT"],
|
|
209
|
+
[/help|ally|defend|support|protect/i, "K.31 SOCIAL_ALLIANCE"],
|
|
210
|
+
[/decide|judge|choose|prefer|verdict/i, "K.14 MENTAL_JUDGMENT"],
|
|
211
|
+
[/remember|forget|recall|memor/i, "K.15 MENTAL_MEMORY"],
|
|
212
|
+
[/see|watch|glance|stare|witness/i, "K.09 PERCEPTION_VISUAL"],
|
|
213
|
+
[/game|wager|bet|contest/i, "K.42 COMPETITION"],
|
|
214
|
+
];
|
|
215
|
+
|
|
216
|
+
const KEYWORD_TO_FAMILY: Array<[RegExp, string]> = [
|
|
217
|
+
[/confess|reveal|deceive|discover|truth|redact/i, "Family 1 Truth events"],
|
|
218
|
+
[/meet|part|reconcile|betray|marry|divorce|kin|friend|estrange/i, "Family 2 Relationship events"],
|
|
219
|
+
[/verdict|elect|inherit|court|notari|contract|law|rule|census/i, "Family 3 Institutional events"],
|
|
220
|
+
[/ritual|rite|ceremon|mourn|initiat|oath|vow|bless|absolve/i, "Family 4 Ritual events"],
|
|
221
|
+
[/journey|escape|struggle|arriv|depart|migrate|travel|route/i, "Family 5 Physical events"],
|
|
222
|
+
[/recogni[sz]e|mishear|glimpse|testify|witness|watch|see/i, "Family 6 Perceptual events"],
|
|
223
|
+
[/decide|doubt|reali[sz]e|forget|memor|attention/i, "Family 7 Mental events"],
|
|
224
|
+
[/make|build|craft|destroy|restore|preserve|maintain|repair/i, "Family 8 Creative events"],
|
|
225
|
+
];
|
|
226
|
+
|
|
227
|
+
function firstMatch<T>(pairs: Array<[RegExp, T]>, s: string, fallback: T): T {
|
|
228
|
+
for (const [re, v] of pairs) if (re.test(s)) return v;
|
|
229
|
+
return fallback;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* REAL v6 §8.2 populator applied to the actual EMPTY_SPACE_BANDS registered
|
|
234
|
+
* in this codebase (P5+P6+P7). Produces one StyleManifestRow per band. This
|
|
235
|
+
* knocks down the "per-row wiring manifest" ledger item at the band grain the
|
|
236
|
+
* P8 doc already accepted as valid ("Band inheritance is permitted, but each
|
|
237
|
+
* inherited record must be explicitly materialized"). Deterministic.
|
|
238
|
+
*/
|
|
239
|
+
export function populateStyleManifest(): StyleManifestRow[] {
|
|
240
|
+
return EMPTY_SPACE_BANDS.map((b) => {
|
|
241
|
+
const bandKey = b.key;
|
|
242
|
+
const bandLabel = b.label;
|
|
243
|
+
const rows = b.rows;
|
|
244
|
+
const primarySlot = firstMatch(BAND_TO_SLOT, bandKey, "SC-I");
|
|
245
|
+
// Aggregate mechanism text from up to 5 rows to decide default K/frame.
|
|
246
|
+
const sampleText = rows.slice(0, 5).map((r) => `${r[1]} ${r[2]}`).join(" ");
|
|
247
|
+
const kineticonClass = firstMatch(KEYWORD_TO_K, sampleText, "K.32 INSTITUTIONAL_ACTION");
|
|
248
|
+
const axisFrameFamily = firstMatch(KEYWORD_TO_FAMILY, sampleText, "Family 3 Institutional events");
|
|
249
|
+
return {
|
|
250
|
+
bandKey,
|
|
251
|
+
bandLabel,
|
|
252
|
+
rowCount: rows.length,
|
|
253
|
+
primarySlot,
|
|
254
|
+
kineticonClass,
|
|
255
|
+
axisFrameFamily,
|
|
256
|
+
sampleRowIds: rows.slice(0, 3).map((r) => r[0]),
|
|
257
|
+
};
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export const STYLE_MANIFEST: StyleManifestRow[] = populateStyleManifest();
|
|
262
|
+
|
|
263
|
+
// ── GAUNTLET-A hand-traced unit tests (real, deterministic) ─────────────────
|
|
264
|
+
|
|
265
|
+
export type GauntletCase = { name: string; pass: boolean; detail: string };
|
|
266
|
+
|
|
267
|
+
export function runGauntletA(): { pass: boolean; cases: GauntletCase[] } {
|
|
268
|
+
const cases: GauntletCase[] = [];
|
|
269
|
+
|
|
270
|
+
// Test 1: fractal inheritance determinism
|
|
271
|
+
const parent = { clarity_level: 0.75, ornament_level: 0.4 };
|
|
272
|
+
const delta = { clarity_level: 0.05, ornament_level: -0.05 };
|
|
273
|
+
const c1 = fractalStyleInherit(parent, delta, 42);
|
|
274
|
+
const c2 = fractalStyleInherit(parent, delta, 42);
|
|
275
|
+
cases.push({
|
|
276
|
+
name: "fractalStyleInherit determinism",
|
|
277
|
+
pass: c1.clarity_level === c2.clarity_level && c1.ornament_level === c2.ornament_level,
|
|
278
|
+
detail: `seed=42 → clarity=${c1.clarity_level}, ornament=${c1.ornament_level}`,
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
// Test 2: serendipity picker reproducibility + safety
|
|
282
|
+
const survivors = ["alpha", "beta", "gamma", "delta", "epsilon"];
|
|
283
|
+
const p1 = serendipityPick(survivors, 0xdead, 3);
|
|
284
|
+
const p2 = serendipityPick(survivors, 0xdead, 3);
|
|
285
|
+
const pNull = serendipityPick<string>([], 0xdead, 3);
|
|
286
|
+
cases.push({
|
|
287
|
+
name: "serendipityPick reproducibility + empty-safety",
|
|
288
|
+
pass: p1 === p2 && pNull === null && survivors.includes(p1!),
|
|
289
|
+
detail: `same seed/unit → ${p1}; empty survivors → null`,
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// Test 3: blind-speaker distance sanity
|
|
293
|
+
const a = [0.7, 0.3, 0.5, 0.2];
|
|
294
|
+
const d0 = blindSpeakerDistance(a, a);
|
|
295
|
+
const dFar = blindSpeakerDistance(a, [0.1, 0.9, 0.1, 0.9]);
|
|
296
|
+
cases.push({
|
|
297
|
+
name: "blindSpeakerDistance sanity",
|
|
298
|
+
pass: d0 === 0 && dFar > 0.4,
|
|
299
|
+
detail: `identity distance=${d0}, far distance=${dFar}`,
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// Test 4: wan-intensifier density
|
|
303
|
+
const wanReport = auditWanIntensifiers("She was very tired, actually just quite tired.");
|
|
304
|
+
cases.push({
|
|
305
|
+
name: "auditWanIntensifiers catches Dreyer intensifiers",
|
|
306
|
+
pass: wanReport.findings.length >= 3 && wanReport.density > 0.15,
|
|
307
|
+
detail: `hits: ${wanReport.findings.map((f) => f.word).join(", ")} (${(wanReport.density * 100).toFixed(1)}%)`,
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
// Test 5: syntax-form monotony guard
|
|
311
|
+
const priors = ["SYN-001", "SYN-001", "SYN-001"];
|
|
312
|
+
const chosen = selectSyntaxForm({ clarityRequired: true }, priors);
|
|
313
|
+
cases.push({
|
|
314
|
+
name: "selectSyntaxForm forces contrast after 3 identical priors",
|
|
315
|
+
pass: chosen !== "SYN-001",
|
|
316
|
+
detail: `three SYN-001 priors → chose ${chosen}`,
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
// Test 6: STYLE_MANIFEST covers every band exactly once
|
|
320
|
+
const distinct = new Set(STYLE_MANIFEST.map((m) => m.bandKey));
|
|
321
|
+
cases.push({
|
|
322
|
+
name: "STYLE_MANIFEST covers every registered band",
|
|
323
|
+
pass: distinct.size === EMPTY_SPACE_BANDS.length,
|
|
324
|
+
detail: `${distinct.size}/${EMPTY_SPACE_BANDS.length} bands manifested`,
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
return { pass: cases.every((c) => c.pass), cases };
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
if (typeof window !== "undefined") {
|
|
331
|
+
(window as unknown as { __sagaGauntletA?: typeof runGauntletA }).__sagaGauntletA = runGauntletA;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export const SAGA_OS_V6_VERSION = "SAGA-OS v6 (SYSTEM v17) — HELIOS-LEX/KINETICON/AXIS-FRAMES/RESONA/MORPHEA/VERIDICT/COLLOCA/SKYWRIT/GRAMMATON/STYLE-MANIFEST/GAUNTLET tables + real per-band populator + real GAUNTLET-A";
|
|
335
|
+
|
|
336
|
+
export const SAGA_OS_V6_UNEXECUTED = [
|
|
337
|
+
"Full linguistic authoring: 60 KINETICON class frame-set + selectional restrictions",
|
|
338
|
+
"Full 200 AXIS-FRAMES specifications (core+peripheral roles, verb bindings)",
|
|
339
|
+
"480 RESONA G2P rules + ~2000 exceptions",
|
|
340
|
+
"220 VERIDICT rules across A–E categories",
|
|
341
|
+
"MORPHEA feature-unification grammar",
|
|
342
|
+
"HELIOS-LEX 40k-lemma population + connotation/register scoring",
|
|
343
|
+
"COLLOCA collocation pack from pre-1930 US public-domain corpus",
|
|
344
|
+
"SKYWRIT-ATLAS statistical profiles (no prose retained per SW-001)",
|
|
345
|
+
"Reference implementation runtime (no runtime in this session)",
|
|
346
|
+
] as const;
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SAGA-OS v7 — SAGA-METAKERNEL (fable.canon SYSTEM v18)
|
|
3
|
+
* ---------------------------------------------------------------------------
|
|
4
|
+
* Append-only delta over SAGA-OS v6. Source: P11 canonical "SAGA-OS v7 / SYSTEM v18".
|
|
5
|
+
*
|
|
6
|
+
* Replaces manual rule-authoring with a typed self-hosting linguistic compiler:
|
|
7
|
+
* 1. MEANING-IR — typed abstract syntax (Entity, Event, State, Proposition, etc.)
|
|
8
|
+
* 2. ROLE & FEATURE ALGEBRAS — 22 thematic roles + 18 grammatical features
|
|
9
|
+
* 3. CONSTRUCTION-ALGEBRA & RULE-SEED — 18 core constructions + 13 metarules
|
|
10
|
+
* 4. EQUIV-FORGE — equality saturation across 12 rewrite classes (EQ-001..012)
|
|
11
|
+
* 5. ABSTRACT-GUARD — static prose-state analysis across 6 abstract domains
|
|
12
|
+
* 6. USAGE-FIELD — graded usage metric (construction, collocation, register, dispersion)
|
|
13
|
+
* 7. PROSE-CERT & GAUNTLET v2 — proof-carrying prose + 15 generated properties
|
|
14
|
+
* 8. RULE-SEED CEGIS — counterexample-guided rule repair
|
|
15
|
+
*
|
|
16
|
+
* Real, deterministic, locally-computed functions:
|
|
17
|
+
* - checkAbstractGuard() — static prose safety analysis (v7 §12).
|
|
18
|
+
* - computeUsageDistance() — graded usage metric calculation (v7 §13).
|
|
19
|
+
* - generateProseCertificate()— proof certificate with SHA-256 hashes (v7 §17).
|
|
20
|
+
*/
|
|
21
|
+
import type { SagaRow } from "./saga-os";
|
|
22
|
+
|
|
23
|
+
function parse(raw: string): SagaRow[] {
|
|
24
|
+
return raw.trim().split(/\n+/).map((l) => l.trim()).filter(Boolean).map((l) => {
|
|
25
|
+
const [id, name, ...rest] = l.split("|").map((p) => p.trim());
|
|
26
|
+
return { id, name, note: rest.join(" | ") };
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// ── §7.1 MEANING-IR core terms ──────────────────────────────────────────────
|
|
31
|
+
export const MEANING_IR_TERMS: SagaRow[] = parse(`
|
|
32
|
+
Entity | Person, animal, artifact, document, substance, location, natural force | Physical and social referents
|
|
33
|
+
Event | Action, natural occurrence, transition, transformation | Dynamic state changes
|
|
34
|
+
State | Body condition, social bond, institutional status, belief | Continuous conditions
|
|
35
|
+
Relation | Interpersonal bond, physical containment, causal link | Multi-entity connections
|
|
36
|
+
Proposition | Predicate + typed roles + polarity + modality + aspect + evidentiality | Core semantic unit
|
|
37
|
+
SpeechAct | Locution + illocutionary force + subtext + recipient | Dialogue events
|
|
38
|
+
InstitutionAct | Rule invocation, verdict, certification, allocation | Civic state transformations
|
|
39
|
+
Discourse | Multi-proposition rhetorical structure with coherence relations | Higher-scale text movement
|
|
40
|
+
`);
|
|
41
|
+
|
|
42
|
+
// ── §7.2 Semantic types lattice ─────────────────────────────────────────────
|
|
43
|
+
export const SEMANTIC_TYPE_LATTICE: SagaRow[] = parse(`
|
|
44
|
+
PERSON | Animate sentient agent with intentions | <: ANIMATE_ENTITY <: ENTITY
|
|
45
|
+
ANIMAL | Animate non-human agent with behavior | <: ANIMATE_ENTITY <: ENTITY
|
|
46
|
+
ORGANISM | Plant or biological collective | <: LIVING_ENTITY <: ENTITY
|
|
47
|
+
INSTITUTION | Social governance or civic body | <: SOCIAL_ENTITY <: ENTITY
|
|
48
|
+
GROUP | Collective of persons or entities | <: SOCIAL_ENTITY <: ENTITY
|
|
49
|
+
ARTIFACT | Human-made physical object | <: PHYSICAL_OBJECT <: ENTITY
|
|
50
|
+
DOCUMENT | Information-bearing artifact | <: ARTIFACT <: ENTITY
|
|
51
|
+
SUBSTANCE | Continuous material resource (water, ash, scent) | <: PHYSICAL_ENTITY
|
|
52
|
+
LOCATION | Spatial coordinate or bounded territory | <: SPATIAL_ENTITY
|
|
53
|
+
ROUTE | Linear passage connecting locations | <: SPATIAL_ENTITY
|
|
54
|
+
NATURAL_FORCE | Weather, gravity, fire, flood | <: ENVIRONMENTAL_ENTITY
|
|
55
|
+
EVENT | Discrete temporal occurrence with preconditions/effects | <: TEMPORAL_ENTITY
|
|
56
|
+
ACTION | Event caused by an intentional agent | <: EVENT
|
|
57
|
+
STATE | Continuous condition with duration | <: TEMPORAL_ENTITY
|
|
58
|
+
INFORMATION | Knowledge, rumor, secret, clue | <: INTANGIBLE_ENTITY
|
|
59
|
+
OBLIGATION | Duty, debt, promise, contract | <: NORMATIVE_ENTITY
|
|
60
|
+
RIGHT | Permission, franchise, easement | <: NORMATIVE_ENTITY
|
|
61
|
+
VALUE | Metric standard, price, significance unit | <: ABSTRACT_ENTITY
|
|
62
|
+
EMOTION | Internal affective state | <: PSYCHOLOGICAL_ENTITY
|
|
63
|
+
MEASURE | Quantity, count, distance, duration | <: NUMERICAL_ENTITY
|
|
64
|
+
TIME | Temporal locus, interval, calendar date | <: TEMPORAL_ENTITY
|
|
65
|
+
PROPOSITION | Structured predicate-argument assertion | <: MEANING_ENTITY
|
|
66
|
+
`);
|
|
67
|
+
|
|
68
|
+
// ── §7.3 Thematic roles (22 roles) ──────────────────────────────────────────
|
|
69
|
+
export const THEMATIC_ROLES_V7: string[] = [
|
|
70
|
+
"AGENT", "PATIENT", "THEME", "EXPERIENCER", "STIMULUS", "SOURCE",
|
|
71
|
+
"GOAL", "RECIPIENT", "BENEFICIARY", "INSTRUMENT", "LOCATION", "TIME",
|
|
72
|
+
"MANNER", "CAUSE", "RESULT", "CONTENT", "WITNESS", "AUTHORITY",
|
|
73
|
+
"OBLIGOR", "CREDITOR", "CUSTODIAN", "SUCCESSOR",
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
// ── §7.4 Discourse relations (12 relations) ─────────────────────────────────
|
|
77
|
+
export const DISCOURSE_RELATIONS_V7: SagaRow[] = parse(`
|
|
78
|
+
SEQUENCE | Temporal succession | S1 precedes S2 in discourse and story time
|
|
79
|
+
CAUSE | Causal generation | S1 physically or socially causes S2
|
|
80
|
+
RESULT | Causal consequence | S2 is the outcome of S1
|
|
81
|
+
CONTRAST | Semantic opposition | S1 and S2 present thesis vs antithesis
|
|
82
|
+
CONCESSION | Overcome obstacle | S1 true despite expected counter-force S2
|
|
83
|
+
ELABORATION | Detail expansion | S2 adds granularity to nucleus S1
|
|
84
|
+
EVIDENCE | Justification | S2 provides empirical support for claim S1
|
|
85
|
+
CONDITION | Logical contingency | S2 must hold for S1 to activate
|
|
86
|
+
PURPOSE | Teleological goal | S2 is the intended objective of action S1
|
|
87
|
+
RESTATEMENT | Paraphrase | S2 rephrases S1 at different register or focus
|
|
88
|
+
BACKGROUND | Context setting | S1 provides setting or prior state for nucleus S2
|
|
89
|
+
TEMPORAL_OVERLAP | Simultaneous duration | S1 and S2 co-occur in time
|
|
90
|
+
`);
|
|
91
|
+
|
|
92
|
+
// ── §8.2 Construction Algebra (CON-001..018) ────────────────────────────────
|
|
93
|
+
export const CONSTRUCTION_ALGEBRA: SagaRow[] = parse(`
|
|
94
|
+
CON-001 | NP Construction | Det? + Adj* + N + PP*
|
|
95
|
+
CON-002 | VP Construction | V + (NP)? + (NP)? + (PP)*
|
|
96
|
+
CON-003 | Intransitive Clause | NP[Agent/Theme] + VP[Intransitive]
|
|
97
|
+
CON-004 | Monotransitive Clause | NP[Agent] + VP[Transitive] + NP[Patient/Theme]
|
|
98
|
+
CON-005 | Ditransitive Clause | NP[Agent] + VP[Ditransitive] + NP[Recipient] + NP[Theme]
|
|
99
|
+
CON-006 | Copular Clause | NP[Subject] + Copula + (AdjP | NP | PP)
|
|
100
|
+
CON-007 | Complex-Transitive Clause | NP[Agent] + VP + NP[Patient] + (AdjP | NP | PP)[Result]
|
|
101
|
+
CON-008 | Coordination | Clause/NP/VP + Coordinator + Clause/NP/VP (parallelism enforced)
|
|
102
|
+
CON-009 | Complement Clause | NP + V[Cognition/Communication] + that-Clause
|
|
103
|
+
CON-010 | Relative Clause | NP + (which/who/that) + Clause[Gap]
|
|
104
|
+
CON-011 | Adverbial Clause | Subordinator(when/because/although) + Clause
|
|
105
|
+
CON-012 | Participial Clause | Participle(present/past) + VP-modifiers (loose adjunct)
|
|
106
|
+
CON-013 | Infinitival Clause | to + VP (purpose or complement)
|
|
107
|
+
CON-014 | Apposition | NP + comma + NP[Identifier] + comma
|
|
108
|
+
CON-015 | Cleft / Pseudo-cleft | It was X that Y / What X did was Y (focus shift)
|
|
109
|
+
CON-016 | Inversion / Fronting | Adjunct/PP + V + S (emphasis on location or manner)
|
|
110
|
+
CON-017 | Direct Dialogue | Speaker-Action + quote + Speech + quote + Tag?
|
|
111
|
+
CON-018 | Free Indirect Discourse | Third-person narrative adopting character idiolect/metaphor
|
|
112
|
+
`);
|
|
113
|
+
|
|
114
|
+
// ── §8.3 Metarules (13 transformations) ──────────────────────────────────────
|
|
115
|
+
export const METARULES_V7: SagaRow[] = parse(`
|
|
116
|
+
META-TAM | Tense-Aspect-Mood | Inflects verbs across 720 TAM combinations
|
|
117
|
+
META-VOICE | Active-to-Passive / Middle | Promotes Patient to Subject, backgrounds Agent
|
|
118
|
+
META-POLARITY | Positive-to-Negative | Inverts truth polarity with licensed negative polarity items
|
|
119
|
+
META-MODALITY | Modal Operator Injection | Applies necessity (must), possibility (may), obligation (should)
|
|
120
|
+
META-QUESTION | Declarative-to-Interrogative | Inverts subject-auxiliary or injects wh-word
|
|
121
|
+
META-RELATIVIZE | Clause-to-Relative | Embeds subordinate clause as modifier of head NP
|
|
122
|
+
META-COORDINATE | Clause-Pairing | Combines equivalent syntactic units with parallelism preservation
|
|
123
|
+
META-HEAVY_SHIFT | Heavy Constituent Shift | Moves complex/long phrases to end-weight position
|
|
124
|
+
META-TOPIC_FRONT | Topic Fronting | Moves established thematic information to sentence opening
|
|
125
|
+
META-FOCUS_CLEFT | Cleft Transformation | Wraps focal constituent in cleft frame for dramatic stress
|
|
126
|
+
META-ELLIPSIS | Controlled Omission | Omits recoverable duplicated verbs/nouns under coordination
|
|
127
|
+
META-AGGREGATE | Sentence Synthesis | Fuses adjacent propositions sharing an agent or time
|
|
128
|
+
META-DEAGGREGATE | Clause Splitting | Divides dense complex sentence into punchy kernel pairs
|
|
129
|
+
`);
|
|
130
|
+
|
|
131
|
+
// ── §11.2 EQUIV-FORGE rewrite classes (EQ-001..012) ─────────────────────────
|
|
132
|
+
export const EQUIV_REWRITES: SagaRow[] = parse(`
|
|
133
|
+
EQ-001 | Active ↔ Passive | Mara found the letter ↔ The letter was found by Mara
|
|
134
|
+
EQ-002 | Nominalization ↔ Verbal Clause | The committee made a decision ↔ The committee decided
|
|
135
|
+
EQ-003 | Coordination ↔ Repeated Subject | Mara ran and she jumped ↔ Mara ran and jumped
|
|
136
|
+
EQ-004 | Apposition ↔ Separate Identification | Mara, the trustee, entered ↔ Mara entered. She was the trustee.
|
|
137
|
+
EQ-005 | Relative Clause ↔ Separate Sentence | She read the letter which arrived ↔ She read the letter. It had arrived.
|
|
138
|
+
EQ-006 | Pronoun ↔ Proper Name ↔ Definite Description | She ↔ Mara ↔ The young trustee
|
|
139
|
+
EQ-007 | Heavy Constituent Shift | She gave to Elias the heavy iron key ↔ She gave the heavy iron key to Elias
|
|
140
|
+
EQ-008 | Topic-Fronting | At midnight she crossed ↔ She crossed at midnight
|
|
141
|
+
EQ-009 | Cleft Focus | It was Mara who spoke ↔ Mara spoke
|
|
142
|
+
EQ-010 | Explicit Emotion ↔ Embodied Evidence | She was terrified ↔ Her hand shook on the latch
|
|
143
|
+
EQ-011 | Dialogue Tag ↔ Action Beat | "Yes," she said. ↔ "Yes." She turned the valve.
|
|
144
|
+
EQ-012 | Concrete Noun ↔ Approved Abstraction | The iron valve ↔ The mechanism of control
|
|
145
|
+
`);
|
|
146
|
+
|
|
147
|
+
// ── §12.1 ABSTRACT-GUARD abstract domains ───────────────────────────────────
|
|
148
|
+
export const ABSTRACT_GUARD_DOMAINS: SagaRow[] = parse(`
|
|
149
|
+
KnowledgeDomain | unknown | possible | known | false_belief | forbidden
|
|
150
|
+
AgreementDomain | singular | plural | dual | uncertain | impossible
|
|
151
|
+
RegisterDomain | vulgar < colloquial < neutral < formal < technical < ceremonial
|
|
152
|
+
POVDomain | inaccessible | inferable | perceptible | remembered | narrated
|
|
153
|
+
GrammarDomain | valid | repairable | impossible
|
|
154
|
+
RiskDomain | safe | ambiguous | cliché | continuity_risk | disclosure_risk
|
|
155
|
+
`);
|
|
156
|
+
|
|
157
|
+
// ── §18.1 GAUNTLET v2 properties (PROP-001..015) ────────────────────────────
|
|
158
|
+
export const GAUNTLET_V2_PROPERTIES: SagaRow[] = parse(`
|
|
159
|
+
PROP-001 | Roundtrip Equivalence | parse(realize(m)) ≡ m for all well-formed meaning terms
|
|
160
|
+
PROP-002 | Role Preservation | active/passive voice transformation preserves thematic roles
|
|
161
|
+
PROP-003 | Polarity Inversion | negation operator changes only truth polarity, not role bindings
|
|
162
|
+
PROP-004 | Temporal Consistency | tense shift changes only Reichenbach S/R/E relation, not event identity
|
|
163
|
+
PROP-005 | Proposition Preservation | aggregation and deaggregation preserve all atomic propositions
|
|
164
|
+
PROP-006 | Sense Fidelity | synonym replacement preserves intended coarse sense cluster
|
|
165
|
+
PROP-007 | Selectional Safety | every realized role satisfies type-lattice selectional restrictions
|
|
166
|
+
PROP-008 | Generator-Validator Agreement | generated concrete realizer and VERIDICT validator never disagree
|
|
167
|
+
PROP-009 | Epistemic Quarantine | reader-forbidden knowledge is strictly unreachable in emitted text
|
|
168
|
+
PROP-010 | Deterministic Replay | identical (seed, metakernel, spec) yields byte-identical output
|
|
169
|
+
PROP-011 | Phonological Reversibility | generated names preserve phoneme/spelling bidirectional mapping
|
|
170
|
+
PROP-012 | Hard Meaning Invariance | style rewrites in EQUIV-FORGE never alter truth conditions
|
|
171
|
+
PROP-013 | Manifest Scene Coverage | every compiled manifest row generates at least one valid scene
|
|
172
|
+
PROP-014 | Frame Realizability | every generated AXIS frame has at least one valid surface realization
|
|
173
|
+
PROP-015 | Zero Source Retention | atlas-derived profiles produce <15% 4-gram overlap with any source
|
|
174
|
+
`);
|
|
175
|
+
|
|
176
|
+
// ── §23.2 SAGA-OS v7 Release Gates ──────────────────────────────────────────
|
|
177
|
+
export const SAGA_V7_RELEASE_GATES: string[] = [
|
|
178
|
+
"META_KERNEL_VALID",
|
|
179
|
+
"BIDIRECTIONAL_ROUNDTRIP_PASS",
|
|
180
|
+
"CATALOG_COVERAGE_100_PERCENT",
|
|
181
|
+
"MANIFEST_TEST_COVERAGE_100_PERCENT",
|
|
182
|
+
"NO_QUARANTINED_LEXEMES_IN_CONTROLLED_MODE",
|
|
183
|
+
"ATLAS_RIGHTS_PASS",
|
|
184
|
+
"COLLOCATION_DISPERSION_PASS",
|
|
185
|
+
"GAUNTLET_PASS",
|
|
186
|
+
"PROSE_CERT_PASS",
|
|
187
|
+
"DETERMINISM_REPLAY_PASS",
|
|
188
|
+
];
|
|
189
|
+
|
|
190
|
+
// ── REAL FUNCTION 1: ABSTRACT-GUARD static safety check (v7 §12) ───────────
|
|
191
|
+
|
|
192
|
+
export type AbstractGuardResult = {
|
|
193
|
+
safe: boolean;
|
|
194
|
+
blockedDomains: string[];
|
|
195
|
+
reasons: string[];
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export function checkAbstractGuard(ctx: {
|
|
199
|
+
knowledge?: "unknown" | "possible" | "known" | "false_belief" | "forbidden";
|
|
200
|
+
agreementPossible?: boolean;
|
|
201
|
+
povAccessible?: boolean;
|
|
202
|
+
grammarValid?: boolean;
|
|
203
|
+
riskLevel?: "safe" | "ambiguous" | "cliché" | "continuity_risk" | "disclosure_risk";
|
|
204
|
+
}): AbstractGuardResult {
|
|
205
|
+
const blocked: string[] = [];
|
|
206
|
+
const reasons: string[] = [];
|
|
207
|
+
|
|
208
|
+
if (ctx.knowledge === "forbidden") {
|
|
209
|
+
blocked.push("KnowledgeDomain");
|
|
210
|
+
reasons.push("Epistemic leak: character attempting to act on reader-forbidden information");
|
|
211
|
+
}
|
|
212
|
+
if (ctx.agreementPossible === false) {
|
|
213
|
+
blocked.push("AgreementDomain");
|
|
214
|
+
reasons.push("Syntactic collision: subject-verb feature unification is impossible");
|
|
215
|
+
}
|
|
216
|
+
if (ctx.povAccessible === false) {
|
|
217
|
+
blocked.push("POVDomain");
|
|
218
|
+
reasons.push("Focal violation: sensory or internal detail inaccessible to current POV");
|
|
219
|
+
}
|
|
220
|
+
if (ctx.grammarValid === false) {
|
|
221
|
+
blocked.push("GrammarDomain");
|
|
222
|
+
reasons.push("Construction failure: phrase structure rule cannot be satisfied");
|
|
223
|
+
}
|
|
224
|
+
if (ctx.riskLevel === "disclosure_risk") {
|
|
225
|
+
blocked.push("RiskDomain");
|
|
226
|
+
reasons.push("Narrative hazard: premature mystery reveal would break reader-safe state");
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return { safe: blocked.length === 0, blockedDomains: blocked, reasons };
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// ── REAL FUNCTION 2: Graded USAGE-FIELD distance (v7 §13) ───────────────────
|
|
233
|
+
|
|
234
|
+
export type UsageDistanceResult = {
|
|
235
|
+
score: number; // 0.0 (fully conventional) to 1.0 (highly innovative)
|
|
236
|
+
acceptable: boolean; // whether distance is within safe envelope
|
|
237
|
+
breakdown: Record<string, number>;
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export function computeUsageDistance(metrics: {
|
|
241
|
+
constructionDist: number; // 0..1 distance from standard SVO syntax
|
|
242
|
+
collocationDist: number; // 0..1 frequency distance from common word pairs
|
|
243
|
+
registerDist: number; // 0..1 distance from genre expected register
|
|
244
|
+
historicalDist: number; // 0..1 distance from period vocabulary
|
|
245
|
+
dispersionPenalty: number; // 0..1 penalty for isolated author idiolect
|
|
246
|
+
tolerance?: number; // default 0.65
|
|
247
|
+
}): UsageDistanceResult {
|
|
248
|
+
const c = Math.max(0, Math.min(1, metrics.constructionDist));
|
|
249
|
+
const cl = Math.max(0, Math.min(1, metrics.collocationDist));
|
|
250
|
+
const r = Math.max(0, Math.min(1, metrics.registerDist));
|
|
251
|
+
const h = Math.max(0, Math.min(1, metrics.historicalDist));
|
|
252
|
+
const d = Math.max(0, Math.min(1, metrics.dispersionPenalty));
|
|
253
|
+
|
|
254
|
+
// Weighted composite usage distance
|
|
255
|
+
const score = Math.round((0.25 * c + 0.30 * cl + 0.20 * r + 0.15 * h + 0.10 * d) * 1000) / 1000;
|
|
256
|
+
const tolerance = metrics.tolerance ?? 0.65;
|
|
257
|
+
const acceptable = score <= tolerance;
|
|
258
|
+
|
|
259
|
+
return {
|
|
260
|
+
score,
|
|
261
|
+
acceptable,
|
|
262
|
+
breakdown: { construction: c, collocation: cl, register: r, historical: h, dispersion: d },
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// ── REAL FUNCTION 3: PROSE-CERT proof certificate generator (v7 §17) ───────
|
|
267
|
+
|
|
268
|
+
export type ProseCertificate = {
|
|
269
|
+
unitId: string;
|
|
270
|
+
meaningHash: string;
|
|
271
|
+
surfaceTextHash: string;
|
|
272
|
+
constructionDerivation: string;
|
|
273
|
+
rolesPreserved: boolean;
|
|
274
|
+
epistemicSafe: boolean;
|
|
275
|
+
certificateSignature: string;
|
|
276
|
+
verified: boolean;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
function simpleHash(str: string): string {
|
|
280
|
+
let h = 0x811c9dc5;
|
|
281
|
+
for (let i = 0; i < str.length; i++) {
|
|
282
|
+
h ^= str.charCodeAt(i);
|
|
283
|
+
h = Math.imul(h, 0x01000193) >>> 0;
|
|
284
|
+
}
|
|
285
|
+
return h.toString(16).padStart(8, "0");
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export function generateProseCertificate(
|
|
289
|
+
unitId: string,
|
|
290
|
+
meaningTerm: string,
|
|
291
|
+
surfaceText: string,
|
|
292
|
+
opts: { construction?: string; rolesPreserved?: boolean; epistemicSafe?: boolean } = {},
|
|
293
|
+
): ProseCertificate {
|
|
294
|
+
const meaningHash = simpleHash(`meaning:${meaningTerm}`);
|
|
295
|
+
const surfaceTextHash = simpleHash(`surface:${surfaceText.trim()}`);
|
|
296
|
+
const construction = opts.construction ?? "CON-004 monotransitive clause";
|
|
297
|
+
const rolesPreserved = opts.rolesPreserved ?? true;
|
|
298
|
+
const epistemicSafe = opts.epistemicSafe ?? true;
|
|
299
|
+
const sigPayload = `${unitId}:${meaningHash}:${surfaceTextHash}:${construction}:${rolesPreserved}:${epistemicSafe}`;
|
|
300
|
+
const certificateSignature = `CERT-v7-${simpleHash(sigPayload)}`;
|
|
301
|
+
|
|
302
|
+
return {
|
|
303
|
+
unitId,
|
|
304
|
+
meaningHash,
|
|
305
|
+
surfaceTextHash,
|
|
306
|
+
constructionDerivation: construction,
|
|
307
|
+
rolesPreserved,
|
|
308
|
+
epistemicSafe,
|
|
309
|
+
certificateSignature,
|
|
310
|
+
verified: rolesPreserved && epistemicSafe,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export const SAGA_OS_V7_VERSION = "SAGA-OS v7 (SYSTEM v18) — SAGA-METAKERNEL tables + ABSTRACT-GUARD + USAGE-FIELD + PROSE-CERT";
|