genaicode 0.3.0 → 0.4.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/README.md +24 -7
- package/dist/ai-service/ai-studio.js +58 -9
- package/dist/ai-service/ai-studio.js.map +1 -1
- package/dist/ai-service/anthropic.js +1 -0
- package/dist/ai-service/anthropic.js.map +1 -1
- package/dist/ai-service/chat-gpt.js +4 -2
- package/dist/ai-service/chat-gpt.js.map +1 -1
- package/dist/ai-service/common.d.ts +13 -4
- package/dist/ai-service/common.js +4 -3
- package/dist/ai-service/common.js.map +1 -1
- package/dist/ai-service/common.test.js +3 -3
- package/dist/ai-service/common.test.js.map +1 -1
- package/dist/ai-service/unescape-function-call.d.ts +7 -0
- package/dist/ai-service/unescape-function-call.js +59 -0
- package/dist/ai-service/unescape-function-call.js.map +1 -0
- package/dist/ai-service/unescape-function-call.test.d.ts +1 -0
- package/dist/ai-service/unescape-function-call.test.js +18 -0
- package/dist/ai-service/unescape-function-call.test.js.map +1 -0
- package/dist/ai-service/vertex-ai-claude.js +7 -1
- package/dist/ai-service/vertex-ai-claude.js.map +1 -1
- package/dist/ai-service/vertex-ai.d.ts +0 -1
- package/dist/ai-service/vertex-ai.js +64 -14
- package/dist/ai-service/vertex-ai.js.map +1 -1
- package/dist/cli/cli-options.js +22 -2
- package/dist/cli/cli-options.js.map +1 -1
- package/dist/cli/cli-params.d.ts +6 -2
- package/dist/cli/cli-params.js +14 -10
- package/dist/cli/cli-params.js.map +1 -1
- package/dist/cli/validate-cli-params.js +11 -2
- package/dist/cli/validate-cli-params.js.map +1 -1
- package/dist/files/cache-file.d.ts +3 -0
- package/dist/files/cache-file.js +36 -0
- package/dist/files/cache-file.js.map +1 -0
- package/dist/files/read-files.d.ts +4 -1
- package/dist/files/read-files.js +5 -3
- package/dist/files/read-files.js.map +1 -1
- package/dist/files/read-files.test.js +1 -0
- package/dist/files/read-files.test.js.map +1 -1
- package/dist/files/update-files.js +1 -4
- package/dist/files/update-files.js.map +1 -1
- package/dist/main/codegen-types.d.ts +3 -4
- package/dist/main/codegen.js +17 -4
- package/dist/main/codegen.js.map +1 -1
- package/dist/main/codegen.test.d.ts +1 -0
- package/dist/main/codegen.test.js +22 -8
- package/dist/main/codegen.test.js.map +1 -1
- package/dist/main/common/content-bus-types.d.ts +5 -0
- package/dist/main/common/content-bus-types.js +4 -0
- package/dist/main/common/content-bus-types.js.map +1 -1
- package/dist/main/common/content-bus.d.ts +7 -6
- package/dist/main/common/content-bus.js +25 -11
- package/dist/main/common/content-bus.js.map +1 -1
- package/dist/main/common/cost-collector.d.ts +10 -14
- package/dist/main/common/cost-collector.js +83 -17
- package/dist/main/common/cost-collector.js.map +1 -1
- package/dist/main/interactive/codegen-interactive.test.d.ts +1 -0
- package/dist/main/interactive/codegen-interactive.test.js +3 -1
- package/dist/main/interactive/codegen-interactive.test.js.map +1 -1
- package/dist/main/interactive/codegen-worker.js +5 -2
- package/dist/main/interactive/codegen-worker.js.map +1 -1
- package/dist/main/interactive/error-handling.d.ts +0 -3
- package/dist/main/interactive/error-handling.js +0 -6
- package/dist/main/interactive/error-handling.js.map +1 -1
- package/dist/main/ui/backend/api.js +15 -3
- package/dist/main/ui/backend/api.js.map +1 -1
- package/dist/main/ui/backend/server.js +9 -6
- package/dist/main/ui/backend/server.js.map +1 -1
- package/dist/main/ui/backend/service.d.ts +4 -2
- package/dist/main/ui/backend/service.js +14 -8
- package/dist/main/ui/backend/service.js.map +1 -1
- package/dist/main/ui/frontend/assets/index-Dicb_1yw.js +779 -0
- package/dist/main/ui/frontend/index.html +1 -1
- package/dist/prompt/ai-service-fallback.js +5 -0
- package/dist/prompt/ai-service-fallback.js.map +1 -1
- package/dist/prompt/function-calling-validate.js +70 -4
- package/dist/prompt/function-calling-validate.js.map +1 -1
- package/dist/prompt/function-calling.js +11 -3
- package/dist/prompt/function-calling.js.map +1 -1
- package/dist/prompt/function-defs/ask-question-reflect.d.ts +20 -0
- package/dist/prompt/function-defs/ask-question-reflect.js +21 -0
- package/dist/prompt/function-defs/ask-question-reflect.js.map +1 -0
- package/dist/prompt/function-defs/ask-question.d.ts +22 -11
- package/dist/prompt/function-defs/ask-question.js +42 -11
- package/dist/prompt/function-defs/ask-question.js.map +1 -1
- package/dist/prompt/function-defs/codegen-summary.d.ts +3 -3
- package/dist/prompt/function-defs/codegen-summary.js +4 -4
- package/dist/prompt/function-defs/codegen-summary.js.map +1 -1
- package/dist/prompt/function-defs/optimize-context.d.ts +16 -11
- package/dist/prompt/function-defs/optimize-context.js +16 -11
- package/dist/prompt/function-defs/optimize-context.js.map +1 -1
- package/dist/prompt/function-defs/read-history.d.ts +13 -0
- package/dist/prompt/function-defs/read-history.js +14 -0
- package/dist/prompt/function-defs/read-history.js.map +1 -0
- package/dist/prompt/function-defs/set-summaries.d.ts +31 -0
- package/dist/prompt/function-defs/set-summaries.js +32 -0
- package/dist/prompt/function-defs/set-summaries.js.map +1 -0
- package/dist/prompt/function-defs/update-history.d.ts +21 -0
- package/dist/prompt/function-defs/update-history.js +22 -0
- package/dist/prompt/function-defs/update-history.js.map +1 -0
- package/dist/prompt/limits.js +2 -2
- package/dist/prompt/limits.test.js +3 -3
- package/dist/prompt/prompt-codegen.js +25 -13
- package/dist/prompt/prompt-codegen.js.map +1 -1
- package/dist/prompt/prompt-codegen.test.js +1 -1
- package/dist/prompt/prompt-codegen.test.js.map +1 -1
- package/dist/prompt/prompt-service-ask-question.test.d.ts +1 -0
- package/dist/prompt/prompt-service-ask-question.test.js +75 -9
- package/dist/prompt/prompt-service-ask-question.test.js.map +1 -1
- package/dist/prompt/prompt-service.d.ts +0 -17
- package/dist/prompt/prompt-service.js +47 -21
- package/dist/prompt/prompt-service.js.map +1 -1
- package/dist/prompt/prompt-service.test.d.ts +1 -0
- package/dist/prompt/prompt-service.test.js +41 -31
- package/dist/prompt/prompt-service.test.js.map +1 -1
- package/dist/prompt/steps/step-ask-question-handlers.d.ts +10 -0
- package/dist/prompt/steps/step-ask-question-handlers.js +265 -0
- package/dist/prompt/steps/step-ask-question-handlers.js.map +1 -0
- package/dist/prompt/steps/step-ask-question-reflect.d.ts +4 -0
- package/dist/prompt/steps/step-ask-question-reflect.js +48 -0
- package/dist/prompt/steps/step-ask-question-reflect.js.map +1 -0
- package/dist/prompt/steps/step-ask-question-types.d.ts +53 -0
- package/dist/prompt/steps/step-ask-question-types.js +2 -0
- package/dist/prompt/steps/step-ask-question-types.js.map +1 -0
- package/dist/prompt/steps/step-ask-question.d.ts +2 -2
- package/dist/prompt/steps/step-ask-question.js +65 -82
- package/dist/prompt/steps/step-ask-question.js.map +1 -1
- package/dist/prompt/steps/step-context-optimization.d.ts +1 -3
- package/dist/prompt/steps/step-context-optimization.js +120 -73
- package/dist/prompt/steps/step-context-optimization.js.map +1 -1
- package/dist/prompt/steps/step-generate-summary.d.ts +3 -0
- package/dist/prompt/steps/step-generate-summary.js +41 -0
- package/dist/prompt/steps/step-generate-summary.js.map +1 -0
- package/dist/prompt/steps/step-history-update.d.ts +5 -0
- package/dist/prompt/steps/step-history-update.js +54 -0
- package/dist/prompt/steps/step-history-update.js.map +1 -0
- package/dist/prompt/steps/step-summarization.d.ts +8 -0
- package/dist/prompt/steps/step-summarization.js +75 -0
- package/dist/prompt/steps/step-summarization.js.map +1 -0
- package/dist/prompt/steps/step-validate-recover.d.ts +2 -13
- package/dist/prompt/steps/step-validate-recover.js +3 -3
- package/dist/prompt/steps/step-validate-recover.js.map +1 -1
- package/dist/prompt/steps/step-verify-patch.d.ts +1 -2
- package/dist/prompt/steps/step-verify-patch.js +3 -10
- package/dist/prompt/steps/step-verify-patch.js.map +1 -1
- package/dist/prompt/steps/steps-types.d.ts +12 -0
- package/dist/prompt/steps/steps-utils.d.ts +7 -0
- package/dist/prompt/steps/steps-utils.js +11 -0
- package/dist/prompt/steps/steps-utils.js.map +1 -0
- package/dist/prompt/systemprompt.js +124 -12
- package/dist/prompt/systemprompt.js.map +1 -1
- package/dist/prompt/systemprompt.test.js +4 -4
- package/dist/prompt/systemprompt.test.js.map +1 -1
- package/package.json +6 -2
- package/dist/main/ui/frontend/assets/index-D9wcaSJU.js +0 -598
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const readHistory = {
|
|
2
|
+
name: 'readHistory',
|
|
3
|
+
description: 'This function reads the history from the cache and returns it as a string.',
|
|
4
|
+
parameters: {
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {
|
|
7
|
+
dateTime: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
required: [],
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=read-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-history.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/read-history.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,4EAA4E;IACzF,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;aACf;SACF;QACD,QAAQ,EAAE,EAAE;KACb;CACF,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for setSummaries
|
|
3
|
+
*/
|
|
4
|
+
export declare const setSummaries: {
|
|
5
|
+
readonly name: "setSummaries";
|
|
6
|
+
readonly description: "Use this function to save summaries of files";
|
|
7
|
+
readonly parameters: {
|
|
8
|
+
readonly type: "object";
|
|
9
|
+
readonly properties: {
|
|
10
|
+
readonly summaries: {
|
|
11
|
+
readonly type: "array";
|
|
12
|
+
readonly description: "An array of results, each corresponding to an analyzed file, containing the absolute file path, and a brief summary.";
|
|
13
|
+
readonly items: {
|
|
14
|
+
readonly type: "object";
|
|
15
|
+
readonly properties: {
|
|
16
|
+
readonly filePath: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
readonly description: "The absolute file path of the analyzed file.";
|
|
19
|
+
};
|
|
20
|
+
readonly summary: {
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
readonly description: "A summary of the file's content, highlighting its main purpose, functionality, or details which may be useful for context optimization.";
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
readonly required: readonly ["filePath", "summary"];
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
readonly required: readonly ["summaries"];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for setSummaries
|
|
3
|
+
*/
|
|
4
|
+
export const setSummaries = {
|
|
5
|
+
name: 'setSummaries',
|
|
6
|
+
description: 'Use this function to save summaries of files',
|
|
7
|
+
parameters: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
summaries: {
|
|
11
|
+
type: 'array',
|
|
12
|
+
description: 'An array of results, each corresponding to an analyzed file, containing the absolute file path, and a brief summary.',
|
|
13
|
+
items: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
filePath: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'The absolute file path of the analyzed file.',
|
|
19
|
+
},
|
|
20
|
+
summary: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: "A summary of the file's content, highlighting its main purpose, functionality, or details which may be useful for context optimization.",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
required: ['filePath', 'summary'],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
required: ['summaries'],
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=set-summaries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-summaries.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/set-summaries.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,8CAA8C;IAC3D,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;gBACb,WAAW,EACT,sHAAsH;gBACxH,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,QAAQ,EAAE;4BACR,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,8CAA8C;yBAC5D;wBACD,OAAO,EAAE;4BACP,IAAI,EAAE,QAAQ;4BACd,WAAW,EACT,yIAAyI;yBAC5I;qBACF;oBACD,QAAQ,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC;iBAClC;aACF;SACF;QACD,QAAQ,EAAE,CAAC,WAAW,CAAC;KACxB;CACO,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for updateHistory
|
|
3
|
+
*/
|
|
4
|
+
export declare const updateHistory: {
|
|
5
|
+
readonly name: "updateHistory";
|
|
6
|
+
readonly description: "Update the history.";
|
|
7
|
+
readonly parameters: {
|
|
8
|
+
readonly type: "object";
|
|
9
|
+
readonly properties: {
|
|
10
|
+
readonly recentConversationSummary: {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
readonly description: "Summary of recent conversation";
|
|
13
|
+
};
|
|
14
|
+
readonly newHistoryContent: {
|
|
15
|
+
readonly type: "string";
|
|
16
|
+
readonly description: "The new history content, combination of recent conversation summary, and current history";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
readonly required: readonly ["recentConversationSummary", "newHistoryContent"];
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function definition for updateHistory
|
|
3
|
+
*/
|
|
4
|
+
export const updateHistory = {
|
|
5
|
+
name: 'updateHistory',
|
|
6
|
+
description: 'Update the history.',
|
|
7
|
+
parameters: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
recentConversationSummary: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'Summary of recent conversation',
|
|
13
|
+
},
|
|
14
|
+
newHistoryContent: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'The new history content, combination of recent conversation summary, and current history',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
required: ['recentConversationSummary', 'newHistoryContent'],
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=update-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-history.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/update-history.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,qBAAqB;IAClC,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,yBAAyB,EAAE;gBACzB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,gCAAgC;aAC9C;YACD,iBAAiB,EAAE;gBACjB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0FAA0F;aACxG;SACF;QACD,QAAQ,EAAE,CAAC,2BAA2B,EAAE,mBAAmB,CAAC;KAC7D;CACO,CAAC"}
|
package/dist/prompt/limits.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import { estimateTokenCount } from './token-estimator.js';
|
|
3
|
-
const SYSTEM_PROMPT_LIMIT =
|
|
4
|
-
const CODEGEN_PROMPT_LIMIT =
|
|
3
|
+
const SYSTEM_PROMPT_LIMIT = 2700;
|
|
4
|
+
const CODEGEN_PROMPT_LIMIT = 850;
|
|
5
5
|
const SOURCE_CODE_LIMIT = 100000;
|
|
6
6
|
function verifyPromptLimit(promptType, prompt, limit) {
|
|
7
7
|
const tokenCount = estimateTokenCount(prompt);
|
|
@@ -7,8 +7,8 @@ describe('Prompt Limits', () => {
|
|
|
7
7
|
expect(() => verifySystemPromptLimit(validPrompt)).not.toThrow();
|
|
8
8
|
});
|
|
9
9
|
it('should throw for a prompt exceeding the limit', () => {
|
|
10
|
-
const invalidPrompt = 'A '.repeat(
|
|
11
|
-
expect(() => verifySystemPromptLimit(invalidPrompt)).toThrow('Token limit exceeded:
|
|
10
|
+
const invalidPrompt = 'A '.repeat(5000);
|
|
11
|
+
expect(() => verifySystemPromptLimit(invalidPrompt)).toThrow('Token limit exceeded: 3250 > 2700');
|
|
12
12
|
});
|
|
13
13
|
});
|
|
14
14
|
describe('verifyCodegenPromptLimit', () => {
|
|
@@ -18,7 +18,7 @@ describe('Prompt Limits', () => {
|
|
|
18
18
|
});
|
|
19
19
|
it('should throw for a prompt exceeding the limit', () => {
|
|
20
20
|
const invalidPrompt = 'B '.repeat(10000);
|
|
21
|
-
expect(() => verifyCodegenPromptLimit(invalidPrompt)).toThrow('Token limit exceeded: 6500 >
|
|
21
|
+
expect(() => verifyCodegenPromptLimit(invalidPrompt)).toThrow('Token limit exceeded: 6500 > 850');
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
24
|
describe('verifySourceCodeLimit', () => {
|
|
@@ -34,28 +34,37 @@ export function getCodeGenPrompt(options) {
|
|
|
34
34
|
? 'This is your task: ' + explicitPrompt + '\n\n'
|
|
35
35
|
: codeGenFiles.length > 0
|
|
36
36
|
? `I have marked some files with the ${CODEGEN_TRIGGER} fragments:\n${codeGenFiles.join('\n')}\nYour task is to generate updates for those files according to the ${CODEGEN_TRIGGER} comments/context.`
|
|
37
|
-
: `No files are marked with ${CODEGEN_TRIGGER} fragment, so you can consider
|
|
37
|
+
: `No files are marked with the ${CODEGEN_TRIGGER} fragment, so you can consider making changes in any file${askQuestion ? ', but you should consult me by asking a question first.' : ''}.`;
|
|
38
38
|
const codeGenPrompt = `${taskPrompt}
|
|
39
39
|
|
|
40
|
-
Before proceeding with code generation, please
|
|
40
|
+
Before proceeding with code generation, please:
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
1. **Analyze the task and requirements**.
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
2. **Use the \`askQuestion\` function** to seek clarification if needed. For analysis requests, use the 'requestAnswer' actionType.
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
- **\`path\`**: Absolute file path to be updated.
|
|
48
|
-
- **\`updateToolName\`**: The tool to be used for the update (e.g., \`createFile\`, \`updateFile\`).
|
|
49
|
-
- **\`prompt\`**: A detailed prompt summarizing the planned changes for this file.
|
|
50
|
-
- **Other Properties**: Include any other necessary properties as per the \`codegenSummary\` function definition.
|
|
46
|
+
3. **When you believe code changes are necessary**, use the 'confirmCodeGeneration' actionType to confirm with the user before proceeding.
|
|
51
47
|
|
|
52
|
-
|
|
48
|
+
4. **Only after confirmation**, summarize the plan of updates by calling the \`codegenSummary\` function with the appropriate arguments.
|
|
49
|
+
|
|
50
|
+
- Ensure that you include:
|
|
51
|
+
- **\`explanation\`**: A brief description of the planned changes or reasoning for no changes.
|
|
52
|
+
- **\`fileUpdates\`**: A list of proposed file updates, each with required properties:
|
|
53
|
+
- **\`path\`**: Absolute file path to be updated.
|
|
54
|
+
- **\`updateToolName\`**: The tool to be used for the update (e.g., \`createFile\`, \`updateFile\`).
|
|
55
|
+
- **\`prompt\`**: A detailed prompt summarizing the planned changes for this file.
|
|
56
|
+
- **Other Properties**: Include any other necessary properties as per the \`codegenSummary\` function definition.
|
|
57
|
+
- **\`contextPaths\`**: A list of file paths that should be used as context for the code generation requests.
|
|
58
|
+
|
|
59
|
+
5. **Context Optimization**: Utilize the \`contextOptimization\` actionType to manage and optimize the context during code generation tasks. Generate a prompt using the \`contextOptimization\` property to guide the LLM in determining which parts of the context are most relevant to keep, enhancing efficiency and focus.
|
|
60
|
+
|
|
61
|
+
6. **Check ActionType Selection**: Always verify that the correct \`actionType\` is being used, especially before requesting file content, to ensure the 'requestFilesContent' actionType is applied. This helps maintain vigilance and accuracy in task execution.
|
|
53
62
|
|
|
54
63
|
## My Requirements for Task Execution:
|
|
55
64
|
|
|
56
65
|
${importantTextPrompts ? `${importantTextPrompts}\n` : ''}
|
|
57
66
|
${considerAllFiles
|
|
58
|
-
? 'You are allowed to modify all files in the application regardless
|
|
67
|
+
? 'You are allowed to modify all files in the application regardless of whether they contain codegen fragments.'
|
|
59
68
|
: 'Do not modify files which do not contain the fragments.'}
|
|
60
69
|
${allowFileCreate ? 'You are allowed to create new files.' : 'Do not create new files. (request permission via `askQuestion`)'}
|
|
61
70
|
${allowFileDelete
|
|
@@ -69,7 +78,10 @@ ${vision ? 'You are allowed to analyze image assets.' : 'Do not analyze image as
|
|
|
69
78
|
${imagen
|
|
70
79
|
? 'You are allowed to generate images.'
|
|
71
80
|
: 'You are not allowed to generate images. (request permission via `askQuestion`)'}
|
|
72
|
-
|
|
81
|
+
|
|
82
|
+
Remember to optimize token usage by reducing context when appropriate during askQuestion conversations. This will help avoid hitting rate limits and improve overall efficiency.
|
|
83
|
+
|
|
84
|
+
Start from generating codegen summary, this summary will be used as a context to generate updates, so make sure that it contains useful information.`;
|
|
73
85
|
if (verbose) {
|
|
74
86
|
console.log('Code gen prompt:');
|
|
75
87
|
console.log(codeGenPrompt);
|
|
@@ -94,7 +106,7 @@ Lint command stderr:
|
|
|
94
106
|
${stderr}
|
|
95
107
|
\`\`\`
|
|
96
108
|
|
|
97
|
-
Please suggest changes to fix these lint errors.`;
|
|
109
|
+
Please suggest changes to fix these lint errors. Use the 'requestAnswer' actionType if you need any clarifications before proposing fixes.`;
|
|
98
110
|
if (verbose) {
|
|
99
111
|
console.log('Lint fix prompt:');
|
|
100
112
|
console.log(lintFixPrompt);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-codegen.js","sourceRoot":"","sources":["../../src/prompt/prompt-codegen.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,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C,CAAC,CAAC,2DAA2D;EAC9G,MAAM,CAAC,CAAC,CAAC,0CAA0C,CAAC,CAAC,CAAC,qEAAqE;EAE3H,MAAM;QACJ,CAAC,CAAC,qCAAqC;QACvC,CAAC,CAAC,gFACN;;;;sJAIsJ,CAAC;IAErJ,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC7B,CAAC;IAED,wBAAwB,CAAC,aAAa,CAAC,CAAC;IAExC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC;AAC5C,CAAC;AAED,0BAA0B;AAC1B,MAAM,UAAU,gBAAgB,CAAC,OAAe,EAAE,EAAE,OAAO,EAAkB,EAAE,MAAc,EAAE,MAAc;IAC3G,MAAM,aAAa,GAAG;;gBAER,OAAO;;;;EAIrB,MAAM;;;;;;EAMN,MAAM;;;2IAGmI,CAAC;IAE1I,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC7B,CAAC;IAED,wBAAwB,CAAC,aAAa,CAAC,CAAC;IAExC,OAAO,aAAa,CAAC;AACvB,CAAC"}
|
|
@@ -12,7 +12,7 @@ vi.mock('../files/read-files.js', () => ({
|
|
|
12
12
|
getSourceCode: () => ({}),
|
|
13
13
|
}));
|
|
14
14
|
vi.mock('../cli/cli-params.js', () => ({
|
|
15
|
-
|
|
15
|
+
disableExplanations: true,
|
|
16
16
|
considerAllFiles: false,
|
|
17
17
|
dependencyTree: false,
|
|
18
18
|
cliExplicitPrompt: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-codegen.test.js","sourceRoot":"","sources":["../../src/prompt/prompt-codegen.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,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AS,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAEtE,MAAM,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,UAAU,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAEzE,MAAM,OAAO,GAAG,cAAc,CAAC;QAC/B,MAAM,MAAM,GAAG,eAAe,CAAC;QAC/B,MAAM,MAAM,GAAG,EAAE,CAAC;QAElB,gBAAgB,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAErF,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;QAC5D,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,gBAAgB,CAAC,4CAA4C,CAAC,CAAC,CAAC;QAE/G,UAAU,CAAC,WAAW,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -4,6 +4,7 @@ import * as vertexAi from '../ai-service/vertex-ai.js';
|
|
|
4
4
|
import * as prompts from '@inquirer/prompts';
|
|
5
5
|
import { CancelablePromise } from '@inquirer/type';
|
|
6
6
|
import '../cli/cli-params.js';
|
|
7
|
+
import '../files/cache-file.js';
|
|
7
8
|
import '../files/read-files.js';
|
|
8
9
|
import '../files/find-files.js';
|
|
9
10
|
import { getCodeGenPrompt } from './prompt-codegen.js';
|
|
@@ -13,7 +14,7 @@ vi.mock('@inquirer/prompts', () => ({
|
|
|
13
14
|
input: vi.fn(),
|
|
14
15
|
}));
|
|
15
16
|
vi.mock('../cli/cli-params.js', () => ({
|
|
16
|
-
|
|
17
|
+
disableExplanations: true,
|
|
17
18
|
considerAllFiles: false,
|
|
18
19
|
dependencyTree: false,
|
|
19
20
|
explicitPrompt: false,
|
|
@@ -29,6 +30,7 @@ vi.mock('../cli/cli-params.js', () => ({
|
|
|
29
30
|
cheap: false,
|
|
30
31
|
askQuestion: true,
|
|
31
32
|
}));
|
|
33
|
+
vi.mock('../files/cache-file.js');
|
|
32
34
|
// Mock find-files module
|
|
33
35
|
vi.mock('../files/find-files.js', () => ({
|
|
34
36
|
getSourceFiles: () => [],
|
|
@@ -64,9 +66,8 @@ describe('promptService with askQuestion', () => {
|
|
|
64
66
|
name: 'askQuestion',
|
|
65
67
|
args: {
|
|
66
68
|
content: 'Do you want to proceed with code generation?',
|
|
67
|
-
|
|
69
|
+
actionType: 'requestAnswer',
|
|
68
70
|
promptNecessity: 80,
|
|
69
|
-
stopCodegen: false,
|
|
70
71
|
},
|
|
71
72
|
},
|
|
72
73
|
];
|
|
@@ -75,9 +76,8 @@ describe('promptService with askQuestion', () => {
|
|
|
75
76
|
name: 'askQuestion',
|
|
76
77
|
args: {
|
|
77
78
|
content: 'Ok lets go',
|
|
78
|
-
|
|
79
|
+
actionType: 'startCodeGeneration',
|
|
79
80
|
promptNecessity: 80,
|
|
80
|
-
stopCodegen: false,
|
|
81
81
|
},
|
|
82
82
|
},
|
|
83
83
|
];
|
|
@@ -113,9 +113,8 @@ describe('promptService with askQuestion', () => {
|
|
|
113
113
|
name: 'askQuestion',
|
|
114
114
|
args: {
|
|
115
115
|
content: 'Stopping code generation as requested.',
|
|
116
|
-
shouldPrompt: false,
|
|
117
116
|
promptNecessity: 100,
|
|
118
|
-
|
|
117
|
+
actionType: 'cancelCodeGeneration',
|
|
119
118
|
},
|
|
120
119
|
},
|
|
121
120
|
];
|
|
@@ -125,7 +124,7 @@ describe('promptService with askQuestion', () => {
|
|
|
125
124
|
expect(result).toEqual([]);
|
|
126
125
|
expect(console.log).toHaveBeenCalledWith('Assistant requested to stop code generation. Exiting...', undefined);
|
|
127
126
|
});
|
|
128
|
-
it('should proceed with code generation when askQuestion
|
|
127
|
+
it('should not proceed with code generation when no askQuestion requests', async () => {
|
|
129
128
|
const mockAskQuestionCall = [];
|
|
130
129
|
const mockCodegenSummary = [
|
|
131
130
|
{
|
|
@@ -138,12 +137,79 @@ describe('promptService with askQuestion', () => {
|
|
|
138
137
|
},
|
|
139
138
|
];
|
|
140
139
|
vi.mocked(vertexAi.generateContent)
|
|
140
|
+
.mockResolvedValueOnce(mockAskQuestionCall)
|
|
141
141
|
.mockResolvedValueOnce(mockAskQuestionCall)
|
|
142
142
|
.mockResolvedValueOnce(mockCodegenSummary);
|
|
143
143
|
await promptService(GENERATE_CONTENT_FNS, GENERATE_IMAGE_FNS, getCodeGenPrompt({ aiService: 'vertex-ai', disableContextOptimization: true, interactive: true }));
|
|
144
144
|
expect(vertexAi.generateContent).toHaveBeenCalledTimes(2);
|
|
145
145
|
expect(prompts.input).not.toHaveBeenCalled();
|
|
146
|
-
|
|
146
|
+
});
|
|
147
|
+
it('should handle self-reflection mechanism', async () => {
|
|
148
|
+
const mockAskQuestionCall = [
|
|
149
|
+
{
|
|
150
|
+
name: 'askQuestion',
|
|
151
|
+
args: {
|
|
152
|
+
content: 'Do you want to proceed with code generation?',
|
|
153
|
+
actionType: 'requestAnswer',
|
|
154
|
+
promptNecessity: 80,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
];
|
|
158
|
+
const mockAskQuestionReflectCall = [
|
|
159
|
+
{
|
|
160
|
+
name: 'askQuestionReflect',
|
|
161
|
+
args: {
|
|
162
|
+
shouldEscalate: 70,
|
|
163
|
+
reason: 'The response requires more advanced processing.',
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
];
|
|
167
|
+
const mockAskQuestionReflectCall2 = [
|
|
168
|
+
{
|
|
169
|
+
name: 'askQuestionReflect',
|
|
170
|
+
args: {
|
|
171
|
+
shouldEscalate: 30,
|
|
172
|
+
reason: 'The response is ok.',
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
];
|
|
176
|
+
const mockAskQuestionCall2 = [
|
|
177
|
+
{
|
|
178
|
+
name: 'askQuestion',
|
|
179
|
+
args: {
|
|
180
|
+
content: 'Startin code generation',
|
|
181
|
+
actionType: 'startCodeGeneration',
|
|
182
|
+
promptNecessity: 80,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
];
|
|
186
|
+
const mockCodegenSummary = [
|
|
187
|
+
{
|
|
188
|
+
name: 'codegenSummary',
|
|
189
|
+
args: {
|
|
190
|
+
fileUpdates: [],
|
|
191
|
+
contextPaths: [],
|
|
192
|
+
explanation: 'No updates needed',
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
];
|
|
196
|
+
vi.mocked(vertexAi.generateContent)
|
|
197
|
+
.mockResolvedValueOnce(mockAskQuestionCall)
|
|
198
|
+
.mockResolvedValueOnce(mockAskQuestionReflectCall)
|
|
199
|
+
.mockResolvedValueOnce(mockAskQuestionCall)
|
|
200
|
+
.mockResolvedValueOnce(mockAskQuestionCall2)
|
|
201
|
+
.mockResolvedValueOnce(mockAskQuestionReflectCall2)
|
|
202
|
+
.mockResolvedValueOnce(mockCodegenSummary);
|
|
203
|
+
vi.mocked(prompts.input).mockImplementationOnce(() => CancelablePromise.resolve('Yes'));
|
|
204
|
+
await promptService(GENERATE_CONTENT_FNS, GENERATE_IMAGE_FNS, getCodeGenPrompt({
|
|
205
|
+
aiService: 'vertex-ai',
|
|
206
|
+
disableContextOptimization: true,
|
|
207
|
+
interactive: true,
|
|
208
|
+
askQuestion: true,
|
|
209
|
+
selfReflectionEnabled: true,
|
|
210
|
+
}));
|
|
211
|
+
expect(vertexAi.generateContent).toHaveBeenCalledTimes(6);
|
|
212
|
+
expect(console.log).toHaveBeenCalledWith('Received codegen summary, will collect partial updates', expect.any(Object));
|
|
147
213
|
});
|
|
148
214
|
});
|
|
149
215
|
//# sourceMappingURL=prompt-service-ask-question.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-service-ask-question.test.js","sourceRoot":"","sources":["../../src/prompt/prompt-service-ask-question.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,4BAA4B,CAAC;AAEvD,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,sBAAsB,CAAC;AAC9B,OAAO,wBAAwB,CAAC;AAChC,OAAO,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AAEzF,EAAE,CAAC,IAAI,CAAC,4BAA4B,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,eAAe,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AAC5E,EAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,GAAG,EAAE,CAAC,CAAC;IAClC,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE;CACf,CAAC,CAAC,CAAC;AACJ,EAAE,CAAC,IAAI,CAAC,sBAAsB,EAAE,GAAG,EAAE,CAAC,CAAC;IACrC,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"prompt-service-ask-question.test.js","sourceRoot":"","sources":["../../src/prompt/prompt-service-ask-question.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAA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ACF,MAAM,kBAAkB,GAAG;YACzB;gBACE,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE;oBACJ,WAAW,EAAE,EAAE;oBACf,YAAY,EAAE,EAAE;oBAChB,WAAW,EAAE,mBAAmB;iBACjC;aACF;SACF,CAAC;QAEF,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC;aAChC,qBAAqB,CAAC,mBAAmB,CAAC;aAC1C,qBAAqB,CAAC,0BAA0B,CAAC;aACjD,qBAAqB,CAAC,mBAAmB,CAAC;aAC1C,qBAAqB,CAAC,oBAAoB,CAAC;aAC3C,qBAAqB,CAAC,2BAA2B,CAAC;aAClD,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;QAE7C,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,sBAAsB,CAC7C,GAAG,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAA8B,CACpE,CAAC;QAEF,MAAM,aAAa,CACjB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,CAAC;YACf,SAAS,EAAE,WAAW;YACtB,0BAA0B,EAAE,IAAI;YAChC,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,IAAI;YACjB,qBAAqB,EAAE,IAAI;SAC5B,CAAC,CACH,CAAC;QAEF,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC1D,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,oBAAoB,CACtC,wDAAwD,EACxD,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CACnB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -3,20 +3,3 @@ import { AiServiceType, ImagenType } from '../main/codegen-types.js';
|
|
|
3
3
|
import { CodegenPrompt } from './prompt-codegen.js';
|
|
4
4
|
/** A function that communicates with model using */
|
|
5
5
|
export declare function promptService(generateContentFns: Record<AiServiceType, GenerateContentFunction>, generateImageFns: Record<ImagenType, GenerateImageFunction>, codegenPrompt: CodegenPrompt, waitIfPaused?: () => Promise<void>): Promise<FunctionCall[]>;
|
|
6
|
-
export type PromptMessages = ReturnType<typeof prepareMessages>;
|
|
7
|
-
/**
|
|
8
|
-
* Function to prepare messages for AI services
|
|
9
|
-
*/
|
|
10
|
-
declare function prepareMessages(codegen: CodegenPrompt): {
|
|
11
|
-
suggestSourceCode: string;
|
|
12
|
-
requestSourceCode: string;
|
|
13
|
-
suggestImageAssets: string;
|
|
14
|
-
requestImageAssets: string;
|
|
15
|
-
prompt: string;
|
|
16
|
-
sourceCode: string;
|
|
17
|
-
contextSourceCode: (paths: string[], pathsOnly?: boolean) => string;
|
|
18
|
-
imageAssets: string;
|
|
19
|
-
partialPromptTemplate(path: string): string;
|
|
20
|
-
invalidFunctionCall: string;
|
|
21
|
-
};
|
|
22
|
-
export {};
|