agentic-qe 2.7.4 → 2.8.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/CHANGELOG.md +104 -0
- package/README.md +67 -2
- package/dist/cli/commands/agent/spawn.d.ts +12 -1
- package/dist/cli/commands/agent/spawn.d.ts.map +1 -1
- package/dist/cli/commands/agent/spawn.js +95 -8
- package/dist/cli/commands/agent/spawn.js.map +1 -1
- package/dist/cli/index.js +91 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/core/memory/HNSWVectorMemory.js +1 -1
- package/dist/edge/adapters/BrowserHNSWAdapter.d.ts +134 -0
- package/dist/edge/adapters/BrowserHNSWAdapter.d.ts.map +1 -0
- package/dist/edge/adapters/BrowserHNSWAdapter.js +484 -0
- package/dist/edge/adapters/BrowserHNSWAdapter.js.map +1 -0
- package/dist/edge/adapters/IndexedDBStorage.d.ts +114 -0
- package/dist/edge/adapters/IndexedDBStorage.d.ts.map +1 -0
- package/dist/edge/adapters/IndexedDBStorage.js +478 -0
- package/dist/edge/adapters/IndexedDBStorage.js.map +1 -0
- package/dist/edge/adapters/index.d.ts +12 -0
- package/dist/edge/adapters/index.d.ts.map +1 -0
- package/dist/edge/adapters/index.js +22 -0
- package/dist/edge/adapters/index.js.map +1 -0
- package/dist/edge/browser/BrowserAgent.d.ts +241 -0
- package/dist/edge/browser/BrowserAgent.d.ts.map +1 -0
- package/dist/edge/browser/BrowserAgent.js +743 -0
- package/dist/edge/browser/BrowserAgent.js.map +1 -0
- package/dist/edge/index.d.ts +34 -0
- package/dist/edge/index.d.ts.map +1 -0
- package/dist/edge/index.js +114 -0
- package/dist/edge/index.js.map +1 -0
- package/dist/edge/p2p/coordination/CoordinationManager.d.ts +181 -0
- package/dist/edge/p2p/coordination/CoordinationManager.d.ts.map +1 -0
- package/dist/edge/p2p/coordination/CoordinationManager.js +851 -0
- package/dist/edge/p2p/coordination/CoordinationManager.js.map +1 -0
- package/dist/edge/p2p/coordination/HealthMonitor.d.ts +143 -0
- package/dist/edge/p2p/coordination/HealthMonitor.d.ts.map +1 -0
- package/dist/edge/p2p/coordination/HealthMonitor.js +432 -0
- package/dist/edge/p2p/coordination/HealthMonitor.js.map +1 -0
- package/dist/edge/p2p/coordination/SyncOrchestrator.d.ts +146 -0
- package/dist/edge/p2p/coordination/SyncOrchestrator.d.ts.map +1 -0
- package/dist/edge/p2p/coordination/SyncOrchestrator.js +783 -0
- package/dist/edge/p2p/coordination/SyncOrchestrator.js.map +1 -0
- package/dist/edge/p2p/coordination/index.d.ts +70 -0
- package/dist/edge/p2p/coordination/index.d.ts.map +1 -0
- package/dist/edge/p2p/coordination/index.js +107 -0
- package/dist/edge/p2p/coordination/index.js.map +1 -0
- package/dist/edge/p2p/coordination/types.d.ts +572 -0
- package/dist/edge/p2p/coordination/types.d.ts.map +1 -0
- package/dist/edge/p2p/coordination/types.js +366 -0
- package/dist/edge/p2p/coordination/types.js.map +1 -0
- package/dist/edge/p2p/crdt/CRDTStore.d.ts +324 -0
- package/dist/edge/p2p/crdt/CRDTStore.d.ts.map +1 -0
- package/dist/edge/p2p/crdt/CRDTStore.js +839 -0
- package/dist/edge/p2p/crdt/CRDTStore.js.map +1 -0
- package/dist/edge/p2p/crdt/GCounter.d.ts +173 -0
- package/dist/edge/p2p/crdt/GCounter.d.ts.map +1 -0
- package/dist/edge/p2p/crdt/GCounter.js +394 -0
- package/dist/edge/p2p/crdt/GCounter.js.map +1 -0
- package/dist/edge/p2p/crdt/LWWRegister.d.ts +200 -0
- package/dist/edge/p2p/crdt/LWWRegister.d.ts.map +1 -0
- package/dist/edge/p2p/crdt/LWWRegister.js +456 -0
- package/dist/edge/p2p/crdt/LWWRegister.js.map +1 -0
- package/dist/edge/p2p/crdt/ORSet.d.ts +232 -0
- package/dist/edge/p2p/crdt/ORSet.d.ts.map +1 -0
- package/dist/edge/p2p/crdt/ORSet.js +723 -0
- package/dist/edge/p2p/crdt/ORSet.js.map +1 -0
- package/dist/edge/p2p/crdt/PatternCRDT.d.ts +366 -0
- package/dist/edge/p2p/crdt/PatternCRDT.d.ts.map +1 -0
- package/dist/edge/p2p/crdt/PatternCRDT.js +838 -0
- package/dist/edge/p2p/crdt/PatternCRDT.js.map +1 -0
- package/dist/edge/p2p/crdt/VectorClock.d.ts +274 -0
- package/dist/edge/p2p/crdt/VectorClock.d.ts.map +1 -0
- package/dist/edge/p2p/crdt/VectorClock.js +499 -0
- package/dist/edge/p2p/crdt/VectorClock.js.map +1 -0
- package/dist/edge/p2p/crdt/index.d.ts +87 -0
- package/dist/edge/p2p/crdt/index.d.ts.map +1 -0
- package/dist/edge/p2p/crdt/index.js +120 -0
- package/dist/edge/p2p/crdt/index.js.map +1 -0
- package/dist/edge/p2p/crdt/types.d.ts +667 -0
- package/dist/edge/p2p/crdt/types.d.ts.map +1 -0
- package/dist/edge/p2p/crdt/types.js +208 -0
- package/dist/edge/p2p/crdt/types.js.map +1 -0
- package/dist/edge/p2p/crypto/Identity.d.ts +139 -0
- package/dist/edge/p2p/crypto/Identity.d.ts.map +1 -0
- package/dist/edge/p2p/crypto/Identity.js +449 -0
- package/dist/edge/p2p/crypto/Identity.js.map +1 -0
- package/dist/edge/p2p/crypto/KeyManager.d.ts +196 -0
- package/dist/edge/p2p/crypto/KeyManager.d.ts.map +1 -0
- package/dist/edge/p2p/crypto/KeyManager.js +576 -0
- package/dist/edge/p2p/crypto/KeyManager.js.map +1 -0
- package/dist/edge/p2p/crypto/Signer.d.ts +164 -0
- package/dist/edge/p2p/crypto/Signer.d.ts.map +1 -0
- package/dist/edge/p2p/crypto/Signer.js +357 -0
- package/dist/edge/p2p/crypto/Signer.js.map +1 -0
- package/dist/edge/p2p/crypto/index.d.ts +90 -0
- package/dist/edge/p2p/crypto/index.d.ts.map +1 -0
- package/dist/edge/p2p/crypto/index.js +158 -0
- package/dist/edge/p2p/crypto/index.js.map +1 -0
- package/dist/edge/p2p/crypto/types.d.ts +217 -0
- package/dist/edge/p2p/crypto/types.d.ts.map +1 -0
- package/dist/edge/p2p/crypto/types.js +42 -0
- package/dist/edge/p2p/crypto/types.js.map +1 -0
- package/dist/edge/p2p/federated/FederatedCoordinator.d.ts +270 -0
- package/dist/edge/p2p/federated/FederatedCoordinator.d.ts.map +1 -0
- package/dist/edge/p2p/federated/FederatedCoordinator.js +824 -0
- package/dist/edge/p2p/federated/FederatedCoordinator.js.map +1 -0
- package/dist/edge/p2p/federated/FederatedRound.d.ts +295 -0
- package/dist/edge/p2p/federated/FederatedRound.d.ts.map +1 -0
- package/dist/edge/p2p/federated/FederatedRound.js +819 -0
- package/dist/edge/p2p/federated/FederatedRound.js.map +1 -0
- package/dist/edge/p2p/federated/GradientAggregator.d.ts +226 -0
- package/dist/edge/p2p/federated/GradientAggregator.d.ts.map +1 -0
- package/dist/edge/p2p/federated/GradientAggregator.js +826 -0
- package/dist/edge/p2p/federated/GradientAggregator.js.map +1 -0
- package/dist/edge/p2p/federated/ModelManager.d.ts +248 -0
- package/dist/edge/p2p/federated/ModelManager.d.ts.map +1 -0
- package/dist/edge/p2p/federated/ModelManager.js +724 -0
- package/dist/edge/p2p/federated/ModelManager.js.map +1 -0
- package/dist/edge/p2p/federated/index.d.ts +65 -0
- package/dist/edge/p2p/federated/index.d.ts.map +1 -0
- package/dist/edge/p2p/federated/index.js +110 -0
- package/dist/edge/p2p/federated/index.js.map +1 -0
- package/dist/edge/p2p/federated/types.d.ts +905 -0
- package/dist/edge/p2p/federated/types.d.ts.map +1 -0
- package/dist/edge/p2p/federated/types.js +339 -0
- package/dist/edge/p2p/federated/types.js.map +1 -0
- package/dist/edge/p2p/index.d.ts +156 -0
- package/dist/edge/p2p/index.d.ts.map +1 -0
- package/dist/edge/p2p/index.js +242 -0
- package/dist/edge/p2p/index.js.map +1 -0
- package/dist/edge/p2p/nat/ConnectivityTester.d.ts +128 -0
- package/dist/edge/p2p/nat/ConnectivityTester.d.ts.map +1 -0
- package/dist/edge/p2p/nat/ConnectivityTester.js +560 -0
- package/dist/edge/p2p/nat/ConnectivityTester.js.map +1 -0
- package/dist/edge/p2p/nat/HolePuncher.d.ts +159 -0
- package/dist/edge/p2p/nat/HolePuncher.d.ts.map +1 -0
- package/dist/edge/p2p/nat/HolePuncher.js +569 -0
- package/dist/edge/p2p/nat/HolePuncher.js.map +1 -0
- package/dist/edge/p2p/nat/NATDetector.d.ts +109 -0
- package/dist/edge/p2p/nat/NATDetector.d.ts.map +1 -0
- package/dist/edge/p2p/nat/NATDetector.js +472 -0
- package/dist/edge/p2p/nat/NATDetector.js.map +1 -0
- package/dist/edge/p2p/nat/TURNManager.d.ts +158 -0
- package/dist/edge/p2p/nat/TURNManager.d.ts.map +1 -0
- package/dist/edge/p2p/nat/TURNManager.js +547 -0
- package/dist/edge/p2p/nat/TURNManager.js.map +1 -0
- package/dist/edge/p2p/nat/index.d.ts +74 -0
- package/dist/edge/p2p/nat/index.d.ts.map +1 -0
- package/dist/edge/p2p/nat/index.js +104 -0
- package/dist/edge/p2p/nat/index.js.map +1 -0
- package/dist/edge/p2p/nat/types.d.ts +583 -0
- package/dist/edge/p2p/nat/types.d.ts.map +1 -0
- package/dist/edge/p2p/nat/types.js +267 -0
- package/dist/edge/p2p/nat/types.js.map +1 -0
- package/dist/edge/p2p/protocol/AgentChannel.d.ts +333 -0
- package/dist/edge/p2p/protocol/AgentChannel.d.ts.map +1 -0
- package/dist/edge/p2p/protocol/AgentChannel.js +914 -0
- package/dist/edge/p2p/protocol/AgentChannel.js.map +1 -0
- package/dist/edge/p2p/protocol/MessageEncoder.d.ts +147 -0
- package/dist/edge/p2p/protocol/MessageEncoder.d.ts.map +1 -0
- package/dist/edge/p2p/protocol/MessageEncoder.js +738 -0
- package/dist/edge/p2p/protocol/MessageEncoder.js.map +1 -0
- package/dist/edge/p2p/protocol/MessageRouter.d.ts +266 -0
- package/dist/edge/p2p/protocol/MessageRouter.d.ts.map +1 -0
- package/dist/edge/p2p/protocol/MessageRouter.js +808 -0
- package/dist/edge/p2p/protocol/MessageRouter.js.map +1 -0
- package/dist/edge/p2p/protocol/ProtocolHandler.d.ts +309 -0
- package/dist/edge/p2p/protocol/ProtocolHandler.d.ts.map +1 -0
- package/dist/edge/p2p/protocol/ProtocolHandler.js +930 -0
- package/dist/edge/p2p/protocol/ProtocolHandler.js.map +1 -0
- package/dist/edge/p2p/protocol/index.d.ts +114 -0
- package/dist/edge/p2p/protocol/index.d.ts.map +1 -0
- package/dist/edge/p2p/protocol/index.js +206 -0
- package/dist/edge/p2p/protocol/index.js.map +1 -0
- package/dist/edge/p2p/protocol/types.d.ts +737 -0
- package/dist/edge/p2p/protocol/types.d.ts.map +1 -0
- package/dist/edge/p2p/protocol/types.js +490 -0
- package/dist/edge/p2p/protocol/types.js.map +1 -0
- package/dist/edge/p2p/sharing/PatternBroadcaster.d.ts +284 -0
- package/dist/edge/p2p/sharing/PatternBroadcaster.d.ts.map +1 -0
- package/dist/edge/p2p/sharing/PatternBroadcaster.js +644 -0
- package/dist/edge/p2p/sharing/PatternBroadcaster.js.map +1 -0
- package/dist/edge/p2p/sharing/PatternIndex.d.ts +168 -0
- package/dist/edge/p2p/sharing/PatternIndex.d.ts.map +1 -0
- package/dist/edge/p2p/sharing/PatternIndex.js +781 -0
- package/dist/edge/p2p/sharing/PatternIndex.js.map +1 -0
- package/dist/edge/p2p/sharing/PatternSerializer.d.ts +163 -0
- package/dist/edge/p2p/sharing/PatternSerializer.d.ts.map +1 -0
- package/dist/edge/p2p/sharing/PatternSerializer.js +696 -0
- package/dist/edge/p2p/sharing/PatternSerializer.js.map +1 -0
- package/dist/edge/p2p/sharing/PatternSyncManager.d.ts +242 -0
- package/dist/edge/p2p/sharing/PatternSyncManager.d.ts.map +1 -0
- package/dist/edge/p2p/sharing/PatternSyncManager.js +859 -0
- package/dist/edge/p2p/sharing/PatternSyncManager.js.map +1 -0
- package/dist/edge/p2p/sharing/index.d.ts +90 -0
- package/dist/edge/p2p/sharing/index.d.ts.map +1 -0
- package/dist/edge/p2p/sharing/index.js +152 -0
- package/dist/edge/p2p/sharing/index.js.map +1 -0
- package/dist/edge/p2p/sharing/types.d.ts +796 -0
- package/dist/edge/p2p/sharing/types.d.ts.map +1 -0
- package/dist/edge/p2p/sharing/types.js +264 -0
- package/dist/edge/p2p/sharing/types.js.map +1 -0
- package/dist/edge/p2p/webrtc/ConnectionPool.d.ts +218 -0
- package/dist/edge/p2p/webrtc/ConnectionPool.d.ts.map +1 -0
- package/dist/edge/p2p/webrtc/ConnectionPool.js +562 -0
- package/dist/edge/p2p/webrtc/ConnectionPool.js.map +1 -0
- package/dist/edge/p2p/webrtc/ICEManager.d.ts +171 -0
- package/dist/edge/p2p/webrtc/ICEManager.d.ts.map +1 -0
- package/dist/edge/p2p/webrtc/ICEManager.js +490 -0
- package/dist/edge/p2p/webrtc/ICEManager.js.map +1 -0
- package/dist/edge/p2p/webrtc/PeerConnectionManager.d.ts +159 -0
- package/dist/edge/p2p/webrtc/PeerConnectionManager.d.ts.map +1 -0
- package/dist/edge/p2p/webrtc/PeerConnectionManager.js +735 -0
- package/dist/edge/p2p/webrtc/PeerConnectionManager.js.map +1 -0
- package/dist/edge/p2p/webrtc/SignalingClient.d.ts +191 -0
- package/dist/edge/p2p/webrtc/SignalingClient.d.ts.map +1 -0
- package/dist/edge/p2p/webrtc/SignalingClient.js +608 -0
- package/dist/edge/p2p/webrtc/SignalingClient.js.map +1 -0
- package/dist/edge/p2p/webrtc/index.d.ts +158 -0
- package/dist/edge/p2p/webrtc/index.d.ts.map +1 -0
- package/dist/edge/p2p/webrtc/index.js +164 -0
- package/dist/edge/p2p/webrtc/index.js.map +1 -0
- package/dist/edge/p2p/webrtc/types.d.ts +665 -0
- package/dist/edge/p2p/webrtc/types.d.ts.map +1 -0
- package/dist/edge/p2p/webrtc/types.js +245 -0
- package/dist/edge/p2p/webrtc/types.js.map +1 -0
- package/dist/edge/server/AgentSpawnAPI.d.ts +98 -0
- package/dist/edge/server/AgentSpawnAPI.d.ts.map +1 -0
- package/dist/edge/server/AgentSpawnAPI.js +264 -0
- package/dist/edge/server/AgentSpawnAPI.js.map +1 -0
- package/dist/edge/server/SignalingServer.d.ts +71 -0
- package/dist/edge/server/SignalingServer.d.ts.map +1 -0
- package/dist/edge/server/SignalingServer.js +429 -0
- package/dist/edge/server/SignalingServer.js.map +1 -0
- package/dist/edge/server/index.d.ts +64 -0
- package/dist/edge/server/index.d.ts.map +1 -0
- package/dist/edge/server/index.js +318 -0
- package/dist/edge/server/index.js.map +1 -0
- package/dist/edge/types/browser-agent.types.d.ts +455 -0
- package/dist/edge/types/browser-agent.types.d.ts.map +1 -0
- package/dist/edge/types/browser-agent.types.js +116 -0
- package/dist/edge/types/browser-agent.types.js.map +1 -0
- package/dist/edge/types/index.d.ts +11 -0
- package/dist/edge/types/index.d.ts.map +1 -0
- package/dist/edge/types/index.js +17 -0
- package/dist/edge/types/index.js.map +1 -0
- package/dist/edge/types/storage.types.d.ts +207 -0
- package/dist/edge/types/storage.types.d.ts.map +1 -0
- package/dist/edge/types/storage.types.js +47 -0
- package/dist/edge/types/storage.types.js.map +1 -0
- package/dist/edge/wasm/shims.d.ts +224 -0
- package/dist/edge/wasm/shims.d.ts.map +1 -0
- package/dist/edge/wasm/shims.js +667 -0
- package/dist/edge/wasm/shims.js.map +1 -0
- package/dist/mcp/handlers/NewDomainToolsHandler.d.ts +33 -0
- package/dist/mcp/handlers/NewDomainToolsHandler.d.ts.map +1 -0
- package/dist/mcp/handlers/NewDomainToolsHandler.js +305 -0
- package/dist/mcp/handlers/NewDomainToolsHandler.js.map +1 -0
- package/dist/mcp/handlers/filtered/index.d.ts +15 -19
- package/dist/mcp/handlers/filtered/index.d.ts.map +1 -1
- package/dist/mcp/handlers/filtered/index.js +16 -27
- package/dist/mcp/handlers/filtered/index.js.map +1 -1
- package/dist/mcp/handlers/integration/index.d.ts +5 -4
- package/dist/mcp/handlers/integration/index.d.ts.map +1 -1
- package/dist/mcp/handlers/integration/index.js +7 -7
- package/dist/mcp/handlers/integration/index.js.map +1 -1
- package/dist/mcp/server-instructions.d.ts +1 -1
- package/dist/mcp/server-instructions.js +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +14 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools.d.ts +8 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +412 -1
- package/dist/mcp/tools.js.map +1 -1
- package/dist/planning/GOAPPlanner.d.ts +1 -0
- package/dist/planning/GOAPPlanner.d.ts.map +1 -1
- package/dist/planning/GOAPPlanner.js +12 -0
- package/dist/planning/GOAPPlanner.js.map +1 -1
- package/package.json +29 -8
- package/dist/alerting/AlertManager.d.ts +0 -120
- package/dist/alerting/AlertManager.d.ts.map +0 -1
- package/dist/alerting/AlertManager.js +0 -345
- package/dist/alerting/AlertManager.js.map +0 -1
- package/dist/alerting/FeedbackRouter.d.ts +0 -98
- package/dist/alerting/FeedbackRouter.d.ts.map +0 -1
- package/dist/alerting/FeedbackRouter.js +0 -331
- package/dist/alerting/FeedbackRouter.js.map +0 -1
- package/dist/alerting/StrategyApplicator.d.ts +0 -120
- package/dist/alerting/StrategyApplicator.d.ts.map +0 -1
- package/dist/alerting/StrategyApplicator.js +0 -299
- package/dist/alerting/StrategyApplicator.js.map +0 -1
- package/dist/alerting/index.d.ts +0 -68
- package/dist/alerting/index.d.ts.map +0 -1
- package/dist/alerting/index.js +0 -112
- package/dist/alerting/index.js.map +0 -1
- package/dist/alerting/types.d.ts +0 -118
- package/dist/alerting/types.d.ts.map +0 -1
- package/dist/alerting/types.js +0 -11
- package/dist/alerting/types.js.map +0 -1
- package/dist/cli/commands/fleet/backup.d.ts +0 -49
- package/dist/cli/commands/fleet/backup.d.ts.map +0 -1
- package/dist/cli/commands/fleet/backup.js +0 -88
- package/dist/cli/commands/fleet/backup.js.map +0 -1
- package/dist/cli/commands/fleet/health.d.ts +0 -154
- package/dist/cli/commands/fleet/health.d.ts.map +0 -1
- package/dist/cli/commands/fleet/health.js +0 -483
- package/dist/cli/commands/fleet/health.js.map +0 -1
- package/dist/cli/commands/fleet/init.d.ts +0 -11
- package/dist/cli/commands/fleet/init.d.ts.map +0 -1
- package/dist/cli/commands/fleet/init.js +0 -91
- package/dist/cli/commands/fleet/init.js.map +0 -1
- package/dist/cli/commands/fleet/logs.d.ts +0 -21
- package/dist/cli/commands/fleet/logs.d.ts.map +0 -1
- package/dist/cli/commands/fleet/logs.js +0 -267
- package/dist/cli/commands/fleet/logs.js.map +0 -1
- package/dist/cli/commands/fleet/metrics.d.ts +0 -27
- package/dist/cli/commands/fleet/metrics.d.ts.map +0 -1
- package/dist/cli/commands/fleet/metrics.js +0 -369
- package/dist/cli/commands/fleet/metrics.js.map +0 -1
- package/dist/cli/commands/fleet/monitor.d.ts +0 -18
- package/dist/cli/commands/fleet/monitor.d.ts.map +0 -1
- package/dist/cli/commands/fleet/monitor.js +0 -237
- package/dist/cli/commands/fleet/monitor.js.map +0 -1
- package/dist/cli/commands/fleet/optimize.d.ts +0 -42
- package/dist/cli/commands/fleet/optimize.d.ts.map +0 -1
- package/dist/cli/commands/fleet/optimize.js +0 -135
- package/dist/cli/commands/fleet/optimize.js.map +0 -1
- package/dist/cli/commands/fleet/recover.d.ts +0 -22
- package/dist/cli/commands/fleet/recover.d.ts.map +0 -1
- package/dist/cli/commands/fleet/recover.js +0 -99
- package/dist/cli/commands/fleet/recover.js.map +0 -1
- package/dist/cli/commands/fleet/restart.d.ts +0 -18
- package/dist/cli/commands/fleet/restart.d.ts.map +0 -1
- package/dist/cli/commands/fleet/restart.js +0 -290
- package/dist/cli/commands/fleet/restart.js.map +0 -1
- package/dist/cli/commands/fleet/scale.d.ts +0 -9
- package/dist/cli/commands/fleet/scale.d.ts.map +0 -1
- package/dist/cli/commands/fleet/scale.js +0 -77
- package/dist/cli/commands/fleet/scale.js.map +0 -1
- package/dist/cli/commands/fleet/shutdown.d.ts +0 -19
- package/dist/cli/commands/fleet/shutdown.d.ts.map +0 -1
- package/dist/cli/commands/fleet/shutdown.js +0 -307
- package/dist/cli/commands/fleet/shutdown.js.map +0 -1
- package/dist/cli/commands/fleet/status.d.ts +0 -10
- package/dist/cli/commands/fleet/status.d.ts.map +0 -1
- package/dist/cli/commands/fleet/status.js +0 -97
- package/dist/cli/commands/fleet/status.js.map +0 -1
- package/dist/cli/commands/fleet/topology.d.ts +0 -23
- package/dist/cli/commands/fleet/topology.d.ts.map +0 -1
- package/dist/cli/commands/fleet/topology.js +0 -376
- package/dist/cli/commands/fleet/topology.js.map +0 -1
- package/dist/cli/commands/monitor/alerts.d.ts +0 -45
- package/dist/cli/commands/monitor/alerts.d.ts.map +0 -1
- package/dist/cli/commands/monitor/alerts.js +0 -168
- package/dist/cli/commands/monitor/alerts.js.map +0 -1
- package/dist/cli/commands/monitor/analyze.d.ts +0 -49
- package/dist/cli/commands/monitor/analyze.d.ts.map +0 -1
- package/dist/cli/commands/monitor/analyze.js +0 -209
- package/dist/cli/commands/monitor/analyze.js.map +0 -1
- package/dist/cli/commands/monitor/compare.d.ts +0 -38
- package/dist/cli/commands/monitor/compare.d.ts.map +0 -1
- package/dist/cli/commands/monitor/compare.js +0 -177
- package/dist/cli/commands/monitor/compare.js.map +0 -1
- package/dist/cli/commands/monitor/dashboard.d.ts +0 -34
- package/dist/cli/commands/monitor/dashboard.d.ts.map +0 -1
- package/dist/cli/commands/monitor/dashboard.js +0 -157
- package/dist/cli/commands/monitor/dashboard.js.map +0 -1
- package/dist/cli/commands/monitor/export.d.ts +0 -36
- package/dist/cli/commands/monitor/export.d.ts.map +0 -1
- package/dist/cli/commands/monitor/export.js +0 -157
- package/dist/cli/commands/monitor/export.js.map +0 -1
- package/dist/cli/commands/monitor/index.d.ts +0 -11
- package/dist/cli/commands/monitor/index.d.ts.map +0 -1
- package/dist/cli/commands/monitor/index.js +0 -14
- package/dist/cli/commands/monitor/index.js.map +0 -1
- package/dist/cli/commands/quality/baseline.d.ts +0 -27
- package/dist/cli/commands/quality/baseline.d.ts.map +0 -1
- package/dist/cli/commands/quality/baseline.js +0 -124
- package/dist/cli/commands/quality/baseline.js.map +0 -1
- package/dist/cli/commands/quality/compare.d.ts +0 -36
- package/dist/cli/commands/quality/compare.d.ts.map +0 -1
- package/dist/cli/commands/quality/compare.js +0 -136
- package/dist/cli/commands/quality/compare.js.map +0 -1
- package/dist/cli/commands/quality/decision.d.ts +0 -81
- package/dist/cli/commands/quality/decision.d.ts.map +0 -1
- package/dist/cli/commands/quality/decision.js +0 -319
- package/dist/cli/commands/quality/decision.js.map +0 -1
- package/dist/cli/commands/quality/gate.d.ts +0 -47
- package/dist/cli/commands/quality/gate.d.ts.map +0 -1
- package/dist/cli/commands/quality/gate.js +0 -205
- package/dist/cli/commands/quality/gate.js.map +0 -1
- package/dist/cli/commands/quality/index.d.ts +0 -17
- package/dist/cli/commands/quality/index.d.ts.map +0 -1
- package/dist/cli/commands/quality/index.js +0 -41
- package/dist/cli/commands/quality/index.js.map +0 -1
- package/dist/cli/commands/quality/policy.d.ts +0 -57
- package/dist/cli/commands/quality/policy.d.ts.map +0 -1
- package/dist/cli/commands/quality/policy.js +0 -359
- package/dist/cli/commands/quality/policy.js.map +0 -1
- package/dist/cli/commands/quality/risk.d.ts +0 -41
- package/dist/cli/commands/quality/risk.d.ts.map +0 -1
- package/dist/cli/commands/quality/risk.js +0 -255
- package/dist/cli/commands/quality/risk.js.map +0 -1
- package/dist/cli/commands/quality/trends.d.ts +0 -40
- package/dist/cli/commands/quality/trends.d.ts.map +0 -1
- package/dist/cli/commands/quality/trends.js +0 -122
- package/dist/cli/commands/quality/trends.js.map +0 -1
- package/dist/cli/commands/quality/validate.d.ts +0 -44
- package/dist/cli/commands/quality/validate.d.ts.map +0 -1
- package/dist/cli/commands/quality/validate.js +0 -234
- package/dist/cli/commands/quality/validate.js.map +0 -1
- package/dist/cli/commands/test/analyze-failures.d.ts +0 -39
- package/dist/cli/commands/test/analyze-failures.d.ts.map +0 -1
- package/dist/cli/commands/test/analyze-failures.js +0 -113
- package/dist/cli/commands/test/analyze-failures.js.map +0 -1
- package/dist/cli/commands/test/clean.d.ts +0 -3
- package/dist/cli/commands/test/clean.d.ts.map +0 -1
- package/dist/cli/commands/test/clean.js +0 -148
- package/dist/cli/commands/test/clean.js.map +0 -1
- package/dist/cli/commands/test/debug.d.ts +0 -3
- package/dist/cli/commands/test/debug.d.ts.map +0 -1
- package/dist/cli/commands/test/debug.js +0 -167
- package/dist/cli/commands/test/debug.js.map +0 -1
- package/dist/cli/commands/test/diff.d.ts +0 -3
- package/dist/cli/commands/test/diff.d.ts.map +0 -1
- package/dist/cli/commands/test/diff.js +0 -195
- package/dist/cli/commands/test/diff.js.map +0 -1
- package/dist/cli/commands/test/flakiness.d.ts +0 -32
- package/dist/cli/commands/test/flakiness.d.ts.map +0 -1
- package/dist/cli/commands/test/flakiness.js +0 -121
- package/dist/cli/commands/test/flakiness.js.map +0 -1
- package/dist/cli/commands/test/index.d.ts +0 -17
- package/dist/cli/commands/test/index.d.ts.map +0 -1
- package/dist/cli/commands/test/index.js +0 -45
- package/dist/cli/commands/test/index.js.map +0 -1
- package/dist/cli/commands/test/mutate.d.ts +0 -29
- package/dist/cli/commands/test/mutate.d.ts.map +0 -1
- package/dist/cli/commands/test/mutate.js +0 -163
- package/dist/cli/commands/test/mutate.js.map +0 -1
- package/dist/cli/commands/test/parallel.d.ts +0 -3
- package/dist/cli/commands/test/parallel.d.ts.map +0 -1
- package/dist/cli/commands/test/parallel.js +0 -117
- package/dist/cli/commands/test/parallel.js.map +0 -1
- package/dist/cli/commands/test/profile.d.ts +0 -3
- package/dist/cli/commands/test/profile.d.ts.map +0 -1
- package/dist/cli/commands/test/profile.js +0 -156
- package/dist/cli/commands/test/profile.js.map +0 -1
- package/dist/cli/commands/test/queue.d.ts +0 -3
- package/dist/cli/commands/test/queue.d.ts.map +0 -1
- package/dist/cli/commands/test/queue.js +0 -140
- package/dist/cli/commands/test/queue.js.map +0 -1
- package/dist/cli/commands/test/retry.d.ts +0 -3
- package/dist/cli/commands/test/retry.d.ts.map +0 -1
- package/dist/cli/commands/test/retry.js +0 -105
- package/dist/cli/commands/test/retry.js.map +0 -1
- package/dist/cli/commands/test/snapshot.d.ts +0 -3
- package/dist/cli/commands/test/snapshot.d.ts.map +0 -1
- package/dist/cli/commands/test/snapshot.js +0 -176
- package/dist/cli/commands/test/snapshot.js.map +0 -1
- package/dist/cli/commands/test/trace.d.ts +0 -3
- package/dist/cli/commands/test/trace.d.ts.map +0 -1
- package/dist/cli/commands/test/trace.js +0 -137
- package/dist/cli/commands/test/trace.js.map +0 -1
- package/dist/cli/commands/test/watch.d.ts +0 -3
- package/dist/cli/commands/test/watch.d.ts.map +0 -1
- package/dist/cli/commands/test/watch.js +0 -130
- package/dist/cli/commands/test/watch.js.map +0 -1
- package/dist/cli/index-spec.d.ts +0 -3
- package/dist/cli/index-spec.d.ts.map +0 -1
- package/dist/cli/index-spec.js +0 -154
- package/dist/cli/index-spec.js.map +0 -1
- package/dist/cli/index-working.d.ts +0 -7
- package/dist/cli/index-working.d.ts.map +0 -1
- package/dist/cli/index-working.js +0 -617
- package/dist/cli/index-working.js.map +0 -1
- package/dist/mcp/handlers/filtered/coverage-analyzer-filtered.d.ts +0 -83
- package/dist/mcp/handlers/filtered/coverage-analyzer-filtered.d.ts.map +0 -1
- package/dist/mcp/handlers/filtered/coverage-analyzer-filtered.js +0 -130
- package/dist/mcp/handlers/filtered/coverage-analyzer-filtered.js.map +0 -1
- package/dist/mcp/handlers/filtered/flaky-detector-filtered.d.ts +0 -58
- package/dist/mcp/handlers/filtered/flaky-detector-filtered.d.ts.map +0 -1
- package/dist/mcp/handlers/filtered/flaky-detector-filtered.js +0 -84
- package/dist/mcp/handlers/filtered/flaky-detector-filtered.js.map +0 -1
- package/dist/mcp/handlers/filtered/security-scanner-filtered.d.ts +0 -54
- package/dist/mcp/handlers/filtered/security-scanner-filtered.d.ts.map +0 -1
- package/dist/mcp/handlers/filtered/security-scanner-filtered.js +0 -73
- package/dist/mcp/handlers/filtered/security-scanner-filtered.js.map +0 -1
- package/dist/mcp/handlers/integration/contract-validate.d.ts +0 -10
- package/dist/mcp/handlers/integration/contract-validate.d.ts.map +0 -1
- package/dist/mcp/handlers/integration/contract-validate.js +0 -348
- package/dist/mcp/handlers/integration/contract-validate.js.map +0 -1
- package/dist/reporting/ResultAggregator.d.ts +0 -107
- package/dist/reporting/ResultAggregator.d.ts.map +0 -1
- package/dist/reporting/ResultAggregator.js +0 -435
- package/dist/reporting/ResultAggregator.js.map +0 -1
- package/dist/reporting/index.d.ts +0 -48
- package/dist/reporting/index.d.ts.map +0 -1
- package/dist/reporting/index.js +0 -154
- package/dist/reporting/index.js.map +0 -1
- package/dist/reporting/reporters/ControlLoopReporter.d.ts +0 -128
- package/dist/reporting/reporters/ControlLoopReporter.d.ts.map +0 -1
- package/dist/reporting/reporters/ControlLoopReporter.js +0 -417
- package/dist/reporting/reporters/ControlLoopReporter.js.map +0 -1
- package/dist/reporting/reporters/HumanReadableReporter.d.ts +0 -140
- package/dist/reporting/reporters/HumanReadableReporter.d.ts.map +0 -1
- package/dist/reporting/reporters/HumanReadableReporter.js +0 -524
- package/dist/reporting/reporters/HumanReadableReporter.js.map +0 -1
- package/dist/reporting/reporters/JSONReporter.d.ts +0 -251
- package/dist/reporting/reporters/JSONReporter.d.ts.map +0 -1
- package/dist/reporting/reporters/JSONReporter.js +0 -325
- package/dist/reporting/reporters/JSONReporter.js.map +0 -1
- package/dist/reporting/reporters/index.d.ts +0 -14
- package/dist/reporting/reporters/index.d.ts.map +0 -1
- package/dist/reporting/reporters/index.js +0 -19
- package/dist/reporting/reporters/index.js.map +0 -1
- package/dist/reporting/types.d.ts +0 -427
- package/dist/reporting/types.d.ts.map +0 -1
- package/dist/reporting/types.js +0 -12
- package/dist/reporting/types.js.map +0 -1
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Two-Machine Coordination Types
|
|
4
|
+
*
|
|
5
|
+
* Type definitions for P2-007: Two-Machine Coordination Proof.
|
|
6
|
+
* Provides interfaces for managing coordination between two or more
|
|
7
|
+
* browser agents in a P2P network.
|
|
8
|
+
*
|
|
9
|
+
* @module edge/p2p/coordination/types
|
|
10
|
+
* @version 1.0.0
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.CoordinationError = exports.CoordinationErrorCode = exports.CoordinationMessageType = exports.CoordinationEventType = exports.DEFAULT_COORDINATION_CONFIG = exports.HealthLevel = exports.CoordinationRole = exports.CoordinationState = exports.HEALTH_PACKET_LOSS_CRITICAL = exports.HEALTH_PACKET_LOSS_WARNING = exports.HEALTH_RTT_CRITICAL_THRESHOLD = exports.HEALTH_RTT_WARNING_THRESHOLD = exports.DEFAULT_SYNC_BATCH_SIZE = exports.MAX_RECONNECT_ATTEMPTS = exports.DEFAULT_RECONNECT_TIMEOUT = exports.DEFAULT_HEALTH_CHECK_INTERVAL = exports.DEFAULT_PING_INTERVAL = exports.COORDINATION_VERSION = void 0;
|
|
14
|
+
exports.createDefaultCapabilities = createDefaultCapabilities;
|
|
15
|
+
exports.createDefaultSyncStatus = createDefaultSyncStatus;
|
|
16
|
+
exports.createDefaultMetrics = createDefaultMetrics;
|
|
17
|
+
exports.createDefaultHealthStatus = createDefaultHealthStatus;
|
|
18
|
+
exports.generateMessageId = generateMessageId;
|
|
19
|
+
exports.generateChallenge = generateChallenge;
|
|
20
|
+
// ============================================
|
|
21
|
+
// Constants
|
|
22
|
+
// ============================================
|
|
23
|
+
/**
|
|
24
|
+
* Coordination protocol version
|
|
25
|
+
*/
|
|
26
|
+
exports.COORDINATION_VERSION = '1.0.0';
|
|
27
|
+
/**
|
|
28
|
+
* Default ping interval in milliseconds
|
|
29
|
+
*/
|
|
30
|
+
exports.DEFAULT_PING_INTERVAL = 5000;
|
|
31
|
+
/**
|
|
32
|
+
* Default health check interval in milliseconds
|
|
33
|
+
*/
|
|
34
|
+
exports.DEFAULT_HEALTH_CHECK_INTERVAL = 10000;
|
|
35
|
+
/**
|
|
36
|
+
* Default reconnection timeout in milliseconds
|
|
37
|
+
*/
|
|
38
|
+
exports.DEFAULT_RECONNECT_TIMEOUT = 30000;
|
|
39
|
+
/**
|
|
40
|
+
* Maximum reconnection attempts before giving up
|
|
41
|
+
*/
|
|
42
|
+
exports.MAX_RECONNECT_ATTEMPTS = 5;
|
|
43
|
+
/**
|
|
44
|
+
* Default sync batch size
|
|
45
|
+
*/
|
|
46
|
+
exports.DEFAULT_SYNC_BATCH_SIZE = 50;
|
|
47
|
+
/**
|
|
48
|
+
* Connection health threshold (RTT in ms)
|
|
49
|
+
*/
|
|
50
|
+
exports.HEALTH_RTT_WARNING_THRESHOLD = 500;
|
|
51
|
+
/**
|
|
52
|
+
* Connection health threshold (RTT in ms)
|
|
53
|
+
*/
|
|
54
|
+
exports.HEALTH_RTT_CRITICAL_THRESHOLD = 2000;
|
|
55
|
+
/**
|
|
56
|
+
* Packet loss warning threshold (percentage)
|
|
57
|
+
*/
|
|
58
|
+
exports.HEALTH_PACKET_LOSS_WARNING = 5;
|
|
59
|
+
/**
|
|
60
|
+
* Packet loss critical threshold (percentage)
|
|
61
|
+
*/
|
|
62
|
+
exports.HEALTH_PACKET_LOSS_CRITICAL = 20;
|
|
63
|
+
// ============================================
|
|
64
|
+
// Coordination State
|
|
65
|
+
// ============================================
|
|
66
|
+
/**
|
|
67
|
+
* Coordination state enumeration
|
|
68
|
+
*/
|
|
69
|
+
var CoordinationState;
|
|
70
|
+
(function (CoordinationState) {
|
|
71
|
+
/** Not connected to any peer */
|
|
72
|
+
CoordinationState["DISCONNECTED"] = "disconnected";
|
|
73
|
+
/** Attempting to connect to peer */
|
|
74
|
+
CoordinationState["CONNECTING"] = "connecting";
|
|
75
|
+
/** Connected, performing authentication */
|
|
76
|
+
CoordinationState["AUTHENTICATING"] = "authenticating";
|
|
77
|
+
/** Authenticated, synchronizing patterns */
|
|
78
|
+
CoordinationState["SYNCING"] = "syncing";
|
|
79
|
+
/** Fully synchronized and coordinated */
|
|
80
|
+
CoordinationState["SYNCHRONIZED"] = "synchronized";
|
|
81
|
+
/** Connection degraded but functional */
|
|
82
|
+
CoordinationState["DEGRADED"] = "degraded";
|
|
83
|
+
/** Attempting to reconnect after failure */
|
|
84
|
+
CoordinationState["RECONNECTING"] = "reconnecting";
|
|
85
|
+
/** Unrecoverable error state */
|
|
86
|
+
CoordinationState["ERROR"] = "error";
|
|
87
|
+
})(CoordinationState || (exports.CoordinationState = CoordinationState = {}));
|
|
88
|
+
/**
|
|
89
|
+
* Coordination role in the network
|
|
90
|
+
*/
|
|
91
|
+
var CoordinationRole;
|
|
92
|
+
(function (CoordinationRole) {
|
|
93
|
+
/** Initiator of the connection */
|
|
94
|
+
CoordinationRole["INITIATOR"] = "initiator";
|
|
95
|
+
/** Responder to connection request */
|
|
96
|
+
CoordinationRole["RESPONDER"] = "responder";
|
|
97
|
+
/** Both roles (for bidirectional communication) */
|
|
98
|
+
CoordinationRole["BIDIRECTIONAL"] = "bidirectional";
|
|
99
|
+
})(CoordinationRole || (exports.CoordinationRole = CoordinationRole = {}));
|
|
100
|
+
/**
|
|
101
|
+
* Health status levels
|
|
102
|
+
*/
|
|
103
|
+
var HealthLevel;
|
|
104
|
+
(function (HealthLevel) {
|
|
105
|
+
/** Connection is healthy */
|
|
106
|
+
HealthLevel["HEALTHY"] = "healthy";
|
|
107
|
+
/** Connection has minor issues */
|
|
108
|
+
HealthLevel["WARNING"] = "warning";
|
|
109
|
+
/** Connection has serious issues */
|
|
110
|
+
HealthLevel["CRITICAL"] = "critical";
|
|
111
|
+
/** Connection is unhealthy/failed */
|
|
112
|
+
HealthLevel["UNHEALTHY"] = "unhealthy";
|
|
113
|
+
})(HealthLevel || (exports.HealthLevel = HealthLevel = {}));
|
|
114
|
+
/**
|
|
115
|
+
* Default coordination configuration
|
|
116
|
+
*/
|
|
117
|
+
exports.DEFAULT_COORDINATION_CONFIG = {
|
|
118
|
+
defaultRole: CoordinationRole.BIDIRECTIONAL,
|
|
119
|
+
autoReconnect: true,
|
|
120
|
+
maxReconnectAttempts: exports.MAX_RECONNECT_ATTEMPTS,
|
|
121
|
+
reconnectTimeout: exports.DEFAULT_RECONNECT_TIMEOUT,
|
|
122
|
+
pingInterval: exports.DEFAULT_PING_INTERVAL,
|
|
123
|
+
healthCheckInterval: exports.DEFAULT_HEALTH_CHECK_INTERVAL,
|
|
124
|
+
authTimeout: 30000,
|
|
125
|
+
enableLogging: true,
|
|
126
|
+
logLevel: 'info',
|
|
127
|
+
syncConfig: {
|
|
128
|
+
autoSyncOnConnect: true,
|
|
129
|
+
syncInterval: 60000,
|
|
130
|
+
batchSize: exports.DEFAULT_SYNC_BATCH_SIZE,
|
|
131
|
+
conflictStrategy: 'latest_wins',
|
|
132
|
+
incrementalSync: true,
|
|
133
|
+
maxPatternsPerSync: 1000,
|
|
134
|
+
validatePatterns: true,
|
|
135
|
+
syncTimeout: 120000,
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
// ============================================
|
|
139
|
+
// Events
|
|
140
|
+
// ============================================
|
|
141
|
+
/**
|
|
142
|
+
* Coordination event types
|
|
143
|
+
*/
|
|
144
|
+
var CoordinationEventType;
|
|
145
|
+
(function (CoordinationEventType) {
|
|
146
|
+
/** State changed */
|
|
147
|
+
CoordinationEventType["STATE_CHANGED"] = "state_changed";
|
|
148
|
+
/** Peer connected */
|
|
149
|
+
CoordinationEventType["PEER_CONNECTED"] = "peer_connected";
|
|
150
|
+
/** Peer disconnected */
|
|
151
|
+
CoordinationEventType["PEER_DISCONNECTED"] = "peer_disconnected";
|
|
152
|
+
/** Peer authenticated */
|
|
153
|
+
CoordinationEventType["PEER_AUTHENTICATED"] = "peer_authenticated";
|
|
154
|
+
/** Authentication failed */
|
|
155
|
+
CoordinationEventType["AUTH_FAILED"] = "auth_failed";
|
|
156
|
+
/** Sync started */
|
|
157
|
+
CoordinationEventType["SYNC_STARTED"] = "sync_started";
|
|
158
|
+
/** Sync progress */
|
|
159
|
+
CoordinationEventType["SYNC_PROGRESS"] = "sync_progress";
|
|
160
|
+
/** Sync completed */
|
|
161
|
+
CoordinationEventType["SYNC_COMPLETED"] = "sync_completed";
|
|
162
|
+
/** Sync failed */
|
|
163
|
+
CoordinationEventType["SYNC_FAILED"] = "sync_failed";
|
|
164
|
+
/** Conflict detected */
|
|
165
|
+
CoordinationEventType["CONFLICT_DETECTED"] = "conflict_detected";
|
|
166
|
+
/** Conflict resolved */
|
|
167
|
+
CoordinationEventType["CONFLICT_RESOLVED"] = "conflict_resolved";
|
|
168
|
+
/** Health warning */
|
|
169
|
+
CoordinationEventType["HEALTH_WARNING"] = "health_warning";
|
|
170
|
+
/** Health critical */
|
|
171
|
+
CoordinationEventType["HEALTH_CRITICAL"] = "health_critical";
|
|
172
|
+
/** Health recovered */
|
|
173
|
+
CoordinationEventType["HEALTH_RECOVERED"] = "health_recovered";
|
|
174
|
+
/** Reconnecting */
|
|
175
|
+
CoordinationEventType["RECONNECTING"] = "reconnecting";
|
|
176
|
+
/** Reconnection failed */
|
|
177
|
+
CoordinationEventType["RECONNECT_FAILED"] = "reconnect_failed";
|
|
178
|
+
/** Pattern received */
|
|
179
|
+
CoordinationEventType["PATTERN_RECEIVED"] = "pattern_received";
|
|
180
|
+
/** Pattern sent */
|
|
181
|
+
CoordinationEventType["PATTERN_SENT"] = "pattern_sent";
|
|
182
|
+
/** Error occurred */
|
|
183
|
+
CoordinationEventType["ERROR"] = "error";
|
|
184
|
+
})(CoordinationEventType || (exports.CoordinationEventType = CoordinationEventType = {}));
|
|
185
|
+
// ============================================
|
|
186
|
+
// Messages
|
|
187
|
+
// ============================================
|
|
188
|
+
/**
|
|
189
|
+
* Coordination message types
|
|
190
|
+
*/
|
|
191
|
+
var CoordinationMessageType;
|
|
192
|
+
(function (CoordinationMessageType) {
|
|
193
|
+
/** Authentication challenge */
|
|
194
|
+
CoordinationMessageType["AUTH_CHALLENGE"] = "auth_challenge";
|
|
195
|
+
/** Authentication response */
|
|
196
|
+
CoordinationMessageType["AUTH_RESPONSE"] = "auth_response";
|
|
197
|
+
/** Authentication result */
|
|
198
|
+
CoordinationMessageType["AUTH_RESULT"] = "auth_result";
|
|
199
|
+
/** Capability exchange */
|
|
200
|
+
CoordinationMessageType["CAPABILITIES"] = "capabilities";
|
|
201
|
+
/** Ping request */
|
|
202
|
+
CoordinationMessageType["PING"] = "ping";
|
|
203
|
+
/** Pong response */
|
|
204
|
+
CoordinationMessageType["PONG"] = "pong";
|
|
205
|
+
/** Sync request */
|
|
206
|
+
CoordinationMessageType["SYNC_REQUEST"] = "sync_request";
|
|
207
|
+
/** Sync response */
|
|
208
|
+
CoordinationMessageType["SYNC_RESPONSE"] = "sync_response";
|
|
209
|
+
/** Sync complete */
|
|
210
|
+
CoordinationMessageType["SYNC_COMPLETE"] = "sync_complete";
|
|
211
|
+
/** Pattern batch */
|
|
212
|
+
CoordinationMessageType["PATTERN_BATCH"] = "pattern_batch";
|
|
213
|
+
/** Conflict notification */
|
|
214
|
+
CoordinationMessageType["CONFLICT"] = "conflict";
|
|
215
|
+
/** Error notification */
|
|
216
|
+
CoordinationMessageType["ERROR"] = "error";
|
|
217
|
+
/** Disconnect notification */
|
|
218
|
+
CoordinationMessageType["DISCONNECT"] = "disconnect";
|
|
219
|
+
})(CoordinationMessageType || (exports.CoordinationMessageType = CoordinationMessageType = {}));
|
|
220
|
+
// ============================================
|
|
221
|
+
// Errors
|
|
222
|
+
// ============================================
|
|
223
|
+
/**
|
|
224
|
+
* Coordination error codes
|
|
225
|
+
*/
|
|
226
|
+
var CoordinationErrorCode;
|
|
227
|
+
(function (CoordinationErrorCode) {
|
|
228
|
+
/** Connection failed */
|
|
229
|
+
CoordinationErrorCode["CONNECTION_FAILED"] = "CONNECTION_FAILED";
|
|
230
|
+
/** Authentication failed */
|
|
231
|
+
CoordinationErrorCode["AUTH_FAILED"] = "AUTH_FAILED";
|
|
232
|
+
/** Authentication timeout */
|
|
233
|
+
CoordinationErrorCode["AUTH_TIMEOUT"] = "AUTH_TIMEOUT";
|
|
234
|
+
/** Invalid signature */
|
|
235
|
+
CoordinationErrorCode["INVALID_SIGNATURE"] = "INVALID_SIGNATURE";
|
|
236
|
+
/** Peer not found */
|
|
237
|
+
CoordinationErrorCode["PEER_NOT_FOUND"] = "PEER_NOT_FOUND";
|
|
238
|
+
/** Peer not authenticated */
|
|
239
|
+
CoordinationErrorCode["PEER_NOT_AUTHENTICATED"] = "PEER_NOT_AUTHENTICATED";
|
|
240
|
+
/** Sync failed */
|
|
241
|
+
CoordinationErrorCode["SYNC_FAILED"] = "SYNC_FAILED";
|
|
242
|
+
/** Sync timeout */
|
|
243
|
+
CoordinationErrorCode["SYNC_TIMEOUT"] = "SYNC_TIMEOUT";
|
|
244
|
+
/** Conflict resolution failed */
|
|
245
|
+
CoordinationErrorCode["CONFLICT_RESOLUTION_FAILED"] = "CONFLICT_RESOLUTION_FAILED";
|
|
246
|
+
/** Protocol version mismatch */
|
|
247
|
+
CoordinationErrorCode["VERSION_MISMATCH"] = "VERSION_MISMATCH";
|
|
248
|
+
/** Invalid message */
|
|
249
|
+
CoordinationErrorCode["INVALID_MESSAGE"] = "INVALID_MESSAGE";
|
|
250
|
+
/** Rate limited */
|
|
251
|
+
CoordinationErrorCode["RATE_LIMITED"] = "RATE_LIMITED";
|
|
252
|
+
/** Connection closed */
|
|
253
|
+
CoordinationErrorCode["CONNECTION_CLOSED"] = "CONNECTION_CLOSED";
|
|
254
|
+
/** Max reconnection attempts exceeded */
|
|
255
|
+
CoordinationErrorCode["MAX_RECONNECTS_EXCEEDED"] = "MAX_RECONNECTS_EXCEEDED";
|
|
256
|
+
/** Unknown error */
|
|
257
|
+
CoordinationErrorCode["UNKNOWN"] = "UNKNOWN";
|
|
258
|
+
})(CoordinationErrorCode || (exports.CoordinationErrorCode = CoordinationErrorCode = {}));
|
|
259
|
+
/**
|
|
260
|
+
* Coordination error class
|
|
261
|
+
*/
|
|
262
|
+
class CoordinationError extends Error {
|
|
263
|
+
constructor(message, code, peerId, details) {
|
|
264
|
+
super(message);
|
|
265
|
+
this.code = code;
|
|
266
|
+
this.peerId = peerId;
|
|
267
|
+
this.details = details;
|
|
268
|
+
this.name = 'CoordinationError';
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
exports.CoordinationError = CoordinationError;
|
|
272
|
+
// ============================================
|
|
273
|
+
// Utility Types
|
|
274
|
+
// ============================================
|
|
275
|
+
/**
|
|
276
|
+
* Create default peer capabilities
|
|
277
|
+
*/
|
|
278
|
+
function createDefaultCapabilities() {
|
|
279
|
+
return {
|
|
280
|
+
version: exports.COORDINATION_VERSION,
|
|
281
|
+
patternSharing: true,
|
|
282
|
+
crdtSync: true,
|
|
283
|
+
differentialPrivacy: false,
|
|
284
|
+
maxBatchSize: exports.DEFAULT_SYNC_BATCH_SIZE,
|
|
285
|
+
categories: ['test', 'code', 'refactor', 'bugfix'],
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Create default sync status
|
|
290
|
+
*/
|
|
291
|
+
function createDefaultSyncStatus() {
|
|
292
|
+
return {
|
|
293
|
+
state: 'idle',
|
|
294
|
+
totalPatterns: 0,
|
|
295
|
+
syncedPatterns: 0,
|
|
296
|
+
pendingPatterns: 0,
|
|
297
|
+
conflicts: 0,
|
|
298
|
+
conflictsResolved: 0,
|
|
299
|
+
progressPercent: 0,
|
|
300
|
+
direction: 'bidirectional',
|
|
301
|
+
bytesTransferred: 0,
|
|
302
|
+
patternsPerSecond: 0,
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Create default coordination metrics
|
|
307
|
+
*/
|
|
308
|
+
function createDefaultMetrics() {
|
|
309
|
+
return {
|
|
310
|
+
latencyMs: 0,
|
|
311
|
+
avgLatencyMs: 0,
|
|
312
|
+
minLatencyMs: Infinity,
|
|
313
|
+
maxLatencyMs: 0,
|
|
314
|
+
jitterMs: 0,
|
|
315
|
+
messagesSent: 0,
|
|
316
|
+
messagesReceived: 0,
|
|
317
|
+
messagesPerSecond: 0,
|
|
318
|
+
bytesSent: 0,
|
|
319
|
+
bytesReceived: 0,
|
|
320
|
+
conflictsDetected: 0,
|
|
321
|
+
conflictsResolved: 0,
|
|
322
|
+
reconnectionAttempts: 0,
|
|
323
|
+
successfulSyncs: 0,
|
|
324
|
+
failedSyncs: 0,
|
|
325
|
+
uptimeMs: 0,
|
|
326
|
+
lastActivityAt: Date.now(),
|
|
327
|
+
collectedAt: Date.now(),
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Create default health status
|
|
332
|
+
*/
|
|
333
|
+
function createDefaultHealthStatus() {
|
|
334
|
+
return {
|
|
335
|
+
level: HealthLevel.HEALTHY,
|
|
336
|
+
score: 100,
|
|
337
|
+
isResponsive: true,
|
|
338
|
+
failedPings: 0,
|
|
339
|
+
currentRttMs: 0,
|
|
340
|
+
packetLossPercent: 0,
|
|
341
|
+
issues: [],
|
|
342
|
+
recommendations: [],
|
|
343
|
+
checkedAt: Date.now(),
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Generate unique message ID using cryptographically secure random
|
|
348
|
+
*/
|
|
349
|
+
function generateMessageId() {
|
|
350
|
+
const timestamp = Date.now().toString(36);
|
|
351
|
+
const randomBytes = new Uint8Array(5);
|
|
352
|
+
crypto.getRandomValues(randomBytes);
|
|
353
|
+
const random = Array.from(randomBytes).map(b => b.toString(36)).join('').substring(0, 8);
|
|
354
|
+
return `coord-${timestamp}-${random}`;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Generate authentication challenge
|
|
358
|
+
*/
|
|
359
|
+
function generateChallenge() {
|
|
360
|
+
const bytes = new Uint8Array(32);
|
|
361
|
+
crypto.getRandomValues(bytes);
|
|
362
|
+
return Array.from(bytes)
|
|
363
|
+
.map((b) => b.toString(16).padStart(2, '0'))
|
|
364
|
+
.join('');
|
|
365
|
+
}
|
|
366
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/edge/p2p/coordination/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AA6uBH,8DASC;AAKD,0DAaC;AAKD,oDAqBC;AAKD,8DAYC;AAKD,8CAMC;AAKD,8CAMC;AAn0BD,+CAA+C;AAC/C,YAAY;AACZ,+CAA+C;AAE/C;;GAEG;AACU,QAAA,oBAAoB,GAAG,OAAO,CAAC;AAE5C;;GAEG;AACU,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAE1C;;GAEG;AACU,QAAA,6BAA6B,GAAG,KAAK,CAAC;AAEnD;;GAEG;AACU,QAAA,yBAAyB,GAAG,KAAK,CAAC;AAE/C;;GAEG;AACU,QAAA,sBAAsB,GAAG,CAAC,CAAC;AAExC;;GAEG;AACU,QAAA,uBAAuB,GAAG,EAAE,CAAC;AAE1C;;GAEG;AACU,QAAA,4BAA4B,GAAG,GAAG,CAAC;AAEhD;;GAEG;AACU,QAAA,6BAA6B,GAAG,IAAI,CAAC;AAElD;;GAEG;AACU,QAAA,0BAA0B,GAAG,CAAC,CAAC;AAE5C;;GAEG;AACU,QAAA,2BAA2B,GAAG,EAAE,CAAC;AAE9C,+CAA+C;AAC/C,qBAAqB;AACrB,+CAA+C;AAE/C;;GAEG;AACH,IAAY,iBAiBX;AAjBD,WAAY,iBAAiB;IAC3B,gCAAgC;IAChC,kDAA6B,CAAA;IAC7B,oCAAoC;IACpC,8CAAyB,CAAA;IACzB,2CAA2C;IAC3C,sDAAiC,CAAA;IACjC,4CAA4C;IAC5C,wCAAmB,CAAA;IACnB,yCAAyC;IACzC,kDAA6B,CAAA;IAC7B,yCAAyC;IACzC,0CAAqB,CAAA;IACrB,4CAA4C;IAC5C,kDAA6B,CAAA;IAC7B,gCAAgC;IAChC,oCAAe,CAAA;AACjB,CAAC,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;;GAEG;AACH,SAAgB,iBAAiB;IAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC1C,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACzF,OAAO,SAAS,SAAS,IAAI,MAAM,EAAE,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB;IAC/B,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACjC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;SACrB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SAC3C,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CRDT Store - Storage and Management for Multiple CRDTs
|
|
3
|
+
*
|
|
4
|
+
* Provides a centralized store for managing multiple CRDT instances,
|
|
5
|
+
* applying remote updates, generating deltas for synchronization,
|
|
6
|
+
* and garbage collecting tombstones.
|
|
7
|
+
*
|
|
8
|
+
* @module edge/p2p/crdt/CRDTStore
|
|
9
|
+
* @version 1.0.0
|
|
10
|
+
*/
|
|
11
|
+
import { ReplicaId, CRDTType, CRDTState, CRDTStoreConfig, CRDTStoreStats, CRDTDelta, SerializedVectorClock, MergeResult, GCResult, ConflictInfo, CRDTEventHandler, SerializedGCounterState, SerializedLWWRegisterState, SerializedORSetState, SerializedPatternCRDTState } from './types';
|
|
12
|
+
import { VectorClock } from './VectorClock';
|
|
13
|
+
import { GCounter } from './GCounter';
|
|
14
|
+
import { LWWRegister } from './LWWRegister';
|
|
15
|
+
import { ORSet } from './ORSet';
|
|
16
|
+
import { PatternCRDT, PatternInput } from './PatternCRDT';
|
|
17
|
+
/**
|
|
18
|
+
* Union type for all CRDT instances
|
|
19
|
+
*/
|
|
20
|
+
type CRDTInstance = GCounter | LWWRegister<unknown> | ORSet<unknown> | PatternCRDT;
|
|
21
|
+
/**
|
|
22
|
+
* Union type for all CRDT states
|
|
23
|
+
*/
|
|
24
|
+
type CRDTStateUnion = CRDTState<SerializedGCounterState> | CRDTState<SerializedLWWRegisterState<unknown>> | CRDTState<SerializedORSetState<unknown>> | CRDTState<SerializedPatternCRDTState>;
|
|
25
|
+
/**
|
|
26
|
+
* Store for managing multiple CRDT instances.
|
|
27
|
+
*
|
|
28
|
+
* Features:
|
|
29
|
+
* - Create and retrieve CRDTs by ID
|
|
30
|
+
* - Apply remote updates and merge states
|
|
31
|
+
* - Generate delta updates for synchronization
|
|
32
|
+
* - Automatic garbage collection of tombstones
|
|
33
|
+
* - Event emission for monitoring
|
|
34
|
+
* - Conflict tracking
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const store = new CRDTStore({
|
|
39
|
+
* replicaId: 'replica-1',
|
|
40
|
+
* autoGC: true,
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* // Create CRDTs
|
|
44
|
+
* const counter = store.createGCounter('page-views');
|
|
45
|
+
* const tags = store.createORSet<string>('user-tags');
|
|
46
|
+
* const pattern = store.createPattern({
|
|
47
|
+
* id: 'pattern-1',
|
|
48
|
+
* content: '...',
|
|
49
|
+
* type: 'test',
|
|
50
|
+
* category: 'unit',
|
|
51
|
+
* domain: 'api',
|
|
52
|
+
* });
|
|
53
|
+
*
|
|
54
|
+
* // Apply remote state
|
|
55
|
+
* store.applyState(remoteState);
|
|
56
|
+
*
|
|
57
|
+
* // Generate deltas for sync
|
|
58
|
+
* const deltas = store.generateDeltas(lastSyncClock);
|
|
59
|
+
*
|
|
60
|
+
* // Get stats
|
|
61
|
+
* const stats = store.getStats();
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare class CRDTStore {
|
|
65
|
+
/** Store configuration */
|
|
66
|
+
private readonly config;
|
|
67
|
+
/** CRDT instances by ID */
|
|
68
|
+
private instances;
|
|
69
|
+
/** CRDT types by ID */
|
|
70
|
+
private types;
|
|
71
|
+
/** Global vector clock for store */
|
|
72
|
+
private vectorClock;
|
|
73
|
+
/** Delta buffer for pending sync */
|
|
74
|
+
private deltaBuffer;
|
|
75
|
+
/** Conflict history */
|
|
76
|
+
private conflicts;
|
|
77
|
+
/** Event handlers */
|
|
78
|
+
private eventHandlers;
|
|
79
|
+
/** GC interval handle */
|
|
80
|
+
private gcIntervalHandle?;
|
|
81
|
+
/** Last GC timestamp */
|
|
82
|
+
private lastGC?;
|
|
83
|
+
/** Last sync timestamp */
|
|
84
|
+
private lastSync?;
|
|
85
|
+
/**
|
|
86
|
+
* Create a new CRDT store
|
|
87
|
+
*
|
|
88
|
+
* @param config - Store configuration
|
|
89
|
+
*/
|
|
90
|
+
constructor(config?: Partial<CRDTStoreConfig>);
|
|
91
|
+
/**
|
|
92
|
+
* Create a new G-Counter
|
|
93
|
+
*
|
|
94
|
+
* @param id - Counter identifier
|
|
95
|
+
* @param initialValue - Initial value
|
|
96
|
+
* @returns Created counter
|
|
97
|
+
*/
|
|
98
|
+
createGCounter(id: string, initialValue?: number): GCounter;
|
|
99
|
+
/**
|
|
100
|
+
* Create a new LWW-Register
|
|
101
|
+
*
|
|
102
|
+
* @param id - Register identifier
|
|
103
|
+
* @param initialValue - Initial value
|
|
104
|
+
* @returns Created register
|
|
105
|
+
*/
|
|
106
|
+
createLWWRegister<T>(id: string, initialValue?: T): LWWRegister<T>;
|
|
107
|
+
/**
|
|
108
|
+
* Create a new OR-Set
|
|
109
|
+
*
|
|
110
|
+
* @param id - Set identifier
|
|
111
|
+
* @returns Created set
|
|
112
|
+
*/
|
|
113
|
+
createORSet<T>(id: string): ORSet<T>;
|
|
114
|
+
/**
|
|
115
|
+
* Create a new Pattern CRDT
|
|
116
|
+
*
|
|
117
|
+
* @param input - Pattern input data
|
|
118
|
+
* @returns Created PatternCRDT
|
|
119
|
+
*/
|
|
120
|
+
createPattern(input: PatternInput): PatternCRDT;
|
|
121
|
+
/**
|
|
122
|
+
* Get a CRDT by ID
|
|
123
|
+
*
|
|
124
|
+
* @param id - CRDT identifier
|
|
125
|
+
* @returns CRDT instance or undefined
|
|
126
|
+
*/
|
|
127
|
+
get(id: string): CRDTInstance | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Get a G-Counter by ID
|
|
130
|
+
*
|
|
131
|
+
* @param id - Counter identifier
|
|
132
|
+
* @returns Counter or undefined
|
|
133
|
+
*/
|
|
134
|
+
getGCounter(id: string): GCounter | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* Get an LWW-Register by ID
|
|
137
|
+
*
|
|
138
|
+
* @param id - Register identifier
|
|
139
|
+
* @returns Register or undefined
|
|
140
|
+
*/
|
|
141
|
+
getLWWRegister<T>(id: string): LWWRegister<T> | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* Get an OR-Set by ID
|
|
144
|
+
*
|
|
145
|
+
* @param id - Set identifier
|
|
146
|
+
* @returns Set or undefined
|
|
147
|
+
*/
|
|
148
|
+
getORSet<T>(id: string): ORSet<T> | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Get a PatternCRDT by ID
|
|
151
|
+
*
|
|
152
|
+
* @param id - Pattern identifier
|
|
153
|
+
* @returns Pattern or undefined
|
|
154
|
+
*/
|
|
155
|
+
getPattern(id: string): PatternCRDT | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* Check if a CRDT exists
|
|
158
|
+
*
|
|
159
|
+
* @param id - CRDT identifier
|
|
160
|
+
* @returns True if exists
|
|
161
|
+
*/
|
|
162
|
+
has(id: string): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Get all CRDT IDs
|
|
165
|
+
*
|
|
166
|
+
* @returns Array of IDs
|
|
167
|
+
*/
|
|
168
|
+
getIds(): string[];
|
|
169
|
+
/**
|
|
170
|
+
* Get IDs by type
|
|
171
|
+
*
|
|
172
|
+
* @param type - CRDT type to filter by
|
|
173
|
+
* @returns Array of matching IDs
|
|
174
|
+
*/
|
|
175
|
+
getIdsByType(type: CRDTType): string[];
|
|
176
|
+
/**
|
|
177
|
+
* Get the type of a CRDT
|
|
178
|
+
*
|
|
179
|
+
* @param id - CRDT identifier
|
|
180
|
+
* @returns CRDT type or undefined
|
|
181
|
+
*/
|
|
182
|
+
getType(id: string): CRDTType | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* Apply a remote CRDT state
|
|
185
|
+
*
|
|
186
|
+
* If the CRDT doesn't exist locally, it will be created.
|
|
187
|
+
* If it exists, the states will be merged.
|
|
188
|
+
*
|
|
189
|
+
* @param state - Remote CRDT state
|
|
190
|
+
* @returns Merge result
|
|
191
|
+
*/
|
|
192
|
+
applyState(state: CRDTStateUnion): MergeResult<unknown>;
|
|
193
|
+
/**
|
|
194
|
+
* Merge state with existing CRDT
|
|
195
|
+
*/
|
|
196
|
+
private mergeExisting;
|
|
197
|
+
/**
|
|
198
|
+
* Create a new CRDT from remote state
|
|
199
|
+
*/
|
|
200
|
+
private createFromState;
|
|
201
|
+
/**
|
|
202
|
+
* Apply a delta update
|
|
203
|
+
*
|
|
204
|
+
* @param delta - Delta to apply
|
|
205
|
+
* @returns True if applied successfully
|
|
206
|
+
*/
|
|
207
|
+
applyDelta(delta: CRDTDelta<unknown>): boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Generate deltas for all CRDTs since a given clock
|
|
210
|
+
*
|
|
211
|
+
* @param since - Vector clock of last sync
|
|
212
|
+
* @returns Array of deltas
|
|
213
|
+
*/
|
|
214
|
+
generateDeltas(since?: SerializedVectorClock): CRDTDelta<unknown>[];
|
|
215
|
+
/**
|
|
216
|
+
* Get all states for full sync
|
|
217
|
+
*
|
|
218
|
+
* @returns Array of all CRDT states
|
|
219
|
+
*/
|
|
220
|
+
getAllStates(): CRDTStateUnion[];
|
|
221
|
+
/**
|
|
222
|
+
* Buffer a delta for later application
|
|
223
|
+
*/
|
|
224
|
+
private bufferDelta;
|
|
225
|
+
/**
|
|
226
|
+
* Apply buffered deltas for a CRDT
|
|
227
|
+
*
|
|
228
|
+
* @param id - CRDT identifier
|
|
229
|
+
* @returns Number of deltas applied
|
|
230
|
+
*/
|
|
231
|
+
applyBufferedDeltas(id: string): number;
|
|
232
|
+
/**
|
|
233
|
+
* Run garbage collection on all ORSets
|
|
234
|
+
*
|
|
235
|
+
* @returns GC result
|
|
236
|
+
*/
|
|
237
|
+
gc(): GCResult;
|
|
238
|
+
/**
|
|
239
|
+
* Start automatic garbage collection
|
|
240
|
+
*/
|
|
241
|
+
private startAutoGC;
|
|
242
|
+
/**
|
|
243
|
+
* Stop automatic garbage collection
|
|
244
|
+
*/
|
|
245
|
+
stopAutoGC(): void;
|
|
246
|
+
/**
|
|
247
|
+
* Add conflicts to history
|
|
248
|
+
*/
|
|
249
|
+
private addConflicts;
|
|
250
|
+
/**
|
|
251
|
+
* Get recent conflicts
|
|
252
|
+
*
|
|
253
|
+
* @param limit - Maximum conflicts to return
|
|
254
|
+
* @returns Array of conflicts
|
|
255
|
+
*/
|
|
256
|
+
getConflicts(limit?: number): ConflictInfo[];
|
|
257
|
+
/**
|
|
258
|
+
* Clear conflict history
|
|
259
|
+
*/
|
|
260
|
+
clearConflicts(): void;
|
|
261
|
+
/**
|
|
262
|
+
* Delete a CRDT from the store
|
|
263
|
+
*
|
|
264
|
+
* @param id - CRDT identifier
|
|
265
|
+
* @returns True if deleted
|
|
266
|
+
*/
|
|
267
|
+
delete(id: string): boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Clear all CRDTs from the store
|
|
270
|
+
*/
|
|
271
|
+
clear(): void;
|
|
272
|
+
/**
|
|
273
|
+
* Add an event handler
|
|
274
|
+
*
|
|
275
|
+
* @param handler - Event handler function
|
|
276
|
+
*/
|
|
277
|
+
on(handler: CRDTEventHandler): void;
|
|
278
|
+
/**
|
|
279
|
+
* Remove an event handler
|
|
280
|
+
*
|
|
281
|
+
* @param handler - Handler to remove
|
|
282
|
+
*/
|
|
283
|
+
off(handler: CRDTEventHandler): void;
|
|
284
|
+
/**
|
|
285
|
+
* Emit an event
|
|
286
|
+
*/
|
|
287
|
+
private emit;
|
|
288
|
+
/**
|
|
289
|
+
* Check if store has capacity for new CRDT
|
|
290
|
+
*/
|
|
291
|
+
private checkCapacity;
|
|
292
|
+
/**
|
|
293
|
+
* Check if ID is available
|
|
294
|
+
*/
|
|
295
|
+
private checkIdAvailable;
|
|
296
|
+
/**
|
|
297
|
+
* Get store statistics
|
|
298
|
+
*
|
|
299
|
+
* @returns Store stats
|
|
300
|
+
*/
|
|
301
|
+
getStats(): CRDTStoreStats;
|
|
302
|
+
/**
|
|
303
|
+
* Estimate memory usage in bytes
|
|
304
|
+
*/
|
|
305
|
+
private estimateMemoryUsage;
|
|
306
|
+
/**
|
|
307
|
+
* Get the replica ID
|
|
308
|
+
*
|
|
309
|
+
* @returns Replica ID
|
|
310
|
+
*/
|
|
311
|
+
getReplicaId(): ReplicaId;
|
|
312
|
+
/**
|
|
313
|
+
* Get the vector clock
|
|
314
|
+
*
|
|
315
|
+
* @returns Vector clock copy
|
|
316
|
+
*/
|
|
317
|
+
getVectorClock(): VectorClock;
|
|
318
|
+
/**
|
|
319
|
+
* Dispose the store
|
|
320
|
+
*/
|
|
321
|
+
dispose(): void;
|
|
322
|
+
}
|
|
323
|
+
export {};
|
|
324
|
+
//# sourceMappingURL=CRDTStore.d.ts.map
|