@theia/ai-chat 1.67.0-next.56 → 1.67.0-next.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/agent-delegation-tool.d.ts +25 -0
- package/lib/browser/agent-delegation-tool.d.ts.map +1 -0
- package/lib/browser/agent-delegation-tool.js +196 -0
- package/lib/browser/agent-delegation-tool.js.map +1 -0
- package/lib/browser/ai-chat-frontend-contribution.d.ts +11 -0
- package/lib/browser/ai-chat-frontend-contribution.d.ts.map +1 -0
- package/lib/browser/ai-chat-frontend-contribution.js +56 -0
- package/lib/browser/ai-chat-frontend-contribution.js.map +1 -0
- package/lib/browser/ai-chat-frontend-module.d.ts +4 -0
- package/lib/browser/ai-chat-frontend-module.d.ts.map +1 -0
- package/lib/browser/ai-chat-frontend-module.js +143 -0
- package/lib/browser/ai-chat-frontend-module.js.map +1 -0
- package/lib/browser/change-set-decorator-service.d.ts +24 -0
- package/lib/browser/change-set-decorator-service.d.ts.map +1 -0
- package/lib/browser/change-set-decorator-service.js +66 -0
- package/lib/browser/change-set-decorator-service.js.map +1 -0
- package/lib/browser/change-set-file-element-deserializer.d.ts +7 -0
- package/lib/browser/change-set-file-element-deserializer.d.ts.map +1 -0
- package/lib/browser/change-set-file-element-deserializer.js +61 -0
- package/lib/browser/change-set-file-element-deserializer.js.map +1 -0
- package/lib/browser/change-set-file-element.d.ts +122 -0
- package/lib/browser/change-set-file-element.d.ts.map +1 -0
- package/lib/browser/change-set-file-element.js +435 -0
- package/lib/browser/change-set-file-element.js.map +1 -0
- package/lib/browser/change-set-file-resource.d.ts +4 -0
- package/lib/browser/change-set-file-resource.d.ts.map +1 -0
- package/lib/browser/change-set-file-resource.js +24 -0
- package/lib/browser/change-set-file-resource.js.map +1 -0
- package/lib/browser/change-set-file-service.d.ts +32 -0
- package/lib/browser/change-set-file-service.d.ts.map +1 -0
- package/lib/browser/change-set-file-service.js +161 -0
- package/lib/browser/change-set-file-service.js.map +1 -0
- package/lib/browser/change-set-variable.d.ts +11 -0
- package/lib/browser/change-set-variable.d.ts.map +1 -0
- package/lib/browser/change-set-variable.js +64 -0
- package/lib/browser/change-set-variable.js.map +1 -0
- package/lib/browser/chat-session-store-impl.d.ts +36 -0
- package/lib/browser/chat-session-store-impl.d.ts.map +1 -0
- package/lib/browser/chat-session-store-impl.js +287 -0
- package/lib/browser/chat-session-store-impl.js.map +1 -0
- package/lib/browser/chat-tool-preference-bindings.d.ts +34 -0
- package/lib/browser/chat-tool-preference-bindings.d.ts.map +1 -0
- package/lib/browser/chat-tool-preference-bindings.js +122 -0
- package/lib/browser/chat-tool-preference-bindings.js.map +1 -0
- package/lib/browser/chat-tool-request-service.d.ts +21 -0
- package/lib/browser/chat-tool-request-service.d.ts.map +1 -0
- package/lib/browser/chat-tool-request-service.js +90 -0
- package/lib/browser/chat-tool-request-service.js.map +1 -0
- package/lib/browser/context-file-validation-service.d.ts +15 -0
- package/lib/browser/context-file-validation-service.d.ts.map +1 -0
- package/lib/browser/context-file-validation-service.js +26 -0
- package/lib/browser/context-file-validation-service.js.map +1 -0
- package/lib/browser/context-file-variable-label-provider.d.ts +14 -0
- package/lib/browser/context-file-variable-label-provider.d.ts.map +1 -0
- package/lib/browser/context-file-variable-label-provider.js +63 -0
- package/lib/browser/context-file-variable-label-provider.js.map +1 -0
- package/lib/browser/context-variable-label-provider.d.ts +9 -0
- package/lib/browser/context-variable-label-provider.d.ts.map +1 -0
- package/lib/browser/context-variable-label-provider.js +55 -0
- package/lib/browser/context-variable-label-provider.js.map +1 -0
- package/lib/browser/custom-agent-factory.d.ts +4 -0
- package/lib/browser/custom-agent-factory.d.ts.map +1 -0
- package/lib/browser/custom-agent-factory.js +20 -0
- package/lib/browser/custom-agent-factory.js.map +1 -0
- package/lib/browser/custom-agent-frontend-application-contribution.d.ts +13 -0
- package/lib/browser/custom-agent-frontend-application-contribution.d.ts.map +1 -0
- package/lib/browser/custom-agent-frontend-application-contribution.js +83 -0
- package/lib/browser/custom-agent-frontend-application-contribution.js.map +1 -0
- package/lib/browser/delegation-response-content.d.ts +20 -0
- package/lib/browser/delegation-response-content.d.ts.map +1 -0
- package/lib/browser/delegation-response-content.js +47 -0
- package/lib/browser/delegation-response-content.js.map +1 -0
- package/lib/browser/file-chat-variable-contribution.d.ts +32 -0
- package/lib/browser/file-chat-variable-contribution.d.ts.map +1 -0
- package/lib/browser/file-chat-variable-contribution.js +241 -0
- package/lib/browser/file-chat-variable-contribution.js.map +1 -0
- package/lib/browser/frontend-chat-service.d.ts +15 -0
- package/lib/browser/frontend-chat-service.d.ts.map +1 -0
- package/lib/browser/frontend-chat-service.js +72 -0
- package/lib/browser/frontend-chat-service.js.map +1 -0
- package/lib/browser/image-context-variable-contribution.d.ts +27 -0
- package/lib/browser/image-context-variable-contribution.d.ts.map +1 -0
- package/lib/browser/image-context-variable-contribution.js +149 -0
- package/lib/browser/image-context-variable-contribution.js.map +1 -0
- package/lib/browser/task-context-service.d.ts +46 -0
- package/lib/browser/task-context-service.d.ts.map +1 -0
- package/lib/browser/task-context-service.js +256 -0
- package/lib/browser/task-context-service.js.map +1 -0
- package/lib/browser/task-context-storage-service.d.ts +19 -0
- package/lib/browser/task-context-storage-service.d.ts.map +1 -0
- package/lib/browser/task-context-storage-service.js +80 -0
- package/lib/browser/task-context-storage-service.js.map +1 -0
- package/lib/browser/task-context-variable-contribution.d.ts +20 -0
- package/lib/browser/task-context-variable-contribution.d.ts.map +1 -0
- package/lib/browser/task-context-variable-contribution.js +101 -0
- package/lib/browser/task-context-variable-contribution.js.map +1 -0
- package/lib/browser/task-context-variable-label-provider.d.ts +21 -0
- package/lib/browser/task-context-variable-label-provider.d.ts.map +1 -0
- package/lib/browser/task-context-variable-label-provider.js +83 -0
- package/lib/browser/task-context-variable-label-provider.js.map +1 -0
- package/lib/browser/task-context-variable.d.ts +3 -0
- package/lib/browser/task-context-variable.d.ts.map +1 -0
- package/lib/browser/task-context-variable.js +33 -0
- package/lib/browser/task-context-variable.js.map +1 -0
- package/lib/common/ai-chat-preferences.d.ts +5 -0
- package/lib/common/ai-chat-preferences.d.ts.map +1 -0
- package/lib/common/ai-chat-preferences.js +40 -0
- package/lib/common/ai-chat-preferences.js.map +1 -0
- package/lib/common/change-set-element-deserializer.d.ts +30 -0
- package/lib/common/change-set-element-deserializer.d.ts.map +1 -0
- package/lib/common/change-set-element-deserializer.js +81 -0
- package/lib/common/change-set-element-deserializer.js.map +1 -0
- package/lib/common/change-set.d.ts +85 -0
- package/lib/common/change-set.d.ts.map +1 -0
- package/lib/common/change-set.js +133 -0
- package/lib/common/change-set.js.map +1 -0
- package/lib/common/chat-agent-service.d.ts +46 -0
- package/lib/common/chat-agent-service.d.ts.map +1 -0
- package/lib/common/chat-agent-service.js +79 -0
- package/lib/common/chat-agent-service.js.map +1 -0
- package/lib/common/chat-agents-variable-contribution.d.ts +17 -0
- package/lib/common/chat-agents-variable-contribution.d.ts.map +1 -0
- package/lib/common/chat-agents-variable-contribution.js +67 -0
- package/lib/common/chat-agents-variable-contribution.js.map +1 -0
- package/lib/common/chat-agents.d.ts +138 -0
- package/lib/common/chat-agents.d.ts.map +1 -0
- package/lib/common/chat-agents.js +428 -0
- package/lib/common/chat-agents.js.map +1 -0
- package/lib/common/chat-auto-save.spec.d.ts +2 -0
- package/lib/common/chat-auto-save.spec.d.ts.map +1 -0
- package/lib/common/chat-auto-save.spec.js +304 -0
- package/lib/common/chat-auto-save.spec.js.map +1 -0
- package/lib/common/chat-content-deserializer.d.ts +161 -0
- package/lib/common/chat-content-deserializer.d.ts.map +1 -0
- package/lib/common/chat-content-deserializer.js +166 -0
- package/lib/common/chat-content-deserializer.js.map +1 -0
- package/lib/common/chat-content-deserializer.spec.d.ts +2 -0
- package/lib/common/chat-content-deserializer.spec.d.ts.map +1 -0
- package/lib/common/chat-content-deserializer.spec.js +307 -0
- package/lib/common/chat-content-deserializer.spec.js.map +1 -0
- package/lib/common/chat-model-serialization.d.ts +110 -0
- package/lib/common/chat-model-serialization.d.ts.map +1 -0
- package/lib/common/chat-model-serialization.js +20 -0
- package/lib/common/chat-model-serialization.js.map +1 -0
- package/lib/common/chat-model-serialization.spec.d.ts +2 -0
- package/lib/common/chat-model-serialization.spec.d.ts.map +1 -0
- package/lib/common/chat-model-serialization.spec.js +278 -0
- package/lib/common/chat-model-serialization.spec.js.map +1 -0
- package/lib/common/chat-model-util.d.ts +7 -0
- package/lib/common/chat-model-util.d.ts.map +1 -0
- package/lib/common/chat-model-util.js +50 -0
- package/lib/common/chat-model-util.js.map +1 -0
- package/lib/common/chat-model.d.ts +923 -0
- package/lib/common/chat-model.d.ts.map +1 -0
- package/lib/common/chat-model.js +1791 -0
- package/lib/common/chat-model.js.map +1 -0
- package/lib/common/chat-request-parser.d.ts +38 -0
- package/lib/common/chat-request-parser.d.ts.map +1 -0
- package/lib/common/chat-request-parser.js +230 -0
- package/lib/common/chat-request-parser.js.map +1 -0
- package/lib/common/chat-request-parser.spec.d.ts +2 -0
- package/lib/common/chat-request-parser.spec.d.ts.map +1 -0
- package/lib/common/chat-request-parser.spec.js +235 -0
- package/lib/common/chat-request-parser.spec.js.map +1 -0
- package/lib/common/chat-service-deletion.spec.d.ts +2 -0
- package/lib/common/chat-service-deletion.spec.d.ts.map +1 -0
- package/lib/common/chat-service-deletion.spec.js +221 -0
- package/lib/common/chat-service-deletion.spec.js.map +1 -0
- package/lib/common/chat-service.d.ts +153 -0
- package/lib/common/chat-service.d.ts.map +1 -0
- package/lib/common/chat-service.js +474 -0
- package/lib/common/chat-service.js.map +1 -0
- package/lib/common/chat-session-naming-prompt-template.d.ts +3 -0
- package/lib/common/chat-session-naming-prompt-template.d.ts.map +1 -0
- package/lib/common/chat-session-naming-prompt-template.js +31 -0
- package/lib/common/chat-session-naming-prompt-template.js.map +1 -0
- package/lib/common/chat-session-naming-service.d.ts +26 -0
- package/lib/common/chat-session-naming-service.d.ts.map +1 -0
- package/lib/common/chat-session-naming-service.js +119 -0
- package/lib/common/chat-session-naming-service.js.map +1 -0
- package/lib/common/chat-session-store.d.ts +43 -0
- package/lib/common/chat-session-store.d.ts.map +1 -0
- package/lib/common/chat-session-store.js +20 -0
- package/lib/common/chat-session-store.js.map +1 -0
- package/lib/common/chat-session-summary-agent-prompt.d.ts +8 -0
- package/lib/common/chat-session-summary-agent-prompt.d.ts.map +1 -0
- package/lib/common/chat-session-summary-agent-prompt.js +33 -0
- package/lib/common/chat-session-summary-agent-prompt.js.map +1 -0
- package/lib/common/chat-session-summary-agent.d.ts +16 -0
- package/lib/common/chat-session-summary-agent.d.ts.map +1 -0
- package/lib/common/chat-session-summary-agent.js +48 -0
- package/lib/common/chat-session-summary-agent.js.map +1 -0
- package/lib/common/chat-string-utils.d.ts +3 -0
- package/lib/common/chat-string-utils.d.ts.map +1 -0
- package/lib/common/chat-string-utils.js +27 -0
- package/lib/common/chat-string-utils.js.map +1 -0
- package/lib/common/chat-tool-preferences.d.ts +23 -0
- package/lib/common/chat-tool-preferences.d.ts.map +1 -0
- package/lib/common/chat-tool-preferences.js +68 -0
- package/lib/common/chat-tool-preferences.js.map +1 -0
- package/lib/common/chat-tool-request-service.d.ts +18 -0
- package/lib/common/chat-tool-request-service.d.ts.map +1 -0
- package/lib/common/chat-tool-request-service.js +52 -0
- package/lib/common/chat-tool-request-service.js.map +1 -0
- package/lib/common/context-details-variable.d.ts +9 -0
- package/lib/common/context-details-variable.d.ts.map +1 -0
- package/lib/common/context-details-variable.js +57 -0
- package/lib/common/context-details-variable.js.map +1 -0
- package/lib/common/context-summary-variable.d.ts +9 -0
- package/lib/common/context-summary-variable.d.ts.map +1 -0
- package/lib/common/context-summary-variable.js +57 -0
- package/lib/common/context-summary-variable.js.map +1 -0
- package/lib/common/context-variables.d.ts +4 -0
- package/lib/common/context-variables.d.ts.map +1 -0
- package/lib/common/context-variables.js +22 -0
- package/lib/common/context-variables.js.map +1 -0
- package/lib/common/custom-chat-agent.d.ts +10 -0
- package/lib/common/custom-chat-agent.d.ts.map +1 -0
- package/lib/common/custom-chat-agent.js +40 -0
- package/lib/common/custom-chat-agent.js.map +1 -0
- package/lib/common/image-context-variable.d.ts +29 -0
- package/lib/common/image-context-variable.d.ts.map +1 -0
- package/lib/common/image-context-variable.js +114 -0
- package/lib/common/image-context-variable.js.map +1 -0
- package/lib/common/index.d.ts +13 -0
- package/lib/common/index.d.ts.map +1 -0
- package/lib/common/index.js +31 -0
- package/lib/common/index.js.map +1 -0
- package/lib/common/parse-contents-with-incomplete-parts.spec.d.ts +2 -0
- package/lib/common/parse-contents-with-incomplete-parts.spec.d.ts.map +1 -0
- package/lib/common/parse-contents-with-incomplete-parts.spec.js +103 -0
- package/lib/common/parse-contents-with-incomplete-parts.spec.js.map +1 -0
- package/lib/common/parse-contents.d.ts +12 -0
- package/lib/common/parse-contents.d.ts.map +1 -0
- package/lib/common/parse-contents.js +107 -0
- package/lib/common/parse-contents.js.map +1 -0
- package/lib/common/parse-contents.spec.d.ts +10 -0
- package/lib/common/parse-contents.spec.d.ts.map +1 -0
- package/lib/common/parse-contents.spec.js +146 -0
- package/lib/common/parse-contents.spec.js.map +1 -0
- package/lib/common/parsed-chat-request.d.ts +66 -0
- package/lib/common/parsed-chat-request.d.ts.map +1 -0
- package/lib/common/parsed-chat-request.js +83 -0
- package/lib/common/parsed-chat-request.js.map +1 -0
- package/lib/common/response-content-matcher.d.ts +69 -0
- package/lib/common/response-content-matcher.d.ts.map +1 -0
- package/lib/common/response-content-matcher.js +97 -0
- package/lib/common/response-content-matcher.js.map +1 -0
- package/lib/node/ai-chat-backend-module.d.ts +4 -0
- package/lib/node/ai-chat-backend-module.d.ts.map +1 -0
- package/lib/node/ai-chat-backend-module.js +26 -0
- package/lib/node/ai-chat-backend-module.js.map +1 -0
- package/package.json +9 -9
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ToolProvider, ToolRequest } from '@theia/ai-core';
|
|
2
|
+
import { ChatAgentService, ChatService } from '../common';
|
|
3
|
+
export declare const AGENT_DELEGATION_FUNCTION_ID = "delegateToAgent";
|
|
4
|
+
export declare class AgentDelegationTool implements ToolProvider {
|
|
5
|
+
static ID: string;
|
|
6
|
+
protected readonly getChatAgentService: () => ChatAgentService;
|
|
7
|
+
protected readonly getChatService: () => ChatService;
|
|
8
|
+
getTool(): ToolRequest;
|
|
9
|
+
private delegateToAgent;
|
|
10
|
+
/**
|
|
11
|
+
* Sets up monitoring of the ChangeSet in the delegated session and bubbles changes to the parent session.
|
|
12
|
+
* @param delegatedSession The session created for the delegated agent
|
|
13
|
+
* @param parentModel The parent session model that should receive the bubbled changes
|
|
14
|
+
* @param agentName The name of the agent for attribution purposes
|
|
15
|
+
*/
|
|
16
|
+
private setupChangeSetBubbling;
|
|
17
|
+
/**
|
|
18
|
+
* Bubbles the ChangeSet from the delegated session to the parent session.
|
|
19
|
+
* @param delegatedSession The session from which to bubble changes
|
|
20
|
+
* @param parentModel The parent session model to receive the bubbled changes
|
|
21
|
+
* @param agentName The name of the agent for attribution purposes
|
|
22
|
+
*/
|
|
23
|
+
private bubbleChangeSet;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=agent-delegation-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-delegation-tool.d.ts","sourceRoot":"","sources":["../../src/browser/agent-delegation-tool.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EACH,gBAAgB,EAGhB,WAAW,EAMd,MAAM,WAAW,CAAC;AAGnB,eAAO,MAAM,4BAA4B,oBAAoB,CAAC;AAE9D,qBACa,mBAAoB,YAAW,YAAY;IACpD,MAAM,CAAC,EAAE,SAAgC;IAGzC,SAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;IAG/D,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,WAAW,CAAC;IAErD,OAAO,IAAI,WAAW;YA8BR,eAAe;IAqI7B;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAU9B;;;;;OAKG;IACH,OAAO,CAAC,eAAe;CAU1B"}
|
|
@@ -0,0 +1,196 @@
|
|
|
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 AgentDelegationTool_1;
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.AgentDelegationTool = exports.AGENT_DELEGATION_FUNCTION_ID = void 0;
|
|
20
|
+
const tslib_1 = require("tslib");
|
|
21
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
+
const common_1 = require("../common");
|
|
23
|
+
const delegation_response_content_1 = require("./delegation-response-content");
|
|
24
|
+
exports.AGENT_DELEGATION_FUNCTION_ID = 'delegateToAgent';
|
|
25
|
+
let AgentDelegationTool = AgentDelegationTool_1 = class AgentDelegationTool {
|
|
26
|
+
getTool() {
|
|
27
|
+
return {
|
|
28
|
+
id: AgentDelegationTool_1.ID,
|
|
29
|
+
name: AgentDelegationTool_1.ID,
|
|
30
|
+
description: 'Delegate a task or question to a specific AI agent. IMPORTANT: When you delegate a task or question to a specific AI agent using this tool, ' +
|
|
31
|
+
'remember that each sub-agent operates solely within its specialized capabilities and tools and does not have access to previous conversation context ' +
|
|
32
|
+
' or external systems. Therefore, it is crucial to provide all necessary context and detailed information directly within your request to ensure accurate ' +
|
|
33
|
+
'and effective task completion.',
|
|
34
|
+
parameters: {
|
|
35
|
+
type: 'object',
|
|
36
|
+
properties: {
|
|
37
|
+
agentId: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
description: 'The ID of the AI agent to delegate the task to.',
|
|
40
|
+
},
|
|
41
|
+
prompt: {
|
|
42
|
+
type: 'string',
|
|
43
|
+
description: 'The task, question, or prompt to pass to the specified agent.',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
required: ['agentId', 'prompt'],
|
|
47
|
+
},
|
|
48
|
+
handler: (arg_string, ctx) => this.delegateToAgent(arg_string, ctx),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
async delegateToAgent(arg_string, ctx) {
|
|
52
|
+
var _a, _b, _c;
|
|
53
|
+
if (ctx.response.cancellationToken.isCancellationRequested) {
|
|
54
|
+
return 'Operation cancelled by user';
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const args = JSON.parse(arg_string);
|
|
58
|
+
const { agentId, prompt } = args;
|
|
59
|
+
if (!agentId || !prompt) {
|
|
60
|
+
const errorMsg = 'Both agentId and prompt parameters are required.';
|
|
61
|
+
console.error(errorMsg, { agentId, prompt });
|
|
62
|
+
return errorMsg;
|
|
63
|
+
}
|
|
64
|
+
// Check if the specified agent exists
|
|
65
|
+
const agent = this.getChatAgentService().getAgent(agentId);
|
|
66
|
+
if (!agent) {
|
|
67
|
+
const availableAgents = this.getChatAgentService()
|
|
68
|
+
.getAgents()
|
|
69
|
+
.map(a => a.id);
|
|
70
|
+
const errorMsg = `Agent '${agentId}' not found or not enabled. Available agents: ${availableAgents.join(', ')}`;
|
|
71
|
+
console.error(errorMsg);
|
|
72
|
+
return errorMsg;
|
|
73
|
+
}
|
|
74
|
+
let newSession;
|
|
75
|
+
try {
|
|
76
|
+
// FIXME: this creates a new conversation visible in the UI (Panel), which we don't want
|
|
77
|
+
// It is not possible to start a session without specifying a location (default=Panel)
|
|
78
|
+
const chatService = this.getChatService();
|
|
79
|
+
// Store the current active session to restore it after delegation
|
|
80
|
+
const currentActiveSession = chatService.getActiveSession();
|
|
81
|
+
newSession = chatService.createSession(undefined, { focus: false }, agent);
|
|
82
|
+
// Immediately restore the original active session to avoid confusing the user
|
|
83
|
+
if (currentActiveSession) {
|
|
84
|
+
chatService.setActiveSession(currentActiveSession.id, { focus: false });
|
|
85
|
+
}
|
|
86
|
+
// Setup ChangeSet bubbling from delegated session to parent session
|
|
87
|
+
this.setupChangeSetBubbling(newSession, ctx.session);
|
|
88
|
+
}
|
|
89
|
+
catch (sessionError) {
|
|
90
|
+
const errorMsg = `Failed to create chat session for agent '${agentId}': ${sessionError instanceof Error ? sessionError.message : sessionError}`;
|
|
91
|
+
console.error(errorMsg, sessionError);
|
|
92
|
+
return errorMsg;
|
|
93
|
+
}
|
|
94
|
+
// Send the request
|
|
95
|
+
const chatRequest = {
|
|
96
|
+
text: prompt,
|
|
97
|
+
};
|
|
98
|
+
let response;
|
|
99
|
+
try {
|
|
100
|
+
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) {
|
|
101
|
+
return 'Operation cancelled by user';
|
|
102
|
+
}
|
|
103
|
+
const chatService = this.getChatService();
|
|
104
|
+
response = await chatService.sendRequest(newSession.id, chatRequest);
|
|
105
|
+
if ((_c = ctx === null || ctx === void 0 ? void 0 : ctx.response) === null || _c === void 0 ? void 0 : _c.cancellationToken) {
|
|
106
|
+
ctx.response.cancellationToken.onCancellationRequested(async () => {
|
|
107
|
+
if (response) {
|
|
108
|
+
(await (response === null || response === void 0 ? void 0 : response.requestCompleted)).cancel();
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch (sendError) {
|
|
114
|
+
const errorMsg = `Failed to send request to agent '${agentId}': ${sendError instanceof Error ? sendError.message : sendError}`;
|
|
115
|
+
console.error(errorMsg, sendError);
|
|
116
|
+
return errorMsg;
|
|
117
|
+
}
|
|
118
|
+
if (response) {
|
|
119
|
+
// Add the response content immediately to enable streaming
|
|
120
|
+
// The renderer will handle the streaming updates
|
|
121
|
+
ctx.response.response.addContent(new delegation_response_content_1.DelegationResponseContent(agent.name, prompt, response));
|
|
122
|
+
try {
|
|
123
|
+
// Wait for completion to return the final result as tool output
|
|
124
|
+
const result = await response.responseCompleted;
|
|
125
|
+
const stringResult = result.response.asString();
|
|
126
|
+
// Clean up the session after completion (no need to await)
|
|
127
|
+
const chatService = this.getChatService();
|
|
128
|
+
chatService.deleteSession(newSession.id).catch(error => {
|
|
129
|
+
console.error('Failed to delete delegated session', error);
|
|
130
|
+
});
|
|
131
|
+
// Return the raw text to the top-level Agent, as a tool result
|
|
132
|
+
return stringResult;
|
|
133
|
+
}
|
|
134
|
+
catch (completionError) {
|
|
135
|
+
if (completionError.message &&
|
|
136
|
+
completionError.message.includes('cancelled')) {
|
|
137
|
+
return 'Operation cancelled by user';
|
|
138
|
+
}
|
|
139
|
+
const errorMsg = `Failed to complete response from agent '${agentId}': ${completionError instanceof Error ? completionError.message : completionError}`;
|
|
140
|
+
console.error(errorMsg, completionError);
|
|
141
|
+
return errorMsg;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
const errorMsg = `Delegation to agent '${agentId}' has failed: no response returned.`;
|
|
146
|
+
console.error(errorMsg);
|
|
147
|
+
return errorMsg;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
console.error('Failed to delegate to agent', error);
|
|
152
|
+
return JSON.stringify({
|
|
153
|
+
error: `Failed to parse arguments or delegate to agent: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Sets up monitoring of the ChangeSet in the delegated session and bubbles changes to the parent session.
|
|
159
|
+
* @param delegatedSession The session created for the delegated agent
|
|
160
|
+
* @param parentModel The parent session model that should receive the bubbled changes
|
|
161
|
+
* @param agentName The name of the agent for attribution purposes
|
|
162
|
+
*/
|
|
163
|
+
setupChangeSetBubbling(delegatedSession, parentModel) {
|
|
164
|
+
// Monitor ChangeSet for bubbling
|
|
165
|
+
delegatedSession.model.changeSet.onDidChange(_event => {
|
|
166
|
+
this.bubbleChangeSet(delegatedSession, parentModel);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Bubbles the ChangeSet from the delegated session to the parent session.
|
|
171
|
+
* @param delegatedSession The session from which to bubble changes
|
|
172
|
+
* @param parentModel The parent session model to receive the bubbled changes
|
|
173
|
+
* @param agentName The name of the agent for attribution purposes
|
|
174
|
+
*/
|
|
175
|
+
bubbleChangeSet(delegatedSession, parentModel) {
|
|
176
|
+
const delegatedElements = delegatedSession.model.changeSet.getElements();
|
|
177
|
+
if (delegatedElements.length > 0) {
|
|
178
|
+
parentModel.changeSet.setTitle(delegatedSession.model.changeSet.title);
|
|
179
|
+
parentModel.changeSet.addElements(...delegatedElements);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
exports.AgentDelegationTool = AgentDelegationTool;
|
|
184
|
+
AgentDelegationTool.ID = exports.AGENT_DELEGATION_FUNCTION_ID;
|
|
185
|
+
tslib_1.__decorate([
|
|
186
|
+
(0, inversify_1.inject)(common_1.ChatAgentServiceFactory),
|
|
187
|
+
tslib_1.__metadata("design:type", Function)
|
|
188
|
+
], AgentDelegationTool.prototype, "getChatAgentService", void 0);
|
|
189
|
+
tslib_1.__decorate([
|
|
190
|
+
(0, inversify_1.inject)(common_1.ChatServiceFactory),
|
|
191
|
+
tslib_1.__metadata("design:type", Function)
|
|
192
|
+
], AgentDelegationTool.prototype, "getChatService", void 0);
|
|
193
|
+
exports.AgentDelegationTool = AgentDelegationTool = AgentDelegationTool_1 = tslib_1.__decorate([
|
|
194
|
+
(0, inversify_1.injectable)()
|
|
195
|
+
], AgentDelegationTool);
|
|
196
|
+
//# sourceMappingURL=agent-delegation-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-delegation-tool.js","sourceRoot":"","sources":["../../src/browser/agent-delegation-tool.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,sCAUmB;AACnB,+EAA0E;AAE7D,QAAA,4BAA4B,GAAG,iBAAiB,CAAC;AAGvD,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAS5B,OAAO;QACH,OAAO;YACH,EAAE,EAAE,qBAAmB,CAAC,EAAE;YAC1B,IAAI,EAAE,qBAAmB,CAAC,EAAE;YAC5B,WAAW,EACP,8IAA8I;gBAC9I,uJAAuJ;gBACvJ,2JAA2J;gBAC3J,gCAAgC;YACpC,UAAU,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACR,OAAO,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,WAAW,EACP,iDAAiD;qBACxD;oBACD,MAAM,EAAE;wBACJ,IAAI,EAAE,QAAQ;wBACd,WAAW,EACP,+DAA+D;qBACtE;iBACJ;gBACD,QAAQ,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;aAClC;YACD,OAAO,EAAE,CAAC,UAAkB,EAAE,GAA4B,EAAE,EAAE,CAC1D,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,GAAG,CAAC;SAC5C,CAAC;IACN,CA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,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACvE,WAAW,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,iBAAiB,CAAC,CAAC;QAC5D,CAAC;IACL,CAAC;;AA3MQ,kDAAmB;AACrB,sBAAE,GAAG,oCAA4B,AAA/B,CAAgC;AAGtB;IADlB,IAAA,kBAAM,EAAC,gCAAuB,CAAC;;gEAC+B;AAG5C;IADlB,IAAA,kBAAM,EAAC,2BAAkB,CAAC;;2DAC0B;8BAP5C,mBAAmB;IAD/B,IAAA,sBAAU,GAAE;GACA,mBAAmB,CA4M/B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AIVariableService } from '@theia/ai-core';
|
|
2
|
+
import { Command, CommandContribution, CommandRegistry } from '@theia/core';
|
|
3
|
+
import { ChatService } from '../common';
|
|
4
|
+
export declare const VARIABLE_ADD_CONTEXT_COMMAND: Command;
|
|
5
|
+
export declare class AIChatFrontendContribution implements CommandContribution {
|
|
6
|
+
protected readonly variableService: AIVariableService;
|
|
7
|
+
protected readonly chatService: ChatService;
|
|
8
|
+
registerCommands(registry: CommandRegistry): void;
|
|
9
|
+
addContextVariable(variableName: string, arg: string | undefined): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=ai-chat-frontend-contribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-chat-frontend-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/ai-chat-frontend-contribution.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAqB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,eAAO,MAAM,4BAA4B,EAAE,OAGF,CAAC;AAE1C,qBACa,0BAA2B,YAAW,mBAAmB;IAElE,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAC;IAEtD,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAE5C,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAO3C,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAQzF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2025 EclipseSource GmbH and others.
|
|
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.AIChatFrontendContribution = exports.VARIABLE_ADD_CONTEXT_COMMAND = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const ai_core_1 = require("@theia/ai-core");
|
|
21
|
+
const core_1 = require("@theia/core");
|
|
22
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
23
|
+
const common_1 = require("../common");
|
|
24
|
+
exports.VARIABLE_ADD_CONTEXT_COMMAND = core_1.Command.toLocalizedCommand({
|
|
25
|
+
id: 'add-context-variable',
|
|
26
|
+
label: 'Add context variable'
|
|
27
|
+
}, 'theia/ai/chat-ui/addContextVariable');
|
|
28
|
+
let AIChatFrontendContribution = class AIChatFrontendContribution {
|
|
29
|
+
registerCommands(registry) {
|
|
30
|
+
registry.registerCommand(exports.VARIABLE_ADD_CONTEXT_COMMAND, {
|
|
31
|
+
execute: (...args) => args.length > 1 && this.addContextVariable(args[0], args[1]),
|
|
32
|
+
isVisible: () => false,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async addContextVariable(variableName, arg) {
|
|
36
|
+
var _a;
|
|
37
|
+
const variable = this.variableService.getVariable(variableName);
|
|
38
|
+
if (!variable || !ai_core_1.AIContextVariable.is(variable)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
(_a = this.chatService.getActiveSession()) === null || _a === void 0 ? void 0 : _a.model.context.addVariables({ variable, arg });
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.AIChatFrontendContribution = AIChatFrontendContribution;
|
|
45
|
+
tslib_1.__decorate([
|
|
46
|
+
(0, inversify_1.inject)(ai_core_1.AIVariableService),
|
|
47
|
+
tslib_1.__metadata("design:type", Object)
|
|
48
|
+
], AIChatFrontendContribution.prototype, "variableService", void 0);
|
|
49
|
+
tslib_1.__decorate([
|
|
50
|
+
(0, inversify_1.inject)(common_1.ChatService),
|
|
51
|
+
tslib_1.__metadata("design:type", Object)
|
|
52
|
+
], AIChatFrontendContribution.prototype, "chatService", void 0);
|
|
53
|
+
exports.AIChatFrontendContribution = AIChatFrontendContribution = tslib_1.__decorate([
|
|
54
|
+
(0, inversify_1.injectable)()
|
|
55
|
+
], AIChatFrontendContribution);
|
|
56
|
+
//# sourceMappingURL=ai-chat-frontend-contribution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-chat-frontend-contribution.js","sourceRoot":"","sources":["../../src/browser/ai-chat-frontend-contribution.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AAC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A,kBAAM,EAAC,oBAAW,CAAC;;+DACwB;qCAJnC,0BAA0B;IADtC,IAAA,sBAAU,GAAE;GACA,0BAA0B,CAqBtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-chat-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/ai-chat-frontend-module.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAyD/D,wBAgHG"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const common_1 = require("@theia/ai-core/lib/common");
|
|
19
|
+
const core_1 = require("@theia/core");
|
|
20
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
21
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
+
const common_2 = require("../common");
|
|
23
|
+
const chat_agents_variable_contribution_1 = require("../common/chat-agents-variable-contribution");
|
|
24
|
+
const custom_chat_agent_1 = require("../common/custom-chat-agent");
|
|
25
|
+
const response_content_matcher_1 = require("../common/response-content-matcher");
|
|
26
|
+
const ai_chat_preferences_1 = require("../common/ai-chat-preferences");
|
|
27
|
+
const change_set_file_element_1 = require("./change-set-file-element");
|
|
28
|
+
const custom_agent_frontend_application_contribution_1 = require("./custom-agent-frontend-application-contribution");
|
|
29
|
+
const frontend_chat_service_1 = require("./frontend-chat-service");
|
|
30
|
+
const custom_agent_factory_1 = require("./custom-agent-factory");
|
|
31
|
+
const chat_tool_request_service_1 = require("../common/chat-tool-request-service");
|
|
32
|
+
const chat_tool_request_service_2 = require("./chat-tool-request-service");
|
|
33
|
+
const change_set_file_service_1 = require("./change-set-file-service");
|
|
34
|
+
const context_variable_label_provider_1 = require("./context-variable-label-provider");
|
|
35
|
+
const context_file_variable_label_provider_1 = require("./context-file-variable-label-provider");
|
|
36
|
+
const file_chat_variable_contribution_1 = require("./file-chat-variable-contribution");
|
|
37
|
+
const context_summary_variable_1 = require("../common/context-summary-variable");
|
|
38
|
+
const context_details_variable_1 = require("../common/context-details-variable");
|
|
39
|
+
const change_set_variable_1 = require("./change-set-variable");
|
|
40
|
+
const chat_session_naming_service_1 = require("../common/chat-session-naming-service");
|
|
41
|
+
const change_set_decorator_service_1 = require("./change-set-decorator-service");
|
|
42
|
+
const chat_session_summary_agent_1 = require("../common/chat-session-summary-agent");
|
|
43
|
+
const task_context_variable_contribution_1 = require("./task-context-variable-contribution");
|
|
44
|
+
const task_context_variable_label_provider_1 = require("./task-context-variable-label-provider");
|
|
45
|
+
const task_context_service_1 = require("./task-context-service");
|
|
46
|
+
const task_context_storage_service_1 = require("./task-context-storage-service");
|
|
47
|
+
const ai_chat_frontend_contribution_1 = require("./ai-chat-frontend-contribution");
|
|
48
|
+
const image_context_variable_contribution_1 = require("./image-context-variable-contribution");
|
|
49
|
+
const agent_delegation_tool_1 = require("./agent-delegation-tool");
|
|
50
|
+
const chat_tool_preference_bindings_1 = require("./chat-tool-preference-bindings");
|
|
51
|
+
const chat_tool_preferences_1 = require("../common/chat-tool-preferences");
|
|
52
|
+
const chat_session_store_1 = require("../common/chat-session-store");
|
|
53
|
+
const chat_session_store_impl_1 = require("./chat-session-store-impl");
|
|
54
|
+
const chat_content_deserializer_1 = require("../common/chat-content-deserializer");
|
|
55
|
+
const change_set_element_deserializer_1 = require("../common/change-set-element-deserializer");
|
|
56
|
+
const change_set_file_element_deserializer_1 = require("./change-set-file-element-deserializer");
|
|
57
|
+
exports.default = new inversify_1.ContainerModule(bind => {
|
|
58
|
+
(0, core_1.bindContributionProvider)(bind, common_2.ChatAgent);
|
|
59
|
+
bind(chat_content_deserializer_1.ChatContentDeserializerRegistryImpl).toSelf().inSingletonScope();
|
|
60
|
+
bind(chat_content_deserializer_1.ChatContentDeserializerRegistry).toService(chat_content_deserializer_1.ChatContentDeserializerRegistryImpl);
|
|
61
|
+
(0, core_1.bindContributionProvider)(bind, chat_content_deserializer_1.ChatContentDeserializerContribution);
|
|
62
|
+
bind(chat_content_deserializer_1.ChatContentDeserializerContribution).to(chat_content_deserializer_1.DefaultChatContentDeserializerContribution).inSingletonScope();
|
|
63
|
+
bind(change_set_element_deserializer_1.ChangeSetElementDeserializerRegistryImpl).toSelf().inSingletonScope();
|
|
64
|
+
bind(change_set_element_deserializer_1.ChangeSetElementDeserializerRegistry).toService(change_set_element_deserializer_1.ChangeSetElementDeserializerRegistryImpl);
|
|
65
|
+
(0, core_1.bindContributionProvider)(bind, change_set_element_deserializer_1.ChangeSetElementDeserializerContribution);
|
|
66
|
+
bind(change_set_element_deserializer_1.ChangeSetElementDeserializerContribution).to(change_set_file_element_deserializer_1.ChangeSetFileElementDeserializerContribution).inSingletonScope();
|
|
67
|
+
bind(chat_session_store_impl_1.ChatSessionStoreImpl).toSelf().inSingletonScope();
|
|
68
|
+
bind(chat_session_store_1.ChatSessionStore).toService(chat_session_store_impl_1.ChatSessionStoreImpl);
|
|
69
|
+
bind(chat_tool_request_service_2.FrontendChatToolRequestService).toSelf().inSingletonScope();
|
|
70
|
+
bind(chat_tool_request_service_1.ChatToolRequestService).toService(chat_tool_request_service_2.FrontendChatToolRequestService);
|
|
71
|
+
bind(common_2.ChatAgentServiceImpl).toSelf().inSingletonScope();
|
|
72
|
+
bind(common_2.ChatAgentService).toService(common_2.ChatAgentServiceImpl);
|
|
73
|
+
bind(common_2.PinChatAgent).toConstantValue(true);
|
|
74
|
+
bind(chat_session_naming_service_1.ChatSessionNamingService).toSelf().inSingletonScope();
|
|
75
|
+
bind(chat_session_naming_service_1.ChatSessionNamingAgent).toSelf().inSingletonScope();
|
|
76
|
+
bind(common_1.Agent).toService(chat_session_naming_service_1.ChatSessionNamingAgent);
|
|
77
|
+
(0, core_1.bindContributionProvider)(bind, response_content_matcher_1.ResponseContentMatcherProvider);
|
|
78
|
+
bind(response_content_matcher_1.DefaultResponseContentMatcherProvider).toSelf().inSingletonScope();
|
|
79
|
+
bind(response_content_matcher_1.ResponseContentMatcherProvider).toService(response_content_matcher_1.DefaultResponseContentMatcherProvider);
|
|
80
|
+
bind(response_content_matcher_1.DefaultResponseContentFactory).toSelf().inSingletonScope();
|
|
81
|
+
bind(common_1.AIVariableContribution).to(chat_agents_variable_contribution_1.ChatAgentsVariableContribution).inSingletonScope();
|
|
82
|
+
bind(common_2.ChatRequestParserImpl).toSelf().inSingletonScope();
|
|
83
|
+
bind(common_2.ChatRequestParser).toService(common_2.ChatRequestParserImpl);
|
|
84
|
+
bind(frontend_chat_service_1.FrontendChatServiceImpl).toSelf().inSingletonScope();
|
|
85
|
+
bind(common_2.ChatService).toService(frontend_chat_service_1.FrontendChatServiceImpl);
|
|
86
|
+
bind(common_2.ChatServiceFactory).toDynamicValue(ctx => () => ctx.container.get(common_2.ChatService));
|
|
87
|
+
bind(common_2.ChatAgentServiceFactory).toDynamicValue(ctx => () => ctx.container.get(common_2.ChatAgentService));
|
|
88
|
+
bind(core_1.PreferenceContribution).toConstantValue({ schema: ai_chat_preferences_1.aiChatPreferences });
|
|
89
|
+
// Tool confirmation preferences
|
|
90
|
+
(0, chat_tool_preferences_1.bindChatToolPreferences)(bind);
|
|
91
|
+
bind(chat_tool_preference_bindings_1.ToolConfirmationManager).toSelf().inSingletonScope();
|
|
92
|
+
bind(custom_chat_agent_1.CustomChatAgent).toSelf();
|
|
93
|
+
bind(custom_agent_factory_1.CustomAgentFactory).toFactory(ctx => (id, name, description, prompt, defaultLLM) => {
|
|
94
|
+
const agent = ctx.container.get(custom_chat_agent_1.CustomChatAgent);
|
|
95
|
+
agent.id = id;
|
|
96
|
+
agent.name = name;
|
|
97
|
+
agent.description = description;
|
|
98
|
+
agent.prompt = prompt;
|
|
99
|
+
agent.languageModelRequirements = [{
|
|
100
|
+
purpose: 'chat',
|
|
101
|
+
identifier: defaultLLM,
|
|
102
|
+
}];
|
|
103
|
+
ctx.container.get(common_2.ChatAgentService).registerChatAgent(agent);
|
|
104
|
+
ctx.container.get(common_1.AgentService).registerAgent(agent);
|
|
105
|
+
return agent;
|
|
106
|
+
});
|
|
107
|
+
bind(browser_1.FrontendApplicationContribution).to(custom_agent_frontend_application_contribution_1.AICustomAgentsFrontendApplicationContribution).inSingletonScope();
|
|
108
|
+
bind(context_variable_label_provider_1.ContextVariableLabelProvider).toSelf().inSingletonScope();
|
|
109
|
+
bind(browser_1.LabelProviderContribution).toService(context_variable_label_provider_1.ContextVariableLabelProvider);
|
|
110
|
+
bind(context_file_variable_label_provider_1.ContextFileVariableLabelProvider).toSelf().inSingletonScope();
|
|
111
|
+
bind(browser_1.LabelProviderContribution).toService(context_file_variable_label_provider_1.ContextFileVariableLabelProvider);
|
|
112
|
+
bind(change_set_file_service_1.ChangeSetFileService).toSelf().inSingletonScope();
|
|
113
|
+
bind(change_set_file_element_1.ChangeSetFileElementFactory).toFactory(ctx => (args) => {
|
|
114
|
+
const container = ctx.container.createChild();
|
|
115
|
+
container.bind(change_set_file_element_1.ChangeSetElementArgs).toConstantValue(args);
|
|
116
|
+
container.bind(change_set_file_element_1.ChangeSetFileElement).toSelf().inSingletonScope();
|
|
117
|
+
return container.get(change_set_file_element_1.ChangeSetFileElement);
|
|
118
|
+
});
|
|
119
|
+
bind(change_set_decorator_service_1.ChangeSetDecoratorService).toSelf().inSingletonScope();
|
|
120
|
+
bind(browser_1.FrontendApplicationContribution).toService(change_set_decorator_service_1.ChangeSetDecoratorService);
|
|
121
|
+
(0, core_1.bindContributionProvider)(bind, change_set_decorator_service_1.ChangeSetDecorator);
|
|
122
|
+
bind(common_2.ToolCallChatResponseContentFactory).toSelf().inSingletonScope();
|
|
123
|
+
bind(common_1.AIVariableContribution).to(file_chat_variable_contribution_1.FileChatVariableContribution).inSingletonScope();
|
|
124
|
+
bind(common_1.AIVariableContribution).to(context_summary_variable_1.ContextSummaryVariableContribution).inSingletonScope();
|
|
125
|
+
bind(common_1.AIVariableContribution).to(context_details_variable_1.ContextDetailsVariableContribution).inSingletonScope();
|
|
126
|
+
bind(common_1.AIVariableContribution).to(change_set_variable_1.ChangeSetVariableContribution).inSingletonScope();
|
|
127
|
+
bind(chat_session_summary_agent_1.ChatSessionSummaryAgent).toSelf().inSingletonScope();
|
|
128
|
+
bind(common_1.Agent).toService(chat_session_summary_agent_1.ChatSessionSummaryAgent);
|
|
129
|
+
bind(task_context_variable_contribution_1.TaskContextVariableContribution).toSelf().inSingletonScope();
|
|
130
|
+
bind(common_1.AIVariableContribution).toService(task_context_variable_contribution_1.TaskContextVariableContribution);
|
|
131
|
+
bind(task_context_variable_label_provider_1.TaskContextVariableLabelProvider).toSelf().inSingletonScope();
|
|
132
|
+
bind(browser_1.LabelProviderContribution).toService(task_context_variable_label_provider_1.TaskContextVariableLabelProvider);
|
|
133
|
+
bind(image_context_variable_contribution_1.ImageContextVariableContribution).toSelf().inSingletonScope();
|
|
134
|
+
bind(common_1.AIVariableContribution).toService(image_context_variable_contribution_1.ImageContextVariableContribution);
|
|
135
|
+
bind(browser_1.LabelProviderContribution).toService(image_context_variable_contribution_1.ImageContextVariableContribution);
|
|
136
|
+
bind(task_context_service_1.TaskContextService).toSelf().inSingletonScope();
|
|
137
|
+
bind(task_context_storage_service_1.InMemoryTaskContextStorage).toSelf().inSingletonScope();
|
|
138
|
+
bind(task_context_service_1.TaskContextStorageService).toService(task_context_storage_service_1.InMemoryTaskContextStorage);
|
|
139
|
+
bind(ai_chat_frontend_contribution_1.AIChatFrontendContribution).toSelf().inSingletonScope();
|
|
140
|
+
bind(core_1.CommandContribution).toService(ai_chat_frontend_contribution_1.AIChatFrontendContribution);
|
|
141
|
+
(0, common_1.bindToolProvider)(agent_delegation_tool_1.AgentDelegationTool, bind);
|
|
142
|
+
});
|
|
143
|
+
//# sourceMappingURL=ai-chat-frontend-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-chat-frontend-module.js","sourceRoot":"","sources":["../../src/browser/ai-chat-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,sDAA0G;AAC1G,sCAAoG;AACpG,qDAAqG;AACrG,4DAA+D;AAC/D,sCAWmB;AACnB,mGAA6F;AAC7F,mEAA8D;AAC9D,iFAA0J;AAC1J,uEAAkE;AAClE,uEAAoH;AACpH,qHAAiH;AACjH,mEAAkE;AAClE,iEAA4D;AAC5D,mFAA6E;AAC7E,2EAA6E;AAC7E,uEAAiE;AACjE,uFAAiF;AACjF,iGAA0F;AAC1F,uFAAiF;AACjF,iFAAwF;AACxF,iFAAwF;AACxF,+DAAsE;AACtE,uFAAyG;AACzG,iFAA+F;AAC/F,qFAA+E;AAC/E,6FAAuF;AACvF,iGAA0F;AAC1F,iEAAuF;AACvF,iFAA4E;AAC5E,mFAA6E;AAC7E,+FAAyF;AACzF,mEAA8D;AAC9D,mFAA0E;AAC1E,2EAA0E;AAC1E,qEAAgE;AAChE,uEAAiE;AACjE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C,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import { ContributionProvider, Emitter, type Event } from '@theia/core';
|
|
3
|
+
import { type FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
4
|
+
import type { ChangeSetDecoration, ChangeSetElement } from '../common';
|
|
5
|
+
/**
|
|
6
|
+
* A decorator for a change set element.
|
|
7
|
+
* It allows to add additional information to the element, such as icons.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ChangeSetDecorator: unique symbol;
|
|
10
|
+
export interface ChangeSetDecorator {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly onDidChangeDecorations: Event<void>;
|
|
13
|
+
decorate(element: ChangeSetElement): ChangeSetDecoration | undefined;
|
|
14
|
+
}
|
|
15
|
+
export declare class ChangeSetDecoratorService implements FrontendApplicationContribution {
|
|
16
|
+
protected readonly onDidChangeDecorationsEmitter: Emitter<void>;
|
|
17
|
+
readonly onDidChangeDecorations: Event<void>;
|
|
18
|
+
protected readonly contributions: ContributionProvider<ChangeSetDecorator>;
|
|
19
|
+
initialize(): void;
|
|
20
|
+
protected readonly fireDidChangeDecorations: import("lodash").DebouncedFunc<() => void>;
|
|
21
|
+
getDecorations(element: ChangeSetElement): ChangeSetDecoration[];
|
|
22
|
+
getAdditionalInfoSuffixIcon(element: ChangeSetElement): string[] | undefined;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=change-set-decorator-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"change-set-decorator-service.d.ts","sourceRoot":"","sources":["../../src/browser/change-set-decorator-service.ts"],"names":[],"mappings":";AAgBA,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,KAAK,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAG/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,eAA+B,CAAC;AAC/D,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,QAAQ,CAAC,sBAAsB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAE7C,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,GAAG,SAAS,CAAC;CACxE;AAED,qBACa,yBAA0B,YAAW,+BAA+B;IAE7E,SAAS,CAAC,QAAQ,CAAC,6BAA6B,gBAAuB;IACvE,QAAQ,CAAC,sBAAsB,cAA4C;IAG3E,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;IAE3E,UAAU,IAAI,IAAI;IAIlB,SAAS,CAAC,QAAQ,CAAC,wBAAwB,6CAEnC;IAER,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,EAAE;IAehE,2BAA2B,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,EAAE,GAAG,SAAS;CAI/E"}
|
|
@@ -0,0 +1,66 @@
|
|
|
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.ChangeSetDecoratorService = exports.ChangeSetDecorator = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const core_1 = require("@theia/core");
|
|
21
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
+
const debounce = require("@theia/core/shared/lodash.debounce");
|
|
23
|
+
/**
|
|
24
|
+
* A decorator for a change set element.
|
|
25
|
+
* It allows to add additional information to the element, such as icons.
|
|
26
|
+
*/
|
|
27
|
+
exports.ChangeSetDecorator = Symbol('ChangeSetDecorator');
|
|
28
|
+
let ChangeSetDecoratorService = class ChangeSetDecoratorService {
|
|
29
|
+
constructor() {
|
|
30
|
+
this.onDidChangeDecorationsEmitter = new core_1.Emitter();
|
|
31
|
+
this.onDidChangeDecorations = this.onDidChangeDecorationsEmitter.event;
|
|
32
|
+
this.fireDidChangeDecorations = debounce(() => {
|
|
33
|
+
this.onDidChangeDecorationsEmitter.fire(undefined);
|
|
34
|
+
}, 150);
|
|
35
|
+
}
|
|
36
|
+
initialize() {
|
|
37
|
+
this.contributions.getContributions().map(decorator => decorator.onDidChangeDecorations(this.fireDidChangeDecorations));
|
|
38
|
+
}
|
|
39
|
+
getDecorations(element) {
|
|
40
|
+
const decorators = this.contributions.getContributions();
|
|
41
|
+
const decorations = [];
|
|
42
|
+
for (const decorator of decorators) {
|
|
43
|
+
const decoration = decorator.decorate(element);
|
|
44
|
+
if (decoration) {
|
|
45
|
+
decorations.push(decoration);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
decorations.sort((a, b) => { var _a, _b; return ((_a = b.priority) !== null && _a !== void 0 ? _a : 0) - ((_b = a.priority) !== null && _b !== void 0 ? _b : 0); });
|
|
49
|
+
return decorations;
|
|
50
|
+
}
|
|
51
|
+
getAdditionalInfoSuffixIcon(element) {
|
|
52
|
+
var _a;
|
|
53
|
+
const decorations = this.getDecorations(element);
|
|
54
|
+
return (_a = decorations.find(d => d.additionalInfoSuffixIcon)) === null || _a === void 0 ? void 0 : _a.additionalInfoSuffixIcon;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.ChangeSetDecoratorService = ChangeSetDecoratorService;
|
|
58
|
+
tslib_1.__decorate([
|
|
59
|
+
(0, inversify_1.inject)(core_1.ContributionProvider),
|
|
60
|
+
(0, inversify_1.named)(exports.ChangeSetDecorator),
|
|
61
|
+
tslib_1.__metadata("design:type", Object)
|
|
62
|
+
], ChangeSetDecoratorService.prototype, "contributions", void 0);
|
|
63
|
+
exports.ChangeSetDecoratorService = ChangeSetDecoratorService = tslib_1.__decorate([
|
|
64
|
+
(0, inversify_1.injectable)()
|
|
65
|
+
], ChangeSetDecoratorService);
|
|
66
|
+
//# sourceMappingURL=change-set-decorator-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"change-set-decorator-service.js","sourceRoot":"","sources":["../../src/browser/change-set-decorator-service.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,sCAAwE;AAExE,4DAAyE;AACzE,+DAAgE;AAGhE;;;GAGG;AACU,QAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAUxD,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAA/B;QAEgB,kCAA6B,GAAG,IAAI,cAAO,EAAQ,CAAC;QAC9D,2BAAsB,GAAG,IAAI,CAAC,6BAA6B,CAAC,KAAK,CAAC;QASxD,6BAAwB,GAAG,QAAQ,CAAC,GAAG,EAAE;YACxD,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,S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B,CAmCrC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChangeSetElementDeserializerContribution, ChangeSetElementDeserializerRegistry } from '../common/change-set-element-deserializer';
|
|
2
|
+
import { ChangeSetFileElementFactory } from './change-set-file-element';
|
|
3
|
+
export declare class ChangeSetFileElementDeserializerContribution implements ChangeSetElementDeserializerContribution {
|
|
4
|
+
protected readonly fileElementFactory: ChangeSetFileElementFactory;
|
|
5
|
+
registerDeserializers(registry: ChangeSetElementDeserializerRegistry): void;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=change-set-file-element-deserializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"change-set-file-element-deserializer.d.ts","sourceRoot":"","sources":["../../src/browser/change-set-file-element-deserializer.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,wCAAwC,EAAE,oCAAoC,EAAmC,MAAM,2CAA2C,CAAC;AAE5K,OAAO,EAAwB,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAE9F,qBACa,4CAA6C,YAAW,wCAAwC;IAGzG,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,2BAA2B,CAAC;IAEnE,qBAAqB,CAAC,QAAQ,EAAE,oCAAoC,GAAG,IAAI;CAgC9E"}
|