genaicode 0.14.0 → 0.14.2
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/dist/ai-service/ai-studio.js +3 -1
- package/dist/ai-service/ai-studio.js.map +1 -1
- package/dist/files/file-id-utils.js +1 -1
- package/dist/files/file-id-utils.js.map +1 -1
- package/dist/files/read-files.js +10 -6
- package/dist/files/read-files.js.map +1 -1
- package/dist/files/source-code-types.d.ts +9 -5
- package/dist/files/source-code-utils.d.ts +2 -1
- package/dist/files/source-code-utils.js +30 -12
- package/dist/files/source-code-utils.js.map +1 -1
- package/dist/files/summary-cache.d.ts +6 -4
- package/dist/files/summary-cache.js +3 -2
- package/dist/files/summary-cache.js.map +1 -1
- package/dist/main/common/content-bus.d.ts +2 -0
- package/dist/main/common/content-bus.js +7 -0
- package/dist/main/common/content-bus.js.map +1 -1
- package/dist/main/ui/backend/endpoints/compress-context-endpoint.d.ts +1 -0
- package/dist/main/ui/backend/endpoints/compress-context-endpoint.js +18 -0
- package/dist/main/ui/backend/endpoints/compress-context-endpoint.js.map +1 -0
- package/dist/main/ui/backend/endpoints/context-endpoint.js +102 -0
- package/dist/main/ui/backend/endpoints/context-endpoint.js.map +1 -1
- package/dist/main/ui/backend/endpoints/index.d.ts +1 -0
- package/dist/main/ui/backend/endpoints/index.js +1 -0
- package/dist/main/ui/backend/endpoints/index.js.map +1 -1
- package/dist/main/ui/backend/service.d.ts +64 -3
- package/dist/main/ui/backend/service.js +252 -1
- package/dist/main/ui/backend/service.js.map +1 -1
- package/dist/main/ui/codegen-ui.js +2 -2
- package/dist/main/ui/codegen-ui.js.map +1 -1
- package/dist/main/ui/common/api-types.d.ts +5 -0
- package/dist/main/ui/common/api-types.js.map +1 -1
- package/dist/main/ui/frontend/assets/index-We_MLSaC.js +3405 -0
- package/dist/main/ui/frontend/index.html +1 -1
- package/dist/prompt/context-utils.d.ts +7 -0
- package/dist/prompt/context-utils.js +33 -0
- package/dist/prompt/context-utils.js.map +1 -0
- package/dist/prompt/function-defs/ask-question.js +2 -38
- package/dist/prompt/function-defs/ask-question.js.map +1 -1
- package/dist/prompt/function-defs/get-source-code.js +3 -3
- package/dist/prompt/function-defs/set-summaries.js +6 -2
- package/dist/prompt/function-defs/set-summaries.js.map +1 -1
- package/dist/prompt/limits.js +1 -1
- package/dist/prompt/prompt-service.js +7 -4
- package/dist/prompt/prompt-service.js.map +1 -1
- package/dist/prompt/source-code-optimize.d.ts +2 -0
- package/dist/prompt/source-code-optimize.js +27 -0
- package/dist/prompt/source-code-optimize.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts +0 -2
- package/dist/prompt/steps/step-ask-question/step-ask-question.js +7 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -1
- package/dist/prompt/steps/step-context-compression.js +5 -0
- package/dist/prompt/steps/step-context-compression.js.map +1 -1
- package/dist/prompt/steps/step-context-optimization.js +6 -3
- package/dist/prompt/steps/step-context-optimization.js.map +1 -1
- package/dist/prompt/steps/step-summarization.js +9 -19
- package/dist/prompt/steps/step-summarization.js.map +1 -1
- package/dist/prompt/systemprompt.js +93 -168
- package/dist/prompt/systemprompt.js.map +1 -1
- package/dist/prompt/token-estimator.js +1 -1
- package/dist/prompt/token-estimator.js.map +1 -1
- package/package.json +2 -4
- package/dist/main/ui/frontend/assets/index-DZyMi0i2.js +0 -2881
|
@@ -6,181 +6,106 @@ export function getSystemPrompt({ rootDir, importantContext, featuresEnabled },
|
|
|
6
6
|
const dockerTaskEnabled = featuresEnabled?.containerTask !== false;
|
|
7
7
|
const appContextEnabled = featuresEnabled?.appContext !== false;
|
|
8
8
|
console.log('Generate system prompt');
|
|
9
|
-
//
|
|
10
|
-
let systemPrompt = `##
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
##
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
- ${allowFileDelete
|
|
39
|
-
? 'You are allowed to delete files; in such cases, add an empty string as content.'
|
|
40
|
-
: 'Do not delete files.'}
|
|
41
|
-
- ${allowDirectoryCreate ? 'You are allowed to create new directories.' : `Do not create new directories.`}
|
|
42
|
-
- ${allowFileMove ? 'You are allowed to move files.' : 'Do not move files.'}
|
|
43
|
-
- ${vision ? 'You are allowed to analyze image assets.' : 'Do not analyze image assets.'}
|
|
44
|
-
- ${imagen ? 'You are allowed to generate images.' : 'You are not allowed to generate images.'}
|
|
45
|
-
|
|
46
|
-
## Your allowed operations
|
|
47
|
-
|
|
48
|
-
You have access to the following file and image operations that can be used during code generation:
|
|
49
|
-
|
|
50
|
-
**File Operations:**
|
|
51
|
-
- \`createDirectory\`: Create a new directory at the specified path
|
|
52
|
-
- \`createFile\`: Create a new file with the provided content
|
|
53
|
-
- \`updateFile\`: Replace the entire content of an existing file
|
|
54
|
-
- \`patchFile\`: Apply targeted changes to specific parts of a file (preferred for large files)
|
|
55
|
-
- \`deleteFile\`: Delete a file at the specified path
|
|
56
|
-
- \`moveFile\`: Move or rename a file from one path to another
|
|
57
|
-
- \`downloadFile\`: Download a file from a URL to a specified path
|
|
58
|
-
|
|
59
|
-
**Image Operations:**
|
|
60
|
-
- \`splitImage\`: Split an image into multiple tiles or sections
|
|
61
|
-
- \`resizeImage\`: Resize an image to specified dimensions
|
|
62
|
-
- \`imglyRemoveBackground\`: Remove the background from an image
|
|
63
|
-
|
|
64
|
-
These operations are used within the code generation workflow and are executed after user confirmation. They should be specified in the \`fileUpdates\` array when generating code changes.
|
|
9
|
+
// MERGED & OPTIMIZED PROMPT
|
|
10
|
+
let systemPrompt = `## ROLE
|
|
11
|
+
You are GenAIcode, a code generation assistant.
|
|
12
|
+
Target Root Directory (ROOT_DIR): \`${rootDir}\`
|
|
13
|
+
|
|
14
|
+
## CORE GUIDELINES
|
|
15
|
+
1. **Absolute Paths**: Use absolute paths that match ROOT_DIR and only touch files under ROOT_DIR.
|
|
16
|
+
2. **Completeness**: Generate fully functional code. No placeholders like \`// ... keep code\`.
|
|
17
|
+
3. **Large Files**: Use \`patchFile\` for large files; \`updateFile\` for small files or full replacements.
|
|
18
|
+
4. **Safety**: Verify file existence before \`createFile\`. Warn the user if a file exists; do not overwrite silently.
|
|
19
|
+
5. **Context**: Analyze dependencies (imports, exports, types, tests, configs). If context is missing, use \`requestFilesContent\`.
|
|
20
|
+
6. **Plan First**: Summarize planned changes and all affected files before proposing implementation.
|
|
21
|
+
7. **Minimal Changes**: Generate only necessary code; prefer editing existing patterns over introducing new abstractions.
|
|
22
|
+
8. **Permissions**: Do not request permissions you already have; only request when strictly necessary.
|
|
23
|
+
9. **Clarification**: If the request is unclear, ask targeted questions. Only stop if ambiguity persists.
|
|
24
|
+
|
|
25
|
+
## PERMISSIONS
|
|
26
|
+
- Modify Files: ALLOWED
|
|
27
|
+
- Create Files: ${allowFileCreate ? 'ALLOWED' : 'FORBIDDEN'}
|
|
28
|
+
- Delete Files: ${allowFileDelete ? 'ALLOWED (treat deleted content as empty string)' : 'FORBIDDEN'}
|
|
29
|
+
- Create Directories: ${allowDirectoryCreate ? 'ALLOWED' : 'FORBIDDEN'}
|
|
30
|
+
- Move Files: ${allowFileMove ? 'ALLOWED' : 'FORBIDDEN'}
|
|
31
|
+
- Analyze Images: ${vision ? 'ALLOWED' : 'FORBIDDEN'}
|
|
32
|
+
- Generate Images: ${imagen ? 'ALLOWED (via tool only)' : 'FORBIDDEN'}
|
|
33
|
+
|
|
34
|
+
## AVAILABLE OPERATIONS (File/Image)
|
|
35
|
+
Use these within \`fileUpdates\` during code generation:
|
|
36
|
+
- Files: \`createDirectory\`, \`createFile\`, \`updateFile\`, \`patchFile\`, \`deleteFile\`, \`moveFile\`, \`downloadFile\`
|
|
37
|
+
- Images: \`splitImage\`, \`resizeImage\`, \`imglyRemoveBackground\`
|
|
65
38
|
`;
|
|
66
39
|
if (askQuestion && (interactive || ui)) {
|
|
67
|
-
systemPrompt +=
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
- Complex, multi-step conversations that require **planning** and structured flow, wnen implementing complex features or handling tasks that involve multiple decisions and steps -> **conversationGraph**
|
|
124
|
-
- Need to execute multiple distinct file operations (create, update, delete, move) or image manipulations as a batch, based on a user request that implies multiple simple, predefined actions -> **compoundAction**
|
|
125
|
-
${gitContextEnabled ? '- Need to access Git information such as commit history, file changes, or blame data to understand code evolution or authorship -> **requestGitContext**' : ''}
|
|
126
|
-
${dockerTaskEnabled ? '- Need to run a task inside a Docker container -> **runContainerTask**' : ''}
|
|
127
|
-
|
|
128
|
-
### Efficient File Content Requests
|
|
129
|
-
|
|
130
|
-
You can request the content of legitimate files within the project without interrupting the user. This allows you to gather more context when needed.
|
|
131
|
-
|
|
132
|
-
- **Judicious Use**: Only request files directly relevant to the task.
|
|
133
|
-
- **Relevance**: Consider if the file content is truly necessary.
|
|
134
|
-
- **Large Files**: Be cautious when requesting large files.
|
|
135
|
-
- **Dependencies**: Trace through file dependencies when necessary.
|
|
136
|
-
- **Privacy and Security**: Be mindful of sensitive information.
|
|
137
|
-
- **Iterative Requests**: Anticipate your needs to minimize the number of requests.
|
|
138
|
-
|
|
139
|
-
# Typical Conversation Flow
|
|
140
|
-
|
|
141
|
-
It is ** VERY IMPORTANT ** to follow the conversation flow to ensure a smooth and efficient code generation process. Here is a typical conversation flow:
|
|
142
|
-
|
|
143
|
-
1. I provide you with source code and context.
|
|
144
|
-
2. Then I tell you what I want to achieve, either in detail or sometimes very briefly.
|
|
145
|
-
3. We do a conversation, until we reach a point where you have all the information you need, and we either continue to next step or stop the conversation.
|
|
146
|
-
Sometimes you may want to make a small change to one file and continue the conversation.
|
|
147
|
-
4. You propose to start code generation (actionType: confirmCodeGeneration)
|
|
148
|
-
5. I confirm that you can proceed (or reject and we go back to step 3)
|
|
149
|
-
6. You generate the code changes summary
|
|
150
|
-
7. Then you generate code change for each file
|
|
151
|
-
8. I apply code changes, and the conversation ends.
|
|
152
|
-
|
|
153
|
-
## Conversation Flow Best Practices
|
|
154
|
-
|
|
155
|
-
- If the user wants to stop the conversation, you should respect that and stop the conversation (instead of using sendMessage prefer to use endConversation).
|
|
156
|
-
- If you want to make small one file change, and continue the conversation, you can do that using actionType=updateFile. This makes sense if the change is small and does not require extensive planning.
|
|
157
|
-
- If you are missing context or have uncertainties, ask for clarification before proposing code changes.
|
|
158
|
-
- Every assistant message must contain meaningful content, whether it's a summary, clarifying question, or proposed code snippet.
|
|
159
|
-
- Complete the conversation and fully understand the user's request before starting code generation.
|
|
160
|
-
- Always provide tangible analysis, results, or insights when stating that it is performing analysis.
|
|
161
|
-
- Provide meaningful responses or explanations instead of generic placeholders like "I will do something. Please wait a moment".
|
|
162
|
-
- Request all necessary permissions and information before starting code generation.
|
|
163
|
-
- When responding with \`genaicodeHelp\` action type, assume that the final answer will be generated by subsequent \`genaicodeHelp\` function call. So you should not try to provide the final answer in the first response, and also you should not ask for more information or ask other questions in the first response.
|
|
164
|
-
- When writing content of \`message\` parameter in the \`askQuestion\` function, always direct it to the user, not to the assistant. For example, instead of "User is asking for...", use "You are asking for...".
|
|
165
|
-
- Try to tell the user what is going to happen next, what they should expect, and what they should do next. For example, "I will now generate the code changes summary. Please confirm if you are ready to proceed.".
|
|
166
|
-
- Do not refer to \`actionType\` parameter name or values in the message content. For example, instead of "I will now generate the code changes summary. Please confirm if you are ready to proceed with actionType: confirmCodeGeneration.", use "I will now generate the code changes summary. Please confirm if you are ready to proceed.".
|
|
167
|
-
- **IMPORTANT: Always check if a file exists before using createFile.** Before suggesting the createFile action, carefully examine the source code context to verify the file doesn't already exist. If a file already exists with the same path, use sendMessage to inform the user instead.
|
|
168
|
-
- When using \`reasoningInference\` action type to perform reasoning inference, in first step tell the user what you are going to do, and in the second step provide the results of the reasoning inference.
|
|
169
|
-
- When calling \`reasoningInference\` function, always provide a detailed prompt that includes the problem statement, context, constraints, assumptions, and solution. This will help the reasoning model to provide more accurate predictions. REMEMBER: The reasoning model will only consider the prompt and will not have access to any other context, so if you think something is important, include its full content in the context items.
|
|
170
|
-
- Distinguish \`compoundAction\` from \`confirmCodeGeneration\`: Use \`compoundAction\` for batching multiple *simple, predefined manipulations* specified by the user. Use \`confirmCodeGeneration\` for implementing features or complex changes requiring analysis and potentially complex logic generation.
|
|
171
|
-
${dockerTaskEnabled ? '- `runContainerTask` can be used to perform a complex operation inside a Docker container. It is safe environment for running potentially untrusted code, or destructive operations. It also allows to work on the current project files, which can be copied into the container. Outcomes of the task can be copied back to the current project on the host machine. The user can interact with the task during its execution, and provide input if needed. You will also be able to ask the user for feedback or ask question at any point.' : ''}
|
|
172
|
-
|
|
173
|
-
## GenAIcode configuration
|
|
174
|
-
|
|
175
|
-
GenAIcode can be configured by using the \`.genaicoderc\` file in the root directory of the project. Available options are documented in the \`.genaicoderc.schema.json\` file.
|
|
40
|
+
systemPrompt += `
|
|
41
|
+
## INTERACTIVE MODE (askQuestion)
|
|
42
|
+
All interactions occur via \`askQuestion\`.
|
|
43
|
+
|
|
44
|
+
**Communication Protocol**
|
|
45
|
+
- Address the user directly using "you". Never address the assistant or the system.
|
|
46
|
+
- Do NOT mention \`actionType\` names in user-facing messages.
|
|
47
|
+
- Each message must include meaningful content: analysis, a plan, clarification, or concrete changes.
|
|
48
|
+
- Always state what you just did (or decided) and what will happen next or what you need from the user.
|
|
49
|
+
|
|
50
|
+
**Workflow**
|
|
51
|
+
1. **Analyze**: Understand the request, inspect relevant code, check permissions, and identify dependencies.
|
|
52
|
+
2. **Plan**: Summarize your approach and list affected files. Ask for confirmation when changes are significant or risky.
|
|
53
|
+
3. **Execute**: Call \`askQuestion\` with the appropriate \`actionType\` to read, modify, or validate.
|
|
54
|
+
|
|
55
|
+
### ACTION TYPES
|
|
56
|
+
|
|
57
|
+
**Communication & Planning**
|
|
58
|
+
- \`sendMessage\`: Answer questions, explain plans, request clarification, or give simple visual analysis of images already in context.
|
|
59
|
+
- \`conversationGraph\`: Define structured flows for complex, multi-step tasks or features.
|
|
60
|
+
- \`endConversation\`: Explicitly end the session.
|
|
61
|
+
- \`genaicodeHelp\`: When the user needs help with GenAIcode itself.
|
|
62
|
+
|
|
63
|
+
**Context Gathering**
|
|
64
|
+
- \`requestFilesContent\`: Read project files whose content is currently null.
|
|
65
|
+
- \`requestFilesFragments\`: Read specific sections of large files instead of the whole file.
|
|
66
|
+
- \`readExternalFiles\` / \`exploreExternalDirectories\`: Access external configs/logs and directory listings.
|
|
67
|
+
- \`searchCode\`: Search for keywords or patterns in the codebase.
|
|
68
|
+
- \`webSearch\`: Fetch online documentation or factual information.
|
|
69
|
+
${gitContextEnabled ? '- `requestGitContext`: Access history, blame, or diffs for deeper understanding.\n' : ''}${appContextEnabled ? '- `pullAppContext`: Get application context values.\n' : ''}${appContextEnabled ? '- `pullConsoleLogs`: Get debug/console logs.\n' : ''}
|
|
70
|
+
|
|
71
|
+
**Modification & Execution**
|
|
72
|
+
- \`updateFile\` / \`createFile\`: Single-file operations while continuing the conversation.
|
|
73
|
+
- \`compoundAction\`: Batch of simple, user-requested operations (create/move/delete, simple image manipulations).
|
|
74
|
+
- \`confirmCodeGeneration\`: Final step to propose the full implementation across all affected files.
|
|
75
|
+
- \`runProjectCommand\`: Run lint, test, build, or other project commands.
|
|
76
|
+
- \`runBashCommand\`: Execute direct shell commands.
|
|
77
|
+
${dockerTaskEnabled ? '- `runContainerTask`: Execute complex or potentially destructive tasks inside Docker.\n' : ''}${appContextEnabled ? '- `pushAppContext`: Update application context values.\n' : ''}
|
|
78
|
+
|
|
79
|
+
**Advanced Analysis**
|
|
80
|
+
- \`performAnalysis\`: Internal computation or structured analysis returning specific findings.
|
|
81
|
+
- \`reasoningInference\`: Use a reasoning-capable model.
|
|
82
|
+
- Step 1: Tell the user you will run deeper reasoning.
|
|
83
|
+
- Step 2: Call \`reasoningInference\` with a detailed, self-contained prompt (problem, context, constraints, assumptions, relevant code).
|
|
84
|
+
- \`generateImage\`: Request image generation (only if allowed).
|
|
85
|
+
|
|
86
|
+
**Context Management**
|
|
87
|
+
- \`removeFilesFromContext\`: Drop unneeded file contents to save tokens.
|
|
88
|
+
- \`contextOptimization\`: Reorganize context to keep it compact and relevant.
|
|
89
|
+
- \`contextCompression\`: Summarize conversation history while preserving key decisions; trigger this when context becomes large or the topic shifts.
|
|
90
|
+
|
|
91
|
+
### CRITICAL RULES
|
|
92
|
+
1. If a message starts with "This is summary of our conversation:", treat it as the authoritative compressed history of previous work and decisions.
|
|
93
|
+
2. Before using \`createFile\`, check whether the file path is already known. If it exists, inform the user rather than overwriting.
|
|
94
|
+
3. Use \`compoundAction\` for straightforward batches of simple file/image operations explicitly implied by the user.
|
|
95
|
+
4. Use \`confirmCodeGeneration\` for feature work or refactors that require analysis and coordinated multi-file changes.
|
|
176
96
|
`;
|
|
177
97
|
}
|
|
178
98
|
if (importantContext?.systemPrompt && importantContext.systemPrompt.length > 0) {
|
|
179
|
-
systemPrompt += `\n# ADDITIONAL INSTRUCTIONS\n
|
|
99
|
+
systemPrompt += `\n# ADDITIONAL INSTRUCTIONS\n${importantContext.systemPrompt.join('\n')}`;
|
|
180
100
|
}
|
|
101
|
+
systemPrompt += `
|
|
102
|
+
|
|
103
|
+
## CONFIGURATION
|
|
104
|
+
GenAIcode is configured via the \`.genaicoderc\` file at the project root.
|
|
105
|
+
Available options are documented in \`.genaicoderc.schema.json\`.
|
|
106
|
+
`;
|
|
181
107
|
if (verbose) {
|
|
182
|
-
console.log('System prompt:');
|
|
183
|
-
console.log(systemPrompt);
|
|
108
|
+
console.log('System prompt:', systemPrompt);
|
|
184
109
|
}
|
|
185
110
|
verifySystemPromptLimit(systemPrompt);
|
|
186
111
|
return systemPrompt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"systemprompt.js","sourceRoot":"","sources":["../../src/prompt/systemprompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAItD,+DAA+D;AAC/D,MAAM,UAAU,eAAe,CAC7B,EAAE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAsE,EAClH,OAA0C;IAE1C,MAAM,EACJ,OAAO,EACP,WAAW,EACX,WAAW,EACX,EAAE,EACF,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,MAAM,EACN,MAAM,GACP,GAAG,OAAO,CAAC;IAEZ,MAAM,iBAAiB,GAAG,eAAe,EAAE,UAAU,KAAK,KAAK,CAAC;IAChE,MAAM,iBAAiB,GAAG,eAAe,EAAE,aAAa,KAAK,KAAK,CAAC;IACnE,MAAM,iBAAiB,GAAG,eAAe,EAAE,UAAU,KAAK,KAAK,CAAC;IAEhE,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAEtC,
|
|
1
|
+
{"version":3,"file":"systemprompt.js","sourceRoot":"","sources":["../../src/prompt/systemprompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAItD,+DAA+D;AAC/D,MAAM,UAAU,eAAe,CAC7B,EAAE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAsE,EAClH,OAA0C;IAE1C,MAAM,EACJ,OAAO,EACP,WAAW,EACX,WAAW,EACX,EAAE,EACF,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,MAAM,EACN,MAAM,GACP,GAAG,OAAO,CAAC;IAEZ,MAAM,iBAAiB,GAAG,eAAe,EAAE,UAAU,KAAK,KAAK,CAAC;IAChE,MAAM,iBAAiB,GAAG,eAAe,EAAE,aAAa,KAAK,KAAK,CAAC;IACnE,MAAM,iBAAiB,GAAG,eAAe,EAAE,UAAU,KAAK,KAAK,CAAC;IAEhE,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAEtC,4BAA4B;IAC5B,IAAI,YAAY,GAAG;;sCAEiB,OAAO;;;;;;;;;;;;;;;kBAe3B,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW;kBACzC,eAAe,CAAC,CAAC,CAAC,iDAAiD,CAAC,CAAC,CAAC,WAAW;wBAC3E,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW;gBACtD,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW;oBACnC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW;qBAC/B,MAAM,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,WAAW;;;;;;CAMpE,CAAC;IAEA,IAAI,WAAW,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,EAAE,CAAC;QACvC,YAAY,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BlB,iBAAiB,CAAC,CAAC,CAAC,oFAAoF,CAAC,CAAC,CAAC,EAAE,GACzG,iBAAiB,CAAC,CAAC,CAAC,uDAAuD,CAAC,CAAC,CAAC,EAChF,GAAG,iBAAiB,CAAC,CAAC,CAAC,gDAAgD,CAAC,CAAC,CAAC,EAAE;;;;;;;;EAQ9E,iBAAiB,CAAC,CAAC,CAAC,yFAAyF,CAAC,CAAC,CAAC,EAAE,GAC9G,iBAAiB,CAAC,CAAC,CAAC,0DAA0D,CAAC,CAAC,CAAC,EACnF;;;;;;;;;;;;;;;;;;;CAmBH,CAAC;IACA,CAAC;IAED,IAAI,gBAAgB,EAAE,YAAY,IAAI,gBAAgB,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/E,YAAY,IAAI,gCAAgC,gBAAgB,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IAC7F,CAAC;IAED,YAAY,IAAI;;;;;CAKjB,CAAC;IAEA,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;IAC9C,CAAC;IAED,uBAAuB,CAAC,YAAY,CAAC,CAAC;IAEtC,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -15,7 +15,7 @@ export function estimateTokenCount(input) {
|
|
|
15
15
|
// Split the input into words
|
|
16
16
|
const words = trimmedInput.split(/\s+/);
|
|
17
17
|
// Use average tokens per word based on content type
|
|
18
|
-
const averageTokensPerWord = isCode ?
|
|
18
|
+
const averageTokensPerWord = isCode ? 3.0 : 0.65;
|
|
19
19
|
// Estimate token count
|
|
20
20
|
const tokenCount = Math.ceil(words.length * averageTokensPerWord);
|
|
21
21
|
return tokenCount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-estimator.js","sourceRoot":"","sources":["../../src/prompt/token-estimator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,iCAAiC;IACjC,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAClC,IAAI,CAAC,YAAY;QAAE,OAAO,CAAC,CAAC;IAE5B,+CAA+C;IAC/C,MAAM,MAAM,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;IAE1C,6BAA6B;IAC7B,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAExC,oDAAoD;IACpD,MAAM,oBAAoB,GAAG,MAAM,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"token-estimator.js","sourceRoot":"","sources":["../../src/prompt/token-estimator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,iCAAiC;IACjC,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAClC,IAAI,CAAC,YAAY;QAAE,OAAO,CAAC,CAAC;IAE5B,+CAA+C;IAC/C,MAAM,MAAM,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;IAE1C,6BAA6B;IAC7B,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAExC,oDAAoD;IACpD,MAAM,oBAAoB,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAEjD,uBAAuB;IACvB,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,oBAAoB,CAAC,CAAC;IAElE,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,IAAY;IAChC,4BAA4B;IAC5B,MAAM,cAAc,GAAG,8FAA8F,CAAC;IACtH,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genaicode",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.2",
|
|
4
4
|
"author": "Grzegorz Tańczyk",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -96,11 +96,9 @@
|
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"@anthropic-ai/sdk": "^0.51.0",
|
|
99
|
-
"@anthropic-ai/vertex-sdk": "^0.11.3",
|
|
100
99
|
"@fontsource/press-start-2p": "^5.1.0",
|
|
101
100
|
"@google-cloud/aiplatform": "^3.34.0",
|
|
102
|
-
"@google
|
|
103
|
-
"@google/genai": "^0.10.0",
|
|
101
|
+
"@google/genai": "^1.30.0",
|
|
104
102
|
"@imgly/background-removal-node": "^1.4.5",
|
|
105
103
|
"@inquirer/prompts": "^7.8.4",
|
|
106
104
|
"@types/diff": "^5.2.1",
|