wave-agent-sdk 0.19.5 → 0.19.7

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 (371) hide show
  1. package/dist/agent.d.ts +30 -14
  2. package/dist/agent.js +70 -56
  3. package/dist/constants/goalPrompts.d.ts +0 -1
  4. package/dist/constants/subagents.d.ts +0 -1
  5. package/dist/constants/toolLimits.d.ts +0 -1
  6. package/dist/constants/tools.d.ts +0 -1
  7. package/dist/core/plugin.d.ts +0 -1
  8. package/dist/core/session.d.ts +0 -1
  9. package/dist/index.d.ts +0 -1
  10. package/dist/managers/MemoryRuleManager.d.ts +0 -1
  11. package/dist/managers/aiManager.d.ts +15 -2
  12. package/dist/managers/aiManager.js +65 -11
  13. package/dist/managers/backgroundTaskManager.d.ts +1 -3
  14. package/dist/managers/backgroundTaskManager.js +20 -22
  15. package/dist/managers/bangManager.d.ts +0 -1
  16. package/dist/managers/bangManager.js +2 -1
  17. package/dist/managers/cronManager.d.ts +0 -1
  18. package/dist/managers/foregroundTaskManager.d.ts +0 -1
  19. package/dist/managers/forkedAgentManager.d.ts +0 -1
  20. package/dist/managers/goalManager.d.ts +0 -1
  21. package/dist/managers/hookManager.d.ts +0 -1
  22. package/dist/managers/liveConfigManager.d.ts +0 -1
  23. package/dist/managers/lspManager.d.ts +0 -1
  24. package/dist/managers/mcpManager.d.ts +0 -1
  25. package/dist/managers/messageManager.d.ts +7 -1
  26. package/dist/managers/messageManager.js +64 -5
  27. package/dist/managers/messageQueue.d.ts +25 -2
  28. package/dist/managers/messageQueue.js +53 -1
  29. package/dist/managers/permissionManager.d.ts +0 -1
  30. package/dist/managers/permissionManager.js +3 -3
  31. package/dist/managers/planManager.d.ts +0 -1
  32. package/dist/managers/pluginManager.d.ts +0 -1
  33. package/dist/managers/pluginScopeManager.d.ts +0 -1
  34. package/dist/managers/reversionManager.d.ts +0 -1
  35. package/dist/managers/skillManager.d.ts +0 -1
  36. package/dist/managers/slashCommandManager.d.ts +0 -1
  37. package/dist/managers/subagentManager.d.ts +0 -3
  38. package/dist/managers/subagentManager.js +15 -14
  39. package/dist/managers/toolManager.d.ts +0 -1
  40. package/dist/managers/workflowManager.d.ts +1 -2
  41. package/dist/managers/workflowManager.js +4 -4
  42. package/dist/prompts/autoMemory.d.ts +0 -1
  43. package/dist/prompts/autoMemoryExtraction.d.ts +0 -1
  44. package/dist/prompts/index.d.ts +3 -2
  45. package/dist/prompts/index.js +2 -4
  46. package/dist/prompts/planModeReminders.d.ts +0 -1
  47. package/dist/services/GitService.d.ts +0 -1
  48. package/dist/services/MarketplaceService.d.ts +0 -1
  49. package/dist/services/MemoryRuleService.d.ts +0 -1
  50. package/dist/services/aiService.d.ts +0 -1
  51. package/dist/services/authService.d.ts +0 -1
  52. package/dist/services/autoMemoryService.d.ts +0 -1
  53. package/dist/services/configurationService.d.ts +0 -1
  54. package/dist/services/fileWatcher.d.ts +0 -1
  55. package/dist/services/hook.d.ts +0 -1
  56. package/dist/services/hook.js +6 -0
  57. package/dist/services/initializationService.d.ts +0 -1
  58. package/dist/services/interactionService.d.ts +0 -1
  59. package/dist/services/interactionService.js +10 -0
  60. package/dist/services/jsonlHandler.d.ts +0 -1
  61. package/dist/services/memory.d.ts +0 -1
  62. package/dist/services/pluginLoader.d.ts +0 -1
  63. package/dist/services/remoteSettingsService.d.ts +0 -1
  64. package/dist/services/reversionService.d.ts +0 -1
  65. package/dist/services/session.d.ts +0 -1
  66. package/dist/services/taskManager.d.ts +0 -1
  67. package/dist/services/taskManager.js +8 -1
  68. package/dist/telemetry/events.d.ts +0 -1
  69. package/dist/telemetry/instrumentation.d.ts +0 -1
  70. package/dist/telemetry/sessionTracing.d.ts +0 -1
  71. package/dist/tools/agentTool.d.ts +0 -1
  72. package/dist/tools/askUserQuestion.d.ts +0 -1
  73. package/dist/tools/bashTool.d.ts +0 -1
  74. package/dist/tools/bashTool.js +7 -5
  75. package/dist/tools/buildTool.d.ts +0 -1
  76. package/dist/tools/cronCreateTool.d.ts +0 -1
  77. package/dist/tools/cronDeleteTool.d.ts +0 -1
  78. package/dist/tools/cronListTool.d.ts +0 -1
  79. package/dist/tools/editTool.d.ts +0 -1
  80. package/dist/tools/enterPlanMode.d.ts +0 -1
  81. package/dist/tools/enterWorktreeTool.d.ts +0 -1
  82. package/dist/tools/enterWorktreeTool.js +3 -8
  83. package/dist/tools/exitPlanMode.d.ts +0 -1
  84. package/dist/tools/exitWorktreeTool.d.ts +0 -1
  85. package/dist/tools/exitWorktreeTool.js +5 -8
  86. package/dist/tools/globTool.d.ts +0 -1
  87. package/dist/tools/grepTool.d.ts +0 -1
  88. package/dist/tools/lspTool.d.ts +0 -1
  89. package/dist/tools/readTool.d.ts +0 -1
  90. package/dist/tools/skillTool.d.ts +0 -1
  91. package/dist/tools/taskManagementTools.d.ts +0 -1
  92. package/dist/tools/taskStopTool.d.ts +0 -1
  93. package/dist/tools/types.d.ts +0 -1
  94. package/dist/tools/webFetchTool.d.ts +0 -1
  95. package/dist/tools/workflowTool.d.ts +0 -1
  96. package/dist/tools/writeTool.d.ts +0 -1
  97. package/dist/types/agent.d.ts +0 -1
  98. package/dist/types/auth.d.ts +0 -1
  99. package/dist/types/commands.d.ts +0 -1
  100. package/dist/types/config.d.ts +0 -1
  101. package/dist/types/configuration.d.ts +0 -1
  102. package/dist/types/core.d.ts +0 -1
  103. package/dist/types/cron.d.ts +0 -1
  104. package/dist/types/environment.d.ts +0 -1
  105. package/dist/types/fileSearch.d.ts +0 -1
  106. package/dist/types/history.d.ts +0 -1
  107. package/dist/types/hooks.d.ts +2 -1
  108. package/dist/types/index.d.ts +0 -1
  109. package/dist/types/lsp.d.ts +0 -1
  110. package/dist/types/marketplace.d.ts +0 -1
  111. package/dist/types/mcp.d.ts +0 -1
  112. package/dist/types/memoryRule.d.ts +0 -1
  113. package/dist/types/messaging.d.ts +2 -1
  114. package/dist/types/permissions.d.ts +0 -1
  115. package/dist/types/plugins.d.ts +0 -1
  116. package/dist/types/processes.d.ts +0 -1
  117. package/dist/types/reversion.d.ts +0 -1
  118. package/dist/types/session.d.ts +0 -1
  119. package/dist/types/skills.d.ts +0 -1
  120. package/dist/types/tasks.d.ts +0 -1
  121. package/dist/types/telemetry.d.ts +0 -1
  122. package/dist/types/tools.d.ts +0 -1
  123. package/dist/types/workflow.d.ts +0 -1
  124. package/dist/utils/abortUtils.d.ts +0 -1
  125. package/dist/utils/atomicWrite.d.ts +0 -1
  126. package/dist/utils/bashParser.d.ts +0 -1
  127. package/dist/utils/cacheControlUtils.d.ts +0 -1
  128. package/dist/utils/commandArgumentParser.d.ts +0 -1
  129. package/dist/utils/commandPathResolver.d.ts +0 -1
  130. package/dist/utils/configPaths.d.ts +0 -1
  131. package/dist/utils/configValidator.d.ts +0 -1
  132. package/dist/utils/constants.d.ts +0 -1
  133. package/dist/utils/container.d.ts +0 -1
  134. package/dist/utils/containerSetup.d.ts +0 -1
  135. package/dist/utils/containerSetup.js +3 -3
  136. package/dist/utils/convertMessagesForAPI.d.ts +0 -1
  137. package/dist/utils/cronTasks.d.ts +0 -1
  138. package/dist/utils/cronTasksLock.d.ts +0 -1
  139. package/dist/utils/cronToHuman.d.ts +0 -1
  140. package/dist/utils/customCommands.d.ts +0 -1
  141. package/dist/utils/editUtils.d.ts +0 -1
  142. package/dist/utils/fileFormat.d.ts +0 -1
  143. package/dist/utils/fileSearch.d.ts +0 -1
  144. package/dist/utils/fileUtils.d.ts +0 -1
  145. package/dist/utils/gitUtils.d.ts +0 -1
  146. package/dist/utils/globalLogger.d.ts +0 -1
  147. package/dist/utils/groupMessagesByApiRound.d.ts +0 -1
  148. package/dist/utils/hookMatcher.d.ts +0 -1
  149. package/dist/utils/markdownParser.d.ts +0 -1
  150. package/dist/utils/mcpUtils.d.ts +0 -1
  151. package/dist/utils/messageOperations.d.ts +0 -1
  152. package/dist/utils/modelCapabilities.d.ts +0 -1
  153. package/dist/utils/nameGenerator.d.ts +0 -1
  154. package/dist/utils/notificationXml.d.ts +0 -1
  155. package/dist/utils/openaiClient.d.ts +0 -1
  156. package/dist/utils/parseCronExpression.d.ts +0 -1
  157. package/dist/utils/path.d.ts +0 -1
  158. package/dist/utils/pathEncoder.d.ts +0 -1
  159. package/dist/utils/pathSafety.d.ts +0 -1
  160. package/dist/utils/promptHistory.d.ts +0 -1
  161. package/dist/utils/ripgrep.d.ts +0 -1
  162. package/dist/utils/shellResolver.d.ts +0 -1
  163. package/dist/utils/shellResolver.js +156 -7
  164. package/dist/utils/skillParser.d.ts +0 -1
  165. package/dist/utils/stringUtils.d.ts +0 -1
  166. package/dist/utils/subagentParser.d.ts +0 -1
  167. package/dist/utils/taskReminder.d.ts +0 -1
  168. package/dist/utils/tokenCalculation.d.ts +0 -1
  169. package/dist/utils/tokenEstimate.d.ts +0 -1
  170. package/dist/utils/toolResultStorage.d.ts +0 -1
  171. package/dist/utils/worktreeSession.d.ts +6 -7
  172. package/dist/utils/worktreeSession.js +7 -11
  173. package/dist/utils/worktreeUtils.d.ts +0 -1
  174. package/dist/workflow/budgetTracker.d.ts +0 -1
  175. package/dist/workflow/concurrencyLimiter.d.ts +0 -1
  176. package/dist/workflow/journal.d.ts +0 -1
  177. package/dist/workflow/progressReporter.d.ts +0 -1
  178. package/dist/workflow/runState.d.ts +0 -1
  179. package/dist/workflow/scriptRuntime.d.ts +0 -1
  180. package/dist/workflow/structuredOutput.d.ts +0 -1
  181. package/dist/workflow/types.d.ts +0 -1
  182. package/dist/workflow/workflowApis.d.ts +0 -1
  183. package/package.json +1 -1
  184. package/src/agent.ts +80 -67
  185. package/src/managers/aiManager.ts +79 -12
  186. package/src/managers/backgroundTaskManager.ts +21 -23
  187. package/src/managers/bangManager.ts +2 -1
  188. package/src/managers/messageManager.ts +72 -6
  189. package/src/managers/messageQueue.ts +60 -2
  190. package/src/managers/permissionManager.ts +6 -3
  191. package/src/managers/subagentManager.ts +22 -16
  192. package/src/managers/workflowManager.ts +5 -5
  193. package/src/prompts/index.ts +4 -4
  194. package/src/services/hook.ts +9 -0
  195. package/src/services/interactionService.ts +11 -0
  196. package/src/services/taskManager.ts +8 -1
  197. package/src/tools/bashTool.ts +11 -5
  198. package/src/tools/enterWorktreeTool.ts +4 -14
  199. package/src/tools/exitWorktreeTool.ts +5 -13
  200. package/src/types/hooks.ts +2 -0
  201. package/src/types/messaging.ts +2 -0
  202. package/src/utils/containerSetup.ts +3 -3
  203. package/src/utils/shellResolver.ts +167 -8
  204. package/src/utils/worktreeSession.ts +6 -16
  205. package/dist/agent.d.ts.map +0 -1
  206. package/dist/constants/goalPrompts.d.ts.map +0 -1
  207. package/dist/constants/subagents.d.ts.map +0 -1
  208. package/dist/constants/toolLimits.d.ts.map +0 -1
  209. package/dist/constants/tools.d.ts.map +0 -1
  210. package/dist/core/plugin.d.ts.map +0 -1
  211. package/dist/core/session.d.ts.map +0 -1
  212. package/dist/index.d.ts.map +0 -1
  213. package/dist/managers/MemoryRuleManager.d.ts.map +0 -1
  214. package/dist/managers/aiManager.d.ts.map +0 -1
  215. package/dist/managers/backgroundTaskManager.d.ts.map +0 -1
  216. package/dist/managers/bangManager.d.ts.map +0 -1
  217. package/dist/managers/cronManager.d.ts.map +0 -1
  218. package/dist/managers/foregroundTaskManager.d.ts.map +0 -1
  219. package/dist/managers/forkedAgentManager.d.ts.map +0 -1
  220. package/dist/managers/goalManager.d.ts.map +0 -1
  221. package/dist/managers/hookManager.d.ts.map +0 -1
  222. package/dist/managers/liveConfigManager.d.ts.map +0 -1
  223. package/dist/managers/lspManager.d.ts.map +0 -1
  224. package/dist/managers/mcpManager.d.ts.map +0 -1
  225. package/dist/managers/messageManager.d.ts.map +0 -1
  226. package/dist/managers/messageQueue.d.ts.map +0 -1
  227. package/dist/managers/notificationQueue.d.ts +0 -8
  228. package/dist/managers/notificationQueue.d.ts.map +0 -1
  229. package/dist/managers/notificationQueue.js +0 -17
  230. package/dist/managers/permissionManager.d.ts.map +0 -1
  231. package/dist/managers/planManager.d.ts.map +0 -1
  232. package/dist/managers/pluginManager.d.ts.map +0 -1
  233. package/dist/managers/pluginScopeManager.d.ts.map +0 -1
  234. package/dist/managers/reversionManager.d.ts.map +0 -1
  235. package/dist/managers/skillManager.d.ts.map +0 -1
  236. package/dist/managers/slashCommandManager.d.ts.map +0 -1
  237. package/dist/managers/subagentManager.d.ts.map +0 -1
  238. package/dist/managers/toolManager.d.ts.map +0 -1
  239. package/dist/managers/workflowManager.d.ts.map +0 -1
  240. package/dist/prompts/autoMemory.d.ts.map +0 -1
  241. package/dist/prompts/autoMemoryExtraction.d.ts.map +0 -1
  242. package/dist/prompts/index.d.ts.map +0 -1
  243. package/dist/prompts/planModeReminders.d.ts.map +0 -1
  244. package/dist/services/GitService.d.ts.map +0 -1
  245. package/dist/services/MarketplaceService.d.ts.map +0 -1
  246. package/dist/services/MemoryRuleService.d.ts.map +0 -1
  247. package/dist/services/aiService.d.ts.map +0 -1
  248. package/dist/services/authService.d.ts.map +0 -1
  249. package/dist/services/autoMemoryService.d.ts.map +0 -1
  250. package/dist/services/configurationService.d.ts.map +0 -1
  251. package/dist/services/fileWatcher.d.ts.map +0 -1
  252. package/dist/services/hook.d.ts.map +0 -1
  253. package/dist/services/initializationService.d.ts.map +0 -1
  254. package/dist/services/interactionService.d.ts.map +0 -1
  255. package/dist/services/jsonlHandler.d.ts.map +0 -1
  256. package/dist/services/memory.d.ts.map +0 -1
  257. package/dist/services/pluginLoader.d.ts.map +0 -1
  258. package/dist/services/remoteSettingsService.d.ts.map +0 -1
  259. package/dist/services/reversionService.d.ts.map +0 -1
  260. package/dist/services/session.d.ts.map +0 -1
  261. package/dist/services/taskManager.d.ts.map +0 -1
  262. package/dist/telemetry/events.d.ts.map +0 -1
  263. package/dist/telemetry/instrumentation.d.ts.map +0 -1
  264. package/dist/telemetry/sessionTracing.d.ts.map +0 -1
  265. package/dist/tools/agentTool.d.ts.map +0 -1
  266. package/dist/tools/askUserQuestion.d.ts.map +0 -1
  267. package/dist/tools/bashTool.d.ts.map +0 -1
  268. package/dist/tools/buildTool.d.ts.map +0 -1
  269. package/dist/tools/cronCreateTool.d.ts.map +0 -1
  270. package/dist/tools/cronDeleteTool.d.ts.map +0 -1
  271. package/dist/tools/cronListTool.d.ts.map +0 -1
  272. package/dist/tools/editTool.d.ts.map +0 -1
  273. package/dist/tools/enterPlanMode.d.ts.map +0 -1
  274. package/dist/tools/enterWorktreeTool.d.ts.map +0 -1
  275. package/dist/tools/exitPlanMode.d.ts.map +0 -1
  276. package/dist/tools/exitWorktreeTool.d.ts.map +0 -1
  277. package/dist/tools/globTool.d.ts.map +0 -1
  278. package/dist/tools/grepTool.d.ts.map +0 -1
  279. package/dist/tools/lspTool.d.ts.map +0 -1
  280. package/dist/tools/readTool.d.ts.map +0 -1
  281. package/dist/tools/skillTool.d.ts.map +0 -1
  282. package/dist/tools/taskManagementTools.d.ts.map +0 -1
  283. package/dist/tools/taskStopTool.d.ts.map +0 -1
  284. package/dist/tools/types.d.ts.map +0 -1
  285. package/dist/tools/webFetchTool.d.ts.map +0 -1
  286. package/dist/tools/workflowTool.d.ts.map +0 -1
  287. package/dist/tools/writeTool.d.ts.map +0 -1
  288. package/dist/types/agent.d.ts.map +0 -1
  289. package/dist/types/auth.d.ts.map +0 -1
  290. package/dist/types/commands.d.ts.map +0 -1
  291. package/dist/types/config.d.ts.map +0 -1
  292. package/dist/types/configuration.d.ts.map +0 -1
  293. package/dist/types/core.d.ts.map +0 -1
  294. package/dist/types/cron.d.ts.map +0 -1
  295. package/dist/types/environment.d.ts.map +0 -1
  296. package/dist/types/fileSearch.d.ts.map +0 -1
  297. package/dist/types/history.d.ts.map +0 -1
  298. package/dist/types/hooks.d.ts.map +0 -1
  299. package/dist/types/index.d.ts.map +0 -1
  300. package/dist/types/lsp.d.ts.map +0 -1
  301. package/dist/types/marketplace.d.ts.map +0 -1
  302. package/dist/types/mcp.d.ts.map +0 -1
  303. package/dist/types/memoryRule.d.ts.map +0 -1
  304. package/dist/types/messaging.d.ts.map +0 -1
  305. package/dist/types/permissions.d.ts.map +0 -1
  306. package/dist/types/plugins.d.ts.map +0 -1
  307. package/dist/types/processes.d.ts.map +0 -1
  308. package/dist/types/reversion.d.ts.map +0 -1
  309. package/dist/types/session.d.ts.map +0 -1
  310. package/dist/types/skills.d.ts.map +0 -1
  311. package/dist/types/tasks.d.ts.map +0 -1
  312. package/dist/types/telemetry.d.ts.map +0 -1
  313. package/dist/types/tools.d.ts.map +0 -1
  314. package/dist/types/workflow.d.ts.map +0 -1
  315. package/dist/utils/abortUtils.d.ts.map +0 -1
  316. package/dist/utils/atomicWrite.d.ts.map +0 -1
  317. package/dist/utils/bashParser.d.ts.map +0 -1
  318. package/dist/utils/cacheControlUtils.d.ts.map +0 -1
  319. package/dist/utils/commandArgumentParser.d.ts.map +0 -1
  320. package/dist/utils/commandPathResolver.d.ts.map +0 -1
  321. package/dist/utils/configPaths.d.ts.map +0 -1
  322. package/dist/utils/configValidator.d.ts.map +0 -1
  323. package/dist/utils/constants.d.ts.map +0 -1
  324. package/dist/utils/container.d.ts.map +0 -1
  325. package/dist/utils/containerSetup.d.ts.map +0 -1
  326. package/dist/utils/convertMessagesForAPI.d.ts.map +0 -1
  327. package/dist/utils/cronTasks.d.ts.map +0 -1
  328. package/dist/utils/cronTasksLock.d.ts.map +0 -1
  329. package/dist/utils/cronToHuman.d.ts.map +0 -1
  330. package/dist/utils/customCommands.d.ts.map +0 -1
  331. package/dist/utils/editUtils.d.ts.map +0 -1
  332. package/dist/utils/fileFormat.d.ts.map +0 -1
  333. package/dist/utils/fileSearch.d.ts.map +0 -1
  334. package/dist/utils/fileUtils.d.ts.map +0 -1
  335. package/dist/utils/gitUtils.d.ts.map +0 -1
  336. package/dist/utils/globalLogger.d.ts.map +0 -1
  337. package/dist/utils/groupMessagesByApiRound.d.ts.map +0 -1
  338. package/dist/utils/hookMatcher.d.ts.map +0 -1
  339. package/dist/utils/markdownParser.d.ts.map +0 -1
  340. package/dist/utils/mcpUtils.d.ts.map +0 -1
  341. package/dist/utils/messageOperations.d.ts.map +0 -1
  342. package/dist/utils/modelCapabilities.d.ts.map +0 -1
  343. package/dist/utils/nameGenerator.d.ts.map +0 -1
  344. package/dist/utils/notificationXml.d.ts.map +0 -1
  345. package/dist/utils/openaiClient.d.ts.map +0 -1
  346. package/dist/utils/parseCronExpression.d.ts.map +0 -1
  347. package/dist/utils/path.d.ts.map +0 -1
  348. package/dist/utils/pathEncoder.d.ts.map +0 -1
  349. package/dist/utils/pathSafety.d.ts.map +0 -1
  350. package/dist/utils/promptHistory.d.ts.map +0 -1
  351. package/dist/utils/ripgrep.d.ts.map +0 -1
  352. package/dist/utils/shellResolver.d.ts.map +0 -1
  353. package/dist/utils/skillParser.d.ts.map +0 -1
  354. package/dist/utils/stringUtils.d.ts.map +0 -1
  355. package/dist/utils/subagentParser.d.ts.map +0 -1
  356. package/dist/utils/taskReminder.d.ts.map +0 -1
  357. package/dist/utils/tokenCalculation.d.ts.map +0 -1
  358. package/dist/utils/tokenEstimate.d.ts.map +0 -1
  359. package/dist/utils/toolResultStorage.d.ts.map +0 -1
  360. package/dist/utils/worktreeSession.d.ts.map +0 -1
  361. package/dist/utils/worktreeUtils.d.ts.map +0 -1
  362. package/dist/workflow/budgetTracker.d.ts.map +0 -1
  363. package/dist/workflow/concurrencyLimiter.d.ts.map +0 -1
  364. package/dist/workflow/journal.d.ts.map +0 -1
  365. package/dist/workflow/progressReporter.d.ts.map +0 -1
  366. package/dist/workflow/runState.d.ts.map +0 -1
  367. package/dist/workflow/scriptRuntime.d.ts.map +0 -1
  368. package/dist/workflow/structuredOutput.d.ts.map +0 -1
  369. package/dist/workflow/types.d.ts.map +0 -1
  370. package/dist/workflow/workflowApis.d.ts.map +0 -1
  371. package/src/managers/notificationQueue.ts +0 -19
@@ -1,4 +1,5 @@
1
1
  import { ToolPlugin } from "../tools/types.js";
2
+ import type { WorktreeSession } from "../utils/worktreeSession.js";
2
3
  export declare const BASE_SYSTEM_PROMPT = "You are a coding agent developed by NetEase that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.";
3
4
  export declare const MODEL_IDENTITY_PROMPT = "# Model identity\n\nIf asked about your model, model version, underlying architecture, or product name, identify yourself simply as a coding agent developed by NetEase. Do not reveal the specific model ID, model family, model provider, or product name. Do not mention or hint at any of these details.";
4
5
  export declare const DOING_TASKS_PROMPT = "# Doing tasks\n- The user will primarily request you to perform software engineering tasks. These may include solving bugs, adding new functionality, refactoring code, explaining code, and more. When given an unclear or generic instruction, consider it in the context of these software engineering tasks and the current working directory. For example, if the user asks you to change \"methodName\" to snake case, do not reply with just \"method_name\", instead find the method in the code and modify the code.\n- You are highly capable and often allow users to complete ambitious tasks that would otherwise be too complex or take too long. You should defer to user judgement about whether a task is too large to attempt.\n- If you notice the user's request is based on a misconception, or spot a bug adjacent to what they asked about, say so. You're a collaborator, not just an executor\u2014users benefit from your judgment, not just your compliance.\n- In general, do not propose changes to code you haven't read. If a user asks about or wants you to modify a file, read it first. Understand existing code before suggesting modifications.\n- Do not create files unless they're absolutely necessary for achieving your goal. Generally prefer editing an existing file to creating a new one, as this prevents file bloat and builds on existing work more effectively.\n- If an approach fails, diagnose why before switching tactics\u2014read the error, check your assumptions, try a focused fix. Don't retry the identical action blindly, but don't abandon a viable approach after a single failure either. Escalate to the user with AskUserQuestion only when you're genuinely stuck after investigation, not as a first response to friction.\n- Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it. Prioritize writing safe, secure, and correct code.\n- Avoid over-engineering. Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused.\n - Don't add features, refactor code, or make \"improvements\" beyond what was asked. A bug fix doesn't need surrounding code cleaned up. A simple feature doesn't need extra configurability. Don't add docstrings, comments, or type annotations to code you didn't change. Only add comments where the logic isn't self-evident.\n - Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs). Don't use feature flags or backwards-compatibility shims when you can just change the code.\n - Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is what the task actually requires\u2014no speculative abstractions, but no half-finished implementations either. Three similar lines of code is better than a premature abstraction.\n- Avoid backwards-compatibility hacks like renaming unused _vars, re-exporting types, adding // removed comments for removed code, etc. If you are certain that something is unused, you can delete it completely.\n- Report outcomes faithfully: if tests fail, say so with the relevant output; if you did not run a verification step, say that rather than implying it succeeded. Never claim \"all tests pass\" when output shows failures, never suppress or simplify failing checks (tests, lints, type errors) to manufacture a green result, and never characterize incomplete or broken work as done. Equally, when a check did pass or a task is complete, state it plainly \u2014 do not hedge confirmed results with unnecessary disclaimers, downgrade finished work to \"partial,\" or re-verify things you already checked. The goal is an accurate report, not a defensive one.\n- Before reporting a task complete, verify it actually works: run the test, execute the script, check the output. Minimum complexity means no gold-plating, not skipping the finish line. If you can't verify (no test exists, can't run the code), say so explicitly rather than claiming success.";
@@ -28,10 +29,10 @@ export declare function buildSystemPrompt(basePrompt: string | undefined, tools:
28
29
  originalWorkdir?: string;
29
30
  language?: string;
30
31
  isSubagent?: boolean;
32
+ worktreeSession?: WorktreeSession | null;
31
33
  autoMemory?: {
32
34
  directory: string;
33
35
  content: string;
34
36
  };
35
37
  }): SystemPromptBlock[];
36
- export declare function enhanceSystemPromptWithEnvDetails(existingSystemPrompt: string, workdir: string, originalWorkdir?: string): string;
37
- //# sourceMappingURL=index.d.ts.map
38
+ export declare function enhanceSystemPromptWithEnvDetails(existingSystemPrompt: string, workdir: string, originalWorkdir?: string, worktreeSession?: WorktreeSession | null): string;
@@ -1,6 +1,5 @@
1
1
  import * as os from "node:os";
2
2
  import { isGitRepository } from "../utils/gitUtils.js";
3
- import { getCurrentWorktreeSession } from "../utils/worktreeSession.js";
4
3
  import { buildAutoMemoryPrompt } from "./autoMemory.js";
5
4
  import { EXPLORE_SUBAGENT_TYPE, PLAN_SUBAGENT_TYPE, } from "../constants/subagents.js";
6
5
  import { ASK_USER_QUESTION_TOOL_NAME, EDIT_TOOL_NAME, WRITE_TOOL_NAME, EXIT_PLAN_MODE_TOOL_NAME, AGENT_TOOL_NAME, BASH_TOOL_NAME, READ_TOOL_NAME, GLOB_TOOL_NAME, GREP_TOOL_NAME, } from "../constants/tools.js";
@@ -230,7 +229,7 @@ export function buildSystemPrompt(basePrompt, tools, options = {}) {
230
229
  : shell.includes("bash")
231
230
  ? "bash"
232
231
  : shell;
233
- const worktreeSession = getCurrentWorktreeSession();
232
+ const worktreeSession = options.worktreeSession;
234
233
  dynamicText += `
235
234
 
236
235
  Here is useful information about the environment you are running in:
@@ -255,7 +254,7 @@ Today's date: ${today}
255
254
  }
256
255
  return blocks;
257
256
  }
258
- export function enhanceSystemPromptWithEnvDetails(existingSystemPrompt, workdir, originalWorkdir) {
257
+ export function enhanceSystemPromptWithEnvDetails(existingSystemPrompt, workdir, originalWorkdir, worktreeSession) {
259
258
  const isGitRepo = isGitRepository(workdir);
260
259
  const platform = os.platform();
261
260
  const osVersion = `${os.type()} ${os.release()}`;
@@ -266,7 +265,6 @@ export function enhanceSystemPromptWithEnvDetails(existingSystemPrompt, workdir,
266
265
  : shell.includes("bash")
267
266
  ? "bash"
268
267
  : shell;
269
- const worktreeSession = getCurrentWorktreeSession();
270
268
  const notes = `Notes:
271
269
  - Agent threads always have their cwd reset between bash calls, as a result please only use absolute file paths.${worktreeSession ? `\n- You are in a git worktree at ${worktreeSession.worktreePath} (branch: ${worktreeSession.worktreeBranch}). Absolute paths from prior context may refer to the original repo at ${worktreeSession.originalCwd}; translate them to your worktree. Do NOT edit files outside this worktree.` : ""}
272
270
  - In your final response, share file paths (always absolute, never relative) that are relevant to the task. Include code snippets only when the exact text is load-bearing (e.g., a bug you found, a function signature the caller asked for) — do not recap code you merely read.
@@ -2,4 +2,3 @@ export declare function wrapInSystemReminder(content: string): string;
2
2
  export declare function buildPlanModeReminder(planFilePath: string, planExists: boolean, isSubagent?: boolean): string;
3
3
  export declare function buildPlanModeReEntryReminder(planFilePath: string): string;
4
4
  export declare function buildExitedPlanModeReminder(planFilePath?: string, planExists?: boolean): string;
5
- //# sourceMappingURL=planModeReminders.d.ts.map
@@ -14,4 +14,3 @@ export declare class GitService {
14
14
  pull(targetPath: string): Promise<void>;
15
15
  private handleGitError;
16
16
  }
17
- //# sourceMappingURL=GitService.d.ts.map
@@ -139,4 +139,3 @@ export declare class MarketplaceService {
139
139
  */
140
140
  updatePlugin(pluginAtMarketplace: string): Promise<InstalledPlugin>;
141
141
  }
142
- //# sourceMappingURL=MarketplaceService.d.ts.map
@@ -9,4 +9,3 @@ export declare class MemoryRuleService {
9
9
  */
10
10
  isRuleActive(rule: MemoryRule, filesInContext: string[], workdir?: string): boolean;
11
11
  }
12
- //# sourceMappingURL=MemoryRuleService.d.ts.map
@@ -112,4 +112,3 @@ export interface EvaluateGoalResult {
112
112
  };
113
113
  }
114
114
  export declare function evaluateGoal(options: EvaluateGoalOptions): Promise<EvaluateGoalResult>;
115
- //# sourceMappingURL=aiService.d.ts.map
@@ -87,4 +87,3 @@ export declare function createAuthAwareFetch(innerFetch: typeof fetch): typeof f
87
87
  export declare function getOrCreateAnonymousId(): string;
88
88
  /** @internal — reset anonymous ID cache for testing only */
89
89
  export declare function __resetAnonymousIdForTesting(): void;
90
- //# sourceMappingURL=authService.d.ts.map
@@ -21,4 +21,3 @@ export declare class AutoMemoryService {
21
21
  */
22
22
  private runExtraction;
23
23
  }
24
- //# sourceMappingURL=autoMemoryService.d.ts.map
@@ -172,4 +172,3 @@ export declare function loadWaveConfigFromFile(filePath: string): WaveConfigurat
172
172
  * Checks .local.json files first, then falls back to .json files
173
173
  */
174
174
  export declare function loadMergedWaveConfig(workdir: string): WaveConfiguration | null;
175
- //# sourceMappingURL=configurationService.d.ts.map
@@ -63,4 +63,3 @@ export declare class FileWatcherService extends EventEmitter {
63
63
  private setupGlobalWatcherEvents;
64
64
  private handleFileEvent;
65
65
  }
66
- //# sourceMappingURL=fileWatcher.d.ts.map
@@ -22,4 +22,3 @@ export declare function executeCwdChangedHooks(oldCwd: string, newCwd: string, c
22
22
  * Validate command safety (basic checks)
23
23
  */
24
24
  export declare function isCommandSafe(command: string): boolean;
25
- //# sourceMappingURL=hook.d.ts.map
@@ -89,6 +89,12 @@ async function buildHookJsonInput(context) {
89
89
  jsonInput.background_tasks = context.backgroundTasks ?? [];
90
90
  jsonInput.session_crons = context.sessionCrons ?? [];
91
91
  }
92
+ // Add last_assistant_message for Stop and SubagentStop events.
93
+ // Omitted when undefined (no text content in last assistant message).
94
+ if ((context.event === "Stop" || context.event === "SubagentStop") &&
95
+ context.lastAssistantMessage !== undefined) {
96
+ jsonInput.last_assistant_message = context.lastAssistantMessage;
97
+ }
92
98
  return jsonInput;
93
99
  }
94
100
  /**
@@ -39,4 +39,3 @@ export declare class InitializationService {
39
39
  messages?: Message[];
40
40
  }): Promise<void>;
41
41
  }
42
- //# sourceMappingURL=initializationService.d.ts.map
@@ -26,4 +26,3 @@ export declare class InteractionService {
26
26
  }>): Promise<void>;
27
27
  static restoreSession(context: InteractionContext, sessionId: string): Promise<void>;
28
28
  }
29
- //# sourceMappingURL=interactionService.d.ts.map
@@ -30,6 +30,12 @@ export class InteractionService {
30
30
  mimeType: img.mimeType,
31
31
  })),
32
32
  });
33
+ // Reserve loading state synchronously before any async work (hooks).
34
+ // This closes the race window where a concurrent notification/message
35
+ // could see isLoading=false during the await below and start a second
36
+ // sendAIMessage. sendAIMessage's generation guard is the backstop, but
37
+ // reserving here prevents the race at its source.
38
+ aiManager.setIsLoading(true);
33
39
  // Execute UserPromptSubmit hooks after adding the user message
34
40
  if (hookManager) {
35
41
  try {
@@ -49,6 +55,8 @@ export class InteractionService {
49
55
  // If hook processing indicates we should block (exit code 2), stop here
50
56
  if (processResult.shouldBlock) {
51
57
  logger?.info("UserPromptSubmit hook blocked prompt processing with error:", processResult.errorMessage);
58
+ // Release the loading state we reserved above
59
+ aiManager.setIsLoading(false);
52
60
  return; // Don't send to AI
53
61
  }
54
62
  }
@@ -62,6 +70,8 @@ export class InteractionService {
62
70
  }
63
71
  catch (error) {
64
72
  console.error("Failed to add user message:", error);
73
+ // Ensure loading state is released on error
74
+ aiManager.setIsLoading(false);
65
75
  // Loading state will be automatically updated by the useEffect that watches messages
66
76
  }
67
77
  }
@@ -68,4 +68,3 @@ export declare class JsonlHandler {
68
68
  */
69
69
  generateSessionFilename(sessionId: string, sessionType: "main" | "subagent"): string;
70
70
  }
71
- //# sourceMappingURL=jsonlHandler.d.ts.map
@@ -27,4 +27,3 @@ export declare class MemoryService {
27
27
  readMemoryFile(workdir: string): Promise<string>;
28
28
  getCombinedMemoryContent(workdir: string): Promise<string>;
29
29
  }
30
- //# sourceMappingURL=memory.d.ts.map
@@ -37,4 +37,3 @@ export declare class PluginLoader {
37
37
  */
38
38
  private static validateManifest;
39
39
  }
40
- //# sourceMappingURL=pluginLoader.d.ts.map
@@ -24,4 +24,3 @@ export declare const remoteSettingsService: {
24
24
  readonly mergeRemoteSettings: typeof mergeRemoteSettings;
25
25
  readonly onSettingsUpdate: typeof onSettingsUpdate;
26
26
  };
27
- //# sourceMappingURL=remoteSettingsService.d.ts.map
@@ -25,4 +25,3 @@ export declare class ReversionService {
25
25
  cleanupOldSessions(days?: number): Promise<void>;
26
26
  private ensureDirectory;
27
27
  }
28
- //# sourceMappingURL=reversionService.d.ts.map
@@ -193,4 +193,3 @@ export declare function loadFullMessageThread(currentSessionId: string, workdir:
193
193
  messages: Message[];
194
194
  sessionIds: string[];
195
195
  }>;
196
- //# sourceMappingURL=session.d.ts.map
@@ -31,4 +31,3 @@ export declare class TaskManager extends EventEmitter {
31
31
  */
32
32
  refreshTasks(): Promise<void>;
33
33
  }
34
- //# sourceMappingURL=taskManager.d.ts.map
@@ -3,6 +3,13 @@ import { join } from "path";
3
3
  import { homedir } from "os";
4
4
  import { EventEmitter } from "events";
5
5
  import { logger } from "../utils/globalLogger.js";
6
+ function byIdAsc(a, b) {
7
+ const aNum = parseInt(a.id, 10);
8
+ const bNum = parseInt(b.id, 10);
9
+ if (!isNaN(aNum) && !isNaN(bNum))
10
+ return aNum - bNum;
11
+ return a.id.localeCompare(b.id);
12
+ }
6
13
  export class TaskManager extends EventEmitter {
7
14
  constructor(container, taskListId) {
8
15
  super();
@@ -198,7 +205,7 @@ export class TaskManager extends EventEmitter {
198
205
  return null;
199
206
  }
200
207
  }));
201
- return tasks.filter((t) => t !== null);
208
+ return tasks.filter((t) => t !== null).sort(byIdAsc);
202
209
  }
203
210
  catch (error) {
204
211
  if (error.code === "ENOENT") {
@@ -9,4 +9,3 @@ import type { OTelEventName } from "../types/telemetry.js";
9
9
  * Logs a structured event via the OTEL logs API. Respects PII gates.
10
10
  */
11
11
  export declare function logOTelEvent(eventName: OTelEventName, metadata: Record<string, string | undefined>): Promise<void>;
12
- //# sourceMappingURL=events.d.ts.map
@@ -70,4 +70,3 @@ export { JsonlSpanExporter, JsonlLogExporter };
70
70
  * 2. Not authenticated → persistent anonymous ID from ~/.wave/config.json
71
71
  */
72
72
  export declare function getTelemetryAttributes(): Record<string, string>;
73
- //# sourceMappingURL=instrumentation.d.ts.map
@@ -52,4 +52,3 @@ export declare function startToolSpan(toolName: string, input?: unknown): Span |
52
52
  * Reads the span from toolContext, then clears it.
53
53
  */
54
54
  export declare function endToolSpan(metadata: ToolMetadata): void;
55
- //# sourceMappingURL=sessionTracing.d.ts.map
@@ -3,4 +3,3 @@ import type { ToolPlugin } from "./types.js";
3
3
  * Agent tool plugin for launching specialized agents to handle complex tasks
4
4
  */
5
5
  export declare const agentTool: ToolPlugin;
6
- //# sourceMappingURL=agentTool.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import { ToolPlugin } from "./types.js";
2
2
  export declare const askUserQuestionTool: ToolPlugin;
3
- //# sourceMappingURL=askUserQuestion.d.ts.map
@@ -3,4 +3,3 @@ import type { ToolPlugin } from "./types.js";
3
3
  * Bash command execution tool - supports both foreground and background execution
4
4
  */
5
5
  export declare const bashTool: ToolPlugin;
6
- //# sourceMappingURL=bashTool.d.ts.map
@@ -152,13 +152,15 @@ The working directory persists between commands. Try to maintain your current wo
152
152
  error: "Command parameter is required and must be a string",
153
153
  };
154
154
  }
155
- // Resolve shell path: on Windows, use Git Bash; on other platforms, use default
155
+ // Resolve shell path: on Windows, use Git Bash; on macOS/Linux, use bash or zsh
156
156
  const shellPath = resolveShellPath();
157
- if (process.platform === "win32" && !shellPath) {
157
+ if (!shellPath) {
158
158
  return {
159
159
  success: false,
160
160
  content: "",
161
- error: "Git Bash not found. Please install Git for Windows or set GIT_BASH_PATH environment variable.",
161
+ error: process.platform === "win32"
162
+ ? "Git Bash not found. Please install Git for Windows or set WAVE_GIT_BASH_PATH environment variable."
163
+ : "No suitable shell found. Please ensure bash or zsh is installed, or set WAVE_SHELL environment variable.",
162
164
  };
163
165
  }
164
166
  // Validate timeout
@@ -207,7 +209,7 @@ The working directory persists between commands. Try to maintain your current wo
207
209
  error: "Background task manager not available",
208
210
  };
209
211
  }
210
- const { id: taskId } = backgroundTaskManager.startShell(command);
212
+ const { id: taskId } = backgroundTaskManager.startShell(command, undefined, context.workdir);
211
213
  const task = backgroundTaskManager.getTask(taskId);
212
214
  const outputPath = task?.outputPath;
213
215
  const backgroundMsg = [
@@ -230,7 +232,7 @@ The working directory persists between commands. Try to maintain your current wo
230
232
  const tempCwdFileForBash = toPosixPath(tempCwdFile);
231
233
  const wrappedCommand = wrapCommandForCwdTracking(command, tempCwdFileForBash);
232
234
  const child = spawn(wrappedCommand, {
233
- shell: shellPath || true,
235
+ shell: shellPath,
234
236
  stdio: "pipe",
235
237
  detached: true,
236
238
  cwd: context.workdir,
@@ -17,4 +17,3 @@ export interface ToolDef {
17
17
  additionalProperties?: boolean;
18
18
  }
19
19
  export declare function buildTool(def: ToolDef): ToolPlugin;
20
- //# sourceMappingURL=buildTool.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import { ToolPlugin } from "./types.js";
2
2
  export declare const cronCreateTool: ToolPlugin;
3
- //# sourceMappingURL=cronCreateTool.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import { ToolPlugin } from "./types.js";
2
2
  export declare const cronDeleteTool: ToolPlugin;
3
- //# sourceMappingURL=cronDeleteTool.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import { ToolPlugin } from "./types.js";
2
2
  export declare const cronListTool: ToolPlugin;
3
- //# sourceMappingURL=cronListTool.d.ts.map
@@ -3,4 +3,3 @@ import type { ToolPlugin } from "./types.js";
3
3
  * Single file edit tool plugin
4
4
  */
5
5
  export declare const editTool: ToolPlugin;
6
- //# sourceMappingURL=editTool.d.ts.map
@@ -3,4 +3,3 @@ import type { ToolPlugin } from "./types.js";
3
3
  * Enter Plan Mode Tool Plugin
4
4
  */
5
5
  export declare const enterPlanModeTool: ToolPlugin;
6
- //# sourceMappingURL=enterPlanMode.d.ts.map
@@ -5,4 +5,3 @@
5
5
  import type { ToolPlugin } from "./types.js";
6
6
  export declare const ENTER_WORKTREE_TOOL_PROMPT = "Use this tool ONLY when the user explicitly asks to work in a worktree. This tool creates an isolated git worktree and switches the current session into it.\n\n## When to Use\n\n- The user explicitly says \"worktree\" (e.g., \"start a worktree\", \"work in a worktree\", \"create a worktree\", \"use a worktree\")\n\n## When NOT to Use\n\n- The user asks to create a branch, switch branches, or work on a different branch \u2014 use git commands instead\n- The user asks to fix a bug or work on a feature \u2014 use normal git workflow unless they specifically mention worktrees\n- Never use this tool unless the user explicitly mentions \"worktree\"\n\n## Requirements\n\n- Must be in a git repository\n- Must not already be in a worktree\n\n## Behavior\n\n- Creates a new git worktree inside `.wave/worktrees/` with a new branch based on HEAD\n- Switches the session's working directory to the new worktree\n- Use ExitWorktree to leave the worktree mid-session (keep or remove). On session exit, if still in the worktree, the user will be prompted to keep or remove it\n\n## Parameters\n\n- `name` (optional): A name for the worktree. Each \"/\"-separated segment may contain only letters, digits, dots, underscores, and dashes; max 64 chars total. A random name is generated if not provided.\n";
7
7
  export declare const enterWorktreeTool: ToolPlugin;
8
- //# sourceMappingURL=enterWorktreeTool.d.ts.map
@@ -2,7 +2,6 @@
2
2
  * EnterWorktree tool - creates an isolated git worktree and switches the session into it.
3
3
  * Mirrors Claude Code's EnterWorktree tool behavior and prompt.
4
4
  */
5
- import { getCurrentWorktreeSession, setCurrentWorktreeSession, } from "../utils/worktreeSession.js";
6
5
  import { createWorktree, validateWorktreeName, generateWorktreeName, } from "../utils/worktreeUtils.js";
7
6
  import { getGitMainRepoRoot } from "../utils/gitUtils.js";
8
7
  import { ENTER_WORKTREE_TOOL_NAME } from "../constants/tools.js";
@@ -55,7 +54,7 @@ export const enterWorktreeTool = {
55
54
  prompt: () => ENTER_WORKTREE_TOOL_PROMPT,
56
55
  async execute(args, context) {
57
56
  // Validate not already in a worktree created by this session
58
- if (getCurrentWorktreeSession()) {
57
+ if (context.aiManager?.getWorktreeSession()) {
59
58
  return {
60
59
  success: false,
61
60
  content: "Already in a worktree session. Use ExitWorktree to leave before creating a new one.",
@@ -95,16 +94,12 @@ export const enterWorktreeTool = {
95
94
  repoRoot: worktreeInfo.repoRoot,
96
95
  originalHeadCommit: worktreeInfo.originalHeadCommit,
97
96
  };
98
- // Set module-level session state
99
- setCurrentWorktreeSession(session);
100
- // Update CWD via AIManager
97
+ // Set per-session worktree state and update CWD via AIManager
101
98
  const aiManager = context.aiManager;
102
99
  if (aiManager) {
100
+ aiManager.setWorktreeSession(session);
103
101
  aiManager.setWorkdir(worktreeInfo.path);
104
102
  }
105
- // Also update the container's Workdir entry
106
- // (Container is not directly accessible from ToolContext, but AIManager.setWorkdir
107
- // handles both its internal field and process.chdir)
108
103
  // Trigger WorktreeCreate hook if worktree is new
109
104
  let hookTriggered = false;
110
105
  if (session.isNew && context.hookManager) {
@@ -3,4 +3,3 @@ import type { ToolPlugin } from "./types.js";
3
3
  * Exit Plan Mode Tool Plugin
4
4
  */
5
5
  export declare const exitPlanModeTool: ToolPlugin;
6
- //# sourceMappingURL=exitPlanMode.d.ts.map
@@ -5,4 +5,3 @@
5
5
  import type { ToolPlugin } from "./types.js";
6
6
  export declare const EXIT_WORKTREE_TOOL_PROMPT = "Exit a worktree session created by EnterWorktree and return the session to the original working directory.\n\n## Scope\n\nThis tool ONLY operates on worktrees created by EnterWorktree in this session. It will NOT touch:\n- Worktrees you created manually with `git worktree add`\n- Worktrees from a previous session (even if created by EnterWorktree then)\n- The directory you're in if EnterWorktree was never called\n\nIf called outside an EnterWorktree session, the tool is a **no-op**: it reports that no worktree session is active and takes no action. Filesystem state is unchanged.\n\n## When to Use\n\n- The user explicitly asks to \"exit the worktree\", \"leave the worktree\", \"go back\", or otherwise end the worktree session\n- Do NOT call this proactively \u2014 only when the user asks\n\n## Parameters\n\n- `action` (required): `\"keep\"` or `\"remove\"`\n - `\"keep\"` \u2014 leave the worktree directory and branch intact on disk. Use this if the user wants to come back to the work later, or if there are changes to preserve.\n - `\"remove\"` \u2014 delete the worktree directory and its branch. Use this for a clean exit when the work is done or abandoned.\n- `discard_changes` (optional, default false): only meaningful with `action: \"remove\"`. If the worktree has uncommitted files or commits not on the original branch, the tool will REFUSE to remove it unless this is set to `true`. If the tool returns an error listing changes, confirm with the user before re-invoking with `discard_changes: true`.\n\n## Behavior\n\n- Restores the session's working directory to where it was before EnterWorktree\n- If action is \"remove\": deletes the worktree directory and branch\n- Once exited, EnterWorktree can be called again to create a fresh worktree\n";
7
7
  export declare const exitWorktreeTool: ToolPlugin;
8
- //# sourceMappingURL=exitWorktreeTool.d.ts.map
@@ -2,7 +2,6 @@
2
2
  * ExitWorktree tool - exits a worktree session and returns to the original directory.
3
3
  * Mirrors Claude Code's ExitWorktree tool behavior and prompt.
4
4
  */
5
- import { getCurrentWorktreeSession, setCurrentWorktreeSession, } from "../utils/worktreeSession.js";
6
5
  import { removeWorktree, countWorktreeChanges, } from "../utils/worktreeUtils.js";
7
6
  import { EXIT_WORKTREE_TOOL_NAME } from "../constants/tools.js";
8
7
  import { logger } from "../utils/globalLogger.js";
@@ -70,8 +69,8 @@ export const exitWorktreeTool = {
70
69
  error: 'Missing required parameter: "action"',
71
70
  };
72
71
  }
73
- // Validate: must be in an active worktree session
74
- const session = getCurrentWorktreeSession();
72
+ // Validate: must be in an active worktree session (for this session)
73
+ const session = context.aiManager?.getWorktreeSession();
75
74
  if (!session) {
76
75
  return {
77
76
  success: false,
@@ -109,10 +108,9 @@ export const exitWorktreeTool = {
109
108
  const { originalCwd, worktreePath, worktreeBranch } = session;
110
109
  if (action === "keep") {
111
110
  // Clear session state
112
- setCurrentWorktreeSession(null);
113
- // Restore CWD
114
111
  const aiManager = context.aiManager;
115
112
  if (aiManager) {
113
+ aiManager.setWorktreeSession(null);
116
114
  aiManager.setWorkdir(originalCwd);
117
115
  }
118
116
  return {
@@ -131,11 +129,10 @@ export const exitWorktreeTool = {
131
129
  // Count changes BEFORE removing the worktree (directory will be gone after)
132
130
  const summary = countWorktreeChanges(worktreePath, session.originalHeadCommit) ?? { changedFiles: 0, commits: 0 };
133
131
  removeWorktree(worktreeInfo);
134
- // Clear session state
135
- setCurrentWorktreeSession(null);
136
- // Restore CWD
132
+ // Clear session state and restore CWD
137
133
  const aiManager = context.aiManager;
138
134
  if (aiManager) {
135
+ aiManager.setWorktreeSession(null);
139
136
  aiManager.setWorkdir(originalCwd);
140
137
  }
141
138
  // Trigger WorktreeRemove hook (non-blocking)
@@ -3,4 +3,3 @@ import type { ToolPlugin } from "./types.js";
3
3
  * Glob Tool Plugin - Fast file pattern matching
4
4
  */
5
5
  export declare const globTool: ToolPlugin;
6
- //# sourceMappingURL=globTool.d.ts.map
@@ -3,4 +3,3 @@ import type { ToolPlugin } from "./types.js";
3
3
  * Grep tool plugin - powerful search tool based on ripgrep
4
4
  */
5
5
  export declare const grepTool: ToolPlugin;
6
- //# sourceMappingURL=grepTool.d.ts.map
@@ -5,4 +5,3 @@ export declare const MAX_FILES = 100;
5
5
  * LSP tool plugin - interact with LSP servers for code intelligence
6
6
  */
7
7
  export declare const lspTool: ToolPlugin;
8
- //# sourceMappingURL=lspTool.d.ts.map
@@ -3,4 +3,3 @@ import type { ToolPlugin } from "./types.js";
3
3
  * Read Tool Plugin - Read file content
4
4
  */
5
5
  export declare const readTool: ToolPlugin;
6
- //# sourceMappingURL=readTool.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import type { ToolPlugin } from "./types.js";
2
2
  export declare const skillTool: ToolPlugin;
3
- //# sourceMappingURL=skillTool.d.ts.map
@@ -3,4 +3,3 @@ export declare const taskCreateTool: ToolPlugin;
3
3
  export declare const taskGetTool: ToolPlugin;
4
4
  export declare const taskUpdateTool: ToolPlugin;
5
5
  export declare const taskListTool: ToolPlugin;
6
- //# sourceMappingURL=taskManagementTools.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import { ToolPlugin } from "./types.js";
2
2
  export declare const taskStopTool: ToolPlugin;
3
- //# sourceMappingURL=taskStopTool.d.ts.map
@@ -105,4 +105,3 @@ export interface ToolContext {
105
105
  /** Workflow manager instance for workflow orchestration */
106
106
  workflowManager?: import("../managers/workflowManager.js").WorkflowManager;
107
107
  }
108
- //# sourceMappingURL=types.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import type { ToolPlugin } from "./types.js";
2
2
  export declare const webFetchTool: ToolPlugin;
3
- //# sourceMappingURL=webFetchTool.d.ts.map
@@ -8,4 +8,3 @@ import type { ToolPlugin } from "./types.js";
8
8
  * and a <task-notification> arrives when the workflow completes.
9
9
  */
10
10
  export declare const workflowTool: ToolPlugin;
11
- //# sourceMappingURL=workflowTool.d.ts.map
@@ -3,4 +3,3 @@ import type { ToolPlugin } from "./types.js";
3
3
  * File Write Tool Plugin
4
4
  */
5
5
  export declare const writeTool: ToolPlugin;
6
- //# sourceMappingURL=writeTool.d.ts.map
@@ -101,4 +101,3 @@ export interface AgentCallbacks extends MessageManagerCallbacks, BackgroundTaskM
101
101
  onGoalStateChange?: (active: boolean, condition?: string, elapsed?: string) => void;
102
102
  onGoalEvaluating?: (evaluating: boolean) => void;
103
103
  }
104
- //# sourceMappingURL=agent.d.ts.map
@@ -18,4 +18,3 @@ export interface TokenResponse {
18
18
  email?: string;
19
19
  };
20
20
  }
21
- //# sourceMappingURL=auth.d.ts.map
@@ -25,4 +25,3 @@ export interface CustomSlashCommand {
25
25
  content: string;
26
26
  config?: CustomSlashCommandConfig;
27
27
  }
28
- //# sourceMappingURL=commands.d.ts.map
@@ -28,4 +28,3 @@ export interface ModelConfig {
28
28
  /** Fast model generation params (resolved from models[fastModel].options) */
29
29
  fastModelOptions?: Record<string, unknown>;
30
30
  }
31
- //# sourceMappingURL=config.d.ts.map
@@ -145,4 +145,3 @@ export interface RemoteSettingsFetchResult {
145
145
  notConfigured?: boolean;
146
146
  }
147
147
  export {};
148
- //# sourceMappingURL=configuration.d.ts.map
@@ -81,4 +81,3 @@ export declare const CONFIG_ERRORS: {
81
81
  readonly INVALID_WAVE_MAX_INPUT_TOKENS: "Token limit must be a positive integer.";
82
82
  readonly EMPTY_BASE_URL: "Base URL cannot be empty string.";
83
83
  };
84
- //# sourceMappingURL=core.d.ts.map
@@ -11,4 +11,3 @@ export interface CronJob {
11
11
  /** Timestamp of the last time a durable recurring job fired. */
12
12
  lastFiredAt?: number;
13
13
  }
14
- //# sourceMappingURL=cron.d.ts.map
@@ -81,4 +81,3 @@ export interface EnvironmentConflict {
81
81
  /** Which source provided the final value */
82
82
  source: Scope;
83
83
  }
84
- //# sourceMappingURL=environment.d.ts.map
@@ -2,4 +2,3 @@ export interface FileItem {
2
2
  path: string;
3
3
  type: "file" | "directory";
4
4
  }
5
- //# sourceMappingURL=fileSearch.d.ts.map
@@ -5,4 +5,3 @@ export interface PromptEntry {
5
5
  workdir?: string;
6
6
  longTextMap?: Record<string, string>;
7
7
  }
8
- //# sourceMappingURL=history.d.ts.map
@@ -81,6 +81,7 @@ export interface HookJsonInput {
81
81
  compact_summary?: string;
82
82
  background_tasks?: BackgroundTaskInfo[];
83
83
  session_crons?: SessionCronInfo[];
84
+ last_assistant_message?: string;
84
85
  }
85
86
  export interface BackgroundTaskInfo {
86
87
  id: string;
@@ -116,9 +117,9 @@ export interface ExtendedHookExecutionContext extends HookExecutionContext {
116
117
  compactSummary?: string;
117
118
  backgroundTasks?: BackgroundTaskInfo[];
118
119
  sessionCrons?: SessionCronInfo[];
120
+ lastAssistantMessage?: string;
119
121
  }
120
122
  export interface HookEnvironment {
121
123
  WAVE_PROJECT_DIR: string;
122
124
  [key: string]: string;
123
125
  }
124
- //# sourceMappingURL=hooks.d.ts.map
@@ -35,4 +35,3 @@ export * from "./cron.js";
35
35
  export * from "./telemetry.js";
36
36
  export * from "./auth.js";
37
37
  export * from "./workflow.js";
38
- //# sourceMappingURL=index.d.ts.map