@theia/ai-ide 1.67.0-next.56 → 1.67.0-next.59

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 (301) hide show
  1. package/lib/browser/ai-configuration/agent-configuration-widget.d.ts +41 -0
  2. package/lib/browser/ai-configuration/agent-configuration-widget.d.ts.map +1 -0
  3. package/lib/browser/ai-configuration/agent-configuration-widget.js +333 -0
  4. package/lib/browser/ai-configuration/agent-configuration-widget.js.map +1 -0
  5. package/lib/browser/ai-configuration/ai-configuration-service.d.ts +18 -0
  6. package/lib/browser/ai-configuration/ai-configuration-service.d.ts.map +1 -0
  7. package/lib/browser/ai-configuration/ai-configuration-service.js +53 -0
  8. package/lib/browser/ai-configuration/ai-configuration-service.js.map +1 -0
  9. package/lib/browser/ai-configuration/ai-configuration-view-contribution.d.ts +14 -0
  10. package/lib/browser/ai-configuration/ai-configuration-view-contribution.d.ts.map +1 -0
  11. package/lib/browser/ai-configuration/ai-configuration-view-contribution.js +67 -0
  12. package/lib/browser/ai-configuration/ai-configuration-view-contribution.js.map +1 -0
  13. package/lib/browser/ai-configuration/ai-configuration-widget.d.ts +29 -0
  14. package/lib/browser/ai-configuration/ai-configuration-widget.d.ts.map +1 -0
  15. package/lib/browser/ai-configuration/ai-configuration-widget.js +118 -0
  16. package/lib/browser/ai-configuration/ai-configuration-widget.js.map +1 -0
  17. package/lib/browser/ai-configuration/language-model-renderer.d.ts +13 -0
  18. package/lib/browser/ai-configuration/language-model-renderer.d.ts.map +1 -0
  19. package/lib/browser/ai-configuration/language-model-renderer.js +104 -0
  20. package/lib/browser/ai-configuration/language-model-renderer.js.map +1 -0
  21. package/lib/browser/ai-configuration/mcp-configuration-widget.d.ts +43 -0
  22. package/lib/browser/ai-configuration/mcp-configuration-widget.d.ts.map +1 -0
  23. package/lib/browser/ai-configuration/mcp-configuration-widget.js +302 -0
  24. package/lib/browser/ai-configuration/mcp-configuration-widget.js.map +1 -0
  25. package/lib/browser/ai-configuration/model-aliases-configuration-widget.d.ts +41 -0
  26. package/lib/browser/ai-configuration/model-aliases-configuration-widget.d.ts.map +1 -0
  27. package/lib/browser/ai-configuration/model-aliases-configuration-widget.js +226 -0
  28. package/lib/browser/ai-configuration/model-aliases-configuration-widget.js.map +1 -0
  29. package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.d.ts +141 -0
  30. package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.d.ts.map +1 -0
  31. package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.js +508 -0
  32. package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.js.map +1 -0
  33. package/lib/browser/ai-configuration/template-settings-renderer.d.ts +10 -0
  34. package/lib/browser/ai-configuration/template-settings-renderer.d.ts.map +1 -0
  35. package/lib/browser/ai-configuration/template-settings-renderer.js +48 -0
  36. package/lib/browser/ai-configuration/template-settings-renderer.js.map +1 -0
  37. package/lib/browser/ai-configuration/token-usage-configuration-widget.d.ts +22 -0
  38. package/lib/browser/ai-configuration/token-usage-configuration-widget.d.ts.map +1 -0
  39. package/lib/browser/ai-configuration/token-usage-configuration-widget.js +156 -0
  40. package/lib/browser/ai-configuration/token-usage-configuration-widget.js.map +1 -0
  41. package/lib/browser/ai-configuration/tools-configuration-widget.d.ts +30 -0
  42. package/lib/browser/ai-configuration/tools-configuration-widget.d.ts.map +1 -0
  43. package/lib/browser/ai-configuration/tools-configuration-widget.js +150 -0
  44. package/lib/browser/ai-configuration/tools-configuration-widget.js.map +1 -0
  45. package/lib/browser/ai-configuration/variable-configuration-widget.d.ts +19 -0
  46. package/lib/browser/ai-configuration/variable-configuration-widget.d.ts.map +1 -0
  47. package/lib/browser/ai-configuration/variable-configuration-widget.js +99 -0
  48. package/lib/browser/ai-configuration/variable-configuration-widget.js.map +1 -0
  49. package/lib/browser/ai-ide-activation-service.d.ts +18 -0
  50. package/lib/browser/ai-ide-activation-service.d.ts.map +1 -0
  51. package/lib/browser/ai-ide-activation-service.js +71 -0
  52. package/lib/browser/ai-ide-activation-service.js.map +1 -0
  53. package/lib/browser/ai-terminal-functions.d.ts +13 -0
  54. package/lib/browser/ai-terminal-functions.d.ts.map +1 -0
  55. package/lib/browser/ai-terminal-functions.js +114 -0
  56. package/lib/browser/ai-terminal-functions.js.map +1 -0
  57. package/lib/browser/app-tester-chat-agent.d.ts +35 -0
  58. package/lib/browser/app-tester-chat-agent.d.ts.map +1 -0
  59. package/lib/browser/app-tester-chat-agent.js +142 -0
  60. package/lib/browser/app-tester-chat-agent.js.map +1 -0
  61. package/lib/browser/app-tester-chat-functions.d.ts +25 -0
  62. package/lib/browser/app-tester-chat-functions.d.ts.map +1 -0
  63. package/lib/browser/app-tester-chat-functions.js +170 -0
  64. package/lib/browser/app-tester-chat-functions.js.map +1 -0
  65. package/lib/browser/app-tester-prompt-template.d.ts +6 -0
  66. package/lib/browser/app-tester-prompt-template.d.ts.map +1 -0
  67. package/lib/browser/app-tester-prompt-template.js +83 -0
  68. package/lib/browser/app-tester-prompt-template.js.map +1 -0
  69. package/lib/browser/architect-agent.d.ts +15 -0
  70. package/lib/browser/architect-agent.d.ts.map +1 -0
  71. package/lib/browser/architect-agent.js +68 -0
  72. package/lib/browser/architect-agent.js.map +1 -0
  73. package/lib/browser/coder-agent.d.ts +15 -0
  74. package/lib/browser/coder-agent.d.ts.map +1 -0
  75. package/lib/browser/coder-agent.js +81 -0
  76. package/lib/browser/coder-agent.js.map +1 -0
  77. package/lib/browser/context-file-validation-service-impl.d.ts +13 -0
  78. package/lib/browser/context-file-validation-service-impl.d.ts.map +1 -0
  79. package/lib/browser/context-file-validation-service-impl.js +123 -0
  80. package/lib/browser/context-file-validation-service-impl.js.map +1 -0
  81. package/lib/browser/context-file-validation-service-impl.spec.d.ts +2 -0
  82. package/lib/browser/context-file-validation-service-impl.spec.d.ts.map +1 -0
  83. package/lib/browser/context-file-validation-service-impl.spec.js +340 -0
  84. package/lib/browser/context-file-validation-service-impl.spec.js.map +1 -0
  85. package/lib/browser/context-functions.d.ts +16 -0
  86. package/lib/browser/context-functions.d.ts.map +1 -0
  87. package/lib/browser/context-functions.js +166 -0
  88. package/lib/browser/context-functions.js.map +1 -0
  89. package/lib/browser/context-functions.spec.d.ts +2 -0
  90. package/lib/browser/context-functions.spec.d.ts.map +1 -0
  91. package/lib/browser/context-functions.spec.js +213 -0
  92. package/lib/browser/context-functions.spec.js.map +1 -0
  93. package/lib/browser/file-changeset-function.spec.d.ts +2 -0
  94. package/lib/browser/file-changeset-function.spec.d.ts.map +1 -0
  95. package/lib/browser/file-changeset-function.spec.js +45 -0
  96. package/lib/browser/file-changeset-function.spec.js.map +1 -0
  97. package/lib/browser/file-changeset-functions.d.ts +87 -0
  98. package/lib/browser/file-changeset-functions.d.ts.map +1 -0
  99. package/lib/browser/file-changeset-functions.js +645 -0
  100. package/lib/browser/file-changeset-functions.js.map +1 -0
  101. package/lib/browser/file-changeset-functions.spec.d.ts +2 -0
  102. package/lib/browser/file-changeset-functions.spec.d.ts.map +1 -0
  103. package/lib/browser/file-changeset-functions.spec.js +179 -0
  104. package/lib/browser/file-changeset-functions.spec.js.map +1 -0
  105. package/lib/browser/frontend-module.d.ts +5 -0
  106. package/lib/browser/frontend-module.d.ts.map +1 -0
  107. package/lib/browser/frontend-module.js +220 -0
  108. package/lib/browser/frontend-module.js.map +1 -0
  109. package/lib/browser/github-chat-agent.d.ts +48 -0
  110. package/lib/browser/github-chat-agent.d.ts.map +1 -0
  111. package/lib/browser/github-chat-agent.js +222 -0
  112. package/lib/browser/github-chat-agent.js.map +1 -0
  113. package/lib/browser/github-prompt-template.d.ts +6 -0
  114. package/lib/browser/github-prompt-template.d.ts.map +1 -0
  115. package/lib/browser/github-prompt-template.js +53 -0
  116. package/lib/browser/github-prompt-template.js.map +1 -0
  117. package/lib/browser/github-repo-variable-contribution.d.ts +15 -0
  118. package/lib/browser/github-repo-variable-contribution.d.ts.map +1 -0
  119. package/lib/browser/github-repo-variable-contribution.js +82 -0
  120. package/lib/browser/github-repo-variable-contribution.js.map +1 -0
  121. package/lib/browser/ide-chat-welcome-message-provider.d.ts +10 -0
  122. package/lib/browser/ide-chat-welcome-message-provider.d.ts.map +1 -0
  123. package/lib/browser/ide-chat-welcome-message-provider.js +102 -0
  124. package/lib/browser/ide-chat-welcome-message-provider.js.map +1 -0
  125. package/lib/browser/project-info-agent.d.ts +13 -0
  126. package/lib/browser/project-info-agent.d.ts.map +1 -0
  127. package/lib/browser/project-info-agent.js +45 -0
  128. package/lib/browser/project-info-agent.js.map +1 -0
  129. package/lib/browser/remember-command-contribution.d.ts +16 -0
  130. package/lib/browser/remember-command-contribution.d.ts.map +1 -0
  131. package/lib/browser/remember-command-contribution.js +101 -0
  132. package/lib/browser/remember-command-contribution.js.map +1 -0
  133. package/lib/browser/summarize-session-command-contribution.d.ts +19 -0
  134. package/lib/browser/summarize-session-command-contribution.d.ts.map +1 -0
  135. package/lib/browser/summarize-session-command-contribution.js +118 -0
  136. package/lib/browser/summarize-session-command-contribution.js.map +1 -0
  137. package/lib/browser/task-background-summary-variable.d.ts +9 -0
  138. package/lib/browser/task-background-summary-variable.d.ts.map +1 -0
  139. package/lib/browser/task-background-summary-variable.js +60 -0
  140. package/lib/browser/task-background-summary-variable.js.map +1 -0
  141. package/lib/browser/task-context-agent.d.ts +13 -0
  142. package/lib/browser/task-context-agent.d.ts.map +1 -0
  143. package/lib/browser/task-context-agent.js +45 -0
  144. package/lib/browser/task-context-agent.js.map +1 -0
  145. package/lib/browser/task-context-file-storage-service.d.ts +40 -0
  146. package/lib/browser/task-context-file-storage-service.d.ts.map +1 -0
  147. package/lib/browser/task-context-file-storage-service.js +232 -0
  148. package/lib/browser/task-context-file-storage-service.js.map +1 -0
  149. package/lib/browser/template-preference-contribution.d.ts +17 -0
  150. package/lib/browser/template-preference-contribution.d.ts.map +1 -0
  151. package/lib/browser/template-preference-contribution.js +94 -0
  152. package/lib/browser/template-preference-contribution.js.map +1 -0
  153. package/lib/browser/test/tool-provider-cancellation-test-util.spec.d.ts +2 -0
  154. package/lib/browser/test/tool-provider-cancellation-test-util.spec.d.ts.map +1 -0
  155. package/lib/browser/test/tool-provider-cancellation-test-util.spec.js +52 -0
  156. package/lib/browser/test/tool-provider-cancellation-test-util.spec.js.map +1 -0
  157. package/lib/browser/workspace-functions.d.ts +78 -0
  158. package/lib/browser/workspace-functions.d.ts.map +1 -0
  159. package/lib/browser/workspace-functions.js +697 -0
  160. package/lib/browser/workspace-functions.js.map +1 -0
  161. package/lib/browser/workspace-functions.spec.d.ts +2 -0
  162. package/lib/browser/workspace-functions.spec.d.ts.map +1 -0
  163. package/lib/browser/workspace-functions.spec.js +161 -0
  164. package/lib/browser/workspace-functions.spec.js.map +1 -0
  165. package/lib/browser/workspace-launch-provider.d.ts +24 -0
  166. package/lib/browser/workspace-launch-provider.d.ts.map +1 -0
  167. package/lib/browser/workspace-launch-provider.js +216 -0
  168. package/lib/browser/workspace-launch-provider.js.map +1 -0
  169. package/lib/browser/workspace-launch-provider.spec.d.ts +2 -0
  170. package/lib/browser/workspace-launch-provider.spec.d.ts.map +1 -0
  171. package/lib/browser/workspace-launch-provider.spec.js +245 -0
  172. package/lib/browser/workspace-launch-provider.spec.js.map +1 -0
  173. package/lib/browser/workspace-search-provider.d.ts +15 -0
  174. package/lib/browser/workspace-search-provider.d.ts.map +1 -0
  175. package/lib/browser/workspace-search-provider.js +204 -0
  176. package/lib/browser/workspace-search-provider.js.map +1 -0
  177. package/lib/browser/workspace-search-provider.spec.d.ts +2 -0
  178. package/lib/browser/workspace-search-provider.spec.d.ts.map +1 -0
  179. package/lib/browser/workspace-search-provider.spec.js +82 -0
  180. package/lib/browser/workspace-search-provider.spec.js.map +1 -0
  181. package/lib/browser/workspace-task-provider.d.ts +15 -0
  182. package/lib/browser/workspace-task-provider.d.ts.map +1 -0
  183. package/lib/browser/workspace-task-provider.js +138 -0
  184. package/lib/browser/workspace-task-provider.js.map +1 -0
  185. package/lib/browser/workspace-task-provider.spec.d.ts +2 -0
  186. package/lib/browser/workspace-task-provider.spec.d.ts.map +1 -0
  187. package/lib/browser/workspace-task-provider.spec.js +109 -0
  188. package/lib/browser/workspace-task-provider.spec.js.map +1 -0
  189. package/lib/common/ai-configuration-preferences.d.ts +8 -0
  190. package/lib/common/ai-configuration-preferences.d.ts.map +1 -0
  191. package/lib/common/ai-configuration-preferences.js +41 -0
  192. package/lib/common/ai-configuration-preferences.js.map +1 -0
  193. package/lib/common/ai-ide-preferences.d.ts +5 -0
  194. package/lib/common/ai-ide-preferences.d.ts.map +1 -0
  195. package/lib/common/ai-ide-preferences.js +53 -0
  196. package/lib/common/ai-ide-preferences.js.map +1 -0
  197. package/lib/common/ai-terminal-functions.d.ts +2 -0
  198. package/lib/common/ai-terminal-functions.d.ts.map +1 -0
  199. package/lib/common/ai-terminal-functions.js +20 -0
  200. package/lib/common/ai-terminal-functions.js.map +1 -0
  201. package/lib/common/app-tester-chat-functions.d.ts +5 -0
  202. package/lib/common/app-tester-chat-functions.d.ts.map +1 -0
  203. package/lib/common/app-tester-chat-functions.js +23 -0
  204. package/lib/common/app-tester-chat-functions.js.map +1 -0
  205. package/lib/common/architect-prompt-template.d.ts +3 -0
  206. package/lib/common/architect-prompt-template.d.ts.map +1 -0
  207. package/lib/common/architect-prompt-template.js +81 -0
  208. package/lib/common/architect-prompt-template.js.map +1 -0
  209. package/lib/common/browser-automation-protocol.d.ts +15 -0
  210. package/lib/common/browser-automation-protocol.d.ts.map +1 -0
  211. package/lib/common/browser-automation-protocol.js +22 -0
  212. package/lib/common/browser-automation-protocol.js.map +1 -0
  213. package/lib/common/coder-replace-prompt-template.d.ts +11 -0
  214. package/lib/common/coder-replace-prompt-template.d.ts.map +1 -0
  215. package/lib/common/coder-replace-prompt-template.js +296 -0
  216. package/lib/common/coder-replace-prompt-template.js.map +1 -0
  217. package/lib/common/command-chat-agents.d.ts +36 -0
  218. package/lib/common/command-chat-agents.d.ts.map +1 -0
  219. package/lib/common/command-chat-agents.js +122 -0
  220. package/lib/common/command-chat-agents.js.map +1 -0
  221. package/lib/common/command-prompt-template.d.ts +3 -0
  222. package/lib/common/command-prompt-template.d.ts.map +1 -0
  223. package/lib/common/command-prompt-template.js +226 -0
  224. package/lib/common/command-prompt-template.js.map +1 -0
  225. package/lib/common/context-files-variable.d.ts +9 -0
  226. package/lib/common/context-files-variable.d.ts.map +1 -0
  227. package/lib/common/context-files-variable.js +52 -0
  228. package/lib/common/context-files-variable.js.map +1 -0
  229. package/lib/common/context-functions.d.ts +4 -0
  230. package/lib/common/context-functions.d.ts.map +1 -0
  231. package/lib/common/context-functions.js +22 -0
  232. package/lib/common/context-functions.js.map +1 -0
  233. package/lib/common/context-variables.d.ts +3 -0
  234. package/lib/common/context-variables.d.ts.map +1 -0
  235. package/lib/common/context-variables.js +21 -0
  236. package/lib/common/context-variables.js.map +1 -0
  237. package/lib/common/file-changeset-function-ids.d.ts +19 -0
  238. package/lib/common/file-changeset-function-ids.d.ts.map +1 -0
  239. package/lib/common/file-changeset-function-ids.js +37 -0
  240. package/lib/common/file-changeset-function-ids.js.map +1 -0
  241. package/lib/common/github-repo-protocol.d.ts +15 -0
  242. package/lib/common/github-repo-protocol.d.ts.map +1 -0
  243. package/lib/common/github-repo-protocol.js +21 -0
  244. package/lib/common/github-repo-protocol.js.map +1 -0
  245. package/lib/common/orchestrator-chat-agent.d.ts +36 -0
  246. package/lib/common/orchestrator-chat-agent.d.ts.map +1 -0
  247. package/lib/common/orchestrator-chat-agent.js +167 -0
  248. package/lib/common/orchestrator-chat-agent.js.map +1 -0
  249. package/lib/common/orchestrator-prompt-template.d.ts +3 -0
  250. package/lib/common/orchestrator-prompt-template.d.ts.map +1 -0
  251. package/lib/common/orchestrator-prompt-template.js +55 -0
  252. package/lib/common/orchestrator-prompt-template.js.map +1 -0
  253. package/lib/common/project-info-prompt-template.d.ts +6 -0
  254. package/lib/common/project-info-prompt-template.d.ts.map +1 -0
  255. package/lib/common/project-info-prompt-template.js +145 -0
  256. package/lib/common/project-info-prompt-template.js.map +1 -0
  257. package/lib/common/summarize-session-commands.d.ts +4 -0
  258. package/lib/common/summarize-session-commands.d.ts.map +1 -0
  259. package/lib/common/summarize-session-commands.js +28 -0
  260. package/lib/common/summarize-session-commands.js.map +1 -0
  261. package/lib/common/task-context-prompt-template.d.ts +8 -0
  262. package/lib/common/task-context-prompt-template.d.ts.map +1 -0
  263. package/lib/common/task-context-prompt-template.js +217 -0
  264. package/lib/common/task-context-prompt-template.js.map +1 -0
  265. package/lib/common/universal-chat-agent.d.ts +17 -0
  266. package/lib/common/universal-chat-agent.d.ts.map +1 -0
  267. package/lib/common/universal-chat-agent.js +47 -0
  268. package/lib/common/universal-chat-agent.js.map +1 -0
  269. package/lib/common/universal-prompt-template.d.ts +4 -0
  270. package/lib/common/universal-prompt-template.d.ts.map +1 -0
  271. package/lib/common/universal-prompt-template.js +32 -0
  272. package/lib/common/universal-prompt-template.js.map +1 -0
  273. package/lib/common/workspace-functions.d.ts +12 -0
  274. package/lib/common/workspace-functions.d.ts.map +1 -0
  275. package/lib/common/workspace-functions.js +30 -0
  276. package/lib/common/workspace-functions.js.map +1 -0
  277. package/lib/common/workspace-preferences.d.ts +10 -0
  278. package/lib/common/workspace-preferences.d.ts.map +1 -0
  279. package/lib/common/workspace-preferences.js +89 -0
  280. package/lib/common/workspace-preferences.js.map +1 -0
  281. package/lib/common/workspace-search-provider-util.d.ts +17 -0
  282. package/lib/common/workspace-search-provider-util.d.ts.map +1 -0
  283. package/lib/common/workspace-search-provider-util.js +51 -0
  284. package/lib/common/workspace-search-provider-util.js.map +1 -0
  285. package/lib/node/app-tester-agent/browser-automation-impl.d.ts +18 -0
  286. package/lib/node/app-tester-agent/browser-automation-impl.d.ts.map +1 -0
  287. package/lib/node/app-tester-agent/browser-automation-impl.js +96 -0
  288. package/lib/node/app-tester-agent/browser-automation-impl.js.map +1 -0
  289. package/lib/node/backend-module.d.ts +4 -0
  290. package/lib/node/backend-module.d.ts.map +1 -0
  291. package/lib/node/backend-module.js +45 -0
  292. package/lib/node/backend-module.js.map +1 -0
  293. package/lib/node/github-repo-service-impl.d.ts +7 -0
  294. package/lib/node/github-repo-service-impl.d.ts.map +1 -0
  295. package/lib/node/github-repo-service-impl.js +86 -0
  296. package/lib/node/github-repo-service-impl.js.map +1 -0
  297. package/lib/package.spec.d.ts +1 -0
  298. package/lib/package.spec.d.ts.map +1 -0
  299. package/lib/package.spec.js +26 -0
  300. package/lib/package.spec.js.map +1 -0
  301. package/package.json +21 -21
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AIIdeActivationServiceImpl = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // *****************************************************************************
6
+ // Copyright (C) 2025 EclipseSource GmbH.
7
+ //
8
+ // This program and the accompanying materials are made available under the
9
+ // terms of the Eclipse Public License v. 2.0 which is available at
10
+ // http://www.eclipse.org/legal/epl-2.0.
11
+ //
12
+ // This Source Code may also be made available under the following Secondary
13
+ // Licenses when the conditions for such availability set forth in the Eclipse
14
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
15
+ // with the GNU Classpath Exception which is available at
16
+ // https://www.gnu.org/software/classpath/license.html.
17
+ //
18
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
19
+ // *****************************************************************************
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const core_1 = require("@theia/core");
22
+ const context_key_service_1 = require("@theia/core/lib/browser/context-key-service");
23
+ const ai_activation_service_1 = require("@theia/ai-core/lib/browser/ai-activation-service");
24
+ const ai_ide_preferences_1 = require("../common/ai-ide-preferences");
25
+ /**
26
+ * Implements AI Activation Service based on preferences.
27
+ */
28
+ let AIIdeActivationServiceImpl = class AIIdeActivationServiceImpl {
29
+ constructor() {
30
+ this.onDidChangeAIEnabled = new core_1.Emitter();
31
+ }
32
+ get onDidChangeActiveStatus() {
33
+ return this.onDidChangeAIEnabled.event;
34
+ }
35
+ get isActive() {
36
+ var _a;
37
+ return (_a = this.isAiEnabledKey.get()) !== null && _a !== void 0 ? _a : false;
38
+ }
39
+ updateEnableValue(value) {
40
+ if (value !== this.isAiEnabledKey.get()) {
41
+ this.isAiEnabledKey.set(value);
42
+ this.onDidChangeAIEnabled.fire(value);
43
+ }
44
+ }
45
+ initialize() {
46
+ this.isAiEnabledKey = this.contextKeyService.createKey(ai_activation_service_1.ENABLE_AI_CONTEXT_KEY, false);
47
+ // make sure we don't miss once preferences are ready
48
+ this.preferenceService.ready.then(() => {
49
+ const enableValue = this.preferenceService.get(ai_ide_preferences_1.PREFERENCE_NAME_ENABLE_AI, false);
50
+ this.updateEnableValue(enableValue);
51
+ });
52
+ this.preferenceService.onPreferenceChanged(e => {
53
+ if (e.preferenceName === ai_ide_preferences_1.PREFERENCE_NAME_ENABLE_AI) {
54
+ this.updateEnableValue(e.newValue);
55
+ }
56
+ });
57
+ }
58
+ };
59
+ exports.AIIdeActivationServiceImpl = AIIdeActivationServiceImpl;
60
+ tslib_1.__decorate([
61
+ (0, inversify_1.inject)(context_key_service_1.ContextKeyService),
62
+ tslib_1.__metadata("design:type", Object)
63
+ ], AIIdeActivationServiceImpl.prototype, "contextKeyService", void 0);
64
+ tslib_1.__decorate([
65
+ (0, inversify_1.inject)(core_1.PreferenceService),
66
+ tslib_1.__metadata("design:type", Object)
67
+ ], AIIdeActivationServiceImpl.prototype, "preferenceService", void 0);
68
+ exports.AIIdeActivationServiceImpl = AIIdeActivationServiceImpl = tslib_1.__decorate([
69
+ (0, inversify_1.injectable)()
70
+ ], AIIdeActivationServiceImpl);
71
+ //# sourceMappingURL=ai-ide-activation-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-ide-activation-service.js","sourceRoot":"","sources":["../../src/browser/ai-ide-activation-service.ts"],"names":[],"mappings":";;;;AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4E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,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,QAAmB,CAAC,CAAC;YAClD,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AAtCY,gEAA0B;AAEhB;IADlB,IAAA,kBAAM,EAAC,uCAAiB,CAAC;;qEAC8B;AAG9C;IADT,IAAA,kBAAM,EAAC,wBAAiB,CAAC;;qEACqB;qCALtC,0BAA0B;IADtC,IAAA,sBAAU,GAAE;GACA,0BAA0B,CAsCtC"}
@@ -0,0 +1,13 @@
1
+ import { ToolProvider, ToolRequest } from '@theia/ai-core';
2
+ import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service';
3
+ import { WorkspaceService } from '@theia/workspace/lib/browser';
4
+ import { ApplicationShell } from '@theia/core/lib/browser';
5
+ export declare class SuggestTerminalCommand implements ToolProvider {
6
+ static ID: string;
7
+ protected readonly terminalService: TerminalService;
8
+ protected readonly workspaceService: WorkspaceService;
9
+ protected readonly applicationShell: ApplicationShell;
10
+ getTool(): ToolRequest;
11
+ protected isValidCommand(command: string): boolean;
12
+ }
13
+ //# sourceMappingURL=ai-terminal-functions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-terminal-functions.d.ts","sourceRoot":"","sources":["../../src/browser/ai-terminal-functions.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,qBACa,sBAAuB,YAAW,YAAY;IACvD,MAAM,CAAC,EAAE,SAA+B;IAGxC,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAGpD,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAGtD,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAEtD,OAAO,IAAI,WAAW;IAwDtB,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;CAQrD"}
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2025 EclipseSource GmbH.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var SuggestTerminalCommand_1;
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.SuggestTerminalCommand = void 0;
20
+ const tslib_1 = require("tslib");
21
+ const inversify_1 = require("@theia/core/shared/inversify");
22
+ const terminal_service_1 = require("@theia/terminal/lib/browser/base/terminal-service");
23
+ const ai_terminal_functions_1 = require("../common/ai-terminal-functions");
24
+ const browser_1 = require("@theia/workspace/lib/browser");
25
+ const promise_util_1 = require("@theia/core/lib/common/promise-util");
26
+ const browser_2 = require("@theia/core/lib/browser");
27
+ let SuggestTerminalCommand = SuggestTerminalCommand_1 = class SuggestTerminalCommand {
28
+ getTool() {
29
+ return {
30
+ id: SuggestTerminalCommand_1.ID,
31
+ name: SuggestTerminalCommand_1.ID,
32
+ description: `Proposes executing a command in the terminal.\n
33
+ This tool will automatically write the command into the terminal buffer.\n
34
+ Execution of the command is up to the user.`,
35
+ parameters: {
36
+ type: 'object',
37
+ properties: {
38
+ command: {
39
+ type: 'string',
40
+ description: `The content of the command to write to the terminal buffer.\n
41
+ ALWAYS provide the COMPLETE intended content of the command, without any truncation or omissions.\n
42
+ You MUST include ALL parts of the command.`
43
+ }
44
+ },
45
+ required: ['command']
46
+ },
47
+ handler: async (args, ctx) => {
48
+ var _a, _b;
49
+ if ((_b = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.response) === null || _a === void 0 ? void 0 : _a.cancellationToken) === null || _b === void 0 ? void 0 : _b.isCancellationRequested) {
50
+ return JSON.stringify({ error: 'Operation cancelled by user' });
51
+ }
52
+ // Ensure that there is a workspace
53
+ let activeTerminal = this.terminalService.lastUsedTerminal;
54
+ if (!activeTerminal || activeTerminal.isDisposed) {
55
+ try {
56
+ activeTerminal = await this.terminalService.newTerminal({});
57
+ this.terminalService.open(activeTerminal, { mode: 'activate' });
58
+ await activeTerminal.start();
59
+ // Wait until the terminal prompt is emitted
60
+ await (0, promise_util_1.waitForEvent)(activeTerminal.onOutput, 3000);
61
+ }
62
+ catch (error) {
63
+ return JSON.stringify({ error: `Error executing tool 'suggestTerminalCommand': ${error}` });
64
+ }
65
+ }
66
+ else {
67
+ this.terminalService.open(activeTerminal, { mode: 'activate' });
68
+ }
69
+ let command;
70
+ try {
71
+ const { command: parsedCommand } = JSON.parse(args);
72
+ command = parsedCommand;
73
+ }
74
+ catch (error) {
75
+ return JSON.stringify({ error: `Error parsing arguments for tool 'suggestTerminalCommand': ${error}` });
76
+ }
77
+ if (!this.isValidCommand(command)) {
78
+ return JSON.stringify({ error: 'Error validating command generated by \'suggestTerminalCommand\'' });
79
+ }
80
+ ;
81
+ // Clear the current input line by sending Ctrl+A (move to start) and Ctrl+K (delete to end)
82
+ activeTerminal.sendText('\x01\x0b');
83
+ activeTerminal.sendText(command);
84
+ return `Proposed executing the terminal command ${command}. The user will review and potentially execute the command.`;
85
+ }
86
+ };
87
+ }
88
+ isValidCommand(command) {
89
+ // Command should not be empty and should not contain control characters
90
+ const CONTROL_CHAR_REGEX = /[\u0000-\u001F\u007F]/; // ASCII control range
91
+ if (!command || CONTROL_CHAR_REGEX.test(command)) {
92
+ return false;
93
+ }
94
+ return true;
95
+ }
96
+ };
97
+ exports.SuggestTerminalCommand = SuggestTerminalCommand;
98
+ SuggestTerminalCommand.ID = ai_terminal_functions_1.SUGGEST_TERMINAL_COMMAND_ID;
99
+ tslib_1.__decorate([
100
+ (0, inversify_1.inject)(terminal_service_1.TerminalService),
101
+ tslib_1.__metadata("design:type", Object)
102
+ ], SuggestTerminalCommand.prototype, "terminalService", void 0);
103
+ tslib_1.__decorate([
104
+ (0, inversify_1.inject)(browser_1.WorkspaceService),
105
+ tslib_1.__metadata("design:type", browser_1.WorkspaceService)
106
+ ], SuggestTerminalCommand.prototype, "workspaceService", void 0);
107
+ tslib_1.__decorate([
108
+ (0, inversify_1.inject)(browser_2.ApplicationShell),
109
+ tslib_1.__metadata("design:type", browser_2.ApplicationShell)
110
+ ], SuggestTerminalCommand.prototype, "applicationShell", void 0);
111
+ exports.SuggestTerminalCommand = SuggestTerminalCommand = SuggestTerminalCommand_1 = tslib_1.__decorate([
112
+ (0, inversify_1.injectable)()
113
+ ], SuggestTerminalCommand);
114
+ //# sourceMappingURL=ai-terminal-functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-terminal-functions.js","sourceRoot":"","sources":["../../src/browser/ai-terminal-functions.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;;AAIhF,4DAAkE;AAClE,wFAAoF;AACpF,2EAA8E;AAC9E,0DAAgE;AAEhE,sEAAmE;AACnE,qDAA2D;AAGpD,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IAY/B,OAAO;QACH,OAAO;YACH,EAAE,EAAE,wBAAsB,CAAC,EAAE;YAC7B,IA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;gEAAC;iCAV7C,sBAAsB;IADlC,IAAA,sBAAU,GAAE;GACA,sBAAsB,CA4ElC"}
@@ -0,0 +1,35 @@
1
+ import { AbstractStreamParsingChatAgent } from '@theia/ai-chat/lib/common/chat-agents';
2
+ import { MutableChatRequestModel } from '@theia/ai-chat/lib/common/chat-model';
3
+ import { LanguageModelRequirement } from '@theia/ai-core/lib/common';
4
+ import { MCPFrontendService, MCPServerDescription } from '@theia/ai-mcp/lib/common/mcp-server-manager';
5
+ import { PreferenceService } from '@theia/core/lib/common';
6
+ export declare const AppTesterChatAgentId = "AppTester";
7
+ export declare class AppTesterChatAgent extends AbstractStreamParsingChatAgent {
8
+ protected readonly mcpService: MCPFrontendService;
9
+ protected readonly preferenceService: PreferenceService;
10
+ id: string;
11
+ name: string;
12
+ languageModelRequirements: LanguageModelRequirement[];
13
+ protected defaultLanguageModelPurpose: string;
14
+ description: string;
15
+ iconClass: string;
16
+ protected systemPromptId: string;
17
+ prompts: {
18
+ id: string;
19
+ defaultVariant: import("@theia/ai-core/lib/common").BasePromptFragment;
20
+ variants: import("@theia/ai-core/lib/common").BasePromptFragment[];
21
+ }[];
22
+ /**
23
+ * Override invoke to check if the Playwright MCP server is running, and if not, ask the user if it should be started.
24
+ */
25
+ invoke(request: MutableChatRequestModel): Promise<void>;
26
+ protected requiresStartingServers(): Promise<boolean>;
27
+ protected startServers(): Promise<void>;
28
+ /**
29
+ * Starts the Playwright MCP server if it doesn't exist or isn't running.
30
+ *
31
+ * @returns A promise that resolves when the server is started
32
+ */
33
+ ensureServersStarted(...servers: MCPServerDescription[]): Promise<void>;
34
+ }
35
+ //# sourceMappingURL=app-tester-chat-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-tester-chat-agent.d.ts","sourceRoot":"","sources":["../../src/browser/app-tester-chat-agent.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAiE,uBAAuB,EAA+B,MAAM,sCAAsC,CAAC;AAC3K,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAIvG,OAAO,EAAmB,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG5E,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAChD,qBACa,kBAAmB,SAAQ,8BAA8B;IAGlE,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IAGlD,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAExD,EAAE,EAAE,MAAM,CAAwB;IAClC,IAAI,SAAwB;IAC5B,yBAAyB,EAAE,wBAAwB,EAAE,CAGlD;IACH,SAAS,CAAC,2BAA2B,EAAE,MAAM,CAAU;IAC9C,WAAW,SACmF;IAE9F,SAAS,EAAE,MAAM,CAA4B;IACtD,UAAmB,cAAc,EAAE,MAAM,CAAuB;IACvD,OAAO;;;;QAA0G;IAE1H;;OAEG;IACY,MAAM,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;cAsDtD,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC;cAK3C,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7C;;;;OAIG;IACG,oBAAoB,CAAC,GAAG,OAAO,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CA4BhF"}
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ /* eslint-disable max-len */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AppTesterChatAgent = exports.AppTesterChatAgentId = void 0;
5
+ const tslib_1 = require("tslib");
6
+ // *****************************************************************************
7
+ // Copyright (C) 2024 EclipseSource GmbH.
8
+ //
9
+ // This program and the accompanying materials are made available under the
10
+ // terms of the Eclipse Public License v. 2.0 which is available at
11
+ // http://www.eclipse.org/legal/epl-2.0.
12
+ //
13
+ // This Source Code may also be made available under the following Secondary
14
+ // Licenses when the conditions for such availability set forth in the Eclipse
15
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
16
+ // with the GNU Classpath Exception which is available at
17
+ // https://www.gnu.org/software/classpath/license.html.
18
+ //
19
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
20
+ // *****************************************************************************
21
+ const chat_agents_1 = require("@theia/ai-chat/lib/common/chat-agents");
22
+ const chat_model_1 = require("@theia/ai-chat/lib/common/chat-model");
23
+ const mcp_server_manager_1 = require("@theia/ai-mcp/lib/common/mcp-server-manager");
24
+ const core_1 = require("@theia/core");
25
+ const inversify_1 = require("@theia/core/shared/inversify");
26
+ const mcp_preferences_1 = require("@theia/ai-mcp/lib/common/mcp-preferences");
27
+ const common_1 = require("@theia/core/lib/common");
28
+ const app_tester_prompt_template_1 = require("./app-tester-prompt-template");
29
+ exports.AppTesterChatAgentId = 'AppTester';
30
+ let AppTesterChatAgent = class AppTesterChatAgent extends chat_agents_1.AbstractStreamParsingChatAgent {
31
+ constructor() {
32
+ super(...arguments);
33
+ this.id = exports.AppTesterChatAgentId;
34
+ this.name = exports.AppTesterChatAgentId;
35
+ this.languageModelRequirements = [{
36
+ purpose: 'chat',
37
+ identifier: 'default/code',
38
+ }];
39
+ this.defaultLanguageModelPurpose = 'chat';
40
+ this.description = core_1.nls.localize('theia/ai/chat/app-tester/description', 'This agent tests your application user interface to verify user-specified test scenarios through the Playwright MCP server. '
41
+ + 'It can automate testing workflows and provide detailed feedback on application functionality.');
42
+ this.iconClass = 'codicon codicon-beaker';
43
+ this.systemPromptId = 'app-tester-system';
44
+ this.prompts = [{ id: 'app-tester-system', defaultVariant: app_tester_prompt_template_1.appTesterTemplate, variants: [app_tester_prompt_template_1.appTesterTemplateVariant] }];
45
+ }
46
+ /**
47
+ * Override invoke to check if the Playwright MCP server is running, and if not, ask the user if it should be started.
48
+ */
49
+ async invoke(request) {
50
+ try {
51
+ if (await this.requiresStartingServers()) {
52
+ // Ask the user if they want to start the server
53
+ request.response.response.addContent(new chat_model_1.QuestionResponseContentImpl(core_1.nls.localize('theia/ai/ide/app-tester/startPlaywrightServers/question', 'The Playwright MCP servers are not running. Would you like to start them now? This may install the Playwright MCP servers.'), [
54
+ { text: core_1.nls.localize('theia/ai/ide/app-tester/startPlaywrightServers/yes', 'Yes, start the servers'), value: 'yes' },
55
+ { text: core_1.nls.localize('theia/ai/ide/app-tester/startPlaywrightServers/no', 'No, cancel'), value: 'no' }
56
+ ], request, async (selectedOption) => {
57
+ if (selectedOption.value === 'yes') {
58
+ // Show progress
59
+ const progress = request.response.addProgressMessage({
60
+ content: core_1.nls.localize('theia/ai/ide/app-tester/startPlaywrightServers/progress', 'Starting Playwright MCP servers.'),
61
+ show: 'whileIncomplete'
62
+ });
63
+ try {
64
+ await this.startServers();
65
+ // Remove progress, continue with normal flow
66
+ request.response.updateProgressMessage({ ...progress, show: 'whileIncomplete', status: 'completed' });
67
+ await super.invoke(request);
68
+ }
69
+ catch (error) {
70
+ request.response.response.addContent(new chat_model_1.ErrorChatResponseContentImpl(new Error(core_1.nls.localize('theia/ai/ide/app-tester/startPlaywrightServers/error', 'Failed to start Playwright MCP server: {0}', error instanceof Error ? error.message : String(error)))));
71
+ request.response.complete();
72
+ }
73
+ }
74
+ else {
75
+ // Continue without starting the server
76
+ request.response.response.addContent(new chat_model_1.MarkdownChatResponseContentImpl(core_1.nls.localize('theia/ai/ide/app-tester/startPlaywrightServers/canceled', 'Please setup the MCP servers.')));
77
+ request.response.complete();
78
+ }
79
+ }));
80
+ request.response.waitForInput();
81
+ return;
82
+ }
83
+ // If already running, continue as normal
84
+ await super.invoke(request);
85
+ }
86
+ catch (error) {
87
+ request.response.response.addContent(new chat_model_1.ErrorChatResponseContentImpl(new Error(core_1.nls.localize('theia/ai/ide/app-tester/errorCheckingPlaywrightServerStatus', 'Error checking Playwright MCP server status: {0}', error instanceof Error ? error.message : String(error)))));
88
+ request.response.complete();
89
+ }
90
+ }
91
+ async requiresStartingServers() {
92
+ const allStarted = await Promise.all(app_tester_prompt_template_1.REQUIRED_MCP_SERVERS.map(server => this.mcpService.isServerStarted(server.name)));
93
+ return allStarted.some(started => !started);
94
+ }
95
+ async startServers() {
96
+ await this.ensureServersStarted(...app_tester_prompt_template_1.REQUIRED_MCP_SERVERS);
97
+ }
98
+ /**
99
+ * Starts the Playwright MCP server if it doesn't exist or isn't running.
100
+ *
101
+ * @returns A promise that resolves when the server is started
102
+ */
103
+ async ensureServersStarted(...servers) {
104
+ try {
105
+ const serversToInstall = [];
106
+ const serversToStart = [];
107
+ for (const server of servers) {
108
+ if (!(await this.mcpService.hasServer(server.name))) {
109
+ serversToInstall.push(server);
110
+ }
111
+ if (!(await this.mcpService.isServerStarted(server.name))) {
112
+ serversToStart.push(server);
113
+ }
114
+ }
115
+ for (const server of serversToInstall) {
116
+ const currentServers = this.preferenceService.get(mcp_preferences_1.MCP_SERVERS_PREF, {});
117
+ await this.preferenceService.set(mcp_preferences_1.MCP_SERVERS_PREF, { ...currentServers, [server.name]: server }, common_1.PreferenceScope.User);
118
+ await this.mcpService.addOrUpdateServer(server);
119
+ }
120
+ for (const server of serversToStart) {
121
+ await this.mcpService.startServer(server.name);
122
+ }
123
+ }
124
+ catch (error) {
125
+ this.logger.error(`Error starting MCP servers ${servers.map(s => s.name)}: ${error}`);
126
+ throw error;
127
+ }
128
+ }
129
+ };
130
+ exports.AppTesterChatAgent = AppTesterChatAgent;
131
+ tslib_1.__decorate([
132
+ (0, inversify_1.inject)(mcp_server_manager_1.MCPFrontendService),
133
+ tslib_1.__metadata("design:type", Object)
134
+ ], AppTesterChatAgent.prototype, "mcpService", void 0);
135
+ tslib_1.__decorate([
136
+ (0, inversify_1.inject)(common_1.PreferenceService),
137
+ tslib_1.__metadata("design:type", Object)
138
+ ], AppTesterChatAgent.prototype, "preferenceService", void 0);
139
+ exports.AppTesterChatAgent = AppTesterChatAgent = tslib_1.__decorate([
140
+ (0, inversify_1.injectable)()
141
+ ], AppTesterChatAgent);
142
+ //# sourceMappingURL=app-tester-chat-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-tester-chat-agent.js","sourceRoot":"","sources":["../../src/browser/app-tester-chat-agent.ts"],"names":[],"mappings":";AAAA,4BAA4B;;;;AAE5B,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAEhF,uEAAuF;AACvF,qEAA2K;AAE3K,oFAAuG;AACvG,sCAAkC;AAClC,4DAAkE;AAClE,8EAA4E;AAC5E,mDAA4E;AAC5E,6EAAiH;AAEpG,QAAA,oBAAoB,GAAG,WAAW,CAAC;AAEzC,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,4CAA8B;IAA/D;;QAQH,OAAE,GAAW,4BAAoB,CAAC;QAClC,SAAI,GAAG,4BAAoB,CAAC;QAC5B,8BAAyB,GAA+B,CAAC;gBACrD,OAAO,EAAE,MAAM;gBACf,UAAU,EAAE,cAAc;aAC7B,CAAC,CAAC;QACO,gCAA2B,GAAW,MAAM,CAAC;QAC9C,gBAAW,GAAG,UAAG,CAAC,QAAQ,CAAC,sCAAsC,EAAE,8HAA8H;cACpM,+FAA+F,CAAC,CAAC;QAE9F,cAAS,GAAW,wBAAwB,CAAC;QACnC,mBAAc,GAAW,mBAAmB,CAAC;QACvD,YAAO,GAAG,CAAC,EAAE,EAAE,EAAE,mBAAmB,EAAE,cAAc,EAAE,8CAAiB,EAAE,QAAQ,EAAE,CAAC,qDAAwB,CAAC,EAAE,CAAC,CAAC;IAqG9H,CAAC;IAnGG;;OAEG;IACM,KAAK,CAAC,MAAM,CAAC,OAAgC;QAClD,IAAI,CAAC;YACD,IAAI,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,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;YACtF,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC;CACJ,CAAA;AAzHY,gDAAkB;AAGR;IADlB,IAAA,kBAAM,EAAC,uCAAkB,CAAC;;sDACuB;AAG/B;IADlB,IAAA,kBAAM,EAAC,0BAAiB,CAAC;;6DAC8B;6BAN/C,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;GACA,kBAAkB,CAyH9B"}
@@ -0,0 +1,25 @@
1
+ import { type ToolProvider, type ToolRequest } from '@theia/ai-core';
2
+ import { MCPServerManager } from '@theia/ai-mcp/lib/common';
3
+ import { BrowserAutomation } from '../common/browser-automation-protocol';
4
+ export declare abstract class BrowserAutomationToolProvider implements ToolProvider {
5
+ protected readonly browser: BrowserAutomation;
6
+ abstract getTool(): ToolRequest;
7
+ }
8
+ export declare class LaunchBrowserProvider extends BrowserAutomationToolProvider {
9
+ static ID: string;
10
+ protected readonly mcpServerManager: MCPServerManager;
11
+ getTool(): ToolRequest;
12
+ }
13
+ export declare class CloseBrowserProvider extends BrowserAutomationToolProvider {
14
+ static ID: string;
15
+ getTool(): ToolRequest;
16
+ }
17
+ export declare class IsBrowserRunningProvider extends BrowserAutomationToolProvider {
18
+ static ID: string;
19
+ getTool(): ToolRequest;
20
+ }
21
+ export declare class QueryDomProvider extends BrowserAutomationToolProvider {
22
+ static ID: string;
23
+ getTool(): ToolRequest;
24
+ }
25
+ //# sourceMappingURL=app-tester-chat-functions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-tester-chat-functions.d.ts","sourceRoot":"","sources":["../../src/browser/app-tester-chat-functions.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAA+B,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE1E,8BACsB,6BAA8B,YAAW,YAAY;IAEvE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IAE9C,QAAQ,CAAC,OAAO,IAAI,WAAW;CAClC;AAED,qBACa,qBAAsB,SAAQ,6BAA6B;IACpE,MAAM,CAAC,EAAE,SAA8B;IAGvC,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAEtD,OAAO,IAAI,WAAW;CAkDzB;AAED,qBACa,oBAAqB,SAAQ,6BAA6B;IACnE,MAAM,CAAC,EAAE,SAA6B;IAEtC,OAAO,IAAI,WAAW;CAmBzB;AAED,qBACa,wBAAyB,SAAQ,6BAA6B;IACvE,MAAM,CAAC,EAAE,SAAkC;IAE3C,OAAO,IAAI,WAAW;CAoBzB;AAED,qBACa,gBAAiB,SAAQ,6BAA6B;IAC/D,MAAM,CAAC,EAAE,SAAyB;IAElC,OAAO,IAAI,WAAW;CA0BzB"}
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ var LaunchBrowserProvider_1, CloseBrowserProvider_1, IsBrowserRunningProvider_1, QueryDomProvider_1;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.QueryDomProvider = exports.IsBrowserRunningProvider = exports.CloseBrowserProvider = exports.LaunchBrowserProvider = exports.BrowserAutomationToolProvider = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const common_1 = require("@theia/ai-mcp/lib/common");
7
+ const inversify_1 = require("@theia/core/shared/inversify");
8
+ const app_tester_chat_functions_1 = require("../common/app-tester-chat-functions");
9
+ const browser_automation_protocol_1 = require("../common/browser-automation-protocol");
10
+ let BrowserAutomationToolProvider = class BrowserAutomationToolProvider {
11
+ };
12
+ exports.BrowserAutomationToolProvider = BrowserAutomationToolProvider;
13
+ tslib_1.__decorate([
14
+ (0, inversify_1.inject)(browser_automation_protocol_1.BrowserAutomation),
15
+ tslib_1.__metadata("design:type", Object)
16
+ ], BrowserAutomationToolProvider.prototype, "browser", void 0);
17
+ exports.BrowserAutomationToolProvider = BrowserAutomationToolProvider = tslib_1.__decorate([
18
+ (0, inversify_1.injectable)()
19
+ ], BrowserAutomationToolProvider);
20
+ let LaunchBrowserProvider = LaunchBrowserProvider_1 = class LaunchBrowserProvider extends BrowserAutomationToolProvider {
21
+ getTool() {
22
+ return {
23
+ id: LaunchBrowserProvider_1.ID,
24
+ name: LaunchBrowserProvider_1.ID,
25
+ description: 'Start the browser.',
26
+ parameters: {
27
+ type: 'object',
28
+ properties: {},
29
+ required: []
30
+ }, handler: async () => {
31
+ var _a, _b;
32
+ try {
33
+ const mcp = await this.mcpServerManager.getServerDescription('playwright');
34
+ if (!mcp) {
35
+ throw new Error('No MCP Playwright instance with name playwright found');
36
+ }
37
+ if (!(0, common_1.isLocalMCPServerDescription)(mcp)) {
38
+ throw new Error('The MCP Playwright instance must run locally.');
39
+ }
40
+ const cdpEndpointIndex = (_a = mcp.args) === null || _a === void 0 ? void 0 : _a.findIndex(p => p === '--cdp-endpoint');
41
+ if (!cdpEndpointIndex) {
42
+ throw new Error('No --cdp-endpoint was provided.');
43
+ }
44
+ const cdpEndpoint = (_b = mcp.args) === null || _b === void 0 ? void 0 : _b[cdpEndpointIndex + 1];
45
+ if (!cdpEndpoint) {
46
+ throw new Error('No --cdp-endpoint argument was provided.');
47
+ }
48
+ let remoteDebuggingPort = 9222;
49
+ try {
50
+ const uri = new URL(cdpEndpoint);
51
+ if (uri.port) {
52
+ remoteDebuggingPort = parseInt(uri.port, 10);
53
+ }
54
+ else {
55
+ // Default ports if not specified
56
+ remoteDebuggingPort = uri.protocol === 'https:' ? 443 : 80;
57
+ }
58
+ }
59
+ catch (error) {
60
+ throw new Error(`Invalid --cdp-endpoint format, URL expected: ${cdpEndpoint}`);
61
+ }
62
+ const result = await this.browser.launch(remoteDebuggingPort);
63
+ return result;
64
+ }
65
+ catch (ex) {
66
+ return (`Failed to starting the browser: ${ex.message}`);
67
+ }
68
+ }
69
+ };
70
+ }
71
+ };
72
+ exports.LaunchBrowserProvider = LaunchBrowserProvider;
73
+ LaunchBrowserProvider.ID = app_tester_chat_functions_1.LAUNCH_BROWSER_FUNCTION_ID;
74
+ tslib_1.__decorate([
75
+ (0, inversify_1.inject)(common_1.MCPServerManager),
76
+ tslib_1.__metadata("design:type", Object)
77
+ ], LaunchBrowserProvider.prototype, "mcpServerManager", void 0);
78
+ exports.LaunchBrowserProvider = LaunchBrowserProvider = LaunchBrowserProvider_1 = tslib_1.__decorate([
79
+ (0, inversify_1.injectable)()
80
+ ], LaunchBrowserProvider);
81
+ let CloseBrowserProvider = CloseBrowserProvider_1 = class CloseBrowserProvider extends BrowserAutomationToolProvider {
82
+ getTool() {
83
+ return {
84
+ id: CloseBrowserProvider_1.ID,
85
+ name: CloseBrowserProvider_1.ID,
86
+ description: 'Close the browser.',
87
+ parameters: {
88
+ type: 'object',
89
+ properties: {},
90
+ required: []
91
+ },
92
+ handler: async () => {
93
+ try {
94
+ await this.browser.close();
95
+ }
96
+ catch (ex) {
97
+ return (`Failed to close browser: ${ex.message}`);
98
+ }
99
+ }
100
+ };
101
+ }
102
+ };
103
+ exports.CloseBrowserProvider = CloseBrowserProvider;
104
+ CloseBrowserProvider.ID = app_tester_chat_functions_1.CLOSE_BROWSER_FUNCTION_ID;
105
+ exports.CloseBrowserProvider = CloseBrowserProvider = CloseBrowserProvider_1 = tslib_1.__decorate([
106
+ (0, inversify_1.injectable)()
107
+ ], CloseBrowserProvider);
108
+ let IsBrowserRunningProvider = IsBrowserRunningProvider_1 = class IsBrowserRunningProvider extends BrowserAutomationToolProvider {
109
+ getTool() {
110
+ return {
111
+ id: IsBrowserRunningProvider_1.ID,
112
+ name: IsBrowserRunningProvider_1.ID,
113
+ description: 'Check if the browser is running.',
114
+ parameters: {
115
+ type: 'object',
116
+ properties: {},
117
+ required: []
118
+ },
119
+ handler: async () => {
120
+ try {
121
+ const isRunning = await this.browser.isRunning();
122
+ return isRunning ? 'Browser is running.' : 'Browser is not running.';
123
+ }
124
+ catch (ex) {
125
+ return (`Failed to check if browser is running: ${ex.message}`);
126
+ }
127
+ }
128
+ };
129
+ }
130
+ };
131
+ exports.IsBrowserRunningProvider = IsBrowserRunningProvider;
132
+ IsBrowserRunningProvider.ID = app_tester_chat_functions_1.IS_BROWSER_RUNNING_FUNCTION_ID;
133
+ exports.IsBrowserRunningProvider = IsBrowserRunningProvider = IsBrowserRunningProvider_1 = tslib_1.__decorate([
134
+ (0, inversify_1.injectable)()
135
+ ], IsBrowserRunningProvider);
136
+ let QueryDomProvider = QueryDomProvider_1 = class QueryDomProvider extends BrowserAutomationToolProvider {
137
+ getTool() {
138
+ return {
139
+ id: QueryDomProvider_1.ID,
140
+ name: QueryDomProvider_1.ID,
141
+ description: 'Query the DOM of the active page.',
142
+ parameters: {
143
+ type: 'object',
144
+ properties: {
145
+ selector: {
146
+ type: 'string',
147
+ description: `The selector of the element to get the DOM of. The selector is a
148
+ CSS selector that identifies the element. If not provided, the entire DOM will be returned.`
149
+ }
150
+ },
151
+ required: []
152
+ },
153
+ handler: async (arg) => {
154
+ try {
155
+ const { selector } = JSON.parse(arg);
156
+ return await this.browser.queryDom(selector);
157
+ }
158
+ catch (ex) {
159
+ return (`Failed to get DOM: ${ex.message}`);
160
+ }
161
+ }
162
+ };
163
+ }
164
+ };
165
+ exports.QueryDomProvider = QueryDomProvider;
166
+ QueryDomProvider.ID = app_tester_chat_functions_1.QUERY_DOM_FUNCTION_ID;
167
+ exports.QueryDomProvider = QueryDomProvider = QueryDomProvider_1 = tslib_1.__decorate([
168
+ (0, inversify_1.injectable)()
169
+ ], QueryDomProvider);
170
+ //# sourceMappingURL=app-tester-chat-functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-tester-chat-funct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AwB;AAC1B,2BAAE,GAAG,0DAA8B,AAAjC,CAAkC;mCADlC,wBAAwB;IADpC,IAAA,sBAAU,GAAE;GACA,wBAAwB,CAuBpC;AAGM,IAAM,gBAAgB,wBAAtB,MAAM,gBAAiB,SAAQ,6BAA6B;IAG/D,OAAO;QACH,OAAO;YACH,EAAE,EAAE,kBAAgB,CAAC,EAAE;YACvB,IAAI,EAAE,kBAAgB,CAAC,EAAE;YACzB,WAAW,EAAE,mCAAmC;YAChD,UAAU,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACR,QAAQ,EAAE;wBACN,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE;oHAC+E;qBAC/F;iBACJ;gBACD,QAAQ,EAAE,EAAE;aACf;YACD,OAAO,EAAE,KAAK,EAAC,GAAG,EAAC,EAAE;gBACjB,IAAI,CAAC;oBACD,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBACrC,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBACjD,CAAC;gBAAC,OAAO,EAAE,EAAE,CAAC;oBACV,OAAO,CAAC,sBAAsB,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;gBAChD,CAAC;YACL,CAAC;SACJ,CAAC;IACN,CAAC;;AA5BQ,4CAAgB;AAClB,mBAAE,GAAG,iDAAqB,AAAxB,CAAyB;2BADzB,gBAAgB;IAD5B,IAAA,sBAAU,GAAE;GACA,gBAAgB,CA6B5B"}
@@ -0,0 +1,6 @@
1
+ import { BasePromptFragment } from '@theia/ai-core/lib/common';
2
+ import { MCPServerDescription } from '@theia/ai-mcp/lib/common/mcp-server-manager';
3
+ export declare const REQUIRED_MCP_SERVERS: MCPServerDescription[];
4
+ export declare const appTesterTemplate: BasePromptFragment;
5
+ export declare const appTesterTemplateVariant: BasePromptFragment;
6
+ //# sourceMappingURL=app-tester-prompt-template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-tester-prompt-template.d.ts","sourceRoot":"","sources":["../../src/browser/app-tester-prompt-template.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAGnF,eAAO,MAAM,oBAAoB,EAAE,oBAAoB,EAmBtD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,kBAyC/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,kBAGtC,CAAC"}