@theia/ai-chat-ui 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 (161) hide show
  1. package/lib/browser/ai-chat-ui-contribution.d.ts +66 -0
  2. package/lib/browser/ai-chat-ui-contribution.d.ts.map +1 -0
  3. package/lib/browser/ai-chat-ui-contribution.js +587 -0
  4. package/lib/browser/ai-chat-ui-contribution.js.map +1 -0
  5. package/lib/browser/ai-chat-ui-frontend-module.d.ts +5 -0
  6. package/lib/browser/ai-chat-ui-frontend-module.d.ts.map +1 -0
  7. package/lib/browser/ai-chat-ui-frontend-module.js +153 -0
  8. package/lib/browser/ai-chat-ui-frontend-module.js.map +1 -0
  9. package/lib/browser/change-set-actions/change-set-accept-action.d.ts +10 -0
  10. package/lib/browser/change-set-actions/change-set-accept-action.d.ts.map +1 -0
  11. package/lib/browser/change-set-actions/change-set-accept-action.js +47 -0
  12. package/lib/browser/change-set-actions/change-set-accept-action.js.map +1 -0
  13. package/lib/browser/change-set-actions/change-set-action-service.d.ts +31 -0
  14. package/lib/browser/change-set-actions/change-set-action-service.d.ts.map +1 -0
  15. package/lib/browser/change-set-actions/change-set-action-service.js +57 -0
  16. package/lib/browser/change-set-actions/change-set-action-service.js.map +1 -0
  17. package/lib/browser/chat-input-agent-suggestions.d.ts +11 -0
  18. package/lib/browser/chat-input-agent-suggestions.d.ts.map +1 -0
  19. package/lib/browser/chat-input-agent-suggestions.js +76 -0
  20. package/lib/browser/chat-input-agent-suggestions.js.map +1 -0
  21. package/lib/browser/chat-input-history-contribution.d.ts +17 -0
  22. package/lib/browser/chat-input-history-contribution.d.ts.map +1 -0
  23. package/lib/browser/chat-input-history-contribution.js +158 -0
  24. package/lib/browser/chat-input-history-contribution.js.map +1 -0
  25. package/lib/browser/chat-input-history.d.ts +32 -0
  26. package/lib/browser/chat-input-history.d.ts.map +1 -0
  27. package/lib/browser/chat-input-history.js +125 -0
  28. package/lib/browser/chat-input-history.js.map +1 -0
  29. package/lib/browser/chat-input-mode-contribution.d.ts +12 -0
  30. package/lib/browser/chat-input-mode-contribution.d.ts.map +1 -0
  31. package/lib/browser/chat-input-mode-contribution.js +77 -0
  32. package/lib/browser/chat-input-mode-contribution.js.map +1 -0
  33. package/lib/browser/chat-input-widget.d.ts +118 -0
  34. package/lib/browser/chat-input-widget.d.ts.map +1 -0
  35. package/lib/browser/chat-input-widget.js +1034 -0
  36. package/lib/browser/chat-input-widget.js.map +1 -0
  37. package/lib/browser/chat-node-toolbar-action-contribution.d.ts +56 -0
  38. package/lib/browser/chat-node-toolbar-action-contribution.d.ts.map +1 -0
  39. package/lib/browser/chat-node-toolbar-action-contribution.js +92 -0
  40. package/lib/browser/chat-node-toolbar-action-contribution.js.map +1 -0
  41. package/lib/browser/chat-progress-message.d.ts +7 -0
  42. package/lib/browser/chat-progress-message.d.ts.map +1 -0
  43. package/lib/browser/chat-progress-message.js +33 -0
  44. package/lib/browser/chat-progress-message.js.map +1 -0
  45. package/lib/browser/chat-response-part-renderer.d.ts +10 -0
  46. package/lib/browser/chat-response-part-renderer.d.ts.map +1 -0
  47. package/lib/browser/chat-response-part-renderer.js +20 -0
  48. package/lib/browser/chat-response-part-renderer.js.map +1 -0
  49. package/lib/browser/chat-response-renderer/ai-selection-resolver.d.ts +23 -0
  50. package/lib/browser/chat-response-renderer/ai-selection-resolver.d.ts.map +1 -0
  51. package/lib/browser/chat-response-renderer/ai-selection-resolver.js +148 -0
  52. package/lib/browser/chat-response-renderer/ai-selection-resolver.js.map +1 -0
  53. package/lib/browser/chat-response-renderer/code-part-renderer.d.ts +73 -0
  54. package/lib/browser/chat-response-renderer/code-part-renderer.d.ts.map +1 -0
  55. package/lib/browser/chat-response-renderer/code-part-renderer.js +227 -0
  56. package/lib/browser/chat-response-renderer/code-part-renderer.js.map +1 -0
  57. package/lib/browser/chat-response-renderer/command-part-renderer.d.ts +12 -0
  58. package/lib/browser/chat-response-renderer/command-part-renderer.d.ts.map +1 -0
  59. package/lib/browser/chat-response-renderer/command-part-renderer.js +67 -0
  60. package/lib/browser/chat-response-renderer/command-part-renderer.js.map +1 -0
  61. package/lib/browser/chat-response-renderer/delegation-response-renderer.d.ts +14 -0
  62. package/lib/browser/chat-response-renderer/delegation-response-renderer.d.ts.map +1 -0
  63. package/lib/browser/chat-response-renderer/delegation-response-renderer.js +144 -0
  64. package/lib/browser/chat-response-renderer/delegation-response-renderer.js.map +1 -0
  65. package/lib/browser/chat-response-renderer/error-part-renderer.d.ts +9 -0
  66. package/lib/browser/chat-response-renderer/error-part-renderer.d.ts.map +1 -0
  67. package/lib/browser/chat-response-renderer/error-part-renderer.js +40 -0
  68. package/lib/browser/chat-response-renderer/error-part-renderer.js.map +1 -0
  69. package/lib/browser/chat-response-renderer/horizontal-layout-part-renderer.d.ts +12 -0
  70. package/lib/browser/chat-response-renderer/horizontal-layout-part-renderer.d.ts.map +1 -0
  71. package/lib/browser/chat-response-renderer/horizontal-layout-part-renderer.js +54 -0
  72. package/lib/browser/chat-response-renderer/horizontal-layout-part-renderer.js.map +1 -0
  73. package/lib/browser/chat-response-renderer/index.d.ts +13 -0
  74. package/lib/browser/chat-response-renderer/index.d.ts.map +1 -0
  75. package/lib/browser/chat-response-renderer/index.js +31 -0
  76. package/lib/browser/chat-response-renderer/index.js.map +1 -0
  77. package/lib/browser/chat-response-renderer/markdown-part-renderer.d.ts +36 -0
  78. package/lib/browser/chat-response-renderer/markdown-part-renderer.d.ts.map +1 -0
  79. package/lib/browser/chat-response-renderer/markdown-part-renderer.js +129 -0
  80. package/lib/browser/chat-response-renderer/markdown-part-renderer.js.map +1 -0
  81. package/lib/browser/chat-response-renderer/progress-part-renderer.d.ts +9 -0
  82. package/lib/browser/chat-response-renderer/progress-part-renderer.d.ts.map +1 -0
  83. package/lib/browser/chat-response-renderer/progress-part-renderer.js +39 -0
  84. package/lib/browser/chat-response-renderer/progress-part-renderer.js.map +1 -0
  85. package/lib/browser/chat-response-renderer/question-part-renderer.d.ts +10 -0
  86. package/lib/browser/chat-response-renderer/question-part-renderer.d.ts.map +1 -0
  87. package/lib/browser/chat-response-renderer/question-part-renderer.js +49 -0
  88. package/lib/browser/chat-response-renderer/question-part-renderer.js.map +1 -0
  89. package/lib/browser/chat-response-renderer/text-part-renderer.d.ts +9 -0
  90. package/lib/browser/chat-response-renderer/text-part-renderer.d.ts.map +1 -0
  91. package/lib/browser/chat-response-renderer/text-part-renderer.js +43 -0
  92. package/lib/browser/chat-response-renderer/text-part-renderer.js.map +1 -0
  93. package/lib/browser/chat-response-renderer/text-part-renderer.spec.d.ts +2 -0
  94. package/lib/browser/chat-response-renderer/text-part-renderer.spec.d.ts.map +1 -0
  95. package/lib/browser/chat-response-renderer/text-part-renderer.spec.js +46 -0
  96. package/lib/browser/chat-response-renderer/text-part-renderer.spec.js.map +1 -0
  97. package/lib/browser/chat-response-renderer/thinking-part-renderer.d.ts +9 -0
  98. package/lib/browser/chat-response-renderer/thinking-part-renderer.d.ts.map +1 -0
  99. package/lib/browser/chat-response-renderer/thinking-part-renderer.js +42 -0
  100. package/lib/browser/chat-response-renderer/thinking-part-renderer.js.map +1 -0
  101. package/lib/browser/chat-response-renderer/tool-confirmation.d.ts +17 -0
  102. package/lib/browser/chat-response-renderer/tool-confirmation.d.ts.map +1 -0
  103. package/lib/browser/chat-response-renderer/tool-confirmation.js +122 -0
  104. package/lib/browser/chat-response-renderer/tool-confirmation.js.map +1 -0
  105. package/lib/browser/chat-response-renderer/toolcall-part-renderer.d.ts +20 -0
  106. package/lib/browser/chat-response-renderer/toolcall-part-renderer.d.ts.map +1 -0
  107. package/lib/browser/chat-response-renderer/toolcall-part-renderer.js +223 -0
  108. package/lib/browser/chat-response-renderer/toolcall-part-renderer.js.map +1 -0
  109. package/lib/browser/chat-response-renderer/unknown-part-renderer.d.ts +9 -0
  110. package/lib/browser/chat-response-renderer/unknown-part-renderer.d.ts.map +1 -0
  111. package/lib/browser/chat-response-renderer/unknown-part-renderer.js +42 -0
  112. package/lib/browser/chat-response-renderer/unknown-part-renderer.js.map +1 -0
  113. package/lib/browser/chat-tree-view/chat-view-tree-container.d.ts +4 -0
  114. package/lib/browser/chat-tree-view/chat-view-tree-container.d.ts.map +1 -0
  115. package/lib/browser/chat-tree-view/chat-view-tree-container.js +33 -0
  116. package/lib/browser/chat-tree-view/chat-view-tree-container.js.map +1 -0
  117. package/lib/browser/chat-tree-view/chat-view-tree-input-widget.d.ts +38 -0
  118. package/lib/browser/chat-tree-view/chat-view-tree-input-widget.d.ts.map +1 -0
  119. package/lib/browser/chat-tree-view/chat-view-tree-input-widget.js +88 -0
  120. package/lib/browser/chat-tree-view/chat-view-tree-input-widget.js.map +1 -0
  121. package/lib/browser/chat-tree-view/chat-view-tree-widget.d.ts +120 -0
  122. package/lib/browser/chat-tree-view/chat-view-tree-widget.d.ts.map +1 -0
  123. package/lib/browser/chat-tree-view/chat-view-tree-widget.js +654 -0
  124. package/lib/browser/chat-tree-view/chat-view-tree-widget.js.map +1 -0
  125. package/lib/browser/chat-tree-view/index.d.ts +3 -0
  126. package/lib/browser/chat-tree-view/index.d.ts.map +1 -0
  127. package/lib/browser/chat-tree-view/index.js +21 -0
  128. package/lib/browser/chat-tree-view/index.js.map +1 -0
  129. package/lib/browser/chat-tree-view/sub-chat-widget.d.ts +22 -0
  130. package/lib/browser/chat-tree-view/sub-chat-widget.d.ts.map +1 -0
  131. package/lib/browser/chat-tree-view/sub-chat-widget.js +92 -0
  132. package/lib/browser/chat-tree-view/sub-chat-widget.js.map +1 -0
  133. package/lib/browser/chat-view-commands.d.ts +15 -0
  134. package/lib/browser/chat-view-commands.d.ts.map +1 -0
  135. package/lib/browser/chat-view-commands.js +76 -0
  136. package/lib/browser/chat-view-commands.js.map +1 -0
  137. package/lib/browser/chat-view-contribution.d.ts +21 -0
  138. package/lib/browser/chat-view-contribution.d.ts.map +1 -0
  139. package/lib/browser/chat-view-contribution.js +183 -0
  140. package/lib/browser/chat-view-contribution.js.map +1 -0
  141. package/lib/browser/chat-view-language-contribution.d.ts +41 -0
  142. package/lib/browser/chat-view-language-contribution.d.ts.map +1 -0
  143. package/lib/browser/chat-view-language-contribution.js +269 -0
  144. package/lib/browser/chat-view-language-contribution.js.map +1 -0
  145. package/lib/browser/chat-view-widget-toolbar-contribution.d.ts +20 -0
  146. package/lib/browser/chat-view-widget-toolbar-contribution.d.ts.map +1 -0
  147. package/lib/browser/chat-view-widget-toolbar-contribution.js +115 -0
  148. package/lib/browser/chat-view-widget-toolbar-contribution.js.map +1 -0
  149. package/lib/browser/chat-view-widget.d.ts +60 -0
  150. package/lib/browser/chat-view-widget.d.ts.map +1 -0
  151. package/lib/browser/chat-view-widget.js +243 -0
  152. package/lib/browser/chat-view-widget.js.map +1 -0
  153. package/lib/browser/context-variable-picker.d.ts +9 -0
  154. package/lib/browser/context-variable-picker.d.ts.map +1 -0
  155. package/lib/browser/context-variable-picker.js +86 -0
  156. package/lib/browser/context-variable-picker.js.map +1 -0
  157. package/lib/browser/session-settings-dialog.d.ts +35 -0
  158. package/lib/browser/session-settings-dialog.d.ts.map +1 -0
  159. package/lib/browser/session-settings-dialog.js +118 -0
  160. package/lib/browser/session-settings-dialog.js.map +1 -0
  161. package/package.json +10 -10
@@ -0,0 +1,54 @@
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.HorizontalLayoutPartRenderer = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const chat_response_part_renderer_1 = require("../chat-response-part-renderer");
21
+ const inversify_1 = require("@theia/core/shared/inversify");
22
+ const common_1 = require("@theia/ai-chat/lib/common");
23
+ const React = require("@theia/core/shared/react");
24
+ const core_1 = require("@theia/core");
25
+ let HorizontalLayoutPartRenderer = class HorizontalLayoutPartRenderer {
26
+ canHandle(response) {
27
+ if (common_1.HorizontalLayoutChatResponseContent.is(response)) {
28
+ return 10;
29
+ }
30
+ return -1;
31
+ }
32
+ render(response, parentNode) {
33
+ const contributions = this.chatResponsePartRenderers.getContributions();
34
+ return (React.createElement("div", { className: "ai-chat-horizontal-layout", style: { display: 'flex', flexDirection: 'row', flexWrap: 'wrap' } }, response.content.map(content => {
35
+ const renderer = contributions
36
+ .map(c => ({
37
+ prio: c.canHandle(content),
38
+ renderer: c,
39
+ }))
40
+ .sort((a, b) => b.prio - a.prio)[0].renderer;
41
+ return renderer.render(content, parentNode);
42
+ })));
43
+ }
44
+ };
45
+ exports.HorizontalLayoutPartRenderer = HorizontalLayoutPartRenderer;
46
+ tslib_1.__decorate([
47
+ (0, inversify_1.inject)(core_1.ContributionProvider),
48
+ (0, inversify_1.named)(chat_response_part_renderer_1.ChatResponsePartRenderer),
49
+ tslib_1.__metadata("design:type", Object)
50
+ ], HorizontalLayoutPartRenderer.prototype, "chatResponsePartRenderers", void 0);
51
+ exports.HorizontalLayoutPartRenderer = HorizontalLayoutPartRenderer = tslib_1.__decorate([
52
+ (0, inversify_1.injectable)()
53
+ ], HorizontalLayoutPartRenderer);
54
+ //# sourceMappingURL=horizontal-layout-part-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"horizontal-layout-part-renderer.js","sourceRoot":"","sources":["../../../src/browser/chat-response-renderer/horizontal-layout-part-renderer.tsx"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E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AFlB,IAAA,kBAAM,EAAC,2BAAoB,CAAC;IAC5B,IAAA,iBAAK,EAAC,sDAAwB,CAAC;;+EAG9B;uCANO,4BAA4B;IADxC,IAAA,sBAAU,GAAE;GACA,4BAA4B,CA8BxC"}
@@ -0,0 +1,13 @@
1
+ export * from './ai-selection-resolver';
2
+ export * from './code-part-renderer';
3
+ export * from './command-part-renderer';
4
+ export * from './error-part-renderer';
5
+ export * from './horizontal-layout-part-renderer';
6
+ export * from './markdown-part-renderer';
7
+ export * from './text-part-renderer';
8
+ export * from './toolcall-part-renderer';
9
+ export * from './thinking-part-renderer';
10
+ export * from './progress-part-renderer';
11
+ export * from './tool-confirmation';
12
+ export * from './delegation-response-renderer';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/chat-response-renderer/index.ts"],"names":[],"mappings":"AAeA,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ // *****************************************************************************
5
+ // Copyright (C) 2024 EclipseSource GmbH.
6
+ //
7
+ // This program and the accompanying materials are made available under the
8
+ // terms of the Eclipse Public License v. 2.0 which is available at
9
+ // http://www.eclipse.org/legal/epl-2.0.
10
+ //
11
+ // This Source Code may also be made available under the following Secondary
12
+ // Licenses when the conditions for such availability set forth in the Eclipse
13
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
14
+ // with the GNU Classpath Exception which is available at
15
+ // https://www.gnu.org/software/classpath/license.html.
16
+ //
17
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
18
+ // *****************************************************************************
19
+ tslib_1.__exportStar(require("./ai-selection-resolver"), exports);
20
+ tslib_1.__exportStar(require("./code-part-renderer"), exports);
21
+ tslib_1.__exportStar(require("./command-part-renderer"), exports);
22
+ tslib_1.__exportStar(require("./error-part-renderer"), exports);
23
+ tslib_1.__exportStar(require("./horizontal-layout-part-renderer"), exports);
24
+ tslib_1.__exportStar(require("./markdown-part-renderer"), exports);
25
+ tslib_1.__exportStar(require("./text-part-renderer"), exports);
26
+ tslib_1.__exportStar(require("./toolcall-part-renderer"), exports);
27
+ tslib_1.__exportStar(require("./thinking-part-renderer"), exports);
28
+ tslib_1.__exportStar(require("./progress-part-renderer"), exports);
29
+ tslib_1.__exportStar(require("./tool-confirmation"), exports);
30
+ tslib_1.__exportStar(require("./delegation-response-renderer"), exports);
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/browser/chat-response-renderer/index.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,kEAAwC;AACxC,+DAAqC;AACrC,kEAAwC;AACxC,gEAAsC;AACtC,4EAAkD;AAClD,mEAAyC;AACzC,+DAAqC;AACrC,mEAAyC;AACzC,mEAAyC;AACzC,mEAAyC;AACzC,8DAAoC;AACpC,yEAA+C"}
@@ -0,0 +1,36 @@
1
+ /// <reference types="react" />
2
+ import { ChatResponsePartRenderer } from '../chat-response-part-renderer';
3
+ import { ChatResponseContent, InformationalChatResponseContent, MarkdownChatResponseContent } from '@theia/ai-chat/lib/common';
4
+ import { ReactNode } from '@theia/core/shared/react';
5
+ import * as React from '@theia/core/shared/react';
6
+ import * as markdownit from '@theia/core/shared/markdown-it';
7
+ import { MarkdownString } from '@theia/core/lib/common/markdown-rendering';
8
+ import { OpenerService } from '@theia/core/lib/browser';
9
+ export declare class MarkdownPartRenderer implements ChatResponsePartRenderer<MarkdownChatResponseContent | InformationalChatResponseContent> {
10
+ protected readonly openerService: OpenerService;
11
+ protected readonly markdownIt: markdownit;
12
+ canHandle(response: ChatResponseContent): number;
13
+ render(response: MarkdownChatResponseContent | InformationalChatResponseContent): ReactNode;
14
+ }
15
+ export interface DeclaredEventsEventListenerObject extends EventListenerObject {
16
+ handledEvents?: (keyof HTMLElementEventMap)[];
17
+ }
18
+ /**
19
+ * This hook uses markdown-it directly to render markdown.
20
+ * The reason to use markdown-it directly is that the MarkdownRenderer is
21
+ * overridden by theia with a monaco version. This monaco version strips all html
22
+ * tags from the markdown with empty content. This leads to unexpected behavior when
23
+ * rendering markdown with html tags.
24
+ *
25
+ * Moreover, we want to intercept link clicks to use the Theia OpenerService instead of the default browser behavior.
26
+ *
27
+ * @param markdown the string to render as markdown
28
+ * @param skipSurroundingParagraph whether to remove a surrounding paragraph element (default: false)
29
+ * @param openerService the service to handle link opening
30
+ * @param eventHandler `handleEvent` will be called by default for `click` events and additionally
31
+ * for all events enumerated in {@link DeclaredEventsEventListenerObject.handledEvents}. If `handleEvent` returns `true`,
32
+ * no additional handlers will be run for the event.
33
+ * @returns the ref to use in an element to render the markdown
34
+ */
35
+ export declare const useMarkdownRendering: (markdown: string | MarkdownString, openerService: OpenerService, skipSurroundingParagraph?: boolean, eventHandler?: DeclaredEventsEventListenerObject) => React.MutableRefObject<HTMLDivElement | null>;
36
+ //# sourceMappingURL=markdown-part-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-part-renderer.d.ts","sourceRoot":"","sources":["../../../src/browser/chat-response-renderer/markdown-part-renderer.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,OAAO,EACH,mBAAmB,EACnB,gCAAgC,EAChC,2BAA2B,EAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,SAAS,EAAqB,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAClD,OAAO,KAAK,UAAU,MAAM,gCAAgC,CAAC;AAG7D,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAQ,MAAM,yBAAyB,CAAC;AAG9D,qBACa,oBAAqB,YAAW,wBAAwB,CAAC,2BAA2B,GAAG,gCAAgC,CAAC;IAC1G,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACvE,SAAS,CAAC,QAAQ,CAAC,UAAU,aAA0C;IACvE,SAAS,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM;IAShD,MAAM,CAAC,QAAQ,EAAE,2BAA2B,GAAG,gCAAgC,GAAG,SAAS;CAU9F;AAQD,MAAM,WAAW,iCAAkC,SAAQ,mBAAmB;IAC1E,aAAa,CAAC,EAAE,CAAC,MAAM,mBAAmB,CAAC,EAAE,CAAC;CACjD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB,aACnB,MAAM,GAAG,cAAc,iBAClB,aAAa,6BACF,OAAO,iBAClB,iCAAiC,kDAgDnD,CAAC"}
@@ -0,0 +1,129 @@
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.useMarkdownRendering = exports.MarkdownPartRenderer = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const common_1 = require("@theia/ai-chat/lib/common");
22
+ const react_1 = require("@theia/core/shared/react");
23
+ const React = require("@theia/core/shared/react");
24
+ const markdownit = require("@theia/core/shared/markdown-it");
25
+ const markdownitemoji = require("@theia/core/shared/markdown-it-emoji");
26
+ const DOMPurify = require("@theia/core/shared/dompurify");
27
+ const browser_1 = require("@theia/core/lib/browser");
28
+ const core_1 = require("@theia/core");
29
+ let MarkdownPartRenderer = class MarkdownPartRenderer {
30
+ constructor() {
31
+ this.markdownIt = markdownit().use(markdownitemoji.full);
32
+ }
33
+ canHandle(response) {
34
+ if (common_1.MarkdownChatResponseContent.is(response)) {
35
+ return 10;
36
+ }
37
+ if (common_1.InformationalChatResponseContent.is(response)) {
38
+ return 10;
39
+ }
40
+ return -1;
41
+ }
42
+ render(response) {
43
+ // TODO let the user configure whether they want to see informational content
44
+ if (common_1.InformationalChatResponseContent.is(response)) {
45
+ // null is valid in React
46
+ // eslint-disable-next-line no-null/no-null
47
+ return null;
48
+ }
49
+ return React.createElement(MarkdownRender, { response: response, openerService: this.openerService });
50
+ }
51
+ };
52
+ exports.MarkdownPartRenderer = MarkdownPartRenderer;
53
+ tslib_1.__decorate([
54
+ (0, inversify_1.inject)(browser_1.OpenerService),
55
+ tslib_1.__metadata("design:type", Object)
56
+ ], MarkdownPartRenderer.prototype, "openerService", void 0);
57
+ exports.MarkdownPartRenderer = MarkdownPartRenderer = tslib_1.__decorate([
58
+ (0, inversify_1.injectable)()
59
+ ], MarkdownPartRenderer);
60
+ const MarkdownRender = ({ response, openerService }) => {
61
+ const ref = (0, exports.useMarkdownRendering)(response.content, openerService);
62
+ return React.createElement("div", { ref: ref });
63
+ };
64
+ /**
65
+ * This hook uses markdown-it directly to render markdown.
66
+ * The reason to use markdown-it directly is that the MarkdownRenderer is
67
+ * overridden by theia with a monaco version. This monaco version strips all html
68
+ * tags from the markdown with empty content. This leads to unexpected behavior when
69
+ * rendering markdown with html tags.
70
+ *
71
+ * Moreover, we want to intercept link clicks to use the Theia OpenerService instead of the default browser behavior.
72
+ *
73
+ * @param markdown the string to render as markdown
74
+ * @param skipSurroundingParagraph whether to remove a surrounding paragraph element (default: false)
75
+ * @param openerService the service to handle link opening
76
+ * @param eventHandler `handleEvent` will be called by default for `click` events and additionally
77
+ * for all events enumerated in {@link DeclaredEventsEventListenerObject.handledEvents}. If `handleEvent` returns `true`,
78
+ * no additional handlers will be run for the event.
79
+ * @returns the ref to use in an element to render the markdown
80
+ */
81
+ const useMarkdownRendering = (markdown, openerService, skipSurroundingParagraph = false, eventHandler) => {
82
+ // null is valid in React
83
+ // eslint-disable-next-line no-null/no-null
84
+ const ref = (0, react_1.useRef)(null);
85
+ const markdownString = typeof markdown === 'string' ? markdown : markdown.value;
86
+ (0, react_1.useEffect)(() => {
87
+ var _a, _b, _c, _d;
88
+ const markdownIt = markdownit().use(markdownitemoji.full);
89
+ const host = document.createElement('div');
90
+ // markdownIt always puts the content in a paragraph element, so we remove it if we don't want that
91
+ const html = skipSurroundingParagraph ? markdownIt.render(markdownString).replace(/^<p>|<\/p>|<p><\/p>$/g, '') : markdownIt.render(markdownString);
92
+ host.innerHTML = DOMPurify.sanitize(html, {
93
+ // DOMPurify usually strips non http(s) links from hrefs
94
+ // but we want to allow them (see handleClick via OpenerService below)
95
+ ALLOW_UNKNOWN_PROTOCOLS: true
96
+ });
97
+ while ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.firstChild) {
98
+ ref.current.removeChild(ref.current.firstChild);
99
+ }
100
+ (_b = ref === null || ref === void 0 ? void 0 : ref.current) === null || _b === void 0 ? void 0 : _b.appendChild(host);
101
+ // intercept link clicks to use the Theia OpenerService instead of the default browser behavior
102
+ const handleClick = (event) => {
103
+ if ((eventHandler === null || eventHandler === void 0 ? void 0 : eventHandler.handleEvent(event)) === true) {
104
+ return;
105
+ }
106
+ let target = event.target;
107
+ while (target && target.tagName !== 'A') {
108
+ target = target.parentElement;
109
+ }
110
+ if (target && target.tagName === 'A') {
111
+ const href = target.getAttribute('href');
112
+ if (href) {
113
+ (0, browser_1.open)(openerService, new core_1.URI(href));
114
+ event.preventDefault();
115
+ }
116
+ }
117
+ };
118
+ (_c = ref === null || ref === void 0 ? void 0 : ref.current) === null || _c === void 0 ? void 0 : _c.addEventListener('click', handleClick);
119
+ (_d = eventHandler === null || eventHandler === void 0 ? void 0 : eventHandler.handledEvents) === null || _d === void 0 ? void 0 : _d.forEach(eventType => { var _a; return eventType !== 'click' && ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.addEventListener(eventType, eventHandler)); });
120
+ return () => {
121
+ var _a, _b;
122
+ (_a = ref.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('click', handleClick);
123
+ (_b = eventHandler === null || eventHandler === void 0 ? void 0 : eventHandler.handledEvents) === null || _b === void 0 ? void 0 : _b.forEach(eventType => { var _a; return eventType !== 'click' && ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.removeEventListener(eventType, eventHandler)); });
124
+ };
125
+ }, [markdownString, skipSurroundingParagraph, openerService]);
126
+ return ref;
127
+ };
128
+ exports.useMarkdownRendering = useMarkdownRendering;
129
+ //# sourceMappingURL=markdown-part-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-part-renderer.js","sourceRoot":"","sources":["../../../src/browser/chat-response-renderer/markdown-part-renderer.tsx"],"names":[],"mappings":";AAAA,gF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AAE,WAAW,CAAC,CAAC;YACvD,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,aAAa,0CAAE,OAAO,CAAC,SAAS,CAAC,EAAE,WAAC,OAAA,SAAS,KAAK,OAAO,KAAI,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,0CAAE,mBAAmB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAA,CAAA,EAAA,CAAC,CAAC;QAC3I,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,cAAc,EAAE,wBAAwB,EAAE,aAAa,CAAC,CAAC,CAAC;IAE9D,OAAO,GAAG,CAAC;AACf,CAAC,CAAC;AApDW,QAAA,oBAAoB,wBAoD/B"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { ChatResponsePartRenderer } from '../chat-response-part-renderer';
3
+ import { ChatResponseContent, ProgressChatResponseContent } from '@theia/ai-chat/lib/common';
4
+ import { ReactNode } from '@theia/core/shared/react';
5
+ export declare class ProgressPartRenderer implements ChatResponsePartRenderer<ProgressChatResponseContent> {
6
+ canHandle(response: ChatResponseContent): number;
7
+ render(response: ProgressChatResponseContent): ReactNode;
8
+ }
9
+ //# sourceMappingURL=progress-part-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-part-renderer.d.ts","sourceRoot":"","sources":["../../../src/browser/chat-response-renderer/progress-part-renderer.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAIrD,qBACa,oBAAqB,YAAW,wBAAwB,CAAC,2BAA2B,CAAC;IAE9F,SAAS,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM;IAOhD,MAAM,CAAC,QAAQ,EAAE,2BAA2B,GAAG,SAAS;CAM3D"}
@@ -0,0 +1,39 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ProgressPartRenderer = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const common_1 = require("@theia/ai-chat/lib/common");
22
+ const React = require("@theia/core/shared/react");
23
+ const chat_progress_message_1 = require("../chat-progress-message");
24
+ let ProgressPartRenderer = class ProgressPartRenderer {
25
+ canHandle(response) {
26
+ if (common_1.ProgressChatResponseContent.is(response)) {
27
+ return 10;
28
+ }
29
+ return -1;
30
+ }
31
+ render(response) {
32
+ return (React.createElement(chat_progress_message_1.ProgressMessage, { content: response.message, status: 'inProgress' }));
33
+ }
34
+ };
35
+ exports.ProgressPartRenderer = ProgressPartRenderer;
36
+ exports.ProgressPartRenderer = ProgressPartRenderer = tslib_1.__decorate([
37
+ (0, inversify_1.injectable)()
38
+ ], ProgressPartRenderer);
39
+ //# sourceMappingURL=progress-part-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-part-renderer.js","sourceRoot":"","sources":["../../../src/browser/chat-response-renderer/progress-part-renderer.tsx"],"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;;;;AAGhF,4DAA0D;AAC1D,sDAA6F;AAE7F,kDAAkD;AAClD,oEAA2D;AAGpD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAE7B,SAAS,CAAC,QAA6B;QACnC,IAAI,oCAA2B,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3C,OAAO,EAAE,CAAC;QACd,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;IACd,CAAC;IAED,MAAM,CAAC,QAAqC;QACxC,OAAO,CACH,oBAAC,uCAAe,IAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAC,YAAY,GAAG,CACrE,CAAC;IACN,CAAC;CAEJ,CAAA;AAfY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,sBAAU,GAAE;GACA,oBAAoB,CAehC"}
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { ChatResponseContent, QuestionResponseContent } from '@theia/ai-chat';
3
+ import { ReactNode } from '@theia/core/shared/react';
4
+ import { ChatResponsePartRenderer } from '../chat-response-part-renderer';
5
+ import { ResponseNode } from '../chat-tree-view';
6
+ export declare class QuestionPartRenderer implements ChatResponsePartRenderer<QuestionResponseContent> {
7
+ canHandle(response: ChatResponseContent): number;
8
+ render(question: QuestionResponseContent, node: ResponseNode): ReactNode;
9
+ }
10
+ //# sourceMappingURL=question-part-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"question-part-renderer.d.ts","sourceRoot":"","sources":["../../../src/browser/chat-response-renderer/question-part-renderer.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAG9E,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,qBACa,oBACT,YAAW,wBAAwB,CAAC,uBAAuB,CAAC;IAE5D,SAAS,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM;IAOhD,MAAM,CAAC,QAAQ,EAAE,uBAAuB,EAAE,IAAI,EAAE,YAAY,GAAG,SAAS;CA6B3E"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuestionPartRenderer = 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 ai_chat_1 = require("@theia/ai-chat");
21
+ const inversify_1 = require("@theia/core/shared/inversify");
22
+ const React = require("@theia/core/shared/react");
23
+ let QuestionPartRenderer = class QuestionPartRenderer {
24
+ canHandle(response) {
25
+ if (ai_chat_1.QuestionResponseContent.is(response)) {
26
+ return 10;
27
+ }
28
+ return -1;
29
+ }
30
+ render(question, node) {
31
+ const isDisabled = question.isReadOnly || question.selectedOption !== undefined || !node.response.isWaitingForInput;
32
+ return (React.createElement("div", { className: "theia-QuestionPartRenderer-root" },
33
+ React.createElement("div", { className: "theia-QuestionPartRenderer-question" }, question.question),
34
+ React.createElement("div", { className: "theia-QuestionPartRenderer-options" }, question.options.map((option, index) => {
35
+ var _a;
36
+ return (React.createElement("button", { className: `theia-button theia-QuestionPartRenderer-option ${((_a = question.selectedOption) === null || _a === void 0 ? void 0 : _a.text) === option.text ? 'selected' : ''}`, onClick: () => {
37
+ if (!question.isReadOnly && question.handler) {
38
+ question.selectedOption = option;
39
+ question.handler(option);
40
+ }
41
+ }, disabled: isDisabled, key: index }, option.text));
42
+ }))));
43
+ }
44
+ };
45
+ exports.QuestionPartRenderer = QuestionPartRenderer;
46
+ exports.QuestionPartRenderer = QuestionPartRenderer = tslib_1.__decorate([
47
+ (0, inversify_1.injectable)()
48
+ ], QuestionPartRenderer);
49
+ //# sourceMappingURL=question-part-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"question-part-renderer.js","sourceRoot":"","sources":["../../../src/browser/chat-response-renderer/question-part-renderer.tsx"],"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,4CAA8E;AAC9E,4DAA0D;AAC1D,kDAAkD;AAM3C,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAG7B,SAAS,CAAC,QAA6B;QACnC,IAAI,iCAAuB,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvC,OAAO,EAAE,CAAC;QACd,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;IACd,CAAC;IAED,MAAM,CAAC,QAAiC,EAAE,IAAkB;QACxD,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,cAAc,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QAEpH,OAAO,CACH,6BAAK,SAAS,EAAC,iCAAiC;YAC5C,6BAAK,SAAS,EAAC,qCAAqC,IAAE,QAAQ,CAAC,QAAQ,CAAO;YAC9E,6BAAK,SAAS,EAAC,oCAAoC,IAE3C,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;;gBAAC,OAAA,CACpC,gCACI,SAAS,EAAE,kDAAkD,CAAA,MAAA,QAAQ,CAAC,cAAc,0CAAE,IAAI,MAAK,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,EAC9H,OAAO,EAAE,GAAG,EAAE;wBACV,IAAI,CAAC,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;4BAC3C,QAAQ,CAAC,cAAc,GAAG,MAAM,CAAC;4BACjC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;wBAC7B,CAAC;oBACL,CAAC,EACD,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,KAAK,IAET,MAAM,CAAC,IAAI,CACP,CACZ,CAAA;aAAA,CAAC,CAEJ,CACJ,CACT,CAAC;IACN,CAAC;CAEJ,CAAA;AAvCY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,sBAAU,GAAE;GACA,oBAAoB,CAuChC"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { ChatResponsePartRenderer } from '../chat-response-part-renderer';
3
+ import { ChatResponseContent } from '@theia/ai-chat/lib/common';
4
+ import { ReactNode } from '@theia/core/shared/react';
5
+ export declare class TextPartRenderer implements ChatResponsePartRenderer<ChatResponseContent> {
6
+ canHandle(_reponse: ChatResponseContent): number;
7
+ render(response: ChatResponseContent): ReactNode;
8
+ }
9
+ //# sourceMappingURL=text-part-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-part-renderer.d.ts","sourceRoot":"","sources":["../../../src/browser/chat-response-renderer/text-part-renderer.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAIrD,qBACa,gBAAiB,YAAW,wBAAwB,CAAC,mBAAmB,CAAC;IAClF,SAAS,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM;IAIhD,MAAM,CAAC,QAAQ,EAAE,mBAAmB,GAAG,SAAS;CAQnD"}
@@ -0,0 +1,43 @@
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.TextPartRenderer = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const common_1 = require("@theia/ai-chat/lib/common");
22
+ const nls_1 = require("@theia/core/lib/common/nls");
23
+ const React = require("@theia/core/shared/react");
24
+ let TextPartRenderer = class TextPartRenderer {
25
+ canHandle(_reponse) {
26
+ // this is the fallback renderer
27
+ return 1;
28
+ }
29
+ render(response) {
30
+ if (response && common_1.ChatResponseContent.hasAsString(response)) {
31
+ return React.createElement("span", null, response.asString());
32
+ }
33
+ return React.createElement("span", null,
34
+ nls_1.nls.localize('theia/ai/chat-ui/text-part-renderer/cantDisplay', "Can't display response, please check your ChatResponsePartRenderers!"),
35
+ " ",
36
+ JSON.stringify(response));
37
+ }
38
+ };
39
+ exports.TextPartRenderer = TextPartRenderer;
40
+ exports.TextPartRenderer = TextPartRenderer = tslib_1.__decorate([
41
+ (0, inversify_1.injectable)()
42
+ ], TextPartRenderer);
43
+ //# sourceMappingURL=text-part-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-part-renderer.js","sourceRoot":"","sources":["../../../src/browser/chat-response-renderer/text-part-renderer.tsx"],"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;;;;AAGhF,4DAA0D;AAC1D,sDAAgE;AAEhE,oDAAiD;AACjD,kDAAkD;AAG3C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IACzB,SAAS,CAAC,QAA6B;QACnC,gCAAgC;QAChC,OAAO,CAAC,CAAC;IACb,CAAC;IACD,MAAM,CAAC,QAA6B;QAChC,IAAI,QAAQ,IAAI,4BAAmB,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxD,OAAO,kCAAO,QAAQ,CAAC,QAAQ,EAAE,CAAQ,CAAC;QAC9C,CAAC;QACD,OAAO;YACF,SAAG,CAAC,QAAQ,CAAC,iDAAiD,EAC3D,sEAAsE,CAAC;;YAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAQ,CAAC;IACvH,CAAC;CACJ,CAAA;AAbY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,sBAAU,GAAE;GACA,gBAAgB,CAa5B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=text-part-renderer.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-part-renderer.spec.d.ts","sourceRoot":"","sources":["../../../src/browser/chat-response-renderer/text-part-renderer.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,46 @@
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
+ const text_part_renderer_1 = require("./text-part-renderer");
19
+ const chai_1 = require("chai");
20
+ describe('TextPartRenderer', () => {
21
+ it('accepts all parts', () => {
22
+ const renderer = new text_part_renderer_1.TextPartRenderer();
23
+ (0, chai_1.expect)(renderer.canHandle({ kind: 'text' })).to.be.greaterThan(0);
24
+ (0, chai_1.expect)(renderer.canHandle({ kind: 'code' })).to.be.greaterThan(0);
25
+ (0, chai_1.expect)(renderer.canHandle({ kind: 'command' })).to.be.greaterThan(0);
26
+ (0, chai_1.expect)(renderer.canHandle({ kind: 'error' })).to.be.greaterThan(0);
27
+ (0, chai_1.expect)(renderer.canHandle({ kind: 'horizontal' })).to.be.greaterThan(0);
28
+ (0, chai_1.expect)(renderer.canHandle({ kind: 'informational' })).to.be.greaterThan(0);
29
+ (0, chai_1.expect)(renderer.canHandle({ kind: 'markdownContent' })).to.be.greaterThan(0);
30
+ (0, chai_1.expect)(renderer.canHandle({ kind: 'toolCall' })).to.be.greaterThan(0);
31
+ (0, chai_1.expect)(renderer.canHandle(undefined)).to.be.greaterThan(0);
32
+ });
33
+ it('renders text correctly', () => {
34
+ const renderer = new text_part_renderer_1.TextPartRenderer();
35
+ const part = { kind: 'text', asString: () => 'Hello, World!' };
36
+ const node = renderer.render(part);
37
+ (0, chai_1.expect)(JSON.stringify(node)).to.contain('Hello, World!');
38
+ });
39
+ it('handles undefined content gracefully', () => {
40
+ const renderer = new text_part_renderer_1.TextPartRenderer();
41
+ const part = undefined;
42
+ const node = renderer.render(part);
43
+ (0, chai_1.expect)(node).to.exist;
44
+ });
45
+ });
46
+ //# sourceMappingURL=text-part-renderer.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-part-renderer.spec.js","sourceRoot":"","sources":["../../../src/browser/chat-response-renderer/text-part-renderer.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,6DAAwD;AACxD,+BAA8B;AAG9B,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAE9B,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QACzB,MAAM,QAAQ,GAAG,IAAI,qCAAgB,EAAE,CAAC;QACxC,IAAA,aAAM,EAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAClE,IAAA,aAAM,EAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAClE,IAAA,aAAM,EAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAA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AS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC5C,MAAM,QAAQ,GAAG,IAAI,qCAAgB,EAAE,CAAC;QACxC,MAAM,IAAI,GAAG,SAA2C,CAAC;QACzD,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACnC,IAAA,aAAM,EAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;IAC1B,CAAC,CAAC,CAAC;AAEP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { ChatResponsePartRenderer } from '../chat-response-part-renderer';
3
+ import { ChatResponseContent, ThinkingChatResponseContent } from '@theia/ai-chat/lib/common';
4
+ import { ReactNode } from '@theia/core/shared/react';
5
+ export declare class ThinkingPartRenderer implements ChatResponsePartRenderer<ThinkingChatResponseContent> {
6
+ canHandle(response: ChatResponseContent): number;
7
+ render(response: ThinkingChatResponseContent): ReactNode;
8
+ }
9
+ //# sourceMappingURL=thinking-part-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thinking-part-renderer.d.ts","sourceRoot":"","sources":["../../../src/browser/chat-response-renderer/thinking-part-renderer.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAIrD,qBACa,oBAAqB,YAAW,wBAAwB,CAAC,2BAA2B,CAAC;IAE9F,SAAS,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM;IAOhD,MAAM,CAAC,QAAQ,EAAE,2BAA2B,GAAG,SAAS;CAU3D"}
@@ -0,0 +1,42 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ThinkingPartRenderer = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const common_1 = require("@theia/ai-chat/lib/common");
22
+ const nls_1 = require("@theia/core/lib/common/nls");
23
+ const React = require("@theia/core/shared/react");
24
+ let ThinkingPartRenderer = class ThinkingPartRenderer {
25
+ canHandle(response) {
26
+ if (common_1.ThinkingChatResponseContent.is(response)) {
27
+ return 10;
28
+ }
29
+ return -1;
30
+ }
31
+ render(response) {
32
+ return (React.createElement("div", { className: 'theia-thinking' },
33
+ React.createElement("details", null,
34
+ React.createElement("summary", null, nls_1.nls.localize('theia/ai/chat-ui/thinking-part-renderer/thinking', 'Thinking')),
35
+ React.createElement("pre", null, response.content))));
36
+ }
37
+ };
38
+ exports.ThinkingPartRenderer = ThinkingPartRenderer;
39
+ exports.ThinkingPartRenderer = ThinkingPartRenderer = tslib_1.__decorate([
40
+ (0, inversify_1.injectable)()
41
+ ], ThinkingPartRenderer);
42
+ //# sourceMappingURL=thinking-part-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thinking-part-renderer.js","sourceRoot":"","sources":["../../../src/browser/chat-response-renderer/thinking-part-renderer.tsx"],"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;;;;AAGhF,4DAA0D;AAC1D,sDAA6F;AAE7F,oDAAiD;AACjD,kDAAkD;AAG3C,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAE7B,SAAS,CAAC,QAA6B;QACnC,IAAI,oCAA2B,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3C,OAAO,EAAE,CAAC;QACd,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;IACd,CAAC;IAED,MAAM,CAAC,QAAqC;QACxC,OAAO,CACH,6BAAK,SAAS,EAAC,gBAAgB;YAC3B;gBACI,qCAAU,SAAG,CAAC,QAAQ,CAAC,kDAAkD,EAAE,UAAU,CAAC,CAAW;gBACjG,iCAAM,QAAQ,CAAC,OAAO,CAAO,CACvB,CACR,CACT,CAAC;IACN,CAAC;CACJ,CAAA;AAnBY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,sBAAU,GAAE;GACA,oBAAoB,CAmBhC"}