agentic-qe 2.7.4 → 2.8.1
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 +209 -0
- package/README.md +67 -2
- package/dist/agents/BaseAgent.d.ts +128 -0
- package/dist/agents/BaseAgent.d.ts.map +1 -1
- package/dist/agents/BaseAgent.js +256 -0
- package/dist/agents/BaseAgent.js.map +1 -1
- 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/commands/supabase/index.d.ts +20 -0
- package/dist/cli/commands/supabase/index.d.ts.map +1 -0
- package/dist/cli/commands/supabase/index.js +632 -0
- package/dist/cli/commands/supabase/index.js.map +1 -0
- package/dist/cli/index.js +94 -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/handlers/ruvector/RuVectorHandler.d.ts +54 -0
- package/dist/mcp/handlers/ruvector/RuVectorHandler.d.ts.map +1 -0
- package/dist/mcp/handlers/ruvector/RuVectorHandler.js +325 -0
- package/dist/mcp/handlers/ruvector/RuVectorHandler.js.map +1 -0
- package/dist/mcp/handlers/ruvector/index.d.ts +5 -0
- package/dist/mcp/handlers/ruvector/index.d.ts.map +1 -0
- package/dist/mcp/handlers/ruvector/index.js +9 -0
- package/dist/mcp/handlers/ruvector/index.js.map +1 -0
- 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 +114 -22
- 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/nervous-system/adapters/BTSPAdapter.d.ts +342 -0
- package/dist/nervous-system/adapters/BTSPAdapter.d.ts.map +1 -0
- package/dist/nervous-system/adapters/BTSPAdapter.js +494 -0
- package/dist/nervous-system/adapters/BTSPAdapter.js.map +1 -0
- package/dist/nervous-system/adapters/CircadianController.d.ts +560 -0
- package/dist/nervous-system/adapters/CircadianController.d.ts.map +1 -0
- package/dist/nervous-system/adapters/CircadianController.js +882 -0
- package/dist/nervous-system/adapters/CircadianController.js.map +1 -0
- package/dist/nervous-system/adapters/GlobalWorkspaceAdapter.d.ts +337 -0
- package/dist/nervous-system/adapters/GlobalWorkspaceAdapter.d.ts.map +1 -0
- package/dist/nervous-system/adapters/GlobalWorkspaceAdapter.js +532 -0
- package/dist/nervous-system/adapters/GlobalWorkspaceAdapter.js.map +1 -0
- package/dist/nervous-system/adapters/HdcMemoryAdapter.d.ts +444 -0
- package/dist/nervous-system/adapters/HdcMemoryAdapter.d.ts.map +1 -0
- package/dist/nervous-system/adapters/HdcMemoryAdapter.js +715 -0
- package/dist/nervous-system/adapters/HdcMemoryAdapter.js.map +1 -0
- package/dist/nervous-system/adapters/ReflexLayer.d.ts +231 -0
- package/dist/nervous-system/adapters/ReflexLayer.d.ts.map +1 -0
- package/dist/nervous-system/adapters/ReflexLayer.js +309 -0
- package/dist/nervous-system/adapters/ReflexLayer.js.map +1 -0
- package/dist/nervous-system/index.d.ts +25 -0
- package/dist/nervous-system/index.d.ts.map +1 -0
- package/dist/nervous-system/index.js +80 -0
- package/dist/nervous-system/index.js.map +1 -0
- package/dist/nervous-system/integration/BTSPLearningEngine.d.ts +266 -0
- package/dist/nervous-system/integration/BTSPLearningEngine.d.ts.map +1 -0
- package/dist/nervous-system/integration/BTSPLearningEngine.js +587 -0
- package/dist/nervous-system/integration/BTSPLearningEngine.js.map +1 -0
- package/dist/nervous-system/integration/CircadianAgent.d.ts +389 -0
- package/dist/nervous-system/integration/CircadianAgent.d.ts.map +1 -0
- package/dist/nervous-system/integration/CircadianAgent.js +696 -0
- package/dist/nervous-system/integration/CircadianAgent.js.map +1 -0
- package/dist/nervous-system/integration/HybridPatternStore.d.ts +244 -0
- package/dist/nervous-system/integration/HybridPatternStore.d.ts.map +1 -0
- package/dist/nervous-system/integration/HybridPatternStore.js +622 -0
- package/dist/nervous-system/integration/HybridPatternStore.js.map +1 -0
- package/dist/nervous-system/integration/NervousSystemEnhancement.d.ts +459 -0
- package/dist/nervous-system/integration/NervousSystemEnhancement.d.ts.map +1 -0
- package/dist/nervous-system/integration/NervousSystemEnhancement.js +921 -0
- package/dist/nervous-system/integration/NervousSystemEnhancement.js.map +1 -0
- package/dist/nervous-system/integration/WorkspaceAgent.d.ts +398 -0
- package/dist/nervous-system/integration/WorkspaceAgent.d.ts.map +1 -0
- package/dist/nervous-system/integration/WorkspaceAgent.js +722 -0
- package/dist/nervous-system/integration/WorkspaceAgent.js.map +1 -0
- package/dist/nervous-system/integration/index.d.ts +22 -0
- package/dist/nervous-system/integration/index.d.ts.map +1 -0
- package/dist/nervous-system/integration/index.js +44 -0
- package/dist/nervous-system/integration/index.js.map +1 -0
- package/dist/nervous-system/persistence/BTSPSerializer.d.ts +96 -0
- package/dist/nervous-system/persistence/BTSPSerializer.d.ts.map +1 -0
- package/dist/nervous-system/persistence/BTSPSerializer.js +223 -0
- package/dist/nervous-system/persistence/BTSPSerializer.js.map +1 -0
- package/dist/nervous-system/persistence/CircadianSerializer.d.ts +90 -0
- package/dist/nervous-system/persistence/CircadianSerializer.d.ts.map +1 -0
- package/dist/nervous-system/persistence/CircadianSerializer.js +239 -0
- package/dist/nervous-system/persistence/CircadianSerializer.js.map +1 -0
- package/dist/nervous-system/persistence/HdcSerializer.d.ts +100 -0
- package/dist/nervous-system/persistence/HdcSerializer.d.ts.map +1 -0
- package/dist/nervous-system/persistence/HdcSerializer.js +259 -0
- package/dist/nervous-system/persistence/HdcSerializer.js.map +1 -0
- package/dist/nervous-system/persistence/INervousSystemStore.d.ts +208 -0
- package/dist/nervous-system/persistence/INervousSystemStore.d.ts.map +1 -0
- package/dist/nervous-system/persistence/INervousSystemStore.js +11 -0
- package/dist/nervous-system/persistence/INervousSystemStore.js.map +1 -0
- package/dist/nervous-system/persistence/NervousSystemPersistenceManager.d.ts +187 -0
- package/dist/nervous-system/persistence/NervousSystemPersistenceManager.d.ts.map +1 -0
- package/dist/nervous-system/persistence/NervousSystemPersistenceManager.js +411 -0
- package/dist/nervous-system/persistence/NervousSystemPersistenceManager.js.map +1 -0
- package/dist/nervous-system/persistence/SQLiteNervousSystemStore.d.ts +98 -0
- package/dist/nervous-system/persistence/SQLiteNervousSystemStore.d.ts.map +1 -0
- package/dist/nervous-system/persistence/SQLiteNervousSystemStore.js +510 -0
- package/dist/nervous-system/persistence/SQLiteNervousSystemStore.js.map +1 -0
- package/dist/nervous-system/persistence/index.d.ts +22 -0
- package/dist/nervous-system/persistence/index.d.ts.map +1 -0
- package/dist/nervous-system/persistence/index.js +45 -0
- package/dist/nervous-system/persistence/index.js.map +1 -0
- package/dist/nervous-system/wasm-loader.d.ts +52 -0
- package/dist/nervous-system/wasm-loader.d.ts.map +1 -0
- package/dist/nervous-system/wasm-loader.js +188 -0
- package/dist/nervous-system/wasm-loader.js.map +1 -0
- package/dist/persistence/HybridPersistenceProvider.d.ts +184 -0
- package/dist/persistence/HybridPersistenceProvider.d.ts.map +1 -0
- package/dist/persistence/HybridPersistenceProvider.js +1086 -0
- package/dist/persistence/HybridPersistenceProvider.js.map +1 -0
- package/dist/persistence/IPersistenceProvider.d.ts +657 -0
- package/dist/persistence/IPersistenceProvider.d.ts.map +1 -0
- package/dist/persistence/IPersistenceProvider.js +11 -0
- package/dist/persistence/IPersistenceProvider.js.map +1 -0
- package/dist/persistence/SupabaseConfig.d.ts +176 -0
- package/dist/persistence/SupabaseConfig.d.ts.map +1 -0
- package/dist/persistence/SupabaseConfig.js +277 -0
- package/dist/persistence/SupabaseConfig.js.map +1 -0
- package/dist/persistence/SupabasePersistenceProvider.d.ts +143 -0
- package/dist/persistence/SupabasePersistenceProvider.d.ts.map +1 -0
- package/dist/persistence/SupabasePersistenceProvider.js +955 -0
- package/dist/persistence/SupabasePersistenceProvider.js.map +1 -0
- package/dist/persistence/adapters/CodeIntelligenceSyncAdapter.d.ts +213 -0
- package/dist/persistence/adapters/CodeIntelligenceSyncAdapter.d.ts.map +1 -0
- package/dist/persistence/adapters/CodeIntelligenceSyncAdapter.js +468 -0
- package/dist/persistence/adapters/CodeIntelligenceSyncAdapter.js.map +1 -0
- package/dist/persistence/adapters/MemorySyncAdapter.d.ts +115 -0
- package/dist/persistence/adapters/MemorySyncAdapter.d.ts.map +1 -0
- package/dist/persistence/adapters/MemorySyncAdapter.js +291 -0
- package/dist/persistence/adapters/MemorySyncAdapter.js.map +1 -0
- package/dist/persistence/adapters/index.d.ts +11 -0
- package/dist/persistence/adapters/index.d.ts.map +1 -0
- package/dist/persistence/adapters/index.js +20 -0
- package/dist/persistence/adapters/index.js.map +1 -0
- package/dist/persistence/index.d.ts +14 -0
- package/dist/persistence/index.d.ts.map +1 -1
- package/dist/persistence/index.js +36 -1
- package/dist/persistence/index.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 +31 -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,743 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* BrowserAgent - Browser-Compatible Base Agent for WASM Environments
|
|
4
|
+
*
|
|
5
|
+
* This is the browser-compatible version of BaseAgent that can run in:
|
|
6
|
+
* - Modern browsers (Chrome 87+, Firefox 89+, Safari 15+)
|
|
7
|
+
* - Web Workers
|
|
8
|
+
* - Service Workers
|
|
9
|
+
* - WASM-based environments
|
|
10
|
+
*
|
|
11
|
+
* Key differences from Node.js BaseAgent:
|
|
12
|
+
* - No EventEmitter inheritance (uses custom BrowserEventEmitter)
|
|
13
|
+
* - No Node.js crypto (uses Web Crypto API via shims)
|
|
14
|
+
* - No fs/path dependencies
|
|
15
|
+
* - IndexedDB for storage instead of SQLite
|
|
16
|
+
* - BroadcastChannel for cross-tab coordination
|
|
17
|
+
*
|
|
18
|
+
* Phase 0: @ruvector/edge integration
|
|
19
|
+
* Target bundle size contribution: <100KB
|
|
20
|
+
*
|
|
21
|
+
* @module edge/browser/BrowserAgent
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.BrowserAgentBase = exports.BrowserAgent = exports.BrowserAgentStatus = exports.BrowserAgentType = void 0;
|
|
25
|
+
const browser_agent_types_1 = require("../types/browser-agent.types");
|
|
26
|
+
const shims_1 = require("../wasm/shims");
|
|
27
|
+
const index_1 = require("../index");
|
|
28
|
+
// Re-export for convenience
|
|
29
|
+
var browser_agent_types_2 = require("../types/browser-agent.types");
|
|
30
|
+
Object.defineProperty(exports, "BrowserAgentType", { enumerable: true, get: function () { return browser_agent_types_2.BrowserAgentType; } });
|
|
31
|
+
Object.defineProperty(exports, "BrowserAgentStatus", { enumerable: true, get: function () { return browser_agent_types_2.BrowserAgentStatus; } });
|
|
32
|
+
// ============================================
|
|
33
|
+
// Default Strategy Implementations
|
|
34
|
+
// ============================================
|
|
35
|
+
/**
|
|
36
|
+
* Default lifecycle strategy for browser agents
|
|
37
|
+
*/
|
|
38
|
+
class DefaultBrowserLifecycleStrategy {
|
|
39
|
+
constructor() {
|
|
40
|
+
this.status = browser_agent_types_1.BrowserAgentStatus.INITIALIZING;
|
|
41
|
+
this.statusListeners = new Map();
|
|
42
|
+
}
|
|
43
|
+
getStatus() {
|
|
44
|
+
return this.status;
|
|
45
|
+
}
|
|
46
|
+
async transitionTo(status, _reason) {
|
|
47
|
+
this.status = status;
|
|
48
|
+
const listeners = this.statusListeners.get(status);
|
|
49
|
+
if (listeners) {
|
|
50
|
+
listeners.forEach((resolve) => resolve());
|
|
51
|
+
this.statusListeners.delete(status);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async waitForStatus(status, timeout = 10000) {
|
|
55
|
+
if (this.status === status)
|
|
56
|
+
return;
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
const timer = setTimeout(() => {
|
|
59
|
+
reject(new Error(`Agent did not reach status '${status}' within ${timeout}ms`));
|
|
60
|
+
}, timeout);
|
|
61
|
+
const listener = () => {
|
|
62
|
+
clearTimeout(timer);
|
|
63
|
+
resolve();
|
|
64
|
+
};
|
|
65
|
+
if (!this.statusListeners.has(status)) {
|
|
66
|
+
this.statusListeners.set(status, []);
|
|
67
|
+
}
|
|
68
|
+
this.statusListeners.get(status).push(listener);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
async waitForReady(timeout = 10000) {
|
|
72
|
+
const status = this.getStatus();
|
|
73
|
+
if (status === browser_agent_types_1.BrowserAgentStatus.IDLE || status === browser_agent_types_1.BrowserAgentStatus.ACTIVE) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
return this.waitForStatus(browser_agent_types_1.BrowserAgentStatus.IDLE, timeout);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Default memory strategy for browser agents
|
|
81
|
+
*/
|
|
82
|
+
class DefaultBrowserMemoryStrategy {
|
|
83
|
+
constructor(memoryStore, agentId) {
|
|
84
|
+
this.memoryStore = memoryStore;
|
|
85
|
+
this.agentId = agentId;
|
|
86
|
+
}
|
|
87
|
+
async store(key, value, options) {
|
|
88
|
+
const fullKey = `aqe/${this.agentId.type}/${key}`;
|
|
89
|
+
await this.memoryStore.store(fullKey, value, options?.ttl);
|
|
90
|
+
}
|
|
91
|
+
async retrieve(key) {
|
|
92
|
+
const fullKey = `aqe/${this.agentId.type}/${key}`;
|
|
93
|
+
return this.memoryStore.retrieve(fullKey);
|
|
94
|
+
}
|
|
95
|
+
async storeShared(agentType, key, value, options) {
|
|
96
|
+
const fullKey = `aqe/shared/${agentType}/${key}`;
|
|
97
|
+
await this.memoryStore.store(fullKey, value, options?.ttl);
|
|
98
|
+
}
|
|
99
|
+
async retrieveShared(agentType, key) {
|
|
100
|
+
const fullKey = `aqe/shared/${agentType}/${key}`;
|
|
101
|
+
return this.memoryStore.retrieve(fullKey);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Default coordination strategy for browser agents
|
|
106
|
+
*/
|
|
107
|
+
class DefaultBrowserCoordinationStrategy {
|
|
108
|
+
constructor(eventBus, agentId) {
|
|
109
|
+
this.eventBus = eventBus;
|
|
110
|
+
this.agentId = agentId;
|
|
111
|
+
this.crypto = (0, shims_1.createBrowserCrypto)();
|
|
112
|
+
// Initialize BroadcastChannel for cross-tab coordination
|
|
113
|
+
if (typeof BroadcastChannel !== 'undefined') {
|
|
114
|
+
try {
|
|
115
|
+
this.broadcastChannel = new BroadcastChannel('agentic-qe-coordination');
|
|
116
|
+
this.broadcastChannel.onmessage = (event) => {
|
|
117
|
+
const message = event.data;
|
|
118
|
+
if (message.target?.id !== this.agentId.id && message.source?.id !== this.agentId.id) {
|
|
119
|
+
this.eventBus.emit(message.type, message);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
// BroadcastChannel not available
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
emitEvent(type, data) {
|
|
129
|
+
const event = {
|
|
130
|
+
id: (0, browser_agent_types_1.generateBrowserEventId)(this.crypto),
|
|
131
|
+
type,
|
|
132
|
+
source: this.agentId,
|
|
133
|
+
data,
|
|
134
|
+
timestamp: Date.now(),
|
|
135
|
+
priority: 'medium',
|
|
136
|
+
scope: 'global',
|
|
137
|
+
};
|
|
138
|
+
this.eventBus.emit(type, event);
|
|
139
|
+
this.broadcastChannel?.postMessage(event);
|
|
140
|
+
}
|
|
141
|
+
registerHandler(type, handler) {
|
|
142
|
+
this.eventBus.on(type, handler);
|
|
143
|
+
}
|
|
144
|
+
unregisterHandler(type, handler) {
|
|
145
|
+
this.eventBus.off(type, handler);
|
|
146
|
+
}
|
|
147
|
+
async broadcast(message) {
|
|
148
|
+
this.eventBus.emit('agent.message', message);
|
|
149
|
+
this.broadcastChannel?.postMessage(message);
|
|
150
|
+
}
|
|
151
|
+
destroy() {
|
|
152
|
+
this.broadcastChannel?.close();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// ============================================
|
|
156
|
+
// Simple BrowserAgent (Legacy Compatibility)
|
|
157
|
+
// ============================================
|
|
158
|
+
/**
|
|
159
|
+
* Simple browser agent for basic WASM operations
|
|
160
|
+
* Use BrowserAgentBase for full BaseAgent compatibility
|
|
161
|
+
*/
|
|
162
|
+
class BrowserAgent {
|
|
163
|
+
constructor(config) {
|
|
164
|
+
this.config = {
|
|
165
|
+
maxMemoryMB: 50,
|
|
166
|
+
debug: false,
|
|
167
|
+
...config
|
|
168
|
+
};
|
|
169
|
+
this.eventHandlers = new Set();
|
|
170
|
+
this.memory = config.memory ?? null;
|
|
171
|
+
this.state = {
|
|
172
|
+
status: 'idle',
|
|
173
|
+
lastActivity: Date.now(),
|
|
174
|
+
tasksCompleted: 0,
|
|
175
|
+
memoryUsage: {
|
|
176
|
+
usedBytes: 0,
|
|
177
|
+
maxBytes: (this.config.maxMemoryMB ?? 50) * 1024 * 1024,
|
|
178
|
+
vectorCount: 0,
|
|
179
|
+
indexSizeBytes: 0
|
|
180
|
+
},
|
|
181
|
+
capabilities: (0, index_1.getEdgeCapabilities)()
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
get id() {
|
|
185
|
+
return this.config.id;
|
|
186
|
+
}
|
|
187
|
+
get type() {
|
|
188
|
+
return this.config.type;
|
|
189
|
+
}
|
|
190
|
+
getState() {
|
|
191
|
+
return { ...this.state };
|
|
192
|
+
}
|
|
193
|
+
getCapabilities() {
|
|
194
|
+
return this.state.capabilities;
|
|
195
|
+
}
|
|
196
|
+
async start() {
|
|
197
|
+
if (this.state.status === 'running') {
|
|
198
|
+
this.log('Agent already running');
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
this.log('Starting agent...');
|
|
202
|
+
if (!this.state.capabilities.hasWASM) {
|
|
203
|
+
throw new Error('WebAssembly not supported in this environment');
|
|
204
|
+
}
|
|
205
|
+
if (this.memory) {
|
|
206
|
+
await this.memory.initialize();
|
|
207
|
+
this.updateMemoryUsage();
|
|
208
|
+
}
|
|
209
|
+
this.state.status = 'running';
|
|
210
|
+
this.state.lastActivity = Date.now();
|
|
211
|
+
this.emit({ type: 'started', agentId: this.id });
|
|
212
|
+
this.log('Agent started successfully');
|
|
213
|
+
}
|
|
214
|
+
async stop() {
|
|
215
|
+
if (this.state.status !== 'running') {
|
|
216
|
+
this.log('Agent not running');
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
this.log('Stopping agent...');
|
|
220
|
+
if (this.memory) {
|
|
221
|
+
await this.memory.close();
|
|
222
|
+
}
|
|
223
|
+
this.state.status = 'idle';
|
|
224
|
+
this.state.lastActivity = Date.now();
|
|
225
|
+
this.emit({ type: 'stopped', agentId: this.id });
|
|
226
|
+
this.log('Agent stopped');
|
|
227
|
+
}
|
|
228
|
+
async storeVector(key, vector, metadata) {
|
|
229
|
+
if (!this.memory) {
|
|
230
|
+
throw new Error('No memory adapter configured');
|
|
231
|
+
}
|
|
232
|
+
if (this.state.status !== 'running') {
|
|
233
|
+
throw new Error('Agent not running');
|
|
234
|
+
}
|
|
235
|
+
await this.memory.store(key, vector, metadata);
|
|
236
|
+
this.updateMemoryUsage();
|
|
237
|
+
this.state.lastActivity = Date.now();
|
|
238
|
+
}
|
|
239
|
+
async searchVectors(query, k = 10) {
|
|
240
|
+
if (!this.memory) {
|
|
241
|
+
throw new Error('No memory adapter configured');
|
|
242
|
+
}
|
|
243
|
+
if (this.state.status !== 'running') {
|
|
244
|
+
throw new Error('Agent not running');
|
|
245
|
+
}
|
|
246
|
+
const results = await this.memory.search(query, k);
|
|
247
|
+
this.state.lastActivity = Date.now();
|
|
248
|
+
return results;
|
|
249
|
+
}
|
|
250
|
+
on(handler) {
|
|
251
|
+
this.eventHandlers.add(handler);
|
|
252
|
+
return () => this.eventHandlers.delete(handler);
|
|
253
|
+
}
|
|
254
|
+
recordTaskCompletion(taskId, duration) {
|
|
255
|
+
this.state.tasksCompleted++;
|
|
256
|
+
this.state.lastActivity = Date.now();
|
|
257
|
+
this.emit({ type: 'task_completed', agentId: this.id, taskId, duration });
|
|
258
|
+
}
|
|
259
|
+
updateMemoryUsage() {
|
|
260
|
+
if (this.memory) {
|
|
261
|
+
this.state.memoryUsage = this.memory.getMemoryUsage();
|
|
262
|
+
this.emit({ type: 'memory_updated', agentId: this.id, usage: this.state.memoryUsage });
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
emit(event) {
|
|
266
|
+
this.eventHandlers.forEach((handler) => {
|
|
267
|
+
try {
|
|
268
|
+
handler(event);
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
this.log(`Event handler error: ${error}`);
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
log(message) {
|
|
276
|
+
if (this.config.debug) {
|
|
277
|
+
console.log(`[BrowserAgent:${this.id}] ${message}`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
exports.BrowserAgent = BrowserAgent;
|
|
282
|
+
// ============================================
|
|
283
|
+
// Abstract BrowserAgentBase (Full BaseAgent Compatibility)
|
|
284
|
+
// ============================================
|
|
285
|
+
/**
|
|
286
|
+
* Abstract base class for browser-compatible QE agents
|
|
287
|
+
* Mirrors the interface of Node.js BaseAgent
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* ```typescript
|
|
291
|
+
* class BrowserTestGeneratorAgent extends BrowserAgentBase {
|
|
292
|
+
* protected async initializeComponents(): Promise<void> {
|
|
293
|
+
* // Initialize test generation components
|
|
294
|
+
* }
|
|
295
|
+
*
|
|
296
|
+
* protected async performTask(task: BrowserTask): Promise<any> {
|
|
297
|
+
* // Generate tests in browser
|
|
298
|
+
* }
|
|
299
|
+
*
|
|
300
|
+
* protected async loadKnowledge(): Promise<void> {
|
|
301
|
+
* // Load cached patterns from IndexedDB
|
|
302
|
+
* }
|
|
303
|
+
*
|
|
304
|
+
* protected async cleanup(): Promise<void> {
|
|
305
|
+
* // Cleanup resources
|
|
306
|
+
* }
|
|
307
|
+
* }
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
class BrowserAgentBase {
|
|
311
|
+
constructor(config) {
|
|
312
|
+
this.performanceMetrics = {
|
|
313
|
+
tasksCompleted: 0,
|
|
314
|
+
averageExecutionTime: 0,
|
|
315
|
+
errorCount: 0,
|
|
316
|
+
lastActivity: Date.now(),
|
|
317
|
+
};
|
|
318
|
+
this.statusChangeCallbacks = [];
|
|
319
|
+
this.crypto = (0, shims_1.createBrowserCrypto)();
|
|
320
|
+
this.logger = (0, shims_1.createBrowserLogger)();
|
|
321
|
+
this.agentId = config.id
|
|
322
|
+
? { id: config.id, type: config.type, created: Date.now() }
|
|
323
|
+
: (0, browser_agent_types_1.generateBrowserAgentId)(config.type, this.crypto);
|
|
324
|
+
this.capabilities = new Map((config.capabilities || []).map((cap) => [cap.name, cap]));
|
|
325
|
+
this.context = config.context;
|
|
326
|
+
this.memoryStore = config.memoryStore;
|
|
327
|
+
this.eventBus = config.eventBus || (0, shims_1.createBrowserEventEmitter)();
|
|
328
|
+
this.llmConfig = config.llm;
|
|
329
|
+
this.strategies = {
|
|
330
|
+
lifecycle: config.lifecycleStrategy ?? new DefaultBrowserLifecycleStrategy(),
|
|
331
|
+
memory: config.memoryStrategy ?? new DefaultBrowserMemoryStrategy(this.memoryStore, this.agentId),
|
|
332
|
+
learning: config.learningStrategy,
|
|
333
|
+
coordination: config.coordinationStrategy ?? new DefaultBrowserCoordinationStrategy(this.eventBus, this.agentId),
|
|
334
|
+
};
|
|
335
|
+
this.setupEventHandlers();
|
|
336
|
+
}
|
|
337
|
+
// ============================================
|
|
338
|
+
// Public Interface
|
|
339
|
+
// ============================================
|
|
340
|
+
async initialize() {
|
|
341
|
+
if (this.initializationPromise) {
|
|
342
|
+
return this.initializationPromise;
|
|
343
|
+
}
|
|
344
|
+
const currentStatus = this.strategies.lifecycle.getStatus();
|
|
345
|
+
if (currentStatus === browser_agent_types_1.BrowserAgentStatus.ACTIVE || currentStatus === browser_agent_types_1.BrowserAgentStatus.IDLE) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
this.initializationPromise = this.doInitialize();
|
|
349
|
+
try {
|
|
350
|
+
await this.initializationPromise;
|
|
351
|
+
}
|
|
352
|
+
finally {
|
|
353
|
+
this.initializationPromise = undefined;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
async doInitialize() {
|
|
357
|
+
try {
|
|
358
|
+
await this.loadKnowledge();
|
|
359
|
+
const savedState = await this.memoryStore.retrieve(`state:${this.agentId.id}`);
|
|
360
|
+
if (savedState && typeof savedState === 'object') {
|
|
361
|
+
const state = savedState;
|
|
362
|
+
if (state.performanceMetrics) {
|
|
363
|
+
this.performanceMetrics = { ...this.performanceMetrics, ...state.performanceMetrics };
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
await this.initializeLLMProvider();
|
|
367
|
+
await this.initializeComponents();
|
|
368
|
+
await this.strategies.lifecycle.transitionTo(browser_agent_types_1.BrowserAgentStatus.IDLE);
|
|
369
|
+
this.emitStatusChange(browser_agent_types_1.BrowserAgentStatus.IDLE);
|
|
370
|
+
this.strategies.coordination.emitEvent('agent.initialized', { agentId: this.agentId });
|
|
371
|
+
this.logger.info(`[${this.agentId.id}] Agent initialized successfully`);
|
|
372
|
+
}
|
|
373
|
+
catch (error) {
|
|
374
|
+
await this.strategies.lifecycle.transitionTo(browser_agent_types_1.BrowserAgentStatus.ERROR, `Initialization failed: ${error}`);
|
|
375
|
+
this.emitStatusChange(browser_agent_types_1.BrowserAgentStatus.ERROR);
|
|
376
|
+
throw new browser_agent_types_1.BrowserAgentError(`Agent initialization failed: ${error}`, 'INITIALIZATION_FAILED', true, error instanceof Error ? error : undefined);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
async executeTask(assignment) {
|
|
380
|
+
const startTime = (0, shims_1.hrtime)();
|
|
381
|
+
try {
|
|
382
|
+
this.validateTaskAssignment(assignment);
|
|
383
|
+
this.currentTask = assignment;
|
|
384
|
+
await this.strategies.lifecycle.transitionTo(browser_agent_types_1.BrowserAgentStatus.ACTIVE);
|
|
385
|
+
this.emitStatusChange(browser_agent_types_1.BrowserAgentStatus.ACTIVE);
|
|
386
|
+
const preTaskData = { assignment };
|
|
387
|
+
await this.onPreTask(preTaskData);
|
|
388
|
+
const result = await this.performTask(assignment.task);
|
|
389
|
+
const duration = (0, shims_1.elapsed)(startTime);
|
|
390
|
+
const postTaskData = { assignment, result, duration };
|
|
391
|
+
await this.onPostTask(postTaskData);
|
|
392
|
+
this.updatePerformanceMetrics(startTime, true);
|
|
393
|
+
await this.memoryStore.store(`task-result:${assignment.id}`, result);
|
|
394
|
+
this.currentTask = undefined;
|
|
395
|
+
await this.strategies.lifecycle.transitionTo(browser_agent_types_1.BrowserAgentStatus.IDLE);
|
|
396
|
+
this.emitStatusChange(browser_agent_types_1.BrowserAgentStatus.IDLE);
|
|
397
|
+
return {
|
|
398
|
+
success: true,
|
|
399
|
+
data: result,
|
|
400
|
+
duration: (0, shims_1.elapsed)(startTime),
|
|
401
|
+
metadata: { taskId: assignment.id },
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
catch (error) {
|
|
405
|
+
this.updatePerformanceMetrics(startTime, false);
|
|
406
|
+
this.currentTask = undefined;
|
|
407
|
+
const taskErrorData = {
|
|
408
|
+
assignment,
|
|
409
|
+
error: error instanceof Error ? error.message : String(error),
|
|
410
|
+
stack: error instanceof Error ? error.stack : undefined,
|
|
411
|
+
};
|
|
412
|
+
await this.onTaskError(taskErrorData);
|
|
413
|
+
await this.strategies.lifecycle.transitionTo(browser_agent_types_1.BrowserAgentStatus.ERROR, `Task failed: ${error}`);
|
|
414
|
+
this.emitStatusChange(browser_agent_types_1.BrowserAgentStatus.ERROR);
|
|
415
|
+
throw new browser_agent_types_1.BrowserAgentError(`Task execution failed: ${error}`, 'TASK_FAILED', true, error instanceof Error ? error : undefined);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
async terminate() {
|
|
419
|
+
try {
|
|
420
|
+
await this.strategies.lifecycle.transitionTo(browser_agent_types_1.BrowserAgentStatus.STOPPING);
|
|
421
|
+
this.emitStatusChange(browser_agent_types_1.BrowserAgentStatus.STOPPING);
|
|
422
|
+
await this.saveState();
|
|
423
|
+
await this.cleanup();
|
|
424
|
+
await this.cleanupLLM();
|
|
425
|
+
if (this.strategies.coordination instanceof DefaultBrowserCoordinationStrategy) {
|
|
426
|
+
this.strategies.coordination.destroy();
|
|
427
|
+
}
|
|
428
|
+
await this.strategies.lifecycle.transitionTo(browser_agent_types_1.BrowserAgentStatus.TERMINATED);
|
|
429
|
+
this.emitStatusChange(browser_agent_types_1.BrowserAgentStatus.TERMINATED);
|
|
430
|
+
this.strategies.coordination.emitEvent('agent.terminated', { agentId: this.agentId });
|
|
431
|
+
this.eventBus.removeAllListeners();
|
|
432
|
+
this.statusChangeCallbacks = [];
|
|
433
|
+
this.logger.info(`[${this.agentId.id}] Agent terminated successfully`);
|
|
434
|
+
}
|
|
435
|
+
catch (error) {
|
|
436
|
+
await this.strategies.lifecycle.transitionTo(browser_agent_types_1.BrowserAgentStatus.ERROR, `Termination failed: ${error}`);
|
|
437
|
+
throw error;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
// ============================================
|
|
441
|
+
// Getters
|
|
442
|
+
// ============================================
|
|
443
|
+
getAgentId() {
|
|
444
|
+
return this.agentId;
|
|
445
|
+
}
|
|
446
|
+
getStatus() {
|
|
447
|
+
return {
|
|
448
|
+
agentId: this.agentId,
|
|
449
|
+
status: this.strategies.lifecycle.getStatus(),
|
|
450
|
+
currentTask: this.currentTask?.id,
|
|
451
|
+
capabilities: Array.from(this.capabilities.keys()),
|
|
452
|
+
performanceMetrics: { ...this.performanceMetrics },
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
hasCapability(name) {
|
|
456
|
+
return this.capabilities.has(name);
|
|
457
|
+
}
|
|
458
|
+
getCapability(name) {
|
|
459
|
+
return this.capabilities.get(name);
|
|
460
|
+
}
|
|
461
|
+
getCapabilities() {
|
|
462
|
+
return Array.from(this.capabilities.values());
|
|
463
|
+
}
|
|
464
|
+
getStrategies() {
|
|
465
|
+
return this.strategies;
|
|
466
|
+
}
|
|
467
|
+
// ============================================
|
|
468
|
+
// Event-Driven Coordination
|
|
469
|
+
// ============================================
|
|
470
|
+
async waitForStatus(status, timeout = 10000) {
|
|
471
|
+
if (this.strategies.lifecycle.waitForStatus) {
|
|
472
|
+
return this.strategies.lifecycle.waitForStatus(status, timeout);
|
|
473
|
+
}
|
|
474
|
+
return new Promise((resolve, reject) => {
|
|
475
|
+
if (this.strategies.lifecycle.getStatus() === status) {
|
|
476
|
+
return resolve();
|
|
477
|
+
}
|
|
478
|
+
const timer = setTimeout(() => {
|
|
479
|
+
reject(new Error(`Agent did not reach status '${status}' within ${timeout}ms`));
|
|
480
|
+
}, timeout);
|
|
481
|
+
const callback = (newStatus) => {
|
|
482
|
+
if (newStatus === status) {
|
|
483
|
+
clearTimeout(timer);
|
|
484
|
+
this.removeStatusChangeCallback(callback);
|
|
485
|
+
resolve();
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
this.addStatusChangeCallback(callback);
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
async waitForReady(timeout = 10000) {
|
|
492
|
+
if (this.strategies.lifecycle.waitForReady) {
|
|
493
|
+
return this.strategies.lifecycle.waitForReady(timeout);
|
|
494
|
+
}
|
|
495
|
+
const status = this.strategies.lifecycle.getStatus();
|
|
496
|
+
if (status === browser_agent_types_1.BrowserAgentStatus.IDLE || status === browser_agent_types_1.BrowserAgentStatus.ACTIVE) {
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
return this.waitForStatus(browser_agent_types_1.BrowserAgentStatus.IDLE, timeout);
|
|
500
|
+
}
|
|
501
|
+
addStatusChangeCallback(callback) {
|
|
502
|
+
this.statusChangeCallbacks.push(callback);
|
|
503
|
+
}
|
|
504
|
+
removeStatusChangeCallback(callback) {
|
|
505
|
+
const index = this.statusChangeCallbacks.indexOf(callback);
|
|
506
|
+
if (index !== -1) {
|
|
507
|
+
this.statusChangeCallbacks.splice(index, 1);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
// ============================================
|
|
511
|
+
// LLM Integration
|
|
512
|
+
// ============================================
|
|
513
|
+
hasLLM() {
|
|
514
|
+
return this.llmProvider !== undefined;
|
|
515
|
+
}
|
|
516
|
+
getLLMProvider() {
|
|
517
|
+
return this.llmProvider;
|
|
518
|
+
}
|
|
519
|
+
async llmComplete(prompt, options) {
|
|
520
|
+
if (!this.llmProvider) {
|
|
521
|
+
throw new browser_agent_types_1.BrowserAgentError('LLM not available - initialize agent first', 'LLM_ERROR', false);
|
|
522
|
+
}
|
|
523
|
+
const completionOptions = {
|
|
524
|
+
model: options?.model || this.llmConfig?.defaultModel || 'default',
|
|
525
|
+
messages: [{ role: 'user', content: prompt }],
|
|
526
|
+
maxTokens: options?.maxTokens,
|
|
527
|
+
temperature: options?.temperature,
|
|
528
|
+
metadata: {
|
|
529
|
+
...options?.metadata,
|
|
530
|
+
agentId: this.agentId.id,
|
|
531
|
+
agentType: this.agentId.type,
|
|
532
|
+
},
|
|
533
|
+
};
|
|
534
|
+
const response = await this.llmProvider.complete(completionOptions);
|
|
535
|
+
return response.content
|
|
536
|
+
.filter((block) => block.type === 'text')
|
|
537
|
+
.map((block) => block.text)
|
|
538
|
+
.join('\n');
|
|
539
|
+
}
|
|
540
|
+
async llmEmbed(text) {
|
|
541
|
+
if (!this.llmProvider?.embed) {
|
|
542
|
+
throw new browser_agent_types_1.BrowserAgentError('Embeddings not supported by LLM provider', 'LLM_ERROR', false);
|
|
543
|
+
}
|
|
544
|
+
const response = await this.llmProvider.embed({ text });
|
|
545
|
+
return response.embedding || [];
|
|
546
|
+
}
|
|
547
|
+
// ============================================
|
|
548
|
+
// FleetManager Compatibility
|
|
549
|
+
// ============================================
|
|
550
|
+
async start() {
|
|
551
|
+
const status = this.strategies.lifecycle.getStatus();
|
|
552
|
+
if (status === browser_agent_types_1.BrowserAgentStatus.ACTIVE || status === browser_agent_types_1.BrowserAgentStatus.IDLE) {
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
await this.initialize();
|
|
556
|
+
}
|
|
557
|
+
async stop() {
|
|
558
|
+
await this.terminate();
|
|
559
|
+
}
|
|
560
|
+
async assignTask(task) {
|
|
561
|
+
const assignment = {
|
|
562
|
+
id: (0, browser_agent_types_1.generateBrowserTaskId)(this.crypto),
|
|
563
|
+
task,
|
|
564
|
+
agentId: this.agentId.id,
|
|
565
|
+
assignedAt: Date.now(),
|
|
566
|
+
status: 'assigned',
|
|
567
|
+
};
|
|
568
|
+
await this.executeTask(assignment);
|
|
569
|
+
}
|
|
570
|
+
// ============================================
|
|
571
|
+
// Protected Methods
|
|
572
|
+
// ============================================
|
|
573
|
+
registerCapability(capability) {
|
|
574
|
+
this.capabilities.set(capability.name, capability);
|
|
575
|
+
this.strategies.coordination.emitEvent('capability.registered', {
|
|
576
|
+
agentId: this.agentId,
|
|
577
|
+
capability: capability.name,
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
registerCapabilities(capabilities) {
|
|
581
|
+
capabilities.forEach((cap) => this.registerCapability(cap));
|
|
582
|
+
}
|
|
583
|
+
emitEvent(type, data) {
|
|
584
|
+
this.strategies.coordination.emitEvent(type, data);
|
|
585
|
+
}
|
|
586
|
+
emitStatusChange(status) {
|
|
587
|
+
this.statusChangeCallbacks.forEach((callback) => {
|
|
588
|
+
try {
|
|
589
|
+
callback(status);
|
|
590
|
+
}
|
|
591
|
+
catch (error) {
|
|
592
|
+
this.logger.error(`Status change callback error:`, error);
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
this.strategies.coordination.emitEvent('agent.status-changed', {
|
|
596
|
+
agentId: this.agentId,
|
|
597
|
+
status,
|
|
598
|
+
timestamp: Date.now(),
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
async broadcastMessage(type, payload) {
|
|
602
|
+
const message = {
|
|
603
|
+
id: (0, browser_agent_types_1.generateBrowserMessageId)(this.crypto),
|
|
604
|
+
from: this.agentId,
|
|
605
|
+
to: { id: 'broadcast', type: browser_agent_types_1.BrowserAgentType.TEST_GENERATOR, created: Date.now() },
|
|
606
|
+
type: type,
|
|
607
|
+
payload,
|
|
608
|
+
timestamp: Date.now(),
|
|
609
|
+
priority: 'medium',
|
|
610
|
+
};
|
|
611
|
+
await this.strategies.coordination.broadcast(message);
|
|
612
|
+
}
|
|
613
|
+
async storeMemory(key, value, ttl) {
|
|
614
|
+
await this.strategies.memory.store(key, value, { ttl });
|
|
615
|
+
}
|
|
616
|
+
async retrieveMemory(key) {
|
|
617
|
+
return this.strategies.memory.retrieve(key);
|
|
618
|
+
}
|
|
619
|
+
async storeSharedMemory(key, value, ttl) {
|
|
620
|
+
await this.strategies.memory.storeShared(this.agentId.type, key, value, { ttl });
|
|
621
|
+
}
|
|
622
|
+
async retrieveSharedMemory(agentType, key) {
|
|
623
|
+
return this.strategies.memory.retrieveShared(agentType, key);
|
|
624
|
+
}
|
|
625
|
+
// ============================================
|
|
626
|
+
// Lifecycle Hooks
|
|
627
|
+
// ============================================
|
|
628
|
+
async onPreTask(data) {
|
|
629
|
+
this.taskStartTime = (0, shims_1.hrtime)();
|
|
630
|
+
if (this.strategies.lifecycle.onPreTask) {
|
|
631
|
+
await this.strategies.lifecycle.onPreTask(data);
|
|
632
|
+
}
|
|
633
|
+
this.emitEvent('hook.pre-task', { agentId: this.agentId, taskId: data.assignment.id });
|
|
634
|
+
}
|
|
635
|
+
async onPostTask(data) {
|
|
636
|
+
if (this.strategies.lifecycle.onPostTask) {
|
|
637
|
+
await this.strategies.lifecycle.onPostTask(data);
|
|
638
|
+
}
|
|
639
|
+
if (this.strategies.learning?.recordExecution) {
|
|
640
|
+
await this.strategies.learning.recordExecution({
|
|
641
|
+
task: data.assignment.task,
|
|
642
|
+
result: data.result,
|
|
643
|
+
success: true,
|
|
644
|
+
duration: data.duration,
|
|
645
|
+
metadata: { taskId: data.assignment.id },
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
this.emitEvent('hook.post-task', { agentId: this.agentId, taskId: data.assignment.id, duration: data.duration });
|
|
649
|
+
}
|
|
650
|
+
async onTaskError(data) {
|
|
651
|
+
const executionTime = this.taskStartTime ? (0, shims_1.elapsed)(this.taskStartTime) : 0;
|
|
652
|
+
await this.storeMemory(`error:${data.assignment.id}`, {
|
|
653
|
+
error: data.error,
|
|
654
|
+
stack: data.stack,
|
|
655
|
+
assignment: { id: data.assignment.id, taskType: data.assignment.task?.type ?? 'unknown' },
|
|
656
|
+
timestamp: Date.now(),
|
|
657
|
+
agentId: this.agentId.id,
|
|
658
|
+
});
|
|
659
|
+
if (this.strategies.lifecycle.onTaskError) {
|
|
660
|
+
await this.strategies.lifecycle.onTaskError(data);
|
|
661
|
+
}
|
|
662
|
+
if (this.strategies.learning?.recordExecution) {
|
|
663
|
+
await this.strategies.learning.recordExecution({
|
|
664
|
+
task: data.assignment.task,
|
|
665
|
+
error: data.error,
|
|
666
|
+
success: false,
|
|
667
|
+
duration: executionTime,
|
|
668
|
+
metadata: { taskId: data.assignment.id },
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
this.emitEvent('hook.task-error', { agentId: this.agentId, error: data.error });
|
|
672
|
+
}
|
|
673
|
+
// ============================================
|
|
674
|
+
// Private Helpers
|
|
675
|
+
// ============================================
|
|
676
|
+
async initializeLLMProvider() {
|
|
677
|
+
if (!this.llmConfig?.enabled || !this.llmConfig?.provider) {
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
try {
|
|
681
|
+
this.llmProvider = this.llmConfig.provider;
|
|
682
|
+
await this.llmProvider.initialize();
|
|
683
|
+
this.logger.info(`[${this.agentId.id}] LLM provider initialized`);
|
|
684
|
+
}
|
|
685
|
+
catch (error) {
|
|
686
|
+
this.logger.warn(`[${this.agentId.id}] LLM initialization failed:`, error);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
async cleanupLLM() {
|
|
690
|
+
if (this.llmProvider) {
|
|
691
|
+
try {
|
|
692
|
+
await this.llmProvider.shutdown();
|
|
693
|
+
this.logger.info(`[${this.agentId.id}] LLM provider shutdown complete`);
|
|
694
|
+
}
|
|
695
|
+
catch (error) {
|
|
696
|
+
this.logger.warn(`[${this.agentId.id}] LLM shutdown error:`, error);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
setupEventHandlers() {
|
|
701
|
+
this.strategies.coordination.registerHandler('fleet.shutdown', async () => {
|
|
702
|
+
await this.terminate();
|
|
703
|
+
});
|
|
704
|
+
this.strategies.coordination.registerHandler('agent.ping', (event) => {
|
|
705
|
+
if (event.target?.id === this.agentId.id) {
|
|
706
|
+
this.emitEvent('agent.pong', { agentId: this.agentId });
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
validateTaskAssignment(assignment) {
|
|
711
|
+
if (!assignment?.task) {
|
|
712
|
+
throw new browser_agent_types_1.BrowserAgentError('Invalid task assignment', 'VALIDATION_ERROR', false);
|
|
713
|
+
}
|
|
714
|
+
const requiredCapabilities = assignment.task.requirements?.capabilities || [];
|
|
715
|
+
for (const cap of requiredCapabilities) {
|
|
716
|
+
if (!this.hasCapability(cap)) {
|
|
717
|
+
throw new browser_agent_types_1.BrowserAgentError(`Missing required capability: ${cap}`, 'VALIDATION_ERROR', false);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
updatePerformanceMetrics(startTime, success) {
|
|
722
|
+
const duration = (0, shims_1.elapsed)(startTime);
|
|
723
|
+
if (success) {
|
|
724
|
+
this.performanceMetrics.tasksCompleted++;
|
|
725
|
+
this.performanceMetrics.averageExecutionTime =
|
|
726
|
+
(this.performanceMetrics.averageExecutionTime * (this.performanceMetrics.tasksCompleted - 1) + duration) /
|
|
727
|
+
this.performanceMetrics.tasksCompleted;
|
|
728
|
+
}
|
|
729
|
+
else {
|
|
730
|
+
this.performanceMetrics.errorCount++;
|
|
731
|
+
}
|
|
732
|
+
this.performanceMetrics.lastActivity = Date.now();
|
|
733
|
+
}
|
|
734
|
+
async saveState() {
|
|
735
|
+
await this.memoryStore.store(`state:${this.agentId.id}`, {
|
|
736
|
+
performanceMetrics: this.performanceMetrics,
|
|
737
|
+
timestamp: Date.now(),
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
exports.BrowserAgentBase = BrowserAgentBase;
|
|
742
|
+
exports.default = BrowserAgent;
|
|
743
|
+
//# sourceMappingURL=BrowserAgent.js.map
|