genaicode 0.9.3 → 0.9.5
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/anthropic.js +4 -1
- package/dist/ai-service/anthropic.js.map +1 -1
- package/dist/ai-service/common.js +1 -1
- package/dist/ai-service/common.js.map +1 -1
- package/dist/ai-service/openai.js +1 -1
- package/dist/ai-service/openai.js.map +1 -1
- package/dist/ai-service/service-configurations.js +1 -1
- package/dist/ai-service/service-configurations.js.map +1 -1
- package/dist/files/cache-file.d.ts +4 -1
- package/dist/files/cache-file.js.map +1 -1
- package/dist/files/file-id-utils.d.ts +7 -0
- package/dist/files/file-id-utils.js +25 -0
- package/dist/files/file-id-utils.js.map +1 -0
- package/dist/files/read-files.js +8 -8
- package/dist/files/read-files.js.map +1 -1
- package/dist/files/source-code-tree.js +3 -3
- package/dist/files/source-code-tree.js.map +1 -1
- package/dist/files/source-code-types.d.ts +21 -3
- package/dist/files/summary-cache.d.ts +3 -2
- package/dist/files/summary-cache.js +1 -1
- package/dist/files/summary-cache.js.map +1 -1
- package/dist/main/common/content-bus-types.d.ts +1 -1
- package/dist/main/common/content-bus.js +1 -1
- package/dist/main/common/content-bus.js.map +1 -1
- package/dist/main/config-schema.js +1 -1
- package/dist/main/config-schema.js.map +1 -1
- package/dist/main/ui/frontend/assets/{index-CSR1NiB_.js → index-Dizqxzws.js} +226 -187
- package/dist/main/ui/frontend/index.html +1 -1
- package/dist/prompt/ai-service-fallback.js +5 -1
- package/dist/prompt/ai-service-fallback.js.map +1 -1
- package/dist/prompt/function-calling.js +8 -1
- package/dist/prompt/function-calling.js.map +1 -1
- package/dist/prompt/function-defs/ask-question.d.ts +3 -0
- package/dist/prompt/function-defs/ask-question.js +43 -1
- package/dist/prompt/function-defs/ask-question.js.map +1 -1
- package/dist/prompt/function-defs/context-compression.d.ts +25 -5
- package/dist/prompt/function-defs/context-compression.js +23 -8
- package/dist/prompt/function-defs/context-compression.js.map +1 -1
- package/dist/prompt/function-defs/conversation-graph.d.ts +33 -0
- package/dist/prompt/function-defs/conversation-graph.js +110 -0
- package/dist/prompt/function-defs/conversation-graph.js.map +1 -0
- package/dist/prompt/function-defs/extract-file-fragments.d.ts +27 -0
- package/dist/prompt/function-defs/extract-file-fragments.js +36 -0
- package/dist/prompt/function-defs/extract-file-fragments.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/ask-question-handler.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/ask-question-handler.js +12 -0
- package/dist/prompt/steps/step-ask-question/ask-question-handler.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.js +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/file-request-utils.d.ts +47 -0
- package/dist/prompt/steps/step-ask-question/handlers/file-request-utils.js +114 -0
- package/dist/prompt/steps/step-ask-question/handlers/file-request-utils.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-code-generation.d.ts +4 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-code-generation.js +169 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-code-generation.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-confirm-code-generation.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-confirm-code-generation.js +40 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-confirm-code-generation.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-context-compression.js +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-context-compression.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-context-optimization.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-context-optimization.js +34 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-context-optimization.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-conversation-graph.d.ts +12 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-conversation-graph.js +243 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-conversation-graph.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-create-file.d.ts +2 -2
- package/dist/prompt/steps/step-ask-question/handlers/handle-create-file.js +5 -3
- package/dist/prompt/steps/step-ask-question/handlers/handle-create-file.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-end-conversation.js +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-end-conversation.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-genaicode-help.js +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-genaicode-help.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-generate-image.js +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-generate-image.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-lint.d.ts +6 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-lint.js +105 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-lint.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-perform-analysis.js +4 -5
- package/dist/prompt/steps/step-ask-question/handlers/handle-perform-analysis.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-pull-app-context.js +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-pull-app-context.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-push-app-context.js +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-push-app-context.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-reasoning-inference.js +3 -3
- package/dist/prompt/steps/step-ask-question/handlers/handle-reasoning-inference.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-remove-files-from-context.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-remove-files-from-context.js +88 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-remove-files-from-context.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-content.d.ts +8 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-content.js +136 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-content.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-fragments.d.ts +8 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-fragments.js +173 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-fragments.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-permissions.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-permissions.js +71 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-permissions.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-search-code.d.ts +0 -3
- package/dist/prompt/steps/step-ask-question/handlers/handle-search-code.js +2 -3
- package/dist/prompt/steps/step-ask-question/handlers/handle-search-code.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.js +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-update-file.d.ts +2 -2
- package/dist/prompt/steps/step-ask-question/handlers/handle-update-file.js +6 -4
- package/dist/prompt/steps/step-ask-question/handlers/handle-update-file.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js +7 -3
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question-handlers.d.ts +3 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-handlers.js +5 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-handlers.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts +13 -2
- package/dist/prompt/steps/step-ask-question/step-ask-question.d.ts +21 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question.js +30 -71
- package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -1
- package/dist/prompt/steps/step-codegen-planning.js +1 -3
- package/dist/prompt/steps/step-codegen-planning.js.map +1 -1
- package/dist/prompt/steps/step-context-compression.d.ts +1 -1
- package/dist/prompt/steps/step-context-compression.js +130 -34
- package/dist/prompt/steps/step-context-compression.js.map +1 -1
- package/dist/prompt/steps/step-context-optimization.js +7 -68
- package/dist/prompt/steps/step-context-optimization.js.map +1 -1
- package/dist/prompt/steps/step-generate-codegen-summary.js +1 -3
- package/dist/prompt/steps/step-generate-codegen-summary.js.map +1 -1
- package/dist/prompt/steps/step-history-update.js +1 -3
- package/dist/prompt/steps/step-history-update.js.map +1 -1
- package/dist/prompt/steps/step-process-file-updates.js +0 -3
- package/dist/prompt/steps/step-process-file-updates.js.map +1 -1
- package/dist/prompt/steps/step-summarization.d.ts +2 -1
- package/dist/prompt/steps/step-summarization.js +6 -5
- package/dist/prompt/steps/step-summarization.js.map +1 -1
- package/dist/prompt/steps/step-verify-patch.js +1 -3
- package/dist/prompt/steps/step-verify-patch.js.map +1 -1
- package/dist/prompt/systemprompt.js +5 -3
- package/dist/prompt/systemprompt.js.map +1 -1
- package/package.json +4 -4
|
@@ -5,9 +5,11 @@ import { ModelType } from '../../../../ai-service/common-types.js';
|
|
|
5
5
|
import { askUserForConfirmationWithAnswer } from '../../../../main/common/user-actions.js';
|
|
6
6
|
import { putSystemMessage, putUserMessage } from '../../../../main/common/content-bus.js';
|
|
7
7
|
import { refreshFiles } from '../../../../files/find-files.js';
|
|
8
|
-
import { generateRequestFilesContentCall } from './request-files-content.js';
|
|
8
|
+
import { generateRequestFilesContentCall } from './handle-request-files-content.js';
|
|
9
9
|
import { executeStepEnsureContext } from '../../step-ensure-context.js';
|
|
10
|
-
|
|
10
|
+
import { registerActionHandler } from '../step-ask-question-handlers.js';
|
|
11
|
+
registerActionHandler('updateFile', handleUpdateFile);
|
|
12
|
+
export async function handleUpdateFile({ askQuestionCall, options, prompt, generateContentFn, }) {
|
|
11
13
|
putSystemMessage('File update requested.', askQuestionCall);
|
|
12
14
|
// First confirmation: Ask user if they want to proceed with content generation
|
|
13
15
|
const generateConfirmation = await askUserForConfirmationWithAnswer('The assistant suggests generating new content for the file update. Do you want to proceed with content generation?', 'Generate content', 'Cancel content generation', false, options);
|
|
@@ -31,7 +33,7 @@ export const handleUpdateFile = async ({ askQuestionCall, options, prompt, gener
|
|
|
31
33
|
if (generateConfirmation.answer) {
|
|
32
34
|
putUserMessage(generateConfirmation.answer);
|
|
33
35
|
}
|
|
34
|
-
putSystemMessage('Content generation started.'
|
|
36
|
+
putSystemMessage('Content generation started.');
|
|
35
37
|
// Ensure file content is available in the context
|
|
36
38
|
const requestedFilesCall = await generateRequestFilesContentCall(generateContentFn, prompt, askQuestionCall, options, ModelType.CHEAP);
|
|
37
39
|
if (requestedFilesCall) {
|
|
@@ -163,5 +165,5 @@ export const handleUpdateFile = async ({ askQuestionCall, options, prompt, gener
|
|
|
163
165
|
],
|
|
164
166
|
};
|
|
165
167
|
}
|
|
166
|
-
}
|
|
168
|
+
}
|
|
167
169
|
//# sourceMappingURL=handle-update-file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-update-file.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-update-file.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,4DAA4D,CAAC;AAE3G,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,+BAA+B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"handle-update-file.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-update-file.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,4DAA4D,CAAC;AAE3G,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,qBAAqB,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EACrC,eAAe,EACf,OAAO,EACP,MAAM,EACN,iBAAiB,GACE;IACnB,gBAAgB,CAAC,wBAAwB,EAAE,eAAe,CAAC,CAAC;IAE5D,+EAA+E;IAC/E,MAAM,oBAAoB,GAAG,MAAM,gCAAgC,CACjE,oHAAoH,EACpH,kBAAkB,EAClB,2BAA2B,EAC3B,KAAK,EACL,OAAO,CACR,CAAC;IAEF,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,CAAC;QACpC,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE;gBACL;oBACE,SAAS,EAAE;wBACT,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,eAAe,CAAC,IAAK,CAAC,OAAO;qBACpC;oBACD,IAAI,EAAE;wBACJ,I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,MAAM,CAAC,CAAC,CAAC,IAAI,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;4BAChE,wEAAwE;wBAC1E,iBAAiB,EAAE;4BACjB;gCACE,IAAI,EAAE,YAAY;gCAClB,OAAO,EAAE,cAAc,CAAC,EAAE;gCAC1B,OAAO,EAAE,EAAE;6BACZ;yBACF;qBACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -4,7 +4,6 @@ import { getSourceCode } from '../../../../files/read-files.js';
|
|
|
4
4
|
import { getExpandedContextPaths } from '../../../../files/source-code-utils.js';
|
|
5
5
|
import { putSystemMessage } from '../../../../main/common/content-bus.js';
|
|
6
6
|
import { getFunctionDefs } from '../../../function-calling.js';
|
|
7
|
-
import { validateAndRecoverSingleResult } from '../../step-validate-recover.js';
|
|
8
7
|
export async function handleRequestFilesContent({ askQuestionCall, options, prompt, generateContentFn, }) {
|
|
9
8
|
let requestFilesContentCall = await generateRequestFilesContentCall(generateContentFn, prompt, askQuestionCall, options, ModelType.CHEAP);
|
|
10
9
|
if (!requestFilesContentCall) {
|
|
@@ -21,6 +20,7 @@ export async function handleRequestFilesContent({ askQuestionCall, options, prom
|
|
|
21
20
|
// Check which files are already provided in the conversation history
|
|
22
21
|
const alreadyProvidedFiles = requestedFiles.filter((file) => isFileContentAlreadyProvided(file, prompt));
|
|
23
22
|
if (alreadyProvidedFiles.length === requestedFiles.length) {
|
|
23
|
+
putSystemMessage('All requested files are already provided');
|
|
24
24
|
// All requested files are already provided
|
|
25
25
|
prompt.push({
|
|
26
26
|
type: 'assistant',
|
|
@@ -100,6 +100,11 @@ ${illegitimateFiles.map((path) => `- ${path}`).join('\n')}`
|
|
|
100
100
|
],
|
|
101
101
|
cache: true,
|
|
102
102
|
};
|
|
103
|
+
putSystemMessage('Providing files content', {
|
|
104
|
+
requestedFiles,
|
|
105
|
+
legitimateFiles,
|
|
106
|
+
illegitimateFiles,
|
|
107
|
+
});
|
|
103
108
|
prompt.push(assistant, user);
|
|
104
109
|
return { breakLoop: false, items: [] };
|
|
105
110
|
}
|
|
@@ -122,8 +127,7 @@ export async function generateRequestFilesContentCall(generateContentFn, prompt,
|
|
|
122
127
|
modelType,
|
|
123
128
|
options,
|
|
124
129
|
];
|
|
125
|
-
const
|
|
126
|
-
const [requestFilesContentCall] = (await validateAndRecoverSingleResult(req, result, generateContentFn));
|
|
130
|
+
const [requestFilesContentCall] = (await generateContentFn(...req));
|
|
127
131
|
return requestFilesContentCall;
|
|
128
132
|
}
|
|
129
133
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-files-content.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/request-files-content.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"request-files-content.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/request-files-content.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-ask-question-handlers.js","sourceRoot":"","sources":["../../../../src/prompt/steps/step-ask-question/step-ask-question-handlers.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,QAAQ,GAA+C,EAAE,CAAC;AAEvE,MAAM,UAAU,qBAAqB,CAAC,IAAgB,EAAE,OAAsB;IAC5E,QAAQ,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;AAC3B,CAAC"}
|
|
@@ -5,12 +5,18 @@ import { PromptItemImage } from '../../../ai-service/common-types.js';
|
|
|
5
5
|
import { FunctionCall } from '../../../ai-service/common-types.js';
|
|
6
6
|
import { CodegenOptions } from '../../../main/codegen-types.js';
|
|
7
7
|
import { PluginActionType } from '../../../ai-service/service-configurations-types.js';
|
|
8
|
-
export type ActionType = 'codeGeneration' | 'sendMessage' | 'generateImage' | 'requestPermissions' | 'requestFilesContent' | 'removeFilesFromContext' | 'confirmCodeGeneration' | 'endConversation' | 'contextOptimization' | 'contextCompression' | 'searchCode' | 'lint' | 'updateFile' | 'performAnalysis' | 'createFile' | 'pullAppContext' | 'genaicodeHelp' | 'pushAppContext' | 'reasoningInference' | PluginActionType;
|
|
8
|
+
export type ActionType = 'codeGeneration' | 'sendMessage' | 'generateImage' | 'requestPermissions' | 'requestFilesContent' | 'removeFilesFromContext' | 'confirmCodeGeneration' | 'endConversation' | 'contextOptimization' | 'contextCompression' | 'searchCode' | 'lint' | 'updateFile' | 'performAnalysis' | 'createFile' | 'pullAppContext' | 'genaicodeHelp' | 'pushAppContext' | 'reasoningInference' | 'requestFilesFragments' | 'conversationGraph' | PluginActionType;
|
|
9
9
|
type AskQuestionArgs = {
|
|
10
10
|
actionType: ActionType;
|
|
11
11
|
message: string;
|
|
12
12
|
decisionMakingProcess?: string;
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Arguments for sendMessage action
|
|
16
|
+
*/
|
|
17
|
+
export type SendMessageArgs = {
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
14
20
|
/**
|
|
15
21
|
* Arguments for help action
|
|
16
22
|
*/
|
|
@@ -45,6 +51,12 @@ export type RequestPermissionsArgs = Record<'allowDirectoryCreate' | 'allowFileC
|
|
|
45
51
|
export type RequestFilesContentArgs = {
|
|
46
52
|
filePaths: string[];
|
|
47
53
|
};
|
|
54
|
+
export type RequestFilesFragmentsArgs = {
|
|
55
|
+
/** Array of file paths to extract fragments from */
|
|
56
|
+
filePaths: string[];
|
|
57
|
+
/** Prompt describing what information should be extracted from the files */
|
|
58
|
+
fragmentPrompt: string;
|
|
59
|
+
};
|
|
48
60
|
export type RemoveFilesFromContextArgs = {
|
|
49
61
|
filePaths: string[];
|
|
50
62
|
};
|
|
@@ -138,7 +150,6 @@ export interface UserItem {
|
|
|
138
150
|
}
|
|
139
151
|
export interface ActionResult {
|
|
140
152
|
breakLoop: boolean;
|
|
141
|
-
executeCodegen?: boolean;
|
|
142
153
|
stepResult?: FunctionCall[];
|
|
143
154
|
items: Array<{
|
|
144
155
|
assistant: AssistantItem;
|
|
@@ -4,4 +4,25 @@ import { PromptItem } from '../../../ai-service/common-types.js';
|
|
|
4
4
|
import { FunctionCall } from '../../../ai-service/common-types.js';
|
|
5
5
|
import { FunctionDef } from '../../../ai-service/common-types.js';
|
|
6
6
|
import { CodegenOptions } from '../../../main/codegen-types.js';
|
|
7
|
+
import './handlers/handle-code-generation.js';
|
|
8
|
+
import './handlers/handle-confirm-code-generation.js';
|
|
9
|
+
import './handlers/handle-context-compression.js';
|
|
10
|
+
import './handlers/handle-context-optimization.js';
|
|
11
|
+
import './handlers/handle-conversation-graph.js';
|
|
12
|
+
import './handlers/handle-create-file.js';
|
|
13
|
+
import './handlers/handle-end-conversation.js';
|
|
14
|
+
import './handlers/handle-genaicode-help.js';
|
|
15
|
+
import './handlers/handle-generate-image.js';
|
|
16
|
+
import './handlers/handle-lint.js';
|
|
17
|
+
import './handlers/handle-perform-analysis.js';
|
|
18
|
+
import './handlers/handle-pull-app-context.js';
|
|
19
|
+
import './handlers/handle-push-app-context.js';
|
|
20
|
+
import './handlers/handle-reasoning-inference.js';
|
|
21
|
+
import './handlers/handle-remove-files-from-context.js';
|
|
22
|
+
import './handlers/handle-request-files-content.js';
|
|
23
|
+
import './handlers/handle-request-files-fragments.js';
|
|
24
|
+
import './handlers/handle-request-permissions.js';
|
|
25
|
+
import './handlers/handle-search-code.js';
|
|
26
|
+
import './handlers/handle-send-message.js';
|
|
27
|
+
import './handlers/handle-update-file.js';
|
|
7
28
|
export declare function executeStepAskQuestion(generateContentFn: GenerateContentFunction, generateImageFn: GenerateImageFunction, prompt: PromptItem[], functionDefs: FunctionDef[], waitIfPaused: () => Promise<void>, temperature: number, options: CodegenOptions): Promise<FunctionCall[]>;
|
|
@@ -1,42 +1,47 @@
|
|
|
1
1
|
import { ModelType } from '../../../ai-service/common-types.js';
|
|
2
2
|
import { putAssistantMessage, putSystemMessage, putUserMessage } from '../../../main/common/content-bus.js';
|
|
3
3
|
import { abortController } from '../../../main/common/abort-controller.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
4
|
+
import { getUsageMetrics } from '../../../main/common/cost-collector.js';
|
|
5
|
+
import { getActionHandler } from './ask-question-handler.js';
|
|
6
|
+
import './handlers/handle-code-generation.js';
|
|
7
|
+
import './handlers/handle-confirm-code-generation.js';
|
|
8
|
+
import './handlers/handle-context-compression.js';
|
|
9
|
+
import './handlers/handle-context-optimization.js';
|
|
10
|
+
import './handlers/handle-conversation-graph.js';
|
|
11
|
+
import './handlers/handle-create-file.js';
|
|
12
|
+
import './handlers/handle-end-conversation.js';
|
|
13
|
+
import './handlers/handle-genaicode-help.js';
|
|
14
|
+
import './handlers/handle-generate-image.js';
|
|
15
|
+
import './handlers/handle-lint.js';
|
|
16
|
+
import './handlers/handle-perform-analysis.js';
|
|
17
|
+
import './handlers/handle-pull-app-context.js';
|
|
18
|
+
import './handlers/handle-push-app-context.js';
|
|
19
|
+
import './handlers/handle-reasoning-inference.js';
|
|
20
|
+
import './handlers/handle-remove-files-from-context.js';
|
|
21
|
+
import './handlers/handle-request-files-content.js';
|
|
22
|
+
import './handlers/handle-request-files-fragments.js';
|
|
23
|
+
import './handlers/handle-request-permissions.js';
|
|
24
|
+
import './handlers/handle-search-code.js';
|
|
25
|
+
import './handlers/handle-send-message.js';
|
|
26
|
+
import './handlers/handle-update-file.js';
|
|
25
27
|
export async function executeStepAskQuestion(generateContentFn, generateImageFn, prompt, functionDefs, waitIfPaused, temperature, options) {
|
|
26
28
|
putSystemMessage('Allowing the assistant to ask a question...');
|
|
27
29
|
while (!abortController?.signal.aborted) {
|
|
28
30
|
try {
|
|
31
|
+
// Calculate context size using the total tokens per day (this is not a perfect metric, but it's a good approximation)
|
|
32
|
+
const lastTokenCount = getUsageMetrics().total.tpd;
|
|
29
33
|
const askQuestionCall = await getAskQuestionCall(generateContentFn, prompt, functionDefs, temperature, options);
|
|
34
|
+
const totalTokens = getUsageMetrics().total.tpd - lastTokenCount;
|
|
30
35
|
if (!askQuestionCall) {
|
|
31
36
|
break;
|
|
32
37
|
}
|
|
33
38
|
if (askQuestionCall.args?.message) {
|
|
34
|
-
putAssistantMessage(askQuestionCall.args.message, askQuestionCall.args);
|
|
39
|
+
putAssistantMessage(askQuestionCall.args.message, { ...askQuestionCall.args, contextSize: totalTokens });
|
|
35
40
|
}
|
|
36
41
|
const actionType = askQuestionCall.args?.actionType;
|
|
37
42
|
if (actionType) {
|
|
38
43
|
const actionHandler = getActionHandler(actionType);
|
|
39
|
-
|
|
44
|
+
const result = await actionHandler({
|
|
40
45
|
askQuestionCall,
|
|
41
46
|
prompt,
|
|
42
47
|
options,
|
|
@@ -45,26 +50,11 @@ export async function executeStepAskQuestion(generateContentFn, generateImageFn,
|
|
|
45
50
|
waitIfPaused,
|
|
46
51
|
});
|
|
47
52
|
// This is important to display the content to the user interface (ui or interactive cli)
|
|
48
|
-
|
|
53
|
+
const lastItem = result.items.slice(-1)[0];
|
|
49
54
|
if (lastItem?.user?.text) {
|
|
50
55
|
putUserMessage(lastItem.user.text, lastItem.user.data, undefined, undefined, lastItem.user);
|
|
51
56
|
}
|
|
52
57
|
prompt.push(...result.items.map(({ assistant, user }) => [assistant, user]).flat());
|
|
53
|
-
if (result.executeCodegen) {
|
|
54
|
-
result = await getActionHandler('codeGeneration')({
|
|
55
|
-
askQuestionCall,
|
|
56
|
-
prompt,
|
|
57
|
-
options,
|
|
58
|
-
generateContentFn,
|
|
59
|
-
generateImageFn,
|
|
60
|
-
waitIfPaused,
|
|
61
|
-
});
|
|
62
|
-
lastItem = result.items.slice(-1)[0];
|
|
63
|
-
if (lastItem?.user?.text) {
|
|
64
|
-
putUserMessage(lastItem.user.text, undefined, undefined, undefined, lastItem.user);
|
|
65
|
-
}
|
|
66
|
-
prompt.push(...result.items.map(({ assistant, user }) => [assistant, user]).flat());
|
|
67
|
-
}
|
|
68
58
|
if (result.breakLoop) {
|
|
69
59
|
return result.stepResult ?? [];
|
|
70
60
|
}
|
|
@@ -91,38 +81,7 @@ async function getAskQuestionCall(generateContentFn, prompt, functionDefs, tempe
|
|
|
91
81
|
ModelType.CHEAP,
|
|
92
82
|
options,
|
|
93
83
|
];
|
|
94
|
-
|
|
95
|
-
askQuestionResult = await validateAndRecoverSingleResult(askQuestionRequest, askQuestionResult, generateContentFn);
|
|
84
|
+
const askQuestionResult = await generateContentFn(...askQuestionRequest);
|
|
96
85
|
return askQuestionResult.find((call) => call.name === 'askQuestion');
|
|
97
86
|
}
|
|
98
|
-
function getActionHandler(actionType) {
|
|
99
|
-
// First, check if there's a plugin-provided handler for this action type
|
|
100
|
-
const pluginHandler = getRegisteredActionHandlers().get(actionType);
|
|
101
|
-
if (pluginHandler) {
|
|
102
|
-
return pluginHandler;
|
|
103
|
-
}
|
|
104
|
-
// If no plugin handler is found, use the built-in handlers
|
|
105
|
-
const handlers = {
|
|
106
|
-
codeGeneration: handleCodeGeneration,
|
|
107
|
-
endConversation: handleEndConversation,
|
|
108
|
-
confirmCodeGeneration: handleConfirmCodeGeneration,
|
|
109
|
-
requestFilesContent: handleRequestFilesContent,
|
|
110
|
-
requestPermissions: handleRequestPermissions,
|
|
111
|
-
removeFilesFromContext: handleRemoveFilesFromContext,
|
|
112
|
-
sendMessage: handleSendMessage,
|
|
113
|
-
generateImage: handleGenerateImage,
|
|
114
|
-
searchCode: handleSearchCode,
|
|
115
|
-
lint: handleLint,
|
|
116
|
-
contextOptimization: handleContextOptimization,
|
|
117
|
-
updateFile: handleUpdateFile,
|
|
118
|
-
createFile: handleCreateFile,
|
|
119
|
-
performAnalysis: handlePerformAnalysis,
|
|
120
|
-
pullAppContext: handlePullAppContext,
|
|
121
|
-
genaicodeHelp: handleGenaicodeHelp,
|
|
122
|
-
reasoningInference: handleReasoningInference,
|
|
123
|
-
pushAppContext: handlePushAppContext,
|
|
124
|
-
contextCompression: handleContextCompression,
|
|
125
|
-
};
|
|
126
|
-
return handlers[actionType] || handleSendMessage;
|
|
127
|
-
}
|
|
128
87
|
//# sourceMappingURL=step-ask-question.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-ask-question.js","sourceRoot":"","sources":["../../../../src/prompt/steps/step-ask-question/step-ask-question.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAC5G,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"step-ask-question.js","sourceRoot":"","sources":["../../../../src/prompt/steps/step-ask-question/step-ask-question.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAC5G,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,sCAAsC,CAAC;AAC9C,OAAO,8CAA8C,CAAC;AACtD,OAAO,0CAA0C,CAAC;AAClD,OAAO,2CAA2C,CAAC;AACnD,OAAO,yCAAyC,CAAC;AACjD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,2BAA2B,CAAC;AACnC,OAAO,uCAAuC,CAAC;AAC/C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,0CAA0C,CAAC;AAClD,OAAO,gDAAgD,CAAC;AACxD,OAAO,4CAA4C,CAAC;AACpD,OAAO,8CAA8C,CAAC;AACtD,OAAO,0CAA0C,CAAC;AAClD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,mCAAmC,CAAC;AAC3C,OAAO,kCAAkC,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,iBAA0C,EAC1C,eAAsC,EACtC,MAAoB,EACpB,YAA2B,EAC3B,YAAiC,EACjC,WAAmB,EACnB,OAAuB;IAEvB,gBAAgB,CAAC,6CAA6C,CAAC,CAAC;IAEhE,OAAO,CAAC,eAAe,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;QACxC,IAAI,CAAC;YACH,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,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;gBAEpF,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;oBACrB,OAAO,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;gBACjC,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,gBAAgB,CAAC,8BAA8B,CAAC,CAAC;gBACjD,MAAM;YACR,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,gBAAgB,CAAC,sBAAsB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACjG,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED,gBAAgB,CAAC,sEAAsE,CAAC,CAAC;IACzF,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,KAAK,UAAU,kBAAkB,CAC/B,iBAA0C,EAC1C,MAAoB,EACpB,YAA2B,EAC3B,WAAmB,EACnB,OAAuB;IAEvB,MAAM,kBAAkB,GAAwB;QAC9C,MAAM;QACN,YAAY;QACZ,aAAa;QACb,WAAW;QACX,SAAS,CAAC,KAAK;QACf,OAAO;KACR,CAAC;IACF,MAAM,iBAAiB,GAAG,MAAM,iBAAiB,CAAC,GAAG,kBAAkB,CAAC,CAAC;IACzE,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,aAAa,CAAgC,CAAC;AACtG,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ModelType } from '../../ai-service/common-types.js';
|
|
2
2
|
import { getFunctionDefs } from '../function-calling.js';
|
|
3
3
|
import { putSystemMessage } from '../../main/common/content-bus.js';
|
|
4
|
-
import { validateAndRecoverSingleResult } from './step-validate-recover.js';
|
|
5
4
|
import { StepResult } from './steps-types.js';
|
|
6
5
|
import { executeStepEnsureContext } from './step-ensure-context.js';
|
|
7
6
|
import { getRegisteredPlanningPreHooks, getRegisteredPlanningPostHooks } from '../../main/plugin-loader.js';
|
|
@@ -45,8 +44,7 @@ export async function executeStepCodegenPlanning(generateContentFn, prompt, opti
|
|
|
45
44
|
options,
|
|
46
45
|
];
|
|
47
46
|
try {
|
|
48
|
-
|
|
49
|
-
planningResult = await validateAndRecoverSingleResult(planningRequest, planningResult, generateContentFn);
|
|
47
|
+
const planningResult = await generateContentFn(...planningRequest);
|
|
50
48
|
let codegenPlanningRequest = planningResult.find((call) => call.name === 'codegenPlanning');
|
|
51
49
|
if (codegenPlanningRequest) {
|
|
52
50
|
// Execute post-hooks to potentially modify the planning result
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-codegen-planning.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-codegen-planning.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"step-codegen-planning.js","sourceRoot":"","sources":["../../../src/prompt/steps/step-codegen-planning.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAE5G,MAAM,CAAC,MAAM,eAAe,GAAG;;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AA2B,EAAE,KAAK,CAAC,CAAC;YACpD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GenerateContentFunction, PromptItem } from '../../ai-service/common-types.js';
|
|
2
2
|
import { CodegenOptions } from '../../main/codegen-types.js';
|
|
3
3
|
import { StepResult } from './steps-types.js';
|
|
4
|
-
export declare const CONTEXT_COMPRESSION_PROMPT = "Analyze the conversation history and source code dependencies to create a comprehensive context summary that preserves essential information while maintaining reasonable token efficiency.\n\nKey Principles:\n1. Preserve Rich Context: Maintain detailed information about the conversation, especially for expensive operations like reasoning inference, code analysis, or complex decision-making.\n2. Token Efficiency: Aim for
|
|
4
|
+
export declare const CONTEXT_COMPRESSION_PROMPT = "Analyze the conversation history and source code dependencies to create a comprehensive context summary that preserves essential information while maintaining reasonable token efficiency.\n\nKey Principles:\n1. Preserve Rich Context: Maintain detailed information about the conversation, especially for expensive operations like reasoning inference, code analysis, or complex decision-making.\n2. Token Efficiency: Target a 50-80% reduction in tokens while preserving critical information. For example:\n - Long conversations (>50k tokens): Aim for 75-80% reduction\n - Medium conversations (10k-50k tokens): Aim for 60-75% reduction\n - Short conversations (<10k tokens): Aim for 50-60% reduction\n3. File Handling: Do not include file contents in the summary - use filePaths array for this purpose.\n4. Temporal Context: Preserve chronological progression of important decisions and changes.\n\nRequired Information to Preserve:\n\n1. Conversation Flow:\n **High Priority:**\n - Initial problem statement and core requirements\n - Results of expensive operations (reasoning inference, analysis)\n - Key architectural and design decisions with rationale\n - Critical constraints or requirements\n - Major changes in direction or approach\n\n **Medium Priority:**\n - Important clarifying questions and answers\n - User preferences affecting implementation\n - Significant technical discussions\n - Error handling requirements\n\n **Optional:**\n - General feedback or observations\n - Minor clarifications\n - Non-critical issues encountered\n - Routine confirmations\n\n2. Technical Details:\n **High Priority:**\n - Specific code changes proposed or implemented\n - Critical architectural decisions\n - Security considerations\n - Performance requirements\n - Core dependencies and their relationships\n\n **Medium Priority:**\n - Testing requirements\n - Code organization decisions\n - Implementation patterns chosen\n - File structure changes\n\n **Optional:**\n - Alternative approaches considered\n - Code style preferences\n - Non-critical optimizations\n - Documentation suggestions\n\n3. Implementation Status:\n **High Priority:**\n - Current development stage\n - Blocking issues or challenges\n - Critical validation results\n - Required next steps\n\n **Medium Priority:**\n - Completed steps\n - Pending tasks\n - Test results\n\n **Optional:**\n - Nice-to-have features\n - Non-blocking improvements\n - Future considerations\n\nPriority Conflict Resolution:\n1. When multiple items compete for inclusion:\n - Always preserve items marked as \"High Priority\"\n - Include \"Medium Priority\" items if they directly relate to \"High Priority\" items\n - Include \"Optional\" items only if they provide crucial context for \"High Priority\" items\n2. When facing token limits:\n - First, compress or remove \"Optional\" items\n - Then, selectively compress \"Medium Priority\" items\n - Finally, if necessary, compress (but never remove) \"High Priority\" items\n3. When items span multiple categories:\n - Preserve items that appear in multiple \"High Priority\" sections\n - Combine related items to reduce redundancy while maintaining context\n\nDeduplication Guidance:\n1. Identify and remove redundant information:\n Example - Before:\n \"User asked about error handling. Assistant explained error handling approach. User requested clarification about error handling. Assistant provided more details about error handling.\"\n After:\n \"Discussion of error handling approach: Initial explanation followed by clarification of specific details.\"\n\n2. Merge related technical decisions:\n Example - Before:\n \"Decided to use async/await. Later discussed error handling with try/catch. Then added discussion about Promise rejection handling.\"\n After:\n \"Implemented asynchronous operations using async/await pattern, incorporating comprehensive error handling (try/catch and Promise rejections).\"\n\n3. Combine similar requirements:\n Example - Before:\n \"Need to handle network errors. Should retry failed requests. Must implement timeout for requests. Should handle offline mode.\"\n After:\n \"Network handling requirements: Error recovery with retries, request timeouts, and offline mode support.\"\n\nFile Path Inclusion Criteria:\n1. Always Include:\n - Files directly targeted for modification\n - Files containing code being analyzed or referenced\n - Critical dependencies of modified files\n - Configuration files affecting the changes\n\n2. Include Based on Context:\n - Files containing relevant examples or patterns\n - Test files for affected components\n - Related documentation files\n\n3. Do Not Include:\n - Files only mentioned in passing\n - Deprecated or unused files\n - Files from rejected approaches\n - Files outside the current task scope\n\nHandling Complex Technical Discussions:\n1. For Code Analysis:\n - Preserve detailed reasoning about algorithmic choices\n - Keep performance considerations and trade-offs\n - Maintain security-related discussions\n - Retain architectural decisions and their rationale\n\n2. For Multi-File Dependencies:\n - Document relationships between files\n - Preserve dependency chain reasoning\n - Keep critical implementation order requirements\n - Maintain context about shared components\n\n3. For Technical Decisions:\n - Preserve core decision points and rationale\n - Keep relevant constraints and requirements\n - Maintain important trade-off discussions\n - Retain technical debt considerations\n\nFormat your response as a structured JSON object with:\n- conversationSummary: Detailed summary preserving rich context of the conversation's progression and key decisions\n- filePaths: Array of file paths that are critical for the task (no file contents, just paths)\n\nExample of good summary structure:\n{\n \"conversationSummary\": \"Started: User requested CONTEXT_COMPRESSION_PROMPT improvement. Analysis: Current compression too aggressive (100k->100 tokens). Key Decision: Allow larger summaries (5k tokens ok). Reasoning inference revealed importance of preserving expensive operation results. Implementation: Updating compression logic in step-context-compression.ts. Requirements: 1) Less aggressive compression, 2) Rich conversation preservation, 3) No file contents in summary.\",\n \"filePaths\": [\"/path/to/relevant/files\"]\n}\n\nFocus on creating a summary that:\n1. Is comprehensive enough for the AI to understand the full context\n2. Preserves expensive computation results\n3. Maintains chronological flow of decisions\n4. Captures technical details and requirements\n5. Excludes file contents but includes critical file paths";
|
|
5
5
|
/**
|
|
6
6
|
* Executes the context compression step
|
|
7
7
|
*/
|