@theia/ai-chat 1.58.3 → 1.59.0-next.72

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 (128) hide show
  1. package/lib/browser/ai-chat-frontend-module.d.ts.map +1 -1
  2. package/lib/browser/ai-chat-frontend-module.js +16 -13
  3. package/lib/browser/ai-chat-frontend-module.js.map +1 -1
  4. package/lib/browser/ai-chat-preferences.d.ts +1 -0
  5. package/lib/browser/ai-chat-preferences.d.ts.map +1 -1
  6. package/lib/browser/ai-chat-preferences.js +12 -3
  7. package/lib/browser/ai-chat-preferences.js.map +1 -1
  8. package/lib/browser/change-set-file-element.d.ts +31 -6
  9. package/lib/browser/change-set-file-element.d.ts.map +1 -1
  10. package/lib/browser/change-set-file-element.js +108 -15
  11. package/lib/browser/change-set-file-element.js.map +1 -1
  12. package/lib/browser/change-set-file-resource.d.ts +40 -8
  13. package/lib/browser/change-set-file-resource.d.ts.map +1 -1
  14. package/lib/browser/change-set-file-resource.js +123 -37
  15. package/lib/browser/change-set-file-resource.js.map +1 -1
  16. package/lib/browser/change-set-file-service.d.ts +9 -3
  17. package/lib/browser/change-set-file-service.d.ts.map +1 -1
  18. package/lib/browser/change-set-file-service.js +35 -13
  19. package/lib/browser/change-set-file-service.js.map +1 -1
  20. package/lib/browser/change-set-variable.d.ts +11 -0
  21. package/lib/browser/change-set-variable.d.ts.map +1 -0
  22. package/lib/browser/change-set-variable.js +56 -0
  23. package/lib/browser/change-set-variable.js.map +1 -0
  24. package/lib/browser/context-file-variable-label-provider.d.ts +14 -0
  25. package/lib/browser/context-file-variable-label-provider.d.ts.map +1 -0
  26. package/lib/browser/context-file-variable-label-provider.js +63 -0
  27. package/lib/browser/context-file-variable-label-provider.js.map +1 -0
  28. package/lib/browser/context-variable-label-provider.d.ts +9 -0
  29. package/lib/browser/context-variable-label-provider.d.ts.map +1 -0
  30. package/lib/browser/context-variable-label-provider.js +55 -0
  31. package/lib/browser/context-variable-label-provider.js.map +1 -0
  32. package/lib/browser/file-chat-variable-contribution.d.ts +18 -0
  33. package/lib/browser/file-chat-variable-contribution.d.ts.map +1 -0
  34. package/lib/browser/file-chat-variable-contribution.js +135 -0
  35. package/lib/browser/file-chat-variable-contribution.js.map +1 -0
  36. package/lib/browser/frontend-chat-service.d.ts +10 -3
  37. package/lib/browser/frontend-chat-service.d.ts.map +1 -1
  38. package/lib/browser/frontend-chat-service.js +39 -19
  39. package/lib/browser/frontend-chat-service.js.map +1 -1
  40. package/lib/common/chat-agents.d.ts +54 -24
  41. package/lib/common/chat-agents.d.ts.map +1 -1
  42. package/lib/common/chat-agents.js +58 -20
  43. package/lib/common/chat-agents.js.map +1 -1
  44. package/lib/common/chat-history-entry.js +1 -1
  45. package/lib/common/chat-history-entry.js.map +1 -1
  46. package/lib/common/chat-model.d.ts +84 -36
  47. package/lib/common/chat-model.d.ts.map +1 -1
  48. package/lib/common/chat-model.js +142 -51
  49. package/lib/common/chat-model.js.map +1 -1
  50. package/lib/common/chat-service.d.ts +27 -10
  51. package/lib/common/chat-service.d.ts.map +1 -1
  52. package/lib/common/chat-service.js +80 -20
  53. package/lib/common/chat-service.js.map +1 -1
  54. package/lib/common/chat-string-utils.d.ts +3 -0
  55. package/lib/common/chat-string-utils.d.ts.map +1 -0
  56. package/lib/common/chat-string-utils.js +27 -0
  57. package/lib/common/chat-string-utils.js.map +1 -0
  58. package/lib/common/chat-tool-request-service.d.ts +5 -5
  59. package/lib/common/chat-tool-request-service.d.ts.map +1 -1
  60. package/lib/common/chat-tool-request-service.js.map +1 -1
  61. package/lib/common/context-details-variable.d.ts +9 -0
  62. package/lib/common/context-details-variable.d.ts.map +1 -0
  63. package/lib/common/context-details-variable.js +57 -0
  64. package/lib/common/context-details-variable.js.map +1 -0
  65. package/lib/common/context-summary-variable.d.ts +9 -0
  66. package/lib/common/context-summary-variable.d.ts.map +1 -0
  67. package/lib/common/context-summary-variable.js +57 -0
  68. package/lib/common/context-summary-variable.js.map +1 -0
  69. package/lib/common/context-variables.d.ts +4 -0
  70. package/lib/common/context-variables.d.ts.map +1 -0
  71. package/lib/common/context-variables.js +22 -0
  72. package/lib/common/context-variables.js.map +1 -0
  73. package/lib/common/custom-chat-agent.d.ts +6 -10
  74. package/lib/common/custom-chat-agent.d.ts.map +1 -1
  75. package/lib/common/custom-chat-agent.js +8 -11
  76. package/lib/common/custom-chat-agent.js.map +1 -1
  77. package/lib/common/index.d.ts +1 -3
  78. package/lib/common/index.d.ts.map +1 -1
  79. package/lib/common/index.js +1 -3
  80. package/lib/common/index.js.map +1 -1
  81. package/lib/common/parse-contents.d.ts +2 -2
  82. package/lib/common/parse-contents.d.ts.map +1 -1
  83. package/lib/common/parse-contents.js.map +1 -1
  84. package/lib/common/parse-contents.spec.d.ts.map +1 -1
  85. package/lib/common/parse-contents.spec.js.map +1 -1
  86. package/lib/common/response-content-matcher.d.ts +3 -3
  87. package/lib/common/response-content-matcher.d.ts.map +1 -1
  88. package/lib/common/response-content-matcher.js.map +1 -1
  89. package/package.json +12 -10
  90. package/src/browser/ai-chat-frontend-module.ts +20 -18
  91. package/src/browser/ai-chat-preferences.ts +13 -2
  92. package/src/browser/change-set-file-element.ts +109 -20
  93. package/src/browser/change-set-file-resource.ts +125 -39
  94. package/src/browser/change-set-file-service.ts +38 -16
  95. package/src/browser/change-set-variable.ts +54 -0
  96. package/src/browser/context-file-variable-label-provider.ts +62 -0
  97. package/src/browser/context-variable-label-provider.ts +56 -0
  98. package/src/browser/file-chat-variable-contribution.ts +143 -0
  99. package/src/browser/frontend-chat-service.ts +40 -26
  100. package/src/common/chat-agents.ts +87 -30
  101. package/src/common/chat-history-entry.ts +1 -1
  102. package/src/common/chat-model.ts +204 -70
  103. package/src/common/chat-service.ts +92 -24
  104. package/src/common/chat-string-utils.ts +23 -0
  105. package/src/common/chat-tool-request-service.ts +5 -5
  106. package/src/common/context-details-variable.ts +53 -0
  107. package/src/common/context-summary-variable.ts +53 -0
  108. package/src/common/context-variables.ts +19 -0
  109. package/src/common/custom-chat-agent.ts +9 -20
  110. package/src/common/index.ts +1 -3
  111. package/src/common/parse-contents.spec.ts +2 -2
  112. package/src/common/parse-contents.ts +2 -2
  113. package/src/common/response-content-matcher.ts +3 -3
  114. package/lib/common/command-chat-agents.d.ts +0 -33
  115. package/lib/common/command-chat-agents.d.ts.map +0 -1
  116. package/lib/common/command-chat-agents.js +0 -329
  117. package/lib/common/command-chat-agents.js.map +0 -1
  118. package/lib/common/orchestrator-chat-agent.d.ts +0 -22
  119. package/lib/common/orchestrator-chat-agent.d.ts.map +0 -1
  120. package/lib/common/orchestrator-chat-agent.js +0 -167
  121. package/lib/common/orchestrator-chat-agent.js.map +0 -1
  122. package/lib/common/universal-chat-agent.d.ts +0 -16
  123. package/lib/common/universal-chat-agent.d.ts.map +0 -1
  124. package/lib/common/universal-chat-agent.js +0 -109
  125. package/lib/common/universal-chat-agent.js.map +0 -1
  126. package/src/common/command-chat-agents.ts +0 -354
  127. package/src/common/orchestrator-chat-agent.ts +0 -179
  128. package/src/common/universal-chat-agent.ts +0 -117
@@ -1,117 +0,0 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2024 EclipseSource GmbH.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { AgentSpecificVariables } from '@theia/ai-core';
18
- import {
19
- PromptTemplate
20
- } from '@theia/ai-core/lib/common';
21
- import { injectable } from '@theia/core/shared/inversify';
22
- import { AbstractStreamParsingChatAgent, ChatAgent, SystemMessageDescription } from './chat-agents';
23
-
24
- export const universalTemplate: PromptTemplate = {
25
- id: 'universal-system',
26
- template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
27
- https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
28
- # Instructions
29
-
30
- You are an AI assistant integrated into the Theia IDE, specifically designed to help software developers by
31
- providing concise and accurate answers to programming-related questions. Your role is to enhance the
32
- developer's productivity by offering quick solutions, explanations, and best practices.
33
- Keep responses short and to the point, focusing on delivering valuable insights, best practices and
34
- simple solutions.
35
-
36
- ### Guidelines
37
-
38
- 1. **Understand Context:**
39
- - Assess the context of the code or issue when available.
40
- - Tailor responses to be relevant to the programming language, framework, or tools like Eclipse Theia.
41
- - Ask clarifying questions if necessary to provide accurate assistance.
42
-
43
- 2. **Provide Clear Solutions:**
44
- - Offer direct answers or code snippets that solve the problem or clarify the concept.
45
- - Avoid lengthy explanations unless necessary for understanding.
46
-
47
- 3. **Promote Best Practices:**
48
- - Suggest best practices and common patterns relevant to the question.
49
- - Provide links to official documentation for further reading when applicable.
50
-
51
- 4. **Support Multiple Languages and Tools:**
52
- - Be familiar with popular programming languages, frameworks, IDEs like Eclipse Theia, and command-line tools.
53
- - Adapt advice based on the language, environment, or tools specified by the developer.
54
-
55
- 5. **Facilitate Learning:**
56
- - Encourage learning by explaining why a solution works or why a particular approach is recommended.
57
- - Keep explanations concise and educational.
58
-
59
- 6. **Maintain Professional Tone:**
60
- - Communicate in a friendly, professional manner.
61
- - Use technical jargon appropriately, ensuring clarity for the target audience.
62
-
63
- 7. **Stay on Topic:**
64
- - Limit responses strictly to topics related to software development, frameworks, Eclipse Theia, terminal usage, and relevant technologies.
65
- - Politely decline to answer questions unrelated to these areas by saying, "I'm here to assist with programming-related questions.
66
- For other topics, please refer to a specialized source."
67
-
68
- ### Example Interactions
69
-
70
- - **Question:** "What's the difference between \`let\` and \`var\` in JavaScript?"
71
- **Answer:** "\`let\` is block-scoped, while \`var\` is function-scoped. Prefer \`let\` to avoid scope-related bugs."
72
-
73
- - **Question:** "How do I handle exceptions in Java?"
74
- **Answer:** "Use try-catch blocks: \`\`\`java try { /* code */ } catch (ExceptionType e) { /* handle exception */ }\`\`\`."
75
-
76
- - **Question:** "What is the capital of France?"
77
- **Answer:** "I'm here to assist with programming-related queries. For other topics, please refer to a specialized source."
78
- `
79
- };
80
-
81
- export const universalTemplateVariant: PromptTemplate = {
82
- id: 'universal-system-empty',
83
- template: '',
84
- variantOf: universalTemplate.id,
85
- };
86
-
87
- @injectable()
88
- export class UniversalChatAgent extends AbstractStreamParsingChatAgent implements ChatAgent {
89
- name: string;
90
- description: string;
91
- variables: string[];
92
- promptTemplates: PromptTemplate[];
93
- readonly functions: string[];
94
- readonly agentSpecificVariables: AgentSpecificVariables[];
95
-
96
- constructor() {
97
- super('Universal', [{
98
- purpose: 'chat',
99
- identifier: 'openai/gpt-4o',
100
- }], 'chat');
101
- this.name = 'Universal';
102
- this.description = 'This agent is designed to help software developers by providing concise and accurate '
103
- + 'answers to general programming and software development questions. It is also the fall-back for any generic '
104
- + 'questions the user might ask. The universal agent currently does not have any context by default, i.e. it cannot '
105
- + 'access the current user context or the workspace.';
106
- this.variables = [];
107
- this.promptTemplates = [universalTemplate, universalTemplateVariant];
108
- this.functions = [];
109
- this.agentSpecificVariables = [];
110
- }
111
-
112
- protected override async getSystemMessageDescription(): Promise<SystemMessageDescription | undefined> {
113
- const resolvedPrompt = await this.promptService.getPrompt(universalTemplate.id);
114
- return resolvedPrompt ? SystemMessageDescription.fromResolvedPromptTemplate(resolvedPrompt) : undefined;
115
- }
116
-
117
- }