@theia/ai-terminal 1.55.0 → 1.56.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-terminal-agent.d.ts","sourceRoot":"","sources":["../../src/browser/ai-terminal-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,KAAK,EACL,6BAA6B,EAG7B,qBAAqB,EAAE,wBAAwB,EAC/C,aAAa,EAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAgB,OAAO,EAAE,MAAM,aAAa,CAAC;AAUpD,qBACa,eAAgB,YAAW,KAAK;IAEzC,SAAS,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;IAE1D,EAAE,SAAwB;IAC1B,IAAI,SAAwB;IAC5B,WAAW,SAEoI;IAC/I,SAAS,UAAM;IACf,SAAS,UAAM;IACf,sBAAsB;;;;QAKpB;IACF,eAAe;;;;;
|
|
1
|
+
{"version":3,"file":"ai-terminal-agent.d.ts","sourceRoot":"","sources":["../../src/browser/ai-terminal-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,KAAK,EACL,6BAA6B,EAG7B,qBAAqB,EAAE,wBAAwB,EAC/C,aAAa,EAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAgB,OAAO,EAAE,MAAM,aAAa,CAAC;AAUpD,qBACa,eAAgB,YAAW,KAAK;IAEzC,SAAS,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;IAE1D,EAAE,SAAwB;IAC1B,IAAI,SAAwB;IAC5B,WAAW,SAEoI;IAC/I,SAAS,UAAM;IACf,SAAS,UAAM;IACf,sBAAsB;;;;QAKpB;IACF,eAAe;;;;;QA8Db;IACF,yBAAyB,EAAE,wBAAwB,EAAE,CAKnD;IAGF,SAAS,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IAGvD,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IAGvC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;IAEpB,WAAW,CACb,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,sBAAsB,EAAE,MAAM,EAAE,GACjC,OAAO,CAAC,MAAM,EAAE,CAAC;CAsFvB"}
|
|
@@ -45,7 +45,8 @@ let AiTerminalAgent = class AiTerminalAgent {
|
|
|
45
45
|
id: 'terminal-system',
|
|
46
46
|
name: 'AI Terminal System Prompt',
|
|
47
47
|
description: 'Prompt for the AI Terminal Assistant',
|
|
48
|
-
template: `
|
|
48
|
+
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
49
|
+
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
49
50
|
# Instructions
|
|
50
51
|
Generate one or more command suggestions based on the user's request, considering the shell being used,
|
|
51
52
|
the current working directory, and the recent terminal contents. Provide the best suggestion first,
|
|
@@ -92,7 +93,8 @@ nothing to commit, working tree clean
|
|
|
92
93
|
id: 'terminal-user',
|
|
93
94
|
name: 'AI Terminal User Prompt',
|
|
94
95
|
description: 'Prompt that contains the user request',
|
|
95
|
-
template: `
|
|
96
|
+
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
97
|
+
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
96
98
|
user-request: {{userRequest}}
|
|
97
99
|
shell: {{shell}}
|
|
98
100
|
cwd: {{cwd}}
|
|
@@ -123,9 +125,9 @@ recent-terminal-contents:
|
|
|
123
125
|
cwd,
|
|
124
126
|
recentTerminalContents
|
|
125
127
|
};
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
if (!
|
|
128
|
+
const systemMessage = await this.promptService.getPrompt('terminal-system', parameters).then(p => p === null || p === void 0 ? void 0 : p.text);
|
|
129
|
+
const request = await this.promptService.getPrompt('terminal-user', parameters).then(p => p === null || p === void 0 ? void 0 : p.text);
|
|
130
|
+
if (!systemMessage || !request) {
|
|
129
131
|
this.logger.error('The prompt service didn\'t return prompts for the AI Terminal Agent.');
|
|
130
132
|
return [];
|
|
131
133
|
}
|
|
@@ -135,10 +137,9 @@ recent-terminal-contents:
|
|
|
135
137
|
this.recordingService.recordRequest({
|
|
136
138
|
agentId: this.id,
|
|
137
139
|
sessionId,
|
|
138
|
-
timestamp: Date.now(),
|
|
139
140
|
requestId,
|
|
140
|
-
request
|
|
141
|
-
|
|
141
|
+
request,
|
|
142
|
+
systemMessage
|
|
142
143
|
});
|
|
143
144
|
try {
|
|
144
145
|
const result = await lm.request({
|
|
@@ -146,12 +147,12 @@ recent-terminal-contents:
|
|
|
146
147
|
{
|
|
147
148
|
actor: 'ai',
|
|
148
149
|
type: 'text',
|
|
149
|
-
query:
|
|
150
|
+
query: systemMessage
|
|
150
151
|
},
|
|
151
152
|
{
|
|
152
153
|
actor: 'user',
|
|
153
154
|
type: 'text',
|
|
154
|
-
query:
|
|
155
|
+
query: request
|
|
155
156
|
}
|
|
156
157
|
],
|
|
157
158
|
response_format: {
|
|
@@ -167,27 +168,15 @@ recent-terminal-contents:
|
|
|
167
168
|
// model returned structured output
|
|
168
169
|
const parsedResult = Commands.safeParse(result.parsed);
|
|
169
170
|
if (parsedResult.success) {
|
|
170
|
-
const
|
|
171
|
-
this.recordingService.recordResponse({
|
|
172
|
-
agentId: this.id,
|
|
173
|
-
sessionId,
|
|
174
|
-
timestamp: Date.now(),
|
|
175
|
-
requestId,
|
|
176
|
-
response: responseTextfromParsed,
|
|
177
|
-
});
|
|
171
|
+
const response = JSON.stringify(parsedResult.data.commands);
|
|
172
|
+
this.recordingService.recordResponse({ agentId: this.id, sessionId, requestId, response, systemMessage });
|
|
178
173
|
return parsedResult.data.commands;
|
|
179
174
|
}
|
|
180
175
|
}
|
|
181
176
|
// fall back to agent-based parsing of result
|
|
182
177
|
const jsonResult = await (0, common_1.getJsonOfResponse)(result);
|
|
183
178
|
const responseTextFromJSON = JSON.stringify(jsonResult);
|
|
184
|
-
this.recordingService.recordResponse({
|
|
185
|
-
agentId: this.id,
|
|
186
|
-
sessionId,
|
|
187
|
-
timestamp: Date.now(),
|
|
188
|
-
requestId,
|
|
189
|
-
response: responseTextFromJSON
|
|
190
|
-
});
|
|
179
|
+
this.recordingService.recordResponse({ agentId: this.id, sessionId, requestId, response: responseTextFromJSON });
|
|
191
180
|
const parsedJsonResult = Commands.safeParse(jsonResult);
|
|
192
181
|
if (parsedJsonResult.success) {
|
|
193
182
|
return parsedJsonResult.data.commands;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-terminal-agent.js","sourceRoot":"","sources":["../../src/browser/ai-terminal-agent.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,sDAOmC;AACnC,sCAAoD;AACpD,4DAAkE;AAClE,6BAAwB;AACxB,2DAAiD;AAEjD,MAAM,QAAQ,GAAG,OAAC,CAAC,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;CAChC,CAAC,CAAC;AAII,IAAM,eAAe,GAArB,MAAM,eAAe;IAArB;QAIH,OAAE,GAAG,oBAAoB,CAAC;QAC1B,SAAI,GAAG,oBAAoB,CAAC;QAC5B,gBAAW,GAAG;;kJAEgI,CAAC;QAC/I,cAAS,GAAG,EAAE,CAAC;QACf,cAAS,GAAG,EAAE,CAAC;QACf,2BAAsB,GAAG;YACrB,EAAE,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,kCAAkC,EAAE;YAC5F,EAAE,IAAI,EAAE,OAAO,EAAE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AAC,8BAAqB,CAAC;;8DACyB;AAG7C;IADT,IAAA,kBAAM,EAAC,sBAAa,CAAC;;sDACiB;AAG7B;IADT,IAAA,kBAAM,EAAC,cAAO,CAAC;;+CACU;0BA9FjB,eAAe;IAD3B,IAAA,sBAAU,GAAE;GACA,eAAe,CA2L3B"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/ai-terminal",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.56.0",
|
|
4
4
|
"description": "Theia - AI Terminal Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/ai-chat": "1.
|
|
7
|
-
"@theia/ai-core": "1.
|
|
8
|
-
"@theia/core": "1.
|
|
9
|
-
"@theia/terminal": "1.
|
|
6
|
+
"@theia/ai-chat": "1.56.0",
|
|
7
|
+
"@theia/ai-core": "1.56.0",
|
|
8
|
+
"@theia/core": "1.56.0",
|
|
9
|
+
"@theia/terminal": "1.56.0",
|
|
10
10
|
"zod": "^3.23.8",
|
|
11
11
|
"zod-to-json-schema": "^3.23.2"
|
|
12
12
|
},
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"watch": "theiaext watch"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@theia/ext-scripts": "1.
|
|
46
|
+
"@theia/ext-scripts": "1.56.0"
|
|
47
47
|
},
|
|
48
48
|
"nyc": {
|
|
49
49
|
"extends": "../../configs/nyc.json"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "3b4498f8f1c66be688847418fcc35595282671dc"
|
|
52
52
|
}
|
|
@@ -55,7 +55,8 @@ export class AiTerminalAgent implements Agent {
|
|
|
55
55
|
id: 'terminal-system',
|
|
56
56
|
name: 'AI Terminal System Prompt',
|
|
57
57
|
description: 'Prompt for the AI Terminal Assistant',
|
|
58
|
-
template: `
|
|
58
|
+
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
59
|
+
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
59
60
|
# Instructions
|
|
60
61
|
Generate one or more command suggestions based on the user's request, considering the shell being used,
|
|
61
62
|
the current working directory, and the recent terminal contents. Provide the best suggestion first,
|
|
@@ -102,7 +103,8 @@ nothing to commit, working tree clean
|
|
|
102
103
|
id: 'terminal-user',
|
|
103
104
|
name: 'AI Terminal User Prompt',
|
|
104
105
|
description: 'Prompt that contains the user request',
|
|
105
|
-
template: `
|
|
106
|
+
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
107
|
+
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
106
108
|
user-request: {{userRequest}}
|
|
107
109
|
shell: {{shell}}
|
|
108
110
|
cwd: {{cwd}}
|
|
@@ -149,9 +151,9 @@ recent-terminal-contents:
|
|
|
149
151
|
recentTerminalContents
|
|
150
152
|
};
|
|
151
153
|
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
if (!
|
|
154
|
+
const systemMessage = await this.promptService.getPrompt('terminal-system', parameters).then(p => p?.text);
|
|
155
|
+
const request = await this.promptService.getPrompt('terminal-user', parameters).then(p => p?.text);
|
|
156
|
+
if (!systemMessage || !request) {
|
|
155
157
|
this.logger.error('The prompt service didn\'t return prompts for the AI Terminal Agent.');
|
|
156
158
|
return [];
|
|
157
159
|
}
|
|
@@ -162,10 +164,9 @@ recent-terminal-contents:
|
|
|
162
164
|
this.recordingService.recordRequest({
|
|
163
165
|
agentId: this.id,
|
|
164
166
|
sessionId,
|
|
165
|
-
timestamp: Date.now(),
|
|
166
167
|
requestId,
|
|
167
|
-
request
|
|
168
|
-
|
|
168
|
+
request,
|
|
169
|
+
systemMessage
|
|
169
170
|
});
|
|
170
171
|
|
|
171
172
|
try {
|
|
@@ -174,12 +175,12 @@ recent-terminal-contents:
|
|
|
174
175
|
{
|
|
175
176
|
actor: 'ai',
|
|
176
177
|
type: 'text',
|
|
177
|
-
query:
|
|
178
|
+
query: systemMessage
|
|
178
179
|
},
|
|
179
180
|
{
|
|
180
181
|
actor: 'user',
|
|
181
182
|
type: 'text',
|
|
182
|
-
query:
|
|
183
|
+
query: request
|
|
183
184
|
}
|
|
184
185
|
],
|
|
185
186
|
response_format: {
|
|
@@ -196,14 +197,8 @@ recent-terminal-contents:
|
|
|
196
197
|
// model returned structured output
|
|
197
198
|
const parsedResult = Commands.safeParse(result.parsed);
|
|
198
199
|
if (parsedResult.success) {
|
|
199
|
-
const
|
|
200
|
-
this.recordingService.recordResponse({
|
|
201
|
-
agentId: this.id,
|
|
202
|
-
sessionId,
|
|
203
|
-
timestamp: Date.now(),
|
|
204
|
-
requestId,
|
|
205
|
-
response: responseTextfromParsed,
|
|
206
|
-
});
|
|
200
|
+
const response = JSON.stringify(parsedResult.data.commands);
|
|
201
|
+
this.recordingService.recordResponse({ agentId: this.id, sessionId, requestId, response, systemMessage });
|
|
207
202
|
return parsedResult.data.commands;
|
|
208
203
|
}
|
|
209
204
|
}
|
|
@@ -211,13 +206,7 @@ recent-terminal-contents:
|
|
|
211
206
|
// fall back to agent-based parsing of result
|
|
212
207
|
const jsonResult = await getJsonOfResponse(result);
|
|
213
208
|
const responseTextFromJSON = JSON.stringify(jsonResult);
|
|
214
|
-
this.recordingService.recordResponse({
|
|
215
|
-
agentId: this.id,
|
|
216
|
-
sessionId,
|
|
217
|
-
timestamp: Date.now(),
|
|
218
|
-
requestId,
|
|
219
|
-
response: responseTextFromJSON
|
|
220
|
-
});
|
|
209
|
+
this.recordingService.recordResponse({ agentId: this.id, sessionId, requestId, response: responseTextFromJSON });
|
|
221
210
|
const parsedJsonResult = Commands.safeParse(jsonResult);
|
|
222
211
|
if (parsedJsonResult.success) {
|
|
223
212
|
return parsedJsonResult.data.commands;
|