@nexus-cortex/executors 4.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (365) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +2 -0
  3. package/README.md +13 -0
  4. package/dist/ExecutorRegistry.d.ts +89 -0
  5. package/dist/ExecutorRegistry.d.ts.map +1 -0
  6. package/dist/ExecutorRegistry.js +219 -0
  7. package/dist/ExecutorRegistry.js.map +1 -0
  8. package/dist/base/BaseTool.d.ts +108 -0
  9. package/dist/base/BaseTool.d.ts.map +1 -0
  10. package/dist/base/BaseTool.js +111 -0
  11. package/dist/base/BaseTool.js.map +1 -0
  12. package/dist/base/ToolRegistry.d.ts +141 -0
  13. package/dist/base/ToolRegistry.d.ts.map +1 -0
  14. package/dist/base/ToolRegistry.js +241 -0
  15. package/dist/base/ToolRegistry.js.map +1 -0
  16. package/dist/base/ToolResult.d.ts +63 -0
  17. package/dist/base/ToolResult.d.ts.map +1 -0
  18. package/dist/base/ToolResult.js +8 -0
  19. package/dist/base/ToolResult.js.map +1 -0
  20. package/dist/base/index.d.ts +10 -0
  21. package/dist/base/index.d.ts.map +1 -0
  22. package/dist/base/index.js +8 -0
  23. package/dist/base/index.js.map +1 -0
  24. package/dist/implementations/addon/CreateArtifactTool.d.ts +221 -0
  25. package/dist/implementations/addon/CreateArtifactTool.d.ts.map +1 -0
  26. package/dist/implementations/addon/CreateArtifactTool.js +1042 -0
  27. package/dist/implementations/addon/CreateArtifactTool.js.map +1 -0
  28. package/dist/implementations/addon/FrameDiffCache.d.ts +166 -0
  29. package/dist/implementations/addon/FrameDiffCache.d.ts.map +1 -0
  30. package/dist/implementations/addon/FrameDiffCache.js +395 -0
  31. package/dist/implementations/addon/FrameDiffCache.js.map +1 -0
  32. package/dist/implementations/addon/H264StreamEncoder.d.ts +84 -0
  33. package/dist/implementations/addon/H264StreamEncoder.d.ts.map +1 -0
  34. package/dist/implementations/addon/H264StreamEncoder.js +203 -0
  35. package/dist/implementations/addon/H264StreamEncoder.js.map +1 -0
  36. package/dist/implementations/addon/HybridScreenshotManager.d.ts +197 -0
  37. package/dist/implementations/addon/HybridScreenshotManager.d.ts.map +1 -0
  38. package/dist/implementations/addon/HybridScreenshotManager.js +415 -0
  39. package/dist/implementations/addon/HybridScreenshotManager.js.map +1 -0
  40. package/dist/implementations/addon/InspectSandboxTool.d.ts +54 -0
  41. package/dist/implementations/addon/InspectSandboxTool.d.ts.map +1 -0
  42. package/dist/implementations/addon/InspectSandboxTool.js +226 -0
  43. package/dist/implementations/addon/InspectSandboxTool.js.map +1 -0
  44. package/dist/implementations/addon/InteractWithSandboxTool.d.ts +90 -0
  45. package/dist/implementations/addon/InteractWithSandboxTool.d.ts.map +1 -0
  46. package/dist/implementations/addon/InteractWithSandboxTool.js +367 -0
  47. package/dist/implementations/addon/InteractWithSandboxTool.js.map +1 -0
  48. package/dist/implementations/addon/KeyframeDetector.d.ts +140 -0
  49. package/dist/implementations/addon/KeyframeDetector.d.ts.map +1 -0
  50. package/dist/implementations/addon/KeyframeDetector.js +390 -0
  51. package/dist/implementations/addon/KeyframeDetector.js.map +1 -0
  52. package/dist/implementations/addon/ModifySandboxTool.d.ts +62 -0
  53. package/dist/implementations/addon/ModifySandboxTool.d.ts.map +1 -0
  54. package/dist/implementations/addon/ModifySandboxTool.js +266 -0
  55. package/dist/implementations/addon/ModifySandboxTool.js.map +1 -0
  56. package/dist/implementations/addon/ReactArtifactBuilder.d.ts +27 -0
  57. package/dist/implementations/addon/ReactArtifactBuilder.d.ts.map +1 -0
  58. package/dist/implementations/addon/ReactArtifactBuilder.js +198 -0
  59. package/dist/implementations/addon/ReactArtifactBuilder.js.map +1 -0
  60. package/dist/implementations/addon/SandboxEventBroadcaster.d.ts +143 -0
  61. package/dist/implementations/addon/SandboxEventBroadcaster.d.ts.map +1 -0
  62. package/dist/implementations/addon/SandboxEventBroadcaster.js +258 -0
  63. package/dist/implementations/addon/SandboxEventBroadcaster.js.map +1 -0
  64. package/dist/implementations/addon/SandboxIntrospectionTools.d.ts +77 -0
  65. package/dist/implementations/addon/SandboxIntrospectionTools.d.ts.map +1 -0
  66. package/dist/implementations/addon/SandboxIntrospectionTools.js +292 -0
  67. package/dist/implementations/addon/SandboxIntrospectionTools.js.map +1 -0
  68. package/dist/implementations/addon/SandboxViewServer.d.ts +127 -0
  69. package/dist/implementations/addon/SandboxViewServer.d.ts.map +1 -0
  70. package/dist/implementations/addon/SandboxViewServer.js +775 -0
  71. package/dist/implementations/addon/SandboxViewServer.js.map +1 -0
  72. package/dist/implementations/addon/ScreenStream.d.ts +149 -0
  73. package/dist/implementations/addon/ScreenStream.d.ts.map +1 -0
  74. package/dist/implementations/addon/ScreenStream.js +306 -0
  75. package/dist/implementations/addon/ScreenStream.js.map +1 -0
  76. package/dist/implementations/addon/StopSandboxTool.d.ts +61 -0
  77. package/dist/implementations/addon/StopSandboxTool.d.ts.map +1 -0
  78. package/dist/implementations/addon/StopSandboxTool.js +252 -0
  79. package/dist/implementations/addon/StopSandboxTool.js.map +1 -0
  80. package/dist/implementations/addon/TerminalSandbox.d.ts +111 -0
  81. package/dist/implementations/addon/TerminalSandbox.d.ts.map +1 -0
  82. package/dist/implementations/addon/TerminalSandbox.js +345 -0
  83. package/dist/implementations/addon/TerminalSandbox.js.map +1 -0
  84. package/dist/implementations/addon/VisualFeedbackBridge.d.ts +367 -0
  85. package/dist/implementations/addon/VisualFeedbackBridge.d.ts.map +1 -0
  86. package/dist/implementations/addon/VisualFeedbackBridge.js +888 -0
  87. package/dist/implementations/addon/VisualFeedbackBridge.js.map +1 -0
  88. package/dist/implementations/addon/WindowManager.d.ts +138 -0
  89. package/dist/implementations/addon/WindowManager.d.ts.map +1 -0
  90. package/dist/implementations/addon/WindowManager.js +276 -0
  91. package/dist/implementations/addon/WindowManager.js.map +1 -0
  92. package/dist/implementations/addon/index.d.ts +29 -0
  93. package/dist/implementations/addon/index.d.ts.map +1 -0
  94. package/dist/implementations/addon/index.js +29 -0
  95. package/dist/implementations/addon/index.js.map +1 -0
  96. package/dist/implementations/addon/injectables/reactIntrospection.d.ts +57 -0
  97. package/dist/implementations/addon/injectables/reactIntrospection.d.ts.map +1 -0
  98. package/dist/implementations/addon/injectables/reactIntrospection.js +480 -0
  99. package/dist/implementations/addon/injectables/reactIntrospection.js.map +1 -0
  100. package/dist/implementations/addon/terminal-client.html +253 -0
  101. package/dist/implementations/agent/PRAgentTool.d.ts +37 -0
  102. package/dist/implementations/agent/PRAgentTool.d.ts.map +1 -0
  103. package/dist/implementations/agent/PRAgentTool.js +257 -0
  104. package/dist/implementations/agent/PRAgentTool.js.map +1 -0
  105. package/dist/implementations/agent/TaskTool.d.ts +76 -0
  106. package/dist/implementations/agent/TaskTool.d.ts.map +1 -0
  107. package/dist/implementations/agent/TaskTool.js +424 -0
  108. package/dist/implementations/agent/TaskTool.js.map +1 -0
  109. package/dist/implementations/agent/index.d.ts +5 -0
  110. package/dist/implementations/agent/index.d.ts.map +1 -0
  111. package/dist/implementations/agent/index.js +3 -0
  112. package/dist/implementations/agent/index.js.map +1 -0
  113. package/dist/implementations/execution/BackgroundProcessRegistry.d.ts +68 -0
  114. package/dist/implementations/execution/BackgroundProcessRegistry.d.ts.map +1 -0
  115. package/dist/implementations/execution/BackgroundProcessRegistry.js +146 -0
  116. package/dist/implementations/execution/BackgroundProcessRegistry.js.map +1 -0
  117. package/dist/implementations/execution/BashOutputTool.d.ts +42 -0
  118. package/dist/implementations/execution/BashOutputTool.d.ts.map +1 -0
  119. package/dist/implementations/execution/BashOutputTool.js +168 -0
  120. package/dist/implementations/execution/BashOutputTool.js.map +1 -0
  121. package/dist/implementations/execution/CodeExecuteTool.d.ts +31 -0
  122. package/dist/implementations/execution/CodeExecuteTool.d.ts.map +1 -0
  123. package/dist/implementations/execution/CodeExecuteTool.js +127 -0
  124. package/dist/implementations/execution/CodeExecuteTool.js.map +1 -0
  125. package/dist/implementations/execution/KillShellTool.d.ts +37 -0
  126. package/dist/implementations/execution/KillShellTool.d.ts.map +1 -0
  127. package/dist/implementations/execution/KillShellTool.js +144 -0
  128. package/dist/implementations/execution/KillShellTool.js.map +1 -0
  129. package/dist/implementations/execution/SearchToolsTool.d.ts +32 -0
  130. package/dist/implementations/execution/SearchToolsTool.d.ts.map +1 -0
  131. package/dist/implementations/execution/SearchToolsTool.js +109 -0
  132. package/dist/implementations/execution/SearchToolsTool.js.map +1 -0
  133. package/dist/implementations/execution/ShellTool.d.ts +108 -0
  134. package/dist/implementations/execution/ShellTool.d.ts.map +1 -0
  135. package/dist/implementations/execution/ShellTool.js +546 -0
  136. package/dist/implementations/execution/ShellTool.js.map +1 -0
  137. package/dist/implementations/execution/WorkspaceManagerTool.d.ts +40 -0
  138. package/dist/implementations/execution/WorkspaceManagerTool.d.ts.map +1 -0
  139. package/dist/implementations/execution/WorkspaceManagerTool.js +370 -0
  140. package/dist/implementations/execution/WorkspaceManagerTool.js.map +1 -0
  141. package/dist/implementations/execution/index.d.ts +13 -0
  142. package/dist/implementations/execution/index.d.ts.map +1 -0
  143. package/dist/implementations/execution/index.js +13 -0
  144. package/dist/implementations/execution/index.js.map +1 -0
  145. package/dist/implementations/extensions/EndTurnTool.d.ts +62 -0
  146. package/dist/implementations/extensions/EndTurnTool.d.ts.map +1 -0
  147. package/dist/implementations/extensions/EndTurnTool.js +172 -0
  148. package/dist/implementations/extensions/EndTurnTool.js.map +1 -0
  149. package/dist/implementations/extensions/ResearchBacklogTool.d.ts +37 -0
  150. package/dist/implementations/extensions/ResearchBacklogTool.d.ts.map +1 -0
  151. package/dist/implementations/extensions/ResearchBacklogTool.js +102 -0
  152. package/dist/implementations/extensions/ResearchBacklogTool.js.map +1 -0
  153. package/dist/implementations/extensions/SkillTool.d.ts +108 -0
  154. package/dist/implementations/extensions/SkillTool.d.ts.map +1 -0
  155. package/dist/implementations/extensions/SkillTool.js +351 -0
  156. package/dist/implementations/extensions/SkillTool.js.map +1 -0
  157. package/dist/implementations/extensions/SlashCommandTool.d.ts +112 -0
  158. package/dist/implementations/extensions/SlashCommandTool.d.ts.map +1 -0
  159. package/dist/implementations/extensions/SlashCommandTool.js +315 -0
  160. package/dist/implementations/extensions/SlashCommandTool.js.map +1 -0
  161. package/dist/implementations/extensions/index.d.ts +14 -0
  162. package/dist/implementations/extensions/index.d.ts.map +1 -0
  163. package/dist/implementations/extensions/index.js +10 -0
  164. package/dist/implementations/extensions/index.js.map +1 -0
  165. package/dist/implementations/file/EditTool.d.ts +232 -0
  166. package/dist/implementations/file/EditTool.d.ts.map +1 -0
  167. package/dist/implementations/file/EditTool.js +707 -0
  168. package/dist/implementations/file/EditTool.js.map +1 -0
  169. package/dist/implementations/file/ReadFileTool.d.ts +49 -0
  170. package/dist/implementations/file/ReadFileTool.d.ts.map +1 -0
  171. package/dist/implementations/file/ReadFileTool.js +225 -0
  172. package/dist/implementations/file/ReadFileTool.js.map +1 -0
  173. package/dist/implementations/file/WriteBinaryTool.d.ts +21 -0
  174. package/dist/implementations/file/WriteBinaryTool.d.ts.map +1 -0
  175. package/dist/implementations/file/WriteBinaryTool.js +153 -0
  176. package/dist/implementations/file/WriteBinaryTool.js.map +1 -0
  177. package/dist/implementations/file/WriteFileTool.d.ts +41 -0
  178. package/dist/implementations/file/WriteFileTool.d.ts.map +1 -0
  179. package/dist/implementations/file/WriteFileTool.js +220 -0
  180. package/dist/implementations/file/WriteFileTool.js.map +1 -0
  181. package/dist/implementations/file/index.d.ts +8 -0
  182. package/dist/implementations/file/index.d.ts.map +1 -0
  183. package/dist/implementations/file/index.js +8 -0
  184. package/dist/implementations/file/index.js.map +1 -0
  185. package/dist/implementations/historical/GetConversationSegmentTool.d.ts +44 -0
  186. package/dist/implementations/historical/GetConversationSegmentTool.d.ts.map +1 -0
  187. package/dist/implementations/historical/GetConversationSegmentTool.js +220 -0
  188. package/dist/implementations/historical/GetConversationSegmentTool.js.map +1 -0
  189. package/dist/implementations/historical/ListCompactionBoundariesTool.d.ts +36 -0
  190. package/dist/implementations/historical/ListCompactionBoundariesTool.d.ts.map +1 -0
  191. package/dist/implementations/historical/ListCompactionBoundariesTool.js +174 -0
  192. package/dist/implementations/historical/ListCompactionBoundariesTool.js.map +1 -0
  193. package/dist/implementations/historical/ListSessionsTool.d.ts +38 -0
  194. package/dist/implementations/historical/ListSessionsTool.d.ts.map +1 -0
  195. package/dist/implementations/historical/ListSessionsTool.js +140 -0
  196. package/dist/implementations/historical/ListSessionsTool.js.map +1 -0
  197. package/dist/implementations/historical/LoadSessionTool.d.ts +39 -0
  198. package/dist/implementations/historical/LoadSessionTool.d.ts.map +1 -0
  199. package/dist/implementations/historical/LoadSessionTool.js +171 -0
  200. package/dist/implementations/historical/LoadSessionTool.js.map +1 -0
  201. package/dist/implementations/historical/RequestHistoricalContextTool.d.ts +46 -0
  202. package/dist/implementations/historical/RequestHistoricalContextTool.d.ts.map +1 -0
  203. package/dist/implementations/historical/RequestHistoricalContextTool.js +224 -0
  204. package/dist/implementations/historical/RequestHistoricalContextTool.js.map +1 -0
  205. package/dist/implementations/historical/SearchConversationHistoryTool.d.ts +51 -0
  206. package/dist/implementations/historical/SearchConversationHistoryTool.d.ts.map +1 -0
  207. package/dist/implementations/historical/SearchConversationHistoryTool.js +306 -0
  208. package/dist/implementations/historical/SearchConversationHistoryTool.js.map +1 -0
  209. package/dist/implementations/historical/index.d.ts +12 -0
  210. package/dist/implementations/historical/index.d.ts.map +1 -0
  211. package/dist/implementations/historical/index.js +12 -0
  212. package/dist/implementations/historical/index.js.map +1 -0
  213. package/dist/implementations/index.d.ts +16 -0
  214. package/dist/implementations/index.d.ts.map +1 -0
  215. package/dist/implementations/index.js +28 -0
  216. package/dist/implementations/index.js.map +1 -0
  217. package/dist/implementations/mcp/DiscoveredMcpTool.d.ts +58 -0
  218. package/dist/implementations/mcp/DiscoveredMcpTool.d.ts.map +1 -0
  219. package/dist/implementations/mcp/DiscoveredMcpTool.js +269 -0
  220. package/dist/implementations/mcp/DiscoveredMcpTool.js.map +1 -0
  221. package/dist/implementations/mcp/index.d.ts +9 -0
  222. package/dist/implementations/mcp/index.d.ts.map +1 -0
  223. package/dist/implementations/mcp/index.js +8 -0
  224. package/dist/implementations/mcp/index.js.map +1 -0
  225. package/dist/implementations/notebook/NotebookEditTool.d.ts +96 -0
  226. package/dist/implementations/notebook/NotebookEditTool.d.ts.map +1 -0
  227. package/dist/implementations/notebook/NotebookEditTool.js +390 -0
  228. package/dist/implementations/notebook/NotebookEditTool.js.map +1 -0
  229. package/dist/implementations/notebook/index.d.ts +7 -0
  230. package/dist/implementations/notebook/index.d.ts.map +1 -0
  231. package/dist/implementations/notebook/index.js +7 -0
  232. package/dist/implementations/notebook/index.js.map +1 -0
  233. package/dist/implementations/search/GlobTool.d.ts +73 -0
  234. package/dist/implementations/search/GlobTool.d.ts.map +1 -0
  235. package/dist/implementations/search/GlobTool.js +213 -0
  236. package/dist/implementations/search/GlobTool.js.map +1 -0
  237. package/dist/implementations/search/GrepTool.d.ts +102 -0
  238. package/dist/implementations/search/GrepTool.d.ts.map +1 -0
  239. package/dist/implementations/search/GrepTool.js +754 -0
  240. package/dist/implementations/search/GrepTool.js.map +1 -0
  241. package/dist/implementations/search/index.d.ts +6 -0
  242. package/dist/implementations/search/index.d.ts.map +1 -0
  243. package/dist/implementations/search/index.js +6 -0
  244. package/dist/implementations/search/index.js.map +1 -0
  245. package/dist/implementations/tmux/TmuxSessionTool.d.ts +82 -0
  246. package/dist/implementations/tmux/TmuxSessionTool.d.ts.map +1 -0
  247. package/dist/implementations/tmux/TmuxSessionTool.js +371 -0
  248. package/dist/implementations/tmux/TmuxSessionTool.js.map +1 -0
  249. package/dist/implementations/tmux/TmuxViewServer.d.ts +86 -0
  250. package/dist/implementations/tmux/TmuxViewServer.d.ts.map +1 -0
  251. package/dist/implementations/tmux/TmuxViewServer.js +480 -0
  252. package/dist/implementations/tmux/TmuxViewServer.js.map +1 -0
  253. package/dist/implementations/tmux/index.d.ts +6 -0
  254. package/dist/implementations/tmux/index.d.ts.map +1 -0
  255. package/dist/implementations/tmux/index.js +6 -0
  256. package/dist/implementations/tmux/index.js.map +1 -0
  257. package/dist/implementations/ui/AskUserQuestionTool.d.ts +77 -0
  258. package/dist/implementations/ui/AskUserQuestionTool.d.ts.map +1 -0
  259. package/dist/implementations/ui/AskUserQuestionTool.js +241 -0
  260. package/dist/implementations/ui/AskUserQuestionTool.js.map +1 -0
  261. package/dist/implementations/ui/ExitPlanModeTool.d.ts +44 -0
  262. package/dist/implementations/ui/ExitPlanModeTool.d.ts.map +1 -0
  263. package/dist/implementations/ui/ExitPlanModeTool.js +150 -0
  264. package/dist/implementations/ui/ExitPlanModeTool.js.map +1 -0
  265. package/dist/implementations/ui/TodoWriteTool.d.ts +59 -0
  266. package/dist/implementations/ui/TodoWriteTool.d.ts.map +1 -0
  267. package/dist/implementations/ui/TodoWriteTool.js +315 -0
  268. package/dist/implementations/ui/TodoWriteTool.js.map +1 -0
  269. package/dist/implementations/ui/index.d.ts +9 -0
  270. package/dist/implementations/ui/index.d.ts.map +1 -0
  271. package/dist/implementations/ui/index.js +9 -0
  272. package/dist/implementations/ui/index.js.map +1 -0
  273. package/dist/implementations/web/BrowseTool.d.ts +43 -0
  274. package/dist/implementations/web/BrowseTool.d.ts.map +1 -0
  275. package/dist/implementations/web/BrowseTool.js +181 -0
  276. package/dist/implementations/web/BrowseTool.js.map +1 -0
  277. package/dist/implementations/web/SandboxTransferTool.d.ts +30 -0
  278. package/dist/implementations/web/SandboxTransferTool.d.ts.map +1 -0
  279. package/dist/implementations/web/SandboxTransferTool.js +261 -0
  280. package/dist/implementations/web/SandboxTransferTool.js.map +1 -0
  281. package/dist/implementations/web/WebFetchTool.d.ts +93 -0
  282. package/dist/implementations/web/WebFetchTool.d.ts.map +1 -0
  283. package/dist/implementations/web/WebFetchTool.js +484 -0
  284. package/dist/implementations/web/WebFetchTool.js.map +1 -0
  285. package/dist/implementations/web/WebSearchTool.d.ts +53 -0
  286. package/dist/implementations/web/WebSearchTool.d.ts.map +1 -0
  287. package/dist/implementations/web/WebSearchTool.js +227 -0
  288. package/dist/implementations/web/WebSearchTool.js.map +1 -0
  289. package/dist/implementations/web/escalateDirective.d.ts +11 -0
  290. package/dist/implementations/web/escalateDirective.d.ts.map +1 -0
  291. package/dist/implementations/web/escalateDirective.js +20 -0
  292. package/dist/implementations/web/escalateDirective.js.map +1 -0
  293. package/dist/implementations/web/index.d.ts +10 -0
  294. package/dist/implementations/web/index.d.ts.map +1 -0
  295. package/dist/implementations/web/index.js +10 -0
  296. package/dist/implementations/web/index.js.map +1 -0
  297. package/dist/implementations/web/webBackends.d.ts +65 -0
  298. package/dist/implementations/web/webBackends.d.ts.map +1 -0
  299. package/dist/implementations/web/webBackends.js +430 -0
  300. package/dist/implementations/web/webBackends.js.map +1 -0
  301. package/dist/implementations/web/webFetchRequestInit.d.ts +9 -0
  302. package/dist/implementations/web/webFetchRequestInit.d.ts.map +1 -0
  303. package/dist/implementations/web/webFetchRequestInit.js +21 -0
  304. package/dist/implementations/web/webFetchRequestInit.js.map +1 -0
  305. package/dist/index.d.ts +14 -0
  306. package/dist/index.d.ts.map +1 -0
  307. package/dist/index.js +18 -0
  308. package/dist/index.js.map +1 -0
  309. package/dist/utils/ArtifactRegistry.d.ts +138 -0
  310. package/dist/utils/ArtifactRegistry.d.ts.map +1 -0
  311. package/dist/utils/ArtifactRegistry.js +259 -0
  312. package/dist/utils/ArtifactRegistry.js.map +1 -0
  313. package/dist/utils/ChromiumBrowserManager.d.ts +56 -0
  314. package/dist/utils/ChromiumBrowserManager.d.ts.map +1 -0
  315. package/dist/utils/ChromiumBrowserManager.js +243 -0
  316. package/dist/utils/ChromiumBrowserManager.js.map +1 -0
  317. package/dist/utils/FileUtils.d.ts +81 -0
  318. package/dist/utils/FileUtils.d.ts.map +1 -0
  319. package/dist/utils/FileUtils.js +148 -0
  320. package/dist/utils/FileUtils.js.map +1 -0
  321. package/dist/utils/GitPolicy.d.ts +70 -0
  322. package/dist/utils/GitPolicy.d.ts.map +1 -0
  323. package/dist/utils/GitPolicy.js +166 -0
  324. package/dist/utils/GitPolicy.js.map +1 -0
  325. package/dist/utils/GitUtils.d.ts +18 -0
  326. package/dist/utils/GitUtils.d.ts.map +1 -0
  327. package/dist/utils/GitUtils.js +62 -0
  328. package/dist/utils/GitUtils.js.map +1 -0
  329. package/dist/utils/SandboxRegistry.d.ts +110 -0
  330. package/dist/utils/SandboxRegistry.d.ts.map +1 -0
  331. package/dist/utils/SandboxRegistry.js +220 -0
  332. package/dist/utils/SandboxRegistry.js.map +1 -0
  333. package/dist/utils/SchemaValidator.d.ts +21 -0
  334. package/dist/utils/SchemaValidator.d.ts.map +1 -0
  335. package/dist/utils/SchemaValidator.js +67 -0
  336. package/dist/utils/SchemaValidator.js.map +1 -0
  337. package/dist/utils/SessionLock.d.ts +96 -0
  338. package/dist/utils/SessionLock.d.ts.map +1 -0
  339. package/dist/utils/SessionLock.js +276 -0
  340. package/dist/utils/SessionLock.js.map +1 -0
  341. package/dist/utils/SessionPersistence.d.ts +89 -0
  342. package/dist/utils/SessionPersistence.d.ts.map +1 -0
  343. package/dist/utils/SessionPersistence.js +244 -0
  344. package/dist/utils/SessionPersistence.js.map +1 -0
  345. package/dist/utils/TextUtils.d.ts +77 -0
  346. package/dist/utils/TextUtils.d.ts.map +1 -0
  347. package/dist/utils/TextUtils.js +112 -0
  348. package/dist/utils/TextUtils.js.map +1 -0
  349. package/dist/utils/TmuxCapture.d.ts +94 -0
  350. package/dist/utils/TmuxCapture.d.ts.map +1 -0
  351. package/dist/utils/TmuxCapture.js +131 -0
  352. package/dist/utils/TmuxCapture.js.map +1 -0
  353. package/dist/utils/TmuxManager.d.ts +65 -0
  354. package/dist/utils/TmuxManager.d.ts.map +1 -0
  355. package/dist/utils/TmuxManager.js +304 -0
  356. package/dist/utils/TmuxManager.js.map +1 -0
  357. package/dist/utils/autoResearchPlanGate.d.ts +10 -0
  358. package/dist/utils/autoResearchPlanGate.d.ts.map +1 -0
  359. package/dist/utils/autoResearchPlanGate.js +57 -0
  360. package/dist/utils/autoResearchPlanGate.js.map +1 -0
  361. package/dist/utils/index.d.ts +19 -0
  362. package/dist/utils/index.d.ts.map +1 -0
  363. package/dist/utils/index.js +13 -0
  364. package/dist/utils/index.js.map +1 -0
  365. package/package.json +83 -0
@@ -0,0 +1,67 @@
1
+ /**
2
+ * JSON Schema Validator
3
+ *
4
+ * Simple validator for tool parameters using JSON Schema
5
+ */
6
+ /**
7
+ * Validate parameters against JSON Schema
8
+ *
9
+ * @param schema JSON Schema definition
10
+ * @param params Parameters to validate (mutated in-place for type coercion)
11
+ * @returns Error message if invalid, null if valid
12
+ */
13
+ export function validateSchema(schema, params) {
14
+ // Check required fields
15
+ if (schema.required) {
16
+ for (const field of schema.required) {
17
+ if (!(field in params)) {
18
+ return `Missing required parameter: ${field}`;
19
+ }
20
+ }
21
+ }
22
+ // Check parameter types (with automatic coercion for numbers)
23
+ if (schema.properties) {
24
+ for (const [key, propSchema] of Object.entries(schema.properties)) {
25
+ if (key in params) {
26
+ let value = params[key];
27
+ const type = propSchema.type;
28
+ // Auto-coerce string numbers to actual numbers
29
+ // This handles cases where parameters come in as strings (e.g., from XML parsing)
30
+ // but the schema expects numeric types
31
+ if (type === 'number' && typeof value === 'string') {
32
+ const numValue = Number(value);
33
+ if (!isNaN(numValue)) {
34
+ params[key] = numValue;
35
+ value = numValue;
36
+ }
37
+ }
38
+ // Type checking
39
+ if (type === 'string' && typeof value !== 'string') {
40
+ return `Parameter '${key}' must be a string`;
41
+ }
42
+ if (type === 'number' && typeof value !== 'number') {
43
+ return `Parameter '${key}' must be a number`;
44
+ }
45
+ if (type === 'boolean' && typeof value !== 'boolean') {
46
+ return `Parameter '${key}' must be a boolean`;
47
+ }
48
+ if (type === 'object' && typeof value !== 'object') {
49
+ return `Parameter '${key}' must be an object`;
50
+ }
51
+ if (type === 'array' && !Array.isArray(value)) {
52
+ return `Parameter '${key}' must be an array`;
53
+ }
54
+ }
55
+ }
56
+ }
57
+ return null;
58
+ }
59
+ /**
60
+ * Schema Validator class (Gemini-CLI-compatible validation patterns)
61
+ */
62
+ export class SchemaValidator {
63
+ static validate(schema, params) {
64
+ return validateSchema(schema, params);
65
+ }
66
+ }
67
+ //# sourceMappingURL=SchemaValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaValidator.js","sourceRoot":"","sources":["../../src/utils/SchemaValidator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,MAAkB,EAAE,MAAW;IAC5D,wBAAwB;IACxB,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpC,IAAI,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,EAAE,CAAC;gBACvB,OAAO,+BAA+B,KAAK,EAAE,CAAC;YAChD,CAAC;QACH,CAAC;IACH,CAAC;IAED,8DAA8D;IAC9D,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACtB,KAAK,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;YAClE,IAAI,GAAG,IAAI,MAAM,EAAE,CAAC;gBAClB,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;gBACxB,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;gBAE7B,+CAA+C;gBAC/C,kFAAkF;gBAClF,uCAAuC;gBACvC,IAAI,IAAI,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;oBACnD,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;oBAC/B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;wBACrB,MAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;wBACvB,KAAK,GAAG,QAAQ,CAAC;oBACnB,CAAC;gBACH,CAAC;gBAED,gBAAgB;gBAChB,IAAI,IAAI,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;oBACnD,OAAO,cAAc,GAAG,oBAAoB,CAAC;gBAC/C,CAAC;gBACD,IAAI,IAAI,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;oBACnD,OAAO,cAAc,GAAG,oBAAoB,CAAC;gBAC/C,CAAC;gBACD,IAAI,IAAI,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;oBACrD,OAAO,cAAc,GAAG,qBAAqB,CAAC;gBAChD,CAAC;gBACD,IAAI,IAAI,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;oBACnD,OAAO,cAAc,GAAG,qBAAqB,CAAC;gBAChD,CAAC;gBACD,IAAI,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC9C,OAAO,cAAc,GAAG,oBAAoB,CAAC;gBAC/C,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,eAAe;IAC1B,MAAM,CAAC,QAAQ,CAAC,MAAkB,EAAE,MAAW;QAC7C,OAAO,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;CACF"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * SessionLock - Manage exclusive access to tmux sessions
3
+ *
4
+ * Prevents conflicts when multiple agents/users try to access
5
+ * the same tmux session simultaneously.
6
+ *
7
+ * Features:
8
+ * - File-based locking mechanism
9
+ * - Automatic lock expiration (prevents deadlocks)
10
+ * - Lock ownership tracking
11
+ * - Shared vs exclusive locks
12
+ */
13
+ export interface LockInfo {
14
+ sessionId: string;
15
+ owner: string;
16
+ acquired: Date;
17
+ expires: Date;
18
+ type: 'exclusive' | 'shared';
19
+ }
20
+ export interface LockOptions {
21
+ timeout?: number;
22
+ retryInterval?: number;
23
+ maxRetries?: number;
24
+ type?: 'exclusive' | 'shared';
25
+ }
26
+ /**
27
+ * SessionLock - Distributed locking for tmux sessions
28
+ *
29
+ * Uses file-based locks stored in .cortex/tmux-sessions/locks/
30
+ * Handles lock acquisition, release, and automatic expiration.
31
+ */
32
+ export declare class SessionLock {
33
+ private lockDir;
34
+ private defaultTimeout;
35
+ constructor(projectPath?: string);
36
+ /**
37
+ * Ensure lock directory exists
38
+ */
39
+ private ensureLockDir;
40
+ /**
41
+ * Get lock file path for a session
42
+ */
43
+ private getLockPath;
44
+ /**
45
+ * Acquire lock on a session
46
+ *
47
+ * @param sessionId Session to lock
48
+ * @param owner Identifier for lock owner (e.g., agent ID, user ID)
49
+ * @param options Lock options
50
+ * @returns true if lock acquired, false otherwise
51
+ */
52
+ acquireLock(sessionId: string, owner: string, options?: LockOptions): Promise<boolean>;
53
+ /**
54
+ * Release lock on a session
55
+ *
56
+ * @param sessionId Session to unlock
57
+ * @param owner Lock owner (must match to release)
58
+ * @returns true if lock released, false if not owned by this owner
59
+ */
60
+ releaseLock(sessionId: string, owner: string): Promise<boolean>;
61
+ /**
62
+ * Check if session is locked
63
+ *
64
+ * @param sessionId Session to check
65
+ * @returns Lock info if locked, null otherwise
66
+ */
67
+ isLocked(sessionId: string): LockInfo | null;
68
+ /**
69
+ * Read lock information from file
70
+ */
71
+ private readLock;
72
+ /**
73
+ * Extend lock expiration time
74
+ *
75
+ * @param sessionId Session to extend lock for
76
+ * @param owner Lock owner (must match)
77
+ * @param additionalTime Additional time in ms
78
+ * @returns true if extended, false otherwise
79
+ */
80
+ extendLock(sessionId: string, owner: string, additionalTime?: number): Promise<boolean>;
81
+ /**
82
+ * Force release all locks (admin operation)
83
+ * Use with caution!
84
+ */
85
+ forceReleaseAll(): Promise<number>;
86
+ /**
87
+ * Clean up expired locks
88
+ * Should be called periodically
89
+ */
90
+ cleanupExpiredLocks(): Promise<number>;
91
+ /**
92
+ * Get all active locks
93
+ */
94
+ getActiveLocks(): Promise<LockInfo[]>;
95
+ }
96
+ //# sourceMappingURL=SessionLock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionLock.d.ts","sourceRoot":"","sources":["../../src/utils/SessionLock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,IAAI,CAAC;IACf,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,WAAW,GAAG,QAAQ,CAAC;CAC9B;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC;CAC/B;AAED;;;;;GAKG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,cAAc,CAAiB;gBAE3B,WAAW,CAAC,EAAE,MAAM;IAMhC;;OAEG;IACH,OAAO,CAAC,aAAa;IAMrB;;OAEG;IACH,OAAO,CAAC,WAAW;IAInB;;;;;;;OAOG;IACU,WAAW,CACtB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,OAAO,CAAC;IAqDnB;;;;;;OAMG;IACU,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAyB5E;;;;;OAKG;IACI,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI;IAsBnD;;OAEG;IACH,OAAO,CAAC,QAAQ;IAoBhB;;;;;;;OAOG;IACU,UAAU,CACrB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,cAAc,GAAE,MAAc,GAC7B,OAAO,CAAC,OAAO,CAAC;IAmBnB;;;OAGG;IACU,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAuB/C;;;OAGG;IACU,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC;IA4BnD;;OAEG;IACU,cAAc,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;CAsBnD"}
@@ -0,0 +1,276 @@
1
+ /**
2
+ * SessionLock - Manage exclusive access to tmux sessions
3
+ *
4
+ * Prevents conflicts when multiple agents/users try to access
5
+ * the same tmux session simultaneously.
6
+ *
7
+ * Features:
8
+ * - File-based locking mechanism
9
+ * - Automatic lock expiration (prevents deadlocks)
10
+ * - Lock ownership tracking
11
+ * - Shared vs exclusive locks
12
+ */
13
+ import * as fs from 'fs';
14
+ import * as path from 'path';
15
+ /**
16
+ * SessionLock - Distributed locking for tmux sessions
17
+ *
18
+ * Uses file-based locks stored in .cortex/tmux-sessions/locks/
19
+ * Handles lock acquisition, release, and automatic expiration.
20
+ */
21
+ export class SessionLock {
22
+ lockDir;
23
+ defaultTimeout = 30000; // 30 seconds
24
+ constructor(projectPath) {
25
+ const basePath = projectPath || process.cwd();
26
+ this.lockDir = path.join(basePath, '.cortex', 'tmux-sessions', 'locks');
27
+ this.ensureLockDir();
28
+ }
29
+ /**
30
+ * Ensure lock directory exists
31
+ */
32
+ ensureLockDir() {
33
+ if (!fs.existsSync(this.lockDir)) {
34
+ fs.mkdirSync(this.lockDir, { recursive: true });
35
+ }
36
+ }
37
+ /**
38
+ * Get lock file path for a session
39
+ */
40
+ getLockPath(sessionId) {
41
+ return path.join(this.lockDir, `${sessionId}.lock`);
42
+ }
43
+ /**
44
+ * Acquire lock on a session
45
+ *
46
+ * @param sessionId Session to lock
47
+ * @param owner Identifier for lock owner (e.g., agent ID, user ID)
48
+ * @param options Lock options
49
+ * @returns true if lock acquired, false otherwise
50
+ */
51
+ async acquireLock(sessionId, owner, options = {}) {
52
+ const timeout = options.timeout || this.defaultTimeout;
53
+ const retryInterval = options.retryInterval || 100;
54
+ const maxRetries = options.maxRetries || Math.floor(timeout / retryInterval);
55
+ const lockType = options.type || 'exclusive';
56
+ const lockPath = this.getLockPath(sessionId);
57
+ const lockInfo = {
58
+ sessionId,
59
+ owner,
60
+ acquired: new Date(),
61
+ expires: new Date(Date.now() + timeout),
62
+ type: lockType
63
+ };
64
+ for (let i = 0; i < maxRetries; i++) {
65
+ try {
66
+ // Check if lock exists
67
+ if (fs.existsSync(lockPath)) {
68
+ const existingLock = this.readLock(sessionId);
69
+ if (existingLock) {
70
+ // Check if lock has expired
71
+ if (new Date() > existingLock.expires) {
72
+ // Lock expired, remove it
73
+ fs.unlinkSync(lockPath);
74
+ }
75
+ else if (existingLock.type === 'shared' && lockType === 'shared') {
76
+ // Both are shared locks, allow access
77
+ return true;
78
+ }
79
+ else {
80
+ // Lock is still valid, wait and retry
81
+ await new Promise(resolve => setTimeout(resolve, retryInterval));
82
+ continue;
83
+ }
84
+ }
85
+ }
86
+ // Try to acquire lock (atomic write)
87
+ fs.writeFileSync(lockPath, JSON.stringify(lockInfo, null, 2), { flag: 'wx' });
88
+ return true;
89
+ }
90
+ catch (error) {
91
+ if (error.code === 'EEXIST') {
92
+ // File was created by another process, retry
93
+ await new Promise(resolve => setTimeout(resolve, retryInterval));
94
+ continue;
95
+ }
96
+ throw error;
97
+ }
98
+ }
99
+ return false; // Failed to acquire lock
100
+ }
101
+ /**
102
+ * Release lock on a session
103
+ *
104
+ * @param sessionId Session to unlock
105
+ * @param owner Lock owner (must match to release)
106
+ * @returns true if lock released, false if not owned by this owner
107
+ */
108
+ async releaseLock(sessionId, owner) {
109
+ const lockPath = this.getLockPath(sessionId);
110
+ if (!fs.existsSync(lockPath)) {
111
+ return true; // No lock exists
112
+ }
113
+ const lock = this.readLock(sessionId);
114
+ if (!lock) {
115
+ return true; // Invalid lock file
116
+ }
117
+ // Only owner can release the lock
118
+ if (lock.owner !== owner) {
119
+ return false;
120
+ }
121
+ try {
122
+ fs.unlinkSync(lockPath);
123
+ return true;
124
+ }
125
+ catch (error) {
126
+ return false;
127
+ }
128
+ }
129
+ /**
130
+ * Check if session is locked
131
+ *
132
+ * @param sessionId Session to check
133
+ * @returns Lock info if locked, null otherwise
134
+ */
135
+ isLocked(sessionId) {
136
+ const lock = this.readLock(sessionId);
137
+ if (!lock) {
138
+ return null;
139
+ }
140
+ // Check if lock has expired
141
+ if (new Date() > lock.expires) {
142
+ // Clean up expired lock
143
+ const lockPath = this.getLockPath(sessionId);
144
+ try {
145
+ fs.unlinkSync(lockPath);
146
+ }
147
+ catch {
148
+ // Ignore cleanup errors
149
+ }
150
+ return null;
151
+ }
152
+ return lock;
153
+ }
154
+ /**
155
+ * Read lock information from file
156
+ */
157
+ readLock(sessionId) {
158
+ const lockPath = this.getLockPath(sessionId);
159
+ if (!fs.existsSync(lockPath)) {
160
+ return null;
161
+ }
162
+ try {
163
+ const data = fs.readFileSync(lockPath, 'utf-8');
164
+ const lock = JSON.parse(data);
165
+ return {
166
+ ...lock,
167
+ acquired: new Date(lock.acquired),
168
+ expires: new Date(lock.expires)
169
+ };
170
+ }
171
+ catch {
172
+ return null;
173
+ }
174
+ }
175
+ /**
176
+ * Extend lock expiration time
177
+ *
178
+ * @param sessionId Session to extend lock for
179
+ * @param owner Lock owner (must match)
180
+ * @param additionalTime Additional time in ms
181
+ * @returns true if extended, false otherwise
182
+ */
183
+ async extendLock(sessionId, owner, additionalTime = 30000) {
184
+ const lock = this.readLock(sessionId);
185
+ if (!lock || lock.owner !== owner) {
186
+ return false;
187
+ }
188
+ // Extend expiration
189
+ lock.expires = new Date(lock.expires.getTime() + additionalTime);
190
+ const lockPath = this.getLockPath(sessionId);
191
+ try {
192
+ fs.writeFileSync(lockPath, JSON.stringify(lock, null, 2));
193
+ return true;
194
+ }
195
+ catch {
196
+ return false;
197
+ }
198
+ }
199
+ /**
200
+ * Force release all locks (admin operation)
201
+ * Use with caution!
202
+ */
203
+ async forceReleaseAll() {
204
+ let released = 0;
205
+ try {
206
+ const files = fs.readdirSync(this.lockDir);
207
+ for (const file of files) {
208
+ if (file.endsWith('.lock')) {
209
+ try {
210
+ fs.unlinkSync(path.join(this.lockDir, file));
211
+ released++;
212
+ }
213
+ catch {
214
+ // Ignore errors
215
+ }
216
+ }
217
+ }
218
+ }
219
+ catch {
220
+ // Directory doesn't exist or not readable
221
+ }
222
+ return released;
223
+ }
224
+ /**
225
+ * Clean up expired locks
226
+ * Should be called periodically
227
+ */
228
+ async cleanupExpiredLocks() {
229
+ let cleaned = 0;
230
+ try {
231
+ const files = fs.readdirSync(this.lockDir);
232
+ for (const file of files) {
233
+ if (file.endsWith('.lock')) {
234
+ const sessionId = file.replace('.lock', '');
235
+ const lock = this.readLock(sessionId);
236
+ if (lock && new Date() > lock.expires) {
237
+ try {
238
+ fs.unlinkSync(path.join(this.lockDir, file));
239
+ cleaned++;
240
+ }
241
+ catch {
242
+ // Ignore errors
243
+ }
244
+ }
245
+ }
246
+ }
247
+ }
248
+ catch {
249
+ // Directory doesn't exist or not readable
250
+ }
251
+ return cleaned;
252
+ }
253
+ /**
254
+ * Get all active locks
255
+ */
256
+ async getActiveLocks() {
257
+ const locks = [];
258
+ try {
259
+ const files = fs.readdirSync(this.lockDir);
260
+ for (const file of files) {
261
+ if (file.endsWith('.lock')) {
262
+ const sessionId = file.replace('.lock', '');
263
+ const lock = this.readLock(sessionId);
264
+ if (lock && new Date() <= lock.expires) {
265
+ locks.push(lock);
266
+ }
267
+ }
268
+ }
269
+ }
270
+ catch {
271
+ // Directory doesn't exist or not readable
272
+ }
273
+ return locks;
274
+ }
275
+ }
276
+ //# sourceMappingURL=SessionLock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionLock.js","sourceRoot":"","sources":["../../src/utils/SessionLock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAW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;IACf,CAAC;CACF"}
@@ -0,0 +1,89 @@
1
+ import { TmuxSessionMetadata } from './TmuxManager.js';
2
+ export declare class SessionPersistence {
3
+ private metadataDir;
4
+ constructor(projectPath?: string);
5
+ /**
6
+ * Ensure the metadata directory exists
7
+ */
8
+ private ensureMetadataDir;
9
+ /**
10
+ * Get the file path for a session's metadata
11
+ */
12
+ private getMetadataPath;
13
+ /**
14
+ * Save session metadata to disk
15
+ * @param metadata Session metadata to save
16
+ */
17
+ saveSession(metadata: TmuxSessionMetadata): Promise<void>;
18
+ /**
19
+ * Load session metadata from disk
20
+ * @param sessionId Session identifier
21
+ * @returns Session metadata or null if not found
22
+ */
23
+ loadSession(sessionId: string): Promise<TmuxSessionMetadata | null>;
24
+ /**
25
+ * Update lastUsed timestamp for a session
26
+ * @param sessionId Session identifier
27
+ */
28
+ touchSession(sessionId: string): Promise<void>;
29
+ /**
30
+ * Delete session metadata from disk
31
+ * @param sessionId Session identifier
32
+ */
33
+ deleteSession(sessionId: string): Promise<void>;
34
+ /**
35
+ * List all stored session metadata
36
+ * @returns Array of session metadata
37
+ */
38
+ listSessions(): Promise<TmuxSessionMetadata[]>;
39
+ /**
40
+ * Clean up metadata for sessions that no longer exist in tmux
41
+ * @param activeSessions Array of active session IDs from tmux
42
+ */
43
+ cleanupOrphaned(activeSessions: string[]): Promise<number>;
44
+ /**
45
+ * Clean up sessions that haven't been used in a specified time period
46
+ * @param maxAgeMs Maximum age in milliseconds
47
+ */
48
+ cleanupStale(maxAgeMs: number): Promise<number>;
49
+ /**
50
+ * Get metadata directory path
51
+ */
52
+ getMetadataDirectory(): string;
53
+ /**
54
+ * Recover sessions on startup
55
+ * Checks which persisted sessions still exist in tmux
56
+ * and cleans up metadata for sessions that no longer exist
57
+ *
58
+ * @param activeSessions Array of currently active tmux session IDs
59
+ * @returns Object with recovered and cleaned session counts
60
+ */
61
+ recoverSessions(activeSessions: string[]): Promise<{
62
+ recovered: number;
63
+ cleaned: number;
64
+ total: number;
65
+ }>;
66
+ /**
67
+ * Auto-cleanup stale and orphaned sessions
68
+ * Should be called periodically (e.g., every hour)
69
+ *
70
+ * @param activeSessions Current active tmux sessions
71
+ * @param maxAgeHours Maximum age in hours before session is considered stale
72
+ * @returns Cleanup statistics
73
+ */
74
+ autoCleanup(activeSessions: string[], maxAgeHours?: number): Promise<{
75
+ orphaned: number;
76
+ stale: number;
77
+ total: number;
78
+ }>;
79
+ /**
80
+ * Get session statistics
81
+ */
82
+ getStats(): Promise<{
83
+ totalSessions: number;
84
+ oldestSession: Date | null;
85
+ newestSession: Date | null;
86
+ averageAge: number;
87
+ }>;
88
+ }
89
+ //# sourceMappingURL=SessionPersistence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionPersistence.d.ts","sourceRoot":"","sources":["../../src/utils/SessionPersistence.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,WAAW,CAAS;gBAEhB,WAAW,CAAC,EAAE,MAAM;IAMhC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAMzB;;OAEG;IACH,OAAO,CAAC,eAAe;IAIvB;;;OAGG;IACU,WAAW,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBtE;;;;OAIG;IACU,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAqBhF;;;OAGG;IACU,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ3D;;;OAGG;IACU,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW5D;;;OAGG;IACU,YAAY,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAyB3D;;;OAGG;IACU,eAAe,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,M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