@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,1235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive setup wizard — the one-line onboarding experience.
|
|
3
|
+
*
|
|
4
|
+
* `npx instar` or `instar setup` walks through everything:
|
|
5
|
+
* 1. Project detection + naming
|
|
6
|
+
* 2. Secret management (Bitwarden / local encrypted / manual)
|
|
7
|
+
* 3. Telegram setup (primary communication channel)
|
|
8
|
+
* 4. User setup (name, email, permissions)
|
|
9
|
+
* 5. Scheduler + first job (optional)
|
|
10
|
+
* 6. Start server
|
|
11
|
+
*
|
|
12
|
+
* Launches a Claude Code session that walks you through setup
|
|
13
|
+
* conversationally. Claude Code is a hard requirement — Instar's
|
|
14
|
+
* entire runtime depends on it.
|
|
15
|
+
*
|
|
16
|
+
* No flags needed. No manual config editing. Just answers.
|
|
17
|
+
*/
|
|
18
|
+
import { execFileSync, execSync, spawn } from 'node:child_process';
|
|
19
|
+
import fs from 'node:fs';
|
|
20
|
+
import os from 'node:os';
|
|
21
|
+
import path from 'node:path';
|
|
22
|
+
import pc from 'picocolors';
|
|
23
|
+
import { detectClaudePath, detectGhPath } from '../core/Config.js';
|
|
24
|
+
import { ensurePrerequisites } from '../core/Prerequisites.js';
|
|
25
|
+
import { allocatePort } from '../core/AgentRegistry.js';
|
|
26
|
+
import { runDiscovery, buildScenarioContext, readSetupLock, } from './discovery.js';
|
|
27
|
+
/**
|
|
28
|
+
* Try allocatePort from the registry, fall back to scanning for a free port.
|
|
29
|
+
*/
|
|
30
|
+
function allocatePortSafe(agentDir) {
|
|
31
|
+
try {
|
|
32
|
+
return allocatePort(agentDir);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Registry unavailable — scan for a free port directly
|
|
36
|
+
for (let port = 4040; port <= 4099; port++) {
|
|
37
|
+
try {
|
|
38
|
+
execSync(`lsof -iTCP:${port} -sTCP:LISTEN -P -n`, { stdio: 'ignore' });
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return port; // lsof found nothing — port is free
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return 4040;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Launch the conversational setup wizard via Claude Code.
|
|
49
|
+
* Claude Code is required — there is no fallback.
|
|
50
|
+
*/
|
|
51
|
+
export async function runSetup() {
|
|
52
|
+
// Check and install prerequisites (tmux, Claude CLI, Node.js version)
|
|
53
|
+
console.log();
|
|
54
|
+
const prereqs = await ensurePrerequisites();
|
|
55
|
+
// Claude Code is a hard requirement — Instar can't run without it
|
|
56
|
+
const claudePath = detectClaudePath();
|
|
57
|
+
if (!claudePath) {
|
|
58
|
+
console.log();
|
|
59
|
+
console.log(pc.red(' Claude Code is required to use Instar.'));
|
|
60
|
+
console.log();
|
|
61
|
+
console.log(pc.dim(' Instar agents are powered by Claude Code — it\'s not optional.'));
|
|
62
|
+
console.log(pc.dim(' Install it, then run this command again:'));
|
|
63
|
+
console.log();
|
|
64
|
+
console.log(` ${pc.cyan('npm install -g @anthropic-ai/claude-code')}`);
|
|
65
|
+
console.log();
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
if (!prereqs.allMet) {
|
|
69
|
+
console.log(pc.red(' Some prerequisites are still missing. Please install them and try again.'));
|
|
70
|
+
console.log();
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
// Check that the setup-wizard skill exists
|
|
74
|
+
const skillPath = path.join(findInstarRoot(), '.claude', 'skills', 'setup-wizard', 'skill.md');
|
|
75
|
+
if (!fs.existsSync(skillPath)) {
|
|
76
|
+
console.log();
|
|
77
|
+
console.log(pc.red(' Setup wizard skill not found.'));
|
|
78
|
+
console.log(pc.dim(` Expected: ${skillPath}`));
|
|
79
|
+
console.log(pc.dim(' This may indicate a corrupted installation. Try: npx instar'));
|
|
80
|
+
console.log();
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
console.log();
|
|
84
|
+
console.log(pc.bold(' Welcome to Instar'));
|
|
85
|
+
console.log();
|
|
86
|
+
console.log(pc.yellow(' Note: Instar runs Claude Code with --dangerously-skip-permissions.'));
|
|
87
|
+
console.log(pc.dim(' This allows your agent to operate autonomously — reading, writing, and'));
|
|
88
|
+
console.log(pc.dim(' executing within your project without per-action approval prompts.'));
|
|
89
|
+
console.log(pc.dim(' Security is enforced through behavioral hooks, identity grounding, and'));
|
|
90
|
+
console.log(pc.dim(' scoped access — not permission dialogs. See: README.md > Security Model'));
|
|
91
|
+
console.log();
|
|
92
|
+
// ── Context Detection & Discovery ───────────────────────────────
|
|
93
|
+
const projectDir = process.cwd();
|
|
94
|
+
// Detect git context
|
|
95
|
+
let isInsideGitRepo = false;
|
|
96
|
+
let gitRepoName = '';
|
|
97
|
+
let gitRepoRoot = '';
|
|
98
|
+
try {
|
|
99
|
+
gitRepoRoot = execFileSync('git', ['rev-parse', '--show-toplevel'], {
|
|
100
|
+
cwd: projectDir,
|
|
101
|
+
encoding: 'utf-8',
|
|
102
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
103
|
+
}).trim();
|
|
104
|
+
gitRepoName = path.basename(gitRepoRoot);
|
|
105
|
+
isInsideGitRepo = true;
|
|
106
|
+
}
|
|
107
|
+
catch { /* not in a git repo */ }
|
|
108
|
+
// Detect gh CLI status (no auto-install — graceful degradation)
|
|
109
|
+
let ghPath = detectGhPath();
|
|
110
|
+
let ghStatus = 'unavailable';
|
|
111
|
+
if (!ghPath) {
|
|
112
|
+
// Don't auto-install — display install guidance instead
|
|
113
|
+
console.log(pc.dim(' GitHub CLI (gh) not found. To discover cloud-backed agents:'));
|
|
114
|
+
const platform = process.platform;
|
|
115
|
+
if (platform === 'darwin') {
|
|
116
|
+
console.log(pc.dim(' brew install gh'));
|
|
117
|
+
}
|
|
118
|
+
else if (platform === 'linux') {
|
|
119
|
+
console.log(pc.dim(' sudo apt install gh'));
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
console.log(pc.dim(' https://cli.github.com/'));
|
|
123
|
+
}
|
|
124
|
+
console.log(pc.dim(' Continuing without GitHub discovery...'));
|
|
125
|
+
console.log();
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
// Check auth status
|
|
129
|
+
try {
|
|
130
|
+
execFileSync(ghPath, ['auth', 'status'], { stdio: 'pipe', timeout: 5000 });
|
|
131
|
+
ghStatus = 'ready';
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
ghStatus = 'auth-needed';
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// Check for interrupted setup
|
|
138
|
+
const existingLock = readSetupLock();
|
|
139
|
+
if (existingLock) {
|
|
140
|
+
console.log(pc.yellow(` A previous setup was interrupted during "${existingLock.phase}".`));
|
|
141
|
+
console.log(pc.dim(` Agent: ${existingLock.agentName}, started: ${existingLock.startedAt}`));
|
|
142
|
+
console.log(pc.dim(' The wizard will offer to resume or start over.'));
|
|
143
|
+
console.log();
|
|
144
|
+
}
|
|
145
|
+
// Run comprehensive discovery
|
|
146
|
+
console.log(pc.dim(' Scanning for existing agents...'));
|
|
147
|
+
const discovery = runDiscovery(projectDir, ghPath, ghStatus);
|
|
148
|
+
const scenarioContext = buildScenarioContext(discovery, isInsideGitRepo);
|
|
149
|
+
// Report discovery results
|
|
150
|
+
const totalFound = discovery.merged_agents.length;
|
|
151
|
+
if (totalFound > 0) {
|
|
152
|
+
console.log(` ${pc.green('✓')} Found ${totalFound} agent${totalFound !== 1 ? 's' : ''}`);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
console.log(` ${pc.green('✓')} No existing agents found — fresh install`);
|
|
156
|
+
}
|
|
157
|
+
if (discovery.zombie_entries.length > 0) {
|
|
158
|
+
console.log(pc.dim(` (${discovery.zombie_entries.length} stale registry entries excluded)`));
|
|
159
|
+
}
|
|
160
|
+
if (discovery.scan_errors.length > 0) {
|
|
161
|
+
for (const err of discovery.scan_errors) {
|
|
162
|
+
console.log(pc.dim(` ⚠ ${err}`));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
console.log();
|
|
166
|
+
// Build structured context for the wizard (replaces ad-hoc string interpolation)
|
|
167
|
+
const gitContext = isInsideGitRepo
|
|
168
|
+
? ` This directory is inside a git repository "${gitRepoName}" at ${gitRepoRoot}. Set up a project-bound agent here.`
|
|
169
|
+
: ' This directory is NOT inside a git repository. Set up a standalone agent at ~/.instar/agents/<name>/ using `npx instar init --standalone <name>`.';
|
|
170
|
+
// Structured JSON context — the wizard parses this, not string fragments
|
|
171
|
+
const discoveryJson = JSON.stringify(discovery, null, 2);
|
|
172
|
+
const scenarioJson = JSON.stringify(scenarioContext, null, 2);
|
|
173
|
+
const lockJson = existingLock ? JSON.stringify(existingLock, null, 2) : 'null';
|
|
174
|
+
// Pre-formatted agent summary — deterministic, not LLM-generated.
|
|
175
|
+
// Structure > Willpower: don't rely on the LLM to enumerate agents from JSON.
|
|
176
|
+
const agentSummary = buildAgentSummary(discovery);
|
|
177
|
+
const detectionContext = `
|
|
178
|
+
--- BEGIN UNTRUSTED DISCOVERY DATA (JSON) ---
|
|
179
|
+
${discoveryJson}
|
|
180
|
+
--- END UNTRUSTED DISCOVERY DATA ---
|
|
181
|
+
|
|
182
|
+
--- BEGIN SCENARIO CONTEXT (JSON) ---
|
|
183
|
+
${scenarioJson}
|
|
184
|
+
--- END SCENARIO CONTEXT ---
|
|
185
|
+
|
|
186
|
+
--- BEGIN SETUP LOCK ---
|
|
187
|
+
${lockJson}
|
|
188
|
+
--- END SETUP LOCK ---
|
|
189
|
+
|
|
190
|
+
--- BEGIN AGENT SUMMARY (display verbatim) ---
|
|
191
|
+
${agentSummary}
|
|
192
|
+
--- END AGENT SUMMARY ---`;
|
|
193
|
+
// Pre-install Playwright browser binaries AND register the MCP server so
|
|
194
|
+
// ALL Claude Code sessions (including the secret-setup micro-session) have
|
|
195
|
+
// browser automation available.
|
|
196
|
+
const instarRoot = findInstarRoot();
|
|
197
|
+
console.log(pc.dim(' Preparing browser automation...'));
|
|
198
|
+
// Step 1: Ensure .claude/settings.json has Playwright MCP registered
|
|
199
|
+
ensurePlaywrightMcp(instarRoot);
|
|
200
|
+
// Step 2: Pre-install Playwright browser binaries
|
|
201
|
+
try {
|
|
202
|
+
execFileSync('npx', ['-y', 'playwright', 'install', 'chromium'], {
|
|
203
|
+
cwd: instarRoot,
|
|
204
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
205
|
+
timeout: 120000,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
catch {
|
|
209
|
+
// Non-fatal — wizard will fall back to manual if browser isn't available
|
|
210
|
+
console.log(pc.dim(' (Browser automation may not be available — the wizard can still guide you manually)'));
|
|
211
|
+
}
|
|
212
|
+
// ── Phase Gate: Secret Management ──────────────────────────────────
|
|
213
|
+
// Structure > Willpower: secret management MUST be configured before the
|
|
214
|
+
// main wizard. Uses a Claude Code micro-session (/secret-setup) for a
|
|
215
|
+
// conversational experience. Gate: main wizard won't start without backend.json.
|
|
216
|
+
const secretContext = await ensureSecretBackend(claudePath, instarRoot);
|
|
217
|
+
// If Bitwarden session was saved by the secret-setup micro-session, pass it
|
|
218
|
+
// as an env var so the main wizard can use it for credential restoration.
|
|
219
|
+
const spawnEnv = { ...process.env };
|
|
220
|
+
const bwSessionFile = path.join(os.homedir(), '.instar', 'secrets', '.bw-session');
|
|
221
|
+
if (fs.existsSync(bwSessionFile)) {
|
|
222
|
+
const bwSession = fs.readFileSync(bwSessionFile, 'utf-8').trim();
|
|
223
|
+
if (bwSession) {
|
|
224
|
+
spawnEnv.BW_SESSION = bwSession;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
// Launch Claude Code from the instar package root (where .claude/skills/ lives)
|
|
228
|
+
const child = spawn(claudePath, [
|
|
229
|
+
'--dangerously-skip-permissions',
|
|
230
|
+
`/setup-wizard The project to set up is at: ${projectDir}.${gitContext}${detectionContext}${secretContext}`,
|
|
231
|
+
], {
|
|
232
|
+
cwd: instarRoot,
|
|
233
|
+
stdio: 'inherit',
|
|
234
|
+
env: spawnEnv,
|
|
235
|
+
});
|
|
236
|
+
return new Promise((resolve) => {
|
|
237
|
+
child.on('close', () => {
|
|
238
|
+
resolve();
|
|
239
|
+
});
|
|
240
|
+
child.on('error', (err) => {
|
|
241
|
+
console.log();
|
|
242
|
+
console.log(pc.red(` Could not launch Claude Code: ${err.message}`));
|
|
243
|
+
console.log(pc.dim(' Make sure Claude Code is installed and accessible:'));
|
|
244
|
+
console.log(` ${pc.cyan('npm install -g @anthropic-ai/claude-code')}`);
|
|
245
|
+
console.log();
|
|
246
|
+
process.exit(1);
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
// ── Phase Gate: Secret Management ──────────────────────────────────────
|
|
251
|
+
// Structure > Willpower: secret management MUST be configured before the main
|
|
252
|
+
// wizard launches. We use a Claude Code micro-session (/secret-setup skill)
|
|
253
|
+
// for this — conversational, can explain options, can answer questions, can
|
|
254
|
+
// install and configure Bitwarden end-to-end. But SCOPED to one job.
|
|
255
|
+
//
|
|
256
|
+
// The gate: setup.ts won't launch the main wizard until backend.json exists.
|
|
257
|
+
/**
|
|
258
|
+
* Ensure a secret backend is configured before the wizard launches.
|
|
259
|
+
* Returns context string to pass to the wizard so it knows secrets are handled.
|
|
260
|
+
*
|
|
261
|
+
* If backend.json already exists → skip (returns existing choice as context).
|
|
262
|
+
* If not → spawn a focused Claude Code session with the /secret-setup skill.
|
|
263
|
+
* Claude explains options, guides through Bitwarden install/login/unlock,
|
|
264
|
+
* configures the backend, and exits. Then we continue.
|
|
265
|
+
*/
|
|
266
|
+
async function ensureSecretBackend(claudePath, instarRoot) {
|
|
267
|
+
const backendFile = path.join(os.homedir(), '.instar', 'secrets', 'backend.json');
|
|
268
|
+
// Check if already configured
|
|
269
|
+
if (fs.existsSync(backendFile)) {
|
|
270
|
+
try {
|
|
271
|
+
const pref = JSON.parse(fs.readFileSync(backendFile, 'utf-8'));
|
|
272
|
+
const backend = pref.backend;
|
|
273
|
+
console.log(` ${pc.green('✓')} Secret management: ${formatBackendName(backend)}`);
|
|
274
|
+
// If Bitwarden, check for saved session and try to restore it
|
|
275
|
+
let bwSessionContext = '';
|
|
276
|
+
if (backend === 'bitwarden') {
|
|
277
|
+
const sessionFile = path.join(os.homedir(), '.instar', 'secrets', '.bw-session');
|
|
278
|
+
if (fs.existsSync(sessionFile)) {
|
|
279
|
+
const savedSession = fs.readFileSync(sessionFile, 'utf-8').trim();
|
|
280
|
+
if (savedSession) {
|
|
281
|
+
bwSessionContext = ` BW_SESSION is available — Bitwarden vault is unlocked.`;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return ` SECRET_BACKEND_CONFIGURED="${backend}". Secret management is already set up — skip Phase 2.5.${bwSessionContext}`;
|
|
286
|
+
}
|
|
287
|
+
catch {
|
|
288
|
+
// Corrupted file — fall through to micro-session
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
// Not configured — launch Claude Code micro-session for secret setup
|
|
292
|
+
console.log();
|
|
293
|
+
console.log(pc.bold(' Secret Management'));
|
|
294
|
+
console.log(pc.dim(' Your agent needs a way to store secrets securely.'));
|
|
295
|
+
console.log(pc.dim(' Let me walk you through the options...'));
|
|
296
|
+
console.log();
|
|
297
|
+
// Spawn a focused Claude Code session with the /secret-setup skill
|
|
298
|
+
const child = spawn(claudePath, [
|
|
299
|
+
'--dangerously-skip-permissions',
|
|
300
|
+
'/secret-setup',
|
|
301
|
+
], {
|
|
302
|
+
cwd: instarRoot,
|
|
303
|
+
stdio: 'inherit',
|
|
304
|
+
});
|
|
305
|
+
await new Promise((resolve) => {
|
|
306
|
+
child.on('close', () => resolve());
|
|
307
|
+
child.on('error', () => resolve());
|
|
308
|
+
});
|
|
309
|
+
// Verify the micro-session did its job — backend.json must exist now
|
|
310
|
+
if (fs.existsSync(backendFile)) {
|
|
311
|
+
try {
|
|
312
|
+
const pref = JSON.parse(fs.readFileSync(backendFile, 'utf-8'));
|
|
313
|
+
const backend = pref.backend;
|
|
314
|
+
console.log();
|
|
315
|
+
console.log(` ${pc.green('✓')} Secret management: ${formatBackendName(backend)}`);
|
|
316
|
+
let bwSessionContext = '';
|
|
317
|
+
if (backend === 'bitwarden') {
|
|
318
|
+
const sessionFile = path.join(os.homedir(), '.instar', 'secrets', '.bw-session');
|
|
319
|
+
if (fs.existsSync(sessionFile)) {
|
|
320
|
+
bwSessionContext = ` BW_SESSION is available — Bitwarden vault is unlocked.`;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return ` SECRET_BACKEND_CONFIGURED="${backend}". Secret management configured. Skip Phase 2.5.${bwSessionContext}`;
|
|
324
|
+
}
|
|
325
|
+
catch {
|
|
326
|
+
// Fall through
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
// Micro-session didn't configure a backend — fall back to local
|
|
330
|
+
console.log();
|
|
331
|
+
console.log(pc.yellow(' Secret setup was not completed. Using local encrypted store as default.'));
|
|
332
|
+
console.log(pc.dim(' You can change this later via: instar secrets backend bitwarden'));
|
|
333
|
+
console.log();
|
|
334
|
+
const { SecretManager } = await import('../core/SecretManager.js');
|
|
335
|
+
const mgr = new SecretManager({ agentName: '_setup' });
|
|
336
|
+
mgr.configureBackend('local');
|
|
337
|
+
return ` SECRET_BACKEND_CONFIGURED="local". Secret setup micro-session did not complete — defaulted to local encrypted store. Skip Phase 2.5.`;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Build a pre-formatted agent summary from discovery data.
|
|
341
|
+
* This is deterministic — the wizard displays it verbatim instead of
|
|
342
|
+
* trying to enumerate agents from JSON (which LLMs do unreliably).
|
|
343
|
+
*
|
|
344
|
+
* Includes inline numbered options so the user can type their choice.
|
|
345
|
+
* AskUserQuestion is NOT used — its overlay hides the summary text.
|
|
346
|
+
*/
|
|
347
|
+
function buildAgentSummary(discovery) {
|
|
348
|
+
const lines = [];
|
|
349
|
+
const localAgents = discovery.merged_agents.filter(a => a.source === 'local' || a.source === 'both');
|
|
350
|
+
const githubOnly = discovery.merged_agents.filter(a => a.source === 'github');
|
|
351
|
+
// Restorable = github-only agents + 'both' agents not in current directory
|
|
352
|
+
const restorable = discovery.merged_agents.filter(a => a.source === 'github' || (a.source === 'both' && !discovery.current_dir_agent?.exists));
|
|
353
|
+
if (localAgents.length === 0 && githubOnly.length === 0) {
|
|
354
|
+
lines.push('No existing agents found. Let\'s set up a new one.');
|
|
355
|
+
return lines.join('\n');
|
|
356
|
+
}
|
|
357
|
+
lines.push('I found some existing agents.');
|
|
358
|
+
lines.push('');
|
|
359
|
+
if (localAgents.length > 0) {
|
|
360
|
+
lines.push('Already running on this machine:');
|
|
361
|
+
for (const agent of localAgents) {
|
|
362
|
+
const details = [];
|
|
363
|
+
if (agent.port)
|
|
364
|
+
details.push(`port ${agent.port}`);
|
|
365
|
+
if (agent.userCount)
|
|
366
|
+
details.push(`${agent.userCount} user${agent.userCount !== 1 ? 's' : ''}`);
|
|
367
|
+
const detailStr = details.length > 0 ? ` (${details.join(', ')})` : '';
|
|
368
|
+
const backupNote = agent.source === 'both' && agent.repo ? `, backed up to ${agent.repo}` : '';
|
|
369
|
+
lines.push(`- ${agent.name}${detailStr} — already set up${backupNote}`);
|
|
370
|
+
}
|
|
371
|
+
lines.push('');
|
|
372
|
+
}
|
|
373
|
+
if (githubOnly.length > 0) {
|
|
374
|
+
lines.push('Available to restore from GitHub:');
|
|
375
|
+
for (const agent of githubOnly) {
|
|
376
|
+
const repoStr = agent.repo ? ` (${agent.repo})` : '';
|
|
377
|
+
lines.push(`- ${agent.name}${repoStr}`);
|
|
378
|
+
}
|
|
379
|
+
lines.push('');
|
|
380
|
+
}
|
|
381
|
+
// Build inline numbered options
|
|
382
|
+
lines.push('What would you like to do?');
|
|
383
|
+
lines.push('');
|
|
384
|
+
let optNum = 1;
|
|
385
|
+
for (const agent of restorable) {
|
|
386
|
+
const repoStr = agent.repo ? ` from ${agent.repo}` : '';
|
|
387
|
+
lines.push(`${optNum}. Restore ${agent.name} — clone${repoStr} and set it up here`);
|
|
388
|
+
optNum++;
|
|
389
|
+
}
|
|
390
|
+
lines.push(`${optNum}. Start fresh — create a brand new agent`);
|
|
391
|
+
lines.push('');
|
|
392
|
+
lines.push('Type a number or describe what you\'d like to do.');
|
|
393
|
+
return lines.join('\n');
|
|
394
|
+
}
|
|
395
|
+
function formatBackendName(backend) {
|
|
396
|
+
switch (backend) {
|
|
397
|
+
case 'bitwarden': return 'Bitwarden';
|
|
398
|
+
case 'local': return 'Local encrypted store';
|
|
399
|
+
case 'manual': return 'Manual (paste when prompted)';
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Register the Playwright MCP server so Claude Code has browser automation
|
|
404
|
+
* available when spawned for the setup wizard.
|
|
405
|
+
*
|
|
406
|
+
* Claude Code loads MCP servers from THREE places (NOT .claude/settings.json):
|
|
407
|
+
* 1. ~/.claude.json — user scope (top-level mcpServers) or local scope
|
|
408
|
+
* (projects["/abs/path"].mcpServers) — NO trust dialog needed
|
|
409
|
+
* 2. .mcp.json in project root — project scope — requires trust acceptance
|
|
410
|
+
*
|
|
411
|
+
* We register in BOTH places for robustness:
|
|
412
|
+
* - ~/.claude.json local scope: guaranteed to work, no trust dialog
|
|
413
|
+
* - .mcp.json: works if trust is pre-accepted or enableAllProjectMcpServers
|
|
414
|
+
*/
|
|
415
|
+
function ensurePlaywrightMcp(dir) {
|
|
416
|
+
const absDir = path.resolve(dir);
|
|
417
|
+
// ── 1. Register in ~/.claude.json at local scope (most reliable) ──
|
|
418
|
+
const claudeJsonPath = path.join(os.homedir(), '.claude.json');
|
|
419
|
+
try {
|
|
420
|
+
let claudeJson = {};
|
|
421
|
+
if (fs.existsSync(claudeJsonPath)) {
|
|
422
|
+
claudeJson = JSON.parse(fs.readFileSync(claudeJsonPath, 'utf-8'));
|
|
423
|
+
}
|
|
424
|
+
// Ensure projects map exists
|
|
425
|
+
if (!claudeJson.projects || typeof claudeJson.projects !== 'object') {
|
|
426
|
+
claudeJson.projects = {};
|
|
427
|
+
}
|
|
428
|
+
const projects = claudeJson.projects;
|
|
429
|
+
// Ensure project entry exists
|
|
430
|
+
if (!projects[absDir]) {
|
|
431
|
+
projects[absDir] = {};
|
|
432
|
+
}
|
|
433
|
+
const projectEntry = projects[absDir];
|
|
434
|
+
// Register Playwright MCP at local scope
|
|
435
|
+
if (!projectEntry.mcpServers || typeof projectEntry.mcpServers !== 'object') {
|
|
436
|
+
projectEntry.mcpServers = {};
|
|
437
|
+
}
|
|
438
|
+
const mcpServers = projectEntry.mcpServers;
|
|
439
|
+
if (!mcpServers.playwright) {
|
|
440
|
+
mcpServers.playwright = {
|
|
441
|
+
command: 'npx',
|
|
442
|
+
args: ['-y', '@playwright/mcp@latest'],
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
// Pre-accept trust so .mcp.json servers also load without a dialog
|
|
446
|
+
projectEntry.hasTrustDialogAccepted = true;
|
|
447
|
+
// Write atomically
|
|
448
|
+
const tmpPath = `${claudeJsonPath}.${process.pid}.tmp`;
|
|
449
|
+
fs.writeFileSync(tmpPath, JSON.stringify(claudeJson, null, 2));
|
|
450
|
+
fs.renameSync(tmpPath, claudeJsonPath);
|
|
451
|
+
}
|
|
452
|
+
catch {
|
|
453
|
+
// Non-fatal — .mcp.json fallback below
|
|
454
|
+
}
|
|
455
|
+
// ── 2. Also create .mcp.json in the project root (belt-and-suspenders) ──
|
|
456
|
+
const mcpJsonPath = path.join(dir, '.mcp.json');
|
|
457
|
+
if (!fs.existsSync(mcpJsonPath)) {
|
|
458
|
+
try {
|
|
459
|
+
const mcpConfig = {
|
|
460
|
+
mcpServers: {
|
|
461
|
+
playwright: {
|
|
462
|
+
command: 'npx',
|
|
463
|
+
args: ['-y', '@playwright/mcp@latest'],
|
|
464
|
+
},
|
|
465
|
+
},
|
|
466
|
+
};
|
|
467
|
+
fs.writeFileSync(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
|
|
468
|
+
}
|
|
469
|
+
catch {
|
|
470
|
+
// Non-fatal
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Find the root of the instar package (where .claude/skills/ lives).
|
|
476
|
+
* Works whether running from source, linked global, or node_modules.
|
|
477
|
+
*/
|
|
478
|
+
function findInstarRoot() {
|
|
479
|
+
// Walk up from this file to find package.json with name "instar"
|
|
480
|
+
let dir = path.dirname(new URL(import.meta.url).pathname);
|
|
481
|
+
while (dir !== path.dirname(dir)) {
|
|
482
|
+
const pkgPath = path.join(dir, 'package.json');
|
|
483
|
+
if (fs.existsSync(pkgPath)) {
|
|
484
|
+
try {
|
|
485
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
486
|
+
if (pkg.name === 'instar')
|
|
487
|
+
return dir;
|
|
488
|
+
}
|
|
489
|
+
catch { /* continue */ }
|
|
490
|
+
}
|
|
491
|
+
dir = path.dirname(dir);
|
|
492
|
+
}
|
|
493
|
+
// Fallback: assume we're in dist/commands/ — go up to root
|
|
494
|
+
return path.resolve(path.dirname(new URL(import.meta.url).pathname), '..', '..');
|
|
495
|
+
}
|
|
496
|
+
// ── Auto-Start on Login ─────────────────────────────────────────
|
|
497
|
+
/**
|
|
498
|
+
* Install auto-start so the agent's lifeline process starts on login.
|
|
499
|
+
* macOS: LaunchAgent plist in ~/Library/LaunchAgents/
|
|
500
|
+
* Linux: systemd user service in ~/.config/systemd/user/
|
|
501
|
+
*
|
|
502
|
+
* Returns true if auto-start was installed successfully.
|
|
503
|
+
*/
|
|
504
|
+
export function installAutoStart(projectName, projectDir, hasTelegram) {
|
|
505
|
+
const platform = process.platform;
|
|
506
|
+
if (platform === 'darwin') {
|
|
507
|
+
return installMacOSLaunchAgent(projectName, projectDir, hasTelegram);
|
|
508
|
+
}
|
|
509
|
+
else if (platform === 'linux') {
|
|
510
|
+
return installLinuxSystemdService(projectName, projectDir, hasTelegram);
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
// Windows or other — no auto-start support yet
|
|
514
|
+
return false;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Remove auto-start for a project.
|
|
519
|
+
*/
|
|
520
|
+
export function uninstallAutoStart(projectName) {
|
|
521
|
+
const platform = process.platform;
|
|
522
|
+
if (platform === 'darwin') {
|
|
523
|
+
const label = `ai.instar.${projectName}`;
|
|
524
|
+
const plistPath = path.join(os.homedir(), 'Library', 'LaunchAgents', `${label}.plist`);
|
|
525
|
+
// Unload if loaded
|
|
526
|
+
try {
|
|
527
|
+
execFileSync('launchctl', ['bootout', `gui/${process.getuid?.() ?? 501}`, plistPath], { stdio: 'ignore' });
|
|
528
|
+
}
|
|
529
|
+
catch { /* not loaded */ }
|
|
530
|
+
// Remove file
|
|
531
|
+
try {
|
|
532
|
+
fs.unlinkSync(plistPath);
|
|
533
|
+
return true;
|
|
534
|
+
}
|
|
535
|
+
catch {
|
|
536
|
+
return false;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
else if (platform === 'linux') {
|
|
540
|
+
const serviceName = `instar-${projectName}.service`;
|
|
541
|
+
const servicePath = path.join(os.homedir(), '.config', 'systemd', 'user', serviceName);
|
|
542
|
+
try {
|
|
543
|
+
execFileSync('systemctl', ['--user', 'disable', serviceName], { stdio: 'ignore' });
|
|
544
|
+
execFileSync('systemctl', ['--user', 'stop', serviceName], { stdio: 'ignore' });
|
|
545
|
+
}
|
|
546
|
+
catch { /* not loaded */ }
|
|
547
|
+
try {
|
|
548
|
+
fs.unlinkSync(servicePath);
|
|
549
|
+
execFileSync('systemctl', ['--user', 'daemon-reload'], { stdio: 'ignore' });
|
|
550
|
+
return true;
|
|
551
|
+
}
|
|
552
|
+
catch {
|
|
553
|
+
return false;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
return false;
|
|
557
|
+
}
|
|
558
|
+
function findNodePath() {
|
|
559
|
+
try {
|
|
560
|
+
return execFileSync('which', ['node'], {
|
|
561
|
+
encoding: 'utf-8',
|
|
562
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
563
|
+
}).trim();
|
|
564
|
+
}
|
|
565
|
+
catch {
|
|
566
|
+
return '/usr/local/bin/node';
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Resolve multiple candidate node paths for robustness.
|
|
571
|
+
* Returns all valid node binary paths found on this system, ordered by preference.
|
|
572
|
+
* Used to create fallback-aware boot wrappers that survive NVM/asdf version switches.
|
|
573
|
+
*/
|
|
574
|
+
function resolveNodeCandidates() {
|
|
575
|
+
const candidates = new Set();
|
|
576
|
+
// 1. Current session's node (most likely correct)
|
|
577
|
+
try {
|
|
578
|
+
const current = execFileSync('which', ['node'], {
|
|
579
|
+
encoding: 'utf-8',
|
|
580
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
581
|
+
}).trim();
|
|
582
|
+
if (current && fs.existsSync(current))
|
|
583
|
+
candidates.add(current);
|
|
584
|
+
}
|
|
585
|
+
catch { /* not found */ }
|
|
586
|
+
// 2. process.execPath — the node that's running THIS process right now
|
|
587
|
+
if (fs.existsSync(process.execPath))
|
|
588
|
+
candidates.add(process.execPath);
|
|
589
|
+
// 3. Well-known stable paths (survive NVM/asdf switches)
|
|
590
|
+
const wellKnown = [
|
|
591
|
+
'/opt/homebrew/bin/node', // Apple Silicon homebrew
|
|
592
|
+
'/usr/local/bin/node', // Intel homebrew / manual install
|
|
593
|
+
'/usr/bin/node', // System node (rare on macOS)
|
|
594
|
+
];
|
|
595
|
+
for (const p of wellKnown) {
|
|
596
|
+
if (fs.existsSync(p))
|
|
597
|
+
candidates.add(p);
|
|
598
|
+
}
|
|
599
|
+
// 4. Homebrew cellar (follows any installed version)
|
|
600
|
+
try {
|
|
601
|
+
const brewPrefix = execFileSync('brew', ['--prefix', 'node'], {
|
|
602
|
+
encoding: 'utf-8',
|
|
603
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
604
|
+
timeout: 5000,
|
|
605
|
+
}).trim();
|
|
606
|
+
const brewNode = path.join(brewPrefix, 'bin', 'node');
|
|
607
|
+
if (fs.existsSync(brewNode))
|
|
608
|
+
candidates.add(brewNode);
|
|
609
|
+
}
|
|
610
|
+
catch { /* brew not installed or node not installed via brew */ }
|
|
611
|
+
return [...candidates];
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Create or update a stable node symlink at .instar/bin/node.
|
|
615
|
+
*
|
|
616
|
+
* The plist references this symlink instead of a hardcoded node path.
|
|
617
|
+
* This way, when node moves (NVM switch, homebrew upgrade), we only
|
|
618
|
+
* need to update the symlink — not regenerate the entire plist.
|
|
619
|
+
*
|
|
620
|
+
* Returns the symlink path.
|
|
621
|
+
*/
|
|
622
|
+
export function ensureStableNodeSymlink(projectDir) {
|
|
623
|
+
const binDir = path.join(projectDir, '.instar', 'bin');
|
|
624
|
+
const symlinkPath = path.join(binDir, 'node');
|
|
625
|
+
const nodePath = findNodePath();
|
|
626
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
627
|
+
// Check if symlink exists and is valid
|
|
628
|
+
try {
|
|
629
|
+
const target = fs.readlinkSync(symlinkPath);
|
|
630
|
+
if (fs.existsSync(target)) {
|
|
631
|
+
// Symlink exists and points to a valid node — update only if we found a newer/better one
|
|
632
|
+
if (target === nodePath)
|
|
633
|
+
return symlinkPath;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
catch { /* symlink doesn't exist or is broken */ }
|
|
637
|
+
// Create/update the symlink
|
|
638
|
+
try {
|
|
639
|
+
fs.unlinkSync(symlinkPath);
|
|
640
|
+
}
|
|
641
|
+
catch { /* didn't exist */ }
|
|
642
|
+
fs.symlinkSync(nodePath, symlinkPath);
|
|
643
|
+
// Also write the candidate list for the JS boot wrapper's fallback logic
|
|
644
|
+
const candidates = resolveNodeCandidates();
|
|
645
|
+
fs.writeFileSync(path.join(binDir, 'node-candidates.json'), JSON.stringify({ primary: nodePath, candidates, updatedAt: new Date().toISOString() }, null, 2));
|
|
646
|
+
return symlinkPath;
|
|
647
|
+
}
|
|
648
|
+
function findInstarCli() {
|
|
649
|
+
// Find the actual instar CLI entry point
|
|
650
|
+
// CRITICAL: Never resolve to an npx cache path. When users run `npx instar setup`,
|
|
651
|
+
// import.meta.url points to the npx cache. If we bake that path into the launchd
|
|
652
|
+
// plist, `npm install -g` updates won't reach the running binary (the npx cache
|
|
653
|
+
// is a separate copy). This caused an infinite update→notify→restart loop (v0.12.12).
|
|
654
|
+
try {
|
|
655
|
+
const globalPath = execFileSync('which', ['instar'], {
|
|
656
|
+
encoding: 'utf-8',
|
|
657
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
658
|
+
}).trim();
|
|
659
|
+
if (globalPath && !globalPath.includes('.npm/_npx')) {
|
|
660
|
+
return globalPath;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
catch { /* not global */ }
|
|
664
|
+
// Try resolving from npm's global prefix (works even when `which` fails)
|
|
665
|
+
try {
|
|
666
|
+
const prefix = execFileSync('npm', ['prefix', '-g'], {
|
|
667
|
+
encoding: 'utf-8',
|
|
668
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
669
|
+
}).trim();
|
|
670
|
+
const globalCli = path.join(prefix, 'lib', 'node_modules', 'instar', 'dist', 'cli.js');
|
|
671
|
+
if (fs.existsSync(globalCli)) {
|
|
672
|
+
return globalCli;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
catch { /* npm prefix failed */ }
|
|
676
|
+
// Fallback: use the dist/cli.js from the npm package — but ONLY if not in npx cache
|
|
677
|
+
const cliPath = new URL('../cli.js', import.meta.url).pathname;
|
|
678
|
+
if (fs.existsSync(cliPath) && !cliPath.includes('.npm/_npx')) {
|
|
679
|
+
return cliPath;
|
|
680
|
+
}
|
|
681
|
+
// Last resort: if everything points to npx cache, warn and use bare command name.
|
|
682
|
+
// The plist will need PATH to resolve it, but at least it won't be pinned to a stale cache.
|
|
683
|
+
if (cliPath.includes('.npm/_npx')) {
|
|
684
|
+
console.warn('[setup] WARNING: Running from npx cache. The launchd plist will use bare "instar" command.\n' +
|
|
685
|
+
' Auto-updates are handled via shadow installs — no global install needed.');
|
|
686
|
+
}
|
|
687
|
+
return 'instar';
|
|
688
|
+
}
|
|
689
|
+
function escapeXml(str) {
|
|
690
|
+
return str
|
|
691
|
+
.replace(/&/g, '&')
|
|
692
|
+
.replace(/</g, '<')
|
|
693
|
+
.replace(/>/g, '>')
|
|
694
|
+
.replace(/"/g, '"')
|
|
695
|
+
.replace(/'/g, ''');
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Generate and install boot wrapper scripts that resolve the shadow install
|
|
699
|
+
* binary at runtime. This ensures machine reboots pick up the auto-updated
|
|
700
|
+
* version instead of the version that was global at setup time.
|
|
701
|
+
*
|
|
702
|
+
* The shadow install is the sole source of truth — no fallback to global.
|
|
703
|
+
* If the shadow install is missing, the wrapper fails loudly instead of
|
|
704
|
+
* silently running a stale global binary (which causes version confusion).
|
|
705
|
+
*
|
|
706
|
+
* Two wrappers are generated:
|
|
707
|
+
* - instar-boot.sh — bash wrapper for manual use / Linux systemd
|
|
708
|
+
* - instar-boot.js — Node.js wrapper for macOS launchd (avoids /bin/bash TCC)
|
|
709
|
+
*
|
|
710
|
+
* On macOS, launchd spawns /bin/bash without Full Disk Access permissions,
|
|
711
|
+
* causing "Operation not permitted" when accessing project directories.
|
|
712
|
+
* Using node directly as the plist entry point bypasses this because
|
|
713
|
+
* user-installed binaries (homebrew, nvm) are not subject to TCC restrictions.
|
|
714
|
+
*/
|
|
715
|
+
function installBootWrapper(projectDir) {
|
|
716
|
+
const stateDir = path.join(projectDir, '.instar');
|
|
717
|
+
const shPath = path.join(stateDir, 'instar-boot.sh');
|
|
718
|
+
// Use .cjs extension if the project has "type": "module" in package.json.
|
|
719
|
+
// Without this, Node treats the boot wrapper as ESM and `require()` fails.
|
|
720
|
+
let usesCjs = false;
|
|
721
|
+
try {
|
|
722
|
+
const pkgJson = JSON.parse(fs.readFileSync(path.join(projectDir, 'package.json'), 'utf-8'));
|
|
723
|
+
usesCjs = pkgJson.type === 'module';
|
|
724
|
+
}
|
|
725
|
+
catch { /* no package.json or parse error — use .js */ }
|
|
726
|
+
const jsExt = usesCjs ? '.cjs' : '.js';
|
|
727
|
+
const jsPath = path.join(stateDir, `instar-boot${jsExt}`);
|
|
728
|
+
// Clean up the other extension if it exists (prevents stale wrapper confusion)
|
|
729
|
+
const altPath = path.join(stateDir, `instar-boot${usesCjs ? '.js' : '.cjs'}`);
|
|
730
|
+
try {
|
|
731
|
+
fs.unlinkSync(altPath);
|
|
732
|
+
}
|
|
733
|
+
catch { /* didn't exist */ }
|
|
734
|
+
const shadowCli = path.join(stateDir, 'shadow-install', 'node_modules', 'instar', 'dist', 'cli.js');
|
|
735
|
+
const shadowDir = path.join(stateDir, 'shadow-install');
|
|
736
|
+
const crashFile = path.join(stateDir, 'state', 'boot-crashes.txt');
|
|
737
|
+
// ── Bash wrapper (for manual use, Linux systemd, backward compat) ──
|
|
738
|
+
const bashWrapper = `#!/bin/bash
|
|
739
|
+
# Instar boot wrapper — generated by 'instar setup'
|
|
740
|
+
# Shadow install is the sole source of truth. No global fallback.
|
|
741
|
+
SHADOW="${shadowCli}"
|
|
742
|
+
SHADOW_DIR="${shadowDir}"
|
|
743
|
+
CRASH_FILE="${crashFile}"
|
|
744
|
+
|
|
745
|
+
if [ ! -f "$SHADOW" ]; then
|
|
746
|
+
echo "ERROR: Shadow install not found at $SHADOW" >&2
|
|
747
|
+
echo "Run: npm install instar --prefix ${stateDir}/shadow-install" >&2
|
|
748
|
+
exit 1
|
|
749
|
+
fi
|
|
750
|
+
|
|
751
|
+
# Strip extended attributes that may block launchd's restricted sandbox.
|
|
752
|
+
# com.apple.quarantine is removable; com.apple.provenance silently fails on macOS 15+.
|
|
753
|
+
if command -v xattr >/dev/null 2>&1; then
|
|
754
|
+
xattr -rd com.apple.quarantine "$SHADOW_DIR" 2>/dev/null || true
|
|
755
|
+
xattr -rd com.apple.provenance "$SHADOW_DIR" 2>/dev/null || true
|
|
756
|
+
fi
|
|
757
|
+
|
|
758
|
+
# Crash loop protection: if node fails rapidly, back off before exiting.
|
|
759
|
+
# Prevents launchd KeepAlive from spinning at max speed on persistent errors.
|
|
760
|
+
mkdir -p "$(dirname "$CRASH_FILE")" 2>/dev/null
|
|
761
|
+
node "$SHADOW" "$@"
|
|
762
|
+
EXIT_CODE=$?
|
|
763
|
+
|
|
764
|
+
if [ $EXIT_CODE -ne 0 ]; then
|
|
765
|
+
echo "$(date -u +%s)" >> "$CRASH_FILE"
|
|
766
|
+
# Count crashes in the last 120 seconds
|
|
767
|
+
NOW=$(date -u +%s)
|
|
768
|
+
RECENT=$(awk -v now="$NOW" '$1 > now - 120' "$CRASH_FILE" 2>/dev/null | wc -l | tr -d ' ')
|
|
769
|
+
if [ "$RECENT" -ge 3 ]; then
|
|
770
|
+
BACKOFF=$((RECENT * 10))
|
|
771
|
+
[ "$BACKOFF" -gt 120 ] && BACKOFF=120
|
|
772
|
+
echo "[instar-boot] Crash loop detected ($RECENT crashes in 120s). Backing off \${BACKOFF}s..." >&2
|
|
773
|
+
sleep $BACKOFF
|
|
774
|
+
fi
|
|
775
|
+
# Trim crash file to last 20 entries
|
|
776
|
+
tail -20 "$CRASH_FILE" > "$CRASH_FILE.tmp" 2>/dev/null && mv "$CRASH_FILE.tmp" "$CRASH_FILE" 2>/dev/null
|
|
777
|
+
exit $EXIT_CODE
|
|
778
|
+
fi
|
|
779
|
+
|
|
780
|
+
# Clean exit — clear crash history
|
|
781
|
+
rm -f "$CRASH_FILE" 2>/dev/null
|
|
782
|
+
`;
|
|
783
|
+
// ── Node.js wrapper (for macOS launchd — bypasses /bin/bash TCC) ──
|
|
784
|
+
//
|
|
785
|
+
// The plist references .instar/bin/node (a stable symlink) to execute this wrapper.
|
|
786
|
+
// If the symlink breaks (NVM switch, homebrew upgrade), launchd can't even start
|
|
787
|
+
// this script — that's the chicken-and-egg problem.
|
|
788
|
+
//
|
|
789
|
+
// To mitigate: this wrapper self-heals the node symlink on every successful boot,
|
|
790
|
+
// ensuring the NEXT restart will work even if node moved between boots.
|
|
791
|
+
// For the initial bootstrap gap, the plist includes the full PATH env var so
|
|
792
|
+
// launchd can resolve commands, and we use well-known fallback paths.
|
|
793
|
+
const nodeSymlinkDir = path.join(stateDir, 'bin');
|
|
794
|
+
const nodeCandidatesFile = path.join(nodeSymlinkDir, 'node-candidates.json');
|
|
795
|
+
const jsWrapper = `#!/usr/bin/env node
|
|
796
|
+
/**
|
|
797
|
+
* Instar boot wrapper (Node.js) — generated by 'instar setup'
|
|
798
|
+
*
|
|
799
|
+
* This replaces /bin/bash as the launchd entry point on macOS.
|
|
800
|
+
* On macOS Sequoia+, launchd-spawned /bin/bash lacks Full Disk Access,
|
|
801
|
+
* causing "Operation not permitted" when accessing project files.
|
|
802
|
+
* User-installed node (homebrew, nvm) is not subject to TCC restrictions.
|
|
803
|
+
*
|
|
804
|
+
* Shadow install is the sole source of truth. No global fallback.
|
|
805
|
+
*/
|
|
806
|
+
const { execFileSync, spawn } = require('child_process');
|
|
807
|
+
const fs = require('fs');
|
|
808
|
+
const path = require('path');
|
|
809
|
+
const os = require('os');
|
|
810
|
+
|
|
811
|
+
const SHADOW = ${JSON.stringify(shadowCli)};
|
|
812
|
+
const SHADOW_DIR = ${JSON.stringify(shadowDir)};
|
|
813
|
+
const CRASH_FILE = ${JSON.stringify(crashFile)};
|
|
814
|
+
const NODE_SYMLINK = ${JSON.stringify(path.join(nodeSymlinkDir, 'node'))};
|
|
815
|
+
const NODE_CANDIDATES_FILE = ${JSON.stringify(nodeCandidatesFile)};
|
|
816
|
+
|
|
817
|
+
// ── Self-heal node symlink ──
|
|
818
|
+
// Update the stable node symlink to point at the node binary that's
|
|
819
|
+
// currently running us. This ensures the NEXT launchd restart will work
|
|
820
|
+
// even if node moved (NVM switch, homebrew upgrade) since the last boot.
|
|
821
|
+
function selfHealNodeSymlink() {
|
|
822
|
+
try {
|
|
823
|
+
const currentNode = process.execPath;
|
|
824
|
+
const symlinkDir = path.dirname(NODE_SYMLINK);
|
|
825
|
+
fs.mkdirSync(symlinkDir, { recursive: true });
|
|
826
|
+
|
|
827
|
+
// Check if symlink already points to current node
|
|
828
|
+
try {
|
|
829
|
+
const target = fs.readlinkSync(NODE_SYMLINK);
|
|
830
|
+
if (target === currentNode) return; // already correct
|
|
831
|
+
} catch { /* broken or missing — will recreate */ }
|
|
832
|
+
|
|
833
|
+
// Update symlink
|
|
834
|
+
try { fs.unlinkSync(NODE_SYMLINK); } catch { /* didn't exist */ }
|
|
835
|
+
fs.symlinkSync(currentNode, NODE_SYMLINK);
|
|
836
|
+
|
|
837
|
+
// Update candidates file for diagnostics
|
|
838
|
+
const candidates = [currentNode];
|
|
839
|
+
const wellKnown = ['/opt/homebrew/bin/node', '/usr/local/bin/node', '/usr/bin/node'];
|
|
840
|
+
for (const p of wellKnown) {
|
|
841
|
+
if (p !== currentNode && fs.existsSync(p)) candidates.push(p);
|
|
842
|
+
}
|
|
843
|
+
fs.writeFileSync(NODE_CANDIDATES_FILE, JSON.stringify({
|
|
844
|
+
primary: currentNode,
|
|
845
|
+
candidates: candidates,
|
|
846
|
+
updatedAt: new Date().toISOString(),
|
|
847
|
+
updatedBy: 'instar-boot.js',
|
|
848
|
+
}, null, 2));
|
|
849
|
+
|
|
850
|
+
process.stderr.write('[instar-boot] Node symlink self-healed: ' + NODE_SYMLINK + ' -> ' + currentNode + '\\n');
|
|
851
|
+
} catch (err) {
|
|
852
|
+
// Non-fatal — symlink update is best-effort
|
|
853
|
+
process.stderr.write('[instar-boot] Node symlink self-heal failed (non-critical): ' + err.message + '\\n');
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
selfHealNodeSymlink();
|
|
858
|
+
|
|
859
|
+
// Verify shadow install exists
|
|
860
|
+
if (!fs.existsSync(SHADOW)) {
|
|
861
|
+
process.stderr.write('ERROR: Shadow install not found at ' + SHADOW + '\\n');
|
|
862
|
+
process.stderr.write('Run: npm install instar --prefix ' + ${JSON.stringify(stateDir + '/shadow-install')} + '\\n');
|
|
863
|
+
process.exit(1);
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
// Strip macOS extended attributes that may block launchd's restricted sandbox
|
|
867
|
+
if (os.platform() === 'darwin') {
|
|
868
|
+
try {
|
|
869
|
+
execFileSync('xattr', ['-rd', 'com.apple.quarantine', SHADOW_DIR], { stdio: 'ignore' });
|
|
870
|
+
} catch { /* no quarantine to remove — fine */ }
|
|
871
|
+
try {
|
|
872
|
+
execFileSync('xattr', ['-rd', 'com.apple.provenance', SHADOW_DIR], { stdio: 'ignore' });
|
|
873
|
+
} catch { /* provenance is kernel-protected on macOS 15+ — fine */ }
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
// Ensure crash file directory exists
|
|
877
|
+
const crashDir = path.dirname(CRASH_FILE);
|
|
878
|
+
fs.mkdirSync(crashDir, { recursive: true });
|
|
879
|
+
|
|
880
|
+
// Spawn the CLI as a child process and wait for exit
|
|
881
|
+
const args = process.argv.slice(2);
|
|
882
|
+
const child = spawn(process.execPath, [SHADOW, ...args], {
|
|
883
|
+
stdio: 'inherit',
|
|
884
|
+
env: process.env,
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
child.on('exit', (code, signal) => {
|
|
888
|
+
const exitCode = code ?? (signal ? 1 : 0);
|
|
889
|
+
|
|
890
|
+
if (exitCode !== 0) {
|
|
891
|
+
// Record crash timestamp
|
|
892
|
+
const now = Math.floor(Date.now() / 1000);
|
|
893
|
+
fs.appendFileSync(CRASH_FILE, now + '\\n');
|
|
894
|
+
|
|
895
|
+
// Count crashes in the last 120 seconds
|
|
896
|
+
try {
|
|
897
|
+
const lines = fs.readFileSync(CRASH_FILE, 'utf-8').trim().split('\\n');
|
|
898
|
+
const cutoff = now - 120;
|
|
899
|
+
const recent = lines.filter(l => parseInt(l, 10) > cutoff).length;
|
|
900
|
+
|
|
901
|
+
if (recent >= 3) {
|
|
902
|
+
const backoff = Math.min(recent * 10, 120);
|
|
903
|
+
process.stderr.write('[instar-boot] Crash loop detected (' + recent + ' crashes in 120s). Backing off ' + backoff + 's...\\n');
|
|
904
|
+
// Block before exiting so launchd KeepAlive doesn't spin
|
|
905
|
+
execFileSync('sleep', [String(backoff)], { stdio: 'ignore' });
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
// Trim crash file to last 20 entries
|
|
909
|
+
if (lines.length > 20) {
|
|
910
|
+
fs.writeFileSync(CRASH_FILE, lines.slice(-20).join('\\n') + '\\n');
|
|
911
|
+
}
|
|
912
|
+
} catch { /* crash file read failed — not critical */ }
|
|
913
|
+
|
|
914
|
+
process.exit(exitCode);
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
// Clean exit — clear crash history
|
|
918
|
+
try { fs.unlinkSync(CRASH_FILE); } catch { /* ok */ }
|
|
919
|
+
process.exit(0);
|
|
920
|
+
});
|
|
921
|
+
|
|
922
|
+
child.on('error', (err) => {
|
|
923
|
+
process.stderr.write('[instar-boot] Failed to spawn CLI: ' + err.message + '\\n');
|
|
924
|
+
process.exit(1);
|
|
925
|
+
});
|
|
926
|
+
`;
|
|
927
|
+
fs.mkdirSync(stateDir, { recursive: true });
|
|
928
|
+
fs.writeFileSync(shPath, bashWrapper, { mode: 0o755 });
|
|
929
|
+
fs.writeFileSync(jsPath, jsWrapper, { mode: 0o755 });
|
|
930
|
+
return { sh: shPath, js: jsPath };
|
|
931
|
+
}
|
|
932
|
+
function installMacOSLaunchAgent(projectName, projectDir, hasTelegram) {
|
|
933
|
+
const label = `ai.instar.${projectName}`;
|
|
934
|
+
const launchAgentsDir = path.join(os.homedir(), 'Library', 'LaunchAgents');
|
|
935
|
+
const plistPath = path.join(launchAgentsDir, `${label}.plist`);
|
|
936
|
+
const logDir = path.join(projectDir, '.instar', 'logs');
|
|
937
|
+
// Install boot wrappers that resolve shadow install at startup time.
|
|
938
|
+
// This ensures machine reboots use the auto-updated version, not the version
|
|
939
|
+
// that was global when setup ran. See: github issue / cluster-shadow-install-*
|
|
940
|
+
const wrappers = installBootWrapper(projectDir);
|
|
941
|
+
// Determine what to start: lifeline if Telegram configured, otherwise just the server
|
|
942
|
+
const command = hasTelegram ? 'lifeline' : 'server';
|
|
943
|
+
const args = hasTelegram
|
|
944
|
+
? ['lifeline', 'start', '--dir', projectDir]
|
|
945
|
+
: ['server', 'start', '--foreground', '--dir', projectDir];
|
|
946
|
+
// Use node + JS wrapper instead of /bin/bash + shell wrapper.
|
|
947
|
+
// On macOS Sequoia+, launchd-spawned /bin/bash lacks Full Disk Access (TCC),
|
|
948
|
+
// causing "Operation not permitted" on project files. User-installed node
|
|
949
|
+
// (homebrew, nvm) is not subject to TCC restrictions.
|
|
950
|
+
//
|
|
951
|
+
// We use a stable symlink (.instar/bin/node) so NVM/asdf version switches
|
|
952
|
+
// don't break the plist. The symlink is updated by self-healing on every startup.
|
|
953
|
+
const nodeSymlink = ensureStableNodeSymlink(projectDir);
|
|
954
|
+
const programArgs = [nodeSymlink, wrappers.js, ...args];
|
|
955
|
+
// Build the plist XML
|
|
956
|
+
const argsXml = programArgs.map(a => ` <string>${escapeXml(a)}</string>`).join('\n');
|
|
957
|
+
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
958
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
959
|
+
<plist version="1.0">
|
|
960
|
+
<dict>
|
|
961
|
+
<key>Label</key>
|
|
962
|
+
<string>${escapeXml(label)}</string>
|
|
963
|
+
<key>ProgramArguments</key>
|
|
964
|
+
<array>
|
|
965
|
+
${argsXml}
|
|
966
|
+
</array>
|
|
967
|
+
<key>WorkingDirectory</key>
|
|
968
|
+
<string>${escapeXml(projectDir)}</string>
|
|
969
|
+
<key>RunAtLoad</key>
|
|
970
|
+
<true/>
|
|
971
|
+
<key>KeepAlive</key>
|
|
972
|
+
<true/>
|
|
973
|
+
<key>StandardOutPath</key>
|
|
974
|
+
<string>${escapeXml(path.join(logDir, `${command}-launchd.log`))}</string>
|
|
975
|
+
<key>StandardErrorPath</key>
|
|
976
|
+
<string>${escapeXml(path.join(logDir, `${command}-launchd.err`))}</string>
|
|
977
|
+
<key>EnvironmentVariables</key>
|
|
978
|
+
<dict>
|
|
979
|
+
<key>PATH</key>
|
|
980
|
+
<string>${escapeXml(process.env.PATH || '/usr/local/bin:/usr/bin:/bin')}</string>
|
|
981
|
+
</dict>
|
|
982
|
+
<key>ThrottleInterval</key>
|
|
983
|
+
<integer>10</integer>
|
|
984
|
+
</dict>
|
|
985
|
+
</plist>`;
|
|
986
|
+
try {
|
|
987
|
+
fs.mkdirSync(launchAgentsDir, { recursive: true });
|
|
988
|
+
fs.mkdirSync(logDir, { recursive: true });
|
|
989
|
+
fs.writeFileSync(plistPath, plist);
|
|
990
|
+
// Load the agent
|
|
991
|
+
try {
|
|
992
|
+
// Unload first if already loaded
|
|
993
|
+
execFileSync('launchctl', ['bootout', `gui/${process.getuid?.() ?? 501}`, plistPath], { stdio: 'ignore' });
|
|
994
|
+
}
|
|
995
|
+
catch { /* not loaded yet — fine */ }
|
|
996
|
+
execFileSync('launchctl', ['bootstrap', `gui/${process.getuid?.() ?? 501}`, plistPath], { stdio: 'ignore' });
|
|
997
|
+
return true;
|
|
998
|
+
}
|
|
999
|
+
catch {
|
|
1000
|
+
return false;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
function installLinuxSystemdService(projectName, projectDir, hasTelegram) {
|
|
1004
|
+
const serviceName = `instar-${projectName}.service`;
|
|
1005
|
+
const serviceDir = path.join(os.homedir(), '.config', 'systemd', 'user');
|
|
1006
|
+
const servicePath = path.join(serviceDir, serviceName);
|
|
1007
|
+
const nodePath = findNodePath();
|
|
1008
|
+
const instarCli = findInstarCli();
|
|
1009
|
+
const command = hasTelegram ? 'lifeline' : 'server';
|
|
1010
|
+
const args = hasTelegram
|
|
1011
|
+
? `${instarCli} lifeline start --dir ${projectDir}`
|
|
1012
|
+
: `${instarCli} server start --foreground --dir ${projectDir}`;
|
|
1013
|
+
const isNodeScript = instarCli.endsWith('.js') || instarCli.endsWith('.mjs');
|
|
1014
|
+
const execStart = isNodeScript ? `${nodePath} ${args}` : args;
|
|
1015
|
+
const service = `[Unit]
|
|
1016
|
+
Description=Instar Agent - ${projectName}
|
|
1017
|
+
After=network.target
|
|
1018
|
+
|
|
1019
|
+
[Service]
|
|
1020
|
+
Type=simple
|
|
1021
|
+
ExecStart=${execStart}
|
|
1022
|
+
WorkingDirectory=${projectDir}
|
|
1023
|
+
Restart=always
|
|
1024
|
+
RestartSec=10
|
|
1025
|
+
Environment=PATH=${process.env.PATH || '/usr/local/bin:/usr/bin:/bin'}
|
|
1026
|
+
|
|
1027
|
+
[Install]
|
|
1028
|
+
WantedBy=default.target
|
|
1029
|
+
`;
|
|
1030
|
+
try {
|
|
1031
|
+
fs.mkdirSync(serviceDir, { recursive: true });
|
|
1032
|
+
fs.writeFileSync(servicePath, service);
|
|
1033
|
+
execFileSync('systemctl', ['--user', 'daemon-reload'], { stdio: 'ignore' });
|
|
1034
|
+
execFileSync('systemctl', ['--user', 'enable', serviceName], { stdio: 'ignore' });
|
|
1035
|
+
execFileSync('systemctl', ['--user', 'start', serviceName], { stdio: 'ignore' });
|
|
1036
|
+
return true;
|
|
1037
|
+
}
|
|
1038
|
+
catch {
|
|
1039
|
+
return false;
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Run setup without the LLM wizard. Requires all necessary flags.
|
|
1044
|
+
* Returns exit code 0 on success, throws on failure.
|
|
1045
|
+
*/
|
|
1046
|
+
export async function runNonInteractiveSetup(opts) {
|
|
1047
|
+
const { resolveScenario } = await import('./discovery.js');
|
|
1048
|
+
// Validate required flags
|
|
1049
|
+
const missing = [];
|
|
1050
|
+
if (!opts.name)
|
|
1051
|
+
missing.push('--name');
|
|
1052
|
+
if (!opts.user)
|
|
1053
|
+
missing.push('--user');
|
|
1054
|
+
if (!opts.scenario)
|
|
1055
|
+
missing.push('--scenario');
|
|
1056
|
+
if (missing.length > 0) {
|
|
1057
|
+
console.error(pc.red(`\n Missing required flags for non-interactive setup: ${missing.join(', ')}`));
|
|
1058
|
+
console.error(pc.dim('\n Example:'));
|
|
1059
|
+
console.error(pc.dim(' npx instar setup --non-interactive --name my-agent --user deploy-bot --scenario 3'));
|
|
1060
|
+
console.error(pc.dim('\n Scenarios: 1-8 (see docs/specs/GUIDED-SETUP-SPEC.md for details)\n'));
|
|
1061
|
+
process.exit(1);
|
|
1062
|
+
}
|
|
1063
|
+
const scenarioNum = parseInt(opts.scenario, 10);
|
|
1064
|
+
if (isNaN(scenarioNum) || scenarioNum < 1 || scenarioNum > 8) {
|
|
1065
|
+
console.error(pc.red(`\n Invalid scenario: ${opts.scenario}. Must be 1-8.\n`));
|
|
1066
|
+
process.exit(1);
|
|
1067
|
+
}
|
|
1068
|
+
const projectDir = process.cwd();
|
|
1069
|
+
const agentName = opts.name;
|
|
1070
|
+
const userName = opts.user;
|
|
1071
|
+
// Determine setup type from scenario
|
|
1072
|
+
const isRepo = [3, 4, 5, 6].includes(scenarioNum);
|
|
1073
|
+
const isMultiUser = [5, 6, 7, 8].includes(scenarioNum);
|
|
1074
|
+
const isMultiMachine = [2, 4, 6, 7].includes(scenarioNum);
|
|
1075
|
+
console.log(pc.bold(`\n Non-interactive setup: ${agentName}`));
|
|
1076
|
+
console.log(pc.dim(` Scenario ${scenarioNum}: ${isRepo ? 'repo' : 'standalone'}, ${isMultiUser ? 'multi' : 'single'}-user, ${isMultiMachine ? 'multi' : 'single'}-machine`));
|
|
1077
|
+
// Create agent directory structure
|
|
1078
|
+
const stateDir = isRepo
|
|
1079
|
+
? path.join(projectDir, '.instar')
|
|
1080
|
+
: path.join(os.homedir(), '.instar', 'agents', agentName, '.instar');
|
|
1081
|
+
const agentDir = isRepo ? projectDir : path.join(os.homedir(), '.instar', 'agents', agentName);
|
|
1082
|
+
fs.mkdirSync(path.join(stateDir, 'state', 'sessions'), { recursive: true });
|
|
1083
|
+
fs.mkdirSync(path.join(stateDir, 'state', 'jobs'), { recursive: true });
|
|
1084
|
+
fs.mkdirSync(path.join(stateDir, 'logs'), { recursive: true });
|
|
1085
|
+
// Build config
|
|
1086
|
+
const config = {
|
|
1087
|
+
projectName: agentName,
|
|
1088
|
+
port: allocatePortSafe(agentDir),
|
|
1089
|
+
sessions: {
|
|
1090
|
+
tmuxPath: '/opt/homebrew/bin/tmux',
|
|
1091
|
+
claudePath: '/usr/local/bin/claude',
|
|
1092
|
+
projectDir: agentDir,
|
|
1093
|
+
maxSessions: 10,
|
|
1094
|
+
protectedSessions: [`${agentName}-server`],
|
|
1095
|
+
completionPatterns: ['has been automatically paused', 'Session ended', 'Interrupted by user'],
|
|
1096
|
+
},
|
|
1097
|
+
scheduler: { jobsFile: path.join(stateDir, 'jobs.json'), enabled: true, maxParallelJobs: 1 },
|
|
1098
|
+
users: [],
|
|
1099
|
+
messaging: [],
|
|
1100
|
+
monitoring: { quotaTracking: false, memoryMonitoring: true, healthCheckIntervalMs: 30000 },
|
|
1101
|
+
};
|
|
1102
|
+
// Add Telegram if provided
|
|
1103
|
+
if (opts.telegramToken && opts.telegramGroup) {
|
|
1104
|
+
// Validate chatId is numeric (Telegram chat IDs are integers, typically negative for groups)
|
|
1105
|
+
// Users sometimes paste invite links (t.me/+ABC123) or link hashes instead of the numeric ID
|
|
1106
|
+
let chatId = opts.telegramGroup.trim();
|
|
1107
|
+
let chatIdValid = /^-?\d+$/.test(chatId);
|
|
1108
|
+
if (!chatIdValid) {
|
|
1109
|
+
console.warn(`[setup] ⚠️ Telegram chatId "${chatId}" does not look like a numeric chat ID.`);
|
|
1110
|
+
console.warn('[setup] Telegram chat IDs are integers (e.g., -1001234567890 for supergroups).');
|
|
1111
|
+
console.warn('[setup] Attempting to resolve via Telegram API...');
|
|
1112
|
+
try {
|
|
1113
|
+
const res = await fetch(`https://api.telegram.org/bot${opts.telegramToken}/getChat`, {
|
|
1114
|
+
method: 'POST',
|
|
1115
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1116
|
+
body: JSON.stringify({ chat_id: chatId }),
|
|
1117
|
+
});
|
|
1118
|
+
const data = await res.json();
|
|
1119
|
+
if (data.ok && data.result?.id) {
|
|
1120
|
+
chatId = String(data.result.id);
|
|
1121
|
+
chatIdValid = true;
|
|
1122
|
+
console.log(`[setup] ✓ Resolved to numeric chat ID: ${chatId}`);
|
|
1123
|
+
}
|
|
1124
|
+
else {
|
|
1125
|
+
console.error(`[setup] ✗ Could not resolve "${opts.telegramGroup}" to a chat ID: ${data.description ?? 'unknown error'}`);
|
|
1126
|
+
console.error('[setup] Skipping Telegram setup. Run setup again with a valid numeric chat ID.');
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
catch (err) {
|
|
1130
|
+
console.error(`[setup] ✗ Failed to validate chat ID: ${err}`);
|
|
1131
|
+
console.error('[setup] Skipping Telegram setup. Run setup again with a valid numeric chat ID.');
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
if (chatIdValid) {
|
|
1135
|
+
config.messaging.push({
|
|
1136
|
+
type: 'telegram',
|
|
1137
|
+
enabled: true,
|
|
1138
|
+
config: {
|
|
1139
|
+
token: opts.telegramToken,
|
|
1140
|
+
chatId,
|
|
1141
|
+
pollIntervalMs: 2000,
|
|
1142
|
+
stallTimeoutMinutes: 5,
|
|
1143
|
+
},
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
// Add WhatsApp if provided
|
|
1148
|
+
if (opts.whatsappBackend && opts.whatsappPhone) {
|
|
1149
|
+
const waConfig = {
|
|
1150
|
+
backend: opts.whatsappBackend,
|
|
1151
|
+
authorizedNumbers: [opts.whatsappPhone],
|
|
1152
|
+
requireConsent: false,
|
|
1153
|
+
};
|
|
1154
|
+
if (opts.whatsappBackend === 'business-api' && opts.whatsappPhoneNumberId && opts.whatsappAccessToken) {
|
|
1155
|
+
waConfig.businessApi = {
|
|
1156
|
+
phoneNumberId: opts.whatsappPhoneNumberId,
|
|
1157
|
+
accessToken: opts.whatsappAccessToken,
|
|
1158
|
+
webhookVerifyToken: opts.whatsappVerifyToken ?? '',
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
config.messaging.push({
|
|
1162
|
+
type: 'whatsapp',
|
|
1163
|
+
enabled: true,
|
|
1164
|
+
config: waConfig,
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
// Multi-user additions
|
|
1168
|
+
if (isMultiUser) {
|
|
1169
|
+
config.userRegistrationPolicy = 'admin-only';
|
|
1170
|
+
config.agentAutonomy = { level: 'collaborative' };
|
|
1171
|
+
// Generate recovery key
|
|
1172
|
+
const crypto = await import('node:crypto');
|
|
1173
|
+
const bytes = crypto.randomBytes(32);
|
|
1174
|
+
const chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
1175
|
+
let key = '';
|
|
1176
|
+
let num = BigInt('0x' + bytes.toString('hex'));
|
|
1177
|
+
while (key.length < 44) {
|
|
1178
|
+
key += chars[Number(num % 58n)];
|
|
1179
|
+
num = num / 58n;
|
|
1180
|
+
}
|
|
1181
|
+
// Hash for storage, output key to stdout
|
|
1182
|
+
const hash = crypto.createHash('sha256').update(key).digest('hex');
|
|
1183
|
+
config.recoveryKeyHash = hash;
|
|
1184
|
+
// Recovery key to stdout (single line for capture)
|
|
1185
|
+
console.log(key);
|
|
1186
|
+
}
|
|
1187
|
+
// Write config
|
|
1188
|
+
fs.writeFileSync(path.join(stateDir, 'config.json'), JSON.stringify(config, null, 2));
|
|
1189
|
+
// Write AGENT.md
|
|
1190
|
+
fs.writeFileSync(path.join(stateDir, 'AGENT.md'), `# Agent Identity
|
|
1191
|
+
|
|
1192
|
+
**Name**: ${agentName}
|
|
1193
|
+
**Created**: ${new Date().toISOString().split('T')[0]}
|
|
1194
|
+
|
|
1195
|
+
## Who I Am
|
|
1196
|
+
|
|
1197
|
+
I am ${agentName}, set up via non-interactive mode.
|
|
1198
|
+
|
|
1199
|
+
## Operating Principles
|
|
1200
|
+
|
|
1201
|
+
- Be genuinely helpful
|
|
1202
|
+
- Research before asking
|
|
1203
|
+
- When in doubt, ask ${userName}
|
|
1204
|
+
`);
|
|
1205
|
+
// Write USER.md
|
|
1206
|
+
fs.writeFileSync(path.join(stateDir, 'USER.md'), `# User Profile: ${userName}
|
|
1207
|
+
|
|
1208
|
+
**Name**: ${userName}
|
|
1209
|
+
**Role**: Admin
|
|
1210
|
+
`);
|
|
1211
|
+
// Write MEMORY.md
|
|
1212
|
+
fs.writeFileSync(path.join(stateDir, 'MEMORY.md'), `# Agent Memory
|
|
1213
|
+
|
|
1214
|
+
## Key Facts
|
|
1215
|
+
|
|
1216
|
+
- Initialized on ${new Date().toISOString().split('T')[0]} (non-interactive)
|
|
1217
|
+
- Primary user: ${userName}
|
|
1218
|
+
`);
|
|
1219
|
+
// Write empty jobs.json and users.json
|
|
1220
|
+
fs.writeFileSync(path.join(stateDir, 'jobs.json'), '[]');
|
|
1221
|
+
fs.writeFileSync(path.join(stateDir, 'users.json'), JSON.stringify([{ name: userName, role: 'admin' }], null, 2));
|
|
1222
|
+
// Set file permissions on sensitive files
|
|
1223
|
+
if (opts.telegramToken) {
|
|
1224
|
+
try {
|
|
1225
|
+
fs.chmodSync(path.join(stateDir, 'config.json'), 0o600);
|
|
1226
|
+
}
|
|
1227
|
+
catch { /* non-fatal on Windows */ }
|
|
1228
|
+
}
|
|
1229
|
+
console.log(pc.green(`\n ✓ Agent "${agentName}" configured at ${stateDir}`));
|
|
1230
|
+
if (opts.telegramToken) {
|
|
1231
|
+
console.log(pc.green(' ✓ Telegram configured'));
|
|
1232
|
+
}
|
|
1233
|
+
console.log(pc.dim(`\n Start with: instar server start --dir ${agentDir}\n`));
|
|
1234
|
+
}
|
|
1235
|
+
//# sourceMappingURL=setup.js.map
|