@theia/ai-ide 1.67.0-next.59 → 1.67.0
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.
- package/lib/browser/address-pr-review-command-contribution.d.ts +9 -0
- package/lib/browser/address-pr-review-command-contribution.d.ts.map +1 -0
- package/lib/browser/address-pr-review-command-contribution.js +176 -0
- package/lib/browser/address-pr-review-command-contribution.js.map +1 -0
- package/lib/browser/ai-configuration/agent-configuration-widget.d.ts +12 -6
- package/lib/browser/ai-configuration/agent-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/agent-configuration-widget.js +158 -106
- package/lib/browser/ai-configuration/agent-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/base/ai-card-grid-configuration-widget.d.ts +32 -0
- package/lib/browser/ai-configuration/base/ai-card-grid-configuration-widget.d.ts.map +1 -0
- package/lib/browser/ai-configuration/base/ai-card-grid-configuration-widget.js +55 -0
- package/lib/browser/ai-configuration/base/ai-card-grid-configuration-widget.js.map +1 -0
- package/lib/browser/ai-configuration/base/ai-configuration-base-widget.d.ts +14 -0
- package/lib/browser/ai-configuration/base/ai-configuration-base-widget.d.ts.map +1 -0
- package/lib/browser/ai-configuration/base/ai-configuration-base-widget.js +35 -0
- package/lib/browser/ai-configuration/base/ai-configuration-base-widget.js.map +1 -0
- package/lib/browser/ai-configuration/base/ai-hierarchical-configuration-widget.d.ts +23 -0
- package/lib/browser/ai-configuration/base/ai-hierarchical-configuration-widget.d.ts.map +1 -0
- package/lib/browser/ai-configuration/base/ai-hierarchical-configuration-widget.js +60 -0
- package/lib/browser/ai-configuration/base/ai-hierarchical-configuration-widget.js.map +1 -0
- package/lib/browser/ai-configuration/base/ai-list-detail-configuration-widget.d.ts +56 -0
- package/lib/browser/ai-configuration/base/ai-list-detail-configuration-widget.d.ts.map +1 -0
- package/lib/browser/ai-configuration/base/ai-list-detail-configuration-widget.js +96 -0
- package/lib/browser/ai-configuration/base/ai-list-detail-configuration-widget.js.map +1 -0
- package/lib/browser/ai-configuration/base/ai-table-configuration-widget.d.ts +45 -0
- package/lib/browser/ai-configuration/base/ai-table-configuration-widget.d.ts.map +1 -0
- package/lib/browser/ai-configuration/base/ai-table-configuration-widget.js +66 -0
- package/lib/browser/ai-configuration/base/ai-table-configuration-widget.js.map +1 -0
- package/lib/browser/ai-configuration/components/configuration-section.d.ts +13 -0
- package/lib/browser/ai-configuration/components/configuration-section.d.ts.map +1 -0
- package/lib/browser/ai-configuration/components/configuration-section.js +28 -0
- package/lib/browser/ai-configuration/components/configuration-section.js.map +1 -0
- package/lib/browser/ai-configuration/components/empty-state.d.ts +11 -0
- package/lib/browser/ai-configuration/components/empty-state.d.ts.map +1 -0
- package/lib/browser/ai-configuration/components/empty-state.js +26 -0
- package/lib/browser/ai-configuration/components/empty-state.js.map +1 -0
- package/lib/browser/ai-configuration/components/expandable-section.d.ts +14 -0
- package/lib/browser/ai-configuration/components/expandable-section.d.ts.map +1 -0
- package/lib/browser/ai-configuration/components/expandable-section.js +31 -0
- package/lib/browser/ai-configuration/components/expandable-section.js.map +1 -0
- package/lib/browser/ai-configuration/language-model-renderer.d.ts.map +1 -1
- package/lib/browser/ai-configuration/language-model-renderer.js +23 -22
- package/lib/browser/ai-configuration/language-model-renderer.js.map +1 -1
- package/lib/browser/ai-configuration/mcp-configuration-widget.d.ts +0 -1
- package/lib/browser/ai-configuration/mcp-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/mcp-configuration-widget.js +88 -82
- package/lib/browser/ai-configuration/mcp-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/model-aliases-configuration-widget.d.ts +8 -22
- package/lib/browser/ai-configuration/model-aliases-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/model-aliases-configuration-widget.js +49 -78
- package/lib/browser/ai-configuration/model-aliases-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.js +10 -10
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/template-settings-renderer.d.ts.map +1 -1
- package/lib/browser/ai-configuration/template-settings-renderer.js +11 -11
- package/lib/browser/ai-configuration/template-settings-renderer.js.map +1 -1
- package/lib/browser/ai-configuration/token-usage-configuration-widget.d.ts +7 -8
- package/lib/browser/ai-configuration/token-usage-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/token-usage-configuration-widget.js +93 -79
- package/lib/browser/ai-configuration/token-usage-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/tools-configuration-widget.d.ts +12 -7
- package/lib/browser/ai-configuration/tools-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/tools-configuration-widget.js +45 -37
- package/lib/browser/ai-configuration/tools-configuration-widget.js.map +1 -1
- package/lib/browser/ai-configuration/variable-configuration-widget.d.ts +8 -4
- package/lib/browser/ai-configuration/variable-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/variable-configuration-widget.js +61 -28
- package/lib/browser/ai-configuration/variable-configuration-widget.js.map +1 -1
- package/lib/browser/analyze-gh-ticket-command-contribution.d.ts +9 -0
- package/lib/browser/analyze-gh-ticket-command-contribution.d.ts.map +1 -0
- package/lib/browser/analyze-gh-ticket-command-contribution.js +172 -0
- package/lib/browser/analyze-gh-ticket-command-contribution.js.map +1 -0
- package/lib/browser/default-chat-agent-recommendation-service.d.ts +5 -0
- package/lib/browser/default-chat-agent-recommendation-service.d.ts.map +1 -0
- package/lib/browser/default-chat-agent-recommendation-service.js +47 -0
- package/lib/browser/default-chat-agent-recommendation-service.js.map +1 -0
- package/lib/browser/frontend-module.d.ts.map +1 -1
- package/lib/browser/frontend-module.js +9 -3
- package/lib/browser/frontend-module.js.map +1 -1
- package/lib/browser/ide-chat-welcome-message-provider.d.ts +36 -0
- package/lib/browser/ide-chat-welcome-message-provider.d.ts.map +1 -1
- package/lib/browser/ide-chat-welcome-message-provider.js +204 -1
- package/lib/browser/ide-chat-welcome-message-provider.js.map +1 -1
- package/lib/browser/implement-gh-ticket-command-contribution.d.ts +9 -0
- package/lib/browser/implement-gh-ticket-command-contribution.d.ts.map +1 -0
- package/lib/browser/implement-gh-ticket-command-contribution.js +156 -0
- package/lib/browser/implement-gh-ticket-command-contribution.js.map +1 -0
- package/package.json +21 -21
- package/src/browser/address-pr-review-command-contribution.ts +180 -0
- package/src/browser/ai-configuration/agent-configuration-widget.tsx +258 -137
- package/src/browser/ai-configuration/base/ai-card-grid-configuration-widget.tsx +72 -0
- package/src/browser/ai-configuration/base/ai-configuration-base-widget.tsx +37 -0
- package/src/browser/ai-configuration/base/ai-hierarchical-configuration-widget.tsx +51 -0
- package/src/browser/ai-configuration/base/ai-list-detail-configuration-widget.tsx +140 -0
- package/src/browser/ai-configuration/base/ai-table-configuration-widget.tsx +107 -0
- package/src/browser/ai-configuration/components/configuration-section.tsx +37 -0
- package/src/browser/ai-configuration/components/empty-state.tsx +30 -0
- package/src/browser/ai-configuration/components/expandable-section.tsx +51 -0
- package/src/browser/ai-configuration/language-model-renderer.tsx +68 -63
- package/src/browser/ai-configuration/mcp-configuration-widget.tsx +82 -87
- package/src/browser/ai-configuration/model-aliases-configuration-widget.tsx +93 -107
- package/src/browser/ai-configuration/prompt-fragments-configuration-widget.tsx +10 -10
- package/src/browser/ai-configuration/template-settings-renderer.tsx +25 -29
- package/src/browser/ai-configuration/token-usage-configuration-widget.tsx +131 -131
- package/src/browser/ai-configuration/tools-configuration-widget.tsx +70 -61
- package/src/browser/ai-configuration/variable-configuration-widget.tsx +95 -45
- package/src/browser/analyze-gh-ticket-command-contribution.ts +176 -0
- package/src/browser/default-chat-agent-recommendation-service.ts +43 -0
- package/src/browser/frontend-module.ts +12 -7
- package/src/browser/ide-chat-welcome-message-provider.tsx +300 -2
- package/src/browser/implement-gh-ticket-command-contribution.ts +160 -0
- package/src/browser/style/ai-configuration-base.css +90 -0
- package/src/browser/style/ai-configuration-cards.css +60 -0
- package/src/browser/style/ai-configuration-hierarchical.css +61 -0
- package/src/browser/style/ai-configuration-list-detail.css +88 -0
- package/src/browser/style/ai-configuration-table.css +73 -0
- package/src/browser/style/index.css +596 -261
- package/src/browser/style/widgets/mcp-configuration.css +253 -0
- package/src/browser/style/widgets/model-aliases-configuration.css +74 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
2
|
+
import { PromptService } from '@theia/ai-core/lib/common';
|
|
3
|
+
export declare class AddressGhReviewCommandContribution implements FrontendApplicationContribution {
|
|
4
|
+
protected readonly promptService: PromptService;
|
|
5
|
+
onStart(): void;
|
|
6
|
+
protected registerAddressGhReviewCommand(): void;
|
|
7
|
+
protected buildCommandTemplate(): string;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=address-pr-review-command-contribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-pr-review-command-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/address-pr-review-command-contribution.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAK1D,qBACa,kCAAmC,YAAW,+BAA+B;IAGtF,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IAEhD,OAAO,IAAI,IAAI;IAIf,SAAS,CAAC,8BAA8B,IAAI,IAAI;IAoBhD,SAAS,CAAC,oBAAoB,IAAI,MAAM;CA8H3C"}
|
|
@@ -0,0 +1,176 @@
|
|
|
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.AddressGhReviewCommandContribution = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
const common_1 = require("@theia/ai-core/lib/common");
|
|
22
|
+
const core_1 = require("@theia/core");
|
|
23
|
+
const agent_delegation_tool_1 = require("@theia/ai-chat/lib/browser/agent-delegation-tool");
|
|
24
|
+
const github_chat_agent_1 = require("./github-chat-agent");
|
|
25
|
+
let AddressGhReviewCommandContribution = class AddressGhReviewCommandContribution {
|
|
26
|
+
onStart() {
|
|
27
|
+
this.registerAddressGhReviewCommand();
|
|
28
|
+
}
|
|
29
|
+
registerAddressGhReviewCommand() {
|
|
30
|
+
const commandTemplate = this.buildCommandTemplate();
|
|
31
|
+
this.promptService.addBuiltInPromptFragment({
|
|
32
|
+
id: 'address-gh-review',
|
|
33
|
+
template: commandTemplate,
|
|
34
|
+
isCommand: true,
|
|
35
|
+
commandName: 'address-gh-review',
|
|
36
|
+
commandDescription: core_1.nls.localize('theia/ai-ide/addressGhReviewCommand/description', 'Address review comments on a GitHub pull request'),
|
|
37
|
+
commandArgumentHint: core_1.nls.localize('theia/ai-ide/addressGhReviewCommand/argumentHint', '<pr-number>'),
|
|
38
|
+
commandAgents: ['Coder']
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
buildCommandTemplate() {
|
|
42
|
+
return `You have been asked to address review comments on a GitHub pull request.
|
|
43
|
+
|
|
44
|
+
## Pull Request Number
|
|
45
|
+
$ARGUMENTS
|
|
46
|
+
|
|
47
|
+
## Task Overview
|
|
48
|
+
You need to retrieve all details about the specified pull request, especially the review comments, assess whether you can safely address all comments, and if so,
|
|
49
|
+
implement the requested changes.
|
|
50
|
+
|
|
51
|
+
## Step 1: Retrieve Pull Request Information
|
|
52
|
+
Use the ~{${agent_delegation_tool_1.AGENT_DELEGATION_FUNCTION_ID}} tool to delegate to the GitHub agent and retrieve comprehensive information about the pull request.
|
|
53
|
+
|
|
54
|
+
**Agent ID:** '${github_chat_agent_1.GitHubChatAgentId}'
|
|
55
|
+
**Prompt:** Ask the GitHub agent to retrieve ALL details about PR #$ARGUMENTS, specifically requesting:
|
|
56
|
+
- The PR title and description
|
|
57
|
+
- The current state of the PR (open, closed, merged)
|
|
58
|
+
- ALL review comments - this is critical, every single review comment must be retrieved
|
|
59
|
+
- General PR comments (conversation)
|
|
60
|
+
- The list of files changed in the PR
|
|
61
|
+
- Any referenced issues
|
|
62
|
+
- Review status (approved, changes requested, etc.)
|
|
63
|
+
|
|
64
|
+
Example delegation prompt:
|
|
65
|
+
\`\`\`
|
|
66
|
+
Please retrieve comprehensive information about pull request #$ARGUMENTS. I need:
|
|
67
|
+
1. The PR title, description, and current state
|
|
68
|
+
2. ALL review comments on this PR - every single inline review comment is critical
|
|
69
|
+
3. ALL general conversation comments on the PR
|
|
70
|
+
4. The list of files changed in this PR
|
|
71
|
+
5. The current review status (approved, changes requested, pending)
|
|
72
|
+
6. Any linked or referenced issues
|
|
73
|
+
|
|
74
|
+
This is for addressing the review comments, so completeness is absolutely crucial. Make sure to get every review comment.
|
|
75
|
+
\`\`\`
|
|
76
|
+
|
|
77
|
+
## Step 2: Analyze and Categorize Review Comments
|
|
78
|
+
After receiving the PR information, analyze each review comment and categorize them:
|
|
79
|
+
|
|
80
|
+
### Categories of Review Comments:
|
|
81
|
+
1. **Clear code changes**: Comments requesting specific, unambiguous code modifications (e.g., "rename this variable", "add null check here", "fix this typo")
|
|
82
|
+
2. **Style/formatting fixes**: Comments about code style, formatting, or conventions
|
|
83
|
+
3. **Bug fixes**: Comments pointing out bugs or issues that need to be fixed
|
|
84
|
+
4. **Clarification questions**: Reviewers asking questions that need answers, not code changes
|
|
85
|
+
5. **Design discussions**: Comments about architectural or design decisions that require human judgment
|
|
86
|
+
6. **Ambiguous requests**: Comments that are unclear or could be interpreted multiple ways
|
|
87
|
+
|
|
88
|
+
### Criteria for Safely Addressable Comments:
|
|
89
|
+
- The requested change is clearly specified
|
|
90
|
+
- The change is localized and well-scoped
|
|
91
|
+
- No architectural or design decisions are required
|
|
92
|
+
- The change doesn't conflict with other review comments
|
|
93
|
+
- You have enough context to make the change correctly
|
|
94
|
+
|
|
95
|
+
### Criteria for Comments Requiring Clarification:
|
|
96
|
+
- The comment is ambiguous or vague
|
|
97
|
+
- Multiple valid interpretations exist
|
|
98
|
+
- The comment requires design decisions
|
|
99
|
+
- Comments conflict with each other
|
|
100
|
+
- The reviewer is asking a question rather than requesting a change
|
|
101
|
+
|
|
102
|
+
## Step 3: Respond Based on Analysis
|
|
103
|
+
|
|
104
|
+
### If ANY comments cannot be safely addressed:
|
|
105
|
+
List all comments and their status, then ask for clarification on the problematic ones:
|
|
106
|
+
|
|
107
|
+
Example response format:
|
|
108
|
+
\`\`\`
|
|
109
|
+
## PR Review Analysis
|
|
110
|
+
|
|
111
|
+
### Comments I Can Address:
|
|
112
|
+
1. [File: path/to/file.ts, Line X] - "[Comment summary]" - Will [action]
|
|
113
|
+
2. [File: path/to/file.ts, Line Y] - "[Comment summary]" - Will [action]
|
|
114
|
+
|
|
115
|
+
### Comments Requiring Clarification:
|
|
116
|
+
1. [File: path/to/file.ts, Line Z] - "[Comment summary]"
|
|
117
|
+
- **Issue**: [Why this needs clarification]
|
|
118
|
+
- **Question**: [Specific question to resolve ambiguity]
|
|
119
|
+
|
|
120
|
+
2. [File: path/to/other.ts, Line W] - "[Comment summary]"
|
|
121
|
+
- **Issue**: [Why this needs clarification]
|
|
122
|
+
- **Question**: [Specific question to resolve ambiguity]
|
|
123
|
+
|
|
124
|
+
### Conflicting Comments:
|
|
125
|
+
- [Describe any conflicts between review comments]
|
|
126
|
+
|
|
127
|
+
Please provide clarification on the above items. Once clarified, I can proceed to address all review comments.
|
|
128
|
+
|
|
129
|
+
Alternatively, if you'd like me to proceed with just the comments I can safely address, please confirm.
|
|
130
|
+
\`\`\`
|
|
131
|
+
|
|
132
|
+
### If ALL comments can be safely addressed:
|
|
133
|
+
Proceed with implementing all the requested changes:
|
|
134
|
+
|
|
135
|
+
1. **List all comments** and what you will do to address each one
|
|
136
|
+
2. **Implement the changes** file by file, addressing each review comment
|
|
137
|
+
3. **Explain each change** as you make it, referencing the original review comment
|
|
138
|
+
4. **Summarize** all changes made at the end
|
|
139
|
+
|
|
140
|
+
Example response format:
|
|
141
|
+
\`\`\`
|
|
142
|
+
## PR Review Analysis
|
|
143
|
+
|
|
144
|
+
All review comments can be safely addressed. Proceeding with implementation.
|
|
145
|
+
|
|
146
|
+
### Review Comments to Address:
|
|
147
|
+
1. [File: path/to/file.ts, Line X] - "[Comment summary]" - Will [action]
|
|
148
|
+
2. [File: path/to/file.ts, Line Y] - "[Comment summary]" - Will [action]
|
|
149
|
+
...
|
|
150
|
+
|
|
151
|
+
### Implementation
|
|
152
|
+
[Proceed to make changes, explaining each one]
|
|
153
|
+
|
|
154
|
+
### Summary
|
|
155
|
+
[List all changes made and which review comments they address]
|
|
156
|
+
\`\`\`
|
|
157
|
+
|
|
158
|
+
## Important Guidelines
|
|
159
|
+
- Always preserve the intent of the original code while addressing review comments
|
|
160
|
+
- If a review comment conflicts with the existing code style, follow the project's conventions
|
|
161
|
+
- Make minimal changes - only change what's necessary to address each comment
|
|
162
|
+
- If you discover issues beyond the review comments, mention them but don't fix them unless asked
|
|
163
|
+
- After implementation, provide a summary that maps each change to the review comment it addresses
|
|
164
|
+
|
|
165
|
+
Remember: It's better to ask for clarification than to make assumptions that could introduce bugs or go against the reviewer's intent.`;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
exports.AddressGhReviewCommandContribution = AddressGhReviewCommandContribution;
|
|
169
|
+
tslib_1.__decorate([
|
|
170
|
+
(0, inversify_1.inject)(common_1.PromptService),
|
|
171
|
+
tslib_1.__metadata("design:type", Object)
|
|
172
|
+
], AddressGhReviewCommandContribution.prototype, "promptService", void 0);
|
|
173
|
+
exports.AddressGhReviewCommandContribution = AddressGhReviewCommandContribution = tslib_1.__decorate([
|
|
174
|
+
(0, inversify_1.injectable)()
|
|
175
|
+
], AddressGhReviewCommandContribution);
|
|
176
|
+
//# sourceMappingURL=address-pr-review-command-contribution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-pr-review-command-contribution.js","sourceRoot":"","sources":["../../src/browser/address-pr-review-command-contribution.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;;;;AAGhF,4DAAkE;AAClE,sDAA0D;AAC1D,sCAAkC;AAClC,4FAAgG;AAChG,2DAAwD;AAGjD,IAAM,kCAAkC,GAAxC,MAAM,kCAAkC;IAK3C,OAAO;QACH,IAAI,CAAC,8BAA8B,EAAE,CAAC;IAC1C,CAAC;IAES,8BAA8B;QACpC,MAAM,eAAe,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAEpD,IAAI,CAAC,aAAa,CAAC,wBAAwB,CAAC;YACxC,EAAE,EAAE,mBAAmB;YACvB,QAAQ,EAAE,eAAe;YACzB,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,mBAAmB;YAChC,kBAAkB,EAAE,UAAG,CAAC,QAAQ,CAC5B,iDAAiD,EACjD,kDAAkD,CACrD;YACD,mBAAmB,EAAE,UAAG,CAAC,QAAQ,CAC7B,kDAAkD,EAClD,aAAa,CAChB;YACD,aAAa,EAAE,CAAC,OAAO,CAAC;SAC3B,CAAC,CAAC;IACP,CAAC;IAES,oBAAoB;QAC1B,OAAO;;;;;;;;;;YAUH,oDAA4B;;iBAEvB,qCAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uIA+GqG,CAAC;IACpI,CAAC;CACJ,CAAA;AA3JY,gFAAkC;AAGxB;IADlB,IAAA,kBAAM,EAAC,sBAAa,CAAC;;yEAC0B;6CAHvC,kCAAkC;IAD9C,IAAA,sBAAU,GAAE;GACA,kCAAkC,CA2J9C"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Agent, AgentService, AISettingsService, AIVariableService, FrontendLanguageModelRegistry, LanguageModel, PromptFragmentCustomizationService, PromptService } from '@theia/ai-core/lib/common';
|
|
3
|
-
import { QuickInputService
|
|
3
|
+
import { QuickInputService } from '@theia/core/lib/browser';
|
|
4
4
|
import * as React from '@theia/core/shared/react';
|
|
5
5
|
import { AIConfigurationSelectionService } from './ai-configuration-service';
|
|
6
6
|
import { LanguageModelAliasRegistry, LanguageModelAlias } from '@theia/ai-core/lib/common/language-model-alias';
|
|
7
|
+
import { AIListDetailConfigurationWidget } from './base/ai-list-detail-configuration-widget';
|
|
7
8
|
interface ParsedPrompt {
|
|
8
9
|
functions: string[];
|
|
9
10
|
globalVariables: string[];
|
|
10
11
|
agentSpecificVariables: string[];
|
|
11
12
|
}
|
|
12
|
-
export declare class AIAgentConfigurationWidget extends
|
|
13
|
+
export declare class AIAgentConfigurationWidget extends AIListDetailConfigurationWidget<Agent> {
|
|
13
14
|
static readonly ID = "ai-agent-configuration-container-widget";
|
|
14
15
|
static readonly LABEL: string;
|
|
15
16
|
protected readonly agentService: AgentService;
|
|
@@ -26,15 +27,20 @@ export declare class AIAgentConfigurationWidget extends ReactWidget {
|
|
|
26
27
|
protected parsedPromptParts: ParsedPrompt | undefined;
|
|
27
28
|
protected isLoadingDetails: boolean;
|
|
28
29
|
protected init(): void;
|
|
30
|
+
protected loadItems(): Promise<void>;
|
|
31
|
+
protected getItemId(agent: Agent): string;
|
|
32
|
+
protected getItemLabel(agent: Agent): string;
|
|
33
|
+
protected getEmptySelectionMessage(): string;
|
|
34
|
+
protected handleItemSelect: (agent: Agent) => void;
|
|
35
|
+
protected renderItemPrefix(agent: Agent): React.ReactNode;
|
|
36
|
+
protected renderItemSuffix(agent: Agent): React.ReactNode;
|
|
37
|
+
protected renderList(): React.ReactNode;
|
|
29
38
|
protected updateParsedPromptParts(): Promise<void>;
|
|
30
|
-
protected
|
|
31
|
-
protected renderAgentName(agent: Agent): React.ReactNode;
|
|
32
|
-
protected renderAgentDetails(): React.ReactNode;
|
|
39
|
+
protected renderItemDetail(agent: Agent): React.ReactNode;
|
|
33
40
|
protected parsePromptFragmentsForVariableAndFunction(agent: Agent): Promise<ParsedPrompt>;
|
|
34
41
|
protected extractVariablesAndFunctions(promptContent: string, result: ParsedPrompt, agent: Agent): void;
|
|
35
42
|
protected showVariableConfigurationTab(): void;
|
|
36
43
|
protected addCustomAgent(): Promise<void>;
|
|
37
|
-
protected setActiveAgent(agent: Agent): void;
|
|
38
44
|
private toggleAgentEnabled;
|
|
39
45
|
}
|
|
40
46
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-configuration-widget.d.ts","sourceRoot":"","sources":["../../../src/browser/ai-configuration/agent-configuration-widget.tsx"],"names":[],"mappings":";AAgBA,OAAO,EACH,KAAK,EACL,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,6BAA6B,EAC7B,aAAa,EAIb,kCAAkC,EAClC,aAAa,EAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAW,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"agent-configuration-widget.d.ts","sourceRoot":"","sources":["../../../src/browser/ai-configuration/agent-configuration-widget.tsx"],"names":[],"mappings":";AAgBA,OAAO,EACH,KAAK,EACL,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,6BAA6B,EAC7B,aAAa,EAIb,kCAAkC,EAClC,aAAa,EAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAW,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGrE,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAE7E,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAIhH,OAAO,EAAE,+BAA+B,EAAE,MAAM,4CAA4C,CAAC;AAE7F,UAAU,YAAY;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,sBAAsB,EAAE,MAAM,EAAE,CAAC;CACpC;AAED,qBACa,0BAA2B,SAAQ,+BAA+B,CAAC,KAAK,CAAC;IAElF,MAAM,CAAC,QAAQ,CAAC,EAAE,6CAA6C;IAC/D,MAAM,CAAC,QAAQ,CAAC,KAAK,SAAoE;IAGzF,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAG9C,SAAS,CAAC,QAAQ,CAAC,qBAAqB,EAAE,6BAA6B,CAAC;IAGxE,SAAS,CAAC,QAAQ,CAAC,kCAAkC,EAAE,kCAAkC,CAAC;IAG1F,SAAS,CAAC,QAAQ,CAAC,0BAA0B,EAAE,0BAA0B,CAAC;IAG1E,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAGxD,SAAS,CAAC,QAAQ,CAAC,+BAA+B,EAAE,+BAA+B,CAAC;IAGpF,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAC;IAGtD,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IAGvC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAExD,SAAS,CAAC,cAAc,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IACtD,SAAS,CAAC,oBAAoB,EAAE,kBAAkB,EAAE,CAAM;IAC1D,SAAS,CAAC,iBAAiB,EAAE,YAAY,GAAG,SAAS,CAAC;IACtD,SAAS,CAAC,gBAAgB,UAAS;IAGnC,SAAS,CAAC,IAAI,IAAI,IAAI;cA8CN,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAW1C,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAIzC,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;cAIzB,wBAAwB,IAAI,MAAM;IAIrD,UAAmB,gBAAgB,UAAW,KAAK,KAAG,IAAI,CAIxD;cAEiB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS;cAa/C,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS;cAO/C,UAAU,IAAI,KAAK,CAAC,SAAS;cA+BhC,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;IAYxD,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS;cAqHzC,0CAA0C,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC;IAmB/F,SAAS,CAAC,4BAA4B,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAyBvG,SAAS,CAAC,4BAA4B,IAAI,IAAI;cAI9B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAiC/C,OAAO,CAAC,kBAAkB,CAYxB;CACL"}
|
|
@@ -28,12 +28,18 @@ const language_model_alias_1 = require("@theia/ai-core/lib/common/language-model
|
|
|
28
28
|
const variable_configuration_widget_1 = require("./variable-configuration-widget");
|
|
29
29
|
const core_1 = require("@theia/core");
|
|
30
30
|
const template_settings_renderer_1 = require("./template-settings-renderer");
|
|
31
|
+
const ai_list_detail_configuration_widget_1 = require("./base/ai-list-detail-configuration-widget");
|
|
31
32
|
;
|
|
32
|
-
let AIAgentConfigurationWidget = AIAgentConfigurationWidget_1 = class AIAgentConfigurationWidget extends
|
|
33
|
+
let AIAgentConfigurationWidget = AIAgentConfigurationWidget_1 = class AIAgentConfigurationWidget extends ai_list_detail_configuration_widget_1.AIListDetailConfigurationWidget {
|
|
33
34
|
constructor() {
|
|
34
35
|
super(...arguments);
|
|
35
36
|
this.languageModelAliases = [];
|
|
36
37
|
this.isLoadingDetails = false;
|
|
38
|
+
this.handleItemSelect = (agent) => {
|
|
39
|
+
this.selectedItem = agent;
|
|
40
|
+
this.aiConfigurationSelectionService.setActiveAgent(agent);
|
|
41
|
+
this.updateParsedPromptParts();
|
|
42
|
+
};
|
|
37
43
|
this.toggleAgentEnabled = async () => {
|
|
38
44
|
const agent = this.aiConfigurationSelectionService.getActiveAgent();
|
|
39
45
|
if (!agent) {
|
|
@@ -53,10 +59,12 @@ let AIAgentConfigurationWidget = AIAgentConfigurationWidget_1 = class AIAgentCon
|
|
|
53
59
|
this.id = AIAgentConfigurationWidget_1.ID;
|
|
54
60
|
this.title.label = AIAgentConfigurationWidget_1.LABEL;
|
|
55
61
|
this.title.closable = false;
|
|
56
|
-
|
|
57
|
-
this.
|
|
58
|
-
this.
|
|
59
|
-
|
|
62
|
+
Promise.all([
|
|
63
|
+
this.loadItems(),
|
|
64
|
+
this.languageModelRegistry.getLanguageModels().then(models => {
|
|
65
|
+
this.languageModels = models !== null && models !== void 0 ? models : [];
|
|
66
|
+
})
|
|
67
|
+
]).then(() => this.update());
|
|
60
68
|
this.languageModelAliasRegistry.ready.then(() => {
|
|
61
69
|
this.languageModelAliases = this.languageModelAliasRegistry.getAliases();
|
|
62
70
|
this.toDispose.push(this.languageModelAliasRegistry.onDidChange(() => {
|
|
@@ -64,27 +72,74 @@ let AIAgentConfigurationWidget = AIAgentConfigurationWidget_1 = class AIAgentCon
|
|
|
64
72
|
this.update();
|
|
65
73
|
}));
|
|
66
74
|
});
|
|
67
|
-
this.toDispose.
|
|
68
|
-
this.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
75
|
+
this.toDispose.pushAll([
|
|
76
|
+
this.languageModelRegistry.onChange(({ models }) => {
|
|
77
|
+
this.languageModelAliases = this.languageModelAliasRegistry.getAliases();
|
|
78
|
+
this.languageModels = models;
|
|
79
|
+
this.update();
|
|
80
|
+
}),
|
|
81
|
+
this.promptService.onPromptsChange(() => this.updateParsedPromptParts()),
|
|
82
|
+
this.promptFragmentCustomizationService.onDidChangePromptFragmentCustomization(() => {
|
|
83
|
+
this.updateParsedPromptParts();
|
|
84
|
+
}),
|
|
85
|
+
this.aiSettingsService.onDidChange(() => {
|
|
86
|
+
this.updateParsedPromptParts();
|
|
87
|
+
}),
|
|
88
|
+
this.aiConfigurationSelectionService.onDidAgentChange(() => {
|
|
89
|
+
this.selectedItem = this.aiConfigurationSelectionService.getActiveAgent();
|
|
90
|
+
this.updateParsedPromptParts();
|
|
91
|
+
}),
|
|
92
|
+
this.agentService.onDidChangeAgents(async () => {
|
|
93
|
+
await this.loadItems();
|
|
94
|
+
this.update();
|
|
95
|
+
})
|
|
96
|
+
]);
|
|
86
97
|
this.updateParsedPromptParts();
|
|
87
98
|
}
|
|
99
|
+
async loadItems() {
|
|
100
|
+
this.items = this.agentService.getAllAgents();
|
|
101
|
+
const activeAgent = this.aiConfigurationSelectionService.getActiveAgent();
|
|
102
|
+
if (activeAgent) {
|
|
103
|
+
this.selectedItem = activeAgent;
|
|
104
|
+
}
|
|
105
|
+
else if (this.items.length > 0 && !this.selectedItem) {
|
|
106
|
+
this.selectedItem = this.items[0];
|
|
107
|
+
this.aiConfigurationSelectionService.setActiveAgent(this.items[0]);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
getItemId(agent) {
|
|
111
|
+
return agent.id;
|
|
112
|
+
}
|
|
113
|
+
getItemLabel(agent) {
|
|
114
|
+
return agent.name;
|
|
115
|
+
}
|
|
116
|
+
getEmptySelectionMessage() {
|
|
117
|
+
return core_1.nls.localize('theia/ai/core/agentConfiguration/selectAgentMessage', 'Please select an Agent first!');
|
|
118
|
+
}
|
|
119
|
+
renderItemPrefix(agent) {
|
|
120
|
+
const enabled = this.agentService.isEnabled(agent.id);
|
|
121
|
+
return (React.createElement("span", { className: `agent-status-indicator ${enabled ? `agent-enabled ${(0, browser_1.codicon)('circle-filled')}` : `agent-disabled ${(0, browser_1.codicon)('circle')}`}`, title: enabled ? 'Enabled' : 'Disabled' }));
|
|
122
|
+
}
|
|
123
|
+
renderItemSuffix(agent) {
|
|
124
|
+
var _a;
|
|
125
|
+
if (!((_a = agent.tags) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
return React.createElement("span", null, agent.tags.map(tag => React.createElement("span", { key: tag, className: 'agent-tag' }, tag)));
|
|
129
|
+
}
|
|
130
|
+
renderList() {
|
|
131
|
+
return (React.createElement("div", { className: "ai-configuration-list preferences-tree-widget theia-TreeContainer" },
|
|
132
|
+
React.createElement("ul", null, this.items.map(agent => {
|
|
133
|
+
const agentId = this.getItemId(agent);
|
|
134
|
+
const isSelected = this.selectedItem && this.getItemId(this.selectedItem) === agentId;
|
|
135
|
+
return (React.createElement("li", { key: agentId, className: `theia-TreeNode theia-CompositeTreeNode${isSelected ? ' theia-mod-selected' : ''} ${this.getItemClassName(agent)}`, onClick: () => this.handleItemSelect(agent) },
|
|
136
|
+
this.renderItemPrefix(agent),
|
|
137
|
+
React.createElement("span", { className: "ai-configuration-list-item-label" }, this.getItemLabel(agent)),
|
|
138
|
+
this.renderItemSuffix(agent)));
|
|
139
|
+
})),
|
|
140
|
+
React.createElement("div", { className: 'configuration-agents-add' },
|
|
141
|
+
React.createElement("button", { className: 'theia-button main', onClick: () => this.addCustomAgent() }, core_1.nls.localize('theia/ai/core/agentConfiguration/addCustomAgent', 'Add Custom Agent')))));
|
|
142
|
+
}
|
|
88
143
|
async updateParsedPromptParts() {
|
|
89
144
|
this.isLoadingDetails = true;
|
|
90
145
|
const agent = this.aiConfigurationSelectionService.getActiveAgent();
|
|
@@ -97,73 +152,56 @@ let AIAgentConfigurationWidget = AIAgentConfigurationWidget_1 = class AIAgentCon
|
|
|
97
152
|
this.isLoadingDetails = false;
|
|
98
153
|
this.update();
|
|
99
154
|
}
|
|
100
|
-
|
|
101
|
-
return React.createElement("div", { className: 'ai-agent-configuration-main' },
|
|
102
|
-
React.createElement("div", { className: 'configuration-agents-list theia-Tree theia-TreeContainer', style: { width: '25%' } },
|
|
103
|
-
React.createElement("ul", null, this.agentService.getAllAgents().map(agent => {
|
|
104
|
-
var _a;
|
|
105
|
-
const isActive = ((_a = this.aiConfigurationSelectionService.getActiveAgent()) === null || _a === void 0 ? void 0 : _a.id) === agent.id;
|
|
106
|
-
const className = `theia-TreeNode theia-CompositeTreeNode theia-ExpandableTreeNode${isActive ? ' theia-mod-selected' : ''}`;
|
|
107
|
-
return React.createElement("li", { key: agent.id, className: className, onClick: () => this.setActiveAgent(agent) }, this.renderAgentName(agent));
|
|
108
|
-
})),
|
|
109
|
-
React.createElement("div", { className: 'configuration-agents-add' },
|
|
110
|
-
React.createElement("button", { style: { marginLeft: 0 }, className: 'theia-button main', onClick: () => this.addCustomAgent() }, core_1.nls.localize('theia/ai/core/agentConfiguration/addCustomAgent', 'Add Custom Agent')))),
|
|
111
|
-
React.createElement("div", { className: 'configuration-agent-panel preferences-editor-widget' }, this.renderAgentDetails()));
|
|
112
|
-
}
|
|
113
|
-
renderAgentName(agent) {
|
|
155
|
+
renderItemDetail(agent) {
|
|
114
156
|
var _a;
|
|
115
|
-
const tagsSuffix = ((_a = agent.tags) === null || _a === void 0 ? void 0 : _a.length) ? React.createElement("span", null, agent.tags.map(tag => React.createElement("span", { key: tag, className: 'agent-tag' }, tag))) : '';
|
|
116
|
-
return React.createElement("span", null,
|
|
117
|
-
agent.name,
|
|
118
|
-
" ",
|
|
119
|
-
tagsSuffix);
|
|
120
|
-
}
|
|
121
|
-
renderAgentDetails() {
|
|
122
157
|
if (this.isLoadingDetails) {
|
|
123
|
-
return React.createElement("div", null, core_1.nls.
|
|
124
|
-
}
|
|
125
|
-
const agent = this.aiConfigurationSelectionService.getActiveAgent();
|
|
126
|
-
if (!agent) {
|
|
127
|
-
return React.createElement("div", null, core_1.nls.localize('theia/ai/core/agentConfiguration/selectAgentMessage', 'Please select an Agent first!'));
|
|
158
|
+
return React.createElement("div", null, core_1.nls.localizeByDefault('Loading...'));
|
|
128
159
|
}
|
|
129
160
|
const enabled = this.agentService.isEnabled(agent.id);
|
|
130
161
|
if (!this.parsedPromptParts) {
|
|
131
162
|
this.updateParsedPromptParts();
|
|
132
|
-
return React.createElement("div", null, core_1.nls.
|
|
163
|
+
return React.createElement("div", null, core_1.nls.localizeByDefault('Loading...'));
|
|
133
164
|
}
|
|
134
165
|
const globalVariables = Array.from(new Set([...this.parsedPromptParts.globalVariables, ...agent.variables]));
|
|
135
166
|
const functions = Array.from(new Set([...this.parsedPromptParts.functions, ...agent.functions]));
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
167
|
+
const agentNameWithTags = React.createElement(React.Fragment, null,
|
|
168
|
+
agent.name,
|
|
169
|
+
((_a = agent.tags) === null || _a === void 0 ? void 0 : _a.length) && React.createElement("span", null, agent.tags.map(tag => React.createElement("span", { key: tag, className: 'agent-tag' }, tag))));
|
|
170
|
+
return React.createElement("div", { key: agent.id },
|
|
171
|
+
React.createElement("div", { className: 'settings-section-title settings-section-category-title agent-title-with-toggle' },
|
|
172
|
+
React.createElement("div", { className: 'agent-title-content' },
|
|
173
|
+
React.createElement("div", null,
|
|
174
|
+
agentNameWithTags,
|
|
175
|
+
React.createElement("pre", { className: 'ai-id-label' },
|
|
176
|
+
"Id: ",
|
|
177
|
+
agent.id)),
|
|
178
|
+
React.createElement("label", { className: 'agent-enable-toggle', title: core_1.nls.localize('theia/ai/core/agentConfiguration/enableAgent', 'Enable Agent') },
|
|
179
|
+
React.createElement("div", { className: 'toggle-switch', onClick: this.toggleAgentEnabled },
|
|
180
|
+
React.createElement("input", { type: "checkbox", checked: enabled, onChange: this.toggleAgentEnabled }),
|
|
181
|
+
React.createElement("span", { className: 'toggle-slider' }))))),
|
|
182
|
+
agent.description && (React.createElement("div", { className: "ai-agent-description" }, agent.description)),
|
|
183
|
+
agent.prompts.length > 0 && (React.createElement(React.Fragment, null,
|
|
184
|
+
React.createElement("div", { className: "settings-section-subcategory-title ai-settings-section-subcategory-title" }, core_1.nls.localize('theia/ai/core/agentConfiguration/promptTemplates', 'Prompt Templates')),
|
|
185
|
+
React.createElement("table", { className: "ai-templates-table" },
|
|
186
|
+
React.createElement("thead", null,
|
|
187
|
+
React.createElement("tr", null,
|
|
188
|
+
React.createElement("th", null, core_1.nls.localize('theia/ai/core/agentConfiguration/templateName', 'Template')),
|
|
189
|
+
React.createElement("th", null, core_1.nls.localize('theia/ai/core/agentConfiguration/variant', 'Variant')),
|
|
190
|
+
React.createElement("th", { className: "template-actions-header" }, core_1.nls.localize('theia/ai/core/agentConfiguration/actions', 'Actions')))),
|
|
191
|
+
React.createElement("tbody", null, agent.prompts.map(prompt => (React.createElement(template_settings_renderer_1.PromptVariantRenderer, { key: agent.id + '.' + prompt.id, agentId: agent.id, promptVariantSet: prompt, promptService: this.promptService }))))))),
|
|
153
192
|
React.createElement("div", { className: 'ai-lm-requirements' },
|
|
154
193
|
React.createElement(language_model_renderer_1.LanguageModelRenderer, { agent: agent, languageModels: this.languageModels, aiSettingsService: this.aiSettingsService, languageModelRegistry: this.languageModelRegistry, languageModelAliases: this.languageModelAliases })),
|
|
155
|
-
React.createElement(
|
|
156
|
-
React.createElement("
|
|
157
|
-
React.createElement(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
React.createElement("span", null, "Used agent-specific Variables:"),
|
|
194
|
+
globalVariables.length > 0 && (React.createElement(React.Fragment, null,
|
|
195
|
+
React.createElement("div", { className: "settings-section-subcategory-title" }, core_1.nls.localize('theia/ai/core/agentConfiguration/usedGlobalVariables', 'Used Global Variables')),
|
|
196
|
+
React.createElement(AgentGlobalVariables, { variables: globalVariables, variableService: this.variableService }))),
|
|
197
|
+
this.parsedPromptParts.agentSpecificVariables.length > 0 && (React.createElement(React.Fragment, null,
|
|
198
|
+
React.createElement("div", { className: "settings-section-subcategory-title" }, core_1.nls.localize('theia/ai/core/agentConfiguration/usedAgentSpecificVariables', 'Used Agent-Specific Variables')),
|
|
161
199
|
React.createElement("ul", { className: 'variable-references' },
|
|
162
|
-
React.createElement(AgentSpecificVariables, { promptVariables: this.parsedPromptParts.agentSpecificVariables, agent: agent }))),
|
|
163
|
-
React.createElement(
|
|
164
|
-
React.createElement("
|
|
200
|
+
React.createElement(AgentSpecificVariables, { promptVariables: this.parsedPromptParts.agentSpecificVariables, agent: agent })))),
|
|
201
|
+
functions.length > 0 && (React.createElement(React.Fragment, null,
|
|
202
|
+
React.createElement("div", { className: "settings-section-subcategory-title" }, core_1.nls.localize('theia/ai/core/agentConfiguration/usedFunctions', 'Used Functions')),
|
|
165
203
|
React.createElement("ul", { className: 'function-references' },
|
|
166
|
-
React.createElement(AgentFunctions, { functions: functions }))));
|
|
204
|
+
React.createElement(AgentFunctions, { functions: functions })))));
|
|
167
205
|
}
|
|
168
206
|
async parsePromptFragmentsForVariableAndFunction(agent) {
|
|
169
207
|
var _a, _b, _c, _d;
|
|
@@ -184,11 +222,9 @@ let AIAgentConfigurationWidget = AIAgentConfigurationWidget_1 = class AIAgentCon
|
|
|
184
222
|
const variableMatches = (0, common_1.matchVariablesRegEx)(promptContent);
|
|
185
223
|
variableMatches.forEach(match => {
|
|
186
224
|
const variableId = match[1];
|
|
187
|
-
// skip comments
|
|
188
225
|
if (variableId.startsWith('!--')) {
|
|
189
226
|
return;
|
|
190
227
|
}
|
|
191
|
-
// Extract base variable ID without arguments
|
|
192
228
|
const baseVariableId = variableId.split(':')[0];
|
|
193
229
|
if (this.variableService.hasVariable(baseVariableId) &&
|
|
194
230
|
agent.agentSpecificVariables.find(v => v.name === baseVariableId) === undefined) {
|
|
@@ -234,10 +270,6 @@ let AIAgentConfigurationWidget = AIAgentConfigurationWidget_1 = class AIAgentCon
|
|
|
234
270
|
});
|
|
235
271
|
quickPick.show();
|
|
236
272
|
}
|
|
237
|
-
setActiveAgent(agent) {
|
|
238
|
-
this.aiConfigurationSelectionService.setActiveAgent(agent);
|
|
239
|
-
this.updateParsedPromptParts();
|
|
240
|
-
}
|
|
241
273
|
};
|
|
242
274
|
exports.AIAgentConfigurationWidget = AIAgentConfigurationWidget;
|
|
243
275
|
AIAgentConfigurationWidget.ID = 'ai-agent-configuration-container-widget';
|
|
@@ -287,14 +319,27 @@ tslib_1.__decorate([
|
|
|
287
319
|
exports.AIAgentConfigurationWidget = AIAgentConfigurationWidget = AIAgentConfigurationWidget_1 = tslib_1.__decorate([
|
|
288
320
|
(0, inversify_1.injectable)()
|
|
289
321
|
], AIAgentConfigurationWidget);
|
|
290
|
-
const AgentGlobalVariables = ({ variables: globalVariables,
|
|
322
|
+
const AgentGlobalVariables = ({ variables: globalVariables, variableService }) => {
|
|
291
323
|
if (globalVariables.length === 0) {
|
|
292
|
-
return React.createElement(
|
|
324
|
+
return React.createElement("div", { className: "ai-empty-state-content" }, core_1.nls.localizeByDefault('None'));
|
|
293
325
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
326
|
+
const allVariables = variableService.getVariables();
|
|
327
|
+
const variableData = globalVariables.map(varId => {
|
|
328
|
+
const variable = allVariables.find(v => v.id === varId);
|
|
329
|
+
return {
|
|
330
|
+
id: varId,
|
|
331
|
+
name: (variable === null || variable === void 0 ? void 0 : variable.name) || varId,
|
|
332
|
+
description: (variable === null || variable === void 0 ? void 0 : variable.description) || ''
|
|
333
|
+
};
|
|
334
|
+
});
|
|
335
|
+
return (React.createElement("table", { className: "ai-templates-table" },
|
|
336
|
+
React.createElement("thead", null,
|
|
337
|
+
React.createElement("tr", null,
|
|
338
|
+
React.createElement("th", null, core_1.nls.localizeByDefault('Variable')),
|
|
339
|
+
React.createElement("th", null, core_1.nls.localizeByDefault('Description')))),
|
|
340
|
+
React.createElement("tbody", null, variableData.map(variable => (React.createElement("tr", { key: variable.id },
|
|
341
|
+
React.createElement("td", { className: "ai-variable-name-cell" }, variable.name),
|
|
342
|
+
React.createElement("td", { className: "ai-variable-description-cell" }, variable.description || core_1.nls.localize('theia/ai/ide/agentConfiguration/noDescription', 'No description available'))))))));
|
|
298
343
|
};
|
|
299
344
|
const AgentFunctions = ({ functions }) => {
|
|
300
345
|
if (functions.length === 0) {
|
|
@@ -307,27 +352,34 @@ const AgentSpecificVariables = ({ promptVariables, agent }) => {
|
|
|
307
352
|
const agentDefinedVariablesName = agent.agentSpecificVariables.map(v => v.name);
|
|
308
353
|
const variables = Array.from(new Set([...promptVariables, ...agentDefinedVariablesName]));
|
|
309
354
|
if (variables.length === 0) {
|
|
310
|
-
return React.createElement(
|
|
355
|
+
return React.createElement("div", { className: "ai-empty-state-content" }, core_1.nls.localizeByDefault('None'));
|
|
311
356
|
}
|
|
312
|
-
return React.createElement(
|
|
357
|
+
return React.createElement("div", null, variables.map(variableId => React.createElement(AgentSpecificVariable, { key: variableId, variableId: variableId, agent: agent, promptVariables: promptVariables })));
|
|
313
358
|
};
|
|
314
359
|
const AgentSpecificVariable = ({ variableId, agent, promptVariables }) => {
|
|
315
360
|
const agentDefinedVariable = agent.agentSpecificVariables.find(v => v.name === variableId);
|
|
316
361
|
const undeclared = agentDefinedVariable === undefined;
|
|
317
362
|
const notUsed = !promptVariables.includes(variableId) && (agentDefinedVariable === null || agentDefinedVariable === void 0 ? void 0 : agentDefinedVariable.usedInPrompt) === true;
|
|
318
|
-
return React.createElement("
|
|
319
|
-
React.createElement("div",
|
|
320
|
-
React.createElement("span",
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
363
|
+
return React.createElement("div", { key: variableId, className: "ai-agent-specific-variable-item" },
|
|
364
|
+
React.createElement("div", { className: "ai-configuration-value-row" },
|
|
365
|
+
React.createElement("span", { className: "ai-configuration-value-row-label" },
|
|
366
|
+
core_1.nls.localizeByDefault('Name'),
|
|
367
|
+
":"),
|
|
368
|
+
React.createElement("span", { className: "ai-configuration-value-row-value" }, variableId)),
|
|
369
|
+
undeclared ? (React.createElement("div", { className: "ai-configuration-value-row" },
|
|
370
|
+
React.createElement("span", { className: "ai-configuration-value-row-label" },
|
|
371
|
+
core_1.nls.localizeByDefault('Status'),
|
|
372
|
+
":"),
|
|
373
|
+
React.createElement("span", { className: "ai-configuration-value-row-value ai-configuration-warning-text" }, core_1.nls.localize('theia/ai/core/agentConfiguration/undeclared', 'Undeclared')))) : (React.createElement(React.Fragment, null,
|
|
374
|
+
React.createElement("div", { className: "ai-configuration-value-row" },
|
|
375
|
+
React.createElement("span", { className: "ai-configuration-value-row-label" },
|
|
376
|
+
core_1.nls.localizeByDefault('Description'),
|
|
377
|
+
":"),
|
|
378
|
+
React.createElement("span", { className: "ai-configuration-value-row-value" }, agentDefinedVariable.description)),
|
|
379
|
+
notUsed && (React.createElement("div", { className: "ai-configuration-value-row" },
|
|
380
|
+
React.createElement("span", { className: "ai-configuration-value-row-label" },
|
|
381
|
+
core_1.nls.localizeByDefault('Status'),
|
|
382
|
+
":"),
|
|
383
|
+
React.createElement("span", { className: "ai-configuration-value-row-value ai-configuration-warning-text" }, core_1.nls.localize('theia/ai/core/agentConfiguration/notUsedInPrompt', 'Not used in prompt')))))));
|
|
332
384
|
};
|
|
333
385
|
//# sourceMappingURL=agent-configuration-widget.js.map
|