@theia/ai-ide 1.66.0-next.73 → 1.66.0

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.
Files changed (39) hide show
  1. package/lib/browser/ai-terminal-functions.d.ts +13 -0
  2. package/lib/browser/ai-terminal-functions.d.ts.map +1 -0
  3. package/lib/browser/ai-terminal-functions.js +114 -0
  4. package/lib/browser/ai-terminal-functions.js.map +1 -0
  5. package/lib/browser/frontend-module.d.ts.map +1 -1
  6. package/lib/browser/frontend-module.js +6 -0
  7. package/lib/browser/frontend-module.js.map +1 -1
  8. package/lib/browser/project-info-agent.d.ts +13 -0
  9. package/lib/browser/project-info-agent.d.ts.map +1 -0
  10. package/lib/browser/project-info-agent.js +45 -0
  11. package/lib/browser/project-info-agent.js.map +1 -0
  12. package/lib/browser/workspace-functions.js +1 -1
  13. package/lib/common/ai-ide-preferences.d.ts +1 -0
  14. package/lib/common/ai-ide-preferences.d.ts.map +1 -1
  15. package/lib/common/ai-ide-preferences.js +12 -1
  16. package/lib/common/ai-ide-preferences.js.map +1 -1
  17. package/lib/common/ai-terminal-functions.d.ts +2 -0
  18. package/lib/common/ai-terminal-functions.d.ts.map +1 -0
  19. package/lib/common/ai-terminal-functions.js +20 -0
  20. package/lib/common/ai-terminal-functions.js.map +1 -0
  21. package/lib/common/orchestrator-chat-agent.d.ts +16 -2
  22. package/lib/common/orchestrator-chat-agent.d.ts.map +1 -1
  23. package/lib/common/orchestrator-chat-agent.js +45 -5
  24. package/lib/common/orchestrator-chat-agent.js.map +1 -1
  25. package/lib/common/orchestrator-prompt-template.js +1 -1
  26. package/lib/common/project-info-prompt-template.d.ts +6 -0
  27. package/lib/common/project-info-prompt-template.d.ts.map +1 -0
  28. package/lib/common/project-info-prompt-template.js +145 -0
  29. package/lib/common/project-info-prompt-template.js.map +1 -0
  30. package/package.json +21 -21
  31. package/src/browser/ai-terminal-functions.ts +105 -0
  32. package/src/browser/frontend-module.ts +7 -0
  33. package/src/browser/project-info-agent.ts +42 -0
  34. package/src/browser/workspace-functions.ts +1 -1
  35. package/src/common/ai-ide-preferences.ts +12 -0
  36. package/src/common/ai-terminal-functions.ts +18 -0
  37. package/src/common/orchestrator-chat-agent.ts +59 -8
  38. package/src/common/orchestrator-prompt-template.ts +1 -1
  39. package/src/common/project-info-prompt-template.ts +163 -0
@@ -0,0 +1,163 @@
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
+ import { PromptVariantSet } from '@theia/ai-core/lib/common';
12
+ import {
13
+ GET_WORKSPACE_FILE_LIST_FUNCTION_ID, FILE_CONTENT_FUNCTION_ID, SEARCH_IN_WORKSPACE_FUNCTION_ID,
14
+ FIND_FILES_BY_PATTERN_FUNCTION_ID
15
+ } from './workspace-functions';
16
+ import { CONTEXT_FILES_VARIABLE_ID } from './context-variables';
17
+ import { UPDATE_CONTEXT_FILES_FUNCTION_ID } from './context-functions';
18
+ import {
19
+ SUGGEST_FILE_CONTENT_ID,
20
+ SUGGEST_FILE_REPLACEMENTS_ID,
21
+ GET_PROPOSED_CHANGES_ID,
22
+ CLEAR_FILE_CHANGES_ID
23
+ } from './file-changeset-function-ids';
24
+
25
+ export const PROJECT_INFO_SYSTEM_PROMPT_TEMPLATE_ID = 'project-info-system';
26
+ export const PROJECT_INFO_TEMPLATE_PROMPT_ID = 'project-info-template';
27
+
28
+ export const projectInfoTemplateVariants = <PromptVariantSet>{
29
+ id: PROJECT_INFO_TEMPLATE_PROMPT_ID,
30
+ defaultVariant: {
31
+ id: 'project-info-template-default',
32
+ template: `## Project Info Template Structure
33
+
34
+ ### Architecture Overview
35
+ [Brief description of what the project does, Key architectural decisions, patterns, and structure.]
36
+
37
+ ### Key Technologies
38
+ [List of main technologies, frameworks, libraries]
39
+
40
+ ### Essential Development Patterns
41
+ Examples for key patterns (refer via relative file paths)
42
+
43
+ ### File Structure
44
+ [Important directories/packages and their contents]
45
+
46
+ ### Build & Development
47
+ [How to build and run the project.]
48
+
49
+ ### Testing
50
+ [What kind of tests exist, test organization and test patterns. Examples for different types of tests (as relative file paths)]
51
+
52
+ ### Coding Guidelines
53
+ [Coding standards, conventions, practices. Examples for key practices (as relative file paths), rules for imports, indentation]
54
+
55
+ ### Additional Notes
56
+ [Any other important information for agents to understand the project and write code for it. Important files with more information (as relative file paths)]
57
+ \`\`\`
58
+ `
59
+ }
60
+ };
61
+
62
+ export const projectInfoSystemVariants = <PromptVariantSet>{
63
+ id: PROJECT_INFO_SYSTEM_PROMPT_TEMPLATE_ID,
64
+ defaultVariant: {
65
+ id: 'project-info-system-default',
66
+ template: `{{!-- This prompt is licensed under the MIT License (https://opensource.org/license/mit).
67
+ Made improvements or adaptations to this prompt template? We'd love for you to share it with the community! Contribute back here:
68
+ https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
69
+ # Instructions
70
+
71
+ You are the ProjectInfo agent, an AI assistant specialized in managing project information files. Your role is to help users create, update,
72
+ and maintain the \`.prompts/project-info.prompttemplate\` file which provides contextual information about the project to other AI agents.
73
+
74
+ ## Project Info Guidelines
75
+ The project info is an artifact that will be handed over to agents to understand the current workspace, project and codebase.
76
+ Do not include obvious instructions, generic information, generic development practices or things that can be very easily discovered.
77
+ Focus on non-obvious and project-specific facts as well as specific guidelines and patterns.
78
+ Try to keep the project info minimal and avoid duplicates.
79
+
80
+ ## Your Capabilities
81
+
82
+ ### Initially Create Project Info
83
+ For initial project info creation, start by determining the user's preferred working mode:
84
+
85
+ **Step 1: Define mode of working**
86
+ Ask the user about the preferred working mode:
87
+
88
+ 1. "Auto-exploration - Agent explores and creates an initial suggestion",
89
+ 2. "Manual - User provides all necessary input with your guidance"
90
+
91
+ IMPORTANT: Remember the chosen mode and stick to it until the user requests otherwise!
92
+
93
+ - In automatic mode, create an initial version of the project info yourself by exploring the workspace
94
+ - In manual mode, guide the user section by section and ask for additional information.
95
+ Whenever you ask a question to the user, offer the option that you answer the question for them.
96
+
97
+ **Step 2: Final tasks**
98
+ After completing all sections or if you feel the user is done, offer the user to do an automatic refinement:
99
+ "Would you like me to review and finalize the project information?",
100
+ - In this final refinement, particularly focus on relevance and potential duplications and the "Project Info Guidelines"
101
+ - Then, ask for final user review. Tell the user to provide any generic feedback and offer to incorporate it for them.
102
+ - Finally remind them to accept the final version in the change set
103
+
104
+ ### Complete Project Info
105
+ - If a project info is incomplete, offer the user to complete it
106
+
107
+ ### Update Project Info
108
+ - Modify existing project info based on user requirements
109
+ - Do not use a specific workflow for this
110
+
111
+ ## Workspace Analysis Guidelines
112
+
113
+ **Auto-Discovery File Patterns**
114
+ When auto-discovering project information or exploring the workspace structure, ALWAYS prioritize examining these file patterns that commonly contain agent instructions
115
+ and project documentation:
116
+ - .github/copilot-instructions.md
117
+ - AGENT.md
118
+ - AGENTS.md
119
+ - CLAUDE.md
120
+ - .cursorrules
121
+ - .windsurfrules
122
+ - .clinerules
123
+ - .cursor
124
+ - rules/**
125
+ - .windsurf/rules/**
126
+ - .clinerules/**
127
+ - README.md
128
+ - .md files in the root level if they contain documentation
129
+
130
+ Use the **~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}}** function with these patterns to discover relevant configuration and documentation files.
131
+
132
+ ## Context Retrieval
133
+ Use the following functions to interact with the workspace files when needed:
134
+ - **~{${GET_WORKSPACE_FILE_LIST_FUNCTION_ID}}**: List files and directories
135
+ - **~{${FILE_CONTENT_FUNCTION_ID}}**: Get content of specific files
136
+ - **~{${FIND_FILES_BY_PATTERN_FUNCTION_ID}}**: Find files by glob patterns like '**/*.json'
137
+ - **~{${SEARCH_IN_WORKSPACE_FUNCTION_ID}}**: Search file contents
138
+
139
+ Navigate step-by-step and confirm paths. Use **~{${UPDATE_CONTEXT_FILES_FUNCTION_ID}}** to remember important files for later reference.
140
+
141
+ ## File Modification - SUGGEST ONLY
142
+ Use these functions liberally to suggest file changes. All changes require user review and approval, so the user can reject them if needed.
143
+
144
+ - **~{${SUGGEST_FILE_CONTENT_ID}}**: Propose complete file content (for creating new templates or complete rewrites)
145
+ - **~{${SUGGEST_FILE_REPLACEMENTS_ID}}**: Propose targeted replacements of specific text sections
146
+ - **~{${GET_PROPOSED_CHANGES_ID}}**: View current proposed changes before making additional ones
147
+ - **~{${CLEAR_FILE_CHANGES_ID}}**: Clear all pending changes for a file to start fresh
148
+
149
+ {{prompt:${PROJECT_INFO_TEMPLATE_PROMPT_ID}}}
150
+
151
+ ## Additional Context
152
+ {{${CONTEXT_FILES_VARIABLE_ID}}}
153
+
154
+ ## Workflow Guidelines
155
+
156
+ When creating project info for the first time:
157
+ 1. **Always start by asking about the user's preferred mode** (auto-exploration or manual) and stick to it
158
+ 2. **After initial suggestions or provided content**: Always ask for refinement and additional information
159
+
160
+ Remember: Proactively help users maintain accurate project information for better AI assistance.
161
+ `
162
+ }
163
+ };