holosphere 2.0.0-alpha1 → 2.0.0-alpha10
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/CHANGELOG.md +473 -0
- package/FEATURES.md +431 -0
- package/LICENSE +29 -166
- package/LICENSE-AGPL.md +180 -0
- package/README.md +97 -16
- package/dist/2019-D2OG2idw.js +6680 -0
- package/dist/2019-D2OG2idw.js.map +1 -0
- package/dist/2019-EION3wKo.cjs +8 -0
- package/dist/2019-EION3wKo.cjs.map +1 -0
- package/dist/_commonjsHelpers-C37NGDzP.cjs +2 -0
- package/dist/_commonjsHelpers-C37NGDzP.cjs.map +1 -0
- package/dist/_commonjsHelpers-CUmg6egw.js +7 -0
- package/dist/_commonjsHelpers-CUmg6egw.js.map +1 -0
- package/dist/browser-BSniCNqO.js +3058 -0
- package/dist/browser-BSniCNqO.js.map +1 -0
- package/dist/browser-Cq59Ij19.cjs +2 -0
- package/dist/browser-Cq59Ij19.cjs.map +1 -0
- package/dist/cdn/holosphere.min.js +55 -0
- package/dist/cdn/holosphere.min.js.map +1 -0
- package/dist/cjs/holosphere.cjs +2 -0
- package/dist/cjs/holosphere.cjs.map +1 -0
- package/dist/esm/holosphere.js +53 -0
- package/dist/esm/holosphere.js.map +1 -0
- package/dist/index-DDGt_V9o.cjs +12 -0
- package/dist/index-DDGt_V9o.cjs.map +1 -0
- package/dist/index-DJXftyvB.js +39841 -0
- package/dist/index-DJXftyvB.js.map +1 -0
- package/dist/index-DMbdcMtK.cjs +18 -0
- package/dist/index-DMbdcMtK.cjs.map +1 -0
- package/dist/index-DeZ1xz_s.js +15104 -0
- package/dist/index-DeZ1xz_s.js.map +1 -0
- package/dist/indexeddb-storage-BFt6hMeF.js +176 -0
- package/dist/indexeddb-storage-BFt6hMeF.js.map +1 -0
- package/dist/indexeddb-storage-BK5tv4Sh.cjs +2 -0
- package/dist/indexeddb-storage-BK5tv4Sh.cjs.map +1 -0
- package/dist/memory-storage-C9HuoL2E.js +91 -0
- package/dist/memory-storage-C9HuoL2E.js.map +1 -0
- package/dist/memory-storage-Dao7jfYG.cjs +2 -0
- package/dist/memory-storage-Dao7jfYG.cjs.map +1 -0
- package/dist/secp256k1-BbKzbLtD.cjs +12 -0
- package/dist/secp256k1-BbKzbLtD.cjs.map +1 -0
- package/dist/secp256k1-CreY7Pcl.js +1890 -0
- package/dist/secp256k1-CreY7Pcl.js.map +1 -0
- package/docs/CONTRACTS.md +797 -0
- package/docs/FOSDEM_PROPOSAL.md +388 -0
- package/docs/LOCALFIRST.md +266 -0
- package/docs/api/ai_aggregation.js.html +333 -0
- package/docs/api/ai_breakdown.js.html +524 -0
- package/docs/api/ai_classifier.js.html +231 -0
- package/docs/api/ai_council.js.html +246 -0
- package/docs/api/ai_embeddings.js.html +304 -0
- package/docs/api/ai_federation-ai.js.html +338 -0
- package/docs/api/ai_h3-ai.js.html +970 -0
- package/docs/api/ai_index.js.html +124 -0
- package/docs/api/ai_json-ops.js.html +241 -0
- package/docs/api/ai_llm-service.js.html +239 -0
- package/docs/api/ai_nl-query.js.html +236 -0
- package/docs/api/ai_relationships.js.html +367 -0
- package/docs/api/ai_schema-extractor.js.html +235 -0
- package/docs/api/ai_spatial.js.html +307 -0
- package/docs/api/ai_tts.js.html +214 -0
- package/docs/api/content_social-protocols.js.html +180 -0
- package/docs/api/core_holosphere.js.html +757 -0
- package/docs/api/crypto_nostr-utils.js.html +306 -0
- package/docs/api/crypto_secp256k1.js.html +267 -0
- package/docs/api/data/search.json +1 -0
- package/docs/api/federation_discovery.js.html +337 -0
- package/docs/api/federation_handshake.js.html +478 -0
- package/docs/api/federation_hologram.js.html +1053 -0
- package/docs/api/federation_registry.js.html +389 -0
- package/docs/api/fonts/Inconsolata-Regular.ttf +0 -0
- package/docs/api/fonts/OpenSans-Regular.ttf +0 -0
- package/docs/api/fonts/WorkSans-Bold.ttf +0 -0
- package/docs/api/global.html +3 -0
- package/docs/api/hierarchical_upcast.js.html +128 -0
- package/docs/api/index.html +265 -0
- package/docs/api/index.js.html +1868 -0
- package/docs/api/lib_ai-methods.js.html +660 -0
- package/docs/api/lib_contract-methods.js.html +445 -0
- package/docs/api/lib_errors.js.html +56 -0
- package/docs/api/lib_federation-methods.js.html +348 -0
- package/docs/api/lib_index.js.html +33 -0
- package/docs/api/module-ai.html +5 -0
- package/docs/api/module-ai_aggregation-SmartAggregation.html +6 -0
- package/docs/api/module-ai_aggregation.SmartAggregation.html +3 -0
- package/docs/api/module-ai_aggregation.html +3 -0
- package/docs/api/module-ai_breakdown-TaskBreakdown.html +5 -0
- package/docs/api/module-ai_breakdown.TaskBreakdown.html +3 -0
- package/docs/api/module-ai_breakdown.html +3 -0
- package/docs/api/module-ai_classifier-Classifier.html +6 -0
- package/docs/api/module-ai_classifier.Classifier.html +3 -0
- package/docs/api/module-ai_classifier.html +3 -0
- package/docs/api/module-ai_council-Council.html +6 -0
- package/docs/api/module-ai_council.Council.html +3 -0
- package/docs/api/module-ai_council.html +3 -0
- package/docs/api/module-ai_embeddings-Embeddings.html +5 -0
- package/docs/api/module-ai_embeddings.Embeddings.html +3 -0
- package/docs/api/module-ai_embeddings.html +3 -0
- package/docs/api/module-ai_federation-ai-FederationAdvisor.html +6 -0
- package/docs/api/module-ai_federation-ai.FederationAdvisor.html +3 -0
- package/docs/api/module-ai_federation-ai.html +3 -0
- package/docs/api/module-ai_h3-ai-H3AI.html +6 -0
- package/docs/api/module-ai_h3-ai.H3AI.html +3 -0
- package/docs/api/module-ai_h3-ai.html +3 -0
- package/docs/api/module-ai_json-ops-JSONOps.html +5 -0
- package/docs/api/module-ai_json-ops.JSONOps.html +3 -0
- package/docs/api/module-ai_json-ops.html +3 -0
- package/docs/api/module-ai_llm-service-LLMService.html +5 -0
- package/docs/api/module-ai_llm-service.LLMService.html +3 -0
- package/docs/api/module-ai_llm-service.html +3 -0
- package/docs/api/module-ai_nl-query-NLQuery.html +5 -0
- package/docs/api/module-ai_nl-query.NLQuery.html +3 -0
- package/docs/api/module-ai_nl-query.html +3 -0
- package/docs/api/module-ai_relationships-RelationshipDiscovery.html +6 -0
- package/docs/api/module-ai_relationships.RelationshipDiscovery.html +3 -0
- package/docs/api/module-ai_relationships.html +3 -0
- package/docs/api/module-ai_schema-extractor-SchemaExtractor.html +5 -0
- package/docs/api/module-ai_schema-extractor.SchemaExtractor.html +3 -0
- package/docs/api/module-ai_schema-extractor.html +3 -0
- package/docs/api/module-ai_spatial-SpatialAnalysis.html +6 -0
- package/docs/api/module-ai_spatial.SpatialAnalysis.html +3 -0
- package/docs/api/module-ai_spatial.html +3 -0
- package/docs/api/module-ai_tts-TTS.html +5 -0
- package/docs/api/module-ai_tts.TTS.html +3 -0
- package/docs/api/module-ai_tts.html +3 -0
- package/docs/api/module-content_social-protocols.html +3 -0
- package/docs/api/module-core_holosphere-HoloSphere.html +6 -0
- package/docs/api/module-core_holosphere.HoloSphere.html +3 -0
- package/docs/api/module-core_holosphere.html +3 -0
- package/docs/api/module-crypto_nostr-utils.html +3 -0
- package/docs/api/module-crypto_secp256k1.html +3 -0
- package/docs/api/module-federation_hologram.html +3 -0
- package/docs/api/module-hierarchical_upcast.html +3 -0
- package/docs/api/module-holosphere-HoloSphereBase.html +3 -0
- package/docs/api/module-holosphere.html +3 -0
- package/docs/api/module-lib_ai-methods.html +3 -0
- package/docs/api/module-lib_contract-methods.html +3 -0
- package/docs/api/module-lib_errors-AuthorizationError.html +3 -0
- package/docs/api/module-lib_errors-ValidationError.html +3 -0
- package/docs/api/module-lib_errors.AuthorizationError.html +3 -0
- package/docs/api/module-lib_errors.ValidationError.html +3 -0
- package/docs/api/module-lib_errors.html +3 -0
- package/docs/api/module-lib_federation-methods.html +3 -0
- package/docs/api/module-lib_index.html +3 -0
- package/docs/api/module-schema_validator-ValidationError.html +3 -0
- package/docs/api/module-schema_validator.ValidationError.html +3 -0
- package/docs/api/module-schema_validator.html +3 -0
- package/docs/api/module-spatial_h3-operations.html +4 -0
- package/docs/api/module-storage_backend-factory.BackendFactory.html +3 -0
- package/docs/api/module-storage_backend-factory.html +3 -0
- package/docs/api/module-storage_backend-interface-StorageBackend.html +3 -0
- package/docs/api/module-storage_backend-interface.StorageBackend.html +3 -0
- package/docs/api/module-storage_backend-interface.html +3 -0
- package/docs/api/module-storage_backends_activitypub-backend-ActivityPubBackend.html +7 -0
- package/docs/api/module-storage_backends_activitypub-backend.ActivityPubBackend.html +3 -0
- package/docs/api/module-storage_backends_activitypub-backend.html +3 -0
- package/docs/api/module-storage_backends_activitypub_server-ActivityPubServer.html +8 -0
- package/docs/api/module-storage_backends_activitypub_server.ActivityPubServer.html +3 -0
- package/docs/api/module-storage_backends_activitypub_server.html +3 -0
- package/docs/api/module-storage_backends_gundb-backend-GunDBBackend.html +7 -0
- package/docs/api/module-storage_backends_gundb-backend.GunDBBackend.html +3 -0
- package/docs/api/module-storage_backends_gundb-backend.html +3 -0
- package/docs/api/module-storage_backends_nostr-backend-NostrBackend.html +8 -0
- package/docs/api/module-storage_backends_nostr-backend.NostrBackend.html +3 -0
- package/docs/api/module-storage_backends_nostr-backend.html +3 -0
- package/docs/api/module-storage_filesystem-storage-FileSystemStorage.html +5 -0
- package/docs/api/module-storage_filesystem-storage-browser-FileSystemStorage.html +3 -0
- package/docs/api/module-storage_filesystem-storage-browser.FileSystemStorage.html +3 -0
- package/docs/api/module-storage_filesystem-storage-browser.html +3 -0
- package/docs/api/module-storage_filesystem-storage.FileSystemStorage.html +3 -0
- package/docs/api/module-storage_filesystem-storage.html +3 -0
- package/docs/api/module-storage_global-tables.html +3 -0
- package/docs/api/module-storage_gun-async.html +3 -0
- package/docs/api/module-storage_gun-auth-GunAuth.html +5 -0
- package/docs/api/module-storage_gun-auth.GunAuth.html +3 -0
- package/docs/api/module-storage_gun-auth.html +3 -0
- package/docs/api/module-storage_gun-federation.html +3 -0
- package/docs/api/module-storage_gun-references-GunReferenceHandler.html +5 -0
- package/docs/api/module-storage_gun-references.GunReferenceHandler.html +3 -0
- package/docs/api/module-storage_gun-references.html +3 -0
- package/docs/api/module-storage_gun-schema-GunSchemaValidator.html +5 -0
- package/docs/api/module-storage_gun-schema.GunSchemaValidator.html +3 -0
- package/docs/api/module-storage_gun-schema.html +3 -0
- package/docs/api/module-storage_gun-wrapper.html +11 -0
- package/docs/api/module-storage_indexeddb-storage-IndexedDBStorage.html +5 -0
- package/docs/api/module-storage_indexeddb-storage.IndexedDBStorage.html +3 -0
- package/docs/api/module-storage_indexeddb-storage.html +3 -0
- package/docs/api/module-storage_key-storage-simple.html +3 -0
- package/docs/api/module-storage_key-storage.html +4 -0
- package/docs/api/module-storage_memory-storage-MemoryStorage.html +5 -0
- package/docs/api/module-storage_memory-storage.MemoryStorage.html +3 -0
- package/docs/api/module-storage_memory-storage.html +3 -0
- package/docs/api/module-storage_migration-MigrationTool.html +6 -0
- package/docs/api/module-storage_migration.MigrationTool.html +3 -0
- package/docs/api/module-storage_migration.html +3 -0
- package/docs/api/module-storage_nostr-async.html +18 -0
- package/docs/api/module-storage_nostr-client-LRUCache.html +3 -0
- package/docs/api/module-storage_nostr-client-NostrClient.html +7 -0
- package/docs/api/module-storage_nostr-client.NostrClient.html +15 -0
- package/docs/api/module-storage_nostr-client.html +6 -0
- package/docs/api/module-storage_nostr-wrapper.html +3 -0
- package/docs/api/module-storage_outbox-queue-OutboxQueue.html +4 -0
- package/docs/api/module-storage_outbox-queue.OutboxQueue.html +3 -0
- package/docs/api/module-storage_outbox-queue.html +3 -0
- package/docs/api/module-storage_persistent-storage-PersistentStorage.html +3 -0
- package/docs/api/module-storage_persistent-storage.html +4 -0
- package/docs/api/module-storage_sync-service-SyncService.html +5 -0
- package/docs/api/module-storage_sync-service.SyncService.html +3 -0
- package/docs/api/module-storage_sync-service.html +3 -0
- package/docs/api/module-storage_unified-storage.html +3 -0
- package/docs/api/module-subscriptions_manager.SubscriptionRegistry.html +3 -0
- package/docs/api/module-subscriptions_manager.html +3 -0
- package/docs/api/schema_validator.js.html +113 -0
- package/docs/api/scripts/core.js +726 -0
- package/docs/api/scripts/core.min.js +23 -0
- package/docs/api/scripts/resize.js +90 -0
- package/docs/api/scripts/search.js +265 -0
- package/docs/api/scripts/search.min.js +6 -0
- package/docs/api/scripts/third-party/Apache-License-2.0.txt +202 -0
- package/docs/api/scripts/third-party/fuse.js +9 -0
- package/docs/api/scripts/third-party/hljs-line-num-original.js +369 -0
- package/docs/api/scripts/third-party/hljs-line-num.js +1 -0
- package/docs/api/scripts/third-party/hljs-original.js +5171 -0
- package/docs/api/scripts/third-party/hljs.js +1 -0
- package/docs/api/scripts/third-party/popper.js +5 -0
- package/docs/api/scripts/third-party/tippy.js +1 -0
- package/docs/api/scripts/third-party/tocbot.js +672 -0
- package/docs/api/scripts/third-party/tocbot.min.js +1 -0
- package/docs/api/spatial_h3-operations.js.html +129 -0
- package/docs/api/storage_backend-factory.js.html +133 -0
- package/docs/api/storage_backend-interface.js.html +164 -0
- package/docs/api/storage_backends_activitypub-backend.js.html +298 -0
- package/docs/api/storage_backends_activitypub_server.js.html +678 -0
- package/docs/api/storage_backends_gundb-backend.js.html +878 -0
- package/docs/api/storage_backends_nostr-backend.js.html +254 -0
- package/docs/api/storage_filesystem-storage-browser.js.html +83 -0
- package/docs/api/storage_filesystem-storage.js.html +207 -0
- package/docs/api/storage_global-tables.js.html +116 -0
- package/docs/api/storage_gun-async.js.html +344 -0
- package/docs/api/storage_gun-auth.js.html +376 -0
- package/docs/api/storage_gun-federation.js.html +788 -0
- package/docs/api/storage_gun-references.js.html +212 -0
- package/docs/api/storage_gun-schema.js.html +309 -0
- package/docs/api/storage_gun-wrapper.js.html +645 -0
- package/docs/api/storage_indexeddb-storage.js.html +224 -0
- package/docs/api/storage_key-storage-simple.js.html +102 -0
- package/docs/api/storage_key-storage.js.html +171 -0
- package/docs/api/storage_memory-storage.js.html +128 -0
- package/docs/api/storage_migration.js.html +354 -0
- package/docs/api/storage_nostr-async.js.html +1076 -0
- package/docs/api/storage_nostr-client.js.html +1598 -0
- package/docs/api/storage_nostr-wrapper.js.html +218 -0
- package/docs/api/storage_outbox-queue.js.html +248 -0
- package/docs/api/storage_persistent-storage.js.html +160 -0
- package/docs/api/storage_sync-service.js.html +201 -0
- package/docs/api/storage_unified-storage.js.html +157 -0
- package/docs/api/styles/clean-jsdoc-theme-base.css +1159 -0
- package/docs/api/styles/clean-jsdoc-theme-dark.css +412 -0
- package/docs/api/styles/clean-jsdoc-theme-light.css +482 -0
- package/docs/api/styles/clean-jsdoc-theme-scrollbar.css +30 -0
- package/docs/api/styles/clean-jsdoc-theme-without-scrollbar.min.css +1 -0
- package/docs/api/styles/clean-jsdoc-theme.min.css +1 -0
- package/docs/api/subscriptions_manager.js.html +162 -0
- package/docs/contracts/api-interface.md +793 -0
- package/docs/data-model.md +476 -0
- package/docs/gun-async-usage.md +338 -0
- package/docs/plan.md +349 -0
- package/docs/quickstart.md +674 -0
- package/docs/research.md +362 -0
- package/docs/spec.md +244 -0
- package/docs/storage-backends.md +326 -0
- package/docs/tasks.md +947 -0
- package/examples/demo.html +47 -0
- package/examples/holosphere-widget.js +1242 -0
- package/examples/widget-demo.html +274 -0
- package/examples/widget.html +703 -0
- package/jsdoc.json +26 -0
- package/package.json +25 -7
- package/src/ai/aggregation.js +13 -2
- package/src/ai/breakdown.js +12 -2
- package/src/ai/classifier.js +14 -3
- package/src/ai/council.js +22 -7
- package/src/ai/embeddings.js +37 -15
- package/src/ai/federation-ai.js +13 -2
- package/src/ai/h3-ai.js +14 -2
- package/src/ai/index.js +16 -7
- package/src/ai/json-ops.js +18 -5
- package/src/ai/llm-service.js +62 -31
- package/src/ai/nl-query.js +12 -2
- package/src/ai/relationships.js +13 -2
- package/src/ai/schema-extractor.js +24 -10
- package/src/ai/spatial.js +13 -2
- package/src/ai/tts.js +25 -8
- package/src/cdn-entry.js +22 -0
- package/src/content/social-protocols.js +34 -25
- package/src/contracts/abis/Appreciative.json +1280 -0
- package/src/contracts/abis/AppreciativeFactory.json +101 -0
- package/src/contracts/abis/Bundle.json +1438 -0
- package/src/contracts/abis/BundleFactory.json +106 -0
- package/src/contracts/abis/Holon.json +881 -0
- package/src/contracts/abis/Holons.json +330 -0
- package/src/contracts/abis/Managed.json +1262 -0
- package/src/contracts/abis/ManagedFactory.json +149 -0
- package/src/contracts/abis/Membrane.json +261 -0
- package/src/contracts/abis/Splitter.json +1624 -0
- package/src/contracts/abis/SplitterFactory.json +220 -0
- package/src/contracts/abis/TestToken.json +321 -0
- package/src/contracts/abis/Zoned.json +1461 -0
- package/src/contracts/abis/ZonedFactory.json +154 -0
- package/src/contracts/chain-manager.js +403 -0
- package/src/contracts/deployer.js +500 -0
- package/src/contracts/event-listener.js +539 -0
- package/src/contracts/holon-contracts.js +359 -0
- package/src/contracts/index.js +82 -0
- package/src/contracts/networks.js +229 -0
- package/src/contracts/operations.js +687 -0
- package/src/contracts/queries.js +638 -0
- package/src/core/holosphere.js +487 -6
- package/src/crypto/nostr-utils.js +303 -0
- package/src/crypto/secp256k1.js +7 -2
- package/src/federation/handshake.js +475 -0
- package/src/federation/hologram.js +117 -3
- package/src/hierarchical/upcast.js +40 -25
- package/src/index.js +1501 -1909
- package/src/lib/ai-methods.js +657 -0
- package/src/lib/contract-methods.js +442 -0
- package/src/lib/errors.js +53 -0
- package/src/lib/federation-methods.js +345 -0
- package/src/lib/index.js +30 -0
- package/src/schema/validator.js +22 -3
- package/src/spatial/h3-operations.js +19 -3
- package/src/storage/backend-factory.js +7 -2
- package/src/storage/backend-interface.js +21 -2
- package/src/storage/backends/activitypub/server.js +25 -3
- package/src/storage/backends/activitypub-backend.js +25 -2
- package/src/storage/backends/gundb-backend.js +692 -50
- package/src/storage/backends/nostr-backend.js +116 -1
- package/src/storage/filesystem-storage-browser.js +42 -2
- package/src/storage/filesystem-storage.js +72 -5
- package/src/storage/global-tables.js +35 -3
- package/src/storage/gun-async.js +75 -15
- package/src/storage/gun-auth.js +373 -0
- package/src/storage/gun-federation.js +785 -0
- package/src/storage/gun-references.js +209 -0
- package/src/storage/gun-schema.js +306 -0
- package/src/storage/gun-wrapper.js +475 -54
- package/src/storage/indexeddb-storage.js +112 -13
- package/src/storage/key-storage-simple.js +32 -9
- package/src/storage/key-storage.js +45 -13
- package/src/storage/memory-storage.js +68 -2
- package/src/storage/migration.js +20 -7
- package/src/storage/nostr-async.js +412 -122
- package/src/storage/nostr-client.js +749 -76
- package/src/storage/nostr-wrapper.js +6 -2
- package/src/storage/outbox-queue.js +55 -18
- package/src/storage/persistent-storage.js +62 -14
- package/src/storage/sync-service.js +51 -17
- package/src/storage/unified-storage.js +154 -0
- package/src/subscriptions/manager.js +34 -17
- package/types/index.d.ts +133 -0
- package/vite.config.cdn.js +60 -0
- package/tests/unit/ai/aggregation.test.js +0 -295
- package/tests/unit/ai/breakdown.test.js +0 -446
- package/tests/unit/ai/classifier.test.js +0 -294
- package/tests/unit/ai/council.test.js +0 -262
- package/tests/unit/ai/embeddings.test.js +0 -384
- package/tests/unit/ai/federation-ai.test.js +0 -344
- package/tests/unit/ai/h3-ai.test.js +0 -458
- package/tests/unit/ai/index.test.js +0 -304
- package/tests/unit/ai/json-ops.test.js +0 -307
- package/tests/unit/ai/llm-service.test.js +0 -390
- package/tests/unit/ai/nl-query.test.js +0 -383
- package/tests/unit/ai/relationships.test.js +0 -311
- package/tests/unit/ai/schema-extractor.test.js +0 -384
- package/tests/unit/ai/spatial.test.js +0 -279
- package/tests/unit/ai/tts.test.js +0 -279
- package/tests/unit/content.test.js +0 -332
- package/tests/unit/contract/core.test.js +0 -88
- package/tests/unit/contract/crypto.test.js +0 -198
- package/tests/unit/contract/data.test.js +0 -223
- package/tests/unit/contract/federation.test.js +0 -181
- package/tests/unit/contract/hierarchical.test.js +0 -113
- package/tests/unit/contract/schema.test.js +0 -114
- package/tests/unit/contract/social.test.js +0 -217
- package/tests/unit/contract/spatial.test.js +0 -110
- package/tests/unit/contract/subscriptions.test.js +0 -128
- package/tests/unit/contract/utils.test.js +0 -159
- package/tests/unit/core.test.js +0 -152
- package/tests/unit/crypto.test.js +0 -328
- package/tests/unit/federation.test.js +0 -234
- package/tests/unit/gun-async.test.js +0 -252
- package/tests/unit/hierarchical.test.js +0 -399
- package/tests/unit/integration/scenario-01-geographic-storage.test.js +0 -74
- package/tests/unit/integration/scenario-02-federation.test.js +0 -76
- package/tests/unit/integration/scenario-03-subscriptions.test.js +0 -102
- package/tests/unit/integration/scenario-04-validation.test.js +0 -129
- package/tests/unit/integration/scenario-05-hierarchy.test.js +0 -125
- package/tests/unit/integration/scenario-06-social.test.js +0 -135
- package/tests/unit/integration/scenario-07-persistence.test.js +0 -130
- package/tests/unit/integration/scenario-08-authorization.test.js +0 -161
- package/tests/unit/integration/scenario-09-cross-dimensional.test.js +0 -139
- package/tests/unit/integration/scenario-10-cross-holosphere-capabilities.test.js +0 -357
- package/tests/unit/integration/scenario-11-cross-holosphere-federation.test.js +0 -410
- package/tests/unit/integration/scenario-12-capability-federated-read.test.js +0 -719
- package/tests/unit/performance/benchmark.test.js +0 -85
- package/tests/unit/schema.test.js +0 -213
- package/tests/unit/spatial.test.js +0 -158
- package/tests/unit/storage.test.js +0 -195
- package/tests/unit/subscriptions.test.js +0 -328
- package/tests/unit/test-data-permanence-debug.js +0 -197
- package/tests/unit/test-data-permanence.js +0 -340
- package/tests/unit/test-key-persistence-fixed.js +0 -148
- package/tests/unit/test-key-persistence.js +0 -172
- package/tests/unit/test-relay-permanence.js +0 -376
- package/tests/unit/test-second-node.js +0 -95
- package/tests/unit/test-simple-write.js +0 -89
- /package/{cleanup-test-data.js → scripts/cleanup-test-data.js} +0 -0
- /package/{test-ai-real-api.js → scripts/test-ai-real-api.js} +0 -0
package/docs/research.md
ADDED
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
# Phase 0: Research & Technical Decisions
|
|
2
|
+
|
|
3
|
+
**Feature**: HoloSphere - Holonic Geospatial Communication Infrastructure
|
|
4
|
+
**Date**: 2025-10-07
|
|
5
|
+
**Status**: Complete
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
This document captures technical research and decisions for implementing HoloSphere, a JavaScript library combining H3 hexagonal geospatial indexing with GunDB distributed P2P storage. All technical context items have been resolved through specification clarifications and architectural planning.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 1. Core Technology Stack
|
|
13
|
+
|
|
14
|
+
### Decision: JavaScript (ES2020+) with Node.js 18+ and Modern Browsers
|
|
15
|
+
**Rationale**:
|
|
16
|
+
- JavaScript provides native cross-platform support for both Node.js and browser environments
|
|
17
|
+
- ES2020+ features (optional chaining, nullish coalescing, dynamic imports) improve code quality
|
|
18
|
+
- Node.js 18+ provides stable LTS support with modern ECMAScript features
|
|
19
|
+
- Modern browsers universally support ES6 modules for tree-shaking and efficient bundling
|
|
20
|
+
|
|
21
|
+
**Alternatives Considered**:
|
|
22
|
+
- TypeScript: Adds type safety but increases build complexity; decided to provide TypeScript definitions (.d.ts) without full TS implementation
|
|
23
|
+
- Rust/WASM: Better performance but increases bundle size and reduces accessibility for JavaScript developers
|
|
24
|
+
|
|
25
|
+
**Implementation Notes**:
|
|
26
|
+
- Use ESM as primary module format with CommonJS compatibility via build tooling
|
|
27
|
+
- Leverage dynamic imports for lazy loading of crypto operations
|
|
28
|
+
- Target ES2020 for broad compatibility while enabling modern features
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 2. Geospatial Indexing
|
|
33
|
+
|
|
34
|
+
### Decision: h3-js Library for H3 Hexagonal Grid Operations
|
|
35
|
+
**Rationale**:
|
|
36
|
+
- Official Uber H3 JavaScript implementation with proven reliability
|
|
37
|
+
- Supports all 16 resolution levels (0-15) covering global to ~1m² precision
|
|
38
|
+
- Provides efficient parent-child hierarchy operations for scalespace queries
|
|
39
|
+
- Active maintenance and comprehensive documentation
|
|
40
|
+
|
|
41
|
+
**Alternatives Considered**:
|
|
42
|
+
- Custom H3 implementation: Unnecessary complexity, error-prone
|
|
43
|
+
- S2 geometry: Less mature JavaScript ecosystem, less intuitive hexagonal structure
|
|
44
|
+
- Geohash: Irregular cell boundaries, poor hierarchical properties compared to hexagons
|
|
45
|
+
|
|
46
|
+
**Key Operations**:
|
|
47
|
+
- `geoToH3()`: Convert lat/lng to H3 cell ID
|
|
48
|
+
- `h3ToParent()`: Navigate up hierarchy for upcast operations
|
|
49
|
+
- `h3ToChildren()`: Navigate down hierarchy for drill-down queries
|
|
50
|
+
- `h3IsValid()`: Validate H3 format (must start with '8', ≥15 chars)
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 3. Distributed Storage
|
|
55
|
+
|
|
56
|
+
### Decision: GunDB with Radisk Adapter
|
|
57
|
+
**Rationale**:
|
|
58
|
+
- GunDB provides decentralized P2P architecture without central servers (constitutional requirement)
|
|
59
|
+
- Built-in real-time synchronization and reactive subscriptions
|
|
60
|
+
- Radisk adapter ensures local-first persistence (IndexedDB in browser, filesystem in Node.js)
|
|
61
|
+
- Eventual consistency with conflict resolution (last-write-wins) aligns with federation requirements
|
|
62
|
+
|
|
63
|
+
**Alternatives Considered**:
|
|
64
|
+
- OrbitDB: More complex setup, less mature ecosystem
|
|
65
|
+
- Automerge: Excellent CRDT support but larger bundle size, narrower use case
|
|
66
|
+
- Custom WebRTC + IndexedDB: Too much complexity to build from scratch
|
|
67
|
+
|
|
68
|
+
**Implementation Strategy**:
|
|
69
|
+
- Initialize GunDB with radisk adapter by default in all environments
|
|
70
|
+
- Configure peer connections for distributed sync (optional central relays for NAT traversal)
|
|
71
|
+
- Use Gun's graph structure for natural holon/lens/data hierarchy
|
|
72
|
+
- Path structure: `appname.holon.lens.key` maps to Gun graph nodes
|
|
73
|
+
|
|
74
|
+
**Radisk Configuration**:
|
|
75
|
+
```javascript
|
|
76
|
+
// Browser
|
|
77
|
+
Gun({ radisk: true })
|
|
78
|
+
|
|
79
|
+
// Node.js
|
|
80
|
+
Gun({ file: 'data/holosphere' })
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 4. Cryptographic Operations
|
|
86
|
+
|
|
87
|
+
### Decision: @noble/curves for secp256k1 Operations
|
|
88
|
+
**Rationale**:
|
|
89
|
+
- Industry-standard secp256k1 curve (same as Bitcoin, Ethereum, Nostr)
|
|
90
|
+
- Lightweight, audited implementation with no native dependencies
|
|
91
|
+
- Supports signing, verification, key derivation
|
|
92
|
+
- Lazy initialization reduces startup cost when crypto features not immediately needed
|
|
93
|
+
|
|
94
|
+
**Alternatives Considered**:
|
|
95
|
+
- elliptic.js: Larger bundle size, less actively maintained
|
|
96
|
+
- Native Web Crypto API: Limited to P-256 curve, doesn't support secp256k1
|
|
97
|
+
- noble-secp256k1 (standalone): @noble/curves supersedes this with better ergonomics
|
|
98
|
+
|
|
99
|
+
**Cryptographic Features**:
|
|
100
|
+
- Content signing (Nostr/ActivityPub protocol support)
|
|
101
|
+
- Capability token generation and verification
|
|
102
|
+
- Password-based holon access control (combined with Gun's SEA module)
|
|
103
|
+
- Lazy loading via dynamic imports to avoid initialization cost
|
|
104
|
+
|
|
105
|
+
**Bundle Impact**: ~30KB minified+gzipped for secp256k1 operations
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 5. Schema Validation
|
|
110
|
+
|
|
111
|
+
### Decision: Ajv (Another JSON Schema Validator)
|
|
112
|
+
**Rationale**:
|
|
113
|
+
- Industry standard for JSON Schema validation
|
|
114
|
+
- Supports JSON Schema 2019 draft (constitutional requirement)
|
|
115
|
+
- Fast performance through JIT compilation
|
|
116
|
+
- Small bundle size (~50KB minified+gzipped)
|
|
117
|
+
- Supports custom error messages and formats
|
|
118
|
+
|
|
119
|
+
**Alternatives Considered**:
|
|
120
|
+
- joi: More focused on runtime validation, less standard schema format
|
|
121
|
+
- yup: Similar to joi, lacks JSON Schema compatibility
|
|
122
|
+
- Custom validation: Reinventing the wheel, missing edge cases
|
|
123
|
+
|
|
124
|
+
**Implementation Strategy**:
|
|
125
|
+
- Cache compiled schemas with 1-hour TTL (configurable)
|
|
126
|
+
- Provide strict mode (blocking) and permissive mode (logging only)
|
|
127
|
+
- Schema storage: Schemas stored in Gun alongside data for decentralized distribution
|
|
128
|
+
- Per-lens schemas with independent validation rules
|
|
129
|
+
|
|
130
|
+
**Cache Design**:
|
|
131
|
+
```javascript
|
|
132
|
+
const schemaCache = new Map(); // key: lens name, value: { validator, timestamp }
|
|
133
|
+
const CACHE_TTL = 3600000; // 1 hour in milliseconds
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## 6. Testing Framework
|
|
139
|
+
|
|
140
|
+
### Decision: Vitest for Unit and Integration Testing
|
|
141
|
+
**Rationale**:
|
|
142
|
+
- Fast, Vite-powered test runner with excellent DX
|
|
143
|
+
- Native ESM support (no transpilation needed)
|
|
144
|
+
- Compatible with Jest API (familiar patterns)
|
|
145
|
+
- Built-in code coverage reporting
|
|
146
|
+
- Supports both Node.js and browser environment testing
|
|
147
|
+
|
|
148
|
+
**Alternatives Considered**:
|
|
149
|
+
- Jest: Slower, requires transpilation for ESM, heavier dependency footprint
|
|
150
|
+
- Mocha + Chai: Requires more configuration, less integrated tooling
|
|
151
|
+
- uvu: Lightweight but less feature-complete
|
|
152
|
+
|
|
153
|
+
**Test Organization**:
|
|
154
|
+
- **Unit tests**: One test file per feature module (tests/unit/*.test.js)
|
|
155
|
+
- **Integration tests**: Cross-module scenarios (tests/integration/*.test.js)
|
|
156
|
+
- **Contract tests**: API surface validation (tests/contract/*.test.js)
|
|
157
|
+
|
|
158
|
+
**Coverage Requirements**: ≥80% line coverage per constitutional mandate for reliability
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## 7. Build and Distribution
|
|
163
|
+
|
|
164
|
+
### Decision: Multi-format Build (ESM, CommonJS, CDN)
|
|
165
|
+
**Rationale**:
|
|
166
|
+
- ESM provides tree-shaking for optimal bundle sizes
|
|
167
|
+
- CommonJS ensures compatibility with legacy Node.js tools
|
|
168
|
+
- CDN bundle enables direct browser usage without build tools
|
|
169
|
+
|
|
170
|
+
**Build Tools**:
|
|
171
|
+
- **Vite**: Fast ESM-native bundler for development and production builds
|
|
172
|
+
- **Rollup** (via Vite): Bundle optimization and multi-format output
|
|
173
|
+
- **terser**: Minification for production builds
|
|
174
|
+
|
|
175
|
+
**Output Formats**:
|
|
176
|
+
```
|
|
177
|
+
dist/
|
|
178
|
+
├── esm/ # ES modules (primary, tree-shakeable)
|
|
179
|
+
│ └── holosphere.js
|
|
180
|
+
├── cjs/ # CommonJS (Node.js compatibility)
|
|
181
|
+
│ └── holosphere.cjs
|
|
182
|
+
└── cdn/ # UMD bundle with all dependencies
|
|
183
|
+
└── holosphere.min.js # <1MB minified+gzipped target
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Package.json Configuration**:
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"type": "module",
|
|
190
|
+
"main": "./dist/cjs/holosphere.cjs",
|
|
191
|
+
"module": "./dist/esm/holosphere.js",
|
|
192
|
+
"browser": "./dist/cdn/holosphere.min.js",
|
|
193
|
+
"exports": {
|
|
194
|
+
".": {
|
|
195
|
+
"import": "./dist/esm/holosphere.js",
|
|
196
|
+
"require": "./dist/cjs/holosphere.cjs"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## 8. Performance Optimization Strategies
|
|
205
|
+
|
|
206
|
+
### Lazy Initialization
|
|
207
|
+
**Decision**: Defer expensive operations until first use
|
|
208
|
+
**Implementation**:
|
|
209
|
+
- Crypto module loaded via dynamic import on first signature operation
|
|
210
|
+
- Schema validator compiled on first validation request
|
|
211
|
+
- H3 library loaded upfront (small footprint, core functionality)
|
|
212
|
+
|
|
213
|
+
### Caching Strategy
|
|
214
|
+
**Decision**: Multi-level caching with configurable TTLs
|
|
215
|
+
**Caches**:
|
|
216
|
+
1. **Schema cache**: Compiled validators (1-hour TTL)
|
|
217
|
+
2. **Hologram resolution cache**: Recently resolved references (5-minute TTL)
|
|
218
|
+
3. **H3 parent hierarchy cache**: Precomputed parent chains (permanent, small memory footprint)
|
|
219
|
+
|
|
220
|
+
### Bundle Size Optimization
|
|
221
|
+
**Target**: <1MB minified+gzipped including all dependencies
|
|
222
|
+
**Techniques**:
|
|
223
|
+
- Tree-shakeable ESM exports (only import what you use)
|
|
224
|
+
- Lazy loading of crypto and validation modules
|
|
225
|
+
- Efficient dependency selection (prefer smaller, focused libraries)
|
|
226
|
+
- Code splitting for advanced features (social protocol integrations)
|
|
227
|
+
|
|
228
|
+
**Estimated Bundle Breakdown**:
|
|
229
|
+
- Core + Spatial: ~100KB
|
|
230
|
+
- GunDB + Radisk: ~400KB
|
|
231
|
+
- H3-js: ~150KB
|
|
232
|
+
- @noble/curves (lazy): ~30KB
|
|
233
|
+
- Ajv (lazy): ~50KB
|
|
234
|
+
- Social protocols (lazy): ~100KB
|
|
235
|
+
- **Total (full feature set)**: ~830KB minified+gzipped ✅
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## 9. Social Protocol Integration
|
|
240
|
+
|
|
241
|
+
### Decision: Pluggable Protocol Adapters for Nostr and ActivityPub
|
|
242
|
+
**Rationale**:
|
|
243
|
+
- Unified interface masks protocol differences
|
|
244
|
+
- Extensible design allows future protocol additions
|
|
245
|
+
- Lazy loading keeps base bundle small for users who don't need social features
|
|
246
|
+
|
|
247
|
+
**Nostr Integration**:
|
|
248
|
+
- Event signing with secp256k1 (NIP-01)
|
|
249
|
+
- Event validation and signature verification
|
|
250
|
+
- Stigmergic access levels via tag filtering
|
|
251
|
+
|
|
252
|
+
**ActivityPub Integration**:
|
|
253
|
+
- JSON-LD signature verification
|
|
254
|
+
- Actor/Object model mapping to HoloSphere entities
|
|
255
|
+
- HTTP signatures for authenticated federation
|
|
256
|
+
|
|
257
|
+
**Common Interface**:
|
|
258
|
+
```javascript
|
|
259
|
+
class SocialProtocol {
|
|
260
|
+
async sign(content, privateKey) { /* ... */ }
|
|
261
|
+
async verify(content, signature, publicKey) { /* ... */ }
|
|
262
|
+
toHolosphereFormat(protocolContent) { /* ... */ }
|
|
263
|
+
fromHolosphereFormat(holosphereContent) { /* ... */ }
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## 10. Development Workflow
|
|
270
|
+
|
|
271
|
+
### Decision: Standard npm-based Development Workflow
|
|
272
|
+
**Rationale**:
|
|
273
|
+
- Familiar to JavaScript developers
|
|
274
|
+
- Excellent tooling ecosystem
|
|
275
|
+
- Easy CI/CD integration
|
|
276
|
+
|
|
277
|
+
**Scripts**:
|
|
278
|
+
```json
|
|
279
|
+
{
|
|
280
|
+
"scripts": {
|
|
281
|
+
"dev": "vite",
|
|
282
|
+
"build": "vite build",
|
|
283
|
+
"test": "vitest",
|
|
284
|
+
"test:coverage": "vitest --coverage",
|
|
285
|
+
"lint": "eslint src/**/*.js",
|
|
286
|
+
"format": "prettier --write src/**/*.js"
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**Quality Gates**:
|
|
292
|
+
- ESLint for code quality
|
|
293
|
+
- Prettier for consistent formatting
|
|
294
|
+
- Vitest coverage threshold (≥80%)
|
|
295
|
+
- Pre-commit hooks via husky (optional)
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## 11. Cross-Dimensional Federation
|
|
300
|
+
|
|
301
|
+
### Decision: URI/URL Scheme for Noospheric Holons
|
|
302
|
+
**Rationale**:
|
|
303
|
+
- Extends federation beyond geographic space into conceptual dimensions
|
|
304
|
+
- Enables external namespace integration (e.g., `nostr://topic/123`, `ap://community/abc`)
|
|
305
|
+
- Maintains architectural consistency with geographic holons
|
|
306
|
+
|
|
307
|
+
**Noospheric Holon Patterns**:
|
|
308
|
+
- Protocol-specific: `nostr://topic/{topicId}`, `ap://community/{communityId}`
|
|
309
|
+
- Custom schemes: `concept://{namespace}/{id}`, `idea://{domain}/{id}`
|
|
310
|
+
- URI validation follows RFC 3986 for consistency
|
|
311
|
+
|
|
312
|
+
**Federation Behavior**:
|
|
313
|
+
- Same federation mechanics as geographic holons (bidirectional, lens-specific)
|
|
314
|
+
- Cross-dimensional links: Geographic holon ↔ Noospheric holon federation
|
|
315
|
+
- Reference-based propagation (holograms) maintains single source of truth
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## 12. Error Handling and Observability
|
|
320
|
+
|
|
321
|
+
### Decision: Structured Logging with JSON Format
|
|
322
|
+
**Rationale**:
|
|
323
|
+
- Machine-parseable logs enable automated monitoring
|
|
324
|
+
- Configurable verbosity levels (ERROR, WARN, INFO, DEBUG)
|
|
325
|
+
- Metrics collection for operation counts and timing
|
|
326
|
+
|
|
327
|
+
**Logging Interface**:
|
|
328
|
+
```javascript
|
|
329
|
+
logger.error({ event: 'validation_failed', lens: 'events', error: err.message });
|
|
330
|
+
logger.warn({ event: 'schema_cache_miss', lens: 'temperature' });
|
|
331
|
+
logger.info({ event: 'federation_established', from: h3_1, to: h3_2 });
|
|
332
|
+
logger.debug({ event: 'hologram_resolved', id: 'xyz', depth: 2 });
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
**Metrics**:
|
|
336
|
+
- Operation counters (writes, reads, federations, subscriptions)
|
|
337
|
+
- Timing histograms (validation duration, hologram resolution time)
|
|
338
|
+
- Error rates by operation type
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## Summary of Resolved Technical Decisions
|
|
343
|
+
|
|
344
|
+
| Area | Decision | Rationale |
|
|
345
|
+
|------|----------|-----------|
|
|
346
|
+
| **Language** | JavaScript ES2020+ | Cross-platform, modern features, broad ecosystem |
|
|
347
|
+
| **Runtime** | Node.js 18+ & modern browsers | LTS support, universal compatibility |
|
|
348
|
+
| **Geospatial** | h3-js | Official H3 implementation, proven reliability |
|
|
349
|
+
| **Storage** | GunDB + Radisk | P2P architecture, local-first, real-time sync |
|
|
350
|
+
| **Crypto** | @noble/curves (secp256k1) | Industry standard, lightweight, audited |
|
|
351
|
+
| **Validation** | Ajv (JSON Schema 2019) | Standard-compliant, fast, small footprint |
|
|
352
|
+
| **Testing** | Vitest | Fast, ESM-native, excellent DX |
|
|
353
|
+
| **Build** | Vite + Rollup | Multi-format output, tree-shaking, optimization |
|
|
354
|
+
| **Bundle** | <1MB minified+gzipped | Lazy loading, efficient dependencies |
|
|
355
|
+
| **Logging** | Structured JSON | Machine-parseable, multi-level verbosity |
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## Next Steps
|
|
360
|
+
|
|
361
|
+
✅ All technical context items resolved - no NEEDS CLARIFICATION remaining
|
|
362
|
+
➡️ Proceed to Phase 1: Design & Contracts
|
package/docs/spec.md
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# Feature Specification: HoloSphere - Holonic Geospatial Communication Infrastructure
|
|
2
|
+
|
|
3
|
+
**Feature Branch**: `001-holosphere-holonic-geospatial`
|
|
4
|
+
**Created**: 2025-10-06
|
|
5
|
+
**Status**: Draft
|
|
6
|
+
**Input**: User description: "HoloSphere Technical Specification & API Reference - A JavaScript library implementing holonic geospatial communication infrastructure by combining H3 hexagonal geospatial indexing with GunDB distributed peer-to-peer storage."
|
|
7
|
+
|
|
8
|
+
## Execution Flow (main)
|
|
9
|
+
```
|
|
10
|
+
1. Parse user description from Input
|
|
11
|
+
→ If empty: ERROR "No feature description provided"
|
|
12
|
+
2. Extract key concepts from description
|
|
13
|
+
→ Identified: holonic architecture, H3 geospatial indexing, GunDB P2P storage, lenses, federation
|
|
14
|
+
3. For each unclear aspect:
|
|
15
|
+
→ No major ambiguities - technical specification provided
|
|
16
|
+
4. Fill User Scenarios & Testing section
|
|
17
|
+
→ User flows: spatial data management, federation, real-time subscriptions
|
|
18
|
+
5. Generate Functional Requirements
|
|
19
|
+
→ Each requirement must be testable
|
|
20
|
+
6. Identify Key Entities (if data involved)
|
|
21
|
+
7. Run Review Checklist
|
|
22
|
+
→ Spec focuses on user needs, avoids implementation details
|
|
23
|
+
8. Return: SUCCESS (spec ready for planning)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## ⚡ Quick Guidelines
|
|
29
|
+
- ✅ Focus on WHAT users need and WHY
|
|
30
|
+
- ❌ Avoid HOW to implement (no tech stack, APIs, code structure)
|
|
31
|
+
- 👥 Written for business stakeholders, not developers
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## User Scenarios & Testing *(mandatory)*
|
|
36
|
+
|
|
37
|
+
### Primary User Story
|
|
38
|
+
Developers need to build distributed applications where data is organized by location - both geographic (physical space) and noospheric (conceptual space). Data is stored in holons, categorized into different types (lenses), and can be shared between locations (federation). The system must support multi-scale geographic operations from global to hyper-local (building-level) precision, enable federation across dimensions (linking geographic locations with conceptual spaces), support real-time data synchronization, and work in offline/distributed environments without central servers. While geographic space is inherently federated through spatial hierarchy, the noosphere enables organization by ideas, concepts, and relationships beyond physical constraints.
|
|
39
|
+
|
|
40
|
+
### Acceptance Scenarios
|
|
41
|
+
|
|
42
|
+
1. **Given** a geographic coordinate (latitude/longitude) and desired precision level, **When** a user stores data at that location, **Then** the data is stored in the appropriate geographic cell and retrievable by location and data category
|
|
43
|
+
|
|
44
|
+
2. **Given** data stored in a local geographic area, **When** that area federates with a larger region, **Then** data automatically propagates to the regional level while maintaining a single source of truth
|
|
45
|
+
|
|
46
|
+
3. **Given** multiple applications using the same geographic coordinate system, **When** they subscribe to changes in a geographic area, **Then** they receive real-time updates when data changes in that location
|
|
47
|
+
|
|
48
|
+
4. **Given** data with specific validation rules (schema), **When** invalid data is submitted, **Then** the system prevents storage in strict mode or logs warnings in permissive mode
|
|
49
|
+
|
|
50
|
+
5. **Given** hierarchical geographic areas (city → state → country → global), **When** local data is created, **Then** references automatically propagate up the hierarchy enabling multi-scale queries
|
|
51
|
+
|
|
52
|
+
6. **Given** social content published in a geographic area, **When** users interact across different protocols (Nostr, ActivityPub), **Then** content is accessible and verifiable across protocol boundaries
|
|
53
|
+
|
|
54
|
+
7. **Given** data has been written to a holon, **When** the application crashes or browser tab closes before sync, **Then** all confirmed writes are recoverable from radisk persistence on restart with no data loss
|
|
55
|
+
|
|
56
|
+
8. **Given** a user attempts to delete data created by another user, **When** the delete operation is called without a valid capability token with delete permission, **Then** the system rejects the operation and returns an authorization error
|
|
57
|
+
|
|
58
|
+
### Edge Cases
|
|
59
|
+
- What happens when network connectivity is lost? (System must continue operating locally with radisk persistence and sync when reconnected)
|
|
60
|
+
- How does the system handle conflicting data in federated holons? (Last-write-wins with GunDB conflict resolution, no data loss)
|
|
61
|
+
- What happens when a hologram reference points to deleted data? (Returns null gracefully)
|
|
62
|
+
- How does the system prevent infinite loops in nested holograms? (Tracks visited references during resolution)
|
|
63
|
+
- What happens when schema validation changes after data is stored? (Existing data grandfathered, new data validated against current schema)
|
|
64
|
+
- What happens if a write operation fails before disk persistence? (Write is retried or error returned; success indicator only after confirmed disk write)
|
|
65
|
+
- What happens during browser tab closure or app crash? (All data persisted to radisk remains intact and recoverable on restart)
|
|
66
|
+
- What happens when someone tries to delete data they don't own? (Delete operation rejected with authorization error unless valid capability token with delete permission provided)
|
|
67
|
+
- What happens when a capability token expires during a delete operation? (Operation rejected; token must be valid at time of execution)
|
|
68
|
+
|
|
69
|
+
## Requirements *(mandatory)*
|
|
70
|
+
|
|
71
|
+
### Functional Requirements
|
|
72
|
+
|
|
73
|
+
**Spatial Data Management**
|
|
74
|
+
- **FR-001**: System MUST convert geographic coordinates (latitude/longitude) to hexagonal grid cells at 16 different resolution levels (global to ~1m²)
|
|
75
|
+
- **FR-002**: System MUST organize all data using geographic location as primary key (holon)
|
|
76
|
+
- **FR-003**: System MUST support hierarchical parent-child relationships between geographic cells automatically
|
|
77
|
+
- **FR-004**: System MUST enable querying all parent cells containing a given location (scalespace)
|
|
78
|
+
|
|
79
|
+
**Data Organization & Storage**
|
|
80
|
+
- **FR-005**: System MUST support categorical organization of data within each location (lenses)
|
|
81
|
+
- **FR-006**: System MUST store data in a structured path format: application/location/category/identifier (where location can be H3 cell ID or URI/URL for noospheric holons)
|
|
82
|
+
- **FR-007**: System MUST generate unique identifiers automatically if not provided
|
|
83
|
+
- **FR-008**: System MUST support optional metadata including timestamps and resolution tracking
|
|
84
|
+
|
|
85
|
+
**Schema & Validation**
|
|
86
|
+
- **FR-009**: System MUST support JSON Schema validation (2019 draft) for data categories
|
|
87
|
+
- **FR-010**: System MUST provide both strict validation mode (blocking) and permissive mode (logging only)
|
|
88
|
+
- **FR-011**: System MUST cache schemas with configurable time-to-live for performance
|
|
89
|
+
- **FR-012**: Users MUST be able to define, retrieve, and clear validation schemas per data category
|
|
90
|
+
|
|
91
|
+
**Reference System (Holograms)**
|
|
92
|
+
- **FR-013**: System MUST support lightweight references (holograms) instead of data duplication
|
|
93
|
+
- **FR-014**: System MUST automatically resolve references to actual data when retrieved
|
|
94
|
+
- **FR-015**: System MUST detect and prevent infinite loops in nested references
|
|
95
|
+
- **FR-016**: System MUST support both automatic and manual reference resolution
|
|
96
|
+
|
|
97
|
+
**Federation**
|
|
98
|
+
- **FR-017**: System MUST enable bidirectional data sharing between geographic locations
|
|
99
|
+
- **FR-018**: System MUST support selective federation by data category (lens-specific)
|
|
100
|
+
- **FR-019**: System MUST support both inbound (receive) and outbound (send) federation configuration
|
|
101
|
+
- **FR-020**: System MUST propagate data to federated locations automatically by default
|
|
102
|
+
- **FR-021**: System MUST use references (not copies) when propagating to federated locations by default
|
|
103
|
+
- **FR-022**: Users MUST be able to query combined local and federated data with automatic deduplication
|
|
104
|
+
- **FR-023**: System MUST support federation beyond geographic space into conceptual/noospheric dimensions
|
|
105
|
+
- **FR-024**: System MUST enable cross-dimensional linking where holons can federate across both spatial and non-spatial organizational schemes
|
|
106
|
+
|
|
107
|
+
**Hierarchical Aggregation**
|
|
108
|
+
- **FR-025**: System MUST support automatic propagation of data to parent geographic cells (upcast)
|
|
109
|
+
- **FR-026**: System MUST support aggregation operations (summarize, aggregate, concatenate) across hierarchy levels
|
|
110
|
+
- **FR-027**: System MUST limit hierarchical propagation to configurable maximum levels
|
|
111
|
+
|
|
112
|
+
**Real-time Subscriptions**
|
|
113
|
+
- **FR-028**: System MUST enable real-time subscriptions to changes in specific location/category combinations
|
|
114
|
+
- **FR-029**: System MUST invoke callbacks when subscribed data changes
|
|
115
|
+
- **FR-030**: Users MUST be able to unsubscribe from real-time updates
|
|
116
|
+
- **FR-031**: System MUST support federation-specific subscriptions with lens filtering and throttling
|
|
117
|
+
|
|
118
|
+
**Distributed Storage**
|
|
119
|
+
- **FR-032**: System MUST operate in peer-to-peer mode without requiring central servers
|
|
120
|
+
- **FR-033**: System MUST support local-first operation with automatic synchronization
|
|
121
|
+
- **FR-034**: System MUST persist data locally by default using GunDB with radisk storage
|
|
122
|
+
- **FR-035**: System MUST support configurable peer connections for distributed sync
|
|
123
|
+
- **FR-069**: System MUST use radisk storage adapter in both npm package and CDN bundle versions
|
|
124
|
+
- **FR-070**: System MUST ensure write operations are persisted to disk before returning success
|
|
125
|
+
- **FR-071**: System MUST prevent data loss through automatic conflict resolution and synchronization
|
|
126
|
+
- **FR-072**: System MUST maintain data integrity during network partitions and offline periods
|
|
127
|
+
|
|
128
|
+
**Access Control & Security**
|
|
129
|
+
- **FR-036**: System MUST support optional password-based access control per geographic location
|
|
130
|
+
- **FR-037**: System MUST support cryptographic signatures for content verification to prevent data tampering
|
|
131
|
+
- **FR-038**: System MUST issue and verify capability tokens for authorization
|
|
132
|
+
- **FR-039**: System MUST support stigmergic (indirect coordination) access control levels
|
|
133
|
+
- **FR-066**: System MUST enforce capability token expiration to prevent unauthorized access
|
|
134
|
+
- **FR-067**: System MUST prevent replay attacks on signed content and capability tokens
|
|
135
|
+
- **FR-068**: System MUST provide basic DoS protection through rate limiting and resource constraints
|
|
136
|
+
- **FR-074**: System MUST require valid capability token with delete permission to delete data created by others
|
|
137
|
+
- **FR-075**: System MUST allow data creators to delete their own data without additional authorization
|
|
138
|
+
- **FR-076**: System MUST verify data ownership or capability token before processing delete operations
|
|
139
|
+
- **FR-077**: System MUST reject delete operations that lack proper authorization with clear error messages
|
|
140
|
+
|
|
141
|
+
**Cross-Protocol Support**
|
|
142
|
+
- **FR-040**: System MUST unify social protocols (Nostr, ActivityPub) under common interface
|
|
143
|
+
- **FR-041**: System MUST validate protocol-specific content formats
|
|
144
|
+
- **FR-042**: System MUST verify cryptographic signatures for social content
|
|
145
|
+
- **FR-043**: Users MUST be able to filter social content by protocol and access level
|
|
146
|
+
|
|
147
|
+
**Global Data Operations**
|
|
148
|
+
- **FR-044**: System MUST support non-location-specific data storage (global tables)
|
|
149
|
+
- **FR-045**: System MUST provide consistent CRUD operations for both location-specific and global data
|
|
150
|
+
|
|
151
|
+
**Performance & Efficiency**
|
|
152
|
+
- **FR-046**: System MUST initialize cryptographic components lazily (on first use)
|
|
153
|
+
- **FR-047**: System MUST cache frequently accessed data with configurable expiration
|
|
154
|
+
- **FR-048**: System MUST support batch operations to reduce network overhead
|
|
155
|
+
- **FR-049**: System MUST provide browser bundle size < 1 MB minified+gzipped including all dependencies
|
|
156
|
+
- **FR-061**: System MUST NOT enforce hard limits on data volume per holon (bounded only by available storage and network capacity)
|
|
157
|
+
|
|
158
|
+
**Error Handling & Reliability**
|
|
159
|
+
- **FR-050**: System MUST return boolean success indicators for state-changing operations
|
|
160
|
+
- **FR-051**: System MUST provide detailed error messages for federation failures
|
|
161
|
+
- **FR-052**: System MUST handle connection failures with retry logic
|
|
162
|
+
- **FR-053**: System MUST gracefully degrade when optional features are unavailable
|
|
163
|
+
|
|
164
|
+
**Observability**
|
|
165
|
+
- **FR-062**: System MUST provide structured logging in JSON format
|
|
166
|
+
- **FR-063**: System MUST capture metrics for operation counts and timing
|
|
167
|
+
- **FR-064**: System MUST support configurable log verbosity levels
|
|
168
|
+
- **FR-065**: System MUST log all errors, warnings, and significant state transitions
|
|
169
|
+
|
|
170
|
+
**Multi-Platform Support**
|
|
171
|
+
- **FR-054**: System MUST operate in Node.js server environments with radisk persistence
|
|
172
|
+
- **FR-055**: System MUST operate in browser environments with radisk persistence
|
|
173
|
+
- **FR-056**: System MUST be distributable via CDN for direct browser usage with radisk included
|
|
174
|
+
- **FR-057**: System MUST support both CommonJS and ES Module imports
|
|
175
|
+
- **FR-073**: Both npm and CDN distributions MUST include GunDB radisk adapter for data persistence
|
|
176
|
+
|
|
177
|
+
**Testing & Quality**
|
|
178
|
+
- **FR-058**: Every feature MUST have dedicated unit tests covering all core functionality
|
|
179
|
+
- **FR-059**: System MUST maintain test coverage for all public API methods
|
|
180
|
+
- **FR-060**: Tests MUST be organized by feature module with clear test isolation
|
|
181
|
+
|
|
182
|
+
### Key Entities
|
|
183
|
+
|
|
184
|
+
- **Holon**: Geographic location represented as H3 hexagonal cell OR conceptual location in noospheric space identified by URI/URL scheme (e.g., "nostr://topic/123", "ap://community/abc"); contains multiple lenses; supports hierarchical parent-child relationships (resolutions 0-15 for geographic); can be federated with other holons across both spatial and noospheric dimensions
|
|
185
|
+
|
|
186
|
+
- **Lens**: Data category within a holon (e.g., temperature, events, social content, ideas, concepts); has optional validation schema; has independent federation configuration; contains key-value data pairs; enables cross-dimensional organization
|
|
187
|
+
|
|
188
|
+
- **Data Object**: Individual data record within a lens; has required unique ID; has optional custom fields; has optional metadata (_meta with timestamp, resolution tracking); follows path structure: appname/holon/lens/key
|
|
189
|
+
|
|
190
|
+
- **Hologram**: Lightweight reference to data stored elsewhere; contains ID and soul path; automatically resolves to actual data; prevents data duplication; tracks visited references to prevent loops
|
|
191
|
+
|
|
192
|
+
- **Federation**: Bidirectional relationship between holons; has inbound lens configuration (what to receive); has outbound lens configuration (what to send); supports selective data sharing; uses holograms for propagation; enables cross-dimensional linking between geographic and noospheric holons
|
|
193
|
+
|
|
194
|
+
- **Schema**: JSON Schema (2019 draft) validation rules for a lens; cached with TTL; enforced in strict mode, logged in permissive mode; independently defined per lens
|
|
195
|
+
|
|
196
|
+
- **Subscription**: Real-time change notification for holon/lens combination; invokes callback on data changes; provides unsubscribe mechanism; supports throttling and filtering
|
|
197
|
+
|
|
198
|
+
- **Capability Token**: Cryptographic authorization token; grants specific permissions (read, write, delete, modify); has expiration timestamp; has designated recipient; uses Nostr signatures for verification; transferable between parties; required for delete operations on data created by others
|
|
199
|
+
|
|
200
|
+
- **Social Content**: Protocol-agnostic social data; supports Nostr and ActivityPub native formats; has cryptographic signature; has stigmergic access level; stored in holons with geographic context
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Clarifications
|
|
205
|
+
|
|
206
|
+
### Session 2025-10-07
|
|
207
|
+
- Q: How should noospheric (conceptual) holons be identified and structured? → A: URI/URL scheme allowing external namespace integration (e.g., "nostr://topic/123", "ap://community/abc")
|
|
208
|
+
- Q: What are the performance targets for browser bundle size? → A: < 1 MB minified+gzipped (comprehensive, including all dependencies)
|
|
209
|
+
- Q: What are the expected data scale limits per holon? → A: No enforced limits (bounded only by available storage and network capacity)
|
|
210
|
+
- Q: What observability features must be provided for monitoring and debugging? → A: Standard: Structured logging (JSON), metrics (operation counts/timing), configurable verbosity
|
|
211
|
+
- Q: What security threats should the system defend against? → A: Standard: Unauthorized data access, data tampering, replay attacks, token expiration enforcement, basic DoS protection
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Review & Acceptance Checklist
|
|
216
|
+
*GATE: Automated checks run during main() execution*
|
|
217
|
+
|
|
218
|
+
### Content Quality
|
|
219
|
+
- [x] No implementation details (languages, frameworks, APIs)
|
|
220
|
+
- [x] Focused on user value and business needs
|
|
221
|
+
- [x] Written for non-technical stakeholders
|
|
222
|
+
- [x] All mandatory sections completed
|
|
223
|
+
|
|
224
|
+
### Requirement Completeness
|
|
225
|
+
- [x] No [NEEDS CLARIFICATION] markers remain
|
|
226
|
+
- [x] Requirements are testable and unambiguous
|
|
227
|
+
- [x] Success criteria are measurable
|
|
228
|
+
- [x] Scope is clearly bounded
|
|
229
|
+
- [x] Dependencies and assumptions identified
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Execution Status
|
|
234
|
+
*Updated by main() during processing*
|
|
235
|
+
|
|
236
|
+
- [x] User description parsed
|
|
237
|
+
- [x] Key concepts extracted
|
|
238
|
+
- [x] Ambiguities marked
|
|
239
|
+
- [x] User scenarios defined
|
|
240
|
+
- [x] Requirements generated
|
|
241
|
+
- [x] Entities identified
|
|
242
|
+
- [x] Review checklist passed
|
|
243
|
+
|
|
244
|
+
---
|