@theia/ai-editor 1.67.0-next.13 → 1.67.0-next.56
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 +1 -0
- package/package.json +10 -10
- package/lib/browser/ai-code-action-provider.d.ts +0 -18
- package/lib/browser/ai-code-action-provider.d.ts.map +0 -1
- package/lib/browser/ai-code-action-provider.js +0 -116
- package/lib/browser/ai-code-action-provider.js.map +0 -1
- package/lib/browser/ai-editor-command-contribution.d.ts +0 -30
- package/lib/browser/ai-editor-command-contribution.d.ts.map +0 -1
- package/lib/browser/ai-editor-command-contribution.js +0 -153
- package/lib/browser/ai-editor-command-contribution.js.map +0 -1
- package/lib/browser/ai-editor-context-variable.d.ts +0 -17
- package/lib/browser/ai-editor-context-variable.d.ts.map +0 -1
- package/lib/browser/ai-editor-context-variable.js +0 -167
- package/lib/browser/ai-editor-context-variable.js.map +0 -1
- package/lib/browser/ai-editor-frontend-module.d.ts +0 -5
- package/lib/browser/ai-editor-frontend-module.d.ts.map +0 -1
- package/lib/browser/ai-editor-frontend-module.js +0 -48
- package/lib/browser/ai-editor-frontend-module.js.map +0 -1
- package/lib/browser/ask-ai-input-monaco-zone-widget.d.ts +0 -25
- package/lib/browser/ask-ai-input-monaco-zone-widget.d.ts.map +0 -1
- package/lib/browser/ask-ai-input-monaco-zone-widget.js +0 -93
- package/lib/browser/ask-ai-input-monaco-zone-widget.js.map +0 -1
- package/lib/browser/ask-ai-input-widget.d.ts +0 -29
- package/lib/browser/ask-ai-input-widget.d.ts.map +0 -1
- package/lib/browser/ask-ai-input-widget.js +0 -94
- package/lib/browser/ask-ai-input-widget.js.map +0 -1
- package/lib/browser/index.d.ts +0 -3
- package/lib/browser/index.d.ts.map +0 -1
- package/lib/browser/index.js +0 -21
- package/lib/browser/index.js.map +0 -1
- package/lib/package.spec.d.ts +0 -1
- package/lib/package.spec.d.ts.map +0 -1
- package/lib/package.spec.js +0 -26
- package/lib/package.spec.js.map +0 -1
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ The `@theia/ai-editor` extension brings AI-powered code actions and editor conte
|
|
|
16
16
|
|
|
17
17
|
## Additional Information
|
|
18
18
|
|
|
19
|
+
- [API documentation for `@theia/ai-editor`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-editor.html)
|
|
19
20
|
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
20
21
|
- [Theia - Website](https://theia-ide.org/)
|
|
21
22
|
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/ai-editor",
|
|
3
|
-
"version": "1.67.0-next.
|
|
3
|
+
"version": "1.67.0-next.56+d8f18cc386c",
|
|
4
4
|
"description": "Theia - AI Editor",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/ai-chat": "1.67.0-next.
|
|
7
|
-
"@theia/ai-chat-ui": "1.67.0-next.
|
|
8
|
-
"@theia/ai-core": "1.67.0-next.
|
|
9
|
-
"@theia/core": "1.67.0-next.
|
|
10
|
-
"@theia/editor": "1.67.0-next.
|
|
11
|
-
"@theia/filesystem": "1.67.0-next.
|
|
12
|
-
"@theia/monaco": "1.67.0-next.
|
|
6
|
+
"@theia/ai-chat": "1.67.0-next.56+d8f18cc386c",
|
|
7
|
+
"@theia/ai-chat-ui": "1.67.0-next.56+d8f18cc386c",
|
|
8
|
+
"@theia/ai-core": "1.67.0-next.56+d8f18cc386c",
|
|
9
|
+
"@theia/core": "1.67.0-next.56+d8f18cc386c",
|
|
10
|
+
"@theia/editor": "1.67.0-next.56+d8f18cc386c",
|
|
11
|
+
"@theia/filesystem": "1.67.0-next.56+d8f18cc386c",
|
|
12
|
+
"@theia/monaco": "1.67.0-next.56+d8f18cc386c",
|
|
13
13
|
"@theia/monaco-editor-core": "1.96.302",
|
|
14
|
-
"@theia/workspace": "1.67.0-next.
|
|
14
|
+
"@theia/workspace": "1.67.0-next.56+d8f18cc386c"
|
|
15
15
|
},
|
|
16
16
|
"main": "lib/common",
|
|
17
17
|
"publishConfig": {
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"nyc": {
|
|
55
55
|
"extends": "../../configs/nyc.json"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "d8f18cc386c45a736cd193d42eab02c8f64c6b10"
|
|
58
58
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
2
|
-
import { CommandService } from '@theia/core/lib/common/command';
|
|
3
|
-
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
4
|
-
import { MonacoEditorService } from '@theia/monaco/lib/browser/monaco-editor-service';
|
|
5
|
-
import { AIActivationService } from '@theia/ai-core/lib/browser/ai-activation-service';
|
|
6
|
-
export declare const AI_EDITOR_SEND_TO_CHAT: {
|
|
7
|
-
id: string;
|
|
8
|
-
};
|
|
9
|
-
export declare class AICodeActionProvider implements FrontendApplicationContribution {
|
|
10
|
-
protected readonly commandService: CommandService;
|
|
11
|
-
protected readonly monacoEditorService: MonacoEditorService;
|
|
12
|
-
protected readonly activationService: AIActivationService;
|
|
13
|
-
protected readonly toDispose: DisposableCollection;
|
|
14
|
-
onStart(): void;
|
|
15
|
-
dispose(): void;
|
|
16
|
-
protected registerCodeActionProvider(): void;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=ai-code-action-provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-code-action-provider.d.ts","sourceRoot":"","sources":["../../src/browser/ai-code-action-provider.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAGzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AAGvF,eAAO,MAAM,sBAAsB;;CAElC,CAAC;AAEF,qBACa,oBAAqB,YAAW,+BAA+B;IAGxE,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IAGlD,SAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAG5D,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;IAE1D,SAAS,CAAC,QAAQ,CAAC,SAAS,uBAA8B;IAE1D,OAAO,IAAI,IAAI;IAUf,OAAO,IAAI,IAAI;IAIf,SAAS,CAAC,0BAA0B,IAAI,IAAI;CA6D/C"}
|
|
@@ -1,116 +0,0 @@
|
|
|
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.AICodeActionProvider = exports.AI_EDITOR_SEND_TO_CHAT = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const command_1 = require("@theia/core/lib/common/command");
|
|
21
|
-
const disposable_1 = require("@theia/core/lib/common/disposable");
|
|
22
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
23
|
-
const monaco = require("@theia/monaco-editor-core");
|
|
24
|
-
const monaco_editor_service_1 = require("@theia/monaco/lib/browser/monaco-editor-service");
|
|
25
|
-
const ai_activation_service_1 = require("@theia/ai-core/lib/browser/ai-activation-service");
|
|
26
|
-
const core_1 = require("@theia/core");
|
|
27
|
-
exports.AI_EDITOR_SEND_TO_CHAT = {
|
|
28
|
-
id: 'ai-editor.sendToChat',
|
|
29
|
-
};
|
|
30
|
-
let AICodeActionProvider = class AICodeActionProvider {
|
|
31
|
-
constructor() {
|
|
32
|
-
this.toDispose = new disposable_1.DisposableCollection();
|
|
33
|
-
}
|
|
34
|
-
onStart() {
|
|
35
|
-
this.registerCodeActionProvider();
|
|
36
|
-
// Listen to AI activation changes and re-register the provider
|
|
37
|
-
this.activationService.onDidChangeActiveStatus(() => {
|
|
38
|
-
this.toDispose.dispose();
|
|
39
|
-
this.registerCodeActionProvider();
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
dispose() {
|
|
43
|
-
this.toDispose.dispose();
|
|
44
|
-
}
|
|
45
|
-
registerCodeActionProvider() {
|
|
46
|
-
if (!this.activationService.isActive) {
|
|
47
|
-
// AI is disabled, don't register the provider
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const disposable = monaco.languages.registerCodeActionProvider('*', {
|
|
51
|
-
provideCodeActions: (model, range, context, token) => {
|
|
52
|
-
// Double-check activation status in the provider
|
|
53
|
-
if (!this.activationService.isActive) {
|
|
54
|
-
return { actions: [], dispose: () => { } };
|
|
55
|
-
}
|
|
56
|
-
// Filter for error markers only
|
|
57
|
-
const errorMarkers = context.markers.filter(marker => marker.severity === monaco.MarkerSeverity.Error);
|
|
58
|
-
if (errorMarkers.length === 0) {
|
|
59
|
-
return { actions: [], dispose: () => { } };
|
|
60
|
-
}
|
|
61
|
-
const actions = [];
|
|
62
|
-
// Create code actions for each error marker: Fix with AI and Explain with AI
|
|
63
|
-
errorMarkers.forEach(marker => {
|
|
64
|
-
actions.push({
|
|
65
|
-
title: core_1.nls.localize('theia/ai/editor/fixWithAI/title', 'Fix with AI'),
|
|
66
|
-
diagnostics: [marker],
|
|
67
|
-
isAI: true,
|
|
68
|
-
kind: 'quickfix',
|
|
69
|
-
command: {
|
|
70
|
-
id: exports.AI_EDITOR_SEND_TO_CHAT.id,
|
|
71
|
-
title: core_1.nls.localize('theia/ai/editor/fixWithAI/title', 'Fix with AI'),
|
|
72
|
-
arguments: [{
|
|
73
|
-
prompt: `@Coder ${core_1.nls.localize('theia/ai/editor/fixWithAI/prompt', 'Help to fix this error')}: "${marker.message}"`
|
|
74
|
-
}]
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
actions.push({
|
|
78
|
-
title: core_1.nls.localize('theia/ai/editor/explainWithAI/title', 'Explain with AI'),
|
|
79
|
-
diagnostics: [marker],
|
|
80
|
-
kind: 'quickfix',
|
|
81
|
-
isAI: true,
|
|
82
|
-
command: {
|
|
83
|
-
id: exports.AI_EDITOR_SEND_TO_CHAT.id,
|
|
84
|
-
title: core_1.nls.localize('theia/ai/editor/explainWithAI/title', 'Explain with AI'),
|
|
85
|
-
arguments: [{
|
|
86
|
-
prompt: `@Architect ${core_1.nls.localize('theia/ai/editor/explainWithAI/prompt', 'Explain this error')}: "${marker.message}"`
|
|
87
|
-
}]
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
return {
|
|
92
|
-
actions: actions,
|
|
93
|
-
dispose: () => { }
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
this.toDispose.push(disposable);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
exports.AICodeActionProvider = AICodeActionProvider;
|
|
101
|
-
tslib_1.__decorate([
|
|
102
|
-
(0, inversify_1.inject)(command_1.CommandService),
|
|
103
|
-
tslib_1.__metadata("design:type", Object)
|
|
104
|
-
], AICodeActionProvider.prototype, "commandService", void 0);
|
|
105
|
-
tslib_1.__decorate([
|
|
106
|
-
(0, inversify_1.inject)(monaco_editor_service_1.MonacoEditorService),
|
|
107
|
-
tslib_1.__metadata("design:type", monaco_editor_service_1.MonacoEditorService)
|
|
108
|
-
], AICodeActionProvider.prototype, "monacoEditorService", void 0);
|
|
109
|
-
tslib_1.__decorate([
|
|
110
|
-
(0, inversify_1.inject)(ai_activation_service_1.AIActivationService),
|
|
111
|
-
tslib_1.__metadata("design:type", Object)
|
|
112
|
-
], AICodeActionProvider.prototype, "activationService", void 0);
|
|
113
|
-
exports.AICodeActionProvider = AICodeActionProvider = tslib_1.__decorate([
|
|
114
|
-
(0, inversify_1.injectable)()
|
|
115
|
-
], AICodeActionProvider);
|
|
116
|
-
//# sourceMappingURL=ai-code-action-provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-code-action-provider.js","sourceRoot":"","sources":["../../src/browser/ai-code-action-provider.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,4DAAgE;AAChE,kEAAyE;AACzE,4DAAkE;AAClE,oDAAoD;AACpD,2FAAsF;AACtF,4FAAuF;AACvF,sCAAkC;AAErB,QAAA,sBAAsB,GAAG;IAClC,EAAE,EAAE,sBAAsB;CAC7B,CAAC;AAGK,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAA1B;QAWgB,cAAS,GAAG,IAAI,iCAAoB,EAAE,CAAC;IA6E9D,CAAC;IA3EG,OAAO;QACH,IAAI,CAAC,0BAA0B,EAAE,CAAC;QAElC,+DAA+D;QAC/D,IAAI,CAAC,iBAAiB,CAAC,uBAAuB,CAAC,GAAG,EAAE;Y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AAC,2CAAmB,CAAC;;+DAC8B;+BATjD,oBAAoB;IADhC,IAAA,sBAAU,GAAE;GACA,oBAAoB,CAwFhC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ChatService } from '@theia/ai-chat';
|
|
2
|
-
import { AICommandHandlerFactory } from '@theia/ai-core/lib/browser';
|
|
3
|
-
import { MenuContribution, MenuModelRegistry } from '@theia/core';
|
|
4
|
-
import { ApplicationShell, KeybindingContribution, KeybindingRegistry } from '@theia/core/lib/browser';
|
|
5
|
-
import { Command, CommandContribution, CommandRegistry } from '@theia/core/lib/common';
|
|
6
|
-
import { MonacoCommandRegistry, MonacoEditorCommandHandler } from '@theia/monaco/lib/browser/monaco-command-registry';
|
|
7
|
-
import { AskAIInputMonacoZoneWidget } from './ask-ai-input-monaco-zone-widget';
|
|
8
|
-
import { AskAIInputFactory } from './ask-ai-input-widget';
|
|
9
|
-
export declare namespace AI_EDITOR_COMMANDS {
|
|
10
|
-
const AI_EDITOR_ASK_AI: Command;
|
|
11
|
-
const AI_EDITOR_SEND_TO_CHAT: Command;
|
|
12
|
-
}
|
|
13
|
-
export declare class AiEditorCommandContribution implements CommandContribution, MenuContribution, KeybindingContribution {
|
|
14
|
-
protected readonly monacoCommandRegistry: MonacoCommandRegistry;
|
|
15
|
-
protected readonly chatService: ChatService;
|
|
16
|
-
protected readonly commandHandlerFactory: AICommandHandlerFactory;
|
|
17
|
-
protected readonly askAIInputFactory: AskAIInputFactory;
|
|
18
|
-
protected readonly shell: ApplicationShell;
|
|
19
|
-
protected askAiInputWidget: AskAIInputMonacoZoneWidget | undefined;
|
|
20
|
-
registerCommands(registry: CommandRegistry): void;
|
|
21
|
-
protected showInputWidgetHandler(): MonacoEditorCommandHandler;
|
|
22
|
-
private showInputWidget;
|
|
23
|
-
private cleanupInputWidget;
|
|
24
|
-
protected sendToChatHandler(): MonacoEditorCommandHandler;
|
|
25
|
-
private createNewChatSession;
|
|
26
|
-
protected wrapMonacoHandler(handler: MonacoEditorCommandHandler): MonacoEditorCommandHandler;
|
|
27
|
-
registerMenus(menus: MenuModelRegistry): void;
|
|
28
|
-
registerKeybindings(registry: KeybindingRegistry): void;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=ai-editor-command-contribution.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-editor-command-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/ai-editor-command-contribution.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAkC,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAyB,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAAsB,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAW,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAChH,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGvF,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,mDAAmD,CAAC;AAEtH,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,yBAAiB,kBAAkB,CAAC;IACzB,MAAM,gBAAgB,EAAE,OAIE,CAAC;IAC3B,MAAM,sBAAsB,EAAE,OAGL,CAAC;CACpC;AAED,qBACa,2BAA4B,YAAW,mBAAmB,EAAE,gBAAgB,EAAE,sBAAsB;IAG7G,SAAS,CAAC,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IAGhE,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAG5C,SAAS,CAAC,QAAQ,CAAC,qBAAqB,EAAE,uBAAuB,CAAC;IAGlE,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAGxD,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IAE3C,SAAS,CAAC,gBAAgB,EAAE,0BAA0B,GAAG,SAAS,CAAC;IAEnE,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAQjD,SAAS,CAAC,sBAAsB,IAAI,0BAA0B;IAU9D,OAAO,CAAC,eAAe;IAoBvB,OAAO,CAAC,kBAAkB;IAO1B,SAAS,CAAC,iBAAiB,IAAI,0BAA0B;IAezD,OAAO,CAAC,oBAAoB;IAQ5B,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,0BAA0B,GAAG,0BAA0B;IAQ5F,aAAa,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAS7C,mBAAmB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI;CAO1D"}
|
|
@@ -1,153 +0,0 @@
|
|
|
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.AiEditorCommandContribution = exports.AI_EDITOR_COMMANDS = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const ai_chat_1 = require("@theia/ai-chat");
|
|
21
|
-
const browser_1 = require("@theia/ai-core/lib/browser");
|
|
22
|
-
const core_1 = require("@theia/core");
|
|
23
|
-
const browser_2 = require("@theia/core/lib/browser");
|
|
24
|
-
const common_1 = require("@theia/core/lib/common");
|
|
25
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
26
|
-
const browser_3 = require("@theia/editor/lib/browser");
|
|
27
|
-
const monaco_command_registry_1 = require("@theia/monaco/lib/browser/monaco-command-registry");
|
|
28
|
-
const ask_ai_input_monaco_zone_widget_1 = require("./ask-ai-input-monaco-zone-widget");
|
|
29
|
-
const ask_ai_input_widget_1 = require("./ask-ai-input-widget");
|
|
30
|
-
var AI_EDITOR_COMMANDS;
|
|
31
|
-
(function (AI_EDITOR_COMMANDS) {
|
|
32
|
-
AI_EDITOR_COMMANDS.AI_EDITOR_ASK_AI = common_1.Command.toLocalizedCommand({
|
|
33
|
-
id: 'ai-editor.contextAction',
|
|
34
|
-
label: 'Ask AI',
|
|
35
|
-
iconClass: (0, browser_2.codicon)('sparkle')
|
|
36
|
-
}, 'theia/ai-editor/contextMenu');
|
|
37
|
-
AI_EDITOR_COMMANDS.AI_EDITOR_SEND_TO_CHAT = common_1.Command.toLocalizedCommand({
|
|
38
|
-
id: 'ai-editor.sendToChat',
|
|
39
|
-
label: 'Send to AI Chat'
|
|
40
|
-
}, 'theia/ai-editor/sendToChat');
|
|
41
|
-
})(AI_EDITOR_COMMANDS || (exports.AI_EDITOR_COMMANDS = AI_EDITOR_COMMANDS = {}));
|
|
42
|
-
;
|
|
43
|
-
let AiEditorCommandContribution = class AiEditorCommandContribution {
|
|
44
|
-
registerCommands(registry) {
|
|
45
|
-
registry.registerCommand(AI_EDITOR_COMMANDS.AI_EDITOR_ASK_AI);
|
|
46
|
-
registry.registerCommand(AI_EDITOR_COMMANDS.AI_EDITOR_SEND_TO_CHAT);
|
|
47
|
-
this.monacoCommandRegistry.registerHandler(AI_EDITOR_COMMANDS.AI_EDITOR_ASK_AI.id, this.wrapMonacoHandler(this.showInputWidgetHandler()));
|
|
48
|
-
this.monacoCommandRegistry.registerHandler(AI_EDITOR_COMMANDS.AI_EDITOR_SEND_TO_CHAT.id, this.wrapMonacoHandler(this.sendToChatHandler()));
|
|
49
|
-
}
|
|
50
|
-
showInputWidgetHandler() {
|
|
51
|
-
return {
|
|
52
|
-
execute: (editor) => {
|
|
53
|
-
this.showInputWidget(editor);
|
|
54
|
-
},
|
|
55
|
-
isEnabled: (editor) => this.shell.currentWidget instanceof browser_3.EditorWidget && this.shell.currentWidget.editor === editor
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
showInputWidget(editor) {
|
|
59
|
-
var _a, _b;
|
|
60
|
-
this.cleanupInputWidget();
|
|
61
|
-
// Create the input widget using the factory
|
|
62
|
-
this.askAiInputWidget = new ask_ai_input_monaco_zone_widget_1.AskAIInputMonacoZoneWidget(editor.getControl(), this.askAIInputFactory);
|
|
63
|
-
this.askAiInputWidget.onSubmit(request => {
|
|
64
|
-
this.createNewChatSession(request);
|
|
65
|
-
this.cleanupInputWidget();
|
|
66
|
-
});
|
|
67
|
-
const line = (_b = (_a = editor.getControl().getPosition()) === null || _a === void 0 ? void 0 : _a.lineNumber) !== null && _b !== void 0 ? _b : 1;
|
|
68
|
-
this.askAiInputWidget.showAtLine(line);
|
|
69
|
-
this.askAiInputWidget.onCancel(() => {
|
|
70
|
-
this.cleanupInputWidget();
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
cleanupInputWidget() {
|
|
74
|
-
if (this.askAiInputWidget) {
|
|
75
|
-
this.askAiInputWidget.dispose();
|
|
76
|
-
this.askAiInputWidget = undefined;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
sendToChatHandler() {
|
|
80
|
-
return {
|
|
81
|
-
execute: (_editor, ...args) => {
|
|
82
|
-
if (containsPrompt(args)) {
|
|
83
|
-
const prompt = args
|
|
84
|
-
.filter(isPromptArg)
|
|
85
|
-
.map(arg => arg.prompt)
|
|
86
|
-
.join();
|
|
87
|
-
this.createNewChatSession({ text: prompt });
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
isEnabled: (_editor, ...args) => containsPrompt(args)
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
createNewChatSession(request) {
|
|
94
|
-
const session = this.chatService.createSession(ai_chat_1.ChatAgentLocation.Panel, { focus: true });
|
|
95
|
-
this.chatService.sendRequest(session.id, {
|
|
96
|
-
...request,
|
|
97
|
-
text: `${request.text} #editorContext`,
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
wrapMonacoHandler(handler) {
|
|
101
|
-
const wrappedHandler = this.commandHandlerFactory(handler);
|
|
102
|
-
return {
|
|
103
|
-
execute: wrappedHandler.execute,
|
|
104
|
-
isEnabled: wrappedHandler.isEnabled
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
registerMenus(menus) {
|
|
108
|
-
menus.registerMenuAction(browser_3.EditorContextMenu.NAVIGATION, {
|
|
109
|
-
commandId: AI_EDITOR_COMMANDS.AI_EDITOR_ASK_AI.id,
|
|
110
|
-
label: AI_EDITOR_COMMANDS.AI_EDITOR_ASK_AI.label,
|
|
111
|
-
icon: AI_EDITOR_COMMANDS.AI_EDITOR_ASK_AI.iconClass,
|
|
112
|
-
when: browser_1.ENABLE_AI_CONTEXT_KEY
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
registerKeybindings(registry) {
|
|
116
|
-
registry.registerKeybinding({
|
|
117
|
-
command: AI_EDITOR_COMMANDS.AI_EDITOR_ASK_AI.id,
|
|
118
|
-
keybinding: 'ctrlcmd+i',
|
|
119
|
-
when: `${browser_1.ENABLE_AI_CONTEXT_KEY} && editorFocus && !editorReadonly`
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
exports.AiEditorCommandContribution = AiEditorCommandContribution;
|
|
124
|
-
tslib_1.__decorate([
|
|
125
|
-
(0, inversify_1.inject)(monaco_command_registry_1.MonacoCommandRegistry),
|
|
126
|
-
tslib_1.__metadata("design:type", monaco_command_registry_1.MonacoCommandRegistry)
|
|
127
|
-
], AiEditorCommandContribution.prototype, "monacoCommandRegistry", void 0);
|
|
128
|
-
tslib_1.__decorate([
|
|
129
|
-
(0, inversify_1.inject)(ai_chat_1.ChatService),
|
|
130
|
-
tslib_1.__metadata("design:type", Object)
|
|
131
|
-
], AiEditorCommandContribution.prototype, "chatService", void 0);
|
|
132
|
-
tslib_1.__decorate([
|
|
133
|
-
(0, inversify_1.inject)(browser_1.AICommandHandlerFactory),
|
|
134
|
-
tslib_1.__metadata("design:type", Function)
|
|
135
|
-
], AiEditorCommandContribution.prototype, "commandHandlerFactory", void 0);
|
|
136
|
-
tslib_1.__decorate([
|
|
137
|
-
(0, inversify_1.inject)(ask_ai_input_widget_1.AskAIInputFactory),
|
|
138
|
-
tslib_1.__metadata("design:type", Function)
|
|
139
|
-
], AiEditorCommandContribution.prototype, "askAIInputFactory", void 0);
|
|
140
|
-
tslib_1.__decorate([
|
|
141
|
-
(0, inversify_1.inject)(browser_2.ApplicationShell),
|
|
142
|
-
tslib_1.__metadata("design:type", browser_2.ApplicationShell)
|
|
143
|
-
], AiEditorCommandContribution.prototype, "shell", void 0);
|
|
144
|
-
exports.AiEditorCommandContribution = AiEditorCommandContribution = tslib_1.__decorate([
|
|
145
|
-
(0, inversify_1.injectable)()
|
|
146
|
-
], AiEditorCommandContribution);
|
|
147
|
-
function containsPrompt(args) {
|
|
148
|
-
return args.some(arg => isPromptArg(arg));
|
|
149
|
-
}
|
|
150
|
-
function isPromptArg(arg) {
|
|
151
|
-
return (0, core_1.isObject)(arg) && 'prompt' in arg && (0, core_1.isString)(arg.prompt);
|
|
152
|
-
}
|
|
153
|
-
//# sourceMappingURL=ai-editor-command-contribution.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-editor-command-contribution.js","sourceRoot":"","sources":["../../src/browser/ai-editor-command-contribution.ts"],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,kBAAkB,CAAC,gBAAgB,CAAC,KAAK;YAChD,IAAI,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,SAAS;YACnD,IAAI,EAAE,+BAAqB;SAC9B,CAAC,CAAC;IACP,CAAC;IAED,mBAAmB,CAAC,QAA4B;QAC5C,QAAQ,CAAC,kBAAkB,CAAC;YACxB,OAAO,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,EAAE;YAC/C,UAAU,EAAE,WAAW;YACvB,IAAI,EAAE,GAAG,+BAAqB,oCAAoC;SACrE,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AA/GY,kEAA2B;AAGjB;IADlB,IAAA,kBAAM,EAAC,+CAAqB,CAAC;sCACY,+CAAqB;0EAAC;AAG7C;IADlB,IAAA,kBAAM,EAAC,qBAAW,CAAC;;gEACwB;AAGzB;IADlB,IAAA,kBAAM,EAAC,iCAAuB,CAAC;;0EACkC;AAG/C;IADlB,IAAA,kBAAM,EAAC,uCAAiB,CAAC;;sEAC8B;AAGrC;IADlB,IAAA,kBAAM,EAAC,0BAAgB,CAAC;sCACC,0BAAgB;0DAAC;sCAflC,2BAA2B;IADvC,IAAA,sBAAU,GAAE;GACA,2BAA2B,CA+GvC;AAED,SAAS,cAAc,CAAC,IAAe;IACnC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,WAAW,CAAC,GAAY;IAC7B,OAAO,IAAA,eAAQ,EAAC,GAAG,CAAC,IAAI,QAAQ,IAAI,GAAG,IAAI,IAAA,eAAQ,EAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AIVariable, AIVariableContext, AIVariableContribution, AIVariableResolutionRequest, AIVariableResolver, ResolvedAIContextVariable } from '@theia/ai-core';
|
|
2
|
-
import { FrontendVariableService } from '@theia/ai-core/lib/browser';
|
|
3
|
-
import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor';
|
|
4
|
-
import { MonacoEditorProvider } from '@theia/monaco/lib/browser/monaco-editor-provider';
|
|
5
|
-
import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
|
|
6
|
-
import * as monaco from '@theia/monaco-editor-core';
|
|
7
|
-
export declare const EDITOR_CONTEXT_VARIABLE: AIVariable;
|
|
8
|
-
export declare class EditorContextVariableContribution implements AIVariableContribution, AIVariableResolver {
|
|
9
|
-
protected readonly monacoEditors: MonacoEditorProvider;
|
|
10
|
-
protected readonly workspaceService: WorkspaceService;
|
|
11
|
-
registerVariables(service: FrontendVariableService): void;
|
|
12
|
-
canResolve(request: AIVariableResolutionRequest, _: AIVariableContext): Promise<number>;
|
|
13
|
-
resolve(request: AIVariableResolutionRequest, _: AIVariableContext): Promise<ResolvedAIContextVariable | undefined>;
|
|
14
|
-
protected getDiagnosticContext(editor: MonacoEditor): Record<string, unknown>;
|
|
15
|
-
protected severityToString(severity: monaco.MarkerSeverity): string;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=ai-editor-context-variable.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-editor-context-variable.d.ts","sourceRoot":"","sources":["../../src/browser/ai-editor-context-variable.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AACnK,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAGrE,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAGpD,eAAO,MAAM,uBAAuB,EAAE,UAQrC,CAAC;AAEF,qBACa,iCAAkC,YAAW,sBAAsB,EAAE,kBAAkB;IAGhG,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAC;IAGvD,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAEtD,iBAAiB,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI;IAInD,UAAU,CAAC,OAAO,EAAE,2BAA2B,EAAE,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvF,OAAO,CAAC,OAAO,EAAE,2BAA2B,EAAE,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC;IAkEzH,SAAS,CAAC,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAyD7E,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,cAAc,GAAG,MAAM;CActE"}
|
|
@@ -1,167 +0,0 @@
|
|
|
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.EditorContextVariableContribution = exports.EDITOR_CONTEXT_VARIABLE = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
22
|
-
const monaco_editor_provider_1 = require("@theia/monaco/lib/browser/monaco-editor-provider");
|
|
23
|
-
const workspace_service_1 = require("@theia/workspace/lib/browser/workspace-service");
|
|
24
|
-
const monaco = require("@theia/monaco-editor-core");
|
|
25
|
-
const core_1 = require("@theia/core");
|
|
26
|
-
exports.EDITOR_CONTEXT_VARIABLE = {
|
|
27
|
-
id: 'editorContext',
|
|
28
|
-
description: core_1.nls.localize('theia/ai/editor/editorContextVariable/description', 'Resolves editor specific context information'),
|
|
29
|
-
name: 'editorContext',
|
|
30
|
-
label: core_1.nls.localize('theia/ai/editor/editorContextVariable/label', 'EditorContext'),
|
|
31
|
-
iconClasses: (0, browser_1.codiconArray)('file'),
|
|
32
|
-
isContextVariable: true,
|
|
33
|
-
args: []
|
|
34
|
-
};
|
|
35
|
-
let EditorContextVariableContribution = class EditorContextVariableContribution {
|
|
36
|
-
registerVariables(service) {
|
|
37
|
-
service.registerResolver(exports.EDITOR_CONTEXT_VARIABLE, this);
|
|
38
|
-
}
|
|
39
|
-
async canResolve(request, _) {
|
|
40
|
-
return request.variable.name === exports.EDITOR_CONTEXT_VARIABLE.name ? 1 : 0;
|
|
41
|
-
}
|
|
42
|
-
async resolve(request, _) {
|
|
43
|
-
const editor = this.monacoEditors.current;
|
|
44
|
-
if (!editor) {
|
|
45
|
-
return undefined;
|
|
46
|
-
}
|
|
47
|
-
const model = editor.getControl().getModel();
|
|
48
|
-
const selection = editor.getControl().getSelection();
|
|
49
|
-
if (!model || !selection) {
|
|
50
|
-
return undefined;
|
|
51
|
-
}
|
|
52
|
-
// Extract file information
|
|
53
|
-
const uri = editor.getResourceUri();
|
|
54
|
-
const languageId = model.getLanguageId();
|
|
55
|
-
// Extract selection information
|
|
56
|
-
const selectedText = model.getValueInRange(selection);
|
|
57
|
-
const hasSelection = !selection.isEmpty();
|
|
58
|
-
// Text position information
|
|
59
|
-
const position = editor.getControl().getPosition();
|
|
60
|
-
const lineNumber = position ? position.lineNumber : 0;
|
|
61
|
-
const column = position ? position.column : 0;
|
|
62
|
-
// Get workspace-relative path
|
|
63
|
-
const workspaceRelativePath = uri ? await this.workspaceService.getWorkspaceRelativePath(uri) : '';
|
|
64
|
-
// Create base context information
|
|
65
|
-
const baseContext = {
|
|
66
|
-
file: {
|
|
67
|
-
uri: workspaceRelativePath,
|
|
68
|
-
languageId,
|
|
69
|
-
fileName: uri ? uri.path.base : ''
|
|
70
|
-
},
|
|
71
|
-
selection: {
|
|
72
|
-
text: selectedText,
|
|
73
|
-
isEmpty: !hasSelection,
|
|
74
|
-
startLineNumber: selection.startLineNumber,
|
|
75
|
-
startColumn: selection.startColumn,
|
|
76
|
-
endLineNumber: selection.endLineNumber,
|
|
77
|
-
endColumn: selection.endColumn
|
|
78
|
-
},
|
|
79
|
-
position: {
|
|
80
|
-
lineNumber,
|
|
81
|
-
column,
|
|
82
|
-
lineContent: position ? model.getLineContent(position.lineNumber) : ''
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
const diagnostics = await this.getDiagnosticContext(editor);
|
|
86
|
-
const fullContext = {
|
|
87
|
-
...baseContext,
|
|
88
|
-
diagnostics
|
|
89
|
-
};
|
|
90
|
-
const contextValue = JSON.stringify(fullContext, undefined, 2);
|
|
91
|
-
return {
|
|
92
|
-
variable: request.variable,
|
|
93
|
-
value: contextValue, // Simplified visible value
|
|
94
|
-
contextValue // Full detailed context for AI processing
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
getDiagnosticContext(editor) {
|
|
98
|
-
const model = editor.getControl().getModel();
|
|
99
|
-
if (!model) {
|
|
100
|
-
return {};
|
|
101
|
-
}
|
|
102
|
-
const markers = monaco.editor.getModelMarkers({ resource: model.uri });
|
|
103
|
-
if (markers.length === 0) {
|
|
104
|
-
return {
|
|
105
|
-
errorCount: 0,
|
|
106
|
-
warningCount: 0,
|
|
107
|
-
infoCount: 0,
|
|
108
|
-
hintCount: 0,
|
|
109
|
-
totalIssues: 0
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
const issues = [];
|
|
113
|
-
const markerCounter = {
|
|
114
|
-
[monaco.MarkerSeverity.Error]: 0,
|
|
115
|
-
[monaco.MarkerSeverity.Warning]: 0,
|
|
116
|
-
[monaco.MarkerSeverity.Info]: 0,
|
|
117
|
-
[monaco.MarkerSeverity.Hint]: 0
|
|
118
|
-
};
|
|
119
|
-
markers.forEach(marker => {
|
|
120
|
-
markerCounter[marker.severity]++;
|
|
121
|
-
issues.push({
|
|
122
|
-
line: marker.startLineNumber,
|
|
123
|
-
column: marker.startColumn,
|
|
124
|
-
severity: this.severityToString(marker.severity),
|
|
125
|
-
message: marker.message,
|
|
126
|
-
source: marker.source
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
return {
|
|
130
|
-
diagnosticCounts: {
|
|
131
|
-
errorCount: markerCounter[monaco.MarkerSeverity.Error],
|
|
132
|
-
warningCount: markerCounter[monaco.MarkerSeverity.Warning],
|
|
133
|
-
infoCount: markerCounter[monaco.MarkerSeverity.Info],
|
|
134
|
-
hintCount: markerCounter[monaco.MarkerSeverity.Hint]
|
|
135
|
-
},
|
|
136
|
-
totalIssues: markers.length,
|
|
137
|
-
issues
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
severityToString(severity) {
|
|
141
|
-
switch (severity) {
|
|
142
|
-
case monaco.MarkerSeverity.Error:
|
|
143
|
-
return 'error';
|
|
144
|
-
case monaco.MarkerSeverity.Warning:
|
|
145
|
-
return 'warning';
|
|
146
|
-
case monaco.MarkerSeverity.Info:
|
|
147
|
-
return 'info';
|
|
148
|
-
case monaco.MarkerSeverity.Hint:
|
|
149
|
-
return 'hint';
|
|
150
|
-
default:
|
|
151
|
-
return 'unknown';
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
exports.EditorContextVariableContribution = EditorContextVariableContribution;
|
|
156
|
-
tslib_1.__decorate([
|
|
157
|
-
(0, inversify_1.inject)(monaco_editor_provider_1.MonacoEditorProvider),
|
|
158
|
-
tslib_1.__metadata("design:type", monaco_editor_provider_1.MonacoEditorProvider)
|
|
159
|
-
], EditorContextVariableContribution.prototype, "monacoEditors", void 0);
|
|
160
|
-
tslib_1.__decorate([
|
|
161
|
-
(0, inversify_1.inject)(workspace_service_1.WorkspaceService),
|
|
162
|
-
tslib_1.__metadata("design:type", workspace_service_1.WorkspaceService)
|
|
163
|
-
], EditorContextVariableContribution.prototype, "workspaceService", void 0);
|
|
164
|
-
exports.EditorContextVariableContribution = EditorContextVariableContribution = tslib_1.__decorate([
|
|
165
|
-
(0, inversify_1.injectable)()
|
|
166
|
-
], EditorContextVariableContribution);
|
|
167
|
-
//# sourceMappingURL=ai-editor-context-variable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-editor-context-variable.js","sourceRoot":"","sources":["../../src/browser/ai-editor-context-variable.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;;;;AAIhF,4DAAkE;AAClE,qDAAuD;AAEvD,6FAAwF;AACxF,sFAAkF;AAClF,oDAAoD;AACpD,sCAAkC;AAErB,QAAA,uBAAuB,GAAe;IAC/C,EAAE,EAAE,eAAe;IACnB,WAAW,EAAE,UAAG,CAAC,QAAQ,CAAC,mDAAmD,EAAE,8CAA8C,CAAC;IAC9H,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,UAAG,CAAC,QAAQ,CAAC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,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,8BAA8B,CAAC;;AAWtC,wBAwBG"}
|
|
@@ -1,48 +0,0 @@
|
|
|
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
|
-
const ai_core_1 = require("@theia/ai-core");
|
|
19
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
20
|
-
const common_1 = require("@theia/core/lib/common");
|
|
21
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
-
require("../../style/ask-ai-input.css");
|
|
23
|
-
const ai_code_action_provider_1 = require("./ai-code-action-provider");
|
|
24
|
-
const ai_editor_command_contribution_1 = require("./ai-editor-command-contribution");
|
|
25
|
-
const ai_editor_context_variable_1 = require("./ai-editor-context-variable");
|
|
26
|
-
const ask_ai_input_widget_1 = require("./ask-ai-input-widget");
|
|
27
|
-
exports.default = new inversify_1.ContainerModule(bind => {
|
|
28
|
-
bind(ai_editor_command_contribution_1.AiEditorCommandContribution).toSelf().inSingletonScope();
|
|
29
|
-
bind(common_1.CommandContribution).toService(ai_editor_command_contribution_1.AiEditorCommandContribution);
|
|
30
|
-
bind(common_1.MenuContribution).toService(ai_editor_command_contribution_1.AiEditorCommandContribution);
|
|
31
|
-
bind(browser_1.KeybindingContribution).toService(ai_editor_command_contribution_1.AiEditorCommandContribution);
|
|
32
|
-
bind(ai_core_1.AIVariableContribution).to(ai_editor_context_variable_1.EditorContextVariableContribution).inSingletonScope();
|
|
33
|
-
bind(ai_code_action_provider_1.AICodeActionProvider).toSelf().inSingletonScope();
|
|
34
|
-
bind(browser_1.FrontendApplicationContribution).toService(ai_code_action_provider_1.AICodeActionProvider);
|
|
35
|
-
bind(ask_ai_input_widget_1.AskAIInputFactory).toFactory(ctx => (args) => {
|
|
36
|
-
const container = ctx.container.createChild();
|
|
37
|
-
container.bind(ask_ai_input_widget_1.AskAIInputArgs).toConstantValue(args);
|
|
38
|
-
container.bind(ask_ai_input_widget_1.AskAIInputConfiguration).toConstantValue({
|
|
39
|
-
showContext: true,
|
|
40
|
-
showPinnedAgent: true,
|
|
41
|
-
showChangeSet: false,
|
|
42
|
-
showSuggestions: false
|
|
43
|
-
});
|
|
44
|
-
container.bind(ask_ai_input_widget_1.AskAIInputWidget).toSelf().inSingletonScope();
|
|
45
|
-
return container.get(ask_ai_input_widget_1.AskAIInputWidget);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
//# sourceMappingURL=ai-editor-frontend-module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-editor-frontend-module.js","sourceRoot":"","sources":["../../src/browser/ai-editor-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,4CAAwD;AACxD,qDAAkG;AAClG,mDAA+E;AAC/E,4DAA+D;AAC/D,wC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AC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ChatRequest } from '@theia/ai-chat';
|
|
2
|
-
import { Disposable } from '@theia/core/lib/common/disposable';
|
|
3
|
-
import { Emitter, Event } from '@theia/core/lib/common/event';
|
|
4
|
-
import * as monaco from '@theia/monaco-editor-core';
|
|
5
|
-
import { MonacoEditorZoneWidget } from '@theia/monaco/lib/browser/monaco-editor-zone-widget';
|
|
6
|
-
import { AskAIInputFactory, AskAIInputWidget } from './ask-ai-input-widget';
|
|
7
|
-
/**
|
|
8
|
-
* A widget that shows the Ask AI input UI in a Monaco editor zone.
|
|
9
|
-
*/
|
|
10
|
-
export declare class AskAIInputMonacoZoneWidget extends MonacoEditorZoneWidget implements Disposable {
|
|
11
|
-
protected readonly inputWidget: AskAIInputWidget;
|
|
12
|
-
protected readonly onSubmitEmitter: Emitter<ChatRequest>;
|
|
13
|
-
protected readonly onCancelEmitter: Emitter<void>;
|
|
14
|
-
readonly onSubmit: Event<ChatRequest>;
|
|
15
|
-
readonly onCancel: Event<void>;
|
|
16
|
-
constructor(editorInstance: monaco.editor.ICodeEditor, inputWidgetFactory: AskAIInputFactory);
|
|
17
|
-
show(options: MonacoEditorZoneWidget.Options): void;
|
|
18
|
-
showAtLine(lineNumber: number): void;
|
|
19
|
-
protected renderReactWidget(): void;
|
|
20
|
-
protected adjustZoneHeight(): void;
|
|
21
|
-
protected handleSubmit(request: ChatRequest): void;
|
|
22
|
-
protected handleCancel(): void;
|
|
23
|
-
protected registerListeners(): void;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=ask-ai-input-monaco-zone-widget.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ask-ai-input-monaco-zone-widget.d.ts","sourceRoot":"","sources":["../../src/browser/ask-ai-input-monaco-zone-widget.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE5E;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,sBAAuB,YAAW,UAAU;IACxF,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;IAEjD,SAAS,CAAC,QAAQ,CAAC,eAAe,uBAA8B;IAChE,SAAS,CAAC,QAAQ,CAAC,eAAe,gBAAuB;IAEzD,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,CAA8B;IACnE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,CAA8B;gBAGxD,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,EACzC,kBAAkB,EAAE,iBAAiB;IAoBhC,IAAI,CAAC,OAAO,EAAE,sBAAsB,CAAC,OAAO,GAAG,IAAI;IAM5D,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAUpC,SAAS,CAAC,iBAAiB,IAAI,IAAI;IAMnC,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAelC,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAKlD,SAAS,CAAC,YAAY,IAAI,IAAI;IAK9B,SAAS,CAAC,iBAAiB,IAAI,IAAI;CAStC"}
|
|
@@ -1,93 +0,0 @@
|
|
|
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.AskAIInputMonacoZoneWidget = void 0;
|
|
19
|
-
const event_1 = require("@theia/core/lib/common/event");
|
|
20
|
-
const monaco = require("@theia/monaco-editor-core");
|
|
21
|
-
const monaco_editor_zone_widget_1 = require("@theia/monaco/lib/browser/monaco-editor-zone-widget");
|
|
22
|
-
/**
|
|
23
|
-
* A widget that shows the Ask AI input UI in a Monaco editor zone.
|
|
24
|
-
*/
|
|
25
|
-
class AskAIInputMonacoZoneWidget extends monaco_editor_zone_widget_1.MonacoEditorZoneWidget {
|
|
26
|
-
constructor(editorInstance, inputWidgetFactory) {
|
|
27
|
-
super(editorInstance, false /* showArrow */);
|
|
28
|
-
this.onSubmitEmitter = new event_1.Emitter();
|
|
29
|
-
this.onCancelEmitter = new event_1.Emitter();
|
|
30
|
-
this.onSubmit = this.onSubmitEmitter.event;
|
|
31
|
-
this.onCancel = this.onCancelEmitter.event;
|
|
32
|
-
this.containerNode.classList.add('ask-ai-input-monaco-zone-widget');
|
|
33
|
-
this.inputWidget = inputWidgetFactory({
|
|
34
|
-
onSubmit: event => this.handleSubmit(event),
|
|
35
|
-
onCancel: () => this.handleCancel()
|
|
36
|
-
});
|
|
37
|
-
this.inputWidget.onDidResize(() => this.adjustZoneHeight());
|
|
38
|
-
this.toDispose.pushAll([
|
|
39
|
-
this.onSubmitEmitter,
|
|
40
|
-
this.onCancelEmitter,
|
|
41
|
-
this.inputWidget,
|
|
42
|
-
]);
|
|
43
|
-
}
|
|
44
|
-
show(options) {
|
|
45
|
-
super.show(options);
|
|
46
|
-
this.renderReactWidget();
|
|
47
|
-
this.registerListeners();
|
|
48
|
-
}
|
|
49
|
-
showAtLine(lineNumber) {
|
|
50
|
-
const options = {
|
|
51
|
-
afterLineNumber: lineNumber,
|
|
52
|
-
heightInLines: 5,
|
|
53
|
-
frameWidth: 1,
|
|
54
|
-
showFrame: true,
|
|
55
|
-
};
|
|
56
|
-
this.show(options);
|
|
57
|
-
}
|
|
58
|
-
renderReactWidget() {
|
|
59
|
-
this.containerNode.append(this.inputWidget.node);
|
|
60
|
-
this.inputWidget.activate();
|
|
61
|
-
this.inputWidget.update();
|
|
62
|
-
}
|
|
63
|
-
adjustZoneHeight() {
|
|
64
|
-
if (!this.viewZone) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const editorLineHeight = this.editor.getOption(monaco.editor.EditorOption.lineHeight);
|
|
68
|
-
const zoneWidgetHeight = this.inputWidget.node.parentElement ? this.inputWidget.node.parentElement.scrollHeight : this.inputWidget.node.scrollHeight;
|
|
69
|
-
const requiredLines = Math.max(5, Math.ceil(zoneWidgetHeight / editorLineHeight));
|
|
70
|
-
if (this.viewZone.heightInLines !== requiredLines) {
|
|
71
|
-
this.layout(requiredLines);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
handleSubmit(request) {
|
|
75
|
-
this.onSubmitEmitter.fire(request);
|
|
76
|
-
this.hide();
|
|
77
|
-
}
|
|
78
|
-
handleCancel() {
|
|
79
|
-
this.onCancelEmitter.fire();
|
|
80
|
-
this.hide();
|
|
81
|
-
}
|
|
82
|
-
registerListeners() {
|
|
83
|
-
this.toHide.push(this.editor.onKeyDown(e => {
|
|
84
|
-
if (e.keyCode === monaco.KeyCode.Escape) {
|
|
85
|
-
this.handleCancel();
|
|
86
|
-
e.preventDefault();
|
|
87
|
-
e.stopPropagation();
|
|
88
|
-
}
|
|
89
|
-
}));
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
exports.AskAIInputMonacoZoneWidget = AskAIInputMonacoZoneWidget;
|
|
93
|
-
//# sourceMappingURL=ask-ai-input-monaco-zone-widget.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ask-ai-input-monaco-zone-widget.js","sourceRoot":"","sources":["../../src/browser/ask-ai-input-monaco-zone-widget.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;;;AAIhF,wDAA8D;AAC9D,oDAAoD;AACpD,mGAA6F;AAG7F;;GAEG;AACH,MAAa,0BAA2B,SAAQ,kDAAsB;IASlE,YACI,cAAyC,EACzC,kBAAqC;QAErC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;QAV9B,oBAAe,GAAG,IAAI,eAAO,EAAe,CAAC;QAC7C,oBAAe,GAAG,IAAI,eAAO,EAAQ,CAAC;QAEhD,aAAQ,GAAuB,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;QAC1D,aAAQ,GAAgB,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;QAQxD,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;QAEpE,IAAI,CAAC,WAAW,GAAG,kBAAkB,CAAC;YAClC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;YAC3C,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE;SACtC,CAAC,CAAC;QAEH,IAA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;QAErJ,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,CAAC;QAElF,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,KAAK,aAAa,EAAE,CAAC;YAChD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC/B,CAAC;IACL,CAAC;IAES,YAAY,CAAC,OAAoB;QACvC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAES,YAAY;QAClB,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAES,iBAAiB;QACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;YACvC,IAAI,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBACtC,IAAI,CAAC,YAAY,EAAE,CAAC;gBACpB,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,CAAC,CAAC,eAAe,EAAE,CAAC;YACxB,CAAC;QACL,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;CACJ;AAvFD,gEAuFC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ChatRequest } from '@theia/ai-chat';
|
|
2
|
-
import { AIChatInputConfiguration, AIChatInputWidget } from '@theia/ai-chat-ui/lib/browser/chat-input-widget';
|
|
3
|
-
import { URI } from '@theia/core';
|
|
4
|
-
export declare const AskAIInputConfiguration: unique symbol;
|
|
5
|
-
export interface AskAIInputConfiguration extends AIChatInputConfiguration {
|
|
6
|
-
}
|
|
7
|
-
export declare const AskAIInputArgs: unique symbol;
|
|
8
|
-
export interface AskAIInputArgs {
|
|
9
|
-
onSubmit: (request: ChatRequest) => void;
|
|
10
|
-
onCancel: () => void;
|
|
11
|
-
}
|
|
12
|
-
export declare const AskAIInputFactory: unique symbol;
|
|
13
|
-
export type AskAIInputFactory = (args: AskAIInputArgs) => AskAIInputWidget;
|
|
14
|
-
/**
|
|
15
|
-
* React input widget for Ask AI functionality, extending the AIChatInputWidget.
|
|
16
|
-
*/
|
|
17
|
-
export declare class AskAIInputWidget extends AIChatInputWidget {
|
|
18
|
-
static ID: string;
|
|
19
|
-
protected readonly args: AskAIInputArgs | undefined;
|
|
20
|
-
protected readonly configuration: AskAIInputConfiguration | undefined;
|
|
21
|
-
protected readonly resourceId: string;
|
|
22
|
-
protected heightInLines: number;
|
|
23
|
-
protected init(): void;
|
|
24
|
-
protected getResourceUri(): URI;
|
|
25
|
-
protected handleSubmit(query: string): Promise<void>;
|
|
26
|
-
protected handleCancel(): void;
|
|
27
|
-
protected onEscape(): void;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=ask-ai-input-widget.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ask-ai-input-widget.d.ts","sourceRoot":"","sources":["../../src/browser/ask-ai-input-widget.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,WAAW,EAAoB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AAE9G,OAAO,EAAgB,GAAG,EAAE,MAAM,aAAa,CAAC;AAGhD,eAAO,MAAM,uBAAuB,eAAoC,CAAC;AACzE,MAAM,WAAW,uBAAwB,SAAQ,wBAAwB;CAAI;AAE7E,eAAO,MAAM,cAAc,eAA2B,CAAC;AACvD,MAAM,WAAW,cAAc;IAC3B,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB,eAA8B,CAAC;AAC7D,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,cAAc,KAAK,gBAAgB,CAAC;AAE3E;;GAEG;AACH,qBACa,gBAAiB,SAAQ,iBAAiB;IACnD,OAAuB,EAAE,SAAyB;IAGlD,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,CAAC;IAEpD,mBAC4B,aAAa,EAAE,uBAAuB,GAAG,SAAS,CAAC;IAE/E,SAAS,CAAC,QAAQ,CAAC,UAAU,SAAkB;IAC/C,UAAmB,aAAa,SAAK;cAGlB,IAAI,IAAI,IAAI;cAoBZ,cAAc,IAAI,GAAG;IAIxC,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUpD,SAAS,CAAC,YAAY,IAAI,IAAI;cAIX,QAAQ,IAAI,IAAI;CAGtC"}
|
|
@@ -1,94 +0,0 @@
|
|
|
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 AskAIInputWidget_1;
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.AskAIInputWidget = exports.AskAIInputFactory = exports.AskAIInputArgs = exports.AskAIInputConfiguration = void 0;
|
|
20
|
-
const tslib_1 = require("tslib");
|
|
21
|
-
const ai_chat_1 = require("@theia/ai-chat");
|
|
22
|
-
const chat_input_widget_1 = require("@theia/ai-chat-ui/lib/browser/chat-input-widget");
|
|
23
|
-
const chat_view_language_contribution_1 = require("@theia/ai-chat-ui/lib/browser/chat-view-language-contribution");
|
|
24
|
-
const core_1 = require("@theia/core");
|
|
25
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
26
|
-
exports.AskAIInputConfiguration = Symbol('AskAIInputConfiguration');
|
|
27
|
-
exports.AskAIInputArgs = Symbol('AskAIInputArgs');
|
|
28
|
-
exports.AskAIInputFactory = Symbol('AskAIInputFactory');
|
|
29
|
-
/**
|
|
30
|
-
* React input widget for Ask AI functionality, extending the AIChatInputWidget.
|
|
31
|
-
*/
|
|
32
|
-
let AskAIInputWidget = AskAIInputWidget_1 = class AskAIInputWidget extends chat_input_widget_1.AIChatInputWidget {
|
|
33
|
-
constructor() {
|
|
34
|
-
super(...arguments);
|
|
35
|
-
this.resourceId = (0, core_1.generateUuid)();
|
|
36
|
-
this.heightInLines = 3;
|
|
37
|
-
}
|
|
38
|
-
init() {
|
|
39
|
-
super.init();
|
|
40
|
-
this.id = AskAIInputWidget_1.ID;
|
|
41
|
-
const noOp = () => { };
|
|
42
|
-
// We need to set those values here, otherwise the widget will throw an error
|
|
43
|
-
this.onUnpin = noOp;
|
|
44
|
-
this.onCancel = noOp;
|
|
45
|
-
this.onDeleteChangeSet = noOp;
|
|
46
|
-
this.onDeleteChangeSetElement = noOp;
|
|
47
|
-
// Create a temporary chat model for the widget
|
|
48
|
-
this.chatModel = new ai_chat_1.MutableChatModel();
|
|
49
|
-
this.setEnabled(true);
|
|
50
|
-
this.onQuery = this.handleSubmit.bind(this);
|
|
51
|
-
this.onCancel = this.handleCancel.bind(this);
|
|
52
|
-
}
|
|
53
|
-
getResourceUri() {
|
|
54
|
-
return new core_1.URI(`ask-ai:/input-${this.resourceId}.${chat_view_language_contribution_1.CHAT_VIEW_LANGUAGE_EXTENSION}`);
|
|
55
|
-
}
|
|
56
|
-
handleSubmit(query) {
|
|
57
|
-
var _a;
|
|
58
|
-
const userInput = query.trim();
|
|
59
|
-
if (userInput) {
|
|
60
|
-
const request = { text: userInput, variables: this._chatModel.context.getVariables() };
|
|
61
|
-
(_a = this.args) === null || _a === void 0 ? void 0 : _a.onSubmit(request);
|
|
62
|
-
}
|
|
63
|
-
return Promise.resolve();
|
|
64
|
-
}
|
|
65
|
-
handleCancel() {
|
|
66
|
-
var _a;
|
|
67
|
-
(_a = this.args) === null || _a === void 0 ? void 0 : _a.onCancel();
|
|
68
|
-
}
|
|
69
|
-
onEscape() {
|
|
70
|
-
this.handleCancel();
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
exports.AskAIInputWidget = AskAIInputWidget;
|
|
74
|
-
AskAIInputWidget.ID = 'ask-ai-input-widget';
|
|
75
|
-
tslib_1.__decorate([
|
|
76
|
-
(0, inversify_1.inject)(exports.AskAIInputArgs),
|
|
77
|
-
(0, inversify_1.optional)(),
|
|
78
|
-
tslib_1.__metadata("design:type", Object)
|
|
79
|
-
], AskAIInputWidget.prototype, "args", void 0);
|
|
80
|
-
tslib_1.__decorate([
|
|
81
|
-
(0, inversify_1.inject)(exports.AskAIInputConfiguration),
|
|
82
|
-
(0, inversify_1.optional)(),
|
|
83
|
-
tslib_1.__metadata("design:type", Object)
|
|
84
|
-
], AskAIInputWidget.prototype, "configuration", void 0);
|
|
85
|
-
tslib_1.__decorate([
|
|
86
|
-
(0, inversify_1.postConstruct)(),
|
|
87
|
-
tslib_1.__metadata("design:type", Function),
|
|
88
|
-
tslib_1.__metadata("design:paramtypes", []),
|
|
89
|
-
tslib_1.__metadata("design:returntype", void 0)
|
|
90
|
-
], AskAIInputWidget.prototype, "init", null);
|
|
91
|
-
exports.AskAIInputWidget = AskAIInputWidget = AskAIInputWidget_1 = tslib_1.__decorate([
|
|
92
|
-
(0, inversify_1.injectable)()
|
|
93
|
-
], AskAIInputWidget);
|
|
94
|
-
//# sourceMappingURL=ask-ai-input-widget.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ask-ai-input-widget.js","sourceRoot":"","sources":["../../src/browser/ask-ai-input-widget.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,4CAA+D;AAC/D,uFAA8G;AAC9G,mHAA6G;AAC7G,sCAAgD;AAChD,4DAA2F;AAE9E,QAAA,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAG5D,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAM1C,QAAA,iBAAiB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAG7D;;GAEG;AAEI,IAAM,gBAAgB,wBAAtB,MAAM,gBAAiB,SAAQ,qCAAiB;IAAhD;;QASgB,eAAU,GAAG,IAAA,mBAAY,GAAE,CAAC;QAC5B,kBAAa,GAAG,CAAC,CAAC;IA4CzC,CAAC;IAzCsB,IAAI;QACnB,KAAK,CAAC,IAAI,EAAE,CAAC;QAEb,IAAI,CAAC,EAAE,GAAG,kBAAgB,CAAC,EAAE,CAAC;QAE9B,MAAM,IAAI,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC;QACvB,6EAA6E;QAC7E,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC9B,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC;QAErC,+CAA+C;QAC/C,IAAI,CAAC,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B"}
|
package/lib/browser/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAgBA,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC"}
|
package/lib/browser/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
const tslib_1 = require("tslib");
|
|
19
|
-
tslib_1.__exportStar(require("./ai-editor-command-contribution"), exports);
|
|
20
|
-
tslib_1.__exportStar(require("./ask-ai-input-widget"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
package/lib/browser/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.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,2EAAiD;AACjD,gEAAsC"}
|
package/lib/package.spec.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=package.spec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package.spec.d.ts","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":""}
|
package/lib/package.spec.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2024 EclipseSource GmbH and others.
|
|
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
|
-
/* note: this bogus test file is required so that
|
|
17
|
-
we are able to run mocha unit tests on this
|
|
18
|
-
package, without having any actual unit tests in it.
|
|
19
|
-
This way a coverage report will be generated,
|
|
20
|
-
showing 0% coverage, instead of no report.
|
|
21
|
-
This file can be removed once we have real unit
|
|
22
|
-
tests in place. */
|
|
23
|
-
describe('ai-editor package', () => {
|
|
24
|
-
it('support code coverage statistics', () => true);
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=package.spec.js.map
|
package/lib/package.spec.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package.spec.js","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,oDAAoD;AACpD,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;;;;;;qBAMqB;AAErB,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAE/B,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC"}
|