@theia/ai-chat 1.67.0-next.3 → 1.67.0-next.56

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 (250) hide show
  1. package/README.md +1 -0
  2. package/package.json +9 -9
  3. package/{lib/common/context-variables.js → src/browser/context-file-validation-service.ts} +19 -7
  4. package/lib/browser/agent-delegation-tool.d.ts +0 -25
  5. package/lib/browser/agent-delegation-tool.d.ts.map +0 -1
  6. package/lib/browser/agent-delegation-tool.js +0 -196
  7. package/lib/browser/agent-delegation-tool.js.map +0 -1
  8. package/lib/browser/ai-chat-frontend-contribution.d.ts +0 -11
  9. package/lib/browser/ai-chat-frontend-contribution.d.ts.map +0 -1
  10. package/lib/browser/ai-chat-frontend-contribution.js +0 -56
  11. package/lib/browser/ai-chat-frontend-contribution.js.map +0 -1
  12. package/lib/browser/ai-chat-frontend-module.d.ts +0 -4
  13. package/lib/browser/ai-chat-frontend-module.d.ts.map +0 -1
  14. package/lib/browser/ai-chat-frontend-module.js +0 -143
  15. package/lib/browser/ai-chat-frontend-module.js.map +0 -1
  16. package/lib/browser/change-set-decorator-service.d.ts +0 -24
  17. package/lib/browser/change-set-decorator-service.d.ts.map +0 -1
  18. package/lib/browser/change-set-decorator-service.js +0 -66
  19. package/lib/browser/change-set-decorator-service.js.map +0 -1
  20. package/lib/browser/change-set-file-element-deserializer.d.ts +0 -7
  21. package/lib/browser/change-set-file-element-deserializer.d.ts.map +0 -1
  22. package/lib/browser/change-set-file-element-deserializer.js +0 -61
  23. package/lib/browser/change-set-file-element-deserializer.js.map +0 -1
  24. package/lib/browser/change-set-file-element.d.ts +0 -122
  25. package/lib/browser/change-set-file-element.d.ts.map +0 -1
  26. package/lib/browser/change-set-file-element.js +0 -435
  27. package/lib/browser/change-set-file-element.js.map +0 -1
  28. package/lib/browser/change-set-file-resource.d.ts +0 -4
  29. package/lib/browser/change-set-file-resource.d.ts.map +0 -1
  30. package/lib/browser/change-set-file-resource.js +0 -24
  31. package/lib/browser/change-set-file-resource.js.map +0 -1
  32. package/lib/browser/change-set-file-service.d.ts +0 -32
  33. package/lib/browser/change-set-file-service.d.ts.map +0 -1
  34. package/lib/browser/change-set-file-service.js +0 -161
  35. package/lib/browser/change-set-file-service.js.map +0 -1
  36. package/lib/browser/change-set-variable.d.ts +0 -11
  37. package/lib/browser/change-set-variable.d.ts.map +0 -1
  38. package/lib/browser/change-set-variable.js +0 -64
  39. package/lib/browser/change-set-variable.js.map +0 -1
  40. package/lib/browser/chat-session-store-impl.d.ts +0 -36
  41. package/lib/browser/chat-session-store-impl.d.ts.map +0 -1
  42. package/lib/browser/chat-session-store-impl.js +0 -287
  43. package/lib/browser/chat-session-store-impl.js.map +0 -1
  44. package/lib/browser/chat-tool-preference-bindings.d.ts +0 -34
  45. package/lib/browser/chat-tool-preference-bindings.d.ts.map +0 -1
  46. package/lib/browser/chat-tool-preference-bindings.js +0 -122
  47. package/lib/browser/chat-tool-preference-bindings.js.map +0 -1
  48. package/lib/browser/chat-tool-request-service.d.ts +0 -21
  49. package/lib/browser/chat-tool-request-service.d.ts.map +0 -1
  50. package/lib/browser/chat-tool-request-service.js +0 -90
  51. package/lib/browser/chat-tool-request-service.js.map +0 -1
  52. package/lib/browser/context-file-variable-label-provider.d.ts +0 -14
  53. package/lib/browser/context-file-variable-label-provider.d.ts.map +0 -1
  54. package/lib/browser/context-file-variable-label-provider.js +0 -63
  55. package/lib/browser/context-file-variable-label-provider.js.map +0 -1
  56. package/lib/browser/context-variable-label-provider.d.ts +0 -9
  57. package/lib/browser/context-variable-label-provider.d.ts.map +0 -1
  58. package/lib/browser/context-variable-label-provider.js +0 -55
  59. package/lib/browser/context-variable-label-provider.js.map +0 -1
  60. package/lib/browser/custom-agent-factory.d.ts +0 -4
  61. package/lib/browser/custom-agent-factory.d.ts.map +0 -1
  62. package/lib/browser/custom-agent-factory.js +0 -20
  63. package/lib/browser/custom-agent-factory.js.map +0 -1
  64. package/lib/browser/custom-agent-frontend-application-contribution.d.ts +0 -13
  65. package/lib/browser/custom-agent-frontend-application-contribution.d.ts.map +0 -1
  66. package/lib/browser/custom-agent-frontend-application-contribution.js +0 -83
  67. package/lib/browser/custom-agent-frontend-application-contribution.js.map +0 -1
  68. package/lib/browser/delegation-response-content.d.ts +0 -20
  69. package/lib/browser/delegation-response-content.d.ts.map +0 -1
  70. package/lib/browser/delegation-response-content.js +0 -47
  71. package/lib/browser/delegation-response-content.js.map +0 -1
  72. package/lib/browser/file-chat-variable-contribution.d.ts +0 -32
  73. package/lib/browser/file-chat-variable-contribution.d.ts.map +0 -1
  74. package/lib/browser/file-chat-variable-contribution.js +0 -241
  75. package/lib/browser/file-chat-variable-contribution.js.map +0 -1
  76. package/lib/browser/frontend-chat-service.d.ts +0 -15
  77. package/lib/browser/frontend-chat-service.d.ts.map +0 -1
  78. package/lib/browser/frontend-chat-service.js +0 -72
  79. package/lib/browser/frontend-chat-service.js.map +0 -1
  80. package/lib/browser/image-context-variable-contribution.d.ts +0 -27
  81. package/lib/browser/image-context-variable-contribution.d.ts.map +0 -1
  82. package/lib/browser/image-context-variable-contribution.js +0 -149
  83. package/lib/browser/image-context-variable-contribution.js.map +0 -1
  84. package/lib/browser/task-context-service.d.ts +0 -46
  85. package/lib/browser/task-context-service.d.ts.map +0 -1
  86. package/lib/browser/task-context-service.js +0 -256
  87. package/lib/browser/task-context-service.js.map +0 -1
  88. package/lib/browser/task-context-storage-service.d.ts +0 -19
  89. package/lib/browser/task-context-storage-service.d.ts.map +0 -1
  90. package/lib/browser/task-context-storage-service.js +0 -80
  91. package/lib/browser/task-context-storage-service.js.map +0 -1
  92. package/lib/browser/task-context-variable-contribution.d.ts +0 -20
  93. package/lib/browser/task-context-variable-contribution.d.ts.map +0 -1
  94. package/lib/browser/task-context-variable-contribution.js +0 -101
  95. package/lib/browser/task-context-variable-contribution.js.map +0 -1
  96. package/lib/browser/task-context-variable-label-provider.d.ts +0 -21
  97. package/lib/browser/task-context-variable-label-provider.d.ts.map +0 -1
  98. package/lib/browser/task-context-variable-label-provider.js +0 -83
  99. package/lib/browser/task-context-variable-label-provider.js.map +0 -1
  100. package/lib/browser/task-context-variable.d.ts +0 -3
  101. package/lib/browser/task-context-variable.d.ts.map +0 -1
  102. package/lib/browser/task-context-variable.js +0 -33
  103. package/lib/browser/task-context-variable.js.map +0 -1
  104. package/lib/common/ai-chat-preferences.d.ts +0 -5
  105. package/lib/common/ai-chat-preferences.d.ts.map +0 -1
  106. package/lib/common/ai-chat-preferences.js +0 -40
  107. package/lib/common/ai-chat-preferences.js.map +0 -1
  108. package/lib/common/change-set-element-deserializer.d.ts +0 -30
  109. package/lib/common/change-set-element-deserializer.d.ts.map +0 -1
  110. package/lib/common/change-set-element-deserializer.js +0 -81
  111. package/lib/common/change-set-element-deserializer.js.map +0 -1
  112. package/lib/common/change-set.d.ts +0 -85
  113. package/lib/common/change-set.d.ts.map +0 -1
  114. package/lib/common/change-set.js +0 -133
  115. package/lib/common/change-set.js.map +0 -1
  116. package/lib/common/chat-agent-service.d.ts +0 -46
  117. package/lib/common/chat-agent-service.d.ts.map +0 -1
  118. package/lib/common/chat-agent-service.js +0 -79
  119. package/lib/common/chat-agent-service.js.map +0 -1
  120. package/lib/common/chat-agents-variable-contribution.d.ts +0 -17
  121. package/lib/common/chat-agents-variable-contribution.d.ts.map +0 -1
  122. package/lib/common/chat-agents-variable-contribution.js +0 -67
  123. package/lib/common/chat-agents-variable-contribution.js.map +0 -1
  124. package/lib/common/chat-agents.d.ts +0 -138
  125. package/lib/common/chat-agents.d.ts.map +0 -1
  126. package/lib/common/chat-agents.js +0 -428
  127. package/lib/common/chat-agents.js.map +0 -1
  128. package/lib/common/chat-auto-save.spec.d.ts +0 -2
  129. package/lib/common/chat-auto-save.spec.d.ts.map +0 -1
  130. package/lib/common/chat-auto-save.spec.js +0 -304
  131. package/lib/common/chat-auto-save.spec.js.map +0 -1
  132. package/lib/common/chat-content-deserializer.d.ts +0 -161
  133. package/lib/common/chat-content-deserializer.d.ts.map +0 -1
  134. package/lib/common/chat-content-deserializer.js +0 -166
  135. package/lib/common/chat-content-deserializer.js.map +0 -1
  136. package/lib/common/chat-content-deserializer.spec.d.ts +0 -2
  137. package/lib/common/chat-content-deserializer.spec.d.ts.map +0 -1
  138. package/lib/common/chat-content-deserializer.spec.js +0 -307
  139. package/lib/common/chat-content-deserializer.spec.js.map +0 -1
  140. package/lib/common/chat-model-serialization.d.ts +0 -110
  141. package/lib/common/chat-model-serialization.d.ts.map +0 -1
  142. package/lib/common/chat-model-serialization.js +0 -20
  143. package/lib/common/chat-model-serialization.js.map +0 -1
  144. package/lib/common/chat-model-serialization.spec.d.ts +0 -2
  145. package/lib/common/chat-model-serialization.spec.d.ts.map +0 -1
  146. package/lib/common/chat-model-serialization.spec.js +0 -278
  147. package/lib/common/chat-model-serialization.spec.js.map +0 -1
  148. package/lib/common/chat-model-util.d.ts +0 -7
  149. package/lib/common/chat-model-util.d.ts.map +0 -1
  150. package/lib/common/chat-model-util.js +0 -50
  151. package/lib/common/chat-model-util.js.map +0 -1
  152. package/lib/common/chat-model.d.ts +0 -923
  153. package/lib/common/chat-model.d.ts.map +0 -1
  154. package/lib/common/chat-model.js +0 -1791
  155. package/lib/common/chat-model.js.map +0 -1
  156. package/lib/common/chat-request-parser.d.ts +0 -38
  157. package/lib/common/chat-request-parser.d.ts.map +0 -1
  158. package/lib/common/chat-request-parser.js +0 -230
  159. package/lib/common/chat-request-parser.js.map +0 -1
  160. package/lib/common/chat-request-parser.spec.d.ts +0 -2
  161. package/lib/common/chat-request-parser.spec.d.ts.map +0 -1
  162. package/lib/common/chat-request-parser.spec.js +0 -235
  163. package/lib/common/chat-request-parser.spec.js.map +0 -1
  164. package/lib/common/chat-service-deletion.spec.d.ts +0 -2
  165. package/lib/common/chat-service-deletion.spec.d.ts.map +0 -1
  166. package/lib/common/chat-service-deletion.spec.js +0 -221
  167. package/lib/common/chat-service-deletion.spec.js.map +0 -1
  168. package/lib/common/chat-service.d.ts +0 -153
  169. package/lib/common/chat-service.d.ts.map +0 -1
  170. package/lib/common/chat-service.js +0 -474
  171. package/lib/common/chat-service.js.map +0 -1
  172. package/lib/common/chat-session-naming-prompt-template.d.ts +0 -3
  173. package/lib/common/chat-session-naming-prompt-template.d.ts.map +0 -1
  174. package/lib/common/chat-session-naming-prompt-template.js +0 -31
  175. package/lib/common/chat-session-naming-prompt-template.js.map +0 -1
  176. package/lib/common/chat-session-naming-service.d.ts +0 -26
  177. package/lib/common/chat-session-naming-service.d.ts.map +0 -1
  178. package/lib/common/chat-session-naming-service.js +0 -119
  179. package/lib/common/chat-session-naming-service.js.map +0 -1
  180. package/lib/common/chat-session-store.d.ts +0 -43
  181. package/lib/common/chat-session-store.d.ts.map +0 -1
  182. package/lib/common/chat-session-store.js +0 -20
  183. package/lib/common/chat-session-store.js.map +0 -1
  184. package/lib/common/chat-session-summary-agent-prompt.d.ts +0 -8
  185. package/lib/common/chat-session-summary-agent-prompt.d.ts.map +0 -1
  186. package/lib/common/chat-session-summary-agent-prompt.js +0 -33
  187. package/lib/common/chat-session-summary-agent-prompt.js.map +0 -1
  188. package/lib/common/chat-session-summary-agent.d.ts +0 -16
  189. package/lib/common/chat-session-summary-agent.d.ts.map +0 -1
  190. package/lib/common/chat-session-summary-agent.js +0 -48
  191. package/lib/common/chat-session-summary-agent.js.map +0 -1
  192. package/lib/common/chat-string-utils.d.ts +0 -3
  193. package/lib/common/chat-string-utils.d.ts.map +0 -1
  194. package/lib/common/chat-string-utils.js +0 -27
  195. package/lib/common/chat-string-utils.js.map +0 -1
  196. package/lib/common/chat-tool-preferences.d.ts +0 -23
  197. package/lib/common/chat-tool-preferences.d.ts.map +0 -1
  198. package/lib/common/chat-tool-preferences.js +0 -68
  199. package/lib/common/chat-tool-preferences.js.map +0 -1
  200. package/lib/common/chat-tool-request-service.d.ts +0 -18
  201. package/lib/common/chat-tool-request-service.d.ts.map +0 -1
  202. package/lib/common/chat-tool-request-service.js +0 -52
  203. package/lib/common/chat-tool-request-service.js.map +0 -1
  204. package/lib/common/context-details-variable.d.ts +0 -9
  205. package/lib/common/context-details-variable.d.ts.map +0 -1
  206. package/lib/common/context-details-variable.js +0 -57
  207. package/lib/common/context-details-variable.js.map +0 -1
  208. package/lib/common/context-summary-variable.d.ts +0 -9
  209. package/lib/common/context-summary-variable.d.ts.map +0 -1
  210. package/lib/common/context-summary-variable.js +0 -57
  211. package/lib/common/context-summary-variable.js.map +0 -1
  212. package/lib/common/context-variables.d.ts +0 -4
  213. package/lib/common/context-variables.d.ts.map +0 -1
  214. package/lib/common/context-variables.js.map +0 -1
  215. package/lib/common/custom-chat-agent.d.ts +0 -10
  216. package/lib/common/custom-chat-agent.d.ts.map +0 -1
  217. package/lib/common/custom-chat-agent.js +0 -40
  218. package/lib/common/custom-chat-agent.js.map +0 -1
  219. package/lib/common/image-context-variable.d.ts +0 -29
  220. package/lib/common/image-context-variable.d.ts.map +0 -1
  221. package/lib/common/image-context-variable.js +0 -114
  222. package/lib/common/image-context-variable.js.map +0 -1
  223. package/lib/common/index.d.ts +0 -13
  224. package/lib/common/index.d.ts.map +0 -1
  225. package/lib/common/index.js +0 -31
  226. package/lib/common/index.js.map +0 -1
  227. package/lib/common/parse-contents-with-incomplete-parts.spec.d.ts +0 -2
  228. package/lib/common/parse-contents-with-incomplete-parts.spec.d.ts.map +0 -1
  229. package/lib/common/parse-contents-with-incomplete-parts.spec.js +0 -103
  230. package/lib/common/parse-contents-with-incomplete-parts.spec.js.map +0 -1
  231. package/lib/common/parse-contents.d.ts +0 -12
  232. package/lib/common/parse-contents.d.ts.map +0 -1
  233. package/lib/common/parse-contents.js +0 -107
  234. package/lib/common/parse-contents.js.map +0 -1
  235. package/lib/common/parse-contents.spec.d.ts +0 -10
  236. package/lib/common/parse-contents.spec.d.ts.map +0 -1
  237. package/lib/common/parse-contents.spec.js +0 -146
  238. package/lib/common/parse-contents.spec.js.map +0 -1
  239. package/lib/common/parsed-chat-request.d.ts +0 -66
  240. package/lib/common/parsed-chat-request.d.ts.map +0 -1
  241. package/lib/common/parsed-chat-request.js +0 -83
  242. package/lib/common/parsed-chat-request.js.map +0 -1
  243. package/lib/common/response-content-matcher.d.ts +0 -69
  244. package/lib/common/response-content-matcher.d.ts.map +0 -1
  245. package/lib/common/response-content-matcher.js +0 -97
  246. package/lib/common/response-content-matcher.js.map +0 -1
  247. package/lib/node/ai-chat-backend-module.d.ts +0 -4
  248. package/lib/node/ai-chat-backend-module.d.ts.map +0 -1
  249. package/lib/node/ai-chat-backend-module.js +0 -26
  250. package/lib/node/ai-chat-backend-module.js.map +0 -1
@@ -1,428 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2024 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
- /*---------------------------------------------------------------------------------------------
18
- * Copyright (c) Microsoft Corporation. All rights reserved.
19
- * Licensed under the MIT License. See License.txt in the project root for license information.
20
- *--------------------------------------------------------------------------------------------*/
21
- // Partially copied from https://github.com/microsoft/vscode/blob/a2cab7255c0df424027be05d58e1b7b941f4ea60/src/vs/workbench/contrib/chat/common/chatAgents.ts
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.AbstractStreamParsingChatAgent = exports.ToolCallChatResponseContentFactory = exports.AbstractTextToModelParsingChatAgent = exports.AbstractChatAgent = exports.ChatAgent = exports.ChatAgentLocation = exports.ChatSessionContext = exports.SystemMessageDescription = void 0;
24
- const tslib_1 = require("tslib");
25
- const ai_core_1 = require("@theia/ai-core");
26
- const common_1 = require("@theia/ai-core/lib/common");
27
- const core_1 = require("@theia/core");
28
- const inversify_1 = require("@theia/core/shared/inversify");
29
- const chat_model_1 = require("./chat-model");
30
- const chat_tool_request_service_1 = require("./chat-tool-request-service");
31
- const parse_contents_1 = require("./parse-contents");
32
- const response_content_matcher_1 = require("./response-content-matcher");
33
- const image_context_variable_1 = require("./image-context-variable");
34
- var SystemMessageDescription;
35
- (function (SystemMessageDescription) {
36
- function fromResolvedPromptFragment(resolvedPrompt) {
37
- return {
38
- text: resolvedPrompt.text,
39
- functionDescriptions: resolvedPrompt.functionDescriptions
40
- };
41
- }
42
- SystemMessageDescription.fromResolvedPromptFragment = fromResolvedPromptFragment;
43
- })(SystemMessageDescription || (exports.SystemMessageDescription = SystemMessageDescription = {}));
44
- var ChatSessionContext;
45
- (function (ChatSessionContext) {
46
- function is(candidate) {
47
- return typeof candidate === 'object' && !!candidate && 'model' in candidate;
48
- }
49
- ChatSessionContext.is = is;
50
- function getVariables(context) {
51
- var _a, _b;
52
- return (_b = (_a = context.request) === null || _a === void 0 ? void 0 : _a.context.variables.map(ai_core_1.AIVariableResolutionRequest.fromResolved)) !== null && _b !== void 0 ? _b : context.model.context.getVariables();
53
- }
54
- ChatSessionContext.getVariables = getVariables;
55
- })(ChatSessionContext || (exports.ChatSessionContext = ChatSessionContext = {}));
56
- /**
57
- * The location from where an chat agent may be invoked.
58
- * Based on the location, a different context may be available.
59
- */
60
- var ChatAgentLocation;
61
- (function (ChatAgentLocation) {
62
- ChatAgentLocation["Panel"] = "panel";
63
- ChatAgentLocation["Terminal"] = "terminal";
64
- ChatAgentLocation["Notebook"] = "notebook";
65
- ChatAgentLocation["Editor"] = "editor";
66
- })(ChatAgentLocation || (exports.ChatAgentLocation = ChatAgentLocation = {}));
67
- (function (ChatAgentLocation) {
68
- ChatAgentLocation.ALL = [ChatAgentLocation.Panel, ChatAgentLocation.Terminal, ChatAgentLocation.Notebook, ChatAgentLocation.Editor];
69
- function fromRaw(value) {
70
- switch (value) {
71
- case 'panel': return ChatAgentLocation.Panel;
72
- case 'terminal': return ChatAgentLocation.Terminal;
73
- case 'notebook': return ChatAgentLocation.Notebook;
74
- case 'editor': return ChatAgentLocation.Editor;
75
- }
76
- return ChatAgentLocation.Panel;
77
- }
78
- ChatAgentLocation.fromRaw = fromRaw;
79
- })(ChatAgentLocation || (exports.ChatAgentLocation = ChatAgentLocation = {}));
80
- exports.ChatAgent = Symbol('ChatAgent');
81
- let AbstractChatAgent = class AbstractChatAgent {
82
- constructor() {
83
- this.iconClass = 'codicon codicon-copilot';
84
- this.locations = ChatAgentLocation.ALL;
85
- this.tags = [core_1.nls.localizeByDefault('Chat')];
86
- this.description = '';
87
- this.variables = [];
88
- this.prompts = [];
89
- this.agentSpecificVariables = [];
90
- this.functions = [];
91
- this.systemPromptId = undefined;
92
- this.additionalToolRequests = [];
93
- this.contentMatchers = [];
94
- }
95
- init() {
96
- this.initializeContentMatchers();
97
- }
98
- initializeContentMatchers() {
99
- const contributedContentMatchers = this.contentMatcherProviders.getContributions().flatMap(provider => provider.matchers);
100
- this.contentMatchers.push(...contributedContentMatchers);
101
- }
102
- async invoke(request) {
103
- var _a;
104
- try {
105
- const languageModel = await this.getLanguageModel(this.defaultLanguageModelPurpose);
106
- if (!languageModel) {
107
- throw new Error(core_1.nls.localize('theia/ai/chat/couldNotFindMatchingLM', 'Couldn\'t find a matching language model. Please check your setup!'));
108
- }
109
- const systemMessageDescription = await this.getSystemMessageDescription({ model: request.session, request });
110
- const messages = await this.getMessages(request.session);
111
- if (systemMessageDescription) {
112
- const systemMsg = {
113
- actor: 'system',
114
- type: 'text',
115
- text: systemMessageDescription.text
116
- };
117
- // insert system message at the beginning of the request messages
118
- messages.unshift(systemMsg);
119
- }
120
- const systemMessageToolRequests = (_a = systemMessageDescription === null || systemMessageDescription === void 0 ? void 0 : systemMessageDescription.functionDescriptions) === null || _a === void 0 ? void 0 : _a.values();
121
- const tools = [
122
- ...this.chatToolRequestService.getChatToolRequests(request),
123
- ...this.chatToolRequestService.toChatToolRequests(systemMessageToolRequests ? Array.from(systemMessageToolRequests) : [], request),
124
- ...this.chatToolRequestService.toChatToolRequests(this.additionalToolRequests, request)
125
- ];
126
- const languageModelResponse = await this.sendLlmRequest(request, messages, tools, languageModel);
127
- await this.addContentsToResponse(languageModelResponse, request);
128
- await this.onResponseComplete(request);
129
- }
130
- catch (e) {
131
- this.handleError(request, e);
132
- }
133
- }
134
- parseContents(text, request) {
135
- var _a;
136
- return (0, parse_contents_1.parseContents)(text, request, this.contentMatchers, (_a = this.defaultContentFactory) === null || _a === void 0 ? void 0 : _a.create.bind(this.defaultContentFactory));
137
- }
138
- ;
139
- handleError(request, error) {
140
- console.error('Error handling chat interaction:', error);
141
- request.response.response.addContent(new chat_model_1.ErrorChatResponseContentImpl(error));
142
- request.response.error(error);
143
- }
144
- getLanguageModelSelector(languageModelPurpose) {
145
- return this.languageModelRequirements.find(req => req.purpose === languageModelPurpose);
146
- }
147
- async getLanguageModel(languageModelPurpose) {
148
- return this.selectLanguageModel(this.getLanguageModelSelector(languageModelPurpose));
149
- }
150
- async selectLanguageModel(selector) {
151
- const languageModel = await this.languageModelRegistry.selectLanguageModel({ agent: this.id, ...selector });
152
- if (!languageModel) {
153
- throw new Error(core_1.nls.localize('theia/ai/chat/couldNotFindReadyLMforAgent', 'Couldn\'t find a ready language model for agent {0}. Please check your setup!', this.id));
154
- }
155
- return languageModel;
156
- }
157
- async getSystemMessageDescription(context) {
158
- if (this.systemPromptId === undefined) {
159
- return undefined;
160
- }
161
- const resolvedPrompt = await this.promptService.getResolvedPromptFragment(this.systemPromptId, undefined, context);
162
- return resolvedPrompt ? SystemMessageDescription.fromResolvedPromptFragment(resolvedPrompt) : undefined;
163
- }
164
- async getMessages(model, includeResponseInProgress = false) {
165
- const requestMessages = model.getRequests().flatMap(request => {
166
- const messages = [];
167
- const text = request.message.parts.map(part => part.promptText).join('');
168
- if (text.length > 0) {
169
- messages.push({
170
- actor: 'user',
171
- type: 'text',
172
- text: text,
173
- });
174
- }
175
- const imageMessages = request.context.variables
176
- .filter(variable => image_context_variable_1.ImageContextVariable.isResolvedImageContext(variable))
177
- .map(variable => image_context_variable_1.ImageContextVariable.parseResolved(variable))
178
- .filter(content => content !== undefined)
179
- .map(content => ({
180
- actor: 'user',
181
- type: 'image',
182
- image: {
183
- base64data: content.data,
184
- mimeType: content.mimeType
185
- }
186
- }));
187
- messages.push(...imageMessages);
188
- if (request.response.isComplete || includeResponseInProgress) {
189
- const responseMessages = request.response.response.content
190
- .filter(c => {
191
- // we do not send errors or informational content
192
- if (chat_model_1.ErrorChatResponseContent.is(c) || chat_model_1.InformationalChatResponseContent.is(c)) {
193
- return false;
194
- }
195
- // content even has an own converter, definitely include it
196
- if (chat_model_1.ChatResponseContent.hasToLanguageModelMessage(c)) {
197
- return true;
198
- }
199
- // make sure content did not indicate to be excluded by returning undefined in asString
200
- if (chat_model_1.ChatResponseContent.hasAsString(c) && c.asString() === undefined) {
201
- return false;
202
- }
203
- // include the rest
204
- return true;
205
- })
206
- .flatMap(c => {
207
- var _a, _b;
208
- if (chat_model_1.ChatResponseContent.hasToLanguageModelMessage(c)) {
209
- return c.toLanguageModelMessage();
210
- }
211
- return {
212
- actor: 'ai',
213
- type: 'text',
214
- text: ((_a = c.asString) === null || _a === void 0 ? void 0 : _a.call(c)) || ((_b = c.asDisplayString) === null || _b === void 0 ? void 0 : _b.call(c)) || '',
215
- };
216
- });
217
- messages.push(...responseMessages);
218
- }
219
- return messages;
220
- });
221
- return requestMessages;
222
- }
223
- /**
224
- * Deduplicate tools by name (falling back to id) while preserving the first occurrence and order.
225
- */
226
- deduplicateTools(toolRequests) {
227
- var _a;
228
- const seen = new Set();
229
- const deduped = [];
230
- for (const tool of toolRequests) {
231
- const key = (_a = tool.name) !== null && _a !== void 0 ? _a : tool.id;
232
- if (!seen.has(key)) {
233
- seen.add(key);
234
- deduped.push(tool);
235
- }
236
- }
237
- return deduped;
238
- }
239
- async sendLlmRequest(request, messages, toolRequests, languageModel) {
240
- const agentSettings = this.getLlmSettings();
241
- const settings = { ...agentSettings, ...request.session.settings };
242
- const dedupedTools = this.deduplicateTools(toolRequests);
243
- const tools = dedupedTools.length > 0 ? dedupedTools : undefined;
244
- return this.languageModelService.sendRequest(languageModel, {
245
- messages,
246
- tools,
247
- settings,
248
- agentId: this.id,
249
- sessionId: request.session.id,
250
- requestId: request.id,
251
- cancellationToken: request.response.cancellationToken
252
- });
253
- }
254
- /**
255
- * @returns the settings, such as `temperature`, to be used in all language model requests. Returns `undefined` by default.
256
- */
257
- getLlmSettings() {
258
- return undefined;
259
- }
260
- /**
261
- * Invoked after the response by the LLM completed successfully.
262
- *
263
- * The default implementation sets the state of the response to `complete`.
264
- * Subclasses may override this method to perform additional actions or keep the response open for processing further requests.
265
- */
266
- async onResponseComplete(request) {
267
- return request.response.complete();
268
- }
269
- };
270
- exports.AbstractChatAgent = AbstractChatAgent;
271
- tslib_1.__decorate([
272
- (0, inversify_1.inject)(common_1.LanguageModelRegistry),
273
- tslib_1.__metadata("design:type", Object)
274
- ], AbstractChatAgent.prototype, "languageModelRegistry", void 0);
275
- tslib_1.__decorate([
276
- (0, inversify_1.inject)(core_1.ILogger),
277
- tslib_1.__metadata("design:type", Object)
278
- ], AbstractChatAgent.prototype, "logger", void 0);
279
- tslib_1.__decorate([
280
- (0, inversify_1.inject)(chat_tool_request_service_1.ChatToolRequestService),
281
- tslib_1.__metadata("design:type", chat_tool_request_service_1.ChatToolRequestService)
282
- ], AbstractChatAgent.prototype, "chatToolRequestService", void 0);
283
- tslib_1.__decorate([
284
- (0, inversify_1.inject)(ai_core_1.LanguageModelService),
285
- tslib_1.__metadata("design:type", Object)
286
- ], AbstractChatAgent.prototype, "languageModelService", void 0);
287
- tslib_1.__decorate([
288
- (0, inversify_1.inject)(ai_core_1.PromptService),
289
- tslib_1.__metadata("design:type", Object)
290
- ], AbstractChatAgent.prototype, "promptService", void 0);
291
- tslib_1.__decorate([
292
- (0, inversify_1.inject)(core_1.ContributionProvider),
293
- (0, inversify_1.named)(response_content_matcher_1.ResponseContentMatcherProvider),
294
- tslib_1.__metadata("design:type", Object)
295
- ], AbstractChatAgent.prototype, "contentMatcherProviders", void 0);
296
- tslib_1.__decorate([
297
- (0, inversify_1.inject)(response_content_matcher_1.DefaultResponseContentFactory),
298
- tslib_1.__metadata("design:type", response_content_matcher_1.DefaultResponseContentFactory)
299
- ], AbstractChatAgent.prototype, "defaultContentFactory", void 0);
300
- tslib_1.__decorate([
301
- (0, inversify_1.postConstruct)(),
302
- tslib_1.__metadata("design:type", Function),
303
- tslib_1.__metadata("design:paramtypes", []),
304
- tslib_1.__metadata("design:returntype", void 0)
305
- ], AbstractChatAgent.prototype, "init", null);
306
- exports.AbstractChatAgent = AbstractChatAgent = tslib_1.__decorate([
307
- (0, inversify_1.injectable)()
308
- ], AbstractChatAgent);
309
- let AbstractTextToModelParsingChatAgent = class AbstractTextToModelParsingChatAgent extends AbstractChatAgent {
310
- async addContentsToResponse(languageModelResponse, request) {
311
- const responseAsText = await (0, ai_core_1.getTextOfResponse)(languageModelResponse);
312
- const parsedCommand = await this.parseTextResponse(responseAsText);
313
- const content = this.createResponseContent(parsedCommand, request);
314
- request.response.response.addContent(content);
315
- }
316
- };
317
- exports.AbstractTextToModelParsingChatAgent = AbstractTextToModelParsingChatAgent;
318
- exports.AbstractTextToModelParsingChatAgent = AbstractTextToModelParsingChatAgent = tslib_1.__decorate([
319
- (0, inversify_1.injectable)()
320
- ], AbstractTextToModelParsingChatAgent);
321
- /**
322
- * Factory for creating ToolCallChatResponseContent instances.
323
- */
324
- let ToolCallChatResponseContentFactory = class ToolCallChatResponseContentFactory {
325
- create(toolCall) {
326
- var _a, _b;
327
- return new chat_model_1.ToolCallChatResponseContentImpl(toolCall.id, (_a = toolCall.function) === null || _a === void 0 ? void 0 : _a.name, (_b = toolCall.function) === null || _b === void 0 ? void 0 : _b.arguments, toolCall.finished, toolCall.result);
328
- }
329
- };
330
- exports.ToolCallChatResponseContentFactory = ToolCallChatResponseContentFactory;
331
- exports.ToolCallChatResponseContentFactory = ToolCallChatResponseContentFactory = tslib_1.__decorate([
332
- (0, inversify_1.injectable)()
333
- ], ToolCallChatResponseContentFactory);
334
- let AbstractStreamParsingChatAgent = class AbstractStreamParsingChatAgent extends AbstractChatAgent {
335
- async addContentsToResponse(languageModelResponse, request) {
336
- if ((0, common_1.isLanguageModelTextResponse)(languageModelResponse)) {
337
- const contents = this.parseContents(languageModelResponse.text, request);
338
- request.response.response.addContents(contents);
339
- return;
340
- }
341
- if ((0, common_1.isLanguageModelStreamResponse)(languageModelResponse)) {
342
- await this.addStreamResponse(languageModelResponse, request);
343
- return;
344
- }
345
- this.logger.error('Received unknown response in agent. Return response as text');
346
- request.response.response.addContent(new chat_model_1.MarkdownChatResponseContentImpl(JSON.stringify(languageModelResponse)));
347
- }
348
- async addStreamResponse(languageModelResponse, request) {
349
- let completeTextBuffer = '';
350
- let startIndex = request.response.response.content.length;
351
- for await (const token of languageModelResponse.stream) {
352
- // Skip unknown tokens. For example OpenAI sends empty tokens around tool calls
353
- if (!(0, ai_core_1.isLanguageModelStreamResponsePart)(token)) {
354
- console.debug(`Unknown token: '${JSON.stringify(token)}'. Skipping`);
355
- continue;
356
- }
357
- const newContent = this.parse(token, request);
358
- if (!(0, ai_core_1.isTextResponsePart)(token)) {
359
- // For non-text tokens (like tool calls), add them directly
360
- if ((0, core_1.isArray)(newContent)) {
361
- request.response.response.addContents(newContent);
362
- }
363
- else {
364
- request.response.response.addContent(newContent);
365
- }
366
- // And reset the marker index and the text buffer as we skip matching across non-text tokens
367
- startIndex = request.response.response.content.length;
368
- completeTextBuffer = '';
369
- }
370
- else {
371
- // parse the entire text so far (since beginning of the stream or last non-text token)
372
- // and replace the entire content with the currently parsed content parts
373
- completeTextBuffer += token.content;
374
- const parsedContents = this.parseContents(completeTextBuffer, request);
375
- const contentBeforeMarker = startIndex > 0
376
- ? request.response.response.content.slice(0, startIndex)
377
- : [];
378
- request.response.response.clearContent();
379
- request.response.response.addContents(contentBeforeMarker);
380
- request.response.response.addContents(parsedContents);
381
- }
382
- }
383
- }
384
- parse(token, request) {
385
- if ((0, ai_core_1.isTextResponsePart)(token)) {
386
- const content = token.content;
387
- // eslint-disable-next-line no-null/no-null
388
- if (content !== undefined && content !== null) {
389
- return this.defaultContentFactory.create(content, request);
390
- }
391
- }
392
- if ((0, ai_core_1.isToolCallResponsePart)(token)) {
393
- const toolCalls = token.tool_calls;
394
- if (toolCalls !== undefined) {
395
- const toolCallContents = toolCalls.map(toolCall => this.createToolCallResponseContent(toolCall));
396
- return toolCallContents;
397
- }
398
- }
399
- if ((0, ai_core_1.isThinkingResponsePart)(token)) {
400
- return new chat_model_1.ThinkingChatResponseContentImpl(token.thought, token.signature);
401
- }
402
- if ((0, ai_core_1.isUsageResponsePart)(token)) {
403
- return [];
404
- }
405
- return this.defaultContentFactory.create('', request);
406
- }
407
- /**
408
- * Creates a ToolCallChatResponseContent instance from the provided tool call data.
409
- *
410
- * This method is called when parsing stream response tokens that contain tool call data.
411
- * Subclasses can override this method to customize the creation of tool call response contents.
412
- *
413
- * @param toolCall The ToolCall.
414
- * @returns A ChatResponseContent representing the tool call.
415
- */
416
- createToolCallResponseContent(toolCall) {
417
- return this.toolCallResponseContentFactory.create(toolCall);
418
- }
419
- };
420
- exports.AbstractStreamParsingChatAgent = AbstractStreamParsingChatAgent;
421
- tslib_1.__decorate([
422
- (0, inversify_1.inject)(ToolCallChatResponseContentFactory),
423
- tslib_1.__metadata("design:type", ToolCallChatResponseContentFactory)
424
- ], AbstractStreamParsingChatAgent.prototype, "toolCallResponseContentFactory", void 0);
425
- exports.AbstractStreamParsingChatAgent = AbstractStreamParsingChatAgent = tslib_1.__decorate([
426
- (0, inversify_1.injectable)()
427
- ], AbstractStreamParsingChatAgent);
428
- //# sourceMappingURL=chat-agents.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chat-agents.js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IAAA,sBAAU,GAAE;GACS,8BAA8B,CAmGnD"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=chat-auto-save.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chat-auto-save.spec.d.ts","sourceRoot":"","sources":["../../src/common/chat-auto-save.spec.ts"],"names":[],"mappings":""}