@su-record/vibe 3.0.0 → 3.1.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/hooks/scripts/__tests__/.vibe/command-log.txt +3 -78
- package/hooks/scripts/__tests__/.vibe/memories/memories.db +0 -0
- package/hooks/scripts/__tests__/.vibe/memories/memories.db-shm +0 -0
- package/hooks/scripts/__tests__/.vibe/memories/memories.db-wal +0 -0
- package/hooks/scripts/__tests__/clone-behaviors.test.js +64 -0
- package/hooks/scripts/__tests__/clone-merge-responsive.test.js +106 -0
- package/hooks/scripts/clone-extract.js +242 -28
- package/hooks/scripts/clone-merge-responsive.js +184 -0
- package/hooks/scripts/clone-spec.js +33 -8
- package/hooks/scripts/clone-validate.js +15 -9
- package/package.json +5 -2
- package/skills/clone/SKILL.md +132 -55
- package/skills/vibe.clone/SKILL.md +39 -19
- package/dist/cli/llm/gemini-commands.d.ts +0 -25
- package/dist/cli/llm/gemini-commands.d.ts.map +0 -1
- package/dist/cli/llm/gemini-commands.js +0 -143
- package/dist/cli/llm/gemini-commands.js.map +0 -1
- package/dist/cli/postinstall/codex-agents.d.ts +0 -24
- package/dist/cli/postinstall/codex-agents.d.ts.map +0 -1
- package/dist/cli/postinstall/codex-agents.js +0 -114
- package/dist/cli/postinstall/codex-agents.js.map +0 -1
- package/dist/cli/postinstall/codex-instruction.d.ts +0 -10
- package/dist/cli/postinstall/codex-instruction.d.ts.map +0 -1
- package/dist/cli/postinstall/codex-instruction.js +0 -56
- package/dist/cli/postinstall/codex-instruction.js.map +0 -1
- package/dist/cli/postinstall/gemini-agents.d.ts +0 -12
- package/dist/cli/postinstall/gemini-agents.d.ts.map +0 -1
- package/dist/cli/postinstall/gemini-agents.js +0 -80
- package/dist/cli/postinstall/gemini-agents.js.map +0 -1
- package/dist/cli/postinstall/gemini-instruction.d.ts +0 -10
- package/dist/cli/postinstall/gemini-instruction.d.ts.map +0 -1
- package/dist/cli/postinstall/gemini-instruction.js +0 -59
- package/dist/cli/postinstall/gemini-instruction.js.map +0 -1
- package/dist/infra/lib/ContextCompressor.d.ts +0 -104
- package/dist/infra/lib/ContextCompressor.d.ts.map +0 -1
- package/dist/infra/lib/ContextCompressor.js +0 -297
- package/dist/infra/lib/ContextCompressor.js.map +0 -1
- package/dist/infra/lib/ContextCompressor.test.d.ts +0 -2
- package/dist/infra/lib/ContextCompressor.test.d.ts.map +0 -1
- package/dist/infra/lib/ContextCompressor.test.js +0 -25
- package/dist/infra/lib/ContextCompressor.test.js.map +0 -1
- package/dist/infra/lib/ProgressTracker.d.ts +0 -73
- package/dist/infra/lib/ProgressTracker.d.ts.map +0 -1
- package/dist/infra/lib/ProgressTracker.js +0 -267
- package/dist/infra/lib/ProgressTracker.js.map +0 -1
- package/dist/infra/lib/TokenBudgetTracker.d.ts +0 -68
- package/dist/infra/lib/TokenBudgetTracker.d.ts.map +0 -1
- package/dist/infra/lib/TokenBudgetTracker.js +0 -191
- package/dist/infra/lib/TokenBudgetTracker.js.map +0 -1
- package/dist/infra/lib/autonomy/AuditStore.d.ts +0 -63
- package/dist/infra/lib/autonomy/AuditStore.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/AuditStore.js +0 -185
- package/dist/infra/lib/autonomy/AuditStore.js.map +0 -1
- package/dist/infra/lib/autonomy/AutonomyConfig.d.ts +0 -84
- package/dist/infra/lib/autonomy/AutonomyConfig.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/AutonomyConfig.js +0 -49
- package/dist/infra/lib/autonomy/AutonomyConfig.js.map +0 -1
- package/dist/infra/lib/autonomy/AutonomyOrchestrator.d.ts +0 -78
- package/dist/infra/lib/autonomy/AutonomyOrchestrator.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/AutonomyOrchestrator.js +0 -246
- package/dist/infra/lib/autonomy/AutonomyOrchestrator.js.map +0 -1
- package/dist/infra/lib/autonomy/BackgroundMonitor.d.ts +0 -36
- package/dist/infra/lib/autonomy/BackgroundMonitor.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/BackgroundMonitor.js +0 -138
- package/dist/infra/lib/autonomy/BackgroundMonitor.js.map +0 -1
- package/dist/infra/lib/autonomy/CollaborationProtocol.d.ts +0 -56
- package/dist/infra/lib/autonomy/CollaborationProtocol.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/CollaborationProtocol.js +0 -122
- package/dist/infra/lib/autonomy/CollaborationProtocol.js.map +0 -1
- package/dist/infra/lib/autonomy/ConfirmationManager.d.ts +0 -42
- package/dist/infra/lib/autonomy/ConfirmationManager.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/ConfirmationManager.js +0 -200
- package/dist/infra/lib/autonomy/ConfirmationManager.js.map +0 -1
- package/dist/infra/lib/autonomy/ConfirmationStore.d.ts +0 -55
- package/dist/infra/lib/autonomy/ConfirmationStore.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/ConfirmationStore.js +0 -130
- package/dist/infra/lib/autonomy/ConfirmationStore.js.map +0 -1
- package/dist/infra/lib/autonomy/EventBus.d.ts +0 -20
- package/dist/infra/lib/autonomy/EventBus.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/EventBus.js +0 -119
- package/dist/infra/lib/autonomy/EventBus.js.map +0 -1
- package/dist/infra/lib/autonomy/EventOutbox.d.ts +0 -32
- package/dist/infra/lib/autonomy/EventOutbox.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/EventOutbox.js +0 -152
- package/dist/infra/lib/autonomy/EventOutbox.js.map +0 -1
- package/dist/infra/lib/autonomy/NotificationDispatcher.d.ts +0 -24
- package/dist/infra/lib/autonomy/NotificationDispatcher.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/NotificationDispatcher.js +0 -112
- package/dist/infra/lib/autonomy/NotificationDispatcher.js.map +0 -1
- package/dist/infra/lib/autonomy/PolicyEngine.d.ts +0 -76
- package/dist/infra/lib/autonomy/PolicyEngine.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/PolicyEngine.js +0 -208
- package/dist/infra/lib/autonomy/PolicyEngine.js.map +0 -1
- package/dist/infra/lib/autonomy/ProactiveAnalyzer.d.ts +0 -61
- package/dist/infra/lib/autonomy/ProactiveAnalyzer.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/ProactiveAnalyzer.js +0 -236
- package/dist/infra/lib/autonomy/ProactiveAnalyzer.js.map +0 -1
- package/dist/infra/lib/autonomy/RiskClassifier.d.ts +0 -35
- package/dist/infra/lib/autonomy/RiskClassifier.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/RiskClassifier.js +0 -147
- package/dist/infra/lib/autonomy/RiskClassifier.js.map +0 -1
- package/dist/infra/lib/autonomy/SecuritySentinel.d.ts +0 -51
- package/dist/infra/lib/autonomy/SecuritySentinel.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/SecuritySentinel.js +0 -162
- package/dist/infra/lib/autonomy/SecuritySentinel.js.map +0 -1
- package/dist/infra/lib/autonomy/SuggestionStore.d.ts +0 -54
- package/dist/infra/lib/autonomy/SuggestionStore.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/SuggestionStore.js +0 -144
- package/dist/infra/lib/autonomy/SuggestionStore.js.map +0 -1
- package/dist/infra/lib/autonomy/TaskDecomposer.d.ts +0 -38
- package/dist/infra/lib/autonomy/TaskDecomposer.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/TaskDecomposer.js +0 -175
- package/dist/infra/lib/autonomy/TaskDecomposer.js.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/audit-store.test.d.ts +0 -2
- package/dist/infra/lib/autonomy/__tests__/audit-store.test.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/audit-store.test.js +0 -198
- package/dist/infra/lib/autonomy/__tests__/audit-store.test.js.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/event-bus.test.d.ts +0 -2
- package/dist/infra/lib/autonomy/__tests__/event-bus.test.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/event-bus.test.js +0 -225
- package/dist/infra/lib/autonomy/__tests__/event-bus.test.js.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/event-core.test.d.ts +0 -2
- package/dist/infra/lib/autonomy/__tests__/event-core.test.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/event-core.test.js +0 -194
- package/dist/infra/lib/autonomy/__tests__/event-core.test.js.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/governance.test.d.ts +0 -2
- package/dist/infra/lib/autonomy/__tests__/governance.test.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/governance.test.js +0 -540
- package/dist/infra/lib/autonomy/__tests__/governance.test.js.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/integration.test.d.ts +0 -2
- package/dist/infra/lib/autonomy/__tests__/integration.test.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/integration.test.js +0 -480
- package/dist/infra/lib/autonomy/__tests__/integration.test.js.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/proactive.test.d.ts +0 -2
- package/dist/infra/lib/autonomy/__tests__/proactive.test.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/proactive.test.js +0 -410
- package/dist/infra/lib/autonomy/__tests__/proactive.test.js.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/sentinel.test.d.ts +0 -2
- package/dist/infra/lib/autonomy/__tests__/sentinel.test.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/__tests__/sentinel.test.js +0 -486
- package/dist/infra/lib/autonomy/__tests__/sentinel.test.js.map +0 -1
- package/dist/infra/lib/autonomy/index.d.ts +0 -18
- package/dist/infra/lib/autonomy/index.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/index.js +0 -22
- package/dist/infra/lib/autonomy/index.js.map +0 -1
- package/dist/infra/lib/autonomy/schemas.d.ts +0 -317
- package/dist/infra/lib/autonomy/schemas.d.ts.map +0 -1
- package/dist/infra/lib/autonomy/schemas.js +0 -90
- package/dist/infra/lib/autonomy/schemas.js.map +0 -1
- package/dist/infra/lib/claude/index.d.ts +0 -5
- package/dist/infra/lib/claude/index.d.ts.map +0 -1
- package/dist/infra/lib/claude/index.js +0 -5
- package/dist/infra/lib/claude/index.js.map +0 -1
- package/dist/infra/lib/claude/storage.d.ts +0 -12
- package/dist/infra/lib/claude/storage.d.ts.map +0 -1
- package/dist/infra/lib/claude/storage.js +0 -54
- package/dist/infra/lib/claude/storage.js.map +0 -1
- package/dist/infra/lib/gemini/auth.d.ts +0 -18
- package/dist/infra/lib/gemini/auth.d.ts.map +0 -1
- package/dist/infra/lib/gemini/auth.js +0 -32
- package/dist/infra/lib/gemini/auth.js.map +0 -1
- package/dist/infra/lib/gemini/capabilities.d.ts +0 -28
- package/dist/infra/lib/gemini/capabilities.d.ts.map +0 -1
- package/dist/infra/lib/gemini/capabilities.js +0 -178
- package/dist/infra/lib/gemini/capabilities.js.map +0 -1
- package/dist/infra/lib/gemini/chat.d.ts +0 -35
- package/dist/infra/lib/gemini/chat.d.ts.map +0 -1
- package/dist/infra/lib/gemini/chat.js +0 -161
- package/dist/infra/lib/gemini/chat.js.map +0 -1
- package/dist/infra/lib/gemini/completion.d.ts +0 -12
- package/dist/infra/lib/gemini/completion.d.ts.map +0 -1
- package/dist/infra/lib/gemini/completion.js +0 -13
- package/dist/infra/lib/gemini/completion.js.map +0 -1
- package/dist/infra/lib/gemini/constants.d.ts +0 -8
- package/dist/infra/lib/gemini/constants.d.ts.map +0 -1
- package/dist/infra/lib/gemini/constants.js +0 -11
- package/dist/infra/lib/gemini/constants.js.map +0 -1
- package/dist/infra/lib/gemini/index.d.ts +0 -13
- package/dist/infra/lib/gemini/index.d.ts.map +0 -1
- package/dist/infra/lib/gemini/index.js +0 -12
- package/dist/infra/lib/gemini/index.js.map +0 -1
- package/dist/infra/lib/gemini/models.d.ts +0 -11
- package/dist/infra/lib/gemini/models.d.ts.map +0 -1
- package/dist/infra/lib/gemini/models.js +0 -38
- package/dist/infra/lib/gemini/models.js.map +0 -1
- package/dist/infra/lib/gemini/orchestration.d.ts +0 -33
- package/dist/infra/lib/gemini/orchestration.d.ts.map +0 -1
- package/dist/infra/lib/gemini/orchestration.js +0 -62
- package/dist/infra/lib/gemini/orchestration.js.map +0 -1
- package/dist/infra/lib/gemini/types.d.ts +0 -115
- package/dist/infra/lib/gemini/types.d.ts.map +0 -1
- package/dist/infra/lib/gemini/types.js +0 -5
- package/dist/infra/lib/gemini/types.js.map +0 -1
- package/dist/infra/orchestrator/AgentAnnouncer.d.ts +0 -64
- package/dist/infra/orchestrator/AgentAnnouncer.d.ts.map +0 -1
- package/dist/infra/orchestrator/AgentAnnouncer.js +0 -127
- package/dist/infra/orchestrator/AgentAnnouncer.js.map +0 -1
- package/dist/infra/orchestrator/AgentAnnouncer.test.d.ts +0 -5
- package/dist/infra/orchestrator/AgentAnnouncer.test.d.ts.map +0 -1
- package/dist/infra/orchestrator/AgentAnnouncer.test.js +0 -119
- package/dist/infra/orchestrator/AgentAnnouncer.test.js.map +0 -1
- package/dist/infra/orchestrator/AgentExecutor.d.ts +0 -22
- package/dist/infra/orchestrator/AgentExecutor.d.ts.map +0 -1
- package/dist/infra/orchestrator/AgentExecutor.js +0 -272
- package/dist/infra/orchestrator/AgentExecutor.js.map +0 -1
- package/dist/infra/orchestrator/AgentManager.d.ts +0 -72
- package/dist/infra/orchestrator/AgentManager.d.ts.map +0 -1
- package/dist/infra/orchestrator/AgentManager.js +0 -183
- package/dist/infra/orchestrator/AgentManager.js.map +0 -1
- package/dist/infra/orchestrator/AgentManifestCache.d.ts +0 -54
- package/dist/infra/orchestrator/AgentManifestCache.d.ts.map +0 -1
- package/dist/infra/orchestrator/AgentManifestCache.js +0 -191
- package/dist/infra/orchestrator/AgentManifestCache.js.map +0 -1
- package/dist/infra/orchestrator/AgentRegistry.d.ts +0 -76
- package/dist/infra/orchestrator/AgentRegistry.d.ts.map +0 -1
- package/dist/infra/orchestrator/AgentRegistry.js +0 -217
- package/dist/infra/orchestrator/AgentRegistry.js.map +0 -1
- package/dist/infra/orchestrator/AgentRegistry.test.d.ts +0 -5
- package/dist/infra/orchestrator/AgentRegistry.test.d.ts.map +0 -1
- package/dist/infra/orchestrator/AgentRegistry.test.js +0 -122
- package/dist/infra/orchestrator/AgentRegistry.test.js.map +0 -1
- package/dist/infra/orchestrator/BackgroundManager.d.ts +0 -128
- package/dist/infra/orchestrator/BackgroundManager.d.ts.map +0 -1
- package/dist/infra/orchestrator/BackgroundManager.js +0 -620
- package/dist/infra/orchestrator/BackgroundManager.js.map +0 -1
- package/dist/infra/orchestrator/BackgroundManager.test.d.ts +0 -6
- package/dist/infra/orchestrator/BackgroundManager.test.d.ts.map +0 -1
- package/dist/infra/orchestrator/BackgroundManager.test.js +0 -162
- package/dist/infra/orchestrator/BackgroundManager.test.js.map +0 -1
- package/dist/infra/orchestrator/CheckpointManager.d.ts +0 -54
- package/dist/infra/orchestrator/CheckpointManager.d.ts.map +0 -1
- package/dist/infra/orchestrator/CheckpointManager.js +0 -121
- package/dist/infra/orchestrator/CheckpointManager.js.map +0 -1
- package/dist/infra/orchestrator/CodexAgentRuntime.d.ts +0 -12
- package/dist/infra/orchestrator/CodexAgentRuntime.d.ts.map +0 -1
- package/dist/infra/orchestrator/CodexAgentRuntime.js +0 -94
- package/dist/infra/orchestrator/CodexAgentRuntime.js.map +0 -1
- package/dist/infra/orchestrator/CodexAgentRuntime.test.d.ts +0 -2
- package/dist/infra/orchestrator/CodexAgentRuntime.test.d.ts.map +0 -1
- package/dist/infra/orchestrator/CodexAgentRuntime.test.js +0 -37
- package/dist/infra/orchestrator/CodexAgentRuntime.test.js.map +0 -1
- package/dist/infra/orchestrator/LLMCluster.d.ts +0 -82
- package/dist/infra/orchestrator/LLMCluster.d.ts.map +0 -1
- package/dist/infra/orchestrator/LLMCluster.js +0 -146
- package/dist/infra/orchestrator/LLMCluster.js.map +0 -1
- package/dist/infra/orchestrator/MultiLlmResearch.d.ts +0 -31
- package/dist/infra/orchestrator/MultiLlmResearch.d.ts.map +0 -1
- package/dist/infra/orchestrator/MultiLlmResearch.js +0 -160
- package/dist/infra/orchestrator/MultiLlmResearch.js.map +0 -1
- package/dist/infra/orchestrator/PhasePipeline.d.ts +0 -122
- package/dist/infra/orchestrator/PhasePipeline.d.ts.map +0 -1
- package/dist/infra/orchestrator/PhasePipeline.js +0 -385
- package/dist/infra/orchestrator/PhasePipeline.js.map +0 -1
- package/dist/infra/orchestrator/PhaseResultStore.d.ts +0 -39
- package/dist/infra/orchestrator/PhaseResultStore.d.ts.map +0 -1
- package/dist/infra/orchestrator/PhaseResultStore.js +0 -151
- package/dist/infra/orchestrator/PhaseResultStore.js.map +0 -1
- package/dist/infra/orchestrator/SessionStore.d.ts +0 -40
- package/dist/infra/orchestrator/SessionStore.d.ts.map +0 -1
- package/dist/infra/orchestrator/SessionStore.js +0 -116
- package/dist/infra/orchestrator/SessionStore.js.map +0 -1
- package/dist/infra/orchestrator/SmartRouter.d.ts +0 -90
- package/dist/infra/orchestrator/SmartRouter.d.ts.map +0 -1
- package/dist/infra/orchestrator/SmartRouter.js +0 -277
- package/dist/infra/orchestrator/SmartRouter.js.map +0 -1
- package/dist/infra/orchestrator/SmartRouter.test.d.ts +0 -5
- package/dist/infra/orchestrator/SmartRouter.test.d.ts.map +0 -1
- package/dist/infra/orchestrator/SmartRouter.test.js +0 -484
- package/dist/infra/orchestrator/SmartRouter.test.js.map +0 -1
- package/dist/infra/orchestrator/SwarmOrchestrator.d.ts +0 -143
- package/dist/infra/orchestrator/SwarmOrchestrator.d.ts.map +0 -1
- package/dist/infra/orchestrator/SwarmOrchestrator.js +0 -378
- package/dist/infra/orchestrator/SwarmOrchestrator.js.map +0 -1
- package/dist/infra/orchestrator/SwarmOrchestrator.test.d.ts +0 -5
- package/dist/infra/orchestrator/SwarmOrchestrator.test.d.ts.map +0 -1
- package/dist/infra/orchestrator/SwarmOrchestrator.test.js +0 -95
- package/dist/infra/orchestrator/SwarmOrchestrator.test.js.map +0 -1
- package/dist/infra/orchestrator/agentDiscovery.d.ts +0 -26
- package/dist/infra/orchestrator/agentDiscovery.d.ts.map +0 -1
- package/dist/infra/orchestrator/agentDiscovery.js +0 -175
- package/dist/infra/orchestrator/agentDiscovery.js.map +0 -1
- package/dist/infra/orchestrator/backgroundAgent.d.ts +0 -9
- package/dist/infra/orchestrator/backgroundAgent.d.ts.map +0 -1
- package/dist/infra/orchestrator/backgroundAgent.js +0 -10
- package/dist/infra/orchestrator/backgroundAgent.js.map +0 -1
- package/dist/infra/orchestrator/index.d.ts +0 -207
- package/dist/infra/orchestrator/index.d.ts.map +0 -1
- package/dist/infra/orchestrator/index.js +0 -362
- package/dist/infra/orchestrator/index.js.map +0 -1
- package/dist/infra/orchestrator/orchestrator.d.ts +0 -60
- package/dist/infra/orchestrator/orchestrator.d.ts.map +0 -1
- package/dist/infra/orchestrator/orchestrator.js +0 -214
- package/dist/infra/orchestrator/orchestrator.js.map +0 -1
- package/dist/infra/orchestrator/parallelResearch.d.ts +0 -27
- package/dist/infra/orchestrator/parallelResearch.d.ts.map +0 -1
- package/dist/infra/orchestrator/parallelResearch.js +0 -285
- package/dist/infra/orchestrator/parallelResearch.js.map +0 -1
- package/dist/infra/orchestrator/types.d.ts +0 -205
- package/dist/infra/orchestrator/types.d.ts.map +0 -1
- package/dist/infra/orchestrator/types.js +0 -87
- package/dist/infra/orchestrator/types.js.map +0 -1
- package/dist/infra/orchestrator/types.test.d.ts +0 -2
- package/dist/infra/orchestrator/types.test.d.ts.map +0 -1
- package/dist/infra/orchestrator/types.test.js +0 -57
- package/dist/infra/orchestrator/types.test.js.map +0 -1
- package/dist/tools/semantic/analyzeDependencyGraph.d.ts +0 -12
- package/dist/tools/semantic/analyzeDependencyGraph.d.ts.map +0 -1
- package/dist/tools/semantic/analyzeDependencyGraph.js +0 -359
- package/dist/tools/semantic/analyzeDependencyGraph.js.map +0 -1
- package/dist/tools/semantic/astGrep.d.ts +0 -25
- package/dist/tools/semantic/astGrep.d.ts.map +0 -1
- package/dist/tools/semantic/astGrep.js +0 -324
- package/dist/tools/semantic/astGrep.js.map +0 -1
- package/dist/tools/semantic/astGrep.test.d.ts +0 -2
- package/dist/tools/semantic/astGrep.test.d.ts.map +0 -1
- package/dist/tools/semantic/astGrep.test.js +0 -74
- package/dist/tools/semantic/astGrep.test.js.map +0 -1
- package/dist/tools/semantic/findReferences.d.ts +0 -9
- package/dist/tools/semantic/findReferences.d.ts.map +0 -1
- package/dist/tools/semantic/findReferences.js +0 -200
- package/dist/tools/semantic/findReferences.js.map +0 -1
- package/dist/tools/semantic/findSymbol.d.ts +0 -8
- package/dist/tools/semantic/findSymbol.d.ts.map +0 -1
- package/dist/tools/semantic/findSymbol.js +0 -204
- package/dist/tools/semantic/findSymbol.js.map +0 -1
- package/dist/tools/semantic/index.d.ts +0 -9
- package/dist/tools/semantic/index.d.ts.map +0 -1
- package/dist/tools/semantic/index.js +0 -11
- package/dist/tools/semantic/index.js.map +0 -1
- package/dist/tools/semantic/lsp.d.ts +0 -68
- package/dist/tools/semantic/lsp.d.ts.map +0 -1
- package/dist/tools/semantic/lsp.js +0 -561
- package/dist/tools/semantic/lsp.js.map +0 -1
- package/dist/tools/spec/e2eTestGenerator.d.ts +0 -61
- package/dist/tools/spec/e2eTestGenerator.d.ts.map +0 -1
- package/dist/tools/spec/e2eTestGenerator.js +0 -255
- package/dist/tools/spec/e2eTestGenerator.js.map +0 -1
- package/dist/tools/spec/specVersioning.d.ts +0 -76
- package/dist/tools/spec/specVersioning.d.ts.map +0 -1
- package/dist/tools/spec/specVersioning.js +0 -236
- package/dist/tools/spec/specVersioning.js.map +0 -1
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { uuidv7 } from 'uuidv7';
|
|
2
|
-
const DEFAULT_PAGE_SIZE = 50;
|
|
3
|
-
const MAX_PAGE_SIZE = 200;
|
|
4
|
-
const SENSITIVE_PATTERNS = [
|
|
5
|
-
[/\b(sk-[a-zA-Z0-9]{20,})\b/g, '[REDACTED:API_KEY]'],
|
|
6
|
-
[/\b(key-[a-zA-Z0-9]{20,})\b/g, '[REDACTED:API_KEY]'],
|
|
7
|
-
[/Bearer\s+[a-zA-Z0-9._\-]+/gi, 'Bearer [REDACTED]'],
|
|
8
|
-
[/("?password"?\s*[:=]\s*)"[^"]*"/gi, '$1"[REDACTED]"'],
|
|
9
|
-
[/("?secret"?\s*[:=]\s*)"[^"]*"/gi, '$1"[REDACTED]"'],
|
|
10
|
-
[/("?token"?\s*[:=]\s*)"[^"]*"/gi, '$1"[REDACTED]"'],
|
|
11
|
-
];
|
|
12
|
-
export class AuditStore {
|
|
13
|
-
db;
|
|
14
|
-
insertStmt;
|
|
15
|
-
fts5Available = false;
|
|
16
|
-
constructor(storage) {
|
|
17
|
-
this.db = storage.getDatabase();
|
|
18
|
-
this.initTables();
|
|
19
|
-
this.insertStmt = this.db.prepare(`
|
|
20
|
-
INSERT INTO audit_events
|
|
21
|
-
(id, correlationId, causationId, eventType, agentId, actionType, riskLevel, payload, outcome, createdAt)
|
|
22
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
23
|
-
`);
|
|
24
|
-
}
|
|
25
|
-
initTables() {
|
|
26
|
-
this.db.exec(`
|
|
27
|
-
CREATE TABLE IF NOT EXISTS audit_events (
|
|
28
|
-
id TEXT PRIMARY KEY,
|
|
29
|
-
correlationId TEXT NOT NULL,
|
|
30
|
-
causationId TEXT,
|
|
31
|
-
eventType TEXT NOT NULL,
|
|
32
|
-
agentId TEXT,
|
|
33
|
-
actionType TEXT,
|
|
34
|
-
riskLevel TEXT,
|
|
35
|
-
payload TEXT NOT NULL,
|
|
36
|
-
outcome TEXT CHECK(outcome IS NULL OR outcome IN ('allowed', 'blocked', 'pending', 'expired')),
|
|
37
|
-
createdAt TEXT NOT NULL
|
|
38
|
-
);
|
|
39
|
-
CREATE INDEX IF NOT EXISTS idx_audit_agent_time ON audit_events(agentId, createdAt);
|
|
40
|
-
CREATE INDEX IF NOT EXISTS idx_audit_type_time ON audit_events(eventType, createdAt);
|
|
41
|
-
CREATE INDEX IF NOT EXISTS idx_audit_correlation ON audit_events(correlationId);
|
|
42
|
-
`);
|
|
43
|
-
try {
|
|
44
|
-
this.db.exec(`
|
|
45
|
-
CREATE VIRTUAL TABLE IF NOT EXISTS audit_events_fts USING fts5(
|
|
46
|
-
eventType, agentId, payload,
|
|
47
|
-
content='audit_events', content_rowid='rowid'
|
|
48
|
-
);
|
|
49
|
-
`);
|
|
50
|
-
this.db.exec(`
|
|
51
|
-
CREATE TRIGGER IF NOT EXISTS audit_events_fts_ai AFTER INSERT ON audit_events BEGIN
|
|
52
|
-
INSERT INTO audit_events_fts(rowid, eventType, agentId, payload)
|
|
53
|
-
VALUES (new.rowid, new.eventType, new.agentId, new.payload);
|
|
54
|
-
END;
|
|
55
|
-
`);
|
|
56
|
-
this.fts5Available = true;
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
this.fts5Available = false;
|
|
60
|
-
}
|
|
61
|
-
this.db.exec(`
|
|
62
|
-
CREATE TRIGGER IF NOT EXISTS prevent_audit_update
|
|
63
|
-
BEFORE UPDATE ON audit_events
|
|
64
|
-
BEGIN SELECT RAISE(ABORT, 'Audit logs are immutable'); END;
|
|
65
|
-
CREATE TRIGGER IF NOT EXISTS prevent_audit_delete
|
|
66
|
-
BEFORE DELETE ON audit_events
|
|
67
|
-
BEGIN SELECT RAISE(ABORT, 'Audit logs are immutable'); END;
|
|
68
|
-
`);
|
|
69
|
-
}
|
|
70
|
-
static redactSensitive(payload) {
|
|
71
|
-
let redacted = payload;
|
|
72
|
-
for (const [pattern, replacement] of SENSITIVE_PATTERNS) {
|
|
73
|
-
redacted = redacted.replace(new RegExp(pattern.source, pattern.flags), replacement);
|
|
74
|
-
}
|
|
75
|
-
return redacted;
|
|
76
|
-
}
|
|
77
|
-
record(event) {
|
|
78
|
-
const id = uuidv7();
|
|
79
|
-
const payloadStr = AuditStore.redactSensitive(JSON.stringify(event.payload));
|
|
80
|
-
this.insertStmt.run(id, event.correlationId, event.causationId ?? null, event.eventType, event.agentId ?? null, event.actionType ?? null, event.riskLevel ?? null, payloadStr, event.outcome ?? null, new Date().toISOString());
|
|
81
|
-
return id;
|
|
82
|
-
}
|
|
83
|
-
recordBatch(events) {
|
|
84
|
-
const ids = [];
|
|
85
|
-
const batchInsert = this.db.transaction(() => {
|
|
86
|
-
for (const event of events) {
|
|
87
|
-
ids.push(this.record(event));
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
batchInsert();
|
|
91
|
-
return ids;
|
|
92
|
-
}
|
|
93
|
-
query(filters) {
|
|
94
|
-
const conditions = [];
|
|
95
|
-
const params = [];
|
|
96
|
-
if (filters.agentId) {
|
|
97
|
-
conditions.push('agentId = ?');
|
|
98
|
-
params.push(filters.agentId);
|
|
99
|
-
}
|
|
100
|
-
if (filters.eventType) {
|
|
101
|
-
conditions.push('eventType = ?');
|
|
102
|
-
params.push(filters.eventType);
|
|
103
|
-
}
|
|
104
|
-
if (filters.riskLevel) {
|
|
105
|
-
conditions.push('riskLevel = ?');
|
|
106
|
-
params.push(filters.riskLevel);
|
|
107
|
-
}
|
|
108
|
-
if (filters.outcome) {
|
|
109
|
-
conditions.push('outcome = ?');
|
|
110
|
-
params.push(filters.outcome);
|
|
111
|
-
}
|
|
112
|
-
if (filters.startDate) {
|
|
113
|
-
conditions.push('createdAt >= ?');
|
|
114
|
-
params.push(filters.startDate);
|
|
115
|
-
}
|
|
116
|
-
if (filters.endDate) {
|
|
117
|
-
conditions.push('createdAt <= ?');
|
|
118
|
-
params.push(filters.endDate);
|
|
119
|
-
}
|
|
120
|
-
const where = conditions.length > 0 ? `WHERE ${conditions.join(' AND ')}` : '';
|
|
121
|
-
const limit = Math.min(filters.limit || DEFAULT_PAGE_SIZE, MAX_PAGE_SIZE);
|
|
122
|
-
const offset = filters.offset || 0;
|
|
123
|
-
const sql = `SELECT * FROM audit_events ${where} ORDER BY createdAt DESC LIMIT ? OFFSET ?`;
|
|
124
|
-
params.push(limit, offset);
|
|
125
|
-
return this.db.prepare(sql).all(...params);
|
|
126
|
-
}
|
|
127
|
-
getByCorrelation(correlationId) {
|
|
128
|
-
return this.db
|
|
129
|
-
.prepare('SELECT * FROM audit_events WHERE correlationId = ? ORDER BY createdAt ASC')
|
|
130
|
-
.all(correlationId);
|
|
131
|
-
}
|
|
132
|
-
getStats(dateRange) {
|
|
133
|
-
const dateCondition = dateRange ? 'WHERE createdAt >= ? AND createdAt <= ?' : '';
|
|
134
|
-
const dateParams = dateRange ? [dateRange.startDate, dateRange.endDate] : [];
|
|
135
|
-
const total = this.db
|
|
136
|
-
.prepare(`SELECT COUNT(*) as count FROM audit_events ${dateCondition}`)
|
|
137
|
-
.get(...dateParams).count;
|
|
138
|
-
const byType = this.db
|
|
139
|
-
.prepare(`SELECT eventType, COUNT(*) as count FROM audit_events ${dateCondition} GROUP BY eventType`)
|
|
140
|
-
.all(...dateParams);
|
|
141
|
-
const riskCondition = dateRange
|
|
142
|
-
? 'WHERE createdAt >= ? AND createdAt <= ? AND riskLevel IS NOT NULL'
|
|
143
|
-
: 'WHERE riskLevel IS NOT NULL';
|
|
144
|
-
const byRisk = this.db
|
|
145
|
-
.prepare(`SELECT riskLevel, COUNT(*) as count FROM audit_events ${riskCondition} GROUP BY riskLevel`)
|
|
146
|
-
.all(...dateParams);
|
|
147
|
-
const blockedCondition = dateRange
|
|
148
|
-
? `WHERE createdAt >= ? AND createdAt <= ? AND outcome = 'blocked'`
|
|
149
|
-
: `WHERE outcome = 'blocked'`;
|
|
150
|
-
const blocked = this.db
|
|
151
|
-
.prepare(`SELECT COUNT(*) as count FROM audit_events ${blockedCondition}`)
|
|
152
|
-
.get(...dateParams).count;
|
|
153
|
-
return {
|
|
154
|
-
totalEvents: total,
|
|
155
|
-
byEventType: Object.fromEntries(byType.map((r) => [r.eventType, r.count])),
|
|
156
|
-
byRiskLevel: Object.fromEntries(byRisk.map((r) => [r.riskLevel, r.count])),
|
|
157
|
-
blockedCount: blocked,
|
|
158
|
-
blockedRate: total > 0 ? blocked / total : 0,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
search(query, limit) {
|
|
162
|
-
if (!this.fts5Available)
|
|
163
|
-
return [];
|
|
164
|
-
const sanitized = query
|
|
165
|
-
.replace(/[*"()\-]/g, ' ')
|
|
166
|
-
.replace(/\b(AND|OR|NOT)\b/gi, ' ')
|
|
167
|
-
.trim();
|
|
168
|
-
if (!sanitized)
|
|
169
|
-
return [];
|
|
170
|
-
const pageSize = Math.min(limit || DEFAULT_PAGE_SIZE, MAX_PAGE_SIZE);
|
|
171
|
-
try {
|
|
172
|
-
return this.db
|
|
173
|
-
.prepare(`SELECT a.* FROM audit_events a
|
|
174
|
-
JOIN audit_events_fts f ON a.rowid = f.rowid
|
|
175
|
-
WHERE audit_events_fts MATCH ?
|
|
176
|
-
ORDER BY rank
|
|
177
|
-
LIMIT ?`)
|
|
178
|
-
.all(sanitized, pageSize);
|
|
179
|
-
}
|
|
180
|
-
catch {
|
|
181
|
-
return [];
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
//# sourceMappingURL=AuditStore.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuditStore.js","sourceRoot":"","sources":["../../../../src/infra/lib/autonomy/AuditStore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,MAAM,kBAAkB,GAAoC;IAC1D,CAAC,4BAA4B,EAAE,oBAAoB,CAAC;IACpD,CAAC,6BAA6B,EAAE,oBAAoB,CAAC;IACrD,CAAC,6BAA6B,EAAE,mBAAmB,CAAC;IACpD,CAAC,mCAAmC,EAAE,gBAAgB,CAAC;IACvD,CAAC,iCAAiC,EAAE,gBAAgB,CAAC;IACrD,CAAC,gCAAgC,EAAE,gBAAgB,CAAC;CACrD,CAAC;AAiDF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W,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;YAC1E,YAAY,EAAE,OAAO;YACrB,WAAW,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;SAC7C,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAa,EAAE,KAAc;QAClC,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,OAAO,EAAE,CAAC;QAEnC,MAAM,SAAS,GAAG,KAAK;aACpB,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC;aACzB,OAAO,CAAC,oBAAoB,EAAE,GAAG,CAAC;aAClC,IAAI,EAAE,CAAC;QACV,IAAI,CAAC,SAAS;YAAE,OAAO,EAAE,CAAC;QAE1B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,iBAAiB,EAAE,aAAa,CAAC,CAAC;QAErE,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,EAAE;iBACX,OAAO,CACN;;;;mBAIS,CACV;iBACA,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAoB,CAAC;QACjD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const NotificationChannelEnum: z.ZodEnum<{
|
|
3
|
-
telegram: "telegram";
|
|
4
|
-
slack: "slack";
|
|
5
|
-
web: "web";
|
|
6
|
-
}>;
|
|
7
|
-
export declare const SentinelConfigSchema: z.ZodObject<{
|
|
8
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
9
|
-
notificationChannels: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
10
|
-
telegram: "telegram";
|
|
11
|
-
slack: "slack";
|
|
12
|
-
web: "web";
|
|
13
|
-
}>>>;
|
|
14
|
-
confirmationTimeout: z.ZodDefault<z.ZodNumber>;
|
|
15
|
-
rules: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
16
|
-
}, z.core.$strip>;
|
|
17
|
-
export declare const ProactiveConfigSchema: z.ZodObject<{
|
|
18
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
19
|
-
modules: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
20
|
-
quality: "quality";
|
|
21
|
-
performance: "performance";
|
|
22
|
-
security: "security";
|
|
23
|
-
dependency: "dependency";
|
|
24
|
-
}>>>;
|
|
25
|
-
}, z.core.$strip>;
|
|
26
|
-
export declare const AutonomyModeEnum: z.ZodEnum<{
|
|
27
|
-
auto: "auto";
|
|
28
|
-
suggest: "suggest";
|
|
29
|
-
disabled: "disabled";
|
|
30
|
-
}>;
|
|
31
|
-
export declare const AutonomyConfigSchema: z.ZodObject<{
|
|
32
|
-
mode: z.ZodDefault<z.ZodEnum<{
|
|
33
|
-
auto: "auto";
|
|
34
|
-
suggest: "suggest";
|
|
35
|
-
disabled: "disabled";
|
|
36
|
-
}>>;
|
|
37
|
-
proactive: z.ZodDefault<z.ZodObject<{
|
|
38
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
39
|
-
modules: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
40
|
-
quality: "quality";
|
|
41
|
-
performance: "performance";
|
|
42
|
-
security: "security";
|
|
43
|
-
dependency: "dependency";
|
|
44
|
-
}>>>;
|
|
45
|
-
}, z.core.$strip>>;
|
|
46
|
-
maxConcurrentSteps: z.ZodDefault<z.ZodNumber>;
|
|
47
|
-
maxStepTimeout: z.ZodDefault<z.ZodNumber>;
|
|
48
|
-
}, z.core.$strip>;
|
|
49
|
-
export declare const FullConfigSchema: z.ZodObject<{
|
|
50
|
-
sentinel: z.ZodDefault<z.ZodObject<{
|
|
51
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
52
|
-
notificationChannels: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
53
|
-
telegram: "telegram";
|
|
54
|
-
slack: "slack";
|
|
55
|
-
web: "web";
|
|
56
|
-
}>>>;
|
|
57
|
-
confirmationTimeout: z.ZodDefault<z.ZodNumber>;
|
|
58
|
-
rules: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
59
|
-
}, z.core.$strip>>;
|
|
60
|
-
autonomy: z.ZodDefault<z.ZodObject<{
|
|
61
|
-
mode: z.ZodDefault<z.ZodEnum<{
|
|
62
|
-
auto: "auto";
|
|
63
|
-
suggest: "suggest";
|
|
64
|
-
disabled: "disabled";
|
|
65
|
-
}>>;
|
|
66
|
-
proactive: z.ZodDefault<z.ZodObject<{
|
|
67
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
68
|
-
modules: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
69
|
-
quality: "quality";
|
|
70
|
-
performance: "performance";
|
|
71
|
-
security: "security";
|
|
72
|
-
dependency: "dependency";
|
|
73
|
-
}>>>;
|
|
74
|
-
}, z.core.$strip>>;
|
|
75
|
-
maxConcurrentSteps: z.ZodDefault<z.ZodNumber>;
|
|
76
|
-
maxStepTimeout: z.ZodDefault<z.ZodNumber>;
|
|
77
|
-
}, z.core.$strip>>;
|
|
78
|
-
}, z.core.$strip>;
|
|
79
|
-
export type SentinelConfig = z.infer<typeof SentinelConfigSchema>;
|
|
80
|
-
export type AutonomyConfig = z.infer<typeof AutonomyConfigSchema>;
|
|
81
|
-
export type FullConfig = z.infer<typeof FullConfigSchema>;
|
|
82
|
-
export declare function loadConfig(rawConfig: unknown): FullConfig;
|
|
83
|
-
export declare function getDefaultConfig(): FullConfig;
|
|
84
|
-
//# sourceMappingURL=AutonomyConfig.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AutonomyConfig.d.ts","sourceRoot":"","sources":["../../../../src/infra/lib/autonomy/AutonomyConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,uBAAuB;;;;EAAuC,CAAC;AAE5E,eAAO,MAAM,oBAAoB;;;;;;;;;iBAK/B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;iBAKhC,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;EAA0C,CAAC;AAExE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;iBAK/B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAG3B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAM1D,wBAAgB,UAAU,CAAC,SAAS,EAAE,OAAO,GAAG,UAAU,CAczD;AAED,wBAAgB,gBAAgB,IAAI,UAAU,CAE7C"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
3
|
-
// Config Schemas
|
|
4
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
5
|
-
export const NotificationChannelEnum = z.enum(['telegram', 'slack', 'web']);
|
|
6
|
-
export const SentinelConfigSchema = z.object({
|
|
7
|
-
enabled: z.boolean().default(true),
|
|
8
|
-
notificationChannels: z.array(NotificationChannelEnum).default(['telegram', 'slack', 'web']),
|
|
9
|
-
confirmationTimeout: z.number().min(60).max(3600).default(300),
|
|
10
|
-
rules: z.array(z.record(z.string(), z.unknown())).default([]),
|
|
11
|
-
});
|
|
12
|
-
export const ProactiveConfigSchema = z.object({
|
|
13
|
-
enabled: z.boolean().default(true),
|
|
14
|
-
modules: z
|
|
15
|
-
.array(z.enum(['security', 'performance', 'quality', 'dependency']))
|
|
16
|
-
.default(['security', 'performance', 'quality', 'dependency']),
|
|
17
|
-
});
|
|
18
|
-
export const AutonomyModeEnum = z.enum(['suggest', 'auto', 'disabled']);
|
|
19
|
-
export const AutonomyConfigSchema = z.object({
|
|
20
|
-
mode: AutonomyModeEnum.default('suggest'),
|
|
21
|
-
proactive: ProactiveConfigSchema.default(() => ProactiveConfigSchema.parse({})),
|
|
22
|
-
maxConcurrentSteps: z.number().min(1).max(5).default(3),
|
|
23
|
-
maxStepTimeout: z.number().min(60).max(3600).default(600),
|
|
24
|
-
});
|
|
25
|
-
export const FullConfigSchema = z.object({
|
|
26
|
-
sentinel: SentinelConfigSchema.default(() => SentinelConfigSchema.parse({})),
|
|
27
|
-
autonomy: AutonomyConfigSchema.default(() => AutonomyConfigSchema.parse({})),
|
|
28
|
-
});
|
|
29
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
30
|
-
// Config Loader
|
|
31
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
32
|
-
export function loadConfig(rawConfig) {
|
|
33
|
-
try {
|
|
34
|
-
return FullConfigSchema.parse(rawConfig ?? {});
|
|
35
|
-
}
|
|
36
|
-
catch (err) {
|
|
37
|
-
if (err instanceof z.ZodError) {
|
|
38
|
-
for (const issue of err.issues) {
|
|
39
|
-
process.stderr.write(`[AutonomyConfig] Invalid config at '${issue.path.join('.')}': ${issue.message} — using default\n`);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
// Return defaults on validation failure
|
|
43
|
-
return FullConfigSchema.parse({});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export function getDefaultConfig() {
|
|
47
|
-
return FullConfigSchema.parse({});
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=AutonomyConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AutonomyConfig.js","sourceRoot":"","sources":["../../../../src/infra/lib/autonomy/AutonomyConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yDAAyD;AACzD,iBAAiB;AACjB,yDAAyD;AAEzD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAE5E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAClC,oBAAoB,EAAE,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC5F,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;IAC9D,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CAC9D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAClC,OAAO,E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C,IAAI,CAAC;QACH,OAAO,gBAAgB,CAAC,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;YAC9B,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;gBAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,uCAAuC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,OAAO,oBAAoB,CACnG,CAAC;YACJ,CAAC;QACH,CAAC;QACD,wCAAwC;QACxC,OAAO,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import type { EventBus } from './EventBus.js';
|
|
2
|
-
import type { AuditStore } from './AuditStore.js';
|
|
3
|
-
import type { SecuritySentinel } from './SecuritySentinel.js';
|
|
4
|
-
import type { ConfirmationManager } from './ConfirmationManager.js';
|
|
5
|
-
import { TaskDecomposer } from './TaskDecomposer.js';
|
|
6
|
-
import type { DecomposedTask, TaskStep, StepStatus } from './TaskDecomposer.js';
|
|
7
|
-
import { CollaborationProtocol } from './CollaborationProtocol.js';
|
|
8
|
-
import type { AgentAssignment } from './CollaborationProtocol.js';
|
|
9
|
-
export type AutonomyMode = 'suggest' | 'auto' | 'disabled';
|
|
10
|
-
export interface StepResult {
|
|
11
|
-
stepId: string;
|
|
12
|
-
status: StepStatus;
|
|
13
|
-
agentName: string;
|
|
14
|
-
output?: string;
|
|
15
|
-
error?: string;
|
|
16
|
-
startedAt: string;
|
|
17
|
-
completedAt: string;
|
|
18
|
-
durationMs: number;
|
|
19
|
-
}
|
|
20
|
-
export interface ExecutionResult {
|
|
21
|
-
taskId: string;
|
|
22
|
-
mode: AutonomyMode;
|
|
23
|
-
status: 'completed' | 'partial' | 'failed' | 'pending_confirmation' | 'suggested';
|
|
24
|
-
stepResults: StepResult[];
|
|
25
|
-
totalDurationMs: number;
|
|
26
|
-
startedAt: string;
|
|
27
|
-
completedAt: string;
|
|
28
|
-
}
|
|
29
|
-
export interface TaskProgress {
|
|
30
|
-
taskId: string;
|
|
31
|
-
totalSteps: number;
|
|
32
|
-
completedSteps: number;
|
|
33
|
-
currentStep: string | null;
|
|
34
|
-
percentComplete: number;
|
|
35
|
-
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
36
|
-
}
|
|
37
|
-
export type StepExecutor = (step: TaskStep, assignment: AgentAssignment) => Promise<{
|
|
38
|
-
success: boolean;
|
|
39
|
-
output?: string;
|
|
40
|
-
error?: string;
|
|
41
|
-
}>;
|
|
42
|
-
export interface OrchestratorDeps {
|
|
43
|
-
eventBus: EventBus;
|
|
44
|
-
auditStore: AuditStore;
|
|
45
|
-
sentinel: SecuritySentinel;
|
|
46
|
-
confirmationManager?: ConfirmationManager;
|
|
47
|
-
stepExecutor?: StepExecutor;
|
|
48
|
-
maxConcurrentSteps?: number;
|
|
49
|
-
maxStepTimeoutS?: number;
|
|
50
|
-
}
|
|
51
|
-
export declare class AutonomyOrchestrator {
|
|
52
|
-
private readonly decomposer;
|
|
53
|
-
private readonly protocol;
|
|
54
|
-
private readonly eventBus;
|
|
55
|
-
private readonly auditStore;
|
|
56
|
-
private readonly sentinel;
|
|
57
|
-
private readonly confirmationManager?;
|
|
58
|
-
private readonly stepExecutor?;
|
|
59
|
-
private readonly maxConcurrent;
|
|
60
|
-
private readonly maxStepTimeoutS;
|
|
61
|
-
private readonly progress;
|
|
62
|
-
constructor(deps: OrchestratorDeps);
|
|
63
|
-
decomposePrompt(prompt: string): DecomposedTask;
|
|
64
|
-
execute(task: DecomposedTask, mode: AutonomyMode): Promise<ExecutionResult>;
|
|
65
|
-
getProgress(taskId: string): TaskProgress | undefined;
|
|
66
|
-
getDecomposer(): TaskDecomposer;
|
|
67
|
-
getProtocol(): CollaborationProtocol;
|
|
68
|
-
private executeStep;
|
|
69
|
-
private buildSuggestResult;
|
|
70
|
-
private buildStepResult;
|
|
71
|
-
private emitStepEvent;
|
|
72
|
-
private stepTypeToActionType;
|
|
73
|
-
private executeWithTimeout;
|
|
74
|
-
private initProgress;
|
|
75
|
-
private updateProgress;
|
|
76
|
-
private finalizeProgress;
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=AutonomyOrchestrator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AutonomyOrchestrator.d.ts","sourceRoot":"","sources":["../../../../src/infra/lib/autonomy/AutonomyOrchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAsB,MAAM,0BAA0B,CAAC;AAExF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAclE,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAE3D,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,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AC5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwB;IACjD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAW;IACpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAC5C,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAsB;IAC3D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAe;IAC7C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmC;gBAEhD,IAAI,EAAE,gBAAgB;IAYlC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc;IAIzC,OAAO,CACX,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC,eAAe,CAAC;IAgD3B,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAIrD,aAAa,IAAI,cAAc;IAI/B,WAAW,IAAI,qBAAqB;YAItB,WAAW;IA2FzB,OAAO,CAAC,kBAAkB;IAyB1B,OAAO,CAAC,eAAe;IA4BvB,OAAO,CAAC,aAAa;IAuBrB,OAAO,CAAC,oBAAoB;YASd,kBAAkB;IAchC,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,gBAAgB;CASzB"}
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import { TaskDecomposer } from './TaskDecomposer.js';
|
|
2
|
-
import { CollaborationProtocol } from './CollaborationProtocol.js';
|
|
3
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
4
|
-
// Constants
|
|
5
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
6
|
-
const DEFAULT_MAX_CONCURRENT = 3;
|
|
7
|
-
const DEFAULT_STEP_TIMEOUT_S = 600;
|
|
8
|
-
const TASK_TIMEOUT_S = 3600;
|
|
9
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
10
|
-
// AutonomyOrchestrator
|
|
11
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
12
|
-
export class AutonomyOrchestrator {
|
|
13
|
-
decomposer;
|
|
14
|
-
protocol;
|
|
15
|
-
eventBus;
|
|
16
|
-
auditStore;
|
|
17
|
-
sentinel;
|
|
18
|
-
confirmationManager;
|
|
19
|
-
stepExecutor;
|
|
20
|
-
maxConcurrent;
|
|
21
|
-
maxStepTimeoutS;
|
|
22
|
-
progress = new Map();
|
|
23
|
-
constructor(deps) {
|
|
24
|
-
this.decomposer = new TaskDecomposer();
|
|
25
|
-
this.protocol = new CollaborationProtocol();
|
|
26
|
-
this.eventBus = deps.eventBus;
|
|
27
|
-
this.auditStore = deps.auditStore;
|
|
28
|
-
this.sentinel = deps.sentinel;
|
|
29
|
-
this.confirmationManager = deps.confirmationManager;
|
|
30
|
-
this.stepExecutor = deps.stepExecutor;
|
|
31
|
-
this.maxConcurrent = deps.maxConcurrentSteps ?? DEFAULT_MAX_CONCURRENT;
|
|
32
|
-
this.maxStepTimeoutS = deps.maxStepTimeoutS ?? DEFAULT_STEP_TIMEOUT_S;
|
|
33
|
-
}
|
|
34
|
-
decomposePrompt(prompt) {
|
|
35
|
-
return this.decomposer.decompose(prompt);
|
|
36
|
-
}
|
|
37
|
-
async execute(task, mode) {
|
|
38
|
-
const startedAt = new Date().toISOString();
|
|
39
|
-
const startMs = Date.now();
|
|
40
|
-
this.initProgress(task);
|
|
41
|
-
if (mode === 'suggest' || mode === 'disabled') {
|
|
42
|
-
return this.buildSuggestResult(task, mode, startedAt, startMs);
|
|
43
|
-
}
|
|
44
|
-
const stepResults = [];
|
|
45
|
-
const taskTimeout = setTimeout(() => {
|
|
46
|
-
// Mark in-progress steps as failed on task timeout
|
|
47
|
-
}, TASK_TIMEOUT_S * 1000);
|
|
48
|
-
try {
|
|
49
|
-
for (const step of task.steps) {
|
|
50
|
-
const result = await this.executeStep(task, step);
|
|
51
|
-
stepResults.push(result);
|
|
52
|
-
if (result.status === 'failed') {
|
|
53
|
-
this.updateProgress(task.id, step, 'failed');
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
this.updateProgress(task.id, step, 'completed');
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
finally {
|
|
60
|
-
clearTimeout(taskTimeout);
|
|
61
|
-
}
|
|
62
|
-
const completedAt = new Date().toISOString();
|
|
63
|
-
const totalDurationMs = Date.now() - startMs;
|
|
64
|
-
const allCompleted = stepResults.every((r) => r.status === 'completed');
|
|
65
|
-
const hasFailed = stepResults.some((r) => r.status === 'failed');
|
|
66
|
-
this.finalizeProgress(task.id, hasFailed ? 'failed' : 'completed');
|
|
67
|
-
return {
|
|
68
|
-
taskId: task.id,
|
|
69
|
-
mode,
|
|
70
|
-
status: allCompleted ? 'completed' : hasFailed ? 'failed' : 'partial',
|
|
71
|
-
stepResults,
|
|
72
|
-
totalDurationMs,
|
|
73
|
-
startedAt,
|
|
74
|
-
completedAt,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
getProgress(taskId) {
|
|
78
|
-
return this.progress.get(taskId);
|
|
79
|
-
}
|
|
80
|
-
getDecomposer() {
|
|
81
|
-
return this.decomposer;
|
|
82
|
-
}
|
|
83
|
-
getProtocol() {
|
|
84
|
-
return this.protocol;
|
|
85
|
-
}
|
|
86
|
-
async executeStep(task, step) {
|
|
87
|
-
const assignment = this.protocol.assignAgent(step);
|
|
88
|
-
const stepStartMs = Date.now();
|
|
89
|
-
const stepStartedAt = new Date().toISOString();
|
|
90
|
-
this.updateProgress(task.id, step, 'in_progress');
|
|
91
|
-
// Emit step start event
|
|
92
|
-
this.emitStepEvent(task, step, assignment, 'started');
|
|
93
|
-
// Risk check via sentinel
|
|
94
|
-
const actionForSentinel = {
|
|
95
|
-
agentId: assignment.agentName,
|
|
96
|
-
actionType: this.stepTypeToActionType(step.type),
|
|
97
|
-
target: task.originalPrompt.slice(0, 200),
|
|
98
|
-
params: {},
|
|
99
|
-
};
|
|
100
|
-
const riskResult = this.sentinel.intercept(actionForSentinel);
|
|
101
|
-
// If HIGH risk in auto mode, request confirmation
|
|
102
|
-
if (!riskResult.allowed && riskResult.policyDecision.requiredAction === 'confirm') {
|
|
103
|
-
if (this.confirmationManager) {
|
|
104
|
-
const riskAssessment = {
|
|
105
|
-
riskLevel: riskResult.riskLevel,
|
|
106
|
-
score: 80,
|
|
107
|
-
factors: riskResult.policyDecision.matchedPolicies,
|
|
108
|
-
reasoning: riskResult.policyDecision.reason,
|
|
109
|
-
};
|
|
110
|
-
const confirmation = await this.confirmationManager.requestConfirmation(actionForSentinel, riskAssessment);
|
|
111
|
-
if (confirmation.status !== 'approved') {
|
|
112
|
-
return this.buildStepResult(step, assignment, stepStartedAt, stepStartMs, 'failed', undefined, `Step blocked: ${confirmation.status}`);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
return this.buildStepResult(step, assignment, stepStartedAt, stepStartMs, 'failed', undefined, 'HIGH risk step requires confirmation but no ConfirmationManager configured');
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
// If blocked outright, fail
|
|
120
|
-
if (!riskResult.allowed && riskResult.policyDecision.requiredAction === 'block') {
|
|
121
|
-
return this.buildStepResult(step, assignment, stepStartedAt, stepStartMs, 'failed', undefined, `Step blocked by policy: ${riskResult.policyDecision.reason}`);
|
|
122
|
-
}
|
|
123
|
-
// Execute the step
|
|
124
|
-
if (this.stepExecutor) {
|
|
125
|
-
try {
|
|
126
|
-
const execResult = await this.executeWithTimeout(this.stepExecutor(step, assignment), this.maxStepTimeoutS * 1000);
|
|
127
|
-
if (!execResult.success && this.protocol.canRetry(step.id)) {
|
|
128
|
-
this.protocol.recordRetry(step.id);
|
|
129
|
-
const retryResult = await this.executeWithTimeout(this.stepExecutor(step, assignment), this.maxStepTimeoutS * 1000);
|
|
130
|
-
return this.buildStepResult(step, assignment, stepStartedAt, stepStartMs, retryResult.success ? 'completed' : 'failed', retryResult.output, retryResult.error);
|
|
131
|
-
}
|
|
132
|
-
return this.buildStepResult(step, assignment, stepStartedAt, stepStartMs, execResult.success ? 'completed' : 'failed', execResult.output, execResult.error);
|
|
133
|
-
}
|
|
134
|
-
catch (err) {
|
|
135
|
-
return this.buildStepResult(step, assignment, stepStartedAt, stepStartMs, 'failed', undefined, err instanceof Error ? err.message : String(err));
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
// No executor: mark as completed (dry-run)
|
|
139
|
-
return this.buildStepResult(step, assignment, stepStartedAt, stepStartMs, 'completed', 'dry-run');
|
|
140
|
-
}
|
|
141
|
-
buildSuggestResult(task, mode, startedAt, startMs) {
|
|
142
|
-
const completedAt = new Date().toISOString();
|
|
143
|
-
return {
|
|
144
|
-
taskId: task.id,
|
|
145
|
-
mode,
|
|
146
|
-
status: 'suggested',
|
|
147
|
-
stepResults: task.steps.map((step) => ({
|
|
148
|
-
stepId: step.id,
|
|
149
|
-
status: 'pending',
|
|
150
|
-
agentName: this.protocol.assignAgent(step).agentName,
|
|
151
|
-
startedAt,
|
|
152
|
-
completedAt,
|
|
153
|
-
durationMs: 0,
|
|
154
|
-
})),
|
|
155
|
-
totalDurationMs: Date.now() - startMs,
|
|
156
|
-
startedAt,
|
|
157
|
-
completedAt,
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
buildStepResult(step, assignment, startedAt, startMs, status, output, error) {
|
|
161
|
-
const completedAt = new Date().toISOString();
|
|
162
|
-
this.emitStepEvent({ id: step.id }, step, assignment, status === 'completed' ? 'completed' : 'failed');
|
|
163
|
-
return {
|
|
164
|
-
stepId: step.id,
|
|
165
|
-
status,
|
|
166
|
-
agentName: assignment.agentName,
|
|
167
|
-
output,
|
|
168
|
-
error,
|
|
169
|
-
startedAt,
|
|
170
|
-
completedAt,
|
|
171
|
-
durationMs: Date.now() - startMs,
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
emitStepEvent(task, step, assignment, status) {
|
|
175
|
-
try {
|
|
176
|
-
this.eventBus.emit('action_executed', {
|
|
177
|
-
eventType: 'step_execution',
|
|
178
|
-
sourceAgentId: assignment.agentName,
|
|
179
|
-
payload: {
|
|
180
|
-
taskId: task.id,
|
|
181
|
-
stepId: step.id,
|
|
182
|
-
stepType: step.type,
|
|
183
|
-
status,
|
|
184
|
-
agentName: assignment.agentName,
|
|
185
|
-
},
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
catch {
|
|
189
|
-
// Non-critical
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
stepTypeToActionType(type) {
|
|
193
|
-
switch (type) {
|
|
194
|
-
case 'implement': return 'file_write';
|
|
195
|
-
case 'test': return 'bash_exec';
|
|
196
|
-
case 'deploy': return 'bash_exec';
|
|
197
|
-
default: return 'skill_generate';
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
async executeWithTimeout(promise, timeoutMs) {
|
|
201
|
-
return new Promise((resolve, reject) => {
|
|
202
|
-
const timer = setTimeout(() => {
|
|
203
|
-
reject(new Error(`Step execution timed out after ${timeoutMs / 1000}s`));
|
|
204
|
-
}, timeoutMs);
|
|
205
|
-
promise
|
|
206
|
-
.then((result) => { clearTimeout(timer); resolve(result); })
|
|
207
|
-
.catch((err) => { clearTimeout(timer); reject(err); });
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
initProgress(task) {
|
|
211
|
-
this.progress.set(task.id, {
|
|
212
|
-
taskId: task.id,
|
|
213
|
-
totalSteps: task.steps.length,
|
|
214
|
-
completedSteps: 0,
|
|
215
|
-
currentStep: null,
|
|
216
|
-
percentComplete: 0,
|
|
217
|
-
status: 'running',
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
updateProgress(taskId, step, status) {
|
|
221
|
-
const p = this.progress.get(taskId);
|
|
222
|
-
if (!p)
|
|
223
|
-
return;
|
|
224
|
-
if (status === 'in_progress') {
|
|
225
|
-
p.currentStep = step.id;
|
|
226
|
-
}
|
|
227
|
-
else if (status === 'completed') {
|
|
228
|
-
p.completedSteps++;
|
|
229
|
-
p.percentComplete = Math.round((p.completedSteps / p.totalSteps) * 100);
|
|
230
|
-
}
|
|
231
|
-
else if (status === 'failed') {
|
|
232
|
-
p.status = 'failed';
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
finalizeProgress(taskId, status) {
|
|
236
|
-
const p = this.progress.get(taskId);
|
|
237
|
-
if (!p)
|
|
238
|
-
return;
|
|
239
|
-
p.status = status;
|
|
240
|
-
p.currentStep = null;
|
|
241
|
-
if (status === 'completed') {
|
|
242
|
-
p.percentComplete = 100;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
//# sourceMappingURL=AutonomyOrchestrator.js.map
|