@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,10 +0,0 @@
1
- import { ChatResponseContent } from './chat-model';
2
- import { ResponseContentMatcher } from './response-content-matcher';
3
- export declare const TestCodeContentMatcher: ResponseContentMatcher;
4
- export declare class CommandChatResponseContentImpl implements ChatResponseContent {
5
- readonly command: string;
6
- constructor(command: string);
7
- kind: string;
8
- }
9
- export declare const CommandContentMatcher: ResponseContentMatcher;
10
- //# sourceMappingURL=parse-contents.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-contents.spec.d.ts","sourceRoot":"","sources":["../../src/common/parse-contents.spec.ts"],"names":[],"mappings":"AAiBA,OAAO,EAA2B,mBAAmB,EAAgE,MAAM,cAAc,CAAC;AAE1I,OAAO,EAAsB,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAExF,eAAO,MAAM,sBAAsB,EAAE,sBAQpC,CAAC;AAEF,qBAAa,8BAA+B,YAAW,mBAAmB;aAC1C,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;IAC3C,IAAI,SAAa;CACpB;AAED,eAAO,MAAM,qBAAqB,EAAE,sBAOnC,CAAC"}
@@ -1,146 +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
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.CommandContentMatcher = exports.CommandChatResponseContentImpl = exports.TestCodeContentMatcher = void 0;
19
- const chai_1 = require("chai");
20
- const chat_model_1 = require("./chat-model");
21
- const parse_contents_1 = require("./parse-contents");
22
- const response_content_matcher_1 = require("./response-content-matcher");
23
- exports.TestCodeContentMatcher = {
24
- start: /^```.*?$/m,
25
- end: /^```$/m,
26
- contentFactory: (content) => {
27
- var _a;
28
- const language = ((_a = content.match(/^```(\w+)/)) === null || _a === void 0 ? void 0 : _a[1]) || '';
29
- const code = content.replace(/^```(\w+)\n|```$/g, '');
30
- return new chat_model_1.CodeChatResponseContentImpl(code.trim(), language);
31
- }
32
- };
33
- class CommandChatResponseContentImpl {
34
- constructor(command) {
35
- this.command = command;
36
- this.kind = 'command';
37
- }
38
- }
39
- exports.CommandChatResponseContentImpl = CommandChatResponseContentImpl;
40
- exports.CommandContentMatcher = {
41
- start: /^<command>$/m,
42
- end: /^<\/command>$/m,
43
- contentFactory: (content) => {
44
- const code = content.replace(/^<command>\n|<\/command>$/g, '');
45
- return new CommandChatResponseContentImpl(code.trim());
46
- }
47
- };
48
- const fakeRequest = {};
49
- describe('parseContents', () => {
50
- it('should parse code content', () => {
51
- const text = '```typescript\nconsole.log("Hello World");\n```';
52
- const result = (0, parse_contents_1.parseContents)(text, fakeRequest, [exports.TestCodeContentMatcher]);
53
- (0, chai_1.expect)(result).to.deep.equal([new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript')]);
54
- });
55
- it('should parse markdown content', () => {
56
- const text = 'Hello **World**';
57
- const result = (0, parse_contents_1.parseContents)(text, fakeRequest, [exports.TestCodeContentMatcher]);
58
- (0, chai_1.expect)(result).to.deep.equal([new chat_model_1.MarkdownChatResponseContentImpl('Hello **World**')]);
59
- });
60
- it('should parse multiple content blocks', () => {
61
- const text = '```typescript\nconsole.log("Hello World");\n```\nHello **World**';
62
- const result = (0, parse_contents_1.parseContents)(text, fakeRequest, [exports.TestCodeContentMatcher]);
63
- (0, chai_1.expect)(result).to.deep.equal([
64
- new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript'),
65
- new chat_model_1.MarkdownChatResponseContentImpl('\nHello **World**')
66
- ]);
67
- });
68
- it('should parse multiple content blocks with different languages', () => {
69
- const text = '```typescript\nconsole.log("Hello World");\n```\n```python\nprint("Hello World")\n```';
70
- const result = (0, parse_contents_1.parseContents)(text, fakeRequest, [exports.TestCodeContentMatcher]);
71
- (0, chai_1.expect)(result).to.deep.equal([
72
- new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript'),
73
- new chat_model_1.CodeChatResponseContentImpl('print("Hello World")', 'python')
74
- ]);
75
- });
76
- it('should parse multiple content blocks with different languages and markdown', () => {
77
- const text = '```typescript\nconsole.log("Hello World");\n```\nHello **World**\n```python\nprint("Hello World")\n```';
78
- const result = (0, parse_contents_1.parseContents)(text, fakeRequest, [exports.TestCodeContentMatcher]);
79
- (0, chai_1.expect)(result).to.deep.equal([
80
- new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript'),
81
- new chat_model_1.MarkdownChatResponseContentImpl('\nHello **World**\n'),
82
- new chat_model_1.CodeChatResponseContentImpl('print("Hello World")', 'python')
83
- ]);
84
- });
85
- it('should parse content blocks with empty content', () => {
86
- const text = '```typescript\n```\nHello **World**\n```python\nprint("Hello World")\n```';
87
- const result = (0, parse_contents_1.parseContents)(text, fakeRequest, [exports.TestCodeContentMatcher]);
88
- (0, chai_1.expect)(result).to.deep.equal([
89
- new chat_model_1.CodeChatResponseContentImpl('', 'typescript'),
90
- new chat_model_1.MarkdownChatResponseContentImpl('\nHello **World**\n'),
91
- new chat_model_1.CodeChatResponseContentImpl('print("Hello World")', 'python')
92
- ]);
93
- });
94
- it('should parse content with markdown, code, and markdown', () => {
95
- const text = 'Hello **World**\n```typescript\nconsole.log("Hello World");\n```\nGoodbye **World**';
96
- const result = (0, parse_contents_1.parseContents)(text, fakeRequest, [exports.TestCodeContentMatcher]);
97
- (0, chai_1.expect)(result).to.deep.equal([
98
- new chat_model_1.MarkdownChatResponseContentImpl('Hello **World**\n'),
99
- new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript'),
100
- new chat_model_1.MarkdownChatResponseContentImpl('\nGoodbye **World**')
101
- ]);
102
- });
103
- it('should handle text with no special content', () => {
104
- const text = 'Just some plain text.';
105
- const result = (0, parse_contents_1.parseContents)(text, fakeRequest, [exports.TestCodeContentMatcher]);
106
- (0, chai_1.expect)(result).to.deep.equal([new chat_model_1.MarkdownChatResponseContentImpl('Just some plain text.')]);
107
- });
108
- it('should handle text with only start code block', () => {
109
- const text = '```typescript\nconsole.log("Hello World");';
110
- // We're using the standard CodeContentMatcher which has incompleteContentFactory
111
- const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
112
- (0, chai_1.expect)(result).to.deep.equal([new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript')]);
113
- });
114
- it('should handle text with only end code block', () => {
115
- const text = 'console.log("Hello World");\n```';
116
- const result = (0, parse_contents_1.parseContents)(text, fakeRequest, [exports.TestCodeContentMatcher]);
117
- (0, chai_1.expect)(result).to.deep.equal([new chat_model_1.MarkdownChatResponseContentImpl('console.log("Hello World");\n```')]);
118
- });
119
- it('should handle text with unmatched code block', () => {
120
- const text = '```typescript\nconsole.log("Hello World");\n```\n```python\nprint("Hello World")';
121
- // We're using the standard CodeContentMatcher which has incompleteContentFactory
122
- const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
123
- (0, chai_1.expect)(result).to.deep.equal([
124
- new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript'),
125
- new chat_model_1.CodeChatResponseContentImpl('print("Hello World")', 'python')
126
- ]);
127
- });
128
- it('should parse code block without newline after language', () => {
129
- const text = '```typescript console.log("Hello World");```';
130
- const result = (0, parse_contents_1.parseContents)(text, fakeRequest, [exports.TestCodeContentMatcher]);
131
- (0, chai_1.expect)(result).to.deep.equal([
132
- new chat_model_1.MarkdownChatResponseContentImpl('```typescript console.log("Hello World");```')
133
- ]);
134
- });
135
- it('should parse with matches of multiple different matchers and default', () => {
136
- const text = '<command>\nMY_SPECIAL_COMMAND\n</command>\nHello **World**\n```python\nprint("Hello World")\n```\n<command>\nMY_SPECIAL_COMMAND2\n</command>';
137
- const result = (0, parse_contents_1.parseContents)(text, fakeRequest, [response_content_matcher_1.CodeContentMatcher, exports.CommandContentMatcher]);
138
- (0, chai_1.expect)(result).to.deep.equal([
139
- new CommandChatResponseContentImpl('MY_SPECIAL_COMMAND'),
140
- new chat_model_1.MarkdownChatResponseContentImpl('\nHello **World**\n'),
141
- new chat_model_1.CodeChatResponseContentImpl('print("Hello World")', 'python'),
142
- new CommandChatResponseContentImpl('MY_SPECIAL_COMMAND2'),
143
- ]);
144
- });
145
- });
146
- //# sourceMappingURL=parse-contents.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-contents.spec.js","sourceRoot":"","sources":["../../src/common/parse-contents.spec.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;;;AAEhF,+BAA8B;AAC9B,6CAA0I;AAC1I,qDAAiD;AACjD,yEAAwF;AAE3E,QAAA,sBAAsB,GAA2B;IAC1D,KAAK,EAAE,W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I,EAAE,WAAW,CAAC,CAAC;QAChD,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YACzB,IAAI,wCAA2B,CAAC,6BAA6B,EAAE,YAAY,CAAC;YAC5E,IAAI,wCAA2B,CAAC,sBAAsB,EAAE,QAAQ,CAAC;SACpE,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAC9D,MAAM,IAAI,GAAG,8CAA8C,CAAC;QAC5D,MAAM,MAAM,GAAG,IAAA,8BAAa,EAAC,IAAI,EAAE,WAAW,EAAE,CAAC,8BAAsB,CAAC,CAAC,CAAC;QAC1E,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YACzB,IAAI,4CAA+B,CAAC,8CAA8C,CAAC;SACtF,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sEAAsE,EAAE,GAAG,EAAE;QAC5E,MAAM,IAAI,GAAG,8IAA8I,CAAC;QAC5J,MAAM,MAAM,GAAG,IAAA,8BAAa,EAAC,IAAI,EAAE,WAAW,EAAE,CAAC,6CAAkB,EAAE,6BAAqB,CAAC,CAAC,CAAC;QAC7F,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YACzB,IAAI,8BAA8B,CAAC,oBAAoB,CAAC;YACxD,IAAI,4CAA+B,CAAC,qBAAqB,CAAC;YAC1D,IAAI,wCAA2B,CAAC,sBAAsB,EAAE,QAAQ,CAAC;YACjE,IAAI,8BAA8B,CAAC,qBAAqB,CAAC;SAC5D,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,66 +0,0 @@
1
- import { ResolvedAIVariable, ToolRequest } from '@theia/ai-core';
2
- import { ChatRequest } from './chat-model';
3
- export declare const chatVariableLeader = "#";
4
- export declare const chatAgentLeader = "@";
5
- export declare const chatFunctionLeader = "~";
6
- export declare const chatSubcommandLeader = "/";
7
- /**********************
8
- * INTERFACES AND TYPE GUARDS
9
- **********************/
10
- export interface OffsetRange {
11
- readonly start: number;
12
- readonly endExclusive: number;
13
- }
14
- export interface ParsedChatRequest {
15
- readonly request: ChatRequest;
16
- readonly parts: ParsedChatRequestPart[];
17
- readonly toolRequests: Map<string, ToolRequest>;
18
- readonly variables: ResolvedAIVariable[];
19
- }
20
- export interface ParsedChatRequestPart {
21
- readonly kind: string;
22
- /**
23
- * The text as represented in the ChatRequest
24
- */
25
- readonly text: string;
26
- /**
27
- * The text as will be sent to the LLM
28
- */
29
- readonly promptText: string;
30
- readonly range: OffsetRange;
31
- }
32
- export declare class ParsedChatRequestTextPart implements ParsedChatRequestPart {
33
- readonly range: OffsetRange;
34
- readonly text: string;
35
- readonly kind: 'text';
36
- constructor(range: OffsetRange, text: string);
37
- get promptText(): string;
38
- }
39
- export declare class ParsedChatRequestVariablePart implements ParsedChatRequestPart {
40
- readonly range: OffsetRange;
41
- readonly variableName: string;
42
- readonly variableArg: string | undefined;
43
- readonly kind: 'var';
44
- resolution: ResolvedAIVariable;
45
- constructor(range: OffsetRange, variableName: string, variableArg: string | undefined);
46
- get text(): string;
47
- get promptText(): string;
48
- }
49
- export declare class ParsedChatRequestFunctionPart implements ParsedChatRequestPart {
50
- readonly range: OffsetRange;
51
- readonly toolRequest: ToolRequest;
52
- readonly kind: 'function';
53
- constructor(range: OffsetRange, toolRequest: ToolRequest);
54
- get text(): string;
55
- get promptText(): string;
56
- }
57
- export declare class ParsedChatRequestAgentPart implements ParsedChatRequestPart {
58
- readonly range: OffsetRange;
59
- readonly agentId: string;
60
- readonly agentName: string;
61
- readonly kind: 'agent';
62
- constructor(range: OffsetRange, agentId: string, agentName: string);
63
- get text(): string;
64
- get promptText(): string;
65
- }
66
- //# sourceMappingURL=parsed-chat-request.d.ts.map
@@ -1 +0,0 @@
1
- {"version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,YAAW,qBAAqB;IAK3D,QAAQ,CAAC,KAAK,EAAE,WAAW;IAAE,QAAQ,CAAC,YAAY,EAAE,MAAM;IAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS;IAJhH,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAEd,UAAU,EAAE,kBAAkB,CAAC;gBAEjB,KAAK,EAAE,WAAW,EAAW,YAAY,EAAE,MAAM,EAAW,WAAW,EAAE,MAAM,GAAG,SAAS;IAEhH,IAAI,IAAI,IAAI,MAAM,CAGjB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;CACJ;AAED,qBAAa,6BAA8B,YAAW,qBAAqB;IAE3D,QAAQ,CAAC,KAAK,EAAE,WAAW;IAAE,QAAQ,CAAC,WAAW,EAAE,WAAW;IAD1E,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;gBACL,KAAK,EAAE,WAAW,EAAW,WAAW,EAAE,WAAW;IAE1E,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;CACJ;AAED,qBAAa,0BAA2B,YAAW,qBAAqB;IAExD,QAAQ,CAAC,KAAK,EAAE,WAAW;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM;IAD7F,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;gBACF,KAAK,EAAE,WAAW,EAAW,OAAO,EAAE,MAAM,EAAW,SAAS,EAAE,MAAM;IAE7F,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;CACJ"}
@@ -1,83 +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/chatParserTypes.ts
22
- // Partially copied from https://github.com/microsoft/vscode/blob/a2cab7255c0df424027be05d58e1b7b941f4ea60/src/vs/editor/common/core/offsetRange.ts
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.ParsedChatRequestAgentPart = exports.ParsedChatRequestFunctionPart = exports.ParsedChatRequestVariablePart = exports.ParsedChatRequestTextPart = exports.chatSubcommandLeader = exports.chatFunctionLeader = exports.chatAgentLeader = exports.chatVariableLeader = void 0;
25
- const ai_core_1 = require("@theia/ai-core");
26
- exports.chatVariableLeader = '#';
27
- exports.chatAgentLeader = '@';
28
- exports.chatFunctionLeader = '~';
29
- exports.chatSubcommandLeader = '/';
30
- class ParsedChatRequestTextPart {
31
- constructor(range, text) {
32
- this.range = range;
33
- this.text = text;
34
- }
35
- get promptText() {
36
- return this.text;
37
- }
38
- }
39
- exports.ParsedChatRequestTextPart = ParsedChatRequestTextPart;
40
- class ParsedChatRequestVariablePart {
41
- constructor(range, variableName, variableArg) {
42
- this.range = range;
43
- this.variableName = variableName;
44
- this.variableArg = variableArg;
45
- }
46
- get text() {
47
- const argPart = this.variableArg ? `:${this.variableArg}` : '';
48
- return `${exports.chatVariableLeader}${this.variableName}${argPart}`;
49
- }
50
- get promptText() {
51
- var _a, _b;
52
- return (_b = (_a = this.resolution) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : this.text;
53
- }
54
- }
55
- exports.ParsedChatRequestVariablePart = ParsedChatRequestVariablePart;
56
- class ParsedChatRequestFunctionPart {
57
- constructor(range, toolRequest) {
58
- this.range = range;
59
- this.toolRequest = toolRequest;
60
- }
61
- get text() {
62
- return `${exports.chatFunctionLeader}${this.toolRequest.id}`;
63
- }
64
- get promptText() {
65
- return (0, ai_core_1.toolRequestToPromptText)(this.toolRequest);
66
- }
67
- }
68
- exports.ParsedChatRequestFunctionPart = ParsedChatRequestFunctionPart;
69
- class ParsedChatRequestAgentPart {
70
- constructor(range, agentId, agentName) {
71
- this.range = range;
72
- this.agentId = agentId;
73
- this.agentName = agentName;
74
- }
75
- get text() {
76
- return `${exports.chatAgentLeader}${this.agentName}`;
77
- }
78
- get promptText() {
79
- return '';
80
- }
81
- }
82
- exports.ParsedChatRequestAgentPart = ParsedChatRequestAgentPart;
83
- //# sourceMappingURL=parsed-chat-request.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parsed-chat-request.js","sourceRoot":"","sources":["../../src/common/parsed-chat-request.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;AAChF;;;gGAGgG;AAChG,kKAAkK;AAClK,mJAAmJ;;;AAEnJ,4CAA0F;AAG7E,QAAA,kBAAkB,GAAG,GAAG,CAAC;AACzB,QAAA,eAAe,GAAG,GAAG,CAAC;AACtB,QAAA,kBAAkB,GAAG,GAAG,CAAC;AACzB,QAAA,oBAAoB,GAAG,GAAG,CAAC;AAgCxC,MAAa,yBAAyB;IAGlC,YAAqB,KAAkB,EAAW,IAAY;QAAzC,UAAK,GAAL,KAAK,CAAa;QAAW,SAAI,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SAAS,EAAE,CAAC;IACjD,CAAC;IAED,IAAI,UAAU;QACV,OAAO,EAAE,CAAC;IACd,CAAC;CACJ;AAXD,gEAWC"}
@@ -1,69 +0,0 @@
1
- import { MutableChatRequestModel, ChatResponseContent } from './chat-model';
2
- export type ResponseContentFactory = (content: string, request: MutableChatRequestModel) => ChatResponseContent;
3
- export declare const MarkdownContentFactory: ResponseContentFactory;
4
- /**
5
- * Default response content factory used if no other `ResponseContentMatcher` applies.
6
- * By default, this factory creates a markdown content object.
7
- *
8
- * @see MarkdownChatResponseContentImpl
9
- */
10
- export declare class DefaultResponseContentFactory {
11
- create(content: string, request: MutableChatRequestModel): ChatResponseContent;
12
- }
13
- /**
14
- * Clients can contribute response content matchers to parse a chat response into specific
15
- * `ChatResponseContent` instances.
16
- */
17
- export interface ResponseContentMatcher {
18
- /** Regular expression for finding the start delimiter. */
19
- start: RegExp;
20
- /** Regular expression for finding the start delimiter. */
21
- end: RegExp;
22
- /**
23
- * The factory creating a response content from the matching content,
24
- * from start index to end index of the match (including delimiters).
25
- */
26
- contentFactory: ResponseContentFactory;
27
- /**
28
- * Optional factory for creating a response content when only the start delimiter has been matched,
29
- * but not yet the end delimiter. Used during streaming to provide better visual feedback.
30
- * If not provided, the default content factory will be used until the end delimiter is matched.
31
- */
32
- incompleteContentFactory?: ResponseContentFactory;
33
- }
34
- export declare const CodeContentMatcher: ResponseContentMatcher;
35
- /**
36
- * Clients can contribute response content matchers to parse the response content.
37
- *
38
- * The default chat user interface will collect all contributed matchers and use them
39
- * to parse the response into structured content parts (e.g. code blocks, markdown blocks),
40
- * which are then rendered with a `ChatResponsePartRenderer` registered for the respective
41
- * content part type.
42
- *
43
- * ### Example
44
- * ```ts
45
- * bind(ResponseContentMatcherProvider).to(MyResponseContentMatcherProvider);
46
- * ...
47
- * @injectable()
48
- * export class MyResponseContentMatcherProvider implements ResponseContentMatcherProvider {
49
- * readonly matchers: ResponseContentMatcher[] = [{
50
- * start: /^<command>$/m,
51
- * end: /^</command>$/m,
52
- * contentFactory: (content: string) => {
53
- * const command = content.replace(/^<command>\n|<\/command>$/g, '');
54
- * return new MyChatResponseContentImpl(command.trim());
55
- * }
56
- * }];
57
- * }
58
- * ```
59
- *
60
- * @see ResponseContentMatcher
61
- */
62
- export declare const ResponseContentMatcherProvider: unique symbol;
63
- export interface ResponseContentMatcherProvider {
64
- readonly matchers: ResponseContentMatcher[];
65
- }
66
- export declare class DefaultResponseContentMatcherProvider implements ResponseContentMatcherProvider {
67
- readonly matchers: ResponseContentMatcher[];
68
- }
69
- //# sourceMappingURL=response-content-matcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"response-content-matcher.d.ts","sourceRoot":"","sources":["../../src/common/response-content-matcher.ts"],"names":[],"mappings":"AAeA,OAAO,EACH,uBAAuB,EACvB,mBAAmB,EAGtB,MAAM,cAAc,CAAC;AAGtB,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,KAAK,mBAAmB,CAAC;AAEhH,eAAO,MAAM,sBAAsB,EAAE,sBACW,CAAC;AAEjD;;;;;GAKG;AACH,qBACa,6BAA6B;IACtC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,GAAG,mBAAmB;CAGjF;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACnC,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,cAAc,EAAE,sBAAsB,CAAC;IACvC;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,sBAAsB,CAAC;CACrD;AAED,eAAO,MAAM,kBAAkB,EAAE,sBAoBhC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,8BAA8B,eAA2C,CAAC;AACvF,MAAM,WAAW,8BAA8B;IAC3C,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,EAAE,CAAC;CAC/C;AAED,qBACa,qCAAsC,YAAW,8BAA8B;IACxF,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,EAAE,CAAwB;CACtE"}
@@ -1,97 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultResponseContentMatcherProvider = exports.ResponseContentMatcherProvider = exports.CodeContentMatcher = exports.DefaultResponseContentFactory = exports.MarkdownContentFactory = void 0;
4
- const tslib_1 = require("tslib");
5
- /*
6
- * Copyright (C) 2024 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 chat_model_1 = require("./chat-model");
21
- const inversify_1 = require("@theia/core/shared/inversify");
22
- const MarkdownContentFactory = (content, request) => new chat_model_1.MarkdownChatResponseContentImpl(content);
23
- exports.MarkdownContentFactory = MarkdownContentFactory;
24
- /**
25
- * Default response content factory used if no other `ResponseContentMatcher` applies.
26
- * By default, this factory creates a markdown content object.
27
- *
28
- * @see MarkdownChatResponseContentImpl
29
- */
30
- let DefaultResponseContentFactory = class DefaultResponseContentFactory {
31
- create(content, request) {
32
- return (0, exports.MarkdownContentFactory)(content, request);
33
- }
34
- };
35
- exports.DefaultResponseContentFactory = DefaultResponseContentFactory;
36
- exports.DefaultResponseContentFactory = DefaultResponseContentFactory = tslib_1.__decorate([
37
- (0, inversify_1.injectable)()
38
- ], DefaultResponseContentFactory);
39
- exports.CodeContentMatcher = {
40
- // Only match when we have the complete first line ending with a newline
41
- // This ensures we have the full language specification before creating the editor
42
- start: /^```.*\n/m,
43
- end: /^```$/m,
44
- contentFactory: (content, request) => {
45
- var _a;
46
- const language = ((_a = content.match(/^```(\w+)/)) === null || _a === void 0 ? void 0 : _a[1]) || '';
47
- const code = content.replace(/^```(\w+)\n|```$/g, '');
48
- return new chat_model_1.CodeChatResponseContentImpl(code.trim(), language);
49
- },
50
- incompleteContentFactory: (content, request) => {
51
- var _a;
52
- // By this point, we know we have at least the complete first line with ```
53
- const firstLine = content.split('\n')[0];
54
- const language = ((_a = firstLine.match(/^```(\w+)/)) === null || _a === void 0 ? void 0 : _a[1]) || '';
55
- // Remove the first line to get just the code content
56
- const code = content.substring(content.indexOf('\n') + 1);
57
- return new chat_model_1.CodeChatResponseContentImpl(code.trim(), language);
58
- }
59
- };
60
- /**
61
- * Clients can contribute response content matchers to parse the response content.
62
- *
63
- * The default chat user interface will collect all contributed matchers and use them
64
- * to parse the response into structured content parts (e.g. code blocks, markdown blocks),
65
- * which are then rendered with a `ChatResponsePartRenderer` registered for the respective
66
- * content part type.
67
- *
68
- * ### Example
69
- * ```ts
70
- * bind(ResponseContentMatcherProvider).to(MyResponseContentMatcherProvider);
71
- * ...
72
- * @injectable()
73
- * export class MyResponseContentMatcherProvider implements ResponseContentMatcherProvider {
74
- * readonly matchers: ResponseContentMatcher[] = [{
75
- * start: /^<command>$/m,
76
- * end: /^</command>$/m,
77
- * contentFactory: (content: string) => {
78
- * const command = content.replace(/^<command>\n|<\/command>$/g, '');
79
- * return new MyChatResponseContentImpl(command.trim());
80
- * }
81
- * }];
82
- * }
83
- * ```
84
- *
85
- * @see ResponseContentMatcher
86
- */
87
- exports.ResponseContentMatcherProvider = Symbol('ResponseContentMatcherProvider');
88
- let DefaultResponseContentMatcherProvider = class DefaultResponseContentMatcherProvider {
89
- constructor() {
90
- this.matchers = [exports.CodeContentMatcher];
91
- }
92
- };
93
- exports.DefaultResponseContentMatcherProvider = DefaultResponseContentMatcherProvider;
94
- exports.DefaultResponseContentMatcherProvider = DefaultResponseContentMatcherProvider = tslib_1.__decorate([
95
- (0, inversify_1.injectable)()
96
- ], DefaultResponseContentMatcherProvider);
97
- //# sourceMappingURL=response-content-matcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"response-content-matcher.js","sourceRoot":"","sources":["../../src/common/response-content-matcher.ts"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,6CAKsB;AACtB,4DAA0D;AAInD,MAAM,sBAAsB,GAA2B,CAAC,OAAe,EAAE,OAAgC,EAAE,EAAE,CAChH,IAAI,4CAA+B,CAAC,OAAO,CAAC,CAAC;AADpC,QAAA,sBAAsB,0BACc;AAEjD;;;;;GAKG;AAEI,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IACtC,MAAM,CAAC,OAAe,EAAE,OAAgC;QACpD,OAAO,IAAA,8BAAsB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;CACJ,CAAA;AAJY,sEAA6B;wCAA7B,6BAA6B;IADzC,IAAA,sBAAU,GAAE;GACA,6BAA6B,CAIzC;AAwBY,QAAA,kBAAkB,GAA2B;IACtD,wEAAwE;IACxE,kFAAkF;IAClF,KAAK,EAAE,WAAW;IAClB,GAAG,EAAE,QAAQ;IACb,cAAc,EAAE,CAAC,OAAe,EAAE,OAAgC,EAAE,EAAE;;QAClE,MAAM,QAAQ,GAAG,CAAA,MAAA,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,0CAAG,CAAC,CAAC,KAAI,EAAE,CAAC;QACvD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;QACtD,OAAO,IAAI,wCAA2B,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;IAClE,CAAC;IACD,wBAAwB,EAAE,CAAC,OAAe,EAAE,OAAgC,EAAE,EAAE;;QAC5E,2EAA2E;QAC3E,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACzC,MAAM,QAAQ,GAAG,CAAA,MAAA,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,0CAAG,CAAC,CAAC,KAAI,EAAE,CAAC;QAEzD,qDAAqD;QACrD,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAE1D,OAAO,IAAI,wCAA2B,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;IAClE,CAAC;CACJ,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACU,QAAA,8BAA8B,GAAG,MAAM,CAAC,gCAAgC,CAAC,CAAC;AAMhF,IAAM,qCAAqC,GAA3C,MAAM,qCAAqC;IAA3C;QACM,aAAQ,GAA6B,CAAC,0BAAkB,CAAC,CAAC;IACvE,CAAC;CAAA,CAAA;AAFY,sFAAqC;gDAArC,qCAAqC;IADjD,IAAA,sBAAU,GAAE;GACA,qCAAqC,CAEjD"}
@@ -1,4 +0,0 @@
1
- import { ContainerModule } from '@theia/core/shared/inversify';
2
- declare const _default: ContainerModule;
3
- export default _default;
4
- //# sourceMappingURL=ai-chat-backend-module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-chat-backend-module.d.ts","sourceRoot":"","sources":["../../src/node/ai-chat-backend-module.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAI/D,wBAGG"}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2025 STMicroelectronics and others
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
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const core_1 = require("@theia/core");
19
- const inversify_1 = require("@theia/core/shared/inversify");
20
- const ai_chat_preferences_1 = require("../common/ai-chat-preferences");
21
- const chat_tool_preferences_1 = require("../common/chat-tool-preferences");
22
- exports.default = new inversify_1.ContainerModule(bind => {
23
- bind(core_1.PreferenceContribution).toConstantValue({ schema: ai_chat_preferences_1.aiChatPreferences });
24
- bind(core_1.PreferenceContribution).toConstantValue({ schema: chat_tool_preferences_1.chatToolPreferences });
25
- });
26
- //# sourceMappingURL=ai-chat-backend-module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-chat-backend-module.js","sourceRoot":"","sources":["../../src/node/ai-chat-backend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,mDAAmD;AACnD,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,sCAAqD;AACrD,4DAA+D;AAC/D,uEAAkE;AAClE,2EAAsE;AAEtE,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAI,CAAC,6BAAsB,CAAC,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,uCAAiB,EAAE,CAAC,CAAC;IAC5E,IAAI,CAAC,6BAAsB,CAAC,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,2CAAmB,EAAE,CAAC,CAAC;AAClF,CAAC,CAAC,CAAC"}