Skip to content

Commit d080cc2

Browse files
authored
Put all prompts under MIT license (#15159)
* Put all prompts under MIT license fixed #15158
1 parent 455f967 commit d080cc2

12 files changed

+464
-379
lines changed

LICENSE-MIT.txt

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
This license covers code in the repository with the MIT license header:
3+
4+
// *****************************************************************************
5+
// Copyright (C) {year, original author} and others.
6+
//
7+
// This file is licensed under the MIT License.
8+
// See LICENSE-MIT.txt in the project root for license information.
9+
// https://opensource.org/license/mit.
10+
//
11+
// SPDX-License-Identifier: MIT
12+
// *****************************************************************************
13+
14+
-----
15+
16+
MIT License
17+
18+
Permission is hereby granted, free of charge, to any person obtaining a copy
19+
of this software and associated documentation files (the "Software"), to deal
20+
in the Software without restriction, including without limitation the rights
21+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22+
copies of the Software, and to permit persons to whom the Software is
23+
furnished to do so, subject to the following conditions:
24+
25+
The above copyright notice and this permission notice shall be included in all
26+
copies or substantial portions of the Software.
27+
28+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34+
SOFTWARE.

packages/ai-code-completion/src/browser/code-completion-agent.ts

+2-30
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { generateUuid, ILogger, nls, ProgressService } from '@theia/core';
2222
import { inject, injectable, named } from '@theia/core/shared/inversify';
2323
import * as monaco from '@theia/monaco-editor-core';
2424
import { PREF_AI_INLINE_COMPLETION_MAX_CONTEXT_LINES } from './ai-code-completion-preference';
25+
import { codeCompletionPromptTemplates } from './code-completion-prompt-template';
2526
import { PreferenceService } from '@theia/core/lib/browser';
2627
import { CodeCompletionPostProcessor } from './code-completion-postprocessor';
2728

@@ -185,36 +186,7 @@ export class CodeCompletionAgentImpl implements CodeCompletionAgent {
185186
name = 'Code Completion';
186187
description =
187188
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;
218190
languageModelRequirements: LanguageModelRequirement[] = [
219191
{
220192
purpose: 'code-completion',
Original file line numberDiff line numberDiff line change
@@ -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+
];

packages/ai-ide/src/common/architect-prompt-template.ts

+8-12
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1+
/* eslint-disable @typescript-eslint/tslint/config */
12
// *****************************************************************************
2-
// Copyright (C) 2024 EclipseSource GmbH.
3+
// Copyright (C) 2025 EclipseSource GmbH and others.
34
//
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.
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.
78
//
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
9+
// SPDX-License-Identifier: MIT
1510
// *****************************************************************************
1611
import { PromptTemplate } from '@theia/ai-core/lib/common';
1712
import { GET_WORKSPACE_FILE_LIST_FUNCTION_ID, FILE_CONTENT_FUNCTION_ID, GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID } from './workspace-functions';
1813
import { CONTEXT_FILES_VARIABLE_ID } from './context-variables';
1914

2015
export const architectPromptTemplate = <PromptTemplate>{
2116
id: 'architect-system',
22-
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
17+
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
18+
Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
2319
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
2420
# Instructions
2521

packages/ai-ide/src/common/coder-replace-prompt-template.ts

+12-16
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1+
/* eslint-disable @typescript-eslint/tslint/config */
12
// *****************************************************************************
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-
*/
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
1710
// *****************************************************************************
1811

1912
import { PromptTemplate } from '@theia/ai-core/lib/common';
@@ -33,7 +26,10 @@ export const CODER_REPLACE_PROMPT_TEMPLATE_ID = 'coder-search-replace';
3326
export function getCoderReplacePromptTemplate(withSearchAndReplace: boolean = false): PromptTemplate {
3427
return {
3528
id: withSearchAndReplace ? CODER_REPLACE_PROMPT_TEMPLATE_ID : CODER_REWRITE_PROMPT_TEMPLATE_ID,
36-
template: `You are an AI assistant integrated into Theia IDE, designed to assist software developers with code tasks. You can interact with the code base and suggest changes.
29+
template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
30+
Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
31+
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
32+
You are an AI assistant integrated into Theia IDE, designed to assist software developers with code tasks. You can interact with the code base and suggest changes.
3733
3834
## Context Retrieval
3935
Use the following functions to interact with the workspace files if you require context:

0 commit comments

Comments
 (0)