@theia/ai-chat 1.56.0 → 1.57.0-next.112
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/README.md +2 -1
- package/lib/browser/ai-chat-frontend-module.d.ts.map +1 -1
- package/lib/browser/ai-chat-frontend-module.js +14 -4
- package/lib/browser/ai-chat-frontend-module.js.map +1 -1
- package/lib/browser/change-set-file-element.d.ts +44 -0
- package/lib/browser/change-set-file-element.d.ts.map +1 -0
- package/lib/browser/change-set-file-element.js +113 -0
- package/lib/browser/change-set-file-element.js.map +1 -0
- package/lib/browser/change-set-file-resource.d.ts +13 -0
- package/lib/browser/change-set-file-resource.d.ts.map +1 -0
- package/lib/browser/change-set-file-resource.js +73 -0
- package/lib/browser/change-set-file-resource.js.map +1 -0
- package/lib/browser/change-set-file-service.d.ts +26 -0
- package/lib/browser/change-set-file-service.d.ts.map +1 -0
- package/lib/browser/change-set-file-service.js +139 -0
- package/lib/browser/change-set-file-service.js.map +1 -0
- package/lib/common/chat-agents.d.ts +4 -5
- package/lib/common/chat-agents.d.ts.map +1 -1
- package/lib/common/chat-agents.js +14 -21
- package/lib/common/chat-agents.js.map +1 -1
- package/lib/common/chat-model.d.ts +117 -7
- package/lib/common/chat-model.d.ts.map +1 -1
- package/lib/common/chat-model.js +124 -8
- package/lib/common/chat-model.js.map +1 -1
- package/lib/common/chat-service.d.ts +6 -0
- package/lib/common/chat-service.d.ts.map +1 -1
- package/lib/common/chat-service.js +12 -0
- package/lib/common/chat-service.js.map +1 -1
- package/lib/common/chat-tool-request-service.d.ts +17 -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/command-chat-agents.js +1 -1
- package/lib/common/command-chat-agents.js.map +1 -1
- package/package.json +10 -8
- package/src/browser/ai-chat-frontend-module.ts +17 -6
- package/src/browser/change-set-file-element.ts +137 -0
- package/src/browser/change-set-file-resource.ts +74 -0
- package/src/browser/change-set-file-service.ts +136 -0
- package/src/common/chat-agents.ts +12 -24
- package/src/common/chat-model.ts +236 -14
- package/src/common/chat-service.ts +17 -0
- package/src/common/chat-tool-request-service.ts +59 -0
- package/src/common/command-chat-agents.ts +1 -1
- package/lib/common/o1-chat-agent.d.ts +0 -13
- package/lib/common/o1-chat-agent.d.ts.map +0 -1
- package/lib/common/o1-chat-agent.js +0 -45
- package/lib/common/o1-chat-agent.js.map +0 -1
- package/src/common/o1-chat-agent.ts +0 -51
|
@@ -0,0 +1,59 @@
|
|
|
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 { ToolRequest } from '@theia/ai-core';
|
|
18
|
+
import { injectable } from '@theia/core/shared/inversify';
|
|
19
|
+
import { ChatRequestModelImpl } from './chat-model';
|
|
20
|
+
|
|
21
|
+
export interface ChatToolRequest extends ToolRequest {
|
|
22
|
+
handler: (
|
|
23
|
+
arg_string: string,
|
|
24
|
+
context: ChatRequestModelImpl,
|
|
25
|
+
) => Promise<unknown>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Wraps tool requests in a chat context.
|
|
30
|
+
*
|
|
31
|
+
* This service extracts tool requests from a given chat request model and wraps their
|
|
32
|
+
* handler functions to provide additional context, such as the chat request model.
|
|
33
|
+
*/
|
|
34
|
+
@injectable()
|
|
35
|
+
export class ChatToolRequestService {
|
|
36
|
+
|
|
37
|
+
getChatToolRequests(request: ChatRequestModelImpl): ChatToolRequest[] {
|
|
38
|
+
const toolRequests = request.message.toolRequests.size > 0 ? [...request.message.toolRequests.values()] : undefined;
|
|
39
|
+
if (!toolRequests) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
return this.toChatToolRequests(toolRequests, request);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
toChatToolRequests(toolRequests: ToolRequest[] | undefined, request: ChatRequestModelImpl): ChatToolRequest[] {
|
|
46
|
+
if (!toolRequests) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
return toolRequests.map(toolRequest => this.toChatToolRequest(toolRequest, request));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
protected toChatToolRequest(toolRequest: ToolRequest, request: ChatRequestModelImpl): ChatToolRequest {
|
|
53
|
+
return {
|
|
54
|
+
...toolRequest,
|
|
55
|
+
handler: async (arg_string: string) => toolRequest.handler(arg_string, request)
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|
|
@@ -315,7 +315,7 @@ export class CommandChatAgent extends AbstractTextToModelParsingChatAgent<Parsed
|
|
|
315
315
|
const theiaCommand = this.commandRegistry.getCommand(parsedCommand.commandId);
|
|
316
316
|
if (theiaCommand === undefined) {
|
|
317
317
|
console.error(`No Theia Command with id ${parsedCommand.commandId}`);
|
|
318
|
-
request.
|
|
318
|
+
request.cancel();
|
|
319
319
|
}
|
|
320
320
|
const args = parsedCommand.arguments !== undefined &&
|
|
321
321
|
parsedCommand.arguments.length > 0
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ChatAgent, AbstractStreamParsingChatAgent, SystemMessageDescription } from './chat-agents';
|
|
2
|
-
import { AgentSpecificVariables, PromptTemplate } from '@theia/ai-core';
|
|
3
|
-
export declare class O1ChatAgent extends AbstractStreamParsingChatAgent implements ChatAgent {
|
|
4
|
-
name: string;
|
|
5
|
-
description: string;
|
|
6
|
-
promptTemplates: PromptTemplate[];
|
|
7
|
-
readonly agentSpecificVariables: AgentSpecificVariables[];
|
|
8
|
-
readonly variables: string[];
|
|
9
|
-
readonly functions: string[];
|
|
10
|
-
constructor();
|
|
11
|
-
protected getSystemMessageDescription(): Promise<SystemMessageDescription | undefined>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=o1-chat-agent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"o1-chat-agent.d.ts","sourceRoot":"","sources":["../../src/common/o1-chat-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,SAAS,EACT,8BAA8B,EAC9B,wBAAwB,EAC3B,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAExE,qBACa,WAAY,SAAQ,8BAA+B,YAAW,SAAS;IAEzE,IAAI,SAAgB;IACpB,WAAW,SAAsD;IACjE,eAAe,EAAE,cAAc,EAAE,CAAM;IAC9C,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,EAAE,CAAM;IAC/D,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAM;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAM;;cAalB,2BAA2B,IAAI,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;CAI/F"}
|
|
@@ -1,45 +0,0 @@
|
|
|
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
|
-
exports.O1ChatAgent = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const chat_agents_1 = require("./chat-agents");
|
|
21
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
-
let O1ChatAgent = class O1ChatAgent extends chat_agents_1.AbstractStreamParsingChatAgent {
|
|
23
|
-
constructor() {
|
|
24
|
-
super('o1-preview', [{
|
|
25
|
-
purpose: 'chat',
|
|
26
|
-
identifier: 'openai/o1-preview',
|
|
27
|
-
}], 'chat');
|
|
28
|
-
this.name = 'O1-Preview';
|
|
29
|
-
this.description = 'An agent for interacting with ChatGPT o1-preview';
|
|
30
|
-
this.promptTemplates = [];
|
|
31
|
-
this.agentSpecificVariables = [];
|
|
32
|
-
this.variables = [];
|
|
33
|
-
this.functions = [];
|
|
34
|
-
}
|
|
35
|
-
async getSystemMessageDescription() {
|
|
36
|
-
// O1 currently does not support system prompts
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
exports.O1ChatAgent = O1ChatAgent;
|
|
41
|
-
exports.O1ChatAgent = O1ChatAgent = tslib_1.__decorate([
|
|
42
|
-
(0, inversify_1.injectable)(),
|
|
43
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
44
|
-
], O1ChatAgent);
|
|
45
|
-
//# sourceMappingURL=o1-chat-agent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"o1-chat-agent.js","sourceRoot":"","sources":["../../src/common/o1-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,+CAIuB;AAEvB,4DAA0D;AAInD,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,4CAA8B;IAS3D;QACI,KAAK,CACD,YAAY,EACZ,CAAC;gBACG,OAAO,EAAE,MAAM;gBACf,UAAU,EAAE,mBAAmB;aAClC,CAAC,EACF,MAAM,CACT,CAAC;QAfC,SAAI,GAAG,YAAY,CAAC;QACpB,gBAAW,GAAG,kDAAkD,CAAC;QACjE,oBAAe,GAAqB,EAAE,CAAC;QACrC,2BAAsB,GAA6B,EAAE,CAAC;QACtD,cAAS,GAAa,EAAE,CAAC;QACzB,cAAS,GAAa,EAAE,CAAC;IAWlC,CAAC;IAES,KAAK,CAAC,2BAA2B;QACvC,+CAA+C;QAC/C,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ,CAAA;AAxBY,kCAAW;sBAAX,WAAW;IADvB,IAAA,sBAAU,GAAE;;GACA,WAAW,CAwBvB"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2024 EclipseSource GmbH.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
ChatAgent,
|
|
19
|
-
AbstractStreamParsingChatAgent,
|
|
20
|
-
SystemMessageDescription
|
|
21
|
-
} from './chat-agents';
|
|
22
|
-
|
|
23
|
-
import { injectable } from '@theia/core/shared/inversify';
|
|
24
|
-
import { AgentSpecificVariables, PromptTemplate } from '@theia/ai-core';
|
|
25
|
-
|
|
26
|
-
@injectable()
|
|
27
|
-
export class O1ChatAgent extends AbstractStreamParsingChatAgent implements ChatAgent {
|
|
28
|
-
|
|
29
|
-
public name = 'O1-Preview';
|
|
30
|
-
public description = 'An agent for interacting with ChatGPT o1-preview';
|
|
31
|
-
public promptTemplates: PromptTemplate[] = [];
|
|
32
|
-
readonly agentSpecificVariables: AgentSpecificVariables[] = [];
|
|
33
|
-
readonly variables: string[] = [];
|
|
34
|
-
readonly functions: string[] = [];
|
|
35
|
-
|
|
36
|
-
constructor() {
|
|
37
|
-
super(
|
|
38
|
-
'o1-preview',
|
|
39
|
-
[{
|
|
40
|
-
purpose: 'chat',
|
|
41
|
-
identifier: 'openai/o1-preview',
|
|
42
|
-
}],
|
|
43
|
-
'chat'
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
protected async getSystemMessageDescription(): Promise<SystemMessageDescription | undefined> {
|
|
48
|
-
// O1 currently does not support system prompts
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
}
|