@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.
Files changed (1671) hide show
  1. package/.claude/hooks/free-text-guard.sh +117 -0
  2. package/.claude/settings.json +201 -0
  3. package/.claude/skills/autonomous/hooks/autonomous-stop-hook.sh +234 -0
  4. package/.claude/skills/autonomous/hooks/hooks.json +15 -0
  5. package/.claude/skills/autonomous/scripts/setup-autonomous.sh +166 -0
  6. package/.claude/skills/autonomous/skill.md +254 -0
  7. package/.claude/skills/secret-setup/skill.md +210 -0
  8. package/.claude/skills/setup-wizard/skill.md +2132 -0
  9. package/LICENSE +21 -0
  10. package/README.md +214 -0
  11. package/dashboard/favicon.png +0 -0
  12. package/dashboard/index.html +5740 -0
  13. package/dashboard/logo.png +0 -0
  14. package/dist/cli.d.ts +21 -0
  15. package/dist/cli.d.ts.map +1 -0
  16. package/dist/cli.js +1782 -0
  17. package/dist/cli.js.map +1 -0
  18. package/dist/commands/backup.d.ts +16 -0
  19. package/dist/commands/backup.d.ts.map +1 -0
  20. package/dist/commands/backup.js +84 -0
  21. package/dist/commands/backup.js.map +1 -0
  22. package/dist/commands/discovery.d.ts +158 -0
  23. package/dist/commands/discovery.d.ts.map +1 -0
  24. package/dist/commands/discovery.js +532 -0
  25. package/dist/commands/discovery.js.map +1 -0
  26. package/dist/commands/git.d.ts +25 -0
  27. package/dist/commands/git.d.ts.map +1 -0
  28. package/dist/commands/git.js +152 -0
  29. package/dist/commands/git.js.map +1 -0
  30. package/dist/commands/init.d.ts +52 -0
  31. package/dist/commands/init.d.ts.map +1 -0
  32. package/dist/commands/init.js +4211 -0
  33. package/dist/commands/init.js.map +1 -0
  34. package/dist/commands/intent.d.ts +30 -0
  35. package/dist/commands/intent.d.ts.map +1 -0
  36. package/dist/commands/intent.js +349 -0
  37. package/dist/commands/intent.js.map +1 -0
  38. package/dist/commands/job.d.ts +42 -0
  39. package/dist/commands/job.d.ts.map +1 -0
  40. package/dist/commands/job.js +202 -0
  41. package/dist/commands/job.js.map +1 -0
  42. package/dist/commands/knowledge.d.ts +25 -0
  43. package/dist/commands/knowledge.d.ts.map +1 -0
  44. package/dist/commands/knowledge.js +127 -0
  45. package/dist/commands/knowledge.js.map +1 -0
  46. package/dist/commands/machine.d.ts +53 -0
  47. package/dist/commands/machine.d.ts.map +1 -0
  48. package/dist/commands/machine.js +680 -0
  49. package/dist/commands/machine.js.map +1 -0
  50. package/dist/commands/memory.d.ts +24 -0
  51. package/dist/commands/memory.d.ts.map +1 -0
  52. package/dist/commands/memory.js +163 -0
  53. package/dist/commands/memory.js.map +1 -0
  54. package/dist/commands/nuke.d.ts +22 -0
  55. package/dist/commands/nuke.d.ts.map +1 -0
  56. package/dist/commands/nuke.js +216 -0
  57. package/dist/commands/nuke.js.map +1 -0
  58. package/dist/commands/org.d.ts +16 -0
  59. package/dist/commands/org.d.ts.map +1 -0
  60. package/dist/commands/org.js +69 -0
  61. package/dist/commands/org.js.map +1 -0
  62. package/dist/commands/playbook.d.ts +91 -0
  63. package/dist/commands/playbook.d.ts.map +1 -0
  64. package/dist/commands/playbook.js +1016 -0
  65. package/dist/commands/playbook.js.map +1 -0
  66. package/dist/commands/reflect.d.ts +52 -0
  67. package/dist/commands/reflect.d.ts.map +1 -0
  68. package/dist/commands/reflect.js +316 -0
  69. package/dist/commands/reflect.js.map +1 -0
  70. package/dist/commands/relationship.d.ts +17 -0
  71. package/dist/commands/relationship.d.ts.map +1 -0
  72. package/dist/commands/relationship.js +156 -0
  73. package/dist/commands/relationship.js.map +1 -0
  74. package/dist/commands/relay.d.ts +26 -0
  75. package/dist/commands/relay.d.ts.map +1 -0
  76. package/dist/commands/relay.js +121 -0
  77. package/dist/commands/relay.js.map +1 -0
  78. package/dist/commands/review.d.ts +18 -0
  79. package/dist/commands/review.d.ts.map +1 -0
  80. package/dist/commands/review.js +193 -0
  81. package/dist/commands/review.js.map +1 -0
  82. package/dist/commands/semantic.d.ts +37 -0
  83. package/dist/commands/semantic.d.ts.map +1 -0
  84. package/dist/commands/semantic.js +198 -0
  85. package/dist/commands/semantic.js.map +1 -0
  86. package/dist/commands/server.d.ts +37 -0
  87. package/dist/commands/server.d.ts.map +1 -0
  88. package/dist/commands/server.js +4875 -0
  89. package/dist/commands/server.js.map +1 -0
  90. package/dist/commands/setup.d.ts +63 -0
  91. package/dist/commands/setup.d.ts.map +1 -0
  92. package/dist/commands/setup.js +1235 -0
  93. package/dist/commands/setup.js.map +1 -0
  94. package/dist/commands/slack-cli.d.ts +16 -0
  95. package/dist/commands/slack-cli.d.ts.map +1 -0
  96. package/dist/commands/slack-cli.js +259 -0
  97. package/dist/commands/slack-cli.js.map +1 -0
  98. package/dist/commands/status.d.ts +11 -0
  99. package/dist/commands/status.d.ts.map +1 -0
  100. package/dist/commands/status.js +120 -0
  101. package/dist/commands/status.js.map +1 -0
  102. package/dist/commands/user.d.ts +17 -0
  103. package/dist/commands/user.d.ts.map +1 -0
  104. package/dist/commands/user.js +53 -0
  105. package/dist/commands/user.js.map +1 -0
  106. package/dist/commands/whatsapp.d.ts +31 -0
  107. package/dist/commands/whatsapp.d.ts.map +1 -0
  108. package/dist/commands/whatsapp.js +408 -0
  109. package/dist/commands/whatsapp.js.map +1 -0
  110. package/dist/config/ConfigDefaults.d.ts +40 -0
  111. package/dist/config/ConfigDefaults.d.ts.map +1 -0
  112. package/dist/config/ConfigDefaults.js +175 -0
  113. package/dist/config/ConfigDefaults.js.map +1 -0
  114. package/dist/config/LiveConfig.d.ts +97 -0
  115. package/dist/config/LiveConfig.d.ts.map +1 -0
  116. package/dist/config/LiveConfig.js +220 -0
  117. package/dist/config/LiveConfig.js.map +1 -0
  118. package/dist/core/AccessControl.d.ts +91 -0
  119. package/dist/core/AccessControl.d.ts.map +1 -0
  120. package/dist/core/AccessControl.js +184 -0
  121. package/dist/core/AccessControl.js.map +1 -0
  122. package/dist/core/AdaptationValidator.d.ts +44 -0
  123. package/dist/core/AdaptationValidator.d.ts.map +1 -0
  124. package/dist/core/AdaptationValidator.js +132 -0
  125. package/dist/core/AdaptationValidator.js.map +1 -0
  126. package/dist/core/AdaptiveTrust.d.ts +188 -0
  127. package/dist/core/AdaptiveTrust.d.ts.map +1 -0
  128. package/dist/core/AdaptiveTrust.js +354 -0
  129. package/dist/core/AdaptiveTrust.js.map +1 -0
  130. package/dist/core/AgentBus.d.ts +168 -0
  131. package/dist/core/AgentBus.d.ts.map +1 -0
  132. package/dist/core/AgentBus.js +369 -0
  133. package/dist/core/AgentBus.js.map +1 -0
  134. package/dist/core/AgentConnector.d.ts +76 -0
  135. package/dist/core/AgentConnector.d.ts.map +1 -0
  136. package/dist/core/AgentConnector.js +324 -0
  137. package/dist/core/AgentConnector.js.map +1 -0
  138. package/dist/core/AgentRegistry.d.ts +107 -0
  139. package/dist/core/AgentRegistry.d.ts.map +1 -0
  140. package/dist/core/AgentRegistry.js +569 -0
  141. package/dist/core/AgentRegistry.js.map +1 -0
  142. package/dist/core/AnthropicIntelligenceProvider.d.ts +24 -0
  143. package/dist/core/AnthropicIntelligenceProvider.d.ts.map +1 -0
  144. package/dist/core/AnthropicIntelligenceProvider.js +63 -0
  145. package/dist/core/AnthropicIntelligenceProvider.js.map +1 -0
  146. package/dist/core/AuditTrail.d.ts +207 -0
  147. package/dist/core/AuditTrail.d.ts.map +1 -0
  148. package/dist/core/AuditTrail.js +271 -0
  149. package/dist/core/AuditTrail.js.map +1 -0
  150. package/dist/core/AutoApprover.d.ts +63 -0
  151. package/dist/core/AutoApprover.d.ts.map +1 -0
  152. package/dist/core/AutoApprover.js +151 -0
  153. package/dist/core/AutoApprover.js.map +1 -0
  154. package/dist/core/AutoDispatcher.d.ts +170 -0
  155. package/dist/core/AutoDispatcher.d.ts.map +1 -0
  156. package/dist/core/AutoDispatcher.js +647 -0
  157. package/dist/core/AutoDispatcher.js.map +1 -0
  158. package/dist/core/AutoUpdater.d.ts +193 -0
  159. package/dist/core/AutoUpdater.d.ts.map +1 -0
  160. package/dist/core/AutoUpdater.js +648 -0
  161. package/dist/core/AutoUpdater.js.map +1 -0
  162. package/dist/core/AutonomousEvolution.d.ts +168 -0
  163. package/dist/core/AutonomousEvolution.d.ts.map +1 -0
  164. package/dist/core/AutonomousEvolution.js +384 -0
  165. package/dist/core/AutonomousEvolution.js.map +1 -0
  166. package/dist/core/AutonomyProfileManager.d.ts +108 -0
  167. package/dist/core/AutonomyProfileManager.d.ts.map +1 -0
  168. package/dist/core/AutonomyProfileManager.js +323 -0
  169. package/dist/core/AutonomyProfileManager.js.map +1 -0
  170. package/dist/core/AutonomySkill.d.ts +98 -0
  171. package/dist/core/AutonomySkill.d.ts.map +1 -0
  172. package/dist/core/AutonomySkill.js +497 -0
  173. package/dist/core/AutonomySkill.js.map +1 -0
  174. package/dist/core/BackupManager.d.ts +66 -0
  175. package/dist/core/BackupManager.d.ts.map +1 -0
  176. package/dist/core/BackupManager.js +266 -0
  177. package/dist/core/BackupManager.js.map +1 -0
  178. package/dist/core/BitwardenProvider.d.ts +85 -0
  179. package/dist/core/BitwardenProvider.d.ts.map +1 -0
  180. package/dist/core/BitwardenProvider.js +437 -0
  181. package/dist/core/BitwardenProvider.js.map +1 -0
  182. package/dist/core/BlockerLearningLoop.d.ts +99 -0
  183. package/dist/core/BlockerLearningLoop.d.ts.map +1 -0
  184. package/dist/core/BlockerLearningLoop.js +205 -0
  185. package/dist/core/BlockerLearningLoop.js.map +1 -0
  186. package/dist/core/BranchManager.d.ts +165 -0
  187. package/dist/core/BranchManager.d.ts.map +1 -0
  188. package/dist/core/BranchManager.js +413 -0
  189. package/dist/core/BranchManager.js.map +1 -0
  190. package/dist/core/CaffeinateManager.d.ts +50 -0
  191. package/dist/core/CaffeinateManager.d.ts.map +1 -0
  192. package/dist/core/CaffeinateManager.js +189 -0
  193. package/dist/core/CaffeinateManager.js.map +1 -0
  194. package/dist/core/CallbackRegistry.d.ts +67 -0
  195. package/dist/core/CallbackRegistry.d.ts.map +1 -0
  196. package/dist/core/CallbackRegistry.js +145 -0
  197. package/dist/core/CallbackRegistry.js.map +1 -0
  198. package/dist/core/CanonicalState.d.ts +132 -0
  199. package/dist/core/CanonicalState.d.ts.map +1 -0
  200. package/dist/core/CanonicalState.js +297 -0
  201. package/dist/core/CanonicalState.js.map +1 -0
  202. package/dist/core/CapabilityMapper.d.ts +192 -0
  203. package/dist/core/CapabilityMapper.d.ts.map +1 -0
  204. package/dist/core/CapabilityMapper.js +958 -0
  205. package/dist/core/CapabilityMapper.js.map +1 -0
  206. package/dist/core/CapabilityRegistryGenerator.d.ts +72 -0
  207. package/dist/core/CapabilityRegistryGenerator.d.ts.map +1 -0
  208. package/dist/core/CapabilityRegistryGenerator.js +310 -0
  209. package/dist/core/CapabilityRegistryGenerator.js.map +1 -0
  210. package/dist/core/ClaudeCliIntelligenceProvider.d.ts +21 -0
  211. package/dist/core/ClaudeCliIntelligenceProvider.d.ts.map +1 -0
  212. package/dist/core/ClaudeCliIntelligenceProvider.js +60 -0
  213. package/dist/core/ClaudeCliIntelligenceProvider.js.map +1 -0
  214. package/dist/core/CoherenceGate.d.ts +198 -0
  215. package/dist/core/CoherenceGate.d.ts.map +1 -0
  216. package/dist/core/CoherenceGate.js +986 -0
  217. package/dist/core/CoherenceGate.js.map +1 -0
  218. package/dist/core/CoherenceReviewer.d.ts +104 -0
  219. package/dist/core/CoherenceReviewer.d.ts.map +1 -0
  220. package/dist/core/CoherenceReviewer.js +185 -0
  221. package/dist/core/CoherenceReviewer.js.map +1 -0
  222. package/dist/core/Config.d.ts +32 -0
  223. package/dist/core/Config.d.ts.map +1 -0
  224. package/dist/core/Config.js +332 -0
  225. package/dist/core/Config.js.map +1 -0
  226. package/dist/core/ConflictNegotiator.d.ts +167 -0
  227. package/dist/core/ConflictNegotiator.d.ts.map +1 -0
  228. package/dist/core/ConflictNegotiator.js +280 -0
  229. package/dist/core/ConflictNegotiator.js.map +1 -0
  230. package/dist/core/ContextHierarchy.d.ts +102 -0
  231. package/dist/core/ContextHierarchy.d.ts.map +1 -0
  232. package/dist/core/ContextHierarchy.js +594 -0
  233. package/dist/core/ContextHierarchy.js.map +1 -0
  234. package/dist/core/ContextSnapshotBuilder.d.ts +80 -0
  235. package/dist/core/ContextSnapshotBuilder.d.ts.map +1 -0
  236. package/dist/core/ContextSnapshotBuilder.js +342 -0
  237. package/dist/core/ContextSnapshotBuilder.js.map +1 -0
  238. package/dist/core/ContextualEvaluator.d.ts +103 -0
  239. package/dist/core/ContextualEvaluator.d.ts.map +1 -0
  240. package/dist/core/ContextualEvaluator.js +389 -0
  241. package/dist/core/ContextualEvaluator.js.map +1 -0
  242. package/dist/core/ConvergenceChecker.d.ts +24 -0
  243. package/dist/core/ConvergenceChecker.d.ts.map +1 -0
  244. package/dist/core/ConvergenceChecker.js +113 -0
  245. package/dist/core/ConvergenceChecker.js.map +1 -0
  246. package/dist/core/CoordinationProtocol.d.ts +198 -0
  247. package/dist/core/CoordinationProtocol.d.ts.map +1 -0
  248. package/dist/core/CoordinationProtocol.js +363 -0
  249. package/dist/core/CoordinationProtocol.js.map +1 -0
  250. package/dist/core/CustomReviewerLoader.d.ts +45 -0
  251. package/dist/core/CustomReviewerLoader.d.ts.map +1 -0
  252. package/dist/core/CustomReviewerLoader.js +153 -0
  253. package/dist/core/CustomReviewerLoader.js.map +1 -0
  254. package/dist/core/DecisionJournal.d.ts +56 -0
  255. package/dist/core/DecisionJournal.d.ts.map +1 -0
  256. package/dist/core/DecisionJournal.js +132 -0
  257. package/dist/core/DecisionJournal.js.map +1 -0
  258. package/dist/core/DeferredDispatchTracker.d.ts +91 -0
  259. package/dist/core/DeferredDispatchTracker.d.ts.map +1 -0
  260. package/dist/core/DeferredDispatchTracker.js +213 -0
  261. package/dist/core/DeferredDispatchTracker.js.map +1 -0
  262. package/dist/core/DiscoveryEvaluator.d.ts +131 -0
  263. package/dist/core/DiscoveryEvaluator.d.ts.map +1 -0
  264. package/dist/core/DiscoveryEvaluator.js +377 -0
  265. package/dist/core/DiscoveryEvaluator.js.map +1 -0
  266. package/dist/core/DispatchDecisionJournal.d.ts +83 -0
  267. package/dist/core/DispatchDecisionJournal.d.ts.map +1 -0
  268. package/dist/core/DispatchDecisionJournal.js +181 -0
  269. package/dist/core/DispatchDecisionJournal.js.map +1 -0
  270. package/dist/core/DispatchExecutor.d.ts +127 -0
  271. package/dist/core/DispatchExecutor.d.ts.map +1 -0
  272. package/dist/core/DispatchExecutor.js +355 -0
  273. package/dist/core/DispatchExecutor.js.map +1 -0
  274. package/dist/core/DispatchManager.d.ts +200 -0
  275. package/dist/core/DispatchManager.d.ts.map +1 -0
  276. package/dist/core/DispatchManager.js +524 -0
  277. package/dist/core/DispatchManager.js.map +1 -0
  278. package/dist/core/DispatchScopeEnforcer.d.ts +57 -0
  279. package/dist/core/DispatchScopeEnforcer.d.ts.map +1 -0
  280. package/dist/core/DispatchScopeEnforcer.js +173 -0
  281. package/dist/core/DispatchScopeEnforcer.js.map +1 -0
  282. package/dist/core/DispatchVerifier.d.ts +76 -0
  283. package/dist/core/DispatchVerifier.d.ts.map +1 -0
  284. package/dist/core/DispatchVerifier.js +128 -0
  285. package/dist/core/DispatchVerifier.js.map +1 -0
  286. package/dist/core/EvolutionManager.d.ts +223 -0
  287. package/dist/core/EvolutionManager.d.ts.map +1 -0
  288. package/dist/core/EvolutionManager.js +630 -0
  289. package/dist/core/EvolutionManager.js.map +1 -0
  290. package/dist/core/ExecutionJournal.d.ts +101 -0
  291. package/dist/core/ExecutionJournal.d.ts.map +1 -0
  292. package/dist/core/ExecutionJournal.js +301 -0
  293. package/dist/core/ExecutionJournal.js.map +1 -0
  294. package/dist/core/ExternalOperationGate.d.ts +204 -0
  295. package/dist/core/ExternalOperationGate.d.ts.map +1 -0
  296. package/dist/core/ExternalOperationGate.js +413 -0
  297. package/dist/core/ExternalOperationGate.js.map +1 -0
  298. package/dist/core/FeatureDefinitions.d.ts +14 -0
  299. package/dist/core/FeatureDefinitions.d.ts.map +1 -0
  300. package/dist/core/FeatureDefinitions.js +374 -0
  301. package/dist/core/FeatureDefinitions.js.map +1 -0
  302. package/dist/core/FeatureRegistry.d.ts +337 -0
  303. package/dist/core/FeatureRegistry.d.ts.map +1 -0
  304. package/dist/core/FeatureRegistry.js +863 -0
  305. package/dist/core/FeatureRegistry.js.map +1 -0
  306. package/dist/core/FeedbackManager.d.ts +69 -0
  307. package/dist/core/FeedbackManager.d.ts.map +1 -0
  308. package/dist/core/FeedbackManager.js +284 -0
  309. package/dist/core/FeedbackManager.js.map +1 -0
  310. package/dist/core/FileClassifier.d.ts +74 -0
  311. package/dist/core/FileClassifier.d.ts.map +1 -0
  312. package/dist/core/FileClassifier.js +377 -0
  313. package/dist/core/FileClassifier.js.map +1 -0
  314. package/dist/core/ForegroundRestartWatcher.d.ts +55 -0
  315. package/dist/core/ForegroundRestartWatcher.d.ts.map +1 -0
  316. package/dist/core/ForegroundRestartWatcher.js +116 -0
  317. package/dist/core/ForegroundRestartWatcher.js.map +1 -0
  318. package/dist/core/GitStateManager.d.ts +78 -0
  319. package/dist/core/GitStateManager.d.ts.map +1 -0
  320. package/dist/core/GitStateManager.js +366 -0
  321. package/dist/core/GitStateManager.js.map +1 -0
  322. package/dist/core/GitSync.d.ts +199 -0
  323. package/dist/core/GitSync.d.ts.map +1 -0
  324. package/dist/core/GitSync.js +955 -0
  325. package/dist/core/GitSync.js.map +1 -0
  326. package/dist/core/GlobalInstallCleanup.d.ts +23 -0
  327. package/dist/core/GlobalInstallCleanup.d.ts.map +1 -0
  328. package/dist/core/GlobalInstallCleanup.js +130 -0
  329. package/dist/core/GlobalInstallCleanup.js.map +1 -0
  330. package/dist/core/GlobalSecretStore.d.ts +112 -0
  331. package/dist/core/GlobalSecretStore.d.ts.map +1 -0
  332. package/dist/core/GlobalSecretStore.js +396 -0
  333. package/dist/core/GlobalSecretStore.js.map +1 -0
  334. package/dist/core/HandoffManager.d.ts +163 -0
  335. package/dist/core/HandoffManager.d.ts.map +1 -0
  336. package/dist/core/HandoffManager.js +370 -0
  337. package/dist/core/HandoffManager.js.map +1 -0
  338. package/dist/core/HeartbeatManager.d.ts +120 -0
  339. package/dist/core/HeartbeatManager.d.ts.map +1 -0
  340. package/dist/core/HeartbeatManager.js +240 -0
  341. package/dist/core/HeartbeatManager.js.map +1 -0
  342. package/dist/core/InputGuard.d.ts +98 -0
  343. package/dist/core/InputGuard.d.ts.map +1 -0
  344. package/dist/core/InputGuard.js +316 -0
  345. package/dist/core/InputGuard.js.map +1 -0
  346. package/dist/core/IntentDriftDetector.d.ts +100 -0
  347. package/dist/core/IntentDriftDetector.d.ts.map +1 -0
  348. package/dist/core/IntentDriftDetector.js +325 -0
  349. package/dist/core/IntentDriftDetector.js.map +1 -0
  350. package/dist/core/JobReflector.d.ts +81 -0
  351. package/dist/core/JobReflector.d.ts.map +1 -0
  352. package/dist/core/JobReflector.js +244 -0
  353. package/dist/core/JobReflector.js.map +1 -0
  354. package/dist/core/LLMConflictResolver.d.ts +132 -0
  355. package/dist/core/LLMConflictResolver.d.ts.map +1 -0
  356. package/dist/core/LLMConflictResolver.js +372 -0
  357. package/dist/core/LLMConflictResolver.js.map +1 -0
  358. package/dist/core/LedgerAuth.d.ts +99 -0
  359. package/dist/core/LedgerAuth.d.ts.map +1 -0
  360. package/dist/core/LedgerAuth.js +215 -0
  361. package/dist/core/LedgerAuth.js.map +1 -0
  362. package/dist/core/MachineIdentity.d.ts +196 -0
  363. package/dist/core/MachineIdentity.d.ts.map +1 -0
  364. package/dist/core/MachineIdentity.js +476 -0
  365. package/dist/core/MachineIdentity.js.map +1 -0
  366. package/dist/core/MessageSentinel.d.ts +142 -0
  367. package/dist/core/MessageSentinel.d.ts.map +1 -0
  368. package/dist/core/MessageSentinel.js +426 -0
  369. package/dist/core/MessageSentinel.js.map +1 -0
  370. package/dist/core/MigrationProvenance.d.ts +62 -0
  371. package/dist/core/MigrationProvenance.d.ts.map +1 -0
  372. package/dist/core/MigrationProvenance.js +183 -0
  373. package/dist/core/MigrationProvenance.js.map +1 -0
  374. package/dist/core/MultiMachineCoordinator.d.ts +106 -0
  375. package/dist/core/MultiMachineCoordinator.d.ts.map +1 -0
  376. package/dist/core/MultiMachineCoordinator.js +311 -0
  377. package/dist/core/MultiMachineCoordinator.js.map +1 -0
  378. package/dist/core/NonceStore.d.ts +72 -0
  379. package/dist/core/NonceStore.d.ts.map +1 -0
  380. package/dist/core/NonceStore.js +163 -0
  381. package/dist/core/NonceStore.js.map +1 -0
  382. package/dist/core/OrgIntentManager.d.ts +58 -0
  383. package/dist/core/OrgIntentManager.d.ts.map +1 -0
  384. package/dist/core/OrgIntentManager.js +250 -0
  385. package/dist/core/OrgIntentManager.js.map +1 -0
  386. package/dist/core/OverlapGuard.d.ts +112 -0
  387. package/dist/core/OverlapGuard.d.ts.map +1 -0
  388. package/dist/core/OverlapGuard.js +241 -0
  389. package/dist/core/OverlapGuard.js.map +1 -0
  390. package/dist/core/PairingProtocol.d.ts +129 -0
  391. package/dist/core/PairingProtocol.d.ts.map +1 -0
  392. package/dist/core/PairingProtocol.js +265 -0
  393. package/dist/core/PairingProtocol.js.map +1 -0
  394. package/dist/core/PatternAnalyzer.d.ts +128 -0
  395. package/dist/core/PatternAnalyzer.d.ts.map +1 -0
  396. package/dist/core/PatternAnalyzer.js +388 -0
  397. package/dist/core/PatternAnalyzer.js.map +1 -0
  398. package/dist/core/PlatformActivityRegistry.d.ts +163 -0
  399. package/dist/core/PlatformActivityRegistry.d.ts.map +1 -0
  400. package/dist/core/PlatformActivityRegistry.js +307 -0
  401. package/dist/core/PlatformActivityRegistry.js.map +1 -0
  402. package/dist/core/PolicyEnforcementLayer.d.ts +63 -0
  403. package/dist/core/PolicyEnforcementLayer.d.ts.map +1 -0
  404. package/dist/core/PolicyEnforcementLayer.js +250 -0
  405. package/dist/core/PolicyEnforcementLayer.js.map +1 -0
  406. package/dist/core/PortRegistry.d.ts +9 -0
  407. package/dist/core/PortRegistry.d.ts.map +1 -0
  408. package/dist/core/PortRegistry.js +8 -0
  409. package/dist/core/PortRegistry.js.map +1 -0
  410. package/dist/core/PostUpdateMigrator.d.ts +170 -0
  411. package/dist/core/PostUpdateMigrator.d.ts.map +1 -0
  412. package/dist/core/PostUpdateMigrator.js +3674 -0
  413. package/dist/core/PostUpdateMigrator.js.map +1 -0
  414. package/dist/core/Prerequisites.d.ts +37 -0
  415. package/dist/core/Prerequisites.d.ts.map +1 -0
  416. package/dist/core/Prerequisites.js +272 -0
  417. package/dist/core/Prerequisites.js.map +1 -0
  418. package/dist/core/ProcessIntegrity.d.ts +90 -0
  419. package/dist/core/ProcessIntegrity.d.ts.map +1 -0
  420. package/dist/core/ProcessIntegrity.js +119 -0
  421. package/dist/core/ProcessIntegrity.js.map +1 -0
  422. package/dist/core/ProjectMapper.d.ts +97 -0
  423. package/dist/core/ProjectMapper.d.ts.map +1 -0
  424. package/dist/core/ProjectMapper.js +370 -0
  425. package/dist/core/ProjectMapper.js.map +1 -0
  426. package/dist/core/PromptGuard.d.ts +121 -0
  427. package/dist/core/PromptGuard.d.ts.map +1 -0
  428. package/dist/core/PromptGuard.js +259 -0
  429. package/dist/core/PromptGuard.js.map +1 -0
  430. package/dist/core/RecipientResolver.d.ts +54 -0
  431. package/dist/core/RecipientResolver.d.ts.map +1 -0
  432. package/dist/core/RecipientResolver.js +143 -0
  433. package/dist/core/RecipientResolver.js.map +1 -0
  434. package/dist/core/ReflectionConsolidator.d.ts +73 -0
  435. package/dist/core/ReflectionConsolidator.d.ts.map +1 -0
  436. package/dist/core/ReflectionConsolidator.js +202 -0
  437. package/dist/core/ReflectionConsolidator.js.map +1 -0
  438. package/dist/core/RelationshipManager.d.ts +146 -0
  439. package/dist/core/RelationshipManager.d.ts.map +1 -0
  440. package/dist/core/RelationshipManager.js +736 -0
  441. package/dist/core/RelationshipManager.js.map +1 -0
  442. package/dist/core/RelevanceFilter.d.ts +61 -0
  443. package/dist/core/RelevanceFilter.d.ts.map +1 -0
  444. package/dist/core/RelevanceFilter.js +160 -0
  445. package/dist/core/RelevanceFilter.js.map +1 -0
  446. package/dist/core/ResearchRateLimiter.d.ts +76 -0
  447. package/dist/core/ResearchRateLimiter.d.ts.map +1 -0
  448. package/dist/core/ResearchRateLimiter.js +168 -0
  449. package/dist/core/ResearchRateLimiter.js.map +1 -0
  450. package/dist/core/ResumeValidator.d.ts +58 -0
  451. package/dist/core/ResumeValidator.d.ts.map +1 -0
  452. package/dist/core/ResumeValidator.js +195 -0
  453. package/dist/core/ResumeValidator.js.map +1 -0
  454. package/dist/core/ScopeCoherenceTracker.d.ts +87 -0
  455. package/dist/core/ScopeCoherenceTracker.d.ts.map +1 -0
  456. package/dist/core/ScopeCoherenceTracker.js +226 -0
  457. package/dist/core/ScopeCoherenceTracker.js.map +1 -0
  458. package/dist/core/ScopeVerifier.d.ts +122 -0
  459. package/dist/core/ScopeVerifier.d.ts.map +1 -0
  460. package/dist/core/ScopeVerifier.js +350 -0
  461. package/dist/core/ScopeVerifier.js.map +1 -0
  462. package/dist/core/SecretManager.d.ts +120 -0
  463. package/dist/core/SecretManager.d.ts.map +1 -0
  464. package/dist/core/SecretManager.js +324 -0
  465. package/dist/core/SecretManager.js.map +1 -0
  466. package/dist/core/SecretMigrator.d.ts +39 -0
  467. package/dist/core/SecretMigrator.d.ts.map +1 -0
  468. package/dist/core/SecretMigrator.js +182 -0
  469. package/dist/core/SecretMigrator.js.map +1 -0
  470. package/dist/core/SecretRedactor.d.ts +121 -0
  471. package/dist/core/SecretRedactor.d.ts.map +1 -0
  472. package/dist/core/SecretRedactor.js +309 -0
  473. package/dist/core/SecretRedactor.js.map +1 -0
  474. package/dist/core/SecretStore.d.ts +104 -0
  475. package/dist/core/SecretStore.d.ts.map +1 -0
  476. package/dist/core/SecretStore.js +405 -0
  477. package/dist/core/SecretStore.js.map +1 -0
  478. package/dist/core/SecurityLog.d.ts +58 -0
  479. package/dist/core/SecurityLog.d.ts.map +1 -0
  480. package/dist/core/SecurityLog.js +123 -0
  481. package/dist/core/SecurityLog.js.map +1 -0
  482. package/dist/core/SendGateway.d.ts +77 -0
  483. package/dist/core/SendGateway.d.ts.map +1 -0
  484. package/dist/core/SendGateway.js +181 -0
  485. package/dist/core/SendGateway.js.map +1 -0
  486. package/dist/core/SessionManager.d.ts +304 -0
  487. package/dist/core/SessionManager.d.ts.map +1 -0
  488. package/dist/core/SessionManager.js +1402 -0
  489. package/dist/core/SessionManager.js.map +1 -0
  490. package/dist/core/SleepWakeDetector.d.ts +37 -0
  491. package/dist/core/SleepWakeDetector.d.ts.map +1 -0
  492. package/dist/core/SleepWakeDetector.js +59 -0
  493. package/dist/core/SleepWakeDetector.js.map +1 -0
  494. package/dist/core/SoulManager.d.ts +107 -0
  495. package/dist/core/SoulManager.d.ts.map +1 -0
  496. package/dist/core/SoulManager.js +574 -0
  497. package/dist/core/SoulManager.js.map +1 -0
  498. package/dist/core/StaleProcessGuard.d.ts +113 -0
  499. package/dist/core/StaleProcessGuard.d.ts.map +1 -0
  500. package/dist/core/StaleProcessGuard.js +134 -0
  501. package/dist/core/StaleProcessGuard.js.map +1 -0
  502. package/dist/core/StateManager.d.ts +56 -0
  503. package/dist/core/StateManager.d.ts.map +1 -0
  504. package/dist/core/StateManager.js +266 -0
  505. package/dist/core/StateManager.js.map +1 -0
  506. package/dist/core/StateWriteAuthority.d.ts +101 -0
  507. package/dist/core/StateWriteAuthority.d.ts.map +1 -0
  508. package/dist/core/StateWriteAuthority.js +169 -0
  509. package/dist/core/StateWriteAuthority.js.map +1 -0
  510. package/dist/core/SurfacingTemplates.d.ts +63 -0
  511. package/dist/core/SurfacingTemplates.d.ts.map +1 -0
  512. package/dist/core/SurfacingTemplates.js +138 -0
  513. package/dist/core/SurfacingTemplates.js.map +1 -0
  514. package/dist/core/SyncOrchestrator.d.ts +308 -0
  515. package/dist/core/SyncOrchestrator.d.ts.map +1 -0
  516. package/dist/core/SyncOrchestrator.js +925 -0
  517. package/dist/core/SyncOrchestrator.js.map +1 -0
  518. package/dist/core/TemporalCoherenceChecker.d.ts +140 -0
  519. package/dist/core/TemporalCoherenceChecker.d.ts.map +1 -0
  520. package/dist/core/TemporalCoherenceChecker.js +375 -0
  521. package/dist/core/TemporalCoherenceChecker.js.map +1 -0
  522. package/dist/core/TopicClassifier.d.ts +54 -0
  523. package/dist/core/TopicClassifier.d.ts.map +1 -0
  524. package/dist/core/TopicClassifier.js +144 -0
  525. package/dist/core/TopicClassifier.js.map +1 -0
  526. package/dist/core/TopicResumeMap.d.ts +76 -0
  527. package/dist/core/TopicResumeMap.d.ts.map +1 -0
  528. package/dist/core/TopicResumeMap.js +252 -0
  529. package/dist/core/TopicResumeMap.js.map +1 -0
  530. package/dist/core/TrustElevationTracker.d.ts +178 -0
  531. package/dist/core/TrustElevationTracker.d.ts.map +1 -0
  532. package/dist/core/TrustElevationTracker.js +343 -0
  533. package/dist/core/TrustElevationTracker.js.map +1 -0
  534. package/dist/core/TrustRecovery.d.ts +109 -0
  535. package/dist/core/TrustRecovery.d.ts.map +1 -0
  536. package/dist/core/TrustRecovery.js +190 -0
  537. package/dist/core/TrustRecovery.js.map +1 -0
  538. package/dist/core/UpdateChecker.d.ts +108 -0
  539. package/dist/core/UpdateChecker.d.ts.map +1 -0
  540. package/dist/core/UpdateChecker.js +593 -0
  541. package/dist/core/UpdateChecker.js.map +1 -0
  542. package/dist/core/UpdateGate.d.ts +102 -0
  543. package/dist/core/UpdateGate.d.ts.map +1 -0
  544. package/dist/core/UpdateGate.js +149 -0
  545. package/dist/core/UpdateGate.js.map +1 -0
  546. package/dist/core/UpgradeGuideProcessor.d.ts +105 -0
  547. package/dist/core/UpgradeGuideProcessor.d.ts.map +1 -0
  548. package/dist/core/UpgradeGuideProcessor.js +278 -0
  549. package/dist/core/UpgradeGuideProcessor.js.map +1 -0
  550. package/dist/core/UpgradeNotifyManager.d.ts +98 -0
  551. package/dist/core/UpgradeNotifyManager.d.ts.map +1 -0
  552. package/dist/core/UpgradeNotifyManager.js +205 -0
  553. package/dist/core/UpgradeNotifyManager.js.map +1 -0
  554. package/dist/core/WorkLedger.d.ts +144 -0
  555. package/dist/core/WorkLedger.d.ts.map +1 -0
  556. package/dist/core/WorkLedger.js +246 -0
  557. package/dist/core/WorkLedger.js.map +1 -0
  558. package/dist/core/models.d.ts +70 -0
  559. package/dist/core/models.d.ts.map +1 -0
  560. package/dist/core/models.js +110 -0
  561. package/dist/core/models.js.map +1 -0
  562. package/dist/core/reviewers/capability-accuracy.d.ts +13 -0
  563. package/dist/core/reviewers/capability-accuracy.d.ts.map +1 -0
  564. package/dist/core/reviewers/capability-accuracy.js +38 -0
  565. package/dist/core/reviewers/capability-accuracy.js.map +1 -0
  566. package/dist/core/reviewers/claim-provenance.d.ts +14 -0
  567. package/dist/core/reviewers/claim-provenance.d.ts.map +1 -0
  568. package/dist/core/reviewers/claim-provenance.js +50 -0
  569. package/dist/core/reviewers/claim-provenance.js.map +1 -0
  570. package/dist/core/reviewers/context-completeness.d.ts +13 -0
  571. package/dist/core/reviewers/context-completeness.d.ts.map +1 -0
  572. package/dist/core/reviewers/context-completeness.js +43 -0
  573. package/dist/core/reviewers/context-completeness.js.map +1 -0
  574. package/dist/core/reviewers/conversational-tone.d.ts +13 -0
  575. package/dist/core/reviewers/conversational-tone.d.ts.map +1 -0
  576. package/dist/core/reviewers/conversational-tone.js +55 -0
  577. package/dist/core/reviewers/conversational-tone.js.map +1 -0
  578. package/dist/core/reviewers/escalation-resolution.d.ts +56 -0
  579. package/dist/core/reviewers/escalation-resolution.d.ts.map +1 -0
  580. package/dist/core/reviewers/escalation-resolution.js +239 -0
  581. package/dist/core/reviewers/escalation-resolution.js.map +1 -0
  582. package/dist/core/reviewers/gate-reviewer.d.ts +26 -0
  583. package/dist/core/reviewers/gate-reviewer.d.ts.map +1 -0
  584. package/dist/core/reviewers/gate-reviewer.js +130 -0
  585. package/dist/core/reviewers/gate-reviewer.js.map +1 -0
  586. package/dist/core/reviewers/information-leakage.d.ts +21 -0
  587. package/dist/core/reviewers/information-leakage.d.ts.map +1 -0
  588. package/dist/core/reviewers/information-leakage.js +72 -0
  589. package/dist/core/reviewers/information-leakage.js.map +1 -0
  590. package/dist/core/reviewers/settling-detection.d.ts +13 -0
  591. package/dist/core/reviewers/settling-detection.d.ts.map +1 -0
  592. package/dist/core/reviewers/settling-detection.js +48 -0
  593. package/dist/core/reviewers/settling-detection.js.map +1 -0
  594. package/dist/core/reviewers/url-validity.d.ts +18 -0
  595. package/dist/core/reviewers/url-validity.d.ts.map +1 -0
  596. package/dist/core/reviewers/url-validity.js +60 -0
  597. package/dist/core/reviewers/url-validity.js.map +1 -0
  598. package/dist/core/reviewers/value-alignment.d.ts +14 -0
  599. package/dist/core/reviewers/value-alignment.d.ts.map +1 -0
  600. package/dist/core/reviewers/value-alignment.js +71 -0
  601. package/dist/core/reviewers/value-alignment.js.map +1 -0
  602. package/dist/core/types.d.ts +2159 -0
  603. package/dist/core/types.d.ts.map +1 -0
  604. package/dist/core/types.js +20 -0
  605. package/dist/core/types.js.map +1 -0
  606. package/dist/data/http-hook-templates.d.ts +53 -0
  607. package/dist/data/http-hook-templates.d.ts.map +1 -0
  608. package/dist/data/http-hook-templates.js +64 -0
  609. package/dist/data/http-hook-templates.js.map +1 -0
  610. package/dist/index.d.ts +263 -0
  611. package/dist/index.d.ts.map +1 -0
  612. package/dist/index.js +164 -0
  613. package/dist/index.js.map +1 -0
  614. package/dist/knowledge/CoverageAuditor.d.ts +58 -0
  615. package/dist/knowledge/CoverageAuditor.d.ts.map +1 -0
  616. package/dist/knowledge/CoverageAuditor.js +153 -0
  617. package/dist/knowledge/CoverageAuditor.js.map +1 -0
  618. package/dist/knowledge/IntegrityManager.d.ts +46 -0
  619. package/dist/knowledge/IntegrityManager.d.ts.map +1 -0
  620. package/dist/knowledge/IntegrityManager.js +101 -0
  621. package/dist/knowledge/IntegrityManager.js.map +1 -0
  622. package/dist/knowledge/KnowledgeManager.d.ts +85 -0
  623. package/dist/knowledge/KnowledgeManager.d.ts.map +1 -0
  624. package/dist/knowledge/KnowledgeManager.js +194 -0
  625. package/dist/knowledge/KnowledgeManager.js.map +1 -0
  626. package/dist/knowledge/ProbeRegistry.d.ts +54 -0
  627. package/dist/knowledge/ProbeRegistry.d.ts.map +1 -0
  628. package/dist/knowledge/ProbeRegistry.js +119 -0
  629. package/dist/knowledge/ProbeRegistry.js.map +1 -0
  630. package/dist/knowledge/SelfKnowledgeTree.d.ts +108 -0
  631. package/dist/knowledge/SelfKnowledgeTree.d.ts.map +1 -0
  632. package/dist/knowledge/SelfKnowledgeTree.js +560 -0
  633. package/dist/knowledge/SelfKnowledgeTree.js.map +1 -0
  634. package/dist/knowledge/TreeGenerator.d.ts +57 -0
  635. package/dist/knowledge/TreeGenerator.d.ts.map +1 -0
  636. package/dist/knowledge/TreeGenerator.js +527 -0
  637. package/dist/knowledge/TreeGenerator.js.map +1 -0
  638. package/dist/knowledge/TreeSynthesis.d.ts +24 -0
  639. package/dist/knowledge/TreeSynthesis.d.ts.map +1 -0
  640. package/dist/knowledge/TreeSynthesis.js +61 -0
  641. package/dist/knowledge/TreeSynthesis.js.map +1 -0
  642. package/dist/knowledge/TreeTraversal.d.ts +93 -0
  643. package/dist/knowledge/TreeTraversal.d.ts.map +1 -0
  644. package/dist/knowledge/TreeTraversal.js +359 -0
  645. package/dist/knowledge/TreeTraversal.js.map +1 -0
  646. package/dist/knowledge/TreeTriage.d.ts +80 -0
  647. package/dist/knowledge/TreeTriage.d.ts.map +1 -0
  648. package/dist/knowledge/TreeTriage.js +413 -0
  649. package/dist/knowledge/TreeTriage.js.map +1 -0
  650. package/dist/knowledge/types.d.ts +183 -0
  651. package/dist/knowledge/types.d.ts.map +1 -0
  652. package/dist/knowledge/types.js +28 -0
  653. package/dist/knowledge/types.js.map +1 -0
  654. package/dist/lifeline/MessageQueue.d.ts +42 -0
  655. package/dist/lifeline/MessageQueue.d.ts.map +1 -0
  656. package/dist/lifeline/MessageQueue.js +63 -0
  657. package/dist/lifeline/MessageQueue.js.map +1 -0
  658. package/dist/lifeline/ServerSupervisor.d.ts +203 -0
  659. package/dist/lifeline/ServerSupervisor.d.ts.map +1 -0
  660. package/dist/lifeline/ServerSupervisor.js +1103 -0
  661. package/dist/lifeline/ServerSupervisor.js.map +1 -0
  662. package/dist/lifeline/SlackLifeline.d.ts +43 -0
  663. package/dist/lifeline/SlackLifeline.d.ts.map +1 -0
  664. package/dist/lifeline/SlackLifeline.js +227 -0
  665. package/dist/lifeline/SlackLifeline.js.map +1 -0
  666. package/dist/lifeline/TelegramLifeline.d.ts +180 -0
  667. package/dist/lifeline/TelegramLifeline.d.ts.map +1 -0
  668. package/dist/lifeline/TelegramLifeline.js +1533 -0
  669. package/dist/lifeline/TelegramLifeline.js.map +1 -0
  670. package/dist/memory/ActivityPartitioner.d.ts +67 -0
  671. package/dist/memory/ActivityPartitioner.d.ts.map +1 -0
  672. package/dist/memory/ActivityPartitioner.js +193 -0
  673. package/dist/memory/ActivityPartitioner.js.map +1 -0
  674. package/dist/memory/Chunker.d.ts +39 -0
  675. package/dist/memory/Chunker.d.ts.map +1 -0
  676. package/dist/memory/Chunker.js +154 -0
  677. package/dist/memory/Chunker.js.map +1 -0
  678. package/dist/memory/EmbeddingProvider.d.ts +82 -0
  679. package/dist/memory/EmbeddingProvider.d.ts.map +1 -0
  680. package/dist/memory/EmbeddingProvider.js +168 -0
  681. package/dist/memory/EmbeddingProvider.js.map +1 -0
  682. package/dist/memory/EpisodicMemory.d.ts +141 -0
  683. package/dist/memory/EpisodicMemory.d.ts.map +1 -0
  684. package/dist/memory/EpisodicMemory.js +303 -0
  685. package/dist/memory/EpisodicMemory.js.map +1 -0
  686. package/dist/memory/MemoryExporter.d.ts +82 -0
  687. package/dist/memory/MemoryExporter.d.ts.map +1 -0
  688. package/dist/memory/MemoryExporter.js +233 -0
  689. package/dist/memory/MemoryExporter.js.map +1 -0
  690. package/dist/memory/MemoryIndex.d.ts +76 -0
  691. package/dist/memory/MemoryIndex.d.ts.map +1 -0
  692. package/dist/memory/MemoryIndex.js +413 -0
  693. package/dist/memory/MemoryIndex.js.map +1 -0
  694. package/dist/memory/MemoryMigrator.d.ts +103 -0
  695. package/dist/memory/MemoryMigrator.d.ts.map +1 -0
  696. package/dist/memory/MemoryMigrator.js +510 -0
  697. package/dist/memory/MemoryMigrator.js.map +1 -0
  698. package/dist/memory/SemanticMemory.d.ts +255 -0
  699. package/dist/memory/SemanticMemory.d.ts.map +1 -0
  700. package/dist/memory/SemanticMemory.js +1130 -0
  701. package/dist/memory/SemanticMemory.js.map +1 -0
  702. package/dist/memory/TopicMemory.d.ts +227 -0
  703. package/dist/memory/TopicMemory.d.ts.map +1 -0
  704. package/dist/memory/TopicMemory.js +731 -0
  705. package/dist/memory/TopicMemory.js.map +1 -0
  706. package/dist/memory/TopicSummarizer.d.ts +69 -0
  707. package/dist/memory/TopicSummarizer.d.ts.map +1 -0
  708. package/dist/memory/TopicSummarizer.js +163 -0
  709. package/dist/memory/TopicSummarizer.js.map +1 -0
  710. package/dist/memory/VectorSearch.d.ts +80 -0
  711. package/dist/memory/VectorSearch.d.ts.map +1 -0
  712. package/dist/memory/VectorSearch.js +148 -0
  713. package/dist/memory/VectorSearch.js.map +1 -0
  714. package/dist/memory/WorkingMemoryAssembler.d.ts +122 -0
  715. package/dist/memory/WorkingMemoryAssembler.d.ts.map +1 -0
  716. package/dist/memory/WorkingMemoryAssembler.js +406 -0
  717. package/dist/memory/WorkingMemoryAssembler.js.map +1 -0
  718. package/dist/messaging/AdapterRegistry.d.ts +27 -0
  719. package/dist/messaging/AdapterRegistry.d.ts.map +1 -0
  720. package/dist/messaging/AdapterRegistry.js +40 -0
  721. package/dist/messaging/AdapterRegistry.js.map +1 -0
  722. package/dist/messaging/AgentTokenManager.d.ts +86 -0
  723. package/dist/messaging/AgentTokenManager.d.ts.map +1 -0
  724. package/dist/messaging/AgentTokenManager.js +213 -0
  725. package/dist/messaging/AgentTokenManager.js.map +1 -0
  726. package/dist/messaging/DeliveryRetryManager.d.ts +47 -0
  727. package/dist/messaging/DeliveryRetryManager.d.ts.map +1 -0
  728. package/dist/messaging/DeliveryRetryManager.js +201 -0
  729. package/dist/messaging/DeliveryRetryManager.js.map +1 -0
  730. package/dist/messaging/DropPickup.d.ts +37 -0
  731. package/dist/messaging/DropPickup.d.ts.map +1 -0
  732. package/dist/messaging/DropPickup.js +120 -0
  733. package/dist/messaging/DropPickup.js.map +1 -0
  734. package/dist/messaging/GitSyncTransport.d.ts +120 -0
  735. package/dist/messaging/GitSyncTransport.d.ts.map +1 -0
  736. package/dist/messaging/GitSyncTransport.js +296 -0
  737. package/dist/messaging/GitSyncTransport.js.map +1 -0
  738. package/dist/messaging/MessageDelivery.d.ts +27 -0
  739. package/dist/messaging/MessageDelivery.d.ts.map +1 -0
  740. package/dist/messaging/MessageDelivery.js +90 -0
  741. package/dist/messaging/MessageDelivery.js.map +1 -0
  742. package/dist/messaging/MessageFormatter.d.ts +30 -0
  743. package/dist/messaging/MessageFormatter.d.ts.map +1 -0
  744. package/dist/messaging/MessageFormatter.js +97 -0
  745. package/dist/messaging/MessageFormatter.js.map +1 -0
  746. package/dist/messaging/MessageRouter.d.ts +157 -0
  747. package/dist/messaging/MessageRouter.d.ts.map +1 -0
  748. package/dist/messaging/MessageRouter.js +657 -0
  749. package/dist/messaging/MessageRouter.js.map +1 -0
  750. package/dist/messaging/MessageStore.d.ts +52 -0
  751. package/dist/messaging/MessageStore.d.ts.map +1 -0
  752. package/dist/messaging/MessageStore.js +363 -0
  753. package/dist/messaging/MessageStore.js.map +1 -0
  754. package/dist/messaging/NotificationBatcher.d.ts +95 -0
  755. package/dist/messaging/NotificationBatcher.d.ts.map +1 -0
  756. package/dist/messaging/NotificationBatcher.js +253 -0
  757. package/dist/messaging/NotificationBatcher.js.map +1 -0
  758. package/dist/messaging/SessionSummarySentinel.d.ts +104 -0
  759. package/dist/messaging/SessionSummarySentinel.d.ts.map +1 -0
  760. package/dist/messaging/SessionSummarySentinel.js +386 -0
  761. package/dist/messaging/SessionSummarySentinel.js.map +1 -0
  762. package/dist/messaging/SpawnRequestManager.d.ts +88 -0
  763. package/dist/messaging/SpawnRequestManager.d.ts.map +1 -0
  764. package/dist/messaging/SpawnRequestManager.js +159 -0
  765. package/dist/messaging/SpawnRequestManager.js.map +1 -0
  766. package/dist/messaging/TelegramAdapter.d.ts +636 -0
  767. package/dist/messaging/TelegramAdapter.d.ts.map +1 -0
  768. package/dist/messaging/TelegramAdapter.js +3434 -0
  769. package/dist/messaging/TelegramAdapter.js.map +1 -0
  770. package/dist/messaging/TopicContentValidator.d.ts +81 -0
  771. package/dist/messaging/TopicContentValidator.d.ts.map +1 -0
  772. package/dist/messaging/TopicContentValidator.js +113 -0
  773. package/dist/messaging/TopicContentValidator.js.map +1 -0
  774. package/dist/messaging/WhatsAppAdapter.d.ts +224 -0
  775. package/dist/messaging/WhatsAppAdapter.d.ts.map +1 -0
  776. package/dist/messaging/WhatsAppAdapter.js +736 -0
  777. package/dist/messaging/WhatsAppAdapter.js.map +1 -0
  778. package/dist/messaging/backends/BaileysBackend.d.ts +74 -0
  779. package/dist/messaging/backends/BaileysBackend.d.ts.map +1 -0
  780. package/dist/messaging/backends/BaileysBackend.js +481 -0
  781. package/dist/messaging/backends/BaileysBackend.js.map +1 -0
  782. package/dist/messaging/backends/BusinessApiBackend.d.ts +173 -0
  783. package/dist/messaging/backends/BusinessApiBackend.d.ts.map +1 -0
  784. package/dist/messaging/backends/BusinessApiBackend.js +269 -0
  785. package/dist/messaging/backends/BusinessApiBackend.js.map +1 -0
  786. package/dist/messaging/backends/WhatsAppWebhookRoutes.d.ts +26 -0
  787. package/dist/messaging/backends/WhatsAppWebhookRoutes.d.ts.map +1 -0
  788. package/dist/messaging/backends/WhatsAppWebhookRoutes.js +50 -0
  789. package/dist/messaging/backends/WhatsAppWebhookRoutes.js.map +1 -0
  790. package/dist/messaging/shared/AuthGate.d.ts +102 -0
  791. package/dist/messaging/shared/AuthGate.d.ts.map +1 -0
  792. package/dist/messaging/shared/AuthGate.js +159 -0
  793. package/dist/messaging/shared/AuthGate.js.map +1 -0
  794. package/dist/messaging/shared/CommandRouter.d.ts +84 -0
  795. package/dist/messaging/shared/CommandRouter.d.ts.map +1 -0
  796. package/dist/messaging/shared/CommandRouter.js +145 -0
  797. package/dist/messaging/shared/CommandRouter.js.map +1 -0
  798. package/dist/messaging/shared/CrossPlatformAlerts.d.ts +67 -0
  799. package/dist/messaging/shared/CrossPlatformAlerts.d.ts.map +1 -0
  800. package/dist/messaging/shared/CrossPlatformAlerts.js +134 -0
  801. package/dist/messaging/shared/CrossPlatformAlerts.js.map +1 -0
  802. package/dist/messaging/shared/EncryptedAuthStore.d.ts +51 -0
  803. package/dist/messaging/shared/EncryptedAuthStore.d.ts.map +1 -0
  804. package/dist/messaging/shared/EncryptedAuthStore.js +194 -0
  805. package/dist/messaging/shared/EncryptedAuthStore.js.map +1 -0
  806. package/dist/messaging/shared/FeatureFlags.d.ts +21 -0
  807. package/dist/messaging/shared/FeatureFlags.d.ts.map +1 -0
  808. package/dist/messaging/shared/FeatureFlags.js +21 -0
  809. package/dist/messaging/shared/FeatureFlags.js.map +1 -0
  810. package/dist/messaging/shared/MessageBridge.d.ts +70 -0
  811. package/dist/messaging/shared/MessageBridge.d.ts.map +1 -0
  812. package/dist/messaging/shared/MessageBridge.js +178 -0
  813. package/dist/messaging/shared/MessageBridge.js.map +1 -0
  814. package/dist/messaging/shared/MessageLogger.d.ts +94 -0
  815. package/dist/messaging/shared/MessageLogger.d.ts.map +1 -0
  816. package/dist/messaging/shared/MessageLogger.js +173 -0
  817. package/dist/messaging/shared/MessageLogger.js.map +1 -0
  818. package/dist/messaging/shared/MessagingEventBus.d.ts +149 -0
  819. package/dist/messaging/shared/MessagingEventBus.d.ts.map +1 -0
  820. package/dist/messaging/shared/MessagingEventBus.js +111 -0
  821. package/dist/messaging/shared/MessagingEventBus.js.map +1 -0
  822. package/dist/messaging/shared/PhoneUtils.d.ts +44 -0
  823. package/dist/messaging/shared/PhoneUtils.d.ts.map +1 -0
  824. package/dist/messaging/shared/PhoneUtils.js +110 -0
  825. package/dist/messaging/shared/PhoneUtils.js.map +1 -0
  826. package/dist/messaging/shared/PrivacyConsent.d.ts +61 -0
  827. package/dist/messaging/shared/PrivacyConsent.d.ts.map +1 -0
  828. package/dist/messaging/shared/PrivacyConsent.js +132 -0
  829. package/dist/messaging/shared/PrivacyConsent.js.map +1 -0
  830. package/dist/messaging/shared/SessionChannelRegistry.d.ts +48 -0
  831. package/dist/messaging/shared/SessionChannelRegistry.d.ts.map +1 -0
  832. package/dist/messaging/shared/SessionChannelRegistry.js +144 -0
  833. package/dist/messaging/shared/SessionChannelRegistry.js.map +1 -0
  834. package/dist/messaging/shared/SmartChunker.d.ts +16 -0
  835. package/dist/messaging/shared/SmartChunker.d.ts.map +1 -0
  836. package/dist/messaging/shared/SmartChunker.js +100 -0
  837. package/dist/messaging/shared/SmartChunker.js.map +1 -0
  838. package/dist/messaging/shared/StallDetector.d.ts +85 -0
  839. package/dist/messaging/shared/StallDetector.d.ts.map +1 -0
  840. package/dist/messaging/shared/StallDetector.js +225 -0
  841. package/dist/messaging/shared/StallDetector.js.map +1 -0
  842. package/dist/messaging/shared/index.d.ts +22 -0
  843. package/dist/messaging/shared/index.d.ts.map +1 -0
  844. package/dist/messaging/shared/index.js +13 -0
  845. package/dist/messaging/shared/index.js.map +1 -0
  846. package/dist/messaging/slack/ChannelManager.d.ts +36 -0
  847. package/dist/messaging/slack/ChannelManager.d.ts.map +1 -0
  848. package/dist/messaging/slack/ChannelManager.js +100 -0
  849. package/dist/messaging/slack/ChannelManager.js.map +1 -0
  850. package/dist/messaging/slack/FileHandler.d.ts +30 -0
  851. package/dist/messaging/slack/FileHandler.d.ts.map +1 -0
  852. package/dist/messaging/slack/FileHandler.js +87 -0
  853. package/dist/messaging/slack/FileHandler.js.map +1 -0
  854. package/dist/messaging/slack/RingBuffer.d.ts +22 -0
  855. package/dist/messaging/slack/RingBuffer.d.ts.map +1 -0
  856. package/dist/messaging/slack/RingBuffer.js +48 -0
  857. package/dist/messaging/slack/RingBuffer.js.map +1 -0
  858. package/dist/messaging/slack/SlackAdapter.d.ts +283 -0
  859. package/dist/messaging/slack/SlackAdapter.d.ts.map +1 -0
  860. package/dist/messaging/slack/SlackAdapter.js +1524 -0
  861. package/dist/messaging/slack/SlackAdapter.js.map +1 -0
  862. package/dist/messaging/slack/SlackApiClient.d.ts +51 -0
  863. package/dist/messaging/slack/SlackApiClient.d.ts.map +1 -0
  864. package/dist/messaging/slack/SlackApiClient.js +94 -0
  865. package/dist/messaging/slack/SlackApiClient.js.map +1 -0
  866. package/dist/messaging/slack/SocketModeClient.d.ts +44 -0
  867. package/dist/messaging/slack/SocketModeClient.d.ts.map +1 -0
  868. package/dist/messaging/slack/SocketModeClient.js +209 -0
  869. package/dist/messaging/slack/SocketModeClient.js.map +1 -0
  870. package/dist/messaging/slack/index.d.ts +12 -0
  871. package/dist/messaging/slack/index.d.ts.map +1 -0
  872. package/dist/messaging/slack/index.js +15 -0
  873. package/dist/messaging/slack/index.js.map +1 -0
  874. package/dist/messaging/slack/sanitize.d.ts +39 -0
  875. package/dist/messaging/slack/sanitize.d.ts.map +1 -0
  876. package/dist/messaging/slack/sanitize.js +71 -0
  877. package/dist/messaging/slack/sanitize.js.map +1 -0
  878. package/dist/messaging/slack/types.d.ts +186 -0
  879. package/dist/messaging/slack/types.d.ts.map +1 -0
  880. package/dist/messaging/slack/types.js +54 -0
  881. package/dist/messaging/slack/types.js.map +1 -0
  882. package/dist/messaging/types.d.ts +400 -0
  883. package/dist/messaging/types.d.ts.map +1 -0
  884. package/dist/messaging/types.js +89 -0
  885. package/dist/messaging/types.js.map +1 -0
  886. package/dist/monitoring/AccountSwitcher.d.ts +61 -0
  887. package/dist/monitoring/AccountSwitcher.d.ts.map +1 -0
  888. package/dist/monitoring/AccountSwitcher.js +196 -0
  889. package/dist/monitoring/AccountSwitcher.js.map +1 -0
  890. package/dist/monitoring/CoherenceMonitor.d.ts +133 -0
  891. package/dist/monitoring/CoherenceMonitor.d.ts.map +1 -0
  892. package/dist/monitoring/CoherenceMonitor.js +550 -0
  893. package/dist/monitoring/CoherenceMonitor.js.map +1 -0
  894. package/dist/monitoring/CommitmentSentinel.d.ts +57 -0
  895. package/dist/monitoring/CommitmentSentinel.d.ts.map +1 -0
  896. package/dist/monitoring/CommitmentSentinel.js +251 -0
  897. package/dist/monitoring/CommitmentSentinel.js.map +1 -0
  898. package/dist/monitoring/CommitmentTracker.d.ts +186 -0
  899. package/dist/monitoring/CommitmentTracker.d.ts.map +1 -0
  900. package/dist/monitoring/CommitmentTracker.js +522 -0
  901. package/dist/monitoring/CommitmentTracker.js.map +1 -0
  902. package/dist/monitoring/CredentialProvider.d.ts +84 -0
  903. package/dist/monitoring/CredentialProvider.d.ts.map +1 -0
  904. package/dist/monitoring/CredentialProvider.js +196 -0
  905. package/dist/monitoring/CredentialProvider.js.map +1 -0
  906. package/dist/monitoring/DegradationReporter.d.ts +123 -0
  907. package/dist/monitoring/DegradationReporter.d.ts.map +1 -0
  908. package/dist/monitoring/DegradationReporter.js +241 -0
  909. package/dist/monitoring/DegradationReporter.js.map +1 -0
  910. package/dist/monitoring/FeedbackAnomalyDetector.d.ts +51 -0
  911. package/dist/monitoring/FeedbackAnomalyDetector.d.ts.map +1 -0
  912. package/dist/monitoring/FeedbackAnomalyDetector.js +120 -0
  913. package/dist/monitoring/FeedbackAnomalyDetector.js.map +1 -0
  914. package/dist/monitoring/HealthChecker.d.ts +45 -0
  915. package/dist/monitoring/HealthChecker.d.ts.map +1 -0
  916. package/dist/monitoring/HealthChecker.js +219 -0
  917. package/dist/monitoring/HealthChecker.js.map +1 -0
  918. package/dist/monitoring/HomeostasisMonitor.d.ts +102 -0
  919. package/dist/monitoring/HomeostasisMonitor.d.ts.map +1 -0
  920. package/dist/monitoring/HomeostasisMonitor.js +185 -0
  921. package/dist/monitoring/HomeostasisMonitor.js.map +1 -0
  922. package/dist/monitoring/HookEventReceiver.d.ts +132 -0
  923. package/dist/monitoring/HookEventReceiver.d.ts.map +1 -0
  924. package/dist/monitoring/HookEventReceiver.js +209 -0
  925. package/dist/monitoring/HookEventReceiver.js.map +1 -0
  926. package/dist/monitoring/InputClassifier.d.ts +68 -0
  927. package/dist/monitoring/InputClassifier.d.ts.map +1 -0
  928. package/dist/monitoring/InputClassifier.js +243 -0
  929. package/dist/monitoring/InputClassifier.js.map +1 -0
  930. package/dist/monitoring/InstructionsVerifier.d.ts +76 -0
  931. package/dist/monitoring/InstructionsVerifier.d.ts.map +1 -0
  932. package/dist/monitoring/InstructionsVerifier.js +116 -0
  933. package/dist/monitoring/InstructionsVerifier.js.map +1 -0
  934. package/dist/monitoring/MemoryPressureMonitor.d.ts +107 -0
  935. package/dist/monitoring/MemoryPressureMonitor.d.ts.map +1 -0
  936. package/dist/monitoring/MemoryPressureMonitor.js +329 -0
  937. package/dist/monitoring/MemoryPressureMonitor.js.map +1 -0
  938. package/dist/monitoring/OrphanProcessReaper.d.ts +125 -0
  939. package/dist/monitoring/OrphanProcessReaper.d.ts.map +1 -0
  940. package/dist/monitoring/OrphanProcessReaper.js +476 -0
  941. package/dist/monitoring/OrphanProcessReaper.js.map +1 -0
  942. package/dist/monitoring/PresenceProxy.d.ts +167 -0
  943. package/dist/monitoring/PresenceProxy.d.ts.map +1 -0
  944. package/dist/monitoring/PresenceProxy.js +972 -0
  945. package/dist/monitoring/PresenceProxy.js.map +1 -0
  946. package/dist/monitoring/PromptGate.d.ts +91 -0
  947. package/dist/monitoring/PromptGate.d.ts.map +1 -0
  948. package/dist/monitoring/PromptGate.js +411 -0
  949. package/dist/monitoring/PromptGate.js.map +1 -0
  950. package/dist/monitoring/QuotaCollector.d.ts +267 -0
  951. package/dist/monitoring/QuotaCollector.d.ts.map +1 -0
  952. package/dist/monitoring/QuotaCollector.js +790 -0
  953. package/dist/monitoring/QuotaCollector.js.map +1 -0
  954. package/dist/monitoring/QuotaExhaustionDetector.d.ts +21 -0
  955. package/dist/monitoring/QuotaExhaustionDetector.d.ts.map +1 -0
  956. package/dist/monitoring/QuotaExhaustionDetector.js +136 -0
  957. package/dist/monitoring/QuotaExhaustionDetector.js.map +1 -0
  958. package/dist/monitoring/QuotaManager.d.ts +191 -0
  959. package/dist/monitoring/QuotaManager.d.ts.map +1 -0
  960. package/dist/monitoring/QuotaManager.js +575 -0
  961. package/dist/monitoring/QuotaManager.js.map +1 -0
  962. package/dist/monitoring/QuotaNotifier.d.ts +38 -0
  963. package/dist/monitoring/QuotaNotifier.d.ts.map +1 -0
  964. package/dist/monitoring/QuotaNotifier.js +144 -0
  965. package/dist/monitoring/QuotaNotifier.js.map +1 -0
  966. package/dist/monitoring/QuotaTracker.d.ts +92 -0
  967. package/dist/monitoring/QuotaTracker.d.ts.map +1 -0
  968. package/dist/monitoring/QuotaTracker.js +239 -0
  969. package/dist/monitoring/QuotaTracker.js.map +1 -0
  970. package/dist/monitoring/ReflectionMetrics.d.ts +97 -0
  971. package/dist/monitoring/ReflectionMetrics.d.ts.map +1 -0
  972. package/dist/monitoring/ReflectionMetrics.js +170 -0
  973. package/dist/monitoring/ReflectionMetrics.js.map +1 -0
  974. package/dist/monitoring/SessionActivitySentinel.d.ts +95 -0
  975. package/dist/monitoring/SessionActivitySentinel.d.ts.map +1 -0
  976. package/dist/monitoring/SessionActivitySentinel.js +391 -0
  977. package/dist/monitoring/SessionActivitySentinel.js.map +1 -0
  978. package/dist/monitoring/SessionCredentialManager.d.ts +56 -0
  979. package/dist/monitoring/SessionCredentialManager.d.ts.map +1 -0
  980. package/dist/monitoring/SessionCredentialManager.js +91 -0
  981. package/dist/monitoring/SessionCredentialManager.js.map +1 -0
  982. package/dist/monitoring/SessionMigrator.d.ts +234 -0
  983. package/dist/monitoring/SessionMigrator.d.ts.map +1 -0
  984. package/dist/monitoring/SessionMigrator.js +604 -0
  985. package/dist/monitoring/SessionMigrator.js.map +1 -0
  986. package/dist/monitoring/SessionMonitor.d.ts +102 -0
  987. package/dist/monitoring/SessionMonitor.d.ts.map +1 -0
  988. package/dist/monitoring/SessionMonitor.js +238 -0
  989. package/dist/monitoring/SessionMonitor.js.map +1 -0
  990. package/dist/monitoring/SessionRecovery.d.ts +129 -0
  991. package/dist/monitoring/SessionRecovery.d.ts.map +1 -0
  992. package/dist/monitoring/SessionRecovery.js +496 -0
  993. package/dist/monitoring/SessionRecovery.js.map +1 -0
  994. package/dist/monitoring/SessionWatchdog.d.ts +138 -0
  995. package/dist/monitoring/SessionWatchdog.d.ts.map +1 -0
  996. package/dist/monitoring/SessionWatchdog.js +549 -0
  997. package/dist/monitoring/SessionWatchdog.js.map +1 -0
  998. package/dist/monitoring/StallTriageNurse.d.ts +96 -0
  999. package/dist/monitoring/StallTriageNurse.d.ts.map +1 -0
  1000. package/dist/monitoring/StallTriageNurse.js +711 -0
  1001. package/dist/monitoring/StallTriageNurse.js.map +1 -0
  1002. package/dist/monitoring/StallTriageNurse.types.d.ts +124 -0
  1003. package/dist/monitoring/StallTriageNurse.types.d.ts.map +1 -0
  1004. package/dist/monitoring/StallTriageNurse.types.js +5 -0
  1005. package/dist/monitoring/StallTriageNurse.types.js.map +1 -0
  1006. package/dist/monitoring/SubagentTracker.d.ts +86 -0
  1007. package/dist/monitoring/SubagentTracker.d.ts.map +1 -0
  1008. package/dist/monitoring/SubagentTracker.js +199 -0
  1009. package/dist/monitoring/SubagentTracker.js.map +1 -0
  1010. package/dist/monitoring/SystemReviewer.d.ts +243 -0
  1011. package/dist/monitoring/SystemReviewer.d.ts.map +1 -0
  1012. package/dist/monitoring/SystemReviewer.js +697 -0
  1013. package/dist/monitoring/SystemReviewer.js.map +1 -0
  1014. package/dist/monitoring/TelemetryAuth.d.ts +64 -0
  1015. package/dist/monitoring/TelemetryAuth.d.ts.map +1 -0
  1016. package/dist/monitoring/TelemetryAuth.js +141 -0
  1017. package/dist/monitoring/TelemetryAuth.js.map +1 -0
  1018. package/dist/monitoring/TelemetryCollector.d.ts +95 -0
  1019. package/dist/monitoring/TelemetryCollector.d.ts.map +1 -0
  1020. package/dist/monitoring/TelemetryCollector.js +326 -0
  1021. package/dist/monitoring/TelemetryCollector.js.map +1 -0
  1022. package/dist/monitoring/TelemetryHeartbeat.d.ts +160 -0
  1023. package/dist/monitoring/TelemetryHeartbeat.d.ts.map +1 -0
  1024. package/dist/monitoring/TelemetryHeartbeat.js +450 -0
  1025. package/dist/monitoring/TelemetryHeartbeat.js.map +1 -0
  1026. package/dist/monitoring/TriageOrchestrator.d.ts +217 -0
  1027. package/dist/monitoring/TriageOrchestrator.d.ts.map +1 -0
  1028. package/dist/monitoring/TriageOrchestrator.js +801 -0
  1029. package/dist/monitoring/TriageOrchestrator.js.map +1 -0
  1030. package/dist/monitoring/WorktreeMonitor.d.ts +124 -0
  1031. package/dist/monitoring/WorktreeMonitor.d.ts.map +1 -0
  1032. package/dist/monitoring/WorktreeMonitor.js +379 -0
  1033. package/dist/monitoring/WorktreeMonitor.js.map +1 -0
  1034. package/dist/monitoring/crash-detector.d.ts +50 -0
  1035. package/dist/monitoring/crash-detector.d.ts.map +1 -0
  1036. package/dist/monitoring/crash-detector.js +224 -0
  1037. package/dist/monitoring/crash-detector.js.map +1 -0
  1038. package/dist/monitoring/jsonl-truncator.d.ts +44 -0
  1039. package/dist/monitoring/jsonl-truncator.d.ts.map +1 -0
  1040. package/dist/monitoring/jsonl-truncator.js +224 -0
  1041. package/dist/monitoring/jsonl-truncator.js.map +1 -0
  1042. package/dist/monitoring/probes/LifelineProbe.d.ts +38 -0
  1043. package/dist/monitoring/probes/LifelineProbe.d.ts.map +1 -0
  1044. package/dist/monitoring/probes/LifelineProbe.js +285 -0
  1045. package/dist/monitoring/probes/LifelineProbe.js.map +1 -0
  1046. package/dist/monitoring/probes/MessagingProbe.d.ts +23 -0
  1047. package/dist/monitoring/probes/MessagingProbe.d.ts.map +1 -0
  1048. package/dist/monitoring/probes/MessagingProbe.js +214 -0
  1049. package/dist/monitoring/probes/MessagingProbe.js.map +1 -0
  1050. package/dist/monitoring/probes/PlatformProbe.d.ts +15 -0
  1051. package/dist/monitoring/probes/PlatformProbe.d.ts.map +1 -0
  1052. package/dist/monitoring/probes/PlatformProbe.js +222 -0
  1053. package/dist/monitoring/probes/PlatformProbe.js.map +1 -0
  1054. package/dist/monitoring/probes/SchedulerProbe.d.ts +33 -0
  1055. package/dist/monitoring/probes/SchedulerProbe.d.ts.map +1 -0
  1056. package/dist/monitoring/probes/SchedulerProbe.js +196 -0
  1057. package/dist/monitoring/probes/SchedulerProbe.js.map +1 -0
  1058. package/dist/monitoring/probes/SessionProbe.d.ts +28 -0
  1059. package/dist/monitoring/probes/SessionProbe.d.ts.map +1 -0
  1060. package/dist/monitoring/probes/SessionProbe.js +234 -0
  1061. package/dist/monitoring/probes/SessionProbe.js.map +1 -0
  1062. package/dist/monitoring/stall-detector.d.ts +34 -0
  1063. package/dist/monitoring/stall-detector.d.ts.map +1 -0
  1064. package/dist/monitoring/stall-detector.js +151 -0
  1065. package/dist/monitoring/stall-detector.js.map +1 -0
  1066. package/dist/paste/PasteManager.d.ts +154 -0
  1067. package/dist/paste/PasteManager.d.ts.map +1 -0
  1068. package/dist/paste/PasteManager.js +524 -0
  1069. package/dist/paste/PasteManager.js.map +1 -0
  1070. package/dist/paste/TruncationDetector.d.ts +51 -0
  1071. package/dist/paste/TruncationDetector.d.ts.map +1 -0
  1072. package/dist/paste/TruncationDetector.js +220 -0
  1073. package/dist/paste/TruncationDetector.js.map +1 -0
  1074. package/dist/privacy/OutputPrivacyRouter.d.ts +65 -0
  1075. package/dist/privacy/OutputPrivacyRouter.d.ts.map +1 -0
  1076. package/dist/privacy/OutputPrivacyRouter.js +156 -0
  1077. package/dist/privacy/OutputPrivacyRouter.js.map +1 -0
  1078. package/dist/publishing/PrivateViewer.d.ts +63 -0
  1079. package/dist/publishing/PrivateViewer.d.ts.map +1 -0
  1080. package/dist/publishing/PrivateViewer.js +398 -0
  1081. package/dist/publishing/PrivateViewer.js.map +1 -0
  1082. package/dist/publishing/TelegraphService.d.ts +137 -0
  1083. package/dist/publishing/TelegraphService.d.ts.map +1 -0
  1084. package/dist/publishing/TelegraphService.js +410 -0
  1085. package/dist/publishing/TelegraphService.js.map +1 -0
  1086. package/dist/scaffold/bootstrap.d.ts +21 -0
  1087. package/dist/scaffold/bootstrap.d.ts.map +1 -0
  1088. package/dist/scaffold/bootstrap.js +125 -0
  1089. package/dist/scaffold/bootstrap.js.map +1 -0
  1090. package/dist/scaffold/templates.d.ts +47 -0
  1091. package/dist/scaffold/templates.d.ts.map +1 -0
  1092. package/dist/scaffold/templates.js +1506 -0
  1093. package/dist/scaffold/templates.js.map +1 -0
  1094. package/dist/scheduler/IntegrationGate.d.ts +81 -0
  1095. package/dist/scheduler/IntegrationGate.d.ts.map +1 -0
  1096. package/dist/scheduler/IntegrationGate.js +242 -0
  1097. package/dist/scheduler/IntegrationGate.js.map +1 -0
  1098. package/dist/scheduler/JobClaimManager.d.ts +137 -0
  1099. package/dist/scheduler/JobClaimManager.d.ts.map +1 -0
  1100. package/dist/scheduler/JobClaimManager.js +283 -0
  1101. package/dist/scheduler/JobClaimManager.js.map +1 -0
  1102. package/dist/scheduler/JobLoader.d.ts +28 -0
  1103. package/dist/scheduler/JobLoader.d.ts.map +1 -0
  1104. package/dist/scheduler/JobLoader.js +269 -0
  1105. package/dist/scheduler/JobLoader.js.map +1 -0
  1106. package/dist/scheduler/JobRunHistory.d.ts +180 -0
  1107. package/dist/scheduler/JobRunHistory.d.ts.map +1 -0
  1108. package/dist/scheduler/JobRunHistory.js +349 -0
  1109. package/dist/scheduler/JobRunHistory.js.map +1 -0
  1110. package/dist/scheduler/JobScheduler.d.ts +244 -0
  1111. package/dist/scheduler/JobScheduler.d.ts.map +1 -0
  1112. package/dist/scheduler/JobScheduler.js +1085 -0
  1113. package/dist/scheduler/JobScheduler.js.map +1 -0
  1114. package/dist/scheduler/SkipLedger.d.ts +65 -0
  1115. package/dist/scheduler/SkipLedger.d.ts.map +1 -0
  1116. package/dist/scheduler/SkipLedger.js +179 -0
  1117. package/dist/scheduler/SkipLedger.js.map +1 -0
  1118. package/dist/security/LLMSanitizer.d.ts +65 -0
  1119. package/dist/security/LLMSanitizer.d.ts.map +1 -0
  1120. package/dist/security/LLMSanitizer.js +153 -0
  1121. package/dist/security/LLMSanitizer.js.map +1 -0
  1122. package/dist/security/ManifestIntegrity.d.ts +72 -0
  1123. package/dist/security/ManifestIntegrity.d.ts.map +1 -0
  1124. package/dist/security/ManifestIntegrity.js +159 -0
  1125. package/dist/security/ManifestIntegrity.js.map +1 -0
  1126. package/dist/server/AgentServer.d.ts +134 -0
  1127. package/dist/server/AgentServer.d.ts.map +1 -0
  1128. package/dist/server/AgentServer.js +307 -0
  1129. package/dist/server/AgentServer.js.map +1 -0
  1130. package/dist/server/SecretDrop.d.ts +133 -0
  1131. package/dist/server/SecretDrop.d.ts.map +1 -0
  1132. package/dist/server/SecretDrop.js +473 -0
  1133. package/dist/server/SecretDrop.js.map +1 -0
  1134. package/dist/server/WebSocketManager.d.ts +80 -0
  1135. package/dist/server/WebSocketManager.d.ts.map +1 -0
  1136. package/dist/server/WebSocketManager.js +367 -0
  1137. package/dist/server/WebSocketManager.js.map +1 -0
  1138. package/dist/server/fileRoutes.d.ts +19 -0
  1139. package/dist/server/fileRoutes.d.ts.map +1 -0
  1140. package/dist/server/fileRoutes.js +578 -0
  1141. package/dist/server/fileRoutes.js.map +1 -0
  1142. package/dist/server/machineAuth.d.ts +87 -0
  1143. package/dist/server/machineAuth.d.ts.map +1 -0
  1144. package/dist/server/machineAuth.js +188 -0
  1145. package/dist/server/machineAuth.js.map +1 -0
  1146. package/dist/server/machineRoutes.d.ts +49 -0
  1147. package/dist/server/machineRoutes.d.ts.map +1 -0
  1148. package/dist/server/machineRoutes.js +305 -0
  1149. package/dist/server/machineRoutes.js.map +1 -0
  1150. package/dist/server/middleware.d.ts +32 -0
  1151. package/dist/server/middleware.d.ts.map +1 -0
  1152. package/dist/server/middleware.js +202 -0
  1153. package/dist/server/middleware.js.map +1 -0
  1154. package/dist/server/routes.d.ts +132 -0
  1155. package/dist/server/routes.d.ts.map +1 -0
  1156. package/dist/server/routes.js +8124 -0
  1157. package/dist/server/routes.js.map +1 -0
  1158. package/dist/threadline/A2AGateway.d.ts +184 -0
  1159. package/dist/threadline/A2AGateway.d.ts.map +1 -0
  1160. package/dist/threadline/A2AGateway.js +438 -0
  1161. package/dist/threadline/A2AGateway.js.map +1 -0
  1162. package/dist/threadline/AgentCard.d.ts +116 -0
  1163. package/dist/threadline/AgentCard.d.ts.map +1 -0
  1164. package/dist/threadline/AgentCard.js +212 -0
  1165. package/dist/threadline/AgentCard.js.map +1 -0
  1166. package/dist/threadline/AgentDiscovery.d.ts +156 -0
  1167. package/dist/threadline/AgentDiscovery.d.ts.map +1 -0
  1168. package/dist/threadline/AgentDiscovery.js +390 -0
  1169. package/dist/threadline/AgentDiscovery.js.map +1 -0
  1170. package/dist/threadline/AgentTrustManager.d.ts +190 -0
  1171. package/dist/threadline/AgentTrustManager.d.ts.map +1 -0
  1172. package/dist/threadline/AgentTrustManager.js +526 -0
  1173. package/dist/threadline/AgentTrustManager.js.map +1 -0
  1174. package/dist/threadline/ApprovalQueue.d.ts +71 -0
  1175. package/dist/threadline/ApprovalQueue.d.ts.map +1 -0
  1176. package/dist/threadline/ApprovalQueue.js +154 -0
  1177. package/dist/threadline/ApprovalQueue.js.map +1 -0
  1178. package/dist/threadline/AutonomyGate.d.ts +130 -0
  1179. package/dist/threadline/AutonomyGate.d.ts.map +1 -0
  1180. package/dist/threadline/AutonomyGate.js +267 -0
  1181. package/dist/threadline/AutonomyGate.js.map +1 -0
  1182. package/dist/threadline/CircuitBreaker.d.ts +89 -0
  1183. package/dist/threadline/CircuitBreaker.d.ts.map +1 -0
  1184. package/dist/threadline/CircuitBreaker.js +238 -0
  1185. package/dist/threadline/CircuitBreaker.js.map +1 -0
  1186. package/dist/threadline/ComputeMeter.d.ts +114 -0
  1187. package/dist/threadline/ComputeMeter.d.ts.map +1 -0
  1188. package/dist/threadline/ComputeMeter.js +350 -0
  1189. package/dist/threadline/ComputeMeter.js.map +1 -0
  1190. package/dist/threadline/ContentClassifier.d.ts +83 -0
  1191. package/dist/threadline/ContentClassifier.d.ts.map +1 -0
  1192. package/dist/threadline/ContentClassifier.js +201 -0
  1193. package/dist/threadline/ContentClassifier.js.map +1 -0
  1194. package/dist/threadline/ContextThreadMap.d.ts +103 -0
  1195. package/dist/threadline/ContextThreadMap.d.ts.map +1 -0
  1196. package/dist/threadline/ContextThreadMap.js +279 -0
  1197. package/dist/threadline/ContextThreadMap.js.map +1 -0
  1198. package/dist/threadline/DNSVerifier.d.ts +48 -0
  1199. package/dist/threadline/DNSVerifier.d.ts.map +1 -0
  1200. package/dist/threadline/DNSVerifier.js +138 -0
  1201. package/dist/threadline/DNSVerifier.js.map +1 -0
  1202. package/dist/threadline/DigestCollector.d.ts +70 -0
  1203. package/dist/threadline/DigestCollector.d.ts.map +1 -0
  1204. package/dist/threadline/DigestCollector.js +146 -0
  1205. package/dist/threadline/DigestCollector.js.map +1 -0
  1206. package/dist/threadline/HandshakeManager.d.ts +130 -0
  1207. package/dist/threadline/HandshakeManager.d.ts.map +1 -0
  1208. package/dist/threadline/HandshakeManager.js +402 -0
  1209. package/dist/threadline/HandshakeManager.js.map +1 -0
  1210. package/dist/threadline/InboundMessageGate.d.ts +80 -0
  1211. package/dist/threadline/InboundMessageGate.d.ts.map +1 -0
  1212. package/dist/threadline/InboundMessageGate.js +241 -0
  1213. package/dist/threadline/InboundMessageGate.js.map +1 -0
  1214. package/dist/threadline/InvitationManager.d.ts +91 -0
  1215. package/dist/threadline/InvitationManager.d.ts.map +1 -0
  1216. package/dist/threadline/InvitationManager.js +228 -0
  1217. package/dist/threadline/InvitationManager.js.map +1 -0
  1218. package/dist/threadline/ListenerSessionManager.d.ts +147 -0
  1219. package/dist/threadline/ListenerSessionManager.d.ts.map +1 -0
  1220. package/dist/threadline/ListenerSessionManager.js +326 -0
  1221. package/dist/threadline/ListenerSessionManager.js.map +1 -0
  1222. package/dist/threadline/MCPAuth.d.ts +98 -0
  1223. package/dist/threadline/MCPAuth.d.ts.map +1 -0
  1224. package/dist/threadline/MCPAuth.js +228 -0
  1225. package/dist/threadline/MCPAuth.js.map +1 -0
  1226. package/dist/threadline/OpenClawBridge.d.ts +143 -0
  1227. package/dist/threadline/OpenClawBridge.d.ts.map +1 -0
  1228. package/dist/threadline/OpenClawBridge.js +336 -0
  1229. package/dist/threadline/OpenClawBridge.js.map +1 -0
  1230. package/dist/threadline/OpenClawSkillManifest.d.ts +47 -0
  1231. package/dist/threadline/OpenClawSkillManifest.d.ts.map +1 -0
  1232. package/dist/threadline/OpenClawSkillManifest.js +148 -0
  1233. package/dist/threadline/OpenClawSkillManifest.js.map +1 -0
  1234. package/dist/threadline/RateLimiter.d.ts +105 -0
  1235. package/dist/threadline/RateLimiter.d.ts.map +1 -0
  1236. package/dist/threadline/RateLimiter.js +236 -0
  1237. package/dist/threadline/RateLimiter.js.map +1 -0
  1238. package/dist/threadline/RelayGroundingPreamble.d.ts +48 -0
  1239. package/dist/threadline/RelayGroundingPreamble.d.ts.map +1 -0
  1240. package/dist/threadline/RelayGroundingPreamble.js +68 -0
  1241. package/dist/threadline/RelayGroundingPreamble.js.map +1 -0
  1242. package/dist/threadline/SessionLifecycle.d.ts +136 -0
  1243. package/dist/threadline/SessionLifecycle.d.ts.map +1 -0
  1244. package/dist/threadline/SessionLifecycle.js +317 -0
  1245. package/dist/threadline/SessionLifecycle.js.map +1 -0
  1246. package/dist/threadline/ThreadResumeMap.d.ts +128 -0
  1247. package/dist/threadline/ThreadResumeMap.d.ts.map +1 -0
  1248. package/dist/threadline/ThreadResumeMap.js +324 -0
  1249. package/dist/threadline/ThreadResumeMap.js.map +1 -0
  1250. package/dist/threadline/ThreadlineBootstrap.d.ts +68 -0
  1251. package/dist/threadline/ThreadlineBootstrap.d.ts.map +1 -0
  1252. package/dist/threadline/ThreadlineBootstrap.js +293 -0
  1253. package/dist/threadline/ThreadlineBootstrap.js.map +1 -0
  1254. package/dist/threadline/ThreadlineCrypto.d.ts +53 -0
  1255. package/dist/threadline/ThreadlineCrypto.d.ts.map +1 -0
  1256. package/dist/threadline/ThreadlineCrypto.js +123 -0
  1257. package/dist/threadline/ThreadlineCrypto.js.map +1 -0
  1258. package/dist/threadline/ThreadlineEndpoints.d.ts +35 -0
  1259. package/dist/threadline/ThreadlineEndpoints.d.ts.map +1 -0
  1260. package/dist/threadline/ThreadlineEndpoints.js +313 -0
  1261. package/dist/threadline/ThreadlineEndpoints.js.map +1 -0
  1262. package/dist/threadline/ThreadlineMCPServer.d.ts +165 -0
  1263. package/dist/threadline/ThreadlineMCPServer.d.ts.map +1 -0
  1264. package/dist/threadline/ThreadlineMCPServer.js +885 -0
  1265. package/dist/threadline/ThreadlineMCPServer.js.map +1 -0
  1266. package/dist/threadline/ThreadlineRouter.d.ts +105 -0
  1267. package/dist/threadline/ThreadlineRouter.d.ts.map +1 -0
  1268. package/dist/threadline/ThreadlineRouter.js +323 -0
  1269. package/dist/threadline/ThreadlineRouter.js.map +1 -0
  1270. package/dist/threadline/TrustBootstrap.d.ts +92 -0
  1271. package/dist/threadline/TrustBootstrap.d.ts.map +1 -0
  1272. package/dist/threadline/TrustBootstrap.js +256 -0
  1273. package/dist/threadline/TrustBootstrap.js.map +1 -0
  1274. package/dist/threadline/adapters/AutoGenTool.d.ts +42 -0
  1275. package/dist/threadline/adapters/AutoGenTool.d.ts.map +1 -0
  1276. package/dist/threadline/adapters/AutoGenTool.js +145 -0
  1277. package/dist/threadline/adapters/AutoGenTool.js.map +1 -0
  1278. package/dist/threadline/adapters/CrewAITool.d.ts +31 -0
  1279. package/dist/threadline/adapters/CrewAITool.d.ts.map +1 -0
  1280. package/dist/threadline/adapters/CrewAITool.js +112 -0
  1281. package/dist/threadline/adapters/CrewAITool.js.map +1 -0
  1282. package/dist/threadline/adapters/LangGraphTool.d.ts +48 -0
  1283. package/dist/threadline/adapters/LangGraphTool.d.ts.map +1 -0
  1284. package/dist/threadline/adapters/LangGraphTool.js +153 -0
  1285. package/dist/threadline/adapters/LangGraphTool.js.map +1 -0
  1286. package/dist/threadline/adapters/RESTServer.d.ts +74 -0
  1287. package/dist/threadline/adapters/RESTServer.d.ts.map +1 -0
  1288. package/dist/threadline/adapters/RESTServer.js +291 -0
  1289. package/dist/threadline/adapters/RESTServer.js.map +1 -0
  1290. package/dist/threadline/adapters/index.d.ts +14 -0
  1291. package/dist/threadline/adapters/index.d.ts.map +1 -0
  1292. package/dist/threadline/adapters/index.js +10 -0
  1293. package/dist/threadline/adapters/index.js.map +1 -0
  1294. package/dist/threadline/client/IdentityManager.d.ts +40 -0
  1295. package/dist/threadline/client/IdentityManager.d.ts.map +1 -0
  1296. package/dist/threadline/client/IdentityManager.js +106 -0
  1297. package/dist/threadline/client/IdentityManager.js.map +1 -0
  1298. package/dist/threadline/client/MessageEncryptor.d.ts +63 -0
  1299. package/dist/threadline/client/MessageEncryptor.d.ts.map +1 -0
  1300. package/dist/threadline/client/MessageEncryptor.js +195 -0
  1301. package/dist/threadline/client/MessageEncryptor.js.map +1 -0
  1302. package/dist/threadline/client/RegistryRestClient.d.ts +46 -0
  1303. package/dist/threadline/client/RegistryRestClient.d.ts.map +1 -0
  1304. package/dist/threadline/client/RegistryRestClient.js +114 -0
  1305. package/dist/threadline/client/RegistryRestClient.js.map +1 -0
  1306. package/dist/threadline/client/RelayClient.d.ts +77 -0
  1307. package/dist/threadline/client/RelayClient.d.ts.map +1 -0
  1308. package/dist/threadline/client/RelayClient.js +249 -0
  1309. package/dist/threadline/client/RelayClient.js.map +1 -0
  1310. package/dist/threadline/client/ThreadlineClient.d.ts +117 -0
  1311. package/dist/threadline/client/ThreadlineClient.d.ts.map +1 -0
  1312. package/dist/threadline/client/ThreadlineClient.js +286 -0
  1313. package/dist/threadline/client/ThreadlineClient.js.map +1 -0
  1314. package/dist/threadline/client/index.d.ts +14 -0
  1315. package/dist/threadline/client/index.d.ts.map +1 -0
  1316. package/dist/threadline/client/index.js +9 -0
  1317. package/dist/threadline/client/index.js.map +1 -0
  1318. package/dist/threadline/index.d.ts +81 -0
  1319. package/dist/threadline/index.d.ts.map +1 -0
  1320. package/dist/threadline/index.js +57 -0
  1321. package/dist/threadline/index.js.map +1 -0
  1322. package/dist/threadline/mcp-stdio-entry.d.ts +24 -0
  1323. package/dist/threadline/mcp-stdio-entry.d.ts.map +1 -0
  1324. package/dist/threadline/mcp-stdio-entry.js +230 -0
  1325. package/dist/threadline/mcp-stdio-entry.js.map +1 -0
  1326. package/dist/threadline/relay/A2ABridge.d.ts +91 -0
  1327. package/dist/threadline/relay/A2ABridge.d.ts.map +1 -0
  1328. package/dist/threadline/relay/A2ABridge.js +457 -0
  1329. package/dist/threadline/relay/A2ABridge.js.map +1 -0
  1330. package/dist/threadline/relay/AbuseDetector.d.ts +131 -0
  1331. package/dist/threadline/relay/AbuseDetector.d.ts.map +1 -0
  1332. package/dist/threadline/relay/AbuseDetector.js +358 -0
  1333. package/dist/threadline/relay/AbuseDetector.js.map +1 -0
  1334. package/dist/threadline/relay/AdminServer.d.ts +55 -0
  1335. package/dist/threadline/relay/AdminServer.d.ts.map +1 -0
  1336. package/dist/threadline/relay/AdminServer.js +215 -0
  1337. package/dist/threadline/relay/AdminServer.js.map +1 -0
  1338. package/dist/threadline/relay/ConnectionManager.d.ts +86 -0
  1339. package/dist/threadline/relay/ConnectionManager.d.ts.map +1 -0
  1340. package/dist/threadline/relay/ConnectionManager.js +356 -0
  1341. package/dist/threadline/relay/ConnectionManager.js.map +1 -0
  1342. package/dist/threadline/relay/MessageRouter.d.ts +46 -0
  1343. package/dist/threadline/relay/MessageRouter.d.ts.map +1 -0
  1344. package/dist/threadline/relay/MessageRouter.js +138 -0
  1345. package/dist/threadline/relay/MessageRouter.js.map +1 -0
  1346. package/dist/threadline/relay/OfflineQueue.d.ts +87 -0
  1347. package/dist/threadline/relay/OfflineQueue.d.ts.map +1 -0
  1348. package/dist/threadline/relay/OfflineQueue.js +137 -0
  1349. package/dist/threadline/relay/OfflineQueue.js.map +1 -0
  1350. package/dist/threadline/relay/PresenceRegistry.d.ts +62 -0
  1351. package/dist/threadline/relay/PresenceRegistry.d.ts.map +1 -0
  1352. package/dist/threadline/relay/PresenceRegistry.js +148 -0
  1353. package/dist/threadline/relay/PresenceRegistry.js.map +1 -0
  1354. package/dist/threadline/relay/RegistryAuth.d.ts +45 -0
  1355. package/dist/threadline/relay/RegistryAuth.d.ts.map +1 -0
  1356. package/dist/threadline/relay/RegistryAuth.js +118 -0
  1357. package/dist/threadline/relay/RegistryAuth.js.map +1 -0
  1358. package/dist/threadline/relay/RegistryStore.d.ts +149 -0
  1359. package/dist/threadline/relay/RegistryStore.d.ts.map +1 -0
  1360. package/dist/threadline/relay/RegistryStore.js +542 -0
  1361. package/dist/threadline/relay/RegistryStore.js.map +1 -0
  1362. package/dist/threadline/relay/RelayMetrics.d.ts +62 -0
  1363. package/dist/threadline/relay/RelayMetrics.d.ts.map +1 -0
  1364. package/dist/threadline/relay/RelayMetrics.js +149 -0
  1365. package/dist/threadline/relay/RelayMetrics.js.map +1 -0
  1366. package/dist/threadline/relay/RelayRateLimiter.d.ts +58 -0
  1367. package/dist/threadline/relay/RelayRateLimiter.d.ts.map +1 -0
  1368. package/dist/threadline/relay/RelayRateLimiter.js +116 -0
  1369. package/dist/threadline/relay/RelayRateLimiter.js.map +1 -0
  1370. package/dist/threadline/relay/RelayServer.d.ts +94 -0
  1371. package/dist/threadline/relay/RelayServer.d.ts.map +1 -0
  1372. package/dist/threadline/relay/RelayServer.js +1049 -0
  1373. package/dist/threadline/relay/RelayServer.js.map +1 -0
  1374. package/dist/threadline/relay/index.d.ts +28 -0
  1375. package/dist/threadline/relay/index.d.ts.map +1 -0
  1376. package/dist/threadline/relay/index.js +17 -0
  1377. package/dist/threadline/relay/index.js.map +1 -0
  1378. package/dist/threadline/relay/types.d.ts +215 -0
  1379. package/dist/threadline/relay/types.d.ts.map +1 -0
  1380. package/dist/threadline/relay/types.js +21 -0
  1381. package/dist/threadline/relay/types.js.map +1 -0
  1382. package/dist/threadline/types.d.ts +39 -0
  1383. package/dist/threadline/types.d.ts.map +1 -0
  1384. package/dist/threadline/types.js +10 -0
  1385. package/dist/threadline/types.js.map +1 -0
  1386. package/dist/tunnel/TunnelManager.d.ts +113 -0
  1387. package/dist/tunnel/TunnelManager.d.ts.map +1 -0
  1388. package/dist/tunnel/TunnelManager.js +474 -0
  1389. package/dist/tunnel/TunnelManager.js.map +1 -0
  1390. package/dist/types/pipeline.d.ts +203 -0
  1391. package/dist/types/pipeline.d.ts.map +1 -0
  1392. package/dist/types/pipeline.js +152 -0
  1393. package/dist/types/pipeline.js.map +1 -0
  1394. package/dist/users/GdprCommands.d.ts +44 -0
  1395. package/dist/users/GdprCommands.d.ts.map +1 -0
  1396. package/dist/users/GdprCommands.js +153 -0
  1397. package/dist/users/GdprCommands.js.map +1 -0
  1398. package/dist/users/OnboardingGate.d.ts +107 -0
  1399. package/dist/users/OnboardingGate.d.ts.map +1 -0
  1400. package/dist/users/OnboardingGate.js +240 -0
  1401. package/dist/users/OnboardingGate.js.map +1 -0
  1402. package/dist/users/UserContextBuilder.d.ts +47 -0
  1403. package/dist/users/UserContextBuilder.d.ts.map +1 -0
  1404. package/dist/users/UserContextBuilder.js +174 -0
  1405. package/dist/users/UserContextBuilder.js.map +1 -0
  1406. package/dist/users/UserManager.d.ts +76 -0
  1407. package/dist/users/UserManager.d.ts.map +1 -0
  1408. package/dist/users/UserManager.js +213 -0
  1409. package/dist/users/UserManager.js.map +1 -0
  1410. package/dist/users/UserOnboarding.d.ts +145 -0
  1411. package/dist/users/UserOnboarding.d.ts.map +1 -0
  1412. package/dist/users/UserOnboarding.js +488 -0
  1413. package/dist/users/UserOnboarding.js.map +1 -0
  1414. package/dist/users/UserPropagator.d.ts +75 -0
  1415. package/dist/users/UserPropagator.d.ts.map +1 -0
  1416. package/dist/users/UserPropagator.js +145 -0
  1417. package/dist/users/UserPropagator.js.map +1 -0
  1418. package/dist/utils/jsonl-rotation.d.ts +27 -0
  1419. package/dist/utils/jsonl-rotation.d.ts.map +1 -0
  1420. package/dist/utils/jsonl-rotation.js +63 -0
  1421. package/dist/utils/jsonl-rotation.js.map +1 -0
  1422. package/dist/utils/privacy.d.ts +88 -0
  1423. package/dist/utils/privacy.d.ts.map +1 -0
  1424. package/dist/utils/privacy.js +182 -0
  1425. package/dist/utils/privacy.js.map +1 -0
  1426. package/dist/utils/sanitize.d.ts +81 -0
  1427. package/dist/utils/sanitize.d.ts.map +1 -0
  1428. package/dist/utils/sanitize.js +122 -0
  1429. package/dist/utils/sanitize.js.map +1 -0
  1430. package/package.json +1 -0
  1431. package/playbook-scripts/atomic_write.py +133 -0
  1432. package/playbook-scripts/bootstrap-manifest.json +92 -0
  1433. package/playbook-scripts/playbook-annotate-context.py +239 -0
  1434. package/playbook-scripts/playbook-assemble.py +385 -0
  1435. package/playbook-scripts/playbook-dashboard.py +242 -0
  1436. package/playbook-scripts/playbook-decay.py +377 -0
  1437. package/playbook-scripts/playbook-dedup-job.py +252 -0
  1438. package/playbook-scripts/playbook-dedup.py +341 -0
  1439. package/playbook-scripts/playbook-delta-validator.py +576 -0
  1440. package/playbook-scripts/playbook-dsar.py +291 -0
  1441. package/playbook-scripts/playbook-eval-log.py +425 -0
  1442. package/playbook-scripts/playbook-failsafe.py +513 -0
  1443. package/playbook-scripts/playbook-feedback-quarantine.py +335 -0
  1444. package/playbook-scripts/playbook-history.py +293 -0
  1445. package/playbook-scripts/playbook-hmac.py +224 -0
  1446. package/playbook-scripts/playbook-lifecycle.py +952 -0
  1447. package/playbook-scripts/playbook-manifest.py +458 -0
  1448. package/playbook-scripts/playbook-micro-eval.py +316 -0
  1449. package/playbook-scripts/playbook-migrate-lessons.py +396 -0
  1450. package/playbook-scripts/playbook-mount.py +393 -0
  1451. package/playbook-scripts/playbook-offline-adapt.py +323 -0
  1452. package/playbook-scripts/playbook-pii-screen.py +207 -0
  1453. package/playbook-scripts/playbook-reflector.py +266 -0
  1454. package/playbook-scripts/playbook-relevance.py +269 -0
  1455. package/playbook-scripts/playbook-retirement.py +365 -0
  1456. package/playbook-scripts/playbook-schema-validate.py +267 -0
  1457. package/playbook-scripts/playbook-scratchpad.py +346 -0
  1458. package/playbook-scripts/playbook-semantic-verify.py +280 -0
  1459. package/playbook-scripts/playbook-spawn-contract.py +341 -0
  1460. package/playbook-scripts/playbook-token-reestimate.py +248 -0
  1461. package/playbook-scripts/playbook-verify.py +357 -0
  1462. package/playbook-scripts/playbook_backend.py +249 -0
  1463. package/playbook-scripts/playbook_paths.py +232 -0
  1464. package/playbook-scripts/schemas/context-delta.schema.json +137 -0
  1465. package/playbook-scripts/schemas/context-manifest.schema.json +200 -0
  1466. package/playbook-scripts/schemas/playbook-config.schema.json +184 -0
  1467. package/scripts/analyze-release.js +752 -0
  1468. package/scripts/check-upgrade-guide.js +373 -0
  1469. package/scripts/collect-metrics.py +248 -0
  1470. package/scripts/demo-two-agents.mjs +187 -0
  1471. package/scripts/fix-better-sqlite3.cjs +100 -0
  1472. package/scripts/generate-builtin-manifest.cjs +440 -0
  1473. package/scripts/pre-push-gate.js +177 -0
  1474. package/scripts/relay-entrypoint.mjs +18 -0
  1475. package/scripts/seed-registry.mjs +258 -0
  1476. package/scripts/telemetry-worker/worker.js +776 -0
  1477. package/scripts/telemetry-worker/wrangler.toml +7 -0
  1478. package/scripts/test-bootstrap-relay.mjs +90 -0
  1479. package/scripts/test-multi-agent-relay.mjs +395 -0
  1480. package/scripts/test-relay-cloud.mjs +389 -0
  1481. package/scripts/test-relay-live.mjs +550 -0
  1482. package/src/data/builtin-manifest.json +1463 -0
  1483. package/src/data/http-hook-templates.ts +81 -0
  1484. package/src/templates/hooks/compaction-recovery.sh +371 -0
  1485. package/src/templates/hooks/dangerous-command-guard.sh +100 -0
  1486. package/src/templates/hooks/free-text-guard.sh +96 -0
  1487. package/src/templates/hooks/grounding-before-messaging.sh +52 -0
  1488. package/src/templates/hooks/session-start.sh +339 -0
  1489. package/src/templates/hooks/settings-template.json +142 -0
  1490. package/src/templates/hooks/slack-channel-context.sh +98 -0
  1491. package/src/templates/hooks/telegram-topic-context.sh +117 -0
  1492. package/src/templates/scripts/convergence-check.sh +99 -0
  1493. package/src/templates/scripts/git-sync-gate.sh +89 -0
  1494. package/src/templates/scripts/health-watchdog.sh +63 -0
  1495. package/src/templates/scripts/serendipity-capture.sh +345 -0
  1496. package/src/templates/scripts/slack-reply.sh +74 -0
  1497. package/src/templates/scripts/smart-fetch.py +215 -0
  1498. package/src/templates/scripts/telegram-reply.sh +67 -0
  1499. package/src/templates/scripts/whatsapp-reply.sh +68 -0
  1500. package/upgrades/0.10.0.md +254 -0
  1501. package/upgrades/0.10.1.md +47 -0
  1502. package/upgrades/0.10.2.md +26 -0
  1503. package/upgrades/0.10.3.md +23 -0
  1504. package/upgrades/0.10.4.md +26 -0
  1505. package/upgrades/0.10.5.md +19 -0
  1506. package/upgrades/0.10.6.md +35 -0
  1507. package/upgrades/0.10.7.md +48 -0
  1508. package/upgrades/0.10.8.md +53 -0
  1509. package/upgrades/0.10.9.md +21 -0
  1510. package/upgrades/0.11.0.md +146 -0
  1511. package/upgrades/0.12.0.md +31 -0
  1512. package/upgrades/0.12.1.md +21 -0
  1513. package/upgrades/0.12.10.md +26 -0
  1514. package/upgrades/0.12.11.md +23 -0
  1515. package/upgrades/0.12.12.md +23 -0
  1516. package/upgrades/0.12.13.md +19 -0
  1517. package/upgrades/0.12.14.md +21 -0
  1518. package/upgrades/0.12.15.md +26 -0
  1519. package/upgrades/0.12.16.md +33 -0
  1520. package/upgrades/0.12.17.md +38 -0
  1521. package/upgrades/0.12.18.md +27 -0
  1522. package/upgrades/0.12.19.md +31 -0
  1523. package/upgrades/0.12.2.md +27 -0
  1524. package/upgrades/0.12.20.md +24 -0
  1525. package/upgrades/0.12.21.md +28 -0
  1526. package/upgrades/0.12.22.md +23 -0
  1527. package/upgrades/0.12.23.md +44 -0
  1528. package/upgrades/0.12.24.md +24 -0
  1529. package/upgrades/0.12.25.md +55 -0
  1530. package/upgrades/0.12.26.md +31 -0
  1531. package/upgrades/0.12.27.md +19 -0
  1532. package/upgrades/0.12.28.md +19 -0
  1533. package/upgrades/0.12.29.md +42 -0
  1534. package/upgrades/0.12.3.md +22 -0
  1535. package/upgrades/0.12.31.md +24 -0
  1536. package/upgrades/0.12.32.md +34 -0
  1537. package/upgrades/0.12.33.md +62 -0
  1538. package/upgrades/0.12.34.md +59 -0
  1539. package/upgrades/0.12.4.md +19 -0
  1540. package/upgrades/0.12.5.md +31 -0
  1541. package/upgrades/0.12.6.md +34 -0
  1542. package/upgrades/0.12.7.md +24 -0
  1543. package/upgrades/0.12.8.md +28 -0
  1544. package/upgrades/0.12.9.md +30 -0
  1545. package/upgrades/0.13.0.md +26 -0
  1546. package/upgrades/0.14.0.md +75 -0
  1547. package/upgrades/0.14.1.md +41 -0
  1548. package/upgrades/0.15.0.md +59 -0
  1549. package/upgrades/0.16.0.md +61 -0
  1550. package/upgrades/0.17.0.md +88 -0
  1551. package/upgrades/0.17.10.md +23 -0
  1552. package/upgrades/0.17.11.md +25 -0
  1553. package/upgrades/0.17.12.md +43 -0
  1554. package/upgrades/0.17.13.md +24 -0
  1555. package/upgrades/0.17.14.md +26 -0
  1556. package/upgrades/0.17.2.md +42 -0
  1557. package/upgrades/0.17.3.md +37 -0
  1558. package/upgrades/0.17.4.md +27 -0
  1559. package/upgrades/0.17.5.md +32 -0
  1560. package/upgrades/0.17.6.md +32 -0
  1561. package/upgrades/0.17.7.md +39 -0
  1562. package/upgrades/0.17.8.md +34 -0
  1563. package/upgrades/0.17.9.md +25 -0
  1564. package/upgrades/0.18.1.md +34 -0
  1565. package/upgrades/0.18.2.md +29 -0
  1566. package/upgrades/0.18.3.md +26 -0
  1567. package/upgrades/0.18.4.md +28 -0
  1568. package/upgrades/0.18.5.md +25 -0
  1569. package/upgrades/0.18.6.md +25 -0
  1570. package/upgrades/0.18.7.md +30 -0
  1571. package/upgrades/0.19.0.md +136 -0
  1572. package/upgrades/0.19.1.md +27 -0
  1573. package/upgrades/0.19.2.md +27 -0
  1574. package/upgrades/0.19.3.md +32 -0
  1575. package/upgrades/0.19.4.md +19 -0
  1576. package/upgrades/0.19.6.md +17 -0
  1577. package/upgrades/0.19.7.md +33 -0
  1578. package/upgrades/0.20.0.md +54 -0
  1579. package/upgrades/0.21.1.md +55 -0
  1580. package/upgrades/0.21.2.md +48 -0
  1581. package/upgrades/0.21.3.md +29 -0
  1582. package/upgrades/0.21.4.md +33 -0
  1583. package/upgrades/0.22.0.md +114 -0
  1584. package/upgrades/0.23.0.md +81 -0
  1585. package/upgrades/0.23.1.md +28 -0
  1586. package/upgrades/0.23.10.md +19 -0
  1587. package/upgrades/0.23.11.md +21 -0
  1588. package/upgrades/0.23.12.md +30 -0
  1589. package/upgrades/0.23.13.md +25 -0
  1590. package/upgrades/0.23.14.md +23 -0
  1591. package/upgrades/0.23.15.md +30 -0
  1592. package/upgrades/0.23.16.md +21 -0
  1593. package/upgrades/0.23.17.md +23 -0
  1594. package/upgrades/0.23.18.md +41 -0
  1595. package/upgrades/0.23.2.md +32 -0
  1596. package/upgrades/0.23.4.md +21 -0
  1597. package/upgrades/0.23.6.md +19 -0
  1598. package/upgrades/0.23.7.md +33 -0
  1599. package/upgrades/0.23.8.md +38 -0
  1600. package/upgrades/0.23.9.md +35 -0
  1601. package/upgrades/0.24.1.md +32 -0
  1602. package/upgrades/0.24.10.md +23 -0
  1603. package/upgrades/0.24.12.md +17 -0
  1604. package/upgrades/0.24.13.md +16 -0
  1605. package/upgrades/0.24.14.md +26 -0
  1606. package/upgrades/0.24.15.md +49 -0
  1607. package/upgrades/0.24.16.md +48 -0
  1608. package/upgrades/0.24.17.md +40 -0
  1609. package/upgrades/0.24.18-beta.0.md +35 -0
  1610. package/upgrades/0.24.18.md +35 -0
  1611. package/upgrades/0.24.19.md +21 -0
  1612. package/upgrades/0.24.2.md +13 -0
  1613. package/upgrades/0.24.20.md +45 -0
  1614. package/upgrades/0.24.21.md +25 -0
  1615. package/upgrades/0.24.22.md +35 -0
  1616. package/upgrades/0.24.23.md +17 -0
  1617. package/upgrades/0.24.24.md +15 -0
  1618. package/upgrades/0.24.25.md +15 -0
  1619. package/upgrades/0.24.26.md +15 -0
  1620. package/upgrades/0.24.27.md +17 -0
  1621. package/upgrades/0.24.28.md +35 -0
  1622. package/upgrades/0.24.29.md +15 -0
  1623. package/upgrades/0.24.30.md +40 -0
  1624. package/upgrades/0.24.31.md +45 -0
  1625. package/upgrades/0.24.32.md +19 -0
  1626. package/upgrades/0.24.33.md +35 -0
  1627. package/upgrades/0.24.34.md +29 -0
  1628. package/upgrades/0.24.4.md +19 -0
  1629. package/upgrades/0.24.5.md +20 -0
  1630. package/upgrades/0.25.0.md +34 -0
  1631. package/upgrades/0.25.1.md +24 -0
  1632. package/upgrades/0.25.10.md +26 -0
  1633. package/upgrades/0.25.2.md +23 -0
  1634. package/upgrades/0.25.3.md +25 -0
  1635. package/upgrades/0.25.4.md +24 -0
  1636. package/upgrades/0.25.5.md +19 -0
  1637. package/upgrades/0.25.6.md +35 -0
  1638. package/upgrades/0.25.7.md +18 -0
  1639. package/upgrades/0.25.8.md +24 -0
  1640. package/upgrades/0.25.9.md +19 -0
  1641. package/upgrades/0.26.0.md +23 -0
  1642. package/upgrades/0.26.1.md +22 -0
  1643. package/upgrades/0.26.2.md +15 -0
  1644. package/upgrades/0.8.12.md +49 -0
  1645. package/upgrades/0.8.13.md +38 -0
  1646. package/upgrades/0.8.17.md +36 -0
  1647. package/upgrades/0.8.22.md +43 -0
  1648. package/upgrades/0.8.23.md +106 -0
  1649. package/upgrades/0.9.1.md +91 -0
  1650. package/upgrades/0.9.10.md +40 -0
  1651. package/upgrades/0.9.11.md +77 -0
  1652. package/upgrades/0.9.12.md +42 -0
  1653. package/upgrades/0.9.13.md +55 -0
  1654. package/upgrades/0.9.14.md +23 -0
  1655. package/upgrades/0.9.15.md +106 -0
  1656. package/upgrades/0.9.16.md +37 -0
  1657. package/upgrades/0.9.17.md +15 -0
  1658. package/upgrades/0.9.19.md +17 -0
  1659. package/upgrades/0.9.20.md +24 -0
  1660. package/upgrades/0.9.21.md +37 -0
  1661. package/upgrades/0.9.22.md +41 -0
  1662. package/upgrades/0.9.23.md +37 -0
  1663. package/upgrades/0.9.24.md +46 -0
  1664. package/upgrades/0.9.25.md +37 -0
  1665. package/upgrades/0.9.28.md +20 -0
  1666. package/upgrades/0.9.29.md +34 -0
  1667. package/upgrades/0.9.32.md +30 -0
  1668. package/upgrades/0.9.36.md +27 -0
  1669. package/upgrades/0.9.8.md +125 -0
  1670. package/upgrades/0.9.9.md +34 -0
  1671. package/upgrades/NEXT.md +35 -0
@@ -0,0 +1,1524 @@
1
+ /**
2
+ * SlackAdapter — Native Slack messaging adapter for Instar.
3
+ *
4
+ * Implements the MessagingAdapter interface using Socket Mode (WebSocket)
5
+ * for event intake and the Slack Web API for outbound messages.
6
+ *
7
+ * Key design decisions:
8
+ * - DIY app model (each user creates their own Slack app)
9
+ * - Socket Mode (no public URLs, no webhooks)
10
+ * - Zero external SDK (direct HTTP to Slack Web API)
11
+ * - authorizedUserIds is required and fail-closed
12
+ * - Ring buffer scoped to authorized users only
13
+ * - JSON-encoded context files (no delimiter-based injection)
14
+ *
15
+ * Required bot scopes (each event subscription requires its read scope):
16
+ * app_mentions:read, channels:history, channels:join, channels:manage,
17
+ * channels:read, chat:write, files:read, groups:history, im:history,
18
+ * im:read, im:write, pins:write, reactions:read, reactions:write, users:read
19
+ */
20
+ import path from 'node:path';
21
+ import fs from 'node:fs';
22
+ import { SlackApiClient } from './SlackApiClient.js';
23
+ import { SocketModeClient } from './SocketModeClient.js';
24
+ import { ChannelManager } from './ChannelManager.js';
25
+ import { FileHandler } from './FileHandler.js';
26
+ import { RingBuffer } from './RingBuffer.js';
27
+ import { MessageLogger } from '../shared/MessageLogger.js';
28
+ import { sanitizeDisplayName } from './sanitize.js';
29
+ const RING_BUFFER_CAPACITY = 50;
30
+ const SLACK_MAX_TEXT_LENGTH = 4000;
31
+ const AUTO_ARCHIVE_DAYS = 7;
32
+ const LOG_PURGE_INTERVAL_MS = 24 * 60 * 60 * 1000; // Daily
33
+ export class SlackAdapter {
34
+ platform = 'slack';
35
+ // Config
36
+ config;
37
+ stateDir;
38
+ // Components
39
+ apiClient;
40
+ socketClient = null;
41
+ channelManager;
42
+ fileHandler;
43
+ logger;
44
+ // Workspace behavior (resolved from config + mode defaults)
45
+ workspaceMode;
46
+ autoJoinChannels;
47
+ respondMode;
48
+ botUserId = null;
49
+ // State
50
+ messageHandler = null;
51
+ started = false;
52
+ authorizedUsers;
53
+ channelHistory = new Map();
54
+ pendingPrompts = new Map();
55
+ seenMessageTs = new Set();
56
+ seenMessageTsCleanupTimer = null;
57
+ userCache = new Map();
58
+ promptEvictionTimer = null;
59
+ housekeepingTimer = null;
60
+ logPurgeTimer = null;
61
+ // Channel ↔ Session Registry (persisted to disk)
62
+ channelToSession = new Map();
63
+ channelRegistryPath;
64
+ // Channel Resume Map (persisted — maps channel IDs to Claude session UUIDs for resume)
65
+ channelResumeMap = new Map();
66
+ channelResumeMapPath;
67
+ // Stall tracking (matches Telegram's trackMessageInjection pattern)
68
+ pendingStalls = new Map();
69
+ stallCheckTimer = null;
70
+ // Promise tracking (matches Telegram's "give me a minute" detection)
71
+ pendingPromises = new Map();
72
+ // Callbacks (wired by server.ts)
73
+ /** Called when a prompt gate response is received */
74
+ onPromptResponse = null;
75
+ /** Called when a message is logged (for dual-write to SQLite) */
76
+ onMessageLogged = null;
77
+ /** Called when a stall is detected */
78
+ onStallDetected = null;
79
+ /** Called to interrupt a session (send Escape) */
80
+ onInterruptSession = null;
81
+ /** Called to restart a session */
82
+ onRestartSession = null;
83
+ /** Called to list running sessions */
84
+ onListSessions = null;
85
+ /** Called to check if a session is alive */
86
+ onIsSessionAlive = null;
87
+ /** Called to transcribe a voice/audio file (via Whisper API) */
88
+ transcribeVoice = null;
89
+ /** Called to handle standby commands (unstick, quiet, resume, restart) */
90
+ onStandbyCommand = null;
91
+ /** Called to get triage status for a channel's session */
92
+ onGetTriageStatus = null;
93
+ /** Called to classify why a session died */
94
+ onClassifySessionDeath = null;
95
+ /** Intelligence provider for LLM-gated stall confirmation */
96
+ intelligence = null;
97
+ constructor(config, stateDir) {
98
+ this.config = config;
99
+ this.stateDir = stateDir;
100
+ // Validate required fields
101
+ if (!this.config.botToken)
102
+ throw new Error('[slack] botToken is required');
103
+ if (!this.config.appToken)
104
+ throw new Error('[slack] appToken is required');
105
+ if (!Array.isArray(this.config.authorizedUserIds)) {
106
+ throw new Error('[slack] authorizedUserIds is required (array of Slack user IDs)');
107
+ }
108
+ // Fail-closed: empty array means deny all
109
+ this.authorizedUsers = new Set(this.config.authorizedUserIds);
110
+ if (this.authorizedUsers.size === 0) {
111
+ console.warn('[slack] authorizedUserIds is empty — all messages will be rejected (fail-closed)');
112
+ }
113
+ // Resolve workspace mode and defaults
114
+ this.workspaceMode = this.config.workspaceMode ?? 'dedicated';
115
+ const isDedicated = this.workspaceMode === 'dedicated';
116
+ this.autoJoinChannels = this.config.autoJoinChannels ?? isDedicated;
117
+ this.respondMode = this.config.respondMode ?? (isDedicated ? 'all' : 'mention-only');
118
+ console.log(`[slack] Workspace mode: ${this.workspaceMode} (autoJoin: ${this.autoJoinChannels}, respond: ${this.respondMode})`);
119
+ // Initialize components
120
+ this.apiClient = new SlackApiClient(this.config.botToken, this.config.appToken);
121
+ const rawAgentName = this.config.workspaceName?.replace(/-agent$/i, '') || 'agent';
122
+ const agentName = rawAgentName.toLowerCase().replace(/[^a-z0-9]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '');
123
+ this.channelManager = new ChannelManager(this.apiClient, agentName);
124
+ this.fileHandler = new FileHandler(this.apiClient, this.config.botToken, stateDir);
125
+ this.logger = new MessageLogger({
126
+ logPath: path.join(stateDir, 'slack-messages.jsonl'),
127
+ maxLines: 100_000,
128
+ keepLines: 75_000,
129
+ });
130
+ // Channel registry and resume map persistence
131
+ this.channelRegistryPath = path.join(stateDir, 'slack-channel-registry.json');
132
+ this.channelResumeMapPath = path.join(stateDir, 'slack-channel-resume-map.json');
133
+ this._loadChannelRegistry();
134
+ this._loadChannelResumeMap();
135
+ }
136
+ // ── MessagingAdapter Interface ──
137
+ async start() {
138
+ const handlers = {
139
+ onEvent: async (type, payload) => this._handleEvent(type, payload),
140
+ onInteraction: async (payload) => this._handleInteraction(payload),
141
+ onConnected: () => {
142
+ console.log('[slack] Socket Mode connected');
143
+ this.started = true;
144
+ },
145
+ onDisconnected: (reason) => {
146
+ console.log(`[slack] Disconnected: ${reason}`);
147
+ },
148
+ onError: (err, permanent) => {
149
+ if (permanent) {
150
+ console.error(`[slack] Permanent error: ${err.message}`);
151
+ }
152
+ else {
153
+ console.warn(`[slack] Transient error: ${err.message}`);
154
+ }
155
+ },
156
+ };
157
+ this.socketClient = new SocketModeClient(this.apiClient, handlers);
158
+ // Connect with a 15-second timeout to prevent server startup hangs
159
+ const SLACK_CONNECT_TIMEOUT_MS = 15000;
160
+ const connectPromise = this.socketClient.connect();
161
+ const timeoutPromise = new Promise((_resolve, reject) => {
162
+ setTimeout(() => reject(new Error('Slack Socket Mode connection timeout after 15s')), SLACK_CONNECT_TIMEOUT_MS);
163
+ });
164
+ await Promise.race([connectPromise, timeoutPromise]);
165
+ this.started = true;
166
+ // Fetch bot user ID (needed for @mention detection in shared mode)
167
+ try {
168
+ const authResult = await this.apiClient.call('auth.test', {});
169
+ this.botUserId = authResult.user_id ?? null;
170
+ if (this.botUserId) {
171
+ console.log(`[slack] Bot user ID: ${this.botUserId}`);
172
+ }
173
+ }
174
+ catch {
175
+ console.warn('[slack] Could not fetch bot user ID — mention detection may not work');
176
+ }
177
+ // Auto-join all public channels if in dedicated mode
178
+ if (this.autoJoinChannels) {
179
+ this._autoJoinAllChannels();
180
+ }
181
+ // Backfill ring buffers with recent channel history so sessions have context on restart
182
+ this._backfillChannelHistory();
183
+ // Start pending prompt TTL eviction
184
+ this._startPromptEviction();
185
+ // Start message dedup set cleanup (every 5 minutes, drop entries older than 10 min)
186
+ this.seenMessageTsCleanupTimer = setInterval(() => {
187
+ // Slack ts format: "1234567890.123456" (seconds.microseconds)
188
+ const cutoff = (Date.now() / 1000) - 600; // 10 minutes ago
189
+ for (const ts of this.seenMessageTs) {
190
+ const tsSeconds = parseFloat(ts);
191
+ if (!isNaN(tsSeconds) && tsSeconds < cutoff) {
192
+ this.seenMessageTs.delete(ts);
193
+ }
194
+ }
195
+ }, 5 * 60 * 1000);
196
+ // Start channel housekeeping (auto-archive idle channels)
197
+ this._startHousekeeping();
198
+ // Start log retention purge (daily)
199
+ this._startLogPurge();
200
+ // Purge stale log entries on startup
201
+ this._purgeOldLogs();
202
+ }
203
+ async stop() {
204
+ this.started = false;
205
+ if (this.promptEvictionTimer) {
206
+ clearInterval(this.promptEvictionTimer);
207
+ this.promptEvictionTimer = null;
208
+ }
209
+ if (this.housekeepingTimer) {
210
+ clearInterval(this.housekeepingTimer);
211
+ this.housekeepingTimer = null;
212
+ }
213
+ if (this.logPurgeTimer) {
214
+ clearInterval(this.logPurgeTimer);
215
+ this.logPurgeTimer = null;
216
+ }
217
+ if (this.stallCheckTimer) {
218
+ clearInterval(this.stallCheckTimer);
219
+ this.stallCheckTimer = null;
220
+ }
221
+ if (this.seenMessageTsCleanupTimer) {
222
+ clearInterval(this.seenMessageTsCleanupTimer);
223
+ this.seenMessageTsCleanupTimer = null;
224
+ }
225
+ if (this.socketClient) {
226
+ await this.socketClient.disconnect();
227
+ this.socketClient = null;
228
+ }
229
+ }
230
+ async send(message) {
231
+ const channelId = message.channel?.identifier;
232
+ if (!channelId) {
233
+ console.error('[slack] Cannot send: no channel identifier');
234
+ return;
235
+ }
236
+ // Chunk long messages
237
+ const chunks = this._chunkText(message.content);
238
+ let lastResult = null;
239
+ for (const chunk of chunks) {
240
+ const params = {
241
+ channel: channelId,
242
+ text: chunk,
243
+ };
244
+ // If there's thread_ts in metadata, reply in thread
245
+ if (message.channel?.type === 'slack' && message.threadTs) {
246
+ params.thread_ts = message.threadTs;
247
+ }
248
+ lastResult = await this.apiClient.call('chat.postMessage', params);
249
+ }
250
+ return lastResult;
251
+ }
252
+ onMessage(handler) {
253
+ this.messageHandler = handler;
254
+ }
255
+ async resolveUser(channelIdentifier) {
256
+ // For Slack, the channel identifier IS the user reference
257
+ return channelIdentifier || null;
258
+ }
259
+ // ── Slack-Specific Public Methods ──
260
+ /** Get the current workspace behavior config. */
261
+ getWorkspaceConfig() {
262
+ return {
263
+ mode: this.workspaceMode,
264
+ autoJoinChannels: this.autoJoinChannels,
265
+ respondMode: this.respondMode,
266
+ };
267
+ }
268
+ /** Get the bot's own Slack user ID (for distinguishing bot vs user messages). */
269
+ getBotUserId() {
270
+ return this.botUserId;
271
+ }
272
+ /** Check if a user is authorized. */
273
+ isAuthorized(userId) {
274
+ return this.authorizedUsers.has(userId);
275
+ }
276
+ /** Send a message to a specific channel. */
277
+ async sendToChannel(channelId, text, options) {
278
+ const params = { channel: channelId, text };
279
+ if (options?.thread_ts)
280
+ params.thread_ts = options.thread_ts;
281
+ const result = await this.apiClient.call('chat.postMessage', params);
282
+ return result.ts;
283
+ }
284
+ /** Add a reaction (fire-and-forget). */
285
+ addReaction(channelId, timestamp, emoji) {
286
+ this.apiClient.call('reactions.add', { channel: channelId, timestamp, name: emoji }).catch(() => { });
287
+ }
288
+ /** Remove a reaction (fire-and-forget). */
289
+ removeReaction(channelId, timestamp, emoji) {
290
+ this.apiClient.call('reactions.remove', { channel: channelId, timestamp, name: emoji }).catch(() => { });
291
+ }
292
+ /** Update an existing message. */
293
+ async updateMessage(channelId, timestamp, text) {
294
+ await this.apiClient.call('chat.update', { channel: channelId, ts: timestamp, text });
295
+ }
296
+ /** Pin a message. */
297
+ async pinMessage(channelId, timestamp) {
298
+ await this.apiClient.call('pins.add', { channel: channelId, timestamp });
299
+ }
300
+ /** Send an ephemeral message (visible only to one user). */
301
+ async postEphemeral(channelId, userId, text) {
302
+ await this.apiClient.call('chat.postEphemeral', { channel: channelId, user: userId, text });
303
+ }
304
+ /** Send a message with Block Kit blocks. */
305
+ async sendBlocks(channelId, blocks, text) {
306
+ const params = { channel: channelId, blocks };
307
+ if (text)
308
+ params.text = text; // Fallback text for notifications
309
+ const result = await this.apiClient.call('chat.postMessage', params);
310
+ return result.ts;
311
+ }
312
+ /** Get cached channel messages from ring buffer. */
313
+ getChannelMessages(channelId, limit = 30) {
314
+ const buffer = this.channelHistory.get(channelId);
315
+ if (!buffer)
316
+ return [];
317
+ const all = buffer.toArray();
318
+ return limit >= all.length ? all : all.slice(-limit);
319
+ }
320
+ /** Get user info (cached for 5 minutes). */
321
+ async getUserInfo(userId) {
322
+ const cached = this.userCache.get(userId);
323
+ if (cached && Date.now() - cached.fetchedAt < 5 * 60 * 1000) {
324
+ return { id: userId, name: cached.name };
325
+ }
326
+ const result = await this.apiClient.call('users.info', { user: userId });
327
+ const user = result.user;
328
+ const name = user.real_name || user.name;
329
+ this.userCache.set(userId, { name, fetchedAt: Date.now() });
330
+ return { id: userId, name };
331
+ }
332
+ /** Create a channel. */
333
+ async createChannel(name, isPrivate) {
334
+ return this.channelManager.createChannel(name, isPrivate);
335
+ }
336
+ /** Archive a channel. */
337
+ async archiveChannel(channelId) {
338
+ return this.channelManager.archiveChannel(channelId);
339
+ }
340
+ /** Upload a file. */
341
+ async uploadFile(channelId, filePath, title) {
342
+ return this.fileHandler.uploadFile(channelId, filePath, title);
343
+ }
344
+ /** Download a file. */
345
+ async downloadFile(url, destPath) {
346
+ return this.fileHandler.downloadFile(url, destPath);
347
+ }
348
+ /** Get the underlying API client (for routes). */
349
+ get api() {
350
+ return this.apiClient;
351
+ }
352
+ // ── Channel ↔ Session Registry ──
353
+ /** Register a channel → session binding. Persisted to disk. */
354
+ registerChannelSession(channelId, sessionName, channelName) {
355
+ this.channelToSession.set(channelId, {
356
+ sessionName,
357
+ channelName,
358
+ registeredAt: new Date().toISOString(),
359
+ });
360
+ this._saveChannelRegistry();
361
+ }
362
+ /** Look up which session is bound to a channel. */
363
+ getSessionForChannel(channelId) {
364
+ return this.channelToSession.get(channelId)?.sessionName ?? null;
365
+ }
366
+ /** Look up which channel is bound to a session. */
367
+ getChannelForSession(sessionName) {
368
+ for (const [channelId, entry] of this.channelToSession) {
369
+ if (entry.sessionName === sessionName)
370
+ return channelId;
371
+ }
372
+ return null;
373
+ }
374
+ /** Remove a channel → session binding. */
375
+ unregisterChannel(channelId) {
376
+ this.channelToSession.delete(channelId);
377
+ this._saveChannelRegistry();
378
+ }
379
+ /** Get all channel → session mappings. */
380
+ getChannelRegistry() {
381
+ const result = {};
382
+ for (const [channelId, entry] of this.channelToSession) {
383
+ result[channelId] = { sessionName: entry.sessionName, channelName: entry.channelName };
384
+ }
385
+ return result;
386
+ }
387
+ // ── Channel Resume Map ──
388
+ /** Save a session UUID for resume when a channel goes idle. */
389
+ saveChannelResume(channelId, uuid, sessionName) {
390
+ this.channelResumeMap.set(channelId, {
391
+ uuid,
392
+ savedAt: new Date().toISOString(),
393
+ sessionName,
394
+ });
395
+ this._saveChannelResumeMap();
396
+ }
397
+ /** Get the resume UUID for a channel (returns null if none or expired). */
398
+ getChannelResume(channelId) {
399
+ const entry = this.channelResumeMap.get(channelId);
400
+ if (!entry)
401
+ return null;
402
+ // Expire entries older than 24 hours
403
+ const age = Date.now() - new Date(entry.savedAt).getTime();
404
+ if (age > 24 * 60 * 60 * 1000) {
405
+ this.channelResumeMap.delete(channelId);
406
+ this._saveChannelResumeMap();
407
+ return null;
408
+ }
409
+ return { uuid: entry.uuid, sessionName: entry.sessionName };
410
+ }
411
+ /** Remove a resume entry (consumed after resume). */
412
+ removeChannelResume(channelId) {
413
+ this.channelResumeMap.delete(channelId);
414
+ this._saveChannelResumeMap();
415
+ }
416
+ // ── Stall Detection ──
417
+ /** Track an injected message for stall detection. */
418
+ trackMessageInjection(channelId, sessionName, text) {
419
+ const key = `${channelId}-${Date.now()}`;
420
+ this.pendingStalls.set(key, {
421
+ channelId,
422
+ sessionName,
423
+ text: text.slice(0, 200),
424
+ injectedAt: Date.now(),
425
+ });
426
+ }
427
+ /** Clear stall tracking for a channel (agent responded). */
428
+ clearStallTracking(channelId) {
429
+ for (const [key, entry] of this.pendingStalls) {
430
+ if (entry.channelId === channelId) {
431
+ this.pendingStalls.delete(key);
432
+ }
433
+ }
434
+ }
435
+ /** Start periodic stall checking (stalls + promise expiry, LLM-gated). */
436
+ startStallDetection(timeoutMs = 5 * 60 * 1000, promiseTimeoutMs = 10 * 60 * 1000) {
437
+ if (this.stallCheckTimer)
438
+ return;
439
+ this.stallCheckTimer = setInterval(async () => {
440
+ const now = Date.now();
441
+ // Check for stalled messages
442
+ for (const [key, entry] of this.pendingStalls) {
443
+ if (now - entry.injectedAt > timeoutMs) {
444
+ this.pendingStalls.delete(key);
445
+ // Delegate to triage system if available
446
+ if (this.onStallDetected) {
447
+ this.onStallDetected(entry.channelId, entry.sessionName, entry.text, entry.injectedAt);
448
+ continue;
449
+ }
450
+ // Fallback: LLM-gated user-facing alert
451
+ const minutesAgo = Math.round((now - entry.injectedAt) / 60000);
452
+ const alive = this.onIsSessionAlive ? this.onIsSessionAlive(entry.sessionName) : true;
453
+ const shouldAlert = await this.confirmStallAlert({
454
+ type: 'stall', sessionName: entry.sessionName,
455
+ messageText: entry.text, minutesElapsed: minutesAgo, sessionAlive: alive,
456
+ });
457
+ if (shouldAlert) {
458
+ const status = alive ? 'running but not responding' : 'no longer running';
459
+ this.sendToChannel(entry.channelId, `⚠️ No response after ${minutesAgo} minutes. "${entry.sessionName}" is ${status}.\n\n${alive ? 'Use `!interrupt` to nudge it, or `!restart` to start fresh.' : 'Send another message to start a new session.'}`).catch(() => { });
460
+ }
461
+ }
462
+ }
463
+ // Check for expired promises
464
+ if (promiseTimeoutMs > 0) {
465
+ for (const [channelId, promise] of this.pendingPromises) {
466
+ if (promise.alerted)
467
+ continue;
468
+ if (now - promise.promisedAt < promiseTimeoutMs)
469
+ continue;
470
+ promise.alerted = true;
471
+ const alive = this.onIsSessionAlive ? this.onIsSessionAlive(promise.sessionName) : true;
472
+ // Delegate to triage if available
473
+ if (this.onStallDetected) {
474
+ this.onStallDetected(channelId, promise.sessionName, `[promise expired] ${promise.promiseText}`, promise.promisedAt);
475
+ continue;
476
+ }
477
+ // Fallback: LLM-gated alert
478
+ const minutesAgo = Math.round((now - promise.promisedAt) / 60000);
479
+ const shouldAlert = await this.confirmStallAlert({
480
+ type: 'promise-expired', sessionName: promise.sessionName,
481
+ messageText: promise.promiseText, minutesElapsed: minutesAgo, sessionAlive: alive,
482
+ });
483
+ if (shouldAlert) {
484
+ this.sendToChannel(channelId, `⚠️ The agent said "${promise.promiseText.slice(0, 80)}..." ${minutesAgo} minutes ago but hasn't followed up.\n\n${alive ? 'Use `!interrupt` to nudge or `!restart` to start fresh.' : 'Session has ended. Send a new message to start.'}`).catch(() => { });
485
+ }
486
+ }
487
+ }
488
+ }, 30_000); // Check every 30s
489
+ if (this.stallCheckTimer.unref)
490
+ this.stallCheckTimer.unref();
491
+ }
492
+ /** Get pending stall count. */
493
+ getPendingStallCount() {
494
+ return this.pendingStalls.size;
495
+ }
496
+ /** Track a promise from the agent ("give me a minute" etc.) */
497
+ trackPromise(channelId, sessionName, text) {
498
+ if (this._isPromiseMessage(text)) {
499
+ this.pendingPromises.set(channelId, {
500
+ channelId,
501
+ sessionName,
502
+ promiseText: text.slice(0, 200),
503
+ promisedAt: Date.now(),
504
+ alerted: false,
505
+ });
506
+ }
507
+ else if (this.pendingPromises.has(channelId) && this._isFollowThroughMessage(text)) {
508
+ this.pendingPromises.delete(channelId);
509
+ }
510
+ }
511
+ /** Clear promise tracking for a channel. */
512
+ clearPromiseTracking(channelId) {
513
+ this.pendingPromises.delete(channelId);
514
+ }
515
+ _isPromiseMessage(text) {
516
+ const patterns = [
517
+ /give me (?:a )?(?:couple|few|some) (?:more )?minutes/i,
518
+ /give me (?:a )?(?:minute|moment|second|sec)/i,
519
+ /working on (?:it|this|that)/i,
520
+ /looking into (?:it|this|that)/i,
521
+ /let me (?:check|look|investigate|dig|research)/i,
522
+ /investigating/i,
523
+ /still (?:on it|working|looking)/i,
524
+ /one moment/i, /hang on/i, /bear with me/i,
525
+ /i'll (?:get back|follow up|check|look into)/i,
526
+ /narrowing (?:it |this |that )?down/i,
527
+ ];
528
+ return patterns.some(p => p.test(text));
529
+ }
530
+ _isFollowThroughMessage(text) {
531
+ if (text.length > 200)
532
+ return true;
533
+ const patterns = [
534
+ /here(?:'s| is| are) (?:what|the)/i,
535
+ /i found/i,
536
+ /the (?:issue|problem|bug|fix|solution|answer|result)/i,
537
+ /done|completed|finished|resolved/i,
538
+ /summary|overview|analysis/i,
539
+ ];
540
+ return patterns.some(p => p.test(text));
541
+ }
542
+ /** LLM-gated stall alert confirmation. Returns true if alert should be sent. Fail-open. */
543
+ async confirmStallAlert(context) {
544
+ if (!this.intelligence)
545
+ return true;
546
+ const prompt = [
547
+ 'You are evaluating whether to send an alert to a user about an AI agent session.',
548
+ '',
549
+ `Alert type: ${context.type}`,
550
+ `Session: "${context.sessionName}" (${context.sessionAlive ? 'still running' : 'stopped'})`,
551
+ `Time elapsed: ${context.minutesElapsed} minutes`,
552
+ `Context: "${context.messageText}"`,
553
+ '',
554
+ 'Should we send a user-facing alert about this? Consider:',
555
+ '- If the session stopped, the user needs to know',
556
+ '- If the session is still running, it might just be working on a complex task',
557
+ `- ${context.minutesElapsed} minutes is ${context.minutesElapsed > 15 ? 'a long time' : 'moderate'} for an AI task`,
558
+ '',
559
+ 'Respond with exactly one word: yes or no.',
560
+ ].join('\n');
561
+ try {
562
+ const response = await this.intelligence.evaluate(prompt, { maxTokens: 5, temperature: 0 });
563
+ if (response.trim().toLowerCase() === 'no') {
564
+ console.log(`[slack] LLM suppressed ${context.type} alert for "${context.sessionName}" (${context.minutesElapsed}m)`);
565
+ return false;
566
+ }
567
+ return true;
568
+ }
569
+ catch {
570
+ return true; // Fail-open
571
+ }
572
+ }
573
+ /** Get adapter status. */
574
+ getStatus() {
575
+ return {
576
+ started: this.started,
577
+ uptime: this.started ? Date.now() : null,
578
+ pendingStalls: this.pendingStalls.size,
579
+ pendingPromises: this.pendingPromises.size,
580
+ channelMappings: this.channelToSession.size,
581
+ };
582
+ }
583
+ // ── Registry Persistence ──
584
+ _loadChannelRegistry() {
585
+ try {
586
+ if (fs.existsSync(this.channelRegistryPath)) {
587
+ const data = JSON.parse(fs.readFileSync(this.channelRegistryPath, 'utf-8'));
588
+ for (const [k, v] of Object.entries(data.channelToSession ?? {})) {
589
+ this.channelToSession.set(k, v);
590
+ }
591
+ }
592
+ }
593
+ catch { /* non-fatal */ }
594
+ }
595
+ _saveChannelRegistry() {
596
+ try {
597
+ const data = { channelToSession: Object.fromEntries(this.channelToSession) };
598
+ const tmp = this.channelRegistryPath + '.tmp';
599
+ fs.writeFileSync(tmp, JSON.stringify(data, null, 2));
600
+ fs.renameSync(tmp, this.channelRegistryPath);
601
+ }
602
+ catch { /* non-fatal */ }
603
+ }
604
+ _loadChannelResumeMap() {
605
+ try {
606
+ if (fs.existsSync(this.channelResumeMapPath)) {
607
+ const data = JSON.parse(fs.readFileSync(this.channelResumeMapPath, 'utf-8'));
608
+ for (const [k, v] of Object.entries(data)) {
609
+ this.channelResumeMap.set(k, v);
610
+ }
611
+ }
612
+ }
613
+ catch { /* non-fatal */ }
614
+ }
615
+ _saveChannelResumeMap() {
616
+ try {
617
+ const data = Object.fromEntries(this.channelResumeMap);
618
+ const tmp = this.channelResumeMapPath + '.tmp';
619
+ fs.writeFileSync(tmp, JSON.stringify(data, null, 2));
620
+ fs.renameSync(tmp, this.channelResumeMapPath);
621
+ }
622
+ catch { /* non-fatal */ }
623
+ }
624
+ // ── Test Helpers (underscore-prefixed) ──
625
+ /** Inject a simulated message for testing. */
626
+ async _testInjectMessage(event) {
627
+ await this._handleEvent('message', { event });
628
+ }
629
+ /** Inject a simulated interaction for testing. */
630
+ async _testInjectInteraction(payload) {
631
+ await this._handleInteraction(payload);
632
+ }
633
+ // ── Internal Event Handling ──
634
+ async _handleEvent(type, payload) {
635
+ const event = (payload.event ?? payload);
636
+ if (type === 'message' || event.type === 'message') {
637
+ await this._handleMessage(event);
638
+ }
639
+ else if (type === 'file_shared') {
640
+ await this._handleFileShared(event);
641
+ }
642
+ else if (type === 'channel_created' && this.autoJoinChannels) {
643
+ // Auto-join newly created channels in dedicated mode
644
+ const channel = event.channel;
645
+ const newChannelId = channel?.id ?? event.channel;
646
+ if (newChannelId) {
647
+ this.apiClient.call('conversations.join', { channel: newChannelId }).then(() => {
648
+ console.log(`[slack] Auto-joined new channel ${newChannelId}`);
649
+ }).catch((err) => {
650
+ console.warn(`[slack] Could not auto-join new channel: ${err.message}`);
651
+ });
652
+ }
653
+ }
654
+ }
655
+ async _handleMessage(event) {
656
+ const userId = event.user;
657
+ const text = event.text ?? '';
658
+ const channelId = event.channel;
659
+ const ts = event.ts;
660
+ const threadTs = event.thread_ts;
661
+ const files = event.files;
662
+ // Skip most subtypes (edits, deletes, etc.)
663
+ // Allow file_share subtype through — that's how Slack sends messages with attachments
664
+ const subtype = event.subtype;
665
+ if (subtype && subtype !== 'file_share')
666
+ return;
667
+ if (!userId || !channelId)
668
+ return;
669
+ // Dedup — Socket Mode reconnections can redeliver the same event.
670
+ // Slack message timestamps are unique per-channel and safe as dedup keys.
671
+ if (ts && this.seenMessageTs.has(ts)) {
672
+ return;
673
+ }
674
+ if (ts) {
675
+ this.seenMessageTs.add(ts);
676
+ }
677
+ // Bot messages: store in ring buffer for context but don't process as user input
678
+ // This ensures spawned sessions see the full conversation (both sides).
679
+ if (event.bot_id) {
680
+ const buffer = this.channelHistory.get(channelId) ?? new RingBuffer(RING_BUFFER_CAPACITY);
681
+ buffer.push({ ts, user: userId, text, channel: channelId, thread_ts: threadTs });
682
+ this.channelHistory.set(channelId, buffer);
683
+ // Bot replied in this channel — clear stall tracking (the agent answered)
684
+ this.clearStallTracking(channelId);
685
+ return;
686
+ }
687
+ // AuthGate — fail-closed
688
+ if (!this.isAuthorized(userId)) {
689
+ // Send ephemeral "not authorized" message instead of silently dropping
690
+ this.postEphemeral(channelId, userId, `You're not authorized to interact with this agent. Contact the workspace admin to get access.`).catch(() => { });
691
+ return;
692
+ }
693
+ // In mention-only mode, skip messages that don't @mention the bot (except DMs and commands)
694
+ const isDM = channelId.startsWith('D');
695
+ if (this.respondMode === 'mention-only' && !isDM && !this._isBotMentioned(text)) {
696
+ // Still populate ring buffer for context, but don't process
697
+ const buffer = this.channelHistory.get(channelId) ?? new RingBuffer(RING_BUFFER_CAPACITY);
698
+ buffer.push({ ts, user: userId, text, channel: channelId, thread_ts: threadTs });
699
+ this.channelHistory.set(channelId, buffer);
700
+ return;
701
+ }
702
+ // Check for standby commands (unstick, quiet, resume, restart) — these bypass normal processing
703
+ const lowerText = text.trim().toLowerCase();
704
+ if (this.onStandbyCommand && ['unstick', 'quiet', 'resume', 'restart'].includes(lowerText)) {
705
+ const handled = await this.onStandbyCommand(channelId, lowerText, userId);
706
+ if (handled)
707
+ return;
708
+ }
709
+ // Handle commands (Slack intercepts / prefix, so we use ! prefix)
710
+ // Supports both !command and /command (in case Slack delivers it)
711
+ if (text.startsWith('!') || text.startsWith('/')) {
712
+ const normalizedText = text.startsWith('!') ? '/' + text.slice(1) : text;
713
+ const handled = await this._handleSlashCommand(normalizedText, channelId, ts);
714
+ if (handled)
715
+ return;
716
+ }
717
+ // Strip @mention of the bot from message text (so sessions see clean content)
718
+ let cleanText = text;
719
+ if (this.botUserId) {
720
+ cleanText = text.replace(new RegExp(`<@${this.botUserId}>\\s*`, 'g'), '').trim();
721
+ }
722
+ // Download attached files (images, documents, voice/audio) and append appropriate tags
723
+ const filePaths = [];
724
+ if (files && files.length > 0) {
725
+ for (const file of files) {
726
+ const url = file.url_private;
727
+ const mimetype = file.mimetype ?? '';
728
+ const filename = file.name ?? 'file';
729
+ if (!url)
730
+ continue;
731
+ try {
732
+ const isImage = mimetype.startsWith('image/');
733
+ const isAudio = mimetype.startsWith('audio/');
734
+ const destName = `${isImage ? 'photo' : isAudio ? 'voice' : 'file'}-${Date.now()}-${file.id ?? ts}.${filename.split('.').pop() ?? 'bin'}`;
735
+ const destPath = path.join(this.fileHandler.downloadDir, destName);
736
+ const savedPath = await this.fileHandler.downloadFile(url, destPath);
737
+ filePaths.push(savedPath);
738
+ if (isImage) {
739
+ // Validate the downloaded file is actually a processable image
740
+ const imageValid = this._validateImageFile(savedPath);
741
+ if (imageValid) {
742
+ cleanText = cleanText ? `${cleanText} [image:${savedPath}]` : `[image:${savedPath}]`;
743
+ }
744
+ else {
745
+ // File exists but isn't a valid/processable image — fall back to document
746
+ console.warn(`[slack] Downloaded image failed validation, treating as document: ${savedPath}`);
747
+ cleanText = cleanText ? `${cleanText} [document:${savedPath}]` : `[document:${savedPath}]`;
748
+ }
749
+ }
750
+ else if (isAudio && this.transcribeVoice) {
751
+ // Voice message: transcribe and inject as [voice] transcript
752
+ try {
753
+ const transcript = await this.transcribeVoice(savedPath);
754
+ cleanText = cleanText ? `${cleanText} [voice] ${transcript}` : `[voice] ${transcript}`;
755
+ }
756
+ catch (transcribeErr) {
757
+ console.warn(`[slack] Voice transcription failed: ${transcribeErr.message}`);
758
+ cleanText = cleanText ? `${cleanText} [document:${savedPath}]` : `[document:${savedPath}]`;
759
+ }
760
+ }
761
+ else {
762
+ cleanText = cleanText ? `${cleanText} [document:${savedPath}]` : `[document:${savedPath}]`;
763
+ }
764
+ }
765
+ catch (err) {
766
+ console.warn(`[slack] Failed to download file ${filename}: ${err.message}`);
767
+ const isImage = mimetype.startsWith('image/');
768
+ cleanText = cleanText ? `${cleanText} [${isImage ? 'image' : 'document'}:download-failed]` : `[${isImage ? 'image' : 'document'}:download-failed]`;
769
+ }
770
+ }
771
+ }
772
+ // Populate ring buffer (authorized messages only — prevents cache poisoning)
773
+ const buffer = this.channelHistory.get(channelId) ?? new RingBuffer(RING_BUFFER_CAPACITY);
774
+ buffer.push({ ts, user: userId, text: cleanText, channel: channelId, thread_ts: threadTs });
775
+ this.channelHistory.set(channelId, buffer);
776
+ // Resolve user name
777
+ let senderName = userId;
778
+ try {
779
+ const info = await this.getUserInfo(userId);
780
+ senderName = info.name;
781
+ }
782
+ catch {
783
+ // Use userId as fallback
784
+ }
785
+ // Log inbound message
786
+ const logEntry = {
787
+ messageId: ts,
788
+ channelId,
789
+ text: cleanText,
790
+ fromUser: true,
791
+ timestamp: new Date(parseFloat(ts) * 1000).toISOString(),
792
+ sessionName: null,
793
+ senderName: sanitizeDisplayName(senderName),
794
+ platformUserId: userId,
795
+ platform: 'slack',
796
+ };
797
+ this.logger.append(logEntry);
798
+ this.onMessageLogged?.(logEntry);
799
+ // Acknowledge with reaction (fire-and-forget)
800
+ this.addReaction(channelId, ts, 'eyes');
801
+ // Convert to Instar Message format
802
+ const message = {
803
+ id: `slack-${ts}`,
804
+ userId,
805
+ content: cleanText,
806
+ channel: {
807
+ type: 'slack',
808
+ identifier: channelId,
809
+ },
810
+ receivedAt: new Date(parseFloat(ts) * 1000).toISOString(),
811
+ metadata: {
812
+ slackUserId: userId,
813
+ senderName: sanitizeDisplayName(senderName),
814
+ ts,
815
+ threadTs: threadTs,
816
+ channelId,
817
+ isDM,
818
+ },
819
+ };
820
+ // Route to handler
821
+ if (this.messageHandler) {
822
+ try {
823
+ await this.messageHandler(message);
824
+ }
825
+ catch (err) {
826
+ console.error('[slack] Message handler error:', err.message);
827
+ }
828
+ }
829
+ // Mark complete (replace eyes with checkmark)
830
+ this.removeReaction(channelId, ts, 'eyes');
831
+ this.addReaction(channelId, ts, 'white_check_mark');
832
+ }
833
+ async _handleInteraction(payload) {
834
+ const userId = payload.user?.id;
835
+ if (!userId)
836
+ return;
837
+ // AuthGate check
838
+ if (!this.isAuthorized(userId)) {
839
+ console.warn(`[slack] Unauthorized interaction from ${userId}`);
840
+ return;
841
+ }
842
+ const action = payload.actions?.[0];
843
+ if (!action)
844
+ return;
845
+ if (action.action_id.startsWith('prompt::')) {
846
+ const parts = action.action_id.split('::');
847
+ const promptId = parts[1];
848
+ // Validate this is a prompt we sent
849
+ const messageTs = payload.message?.ts;
850
+ if (!messageTs || !this.pendingPrompts.has(messageTs)) {
851
+ console.warn(`[slack] Interaction for unknown prompt ts: ${messageTs}`);
852
+ return;
853
+ }
854
+ const pending = this.pendingPrompts.get(messageTs);
855
+ this.pendingPrompts.delete(messageTs);
856
+ // Clear stall tracking for the channel — prompt was answered
857
+ this.clearStallTracking(pending.channelId);
858
+ // Update message to show selection
859
+ const channelId = payload.channel?.id;
860
+ if (channelId && messageTs) {
861
+ await this.updateMessage(channelId, messageTs, `Answered: ${action.text?.text ?? action.value ?? 'selected'}`).catch(() => { });
862
+ }
863
+ // Inject the response into the session
864
+ const value = action.value ?? action.text?.text ?? '';
865
+ if (this.onPromptResponse && channelId) {
866
+ this.onPromptResponse(channelId, promptId, value);
867
+ console.log(`[slack] Prompt response: session=${pending.sessionName ?? 'unknown'} value="${value}"`);
868
+ }
869
+ }
870
+ }
871
+ async _handleFileShared(event) {
872
+ // Files attached to messages are handled inline in _handleMessage.
873
+ // This handler catches standalone file_shared events (e.g., drag-and-drop without text).
874
+ const userId = event.user_id ?? event.user;
875
+ const channelId = event.channel_id;
876
+ const fileId = event.file_id;
877
+ // AuthGate — check before download (prevents disk exhaustion from unauthorized users)
878
+ if (!userId || !this.isAuthorized(userId)) {
879
+ return;
880
+ }
881
+ if (!fileId || !channelId) {
882
+ console.warn(`[slack] file_shared event missing file_id or channel_id`);
883
+ return;
884
+ }
885
+ // Fetch file metadata from Slack API (url_private, mimetype, name, etc.)
886
+ let fileInfo;
887
+ try {
888
+ const response = await this.apiClient.call('files.info', { file: fileId });
889
+ fileInfo = response.file;
890
+ if (!fileInfo) {
891
+ console.warn(`[slack] files.info returned no file for ${fileId}`);
892
+ return;
893
+ }
894
+ }
895
+ catch (err) {
896
+ const errMsg = err.message;
897
+ if (errMsg.includes('missing_scope')) {
898
+ console.error(`[slack] files.info requires 'files:read' scope — add it in your Slack app's OAuth settings and reinstall the app`);
899
+ }
900
+ else {
901
+ console.error(`[slack] files.info failed for ${fileId}: ${errMsg}`);
902
+ }
903
+ return;
904
+ }
905
+ const url = fileInfo.url_private;
906
+ const mimetype = fileInfo.mimetype ?? '';
907
+ const filename = fileInfo.name ?? 'file';
908
+ if (!url) {
909
+ console.warn(`[slack] file ${fileId} has no url_private`);
910
+ return;
911
+ }
912
+ // Download and process the file
913
+ const ts = `file-${fileId}-${Date.now()}`;
914
+ let cleanText = '';
915
+ try {
916
+ const isImage = mimetype.startsWith('image/');
917
+ const isAudio = mimetype.startsWith('audio/');
918
+ const destName = `${isImage ? 'photo' : isAudio ? 'voice' : 'file'}-${Date.now()}-${fileId}.${filename.split('.').pop() ?? 'bin'}`;
919
+ const destPath = path.join(this.fileHandler.downloadDir, destName);
920
+ const savedPath = await this.fileHandler.downloadFile(url, destPath);
921
+ if (isImage) {
922
+ const imageValid = this._validateImageFile(savedPath);
923
+ cleanText = imageValid ? `[image:${savedPath}]` : `[document:${savedPath}]`;
924
+ if (!imageValid) {
925
+ console.warn(`[slack] Downloaded image failed validation, treating as document: ${savedPath}`);
926
+ }
927
+ }
928
+ else if (isAudio && this.transcribeVoice) {
929
+ try {
930
+ const transcript = await this.transcribeVoice(savedPath);
931
+ cleanText = `[voice] ${transcript}`;
932
+ }
933
+ catch (transcribeErr) {
934
+ console.warn(`[slack] Voice transcription failed: ${transcribeErr.message}`);
935
+ cleanText = `[document:${savedPath}]`;
936
+ }
937
+ }
938
+ else {
939
+ cleanText = `[document:${savedPath}]`;
940
+ }
941
+ }
942
+ catch (err) {
943
+ console.error(`[slack] Failed to download standalone file ${filename}: ${err.message}`);
944
+ cleanText = `[document:download-failed]`;
945
+ }
946
+ // Acknowledge with reaction on the file message
947
+ // (file_shared events don't have a message ts to react to, so skip reactions)
948
+ // Resolve user name
949
+ let senderName = userId;
950
+ try {
951
+ const info = await this.getUserInfo(userId);
952
+ senderName = info.name;
953
+ }
954
+ catch {
955
+ // Use userId as fallback
956
+ }
957
+ // Log inbound file
958
+ const logEntry = {
959
+ messageId: ts,
960
+ channelId,
961
+ text: cleanText,
962
+ fromUser: true,
963
+ timestamp: new Date().toISOString(),
964
+ sessionName: null,
965
+ senderName: sanitizeDisplayName(senderName),
966
+ platformUserId: userId,
967
+ platform: 'slack',
968
+ };
969
+ this.logger.append(logEntry);
970
+ this.onMessageLogged?.(logEntry);
971
+ // Convert to Instar Message format and route to handler
972
+ const isDM = channelId.startsWith('D');
973
+ const message = {
974
+ id: `slack-${ts}`,
975
+ userId,
976
+ content: cleanText,
977
+ channel: {
978
+ type: 'slack',
979
+ identifier: channelId,
980
+ },
981
+ receivedAt: new Date().toISOString(),
982
+ metadata: {
983
+ slackUserId: userId,
984
+ senderName: sanitizeDisplayName(senderName),
985
+ ts,
986
+ channelId,
987
+ isDM,
988
+ },
989
+ };
990
+ if (this.messageHandler) {
991
+ try {
992
+ await this.messageHandler(message);
993
+ }
994
+ catch (err) {
995
+ console.error('[slack] Message handler error (file_shared):', err.message);
996
+ }
997
+ }
998
+ console.log(`[slack] Processed standalone file_shared: ${fileId} (${mimetype}) in ${channelId}`);
999
+ }
1000
+ // ── Prompt Gate ──
1001
+ /** Register a pending prompt (for interaction validation). */
1002
+ registerPendingPrompt(messageTs, promptId, channelId, sessionName) {
1003
+ this.pendingPrompts.set(messageTs, {
1004
+ promptId,
1005
+ channelId,
1006
+ messageTs,
1007
+ createdAt: Date.now(),
1008
+ sessionName,
1009
+ });
1010
+ }
1011
+ _startPromptEviction() {
1012
+ const ttl = (this.config.promptGate?.relayTimeoutSeconds ?? 300) * 1000;
1013
+ this.promptEvictionTimer = setInterval(() => {
1014
+ const now = Date.now();
1015
+ for (const [ts, prompt] of this.pendingPrompts) {
1016
+ if (now - prompt.createdAt > ttl) {
1017
+ this.pendingPrompts.delete(ts);
1018
+ }
1019
+ }
1020
+ }, 60_000); // Check every 60s
1021
+ }
1022
+ // ── Utilities ──
1023
+ // ── Prompt Gate (Block Kit) ──
1024
+ /**
1025
+ * Relay a prompt to the user via Block Kit interactive message.
1026
+ * Registers the prompt for validation against spoofed button presses.
1027
+ */
1028
+ async relayPrompt(channelId, promptId, question, options) {
1029
+ const blocks = [
1030
+ {
1031
+ type: 'section',
1032
+ text: { type: 'mrkdwn', text: `*Agent needs your input:*\n${question}` },
1033
+ },
1034
+ {
1035
+ type: 'actions',
1036
+ elements: options.map((opt, i) => ({
1037
+ type: 'button',
1038
+ text: { type: 'plain_text', text: opt.label },
1039
+ value: opt.value,
1040
+ action_id: `prompt::${promptId}::${i}`,
1041
+ ...(opt.primary ? { style: 'primary' } : {}),
1042
+ })),
1043
+ },
1044
+ ];
1045
+ const ts = await this.sendBlocks(channelId, blocks, question);
1046
+ this.registerPendingPrompt(ts, promptId, channelId);
1047
+ }
1048
+ // ── Message Search ──
1049
+ /** Search the JSONL message log. */
1050
+ searchLog(params) {
1051
+ return this.logger.search(params);
1052
+ }
1053
+ /** Get message log statistics. */
1054
+ getLogStats() {
1055
+ return this.logger.getStats();
1056
+ }
1057
+ // ── Channel Housekeeping ──
1058
+ /**
1059
+ * Auto-archive channels idle for more than AUTO_ARCHIVE_DAYS.
1060
+ * Runs periodically. Only archives session channels (sess- prefix).
1061
+ */
1062
+ async _archiveIdleChannels() {
1063
+ try {
1064
+ const channels = await this.channelManager.listChannels();
1065
+ const now = Date.now();
1066
+ const threshold = AUTO_ARCHIVE_DAYS * 24 * 60 * 60 * 1000;
1067
+ for (const channel of channels) {
1068
+ // Only auto-archive session channels, not system/job channels
1069
+ if (!channel.name.includes('-sess-') || channel.is_archived)
1070
+ continue;
1071
+ // Check last message time from ring buffer
1072
+ const history = this.channelHistory.get(channel.id);
1073
+ const lastMessage = history?.toArray().at(-1);
1074
+ if (lastMessage) {
1075
+ const lastTs = parseFloat(lastMessage.ts) * 1000;
1076
+ if (now - lastTs > threshold) {
1077
+ await this.channelManager.archiveChannel(channel.id);
1078
+ console.log(`[slack] Auto-archived idle channel: ${channel.name}`);
1079
+ }
1080
+ }
1081
+ }
1082
+ }
1083
+ catch (err) {
1084
+ console.error('[slack] Channel housekeeping error:', err.message);
1085
+ }
1086
+ }
1087
+ _startHousekeeping() {
1088
+ // Run every 6 hours
1089
+ this.housekeepingTimer = setInterval(() => {
1090
+ this._archiveIdleChannels().catch(() => { });
1091
+ }, 6 * 60 * 60 * 1000);
1092
+ if (this.housekeepingTimer.unref)
1093
+ this.housekeepingTimer.unref();
1094
+ }
1095
+ // ── Log Retention ──
1096
+ /** Purge log entries older than logRetentionDays. */
1097
+ _purgeOldLogs() {
1098
+ const retentionDays = this.config.logRetentionDays ?? 90;
1099
+ if (retentionDays === 0)
1100
+ return; // Unlimited
1101
+ const logPath = path.join(this.stateDir, 'slack-messages.jsonl');
1102
+ if (!fs.existsSync(logPath))
1103
+ return;
1104
+ try {
1105
+ const cutoff = new Date(Date.now() - retentionDays * 24 * 60 * 60 * 1000);
1106
+ const content = fs.readFileSync(logPath, 'utf-8');
1107
+ const lines = content.split('\n').filter(Boolean);
1108
+ const kept = lines.filter(line => {
1109
+ try {
1110
+ const entry = JSON.parse(line);
1111
+ return new Date(entry.timestamp) >= cutoff;
1112
+ }
1113
+ catch {
1114
+ return true; // Keep unparseable lines
1115
+ }
1116
+ });
1117
+ if (kept.length < lines.length) {
1118
+ fs.writeFileSync(logPath, kept.join('\n') + '\n');
1119
+ console.log(`[slack] Log purge: removed ${lines.length - kept.length} entries older than ${retentionDays} days`);
1120
+ }
1121
+ }
1122
+ catch {
1123
+ // Non-fatal — will retry on next cycle
1124
+ }
1125
+ }
1126
+ _startLogPurge() {
1127
+ this.logPurgeTimer = setInterval(() => {
1128
+ this._purgeOldLogs();
1129
+ }, LOG_PURGE_INTERVAL_MS);
1130
+ if (this.logPurgeTimer.unref)
1131
+ this.logPurgeTimer.unref();
1132
+ }
1133
+ // ── Dashboard ──
1134
+ /**
1135
+ * Broadcast the tunnel URL to the dashboard channel.
1136
+ * Called by server.ts when tunnel is established.
1137
+ */
1138
+ /** Last broadcast dashboard URL and message timestamp (for update-in-place) */
1139
+ lastDashboardUrl = null;
1140
+ lastDashboardMessageTs = null;
1141
+ async broadcastDashboardUrl(tunnelUrl) {
1142
+ const dashboardChannelId = this.config.dashboardChannelId;
1143
+ if (!dashboardChannelId)
1144
+ return;
1145
+ // Skip if URL hasn't changed
1146
+ if (this.lastDashboardUrl === tunnelUrl)
1147
+ return;
1148
+ const text = `Dashboard available at: ${tunnelUrl}`;
1149
+ try {
1150
+ if (this.lastDashboardMessageTs) {
1151
+ // Update existing message in-place
1152
+ await this.updateMessage(dashboardChannelId, this.lastDashboardMessageTs, text);
1153
+ }
1154
+ else {
1155
+ // First time — post new message and pin it
1156
+ const ts = await this.sendToChannel(dashboardChannelId, text);
1157
+ this.lastDashboardMessageTs = ts;
1158
+ try {
1159
+ await this.pinMessage(dashboardChannelId, ts);
1160
+ }
1161
+ catch { /* already pinned or can't pin */ }
1162
+ }
1163
+ this.lastDashboardUrl = tunnelUrl;
1164
+ }
1165
+ catch (err) {
1166
+ // If update fails (message deleted?), post new
1167
+ try {
1168
+ const ts = await this.sendToChannel(dashboardChannelId, text);
1169
+ this.lastDashboardMessageTs = ts;
1170
+ this.lastDashboardUrl = tunnelUrl;
1171
+ try {
1172
+ await this.pinMessage(dashboardChannelId, ts);
1173
+ }
1174
+ catch { /* ignore */ }
1175
+ }
1176
+ catch (err2) {
1177
+ console.error('[slack] Dashboard broadcast failed:', err2.message);
1178
+ }
1179
+ }
1180
+ }
1181
+ // ── Unanswered Message Detection ──
1182
+ /**
1183
+ * Get count of unanswered user messages in a channel.
1184
+ * A message is "unanswered" if it's from a user and no agent reply follows.
1185
+ */
1186
+ getUnansweredCount(channelId) {
1187
+ const messages = this.getChannelMessages(channelId);
1188
+ let unanswered = 0;
1189
+ for (let i = messages.length - 1; i >= 0; i--) {
1190
+ const msg = messages[i];
1191
+ // Messages from authorized users are "user" messages
1192
+ if (this.authorizedUsers.has(msg.user)) {
1193
+ unanswered++;
1194
+ }
1195
+ else {
1196
+ break; // Agent reply found — stop counting
1197
+ }
1198
+ }
1199
+ return unanswered;
1200
+ }
1201
+ // ── Slash Commands (Telegram parity) ──
1202
+ /** Handle slash commands from Slack messages. Returns true if handled. */
1203
+ async _handleSlashCommand(text, channelId, ts) {
1204
+ const parts = text.trim().split(/\s+/);
1205
+ const cmd = parts[0].toLowerCase();
1206
+ const args = parts.slice(1).join(' ');
1207
+ switch (cmd) {
1208
+ case '/sessions': {
1209
+ // List running sessions
1210
+ const sessions = this.getChannelRegistry();
1211
+ const lines = Object.entries(sessions).map(([chId, info]) => `• ${info.sessionName}${info.channelName ? ` (#${info.channelName})` : ` (${chId})`}`);
1212
+ const reply = lines.length > 0
1213
+ ? `Running Slack sessions:\n${lines.join('\n')}`
1214
+ : 'No active Slack sessions.';
1215
+ await this.sendToChannel(channelId, reply);
1216
+ return true;
1217
+ }
1218
+ case '/new': {
1219
+ // Create new session with Slack channel
1220
+ const name = args || `session-${Date.now()}`;
1221
+ const channelName = `${(this.config.workspaceName?.replace(/-agent$/i, '') || 'agent').toLowerCase().replace(/[^a-z0-9]/g, '-')}-sess-${name.toLowerCase().replace(/[^a-z0-9]/g, '-').slice(0, 40)}`;
1222
+ try {
1223
+ const newChannelId = await this.createChannel(channelName);
1224
+ // Invite authorized users
1225
+ for (const uid of this.config.authorizedUserIds) {
1226
+ this.apiClient.call('conversations.invite', { channel: newChannelId, users: uid }).catch(() => { });
1227
+ }
1228
+ await this.sendToChannel(channelId, `Created new session channel: #${channelName}`);
1229
+ await this.sendToChannel(newChannelId, `Session "${name}" is ready. Send a message here to start working.`);
1230
+ }
1231
+ catch (err) {
1232
+ await this.sendToChannel(channelId, `Failed to create session: ${err.message}`);
1233
+ }
1234
+ return true;
1235
+ }
1236
+ case '/claim':
1237
+ case '/link': {
1238
+ // Claim/link a session to this channel
1239
+ if (!args) {
1240
+ await this.sendToChannel(channelId, `Please include a session name — e.g. \`!claim my-session\``);
1241
+ return true;
1242
+ }
1243
+ const existingSession = this.getSessionForChannel(channelId);
1244
+ if (existingSession) {
1245
+ await this.sendToChannel(channelId, `This channel is already linked to "${existingSession}". Use \`!unlink\` first.`);
1246
+ return true;
1247
+ }
1248
+ this.registerChannelSession(channelId, args);
1249
+ await this.sendToChannel(channelId, `Claimed session "${args}" into this channel.`);
1250
+ return true;
1251
+ }
1252
+ case '/unlink': {
1253
+ const sessionName = this.getSessionForChannel(channelId);
1254
+ if (!sessionName) {
1255
+ await this.sendToChannel(channelId, 'No session linked to this channel.');
1256
+ return true;
1257
+ }
1258
+ this.unregisterChannel(channelId);
1259
+ await this.sendToChannel(channelId, `Unlinked session "${sessionName}" from this channel.`);
1260
+ return true;
1261
+ }
1262
+ case '/interrupt': {
1263
+ const sessionName = this.getSessionForChannel(channelId);
1264
+ if (!sessionName) {
1265
+ await this.sendToChannel(channelId, 'No session linked to this channel.');
1266
+ return true;
1267
+ }
1268
+ if (!this.onInterruptSession) {
1269
+ await this.sendToChannel(channelId, 'Interrupt not available.');
1270
+ return true;
1271
+ }
1272
+ try {
1273
+ const success = await this.onInterruptSession(sessionName);
1274
+ this.clearStallTracking(channelId);
1275
+ await this.sendToChannel(channelId, success
1276
+ ? `Nudged "${sessionName}" — it should resume shortly.`
1277
+ : `Failed to interrupt "${sessionName}" — session may not exist.`);
1278
+ }
1279
+ catch {
1280
+ await this.sendToChannel(channelId, `Couldn't interrupt the session. It may have already ended.`);
1281
+ }
1282
+ return true;
1283
+ }
1284
+ case '/restart': {
1285
+ const sessionName = this.getSessionForChannel(channelId);
1286
+ if (!sessionName) {
1287
+ await this.sendToChannel(channelId, 'No session linked to this channel.');
1288
+ return true;
1289
+ }
1290
+ if (!this.onRestartSession) {
1291
+ await this.sendToChannel(channelId, 'Restart not available.');
1292
+ return true;
1293
+ }
1294
+ this.clearStallTracking(channelId);
1295
+ await this.sendToChannel(channelId, `Restarting "${sessionName}"...`);
1296
+ try {
1297
+ await this.onRestartSession(sessionName, channelId);
1298
+ await this.sendToChannel(channelId, 'Session restarted.');
1299
+ }
1300
+ catch {
1301
+ await this.sendToChannel(channelId, `Restart didn't work. Try sending a new message to start a fresh session.`);
1302
+ }
1303
+ return true;
1304
+ }
1305
+ case '/triage': {
1306
+ if (!this.onGetTriageStatus) {
1307
+ await this.sendToChannel(channelId, 'Triage system not available.');
1308
+ return true;
1309
+ }
1310
+ const status = this.onGetTriageStatus(channelId);
1311
+ if (!status || !status.active) {
1312
+ await this.sendToChannel(channelId, '🔍 No active triage for this channel. Session appears to be operating normally.');
1313
+ }
1314
+ else {
1315
+ const triageLines = [
1316
+ '🔍 Active triage for this channel:',
1317
+ `Classification: ${status.classification || 'pending'}`,
1318
+ `Checks: ${status.checkCount}`,
1319
+ status.lastCheck ? `Last check: ${status.lastCheck}` : '',
1320
+ ].filter(Boolean);
1321
+ await this.sendToChannel(channelId, triageLines.join('\n'));
1322
+ }
1323
+ return true;
1324
+ }
1325
+ case '/status': {
1326
+ const s = this.getStatus();
1327
+ const wsConfig = this.getWorkspaceConfig();
1328
+ const lines = [
1329
+ `Slack adapter: ${s.started ? '✅ running' : '❌ stopped'}`,
1330
+ `Workspace mode: ${wsConfig.mode} (respond: ${wsConfig.respondMode})`,
1331
+ `Channel mappings: ${s.channelMappings}`,
1332
+ `Pending stall alerts: ${s.pendingStalls}`,
1333
+ `Pending promises: ${s.pendingPromises}`,
1334
+ ];
1335
+ await this.sendToChannel(channelId, lines.join('\n'));
1336
+ return true;
1337
+ }
1338
+ case '/help': {
1339
+ await this.sendToChannel(channelId, `Available commands (use \`!\` prefix in Slack):\n` +
1340
+ `• \`!sessions\` — List running sessions\n` +
1341
+ `• \`!new [name]\` — Create a new session channel\n` +
1342
+ `• \`!claim <session>\` — Link a session to this channel\n` +
1343
+ `• \`!unlink\` — Unlink session from this channel\n` +
1344
+ `• \`!interrupt\` — Nudge a stuck session\n` +
1345
+ `• \`!restart\` — Kill and respawn the session\n` +
1346
+ `• \`!triage\` — Show triage status for this channel\n` +
1347
+ `• \`!status\` — Show adapter status\n` +
1348
+ `• \`!help\` — Show this help message`);
1349
+ return true;
1350
+ }
1351
+ default:
1352
+ // Unknown command — don't handle, let it pass through as a regular message
1353
+ return false;
1354
+ }
1355
+ }
1356
+ /**
1357
+ * Auto-join all public channels in the workspace.
1358
+ * Only called in dedicated mode or when autoJoinChannels is true.
1359
+ * Runs asynchronously — doesn't block startup.
1360
+ */
1361
+ /**
1362
+ * Backfill ring buffers with recent channel history from Slack's API.
1363
+ * This runs on startup so that sessions spawned after a server restart
1364
+ * have conversation context instead of starting from scratch.
1365
+ */
1366
+ async _backfillChannelHistory() {
1367
+ // Backfill the lifeline channel and any other configured channels
1368
+ const channelIds = [
1369
+ this.config.lifelineChannelId,
1370
+ this.config.dashboardChannelId,
1371
+ ].filter(Boolean);
1372
+ for (const channelId of channelIds) {
1373
+ try {
1374
+ const result = await this.apiClient.call('conversations.history', {
1375
+ channel: channelId,
1376
+ limit: 50,
1377
+ });
1378
+ const messages = result.messages ?? [];
1379
+ messages.reverse(); // API returns newest-first, we want oldest-first
1380
+ const buffer = this.channelHistory.get(channelId) ?? new RingBuffer(RING_BUFFER_CAPACITY);
1381
+ let count = 0;
1382
+ for (const m of messages) {
1383
+ const user = m.user ?? m.bot_id;
1384
+ const text = m.text ?? '';
1385
+ const ts = m.ts;
1386
+ const subtype = m.subtype;
1387
+ if (!user || !ts)
1388
+ continue;
1389
+ // Skip join/leave subtypes
1390
+ if (subtype && subtype !== 'file_share')
1391
+ continue;
1392
+ buffer.push({ ts, user, text, channel: channelId });
1393
+ count++;
1394
+ }
1395
+ this.channelHistory.set(channelId, buffer);
1396
+ if (count > 0) {
1397
+ console.log(`[slack] Backfilled ${count} messages for channel ${channelId}`);
1398
+ }
1399
+ }
1400
+ catch (err) {
1401
+ console.warn(`[slack] Could not backfill channel ${channelId}: ${err.message}`);
1402
+ }
1403
+ }
1404
+ }
1405
+ async _autoJoinAllChannels() {
1406
+ try {
1407
+ const result = await this.apiClient.call('conversations.list', {
1408
+ types: 'public_channel',
1409
+ limit: 200,
1410
+ exclude_archived: true,
1411
+ });
1412
+ const channels = (result.channels ?? []);
1413
+ let joined = 0;
1414
+ for (const ch of channels) {
1415
+ if (ch.is_member)
1416
+ continue;
1417
+ try {
1418
+ await this.apiClient.call('conversations.join', { channel: ch.id });
1419
+ joined++;
1420
+ }
1421
+ catch (err) {
1422
+ // channels:join scope might not be available — log and continue
1423
+ console.warn(`[slack] Could not auto-join #${ch.name}: ${err.message}`);
1424
+ }
1425
+ }
1426
+ if (joined > 0) {
1427
+ console.log(`[slack] Auto-joined ${joined} channel(s)`);
1428
+ }
1429
+ }
1430
+ catch (err) {
1431
+ console.warn(`[slack] Auto-join channel scan failed: ${err.message}`);
1432
+ }
1433
+ }
1434
+ /**
1435
+ * Check if a message mentions the bot (via @mention).
1436
+ * Slack encodes mentions as <@U12345> in message text.
1437
+ */
1438
+ /**
1439
+ * Validate that a downloaded file is a processable image.
1440
+ * Checks magic bytes and file size to avoid Claude API "Could not process image" errors.
1441
+ */
1442
+ _validateImageFile(filePath) {
1443
+ try {
1444
+ const stats = fs.statSync(filePath);
1445
+ // Too small to be a real image (< 100 bytes is likely an error page or empty)
1446
+ if (stats.size < 100) {
1447
+ console.warn(`[slack] Image too small (${stats.size} bytes): ${filePath}`);
1448
+ return false;
1449
+ }
1450
+ // Too large for Claude API (> 20MB)
1451
+ if (stats.size > 20 * 1024 * 1024) {
1452
+ console.warn(`[slack] Image too large (${Math.round(stats.size / 1024 / 1024)}MB): ${filePath}`);
1453
+ return false;
1454
+ }
1455
+ // Check magic bytes for supported image formats
1456
+ const header = Buffer.alloc(16);
1457
+ const fd = fs.openSync(filePath, 'r');
1458
+ fs.readSync(fd, header, 0, 16, 0);
1459
+ fs.closeSync(fd);
1460
+ // JPEG: FF D8 FF
1461
+ if (header[0] === 0xFF && header[1] === 0xD8 && header[2] === 0xFF)
1462
+ return true;
1463
+ // PNG: 89 50 4E 47
1464
+ if (header[0] === 0x89 && header[1] === 0x50 && header[2] === 0x4E && header[3] === 0x47)
1465
+ return true;
1466
+ // GIF: 47 49 46
1467
+ if (header[0] === 0x47 && header[1] === 0x49 && header[2] === 0x46)
1468
+ return true;
1469
+ // WebP: RIFF....WEBP
1470
+ if (header[0] === 0x52 && header[1] === 0x49 && header[2] === 0x46 && header[3] === 0x46
1471
+ && header[8] === 0x57 && header[9] === 0x45 && header[10] === 0x42 && header[11] === 0x50)
1472
+ return true;
1473
+ // BMP: 42 4D
1474
+ if (header[0] === 0x42 && header[1] === 0x4D)
1475
+ return true;
1476
+ // SVG: starts with < (text-based)
1477
+ if (header[0] === 0x3C)
1478
+ return true;
1479
+ // Check if it looks like HTML (Slack error page downloaded instead of image)
1480
+ const headerStr = header.toString('utf-8', 0, 10).toLowerCase();
1481
+ if (headerStr.includes('<!doctype') || headerStr.includes('<html')) {
1482
+ console.warn(`[slack] Downloaded file is HTML, not an image: ${filePath}`);
1483
+ return false;
1484
+ }
1485
+ console.warn(`[slack] Unknown image format (magic: ${header.slice(0, 4).toString('hex')}): ${filePath}`);
1486
+ return false;
1487
+ }
1488
+ catch (err) {
1489
+ console.warn(`[slack] Image validation error: ${err.message}`);
1490
+ return false;
1491
+ }
1492
+ }
1493
+ _isBotMentioned(text) {
1494
+ if (!this.botUserId)
1495
+ return false;
1496
+ return text.includes(`<@${this.botUserId}>`);
1497
+ }
1498
+ _chunkText(text) {
1499
+ if (text.length <= SLACK_MAX_TEXT_LENGTH)
1500
+ return [text];
1501
+ const chunks = [];
1502
+ let remaining = text;
1503
+ while (remaining.length > 0) {
1504
+ if (remaining.length <= SLACK_MAX_TEXT_LENGTH) {
1505
+ chunks.push(remaining);
1506
+ break;
1507
+ }
1508
+ // Try to break at a newline
1509
+ let breakPoint = remaining.lastIndexOf('\n', SLACK_MAX_TEXT_LENGTH);
1510
+ if (breakPoint < SLACK_MAX_TEXT_LENGTH / 2) {
1511
+ // No good newline break — try space
1512
+ breakPoint = remaining.lastIndexOf(' ', SLACK_MAX_TEXT_LENGTH);
1513
+ }
1514
+ if (breakPoint < SLACK_MAX_TEXT_LENGTH / 2) {
1515
+ // No good break point — hard break
1516
+ breakPoint = SLACK_MAX_TEXT_LENGTH;
1517
+ }
1518
+ chunks.push(remaining.slice(0, breakPoint));
1519
+ remaining = remaining.slice(breakPoint).trimStart();
1520
+ }
1521
+ return chunks;
1522
+ }
1523
+ }
1524
+ //# sourceMappingURL=SlackAdapter.js.map