@iflow-mcp/jkheadley-instar 0.26.2
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/.claude/hooks/free-text-guard.sh +117 -0
- package/.claude/settings.json +201 -0
- package/.claude/skills/autonomous/hooks/autonomous-stop-hook.sh +234 -0
- package/.claude/skills/autonomous/hooks/hooks.json +15 -0
- package/.claude/skills/autonomous/scripts/setup-autonomous.sh +166 -0
- package/.claude/skills/autonomous/skill.md +254 -0
- package/.claude/skills/secret-setup/skill.md +210 -0
- package/.claude/skills/setup-wizard/skill.md +2132 -0
- package/LICENSE +21 -0
- package/README.md +214 -0
- package/dashboard/favicon.png +0 -0
- package/dashboard/index.html +5740 -0
- package/dashboard/logo.png +0 -0
- package/dist/cli.d.ts +21 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1782 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/backup.d.ts +16 -0
- package/dist/commands/backup.d.ts.map +1 -0
- package/dist/commands/backup.js +84 -0
- package/dist/commands/backup.js.map +1 -0
- package/dist/commands/discovery.d.ts +158 -0
- package/dist/commands/discovery.d.ts.map +1 -0
- package/dist/commands/discovery.js +532 -0
- package/dist/commands/discovery.js.map +1 -0
- package/dist/commands/git.d.ts +25 -0
- package/dist/commands/git.d.ts.map +1 -0
- package/dist/commands/git.js +152 -0
- package/dist/commands/git.js.map +1 -0
- package/dist/commands/init.d.ts +52 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +4211 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/intent.d.ts +30 -0
- package/dist/commands/intent.d.ts.map +1 -0
- package/dist/commands/intent.js +349 -0
- package/dist/commands/intent.js.map +1 -0
- package/dist/commands/job.d.ts +42 -0
- package/dist/commands/job.d.ts.map +1 -0
- package/dist/commands/job.js +202 -0
- package/dist/commands/job.js.map +1 -0
- package/dist/commands/knowledge.d.ts +25 -0
- package/dist/commands/knowledge.d.ts.map +1 -0
- package/dist/commands/knowledge.js +127 -0
- package/dist/commands/knowledge.js.map +1 -0
- package/dist/commands/machine.d.ts +53 -0
- package/dist/commands/machine.d.ts.map +1 -0
- package/dist/commands/machine.js +680 -0
- package/dist/commands/machine.js.map +1 -0
- package/dist/commands/memory.d.ts +24 -0
- package/dist/commands/memory.d.ts.map +1 -0
- package/dist/commands/memory.js +163 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/nuke.d.ts +22 -0
- package/dist/commands/nuke.d.ts.map +1 -0
- package/dist/commands/nuke.js +216 -0
- package/dist/commands/nuke.js.map +1 -0
- package/dist/commands/org.d.ts +16 -0
- package/dist/commands/org.d.ts.map +1 -0
- package/dist/commands/org.js +69 -0
- package/dist/commands/org.js.map +1 -0
- package/dist/commands/playbook.d.ts +91 -0
- package/dist/commands/playbook.d.ts.map +1 -0
- package/dist/commands/playbook.js +1016 -0
- package/dist/commands/playbook.js.map +1 -0
- package/dist/commands/reflect.d.ts +52 -0
- package/dist/commands/reflect.d.ts.map +1 -0
- package/dist/commands/reflect.js +316 -0
- package/dist/commands/reflect.js.map +1 -0
- package/dist/commands/relationship.d.ts +17 -0
- package/dist/commands/relationship.d.ts.map +1 -0
- package/dist/commands/relationship.js +156 -0
- package/dist/commands/relationship.js.map +1 -0
- package/dist/commands/relay.d.ts +26 -0
- package/dist/commands/relay.d.ts.map +1 -0
- package/dist/commands/relay.js +121 -0
- package/dist/commands/relay.js.map +1 -0
- package/dist/commands/review.d.ts +18 -0
- package/dist/commands/review.d.ts.map +1 -0
- package/dist/commands/review.js +193 -0
- package/dist/commands/review.js.map +1 -0
- package/dist/commands/semantic.d.ts +37 -0
- package/dist/commands/semantic.d.ts.map +1 -0
- package/dist/commands/semantic.js +198 -0
- package/dist/commands/semantic.js.map +1 -0
- package/dist/commands/server.d.ts +37 -0
- package/dist/commands/server.d.ts.map +1 -0
- package/dist/commands/server.js +4875 -0
- package/dist/commands/server.js.map +1 -0
- package/dist/commands/setup.d.ts +63 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +1235 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/slack-cli.d.ts +16 -0
- package/dist/commands/slack-cli.d.ts.map +1 -0
- package/dist/commands/slack-cli.js +259 -0
- package/dist/commands/slack-cli.js.map +1 -0
- package/dist/commands/status.d.ts +11 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +120 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/user.d.ts +17 -0
- package/dist/commands/user.d.ts.map +1 -0
- package/dist/commands/user.js +53 -0
- package/dist/commands/user.js.map +1 -0
- package/dist/commands/whatsapp.d.ts +31 -0
- package/dist/commands/whatsapp.d.ts.map +1 -0
- package/dist/commands/whatsapp.js +408 -0
- package/dist/commands/whatsapp.js.map +1 -0
- package/dist/config/ConfigDefaults.d.ts +40 -0
- package/dist/config/ConfigDefaults.d.ts.map +1 -0
- package/dist/config/ConfigDefaults.js +175 -0
- package/dist/config/ConfigDefaults.js.map +1 -0
- package/dist/config/LiveConfig.d.ts +97 -0
- package/dist/config/LiveConfig.d.ts.map +1 -0
- package/dist/config/LiveConfig.js +220 -0
- package/dist/config/LiveConfig.js.map +1 -0
- package/dist/core/AccessControl.d.ts +91 -0
- package/dist/core/AccessControl.d.ts.map +1 -0
- package/dist/core/AccessControl.js +184 -0
- package/dist/core/AccessControl.js.map +1 -0
- package/dist/core/AdaptationValidator.d.ts +44 -0
- package/dist/core/AdaptationValidator.d.ts.map +1 -0
- package/dist/core/AdaptationValidator.js +132 -0
- package/dist/core/AdaptationValidator.js.map +1 -0
- package/dist/core/AdaptiveTrust.d.ts +188 -0
- package/dist/core/AdaptiveTrust.d.ts.map +1 -0
- package/dist/core/AdaptiveTrust.js +354 -0
- package/dist/core/AdaptiveTrust.js.map +1 -0
- package/dist/core/AgentBus.d.ts +168 -0
- package/dist/core/AgentBus.d.ts.map +1 -0
- package/dist/core/AgentBus.js +369 -0
- package/dist/core/AgentBus.js.map +1 -0
- package/dist/core/AgentConnector.d.ts +76 -0
- package/dist/core/AgentConnector.d.ts.map +1 -0
- package/dist/core/AgentConnector.js +324 -0
- package/dist/core/AgentConnector.js.map +1 -0
- package/dist/core/AgentRegistry.d.ts +107 -0
- package/dist/core/AgentRegistry.d.ts.map +1 -0
- package/dist/core/AgentRegistry.js +569 -0
- package/dist/core/AgentRegistry.js.map +1 -0
- package/dist/core/AnthropicIntelligenceProvider.d.ts +24 -0
- package/dist/core/AnthropicIntelligenceProvider.d.ts.map +1 -0
- package/dist/core/AnthropicIntelligenceProvider.js +63 -0
- package/dist/core/AnthropicIntelligenceProvider.js.map +1 -0
- package/dist/core/AuditTrail.d.ts +207 -0
- package/dist/core/AuditTrail.d.ts.map +1 -0
- package/dist/core/AuditTrail.js +271 -0
- package/dist/core/AuditTrail.js.map +1 -0
- package/dist/core/AutoApprover.d.ts +63 -0
- package/dist/core/AutoApprover.d.ts.map +1 -0
- package/dist/core/AutoApprover.js +151 -0
- package/dist/core/AutoApprover.js.map +1 -0
- package/dist/core/AutoDispatcher.d.ts +170 -0
- package/dist/core/AutoDispatcher.d.ts.map +1 -0
- package/dist/core/AutoDispatcher.js +647 -0
- package/dist/core/AutoDispatcher.js.map +1 -0
- package/dist/core/AutoUpdater.d.ts +193 -0
- package/dist/core/AutoUpdater.d.ts.map +1 -0
- package/dist/core/AutoUpdater.js +648 -0
- package/dist/core/AutoUpdater.js.map +1 -0
- package/dist/core/AutonomousEvolution.d.ts +168 -0
- package/dist/core/AutonomousEvolution.d.ts.map +1 -0
- package/dist/core/AutonomousEvolution.js +384 -0
- package/dist/core/AutonomousEvolution.js.map +1 -0
- package/dist/core/AutonomyProfileManager.d.ts +108 -0
- package/dist/core/AutonomyProfileManager.d.ts.map +1 -0
- package/dist/core/AutonomyProfileManager.js +323 -0
- package/dist/core/AutonomyProfileManager.js.map +1 -0
- package/dist/core/AutonomySkill.d.ts +98 -0
- package/dist/core/AutonomySkill.d.ts.map +1 -0
- package/dist/core/AutonomySkill.js +497 -0
- package/dist/core/AutonomySkill.js.map +1 -0
- package/dist/core/BackupManager.d.ts +66 -0
- package/dist/core/BackupManager.d.ts.map +1 -0
- package/dist/core/BackupManager.js +266 -0
- package/dist/core/BackupManager.js.map +1 -0
- package/dist/core/BitwardenProvider.d.ts +85 -0
- package/dist/core/BitwardenProvider.d.ts.map +1 -0
- package/dist/core/BitwardenProvider.js +437 -0
- package/dist/core/BitwardenProvider.js.map +1 -0
- package/dist/core/BlockerLearningLoop.d.ts +99 -0
- package/dist/core/BlockerLearningLoop.d.ts.map +1 -0
- package/dist/core/BlockerLearningLoop.js +205 -0
- package/dist/core/BlockerLearningLoop.js.map +1 -0
- package/dist/core/BranchManager.d.ts +165 -0
- package/dist/core/BranchManager.d.ts.map +1 -0
- package/dist/core/BranchManager.js +413 -0
- package/dist/core/BranchManager.js.map +1 -0
- package/dist/core/CaffeinateManager.d.ts +50 -0
- package/dist/core/CaffeinateManager.d.ts.map +1 -0
- package/dist/core/CaffeinateManager.js +189 -0
- package/dist/core/CaffeinateManager.js.map +1 -0
- package/dist/core/CallbackRegistry.d.ts +67 -0
- package/dist/core/CallbackRegistry.d.ts.map +1 -0
- package/dist/core/CallbackRegistry.js +145 -0
- package/dist/core/CallbackRegistry.js.map +1 -0
- package/dist/core/CanonicalState.d.ts +132 -0
- package/dist/core/CanonicalState.d.ts.map +1 -0
- package/dist/core/CanonicalState.js +297 -0
- package/dist/core/CanonicalState.js.map +1 -0
- package/dist/core/CapabilityMapper.d.ts +192 -0
- package/dist/core/CapabilityMapper.d.ts.map +1 -0
- package/dist/core/CapabilityMapper.js +958 -0
- package/dist/core/CapabilityMapper.js.map +1 -0
- package/dist/core/CapabilityRegistryGenerator.d.ts +72 -0
- package/dist/core/CapabilityRegistryGenerator.d.ts.map +1 -0
- package/dist/core/CapabilityRegistryGenerator.js +310 -0
- package/dist/core/CapabilityRegistryGenerator.js.map +1 -0
- package/dist/core/ClaudeCliIntelligenceProvider.d.ts +21 -0
- package/dist/core/ClaudeCliIntelligenceProvider.d.ts.map +1 -0
- package/dist/core/ClaudeCliIntelligenceProvider.js +60 -0
- package/dist/core/ClaudeCliIntelligenceProvider.js.map +1 -0
- package/dist/core/CoherenceGate.d.ts +198 -0
- package/dist/core/CoherenceGate.d.ts.map +1 -0
- package/dist/core/CoherenceGate.js +986 -0
- package/dist/core/CoherenceGate.js.map +1 -0
- package/dist/core/CoherenceReviewer.d.ts +104 -0
- package/dist/core/CoherenceReviewer.d.ts.map +1 -0
- package/dist/core/CoherenceReviewer.js +185 -0
- package/dist/core/CoherenceReviewer.js.map +1 -0
- package/dist/core/Config.d.ts +32 -0
- package/dist/core/Config.d.ts.map +1 -0
- package/dist/core/Config.js +332 -0
- package/dist/core/Config.js.map +1 -0
- package/dist/core/ConflictNegotiator.d.ts +167 -0
- package/dist/core/ConflictNegotiator.d.ts.map +1 -0
- package/dist/core/ConflictNegotiator.js +280 -0
- package/dist/core/ConflictNegotiator.js.map +1 -0
- package/dist/core/ContextHierarchy.d.ts +102 -0
- package/dist/core/ContextHierarchy.d.ts.map +1 -0
- package/dist/core/ContextHierarchy.js +594 -0
- package/dist/core/ContextHierarchy.js.map +1 -0
- package/dist/core/ContextSnapshotBuilder.d.ts +80 -0
- package/dist/core/ContextSnapshotBuilder.d.ts.map +1 -0
- package/dist/core/ContextSnapshotBuilder.js +342 -0
- package/dist/core/ContextSnapshotBuilder.js.map +1 -0
- package/dist/core/ContextualEvaluator.d.ts +103 -0
- package/dist/core/ContextualEvaluator.d.ts.map +1 -0
- package/dist/core/ContextualEvaluator.js +389 -0
- package/dist/core/ContextualEvaluator.js.map +1 -0
- package/dist/core/ConvergenceChecker.d.ts +24 -0
- package/dist/core/ConvergenceChecker.d.ts.map +1 -0
- package/dist/core/ConvergenceChecker.js +113 -0
- package/dist/core/ConvergenceChecker.js.map +1 -0
- package/dist/core/CoordinationProtocol.d.ts +198 -0
- package/dist/core/CoordinationProtocol.d.ts.map +1 -0
- package/dist/core/CoordinationProtocol.js +363 -0
- package/dist/core/CoordinationProtocol.js.map +1 -0
- package/dist/core/CustomReviewerLoader.d.ts +45 -0
- package/dist/core/CustomReviewerLoader.d.ts.map +1 -0
- package/dist/core/CustomReviewerLoader.js +153 -0
- package/dist/core/CustomReviewerLoader.js.map +1 -0
- package/dist/core/DecisionJournal.d.ts +56 -0
- package/dist/core/DecisionJournal.d.ts.map +1 -0
- package/dist/core/DecisionJournal.js +132 -0
- package/dist/core/DecisionJournal.js.map +1 -0
- package/dist/core/DeferredDispatchTracker.d.ts +91 -0
- package/dist/core/DeferredDispatchTracker.d.ts.map +1 -0
- package/dist/core/DeferredDispatchTracker.js +213 -0
- package/dist/core/DeferredDispatchTracker.js.map +1 -0
- package/dist/core/DiscoveryEvaluator.d.ts +131 -0
- package/dist/core/DiscoveryEvaluator.d.ts.map +1 -0
- package/dist/core/DiscoveryEvaluator.js +377 -0
- package/dist/core/DiscoveryEvaluator.js.map +1 -0
- package/dist/core/DispatchDecisionJournal.d.ts +83 -0
- package/dist/core/DispatchDecisionJournal.d.ts.map +1 -0
- package/dist/core/DispatchDecisionJournal.js +181 -0
- package/dist/core/DispatchDecisionJournal.js.map +1 -0
- package/dist/core/DispatchExecutor.d.ts +127 -0
- package/dist/core/DispatchExecutor.d.ts.map +1 -0
- package/dist/core/DispatchExecutor.js +355 -0
- package/dist/core/DispatchExecutor.js.map +1 -0
- package/dist/core/DispatchManager.d.ts +200 -0
- package/dist/core/DispatchManager.d.ts.map +1 -0
- package/dist/core/DispatchManager.js +524 -0
- package/dist/core/DispatchManager.js.map +1 -0
- package/dist/core/DispatchScopeEnforcer.d.ts +57 -0
- package/dist/core/DispatchScopeEnforcer.d.ts.map +1 -0
- package/dist/core/DispatchScopeEnforcer.js +173 -0
- package/dist/core/DispatchScopeEnforcer.js.map +1 -0
- package/dist/core/DispatchVerifier.d.ts +76 -0
- package/dist/core/DispatchVerifier.d.ts.map +1 -0
- package/dist/core/DispatchVerifier.js +128 -0
- package/dist/core/DispatchVerifier.js.map +1 -0
- package/dist/core/EvolutionManager.d.ts +223 -0
- package/dist/core/EvolutionManager.d.ts.map +1 -0
- package/dist/core/EvolutionManager.js +630 -0
- package/dist/core/EvolutionManager.js.map +1 -0
- package/dist/core/ExecutionJournal.d.ts +101 -0
- package/dist/core/ExecutionJournal.d.ts.map +1 -0
- package/dist/core/ExecutionJournal.js +301 -0
- package/dist/core/ExecutionJournal.js.map +1 -0
- package/dist/core/ExternalOperationGate.d.ts +204 -0
- package/dist/core/ExternalOperationGate.d.ts.map +1 -0
- package/dist/core/ExternalOperationGate.js +413 -0
- package/dist/core/ExternalOperationGate.js.map +1 -0
- package/dist/core/FeatureDefinitions.d.ts +14 -0
- package/dist/core/FeatureDefinitions.d.ts.map +1 -0
- package/dist/core/FeatureDefinitions.js +374 -0
- package/dist/core/FeatureDefinitions.js.map +1 -0
- package/dist/core/FeatureRegistry.d.ts +337 -0
- package/dist/core/FeatureRegistry.d.ts.map +1 -0
- package/dist/core/FeatureRegistry.js +863 -0
- package/dist/core/FeatureRegistry.js.map +1 -0
- package/dist/core/FeedbackManager.d.ts +69 -0
- package/dist/core/FeedbackManager.d.ts.map +1 -0
- package/dist/core/FeedbackManager.js +284 -0
- package/dist/core/FeedbackManager.js.map +1 -0
- package/dist/core/FileClassifier.d.ts +74 -0
- package/dist/core/FileClassifier.d.ts.map +1 -0
- package/dist/core/FileClassifier.js +377 -0
- package/dist/core/FileClassifier.js.map +1 -0
- package/dist/core/ForegroundRestartWatcher.d.ts +55 -0
- package/dist/core/ForegroundRestartWatcher.d.ts.map +1 -0
- package/dist/core/ForegroundRestartWatcher.js +116 -0
- package/dist/core/ForegroundRestartWatcher.js.map +1 -0
- package/dist/core/GitStateManager.d.ts +78 -0
- package/dist/core/GitStateManager.d.ts.map +1 -0
- package/dist/core/GitStateManager.js +366 -0
- package/dist/core/GitStateManager.js.map +1 -0
- package/dist/core/GitSync.d.ts +199 -0
- package/dist/core/GitSync.d.ts.map +1 -0
- package/dist/core/GitSync.js +955 -0
- package/dist/core/GitSync.js.map +1 -0
- package/dist/core/GlobalInstallCleanup.d.ts +23 -0
- package/dist/core/GlobalInstallCleanup.d.ts.map +1 -0
- package/dist/core/GlobalInstallCleanup.js +130 -0
- package/dist/core/GlobalInstallCleanup.js.map +1 -0
- package/dist/core/GlobalSecretStore.d.ts +112 -0
- package/dist/core/GlobalSecretStore.d.ts.map +1 -0
- package/dist/core/GlobalSecretStore.js +396 -0
- package/dist/core/GlobalSecretStore.js.map +1 -0
- package/dist/core/HandoffManager.d.ts +163 -0
- package/dist/core/HandoffManager.d.ts.map +1 -0
- package/dist/core/HandoffManager.js +370 -0
- package/dist/core/HandoffManager.js.map +1 -0
- package/dist/core/HeartbeatManager.d.ts +120 -0
- package/dist/core/HeartbeatManager.d.ts.map +1 -0
- package/dist/core/HeartbeatManager.js +240 -0
- package/dist/core/HeartbeatManager.js.map +1 -0
- package/dist/core/InputGuard.d.ts +98 -0
- package/dist/core/InputGuard.d.ts.map +1 -0
- package/dist/core/InputGuard.js +316 -0
- package/dist/core/InputGuard.js.map +1 -0
- package/dist/core/IntentDriftDetector.d.ts +100 -0
- package/dist/core/IntentDriftDetector.d.ts.map +1 -0
- package/dist/core/IntentDriftDetector.js +325 -0
- package/dist/core/IntentDriftDetector.js.map +1 -0
- package/dist/core/JobReflector.d.ts +81 -0
- package/dist/core/JobReflector.d.ts.map +1 -0
- package/dist/core/JobReflector.js +244 -0
- package/dist/core/JobReflector.js.map +1 -0
- package/dist/core/LLMConflictResolver.d.ts +132 -0
- package/dist/core/LLMConflictResolver.d.ts.map +1 -0
- package/dist/core/LLMConflictResolver.js +372 -0
- package/dist/core/LLMConflictResolver.js.map +1 -0
- package/dist/core/LedgerAuth.d.ts +99 -0
- package/dist/core/LedgerAuth.d.ts.map +1 -0
- package/dist/core/LedgerAuth.js +215 -0
- package/dist/core/LedgerAuth.js.map +1 -0
- package/dist/core/MachineIdentity.d.ts +196 -0
- package/dist/core/MachineIdentity.d.ts.map +1 -0
- package/dist/core/MachineIdentity.js +476 -0
- package/dist/core/MachineIdentity.js.map +1 -0
- package/dist/core/MessageSentinel.d.ts +142 -0
- package/dist/core/MessageSentinel.d.ts.map +1 -0
- package/dist/core/MessageSentinel.js +426 -0
- package/dist/core/MessageSentinel.js.map +1 -0
- package/dist/core/MigrationProvenance.d.ts +62 -0
- package/dist/core/MigrationProvenance.d.ts.map +1 -0
- package/dist/core/MigrationProvenance.js +183 -0
- package/dist/core/MigrationProvenance.js.map +1 -0
- package/dist/core/MultiMachineCoordinator.d.ts +106 -0
- package/dist/core/MultiMachineCoordinator.d.ts.map +1 -0
- package/dist/core/MultiMachineCoordinator.js +311 -0
- package/dist/core/MultiMachineCoordinator.js.map +1 -0
- package/dist/core/NonceStore.d.ts +72 -0
- package/dist/core/NonceStore.d.ts.map +1 -0
- package/dist/core/NonceStore.js +163 -0
- package/dist/core/NonceStore.js.map +1 -0
- package/dist/core/OrgIntentManager.d.ts +58 -0
- package/dist/core/OrgIntentManager.d.ts.map +1 -0
- package/dist/core/OrgIntentManager.js +250 -0
- package/dist/core/OrgIntentManager.js.map +1 -0
- package/dist/core/OverlapGuard.d.ts +112 -0
- package/dist/core/OverlapGuard.d.ts.map +1 -0
- package/dist/core/OverlapGuard.js +241 -0
- package/dist/core/OverlapGuard.js.map +1 -0
- package/dist/core/PairingProtocol.d.ts +129 -0
- package/dist/core/PairingProtocol.d.ts.map +1 -0
- package/dist/core/PairingProtocol.js +265 -0
- package/dist/core/PairingProtocol.js.map +1 -0
- package/dist/core/PatternAnalyzer.d.ts +128 -0
- package/dist/core/PatternAnalyzer.d.ts.map +1 -0
- package/dist/core/PatternAnalyzer.js +388 -0
- package/dist/core/PatternAnalyzer.js.map +1 -0
- package/dist/core/PlatformActivityRegistry.d.ts +163 -0
- package/dist/core/PlatformActivityRegistry.d.ts.map +1 -0
- package/dist/core/PlatformActivityRegistry.js +307 -0
- package/dist/core/PlatformActivityRegistry.js.map +1 -0
- package/dist/core/PolicyEnforcementLayer.d.ts +63 -0
- package/dist/core/PolicyEnforcementLayer.d.ts.map +1 -0
- package/dist/core/PolicyEnforcementLayer.js +250 -0
- package/dist/core/PolicyEnforcementLayer.js.map +1 -0
- package/dist/core/PortRegistry.d.ts +9 -0
- package/dist/core/PortRegistry.d.ts.map +1 -0
- package/dist/core/PortRegistry.js +8 -0
- package/dist/core/PortRegistry.js.map +1 -0
- package/dist/core/PostUpdateMigrator.d.ts +170 -0
- package/dist/core/PostUpdateMigrator.d.ts.map +1 -0
- package/dist/core/PostUpdateMigrator.js +3674 -0
- package/dist/core/PostUpdateMigrator.js.map +1 -0
- package/dist/core/Prerequisites.d.ts +37 -0
- package/dist/core/Prerequisites.d.ts.map +1 -0
- package/dist/core/Prerequisites.js +272 -0
- package/dist/core/Prerequisites.js.map +1 -0
- package/dist/core/ProcessIntegrity.d.ts +90 -0
- package/dist/core/ProcessIntegrity.d.ts.map +1 -0
- package/dist/core/ProcessIntegrity.js +119 -0
- package/dist/core/ProcessIntegrity.js.map +1 -0
- package/dist/core/ProjectMapper.d.ts +97 -0
- package/dist/core/ProjectMapper.d.ts.map +1 -0
- package/dist/core/ProjectMapper.js +370 -0
- package/dist/core/ProjectMapper.js.map +1 -0
- package/dist/core/PromptGuard.d.ts +121 -0
- package/dist/core/PromptGuard.d.ts.map +1 -0
- package/dist/core/PromptGuard.js +259 -0
- package/dist/core/PromptGuard.js.map +1 -0
- package/dist/core/RecipientResolver.d.ts +54 -0
- package/dist/core/RecipientResolver.d.ts.map +1 -0
- package/dist/core/RecipientResolver.js +143 -0
- package/dist/core/RecipientResolver.js.map +1 -0
- package/dist/core/ReflectionConsolidator.d.ts +73 -0
- package/dist/core/ReflectionConsolidator.d.ts.map +1 -0
- package/dist/core/ReflectionConsolidator.js +202 -0
- package/dist/core/ReflectionConsolidator.js.map +1 -0
- package/dist/core/RelationshipManager.d.ts +146 -0
- package/dist/core/RelationshipManager.d.ts.map +1 -0
- package/dist/core/RelationshipManager.js +736 -0
- package/dist/core/RelationshipManager.js.map +1 -0
- package/dist/core/RelevanceFilter.d.ts +61 -0
- package/dist/core/RelevanceFilter.d.ts.map +1 -0
- package/dist/core/RelevanceFilter.js +160 -0
- package/dist/core/RelevanceFilter.js.map +1 -0
- package/dist/core/ResearchRateLimiter.d.ts +76 -0
- package/dist/core/ResearchRateLimiter.d.ts.map +1 -0
- package/dist/core/ResearchRateLimiter.js +168 -0
- package/dist/core/ResearchRateLimiter.js.map +1 -0
- package/dist/core/ResumeValidator.d.ts +58 -0
- package/dist/core/ResumeValidator.d.ts.map +1 -0
- package/dist/core/ResumeValidator.js +195 -0
- package/dist/core/ResumeValidator.js.map +1 -0
- package/dist/core/ScopeCoherenceTracker.d.ts +87 -0
- package/dist/core/ScopeCoherenceTracker.d.ts.map +1 -0
- package/dist/core/ScopeCoherenceTracker.js +226 -0
- package/dist/core/ScopeCoherenceTracker.js.map +1 -0
- package/dist/core/ScopeVerifier.d.ts +122 -0
- package/dist/core/ScopeVerifier.d.ts.map +1 -0
- package/dist/core/ScopeVerifier.js +350 -0
- package/dist/core/ScopeVerifier.js.map +1 -0
- package/dist/core/SecretManager.d.ts +120 -0
- package/dist/core/SecretManager.d.ts.map +1 -0
- package/dist/core/SecretManager.js +324 -0
- package/dist/core/SecretManager.js.map +1 -0
- package/dist/core/SecretMigrator.d.ts +39 -0
- package/dist/core/SecretMigrator.d.ts.map +1 -0
- package/dist/core/SecretMigrator.js +182 -0
- package/dist/core/SecretMigrator.js.map +1 -0
- package/dist/core/SecretRedactor.d.ts +121 -0
- package/dist/core/SecretRedactor.d.ts.map +1 -0
- package/dist/core/SecretRedactor.js +309 -0
- package/dist/core/SecretRedactor.js.map +1 -0
- package/dist/core/SecretStore.d.ts +104 -0
- package/dist/core/SecretStore.d.ts.map +1 -0
- package/dist/core/SecretStore.js +405 -0
- package/dist/core/SecretStore.js.map +1 -0
- package/dist/core/SecurityLog.d.ts +58 -0
- package/dist/core/SecurityLog.d.ts.map +1 -0
- package/dist/core/SecurityLog.js +123 -0
- package/dist/core/SecurityLog.js.map +1 -0
- package/dist/core/SendGateway.d.ts +77 -0
- package/dist/core/SendGateway.d.ts.map +1 -0
- package/dist/core/SendGateway.js +181 -0
- package/dist/core/SendGateway.js.map +1 -0
- package/dist/core/SessionManager.d.ts +304 -0
- package/dist/core/SessionManager.d.ts.map +1 -0
- package/dist/core/SessionManager.js +1402 -0
- package/dist/core/SessionManager.js.map +1 -0
- package/dist/core/SleepWakeDetector.d.ts +37 -0
- package/dist/core/SleepWakeDetector.d.ts.map +1 -0
- package/dist/core/SleepWakeDetector.js +59 -0
- package/dist/core/SleepWakeDetector.js.map +1 -0
- package/dist/core/SoulManager.d.ts +107 -0
- package/dist/core/SoulManager.d.ts.map +1 -0
- package/dist/core/SoulManager.js +574 -0
- package/dist/core/SoulManager.js.map +1 -0
- package/dist/core/StaleProcessGuard.d.ts +113 -0
- package/dist/core/StaleProcessGuard.d.ts.map +1 -0
- package/dist/core/StaleProcessGuard.js +134 -0
- package/dist/core/StaleProcessGuard.js.map +1 -0
- package/dist/core/StateManager.d.ts +56 -0
- package/dist/core/StateManager.d.ts.map +1 -0
- package/dist/core/StateManager.js +266 -0
- package/dist/core/StateManager.js.map +1 -0
- package/dist/core/StateWriteAuthority.d.ts +101 -0
- package/dist/core/StateWriteAuthority.d.ts.map +1 -0
- package/dist/core/StateWriteAuthority.js +169 -0
- package/dist/core/StateWriteAuthority.js.map +1 -0
- package/dist/core/SurfacingTemplates.d.ts +63 -0
- package/dist/core/SurfacingTemplates.d.ts.map +1 -0
- package/dist/core/SurfacingTemplates.js +138 -0
- package/dist/core/SurfacingTemplates.js.map +1 -0
- package/dist/core/SyncOrchestrator.d.ts +308 -0
- package/dist/core/SyncOrchestrator.d.ts.map +1 -0
- package/dist/core/SyncOrchestrator.js +925 -0
- package/dist/core/SyncOrchestrator.js.map +1 -0
- package/dist/core/TemporalCoherenceChecker.d.ts +140 -0
- package/dist/core/TemporalCoherenceChecker.d.ts.map +1 -0
- package/dist/core/TemporalCoherenceChecker.js +375 -0
- package/dist/core/TemporalCoherenceChecker.js.map +1 -0
- package/dist/core/TopicClassifier.d.ts +54 -0
- package/dist/core/TopicClassifier.d.ts.map +1 -0
- package/dist/core/TopicClassifier.js +144 -0
- package/dist/core/TopicClassifier.js.map +1 -0
- package/dist/core/TopicResumeMap.d.ts +76 -0
- package/dist/core/TopicResumeMap.d.ts.map +1 -0
- package/dist/core/TopicResumeMap.js +252 -0
- package/dist/core/TopicResumeMap.js.map +1 -0
- package/dist/core/TrustElevationTracker.d.ts +178 -0
- package/dist/core/TrustElevationTracker.d.ts.map +1 -0
- package/dist/core/TrustElevationTracker.js +343 -0
- package/dist/core/TrustElevationTracker.js.map +1 -0
- package/dist/core/TrustRecovery.d.ts +109 -0
- package/dist/core/TrustRecovery.d.ts.map +1 -0
- package/dist/core/TrustRecovery.js +190 -0
- package/dist/core/TrustRecovery.js.map +1 -0
- package/dist/core/UpdateChecker.d.ts +108 -0
- package/dist/core/UpdateChecker.d.ts.map +1 -0
- package/dist/core/UpdateChecker.js +593 -0
- package/dist/core/UpdateChecker.js.map +1 -0
- package/dist/core/UpdateGate.d.ts +102 -0
- package/dist/core/UpdateGate.d.ts.map +1 -0
- package/dist/core/UpdateGate.js +149 -0
- package/dist/core/UpdateGate.js.map +1 -0
- package/dist/core/UpgradeGuideProcessor.d.ts +105 -0
- package/dist/core/UpgradeGuideProcessor.d.ts.map +1 -0
- package/dist/core/UpgradeGuideProcessor.js +278 -0
- package/dist/core/UpgradeGuideProcessor.js.map +1 -0
- package/dist/core/UpgradeNotifyManager.d.ts +98 -0
- package/dist/core/UpgradeNotifyManager.d.ts.map +1 -0
- package/dist/core/UpgradeNotifyManager.js +205 -0
- package/dist/core/UpgradeNotifyManager.js.map +1 -0
- package/dist/core/WorkLedger.d.ts +144 -0
- package/dist/core/WorkLedger.d.ts.map +1 -0
- package/dist/core/WorkLedger.js +246 -0
- package/dist/core/WorkLedger.js.map +1 -0
- package/dist/core/models.d.ts +70 -0
- package/dist/core/models.d.ts.map +1 -0
- package/dist/core/models.js +110 -0
- package/dist/core/models.js.map +1 -0
- package/dist/core/reviewers/capability-accuracy.d.ts +13 -0
- package/dist/core/reviewers/capability-accuracy.d.ts.map +1 -0
- package/dist/core/reviewers/capability-accuracy.js +38 -0
- package/dist/core/reviewers/capability-accuracy.js.map +1 -0
- package/dist/core/reviewers/claim-provenance.d.ts +14 -0
- package/dist/core/reviewers/claim-provenance.d.ts.map +1 -0
- package/dist/core/reviewers/claim-provenance.js +50 -0
- package/dist/core/reviewers/claim-provenance.js.map +1 -0
- package/dist/core/reviewers/context-completeness.d.ts +13 -0
- package/dist/core/reviewers/context-completeness.d.ts.map +1 -0
- package/dist/core/reviewers/context-completeness.js +43 -0
- package/dist/core/reviewers/context-completeness.js.map +1 -0
- package/dist/core/reviewers/conversational-tone.d.ts +13 -0
- package/dist/core/reviewers/conversational-tone.d.ts.map +1 -0
- package/dist/core/reviewers/conversational-tone.js +55 -0
- package/dist/core/reviewers/conversational-tone.js.map +1 -0
- package/dist/core/reviewers/escalation-resolution.d.ts +56 -0
- package/dist/core/reviewers/escalation-resolution.d.ts.map +1 -0
- package/dist/core/reviewers/escalation-resolution.js +239 -0
- package/dist/core/reviewers/escalation-resolution.js.map +1 -0
- package/dist/core/reviewers/gate-reviewer.d.ts +26 -0
- package/dist/core/reviewers/gate-reviewer.d.ts.map +1 -0
- package/dist/core/reviewers/gate-reviewer.js +130 -0
- package/dist/core/reviewers/gate-reviewer.js.map +1 -0
- package/dist/core/reviewers/information-leakage.d.ts +21 -0
- package/dist/core/reviewers/information-leakage.d.ts.map +1 -0
- package/dist/core/reviewers/information-leakage.js +72 -0
- package/dist/core/reviewers/information-leakage.js.map +1 -0
- package/dist/core/reviewers/settling-detection.d.ts +13 -0
- package/dist/core/reviewers/settling-detection.d.ts.map +1 -0
- package/dist/core/reviewers/settling-detection.js +48 -0
- package/dist/core/reviewers/settling-detection.js.map +1 -0
- package/dist/core/reviewers/url-validity.d.ts +18 -0
- package/dist/core/reviewers/url-validity.d.ts.map +1 -0
- package/dist/core/reviewers/url-validity.js +60 -0
- package/dist/core/reviewers/url-validity.js.map +1 -0
- package/dist/core/reviewers/value-alignment.d.ts +14 -0
- package/dist/core/reviewers/value-alignment.d.ts.map +1 -0
- package/dist/core/reviewers/value-alignment.js +71 -0
- package/dist/core/reviewers/value-alignment.js.map +1 -0
- package/dist/core/types.d.ts +2159 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +20 -0
- package/dist/core/types.js.map +1 -0
- package/dist/data/http-hook-templates.d.ts +53 -0
- package/dist/data/http-hook-templates.d.ts.map +1 -0
- package/dist/data/http-hook-templates.js +64 -0
- package/dist/data/http-hook-templates.js.map +1 -0
- package/dist/index.d.ts +263 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +164 -0
- package/dist/index.js.map +1 -0
- package/dist/knowledge/CoverageAuditor.d.ts +58 -0
- package/dist/knowledge/CoverageAuditor.d.ts.map +1 -0
- package/dist/knowledge/CoverageAuditor.js +153 -0
- package/dist/knowledge/CoverageAuditor.js.map +1 -0
- package/dist/knowledge/IntegrityManager.d.ts +46 -0
- package/dist/knowledge/IntegrityManager.d.ts.map +1 -0
- package/dist/knowledge/IntegrityManager.js +101 -0
- package/dist/knowledge/IntegrityManager.js.map +1 -0
- package/dist/knowledge/KnowledgeManager.d.ts +85 -0
- package/dist/knowledge/KnowledgeManager.d.ts.map +1 -0
- package/dist/knowledge/KnowledgeManager.js +194 -0
- package/dist/knowledge/KnowledgeManager.js.map +1 -0
- package/dist/knowledge/ProbeRegistry.d.ts +54 -0
- package/dist/knowledge/ProbeRegistry.d.ts.map +1 -0
- package/dist/knowledge/ProbeRegistry.js +119 -0
- package/dist/knowledge/ProbeRegistry.js.map +1 -0
- package/dist/knowledge/SelfKnowledgeTree.d.ts +108 -0
- package/dist/knowledge/SelfKnowledgeTree.d.ts.map +1 -0
- package/dist/knowledge/SelfKnowledgeTree.js +560 -0
- package/dist/knowledge/SelfKnowledgeTree.js.map +1 -0
- package/dist/knowledge/TreeGenerator.d.ts +57 -0
- package/dist/knowledge/TreeGenerator.d.ts.map +1 -0
- package/dist/knowledge/TreeGenerator.js +527 -0
- package/dist/knowledge/TreeGenerator.js.map +1 -0
- package/dist/knowledge/TreeSynthesis.d.ts +24 -0
- package/dist/knowledge/TreeSynthesis.d.ts.map +1 -0
- package/dist/knowledge/TreeSynthesis.js +61 -0
- package/dist/knowledge/TreeSynthesis.js.map +1 -0
- package/dist/knowledge/TreeTraversal.d.ts +93 -0
- package/dist/knowledge/TreeTraversal.d.ts.map +1 -0
- package/dist/knowledge/TreeTraversal.js +359 -0
- package/dist/knowledge/TreeTraversal.js.map +1 -0
- package/dist/knowledge/TreeTriage.d.ts +80 -0
- package/dist/knowledge/TreeTriage.d.ts.map +1 -0
- package/dist/knowledge/TreeTriage.js +413 -0
- package/dist/knowledge/TreeTriage.js.map +1 -0
- package/dist/knowledge/types.d.ts +183 -0
- package/dist/knowledge/types.d.ts.map +1 -0
- package/dist/knowledge/types.js +28 -0
- package/dist/knowledge/types.js.map +1 -0
- package/dist/lifeline/MessageQueue.d.ts +42 -0
- package/dist/lifeline/MessageQueue.d.ts.map +1 -0
- package/dist/lifeline/MessageQueue.js +63 -0
- package/dist/lifeline/MessageQueue.js.map +1 -0
- package/dist/lifeline/ServerSupervisor.d.ts +203 -0
- package/dist/lifeline/ServerSupervisor.d.ts.map +1 -0
- package/dist/lifeline/ServerSupervisor.js +1103 -0
- package/dist/lifeline/ServerSupervisor.js.map +1 -0
- package/dist/lifeline/SlackLifeline.d.ts +43 -0
- package/dist/lifeline/SlackLifeline.d.ts.map +1 -0
- package/dist/lifeline/SlackLifeline.js +227 -0
- package/dist/lifeline/SlackLifeline.js.map +1 -0
- package/dist/lifeline/TelegramLifeline.d.ts +180 -0
- package/dist/lifeline/TelegramLifeline.d.ts.map +1 -0
- package/dist/lifeline/TelegramLifeline.js +1533 -0
- package/dist/lifeline/TelegramLifeline.js.map +1 -0
- package/dist/memory/ActivityPartitioner.d.ts +67 -0
- package/dist/memory/ActivityPartitioner.d.ts.map +1 -0
- package/dist/memory/ActivityPartitioner.js +193 -0
- package/dist/memory/ActivityPartitioner.js.map +1 -0
- package/dist/memory/Chunker.d.ts +39 -0
- package/dist/memory/Chunker.d.ts.map +1 -0
- package/dist/memory/Chunker.js +154 -0
- package/dist/memory/Chunker.js.map +1 -0
- package/dist/memory/EmbeddingProvider.d.ts +82 -0
- package/dist/memory/EmbeddingProvider.d.ts.map +1 -0
- package/dist/memory/EmbeddingProvider.js +168 -0
- package/dist/memory/EmbeddingProvider.js.map +1 -0
- package/dist/memory/EpisodicMemory.d.ts +141 -0
- package/dist/memory/EpisodicMemory.d.ts.map +1 -0
- package/dist/memory/EpisodicMemory.js +303 -0
- package/dist/memory/EpisodicMemory.js.map +1 -0
- package/dist/memory/MemoryExporter.d.ts +82 -0
- package/dist/memory/MemoryExporter.d.ts.map +1 -0
- package/dist/memory/MemoryExporter.js +233 -0
- package/dist/memory/MemoryExporter.js.map +1 -0
- package/dist/memory/MemoryIndex.d.ts +76 -0
- package/dist/memory/MemoryIndex.d.ts.map +1 -0
- package/dist/memory/MemoryIndex.js +413 -0
- package/dist/memory/MemoryIndex.js.map +1 -0
- package/dist/memory/MemoryMigrator.d.ts +103 -0
- package/dist/memory/MemoryMigrator.d.ts.map +1 -0
- package/dist/memory/MemoryMigrator.js +510 -0
- package/dist/memory/MemoryMigrator.js.map +1 -0
- package/dist/memory/SemanticMemory.d.ts +255 -0
- package/dist/memory/SemanticMemory.d.ts.map +1 -0
- package/dist/memory/SemanticMemory.js +1130 -0
- package/dist/memory/SemanticMemory.js.map +1 -0
- package/dist/memory/TopicMemory.d.ts +227 -0
- package/dist/memory/TopicMemory.d.ts.map +1 -0
- package/dist/memory/TopicMemory.js +731 -0
- package/dist/memory/TopicMemory.js.map +1 -0
- package/dist/memory/TopicSummarizer.d.ts +69 -0
- package/dist/memory/TopicSummarizer.d.ts.map +1 -0
- package/dist/memory/TopicSummarizer.js +163 -0
- package/dist/memory/TopicSummarizer.js.map +1 -0
- package/dist/memory/VectorSearch.d.ts +80 -0
- package/dist/memory/VectorSearch.d.ts.map +1 -0
- package/dist/memory/VectorSearch.js +148 -0
- package/dist/memory/VectorSearch.js.map +1 -0
- package/dist/memory/WorkingMemoryAssembler.d.ts +122 -0
- package/dist/memory/WorkingMemoryAssembler.d.ts.map +1 -0
- package/dist/memory/WorkingMemoryAssembler.js +406 -0
- package/dist/memory/WorkingMemoryAssembler.js.map +1 -0
- package/dist/messaging/AdapterRegistry.d.ts +27 -0
- package/dist/messaging/AdapterRegistry.d.ts.map +1 -0
- package/dist/messaging/AdapterRegistry.js +40 -0
- package/dist/messaging/AdapterRegistry.js.map +1 -0
- package/dist/messaging/AgentTokenManager.d.ts +86 -0
- package/dist/messaging/AgentTokenManager.d.ts.map +1 -0
- package/dist/messaging/AgentTokenManager.js +213 -0
- package/dist/messaging/AgentTokenManager.js.map +1 -0
- package/dist/messaging/DeliveryRetryManager.d.ts +47 -0
- package/dist/messaging/DeliveryRetryManager.d.ts.map +1 -0
- package/dist/messaging/DeliveryRetryManager.js +201 -0
- package/dist/messaging/DeliveryRetryManager.js.map +1 -0
- package/dist/messaging/DropPickup.d.ts +37 -0
- package/dist/messaging/DropPickup.d.ts.map +1 -0
- package/dist/messaging/DropPickup.js +120 -0
- package/dist/messaging/DropPickup.js.map +1 -0
- package/dist/messaging/GitSyncTransport.d.ts +120 -0
- package/dist/messaging/GitSyncTransport.d.ts.map +1 -0
- package/dist/messaging/GitSyncTransport.js +296 -0
- package/dist/messaging/GitSyncTransport.js.map +1 -0
- package/dist/messaging/MessageDelivery.d.ts +27 -0
- package/dist/messaging/MessageDelivery.d.ts.map +1 -0
- package/dist/messaging/MessageDelivery.js +90 -0
- package/dist/messaging/MessageDelivery.js.map +1 -0
- package/dist/messaging/MessageFormatter.d.ts +30 -0
- package/dist/messaging/MessageFormatter.d.ts.map +1 -0
- package/dist/messaging/MessageFormatter.js +97 -0
- package/dist/messaging/MessageFormatter.js.map +1 -0
- package/dist/messaging/MessageRouter.d.ts +157 -0
- package/dist/messaging/MessageRouter.d.ts.map +1 -0
- package/dist/messaging/MessageRouter.js +657 -0
- package/dist/messaging/MessageRouter.js.map +1 -0
- package/dist/messaging/MessageStore.d.ts +52 -0
- package/dist/messaging/MessageStore.d.ts.map +1 -0
- package/dist/messaging/MessageStore.js +363 -0
- package/dist/messaging/MessageStore.js.map +1 -0
- package/dist/messaging/NotificationBatcher.d.ts +95 -0
- package/dist/messaging/NotificationBatcher.d.ts.map +1 -0
- package/dist/messaging/NotificationBatcher.js +253 -0
- package/dist/messaging/NotificationBatcher.js.map +1 -0
- package/dist/messaging/SessionSummarySentinel.d.ts +104 -0
- package/dist/messaging/SessionSummarySentinel.d.ts.map +1 -0
- package/dist/messaging/SessionSummarySentinel.js +386 -0
- package/dist/messaging/SessionSummarySentinel.js.map +1 -0
- package/dist/messaging/SpawnRequestManager.d.ts +88 -0
- package/dist/messaging/SpawnRequestManager.d.ts.map +1 -0
- package/dist/messaging/SpawnRequestManager.js +159 -0
- package/dist/messaging/SpawnRequestManager.js.map +1 -0
- package/dist/messaging/TelegramAdapter.d.ts +636 -0
- package/dist/messaging/TelegramAdapter.d.ts.map +1 -0
- package/dist/messaging/TelegramAdapter.js +3434 -0
- package/dist/messaging/TelegramAdapter.js.map +1 -0
- package/dist/messaging/TopicContentValidator.d.ts +81 -0
- package/dist/messaging/TopicContentValidator.d.ts.map +1 -0
- package/dist/messaging/TopicContentValidator.js +113 -0
- package/dist/messaging/TopicContentValidator.js.map +1 -0
- package/dist/messaging/WhatsAppAdapter.d.ts +224 -0
- package/dist/messaging/WhatsAppAdapter.d.ts.map +1 -0
- package/dist/messaging/WhatsAppAdapter.js +736 -0
- package/dist/messaging/WhatsAppAdapter.js.map +1 -0
- package/dist/messaging/backends/BaileysBackend.d.ts +74 -0
- package/dist/messaging/backends/BaileysBackend.d.ts.map +1 -0
- package/dist/messaging/backends/BaileysBackend.js +481 -0
- package/dist/messaging/backends/BaileysBackend.js.map +1 -0
- package/dist/messaging/backends/BusinessApiBackend.d.ts +173 -0
- package/dist/messaging/backends/BusinessApiBackend.d.ts.map +1 -0
- package/dist/messaging/backends/BusinessApiBackend.js +269 -0
- package/dist/messaging/backends/BusinessApiBackend.js.map +1 -0
- package/dist/messaging/backends/WhatsAppWebhookRoutes.d.ts +26 -0
- package/dist/messaging/backends/WhatsAppWebhookRoutes.d.ts.map +1 -0
- package/dist/messaging/backends/WhatsAppWebhookRoutes.js +50 -0
- package/dist/messaging/backends/WhatsAppWebhookRoutes.js.map +1 -0
- package/dist/messaging/shared/AuthGate.d.ts +102 -0
- package/dist/messaging/shared/AuthGate.d.ts.map +1 -0
- package/dist/messaging/shared/AuthGate.js +159 -0
- package/dist/messaging/shared/AuthGate.js.map +1 -0
- package/dist/messaging/shared/CommandRouter.d.ts +84 -0
- package/dist/messaging/shared/CommandRouter.d.ts.map +1 -0
- package/dist/messaging/shared/CommandRouter.js +145 -0
- package/dist/messaging/shared/CommandRouter.js.map +1 -0
- package/dist/messaging/shared/CrossPlatformAlerts.d.ts +67 -0
- package/dist/messaging/shared/CrossPlatformAlerts.d.ts.map +1 -0
- package/dist/messaging/shared/CrossPlatformAlerts.js +134 -0
- package/dist/messaging/shared/CrossPlatformAlerts.js.map +1 -0
- package/dist/messaging/shared/EncryptedAuthStore.d.ts +51 -0
- package/dist/messaging/shared/EncryptedAuthStore.d.ts.map +1 -0
- package/dist/messaging/shared/EncryptedAuthStore.js +194 -0
- package/dist/messaging/shared/EncryptedAuthStore.js.map +1 -0
- package/dist/messaging/shared/FeatureFlags.d.ts +21 -0
- package/dist/messaging/shared/FeatureFlags.d.ts.map +1 -0
- package/dist/messaging/shared/FeatureFlags.js +21 -0
- package/dist/messaging/shared/FeatureFlags.js.map +1 -0
- package/dist/messaging/shared/MessageBridge.d.ts +70 -0
- package/dist/messaging/shared/MessageBridge.d.ts.map +1 -0
- package/dist/messaging/shared/MessageBridge.js +178 -0
- package/dist/messaging/shared/MessageBridge.js.map +1 -0
- package/dist/messaging/shared/MessageLogger.d.ts +94 -0
- package/dist/messaging/shared/MessageLogger.d.ts.map +1 -0
- package/dist/messaging/shared/MessageLogger.js +173 -0
- package/dist/messaging/shared/MessageLogger.js.map +1 -0
- package/dist/messaging/shared/MessagingEventBus.d.ts +149 -0
- package/dist/messaging/shared/MessagingEventBus.d.ts.map +1 -0
- package/dist/messaging/shared/MessagingEventBus.js +111 -0
- package/dist/messaging/shared/MessagingEventBus.js.map +1 -0
- package/dist/messaging/shared/PhoneUtils.d.ts +44 -0
- package/dist/messaging/shared/PhoneUtils.d.ts.map +1 -0
- package/dist/messaging/shared/PhoneUtils.js +110 -0
- package/dist/messaging/shared/PhoneUtils.js.map +1 -0
- package/dist/messaging/shared/PrivacyConsent.d.ts +61 -0
- package/dist/messaging/shared/PrivacyConsent.d.ts.map +1 -0
- package/dist/messaging/shared/PrivacyConsent.js +132 -0
- package/dist/messaging/shared/PrivacyConsent.js.map +1 -0
- package/dist/messaging/shared/SessionChannelRegistry.d.ts +48 -0
- package/dist/messaging/shared/SessionChannelRegistry.d.ts.map +1 -0
- package/dist/messaging/shared/SessionChannelRegistry.js +144 -0
- package/dist/messaging/shared/SessionChannelRegistry.js.map +1 -0
- package/dist/messaging/shared/SmartChunker.d.ts +16 -0
- package/dist/messaging/shared/SmartChunker.d.ts.map +1 -0
- package/dist/messaging/shared/SmartChunker.js +100 -0
- package/dist/messaging/shared/SmartChunker.js.map +1 -0
- package/dist/messaging/shared/StallDetector.d.ts +85 -0
- package/dist/messaging/shared/StallDetector.d.ts.map +1 -0
- package/dist/messaging/shared/StallDetector.js +225 -0
- package/dist/messaging/shared/StallDetector.js.map +1 -0
- package/dist/messaging/shared/index.d.ts +22 -0
- package/dist/messaging/shared/index.d.ts.map +1 -0
- package/dist/messaging/shared/index.js +13 -0
- package/dist/messaging/shared/index.js.map +1 -0
- package/dist/messaging/slack/ChannelManager.d.ts +36 -0
- package/dist/messaging/slack/ChannelManager.d.ts.map +1 -0
- package/dist/messaging/slack/ChannelManager.js +100 -0
- package/dist/messaging/slack/ChannelManager.js.map +1 -0
- package/dist/messaging/slack/FileHandler.d.ts +30 -0
- package/dist/messaging/slack/FileHandler.d.ts.map +1 -0
- package/dist/messaging/slack/FileHandler.js +87 -0
- package/dist/messaging/slack/FileHandler.js.map +1 -0
- package/dist/messaging/slack/RingBuffer.d.ts +22 -0
- package/dist/messaging/slack/RingBuffer.d.ts.map +1 -0
- package/dist/messaging/slack/RingBuffer.js +48 -0
- package/dist/messaging/slack/RingBuffer.js.map +1 -0
- package/dist/messaging/slack/SlackAdapter.d.ts +283 -0
- package/dist/messaging/slack/SlackAdapter.d.ts.map +1 -0
- package/dist/messaging/slack/SlackAdapter.js +1524 -0
- package/dist/messaging/slack/SlackAdapter.js.map +1 -0
- package/dist/messaging/slack/SlackApiClient.d.ts +51 -0
- package/dist/messaging/slack/SlackApiClient.d.ts.map +1 -0
- package/dist/messaging/slack/SlackApiClient.js +94 -0
- package/dist/messaging/slack/SlackApiClient.js.map +1 -0
- package/dist/messaging/slack/SocketModeClient.d.ts +44 -0
- package/dist/messaging/slack/SocketModeClient.d.ts.map +1 -0
- package/dist/messaging/slack/SocketModeClient.js +209 -0
- package/dist/messaging/slack/SocketModeClient.js.map +1 -0
- package/dist/messaging/slack/index.d.ts +12 -0
- package/dist/messaging/slack/index.d.ts.map +1 -0
- package/dist/messaging/slack/index.js +15 -0
- package/dist/messaging/slack/index.js.map +1 -0
- package/dist/messaging/slack/sanitize.d.ts +39 -0
- package/dist/messaging/slack/sanitize.d.ts.map +1 -0
- package/dist/messaging/slack/sanitize.js +71 -0
- package/dist/messaging/slack/sanitize.js.map +1 -0
- package/dist/messaging/slack/types.d.ts +186 -0
- package/dist/messaging/slack/types.d.ts.map +1 -0
- package/dist/messaging/slack/types.js +54 -0
- package/dist/messaging/slack/types.js.map +1 -0
- package/dist/messaging/types.d.ts +400 -0
- package/dist/messaging/types.d.ts.map +1 -0
- package/dist/messaging/types.js +89 -0
- package/dist/messaging/types.js.map +1 -0
- package/dist/monitoring/AccountSwitcher.d.ts +61 -0
- package/dist/monitoring/AccountSwitcher.d.ts.map +1 -0
- package/dist/monitoring/AccountSwitcher.js +196 -0
- package/dist/monitoring/AccountSwitcher.js.map +1 -0
- package/dist/monitoring/CoherenceMonitor.d.ts +133 -0
- package/dist/monitoring/CoherenceMonitor.d.ts.map +1 -0
- package/dist/monitoring/CoherenceMonitor.js +550 -0
- package/dist/monitoring/CoherenceMonitor.js.map +1 -0
- package/dist/monitoring/CommitmentSentinel.d.ts +57 -0
- package/dist/monitoring/CommitmentSentinel.d.ts.map +1 -0
- package/dist/monitoring/CommitmentSentinel.js +251 -0
- package/dist/monitoring/CommitmentSentinel.js.map +1 -0
- package/dist/monitoring/CommitmentTracker.d.ts +186 -0
- package/dist/monitoring/CommitmentTracker.d.ts.map +1 -0
- package/dist/monitoring/CommitmentTracker.js +522 -0
- package/dist/monitoring/CommitmentTracker.js.map +1 -0
- package/dist/monitoring/CredentialProvider.d.ts +84 -0
- package/dist/monitoring/CredentialProvider.d.ts.map +1 -0
- package/dist/monitoring/CredentialProvider.js +196 -0
- package/dist/monitoring/CredentialProvider.js.map +1 -0
- package/dist/monitoring/DegradationReporter.d.ts +123 -0
- package/dist/monitoring/DegradationReporter.d.ts.map +1 -0
- package/dist/monitoring/DegradationReporter.js +241 -0
- package/dist/monitoring/DegradationReporter.js.map +1 -0
- package/dist/monitoring/FeedbackAnomalyDetector.d.ts +51 -0
- package/dist/monitoring/FeedbackAnomalyDetector.d.ts.map +1 -0
- package/dist/monitoring/FeedbackAnomalyDetector.js +120 -0
- package/dist/monitoring/FeedbackAnomalyDetector.js.map +1 -0
- package/dist/monitoring/HealthChecker.d.ts +45 -0
- package/dist/monitoring/HealthChecker.d.ts.map +1 -0
- package/dist/monitoring/HealthChecker.js +219 -0
- package/dist/monitoring/HealthChecker.js.map +1 -0
- package/dist/monitoring/HomeostasisMonitor.d.ts +102 -0
- package/dist/monitoring/HomeostasisMonitor.d.ts.map +1 -0
- package/dist/monitoring/HomeostasisMonitor.js +185 -0
- package/dist/monitoring/HomeostasisMonitor.js.map +1 -0
- package/dist/monitoring/HookEventReceiver.d.ts +132 -0
- package/dist/monitoring/HookEventReceiver.d.ts.map +1 -0
- package/dist/monitoring/HookEventReceiver.js +209 -0
- package/dist/monitoring/HookEventReceiver.js.map +1 -0
- package/dist/monitoring/InputClassifier.d.ts +68 -0
- package/dist/monitoring/InputClassifier.d.ts.map +1 -0
- package/dist/monitoring/InputClassifier.js +243 -0
- package/dist/monitoring/InputClassifier.js.map +1 -0
- package/dist/monitoring/InstructionsVerifier.d.ts +76 -0
- package/dist/monitoring/InstructionsVerifier.d.ts.map +1 -0
- package/dist/monitoring/InstructionsVerifier.js +116 -0
- package/dist/monitoring/InstructionsVerifier.js.map +1 -0
- package/dist/monitoring/MemoryPressureMonitor.d.ts +107 -0
- package/dist/monitoring/MemoryPressureMonitor.d.ts.map +1 -0
- package/dist/monitoring/MemoryPressureMonitor.js +329 -0
- package/dist/monitoring/MemoryPressureMonitor.js.map +1 -0
- package/dist/monitoring/OrphanProcessReaper.d.ts +125 -0
- package/dist/monitoring/OrphanProcessReaper.d.ts.map +1 -0
- package/dist/monitoring/OrphanProcessReaper.js +476 -0
- package/dist/monitoring/OrphanProcessReaper.js.map +1 -0
- package/dist/monitoring/PresenceProxy.d.ts +167 -0
- package/dist/monitoring/PresenceProxy.d.ts.map +1 -0
- package/dist/monitoring/PresenceProxy.js +972 -0
- package/dist/monitoring/PresenceProxy.js.map +1 -0
- package/dist/monitoring/PromptGate.d.ts +91 -0
- package/dist/monitoring/PromptGate.d.ts.map +1 -0
- package/dist/monitoring/PromptGate.js +411 -0
- package/dist/monitoring/PromptGate.js.map +1 -0
- package/dist/monitoring/QuotaCollector.d.ts +267 -0
- package/dist/monitoring/QuotaCollector.d.ts.map +1 -0
- package/dist/monitoring/QuotaCollector.js +790 -0
- package/dist/monitoring/QuotaCollector.js.map +1 -0
- package/dist/monitoring/QuotaExhaustionDetector.d.ts +21 -0
- package/dist/monitoring/QuotaExhaustionDetector.d.ts.map +1 -0
- package/dist/monitoring/QuotaExhaustionDetector.js +136 -0
- package/dist/monitoring/QuotaExhaustionDetector.js.map +1 -0
- package/dist/monitoring/QuotaManager.d.ts +191 -0
- package/dist/monitoring/QuotaManager.d.ts.map +1 -0
- package/dist/monitoring/QuotaManager.js +575 -0
- package/dist/monitoring/QuotaManager.js.map +1 -0
- package/dist/monitoring/QuotaNotifier.d.ts +38 -0
- package/dist/monitoring/QuotaNotifier.d.ts.map +1 -0
- package/dist/monitoring/QuotaNotifier.js +144 -0
- package/dist/monitoring/QuotaNotifier.js.map +1 -0
- package/dist/monitoring/QuotaTracker.d.ts +92 -0
- package/dist/monitoring/QuotaTracker.d.ts.map +1 -0
- package/dist/monitoring/QuotaTracker.js +239 -0
- package/dist/monitoring/QuotaTracker.js.map +1 -0
- package/dist/monitoring/ReflectionMetrics.d.ts +97 -0
- package/dist/monitoring/ReflectionMetrics.d.ts.map +1 -0
- package/dist/monitoring/ReflectionMetrics.js +170 -0
- package/dist/monitoring/ReflectionMetrics.js.map +1 -0
- package/dist/monitoring/SessionActivitySentinel.d.ts +95 -0
- package/dist/monitoring/SessionActivitySentinel.d.ts.map +1 -0
- package/dist/monitoring/SessionActivitySentinel.js +391 -0
- package/dist/monitoring/SessionActivitySentinel.js.map +1 -0
- package/dist/monitoring/SessionCredentialManager.d.ts +56 -0
- package/dist/monitoring/SessionCredentialManager.d.ts.map +1 -0
- package/dist/monitoring/SessionCredentialManager.js +91 -0
- package/dist/monitoring/SessionCredentialManager.js.map +1 -0
- package/dist/monitoring/SessionMigrator.d.ts +234 -0
- package/dist/monitoring/SessionMigrator.d.ts.map +1 -0
- package/dist/monitoring/SessionMigrator.js +604 -0
- package/dist/monitoring/SessionMigrator.js.map +1 -0
- package/dist/monitoring/SessionMonitor.d.ts +102 -0
- package/dist/monitoring/SessionMonitor.d.ts.map +1 -0
- package/dist/monitoring/SessionMonitor.js +238 -0
- package/dist/monitoring/SessionMonitor.js.map +1 -0
- package/dist/monitoring/SessionRecovery.d.ts +129 -0
- package/dist/monitoring/SessionRecovery.d.ts.map +1 -0
- package/dist/monitoring/SessionRecovery.js +496 -0
- package/dist/monitoring/SessionRecovery.js.map +1 -0
- package/dist/monitoring/SessionWatchdog.d.ts +138 -0
- package/dist/monitoring/SessionWatchdog.d.ts.map +1 -0
- package/dist/monitoring/SessionWatchdog.js +549 -0
- package/dist/monitoring/SessionWatchdog.js.map +1 -0
- package/dist/monitoring/StallTriageNurse.d.ts +96 -0
- package/dist/monitoring/StallTriageNurse.d.ts.map +1 -0
- package/dist/monitoring/StallTriageNurse.js +711 -0
- package/dist/monitoring/StallTriageNurse.js.map +1 -0
- package/dist/monitoring/StallTriageNurse.types.d.ts +124 -0
- package/dist/monitoring/StallTriageNurse.types.d.ts.map +1 -0
- package/dist/monitoring/StallTriageNurse.types.js +5 -0
- package/dist/monitoring/StallTriageNurse.types.js.map +1 -0
- package/dist/monitoring/SubagentTracker.d.ts +86 -0
- package/dist/monitoring/SubagentTracker.d.ts.map +1 -0
- package/dist/monitoring/SubagentTracker.js +199 -0
- package/dist/monitoring/SubagentTracker.js.map +1 -0
- package/dist/monitoring/SystemReviewer.d.ts +243 -0
- package/dist/monitoring/SystemReviewer.d.ts.map +1 -0
- package/dist/monitoring/SystemReviewer.js +697 -0
- package/dist/monitoring/SystemReviewer.js.map +1 -0
- package/dist/monitoring/TelemetryAuth.d.ts +64 -0
- package/dist/monitoring/TelemetryAuth.d.ts.map +1 -0
- package/dist/monitoring/TelemetryAuth.js +141 -0
- package/dist/monitoring/TelemetryAuth.js.map +1 -0
- package/dist/monitoring/TelemetryCollector.d.ts +95 -0
- package/dist/monitoring/TelemetryCollector.d.ts.map +1 -0
- package/dist/monitoring/TelemetryCollector.js +326 -0
- package/dist/monitoring/TelemetryCollector.js.map +1 -0
- package/dist/monitoring/TelemetryHeartbeat.d.ts +160 -0
- package/dist/monitoring/TelemetryHeartbeat.d.ts.map +1 -0
- package/dist/monitoring/TelemetryHeartbeat.js +450 -0
- package/dist/monitoring/TelemetryHeartbeat.js.map +1 -0
- package/dist/monitoring/TriageOrchestrator.d.ts +217 -0
- package/dist/monitoring/TriageOrchestrator.d.ts.map +1 -0
- package/dist/monitoring/TriageOrchestrator.js +801 -0
- package/dist/monitoring/TriageOrchestrator.js.map +1 -0
- package/dist/monitoring/WorktreeMonitor.d.ts +124 -0
- package/dist/monitoring/WorktreeMonitor.d.ts.map +1 -0
- package/dist/monitoring/WorktreeMonitor.js +379 -0
- package/dist/monitoring/WorktreeMonitor.js.map +1 -0
- package/dist/monitoring/crash-detector.d.ts +50 -0
- package/dist/monitoring/crash-detector.d.ts.map +1 -0
- package/dist/monitoring/crash-detector.js +224 -0
- package/dist/monitoring/crash-detector.js.map +1 -0
- package/dist/monitoring/jsonl-truncator.d.ts +44 -0
- package/dist/monitoring/jsonl-truncator.d.ts.map +1 -0
- package/dist/monitoring/jsonl-truncator.js +224 -0
- package/dist/monitoring/jsonl-truncator.js.map +1 -0
- package/dist/monitoring/probes/LifelineProbe.d.ts +38 -0
- package/dist/monitoring/probes/LifelineProbe.d.ts.map +1 -0
- package/dist/monitoring/probes/LifelineProbe.js +285 -0
- package/dist/monitoring/probes/LifelineProbe.js.map +1 -0
- package/dist/monitoring/probes/MessagingProbe.d.ts +23 -0
- package/dist/monitoring/probes/MessagingProbe.d.ts.map +1 -0
- package/dist/monitoring/probes/MessagingProbe.js +214 -0
- package/dist/monitoring/probes/MessagingProbe.js.map +1 -0
- package/dist/monitoring/probes/PlatformProbe.d.ts +15 -0
- package/dist/monitoring/probes/PlatformProbe.d.ts.map +1 -0
- package/dist/monitoring/probes/PlatformProbe.js +222 -0
- package/dist/monitoring/probes/PlatformProbe.js.map +1 -0
- package/dist/monitoring/probes/SchedulerProbe.d.ts +33 -0
- package/dist/monitoring/probes/SchedulerProbe.d.ts.map +1 -0
- package/dist/monitoring/probes/SchedulerProbe.js +196 -0
- package/dist/monitoring/probes/SchedulerProbe.js.map +1 -0
- package/dist/monitoring/probes/SessionProbe.d.ts +28 -0
- package/dist/monitoring/probes/SessionProbe.d.ts.map +1 -0
- package/dist/monitoring/probes/SessionProbe.js +234 -0
- package/dist/monitoring/probes/SessionProbe.js.map +1 -0
- package/dist/monitoring/stall-detector.d.ts +34 -0
- package/dist/monitoring/stall-detector.d.ts.map +1 -0
- package/dist/monitoring/stall-detector.js +151 -0
- package/dist/monitoring/stall-detector.js.map +1 -0
- package/dist/paste/PasteManager.d.ts +154 -0
- package/dist/paste/PasteManager.d.ts.map +1 -0
- package/dist/paste/PasteManager.js +524 -0
- package/dist/paste/PasteManager.js.map +1 -0
- package/dist/paste/TruncationDetector.d.ts +51 -0
- package/dist/paste/TruncationDetector.d.ts.map +1 -0
- package/dist/paste/TruncationDetector.js +220 -0
- package/dist/paste/TruncationDetector.js.map +1 -0
- package/dist/privacy/OutputPrivacyRouter.d.ts +65 -0
- package/dist/privacy/OutputPrivacyRouter.d.ts.map +1 -0
- package/dist/privacy/OutputPrivacyRouter.js +156 -0
- package/dist/privacy/OutputPrivacyRouter.js.map +1 -0
- package/dist/publishing/PrivateViewer.d.ts +63 -0
- package/dist/publishing/PrivateViewer.d.ts.map +1 -0
- package/dist/publishing/PrivateViewer.js +398 -0
- package/dist/publishing/PrivateViewer.js.map +1 -0
- package/dist/publishing/TelegraphService.d.ts +137 -0
- package/dist/publishing/TelegraphService.d.ts.map +1 -0
- package/dist/publishing/TelegraphService.js +410 -0
- package/dist/publishing/TelegraphService.js.map +1 -0
- package/dist/scaffold/bootstrap.d.ts +21 -0
- package/dist/scaffold/bootstrap.d.ts.map +1 -0
- package/dist/scaffold/bootstrap.js +125 -0
- package/dist/scaffold/bootstrap.js.map +1 -0
- package/dist/scaffold/templates.d.ts +47 -0
- package/dist/scaffold/templates.d.ts.map +1 -0
- package/dist/scaffold/templates.js +1506 -0
- package/dist/scaffold/templates.js.map +1 -0
- package/dist/scheduler/IntegrationGate.d.ts +81 -0
- package/dist/scheduler/IntegrationGate.d.ts.map +1 -0
- package/dist/scheduler/IntegrationGate.js +242 -0
- package/dist/scheduler/IntegrationGate.js.map +1 -0
- package/dist/scheduler/JobClaimManager.d.ts +137 -0
- package/dist/scheduler/JobClaimManager.d.ts.map +1 -0
- package/dist/scheduler/JobClaimManager.js +283 -0
- package/dist/scheduler/JobClaimManager.js.map +1 -0
- package/dist/scheduler/JobLoader.d.ts +28 -0
- package/dist/scheduler/JobLoader.d.ts.map +1 -0
- package/dist/scheduler/JobLoader.js +269 -0
- package/dist/scheduler/JobLoader.js.map +1 -0
- package/dist/scheduler/JobRunHistory.d.ts +180 -0
- package/dist/scheduler/JobRunHistory.d.ts.map +1 -0
- package/dist/scheduler/JobRunHistory.js +349 -0
- package/dist/scheduler/JobRunHistory.js.map +1 -0
- package/dist/scheduler/JobScheduler.d.ts +244 -0
- package/dist/scheduler/JobScheduler.d.ts.map +1 -0
- package/dist/scheduler/JobScheduler.js +1085 -0
- package/dist/scheduler/JobScheduler.js.map +1 -0
- package/dist/scheduler/SkipLedger.d.ts +65 -0
- package/dist/scheduler/SkipLedger.d.ts.map +1 -0
- package/dist/scheduler/SkipLedger.js +179 -0
- package/dist/scheduler/SkipLedger.js.map +1 -0
- package/dist/security/LLMSanitizer.d.ts +65 -0
- package/dist/security/LLMSanitizer.d.ts.map +1 -0
- package/dist/security/LLMSanitizer.js +153 -0
- package/dist/security/LLMSanitizer.js.map +1 -0
- package/dist/security/ManifestIntegrity.d.ts +72 -0
- package/dist/security/ManifestIntegrity.d.ts.map +1 -0
- package/dist/security/ManifestIntegrity.js +159 -0
- package/dist/security/ManifestIntegrity.js.map +1 -0
- package/dist/server/AgentServer.d.ts +134 -0
- package/dist/server/AgentServer.d.ts.map +1 -0
- package/dist/server/AgentServer.js +307 -0
- package/dist/server/AgentServer.js.map +1 -0
- package/dist/server/SecretDrop.d.ts +133 -0
- package/dist/server/SecretDrop.d.ts.map +1 -0
- package/dist/server/SecretDrop.js +473 -0
- package/dist/server/SecretDrop.js.map +1 -0
- package/dist/server/WebSocketManager.d.ts +80 -0
- package/dist/server/WebSocketManager.d.ts.map +1 -0
- package/dist/server/WebSocketManager.js +367 -0
- package/dist/server/WebSocketManager.js.map +1 -0
- package/dist/server/fileRoutes.d.ts +19 -0
- package/dist/server/fileRoutes.d.ts.map +1 -0
- package/dist/server/fileRoutes.js +578 -0
- package/dist/server/fileRoutes.js.map +1 -0
- package/dist/server/machineAuth.d.ts +87 -0
- package/dist/server/machineAuth.d.ts.map +1 -0
- package/dist/server/machineAuth.js +188 -0
- package/dist/server/machineAuth.js.map +1 -0
- package/dist/server/machineRoutes.d.ts +49 -0
- package/dist/server/machineRoutes.d.ts.map +1 -0
- package/dist/server/machineRoutes.js +305 -0
- package/dist/server/machineRoutes.js.map +1 -0
- package/dist/server/middleware.d.ts +32 -0
- package/dist/server/middleware.d.ts.map +1 -0
- package/dist/server/middleware.js +202 -0
- package/dist/server/middleware.js.map +1 -0
- package/dist/server/routes.d.ts +132 -0
- package/dist/server/routes.d.ts.map +1 -0
- package/dist/server/routes.js +8124 -0
- package/dist/server/routes.js.map +1 -0
- package/dist/threadline/A2AGateway.d.ts +184 -0
- package/dist/threadline/A2AGateway.d.ts.map +1 -0
- package/dist/threadline/A2AGateway.js +438 -0
- package/dist/threadline/A2AGateway.js.map +1 -0
- package/dist/threadline/AgentCard.d.ts +116 -0
- package/dist/threadline/AgentCard.d.ts.map +1 -0
- package/dist/threadline/AgentCard.js +212 -0
- package/dist/threadline/AgentCard.js.map +1 -0
- package/dist/threadline/AgentDiscovery.d.ts +156 -0
- package/dist/threadline/AgentDiscovery.d.ts.map +1 -0
- package/dist/threadline/AgentDiscovery.js +390 -0
- package/dist/threadline/AgentDiscovery.js.map +1 -0
- package/dist/threadline/AgentTrustManager.d.ts +190 -0
- package/dist/threadline/AgentTrustManager.d.ts.map +1 -0
- package/dist/threadline/AgentTrustManager.js +526 -0
- package/dist/threadline/AgentTrustManager.js.map +1 -0
- package/dist/threadline/ApprovalQueue.d.ts +71 -0
- package/dist/threadline/ApprovalQueue.d.ts.map +1 -0
- package/dist/threadline/ApprovalQueue.js +154 -0
- package/dist/threadline/ApprovalQueue.js.map +1 -0
- package/dist/threadline/AutonomyGate.d.ts +130 -0
- package/dist/threadline/AutonomyGate.d.ts.map +1 -0
- package/dist/threadline/AutonomyGate.js +267 -0
- package/dist/threadline/AutonomyGate.js.map +1 -0
- package/dist/threadline/CircuitBreaker.d.ts +89 -0
- package/dist/threadline/CircuitBreaker.d.ts.map +1 -0
- package/dist/threadline/CircuitBreaker.js +238 -0
- package/dist/threadline/CircuitBreaker.js.map +1 -0
- package/dist/threadline/ComputeMeter.d.ts +114 -0
- package/dist/threadline/ComputeMeter.d.ts.map +1 -0
- package/dist/threadline/ComputeMeter.js +350 -0
- package/dist/threadline/ComputeMeter.js.map +1 -0
- package/dist/threadline/ContentClassifier.d.ts +83 -0
- package/dist/threadline/ContentClassifier.d.ts.map +1 -0
- package/dist/threadline/ContentClassifier.js +201 -0
- package/dist/threadline/ContentClassifier.js.map +1 -0
- package/dist/threadline/ContextThreadMap.d.ts +103 -0
- package/dist/threadline/ContextThreadMap.d.ts.map +1 -0
- package/dist/threadline/ContextThreadMap.js +279 -0
- package/dist/threadline/ContextThreadMap.js.map +1 -0
- package/dist/threadline/DNSVerifier.d.ts +48 -0
- package/dist/threadline/DNSVerifier.d.ts.map +1 -0
- package/dist/threadline/DNSVerifier.js +138 -0
- package/dist/threadline/DNSVerifier.js.map +1 -0
- package/dist/threadline/DigestCollector.d.ts +70 -0
- package/dist/threadline/DigestCollector.d.ts.map +1 -0
- package/dist/threadline/DigestCollector.js +146 -0
- package/dist/threadline/DigestCollector.js.map +1 -0
- package/dist/threadline/HandshakeManager.d.ts +130 -0
- package/dist/threadline/HandshakeManager.d.ts.map +1 -0
- package/dist/threadline/HandshakeManager.js +402 -0
- package/dist/threadline/HandshakeManager.js.map +1 -0
- package/dist/threadline/InboundMessageGate.d.ts +80 -0
- package/dist/threadline/InboundMessageGate.d.ts.map +1 -0
- package/dist/threadline/InboundMessageGate.js +241 -0
- package/dist/threadline/InboundMessageGate.js.map +1 -0
- package/dist/threadline/InvitationManager.d.ts +91 -0
- package/dist/threadline/InvitationManager.d.ts.map +1 -0
- package/dist/threadline/InvitationManager.js +228 -0
- package/dist/threadline/InvitationManager.js.map +1 -0
- package/dist/threadline/ListenerSessionManager.d.ts +147 -0
- package/dist/threadline/ListenerSessionManager.d.ts.map +1 -0
- package/dist/threadline/ListenerSessionManager.js +326 -0
- package/dist/threadline/ListenerSessionManager.js.map +1 -0
- package/dist/threadline/MCPAuth.d.ts +98 -0
- package/dist/threadline/MCPAuth.d.ts.map +1 -0
- package/dist/threadline/MCPAuth.js +228 -0
- package/dist/threadline/MCPAuth.js.map +1 -0
- package/dist/threadline/OpenClawBridge.d.ts +143 -0
- package/dist/threadline/OpenClawBridge.d.ts.map +1 -0
- package/dist/threadline/OpenClawBridge.js +336 -0
- package/dist/threadline/OpenClawBridge.js.map +1 -0
- package/dist/threadline/OpenClawSkillManifest.d.ts +47 -0
- package/dist/threadline/OpenClawSkillManifest.d.ts.map +1 -0
- package/dist/threadline/OpenClawSkillManifest.js +148 -0
- package/dist/threadline/OpenClawSkillManifest.js.map +1 -0
- package/dist/threadline/RateLimiter.d.ts +105 -0
- package/dist/threadline/RateLimiter.d.ts.map +1 -0
- package/dist/threadline/RateLimiter.js +236 -0
- package/dist/threadline/RateLimiter.js.map +1 -0
- package/dist/threadline/RelayGroundingPreamble.d.ts +48 -0
- package/dist/threadline/RelayGroundingPreamble.d.ts.map +1 -0
- package/dist/threadline/RelayGroundingPreamble.js +68 -0
- package/dist/threadline/RelayGroundingPreamble.js.map +1 -0
- package/dist/threadline/SessionLifecycle.d.ts +136 -0
- package/dist/threadline/SessionLifecycle.d.ts.map +1 -0
- package/dist/threadline/SessionLifecycle.js +317 -0
- package/dist/threadline/SessionLifecycle.js.map +1 -0
- package/dist/threadline/ThreadResumeMap.d.ts +128 -0
- package/dist/threadline/ThreadResumeMap.d.ts.map +1 -0
- package/dist/threadline/ThreadResumeMap.js +324 -0
- package/dist/threadline/ThreadResumeMap.js.map +1 -0
- package/dist/threadline/ThreadlineBootstrap.d.ts +68 -0
- package/dist/threadline/ThreadlineBootstrap.d.ts.map +1 -0
- package/dist/threadline/ThreadlineBootstrap.js +293 -0
- package/dist/threadline/ThreadlineBootstrap.js.map +1 -0
- package/dist/threadline/ThreadlineCrypto.d.ts +53 -0
- package/dist/threadline/ThreadlineCrypto.d.ts.map +1 -0
- package/dist/threadline/ThreadlineCrypto.js +123 -0
- package/dist/threadline/ThreadlineCrypto.js.map +1 -0
- package/dist/threadline/ThreadlineEndpoints.d.ts +35 -0
- package/dist/threadline/ThreadlineEndpoints.d.ts.map +1 -0
- package/dist/threadline/ThreadlineEndpoints.js +313 -0
- package/dist/threadline/ThreadlineEndpoints.js.map +1 -0
- package/dist/threadline/ThreadlineMCPServer.d.ts +165 -0
- package/dist/threadline/ThreadlineMCPServer.d.ts.map +1 -0
- package/dist/threadline/ThreadlineMCPServer.js +885 -0
- package/dist/threadline/ThreadlineMCPServer.js.map +1 -0
- package/dist/threadline/ThreadlineRouter.d.ts +105 -0
- package/dist/threadline/ThreadlineRouter.d.ts.map +1 -0
- package/dist/threadline/ThreadlineRouter.js +323 -0
- package/dist/threadline/ThreadlineRouter.js.map +1 -0
- package/dist/threadline/TrustBootstrap.d.ts +92 -0
- package/dist/threadline/TrustBootstrap.d.ts.map +1 -0
- package/dist/threadline/TrustBootstrap.js +256 -0
- package/dist/threadline/TrustBootstrap.js.map +1 -0
- package/dist/threadline/adapters/AutoGenTool.d.ts +42 -0
- package/dist/threadline/adapters/AutoGenTool.d.ts.map +1 -0
- package/dist/threadline/adapters/AutoGenTool.js +145 -0
- package/dist/threadline/adapters/AutoGenTool.js.map +1 -0
- package/dist/threadline/adapters/CrewAITool.d.ts +31 -0
- package/dist/threadline/adapters/CrewAITool.d.ts.map +1 -0
- package/dist/threadline/adapters/CrewAITool.js +112 -0
- package/dist/threadline/adapters/CrewAITool.js.map +1 -0
- package/dist/threadline/adapters/LangGraphTool.d.ts +48 -0
- package/dist/threadline/adapters/LangGraphTool.d.ts.map +1 -0
- package/dist/threadline/adapters/LangGraphTool.js +153 -0
- package/dist/threadline/adapters/LangGraphTool.js.map +1 -0
- package/dist/threadline/adapters/RESTServer.d.ts +74 -0
- package/dist/threadline/adapters/RESTServer.d.ts.map +1 -0
- package/dist/threadline/adapters/RESTServer.js +291 -0
- package/dist/threadline/adapters/RESTServer.js.map +1 -0
- package/dist/threadline/adapters/index.d.ts +14 -0
- package/dist/threadline/adapters/index.d.ts.map +1 -0
- package/dist/threadline/adapters/index.js +10 -0
- package/dist/threadline/adapters/index.js.map +1 -0
- package/dist/threadline/client/IdentityManager.d.ts +40 -0
- package/dist/threadline/client/IdentityManager.d.ts.map +1 -0
- package/dist/threadline/client/IdentityManager.js +106 -0
- package/dist/threadline/client/IdentityManager.js.map +1 -0
- package/dist/threadline/client/MessageEncryptor.d.ts +63 -0
- package/dist/threadline/client/MessageEncryptor.d.ts.map +1 -0
- package/dist/threadline/client/MessageEncryptor.js +195 -0
- package/dist/threadline/client/MessageEncryptor.js.map +1 -0
- package/dist/threadline/client/RegistryRestClient.d.ts +46 -0
- package/dist/threadline/client/RegistryRestClient.d.ts.map +1 -0
- package/dist/threadline/client/RegistryRestClient.js +114 -0
- package/dist/threadline/client/RegistryRestClient.js.map +1 -0
- package/dist/threadline/client/RelayClient.d.ts +77 -0
- package/dist/threadline/client/RelayClient.d.ts.map +1 -0
- package/dist/threadline/client/RelayClient.js +249 -0
- package/dist/threadline/client/RelayClient.js.map +1 -0
- package/dist/threadline/client/ThreadlineClient.d.ts +117 -0
- package/dist/threadline/client/ThreadlineClient.d.ts.map +1 -0
- package/dist/threadline/client/ThreadlineClient.js +286 -0
- package/dist/threadline/client/ThreadlineClient.js.map +1 -0
- package/dist/threadline/client/index.d.ts +14 -0
- package/dist/threadline/client/index.d.ts.map +1 -0
- package/dist/threadline/client/index.js +9 -0
- package/dist/threadline/client/index.js.map +1 -0
- package/dist/threadline/index.d.ts +81 -0
- package/dist/threadline/index.d.ts.map +1 -0
- package/dist/threadline/index.js +57 -0
- package/dist/threadline/index.js.map +1 -0
- package/dist/threadline/mcp-stdio-entry.d.ts +24 -0
- package/dist/threadline/mcp-stdio-entry.d.ts.map +1 -0
- package/dist/threadline/mcp-stdio-entry.js +230 -0
- package/dist/threadline/mcp-stdio-entry.js.map +1 -0
- package/dist/threadline/relay/A2ABridge.d.ts +91 -0
- package/dist/threadline/relay/A2ABridge.d.ts.map +1 -0
- package/dist/threadline/relay/A2ABridge.js +457 -0
- package/dist/threadline/relay/A2ABridge.js.map +1 -0
- package/dist/threadline/relay/AbuseDetector.d.ts +131 -0
- package/dist/threadline/relay/AbuseDetector.d.ts.map +1 -0
- package/dist/threadline/relay/AbuseDetector.js +358 -0
- package/dist/threadline/relay/AbuseDetector.js.map +1 -0
- package/dist/threadline/relay/AdminServer.d.ts +55 -0
- package/dist/threadline/relay/AdminServer.d.ts.map +1 -0
- package/dist/threadline/relay/AdminServer.js +215 -0
- package/dist/threadline/relay/AdminServer.js.map +1 -0
- package/dist/threadline/relay/ConnectionManager.d.ts +86 -0
- package/dist/threadline/relay/ConnectionManager.d.ts.map +1 -0
- package/dist/threadline/relay/ConnectionManager.js +356 -0
- package/dist/threadline/relay/ConnectionManager.js.map +1 -0
- package/dist/threadline/relay/MessageRouter.d.ts +46 -0
- package/dist/threadline/relay/MessageRouter.d.ts.map +1 -0
- package/dist/threadline/relay/MessageRouter.js +138 -0
- package/dist/threadline/relay/MessageRouter.js.map +1 -0
- package/dist/threadline/relay/OfflineQueue.d.ts +87 -0
- package/dist/threadline/relay/OfflineQueue.d.ts.map +1 -0
- package/dist/threadline/relay/OfflineQueue.js +137 -0
- package/dist/threadline/relay/OfflineQueue.js.map +1 -0
- package/dist/threadline/relay/PresenceRegistry.d.ts +62 -0
- package/dist/threadline/relay/PresenceRegistry.d.ts.map +1 -0
- package/dist/threadline/relay/PresenceRegistry.js +148 -0
- package/dist/threadline/relay/PresenceRegistry.js.map +1 -0
- package/dist/threadline/relay/RegistryAuth.d.ts +45 -0
- package/dist/threadline/relay/RegistryAuth.d.ts.map +1 -0
- package/dist/threadline/relay/RegistryAuth.js +118 -0
- package/dist/threadline/relay/RegistryAuth.js.map +1 -0
- package/dist/threadline/relay/RegistryStore.d.ts +149 -0
- package/dist/threadline/relay/RegistryStore.d.ts.map +1 -0
- package/dist/threadline/relay/RegistryStore.js +542 -0
- package/dist/threadline/relay/RegistryStore.js.map +1 -0
- package/dist/threadline/relay/RelayMetrics.d.ts +62 -0
- package/dist/threadline/relay/RelayMetrics.d.ts.map +1 -0
- package/dist/threadline/relay/RelayMetrics.js +149 -0
- package/dist/threadline/relay/RelayMetrics.js.map +1 -0
- package/dist/threadline/relay/RelayRateLimiter.d.ts +58 -0
- package/dist/threadline/relay/RelayRateLimiter.d.ts.map +1 -0
- package/dist/threadline/relay/RelayRateLimiter.js +116 -0
- package/dist/threadline/relay/RelayRateLimiter.js.map +1 -0
- package/dist/threadline/relay/RelayServer.d.ts +94 -0
- package/dist/threadline/relay/RelayServer.d.ts.map +1 -0
- package/dist/threadline/relay/RelayServer.js +1049 -0
- package/dist/threadline/relay/RelayServer.js.map +1 -0
- package/dist/threadline/relay/index.d.ts +28 -0
- package/dist/threadline/relay/index.d.ts.map +1 -0
- package/dist/threadline/relay/index.js +17 -0
- package/dist/threadline/relay/index.js.map +1 -0
- package/dist/threadline/relay/types.d.ts +215 -0
- package/dist/threadline/relay/types.d.ts.map +1 -0
- package/dist/threadline/relay/types.js +21 -0
- package/dist/threadline/relay/types.js.map +1 -0
- package/dist/threadline/types.d.ts +39 -0
- package/dist/threadline/types.d.ts.map +1 -0
- package/dist/threadline/types.js +10 -0
- package/dist/threadline/types.js.map +1 -0
- package/dist/tunnel/TunnelManager.d.ts +113 -0
- package/dist/tunnel/TunnelManager.d.ts.map +1 -0
- package/dist/tunnel/TunnelManager.js +474 -0
- package/dist/tunnel/TunnelManager.js.map +1 -0
- package/dist/types/pipeline.d.ts +203 -0
- package/dist/types/pipeline.d.ts.map +1 -0
- package/dist/types/pipeline.js +152 -0
- package/dist/types/pipeline.js.map +1 -0
- package/dist/users/GdprCommands.d.ts +44 -0
- package/dist/users/GdprCommands.d.ts.map +1 -0
- package/dist/users/GdprCommands.js +153 -0
- package/dist/users/GdprCommands.js.map +1 -0
- package/dist/users/OnboardingGate.d.ts +107 -0
- package/dist/users/OnboardingGate.d.ts.map +1 -0
- package/dist/users/OnboardingGate.js +240 -0
- package/dist/users/OnboardingGate.js.map +1 -0
- package/dist/users/UserContextBuilder.d.ts +47 -0
- package/dist/users/UserContextBuilder.d.ts.map +1 -0
- package/dist/users/UserContextBuilder.js +174 -0
- package/dist/users/UserContextBuilder.js.map +1 -0
- package/dist/users/UserManager.d.ts +76 -0
- package/dist/users/UserManager.d.ts.map +1 -0
- package/dist/users/UserManager.js +213 -0
- package/dist/users/UserManager.js.map +1 -0
- package/dist/users/UserOnboarding.d.ts +145 -0
- package/dist/users/UserOnboarding.d.ts.map +1 -0
- package/dist/users/UserOnboarding.js +488 -0
- package/dist/users/UserOnboarding.js.map +1 -0
- package/dist/users/UserPropagator.d.ts +75 -0
- package/dist/users/UserPropagator.d.ts.map +1 -0
- package/dist/users/UserPropagator.js +145 -0
- package/dist/users/UserPropagator.js.map +1 -0
- package/dist/utils/jsonl-rotation.d.ts +27 -0
- package/dist/utils/jsonl-rotation.d.ts.map +1 -0
- package/dist/utils/jsonl-rotation.js +63 -0
- package/dist/utils/jsonl-rotation.js.map +1 -0
- package/dist/utils/privacy.d.ts +88 -0
- package/dist/utils/privacy.d.ts.map +1 -0
- package/dist/utils/privacy.js +182 -0
- package/dist/utils/privacy.js.map +1 -0
- package/dist/utils/sanitize.d.ts +81 -0
- package/dist/utils/sanitize.d.ts.map +1 -0
- package/dist/utils/sanitize.js +122 -0
- package/dist/utils/sanitize.js.map +1 -0
- package/package.json +1 -0
- package/playbook-scripts/atomic_write.py +133 -0
- package/playbook-scripts/bootstrap-manifest.json +92 -0
- package/playbook-scripts/playbook-annotate-context.py +239 -0
- package/playbook-scripts/playbook-assemble.py +385 -0
- package/playbook-scripts/playbook-dashboard.py +242 -0
- package/playbook-scripts/playbook-decay.py +377 -0
- package/playbook-scripts/playbook-dedup-job.py +252 -0
- package/playbook-scripts/playbook-dedup.py +341 -0
- package/playbook-scripts/playbook-delta-validator.py +576 -0
- package/playbook-scripts/playbook-dsar.py +291 -0
- package/playbook-scripts/playbook-eval-log.py +425 -0
- package/playbook-scripts/playbook-failsafe.py +513 -0
- package/playbook-scripts/playbook-feedback-quarantine.py +335 -0
- package/playbook-scripts/playbook-history.py +293 -0
- package/playbook-scripts/playbook-hmac.py +224 -0
- package/playbook-scripts/playbook-lifecycle.py +952 -0
- package/playbook-scripts/playbook-manifest.py +458 -0
- package/playbook-scripts/playbook-micro-eval.py +316 -0
- package/playbook-scripts/playbook-migrate-lessons.py +396 -0
- package/playbook-scripts/playbook-mount.py +393 -0
- package/playbook-scripts/playbook-offline-adapt.py +323 -0
- package/playbook-scripts/playbook-pii-screen.py +207 -0
- package/playbook-scripts/playbook-reflector.py +266 -0
- package/playbook-scripts/playbook-relevance.py +269 -0
- package/playbook-scripts/playbook-retirement.py +365 -0
- package/playbook-scripts/playbook-schema-validate.py +267 -0
- package/playbook-scripts/playbook-scratchpad.py +346 -0
- package/playbook-scripts/playbook-semantic-verify.py +280 -0
- package/playbook-scripts/playbook-spawn-contract.py +341 -0
- package/playbook-scripts/playbook-token-reestimate.py +248 -0
- package/playbook-scripts/playbook-verify.py +357 -0
- package/playbook-scripts/playbook_backend.py +249 -0
- package/playbook-scripts/playbook_paths.py +232 -0
- package/playbook-scripts/schemas/context-delta.schema.json +137 -0
- package/playbook-scripts/schemas/context-manifest.schema.json +200 -0
- package/playbook-scripts/schemas/playbook-config.schema.json +184 -0
- package/scripts/analyze-release.js +752 -0
- package/scripts/check-upgrade-guide.js +373 -0
- package/scripts/collect-metrics.py +248 -0
- package/scripts/demo-two-agents.mjs +187 -0
- package/scripts/fix-better-sqlite3.cjs +100 -0
- package/scripts/generate-builtin-manifest.cjs +440 -0
- package/scripts/pre-push-gate.js +177 -0
- package/scripts/relay-entrypoint.mjs +18 -0
- package/scripts/seed-registry.mjs +258 -0
- package/scripts/telemetry-worker/worker.js +776 -0
- package/scripts/telemetry-worker/wrangler.toml +7 -0
- package/scripts/test-bootstrap-relay.mjs +90 -0
- package/scripts/test-multi-agent-relay.mjs +395 -0
- package/scripts/test-relay-cloud.mjs +389 -0
- package/scripts/test-relay-live.mjs +550 -0
- package/src/data/builtin-manifest.json +1463 -0
- package/src/data/http-hook-templates.ts +81 -0
- package/src/templates/hooks/compaction-recovery.sh +371 -0
- package/src/templates/hooks/dangerous-command-guard.sh +100 -0
- package/src/templates/hooks/free-text-guard.sh +96 -0
- package/src/templates/hooks/grounding-before-messaging.sh +52 -0
- package/src/templates/hooks/session-start.sh +339 -0
- package/src/templates/hooks/settings-template.json +142 -0
- package/src/templates/hooks/slack-channel-context.sh +98 -0
- package/src/templates/hooks/telegram-topic-context.sh +117 -0
- package/src/templates/scripts/convergence-check.sh +99 -0
- package/src/templates/scripts/git-sync-gate.sh +89 -0
- package/src/templates/scripts/health-watchdog.sh +63 -0
- package/src/templates/scripts/serendipity-capture.sh +345 -0
- package/src/templates/scripts/slack-reply.sh +74 -0
- package/src/templates/scripts/smart-fetch.py +215 -0
- package/src/templates/scripts/telegram-reply.sh +67 -0
- package/src/templates/scripts/whatsapp-reply.sh +68 -0
- package/upgrades/0.10.0.md +254 -0
- package/upgrades/0.10.1.md +47 -0
- package/upgrades/0.10.2.md +26 -0
- package/upgrades/0.10.3.md +23 -0
- package/upgrades/0.10.4.md +26 -0
- package/upgrades/0.10.5.md +19 -0
- package/upgrades/0.10.6.md +35 -0
- package/upgrades/0.10.7.md +48 -0
- package/upgrades/0.10.8.md +53 -0
- package/upgrades/0.10.9.md +21 -0
- package/upgrades/0.11.0.md +146 -0
- package/upgrades/0.12.0.md +31 -0
- package/upgrades/0.12.1.md +21 -0
- package/upgrades/0.12.10.md +26 -0
- package/upgrades/0.12.11.md +23 -0
- package/upgrades/0.12.12.md +23 -0
- package/upgrades/0.12.13.md +19 -0
- package/upgrades/0.12.14.md +21 -0
- package/upgrades/0.12.15.md +26 -0
- package/upgrades/0.12.16.md +33 -0
- package/upgrades/0.12.17.md +38 -0
- package/upgrades/0.12.18.md +27 -0
- package/upgrades/0.12.19.md +31 -0
- package/upgrades/0.12.2.md +27 -0
- package/upgrades/0.12.20.md +24 -0
- package/upgrades/0.12.21.md +28 -0
- package/upgrades/0.12.22.md +23 -0
- package/upgrades/0.12.23.md +44 -0
- package/upgrades/0.12.24.md +24 -0
- package/upgrades/0.12.25.md +55 -0
- package/upgrades/0.12.26.md +31 -0
- package/upgrades/0.12.27.md +19 -0
- package/upgrades/0.12.28.md +19 -0
- package/upgrades/0.12.29.md +42 -0
- package/upgrades/0.12.3.md +22 -0
- package/upgrades/0.12.31.md +24 -0
- package/upgrades/0.12.32.md +34 -0
- package/upgrades/0.12.33.md +62 -0
- package/upgrades/0.12.34.md +59 -0
- package/upgrades/0.12.4.md +19 -0
- package/upgrades/0.12.5.md +31 -0
- package/upgrades/0.12.6.md +34 -0
- package/upgrades/0.12.7.md +24 -0
- package/upgrades/0.12.8.md +28 -0
- package/upgrades/0.12.9.md +30 -0
- package/upgrades/0.13.0.md +26 -0
- package/upgrades/0.14.0.md +75 -0
- package/upgrades/0.14.1.md +41 -0
- package/upgrades/0.15.0.md +59 -0
- package/upgrades/0.16.0.md +61 -0
- package/upgrades/0.17.0.md +88 -0
- package/upgrades/0.17.10.md +23 -0
- package/upgrades/0.17.11.md +25 -0
- package/upgrades/0.17.12.md +43 -0
- package/upgrades/0.17.13.md +24 -0
- package/upgrades/0.17.14.md +26 -0
- package/upgrades/0.17.2.md +42 -0
- package/upgrades/0.17.3.md +37 -0
- package/upgrades/0.17.4.md +27 -0
- package/upgrades/0.17.5.md +32 -0
- package/upgrades/0.17.6.md +32 -0
- package/upgrades/0.17.7.md +39 -0
- package/upgrades/0.17.8.md +34 -0
- package/upgrades/0.17.9.md +25 -0
- package/upgrades/0.18.1.md +34 -0
- package/upgrades/0.18.2.md +29 -0
- package/upgrades/0.18.3.md +26 -0
- package/upgrades/0.18.4.md +28 -0
- package/upgrades/0.18.5.md +25 -0
- package/upgrades/0.18.6.md +25 -0
- package/upgrades/0.18.7.md +30 -0
- package/upgrades/0.19.0.md +136 -0
- package/upgrades/0.19.1.md +27 -0
- package/upgrades/0.19.2.md +27 -0
- package/upgrades/0.19.3.md +32 -0
- package/upgrades/0.19.4.md +19 -0
- package/upgrades/0.19.6.md +17 -0
- package/upgrades/0.19.7.md +33 -0
- package/upgrades/0.20.0.md +54 -0
- package/upgrades/0.21.1.md +55 -0
- package/upgrades/0.21.2.md +48 -0
- package/upgrades/0.21.3.md +29 -0
- package/upgrades/0.21.4.md +33 -0
- package/upgrades/0.22.0.md +114 -0
- package/upgrades/0.23.0.md +81 -0
- package/upgrades/0.23.1.md +28 -0
- package/upgrades/0.23.10.md +19 -0
- package/upgrades/0.23.11.md +21 -0
- package/upgrades/0.23.12.md +30 -0
- package/upgrades/0.23.13.md +25 -0
- package/upgrades/0.23.14.md +23 -0
- package/upgrades/0.23.15.md +30 -0
- package/upgrades/0.23.16.md +21 -0
- package/upgrades/0.23.17.md +23 -0
- package/upgrades/0.23.18.md +41 -0
- package/upgrades/0.23.2.md +32 -0
- package/upgrades/0.23.4.md +21 -0
- package/upgrades/0.23.6.md +19 -0
- package/upgrades/0.23.7.md +33 -0
- package/upgrades/0.23.8.md +38 -0
- package/upgrades/0.23.9.md +35 -0
- package/upgrades/0.24.1.md +32 -0
- package/upgrades/0.24.10.md +23 -0
- package/upgrades/0.24.12.md +17 -0
- package/upgrades/0.24.13.md +16 -0
- package/upgrades/0.24.14.md +26 -0
- package/upgrades/0.24.15.md +49 -0
- package/upgrades/0.24.16.md +48 -0
- package/upgrades/0.24.17.md +40 -0
- package/upgrades/0.24.18-beta.0.md +35 -0
- package/upgrades/0.24.18.md +35 -0
- package/upgrades/0.24.19.md +21 -0
- package/upgrades/0.24.2.md +13 -0
- package/upgrades/0.24.20.md +45 -0
- package/upgrades/0.24.21.md +25 -0
- package/upgrades/0.24.22.md +35 -0
- package/upgrades/0.24.23.md +17 -0
- package/upgrades/0.24.24.md +15 -0
- package/upgrades/0.24.25.md +15 -0
- package/upgrades/0.24.26.md +15 -0
- package/upgrades/0.24.27.md +17 -0
- package/upgrades/0.24.28.md +35 -0
- package/upgrades/0.24.29.md +15 -0
- package/upgrades/0.24.30.md +40 -0
- package/upgrades/0.24.31.md +45 -0
- package/upgrades/0.24.32.md +19 -0
- package/upgrades/0.24.33.md +35 -0
- package/upgrades/0.24.34.md +29 -0
- package/upgrades/0.24.4.md +19 -0
- package/upgrades/0.24.5.md +20 -0
- package/upgrades/0.25.0.md +34 -0
- package/upgrades/0.25.1.md +24 -0
- package/upgrades/0.25.10.md +26 -0
- package/upgrades/0.25.2.md +23 -0
- package/upgrades/0.25.3.md +25 -0
- package/upgrades/0.25.4.md +24 -0
- package/upgrades/0.25.5.md +19 -0
- package/upgrades/0.25.6.md +35 -0
- package/upgrades/0.25.7.md +18 -0
- package/upgrades/0.25.8.md +24 -0
- package/upgrades/0.25.9.md +19 -0
- package/upgrades/0.26.0.md +23 -0
- package/upgrades/0.26.1.md +22 -0
- package/upgrades/0.26.2.md +15 -0
- package/upgrades/0.8.12.md +49 -0
- package/upgrades/0.8.13.md +38 -0
- package/upgrades/0.8.17.md +36 -0
- package/upgrades/0.8.22.md +43 -0
- package/upgrades/0.8.23.md +106 -0
- package/upgrades/0.9.1.md +91 -0
- package/upgrades/0.9.10.md +40 -0
- package/upgrades/0.9.11.md +77 -0
- package/upgrades/0.9.12.md +42 -0
- package/upgrades/0.9.13.md +55 -0
- package/upgrades/0.9.14.md +23 -0
- package/upgrades/0.9.15.md +106 -0
- package/upgrades/0.9.16.md +37 -0
- package/upgrades/0.9.17.md +15 -0
- package/upgrades/0.9.19.md +17 -0
- package/upgrades/0.9.20.md +24 -0
- package/upgrades/0.9.21.md +37 -0
- package/upgrades/0.9.22.md +41 -0
- package/upgrades/0.9.23.md +37 -0
- package/upgrades/0.9.24.md +46 -0
- package/upgrades/0.9.25.md +37 -0
- package/upgrades/0.9.28.md +20 -0
- package/upgrades/0.9.29.md +34 -0
- package/upgrades/0.9.32.md +30 -0
- package/upgrades/0.9.36.md +27 -0
- package/upgrades/0.9.8.md +125 -0
- package/upgrades/0.9.9.md +34 -0
- package/upgrades/NEXT.md +35 -0
|
@@ -0,0 +1,1402 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Manager — spawn and monitor Claude Code sessions via tmux.
|
|
3
|
+
*
|
|
4
|
+
* This is the core capability that transforms Claude Code from a CLI tool
|
|
5
|
+
* into a persistent agent. Sessions run in tmux, survive terminal disconnects,
|
|
6
|
+
* and can be monitored/reaped by the server.
|
|
7
|
+
*/
|
|
8
|
+
import { execFileSync, execFile } from 'node:child_process';
|
|
9
|
+
import { promisify } from 'node:util';
|
|
10
|
+
import { EventEmitter } from 'node:events';
|
|
11
|
+
import { randomUUID } from 'node:crypto';
|
|
12
|
+
import fs from 'node:fs';
|
|
13
|
+
import os from 'node:os';
|
|
14
|
+
import path from 'node:path';
|
|
15
|
+
import { DegradationReporter } from '../monitoring/DegradationReporter.js';
|
|
16
|
+
const execFileAsync = promisify(execFile);
|
|
17
|
+
import { buildInjectionTag } from '../types/pipeline.js';
|
|
18
|
+
import { sanitizeSenderName, sanitizeTopicName } from '../utils/sanitize.js';
|
|
19
|
+
/** Absolute maximum session duration (4 hours) — safety net for sessions without explicit timeout */
|
|
20
|
+
const DEFAULT_MAX_DURATION_MINUTES = 240;
|
|
21
|
+
/** Minutes of idle-at-prompt before a non-protected session is killed */
|
|
22
|
+
const IDLE_PROMPT_KILL_MINUTES = 15;
|
|
23
|
+
/** Patterns that indicate Claude is sitting at its idle prompt (not actively working) */
|
|
24
|
+
const IDLE_PROMPT_PATTERNS = [
|
|
25
|
+
'bypass permissions on',
|
|
26
|
+
'shift+tab to cycle',
|
|
27
|
+
'auto-accept edits',
|
|
28
|
+
// The bare prompt character at end of output (after stripping ANSI)
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* Patterns in terminal output that indicate an API or tool error caused the session to stop.
|
|
32
|
+
* When detected at the idle prompt, we nudge the session to continue instead of killing it.
|
|
33
|
+
*/
|
|
34
|
+
const TERMINAL_ERROR_PATTERNS = [
|
|
35
|
+
'API Error:',
|
|
36
|
+
'invalid_request_error',
|
|
37
|
+
'Could not process',
|
|
38
|
+
'overloaded_error',
|
|
39
|
+
'rate_limit_error',
|
|
40
|
+
'Request timed out',
|
|
41
|
+
'Internal server error',
|
|
42
|
+
'ServiceUnavailable',
|
|
43
|
+
'ECONNREFUSED',
|
|
44
|
+
'ETIMEDOUT',
|
|
45
|
+
'fetch failed',
|
|
46
|
+
];
|
|
47
|
+
/**
|
|
48
|
+
* Process names that are always running in a Claude Code session (MCP servers, etc.)
|
|
49
|
+
* These do NOT indicate activity — they're background infrastructure.
|
|
50
|
+
*/
|
|
51
|
+
const BASELINE_PROCESS_PATTERNS = [
|
|
52
|
+
/\bplaywright-mcp\b/,
|
|
53
|
+
/\bplaywright\/mcp\b/,
|
|
54
|
+
/\bmcp-stdio-entry\b/,
|
|
55
|
+
/\bmcp.*server\b/i,
|
|
56
|
+
/\bcaffeinate\b/,
|
|
57
|
+
/\bnpm exec\b.*mcp/,
|
|
58
|
+
];
|
|
59
|
+
/** Sanitize a string for use as part of a tmux session name. */
|
|
60
|
+
function sanitizeSessionName(name) {
|
|
61
|
+
const sanitized = name.replace(/[^a-zA-Z0-9_-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '').slice(0, 60);
|
|
62
|
+
return sanitized || 'session';
|
|
63
|
+
}
|
|
64
|
+
export class SessionManager extends EventEmitter {
|
|
65
|
+
config;
|
|
66
|
+
state;
|
|
67
|
+
monitorInterval = null;
|
|
68
|
+
monitoringInProgress = false;
|
|
69
|
+
inputGuard = null;
|
|
70
|
+
registryPath = null;
|
|
71
|
+
/** Track when each session was first seen idle at the Claude prompt. Key = session ID */
|
|
72
|
+
idlePromptSince = new Map();
|
|
73
|
+
/** Throttle stale session cleanup to every 5 minutes */
|
|
74
|
+
lastCleanupAt = 0;
|
|
75
|
+
/** Optional callback to check if a session has active subagents (prevents false zombie kills) */
|
|
76
|
+
subagentChecker;
|
|
77
|
+
/** Prompt Gate InputDetector — monitors terminal output for interactive prompts */
|
|
78
|
+
promptDetector;
|
|
79
|
+
/** Sessions with active relay leases (prompt relayed, waiting for response) — extends idle timeout */
|
|
80
|
+
relayLeases = new Map(); // session ID → lease expiry timestamp
|
|
81
|
+
/** Track pending Telegram injections awaiting agent response.
|
|
82
|
+
* Key = tmuxSession name. Cleared when agent replies via /telegram/reply/:topicId. */
|
|
83
|
+
pendingInjections = new Map();
|
|
84
|
+
/** Track sessions that have been nudged after an API error.
|
|
85
|
+
* Key = session ID. Prevents infinite nudge loops — each session gets ONE nudge.
|
|
86
|
+
* If it goes idle again after the nudge, the zombie detector kills it normally. */
|
|
87
|
+
errorNudgedSessions = new Set();
|
|
88
|
+
/** Sessions where we've already retried Enter for stuck pasted text.
|
|
89
|
+
* Key = session ID. Prevents infinite retry loops — one retry per session. */
|
|
90
|
+
pasteRetried = new Set();
|
|
91
|
+
/** Cached count of running sessions, updated asynchronously by the monitor tick.
|
|
92
|
+
* Used by the health endpoint to avoid synchronous tmux polling. */
|
|
93
|
+
_cachedRunningCount = 0;
|
|
94
|
+
_cachedRunningSessions = [];
|
|
95
|
+
constructor(config, state) {
|
|
96
|
+
super();
|
|
97
|
+
this.config = config;
|
|
98
|
+
this.state = state;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Set the InputGuard for cross-topic injection defense.
|
|
102
|
+
* Must be called after construction with state dir info.
|
|
103
|
+
*/
|
|
104
|
+
setInputGuard(guard, registryPath) {
|
|
105
|
+
this.inputGuard = guard;
|
|
106
|
+
this.registryPath = registryPath;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Set the subagent checker callback for zombie cleanup awareness.
|
|
110
|
+
* When set, the zombie cleanup will skip sessions that have active subagents.
|
|
111
|
+
* Must be called after SubagentTracker is constructed.
|
|
112
|
+
*/
|
|
113
|
+
setSubagentChecker(checker) {
|
|
114
|
+
this.subagentChecker = checker;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Set the Prompt Gate InputDetector for prompt monitoring.
|
|
118
|
+
* When set, monitorTick() will capture output and feed it to the detector.
|
|
119
|
+
*/
|
|
120
|
+
setPromptDetector(detector) {
|
|
121
|
+
this.promptDetector = detector;
|
|
122
|
+
// Clean up detector state when sessions end
|
|
123
|
+
this.on('sessionComplete', (session) => {
|
|
124
|
+
detector.cleanup(session.tmuxSession);
|
|
125
|
+
this.relayLeases.delete(session.id);
|
|
126
|
+
this.errorNudgedSessions.delete(session.id);
|
|
127
|
+
this.pasteRetried.delete(session.id);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Grant a relay lease to a session — extends idle timeout while waiting for
|
|
132
|
+
* a Telegram relay response. Prevents the zombie killer from killing sessions
|
|
133
|
+
* that are legitimately waiting for user input.
|
|
134
|
+
*/
|
|
135
|
+
grantRelayLease(sessionId, durationMs) {
|
|
136
|
+
this.relayLeases.set(sessionId, Date.now() + durationMs);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Clear a relay lease (prompt was answered or timed out).
|
|
140
|
+
*/
|
|
141
|
+
clearRelayLease(sessionId) {
|
|
142
|
+
this.relayLeases.delete(sessionId);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Associate a Claude Code session UUID with an instar session.
|
|
146
|
+
* Called when the first hook event arrives from a Claude Code session,
|
|
147
|
+
* allowing SubagentTracker lookups to bridge the two ID spaces.
|
|
148
|
+
*/
|
|
149
|
+
setClaudeSessionId(instarSessionId, claudeSessionId) {
|
|
150
|
+
const sessions = this.state.listSessions({ status: 'running' });
|
|
151
|
+
const session = sessions.find(s => s.id === instarSessionId);
|
|
152
|
+
if (session && !session.claudeSessionId) {
|
|
153
|
+
session.claudeSessionId = claudeSessionId;
|
|
154
|
+
this.state.saveSession(session);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Find a running session by its instar session ID.
|
|
159
|
+
*/
|
|
160
|
+
getSessionById(instarSessionId) {
|
|
161
|
+
return this.state.listSessions({ status: 'running' }).find(s => s.id === instarSessionId);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Look up the topic binding for a tmux session from the topic-session registry.
|
|
165
|
+
* Returns null if the session is not bound to any topic.
|
|
166
|
+
*/
|
|
167
|
+
getTopicBinding(tmuxSession) {
|
|
168
|
+
if (!this.registryPath)
|
|
169
|
+
return null;
|
|
170
|
+
try {
|
|
171
|
+
if (!fs.existsSync(this.registryPath))
|
|
172
|
+
return null;
|
|
173
|
+
const registry = JSON.parse(fs.readFileSync(this.registryPath, 'utf-8'));
|
|
174
|
+
const topicToSession = registry.topicToSession || {};
|
|
175
|
+
const topicToName = registry.topicToName || {};
|
|
176
|
+
// Reverse lookup: find which topic maps to this session
|
|
177
|
+
for (const [topicIdStr, sessionName] of Object.entries(topicToSession)) {
|
|
178
|
+
if (sessionName === tmuxSession) {
|
|
179
|
+
const topicId = parseInt(topicIdStr, 10);
|
|
180
|
+
return {
|
|
181
|
+
topicId,
|
|
182
|
+
topicName: topicToName[topicIdStr] || `Topic ${topicId}`,
|
|
183
|
+
channel: 'telegram', // Currently only Telegram uses the registry
|
|
184
|
+
sessionName: tmuxSession,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
// Registry read failure — fail open (no binding = no check)
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Start polling for completed sessions. Emits 'sessionComplete' when
|
|
197
|
+
* a running session's tmux process disappears.
|
|
198
|
+
*
|
|
199
|
+
* Uses async tmux calls to avoid blocking the event loop when
|
|
200
|
+
* many sessions are running.
|
|
201
|
+
*/
|
|
202
|
+
startMonitoring(intervalMs = 5000) {
|
|
203
|
+
if (this.monitorInterval)
|
|
204
|
+
return;
|
|
205
|
+
this.monitorInterval = setInterval(() => {
|
|
206
|
+
// Prevent overlapping monitor ticks
|
|
207
|
+
if (this.monitoringInProgress)
|
|
208
|
+
return;
|
|
209
|
+
this.monitorTick().catch(err => {
|
|
210
|
+
console.error(`[SessionManager] Monitor tick error: ${err}`);
|
|
211
|
+
});
|
|
212
|
+
}, intervalMs);
|
|
213
|
+
}
|
|
214
|
+
async monitorTick() {
|
|
215
|
+
this.monitoringInProgress = true;
|
|
216
|
+
try {
|
|
217
|
+
const running = this.state.listSessions({ status: 'running' });
|
|
218
|
+
for (const session of running) {
|
|
219
|
+
const alive = await this.isSessionAliveAsync(session.tmuxSession);
|
|
220
|
+
if (!alive) {
|
|
221
|
+
// Check if this session had a pending Telegram injection that never got a response
|
|
222
|
+
const pendingInjection = this.pendingInjections.get(session.tmuxSession);
|
|
223
|
+
if (pendingInjection) {
|
|
224
|
+
console.warn(`[SessionManager] Session "${session.name}" died with unanswered Telegram injection for topic ${pendingInjection.topicId} (injected ${Math.round((Date.now() - pendingInjection.injectedAt) / 1000)}s ago)`);
|
|
225
|
+
this.pendingInjections.delete(session.tmuxSession);
|
|
226
|
+
this.emit('injectionDropped', {
|
|
227
|
+
topicId: pendingInjection.topicId,
|
|
228
|
+
sessionName: session.tmuxSession,
|
|
229
|
+
text: pendingInjection.text,
|
|
230
|
+
injectedAt: pendingInjection.injectedAt,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
session.status = 'completed';
|
|
234
|
+
session.endedAt = new Date().toISOString();
|
|
235
|
+
this.state.saveSession(session);
|
|
236
|
+
this.emit('sessionComplete', session);
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
// Check for completion patterns even while session appears alive
|
|
240
|
+
// (catches sessions where Claude finished but tmux is still open)
|
|
241
|
+
if (!this.config.protectedSessions.includes(session.tmuxSession) &&
|
|
242
|
+
this.detectCompletion(session.tmuxSession)) {
|
|
243
|
+
console.log(`[SessionManager] Session "${session.name}" completed (pattern detected). Cleaning up.`);
|
|
244
|
+
// Emit beforeSessionKill so listeners (TopicResumeMap, SlackAdapter) can save resume UUIDs
|
|
245
|
+
this.emit('beforeSessionKill', session);
|
|
246
|
+
try {
|
|
247
|
+
await execFileAsync(this.config.tmuxPath, ['kill-session', '-t', `=${session.tmuxSession}`]);
|
|
248
|
+
}
|
|
249
|
+
catch { /* ignore */ }
|
|
250
|
+
session.status = 'completed';
|
|
251
|
+
session.endedAt = new Date().toISOString();
|
|
252
|
+
this.state.saveSession(session);
|
|
253
|
+
this.emit('sessionComplete', session);
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
// Enforce session timeout (prevents zombie/stuck sessions)
|
|
257
|
+
// Uses explicit maxDurationMinutes if set, otherwise falls back to
|
|
258
|
+
// DEFAULT_MAX_DURATION_MINUTES as an absolute safety net.
|
|
259
|
+
if (session.startedAt) {
|
|
260
|
+
const maxMinutes = session.maxDurationMinutes || DEFAULT_MAX_DURATION_MINUTES;
|
|
261
|
+
const elapsed = (Date.now() - new Date(session.startedAt).getTime()) / 60000;
|
|
262
|
+
const buffer = Math.min(maxMinutes * 0.2, 60); // 20% buffer, max 60 min
|
|
263
|
+
const limit = maxMinutes + buffer;
|
|
264
|
+
if (elapsed > limit && !this.config.protectedSessions.includes(session.tmuxSession)) {
|
|
265
|
+
// Check for unanswered injection before timeout kill
|
|
266
|
+
const pendingInjection = this.pendingInjections.get(session.tmuxSession);
|
|
267
|
+
if (pendingInjection) {
|
|
268
|
+
console.warn(`[SessionManager] Timed-out session "${session.name}" had unanswered injection for topic ${pendingInjection.topicId}`);
|
|
269
|
+
this.pendingInjections.delete(session.tmuxSession);
|
|
270
|
+
this.emit('injectionDropped', {
|
|
271
|
+
topicId: pendingInjection.topicId,
|
|
272
|
+
sessionName: session.tmuxSession,
|
|
273
|
+
text: pendingInjection.text,
|
|
274
|
+
injectedAt: pendingInjection.injectedAt,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
console.warn(`[SessionManager] Session "${session.name}" exceeded timeout (${Math.round(elapsed)}m > ${maxMinutes}m). Killing.`);
|
|
278
|
+
// Emit beforeSessionKill BEFORE destroying the tmux session so
|
|
279
|
+
// listeners (e.g. TopicResumeMap) can discover the Claude UUID.
|
|
280
|
+
this.emit('beforeSessionKill', session);
|
|
281
|
+
try {
|
|
282
|
+
await execFileAsync(this.config.tmuxPath, ['kill-session', '-t', `=${session.tmuxSession}`]);
|
|
283
|
+
}
|
|
284
|
+
catch {
|
|
285
|
+
// @silent-fallback-ok — tmux kill, session may be dead
|
|
286
|
+
}
|
|
287
|
+
session.status = 'killed';
|
|
288
|
+
session.endedAt = new Date().toISOString();
|
|
289
|
+
this.state.saveSession(session);
|
|
290
|
+
this.emit('sessionComplete', session);
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
// Idle detection — kill sessions that are truly stopped.
|
|
295
|
+
// A session is idle when: (1) the terminal shows idle prompt patterns,
|
|
296
|
+
// AND (2) no non-baseline child processes are running. This is the ground
|
|
297
|
+
// truth — no exemptions needed for subagents, topic bindings, or relay leases.
|
|
298
|
+
// If the process tree shows work, the session is active. Period.
|
|
299
|
+
if (!this.config.protectedSessions.includes(session.tmuxSession)) {
|
|
300
|
+
const output = this.captureOutput(session.tmuxSession, 5);
|
|
301
|
+
const isIdleAtPrompt = output && IDLE_PROMPT_PATTERNS.some(p => output.includes(p));
|
|
302
|
+
// ── Prompt Gate: feed captured output to InputDetector ──
|
|
303
|
+
if (this.promptDetector && output) {
|
|
304
|
+
const fullOutput = this.captureOutput(session.tmuxSession, 50);
|
|
305
|
+
if (fullOutput) {
|
|
306
|
+
this.promptDetector.onCapture(session.tmuxSession, fullOutput);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
// Two conditions must BOTH be true for idle: prompt pattern + no active processes
|
|
310
|
+
const isActuallyIdle = isIdleAtPrompt && !this.hasActiveProcesses(session.tmuxSession);
|
|
311
|
+
if (isActuallyIdle) {
|
|
312
|
+
const now = Date.now();
|
|
313
|
+
if (!this.idlePromptSince.has(session.id)) {
|
|
314
|
+
this.idlePromptSince.set(session.id, now);
|
|
315
|
+
// ── Pasted text stuck: detect unsubmitted paste and retry Enter ──
|
|
316
|
+
// Claude Code shows "[Pasted text #N]" when bracketed paste content
|
|
317
|
+
// sits in the input buffer without being submitted. This happens when
|
|
318
|
+
// the Enter key sent after the paste end sequence doesn't register.
|
|
319
|
+
// Re-send Enter to unstick it. Only try once per session to avoid loops.
|
|
320
|
+
if (!this.pasteRetried.has(session.id)) {
|
|
321
|
+
const recentForPaste = this.captureOutput(session.tmuxSession, 15);
|
|
322
|
+
if (recentForPaste && /\[Pasted text #\d+\]/.test(recentForPaste)) {
|
|
323
|
+
this.pasteRetried.add(session.id);
|
|
324
|
+
console.log(`[SessionManager] Session "${session.name}" has unsubmitted pasted text — resending Enter.`);
|
|
325
|
+
this.sendKey(session.tmuxSession, 'Enter');
|
|
326
|
+
this.idlePromptSince.delete(session.id); // Reset idle timer
|
|
327
|
+
continue; // Skip to next session
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// ── Error nudge: on first idle detection, check terminal for API errors ──
|
|
331
|
+
// If the session went idle because of an API error (not a natural stop),
|
|
332
|
+
// inject a nudge to get it working again instead of waiting 15m to kill.
|
|
333
|
+
if (!this.errorNudgedSessions.has(session.id)) {
|
|
334
|
+
const recentOutput = this.captureOutput(session.tmuxSession, 30);
|
|
335
|
+
if (recentOutput) {
|
|
336
|
+
const hasError = TERMINAL_ERROR_PATTERNS.some(p => recentOutput.includes(p));
|
|
337
|
+
if (hasError) {
|
|
338
|
+
this.errorNudgedSessions.add(session.id);
|
|
339
|
+
console.log(`[SessionManager] Session "${session.name}" idle after API error — nudging to continue.`);
|
|
340
|
+
this.sendInput(session.tmuxSession, 'You hit an API error. Please continue your work — skip or work around the action that failed.');
|
|
341
|
+
this.idlePromptSince.delete(session.id); // Reset idle timer
|
|
342
|
+
continue; // Skip to next session
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
const idleMs = now - this.idlePromptSince.get(session.id);
|
|
349
|
+
if (idleMs > IDLE_PROMPT_KILL_MINUTES * 60_000) {
|
|
350
|
+
// Check for unanswered injection before killing
|
|
351
|
+
const pendingInjection = this.pendingInjections.get(session.tmuxSession);
|
|
352
|
+
if (pendingInjection) {
|
|
353
|
+
console.warn(`[SessionManager] Zombie session "${session.name}" had unanswered injection for topic ${pendingInjection.topicId}`);
|
|
354
|
+
this.pendingInjections.delete(session.tmuxSession);
|
|
355
|
+
this.emit('injectionDropped', {
|
|
356
|
+
topicId: pendingInjection.topicId,
|
|
357
|
+
sessionName: session.tmuxSession,
|
|
358
|
+
text: pendingInjection.text,
|
|
359
|
+
injectedAt: pendingInjection.injectedAt,
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
console.warn(`[SessionManager] Session "${session.name}" idle at prompt for ${Math.round(idleMs / 60_000)}m with no active processes. Killing zombie.`);
|
|
363
|
+
this.emit('beforeSessionKill', session);
|
|
364
|
+
try {
|
|
365
|
+
await execFileAsync(this.config.tmuxPath, ['kill-session', '-t', `=${session.tmuxSession}`]);
|
|
366
|
+
}
|
|
367
|
+
catch { /* ignore */ }
|
|
368
|
+
session.status = 'completed';
|
|
369
|
+
session.endedAt = new Date().toISOString();
|
|
370
|
+
this.state.saveSession(session);
|
|
371
|
+
this.emit('sessionComplete', session);
|
|
372
|
+
this.idlePromptSince.delete(session.id);
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
// Session is active — clear idle tracker
|
|
379
|
+
this.idlePromptSince.delete(session.id);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
// Periodically clean up stale killed/completed session state files (every 5 min)
|
|
384
|
+
const CLEANUP_INTERVAL_MS = 5 * 60 * 1000;
|
|
385
|
+
if (Date.now() - this.lastCleanupAt > CLEANUP_INTERVAL_MS) {
|
|
386
|
+
this.lastCleanupAt = Date.now();
|
|
387
|
+
this.cleanupStaleSessions();
|
|
388
|
+
}
|
|
389
|
+
// Update cached session list (non-blocking) for health endpoint
|
|
390
|
+
const stillRunning = this.state.listSessions({ status: 'running' });
|
|
391
|
+
this._cachedRunningSessions = stillRunning;
|
|
392
|
+
this._cachedRunningCount = stillRunning.length;
|
|
393
|
+
}
|
|
394
|
+
finally {
|
|
395
|
+
this.monitoringInProgress = false;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Stop the monitoring poll.
|
|
400
|
+
*/
|
|
401
|
+
stopMonitoring() {
|
|
402
|
+
if (this.monitorInterval) {
|
|
403
|
+
clearInterval(this.monitorInterval);
|
|
404
|
+
this.monitorInterval = null;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Spawn a new Claude Code session in tmux.
|
|
409
|
+
*/
|
|
410
|
+
async spawnSession(options) {
|
|
411
|
+
const runningSessions = this.listRunningSessions();
|
|
412
|
+
if (runningSessions.length >= this.config.maxSessions) {
|
|
413
|
+
throw new Error(`Max sessions (${this.config.maxSessions}) reached. ` +
|
|
414
|
+
`Running: ${runningSessions.map(s => s.name).join(', ')}`);
|
|
415
|
+
}
|
|
416
|
+
const sessionId = this.generateId();
|
|
417
|
+
const safeName = sanitizeSessionName(options.name);
|
|
418
|
+
const tmuxSession = `${path.basename(this.config.projectDir)}-${safeName}`;
|
|
419
|
+
// Check if tmux session already exists
|
|
420
|
+
if (this.tmuxSessionExists(tmuxSession)) {
|
|
421
|
+
throw new Error(`tmux session "${tmuxSession}" already exists`);
|
|
422
|
+
}
|
|
423
|
+
// Build Claude CLI arguments — no shell intermediary.
|
|
424
|
+
// tmux new-session executes the command directly (no bash -c needed)
|
|
425
|
+
// when given as separate arguments after the session options.
|
|
426
|
+
// Use -e CLAUDECODE= to unset the CLAUDECODE env var in spawned sessions,
|
|
427
|
+
// preventing nested Claude Code detection when instar runs inside Claude Code.
|
|
428
|
+
const claudeArgs = ['--dangerously-skip-permissions'];
|
|
429
|
+
if (options.model) {
|
|
430
|
+
claudeArgs.push('--model', options.model);
|
|
431
|
+
}
|
|
432
|
+
claudeArgs.push('-p', options.prompt);
|
|
433
|
+
try {
|
|
434
|
+
execFileSync(this.config.tmuxPath, [
|
|
435
|
+
'new-session', '-d',
|
|
436
|
+
'-s', tmuxSession,
|
|
437
|
+
'-c', this.config.projectDir,
|
|
438
|
+
'-e', 'CLAUDECODE=', // Prevent nested Claude Code detection
|
|
439
|
+
'-e', `INSTAR_SESSION_ID=${sessionId}`, // Expose instar session ID to hook events
|
|
440
|
+
'-e', `INSTAR_SERVER_URL=http://localhost:${this.config.port}`,
|
|
441
|
+
'-e', `INSTAR_AUTH_TOKEN=${this.config.authToken}`,
|
|
442
|
+
'-e', 'ANTHROPIC_API_KEY=', // Clear stale/invalid API keys — agents use Claude subscription
|
|
443
|
+
// Isolate database credentials — spawned sessions must never inherit production
|
|
444
|
+
// database URLs from the parent shell. This prevents accidental schema changes
|
|
445
|
+
// or data operations against the wrong database. (Learned from Portal incident 2026-02-22)
|
|
446
|
+
'-e', 'DATABASE_URL=',
|
|
447
|
+
'-e', 'DIRECT_DATABASE_URL=',
|
|
448
|
+
'-e', 'DATABASE_URL_PROD=',
|
|
449
|
+
'-e', 'DATABASE_URL_DEV=',
|
|
450
|
+
'-e', 'DATABASE_URL_TEST=',
|
|
451
|
+
this.config.claudePath, ...claudeArgs,
|
|
452
|
+
], { encoding: 'utf-8' });
|
|
453
|
+
// Increase tmux scrollback buffer for dashboard history support
|
|
454
|
+
try {
|
|
455
|
+
execFileSync(this.config.tmuxPath, [
|
|
456
|
+
'set-option', '-t', `=${tmuxSession}:`, 'history-limit', '50000',
|
|
457
|
+
], { encoding: 'utf-8', timeout: 5000 });
|
|
458
|
+
}
|
|
459
|
+
catch {
|
|
460
|
+
// @silent-fallback-ok — history-limit is a nice-to-have
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
catch (err) {
|
|
464
|
+
throw new Error(`Failed to create tmux session: ${err}`);
|
|
465
|
+
}
|
|
466
|
+
const session = {
|
|
467
|
+
id: sessionId,
|
|
468
|
+
name: options.name,
|
|
469
|
+
status: 'running',
|
|
470
|
+
jobSlug: options.jobSlug,
|
|
471
|
+
tmuxSession,
|
|
472
|
+
startedAt: new Date().toISOString(),
|
|
473
|
+
triggeredBy: options.triggeredBy,
|
|
474
|
+
model: options.model,
|
|
475
|
+
prompt: options.prompt,
|
|
476
|
+
maxDurationMinutes: options.maxDurationMinutes,
|
|
477
|
+
};
|
|
478
|
+
this.state.saveSession(session);
|
|
479
|
+
return session;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Check if a session is still running by checking tmux AND verifying
|
|
483
|
+
* that the Claude process is running inside (not a zombie tmux pane).
|
|
484
|
+
*/
|
|
485
|
+
isSessionAlive(tmuxSession) {
|
|
486
|
+
if (!this.tmuxSessionExists(tmuxSession))
|
|
487
|
+
return false;
|
|
488
|
+
// Verify Claude process is running inside the tmux session
|
|
489
|
+
try {
|
|
490
|
+
const paneInfo = execFileSync(this.config.tmuxPath, ['display-message', '-t', `=${tmuxSession}:`, '-p', '#{pane_current_command}||#{pane_start_command}'], { encoding: 'utf-8', timeout: 5000 }).trim();
|
|
491
|
+
const [paneCmd, startCmd] = paneInfo.split('||');
|
|
492
|
+
// Claude Code runs as 'claude' or 'node' process
|
|
493
|
+
if (paneCmd && (paneCmd.includes('claude') || paneCmd.includes('node'))) {
|
|
494
|
+
return true;
|
|
495
|
+
}
|
|
496
|
+
// If pane command is bash/zsh/sh, check whether the session was launched
|
|
497
|
+
// with a direct command (e.g., a bash script as claudePath). In that case
|
|
498
|
+
// bash IS the expected running process — not a leftover shell after Claude exits.
|
|
499
|
+
// tmux kills sessions launched with direct commands when the command exits,
|
|
500
|
+
// so if has-session succeeds and start_command is non-empty, it's still running.
|
|
501
|
+
if (paneCmd === 'bash' || paneCmd === 'zsh' || paneCmd === 'sh') {
|
|
502
|
+
if (startCmd && startCmd !== paneCmd) {
|
|
503
|
+
// Session was launched with a specific command (not a bare shell) — still alive
|
|
504
|
+
return true;
|
|
505
|
+
}
|
|
506
|
+
return false;
|
|
507
|
+
}
|
|
508
|
+
// For any other command, assume alive (could be a Claude subprocess)
|
|
509
|
+
return true;
|
|
510
|
+
}
|
|
511
|
+
catch {
|
|
512
|
+
// @silent-fallback-ok — pane inspection, assumes alive
|
|
513
|
+
return true;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Check if a session is still running by checking tmux AND verifying
|
|
518
|
+
* that the Claude process is running inside (async version).
|
|
519
|
+
* Used by the monitoring loop to avoid blocking the event loop.
|
|
520
|
+
*
|
|
521
|
+
* Previously only checked `tmux has-session` which missed zombie sessions
|
|
522
|
+
* where tmux was alive but Claude had exited — causing stuck sessions
|
|
523
|
+
* that blocked the scheduler for hours.
|
|
524
|
+
*/
|
|
525
|
+
async isSessionAliveAsync(tmuxSession) {
|
|
526
|
+
try {
|
|
527
|
+
await execFileAsync(this.config.tmuxPath, ['has-session', '-t', `=${tmuxSession}`], {
|
|
528
|
+
timeout: 5000,
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
catch {
|
|
532
|
+
// @silent-fallback-ok — session existence check
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
535
|
+
// Verify Claude process is alive inside (matches sync isSessionAlive logic)
|
|
536
|
+
try {
|
|
537
|
+
const { stdout } = await execFileAsync(this.config.tmuxPath, ['display-message', '-t', `=${tmuxSession}:`, '-p', '#{pane_current_command}||#{pane_start_command}'], { timeout: 5000 });
|
|
538
|
+
const paneInfo = stdout.trim();
|
|
539
|
+
const [paneCmd, startCmd] = paneInfo.split('||');
|
|
540
|
+
if (paneCmd && (paneCmd.includes('claude') || paneCmd.includes('node'))) {
|
|
541
|
+
return true;
|
|
542
|
+
}
|
|
543
|
+
if (paneCmd === 'bash' || paneCmd === 'zsh' || paneCmd === 'sh') {
|
|
544
|
+
if (startCmd && startCmd !== paneCmd) {
|
|
545
|
+
return true;
|
|
546
|
+
}
|
|
547
|
+
return false;
|
|
548
|
+
}
|
|
549
|
+
return true;
|
|
550
|
+
}
|
|
551
|
+
catch {
|
|
552
|
+
return true;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Kill a session by terminating its tmux session.
|
|
557
|
+
*/
|
|
558
|
+
killSession(sessionId) {
|
|
559
|
+
const session = this.state.getSession(sessionId);
|
|
560
|
+
if (!session)
|
|
561
|
+
return false;
|
|
562
|
+
// Don't kill protected sessions
|
|
563
|
+
if (this.config.protectedSessions.includes(session.tmuxSession)) {
|
|
564
|
+
throw new Error(`Cannot kill protected session: ${session.tmuxSession}`);
|
|
565
|
+
}
|
|
566
|
+
// Emit beforeSessionKill BEFORE destroying the tmux session so
|
|
567
|
+
// listeners (e.g. TopicResumeMap) can discover the Claude UUID
|
|
568
|
+
// while the session is still alive.
|
|
569
|
+
this.emit('beforeSessionKill', session);
|
|
570
|
+
try {
|
|
571
|
+
execFileSync(this.config.tmuxPath, ['kill-session', '-t', `=${session.tmuxSession}`], {
|
|
572
|
+
encoding: 'utf-8',
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
catch {
|
|
576
|
+
// Session might already be dead
|
|
577
|
+
}
|
|
578
|
+
session.status = 'killed';
|
|
579
|
+
session.endedAt = new Date().toISOString();
|
|
580
|
+
this.state.saveSession(session);
|
|
581
|
+
return true;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Check if a tmux session has active (non-baseline) child processes.
|
|
585
|
+
* Returns true if the session is doing real work — running tools, bash commands,
|
|
586
|
+
* subagents, etc. Returns false if only baseline processes (MCP servers, caffeinate)
|
|
587
|
+
* are running, meaning the session is truly idle.
|
|
588
|
+
*
|
|
589
|
+
* This is the ground truth for whether a session is active — it doesn't care about
|
|
590
|
+
* terminal output patterns, topic bindings, or subagent trackers. If the process
|
|
591
|
+
* tree shows work happening, the session is active. Period.
|
|
592
|
+
*/
|
|
593
|
+
hasActiveProcesses(tmuxSession) {
|
|
594
|
+
try {
|
|
595
|
+
// Get the tmux pane's shell PID
|
|
596
|
+
const panePid = execFileSync(this.config.tmuxPath, ['list-panes', '-t', `=${tmuxSession}:`, '-F', '#{pane_pid}'], { encoding: 'utf-8', timeout: 5000 }).trim();
|
|
597
|
+
if (!panePid || !/^\d+$/.test(panePid))
|
|
598
|
+
return false;
|
|
599
|
+
// Get all descendant processes of the pane PID
|
|
600
|
+
// Use ps to find all processes whose parent is in our tree
|
|
601
|
+
const psOutput = execFileSync('ps', ['-eo', 'pid,ppid,command'], { encoding: 'utf-8', timeout: 5000 });
|
|
602
|
+
// Build a map of PID → { ppid, command }
|
|
603
|
+
const processes = new Map();
|
|
604
|
+
for (const line of psOutput.split('\n').slice(1)) { // skip header
|
|
605
|
+
const match = line.trim().match(/^(\d+)\s+(\d+)\s+(.*)$/);
|
|
606
|
+
if (match) {
|
|
607
|
+
processes.set(match[1], { ppid: match[2], command: match[3] });
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
// Walk the tree: find all descendants of panePid
|
|
611
|
+
const descendants = [];
|
|
612
|
+
const queue = [panePid];
|
|
613
|
+
while (queue.length > 0) {
|
|
614
|
+
const parentPid = queue.shift();
|
|
615
|
+
for (const [pid, info] of processes) {
|
|
616
|
+
if (info.ppid === parentPid && pid !== panePid) {
|
|
617
|
+
descendants.push({ pid, command: info.command });
|
|
618
|
+
queue.push(pid);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
// Filter out baseline processes
|
|
623
|
+
const activeProcesses = descendants.filter(p => {
|
|
624
|
+
return !BASELINE_PROCESS_PATTERNS.some(pattern => pattern.test(p.command));
|
|
625
|
+
});
|
|
626
|
+
// The Claude Code node process itself is always running — that's the main process.
|
|
627
|
+
// We care about processes BEYOND Claude itself and its baseline children.
|
|
628
|
+
// Claude's main process is the direct child of the pane PID.
|
|
629
|
+
// Filter it out: it's typically `node` or `claude` running the main Claude binary.
|
|
630
|
+
const nonClaude = activeProcesses.filter(p => {
|
|
631
|
+
const proc = processes.get(p.pid);
|
|
632
|
+
// Direct child of pane PID running claude/node is the main process
|
|
633
|
+
if (proc?.ppid === panePid) {
|
|
634
|
+
return !/\bclaude\b/.test(p.command) && !/\bnode\b.*\bclaude\b/.test(p.command);
|
|
635
|
+
}
|
|
636
|
+
return true;
|
|
637
|
+
});
|
|
638
|
+
return nonClaude.length > 0;
|
|
639
|
+
}
|
|
640
|
+
catch {
|
|
641
|
+
// If we can't check processes, assume active (fail-safe: don't kill)
|
|
642
|
+
return true;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Capture the current output of a tmux session.
|
|
647
|
+
*/
|
|
648
|
+
captureOutput(tmuxSession, lines = 100) {
|
|
649
|
+
try {
|
|
650
|
+
// Note: use `=session:` (trailing colon) for pane-level tmux commands
|
|
651
|
+
return execFileSync(this.config.tmuxPath, ['capture-pane', '-t', `=${tmuxSession}:`, '-p', '-S', `-${lines}`], { encoding: 'utf-8', timeout: 5000 });
|
|
652
|
+
}
|
|
653
|
+
catch {
|
|
654
|
+
// @silent-fallback-ok — capture output, null handled by caller
|
|
655
|
+
return null;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Send input to a running tmux session.
|
|
660
|
+
*/
|
|
661
|
+
sendInput(tmuxSession, input) {
|
|
662
|
+
try {
|
|
663
|
+
// Note: use `=session:` (trailing colon) for pane-level tmux commands
|
|
664
|
+
// Send text literally, then Enter separately
|
|
665
|
+
execFileSync(this.config.tmuxPath, ['send-keys', '-t', `=${tmuxSession}:`, '-l', input], { encoding: 'utf-8', timeout: 5000 });
|
|
666
|
+
execFileSync(this.config.tmuxPath, ['send-keys', '-t', `=${tmuxSession}:`, 'Enter'], { encoding: 'utf-8', timeout: 5000 });
|
|
667
|
+
return true;
|
|
668
|
+
}
|
|
669
|
+
catch {
|
|
670
|
+
// @silent-fallback-ok — send-keys boolean return
|
|
671
|
+
return false;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Send a tmux key sequence (without -l literal flag).
|
|
676
|
+
* Use for special keys like 'C-c' (Ctrl+C), 'Enter', 'Escape'.
|
|
677
|
+
* Unlike sendInput() which uses -l (literal), this sends key names directly.
|
|
678
|
+
*/
|
|
679
|
+
sendKey(tmuxSession, key) {
|
|
680
|
+
try {
|
|
681
|
+
execFileSync(this.config.tmuxPath, ['send-keys', '-t', `=${tmuxSession}:`, key], { encoding: 'utf-8', timeout: 5000 });
|
|
682
|
+
return true;
|
|
683
|
+
}
|
|
684
|
+
catch {
|
|
685
|
+
// @silent-fallback-ok — send-key boolean return
|
|
686
|
+
return false;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* List all sessions that are currently running.
|
|
691
|
+
* Pure filter — does not mutate state. The monitor tick handles lifecycle transitions.
|
|
692
|
+
* WARNING: This calls synchronous tmux has-session for each session.
|
|
693
|
+
* For health checks and non-critical callers, prefer getCachedRunningSessions().
|
|
694
|
+
*/
|
|
695
|
+
listRunningSessions() {
|
|
696
|
+
const sessions = this.state.listSessions({ status: 'running' });
|
|
697
|
+
const alive = sessions.filter(s => this.isSessionAlive(s.tmuxSession));
|
|
698
|
+
// Update cache as a side effect
|
|
699
|
+
this._cachedRunningCount = alive.length;
|
|
700
|
+
this._cachedRunningSessions = alive;
|
|
701
|
+
return alive;
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Get cached running session info (count + list) without blocking the event loop.
|
|
705
|
+
* Updated asynchronously by the monitor tick every 5 seconds.
|
|
706
|
+
* Safe to call from the health endpoint and other latency-sensitive paths.
|
|
707
|
+
*/
|
|
708
|
+
getCachedRunningSessions() {
|
|
709
|
+
return { count: this._cachedRunningCount, sessions: this._cachedRunningSessions };
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Fast startup purge — immediately remove session records for dead tmux sessions.
|
|
713
|
+
* Called once at server boot BEFORE monitoring starts, to prevent the death spiral
|
|
714
|
+
* where stale sessions overwhelm startup and block health checks.
|
|
715
|
+
* Uses a short timeout (1s) per session to fail fast.
|
|
716
|
+
*/
|
|
717
|
+
async purgeDeadSessions() {
|
|
718
|
+
const running = this.state.listSessions({ status: 'running' });
|
|
719
|
+
if (running.length === 0)
|
|
720
|
+
return 0;
|
|
721
|
+
let purged = 0;
|
|
722
|
+
for (const session of running) {
|
|
723
|
+
try {
|
|
724
|
+
execFileSync(this.config.tmuxPath, ['has-session', '-t', `=${session.tmuxSession}`], {
|
|
725
|
+
stdio: 'ignore', timeout: 1000,
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
catch {
|
|
729
|
+
// tmux session doesn't exist — purge the record
|
|
730
|
+
session.status = 'completed';
|
|
731
|
+
session.endedAt = new Date().toISOString();
|
|
732
|
+
this.state.saveSession(session);
|
|
733
|
+
purged++;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
if (purged > 0) {
|
|
737
|
+
console.log(`[SessionManager] Startup purge: removed ${purged} dead session(s) of ${running.length} tracked`);
|
|
738
|
+
}
|
|
739
|
+
return purged;
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Get diagnostics for all running sessions, including staleness detection
|
|
743
|
+
* and memory pressure. Used by the scheduler to build intelligent notifications
|
|
744
|
+
* when jobs are blocked by session limits.
|
|
745
|
+
*/
|
|
746
|
+
getSessionDiagnostics() {
|
|
747
|
+
const running = this.listRunningSessions();
|
|
748
|
+
const now = Date.now();
|
|
749
|
+
const sessions = running.map(s => {
|
|
750
|
+
const ageMinutes = s.startedAt
|
|
751
|
+
? Math.round((now - new Date(s.startedAt).getTime()) / 60000)
|
|
752
|
+
: 0;
|
|
753
|
+
const maxDuration = s.maxDurationMinutes || DEFAULT_MAX_DURATION_MINUTES;
|
|
754
|
+
// A session is stale if it's exceeded its expected duration
|
|
755
|
+
let isStale = false;
|
|
756
|
+
let staleReason;
|
|
757
|
+
if (ageMinutes > maxDuration) {
|
|
758
|
+
isStale = true;
|
|
759
|
+
staleReason = `Running ${ageMinutes}m, expected max ${maxDuration}m`;
|
|
760
|
+
}
|
|
761
|
+
else if (s.maxDurationMinutes && ageMinutes > s.maxDurationMinutes * 0.9) {
|
|
762
|
+
// Near its limit — flag as approaching stale
|
|
763
|
+
isStale = true;
|
|
764
|
+
staleReason = `Near timeout (${ageMinutes}m / ${s.maxDurationMinutes}m)`;
|
|
765
|
+
}
|
|
766
|
+
return {
|
|
767
|
+
name: s.name,
|
|
768
|
+
id: s.id,
|
|
769
|
+
jobSlug: s.jobSlug,
|
|
770
|
+
ageMinutes,
|
|
771
|
+
maxDurationMinutes: s.maxDurationMinutes,
|
|
772
|
+
isStale,
|
|
773
|
+
staleReason,
|
|
774
|
+
};
|
|
775
|
+
});
|
|
776
|
+
const staleSessions = sessions.filter(s => s.isStale);
|
|
777
|
+
// Memory pressure assessment
|
|
778
|
+
const totalMem = os.totalmem();
|
|
779
|
+
const freeMem = os.freemem();
|
|
780
|
+
const usedPercent = Math.round(((totalMem - freeMem) / totalMem) * 100);
|
|
781
|
+
const freeMemMB = Math.round(freeMem / 1048576);
|
|
782
|
+
const totalMemMB = Math.round(totalMem / 1048576);
|
|
783
|
+
let memoryPressure;
|
|
784
|
+
if (usedPercent >= 90)
|
|
785
|
+
memoryPressure = 'critical';
|
|
786
|
+
else if (usedPercent >= 75)
|
|
787
|
+
memoryPressure = 'high';
|
|
788
|
+
else if (usedPercent >= 60)
|
|
789
|
+
memoryPressure = 'moderate';
|
|
790
|
+
else
|
|
791
|
+
memoryPressure = 'low';
|
|
792
|
+
// Build actionable suggestions
|
|
793
|
+
const suggestions = [];
|
|
794
|
+
if (staleSessions.length > 0) {
|
|
795
|
+
for (const s of staleSessions) {
|
|
796
|
+
suggestions.push(`Kill stale session "${s.name}" (${s.staleReason})`);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
if (memoryPressure === 'critical' || memoryPressure === 'high') {
|
|
800
|
+
if (staleSessions.length > 0) {
|
|
801
|
+
suggestions.push(`Memory pressure is ${memoryPressure} (${usedPercent}% used) — killing stale sessions would free resources`);
|
|
802
|
+
}
|
|
803
|
+
else {
|
|
804
|
+
suggestions.push(`Memory pressure is ${memoryPressure} (${usedPercent}% used) — avoid increasing maxSessions`);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
else if (staleSessions.length === 0) {
|
|
808
|
+
// No stale sessions and memory is fine — suggest increasing the limit
|
|
809
|
+
suggestions.push(`All ${running.length} sessions are active and healthy. Consider increasing maxSessions from ${this.config.maxSessions} to ${this.config.maxSessions + 1}`);
|
|
810
|
+
}
|
|
811
|
+
return {
|
|
812
|
+
sessions,
|
|
813
|
+
maxSessions: this.config.maxSessions,
|
|
814
|
+
staleSessions,
|
|
815
|
+
memoryPressure,
|
|
816
|
+
memoryUsedPercent: usedPercent,
|
|
817
|
+
freeMemoryMB: freeMemMB,
|
|
818
|
+
totalMemoryMB: totalMemMB,
|
|
819
|
+
suggestions,
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* Detect if a session has completed by checking output patterns.
|
|
824
|
+
*/
|
|
825
|
+
detectCompletion(tmuxSession) {
|
|
826
|
+
const output = this.captureOutput(tmuxSession, 30);
|
|
827
|
+
if (!output)
|
|
828
|
+
return false;
|
|
829
|
+
return this.config.completionPatterns.some(pattern => output.includes(pattern));
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* Reap completed/zombie sessions.
|
|
833
|
+
*/
|
|
834
|
+
reapCompletedSessions() {
|
|
835
|
+
const running = this.state.listSessions({ status: 'running' });
|
|
836
|
+
const reaped = [];
|
|
837
|
+
for (const session of running) {
|
|
838
|
+
if (this.config.protectedSessions.includes(session.tmuxSession))
|
|
839
|
+
continue;
|
|
840
|
+
if (!this.isSessionAlive(session.tmuxSession) || this.detectCompletion(session.tmuxSession)) {
|
|
841
|
+
session.status = 'completed';
|
|
842
|
+
session.endedAt = new Date().toISOString();
|
|
843
|
+
this.state.saveSession(session);
|
|
844
|
+
reaped.push(session.id);
|
|
845
|
+
// Kill the tmux session if it's still hanging around
|
|
846
|
+
if (this.isSessionAlive(session.tmuxSession)) {
|
|
847
|
+
try {
|
|
848
|
+
execFileSync(this.config.tmuxPath, ['kill-session', '-t', `=${session.tmuxSession}`], {
|
|
849
|
+
encoding: 'utf-8',
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
catch { /* ignore */ }
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
return reaped;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Remove stale session state files for sessions that have been
|
|
860
|
+
* killed or completed beyond the retention period.
|
|
861
|
+
* Killed sessions: removed after 1 hour.
|
|
862
|
+
* Completed sessions: removed after 24 hours.
|
|
863
|
+
*/
|
|
864
|
+
cleanupStaleSessions() {
|
|
865
|
+
const allSessions = this.state.listSessions();
|
|
866
|
+
const now = Date.now();
|
|
867
|
+
const KILLED_TTL_MS = 60 * 60 * 1000; // 1 hour
|
|
868
|
+
const COMPLETED_TTL_MS = 24 * 60 * 60 * 1000; // 24 hours
|
|
869
|
+
const cleaned = [];
|
|
870
|
+
for (const session of allSessions) {
|
|
871
|
+
if (session.status !== 'killed' && session.status !== 'completed')
|
|
872
|
+
continue;
|
|
873
|
+
const endedAt = session.endedAt ? new Date(session.endedAt).getTime() : 0;
|
|
874
|
+
if (!endedAt)
|
|
875
|
+
continue;
|
|
876
|
+
const age = now - endedAt;
|
|
877
|
+
const ttl = session.status === 'killed' ? KILLED_TTL_MS : COMPLETED_TTL_MS;
|
|
878
|
+
if (age > ttl) {
|
|
879
|
+
if (this.state.removeSession(session.id)) {
|
|
880
|
+
cleaned.push(session.id);
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
if (cleaned.length > 0) {
|
|
885
|
+
console.log(`[SessionManager] Cleaned up ${cleaned.length} stale session(s): ${cleaned.join(', ')}`);
|
|
886
|
+
}
|
|
887
|
+
return cleaned;
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Spawn an interactive Claude Code session (no -p prompt — opens at the REPL).
|
|
891
|
+
* Used for Telegram-driven conversational sessions.
|
|
892
|
+
* Optionally sends an initial message after Claude is ready.
|
|
893
|
+
*/
|
|
894
|
+
async spawnInteractiveSession(initialMessage, name, options) {
|
|
895
|
+
const sanitized = name
|
|
896
|
+
? name.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '').slice(0, 40)
|
|
897
|
+
: null;
|
|
898
|
+
const projectBase = path.basename(this.config.projectDir);
|
|
899
|
+
const tmuxSession = sanitized ? `${projectBase}-${sanitized}` : `${projectBase}-interactive-${Date.now()}`;
|
|
900
|
+
// Prevent injection into protected sessions (e.g., the server itself)
|
|
901
|
+
if (this.config.protectedSessions.includes(tmuxSession)) {
|
|
902
|
+
throw new Error(`Cannot interact with protected session: ${tmuxSession}`);
|
|
903
|
+
}
|
|
904
|
+
if (this.tmuxSessionExists(tmuxSession)) {
|
|
905
|
+
// Session already exists — just reuse it
|
|
906
|
+
if (initialMessage) {
|
|
907
|
+
this.injectMessage(tmuxSession, initialMessage);
|
|
908
|
+
}
|
|
909
|
+
return tmuxSession;
|
|
910
|
+
}
|
|
911
|
+
// User-initiated sessions bypass the maxSessions limit entirely.
|
|
912
|
+
// The user should NEVER be blocked from interacting with their agent
|
|
913
|
+
// because scheduled jobs filled all slots. maxSessions only constrains
|
|
914
|
+
// autonomous/scheduled sessions, not human-initiated ones.
|
|
915
|
+
// Safety valve: still cap at maxSessions * 3 to prevent runaway sessions.
|
|
916
|
+
const runningSessions = this.listRunningSessions();
|
|
917
|
+
const absoluteLimit = this.config.maxSessions * 3;
|
|
918
|
+
if (runningSessions.length >= absoluteLimit) {
|
|
919
|
+
throw new Error(`Absolute session limit (${absoluteLimit}) reached. ` +
|
|
920
|
+
`Running: ${runningSessions.map(s => s.name).join(', ')}`);
|
|
921
|
+
}
|
|
922
|
+
// Generate session ID before tmux spawn so we can pass it as env var
|
|
923
|
+
const interactiveSessionId = this.generateId();
|
|
924
|
+
// Spawn Claude in tmux — no bash -c shell intermediary.
|
|
925
|
+
// Uses tmux -e flags to set/unset env vars directly, matching spawnSession pattern.
|
|
926
|
+
// This avoids shell injection risks and handles claudePath with spaces.
|
|
927
|
+
try {
|
|
928
|
+
const tmuxArgs = [
|
|
929
|
+
'new-session', '-d',
|
|
930
|
+
'-s', tmuxSession,
|
|
931
|
+
'-c', this.config.projectDir,
|
|
932
|
+
'-x', '200', '-y', '50',
|
|
933
|
+
'-e', 'CLAUDECODE=', // Prevent nested Claude Code detection
|
|
934
|
+
'-e', `INSTAR_SESSION_ID=${interactiveSessionId}`, // Expose instar session ID to hook events
|
|
935
|
+
'-e', `INSTAR_SERVER_URL=http://localhost:${this.config.port}`,
|
|
936
|
+
'-e', `INSTAR_AUTH_TOKEN=${this.config.authToken}`,
|
|
937
|
+
'-e', 'ANTHROPIC_API_KEY=', // Clear stale/invalid API keys — agents use Claude subscription
|
|
938
|
+
// Isolate database credentials — spawned sessions must never inherit production
|
|
939
|
+
// database URLs from the parent shell. (Learned from Portal incident 2026-02-22)
|
|
940
|
+
'-e', 'DATABASE_URL=',
|
|
941
|
+
'-e', 'DIRECT_DATABASE_URL=',
|
|
942
|
+
'-e', 'DATABASE_URL_PROD=',
|
|
943
|
+
'-e', 'DATABASE_URL_DEV=',
|
|
944
|
+
'-e', 'DATABASE_URL_TEST=',
|
|
945
|
+
];
|
|
946
|
+
if (options?.telegramTopicId) {
|
|
947
|
+
tmuxArgs.push('-e', `INSTAR_TELEGRAM_TOPIC=${options.telegramTopicId}`);
|
|
948
|
+
}
|
|
949
|
+
tmuxArgs.push(this.config.claudePath, '--dangerously-skip-permissions');
|
|
950
|
+
if (options?.resumeSessionId) {
|
|
951
|
+
tmuxArgs.push('--resume', options.resumeSessionId);
|
|
952
|
+
console.log(`[SessionManager] Resuming session: ${options.resumeSessionId}`);
|
|
953
|
+
}
|
|
954
|
+
execFileSync(this.config.tmuxPath, tmuxArgs, { encoding: 'utf-8' });
|
|
955
|
+
// Increase tmux scrollback buffer for dashboard history support
|
|
956
|
+
try {
|
|
957
|
+
execFileSync(this.config.tmuxPath, [
|
|
958
|
+
'set-option', '-t', `=${tmuxSession}:`, 'history-limit', '50000',
|
|
959
|
+
], { encoding: 'utf-8', timeout: 5000 });
|
|
960
|
+
}
|
|
961
|
+
catch {
|
|
962
|
+
// @silent-fallback-ok — history-limit is a nice-to-have
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
catch (err) {
|
|
966
|
+
throw new Error(`Failed to create interactive tmux session: ${err}`);
|
|
967
|
+
}
|
|
968
|
+
// Track it in state (with default timeout — interactive sessions shouldn't hang forever)
|
|
969
|
+
const session = {
|
|
970
|
+
id: interactiveSessionId,
|
|
971
|
+
name: name || tmuxSession,
|
|
972
|
+
status: 'running',
|
|
973
|
+
tmuxSession,
|
|
974
|
+
startedAt: new Date().toISOString(),
|
|
975
|
+
prompt: initialMessage,
|
|
976
|
+
maxDurationMinutes: DEFAULT_MAX_DURATION_MINUTES,
|
|
977
|
+
};
|
|
978
|
+
this.state.saveSession(session);
|
|
979
|
+
// Wait for Claude to be ready, then send the initial message
|
|
980
|
+
// Resume sessions load large JONSLs which trigger TUI redraws — use longer timeout
|
|
981
|
+
// and a stabilization delay to avoid injecting text that gets wiped by the redraw.
|
|
982
|
+
const readyTimeout = options?.resumeSessionId ? 60000 : 30000;
|
|
983
|
+
if (initialMessage) {
|
|
984
|
+
this.waitForClaudeReady(tmuxSession, readyTimeout).then((ready) => {
|
|
985
|
+
if (ready) {
|
|
986
|
+
// Stabilization delay: Claude's TUI may redraw after loading large JONSLs,
|
|
987
|
+
// clearing any text injected too early. Wait for the redraw to settle.
|
|
988
|
+
const stabilizationMs = options?.resumeSessionId ? 5000 : 0;
|
|
989
|
+
setTimeout(() => {
|
|
990
|
+
this.injectMessage(tmuxSession, initialMessage);
|
|
991
|
+
console.log(`[SessionManager] Injected initial message into "${tmuxSession}" (${initialMessage.length} chars${stabilizationMs ? ', after stabilization delay' : ''})`);
|
|
992
|
+
}, stabilizationMs);
|
|
993
|
+
}
|
|
994
|
+
else {
|
|
995
|
+
console.error(`[SessionManager] Claude not ready in session "${tmuxSession}" — message NOT injected. Session may need manual intervention.`);
|
|
996
|
+
// Still try to inject — Claude might be ready but prompt detection failed
|
|
997
|
+
if (this.tmuxSessionExists(tmuxSession)) {
|
|
998
|
+
console.log(`[SessionManager] Session "${tmuxSession}" still alive — attempting injection anyway`);
|
|
999
|
+
this.injectMessage(tmuxSession, initialMessage);
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
}).catch((err) => {
|
|
1003
|
+
console.error(`[SessionManager] Error waiting for Claude ready in "${tmuxSession}": ${err}`);
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
return tmuxSession;
|
|
1007
|
+
}
|
|
1008
|
+
/**
|
|
1009
|
+
* Spawn a scoped triage session with restricted tool access.
|
|
1010
|
+
* Unlike interactive sessions, triage sessions use --allowedTools + --permission-mode dontAsk
|
|
1011
|
+
* instead of --dangerously-skip-permissions. This gives them read-only access.
|
|
1012
|
+
*
|
|
1013
|
+
* Used by TriageOrchestrator for behind-the-scenes session investigation.
|
|
1014
|
+
*/
|
|
1015
|
+
async spawnTriageSession(name, options) {
|
|
1016
|
+
const sanitized = name.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '').slice(0, 40);
|
|
1017
|
+
const projectBase = path.basename(this.config.projectDir);
|
|
1018
|
+
const tmuxSession = `${projectBase}-${sanitized}`;
|
|
1019
|
+
if (this.config.protectedSessions.includes(tmuxSession)) {
|
|
1020
|
+
throw new Error(`Cannot create triage session with protected name: ${tmuxSession}`);
|
|
1021
|
+
}
|
|
1022
|
+
// Generate session ID before tmux spawn so we can pass it as env var
|
|
1023
|
+
const triageSessionId = this.generateId();
|
|
1024
|
+
// Kill existing triage session if present (triage sessions are ephemeral)
|
|
1025
|
+
if (this.tmuxSessionExists(tmuxSession)) {
|
|
1026
|
+
try {
|
|
1027
|
+
execFileSync(this.config.tmuxPath, ['kill-session', '-t', tmuxSession], { encoding: 'utf-8' });
|
|
1028
|
+
}
|
|
1029
|
+
catch {
|
|
1030
|
+
// Best-effort
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
try {
|
|
1034
|
+
const tmuxArgs = [
|
|
1035
|
+
'new-session', '-d',
|
|
1036
|
+
'-s', tmuxSession,
|
|
1037
|
+
'-c', this.config.projectDir,
|
|
1038
|
+
'-x', '200', '-y', '50',
|
|
1039
|
+
'-e', 'CLAUDECODE=',
|
|
1040
|
+
'-e', `INSTAR_SESSION_ID=${triageSessionId}`,
|
|
1041
|
+
'-e', `INSTAR_SERVER_URL=http://localhost:${this.config.port}`,
|
|
1042
|
+
'-e', `INSTAR_AUTH_TOKEN=${this.config.authToken}`,
|
|
1043
|
+
'-e', 'ANTHROPIC_API_KEY=',
|
|
1044
|
+
'-e', 'DATABASE_URL=',
|
|
1045
|
+
'-e', 'DIRECT_DATABASE_URL=',
|
|
1046
|
+
'-e', 'DATABASE_URL_PROD=',
|
|
1047
|
+
'-e', 'DATABASE_URL_DEV=',
|
|
1048
|
+
'-e', 'DATABASE_URL_TEST=',
|
|
1049
|
+
];
|
|
1050
|
+
tmuxArgs.push(this.config.claudePath);
|
|
1051
|
+
// Scoped permissions: allowedTools + permissionMode (NOT --dangerously-skip-permissions)
|
|
1052
|
+
if (options.allowedTools.length > 0) {
|
|
1053
|
+
tmuxArgs.push('--allowedTools', options.allowedTools.join(','));
|
|
1054
|
+
}
|
|
1055
|
+
tmuxArgs.push('--permission-mode', options.permissionMode);
|
|
1056
|
+
if (options.resumeSessionId) {
|
|
1057
|
+
tmuxArgs.push('--resume', options.resumeSessionId);
|
|
1058
|
+
console.log(`[SessionManager] Resuming triage session: ${options.resumeSessionId}`);
|
|
1059
|
+
}
|
|
1060
|
+
execFileSync(this.config.tmuxPath, tmuxArgs, { encoding: 'utf-8' });
|
|
1061
|
+
// Increase tmux scrollback buffer for dashboard history support
|
|
1062
|
+
try {
|
|
1063
|
+
execFileSync(this.config.tmuxPath, [
|
|
1064
|
+
'set-option', '-t', `=${tmuxSession}:`, 'history-limit', '50000',
|
|
1065
|
+
], { encoding: 'utf-8', timeout: 5000 });
|
|
1066
|
+
}
|
|
1067
|
+
catch {
|
|
1068
|
+
// @silent-fallback-ok — history-limit is a nice-to-have
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
catch (err) {
|
|
1072
|
+
throw new Error(`Failed to create triage tmux session: ${err}`);
|
|
1073
|
+
}
|
|
1074
|
+
// Track it but with a shorter timeout (triage sessions should be brief)
|
|
1075
|
+
const session = {
|
|
1076
|
+
id: triageSessionId,
|
|
1077
|
+
name,
|
|
1078
|
+
status: 'running',
|
|
1079
|
+
tmuxSession,
|
|
1080
|
+
startedAt: new Date().toISOString(),
|
|
1081
|
+
maxDurationMinutes: 10,
|
|
1082
|
+
};
|
|
1083
|
+
this.state.saveSession(session);
|
|
1084
|
+
// Wait for Claude to be ready
|
|
1085
|
+
const readyTimeout = options.resumeSessionId ? 60000 : 30000;
|
|
1086
|
+
await this.waitForClaudeReady(tmuxSession, readyTimeout);
|
|
1087
|
+
return tmuxSession;
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Inject a Telegram message into a tmux session.
|
|
1091
|
+
* Short messages go via send-keys; long messages are written to a temp file.
|
|
1092
|
+
*
|
|
1093
|
+
* Image handling: [image:/path] tags from Telegram photo downloads are
|
|
1094
|
+
* transformed into explicit instructions so Claude Code knows to read the
|
|
1095
|
+
* image file (it can natively view images via the Read tool).
|
|
1096
|
+
*/
|
|
1097
|
+
/**
|
|
1098
|
+
* Inject a paste notification into a tmux session.
|
|
1099
|
+
* Uses the same injection path as Telegram/WhatsApp messages
|
|
1100
|
+
* so InputGuard provenance checks apply.
|
|
1101
|
+
*/
|
|
1102
|
+
injectPasteNotification(tmuxSession, notification) {
|
|
1103
|
+
const FILE_THRESHOLD = 500;
|
|
1104
|
+
if (notification.length <= FILE_THRESHOLD) {
|
|
1105
|
+
this.injectMessage(tmuxSession, notification);
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
// Write to temp file for large notifications
|
|
1109
|
+
const tmpDir = path.join('/tmp', 'instar-paste');
|
|
1110
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
1111
|
+
const filename = `paste-notify-${Date.now()}-${randomUUID().slice(0, 8)}.txt`;
|
|
1112
|
+
const filepath = path.join(tmpDir, filename);
|
|
1113
|
+
fs.writeFileSync(filepath, notification);
|
|
1114
|
+
const ref = `[paste] Content notification saved to ${filepath} — read it to see the details.`;
|
|
1115
|
+
this.injectMessage(tmuxSession, ref);
|
|
1116
|
+
}
|
|
1117
|
+
injectTelegramMessage(tmuxSession, topicId, text, topicName, senderName, telegramUserId) {
|
|
1118
|
+
// Track this injection for response verification.
|
|
1119
|
+
// If the session dies before the agent replies, the monitor loop will detect it.
|
|
1120
|
+
this.pendingInjections.set(tmuxSession, { topicId, injectedAt: Date.now(), text: text.slice(0, 200) });
|
|
1121
|
+
const FILE_THRESHOLD = 500;
|
|
1122
|
+
// Transform [image:path] tags into explicit read instructions.
|
|
1123
|
+
// Claude Code can natively view images via the Read tool, but only
|
|
1124
|
+
// if it knows there's an image file to read.
|
|
1125
|
+
let transformed = text.replace(/\[image:([^\]]+)\]/g, (_, imagePath) => {
|
|
1126
|
+
if (imagePath === 'download-failed') {
|
|
1127
|
+
return '[User sent a photo but the download failed]';
|
|
1128
|
+
}
|
|
1129
|
+
return `[User sent a photo — read the image file at ${imagePath} to view it. If the image cannot be processed, acknowledge you received it and let the user know the image format may not be supported.]`;
|
|
1130
|
+
});
|
|
1131
|
+
// Transform [document:path] tags into explicit read instructions.
|
|
1132
|
+
transformed = transformed.replace(/\[document:([^\]]+)\]/g, (_, docPath) => {
|
|
1133
|
+
if (docPath === 'download-failed') {
|
|
1134
|
+
return '[User sent a file but the download failed]';
|
|
1135
|
+
}
|
|
1136
|
+
return `[User sent a file — it has been saved to ${docPath}. Read the file to view its contents]`;
|
|
1137
|
+
});
|
|
1138
|
+
// Sanitize user-controlled content at the injection boundary
|
|
1139
|
+
// (User-Agent Topology Spec, Gap 12)
|
|
1140
|
+
const safeName = senderName ? sanitizeSenderName(senderName) : undefined;
|
|
1141
|
+
const safeTopic = topicName ? sanitizeTopicName(topicName) : undefined;
|
|
1142
|
+
// Build tag using the shared builder — includes UID when available
|
|
1143
|
+
// Format: [telegram:42 "Agent Updates" from Justin (uid:12345)]
|
|
1144
|
+
const topicTag = buildInjectionTag(topicId, safeTopic, safeName, telegramUserId);
|
|
1145
|
+
const taggedText = `${topicTag} ${transformed}`;
|
|
1146
|
+
if (taggedText.length <= FILE_THRESHOLD) {
|
|
1147
|
+
this.injectMessage(tmuxSession, taggedText);
|
|
1148
|
+
return;
|
|
1149
|
+
}
|
|
1150
|
+
// Write full message to temp file
|
|
1151
|
+
const tmpDir = path.join('/tmp', 'instar-telegram');
|
|
1152
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
1153
|
+
const filename = `msg-${topicId}-${Date.now()}-${randomUUID().slice(0, 8)}.txt`;
|
|
1154
|
+
const filepath = path.join(tmpDir, filename);
|
|
1155
|
+
fs.writeFileSync(filepath, taggedText);
|
|
1156
|
+
const ref = `[telegram:${topicId}] [Long message saved to ${filepath} — read it to see the full message]`;
|
|
1157
|
+
this.injectMessage(tmuxSession, ref);
|
|
1158
|
+
}
|
|
1159
|
+
/**
|
|
1160
|
+
* Clear the injection tracker for a topic when the agent sends a reply.
|
|
1161
|
+
* Called from the /telegram/reply/:topicId route.
|
|
1162
|
+
*/
|
|
1163
|
+
clearInjectionTracker(topicId) {
|
|
1164
|
+
for (const [session, info] of this.pendingInjections) {
|
|
1165
|
+
if (info.topicId === topicId) {
|
|
1166
|
+
this.pendingInjections.delete(session);
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* Get all pending injections (for diagnostics / event emission on session death).
|
|
1172
|
+
*/
|
|
1173
|
+
getPendingInjection(tmuxSession) {
|
|
1174
|
+
return this.pendingInjections.get(tmuxSession);
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* Inject a WhatsApp message into a tmux session.
|
|
1178
|
+
* Tags with [whatsapp:JID] and handles long messages via temp files.
|
|
1179
|
+
*/
|
|
1180
|
+
injectWhatsAppMessage(tmuxSession, jid, text, senderName) {
|
|
1181
|
+
const FILE_THRESHOLD = 500;
|
|
1182
|
+
// Build tag: [whatsapp:12345678901@s.whatsapp.net from Justin]
|
|
1183
|
+
const nameTag = senderName ? ` from ${senderName.replace(/[\[\]]/g, '')}` : '';
|
|
1184
|
+
const tag = `[whatsapp:${jid}${nameTag}]`;
|
|
1185
|
+
const taggedText = `${tag} ${text}`;
|
|
1186
|
+
if (taggedText.length <= FILE_THRESHOLD) {
|
|
1187
|
+
this.injectMessage(tmuxSession, taggedText);
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
// Write full message to temp file
|
|
1191
|
+
const tmpDir = path.join('/tmp', 'instar-whatsapp');
|
|
1192
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
1193
|
+
const filename = `msg-${jid.split('@')[0]}-${Date.now()}.txt`;
|
|
1194
|
+
const filepath = path.join(tmpDir, filename);
|
|
1195
|
+
fs.writeFileSync(filepath, taggedText);
|
|
1196
|
+
const ref = `${tag} [Long message saved to ${filepath} — read it to see the full message]`;
|
|
1197
|
+
this.injectMessage(tmuxSession, ref);
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* Send text to a tmux session via send-keys, with Input Guard protection.
|
|
1201
|
+
*
|
|
1202
|
+
* When an InputGuard is configured, messages are checked for provenance
|
|
1203
|
+
* before injection. Suspicious messages still reach the session but with
|
|
1204
|
+
* a system-reminder warning injected afterward (async, non-blocking).
|
|
1205
|
+
*
|
|
1206
|
+
* For multi-line text, uses bracketed paste mode escape sequences so the
|
|
1207
|
+
* terminal treats newlines as literal text rather than Enter keypresses.
|
|
1208
|
+
* This avoids tmux load-buffer/paste-buffer which trigger macOS TCC
|
|
1209
|
+
* "access data from other apps" permission prompts.
|
|
1210
|
+
*/
|
|
1211
|
+
injectMessage(tmuxSession, text) {
|
|
1212
|
+
// ── Input Guard: Layer 1 + 1.5 (deterministic, synchronous) ──
|
|
1213
|
+
if (this.inputGuard) {
|
|
1214
|
+
const binding = this.getTopicBinding(tmuxSession);
|
|
1215
|
+
if (binding) {
|
|
1216
|
+
const provenance = this.inputGuard.checkProvenance(text, binding);
|
|
1217
|
+
if (provenance === 'mismatched-tag') {
|
|
1218
|
+
// Wrong topic — log, alert, and drop
|
|
1219
|
+
console.error(`[InputGuard] BLOCKED cross-topic injection: message bound for different topic, ` +
|
|
1220
|
+
`session "${tmuxSession}" is bound to topic ${binding.topicId}`);
|
|
1221
|
+
this.inputGuard.logSecurityEvent({
|
|
1222
|
+
event: 'input-provenance-block',
|
|
1223
|
+
session: tmuxSession,
|
|
1224
|
+
boundTopic: binding.topicId,
|
|
1225
|
+
messagePreview: text.slice(0, 100),
|
|
1226
|
+
reason: 'mismatched tag',
|
|
1227
|
+
});
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
if (provenance === 'untagged') {
|
|
1231
|
+
// Layer 1.5: Check injection patterns
|
|
1232
|
+
const pattern = this.inputGuard.checkInjectionPatterns(text);
|
|
1233
|
+
if (pattern) {
|
|
1234
|
+
const action = this.inputGuard['config'].action ?? 'warn';
|
|
1235
|
+
this.inputGuard.logSecurityEvent({
|
|
1236
|
+
event: 'input-injection-pattern',
|
|
1237
|
+
session: tmuxSession,
|
|
1238
|
+
boundTopic: binding.topicId,
|
|
1239
|
+
pattern,
|
|
1240
|
+
action,
|
|
1241
|
+
messagePreview: text.slice(0, 100),
|
|
1242
|
+
});
|
|
1243
|
+
if (action === 'block') {
|
|
1244
|
+
console.error(`[InputGuard] BLOCKED injection pattern "${pattern}" in session "${tmuxSession}"`);
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
1247
|
+
if (action === 'warn') {
|
|
1248
|
+
// Inject the message, then inject warning afterward
|
|
1249
|
+
this.rawInject(tmuxSession, text);
|
|
1250
|
+
// Small delay so warning arrives after message
|
|
1251
|
+
setTimeout(() => {
|
|
1252
|
+
const warning = this.inputGuard.buildWarning(binding, `Matched injection pattern: ${pattern}`);
|
|
1253
|
+
this.rawInject(tmuxSession, warning);
|
|
1254
|
+
}, 500);
|
|
1255
|
+
return;
|
|
1256
|
+
}
|
|
1257
|
+
// action === 'log': fall through to normal injection
|
|
1258
|
+
}
|
|
1259
|
+
// Layer 2: Async LLM topic coherence review (non-blocking)
|
|
1260
|
+
// Inject immediately, review in background
|
|
1261
|
+
this.rawInject(tmuxSession, text);
|
|
1262
|
+
this.inputGuard.reviewTopicCoherence(text, binding).then(result => {
|
|
1263
|
+
if (result.verdict === 'suspicious') {
|
|
1264
|
+
const action = this.inputGuard['config'].action ?? 'warn';
|
|
1265
|
+
this.inputGuard.logSecurityEvent({
|
|
1266
|
+
event: 'input-coherence-suspicious',
|
|
1267
|
+
session: tmuxSession,
|
|
1268
|
+
boundTopic: binding.topicId,
|
|
1269
|
+
reason: result.reason,
|
|
1270
|
+
confidence: result.confidence,
|
|
1271
|
+
action,
|
|
1272
|
+
messagePreview: text.slice(0, 100),
|
|
1273
|
+
});
|
|
1274
|
+
if (action === 'warn') {
|
|
1275
|
+
const warning = this.inputGuard.buildWarning(binding, result.reason);
|
|
1276
|
+
this.rawInject(tmuxSession, warning);
|
|
1277
|
+
}
|
|
1278
|
+
// block mode doesn't apply after async review — message already injected
|
|
1279
|
+
// log mode: already logged above
|
|
1280
|
+
}
|
|
1281
|
+
}).catch(err => {
|
|
1282
|
+
// Fail open — message already injected, just log the error
|
|
1283
|
+
console.error(`[InputGuard] Coherence review error: ${err instanceof Error ? err.message : err}`);
|
|
1284
|
+
});
|
|
1285
|
+
return;
|
|
1286
|
+
}
|
|
1287
|
+
// provenance === 'verified' or 'unbound' — fall through to normal injection
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
// ── Normal injection (verified provenance or no InputGuard) ──
|
|
1291
|
+
this.rawInject(tmuxSession, text);
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Raw tmux send-keys injection. No validation — just sends text to the session.
|
|
1295
|
+
* Used by injectMessage after provenance checks pass.
|
|
1296
|
+
*/
|
|
1297
|
+
rawInject(tmuxSession, text) {
|
|
1298
|
+
// Reset idle-prompt timer — this session is about to receive new input,
|
|
1299
|
+
// so it's not a zombie. Without this, the zombie detector can kill a session
|
|
1300
|
+
// that just received a message but hasn't produced output yet.
|
|
1301
|
+
const running = this.state.listSessions({ status: 'running' });
|
|
1302
|
+
const match = running.find(s => s.tmuxSession === tmuxSession);
|
|
1303
|
+
if (match) {
|
|
1304
|
+
this.idlePromptSince.delete(match.id);
|
|
1305
|
+
}
|
|
1306
|
+
const exactTarget = `=${tmuxSession}:`;
|
|
1307
|
+
try {
|
|
1308
|
+
if (text.includes('\n')) {
|
|
1309
|
+
// Multi-line: use bracketed paste mode.
|
|
1310
|
+
// The terminal (and Claude Code's readline) treats everything between
|
|
1311
|
+
// \e[200~ and \e[201~ as a single paste — newlines are literal, not Enter.
|
|
1312
|
+
// This completely avoids load-buffer/paste-buffer and their TCC prompts.
|
|
1313
|
+
execFileSync(this.config.tmuxPath, ['send-keys', '-t', exactTarget, '\x1b[200~'], {
|
|
1314
|
+
encoding: 'utf-8', timeout: 5000,
|
|
1315
|
+
});
|
|
1316
|
+
execFileSync(this.config.tmuxPath, ['send-keys', '-t', exactTarget, '-l', text], {
|
|
1317
|
+
encoding: 'utf-8', timeout: 5000,
|
|
1318
|
+
});
|
|
1319
|
+
execFileSync(this.config.tmuxPath, ['send-keys', '-t', exactTarget, '\x1b[201~'], {
|
|
1320
|
+
encoding: 'utf-8', timeout: 5000,
|
|
1321
|
+
});
|
|
1322
|
+
// Delay to let the terminal fully process the bracketed paste.
|
|
1323
|
+
// 100ms was too short — Claude Code needs time to parse the paste end
|
|
1324
|
+
// sequence and buffer the content before Enter can submit it.
|
|
1325
|
+
// 500ms is conservative but prevents the "[Pasted text #1]" stuck state.
|
|
1326
|
+
execFileSync('/bin/sleep', ['0.5'], { timeout: 2000 });
|
|
1327
|
+
// Send Enter to submit
|
|
1328
|
+
execFileSync(this.config.tmuxPath, ['send-keys', '-t', exactTarget, 'Enter'], {
|
|
1329
|
+
encoding: 'utf-8', timeout: 5000,
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
else {
|
|
1333
|
+
// Single-line: simple send-keys
|
|
1334
|
+
execFileSync(this.config.tmuxPath, ['send-keys', '-t', exactTarget, '-l', text], {
|
|
1335
|
+
encoding: 'utf-8', timeout: 5000,
|
|
1336
|
+
});
|
|
1337
|
+
// Send Enter separately
|
|
1338
|
+
execFileSync(this.config.tmuxPath, ['send-keys', '-t', exactTarget, 'Enter'], {
|
|
1339
|
+
encoding: 'utf-8', timeout: 5000,
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
catch (err) {
|
|
1344
|
+
console.error(`[SessionManager] Failed to inject message into ${tmuxSession}: ${err}`);
|
|
1345
|
+
DegradationReporter.getInstance().report({
|
|
1346
|
+
feature: 'SessionManager.injectMessage',
|
|
1347
|
+
primary: 'Inject Telegram message into tmux session',
|
|
1348
|
+
fallback: 'Message lost — user input never reaches Claude',
|
|
1349
|
+
reason: `Failed to inject message: ${err instanceof Error ? err.message : String(err)}`,
|
|
1350
|
+
impact: 'User message silently dropped',
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Wait for Claude to be ready in a tmux session by polling output.
|
|
1356
|
+
* Looks for Claude Code's prompt character (❯) which appears when ready for input.
|
|
1357
|
+
*/
|
|
1358
|
+
async waitForClaudeReady(tmuxSession, timeoutMs = 30000) {
|
|
1359
|
+
const start = Date.now();
|
|
1360
|
+
// Wait a minimum startup delay before checking (Claude needs time to load)
|
|
1361
|
+
await new Promise(r => setTimeout(r, 3000));
|
|
1362
|
+
while (Date.now() - start < timeoutMs) {
|
|
1363
|
+
if (!this.tmuxSessionExists(tmuxSession)) {
|
|
1364
|
+
console.error(`[SessionManager] Session "${tmuxSession}" died during startup`);
|
|
1365
|
+
return false;
|
|
1366
|
+
}
|
|
1367
|
+
const output = this.captureOutput(tmuxSession, 5);
|
|
1368
|
+
// Check only the last 3 lines for Claude Code's prompt character (❯).
|
|
1369
|
+
// Checking all captured lines can false-positive on ❯ appearing in prior output
|
|
1370
|
+
// (e.g., during TUI redraw of a resumed session's history).
|
|
1371
|
+
const lines = (output || '').split('\n').filter(l => l.trim());
|
|
1372
|
+
const tail = lines.slice(-3).join('\n');
|
|
1373
|
+
if (tail.includes('❯') || tail.includes('bypass permissions')) {
|
|
1374
|
+
console.log(`[SessionManager] Claude ready in "${tmuxSession}" after ${Date.now() - start}ms`);
|
|
1375
|
+
return true;
|
|
1376
|
+
}
|
|
1377
|
+
await new Promise(r => setTimeout(r, 500));
|
|
1378
|
+
}
|
|
1379
|
+
// Log what we see on timeout for debugging
|
|
1380
|
+
const finalOutput = this.captureOutput(tmuxSession, 20);
|
|
1381
|
+
console.error(`[SessionManager] Claude not ready in "${tmuxSession}" after ${timeoutMs}ms. Output: ${(finalOutput || '').slice(-200)}`);
|
|
1382
|
+
return false;
|
|
1383
|
+
}
|
|
1384
|
+
tmuxSessionExists(name) {
|
|
1385
|
+
try {
|
|
1386
|
+
execFileSync(this.config.tmuxPath, ['has-session', '-t', `=${name}`], {
|
|
1387
|
+
encoding: 'utf-8',
|
|
1388
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
1389
|
+
timeout: 5000,
|
|
1390
|
+
});
|
|
1391
|
+
return true;
|
|
1392
|
+
}
|
|
1393
|
+
catch {
|
|
1394
|
+
// @silent-fallback-ok — session existence check
|
|
1395
|
+
return false;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
generateId() {
|
|
1399
|
+
return randomUUID();
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
//# sourceMappingURL=SessionManager.js.map
|