genaicode 0.6.1 → 0.8.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.
- package/README.md +0 -2
- package/dist/ai-service/ai-studio.js +7 -1
- package/dist/ai-service/ai-studio.js.map +1 -1
- package/dist/ai-service/anthropic.js +49 -19
- package/dist/ai-service/anthropic.js.map +1 -1
- package/dist/ai-service/chat-gpt.js +28 -11
- package/dist/ai-service/chat-gpt.js.map +1 -1
- package/dist/ai-service/common.d.ts +5 -4
- package/dist/ai-service/common.js +3 -4
- package/dist/ai-service/common.js.map +1 -1
- package/dist/ai-service/common.test.js +1 -1
- package/dist/ai-service/vertex-ai-claude.js +1 -1
- package/dist/ai-service/vertex-ai-claude.js.map +1 -1
- package/dist/ai-service/vertex-ai.js +7 -1
- package/dist/ai-service/vertex-ai.js.map +1 -1
- package/dist/cli/cli-options.js +0 -12
- package/dist/cli/cli-options.js.map +1 -1
- package/dist/cli/cli-params.d.ts +1 -4
- package/dist/cli/cli-params.js +1 -10
- package/dist/cli/cli-params.js.map +1 -1
- package/dist/cli/validate-cli-params.js +1 -7
- package/dist/cli/validate-cli-params.js.map +1 -1
- package/dist/cli/validate-cli-params.test.js +1 -1
- package/dist/cli/validate-cli-params.test.js.map +1 -1
- package/dist/eval/codegen-summary.test.d.ts +1 -0
- package/dist/eval/codegen-summary.test.js +93 -0
- package/dist/eval/codegen-summary.test.js.map +1 -0
- package/dist/eval/current-prompt-plugin.d.ts +3 -0
- package/dist/eval/current-prompt-plugin.js +10 -0
- package/dist/eval/current-prompt-plugin.js.map +1 -0
- package/dist/eval/data/current-prompt.d.ts +34 -0
- package/dist/eval/data/current-prompt.js +59 -0
- package/dist/eval/data/current-prompt.js.map +1 -0
- package/dist/eval/data/prompt-assistant-image.d.ts +49 -0
- package/dist/eval/data/prompt-assistant-image.js +67 -0
- package/dist/eval/data/prompt-assistant-image.js.map +1 -0
- package/dist/eval/data/prompt3.d.ts +34 -0
- package/dist/eval/data/prompt3.js +71 -0
- package/dist/eval/data/prompt3.js.map +1 -0
- package/dist/eval/prompt-debug.test.d.ts +1 -0
- package/dist/eval/prompt-debug.test.js +76 -0
- package/dist/eval/prompt-debug.test.js.map +1 -0
- package/dist/eval/prompt2.d.ts +34 -0
- package/dist/eval/prompt2.js +125 -0
- package/dist/eval/prompt2.js.map +1 -0
- package/dist/files/read-files.d.ts +29 -6
- package/dist/files/read-files.js +31 -10
- package/dist/files/read-files.js.map +1 -1
- package/dist/files/read-files.test.js +15 -9
- package/dist/files/read-files.test.js.map +1 -1
- package/dist/files/source-code-tree.d.ts +17 -0
- package/dist/files/source-code-tree.js +70 -0
- package/dist/files/source-code-tree.js.map +1 -0
- package/dist/main/codegen-types.d.ts +8 -5
- package/dist/main/codegen.ai-services.test.d.ts +3 -0
- package/dist/main/codegen.ai-services.test.js +198 -0
- package/dist/main/codegen.ai-services.test.js.map +1 -0
- package/dist/main/codegen.cli-options.test.d.ts +3 -0
- package/dist/main/codegen.cli-options.test.js +171 -0
- package/dist/main/codegen.cli-options.test.js.map +1 -0
- package/dist/main/codegen.image-generation.test.d.ts +3 -0
- package/dist/main/codegen.image-generation.test.js +187 -0
- package/dist/main/codegen.image-generation.test.js.map +1 -0
- package/dist/main/codegen.js +2 -5
- package/dist/main/codegen.js.map +1 -1
- package/dist/main/codegen.test-utils.d.ts +81 -0
- package/dist/main/codegen.test-utils.js +88 -0
- package/dist/main/codegen.test-utils.js.map +1 -0
- package/dist/main/codegen.test.js +47 -28
- package/dist/main/codegen.test.js.map +1 -1
- package/dist/main/common/content-bus-types.d.ts +6 -0
- package/dist/main/common/content-bus.d.ts +2 -2
- package/dist/main/common/content-bus.js +3 -1
- package/dist/main/common/content-bus.js.map +1 -1
- package/dist/main/common/user-actions.d.ts +8 -2
- package/dist/main/common/user-actions.js.map +1 -1
- package/dist/main/config-lib.js +20 -2
- package/dist/main/config-lib.js.map +1 -1
- package/dist/main/config.js +4 -28
- package/dist/main/config.js.map +1 -1
- package/dist/main/interactive/codegen-interactive.js +0 -4
- package/dist/main/interactive/codegen-interactive.js.map +1 -1
- package/dist/main/interactive/codegen-interactive.test.js +1 -7
- package/dist/main/interactive/codegen-interactive.test.js.map +1 -1
- package/dist/main/interactive/common.d.ts +1 -1
- package/dist/main/interactive/common.js +0 -2
- package/dist/main/interactive/common.js.map +1 -1
- package/dist/main/interactive/configure.js +0 -2
- package/dist/main/interactive/configure.js.map +1 -1
- package/dist/main/interactive/help.js +0 -2
- package/dist/main/interactive/help.js.map +1 -1
- package/dist/main/interactive/task-file.js +1 -1
- package/dist/main/interactive/task-file.js.map +1 -1
- package/dist/main/interactive/text-prompt.js +1 -1
- package/dist/main/interactive/text-prompt.js.map +1 -1
- package/dist/main/interactive/user-action-handlers.js +4 -2
- package/dist/main/interactive/user-action-handlers.js.map +1 -1
- package/dist/main/plugin-loader.d.ts +7 -1
- package/dist/main/plugin-loader.js +61 -0
- package/dist/main/plugin-loader.js.map +1 -1
- package/dist/main/ui/backend/api.js +9 -3
- package/dist/main/ui/backend/api.js.map +1 -1
- package/dist/main/ui/backend/service.d.ts +2 -1
- package/dist/main/ui/backend/service.js +6 -3
- package/dist/main/ui/backend/service.js.map +1 -1
- package/dist/main/ui/frontend/assets/index-QOcNx5ac.js +812 -0
- package/dist/main/ui/frontend/index.html +1 -1
- package/dist/main/ui/user-action-handlers.js +1 -1
- package/dist/main/ui/user-action-handlers.js.map +1 -1
- package/dist/project-profiles/detection.d.ts +40 -0
- package/dist/project-profiles/detection.js +131 -0
- package/dist/project-profiles/detection.js.map +1 -0
- package/dist/project-profiles/index.d.ts +35 -0
- package/dist/project-profiles/index.js +72 -0
- package/dist/project-profiles/index.js.map +1 -0
- package/dist/project-profiles/profiles/golang.d.ts +65 -0
- package/dist/project-profiles/profiles/golang.js +208 -0
- package/dist/project-profiles/profiles/golang.js.map +1 -0
- package/dist/project-profiles/profiles/java-maven.d.ts +80 -0
- package/dist/project-profiles/profiles/java-maven.js +165 -0
- package/dist/project-profiles/profiles/java-maven.js.map +1 -0
- package/dist/project-profiles/profiles/javascript-npm.d.ts +40 -0
- package/dist/project-profiles/profiles/javascript-npm.js +118 -0
- package/dist/project-profiles/profiles/javascript-npm.js.map +1 -0
- package/dist/project-profiles/profiles/javascript-react.d.ts +46 -0
- package/dist/project-profiles/profiles/javascript-react.js +147 -0
- package/dist/project-profiles/profiles/javascript-react.js.map +1 -0
- package/dist/project-profiles/profiles/python-django.d.ts +58 -0
- package/dist/project-profiles/profiles/python-django.js +200 -0
- package/dist/project-profiles/profiles/python-django.js.map +1 -0
- package/dist/project-profiles/types.d.ts +122 -0
- package/dist/project-profiles/types.js +77 -0
- package/dist/project-profiles/types.js.map +1 -0
- package/dist/prompt/function-calling.js +8 -3
- package/dist/prompt/function-calling.js.map +1 -1
- package/dist/prompt/function-defs/ask-question.d.ts +5 -0
- package/dist/prompt/function-defs/ask-question.js +140 -60
- package/dist/prompt/function-defs/ask-question.js.map +1 -1
- package/dist/prompt/function-defs/codegen-planning.d.ts +8 -0
- package/dist/prompt/function-defs/codegen-planning.js +50 -0
- package/dist/prompt/function-defs/codegen-planning.js.map +1 -0
- package/dist/prompt/function-defs/codegen-summary.js +2 -2
- package/dist/prompt/function-defs/codegen-summary.js.map +1 -1
- package/dist/prompt/function-defs/get-source-code.js +32 -2
- package/dist/prompt/function-defs/get-source-code.js.map +1 -1
- package/dist/prompt/function-defs/optimize-context.js +35 -12
- package/dist/prompt/function-defs/optimize-context.js.map +1 -1
- package/dist/prompt/function-defs/set-summaries.js +20 -1
- package/dist/prompt/function-defs/set-summaries.js.map +1 -1
- package/dist/prompt/limits.js +2 -2
- package/dist/prompt/limits.js.map +1 -1
- package/dist/prompt/limits.test.js +3 -3
- package/dist/prompt/limits.test.js.map +1 -1
- package/dist/prompt/prompt-codegen.js +7 -79
- package/dist/prompt/prompt-codegen.js.map +1 -1
- package/dist/prompt/prompt-codegen.test.js +8 -14
- package/dist/prompt/prompt-codegen.test.js.map +1 -1
- package/dist/prompt/prompt-service-ask-question.test.js +27 -80
- package/dist/prompt/prompt-service-ask-question.test.js.map +1 -1
- package/dist/prompt/prompt-service.ai-services.test.d.ts +1 -0
- package/dist/prompt/prompt-service.ai-services.test.js +149 -0
- package/dist/prompt/prompt-service.ai-services.test.js.map +1 -0
- package/dist/prompt/prompt-service.context-optimization.test.d.ts +1 -0
- package/dist/prompt/prompt-service.context-optimization.test.js +212 -0
- package/dist/prompt/prompt-service.context-optimization.test.js.map +1 -0
- package/dist/prompt/prompt-service.image-handling.test.d.ts +1 -0
- package/dist/prompt/prompt-service.image-handling.test.js +212 -0
- package/dist/prompt/prompt-service.image-handling.test.js.map +1 -0
- package/dist/prompt/prompt-service.js +41 -127
- package/dist/prompt/prompt-service.js.map +1 -1
- package/dist/prompt/prompt-service.test-utils.d.ts +66 -0
- package/dist/prompt/prompt-service.test-utils.js +169 -0
- package/dist/prompt/prompt-service.test-utils.js.map +1 -0
- package/dist/prompt/prompt-service.test.js +96 -20
- package/dist/prompt/prompt-service.test.js.map +1 -1
- package/dist/prompt/prompt-service.validation-recovery.test.d.ts +1 -0
- package/dist/prompt/prompt-service.validation-recovery.test.js +263 -0
- package/dist/prompt/prompt-service.validation-recovery.test.js.map +1 -0
- package/dist/prompt/static-prompts.d.ts +16 -0
- package/dist/prompt/static-prompts.js +22 -0
- package/dist/prompt/static-prompts.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.js +1 -3
- package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.js +58 -0
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.d.ts +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js +8 -7
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js +6 -6
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/default-action.js +1 -4
- package/dist/prompt/steps/step-ask-question/handlers/default-action.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer-with-image.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer-with-image.js +86 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer-with-image.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message-with-image.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message-with-image.js +97 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message-with-image.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.js +20 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handler-utils.d.ts +0 -0
- package/dist/prompt/steps/step-ask-question/handlers/handler-utils.js +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handler-utils.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.d.ts +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js +57 -15
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.d.ts +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js +109 -12
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.d.ts +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js +48 -26
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.js +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.js +1 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts +25 -21
- package/dist/prompt/steps/step-ask-question/step-ask-question.d.ts +2 -5
- package/dist/prompt/steps/step-ask-question/step-ask-question.js +36 -33
- package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -1
- package/dist/prompt/steps/step-codegen-planning.d.ts +10 -0
- package/dist/prompt/steps/step-codegen-planning.js +69 -0
- package/dist/prompt/steps/step-codegen-planning.js.map +1 -0
- package/dist/prompt/steps/step-codegen-summary.d.ts +7 -0
- package/dist/prompt/steps/step-codegen-summary.js +106 -0
- package/dist/prompt/steps/step-codegen-summary.js.map +1 -0
- package/dist/prompt/steps/step-codegen-summary.test.d.ts +1 -0
- package/dist/prompt/steps/step-codegen-summary.test.js +136 -0
- package/dist/prompt/steps/step-codegen-summary.test.js.map +1 -0
- package/dist/prompt/steps/step-context-optimization.js +243 -126
- package/dist/prompt/steps/step-context-optimization.js.map +1 -1
- package/dist/prompt/steps/step-context-optimization.test.d.ts +2 -0
- package/dist/prompt/steps/step-context-optimization.test.js +475 -0
- package/dist/prompt/steps/step-context-optimization.test.js.map +1 -0
- package/dist/prompt/steps/step-ensure-context.d.ts +15 -0
- package/dist/prompt/steps/step-ensure-context.js +102 -0
- package/dist/prompt/steps/step-ensure-context.js.map +1 -0
- package/dist/prompt/steps/step-ensure-context.test.d.ts +1 -0
- package/dist/prompt/steps/step-ensure-context.test.js +242 -0
- package/dist/prompt/steps/step-ensure-context.test.js.map +1 -0
- package/dist/prompt/steps/step-generate-image.d.ts +8 -1
- package/dist/prompt/steps/step-generate-image.js +1 -0
- package/dist/prompt/steps/step-generate-image.js.map +1 -1
- package/dist/prompt/steps/step-summarization.d.ts +2 -2
- package/dist/prompt/steps/step-summarization.js +45 -9
- package/dist/prompt/steps/step-summarization.js.map +1 -1
- package/dist/prompt/steps/step-validate-recover.js +24 -15
- package/dist/prompt/steps/step-validate-recover.js.map +1 -1
- package/dist/prompt/steps/steps-types.d.ts +2 -0
- package/dist/prompt/steps/steps-types.js.map +1 -1
- package/dist/prompt/systemprompt.d.ts +2 -2
- package/dist/prompt/systemprompt.js +74 -176
- package/dist/prompt/systemprompt.js.map +1 -1
- package/dist/prompt/systemprompt.test.js +4 -5
- package/dist/prompt/systemprompt.test.js.map +1 -1
- package/dist/vite-genaicode/vite-genaicode-plugin.js +0 -2
- package/dist/vite-genaicode/vite-genaicode-plugin.js.map +1 -1
- package/package.json +6 -2
- package/dist/main/ui/frontend/assets/index-Dk_qaEQg.js +0 -782
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
import { executeStepEnsureContext } from './step-ensure-context';
|
|
3
|
+
import { getSourceCode } from '../../files/read-files';
|
|
4
|
+
import { putSystemMessage } from '../../main/common/content-bus';
|
|
5
|
+
import { StepResult } from './steps-types';
|
|
6
|
+
import '../../files/find-files.js';
|
|
7
|
+
import { importantContext } from '../../main/config.js';
|
|
8
|
+
// Mock dependencies
|
|
9
|
+
vi.mock('../../files/read-files');
|
|
10
|
+
vi.mock('../../files/find-files.js', () => ({
|
|
11
|
+
getSourceFiles: () => [],
|
|
12
|
+
getImageAssetFiles: () => [],
|
|
13
|
+
refreshFiles: () => null,
|
|
14
|
+
}));
|
|
15
|
+
vi.mock('../../main/common/content-bus');
|
|
16
|
+
vi.mock('../../main/config.js', () => ({
|
|
17
|
+
rootDir: '/test',
|
|
18
|
+
rcConfig: {
|
|
19
|
+
rootDir: '/test',
|
|
20
|
+
extensions: ['.js', '.ts', '.tsx', '.jsx'],
|
|
21
|
+
},
|
|
22
|
+
importantContext: {
|
|
23
|
+
files: ['/test/important.ts'],
|
|
24
|
+
},
|
|
25
|
+
}));
|
|
26
|
+
describe('executeStepEnsureContext', () => {
|
|
27
|
+
const mockOptions = {
|
|
28
|
+
aiService: 'vertex-ai',
|
|
29
|
+
askQuestion: false,
|
|
30
|
+
};
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
vi.clearAllMocks();
|
|
33
|
+
importantContext.files = ['/test/important.ts'];
|
|
34
|
+
});
|
|
35
|
+
describe('Path extraction from codegenSummary', () => {
|
|
36
|
+
it('should extract paths from fileUpdates and contextPaths', async () => {
|
|
37
|
+
const mockCodegenSummary = {
|
|
38
|
+
name: 'codegenSummary',
|
|
39
|
+
args: {
|
|
40
|
+
fileUpdates: [{ filePath: '/test/file1.ts' }, { filePath: '/test/file2.ts' }],
|
|
41
|
+
contextPaths: ['/test/context1.ts', '/test/context2.ts'],
|
|
42
|
+
explanation: 'test',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
vi.mocked(getSourceCode).mockReturnValue({
|
|
46
|
+
'/test/file1.ts': { content: 'content1' },
|
|
47
|
+
'/test/file2.ts': { content: 'content2' },
|
|
48
|
+
'/test/context1.ts': { content: 'context1' },
|
|
49
|
+
'/test/context2.ts': { content: 'context2' },
|
|
50
|
+
'/test/important.ts': { content: 'important' },
|
|
51
|
+
});
|
|
52
|
+
const prompt = [];
|
|
53
|
+
const result = await executeStepEnsureContext(prompt, mockCodegenSummary, mockOptions);
|
|
54
|
+
expect(result).toBe(StepResult.CONTINUE);
|
|
55
|
+
expect(getSourceCode).toHaveBeenCalledWith(expect.objectContaining({
|
|
56
|
+
filterPaths: expect.arrayContaining([
|
|
57
|
+
'/test/file1.ts',
|
|
58
|
+
'/test/file2.ts',
|
|
59
|
+
'/test/context1.ts',
|
|
60
|
+
'/test/context2.ts',
|
|
61
|
+
'/test/important.ts',
|
|
62
|
+
]),
|
|
63
|
+
}), mockOptions);
|
|
64
|
+
});
|
|
65
|
+
it('should handle empty fileUpdates and contextPaths', async () => {
|
|
66
|
+
importantContext.files = [];
|
|
67
|
+
const mockCodegenSummary = {
|
|
68
|
+
name: 'codegenSummary',
|
|
69
|
+
args: {
|
|
70
|
+
fileUpdates: [],
|
|
71
|
+
contextPaths: [],
|
|
72
|
+
explanation: 'test',
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
vi.mocked(getSourceCode).mockReturnValue({});
|
|
76
|
+
const prompt = [];
|
|
77
|
+
const result = await executeStepEnsureContext(prompt, mockCodegenSummary, mockOptions);
|
|
78
|
+
expect(result).toBe(StepResult.CONTINUE);
|
|
79
|
+
expect(putSystemMessage).toHaveBeenCalledWith(expect.stringContaining('No paths to ensure'));
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe('Context checking in conversation', () => {
|
|
83
|
+
it('should identify files already in context', async () => {
|
|
84
|
+
const mockCodegenSummary = {
|
|
85
|
+
name: 'codegenSummary',
|
|
86
|
+
args: {
|
|
87
|
+
fileUpdates: [{ filePath: '/test/file1.ts' }],
|
|
88
|
+
contextPaths: ['/test/context1.ts'],
|
|
89
|
+
explanation: 'test',
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
const prompt = [
|
|
93
|
+
{
|
|
94
|
+
type: 'user',
|
|
95
|
+
functionResponses: [
|
|
96
|
+
{
|
|
97
|
+
name: 'getSourceCode',
|
|
98
|
+
content: JSON.stringify({
|
|
99
|
+
'/test': {
|
|
100
|
+
'file1.ts': { content: 'existing content' },
|
|
101
|
+
},
|
|
102
|
+
}),
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
vi.mocked(getSourceCode).mockReturnValue({
|
|
108
|
+
'/test/context1.ts': { content: 'context1' },
|
|
109
|
+
'/test/important.ts': { content: 'important' },
|
|
110
|
+
});
|
|
111
|
+
const result = await executeStepEnsureContext(prompt, mockCodegenSummary, mockOptions);
|
|
112
|
+
expect(result).toBe(StepResult.CONTINUE);
|
|
113
|
+
expect(getSourceCode).toHaveBeenCalledWith(expect.objectContaining({
|
|
114
|
+
filterPaths: expect.arrayContaining(['/test/context1.ts', '/test/important.ts']),
|
|
115
|
+
}), mockOptions);
|
|
116
|
+
});
|
|
117
|
+
it('should handle both content and summary in context', async () => {
|
|
118
|
+
const mockCodegenSummary = {
|
|
119
|
+
name: 'codegenSummary',
|
|
120
|
+
args: {
|
|
121
|
+
fileUpdates: [{ filePath: '/test/file1.ts' }],
|
|
122
|
+
contextPaths: ['/test/context1.ts'],
|
|
123
|
+
explanation: 'test',
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
const prompt = [
|
|
127
|
+
{
|
|
128
|
+
type: 'user',
|
|
129
|
+
functionResponses: [
|
|
130
|
+
{
|
|
131
|
+
name: 'getSourceCode',
|
|
132
|
+
content: JSON.stringify({
|
|
133
|
+
'/test': {
|
|
134
|
+
'file1.ts': { content: 'existing content' },
|
|
135
|
+
'context1.ts': { summary: 'summary only' },
|
|
136
|
+
},
|
|
137
|
+
}),
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
];
|
|
142
|
+
vi.mocked(getSourceCode).mockReturnValue({
|
|
143
|
+
'/test/context1.ts': { content: 'context1' },
|
|
144
|
+
'/test/important.ts': { content: 'important' },
|
|
145
|
+
});
|
|
146
|
+
const result = await executeStepEnsureContext(prompt, mockCodegenSummary, mockOptions);
|
|
147
|
+
expect(result).toBe(StepResult.CONTINUE);
|
|
148
|
+
expect(getSourceCode).toHaveBeenCalledWith(expect.objectContaining({
|
|
149
|
+
filterPaths: expect.arrayContaining(['/test/context1.ts', '/test/important.ts']),
|
|
150
|
+
}), mockOptions);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
describe('getSourceCode appending', () => {
|
|
154
|
+
it('should append getSourceCode call/response for missing files', async () => {
|
|
155
|
+
const mockCodegenSummary = {
|
|
156
|
+
name: 'codegenSummary',
|
|
157
|
+
args: {
|
|
158
|
+
fileUpdates: [{ filePath: '/test/new1.ts' }],
|
|
159
|
+
contextPaths: ['/test/new2.ts'],
|
|
160
|
+
explanation: 'test',
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
const prompt = [];
|
|
164
|
+
vi.mocked(getSourceCode).mockReturnValue({
|
|
165
|
+
'/test/new1.ts': { content: 'new1' },
|
|
166
|
+
'/test/new2.ts': { content: 'new2' },
|
|
167
|
+
'/test/important.ts': { content: 'important' },
|
|
168
|
+
});
|
|
169
|
+
await executeStepEnsureContext(prompt, mockCodegenSummary, mockOptions);
|
|
170
|
+
expect(prompt).toHaveLength(2);
|
|
171
|
+
expect(prompt[0].type).toBe('assistant');
|
|
172
|
+
expect(prompt[0].functionCalls?.[0].name).toBe('getSourceCode');
|
|
173
|
+
expect(prompt[1].type).toBe('user');
|
|
174
|
+
expect(prompt[1].functionResponses?.[0].name).toBe('getSourceCode');
|
|
175
|
+
expect(JSON.parse(prompt[1].functionResponses?.[0].content ?? '')).toEqual({
|
|
176
|
+
'/test': {
|
|
177
|
+
'new1.ts': { content: 'new1' },
|
|
178
|
+
'new2.ts': { content: 'new2' },
|
|
179
|
+
'important.ts': { content: 'important' },
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
describe('Edge cases and error handling', () => {
|
|
185
|
+
it('should handle invalid getSourceCode responses in context', async () => {
|
|
186
|
+
console.warn = vi.fn();
|
|
187
|
+
const mockCodegenSummary = {
|
|
188
|
+
name: 'codegenSummary',
|
|
189
|
+
args: {
|
|
190
|
+
fileUpdates: [{ filePath: '/test/file1.ts' }],
|
|
191
|
+
contextPaths: [],
|
|
192
|
+
explanation: 'test',
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
const prompt = [
|
|
196
|
+
{
|
|
197
|
+
type: 'user',
|
|
198
|
+
functionResponses: [
|
|
199
|
+
{
|
|
200
|
+
name: 'getSourceCode',
|
|
201
|
+
content: 'invalid json',
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
];
|
|
206
|
+
vi.mocked(getSourceCode).mockReturnValue({
|
|
207
|
+
'/test/file1.ts': { content: 'content1' },
|
|
208
|
+
'/test/important.ts': { content: 'important' },
|
|
209
|
+
});
|
|
210
|
+
const result = await executeStepEnsureContext(prompt, mockCodegenSummary, mockOptions);
|
|
211
|
+
expect(result).toBe(StepResult.CONTINUE);
|
|
212
|
+
expect(console.warn).toHaveBeenCalledWith('Failed to parse getSourceCode response:', expect.any(Error));
|
|
213
|
+
});
|
|
214
|
+
it('should handle missing args in codegenSummary', async () => {
|
|
215
|
+
const mockCodegenSummary = {
|
|
216
|
+
name: 'codegenSummary',
|
|
217
|
+
args: {},
|
|
218
|
+
};
|
|
219
|
+
const prompt = [];
|
|
220
|
+
const result = await executeStepEnsureContext(prompt, mockCodegenSummary, mockOptions);
|
|
221
|
+
expect(result).toEqual(StepResult.BREAK);
|
|
222
|
+
});
|
|
223
|
+
it('should handle getSourceCode errors', async () => {
|
|
224
|
+
const mockCodegenSummary = {
|
|
225
|
+
name: 'codegenSummary',
|
|
226
|
+
args: {
|
|
227
|
+
fileUpdates: [{ filePath: '/test/file1.ts' }],
|
|
228
|
+
contextPaths: [],
|
|
229
|
+
explanation: 'test',
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
vi.mocked(getSourceCode).mockImplementation(() => {
|
|
233
|
+
throw new Error('Mock error');
|
|
234
|
+
});
|
|
235
|
+
const prompt = [];
|
|
236
|
+
const result = await executeStepEnsureContext(prompt, mockCodegenSummary, mockOptions);
|
|
237
|
+
expect(result).toBe(StepResult.BREAK);
|
|
238
|
+
expect(putSystemMessage).toHaveBeenCalledWith('Error: Context completeness check failed. This is unexpected.');
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
//# sourceMappingURL=step-ensure-context.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-ensure-context.test.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-ensure-context.test.ts"],"names":[],"mappings":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AI,EAAE,gBAAgB;gBACtB,IAAI,EAAE;oBACJ,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;oBAC7C,YAAY,EAAE,EAAE;oBAChB,WAAW,EAAE,MAAM;iBACpB;aACF,CAAC;YAEF,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE;gBAC/C,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;YAEH,MAAM,MAAM,GAAiB,EAAE,CAAC;YAChC,MAAM,MAAM,GAAG,MAAM,wBAAwB,CAAC,MAAM,EAAE,kBAAkB,EAAE,WAAW,CAAC,CAAC;YAEvF,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACtC,MAAM,CAAC,gBAAgB,CAAC,CAAC,oBAAoB,CAAC,+DAA+D,CAAC,CAAC;QACjH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import { FunctionCall, GenerateImageFunction } from '../../ai-service/common.js';
|
|
2
|
-
export declare function executeStepGenerateImage(generateImageFn: GenerateImageFunction, generateImageCall: FunctionCall): Promise<FunctionCall
|
|
2
|
+
export declare function executeStepGenerateImage(generateImageFn: GenerateImageFunction, generateImageCall: FunctionCall): Promise<FunctionCall<{
|
|
3
|
+
filePath: string;
|
|
4
|
+
downloadUrl: string;
|
|
5
|
+
explanation: string;
|
|
6
|
+
} | {
|
|
7
|
+
text: string;
|
|
8
|
+
downloadUrl: undefined;
|
|
9
|
+
}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-generate-image.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-generate-image.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAGjC,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,eAAsC,EACtC,iBAA+B;
|
|
1
|
+
{"version":3,"file":"step-generate-image.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-generate-image.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAGjC,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,eAAsC,EACtC,iBAA+B;IAc/B,MAAM,CAAC,CAAC,CAAC,eAAe,EAAE,8EAA8E,CAAC,CAAC;IAE1G,OAAO,CAAC,GAAG,CAAC,sCAAsC,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAE5E,IAAI,CAAC;QACH,MAAM,EACJ,MAAM,EAAE,WAAW,EACnB,QAAQ,EACR,gBAAgB,EAChB,KAAK,EACL,MAAM,EACN,KAAK,GACN,GAAG,iBAAiB,CAAC,IAOrB,CAAC;QACF,MAAM,iBAAiB,GAAG,MAAM,eAAe,CAAC,WAAW,EAAE,gBAAgB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC;QAElH,iFAAiF;QACjF,OAAO;YACL,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE;gBACJ,QAAQ,EAAE,QAAQ;gBAClB,WAAW,EAAE,iBAAiB;gBAC9B,WAAW,EAAE,6BAA6B;aAC3C;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;QAChD,uDAAuD;QACvD,OAAO;YACL,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE;gBACJ,IAAI,EAAE,6BAA8B,KAAe,CAAC,OAAO,EAAE;gBAC7D,WAAW,EAAE,SAAS;aACvB;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { GenerateContentFunction } from '../../ai-service/common.js';
|
|
2
2
|
import { CodegenOptions } from '../../main/codegen-types.js';
|
|
3
|
-
import { SourceCodeMap } from '../../files/read-files.js';
|
|
3
|
+
import { SourceCodeMap, DependencyInfo } from '../../files/read-files.js';
|
|
4
4
|
export declare function summarizeSourceCode(generateContentFn: GenerateContentFunction, sourceCode: SourceCodeMap, options: CodegenOptions): Promise<void>;
|
|
5
5
|
export declare function getSummary(filePath: string): {
|
|
6
|
+
dependencies: DependencyInfo[];
|
|
6
7
|
summary: string;
|
|
7
|
-
tokenCount: number;
|
|
8
8
|
} | undefined;
|
|
@@ -4,19 +4,48 @@ import { putSystemMessage } from '../../main/common/content-bus.js';
|
|
|
4
4
|
import { estimateTokenCount } from '../token-estimator.js';
|
|
5
5
|
import { validateAndRecoverSingleResult } from './step-validate-recover.js';
|
|
6
6
|
const BATCH_SIZE = 50;
|
|
7
|
-
const MAX_SUMMARY_TOKENS =
|
|
8
|
-
const CACHE_VERSION = '
|
|
9
|
-
const SUMMARIZATION_PROMPT = `Your role is to summarize content of files in ${MAX_SUMMARY_TOKENS} tokens or fewer.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
const MAX_SUMMARY_TOKENS = 10;
|
|
8
|
+
const CACHE_VERSION = 'v6'; // Incremented version for dependency support
|
|
9
|
+
const SUMMARIZATION_PROMPT = `Your role is to summarize content of files in ${MAX_SUMMARY_TOKENS} tokens or fewer while also detecting dependencies.
|
|
10
|
+
|
|
11
|
+
For the summary:
|
|
12
|
+
- Fit as much information as possible given the limit
|
|
13
|
+
- The summary must be understandable for LLM, does not need to be human readable
|
|
14
|
+
- Include as much key information as possible, even if readability and style are sacrificed
|
|
15
|
+
- Do not include information if they can be already derived from the file name or file path
|
|
16
|
+
- Focus on the main purpose or functionality
|
|
17
|
+
- The length of summary should be max ${MAX_SUMMARY_TOKENS} tokens
|
|
18
|
+
|
|
19
|
+
For dependencies:
|
|
20
|
+
- Identify all import and require statements in the code
|
|
21
|
+
- Detect both local (relative) and external (package) dependencies
|
|
22
|
+
- For local dependencies, include the full resolved path
|
|
23
|
+
- For external dependencies, include the package name
|
|
24
|
+
- Mark dependencies as either 'local' or 'external'
|
|
25
|
+
- Include the original import path as provided in the code
|
|
26
|
+
|
|
27
|
+
Provide your response using the \`setSummaries\` function with the following structure:
|
|
28
|
+
{
|
|
29
|
+
"filePath": "absolute/path/to/file",
|
|
30
|
+
"summary": "concise summary",
|
|
31
|
+
"dependencies": [
|
|
32
|
+
{
|
|
33
|
+
"path": "resolved/path/or/package",
|
|
34
|
+
"type": "local|external",
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
|
|
13
39
|
The file path must be absolute, exactly the same as you receive in the \`getSourceCode\` function responses.
|
|
14
40
|
`;
|
|
15
|
-
const summaryCache = readCache('summaries', {
|
|
41
|
+
const summaryCache = readCache('summaries', {
|
|
42
|
+
_version: CACHE_VERSION,
|
|
43
|
+
});
|
|
16
44
|
export async function summarizeSourceCode(generateContentFn, sourceCode, options) {
|
|
17
45
|
const items = Object.entries(sourceCode).map(([path, file]) => ({
|
|
18
46
|
path,
|
|
19
47
|
content: 'content' in file ? file.content : null,
|
|
48
|
+
dependencies: 'dependencies' in file ? file.dependencies : undefined,
|
|
20
49
|
}));
|
|
21
50
|
await summarizeBatch(generateContentFn, items, options);
|
|
22
51
|
}
|
|
@@ -50,11 +79,13 @@ async function summarizeBatch(generateContentFn, items, options) {
|
|
|
50
79
|
result = await validateAndRecoverSingleResult(request, result, generateContentFn);
|
|
51
80
|
const batchSummaries = parseSummarizationResult(result);
|
|
52
81
|
batchSummaries.forEach((file) => {
|
|
53
|
-
const
|
|
82
|
+
const item = items.find((item) => item.path === file.filePath);
|
|
83
|
+
const content = item?.content ?? '';
|
|
54
84
|
summaryCache[file.filePath] = {
|
|
55
85
|
tokenCount: estimateTokenCount(content),
|
|
56
86
|
summary: file.summary,
|
|
57
87
|
checksum: md5(content),
|
|
88
|
+
dependencies: file.dependencies ?? item?.dependencies ?? [],
|
|
58
89
|
};
|
|
59
90
|
});
|
|
60
91
|
}
|
|
@@ -70,6 +101,11 @@ function parseSummarizationResult(result) {
|
|
|
70
101
|
}
|
|
71
102
|
export function getSummary(filePath) {
|
|
72
103
|
const summary = summaryCache[filePath];
|
|
73
|
-
return summary
|
|
104
|
+
return summary
|
|
105
|
+
? {
|
|
106
|
+
summary: summary.summary,
|
|
107
|
+
...(summary.dependencies && { dependencies: summary.dependencies }),
|
|
108
|
+
}
|
|
109
|
+
: undefined;
|
|
74
110
|
}
|
|
75
111
|
//# sourceMappingURL=step-summarization.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-summarization.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-summarization.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAE5E,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,aAAa,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"step-summarization.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-summarization.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAE5E,M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CAAC,QAAQ,CAAC,CAAC;IACvC,OAAO,OAAO;QACZ,CAAC,CAAC;YACE,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,GAAG,CAAC,OAAO,CAAC,YAAY,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;SACpE;QACH,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
|
|
@@ -16,27 +16,36 @@ export async function validateAndRecoverSingleResult([prompt, functionDefs, requ
|
|
|
16
16
|
requiredFunctionName = 'updateFile';
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
prompt
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
prompt = [
|
|
20
|
+
...prompt,
|
|
21
|
+
{ type: 'assistant', functionCalls: [call] },
|
|
22
|
+
{
|
|
23
|
+
type: 'user',
|
|
24
|
+
text: 'Function call was invalid, please analyze the error and respond with corrected function call.',
|
|
25
|
+
functionResponses: [
|
|
26
|
+
{
|
|
27
|
+
name: call.name,
|
|
28
|
+
call_id: call.id,
|
|
29
|
+
content: JSON.stringify({ args: call.args, error: validatorError }),
|
|
30
|
+
isError: true,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
];
|
|
31
35
|
console.log('Trying to recover...');
|
|
32
36
|
if (cheap) {
|
|
33
37
|
console.log('Disabling --cheap for recovery.');
|
|
34
38
|
}
|
|
35
|
-
result = await generateContentFn(prompt, functionDefs, requiredFunctionName, temperature,
|
|
39
|
+
result = await generateContentFn(prompt, functionDefs, requiredFunctionName, temperature, true, options);
|
|
36
40
|
console.log('Recover result:', result);
|
|
37
41
|
if (result?.length === 1) {
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
let recoveryError = validateFunctionCall(result[0], requiredFunctionName);
|
|
43
|
+
if (recoveryError) {
|
|
44
|
+
console.log("Use more expensive recovery method, because we couldn't recover.");
|
|
45
|
+
result = await generateContentFn(prompt, functionDefs, requiredFunctionName, temperature, false, options);
|
|
46
|
+
recoveryError = validateFunctionCall(result?.[0], requiredFunctionName);
|
|
47
|
+
assert(!recoveryError, 'Recovery failed');
|
|
48
|
+
}
|
|
40
49
|
console.log('Recovery was successful');
|
|
41
50
|
}
|
|
42
51
|
else if (result?.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-validate-recover.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-validate-recover.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,CAAC,MAAM,EAAE,YAAY,EAAE,oBAAoB,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,CAAsB,EAC9F,MAAsB,EACtB,iBAA0C;IAE1C,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC/C,mBAAmB;QACnB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,IAAI,GAA6B,MAAM,CAAC,CAAC,CAAC,CAAC;IAC/C,MAAM,cAAc,GAAG,oBAAoB,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IACxE,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QAC3D,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,GAAG,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;YACtC,IAAI,oBAAoB,KAAK,WAAW,EAAE,CAAC;gBACzC,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;gBACjD,oBAAoB,GAAG,YAAY,CAAC;YACtC,CAAC;QACH,CAAC;QAED,MAAM,
|
|
1
|
+
{"version":3,"file":"step-validate-recover.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-validate-recover.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,CAAC,MAAM,EAAE,YAAY,EAAE,oBAAoB,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,CAAsB,EAC9F,MAAsB,EACtB,iBAA0C;IAE1C,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC/C,mBAAmB;QACnB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,IAAI,GAA6B,MAAM,CAAC,CAAC,CAAC,CAAC;IAC/C,MAAM,cAAc,GAAG,oBAAoB,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IACxE,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QAC3D,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,GAAG,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;YACtC,IAAI,oBAAoB,KAAK,WAAW,EAAE,CAAC;gBACzC,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;gBACjD,oBAAoB,GAAG,YAAY,CAAC;YACtC,CAAC;QACH,CAAC;QAED,MAAM,GAAG;YACP,GAAG,MAAM;YACT,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,IAAI,CAAC,EAAE;YAC5C;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,+FAA+F;gBACrG,iBAAiB,EAAE;oBACjB;wBACE,IAAI,EAAE,IAAI,CAAC,IAAI;wBACf,OAAO,EAAE,IAAI,CAAC,EAAE;wBAChB,OAA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AC,CAAC;QAC7D,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DependencyInfo } from '../../files/read-files';
|
|
1
2
|
export declare enum StepResult {
|
|
2
3
|
CONTINUE = 0,
|
|
3
4
|
BREAK = 1
|
|
@@ -11,6 +12,7 @@ export type SummaryCache = Record<string, {
|
|
|
11
12
|
tokenCount: number;
|
|
12
13
|
summary: string;
|
|
13
14
|
checksum: string;
|
|
15
|
+
dependencies: DependencyInfo[];
|
|
14
16
|
}> & {
|
|
15
17
|
_version: string;
|
|
16
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps-types.js","sourceRoot":"","sources":["../../../src/prompt/steps/steps-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"steps-types.js","sourceRoot":"","sources":["../../../src/prompt/steps/steps-types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,mDAAQ,CAAA;IACR,6CAAK,CAAA;AACP,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CodegenOptions } from '../main/codegen-types.js';
|
|
2
|
-
/** Generates a system prompt */
|
|
3
|
-
export declare function getSystemPrompt(
|
|
2
|
+
/** Generates a system prompt with the codegen prompt merged */
|
|
3
|
+
export declare function getSystemPrompt(options: CodegenOptions): string;
|