@theia/ai-ide 1.66.0-next.80 → 1.66.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/ai-terminal-functions.d.ts +13 -0
- package/lib/browser/ai-terminal-functions.d.ts.map +1 -0
- package/lib/browser/ai-terminal-functions.js +114 -0
- package/lib/browser/ai-terminal-functions.js.map +1 -0
- package/lib/browser/frontend-module.d.ts.map +1 -1
- package/lib/browser/frontend-module.js +2 -0
- package/lib/browser/frontend-module.js.map +1 -1
- package/lib/common/ai-ide-preferences.d.ts +1 -0
- package/lib/common/ai-ide-preferences.d.ts.map +1 -1
- package/lib/common/ai-ide-preferences.js +12 -1
- package/lib/common/ai-ide-preferences.js.map +1 -1
- package/lib/common/ai-terminal-functions.d.ts +2 -0
- package/lib/common/ai-terminal-functions.d.ts.map +1 -0
- package/lib/common/ai-terminal-functions.js +20 -0
- package/lib/common/ai-terminal-functions.js.map +1 -0
- package/lib/common/orchestrator-chat-agent.d.ts +16 -2
- package/lib/common/orchestrator-chat-agent.d.ts.map +1 -1
- package/lib/common/orchestrator-chat-agent.js +45 -5
- package/lib/common/orchestrator-chat-agent.js.map +1 -1
- package/lib/common/orchestrator-prompt-template.js +1 -1
- package/package.json +21 -21
- package/src/browser/ai-terminal-functions.ts +105 -0
- package/src/browser/frontend-module.ts +3 -0
- package/src/common/ai-ide-preferences.ts +12 -0
- package/src/common/ai-terminal-functions.ts +18 -0
- package/src/common/orchestrator-chat-agent.ts +59 -8
- package/src/common/orchestrator-prompt-template.ts +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ToolProvider, ToolRequest } from '@theia/ai-core';
|
|
2
|
+
import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service';
|
|
3
|
+
import { WorkspaceService } from '@theia/workspace/lib/browser';
|
|
4
|
+
import { ApplicationShell } from '@theia/core/lib/browser';
|
|
5
|
+
export declare class SuggestTerminalCommand implements ToolProvider {
|
|
6
|
+
static ID: string;
|
|
7
|
+
protected readonly terminalService: TerminalService;
|
|
8
|
+
protected readonly workspaceService: WorkspaceService;
|
|
9
|
+
protected readonly applicationShell: ApplicationShell;
|
|
10
|
+
getTool(): ToolRequest;
|
|
11
|
+
protected isValidCommand(command: string): boolean;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ai-terminal-functions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-terminal-functions.d.ts","sourceRoot":"","sources":["../../src/browser/ai-terminal-functions.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,qBACa,sBAAuB,YAAW,YAAY;IACvD,MAAM,CAAC,EAAE,SAA+B;IAGxC,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAGpD,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAGtD,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAEtD,OAAO,IAAI,WAAW;IAwDtB,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;CAQrD"}
|
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
var SuggestTerminalCommand_1;
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.SuggestTerminalCommand = void 0;
|
|
20
|
+
const tslib_1 = require("tslib");
|
|
21
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
+
const terminal_service_1 = require("@theia/terminal/lib/browser/base/terminal-service");
|
|
23
|
+
const ai_terminal_functions_1 = require("../common/ai-terminal-functions");
|
|
24
|
+
const browser_1 = require("@theia/workspace/lib/browser");
|
|
25
|
+
const promise_util_1 = require("@theia/core/lib/common/promise-util");
|
|
26
|
+
const browser_2 = require("@theia/core/lib/browser");
|
|
27
|
+
let SuggestTerminalCommand = SuggestTerminalCommand_1 = class SuggestTerminalCommand {
|
|
28
|
+
getTool() {
|
|
29
|
+
return {
|
|
30
|
+
id: SuggestTerminalCommand_1.ID,
|
|
31
|
+
name: SuggestTerminalCommand_1.ID,
|
|
32
|
+
description: `Proposes executing a command in the terminal.\n
|
|
33
|
+
This tool will automatically write the command into the terminal buffer.\n
|
|
34
|
+
Execution of the command is up to the user.`,
|
|
35
|
+
parameters: {
|
|
36
|
+
type: 'object',
|
|
37
|
+
properties: {
|
|
38
|
+
command: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
description: `The content of the command to write to the terminal buffer.\n
|
|
41
|
+
ALWAYS provide the COMPLETE intended content of the command, without any truncation or omissions.\n
|
|
42
|
+
You MUST include ALL parts of the command.`
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
required: ['command']
|
|
46
|
+
},
|
|
47
|
+
handler: async (args, ctx) => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
if ((_b = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.response) === null || _a === void 0 ? void 0 : _a.cancellationToken) === null || _b === void 0 ? void 0 : _b.isCancellationRequested) {
|
|
50
|
+
return JSON.stringify({ error: 'Operation cancelled by user' });
|
|
51
|
+
}
|
|
52
|
+
// Ensure that there is a workspace
|
|
53
|
+
let activeTerminal = this.terminalService.lastUsedTerminal;
|
|
54
|
+
if (!activeTerminal || activeTerminal.isDisposed) {
|
|
55
|
+
try {
|
|
56
|
+
activeTerminal = await this.terminalService.newTerminal({});
|
|
57
|
+
this.terminalService.open(activeTerminal, { mode: 'activate' });
|
|
58
|
+
await activeTerminal.start();
|
|
59
|
+
// Wait until the terminal prompt is emitted
|
|
60
|
+
await (0, promise_util_1.waitForEvent)(activeTerminal.onOutput, 3000);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
return JSON.stringify({ error: `Error executing tool 'suggestTerminalCommand': ${error}` });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
this.terminalService.open(activeTerminal, { mode: 'activate' });
|
|
68
|
+
}
|
|
69
|
+
let command;
|
|
70
|
+
try {
|
|
71
|
+
const { command: parsedCommand } = JSON.parse(args);
|
|
72
|
+
command = parsedCommand;
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
return JSON.stringify({ error: `Error parsing arguments for tool 'suggestTerminalCommand': ${error}` });
|
|
76
|
+
}
|
|
77
|
+
if (!this.isValidCommand(command)) {
|
|
78
|
+
return JSON.stringify({ error: 'Error validating command generated by \'suggestTerminalCommand\'' });
|
|
79
|
+
}
|
|
80
|
+
;
|
|
81
|
+
// Clear the current input line by sending Ctrl+A (move to start) and Ctrl+K (delete to end)
|
|
82
|
+
activeTerminal.sendText('\x01\x0b');
|
|
83
|
+
activeTerminal.sendText(command);
|
|
84
|
+
return `Proposed executing the terminal command ${command}. The user will review and potentially execute the command.`;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
isValidCommand(command) {
|
|
89
|
+
// Command should not be empty and should not contain control characters
|
|
90
|
+
const CONTROL_CHAR_REGEX = /[\u0000-\u001F\u007F]/; // ASCII control range
|
|
91
|
+
if (!command || CONTROL_CHAR_REGEX.test(command)) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
exports.SuggestTerminalCommand = SuggestTerminalCommand;
|
|
98
|
+
SuggestTerminalCommand.ID = ai_terminal_functions_1.SUGGEST_TERMINAL_COMMAND_ID;
|
|
99
|
+
tslib_1.__decorate([
|
|
100
|
+
(0, inversify_1.inject)(terminal_service_1.TerminalService),
|
|
101
|
+
tslib_1.__metadata("design:type", Object)
|
|
102
|
+
], SuggestTerminalCommand.prototype, "terminalService", void 0);
|
|
103
|
+
tslib_1.__decorate([
|
|
104
|
+
(0, inversify_1.inject)(browser_1.WorkspaceService),
|
|
105
|
+
tslib_1.__metadata("design:type", browser_1.WorkspaceService)
|
|
106
|
+
], SuggestTerminalCommand.prototype, "workspaceService", void 0);
|
|
107
|
+
tslib_1.__decorate([
|
|
108
|
+
(0, inversify_1.inject)(browser_2.ApplicationShell),
|
|
109
|
+
tslib_1.__metadata("design:type", browser_2.ApplicationShell)
|
|
110
|
+
], SuggestTerminalCommand.prototype, "applicationShell", void 0);
|
|
111
|
+
exports.SuggestTerminalCommand = SuggestTerminalCommand = SuggestTerminalCommand_1 = tslib_1.__decorate([
|
|
112
|
+
(0, inversify_1.injectable)()
|
|
113
|
+
], SuggestTerminalCommand);
|
|
114
|
+
//# sourceMappingURL=ai-terminal-functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-terminal-functions.js","sourceRoot":"","sources":["../../src/browser/ai-terminal-functions.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AAC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AAI,CAAC,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/C,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;;AA3EQ,wDAAsB;AACxB,yBAAE,GAAG,mDAA2B,AAA9B,CAA+B;AAGrB;IADlB,IAAA,kBAAM,EAAC,kCAAe,CAAC;;+DAC4B;AAGjC;IADlB,IAAA,kBAAM,EAAC,0BAAgB,CAAC;sCACY,0BAAgB;gEAAC;AAGnC;IADlB,IAAA,kBAAM,EAAC,0BAAgB,CAAC;sCACY,0BAAgB;gEAAC;iCAV7C,sBAAsB;IADlC,IAAA,sBAAU,GAAE;GACA,sBAAsB,CA4ElC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,mCAAmC,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;
|
|
1
|
+
{"version":3,"file":"frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,mCAAmC,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAiF/D,wBA6KG"}
|
|
@@ -64,6 +64,7 @@ const ai_ide_activation_service_1 = require("./ai-ide-activation-service");
|
|
|
64
64
|
const ai_configuration_preferences_1 = require("../common/ai-configuration-preferences");
|
|
65
65
|
const task_context_agent_1 = require("./task-context-agent");
|
|
66
66
|
const project_info_agent_1 = require("./project-info-agent");
|
|
67
|
+
const ai_terminal_functions_1 = require("./ai-terminal-functions");
|
|
67
68
|
exports.default = new inversify_1.ContainerModule((bind, _unbind, _isBound, rebind) => {
|
|
68
69
|
bind(core_1.PreferenceContribution).toConstantValue({ schema: ai_ide_preferences_1.aiIdePreferenceSchema });
|
|
69
70
|
bind(core_1.PreferenceContribution).toConstantValue({ schema: workspace_preferences_1.WorkspacePreferencesSchema });
|
|
@@ -208,5 +209,6 @@ exports.default = new inversify_1.ContainerModule((bind, _unbind, _isBound, rebi
|
|
|
208
209
|
createWidget: () => ctx.container.get(prompt_fragments_configuration_widget_1.AIPromptFragmentsConfigurationWidget)
|
|
209
210
|
}))
|
|
210
211
|
.inSingletonScope();
|
|
212
|
+
(0, common_2.bindToolProvider)(ai_terminal_functions_1.SuggestTerminalCommand, bind);
|
|
211
213
|
});
|
|
212
214
|
//# sourceMappingURL=frontend-module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend-module.js","sourceRoot":"","sources":["../../src/browser/frontend-module.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,6CAA2C;AAE3C,4DAA+D;AAC/D,sDAA+F;AAC/F,sDAA4F;AAC5F,uDAAmD;AACnD,+CAA2C;AAC3C,qGAA+F;AAC/F,+DAO+B;AAC/B,2EAAsE;AACtE,qDAMiC;AACjC,uEAAiF;AACjF,2EAIqC;AACrC,2EAA6E;AAC7E,yEAcoC;AACpC,+EAAmG;AACnG,yEAA0F;AAC1F,mEAA6D;AAC7D,2DAAsD;AACtD,uEAAiE;AACjE,2DAAgG;AAChG,8FAA2F;AAC3F,0FAA8F;AAC9F,8GAA6G;AAC7G,wFAA4F;AAC5F,oGAAiG;AACjG,6EAAoF;AACpF,8FAA2F;AAC3F,mFAA0F;AAC1F,yFAAoF;AACpF,0FAAuF;AACvF,iFAA0F;AAC1F,2FAAoF;AACpF,0GAAsG;AACtG,yFAA4F;AAC5F,2FAAqF;AACrF,2FAAoF;AACpF,0FAA4F;AAC5F,sCAA0E;AAC1E,oHAAgH;AAChH,uFAAiG;AACjG,yEAA0F;AAC1F,2EAAsI;AACtI,8GAAwG;AACxG,qEAAqE;AACrE,wDAAiE;AACjE,2EAAyE;AACzE,yFAAoF;AACpF,6DAAwD;AACxD,6DAAwD;
|
|
1
|
+
{"version":3,"file":"frontend-module.js","sourceRoot":"","sources":["../../src/browser/frontend-module.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,6CAA2C;AAE3C,4DAA+D;AAC/D,sDAA+F;AAC/F,sDAA4F;AAC5F,uDAAmD;AACnD,+CAA2C;AAC3C,qGAA+F;AAC/F,+DAO+B;AAC/B,2EAAsE;AACtE,qDAMiC;AACjC,uEAAiF;AACjF,2EAIqC;AACrC,2EAA6E;AAC7E,yEAcoC;AACpC,+EAAmG;AACnG,yEAA0F;AAC1F,mEAA6D;AAC7D,2DAAsD;AACtD,uEAAiE;AACjE,2DAAgG;AAChG,8FAA2F;AAC3F,0FAA8F;AAC9F,8GAA6G;AAC7G,wFAA4F;AAC5F,oGAAiG;AACjG,6EAAoF;AACpF,8FAA2F;AAC3F,mFAA0F;AAC1F,yFAAoF;AACpF,0FAAuF;AACvF,iFAA0F;AAC1F,2FAAoF;AACpF,0GAAsG;AACtG,yFAA4F;AAC5F,2FAAqF;AACrF,2FAAoF;AACpF,0FAA4F;AAC5F,sCAA0E;AAC1E,oHAAgH;AAChH,uFAAiG;AACjG,yEAA0F;AAC1F,2EAAsI;AACtI,8GAAwG;AACxG,qEAAqE;AACrE,wDAAiE;AACjE,2EAAyE;AACzE,yFAAoF;AACpF,6DAAwD;AACxD,6DAAwD;AACxD,mEAAiE;AAEjE,kBAAe,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ENCE_NAME_ENABLE_AI = "ai-features.AiEnable.enableAI";
|
|
3
|
+
export declare const PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST = "ai-features.orchestrator.excludedAgents";
|
|
3
4
|
export declare const aiIdePreferenceSchema: PreferenceSchema;
|
|
4
5
|
//# sourceMappingURL=ai-ide-preferences.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-ide-preferences.d.ts","sourceRoot":"","sources":["../../src/common/ai-ide-preferences.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAO,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,eAAO,MAAM,yBAAyB,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"ai-ide-preferences.d.ts","sourceRoot":"","sources":["../../src/common/ai-ide-preferences.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAO,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,eAAO,MAAM,yBAAyB,kCAAkC,CAAC;AACzE,eAAO,MAAM,2CAA2C,4CAA4C,CAAC;AAErG,eAAO,MAAM,qBAAqB,EAAE,gBA8BnC,CAAC"}
|
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
16
|
// *****************************************************************************
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.aiIdePreferenceSchema = exports.PREFERENCE_NAME_ENABLE_AI = void 0;
|
|
18
|
+
exports.aiIdePreferenceSchema = exports.PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST = exports.PREFERENCE_NAME_ENABLE_AI = void 0;
|
|
19
19
|
const common_1 = require("@theia/ai-core/lib/common");
|
|
20
20
|
const core_1 = require("@theia/core");
|
|
21
21
|
// We reuse the context key for the preference name
|
|
22
22
|
exports.PREFERENCE_NAME_ENABLE_AI = 'ai-features.AiEnable.enableAI';
|
|
23
|
+
exports.PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST = 'ai-features.orchestrator.excludedAgents';
|
|
23
24
|
exports.aiIdePreferenceSchema = {
|
|
24
25
|
properties: {
|
|
25
26
|
[exports.PREFERENCE_NAME_ENABLE_AI]: {
|
|
@@ -36,6 +37,16 @@ exports.aiIdePreferenceSchema = {
|
|
|
36
37
|
LLM provider below. Also see [the documentation](https://theia-ide.org/docs/user_ai/)**.'),
|
|
37
38
|
type: 'boolean',
|
|
38
39
|
default: false,
|
|
40
|
+
},
|
|
41
|
+
[exports.PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST]: {
|
|
42
|
+
title: common_1.AI_CORE_PREFERENCES_TITLE,
|
|
43
|
+
markdownDescription: core_1.nls.localize('theia/ai/ide/orchestrator/excludedAgents/mdDescription', 'List of agent IDs that the orchestrator is not allowed to delegate to. ' +
|
|
44
|
+
'These agents will not be visible to the orchestrator when selecting an agent to handle a request.'),
|
|
45
|
+
type: 'array',
|
|
46
|
+
items: {
|
|
47
|
+
type: 'string'
|
|
48
|
+
},
|
|
49
|
+
default: ['ClaudeCode'],
|
|
39
50
|
}
|
|
40
51
|
}
|
|
41
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-ide-preferences.js","sourceRoot":"","sources":["../../src/common/ai-ide-preferences.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,sDAAsE;AACtE,sCAAoD;AAEpD,mDAAmD;AACtC,QAAA,yBAAyB,GAAG,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"ai-ide-preferences.js","sourceRoot":"","sources":["../../src/common/ai-ide-preferences.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,sDAAsE;AACtE,sCAAoD;AAEpD,mDAAmD;AACtC,QAAA,yBAAyB,GAAG,+BAA+B,CAAC;AAC5D,QAAA,2CAA2C,GAAG,yCAAyC,CAAC;AAExF,QAAA,qBAAqB,GAAqB;IACnD,UAAU,EAAE;QACR,CAAC,iCAAyB,CAAC,EAAE;YACzB,KAAK,EAAE,kCAAyB;YAChC,mBAAmB,EAAE,UAAG,CAAC,QAAQ,CAAC,qCAAqC,EACnE;;;;;;;;;qGASqF,CAAC;YAC1F,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;SACjB;QACD,CAAC,mDAA2C,CAAC,EAAE;YAC3C,KAAK,EAAE,kCAAyB;YAChC,mBAAmB,EAAE,UAAG,CAAC,QAAQ,CAAC,wDAAwD,EACtF,yEAAyE;gBACzE,mGAAmG,CAAC;YACxG,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACH,IAAI,EAAE,QAAQ;aACjB;YACD,OAAO,EAAE,CAAC,YAAY,CAAC;SAC1B;KACJ;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-terminal-functions.d.ts","sourceRoot":"","sources":["../../src/common/ai-terminal-functions.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,2BAA2B,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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.SUGGEST_TERMINAL_COMMAND_ID = void 0;
|
|
19
|
+
exports.SUGGEST_TERMINAL_COMMAND_ID = 'suggestTerminalCommand';
|
|
20
|
+
//# sourceMappingURL=ai-terminal-functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-terminal-functions.js","sourceRoot":"","sources":["../../src/common/ai-terminal-functions.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;;;AAEnE,QAAA,2BAA2B,GAAG,wBAAwB,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { LanguageModel, LanguageModelMessage, LanguageModelRequirement, LanguageModelResponse } from '@theia/ai-core';
|
|
1
|
+
import { AIVariableContext, LanguageModel, LanguageModelMessage, LanguageModelRequirement, LanguageModelResponse } from '@theia/ai-core';
|
|
2
2
|
import { ChatAgentService } from '@theia/ai-chat/lib/common/chat-agent-service';
|
|
3
3
|
import { ChatToolRequest } from '@theia/ai-chat/lib/common/chat-tool-request-service';
|
|
4
|
-
import { AbstractStreamParsingChatAgent } from '@theia/ai-chat/lib/common/chat-agents';
|
|
4
|
+
import { AbstractStreamParsingChatAgent, SystemMessageDescription } from '@theia/ai-chat/lib/common/chat-agents';
|
|
5
5
|
import { MutableChatRequestModel } from '@theia/ai-chat/lib/common/chat-model';
|
|
6
|
+
import { PreferenceService } from '@theia/core';
|
|
6
7
|
export declare const OrchestratorChatAgentId = "Orchestrator";
|
|
7
8
|
export declare class OrchestratorChatAgent extends AbstractStreamParsingChatAgent {
|
|
8
9
|
id: string;
|
|
@@ -12,9 +13,22 @@ export declare class OrchestratorChatAgent extends AbstractStreamParsingChatAgen
|
|
|
12
13
|
prompts: import("@theia/ai-core").PromptVariantSet[];
|
|
13
14
|
description: string;
|
|
14
15
|
iconClass: string;
|
|
16
|
+
agentSpecificVariables: {
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
usedInPrompt: boolean;
|
|
20
|
+
}[];
|
|
15
21
|
protected systemPromptId: string;
|
|
16
22
|
private fallBackChatAgentId;
|
|
17
23
|
protected chatAgentService: ChatAgentService;
|
|
24
|
+
protected preferenceService: PreferenceService;
|
|
25
|
+
protected getSystemMessageDescription(context: AIVariableContext): Promise<SystemMessageDescription | undefined>;
|
|
26
|
+
protected getAvailableAgentsForDelegation(excludedAgents: string[]): Array<{
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
}>;
|
|
31
|
+
protected getExcludedAgentIds(): string[];
|
|
18
32
|
invoke(request: MutableChatRequestModel): Promise<void>;
|
|
19
33
|
protected sendLlmRequest(request: MutableChatRequestModel, messages: LanguageModelMessage[], toolRequests: ChatToolRequest[], languageModel: LanguageModel): Promise<LanguageModelResponse>;
|
|
20
34
|
protected addContentsToResponse(response: LanguageModelResponse, request: MutableChatRequestModel): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator-chat-agent.d.ts","sourceRoot":"","sources":["../../src/common/orchestrator-chat-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAoC,aAAa,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"orchestrator-chat-agent.d.ts","sourceRoot":"","sources":["../../src/common/orchestrator-chat-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,iBAAiB,EAAoC,aAAa,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE3K,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AACtF,OAAO,EAAE,8BAA8B,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjH,OAAO,EAAE,uBAAuB,EAAwC,MAAM,sCAAsC,CAAC;AACrH,OAAO,EAAqB,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAInE,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAGtD,qBACa,qBAAsB,SAAQ,8BAA8B;IACrE,EAAE,EAAE,MAAM,CAA2B;IACrC,IAAI,SAA2B;IAC/B,yBAAyB,EAAE,wBAAwB,EAAE,CAGlD;IACH,SAAS,CAAC,2BAA2B,EAAE,MAAM,CAAqB;IAEzD,OAAO,8CAA0B;IACjC,WAAW,SAE+F;IAC1G,SAAS,EAAE,MAAM,CAAoC;IACrD,sBAAsB;;;;QAK5B;IAEH,UAAmB,cAAc,EAAE,MAAM,CAA2B;IAEpE,OAAO,CAAC,mBAAmB,CAAe;IAG1C,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAG7C,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;cAEtB,2BAA2B,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;IAkB/H,SAAS,CAAC,+BAA+B,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAU7H,SAAS,CAAC,mBAAmB,IAAI,MAAM,EAAE;IAI1B,MAAM,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;cAS7C,cAAc,CACnC,OAAO,EAAE,uBAAuB,EAChC,QAAQ,EAAE,oBAAoB,EAAE,EAChC,YAAY,EAAE,eAAe,EAAE,EAC/B,aAAa,EAAE,aAAa,GAC7B,OAAO,CAAC,qBAAqB,CAAC;cAqBR,qBAAqB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;CA2DnI"}
|
|
@@ -24,6 +24,7 @@ const chat_agents_1 = require("@theia/ai-chat/lib/common/chat-agents");
|
|
|
24
24
|
const chat_model_1 = require("@theia/ai-chat/lib/common/chat-model");
|
|
25
25
|
const core_1 = require("@theia/core");
|
|
26
26
|
const orchestrator_prompt_template_1 = require("./orchestrator-prompt-template");
|
|
27
|
+
const ai_ide_preferences_1 = require("./ai-ide-preferences");
|
|
27
28
|
exports.OrchestratorChatAgentId = 'Orchestrator';
|
|
28
29
|
const OrchestratorRequestIdKey = 'orchestratorRequestIdKey';
|
|
29
30
|
let OrchestratorChatAgent = class OrchestratorChatAgent extends chat_agents_1.AbstractStreamParsingChatAgent {
|
|
@@ -40,9 +41,36 @@ let OrchestratorChatAgent = class OrchestratorChatAgent extends chat_agents_1.Ab
|
|
|
40
41
|
this.description = core_1.nls.localize('theia/ai/chat/orchestrator/description', 'This agent analyzes the user request against the description of all available chat agents and selects the best fitting agent to answer the request \
|
|
41
42
|
(by using AI).The user\'s request will be directly delegated to the selected agent without further confirmation.');
|
|
42
43
|
this.iconClass = 'codicon codicon-symbol-boolean';
|
|
44
|
+
this.agentSpecificVariables = [{
|
|
45
|
+
name: 'availableChatAgents',
|
|
46
|
+
description: core_1.nls.localize('theia/ai/chat/orchestrator/vars/availableChatAgents/description', 'The list of chat agents that the orchestrator can delegate to, excluding agents specified in the exclusion list preference.'),
|
|
47
|
+
usedInPrompt: true
|
|
48
|
+
}];
|
|
43
49
|
this.systemPromptId = orchestrator_prompt_template_1.orchestratorTemplate.id;
|
|
44
50
|
this.fallBackChatAgentId = 'Universal';
|
|
45
51
|
}
|
|
52
|
+
async getSystemMessageDescription(context) {
|
|
53
|
+
if (this.systemPromptId === undefined) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
const excludedAgents = this.preferenceService.get(ai_ide_preferences_1.PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST, ['ClaudeCode']);
|
|
57
|
+
const availableAgents = this.getAvailableAgentsForDelegation(excludedAgents);
|
|
58
|
+
const availableChatAgentsValue = availableAgents.map(agent => prettyPrintAgentInMd(agent)).join('\n');
|
|
59
|
+
const resolvedPrompt = await this.promptService.getResolvedPromptFragment(this.systemPromptId, { availableChatAgents: availableChatAgentsValue }, context);
|
|
60
|
+
return resolvedPrompt ? chat_agents_1.SystemMessageDescription.fromResolvedPromptFragment(resolvedPrompt) : undefined;
|
|
61
|
+
}
|
|
62
|
+
getAvailableAgentsForDelegation(excludedAgents) {
|
|
63
|
+
return this.chatAgentService.getAgents()
|
|
64
|
+
.filter(agent => agent.id !== this.id && !excludedAgents.includes(agent.id))
|
|
65
|
+
.map(agent => ({
|
|
66
|
+
id: agent.id,
|
|
67
|
+
name: agent.name,
|
|
68
|
+
description: agent.description
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
getExcludedAgentIds() {
|
|
72
|
+
return this.preferenceService.get(ai_ide_preferences_1.PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST, ['ClaudeCode']);
|
|
73
|
+
}
|
|
46
74
|
async invoke(request) {
|
|
47
75
|
request.response.addProgressMessage({ content: core_1.nls.localize('theia/ai/ide/orchestrator/progressMessage', 'Determining the most appropriate agent'), status: 'inProgress' });
|
|
48
76
|
// We use a dedicated id for the orchestrator request
|
|
@@ -72,10 +100,11 @@ let OrchestratorChatAgent = class OrchestratorChatAgent extends chat_agents_1.Ab
|
|
|
72
100
|
var _a;
|
|
73
101
|
const responseText = await (0, ai_core_1.getTextOfResponse)(response);
|
|
74
102
|
let agentIds = [];
|
|
103
|
+
const excludedAgents = this.getExcludedAgentIds();
|
|
75
104
|
try {
|
|
76
105
|
const jsonResponse = await (0, ai_core_1.getJsonOfText)(responseText);
|
|
77
106
|
if (Array.isArray(jsonResponse)) {
|
|
78
|
-
agentIds = jsonResponse.filter((id) => id !== this.id);
|
|
107
|
+
agentIds = jsonResponse.filter((id) => id !== this.id && !excludedAgents.includes(id));
|
|
79
108
|
}
|
|
80
109
|
}
|
|
81
110
|
catch (error) {
|
|
@@ -87,10 +116,11 @@ let OrchestratorChatAgent = class OrchestratorChatAgent extends chat_agents_1.Ab
|
|
|
87
116
|
request.response.progressMessages.forEach(progressMessage => request.response.updateProgressMessage({ ...progressMessage, status: 'failed' }));
|
|
88
117
|
agentIds = [this.fallBackChatAgentId];
|
|
89
118
|
}
|
|
90
|
-
// check if selected (or fallback) agent exists
|
|
91
|
-
if (!this.chatAgentService.getAgent(agentIds[0])) {
|
|
92
|
-
this.logger.error(`Chat agent ${agentIds[0]} not found. Falling back to first
|
|
93
|
-
const firstRegisteredAgent = (_a = this.chatAgentService.getAgents()
|
|
119
|
+
// check if selected (or fallback) agent exists and is not excluded
|
|
120
|
+
if (!this.chatAgentService.getAgent(agentIds[0]) || excludedAgents.includes(agentIds[0])) {
|
|
121
|
+
this.logger.error(`Chat agent ${agentIds[0]} not found or excluded. Falling back to first available agent.`);
|
|
122
|
+
const firstRegisteredAgent = (_a = this.chatAgentService.getAgents()
|
|
123
|
+
.filter(a => a.id !== this.id && !excludedAgents.includes(a.id))[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
94
124
|
if (firstRegisteredAgent) {
|
|
95
125
|
agentIds = [firstRegisteredAgent];
|
|
96
126
|
}
|
|
@@ -121,7 +151,17 @@ tslib_1.__decorate([
|
|
|
121
151
|
(0, inversify_1.inject)(chat_agent_service_1.ChatAgentService),
|
|
122
152
|
tslib_1.__metadata("design:type", Object)
|
|
123
153
|
], OrchestratorChatAgent.prototype, "chatAgentService", void 0);
|
|
154
|
+
tslib_1.__decorate([
|
|
155
|
+
(0, inversify_1.inject)(core_1.PreferenceService),
|
|
156
|
+
tslib_1.__metadata("design:type", Object)
|
|
157
|
+
], OrchestratorChatAgent.prototype, "preferenceService", void 0);
|
|
124
158
|
exports.OrchestratorChatAgent = OrchestratorChatAgent = tslib_1.__decorate([
|
|
125
159
|
(0, inversify_1.injectable)()
|
|
126
160
|
], OrchestratorChatAgent);
|
|
161
|
+
function prettyPrintAgentInMd(agent) {
|
|
162
|
+
return `- ${agent.id}
|
|
163
|
+
- *ID*: ${agent.id}
|
|
164
|
+
- *Name*: ${agent.name}
|
|
165
|
+
- *Description*: ${agent.description.replace(/\n/g, ' ')}`;
|
|
166
|
+
}
|
|
127
167
|
//# sourceMappingURL=orchestrator-chat-agent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator-chat-agent.js","sourceRoot":"","sources":["../../src/common/orchestrator-chat-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,
|
|
1
|
+
{"version":3,"file":"orchestrator-chat-agent.js","sourceRoot":"","sources":["../../src/common/orchestrator-chat-agent.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAm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C,CAAC,OAAO,CAAC;QACxH,MAAM,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;CACJ,CAAA;AA7JY,sDAAqB;AA0BpB;IADT,IAAA,kBAAM,EAAC,qCAAgB,CAAC;;+DACoB;AAGnC;IADT,IAAA,kBAAM,EAAC,wBAAiB,CAAC;;gEACqB;gCA7BtC,qBAAqB;IADjC,IAAA,sBAAU,GAAE;GACA,qBAAqB,CA6JjC;AAED,SAAS,oBAAoB,CAAC,KAAwD;IAClF,OAAO,KAAK,KAAK,CAAC,EAAE;YACZ,KAAK,CAAC,EAAE;cACN,KAAK,CAAC,IAAI;qBACH,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;AAC7D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/ai-ide",
|
|
3
|
-
"version": "1.66.0
|
|
3
|
+
"version": "1.66.0",
|
|
4
4
|
"description": "AI IDE Agents Extension",
|
|
5
5
|
"license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -15,23 +15,23 @@
|
|
|
15
15
|
"theia-extension"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@theia/ai-chat": "1.66.0
|
|
19
|
-
"@theia/ai-chat-ui": "1.66.0
|
|
20
|
-
"@theia/ai-core": "1.66.0
|
|
21
|
-
"@theia/ai-mcp": "1.66.0
|
|
22
|
-
"@theia/core": "1.66.0
|
|
23
|
-
"@theia/debug": "1.66.0
|
|
24
|
-
"@theia/editor": "1.66.0
|
|
25
|
-
"@theia/filesystem": "1.66.0
|
|
26
|
-
"@theia/markers": "1.66.0
|
|
27
|
-
"@theia/monaco": "1.66.0
|
|
28
|
-
"@theia/navigator": "1.66.0
|
|
29
|
-
"@theia/preferences": "1.66.0
|
|
30
|
-
"@theia/scm": "1.66.0
|
|
31
|
-
"@theia/search-in-workspace": "1.66.0
|
|
32
|
-
"@theia/task": "1.66.0
|
|
33
|
-
"@theia/terminal": "1.66.0
|
|
34
|
-
"@theia/workspace": "1.66.0
|
|
18
|
+
"@theia/ai-chat": "1.66.0",
|
|
19
|
+
"@theia/ai-chat-ui": "1.66.0",
|
|
20
|
+
"@theia/ai-core": "1.66.0",
|
|
21
|
+
"@theia/ai-mcp": "1.66.0",
|
|
22
|
+
"@theia/core": "1.66.0",
|
|
23
|
+
"@theia/debug": "1.66.0",
|
|
24
|
+
"@theia/editor": "1.66.0",
|
|
25
|
+
"@theia/filesystem": "1.66.0",
|
|
26
|
+
"@theia/markers": "1.66.0",
|
|
27
|
+
"@theia/monaco": "1.66.0",
|
|
28
|
+
"@theia/navigator": "1.66.0",
|
|
29
|
+
"@theia/preferences": "1.66.0",
|
|
30
|
+
"@theia/scm": "1.66.0",
|
|
31
|
+
"@theia/search-in-workspace": "1.66.0",
|
|
32
|
+
"@theia/task": "1.66.0",
|
|
33
|
+
"@theia/terminal": "1.66.0",
|
|
34
|
+
"@theia/workspace": "1.66.0",
|
|
35
35
|
"date-fns": "^4.1.0",
|
|
36
36
|
"ignore": "^6.0.0",
|
|
37
37
|
"js-yaml": "^4.1.0",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@theia/cli": "1.66.0
|
|
47
|
-
"@theia/test": "1.66.0
|
|
46
|
+
"@theia/cli": "1.66.0",
|
|
47
|
+
"@theia/test": "1.66.0"
|
|
48
48
|
},
|
|
49
49
|
"theiaExtensions": [
|
|
50
50
|
{
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"nyc": {
|
|
69
69
|
"extends": "../../configs/nyc.json"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "dc03613006449e67b722a8c2e75c9a62585d5da8"
|
|
72
72
|
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2025 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 { MutableChatRequestModel } from '@theia/ai-chat';
|
|
18
|
+
import { ToolProvider, ToolRequest } from '@theia/ai-core';
|
|
19
|
+
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
20
|
+
import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service';
|
|
21
|
+
import { SUGGEST_TERMINAL_COMMAND_ID } from '../common/ai-terminal-functions';
|
|
22
|
+
import { WorkspaceService } from '@theia/workspace/lib/browser';
|
|
23
|
+
import { TerminalWidget } from '@theia/terminal/lib/browser/base/terminal-widget';
|
|
24
|
+
import { waitForEvent } from '@theia/core/lib/common/promise-util';
|
|
25
|
+
import { ApplicationShell } from '@theia/core/lib/browser';
|
|
26
|
+
|
|
27
|
+
@injectable()
|
|
28
|
+
export class SuggestTerminalCommand implements ToolProvider {
|
|
29
|
+
static ID = SUGGEST_TERMINAL_COMMAND_ID;
|
|
30
|
+
|
|
31
|
+
@inject(TerminalService)
|
|
32
|
+
protected readonly terminalService: TerminalService;
|
|
33
|
+
|
|
34
|
+
@inject(WorkspaceService)
|
|
35
|
+
protected readonly workspaceService: WorkspaceService;
|
|
36
|
+
|
|
37
|
+
@inject(ApplicationShell)
|
|
38
|
+
protected readonly applicationShell: ApplicationShell;
|
|
39
|
+
|
|
40
|
+
getTool(): ToolRequest {
|
|
41
|
+
return {
|
|
42
|
+
id: SuggestTerminalCommand.ID,
|
|
43
|
+
name: SuggestTerminalCommand.ID,
|
|
44
|
+
description: `Proposes executing a command in the terminal.\n
|
|
45
|
+
This tool will automatically write the command into the terminal buffer.\n
|
|
46
|
+
Execution of the command is up to the user.`,
|
|
47
|
+
parameters: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
properties: {
|
|
50
|
+
command: {
|
|
51
|
+
type: 'string',
|
|
52
|
+
description: `The content of the command to write to the terminal buffer.\n
|
|
53
|
+
ALWAYS provide the COMPLETE intended content of the command, without any truncation or omissions.\n
|
|
54
|
+
You MUST include ALL parts of the command.`
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
required: ['command']
|
|
58
|
+
},
|
|
59
|
+
handler: async (args: string, ctx: MutableChatRequestModel): Promise<string> => {
|
|
60
|
+
if (ctx?.response?.cancellationToken?.isCancellationRequested) {
|
|
61
|
+
return JSON.stringify({ error: 'Operation cancelled by user' });
|
|
62
|
+
}
|
|
63
|
+
// Ensure that there is a workspace
|
|
64
|
+
let activeTerminal: TerminalWidget | undefined = this.terminalService.lastUsedTerminal;
|
|
65
|
+
if (!activeTerminal || activeTerminal.isDisposed) {
|
|
66
|
+
try {
|
|
67
|
+
activeTerminal = await this.terminalService.newTerminal({});
|
|
68
|
+
this.terminalService.open(activeTerminal, { mode: 'activate' });
|
|
69
|
+
await activeTerminal.start();
|
|
70
|
+
// Wait until the terminal prompt is emitted
|
|
71
|
+
await waitForEvent(activeTerminal.onOutput, 3000);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
return JSON.stringify({ error: `Error executing tool 'suggestTerminalCommand': ${error}` });
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
this.terminalService.open(activeTerminal, { mode: 'activate' });
|
|
77
|
+
}
|
|
78
|
+
let command: string;
|
|
79
|
+
try {
|
|
80
|
+
const { command: parsedCommand } = JSON.parse(args);
|
|
81
|
+
command = parsedCommand;
|
|
82
|
+
} catch (error) {
|
|
83
|
+
return JSON.stringify({ error: `Error parsing arguments for tool 'suggestTerminalCommand': ${error}` });
|
|
84
|
+
}
|
|
85
|
+
if (!this.isValidCommand(command)) {
|
|
86
|
+
return JSON.stringify({ error: 'Error validating command generated by \'suggestTerminalCommand\'' });
|
|
87
|
+
};
|
|
88
|
+
// Clear the current input line by sending Ctrl+A (move to start) and Ctrl+K (delete to end)
|
|
89
|
+
activeTerminal.sendText('\x01\x0b');
|
|
90
|
+
activeTerminal.sendText(command);
|
|
91
|
+
return `Proposed executing the terminal command ${command}. The user will review and potentially execute the command.`;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
protected isValidCommand(command: string): boolean {
|
|
97
|
+
// Command should not be empty and should not contain control characters
|
|
98
|
+
const CONTROL_CHAR_REGEX = /[\u0000-\u001F\u007F]/; // ASCII control range
|
|
99
|
+
if (!command || CONTROL_CHAR_REGEX.test(command)) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
@@ -95,6 +95,7 @@ import { AIIdeActivationServiceImpl } from './ai-ide-activation-service';
|
|
|
95
95
|
import { AiConfigurationPreferences } from '../common/ai-configuration-preferences';
|
|
96
96
|
import { TaskContextAgent } from './task-context-agent';
|
|
97
97
|
import { ProjectInfoAgent } from './project-info-agent';
|
|
98
|
+
import { SuggestTerminalCommand } from './ai-terminal-functions';
|
|
98
99
|
|
|
99
100
|
export default new ContainerModule((bind, _unbind, _isBound, rebind) => {
|
|
100
101
|
bind(PreferenceContribution).toConstantValue({ schema: aiIdePreferenceSchema });
|
|
@@ -267,4 +268,6 @@ export default new ContainerModule((bind, _unbind, _isBound, rebind) => {
|
|
|
267
268
|
createWidget: () => ctx.container.get(AIPromptFragmentsConfigurationWidget)
|
|
268
269
|
}))
|
|
269
270
|
.inSingletonScope();
|
|
271
|
+
|
|
272
|
+
bindToolProvider(SuggestTerminalCommand, bind);
|
|
270
273
|
});
|
|
@@ -19,6 +19,7 @@ import { nls, PreferenceSchema } from '@theia/core';
|
|
|
19
19
|
|
|
20
20
|
// We reuse the context key for the preference name
|
|
21
21
|
export const PREFERENCE_NAME_ENABLE_AI = 'ai-features.AiEnable.enableAI';
|
|
22
|
+
export const PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST = 'ai-features.orchestrator.excludedAgents';
|
|
22
23
|
|
|
23
24
|
export const aiIdePreferenceSchema: PreferenceSchema = {
|
|
24
25
|
properties: {
|
|
@@ -37,6 +38,17 @@ export const aiIdePreferenceSchema: PreferenceSchema = {
|
|
|
37
38
|
LLM provider below. Also see [the documentation](https://theia-ide.org/docs/user_ai/)**.'),
|
|
38
39
|
type: 'boolean',
|
|
39
40
|
default: false,
|
|
41
|
+
},
|
|
42
|
+
[PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST]: {
|
|
43
|
+
title: AI_CORE_PREFERENCES_TITLE,
|
|
44
|
+
markdownDescription: nls.localize('theia/ai/ide/orchestrator/excludedAgents/mdDescription',
|
|
45
|
+
'List of agent IDs that the orchestrator is not allowed to delegate to. ' +
|
|
46
|
+
'These agents will not be visible to the orchestrator when selecting an agent to handle a request.'),
|
|
47
|
+
type: 'array',
|
|
48
|
+
items: {
|
|
49
|
+
type: 'string'
|
|
50
|
+
},
|
|
51
|
+
default: ['ClaudeCode'],
|
|
40
52
|
}
|
|
41
53
|
}
|
|
42
54
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2025 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
|
+
export const SUGGEST_TERMINAL_COMMAND_ID = 'suggestTerminalCommand';
|
|
18
|
+
|
|
@@ -14,14 +14,15 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { getJsonOfText, getTextOfResponse, LanguageModel, LanguageModelMessage, LanguageModelRequirement, LanguageModelResponse } from '@theia/ai-core';
|
|
17
|
+
import { AIVariableContext, getJsonOfText, getTextOfResponse, LanguageModel, LanguageModelMessage, LanguageModelRequirement, LanguageModelResponse } from '@theia/ai-core';
|
|
18
18
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
19
19
|
import { ChatAgentService } from '@theia/ai-chat/lib/common/chat-agent-service';
|
|
20
20
|
import { ChatToolRequest } from '@theia/ai-chat/lib/common/chat-tool-request-service';
|
|
21
|
-
import { AbstractStreamParsingChatAgent } from '@theia/ai-chat/lib/common/chat-agents';
|
|
21
|
+
import { AbstractStreamParsingChatAgent, SystemMessageDescription } from '@theia/ai-chat/lib/common/chat-agents';
|
|
22
22
|
import { MutableChatRequestModel, InformationalChatResponseContentImpl } from '@theia/ai-chat/lib/common/chat-model';
|
|
23
|
-
import { generateUuid, nls } from '@theia/core';
|
|
23
|
+
import { generateUuid, nls, PreferenceService } from '@theia/core';
|
|
24
24
|
import { orchestratorTemplate } from './orchestrator-prompt-template';
|
|
25
|
+
import { PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST } from './ai-ide-preferences';
|
|
25
26
|
|
|
26
27
|
export const OrchestratorChatAgentId = 'Orchestrator';
|
|
27
28
|
const OrchestratorRequestIdKey = 'orchestratorRequestIdKey';
|
|
@@ -41,6 +42,12 @@ export class OrchestratorChatAgent extends AbstractStreamParsingChatAgent {
|
|
|
41
42
|
'This agent analyzes the user request against the description of all available chat agents and selects the best fitting agent to answer the request \
|
|
42
43
|
(by using AI).The user\'s request will be directly delegated to the selected agent without further confirmation.');
|
|
43
44
|
override iconClass: string = 'codicon codicon-symbol-boolean';
|
|
45
|
+
override agentSpecificVariables = [{
|
|
46
|
+
name: 'availableChatAgents',
|
|
47
|
+
description: nls.localize('theia/ai/chat/orchestrator/vars/availableChatAgents/description',
|
|
48
|
+
'The list of chat agents that the orchestrator can delegate to, excluding agents specified in the exclusion list preference.'),
|
|
49
|
+
usedInPrompt: true
|
|
50
|
+
}];
|
|
44
51
|
|
|
45
52
|
protected override systemPromptId: string = orchestratorTemplate.id;
|
|
46
53
|
|
|
@@ -49,6 +56,41 @@ export class OrchestratorChatAgent extends AbstractStreamParsingChatAgent {
|
|
|
49
56
|
@inject(ChatAgentService)
|
|
50
57
|
protected chatAgentService: ChatAgentService;
|
|
51
58
|
|
|
59
|
+
@inject(PreferenceService)
|
|
60
|
+
protected preferenceService: PreferenceService;
|
|
61
|
+
|
|
62
|
+
protected override async getSystemMessageDescription(context: AIVariableContext): Promise<SystemMessageDescription | undefined> {
|
|
63
|
+
if (this.systemPromptId === undefined) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const excludedAgents = this.preferenceService.get<string[]>(PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST, ['ClaudeCode']);
|
|
68
|
+
const availableAgents = this.getAvailableAgentsForDelegation(excludedAgents);
|
|
69
|
+
const availableChatAgentsValue = availableAgents.map(agent => prettyPrintAgentInMd(agent)).join('\n');
|
|
70
|
+
|
|
71
|
+
const resolvedPrompt = await this.promptService.getResolvedPromptFragment(
|
|
72
|
+
this.systemPromptId,
|
|
73
|
+
{ availableChatAgents: availableChatAgentsValue },
|
|
74
|
+
context
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
return resolvedPrompt ? SystemMessageDescription.fromResolvedPromptFragment(resolvedPrompt) : undefined;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
protected getAvailableAgentsForDelegation(excludedAgents: string[]): Array<{ id: string; name: string; description: string }> {
|
|
81
|
+
return this.chatAgentService.getAgents()
|
|
82
|
+
.filter(agent => agent.id !== this.id && !excludedAgents.includes(agent.id))
|
|
83
|
+
.map(agent => ({
|
|
84
|
+
id: agent.id,
|
|
85
|
+
name: agent.name,
|
|
86
|
+
description: agent.description
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
protected getExcludedAgentIds(): string[] {
|
|
91
|
+
return this.preferenceService.get<string[]>(PREFERENCE_NAME_ORCHESTRATOR_EXCLUSION_LIST, ['ClaudeCode']);
|
|
92
|
+
}
|
|
93
|
+
|
|
52
94
|
override async invoke(request: MutableChatRequestModel): Promise<void> {
|
|
53
95
|
request.response.addProgressMessage({ content: nls.localize('theia/ai/ide/orchestrator/progressMessage', 'Determining the most appropriate agent'), status: 'inProgress' });
|
|
54
96
|
// We use a dedicated id for the orchestrator request
|
|
@@ -88,11 +130,12 @@ export class OrchestratorChatAgent extends AbstractStreamParsingChatAgent {
|
|
|
88
130
|
const responseText = await getTextOfResponse(response);
|
|
89
131
|
|
|
90
132
|
let agentIds: string[] = [];
|
|
133
|
+
const excludedAgents = this.getExcludedAgentIds();
|
|
91
134
|
|
|
92
135
|
try {
|
|
93
136
|
const jsonResponse = await getJsonOfText(responseText);
|
|
94
137
|
if (Array.isArray(jsonResponse)) {
|
|
95
|
-
agentIds = jsonResponse.filter((id: string) => id !== this.id);
|
|
138
|
+
agentIds = jsonResponse.filter((id: string) => id !== this.id && !excludedAgents.includes(id));
|
|
96
139
|
}
|
|
97
140
|
} catch (error: unknown) {
|
|
98
141
|
// The llm sometimes does not return a parseable result
|
|
@@ -107,10 +150,11 @@ export class OrchestratorChatAgent extends AbstractStreamParsingChatAgent {
|
|
|
107
150
|
agentIds = [this.fallBackChatAgentId];
|
|
108
151
|
}
|
|
109
152
|
|
|
110
|
-
// check if selected (or fallback) agent exists
|
|
111
|
-
if (!this.chatAgentService.getAgent(agentIds[0])) {
|
|
112
|
-
this.logger.error(`Chat agent ${agentIds[0]} not found. Falling back to first
|
|
113
|
-
const firstRegisteredAgent = this.chatAgentService.getAgents()
|
|
153
|
+
// check if selected (or fallback) agent exists and is not excluded
|
|
154
|
+
if (!this.chatAgentService.getAgent(agentIds[0]) || excludedAgents.includes(agentIds[0])) {
|
|
155
|
+
this.logger.error(`Chat agent ${agentIds[0]} not found or excluded. Falling back to first available agent.`);
|
|
156
|
+
const firstRegisteredAgent = this.chatAgentService.getAgents()
|
|
157
|
+
.filter(a => a.id !== this.id && !excludedAgents.includes(a.id))[0]?.id;
|
|
114
158
|
if (firstRegisteredAgent) {
|
|
115
159
|
agentIds = [firstRegisteredAgent];
|
|
116
160
|
} else {
|
|
@@ -142,3 +186,10 @@ export class OrchestratorChatAgent extends AbstractStreamParsingChatAgent {
|
|
|
142
186
|
await agent.invoke(originalRequest);
|
|
143
187
|
}
|
|
144
188
|
}
|
|
189
|
+
|
|
190
|
+
function prettyPrintAgentInMd(agent: { id: string; name: string; description: string }): string {
|
|
191
|
+
return `- ${agent.id}
|
|
192
|
+
- *ID*: ${agent.id}
|
|
193
|
+
- *Name*: ${agent.name}
|
|
194
|
+
- *Description*: ${agent.description.replace(/\n/g, ' ')}`;
|
|
195
|
+
}
|