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,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SAGA-OS v2/v3 — append-only delta over saga-os.ts (SAGA-OS v1).
|
|
3
|
+
* ---------------------------------------------------------------------------
|
|
4
|
+
* Source: P9 canonical documents "SAGA-OS v2 (fable.canon.system.v13)" and
|
|
5
|
+
* "SAGA-OS v3 (SYSTEM v14)". Nothing in v1 is removed, weakened, or renamed.
|
|
6
|
+
*
|
|
7
|
+
* Integration policy (per task): Pareto-superior, additive, NO new UI/UX.
|
|
8
|
+
* This module exposes:
|
|
9
|
+
* 1. Canonical tables transcribed from the P9 documents (slot-class registry,
|
|
10
|
+
* GENESIS-GRID pattern→ending taxonomy, GENRE HELM taxonomy, KALLOS v3
|
|
11
|
+
* dimensions + genre base-weight profiles, ONOMASTRATA name classes,
|
|
12
|
+
* SAGA-SCREEN audits, production acceptance-test index).
|
|
13
|
+
* 2. Two REAL, locally-computed functions (no LLM, deterministic):
|
|
14
|
+
* - computeKallosLite(): the computable subset of the KALLOS pillars
|
|
15
|
+
* (golden-section placement, chapter-length flow proxy, Birkhoff
|
|
16
|
+
* M = O/C from prose metrics) as a weighted geometric mean, with
|
|
17
|
+
* the P9 v3 caps honored (math regularizers never dominate).
|
|
18
|
+
* - auditCastNameConfusion(): the ONOMASTRATA cast-confusion audit
|
|
19
|
+
* (first-letter clustering + normalized edit distance ≥ 0.35).
|
|
20
|
+
*
|
|
21
|
+
* HONESTY (imported verbatim as invariants from the P9 docs themselves):
|
|
22
|
+
* - KALLOS is a deterministic, falsifiable PROXY, never a proven measure of
|
|
23
|
+
* human beauty. Scores carry a correlation-not-causation caveat.
|
|
24
|
+
* - φ/Fibonacci/1-f/Birkhoff/Zipf are prior mathematics; their transfer to
|
|
25
|
+
* narrative is a design hypothesis. Here they are capped diagnostics.
|
|
26
|
+
* - The full morphogenesis lattice / prose-compiler / screenplay exporter are
|
|
27
|
+
* architecture designs in the source docs ("NOT EXECUTED — no runtime");
|
|
28
|
+
* they are integrated as data + honest gap notes, not fake executables.
|
|
29
|
+
*/
|
|
30
|
+
import type { SagaRow } from "./saga-os";
|
|
31
|
+
import type { ProseMetrics } from "./judge";
|
|
32
|
+
|
|
33
|
+
function parse(raw: string): SagaRow[] {
|
|
34
|
+
return raw.trim().split(/\n+/).map((l) => l.trim()).filter(Boolean).map((l) => {
|
|
35
|
+
const [id, name, ...rest] = l.split("|").map((p) => p.trim());
|
|
36
|
+
return { id, name, note: rest.join(" | ") };
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// ── §2 SAGA-WIRE slot-class registry (v2) ───────────────────────────────────
|
|
41
|
+
export const SAGA_SLOT_CLASSES: SagaRow[] = parse(`
|
|
42
|
+
SC-A | AGENT | characters, nonhuman agents ← ES-C*, ES2-CH/NH, ES-HC*, GS-CHR*
|
|
43
|
+
SC-I | INSTITUTION | pressure systems ← ES-HI*, ES-HM*, GS-I*, all ES-H* civic bands
|
|
44
|
+
SC-S | SETTING | place machines ← ES-HS*, GS-SET*, ES2-SET*, GS-E*
|
|
45
|
+
SC-T | SITUATION | decision engines ← ES-HP*, ES2-SIT*, GS-SIT*, GS-P*
|
|
46
|
+
SC-B | BEAT | scene/micro units ← ES-HB*, ES2-MB*
|
|
47
|
+
SC-L | LAW | empty-space physics; ≤1 foreground; HARNESS mandatory ← ES-L*, ES-F*, ES-O*
|
|
48
|
+
SC-R | RELATION | bond forms ← ES-HR*, ES-HL*, GS-R*, GS-K*
|
|
49
|
+
SC-E | ENDING | closure families ← ES2-END*
|
|
50
|
+
SC-G | GENRE-ENGINE | macro drives ← ES-HG*, GS-A*, GS-MAC*
|
|
51
|
+
SC-M | MOTIF/THEME | recurrence payloads ← ES-HRIT*, motif classes
|
|
52
|
+
SC-N | NARRATOR/POV | narration forms ← ES2-NR*
|
|
53
|
+
SC-W | TWIST/REVEAL | reveal devices ← ES2-TW*
|
|
54
|
+
SC-D | DOCUMENT/RECORD | diegetic memory objects ← GS-D*
|
|
55
|
+
SC-P | PLAYABLE | interactive ← ES-HGAME*
|
|
56
|
+
`);
|
|
57
|
+
|
|
58
|
+
// ── §4.4 GENESIS-GRID pattern taxonomy → ending families ────────────────────
|
|
59
|
+
export const GENESIS_PATTERNS: SagaRow[] = parse(`
|
|
60
|
+
STILL-LIFE | stable constellation | Maintenance / Stable-Incomplete endings
|
|
61
|
+
OSCILLATOR | period-k repetition | Episodic/serial closure; period = container; FVI = mutation rate
|
|
62
|
+
GLIDER | pattern translating away | Handoff / Custodial / Successor endings
|
|
63
|
+
GLIDER-GUN | emits gliders forever | Open serial: each glider = a spun-off volume
|
|
64
|
+
EXTINCTION | all cells die | Tragedy / Decommission / Counterfactual-closure endings
|
|
65
|
+
METHUSELAH | long chaos → late order | Literary braid with late convergence
|
|
66
|
+
RING | mirrored closure | Ring-composition closure (v3 addition)
|
|
67
|
+
SPLIT | incompatible valid endings | Split-custody ending (v3 addition)
|
|
68
|
+
GARDEN-OF-EDEN | state with no predecessor | FLAG: un-set-up climax = fair-play violation (AUDIT-034)
|
|
69
|
+
`);
|
|
70
|
+
|
|
71
|
+
// ── §3 GENRE HELM taxonomy (2-level) ────────────────────────────────────────
|
|
72
|
+
export const GENRE_HELM: Record<string, string[]> = {
|
|
73
|
+
ROMANCE: ["contemporary", "historical", "gothic-romance", "romantic-suspense", "slow-burn", "second-chance"],
|
|
74
|
+
THRILLER: ["psychological", "legal", "techno", "domestic", "conspiracy", "eco-thriller"],
|
|
75
|
+
MYSTERY: ["cozy", "hardboiled", "procedural", "locked-room", "inverted", "anti-recognition"],
|
|
76
|
+
HORROR: ["gothic", "cosmic", "folk", "body", "quiet/liminal", "institutional-dread"],
|
|
77
|
+
FANTASY: ["epic", "portal", "urban", "low/grounded", "fable-institutional"],
|
|
78
|
+
SF: ["hard", "social", "infra", "first-contact", "time-structure"],
|
|
79
|
+
LITERARY: ["domestic", "maintenance", "braided", "autofictional-form", "anti-spectacle"],
|
|
80
|
+
HISTORICAL: ["epic", "intimate", "counterfactual"],
|
|
81
|
+
"FAMILY/SAGA": ["generational", "inheritance", "custodial"],
|
|
82
|
+
"CHILDREN/YA": ["adventure", "school-container", "formula-serial", "coming-of-age"],
|
|
83
|
+
COMEDY: ["satire", "farce-of-institutions", "gentle"],
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// ── §9 KALLOS v3 dimensions + base weights (v2026.08, rows sum to 100) ─────
|
|
87
|
+
export const KALLOS_DIMENSIONS = [
|
|
88
|
+
"COH", "INT", "TRN", "EMO", "REL", "PAC", "NOV", "THM", "WRL", "PRO", "PAY", "GCT",
|
|
89
|
+
] as const;
|
|
90
|
+
|
|
91
|
+
export const KALLOS_BASE_WEIGHTS: Record<string, number[]> = {
|
|
92
|
+
general_fiction: [10, 8, 9, 13, 12, 6, 7, 13, 5, 10, 4, 3],
|
|
93
|
+
historical: [10, 8, 9, 10, 8, 7, 5, 10, 15, 8, 5, 5],
|
|
94
|
+
mystery_thriller: [14, 9, 6, 6, 6, 16, 10, 5, 4, 6, 10, 8],
|
|
95
|
+
romance: [7, 9, 7, 17, 16, 8, 5, 7, 4, 7, 8, 5],
|
|
96
|
+
romantasy: [8, 8, 8, 13, 12, 10, 7, 6, 11, 5, 6, 6],
|
|
97
|
+
fantasy: [9, 8, 10, 9, 8, 8, 9, 7, 16, 6, 5, 5],
|
|
98
|
+
science_fiction: [12, 8, 8, 7, 6, 8, 14, 11, 12, 5, 4, 5],
|
|
99
|
+
horror: [8, 7, 10, 10, 8, 14, 9, 8, 9, 6, 5, 6],
|
|
100
|
+
ya_saga: [9, 8, 10, 12, 11, 10, 9, 8, 9, 6, 4, 4],
|
|
101
|
+
institutional_maintenance: [15, 10, 6, 8, 8, 6, 7, 12, 8, 5, 8, 7],
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// ── §10 ONOMASTRATA name classes ────────────────────────────────────────────
|
|
105
|
+
export const ONOMASTRATA_NAME_CLASSES = [
|
|
106
|
+
"PERSON", "DYNASTY", "HOUSEHOLD", "PLACE", "REGION", "INSTITUTION", "OFFICE",
|
|
107
|
+
"ARTIFACT", "WEAPON", "VEHICLE", "SPECIES", "EVENT", "RITUAL", "LAW",
|
|
108
|
+
"DOCUMENT", "WORK_TITLE", "VOLUME_TITLE", "CHAPTER_TITLE",
|
|
109
|
+
] as const;
|
|
110
|
+
|
|
111
|
+
// ── §13.6 SAGA-SCREEN audits ────────────────────────────────────────────────
|
|
112
|
+
export const SAGA_SCREEN_AUDITS: SagaRow[] = parse(`
|
|
113
|
+
SCR-001 | slugline validity | every scene has valid slugline
|
|
114
|
+
SCR-002 | character cue | every dialogue has character cue
|
|
115
|
+
SCR-003 | causal preservation | all source causal deltas preserved or approved
|
|
116
|
+
SCR-004 | interiority conversion | no unconverted interiority
|
|
117
|
+
SCR-005 | location/time continuity | location/time continuity valid
|
|
118
|
+
SCR-006 | continuity ids | character, wardrobe, prop continuity valid
|
|
119
|
+
SCR-007 | prompt separation | no production prompts leak into spec script
|
|
120
|
+
SCR-008 | merge integrity | merged characters preserve all required causal functions
|
|
121
|
+
SCR-009 | planned compression | adaptation target length achieved through planned compression
|
|
122
|
+
SCR-010 | fountain syntax | Fountain syntax passes
|
|
123
|
+
`);
|
|
124
|
+
|
|
125
|
+
// ── §17 production acceptance-test index ────────────────────────────────────
|
|
126
|
+
export const SAGA_PRODUCTION_TESTS: SagaRow[] = parse(`
|
|
127
|
+
TEST-001 | determinism | same seed/spec/version produces byte-identical output
|
|
128
|
+
TEST-002 | seed distinctness | different seeds produce causally distinct plans
|
|
129
|
+
TEST-003 | catalog coverage | catalog coverage exactly 100%
|
|
130
|
+
TEST-004 | fail closed | unknown row fails closed
|
|
131
|
+
TEST-005 | id uniqueness | no duplicate IDs
|
|
132
|
+
TEST-006 | no template tokens | no unresolved template tokens
|
|
133
|
+
TEST-007 | no truncation | no incomplete sentence at EOF
|
|
134
|
+
TEST-008 | full realization | all planned scenes realized
|
|
135
|
+
TEST-009 | motive+preconditions | every major action has motive and preconditions
|
|
136
|
+
TEST-010 | knowledge boundary | character knowledge cannot leak
|
|
137
|
+
TEST-011 | custody validity | object custody remains valid
|
|
138
|
+
TEST-012 | geography validity | travel time and geography remain valid
|
|
139
|
+
TEST-013 | exception pricing | world-rule exceptions are priced and logged
|
|
140
|
+
TEST-014 | promise closure | all mandatory promises close or transfer
|
|
141
|
+
TEST-015 | grammar gate | grammar checker returns no blocking findings
|
|
142
|
+
TEST-016 | name confusables | name confusables rejected
|
|
143
|
+
TEST-017 | fountain validity | screenplay Fountain syntax valid
|
|
144
|
+
TEST-018 | interiority preserved | no interiority silently lost in adaptation
|
|
145
|
+
TEST-019 | kallos determinism | KALLOS update deterministic
|
|
146
|
+
TEST-020 | drift caps | audience-weight drift stays within caps
|
|
147
|
+
TEST-021 | crash recovery | crash recovery resumes at exact checkpoint
|
|
148
|
+
TEST-022 | memory ceiling | 13-volume build stays within configured memory ceiling
|
|
149
|
+
TEST-023 | refrain cap | no paragraph hash repeated beyond allowed refrain
|
|
150
|
+
TEST-024 | volume contract | every volume has local closure and series delta
|
|
151
|
+
TEST-025 | human review | human review sample passes declared readability threshold
|
|
152
|
+
`);
|
|
153
|
+
|
|
154
|
+
// ── REAL FUNCTION 1: KALLOS-lite (computable pillars only, honest) ──────────
|
|
155
|
+
|
|
156
|
+
export type KallosLiteReport = {
|
|
157
|
+
phiPlacement: number; // 0..1 — golden-section proximity of the peak-intensity chapter
|
|
158
|
+
flowVariance: number; // 0..1 — chapter-length ebb/flow (proxy for 1/f; NOT a spectral fit)
|
|
159
|
+
birkhoffM: number; // 0..1 — order/complexity from prose metrics
|
|
160
|
+
composite: number; // 0..100 weighted geometric mean of computable pillars
|
|
161
|
+
caveat: string;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Computable subset of KALLOS. Pillars requiring an LLM, an audience panel, or
|
|
166
|
+
* an annotated knowledge graph (EMO, TRN, THM, GCT, …) are NOT fabricated —
|
|
167
|
+
* they are simply absent from this composite, and the caveat says so. The
|
|
168
|
+
* existing LLM judge (judge.ts) remains the tool for those humanistic axes.
|
|
169
|
+
*
|
|
170
|
+
* φ placement: peak chapter (by word count as intensity proxy) scored against
|
|
171
|
+
* the 0.618/0.90 craft targets with ±0.08 tolerance.
|
|
172
|
+
* Flow: coefficient of variation of chapter lengths mapped to 0..1 with an
|
|
173
|
+
* ideal band (too uniform = monotony; too wild = incoherence).
|
|
174
|
+
* Birkhoff M = O/C: O from motif closure proxies (distinct-word ratio inverse
|
|
175
|
+
* + dialogue presence), C from repeated-phrase density + sentence-length spread.
|
|
176
|
+
*/
|
|
177
|
+
export function computeKallosLite(chapterWordCounts: number[], metrics: ProseMetrics): KallosLiteReport {
|
|
178
|
+
const n = chapterWordCounts.length;
|
|
179
|
+
const total = chapterWordCounts.reduce((a, b) => a + b, 0);
|
|
180
|
+
|
|
181
|
+
// φ placement
|
|
182
|
+
let phiPlacement = 0.5;
|
|
183
|
+
if (n >= 3 && total > 0) {
|
|
184
|
+
let peakIdx = 0;
|
|
185
|
+
chapterWordCounts.forEach((w, i) => { if (w > chapterWordCounts[peakIdx]) peakIdx = i; });
|
|
186
|
+
const cum = chapterWordCounts.slice(0, peakIdx + 1).reduce((a, b) => a + b, 0);
|
|
187
|
+
const pos = cum / total;
|
|
188
|
+
const dist = Math.min(Math.abs(pos - 0.618), Math.abs(pos - 0.9));
|
|
189
|
+
phiPlacement = Math.max(0, Math.min(1, 1 - dist / 0.25));
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Flow (chapter-length variation)
|
|
193
|
+
let flowVariance = 0.5;
|
|
194
|
+
if (n >= 2) {
|
|
195
|
+
const mean = total / n;
|
|
196
|
+
const sd = Math.sqrt(chapterWordCounts.reduce((a, w) => a + (w - mean) ** 2, 0) / n);
|
|
197
|
+
const cv = mean > 0 ? sd / mean : 0;
|
|
198
|
+
// ideal band ~0.10–0.35; falls off outside
|
|
199
|
+
flowVariance = cv < 0.1 ? cv / 0.1 * 0.7 : cv <= 0.35 ? 1 : Math.max(0.2, 1 - (cv - 0.35));
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Birkhoff M = O/C (normalized)
|
|
203
|
+
const order = Math.min(1, metrics.distinctWordRatio * 1.4 + metrics.dialogueRatio * 0.4);
|
|
204
|
+
const complexity = Math.min(1, 0.2 + metrics.repeatedPhraseDensity * 6 + Math.min(0.4, metrics.sentenceLenStdev / 30));
|
|
205
|
+
const birkhoffM = Math.max(0.01, Math.min(1, order / Math.max(0.2, complexity) / 2));
|
|
206
|
+
|
|
207
|
+
// Weighted geometric mean (weights: flow .4, birkhoff .4, phi .2 — φ capped low per v3 §9.5)
|
|
208
|
+
const composite = Math.round(
|
|
209
|
+
100 * Math.exp(0.2 * Math.log(Math.max(0.01, phiPlacement)) + 0.4 * Math.log(Math.max(0.01, flowVariance)) + 0.4 * Math.log(Math.max(0.01, birkhoffM))),
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
return {
|
|
213
|
+
phiPlacement: Math.round(phiPlacement * 100) / 100,
|
|
214
|
+
flowVariance: Math.round(flowVariance * 100) / 100,
|
|
215
|
+
birkhoffM: Math.round(birkhoffM * 100) / 100,
|
|
216
|
+
composite,
|
|
217
|
+
caveat: "KALLOS-lite: computable structural pillars only (φ placement, flow, Birkhoff M). Humanistic axes (emotion, transportation, theme, genre contract) require the LLM judge or human panel; correlation with beauty is a hypothesis, not a verdict.",
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// ── REAL FUNCTION 2: ONOMASTRATA cast-confusion audit (§10.4) ───────────────
|
|
222
|
+
|
|
223
|
+
export type NameConfusionFinding = { a: string; b: string; issue: string };
|
|
224
|
+
|
|
225
|
+
function editDistance(a: string, b: string): number {
|
|
226
|
+
const m = a.length, n = b.length;
|
|
227
|
+
const d: number[][] = Array.from({ length: m + 1 }, (_, i) => [i, ...Array(n).fill(0)]);
|
|
228
|
+
for (let j = 0; j <= n; j++) d[0][j] = j;
|
|
229
|
+
for (let i = 1; i <= m; i++) for (let j = 1; j <= n; j++) {
|
|
230
|
+
d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));
|
|
231
|
+
}
|
|
232
|
+
return d[m][n];
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Real, deterministic cast-name confusion audit per ONOMASTRATA §10.4:
|
|
237
|
+
* - same first letter among >2 major names → flagged
|
|
238
|
+
* - normalized edit distance < 0.35 between any pair → flagged
|
|
239
|
+
*/
|
|
240
|
+
export function auditCastNameConfusion(names: string[]): NameConfusionFinding[] {
|
|
241
|
+
const findings: NameConfusionFinding[] = [];
|
|
242
|
+
const norm = names.map((s) => s.trim().toLowerCase()).filter(Boolean);
|
|
243
|
+
|
|
244
|
+
const byInitial = new Map<string, string[]>();
|
|
245
|
+
for (const nm of norm) {
|
|
246
|
+
const k = nm[0] ?? "";
|
|
247
|
+
byInitial.set(k, [...(byInitial.get(k) ?? []), nm]);
|
|
248
|
+
}
|
|
249
|
+
for (const [initial, group] of byInitial) {
|
|
250
|
+
if (group.length > 2) {
|
|
251
|
+
findings.push({ a: group[0], b: group.slice(1).join(", "), issue: `>2 major names share first letter "${initial}"` });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
for (let i = 0; i < norm.length; i++) for (let j = i + 1; j < norm.length; j++) {
|
|
256
|
+
const maxLen = Math.max(norm[i].length, norm[j].length);
|
|
257
|
+
if (maxLen === 0) continue;
|
|
258
|
+
const nd = editDistance(norm[i], norm[j]) / maxLen;
|
|
259
|
+
if (nd < 0.35) findings.push({ a: norm[i], b: norm[j], issue: `normalized edit distance ${nd.toFixed(2)} < 0.35` });
|
|
260
|
+
}
|
|
261
|
+
return findings;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export const SAGA_OS_V2_VERSION = "SAGA-OS v2/v3 (SYSTEM v13/v14) — tables + computable KALLOS-lite + ONOMASTRATA cast audit";
|
|
265
|
+
|
|
266
|
+
/** Honest gap ledger imported from the P9 docs themselves. */
|
|
267
|
+
export const SAGA_OS_V3_UNEXECUTED = [
|
|
268
|
+
"Per-row compiled catalog manifest (per-row wiring overrides) — architecture only",
|
|
269
|
+
"MORPHOGENESIS-LATTICE runtime (CA evolution engine) — design only, no runtime",
|
|
270
|
+
"PROSE-COMPILER (offline non-LLM realizer) — design only; grammar ceiling declared",
|
|
271
|
+
"SAGA-SCREEN Fountain exporter — design only",
|
|
272
|
+
"KALLOS-LIVE audience-panel calibration — requires humans",
|
|
273
|
+
"Full KALLOS (12 empirical dimensions) — requires LLM judge or panel; only KALLOS-lite computed locally",
|
|
274
|
+
] as const;
|