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,294 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* §B THE 7 OMEGA AI-NATIVE MASTER TEMPLATES + §C OVERRIDE REGISTRY
|
|
3
|
+
* 1:1 with the research doc. Additive: when a template is selected its
|
|
4
|
+
* section skeleton + style-modulation hooks inject into the synthesis
|
|
5
|
+
* prompt. The anti-hallucination stack still wraps every stage.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export type OmegaArchetype =
|
|
9
|
+
| "OMEGA-STRATEGY"
|
|
10
|
+
| "OMEGA-DILIGENCE"
|
|
11
|
+
| "OMEGA-DISCOVERY"
|
|
12
|
+
| "OMEGA-COMPLIANCE"
|
|
13
|
+
| "OMEGA-BUILD"
|
|
14
|
+
| "OMEGA-SCIENCE"
|
|
15
|
+
| "OMEGA-CRISIS"
|
|
16
|
+
| "NIH-GRANT-SRF";
|
|
17
|
+
|
|
18
|
+
export interface OmegaSection {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
hint: string;
|
|
22
|
+
pages?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface OmegaTemplate {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
tagline: string;
|
|
29
|
+
replaces: string;
|
|
30
|
+
sections: OmegaSection[];
|
|
31
|
+
styleHooks: string[];
|
|
32
|
+
custom?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface StyleOverride {
|
|
36
|
+
token: string;
|
|
37
|
+
legacy: string;
|
|
38
|
+
mapsTo: OmegaArchetype;
|
|
39
|
+
hooks: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function unifiedHeaderBlock(opts: {
|
|
43
|
+
title: string; audience: string; date: string; classification: string;
|
|
44
|
+
sscpHash: string; evidenceTier: string; model: string; cutoff: string; styleMode: string;
|
|
45
|
+
}): string {
|
|
46
|
+
return [
|
|
47
|
+
"╔══════════════════════════════════════════════════════════════╗",
|
|
48
|
+
`║ ${opts.title} | ${opts.audience} | ${opts.date}`,
|
|
49
|
+
`║ Classification: ${opts.classification}`,
|
|
50
|
+
`║ SSCP Receipt: ${opts.sscpHash} | Evidence Tier: ${opts.evidenceTier}`,
|
|
51
|
+
`║ AI Disclosure: ${opts.model} | Cutoff: ${opts.cutoff}`,
|
|
52
|
+
`║ Style Mode: ${opts.styleMode}`,
|
|
53
|
+
"╚══════════════════════════════════════════════════════════════╝",
|
|
54
|
+
].join("\n");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const OMEGA_TEMPLATES: OmegaTemplate[] = [
|
|
58
|
+
{
|
|
59
|
+
id: "OMEGA-STRATEGY",
|
|
60
|
+
name: "OMEGA-STRATEGY",
|
|
61
|
+
tagline: "Strategic Recommendation",
|
|
62
|
+
replaces: "McKinsey Strategy Deck, BCG T-Model, Bain Corporate Strategy, Strategy& CDS, Roland Berger, L.E.K., Kearney, Market Entry",
|
|
63
|
+
sections: [
|
|
64
|
+
{ id: "§1", title: "BLUF", hint: "Decision trigger, value at stake ($NPV/IRR + confidence), top 3 action-titled MECE findings, recommendation + deadline", pages: "1 page" },
|
|
65
|
+
{ id: "§2", title: "Situation (SCQA)", hint: "Baseline state, complication, decision question, preview of answer", pages: "1-2 pages" },
|
|
66
|
+
{ id: "§3", title: "Diagnostic (T-Bar)", hint: "Market dynamics (TAM/SAM/SOM cited), competitive position, root-cause issue tree (MECE)", pages: "3-5 pages" },
|
|
67
|
+
{ id: "§4", title: "Options Tournament", hint: "≥4 paths incl. rejected naive default, weighted rubric, exclusion proofs (falsification gate), winning path + utility score", pages: "2-3 pages" },
|
|
68
|
+
{ id: "§5", title: "Recommendation & Value Bridge", hint: "3-5 bold moves, value bridge entry→exit by lever, quantified impact, capability requirements", pages: "2 pages" },
|
|
69
|
+
{ id: "§6", title: "Implementation (Wave Architecture)", hint: "Wave 1 (0-6mo) / Wave 2 (6-18mo) / Wave 3 (18mo+), RACI, resource ask, KPI dashboard", pages: "2 pages" },
|
|
70
|
+
{ id: "§7", title: "Risk Register & Assumption Ledger", hint: "Top 5-10 risks P×I with mitigants, [ASSUM] flags + sensitivity analysis", pages: "1 page" },
|
|
71
|
+
{ id: "§A", title: "Appendix (T-Body)", hint: "Data exhibits, methodology, interview list, model" },
|
|
72
|
+
],
|
|
73
|
+
styleHooks: ["Action titles ON (McKinsey)", "Red/black palette (Bain)", "NPS section (Bain PE)", "European stakeholder layer (Roland Berger)", "Bottom-up sizing model (L.E.K.)", "TCO/Procurement depth (Kearney)"],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "OMEGA-DILIGENCE",
|
|
77
|
+
name: "OMEGA-DILIGENCE",
|
|
78
|
+
tagline: "Investment & Transaction Analysis",
|
|
79
|
+
replaces: "Bain PE Due Diligence, EY-Parthenon Transaction, Commercial DD, Quality of Earnings",
|
|
80
|
+
sections: [
|
|
81
|
+
{ id: "§0", title: "Scope & Reliance Statement", hint: "Procedures performed, data cutoff, limitations, privilege status", pages: "0.5 page" },
|
|
82
|
+
{ id: "§1", title: "Investment Thesis", hint: "Bull/bear case (2 sentences), verdict PROCEED/CONDITIONAL/PASS, red-flags ledger, open items", pages: "1 page" },
|
|
83
|
+
{ id: "§2", title: "Market Attractiveness", hint: "Size/growth/profitability (sourced), Porter 5F, tailwinds vs disruption", pages: "2 pages" },
|
|
84
|
+
{ id: "§3", title: "Competitive Position & Moat", hint: "Share trajectory, relative cost, pricing power, concentration, switching costs, defensibility", pages: "2 pages" },
|
|
85
|
+
{ id: "§4", title: "Commercial Diligence", hint: "Customer interview synthesis (n=, methodology), NPS/retention, challenge of mgmt plan", pages: "3 pages" },
|
|
86
|
+
{ id: "§5", title: "Financial Diligence & QofE", hint: "Adjusted EBITDA bridge, revenue quality, working capital, CapEx, net debt, off-balance-sheet", pages: "3 pages" },
|
|
87
|
+
{ id: "§6", title: "Value Creation Plan", hint: "5yr EBITDA bridge, growth + margin levers quantified, multiple expansion, IRR/MOIC scenarios", pages: "2 pages" },
|
|
88
|
+
{ id: "§7", title: "Risk Register", hint: "Top 10 risks ranked P×I with structural mitigants", pages: "1 page" },
|
|
89
|
+
{ id: "§A", title: "Appendix", hint: "Model, anonymized transcripts, comparables, market sources" },
|
|
90
|
+
],
|
|
91
|
+
styleHooks: ["NPS deep-dive (Bain)", "Customer interview-heavy (EY-P)", "QofE adjustment tables (Big 4)", "Sponsor-specific value creation (PE)"],
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: "OMEGA-DISCOVERY",
|
|
95
|
+
name: "OMEGA-DISCOVERY",
|
|
96
|
+
tagline: "Research, Thought Leadership & Surveys",
|
|
97
|
+
replaces: "McKinsey MGI, BCG Perspectives, Deloitte Regulatory Outlook, PwC CEO Survey, EY Sector Outlook, KPMG CEO Outlook, Accenture Tech Vision, Academic Policy Brief",
|
|
98
|
+
sections: [
|
|
99
|
+
{ id: "§0", title: "Foreword", hint: "Why this report, why now (timeliness anchor), from [leader]", pages: "0.5 page" },
|
|
100
|
+
{ id: "§1", title: "Methodology Note", hint: "Sample size, respondent profile, field dates, weighting, source hierarchy, citations + reproducibility", pages: "1 page" },
|
|
101
|
+
{ id: "§2", title: "Executive Summary", hint: "5 headline findings (≤30 words each, data-anchored), infographic summary", pages: "2 pages" },
|
|
102
|
+
{ id: "§3", title: "The Big Idea / Central Thesis", hint: "The provocation (striking stat/paradox), what changed, why prior consensus fails", pages: "1 page" },
|
|
103
|
+
{ id: "§4", title: "Thematic Deep Dives (3-7 chapters)", hint: "Per chapter: synthesis paragraph, evidence base, leader-vs-laggard, quantified impact, disconfirming evidence (steelman)", pages: "4-8 pages each" },
|
|
104
|
+
{ id: "§5", title: "Regional / Sector Cuts", hint: "Americas/EMEA/APAC, sector heatmap (FS/Health/Industrial/TMT/Energy)", pages: "2-3 pages" },
|
|
105
|
+
{ id: "§6", title: "Horizon Scan", hint: "Near-term (12mo) / medium (1-3yr) / long-term wildcards, what would change our view", pages: "1 page" },
|
|
106
|
+
{ id: "§7", title: "Implications by Stakeholder", hint: "Business leaders / policymakers / workers / investors / regulators", pages: "2 pages" },
|
|
107
|
+
{ id: "§A", title: "Appendix", hint: "Full methodology, cross-tabs, regulatory tracker, glossary, bibliography (DOIs)" },
|
|
108
|
+
],
|
|
109
|
+
styleHooks: ["Long-form 80-150pp (MGI)", "Punchy 8-20pp (BCG Perspectives)", "Survey-heavy (PwC/KPMG)", "Regulatory tracker tables (Deloitte)", "Practitioner-architectural (Accenture Tech Vision)"],
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: "OMEGA-COMPLIANCE",
|
|
113
|
+
name: "OMEGA-COMPLIANCE",
|
|
114
|
+
tagline: "Audit, Risk, Governance & ESG",
|
|
115
|
+
replaces: "Deloitte Strategy & Ops, KPMG Advisory, GAO Audit, GAO PAR, Government Consulting, Oliver Wyman FinServ, ERM Assessment, ESG/Sustainability",
|
|
116
|
+
sections: [
|
|
117
|
+
{ id: "§0", title: "Transmittal Letter", hint: "Addressed to committee/board, scope restatement, limitations, signature", pages: "0.5 page" },
|
|
118
|
+
{ id: "§1", title: "Highlights Page (GAO-style)", hint: "LEFT: why this study | CENTER: key exhibit | RIGHT: what we found + recommend", pages: "1 page" },
|
|
119
|
+
{ id: "§2", title: "Background & Regulatory Context", hint: "Framework (COSO ERM 2017 / ISO 31000 / CSRD / GAGAS), prior work, materiality", pages: "2 pages" },
|
|
120
|
+
{ id: "§3", title: "Methodology", hint: "Evidence categories, GAGAS sufficiency, interviews, methods", pages: "1 page" },
|
|
121
|
+
{ id: "§4", title: "Findings (numbered)", hint: "Per finding: observation, impact, root cause, criterion violated, mgmt response", pages: "3-8 pages" },
|
|
122
|
+
{ id: "§5", title: "Risk Inventory & Heat Map", hint: "Risk register (ID, P×I inherent, controls, residual, owner), 5×5 heat map, emerging risks", pages: "2 pages" },
|
|
123
|
+
{ id: "§6", title: "Maturity Assessment", hint: "1-5 scale across 5-10 dimensions, heatmap vs peer benchmark, gap analysis", pages: "1 page" },
|
|
124
|
+
{ id: "§7", title: "Recommendations", hint: "Numbered, owner-assigned, priority + timeline + investment + metric", pages: "2-4 pages" },
|
|
125
|
+
{ id: "§8", title: "Agency/Management Response", hint: "Verbatim response letter, auditor reply, agree/disagree per rec", pages: "1 page" },
|
|
126
|
+
{ id: "§9", title: "Implementation Roadmap", hint: "Short/medium/long-term + governance structure", pages: "1 page" },
|
|
127
|
+
{ id: "§A", title: "Appendices", hint: "Risk register full, control matrix, GHG inventory (ESG), independence statement" },
|
|
128
|
+
],
|
|
129
|
+
styleHooks: ["GAO Highlights format", "Finding→Impact→Root Cause→Rec (KPMG)", "Actuarial models (Oliver Wyman)", "CSRD/ESRS double-materiality (ESG)", "COSO ERM framing (Risk)", "Federal Yellow Book GAGAS (GAO)"],
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: "OMEGA-BUILD",
|
|
133
|
+
name: "OMEGA-BUILD",
|
|
134
|
+
tagline: "Transformation, Architecture & Implementation",
|
|
135
|
+
replaces: "Accenture Digital Transformation, IBM Consulting, Capgemini, Digital Transformation Assessment, Healthcare Strategy",
|
|
136
|
+
sections: [
|
|
137
|
+
{ id: "§1", title: "Executive Summary", hint: "Transformation scope, value case, key decisions, digital maturity score (current→aspirational)", pages: "1 page" },
|
|
138
|
+
{ id: "§2", title: "Current State Architecture", hint: "App landscape inventory, tech debt, data/integration/security architecture, cloud status, capability maturity", pages: "3 pages" },
|
|
139
|
+
{ id: "§3", title: "Maturity Assessment", hint: "Scored: CX/Data&Analytics/Cloud/AI&Automation/Cybersec/Org&Talent/Op Model, heat map vs peers", pages: "2 pages" },
|
|
140
|
+
{ id: "§4", title: "Opportunity Portfolio", hint: "CX / operational efficiency / new business model / data monetization — each: size × feasibility × investment × timeline", pages: "2 pages" },
|
|
141
|
+
{ id: "§5", title: "Future State Architecture", hint: "Target landscape, cloud strategy, data & AI platform, security & compliance (GDPR/NIS2/AI Act/HIPAA/FedRAMP)", pages: "3 pages" },
|
|
142
|
+
{ id: "§6", title: "AI & Automation Roadmap", hint: "Use-case portfolio (100-day → long-term), GenAI opportunities, data-readiness gates, AI governance", pages: "2 pages" },
|
|
143
|
+
{ id: "§7", title: "Transformation Roadmap (Waves)", hint: "Wave 1 quick wins, Wave 2 scale, Wave 3 differentiation, milestone gates, investment by wave", pages: "2 pages" },
|
|
144
|
+
{ id: "§8", title: "Business Case", hint: "TCO categories, benefits (efficiency/revenue/risk), NPV/IRR/payback, sensitivity", pages: "2 pages" },
|
|
145
|
+
{ id: "§9", title: "Operating Model & Governance", hint: "Agile/DevOps/MLOps, product teams, vendor ecosystem, build vs buy vs partner", pages: "1 page" },
|
|
146
|
+
{ id: "§10", title: "Change Management", hint: "Stakeholder map, comms plan, training, adoption metrics", pages: "1 page" },
|
|
147
|
+
{ id: "§A", title: "Appendix", hint: "Architecture diagrams, vendor comparison matrix, financial model, security/compliance trace" },
|
|
148
|
+
],
|
|
149
|
+
styleHooks: ["Hyperscaler-neutral default", "Google Cloud-tilt (Capgemini)", "watsonx-tilt (IBM)", "AI Refinery-tilt (Accenture)", "Healthcare HEDIS/CMS Stars overlay"],
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: "OMEGA-SCIENCE",
|
|
153
|
+
name: "OMEGA-SCIENCE",
|
|
154
|
+
tagline: "Scientific & Academic (IMRAD)",
|
|
155
|
+
replaces: "IMRAD Empirical Article, PRISMA Systematic Review, Dissertation, Narrative Review",
|
|
156
|
+
sections: [
|
|
157
|
+
{ id: "§0", title: "Administrative Front Matter", hint: "Title, authors + ORCID, affiliations, funding, COI, AI Use Disclosure (Model/Version/Scope)" },
|
|
158
|
+
{ id: "§1", title: "Structured Abstract", hint: "Background | Methods | Results | Conclusions, 3-6 MeSH/Keywords", pages: "250 words" },
|
|
159
|
+
{ id: "§2", title: "Introduction", hint: "Problem magnitude, knowledge gap (niche), study rationale, central hypotheses", pages: "1-2 pages" },
|
|
160
|
+
{ id: "§3", title: "Methods", hint: "Design, setting, sample, measures, statistical plan (effect size, correction, missing data), ethics/IRB", pages: "3-5 pages" },
|
|
161
|
+
{ id: "§4", title: "Results", hint: "Aim-by-aim findings, descriptive stats, all inferential stats (p, effect size, 95% CI), tables/figures", pages: "3-5 pages" },
|
|
162
|
+
{ id: "§5", title: "Discussion", hint: "Findings summary, comparison to prior lit, mechanisms, strengths/limitations, implications", pages: "2-3 pages" },
|
|
163
|
+
{ id: "§6", title: "Conclusions", hint: "Final contribution, future directions, field-shaping summary", pages: "0.5 page" },
|
|
164
|
+
{ id: "§A", title: "Appendices", hint: "References (DOIs), supplementary tables, data/code availability statement" },
|
|
165
|
+
],
|
|
166
|
+
styleHooks: ["IMRAD pure", "PRISMA 2020 (Flow diagram)", "Cochrane Review", "APA JARS (Psych/Social)"],
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: "NIH-GRANT-SRF",
|
|
170
|
+
name: "NIH-GRANT-SRF",
|
|
171
|
+
tagline: "NIH Simplified Review Framework (2025+)",
|
|
172
|
+
replaces: "NIH R01, R03, R15, R21 Proposals after Jan 25, 2025",
|
|
173
|
+
sections: [
|
|
174
|
+
{ id: "§0", title: "Specific Aims", hint: "Long-term goal, objective, central hypothesis, 3 independent/synergistic aims, expected outcomes, impact", pages: "1 page" },
|
|
175
|
+
{ id: "§1", title: "Factor 1: Importance of the Research", hint: "Significance and Innovation. Establishing high impact likelihood. Rigor of prior research assessment.", pages: "2-2.5 pages" },
|
|
176
|
+
{ id: "§2", title: "Factor 2: Rigor and Feasibility of the Approach", hint: "Detailed methodology, unbiased robust data, sample size (ICC-adjusted), controls, pitfalls & alternatives, SABV", pages: "8.5-9 pages" },
|
|
177
|
+
{ id: "§3", title: "Human Subjects / Vertebrate Animals", hint: "Protection, inclusion across lifespan, recruitment, clinical trial timeline if relevant" },
|
|
178
|
+
{ id: "§4", title: "Data Management and Sharing (DMS)", hint: "Data types, standards, preservation/access, oversight, institutional support" },
|
|
179
|
+
{ id: "§A", title: "Appendices", hint: "References cited, facilities, resources, biosketch logic, budget justification" },
|
|
180
|
+
],
|
|
181
|
+
styleHooks: ["Factor 1 Importance", "Factor 2 Rigor", "Factor 3 Expertise/Resources (Acceptable/Unacceptable)", "SimplerNOFO era"],
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
id: "OMEGA-CRISIS",
|
|
185
|
+
name: "OMEGA-CRISIS",
|
|
186
|
+
tagline: "Restructuring, Federal RFP, Emergency Response",
|
|
187
|
+
replaces: "AlixPartners Restructuring, Federal Government Proposal/RFP Response",
|
|
188
|
+
sections: [
|
|
189
|
+
{ id: "§0", title: "Privilege & Scope Notice", hint: "Attorney-client privilege (restructuring), FAR/DFARS clauses (federal RFP), Section 508/WCAG 2.1 AA, document control", pages: "0.5 page" },
|
|
190
|
+
{ id: "§1", title: "Situation Overview", hint: "Current condition, liquidity runway (restructuring), understanding of requirement (RFP), crisis triggers, stakeholder map", pages: "1 page" },
|
|
191
|
+
{ id: "§2", title: "Immediate-Term Forecast", hint: "13-week cash flow (restructuring) OR 30/60/90-day transition plan (RFP), minimum liquidity/performance threshold" },
|
|
192
|
+
{ id: "§3", title: "Operational Assessment", hint: "Business unit performance, cost structure, revenue sustainability, quick-win actions", pages: "2 pages" },
|
|
193
|
+
{ id: "§4", title: "Strategic Options", hint: "A: standalone reorg / continue. B: sale/363 / alternate vendor. C: wind-down / withdrawal. Comparative matrix + recommendation", pages: "2 pages" },
|
|
194
|
+
{ id: "§5", title: "Execution Plan", hint: "Phased timeline (court filings / contract milestones), workplan by task area (PWS/SOW), resource + key personnel + clearances, QASP", pages: "3 pages" },
|
|
195
|
+
{ id: "§6", title: "Governance & Risk", hint: "Steering structure, decision rights, risk register, key dependencies", pages: "1 page" },
|
|
196
|
+
{ id: "§7", title: "Past Performance / Track Record", hint: "Contract refs (PIID, agency, value, POC, CPARS) (federal), prior crisis engagements (restructuring)", pages: "2 pages" },
|
|
197
|
+
{ id: "§8", title: "Price / Volume IV", hint: "CLIN-structured pricing, labor categories × rates × hours, escalation, pricing narrative (federal)", pages: "1-2 pages" },
|
|
198
|
+
{ id: "§A", title: "Appendix", hint: "Financial model, creditor analysis, key personnel resumes (clearances), legal/regulatory trace" },
|
|
199
|
+
],
|
|
200
|
+
styleHooks: ["Court-exhibit format (AlixPartners)", "4-Volume FAR-compliant (Technical/Past Perf/Personnel/Price)", "Classified markings (TS/SCI/SECRET/CUI)"],
|
|
201
|
+
},
|
|
202
|
+
];
|
|
203
|
+
|
|
204
|
+
// ─── §C Style Override Registry (40 legacy templates) ───────────────
|
|
205
|
+
export const STYLE_OVERRIDES: StyleOverride[] = [
|
|
206
|
+
{ token: "--mckinsey-classic", legacy: "McKinsey Strategy Deck (1A)", mapsTo: "OMEGA-STRATEGY", hooks: "Action titles + Ghost deck + Pyramid Principle + Exhibit numbering" },
|
|
207
|
+
{ token: "--mgi-research", legacy: "McKinsey MGI Research (1B)", mapsTo: "OMEGA-DISCOVERY", hooks: "80-150pp + full-page exhibits + 4-6pp standalone ExecSumm" },
|
|
208
|
+
{ token: "--bcg-tmodel", legacy: "BCG T-Model Deck (2A)", mapsTo: "OMEGA-STRATEGY", hooks: "T-Bar/T-Body split + Growth-Share Matrix + green palette" },
|
|
209
|
+
{ token: "--bcg-perspective", legacy: "BCG Perspectives White Paper (2B)", mapsTo: "OMEGA-DISCOVERY", hooks: "8-20pp + provocation opening + named framework" },
|
|
210
|
+
{ token: "--bain-pe", legacy: "Bain PE Due Diligence (3A)", mapsTo: "OMEGA-DILIGENCE", hooks: "NPS section + 55pp narrative + red/black palette" },
|
|
211
|
+
{ token: "--bain-strategy", legacy: "Bain Corporate Strategy (3B)", mapsTo: "OMEGA-STRATEGY", hooks: "Full Potential + Results Delivery + bold moves" },
|
|
212
|
+
{ token: "--deloitte-engagement", legacy: "Deloitte Strategy & Ops (4A)", mapsTo: "OMEGA-BUILD", hooks: "Document control block + chapter structure + green palette" },
|
|
213
|
+
{ token: "--deloitte-regoutlook", legacy: "Deloitte Regulatory Outlook (4B)", mapsTo: "OMEGA-DISCOVERY", hooks: "Regulatory tracker table + jurisdiction × deadline matrix" },
|
|
214
|
+
{ token: "--strategy&-cds", legacy: "Strategy& Corporate Strategy (5A)", mapsTo: "OMEGA-STRATEGY", hooks: "Capabilities-Driven Strategy + Way to Play + transmittal letter" },
|
|
215
|
+
{ token: "--pwc-ceosurvey", legacy: "PwC Global CEO Survey (5B)", mapsTo: "OMEGA-DISCOVERY", hooks: "4000+ CEO sample + longitudinal trend + regional cross-tabs" },
|
|
216
|
+
{ token: "--ey-parthenon", legacy: "EY-Parthenon Transaction (6A)", mapsTo: "OMEGA-DILIGENCE", hooks: "EY yellow accent + commercial diligence-heavy + legal disclaimer" },
|
|
217
|
+
{ token: "--ey-sectoroutlook", legacy: "EY Sector Outlook (6B)", mapsTo: "OMEGA-DISCOVERY", hooks: "Survey-heavy + horizon scan + risk framing" },
|
|
218
|
+
{ token: "--kpmg-advisory", legacy: "KPMG Advisory (7A)", mapsTo: "OMEGA-COMPLIANCE", hooks: "Finding→Impact→Root Cause→Recommendation + audit traceability" },
|
|
219
|
+
{ token: "--kpmg-ceooutlook", legacy: "KPMG CEO Outlook (7B)", mapsTo: "OMEGA-DISCOVERY", hooks: "~1300 CEO sample + Three Horizons + regulatory risk lens" },
|
|
220
|
+
{ token: "--olwyman-finserv", legacy: "Oliver Wyman FinServ (8)", mapsTo: "OMEGA-COMPLIANCE", hooks: "Actuarial models + probability distributions + statistical bands" },
|
|
221
|
+
{ token: "--rolandberger", legacy: "Roland Berger (9)", mapsTo: "OMEGA-STRATEGY", hooks: "European regulatory + Mittelstand + stakeholder integration" },
|
|
222
|
+
{ token: "--lek", legacy: "L.E.K. (10)", mapsTo: "OMEGA-STRATEGY", hooks: "Bottom-up market sizing + rNPV pipeline + physician/payer surveys" },
|
|
223
|
+
{ token: "--kearney", legacy: "Kearney (11)", mapsTo: "OMEGA-STRATEGY", hooks: "Procurement Maturity + TCO framework + waterfall savings charts" },
|
|
224
|
+
{ token: "--alixpartners", legacy: "AlixPartners Restructuring (12)", mapsTo: "OMEGA-CRISIS", hooks: "13-week cash flow + court exhibit format + attorney-client privilege" },
|
|
225
|
+
{ token: "--accenture-transform", legacy: "Accenture Digital Transformation (13A)", mapsTo: "OMEGA-BUILD", hooks: "Architecture diagrams + AI Refinery + Accenture purple" },
|
|
226
|
+
{ token: "--accenture-techvision", legacy: "Accenture Tech Vision (13B)", mapsTo: "OMEGA-DISCOVERY", hooks: "5-trends format + ~3000 exec survey + practitioner depth" },
|
|
227
|
+
{ token: "--ibm", legacy: "IBM Consulting (14)", mapsTo: "OMEGA-BUILD", hooks: "watsonx-positioned + POC results + hybrid advisory-sales" },
|
|
228
|
+
{ token: "--capgemini", legacy: "Capgemini (15)", mapsTo: "OMEGA-BUILD", hooks: "Google Cloud tilt + GDPR/NIS2/AI Act + sovereign cloud" },
|
|
229
|
+
{ token: "--gao-audit", legacy: "GAO Audit (16A)", mapsTo: "OMEGA-COMPLIANCE", hooks: "Highlights 1-pager + Yellow Book GAGAS + agency response + numbered recs" },
|
|
230
|
+
{ token: "--gao-par", legacy: "GAO PAR (16B)", mapsTo: "OMEGA-COMPLIANCE", hooks: "OMB A-136 + GPRA + 5-part structure + audited financials" },
|
|
231
|
+
{ token: "--federal-rfp", legacy: "Federal RFP Response (17)", mapsTo: "OMEGA-CRISIS", hooks: "4-Volume FAR structure + CPARS + Section 508 + DFARS" },
|
|
232
|
+
{ token: "--govcon", legacy: "Government Consulting (18)", mapsTo: "OMEGA-COMPLIANCE", hooks: "OMB A-94 cost-benefit + classified markings + agency-specific" },
|
|
233
|
+
{ token: "--nih-r01", legacy: "NIH R01 Grant (19A)", mapsTo: "OMEGA-SCIENCE", hooks: "Simplified Review Framework (Factor 1 + Factor 2) + 12pp limit" },
|
|
234
|
+
{ token: "--nih-rppr", legacy: "NIH RPPR Progress (19B)", mapsTo: "OMEGA-SCIENCE", hooks: "Sections A-H + Research.gov format + Current & Pending update" },
|
|
235
|
+
{ token: "--nsf-pappg", legacy: "NSF Proposal (20)", mapsTo: "OMEGA-SCIENCE", hooks: "PAPPG + Intellectual Merit + Broader Impacts standalone + Safe/Inclusive" },
|
|
236
|
+
{ token: "--imrad", legacy: "IMRAD Empirical Article (21A)", mapsTo: "OMEGA-SCIENCE", hooks: "Pure IMRAD + structured abstract + reporting checklist" },
|
|
237
|
+
{ token: "--prisma", legacy: "PRISMA Systematic Review (21B)", mapsTo: "OMEGA-SCIENCE", hooks: "PRISMA 2020 + PROSPERO registration + GRADE + flow diagram" },
|
|
238
|
+
{ token: "--policybrief", legacy: "Academic Policy Brief (21C)", mapsTo: "OMEGA-DISCOVERY", hooks: "Think tank format + non-specialist audience + working paper number" },
|
|
239
|
+
{ token: "--market-entry", legacy: "Market Entry / Assessment (22)", mapsTo: "OMEGA-STRATEGY", hooks: "TAM/SAM/SOM + 4-option entry analysis + 5-year financial ramp" },
|
|
240
|
+
{ token: "--cdd", legacy: "Commercial Due Diligence (23)", mapsTo: "OMEGA-DILIGENCE", hooks: "Customer interview chapter + management plan challenge" },
|
|
241
|
+
{ token: "--digital-assess", legacy: "Digital Transformation Assessment (24)", mapsTo: "OMEGA-BUILD", hooks: "5-7 dimension maturity heatmap + wave roadmap" },
|
|
242
|
+
{ token: "--esg-csrd", legacy: "ESG/Sustainability (25)", mapsTo: "OMEGA-COMPLIANCE", hooks: "Double materiality + Scope 1/2/3 + CSRD/ESRS/ISSB" },
|
|
243
|
+
{ token: "--erm-coso", legacy: "ERM Assessment (26)", mapsTo: "OMEGA-COMPLIANCE", hooks: "COSO ERM 2017 + ISO 31000 + 5x5 heat map + 3 lines of defense" },
|
|
244
|
+
{ token: "--qofe", legacy: "Quality of Earnings (27)", mapsTo: "OMEGA-DILIGENCE", hooks: "EBITDA bridge + adjustments table + agreed-upon procedures" },
|
|
245
|
+
{ token: "--healthcare", legacy: "Healthcare Consulting (28)", mapsTo: "OMEGA-BUILD", hooks: "HEDIS + CMS Stars + payer mix + clinical variation analysis" },
|
|
246
|
+
];
|
|
247
|
+
|
|
248
|
+
// ─── §D Selection decision matrix ───────────────────────────────────
|
|
249
|
+
export const SELECTION_MATRIX: { task: string; def: OmegaArchetype; override: string }[] = [
|
|
250
|
+
{ task: "Recommend a strategy", def: "OMEGA-STRATEGY", override: "PE due diligence depth → --bain-pe" },
|
|
251
|
+
{ task: "Should we invest / acquire?", def: "OMEGA-DILIGENCE", override: "Only earnings quality → --qofe" },
|
|
252
|
+
{ task: "What's happening in [field]?", def: "OMEGA-DISCOVERY", override: "CEO survey longitudinal → --pwc-ceosurvey" },
|
|
253
|
+
{ task: "Audit / find gaps / assess risk", def: "OMEGA-COMPLIANCE", override: "Federal Yellow Book → --gao-audit" },
|
|
254
|
+
{ task: "Build / transform / modernize", def: "OMEGA-BUILD", override: "IBM stack → --ibm" },
|
|
255
|
+
{ task: "Scientific publication", def: "OMEGA-SCIENCE", override: "Systematic review → --prisma" },
|
|
256
|
+
{ task: "NIH Grant Application", def: "NIH-GRANT-SRF", override: "R01 Full Project → --nih-r01" },
|
|
257
|
+
{ task: "Restructuring / federal bid", def: "OMEGA-CRISIS", override: "Court-filed → --alixpartners" },
|
|
258
|
+
];
|
|
259
|
+
|
|
260
|
+
// ─── Auto-pick a template from a query (deterministic keyword routing) ──
|
|
261
|
+
const ROUTES: { re: RegExp; id: OmegaArchetype }[] = [
|
|
262
|
+
{ re: /\b(invest|acquir|due diligence|valuation|ebitda|earnings quality|target company|m&a|buyout)\b/i, id: "OMEGA-DILIGENCE" },
|
|
263
|
+
{ re: /\b(audit|compliance|risk register|governance|esg|csrd|coso|gao|control|materiality)\b/i, id: "OMEGA-COMPLIANCE" },
|
|
264
|
+
{ re: /\b(transform|modernize|architecture|migration|cloud|platform|implementation|roadmap|devops)\b/i, id: "OMEGA-BUILD" },
|
|
265
|
+
{ re: /\b(nih|r01|r03|r15|r21|grant application|simplified review|specific aims)\b/i, id: "NIH-GRANT-SRF" },
|
|
266
|
+
{ re: /\b(grant|hypothesis|study|trial|systematic review|prisma|nsf|imrad|p-?value|methodology)\b/i, id: "OMEGA-SCIENCE" },
|
|
267
|
+
{ re: /\b(restructur|bankrupt|liquidity|rfp|federal bid|chapter 11|wind-down|13-week|insolvenc)\b/i, id: "OMEGA-CRISIS" },
|
|
268
|
+
{ re: /\b(what.?s happening|trend|outlook|survey|thought leadership|landscape|horizon scan|state of)\b/i, id: "OMEGA-DISCOVERY" },
|
|
269
|
+
{ re: /\b(strateg|recommend|should we|market entry|competitive|grow|options|decision)\b/i, id: "OMEGA-STRATEGY" },
|
|
270
|
+
];
|
|
271
|
+
|
|
272
|
+
export function autoPickTemplate(query: string): OmegaArchetype {
|
|
273
|
+
for (const r of ROUTES) if (r.re.test(query)) return r.id;
|
|
274
|
+
return "OMEGA-STRATEGY";
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export function findTemplate(list: OmegaTemplate[], id: string): OmegaTemplate | undefined {
|
|
278
|
+
return list.find((t) => t.id === id);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/** Build the synthesis-prompt skeleton injected when a template is active. */
|
|
282
|
+
export function buildTemplatePrompt(t: OmegaTemplate, styleMode: string): string {
|
|
283
|
+
const sections = t.sections
|
|
284
|
+
.map((s) => ` ${s.id} ${s.title}${s.pages ? ` (${s.pages})` : ""} — ${s.hint}`)
|
|
285
|
+
.join("\n");
|
|
286
|
+
return [
|
|
287
|
+
`OUTPUT TEMPLATE: ${t.name} — ${t.tagline}`,
|
|
288
|
+
"Produce the answer using EXACTLY these sections, in order. Begin with the unified header block.",
|
|
289
|
+
"Omit a section ONLY if it is genuinely inapplicable, and say so in one line.",
|
|
290
|
+
sections,
|
|
291
|
+
`STYLE MODE: ${styleMode}`,
|
|
292
|
+
"Apply the relevant style-modulation hooks silently; never print the hook names.",
|
|
293
|
+
].join("\n");
|
|
294
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/** Persistent template contract shared by calibration and production SLOOP. */
|
|
2
|
+
export * from "./omega-templates.base";
|
|
3
|
+
import {
|
|
4
|
+
OMEGA_TEMPLATES,
|
|
5
|
+
STYLE_OVERRIDES,
|
|
6
|
+
type OmegaTemplate,
|
|
7
|
+
} from "./omega-templates.base";
|
|
8
|
+
|
|
9
|
+
const NON_FABRICATION_RULES: Record<string, string[]> = {
|
|
10
|
+
"OMEGA-STRATEGY": [
|
|
11
|
+
"Do not invent TAM/SAM/SOM, NPV, IRR, market share, competitor data, RACI owners, or deadlines. Compute only from supplied inputs; otherwise mark the exact data gap and provide a formula or decision rule.",
|
|
12
|
+
],
|
|
13
|
+
"OMEGA-DILIGENCE": [
|
|
14
|
+
"Do not invent management plans, customer interviews, NPS, retention, EBITDA adjustments, debt, valuation multiples, IRR, or MOIC. Separate sourced facts, analyst inference, and diligence requests.",
|
|
15
|
+
"A verdict may be CONDITIONAL when load-bearing diligence evidence is absent; state the conditions explicitly.",
|
|
16
|
+
],
|
|
17
|
+
"OMEGA-DISCOVERY": [
|
|
18
|
+
"Do not invent survey respondents, field dates, weighting, cross-tabs, regional findings, quotes, or statistics. If no survey was performed, label the methodology as desk research and omit survey claims.",
|
|
19
|
+
],
|
|
20
|
+
"OMEGA-COMPLIANCE": [
|
|
21
|
+
"Do not claim an audit standard was satisfied, quote management responses, assign control owners, calculate residual risk, or assert regulatory compliance without evidence. Distinguish observation, criterion, inference, and recommendation.",
|
|
22
|
+
],
|
|
23
|
+
"OMEGA-BUILD": [
|
|
24
|
+
"Do not invent application inventories, maturity scores, architecture state, vendor capabilities, costs, NPV, security certification, or adoption metrics. Use [PROPOSED] for target-state design and identify discovery inputs needed for current-state claims.",
|
|
25
|
+
],
|
|
26
|
+
"OMEGA-SCIENCE": [
|
|
27
|
+
"First classify the task as completed empirical study, protocol/proposal, systematic review, or narrative review. Never put hypothetical or projected findings under Results; use Expected Outcomes for proposals/protocols.",
|
|
28
|
+
"Do not invent sample size, effect size, p-values, confidence intervals, ethics approval, registration, PRISMA counts, data availability, authors, ORCIDs, funding, or DOIs.",
|
|
29
|
+
],
|
|
30
|
+
"NIH-GRANT-SRF": [
|
|
31
|
+
"Treat the document as a proposal: never fabricate preliminary data, IRB approval, recruitment performance, facilities, investigator expertise, award mechanism fit, or NIH Institute interest. Label unverified design choices [PROPOSED].",
|
|
32
|
+
"Do not force exactly three aims when the question or mechanism supports fewer; aims must be independently interpretable and collectively coherent.",
|
|
33
|
+
],
|
|
34
|
+
"OMEGA-CRISIS": [
|
|
35
|
+
"Do not assert attorney-client privilege, classification, CUI/SECRET markings, FAR/DFARS applicability, liquidity, creditor positions, PIIDs, CPARS, clearances, labor rates, or court facts without authoritative input.",
|
|
36
|
+
"Never generate official markings or representations of legal privilege; provide a clearly labeled draft framework requiring counsel/contracting-officer review.",
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export function getOmegaTemplate(id?: string): OmegaTemplate | undefined {
|
|
41
|
+
return OMEGA_TEMPLATES.find(t => t.id === id);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Build a page-aware, evidence-safe template contract. Every main section is
|
|
46
|
+
* retained; a small page target compresses sections instead of deleting them.
|
|
47
|
+
*/
|
|
48
|
+
export function buildAdaptiveTemplateContract(opts: {
|
|
49
|
+
templateId?: string;
|
|
50
|
+
styleOverride?: string;
|
|
51
|
+
targetPages?: number;
|
|
52
|
+
evidenceAvailable?: boolean;
|
|
53
|
+
}): string {
|
|
54
|
+
const t = getOmegaTemplate(opts.templateId);
|
|
55
|
+
if (!t) return "";
|
|
56
|
+
const pages = Math.max(1, opts.targetPages ?? 4);
|
|
57
|
+
const targetWords = Math.max(700, pages * 550);
|
|
58
|
+
const substantive = t.sections.filter(s => !/^§A/.test(s.id));
|
|
59
|
+
const perSection = Math.max(90, Math.floor(targetWords / Math.max(1, substantive.length)));
|
|
60
|
+
const style = STYLE_OVERRIDES.find(s => s.token === opts.styleOverride);
|
|
61
|
+
const mismatch = style && style.mapsTo !== t.id;
|
|
62
|
+
const sections = t.sections.map((s, i) => {
|
|
63
|
+
const appendix = /^§A/.test(s.id);
|
|
64
|
+
return `${i + 1}. ## ${s.title}\n Contract: ${s.hint}\n Budget: ${appendix ? "compact appendix / evidence ledger" : `~${perSection} words; substantive, no bare heading`}`;
|
|
65
|
+
}).join("\n");
|
|
66
|
+
const evidenceRules = NON_FABRICATION_RULES[t.id] ?? [];
|
|
67
|
+
return [
|
|
68
|
+
`AUTHORITATIVE OUTPUT CONTRACT: ${t.id} — ${t.tagline}`,
|
|
69
|
+
`Target: approximately ${pages} page(s) / ${targetWords} words. Preserve ALL main sections below in order; compress depth proportionally rather than deleting later sections.`,
|
|
70
|
+
"Use the exact Markdown headings below. A section may be marked 'Not applicable — <specific reason>' only when genuinely outside the user's task; never leave a bare heading.",
|
|
71
|
+
sections,
|
|
72
|
+
"",
|
|
73
|
+
"EVIDENCE AND STATUS RULES:",
|
|
74
|
+
"- Tag design choices or future actions [PROPOSED], unresolved inputs [DATA GAP], and explicit assumptions [ASSUMPTION]. Do not present any of these as observed fact.",
|
|
75
|
+
"- Cite only retrieved source IDs actually present in the evidence block. If evidence is unavailable, do not manufacture a bibliography or URL.",
|
|
76
|
+
"- Never manufacture interviews, survey samples, financial statements, regulatory determinations, study results, named personnel, official responses, approvals, classifications, or audit evidence.",
|
|
77
|
+
...evidenceRules.map(r => `- ${r}`),
|
|
78
|
+
opts.evidenceAvailable ? "- Retrieved evidence is available; bind every load-bearing factual claim to it." : "- No retrieved evidence is available; limit factual claims, state uncertainty, and emphasize the verification plan.",
|
|
79
|
+
"",
|
|
80
|
+
`STYLE OVERRIDE: ${opts.styleOverride || "none"}. ${style ? style.hooks : "Apply no legacy-specific hooks."}`,
|
|
81
|
+
mismatch
|
|
82
|
+
? `STYLE/TEMPLATE CONFLICT RESOLUTION: ${style!.token} normally maps to ${style!.mapsTo}, not ${t.id}. Apply only compatible voice/layout characteristics; DO NOT import the other template's substantive sections, evidence claims, or metrics.`
|
|
83
|
+
: "Style must never override section semantics, evidence rules, safety, or factual status.",
|
|
84
|
+
].join("\n");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Backward-compatible production prompt, now evidence-safe. */
|
|
88
|
+
export function buildTemplatePrompt(t: OmegaTemplate, styleMode: string): string {
|
|
89
|
+
return buildAdaptiveTemplateContract({ templateId: t.id, styleOverride: styleMode, targetPages: 8, evidenceAvailable: true });
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ─── Template-Directed Search Queries ──────────────────────────────────────
|
|
93
|
+
// Instead of a single heuristic query, each template generates explicit,
|
|
94
|
+
// per-section search queries that target the EXACT evidence each section needs.
|
|
95
|
+
// This replaces generic "search for the question" with structured evidence acquisition.
|
|
96
|
+
|
|
97
|
+
const SECTION_SEARCH_PATTERNS: Record<string, Record<string, string[]>> = {
|
|
98
|
+
"OMEGA-STRATEGY": {
|
|
99
|
+
"BLUF": ["{topic} strategic recommendation decision"],
|
|
100
|
+
"Situation (SCQA)": ["{topic} market overview current state 2024 2025", "{topic} industry challenges complication"],
|
|
101
|
+
"Diagnostic (T-Bar)": ["{topic} market size TAM SAM SOM", "{topic} competitive landscape market share", "{topic} root cause analysis industry issues"],
|
|
102
|
+
"Options Tournament": ["{topic} strategic options alternatives comparison", "{topic} case study successful strategy"],
|
|
103
|
+
"Recommendation & Value Bridge": ["{topic} value creation levers quantified impact", "{topic} NPV IRR business case"],
|
|
104
|
+
"Implementation (Wave Architecture)": ["{topic} implementation roadmap phases timeline", "{topic} KPI metrics dashboard"],
|
|
105
|
+
"Risk Register & Assumption Ledger": ["{topic} key risks mitigation strategy", "{topic} market risk factors sensitivity"],
|
|
106
|
+
},
|
|
107
|
+
"OMEGA-DILIGENCE": {
|
|
108
|
+
"Investment Thesis": ["{topic} investment thesis bull bear case"],
|
|
109
|
+
"Market Attractiveness": ["{topic} market size growth rate addressable market", "{topic} Porter five forces industry analysis"],
|
|
110
|
+
"Competitive Position & Moat": ["{topic} competitive advantage market share moat", "{topic} switching costs barriers to entry"],
|
|
111
|
+
"Commercial Diligence": ["{topic} customer satisfaction NPS retention churn", "{topic} revenue quality customer concentration"],
|
|
112
|
+
"Financial Diligence & QofE": ["{topic} EBITDA quality of earnings adjusted", "{topic} working capital capex analysis"],
|
|
113
|
+
"Value Creation Plan": ["{topic} value creation EBITDA bridge margin improvement", "{topic} IRR MOIC return analysis"],
|
|
114
|
+
"Risk Register": ["{topic} investment risk factors due diligence red flags"],
|
|
115
|
+
},
|
|
116
|
+
"OMEGA-DISCOVERY": {
|
|
117
|
+
"Methodology Note": ["{topic} research methodology survey design"],
|
|
118
|
+
"The Big Idea / Central Thesis": ["{topic} emerging trend disruption paradigm shift 2025 2026"],
|
|
119
|
+
"Thematic Deep Dives (3-7 chapters)": ["{topic} key findings data analysis", "{topic} case study leader vs laggard", "{topic} quantified impact research evidence"],
|
|
120
|
+
"Regional / Sector Cuts": ["{topic} regional analysis Americas EMEA APAC", "{topic} sector comparison financial services healthcare technology"],
|
|
121
|
+
"Horizon Scan": ["{topic} future outlook predictions 2025 2026 2027"],
|
|
122
|
+
"Implications by Stakeholder": ["{topic} implications business leaders policymakers investors"],
|
|
123
|
+
},
|
|
124
|
+
"OMEGA-COMPLIANCE": {
|
|
125
|
+
"Background & Regulatory Context": ["{topic} regulatory framework compliance requirements", "{topic} COSO ERM ISO 31000 GAGAS applicable standards"],
|
|
126
|
+
"Methodology": ["{topic} audit methodology assessment approach"],
|
|
127
|
+
"Findings (numbered)": ["{topic} compliance gaps findings deficiencies", "{topic} risk assessment audit findings"],
|
|
128
|
+
"Risk Inventory & Heat Map": ["{topic} risk register heat map likelihood impact"],
|
|
129
|
+
"Maturity Assessment": ["{topic} maturity model assessment benchmark"],
|
|
130
|
+
"Recommendations": ["{topic} remediation recommendations improvement plan"],
|
|
131
|
+
},
|
|
132
|
+
"OMEGA-BUILD": {
|
|
133
|
+
"Current State Architecture": ["{topic} current IT architecture application landscape", "{topic} technology debt assessment"],
|
|
134
|
+
"Maturity Assessment": ["{topic} digital maturity assessment benchmark"],
|
|
135
|
+
"Opportunity Portfolio": ["{topic} digital transformation opportunities use cases"],
|
|
136
|
+
"Future State Architecture": ["{topic} target architecture cloud strategy AI platform"],
|
|
137
|
+
"AI & Automation Roadmap": ["{topic} AI use cases automation roadmap GenAI"],
|
|
138
|
+
"Business Case": ["{topic} digital transformation business case TCO ROI NPV"],
|
|
139
|
+
},
|
|
140
|
+
"OMEGA-SCIENCE": {
|
|
141
|
+
"Introduction": ["{topic} literature review research gap background"],
|
|
142
|
+
"Methods": ["{topic} research methodology study design sample size"],
|
|
143
|
+
"Results": ["{topic} research findings results data analysis"],
|
|
144
|
+
"Discussion": ["{topic} interpretation comparison prior literature implications"],
|
|
145
|
+
},
|
|
146
|
+
"NIH-GRANT-SRF": {
|
|
147
|
+
"Specific Aims": ["{topic} NIH research aims hypothesis objectives"],
|
|
148
|
+
"Factor 1: Importance of the Research": ["{topic} significance innovation prior research rigor", "{topic} health disparity unmet need public health impact"],
|
|
149
|
+
"Factor 2: Rigor and Feasibility of the Approach": ["{topic} methodology feasibility sample size power analysis", "{topic} statistical approach SABV biological variable"],
|
|
150
|
+
},
|
|
151
|
+
"OMEGA-CRISIS": {
|
|
152
|
+
"Situation Overview": ["{topic} crisis current situation liquidity assessment"],
|
|
153
|
+
"Immediate-Term Forecast": ["{topic} 13-week cash flow forecast liquidity runway"],
|
|
154
|
+
"Operational Assessment": ["{topic} operational performance cost structure assessment"],
|
|
155
|
+
"Strategic Options": ["{topic} restructuring options turnaround alternatives"],
|
|
156
|
+
"Execution Plan": ["{topic} restructuring implementation timeline milestones"],
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Generate explicit, per-section search queries for a given template and user question.
|
|
162
|
+
* Returns an array of { section, queries } objects that the grounding system
|
|
163
|
+
* should execute instead of (or in addition to) a single generic query.
|
|
164
|
+
*/
|
|
165
|
+
export function buildTemplateSearchQueries(templateId: string, userQuestion: string): Array<{ section: string; queries: string[] }> {
|
|
166
|
+
const patterns = SECTION_SEARCH_PATTERNS[templateId];
|
|
167
|
+
if (!patterns) return [{ section: "general", queries: [userQuestion] }];
|
|
168
|
+
|
|
169
|
+
// Extract the core topic from the user question (strip common question prefixes)
|
|
170
|
+
const topic = userQuestion
|
|
171
|
+
.replace(/^(please |can you |could you |find me |help me |write |create |produce |generate |draft )/gi, "")
|
|
172
|
+
.replace(/\b(a report|an analysis|a strategy|a plan|a proposal)\b/gi, "")
|
|
173
|
+
.trim()
|
|
174
|
+
.slice(0, 120) || userQuestion.slice(0, 120);
|
|
175
|
+
|
|
176
|
+
const result: Array<{ section: string; queries: string[] }> = [];
|
|
177
|
+
for (const [section, queryPatterns] of Object.entries(patterns)) {
|
|
178
|
+
const queries = queryPatterns.map(p => p.replace("{topic}", topic));
|
|
179
|
+
result.push({ section, queries });
|
|
180
|
+
}
|
|
181
|
+
return result;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// ─── Hand-Trace Appendix Builder ───────────────────────────────────────────
|
|
185
|
+
// For any math, logic, or analytical claim in the output, this generates
|
|
186
|
+
// a step-by-step derivation appendix that a human can audit on paper.
|
|
187
|
+
|
|
188
|
+
export function buildHandTraceInstruction(templateId?: string): string {
|
|
189
|
+
const lines = [
|
|
190
|
+
"",
|
|
191
|
+
"HAND-TRACE APPENDIX REQUIREMENT:",
|
|
192
|
+
"At the END of the report, add a section titled '## Appendix: Analytical Hand-Trace'.",
|
|
193
|
+
"For EVERY quantitative claim, formula, calculation, logical deduction, or analytical assertion in the report, provide:",
|
|
194
|
+
" 1. CLAIM: The exact claim as stated in the body (quote it).",
|
|
195
|
+
" 2. DERIVATION: Step-by-step breakdown showing how the number/conclusion was reached.",
|
|
196
|
+
" - If from a source: cite [S#] and quote the exact passage that supports it.",
|
|
197
|
+
" - If computed: show the formula, each input value with its source, and the arithmetic.",
|
|
198
|
+
" - If inferred: state the premises, the inference rule, and the conclusion.",
|
|
199
|
+
" - If assumed: label it [ASSUMPTION] and state what would change if the assumption is wrong.",
|
|
200
|
+
" 3. VERIFICATION STATUS: One of:",
|
|
201
|
+
" - [SOURCED] — directly stated in a cited source",
|
|
202
|
+
" - [COMPUTED] — derived from sourced inputs via transparent arithmetic",
|
|
203
|
+
" - [INFERRED] — logically derived from sourced premises",
|
|
204
|
+
" - [ASSUMED] — not verifiable from available evidence",
|
|
205
|
+
" - [DATA GAP] — required input is missing; claim is conditional",
|
|
206
|
+
"",
|
|
207
|
+
"This appendix must be machine-auditable: every claim must trace to either a source citation or a transparent derivation chain. No claim in the body should lack a corresponding hand-trace entry.",
|
|
208
|
+
];
|
|
209
|
+
|
|
210
|
+
// Template-specific trace requirements
|
|
211
|
+
if (templateId === "OMEGA-STRATEGY" || templateId === "OMEGA-DILIGENCE") {
|
|
212
|
+
lines.push(" - For financial claims (NPV, IRR, MOIC, TAM/SAM/SOM): show the full formula, discount rate, cash flow assumptions, and sensitivity range.");
|
|
213
|
+
lines.push(" - For market sizing: show bottom-up and/or top-down methodology with each input cited.");
|
|
214
|
+
}
|
|
215
|
+
if (templateId === "OMEGA-SCIENCE" || templateId === "NIH-GRANT-SRF") {
|
|
216
|
+
lines.push(" - For statistical claims: show the test used, sample size, effect size, p-value, confidence interval, and power calculation inputs.");
|
|
217
|
+
lines.push(" - For study design claims: trace each design choice to its methodological justification.");
|
|
218
|
+
}
|
|
219
|
+
if (templateId === "OMEGA-COMPLIANCE") {
|
|
220
|
+
lines.push(" - For risk scores: show the likelihood and impact ratings with their evidence basis.");
|
|
221
|
+
lines.push(" - For regulatory citations: provide the exact statute/regulation section number.");
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return lines.join("\n");
|
|
225
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* omni-nexus.ts
|
|
3
|
+
* ============================================================================
|
|
4
|
+
* Additive canonical Omni Nexus endpoint for the portfolio orchestrator.
|
|
5
|
+
* Delegates to Nexus Consensus engine.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { nexusResearch } from "./scraper-vnext/nexus-consensus";
|
|
9
|
+
|
|
10
|
+
export async function omniNexusGround(
|
|
11
|
+
opts: {
|
|
12
|
+
query: string;
|
|
13
|
+
depth?: number;
|
|
14
|
+
maxTokens?: number;
|
|
15
|
+
concurrency?: number;
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
onDebug?: (msg: string) => void;
|
|
18
|
+
}
|
|
19
|
+
): Promise<{
|
|
20
|
+
ok: boolean;
|
|
21
|
+
provider: string;
|
|
22
|
+
evidenceBlock: string;
|
|
23
|
+
sources: Array<{ title: string; url: string; content: string }>;
|
|
24
|
+
claims: any[];
|
|
25
|
+
counts: Record<string, number>;
|
|
26
|
+
}> {
|
|
27
|
+
try {
|
|
28
|
+
const nexus = await nexusResearch(opts.query, {
|
|
29
|
+
depth: opts.depth,
|
|
30
|
+
enrichTop: Math.min(opts.depth ?? 5, 5),
|
|
31
|
+
enrichConcurrency: opts.concurrency ?? 3,
|
|
32
|
+
signal: opts.signal,
|
|
33
|
+
allowJina: true,
|
|
34
|
+
allowPublicProxies: true,
|
|
35
|
+
allowWayback: true,
|
|
36
|
+
onDebug: opts.onDebug,
|
|
37
|
+
});
|
|
38
|
+
if (nexus.ok && nexus.evidenceBlock) {
|
|
39
|
+
return {
|
|
40
|
+
ok: true,
|
|
41
|
+
provider: `omni-nexus(${nexus.provider})`,
|
|
42
|
+
evidenceBlock: nexus.evidenceBlock,
|
|
43
|
+
sources: (nexus.sources || []).map((s) => ({
|
|
44
|
+
title: s.title || "Untitled",
|
|
45
|
+
url: s.canonicalUrl || s.url,
|
|
46
|
+
content: s.content || "",
|
|
47
|
+
})),
|
|
48
|
+
claims: (nexus.atoms || []) as any[],
|
|
49
|
+
counts: { supported: nexus.sources?.length || 0 },
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
} catch (e) {
|
|
53
|
+
opts.onDebug?.(`omni-nexus fail: ${e instanceof Error ? e.message : String(e)}`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
ok: false,
|
|
58
|
+
provider: "omni-nexus(unresolved)",
|
|
59
|
+
evidenceBlock: "",
|
|
60
|
+
sources: [],
|
|
61
|
+
claims: [],
|
|
62
|
+
counts: {},
|
|
63
|
+
};
|
|
64
|
+
}
|