@theia/ai-code-completion 1.59.0 → 1.60.0-next.43
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/code-completion-agent.d.ts.map +1 -1
- package/lib/browser/code-completion-agent.js +2 -30
- package/lib/browser/code-completion-agent.js.map +1 -1
- package/lib/browser/code-completion-prompt-template.d.ts +3 -0
- package/lib/browser/code-completion-prompt-template.d.ts.map +1 -0
- package/lib/browser/code-completion-prompt-template.js +46 -0
- package/lib/browser/code-completion-prompt-template.js.map +1 -0
- package/package.json +7 -7
- package/src/browser/code-completion-agent.ts +2 -30
- package/src/browser/code-completion-prompt-template.ts +45 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-completion-agent.d.ts","sourceRoot":"","sources":["../../src/browser/code-completion-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,KAAK,EAAE,sBAAsB,EAAE,6BAA6B,EAC5D,qBAAqB,EAAwB,wBAAwB,EAAE,aAAa,EAAE,cAAc,EACvG,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAgB,OAAO,EAAO,eAAe,EAAE,MAAM,aAAa,CAAC;AAE1E,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"code-completion-agent.d.ts","sourceRoot":"","sources":["../../src/browser/code-completion-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,KAAK,EAAE,sBAAsB,EAAE,6BAA6B,EAC5D,qBAAqB,EAAwB,wBAAwB,EAAE,aAAa,EAAE,cAAc,EACvG,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAgB,OAAO,EAAO,eAAe,EAAE,MAAM,aAAa,CAAC;AAE1E,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAGpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAE9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sBAAsB,EAAE,CAKvD;IACF,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACxC"}
|
|
@@ -21,6 +21,7 @@ const common_1 = require("@theia/ai-core/lib/common");
|
|
|
21
21
|
const core_1 = require("@theia/core");
|
|
22
22
|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
23
23
|
const ai_code_completion_preference_1 = require("./ai-code-completion-preference");
|
|
24
|
+
const code_completion_prompt_template_1 = require("./code-completion-prompt-template");
|
|
24
25
|
const browser_1 = require("@theia/core/lib/browser");
|
|
25
26
|
const code_completion_postprocessor_1 = require("./code-completion-postprocessor");
|
|
26
27
|
exports.CodeCompletionAgent = Symbol('CodeCompletionAgent');
|
|
@@ -29,36 +30,7 @@ let CodeCompletionAgentImpl = class CodeCompletionAgentImpl {
|
|
|
29
30
|
this.id = 'Code Completion';
|
|
30
31
|
this.name = 'Code Completion';
|
|
31
32
|
this.description = core_1.nls.localize('theia/ai/completion/agent/description', 'This agent provides inline code completion in the code editor in the Theia IDE.');
|
|
32
|
-
this.promptTemplates =
|
|
33
|
-
{
|
|
34
|
-
id: 'code-completion-prompt-previous',
|
|
35
|
-
variantOf: 'code-completion-prompt',
|
|
36
|
-
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
37
|
-
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
38
|
-
You are a code completion agent. The current file you have to complete is named {{file}}.
|
|
39
|
-
The language of the file is {{language}}. Return your result as plain text without markdown formatting.
|
|
40
|
-
Finish the following code snippet.
|
|
41
|
-
|
|
42
|
-
{{prefix}}[[MARKER]]{{suffix}}
|
|
43
|
-
|
|
44
|
-
Only return the exact replacement for [[MARKER]] to complete the snippet.`
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
id: 'code-completion-prompt',
|
|
48
|
-
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
49
|
-
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
50
|
-
## Code snippet
|
|
51
|
-
\`\`\`
|
|
52
|
-
{{ prefix }}[[MARKER]]{{ suffix }}
|
|
53
|
-
\`\`\`
|
|
54
|
-
|
|
55
|
-
## Meta Data
|
|
56
|
-
- File: {{file}}
|
|
57
|
-
- Language: {{language}}
|
|
58
|
-
|
|
59
|
-
Replace [[MARKER]] with the exact code to complete the code snippet. Return only the replacement of [[MAKRER]] as plain text.`,
|
|
60
|
-
},
|
|
61
|
-
];
|
|
33
|
+
this.promptTemplates = code_completion_prompt_template_1.codeCompletionPromptTemplates;
|
|
62
34
|
this.languageModelRequirements = [
|
|
63
35
|
{
|
|
64
36
|
purpose: 'code-completion',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-completion-agent.js","sourceRoot":"","sources":["../../src/browser/code-completion-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,sDAGmC;AACnC,sCAA0E;AAC1E,4DAAyE;AAEzE,mFAA8F;AAC9F,qDAA4D;AAC5D,mFAA8E;AAEjE,QAAA,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAO1D,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAA7B;QAqJH,OAAE,GAAG,iBAAiB,CAAC;QACvB,SAAI,GAAG,iBAAiB,CAAC;QACzB,gBAAW,GACP,UAAG,CAAC,QAAQ,CAAC,uCAAuC,EAAE,iFAAiF,CAAC,CAAC;QAC7I,oBAAe,GAAqB
|
|
1
|
+
{"version":3,"file":"code-completion-agent.js","sourceRoot":"","sources":["../../src/browser/code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Aa,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;YAEnF,OAAO;gBACH,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,2BAA2B,EAAE,CAAC;gBACpD,sBAAsB,EAAE,IAAI;aAC/B,CAAC;QACN,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,IAAI,CAAC,KAAK,CAAC,uBAAuB,EAAE,CAAC;gBACjC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YAChC,CAAC;QACL,CAAC;gBACO,CAAC;YACL,QAAQ,CAAC,MAAM,EAAE,CAAC;QACtB,CAAC;IACL,CAAC;CA4CJ,CAAA;AAzKY,0DAAuB;AAiItB;IAFT,IAAA,kBAAM,EAAC,cAAO,CAAC;IACf,IAAA,iBAAK,EAAC,uBAAuB,CAAC;;uDACL;AAGhB;IADT,IAAA,kBAAM,EAAC,8BAAqB,CAAC;;sEACyB;AAG7C;IADT,IAAA,kBAAM,EAAC,sBAAa,CAAC;;8DACiB;AAG7B;IADT,IAAA,kBAAM,EAAC,sCAA6B,CAAC;;iEACoB;AAGhD;IADT,IAAA,kBAAM,EAAC,sBAAe,CAAC;sCACG,sBAAe;gEAAC;AAGjC;IADT,IAAA,kBAAM,EAAC,2BAAiB,CAAC;;4DACe;AAG/B;IADT,IAAA,kBAAM,EAAC,2DAA2B,CAAC;;8DACiB;kCAnJ5C,uBAAuB;IADnC,IAAA,sBAAU,GAAE;GACA,uBAAuB,CAyKnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-completion-prompt-template.d.ts","sourceRoot":"","sources":["../../src/browser/code-completion-prompt-template.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,eAAO,MAAM,6BAA6B,EAAE,cAAc,EA+BzD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/tslint/config */
|
|
3
|
+
// *****************************************************************************
|
|
4
|
+
// Copyright (C) 2025 EclipseSource GmbH and others.
|
|
5
|
+
//
|
|
6
|
+
// This file is licensed under the MIT License.
|
|
7
|
+
// See LICENSE-MIT.txt in the project root for license information.
|
|
8
|
+
// https://opensource.org/license/mit.
|
|
9
|
+
//
|
|
10
|
+
// SPDX-License-Identifier: MIT
|
|
11
|
+
// *****************************************************************************
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.codeCompletionPromptTemplates = void 0;
|
|
14
|
+
exports.codeCompletionPromptTemplates = [
|
|
15
|
+
{
|
|
16
|
+
id: 'code-completion-prompt-previous',
|
|
17
|
+
variantOf: 'code-completion-prompt',
|
|
18
|
+
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
19
|
+
Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
20
|
+
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
21
|
+
You are a code completion agent. The current file you have to complete is named {{file}}.
|
|
22
|
+
The language of the file is {{language}}. Return your result as plain text without markdown formatting.
|
|
23
|
+
Finish the following code snippet.
|
|
24
|
+
|
|
25
|
+
{{prefix}}[[MARKER]]{{suffix}}
|
|
26
|
+
|
|
27
|
+
Only return the exact replacement for [[MARKER]] to complete the snippet.`
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'code-completion-prompt',
|
|
31
|
+
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
32
|
+
Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
33
|
+
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
34
|
+
## Code snippet
|
|
35
|
+
\`\`\`
|
|
36
|
+
{{ prefix }}[[MARKER]]{{ suffix }}
|
|
37
|
+
\`\`\`
|
|
38
|
+
|
|
39
|
+
## Meta Data
|
|
40
|
+
- File: {{file}}
|
|
41
|
+
- Language: {{language}}
|
|
42
|
+
|
|
43
|
+
Replace [[MARKER]] with the exact code to complete the code snippet. Return only the replacement of [[MAKRER]] as plain text.`,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
//# sourceMappingURL=code-completion-prompt-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-completion-prompt-template.js","sourceRoot":"","sources":["../../src/browser/code-completion-prompt-template.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,+CAA+C;AAC/C,mEAAmE;AACnE,sCAAsC;AACtC,EAAE;AACF,+BAA+B;AAC/B,gFAAgF;;;AAInE,QAAA,6BAA6B,GAAqB;IAC3D;QACI,EAAE,EAAE,iCAAiC;QACrC,SAAS,EAAE,wBAAwB;QACnC,QAAQ,EAAE;;;;;;;;;0EASwD;KACrE;IACD;QACI,EAAE,EAAE,wBAAwB;QAC5B,QAAQ,EAAE;;;;;;;;;;;;8HAY4G;KACzH;CACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/ai-code-completion",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.60.0-next.43+2a13720d2",
|
|
4
4
|
"description": "Theia - AI Core",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/ai-core": "1.
|
|
7
|
-
"@theia/core": "1.
|
|
8
|
-
"@theia/filesystem": "1.
|
|
6
|
+
"@theia/ai-core": "1.60.0-next.43+2a13720d2",
|
|
7
|
+
"@theia/core": "1.60.0-next.43+2a13720d2",
|
|
8
|
+
"@theia/filesystem": "1.60.0-next.43+2a13720d2",
|
|
9
9
|
"@theia/monaco-editor-core": "1.96.302",
|
|
10
|
-
"@theia/output": "1.
|
|
11
|
-
"@theia/workspace": "1.
|
|
10
|
+
"@theia/output": "1.60.0-next.43+2a13720d2",
|
|
11
|
+
"@theia/workspace": "1.60.0-next.43+2a13720d2",
|
|
12
12
|
"minimatch": "^5.1.0",
|
|
13
13
|
"tslib": "^2.6.2"
|
|
14
14
|
},
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"nyc": {
|
|
52
52
|
"extends": "../../configs/nyc.json"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "2a13720d2d41d8ae6ee4e34cd2dee1c656a18018"
|
|
55
55
|
}
|
|
@@ -22,6 +22,7 @@ import { generateUuid, ILogger, nls, ProgressService } from '@theia/core';
|
|
|
22
22
|
import { inject, injectable, named } from '@theia/core/shared/inversify';
|
|
23
23
|
import * as monaco from '@theia/monaco-editor-core';
|
|
24
24
|
import { PREF_AI_INLINE_COMPLETION_MAX_CONTEXT_LINES } from './ai-code-completion-preference';
|
|
25
|
+
import { codeCompletionPromptTemplates } from './code-completion-prompt-template';
|
|
25
26
|
import { PreferenceService } from '@theia/core/lib/browser';
|
|
26
27
|
import { CodeCompletionPostProcessor } from './code-completion-postprocessor';
|
|
27
28
|
|
|
@@ -185,36 +186,7 @@ export class CodeCompletionAgentImpl implements CodeCompletionAgent {
|
|
|
185
186
|
name = 'Code Completion';
|
|
186
187
|
description =
|
|
187
188
|
nls.localize('theia/ai/completion/agent/description', 'This agent provides inline code completion in the code editor in the Theia IDE.');
|
|
188
|
-
promptTemplates: PromptTemplate[] =
|
|
189
|
-
{
|
|
190
|
-
id: 'code-completion-prompt-previous',
|
|
191
|
-
variantOf: 'code-completion-prompt',
|
|
192
|
-
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
193
|
-
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
194
|
-
You are a code completion agent. The current file you have to complete is named {{file}}.
|
|
195
|
-
The language of the file is {{language}}. Return your result as plain text without markdown formatting.
|
|
196
|
-
Finish the following code snippet.
|
|
197
|
-
|
|
198
|
-
{{prefix}}[[MARKER]]{{suffix}}
|
|
199
|
-
|
|
200
|
-
Only return the exact replacement for [[MARKER]] to complete the snippet.`
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
id: 'code-completion-prompt',
|
|
204
|
-
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
205
|
-
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
206
|
-
## Code snippet
|
|
207
|
-
\`\`\`
|
|
208
|
-
{{ prefix }}[[MARKER]]{{ suffix }}
|
|
209
|
-
\`\`\`
|
|
210
|
-
|
|
211
|
-
## Meta Data
|
|
212
|
-
- File: {{file}}
|
|
213
|
-
- Language: {{language}}
|
|
214
|
-
|
|
215
|
-
Replace [[MARKER]] with the exact code to complete the code snippet. Return only the replacement of [[MAKRER]] as plain text.`,
|
|
216
|
-
},
|
|
217
|
-
];
|
|
189
|
+
promptTemplates: PromptTemplate[] = codeCompletionPromptTemplates;
|
|
218
190
|
languageModelRequirements: LanguageModelRequirement[] = [
|
|
219
191
|
{
|
|
220
192
|
purpose: 'code-completion',
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/tslint/config */
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2025 EclipseSource GmbH and others.
|
|
4
|
+
//
|
|
5
|
+
// This file is licensed under the MIT License.
|
|
6
|
+
// See LICENSE-MIT.txt in the project root for license information.
|
|
7
|
+
// https://opensource.org/license/mit.
|
|
8
|
+
//
|
|
9
|
+
// SPDX-License-Identifier: MIT
|
|
10
|
+
// *****************************************************************************
|
|
11
|
+
|
|
12
|
+
import { PromptTemplate } from '@theia/ai-core/lib/common';
|
|
13
|
+
|
|
14
|
+
export const codeCompletionPromptTemplates: PromptTemplate[] = [
|
|
15
|
+
{
|
|
16
|
+
id: 'code-completion-prompt-previous',
|
|
17
|
+
variantOf: 'code-completion-prompt',
|
|
18
|
+
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
19
|
+
Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
20
|
+
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
21
|
+
You are a code completion agent. The current file you have to complete is named {{file}}.
|
|
22
|
+
The language of the file is {{language}}. Return your result as plain text without markdown formatting.
|
|
23
|
+
Finish the following code snippet.
|
|
24
|
+
|
|
25
|
+
{{prefix}}[[MARKER]]{{suffix}}
|
|
26
|
+
|
|
27
|
+
Only return the exact replacement for [[MARKER]] to complete the snippet.`
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'code-completion-prompt',
|
|
31
|
+
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
|
|
32
|
+
Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
33
|
+
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
34
|
+
## Code snippet
|
|
35
|
+
\`\`\`
|
|
36
|
+
{{ prefix }}[[MARKER]]{{ suffix }}
|
|
37
|
+
\`\`\`
|
|
38
|
+
|
|
39
|
+
## Meta Data
|
|
40
|
+
- File: {{file}}
|
|
41
|
+
- Language: {{language}}
|
|
42
|
+
|
|
43
|
+
Replace [[MARKER]] with the exact code to complete the code snippet. Return only the replacement of [[MAKRER]] as plain text.`,
|
|
44
|
+
},
|
|
45
|
+
];
|