refactor: move core engine into lib/ and harness into ui/#85
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR restructures the repository to separate the core engine from the runtime/UI harness by moving engine code under lib/ and the harness under ui/, while keeping the previous module paths working via re-export shims.
Changes:
- Updated TypeScript project includes to target
lib/**(and tests) instead of the previous top-level engine directories. - Replaced prior top-level engine modules with thin shims that re-export from
lib/for backward compatibility. - Moved the legacy runtime harness to
ui/harnessand updated the harness server script + docs references accordingly.
Reviewed changes
Copilot reviewed 109 out of 116 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Updates compilation include paths to focus on lib/** (+ tests). |
| scripts/runtime-harness-server.mjs | Serves harness content from ui/harness instead of runtime/harness. |
| docs/development.md | Updates harness path reference in development docs. |
| PLAN.md | Updates harness file path references in the plan. |
| storage/OPFSVectorStore.ts | Back-compat shim re-exporting lib/storage/OPFSVectorStore. |
| storage/MemoryVectorStore.ts | Back-compat shim re-exporting lib/storage/MemoryVectorStore. |
| sharing/types.ts | Back-compat shim re-exporting lib/sharing/types. |
| sharing/SubgraphImporter.ts | Back-compat shim re-exporting lib/sharing/SubgraphImporter. |
| sharing/SubgraphExporter.ts | Back-compat shim re-exporting lib/sharing/SubgraphExporter. |
| sharing/PeerExchange.ts | Back-compat shim re-exporting lib/sharing/PeerExchange. |
| sharing/EligibilityClassifier.ts | Back-compat shim re-exporting lib/sharing/EligibilityClassifier. |
| sharing/CuriosityBroadcaster.ts | Back-compat shim re-exporting lib/sharing/CuriosityBroadcaster. |
| hippocampus/PageBuilder.ts | Back-compat shim re-exporting lib/hippocampus/PageBuilder. |
| hippocampus/Ingest.ts | Back-compat shim re-exporting lib/hippocampus/Ingest. |
| hippocampus/Chunker.ts | Back-compat shim re-exporting lib/hippocampus/Chunker. |
| embeddings/TransformersJsEmbeddingBackend.ts | Back-compat shim re-exporting lib/embeddings/TransformersJsEmbeddingBackend. |
| embeddings/OrtWebglEmbeddingBackend.ts | Back-compat shim re-exporting lib/embeddings/OrtWebglEmbeddingBackend. |
| embeddings/EmbeddingRunner.ts | Back-compat shim re-exporting lib/embeddings/EmbeddingRunner. |
| embeddings/EmbeddingBackend.ts | Back-compat shim re-exporting lib/embeddings/EmbeddingBackend. |
| embeddings/DeterministicDummyEmbeddingBackend.ts | Back-compat shim re-exporting lib/embeddings/DeterministicDummyEmbeddingBackend. |
| daydreamer/IdleScheduler.ts | Back-compat shim re-exporting lib/daydreamer/IdleScheduler. |
| daydreamer/HebbianUpdater.ts | Back-compat shim re-exporting lib/daydreamer/HebbianUpdater. |
| daydreamer/FullNeighborRecalc.ts | Back-compat shim re-exporting lib/daydreamer/FullNeighborRecalc. |
| daydreamer/ExperienceReplay.ts | Back-compat shim re-exporting lib/daydreamer/ExperienceReplay. |
| cortex/Ranking.ts | Back-compat shim re-exporting lib/cortex/Ranking. |
| cortex/QueryResult.ts | Back-compat shim re-exporting lib/cortex/QueryResult. |
| cortex/Query.ts | Back-compat shim re-exporting lib/cortex/Query. |
| cortex/OpenTSPSolver.ts | Back-compat shim re-exporting lib/cortex/OpenTSPSolver. |
| cortex/KnowledgeGapDetector.ts | Back-compat shim re-exporting lib/cortex/KnowledgeGapDetector. |
| core/crypto/verify.ts | Back-compat shim re-exporting lib/core/crypto/verify. |
| core/crypto/uuid.ts | Back-compat shim re-exporting lib/core/crypto/uuid. |
| core/crypto/sign.ts | Back-compat shim re-exporting lib/core/crypto/sign. |
| core/crypto/hash.ts | Back-compat shim re-exporting lib/core/crypto/hash. |
| core/NumericConstants.ts | Back-compat shim re-exporting lib/core/NumericConstants. |
| core/ModelProfileResolver.ts | Back-compat shim re-exporting lib/core/ModelProfileResolver. |
| core/ModelProfile.ts | Back-compat shim re-exporting lib/core/ModelProfile. |
| core/ModelDefaults.ts | Back-compat shim re-exporting lib/core/ModelDefaults. |
| core/BuiltInModelProfiles.ts | Back-compat shim re-exporting lib/core/BuiltInModelProfiles. |
| BackendKind.ts | Back-compat shim re-exporting lib/BackendKind. |
| CreateVectorBackend.ts | Back-compat shim re-exporting lib/CreateVectorBackend. |
| Policy.ts | Back-compat shim re-exporting lib/Policy. |
| TopK.ts | Back-compat shim re-exporting lib/TopK. |
| VectorBackend.ts | Back-compat shim re-exporting lib/VectorBackend. |
| WasmVectorBackend.ts | Back-compat shim re-exporting lib/WasmVectorBackend. |
| WebNNVectorBackend.ts | Back-compat shim re-exporting lib/WebNNVectorBackend. |
| WebNNTypes.d.ts | Back-compat shim intended to forward WebNN global typings. |
| lib/storage/OPFSVectorStore.ts | Canonical engine implementation location under lib/. |
| lib/storage/MemoryVectorStore.ts | Canonical engine implementation location under lib/. |
| lib/sharing/types.ts | Canonical sharing schema/types under lib/. |
| lib/sharing/SubgraphImporter.ts | Canonical importer implementation under lib/. |
| lib/sharing/SubgraphExporter.ts | Canonical exporter implementation under lib/. |
| lib/sharing/PeerExchange.ts | Canonical peer exchange orchestration under lib/. |
| lib/sharing/EligibilityClassifier.ts | Canonical eligibility classifier under lib/. |
| lib/sharing/CuriosityBroadcaster.ts | Canonical broadcaster under lib/. |
| lib/hippocampus/PageBuilder.ts | Canonical hippocampus implementation under lib/. |
| lib/hippocampus/Ingest.ts | Canonical hippocampus implementation under lib/. |
| lib/hippocampus/Chunker.ts | Canonical hippocampus implementation under lib/. |
| lib/embeddings/TransformersJsEmbeddingBackend.ts | Canonical embeddings backend under lib/. |
| lib/embeddings/OrtWebglEmbeddingBackend.ts | Canonical embeddings backend under lib/. |
| lib/embeddings/EmbeddingRunner.ts | Canonical embeddings runner under lib/. |
| lib/embeddings/EmbeddingBackend.ts | Canonical embeddings interface under lib/. |
| lib/embeddings/DeterministicDummyEmbeddingBackend.ts | Canonical dummy embeddings backend under lib/. |
| lib/daydreamer/IdleScheduler.ts | Canonical daydreamer scheduler under lib/. |
| lib/cortex/Ranking.ts | Canonical cortex ranking under lib/. |
| lib/cortex/QueryResult.ts | Canonical cortex result type under lib/. |
| lib/cortex/Query.ts | Canonical cortex query path under lib/. |
| lib/cortex/OpenTSPSolver.ts | Canonical cortex TSP solver under lib/. |
| lib/cortex/KnowledgeGapDetector.ts | Canonical cortex gap detector under lib/. |
| lib/core/crypto/verify.ts | Canonical crypto verify under lib/. |
| lib/core/crypto/uuid.ts | Canonical UUID helper under lib/. |
| lib/core/crypto/sign.ts | Canonical crypto signing under lib/. |
| lib/core/crypto/hash.ts | Canonical crypto hashing under lib/. |
| lib/core/NumericConstants.ts | Canonical shared numeric constants under lib/. |
| lib/core/ModelProfileResolver.ts | Canonical model profile resolver under lib/. |
| lib/core/ModelProfile.ts | Canonical model profile types under lib/. |
| lib/core/ModelDefaults.ts | Canonical model-derived defaults under lib/. |
| lib/core/BuiltInModelProfiles.ts | Canonical built-in model registry under lib/. |
| lib/BackendKind.ts | Canonical backend detection under lib/. |
| lib/CreateVectorBackend.ts | Canonical vector backend factory under lib/. |
| lib/Policy.ts | Canonical routing policy resolution under lib/. |
| lib/VectorBackend.ts | Canonical vector backend interface under lib/. |
| lib/TopK.ts | Canonical Top-K helpers under lib/. |
| lib/WasmVectorBackend.ts | Canonical WASM backend under lib/. |
| lib/WebNNVectorBackend.ts | Canonical WebNN backend under lib/. |
| lib/WebNNTypes.d.ts | Canonical WebNN ambient typings under lib/. |
| lib/Vectors.glsl | Shader source asset moved/added under lib/. |
Contributor
* Initial plan * fix: wrap WebGlVectorBackend.create() in .then() to capture synchronous throws for WASM fallback Co-authored-by: devlux76 <86517969+devlux76@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: devlux76 <86517969+devlux76@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary\n\nThis PR reorganizes the repository to make a clean separation between the core engine code () and UI/runtime harness code ().\n\n### Changes\n- Moved all engine modules (core, cortex, embeddings, hippocampus, daydreamer, sharing, storage, and root helpers) into \n- Kept existing root-level exports as lightweight shims for backwards compatibility\n- Moved the runtime legacy harness to and updated the harness server script accordingly\n- Updated includes and docs/plan references\n\n### Notes\n- All unit tests pass (
�[1m�[46m RUN �[49m�[22m �[36mv4.1.0 �[39m�[90m/home/user/Projects/cortex�[39m
�[32m✓�[39m tests/embeddings/DeterministicDummyEmbeddingBackend.test.ts �[2m(�[22m�[2m6 tests�[22m�[2m)�[22m�[32m 27�[2mms�[22m�[39m
�[32m✓�[39m tests/daydreamer/HebbianUpdater.test.ts �[2m(�[22m�[2m11 tests�[22m�[2m)�[22m�[32m 23�[2mms�[22m�[39m
�[32m✓�[39m tests/Persistence.test.ts �[2m(�[22m�[2m45 tests�[22m�[2m)�[22m�[32m 60�[2mms�[22m�[39m
�[32m✓�[39m tests/hippocampus/Ingest.test.ts �[2m(�[22m�[2m1 test�[22m�[2m)�[22m�[32m 48�[2mms�[22m�[39m
�[32m✓�[39m tests/hippocampus/FastNeighborInsert.test.ts �[2m(�[22m�[2m8 tests�[22m�[2m)�[22m�[32m 129�[2mms�[22m�[39m
�[32m✓�[39m tests/cortex/Ranking.test.ts �[2m(�[22m�[2m12 tests�[22m�[2m)�[22m�[32m 116�[2mms�[22m�[39m
�[32m✓�[39m tests/cortex/Query.test.ts �[2m(�[22m�[2m4 tests�[22m�[2m)�[22m�[32m 103�[2mms�[22m�[39m
�[32m✓�[39m tests/daydreamer/ExperienceReplay.test.ts �[2m(�[22m�[2m7 tests�[22m�[2m)�[22m�[32m 182�[2mms�[22m�[39m
�[32m✓�[39m tests/integration/IngestQuery.test.ts �[2m(�[22m�[2m9 tests�[22m�[2m)�[22m�[32m 149�[2mms�[22m�[39m
�[32m✓�[39m tests/HotpathPolicy.test.ts �[2m(�[22m�[2m40 tests�[22m�[2m)�[22m�[32m 30�[2mms�[22m�[39m
�[32m✓�[39m tests/SalienceEngine.test.ts �[2m(�[22m�[2m40 tests�[22m�[2m)�[22m�[32m 32�[2mms�[22m�[39m
�[32m✓�[39m tests/crypto/sign.test.ts �[2m(�[22m�[2m9 tests�[22m�[2m)�[22m�[32m 24�[2mms�[22m�[39m
�[32m✓�[39m tests/hippocampus/HierarchyBuilder.test.ts �[2m(�[22m�[2m12 tests�[22m�[2m)�[22m�[32m 288�[2mms�[22m�[39m
�[32m✓�[39m tests/sharing/SubgraphExchange.test.ts �[2m(�[22m�[2m13 tests�[22m�[2m)�[22m�[32m 42�[2mms�[22m�[39m
�[32m✓�[39m tests/hippocampus/Chunker.test.ts �[2m(�[22m�[2m8 tests�[22m�[2m)�[22m�[32m 24�[2mms�[22m�[39m
�[32m✓�[39m tests/daydreamer/IdleScheduler.test.ts �[2m(�[22m�[2m8 tests�[22m�[2m)�[22m�[32m 24�[2mms�[22m�[39m
�[32m✓�[39m tests/sharing/EligibilityClassifier.test.ts �[2m(�[22m�[2m14 tests�[22m�[2m)�[22m�[32m 13�[2mms�[22m�[39m
�[32m✓�[39m tests/integration/Daydreamer.test.ts �[2m(�[22m�[2m7 tests�[22m�[2m)�[22m�[32m 128�[2mms�[22m�[39m
�[32m✓�[39m tests/embeddings/ProviderResolver.test.ts �[2m(�[22m�[2m13 tests�[22m�[2m)�[22m�[32m 19�[2mms�[22m�[39m
�[32m✓�[39m tests/crypto/verify.test.ts �[2m(�[22m�[2m7 tests�[22m�[2m)�[22m�[32m 27�[2mms�[22m�[39m
�[32m✓�[39m tests/daydreamer/FullNeighborRecalc.test.ts �[2m(�[22m�[2m8 tests�[22m�[2m)�[22m�[32m 26�[2mms�[22m�[39m
�[32m✓�[39m tests/hippocampus/PageBuilder.test.ts �[2m(�[22m�[2m2 tests�[22m�[2m)�[22m�[32m 22�[2mms�[22m�[39m
�[32m✓�[39m tests/daydreamer/PrototypeRecomputer.test.ts �[2m(�[22m�[2m11 tests�[22m�[2m)�[22m�[32m 14�[2mms�[22m�[39m
�[32m✓�[39m tests/embeddings/TransformersJsEmbeddingBackend.test.ts �[2m(�[22m�[2m10 tests�[22m�[2m)�[22m�[32m 16�[2mms�[22m�[39m
�[32m✓�[39m tests/daydreamer/ClusterStability.test.ts �[2m(�[22m�[2m21 tests�[22m�[2m)�[22m�[32m 30�[2mms�[22m�[39m
�[32m✓�[39m tests/sharing/CuriosityBroadcaster.test.ts �[2m(�[22m�[2m11 tests�[22m�[2m)�[22m�[32m 21�[2mms�[22m�[39m
�[32m✓�[39m tests/crypto/hash.test.ts �[2m(�[22m�[2m10 tests�[22m�[2m)�[22m�[32m 18�[2mms�[22m�[39m
�[32m✓�[39m tests/cortex/KnowledgeGapDetector.test.ts �[2m(�[22m�[2m14 tests�[22m�[2m)�[22m�[32m 21�[2mms�[22m�[39m
�[32m✓�[39m tests/embeddings/OrtWebglEmbeddingBackend.test.ts �[2m(�[22m�[2m13 tests�[22m�[2m)�[22m�[32m 14�[2mms�[22m�[39m
�[32m✓�[39m tests/model/ModelDefaults.test.ts �[2m(�[22m�[2m6 tests�[22m�[2m)�[22m�[32m 8�[2mms�[22m�[39m
�[32m✓�[39m tests/cortex/MetroidBuilder.test.ts �[2m(�[22m�[2m9 tests�[22m�[2m)�[22m�[32m 13�[2mms�[22m�[39m
�[32m✓�[39m tests/cortex/OpenTSPSolver.test.ts �[2m(�[22m�[2m9 tests�[22m�[2m)�[22m�[32m 10�[2mms�[22m�[39m
�[32m✓�[39m tests/model/RoutingPolicy.test.ts �[2m(�[22m�[2m6 tests�[22m�[2m)�[22m�[32m 6�[2mms�[22m�[39m
�[32m✓�[39m tests/BackendSmoke.test.ts �[2m(�[22m�[2m3 tests�[22m�[2m)�[22m�[32m 8�[2mms�[22m�[39m
�[32m✓�[39m tests/embeddings/EmbeddingRunner.test.ts �[2m(�[22m�[2m2 tests�[22m�[2m)�[22m�[32m 5�[2mms�[22m�[39m
�[32m✓�[39m tests/model/ModelProfileResolver.test.ts �[2m(�[22m�[2m4 tests�[22m�[2m)�[22m�[32m 5�[2mms�[22m�[39m
�[32m✓�[39m tests/model/BuiltInModelProfiles.test.ts �[2m(�[22m�[2m5 tests�[22m�[2m)�[22m�[32m 4�[2mms�[22m�[39m
�[2m Test Files �[22m �[1m�[32m37 passed�[39m�[22m�[90m (37)�[39m
�[2m Tests �[22m �[1m�[32m418 passed�[39m�[22m�[90m (418)�[39m
�[2m Start at �[22m 02:56:55
�[2m Duration �[22m 1.50s�[2m (transform 2.98s, setup 0ms, import 5.05s, tests 1.73s, environment 6ms)�[22m).\n- No functional behavior was changed; this is purely structural.\n