genaicode 0.9.2 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/ai-service/ai-studio.js +1 -1
  2. package/dist/ai-service/ai-studio.js.map +1 -1
  3. package/dist/ai-service/anthropic.js +4 -1
  4. package/dist/ai-service/anthropic.js.map +1 -1
  5. package/dist/ai-service/common.js +1 -1
  6. package/dist/ai-service/common.js.map +1 -1
  7. package/dist/ai-service/service-configurations.js +2 -2
  8. package/dist/ai-service/service-configurations.js.map +1 -1
  9. package/dist/ai-service/vertex-ai.js +1 -1
  10. package/dist/ai-service/vertex-ai.js.map +1 -1
  11. package/dist/files/cache-file.d.ts +4 -1
  12. package/dist/files/cache-file.js.map +1 -1
  13. package/dist/files/file-id-utils.d.ts +7 -0
  14. package/dist/files/file-id-utils.js +25 -0
  15. package/dist/files/file-id-utils.js.map +1 -0
  16. package/dist/files/read-files.js +8 -8
  17. package/dist/files/read-files.js.map +1 -1
  18. package/dist/files/source-code-tree.js +3 -3
  19. package/dist/files/source-code-tree.js.map +1 -1
  20. package/dist/files/source-code-types.d.ts +21 -3
  21. package/dist/files/summary-cache.d.ts +3 -2
  22. package/dist/files/summary-cache.js +1 -1
  23. package/dist/files/summary-cache.js.map +1 -1
  24. package/dist/main/common/content-bus-types.d.ts +1 -1
  25. package/dist/main/common/content-bus.js +1 -1
  26. package/dist/main/common/content-bus.js.map +1 -1
  27. package/dist/main/ui/frontend/assets/{index-B0R1bgBi.js → index-COR2Vhaf.js} +226 -187
  28. package/dist/main/ui/frontend/index.html +1 -1
  29. package/dist/prompt/ai-service-fallback.js +5 -1
  30. package/dist/prompt/ai-service-fallback.js.map +1 -1
  31. package/dist/prompt/function-calling.js +4 -1
  32. package/dist/prompt/function-calling.js.map +1 -1
  33. package/dist/prompt/function-defs/ask-question.d.ts +1 -0
  34. package/dist/prompt/function-defs/ask-question.js +25 -0
  35. package/dist/prompt/function-defs/ask-question.js.map +1 -1
  36. package/dist/prompt/function-defs/context-compression.d.ts +25 -5
  37. package/dist/prompt/function-defs/context-compression.js +23 -8
  38. package/dist/prompt/function-defs/context-compression.js.map +1 -1
  39. package/dist/prompt/function-defs/extract-file-fragments.d.ts +27 -0
  40. package/dist/prompt/function-defs/extract-file-fragments.js +36 -0
  41. package/dist/prompt/function-defs/extract-file-fragments.js.map +1 -0
  42. package/dist/prompt/steps/step-ask-question/handlers/code-generation.js +35 -24
  43. package/dist/prompt/steps/step-ask-question/handlers/code-generation.js.map +1 -1
  44. package/dist/prompt/steps/step-ask-question/handlers/file-request-utils.d.ts +47 -0
  45. package/dist/prompt/steps/step-ask-question/handlers/file-request-utils.js +114 -0
  46. package/dist/prompt/steps/step-ask-question/handlers/file-request-utils.js.map +1 -0
  47. package/dist/prompt/steps/step-ask-question/handlers/handle-code-generation.d.ts +4 -0
  48. package/dist/prompt/steps/step-ask-question/handlers/handle-code-generation.js +167 -0
  49. package/dist/prompt/steps/step-ask-question/handlers/handle-code-generation.js.map +1 -0
  50. package/dist/prompt/steps/step-ask-question/handlers/handle-confirm-code-generation.d.ts +2 -0
  51. package/dist/prompt/steps/step-ask-question/handlers/handle-confirm-code-generation.js +34 -0
  52. package/dist/prompt/steps/step-ask-question/handlers/handle-confirm-code-generation.js.map +1 -0
  53. package/dist/prompt/steps/step-ask-question/handlers/handle-context-optimization.d.ts +2 -0
  54. package/dist/prompt/steps/step-ask-question/handlers/handle-context-optimization.js +32 -0
  55. package/dist/prompt/steps/step-ask-question/handlers/handle-context-optimization.js.map +1 -0
  56. package/dist/prompt/steps/step-ask-question/handlers/handle-create-file.js +1 -1
  57. package/dist/prompt/steps/step-ask-question/handlers/handle-create-file.js.map +1 -1
  58. package/dist/prompt/steps/step-ask-question/handlers/handle-lint.d.ts +6 -0
  59. package/dist/prompt/steps/step-ask-question/handlers/handle-lint.js +103 -0
  60. package/dist/prompt/steps/step-ask-question/handlers/handle-lint.js.map +1 -0
  61. package/dist/prompt/steps/step-ask-question/handlers/handle-perform-analysis.js +2 -5
  62. package/dist/prompt/steps/step-ask-question/handlers/handle-perform-analysis.js.map +1 -1
  63. package/dist/prompt/steps/step-ask-question/handlers/handle-reasoning-inference.js +1 -3
  64. package/dist/prompt/steps/step-ask-question/handlers/handle-reasoning-inference.js.map +1 -1
  65. package/dist/prompt/steps/step-ask-question/handlers/handle-remove-files-from-context.d.ts +2 -0
  66. package/dist/prompt/steps/step-ask-question/handlers/handle-remove-files-from-context.js +86 -0
  67. package/dist/prompt/steps/step-ask-question/handlers/handle-remove-files-from-context.js.map +1 -0
  68. package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-content.d.ts +8 -0
  69. package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-content.js +134 -0
  70. package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-content.js.map +1 -0
  71. package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-fragments.d.ts +8 -0
  72. package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-fragments.js +171 -0
  73. package/dist/prompt/steps/step-ask-question/handlers/handle-request-files-fragments.js.map +1 -0
  74. package/dist/prompt/steps/step-ask-question/handlers/handle-request-permissions.d.ts +2 -0
  75. package/dist/prompt/steps/step-ask-question/handlers/handle-request-permissions.js +69 -0
  76. package/dist/prompt/steps/step-ask-question/handlers/handle-request-permissions.js.map +1 -0
  77. package/dist/prompt/steps/step-ask-question/handlers/handle-update-file.js +2 -2
  78. package/dist/prompt/steps/step-ask-question/handlers/handle-update-file.js.map +1 -1
  79. package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js +7 -3
  80. package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js.map +1 -1
  81. package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts +7 -1
  82. package/dist/prompt/steps/step-ask-question/step-ask-question.js +15 -11
  83. package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -1
  84. package/dist/prompt/steps/step-codegen-planning.js +1 -3
  85. package/dist/prompt/steps/step-codegen-planning.js.map +1 -1
  86. package/dist/prompt/steps/step-context-compression.d.ts +1 -1
  87. package/dist/prompt/steps/step-context-compression.js +130 -34
  88. package/dist/prompt/steps/step-context-compression.js.map +1 -1
  89. package/dist/prompt/steps/step-context-optimization.js +7 -68
  90. package/dist/prompt/steps/step-context-optimization.js.map +1 -1
  91. package/dist/prompt/steps/step-generate-codegen-summary.js +1 -3
  92. package/dist/prompt/steps/step-generate-codegen-summary.js.map +1 -1
  93. package/dist/prompt/steps/step-history-update.js +1 -3
  94. package/dist/prompt/steps/step-history-update.js.map +1 -1
  95. package/dist/prompt/steps/step-process-file-updates.js +0 -3
  96. package/dist/prompt/steps/step-process-file-updates.js.map +1 -1
  97. package/dist/prompt/steps/step-summarization.d.ts +2 -1
  98. package/dist/prompt/steps/step-summarization.js +6 -5
  99. package/dist/prompt/steps/step-summarization.js.map +1 -1
  100. package/dist/prompt/steps/step-verify-patch.js +1 -3
  101. package/dist/prompt/steps/step-verify-patch.js.map +1 -1
  102. package/dist/prompt/systemprompt.js +1 -0
  103. package/dist/prompt/systemprompt.js.map +1 -1
  104. package/package.json +4 -4
@@ -7,7 +7,7 @@
7
7
  <meta name="keywords" content="GenAIcode, AI, code generation, programming" />
8
8
  <title>GenAIcode - AI-Powered Code Generation</title>
9
9
  <link rel="icon" href="/assets/favicon-DvroFOpS.png" type="image/png" />
10
- <script type="module" crossorigin src="/assets/index-B0R1bgBi.js"></script>
10
+ <script type="module" crossorigin src="/assets/index-COR2Vhaf.js"></script>
11
11
  <link rel="stylesheet" crossorigin href="/assets/index-S_ocA1xG.css">
12
12
  </head>
13
13
  <body data-security-token="__SECURITY_TOKEN__">
@@ -1,6 +1,7 @@
1
1
  import { putSystemMessage } from '../main/common/content-bus.js';
2
2
  import { askUserForConfirmation } from '../main/common/user-actions.js';
3
3
  import { abortController } from '../main/common/abort-controller.js';
4
+ import { validateAndRecoverSingleResult } from './steps/step-validate-recover.js';
4
5
  export async function handleAiServiceFallback(generateContentFns, options, ...args) {
5
6
  // eslint-disable-next-line no-constant-condition
6
7
  while (true) {
@@ -10,7 +11,10 @@ export async function handleAiServiceFallback(generateContentFns, options, ...ar
10
11
  }
11
12
  try {
12
13
  const result = await generateContentFns[options.aiService](...args);
13
- return result;
14
+ // Attempt to validate and recover the result if necessary
15
+ // If validation/recovery fails we'll handle it in the outer catch
16
+ const validatedResult = await validateAndRecoverSingleResult(args, result, generateContentFns[options.aiService]);
17
+ return validatedResult;
14
18
  }
15
19
  catch (error) {
16
20
  if (error instanceof Error) {
@@ -1 +1 @@
1
- {"version":3,"file":"ai-service-fallback.js","sourceRoot":"","sources":["../../src/prompt/ai-service-fallback.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErE,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,kBAAkE,EAClE,OAAuB,EACvB,GAAG,IAAyC;IAE5C,iDAAiD;IACjD,OAAO,IAAI,EAAE,CAAC;QACZ,IAAI,eAAe,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;YACpC,gBAAgB,CAAC,6BAA6B,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;YACnE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;YACpE,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,+CAA+C;gBAC/C,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,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BACd,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,0CAA0C;gBAC1C,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -4,7 +4,7 @@ import { getImageAssets } from './function-defs/get-image-assets.js';
4
4
  import { getCodegenSummaryDef } from './function-defs/codegen-summary.js';
5
5
  import { explanation } from './function-defs/explanation.js';
6
6
  import { generateImage } from './function-defs/generate-image.js';
7
- import { getAskQuestionDef, requestPermissions, requestFilesContent, removeFilesFromContext, contextOptimization, searchCode, lint, pullAppContext, pushAppContext, } from './function-defs/ask-question.js';
7
+ import { getAskQuestionDef, requestPermissions, requestFilesContent, removeFilesFromContext, contextOptimization, searchCode, lint, pullAppContext, pushAppContext, requestFilesFragments, } from './function-defs/ask-question.js';
8
8
  import { optimizeContext } from './function-defs/optimize-context.js';
9
9
  import { setSummaries } from './function-defs/set-summaries.js';
10
10
  import { updateHistory } from './function-defs/update-history.js';
@@ -16,6 +16,7 @@ import { analysisResult } from './function-defs/analysis-result.js';
16
16
  import { genaicodeHelpDef } from './function-defs/genaicode-help.js';
17
17
  import { reasoningInference, reasoningInferenceResponse } from './function-defs/reasoning-inference.js';
18
18
  import { compressContext } from './function-defs/context-compression.js';
19
+ import { extractFileFragments } from './function-defs/extract-file-fragments.js';
19
20
  /**
20
21
  * Function definitions for function calling feature
21
22
  */
@@ -46,6 +47,8 @@ export function getFunctionDefs() {
46
47
  reasoningInference,
47
48
  compressContext,
48
49
  reasoningInferenceResponse,
50
+ extractFileFragments,
51
+ requestFilesFragments,
49
52
  ...getOperationDefs(),
50
53
  ].map((fd) => {
51
54
  if (!disableExplanations &&
@@ -1 +1 @@
1
- {"version":3,"file":"function-calling.js","sourceRoot":"","sources":["../../src/prompt/function-calling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAA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,CAAC;QAChD,CAAC;aAAM,IAAI,mBAAmB,EAAE,CAAC;YAC/B,OAAO,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC;QAC9C,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -7,6 +7,7 @@ import { FunctionDef } from '../../ai-service/common-types.js';
7
7
  */
8
8
  export declare const getAskQuestionDef: () => FunctionDef;
9
9
  export declare const requestFilesContent: FunctionDef;
10
+ export declare const requestFilesFragments: FunctionDef;
10
11
  export declare const removeFilesFromContext: FunctionDef;
11
12
  export declare const contextOptimization: FunctionDef;
12
13
  export declare const requestPermissions: FunctionDef;
@@ -20,6 +20,7 @@ Detailed Explanation of actionTypes:
20
20
  - searchCode: Use to search through source code files with flexible filtering. Supports searching in file contents and names, with pattern matching and case sensitivity options. Useful for finding specific code patterns or references across the codebase.
21
21
  - confirmCodeGeneration: Use to confirm with the user before starting code generation tasks.
22
22
  - endConversation: Use to stop the conversation.
23
+ - requestFilesFragments: Use to request fragments (specific parts) of files based on a given prompt. This is useful when you need only certain sections of files, not their entire content.
23
24
  ${rcConfig.featuresEnabled?.appContext
24
25
  ? `- pullAppContext: Use to retrieve application context values for use in the conversation. This allows accessing shared state between the application and GenAIcode.
25
26
  - pushAppContext: Use to update application context values based on conversation outcomes. This enables persisting conversation results back to the application.`
@@ -45,6 +46,7 @@ const actionTypeOptions = [
45
46
  'searchCode',
46
47
  'confirmCodeGeneration',
47
48
  'endConversation',
49
+ 'requestFilesFragments',
48
50
  ...(rcConfig.featuresEnabled?.appContext ? ['pullAppContext', 'pushAppContext'] : []),
49
51
  ...(rcConfig.lintCommand ? ['lint'] : []),
50
52
  ...Array.from(getRegisteredActionHandlers().keys()),
@@ -135,6 +137,29 @@ export const requestFilesContent = {
135
137
  required: ['filePaths'],
136
138
  },
137
139
  };
140
+ // requestFilesFragments
141
+ export const requestFilesFragments = {
142
+ name: 'requestFilesFragments',
143
+ description: 'Use this function to request fragments of files based on a given prompt. The prompt will be used to extract relevant information from the files.',
144
+ parameters: {
145
+ type: 'object',
146
+ properties: {
147
+ filePaths: {
148
+ type: 'array',
149
+ items: {
150
+ type: 'string',
151
+ },
152
+ minLength: 1,
153
+ description: 'An array of absolute file paths for which you need to extract fragments.',
154
+ },
155
+ fragmentPrompt: {
156
+ type: 'string',
157
+ description: 'A prompt describing what information should be extracted from the files.',
158
+ },
159
+ },
160
+ required: ['filePaths', 'fragmentPrompt'],
161
+ },
162
+ };
138
163
  // removeFilesFromContext
139
164
  export const removeFilesFromContext = {
140
165
  name: 'removeFilesFromContext',
@@ -1 +1 @@
1
- {"version":3,"file":"ask-question.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/ask-question.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,sCAAsC,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAElH,SAAS,wBAAwB;IAC/B,MAAM,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAAC,sCAAsC,EAAE,CAAC,OAAO,EAAE,CAAC;SACtF,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,MAAM,UAAU,KAAK,WAAW,EAAE,CAAC;SACtE,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO;;;;;;;;;;;;;;;;EAiBP,QAAQ,CAAC,eAAe,EAAE,UAAU;QAClC,CAAC,CAAC;iKAC2J;QAC7J,CAAC,CAAC,EACN;EACE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,2FAA2F,CAAC,CAAC,CAAC,EAAE;EACvH,kBAAkB;;;;uHAImG,CAAC;AACxH,CAAC;AAED,MAAM,iBAAiB,GAAa;IAClC,aAAa;IACb,eAAe;IACf,YAAY;IACZ,YAAY;IACZ,iBAAiB;IACjB,oBAAoB;IACpB,qBAAqB;IACrB,wBAAwB;IACxB,qBAAq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ACpF;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,kDAAkD;aAChE;SACF;QACD,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC;KAC3B;CACF,CAAC"}
@@ -5,6 +5,13 @@ import { FunctionCall, FunctionDef } from '../../ai-service/common-types.js';
5
5
  * This function performs intelligent context compression by analyzing both conversation
6
6
  * history and source code dependencies. It aims to reduce token usage while maintaining
7
7
  * essential information required for high-quality code generation.
8
+ *
9
+ * The compression process:
10
+ * 1. Analyzes conversation history to identify high, medium, and optional priority information
11
+ * 2. Deduplicates redundant information while preserving context
12
+ * 3. Identifies and includes critical file paths based on specific criteria
13
+ * 4. Maintains chronological progression of important decisions
14
+ * 5. Preserves technical details and implementation status
8
15
  */
9
16
  export declare const compressContext: FunctionDef;
10
17
  /**
@@ -13,13 +20,26 @@ export declare const compressContext: FunctionDef;
13
20
  * are compressed and managed.
14
21
  */
15
22
  export type ContextCompressionArgs = {
16
- /** A concise summary of the key points from the conversation history */
23
+ /**
24
+ * A concise summary of the key points from the conversation history.
25
+ * The summary should:
26
+ * - Preserve high-priority information (requirements, decisions, analysis results)
27
+ * - Include relevant medium-priority items (clarifications, preferences)
28
+ * - Maintain chronological order of important events
29
+ * - Keep technical accuracy and context
30
+ */
17
31
  conversationSummary: string;
18
- /** The identified primary intent or goal of the code generation task */
19
- codegenIntent: string;
20
32
  /**
21
- * Optional list of file paths that are essential for the code generation task.
22
- * These files will be retained in the context even after compression.
33
+ * List of file paths that are essential for the code generation task.
34
+ * The list should include:
35
+ * - Files directly targeted for modification
36
+ * - Files containing code being analyzed
37
+ * - Critical dependencies of modified files
38
+ * - Configuration files affecting the changes
39
+ * But exclude:
40
+ * - Files only mentioned in passing
41
+ * - Files from rejected approaches
42
+ * - Files outside the current task scope
23
43
  */
24
44
  filePaths?: string[];
25
45
  };
@@ -4,31 +4,46 @@
4
4
  * This function performs intelligent context compression by analyzing both conversation
5
5
  * history and source code dependencies. It aims to reduce token usage while maintaining
6
6
  * essential information required for high-quality code generation.
7
+ *
8
+ * The compression process:
9
+ * 1. Analyzes conversation history to identify high, medium, and optional priority information
10
+ * 2. Deduplicates redundant information while preserving context
11
+ * 3. Identifies and includes critical file paths based on specific criteria
12
+ * 4. Maintains chronological progression of important decisions
13
+ * 5. Preserves technical details and implementation status
7
14
  */
8
15
  export const compressContext = {
9
16
  name: 'compressContext',
10
17
  description: 'Use this function to compress the context by analyzing both conversation history and source code dependencies. ' +
11
- 'The function returns a compressed version of the conversation that maintains essential information while reducing tokens.',
18
+ 'The function returns a compressed version of the conversation that maintains essential information while reducing tokens. ' +
19
+ 'It prioritizes information (High/Medium/Optional), deduplicates content, and carefully manages file path inclusion.',
12
20
  parameters: {
13
21
  type: 'object',
14
22
  properties: {
15
23
  conversationSummary: {
16
24
  type: 'string',
17
- description: 'A concise summary of the key points from the conversation history.',
18
- },
19
- codegenIntent: {
20
- type: 'string',
21
- description: 'The identified primary intent or goal of the code generation task.',
25
+ description: 'A concise summary of the conversation history, preserving high-priority information ' +
26
+ '(core requirements, expensive operations results, key decisions), medium-priority items ' +
27
+ '(important clarifications, preferences), and optional details when relevant. ' +
28
+ 'The summary should maintain chronological order and technical accuracy.',
22
29
  },
23
30
  filePaths: {
24
31
  type: 'array',
25
32
  items: {
26
33
  type: 'string',
27
34
  },
28
- description: 'List of file paths that are essential for the code generation task.',
35
+ description: 'List of file paths that are essential for the code generation task. Include:\n' +
36
+ '- Files directly involved in code changes\n' +
37
+ '- Files containing analyzed or discussed code\n' +
38
+ '- Critical dependencies of modified files\n' +
39
+ '- Configuration files affecting changes\n' +
40
+ 'Exclude:\n' +
41
+ '- Files only mentioned in passing\n' +
42
+ '- Files from rejected approaches\n' +
43
+ '- Files outside current task scope',
29
44
  },
30
45
  },
31
- required: ['conversationSummary', 'codegenIntent', 'filePaths'],
46
+ required: ['conversationSummary', 'filePaths'],
32
47
  },
33
48
  };
34
49
  //# sourceMappingURL=context-compression.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-compression.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/context-compression.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAgB;IAC1C,IAAI,EAAE,iBAAiB;IACvB,WAAW,EACT,iHAAiH;QACjH,2HAA2H;IAC7H,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,mBAAmB,EAAE;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,oEAAoE;aAClF;YACD,aAAa,EAAE;gBACb,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,oEAAoE;aAClF;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;gBACD,WAAW,EAAE,qEAAqE;aACnF;SACF;QACD,QAAQ,EAAE,CAAC,qBAAqB,EAAE,eAAe,EAAE,WAAW,CAAC;KAChE;CACF,CAAC"}
1
+ {"version":3,"file":"context-compression.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/context-compression.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,eAAe,GAAgB;IAC1C,IAAI,EAAE,iBAAiB;IACvB,WAAW,EACT,iHAAiH;QACjH,4HAA4H;QAC5H,qHAAqH;IACvH,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,mBAAmB,EAAE;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,sFAAsF;oBACtF,0FAA0F;oBAC1F,+EAA+E;oBAC/E,yEAAyE;aAC5E;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;gBACD,WAAW,EACT,gFAAgF;oBAChF,6CAA6C;oBAC7C,iDAAiD;oBACjD,6CAA6C;oBAC7C,2CAA2C;oBAC3C,YAAY;oBACZ,qCAAqC;oBACrC,oCAAoC;oBACpC,oCAAoC;aACvC;SACF;QACD,QAAQ,EAAE,CAAC,qBAAqB,EAAE,WAAW,CAAC;KAC/C;CACF,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { FunctionDef } from '../../ai-service/common-types';
2
+ /**
3
+ * Response from extractFileFragments function
4
+ */
5
+ export declare const extractFileFragments: FunctionDef;
6
+ /**
7
+ * Structure representing a fragment extracted from a file
8
+ */
9
+ export type FileFragment = {
10
+ /** The extracted fragment content */
11
+ content: string;
12
+ /** Explanation of why this fragment was selected */
13
+ reason: string;
14
+ /** The path of the file this fragment was extracted from */
15
+ filePath: string;
16
+ };
17
+ /**
18
+ * Response from extractFileFragments function
19
+ */
20
+ export type ExtractFileFragmentsArgs = {
21
+ /** Array of file paths that were processed */
22
+ filePaths: string[];
23
+ /** Array of extracted fragments with their locations and explanations */
24
+ fragments: FileFragment[];
25
+ /** Explanation of how the fragments were selected and why they are relevant */
26
+ reasoning: string;
27
+ };
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Response from extractFileFragments function
3
+ */
4
+ export const extractFileFragments = {
5
+ name: 'extractFileFragments',
6
+ description: 'Response containing extracted fragments from one or more files.',
7
+ parameters: {
8
+ type: 'object',
9
+ properties: {
10
+ fragments: {
11
+ type: 'array',
12
+ items: {
13
+ type: 'object',
14
+ properties: {
15
+ reason: {
16
+ type: 'string',
17
+ description: 'Explanation of why this fragment was selected.',
18
+ },
19
+ content: {
20
+ type: 'string',
21
+ description: 'The extracted fragment content.',
22
+ },
23
+ filePath: {
24
+ type: 'string',
25
+ description: 'The path of the file this fragment was extracted from.',
26
+ },
27
+ },
28
+ required: ['reason', 'content', 'filePath'],
29
+ },
30
+ description: 'Array of extracted fragments with their locations and explanations.',
31
+ },
32
+ },
33
+ required: ['fragments'],
34
+ },
35
+ };
36
+ //# sourceMappingURL=extract-file-fragments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-file-fragments.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/extract-file-fragments.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAgB;IAC/C,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,iEAAiE;IAC9E,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,MAAM,EAAE;4BACN,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,gDAAgD;yBAC9D;wBACD,OAAO,EAAE;4BACP,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,iCAAiC;yBAC/C;wBACD,QAAQ,EAAE;4BACR,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,wDAAwD;yBACtE;qBACF;oBACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC;iBAC5C;gBACD,WAAW,EAAE,qEAAqE;aACnF;SACF;QACD,QAAQ,EAAE,CAAC,WAAW,CAAC;KACxB;CACF,CAAC"}
@@ -87,17 +87,17 @@ export async function handleCodeGeneration({ generateContentFn, generateImageFn,
87
87
  // Second step: Process file updates
88
88
  const updateResults = await processFileUpdates(generateContentFn, prompt, getFunctionDefs(), options, codegenSummaryRequest, waitIfPaused, generateImageFn);
89
89
  const functionCalls = [...baseResult, ...updateResults];
90
- const confirmed = await askUserForConfirmationWithAnswer('Code changes are generated, now what?', 'Apply code changes', 'Continue conversation', true, options);
90
+ const confirmApply = await askUserForConfirmationWithAnswer('Code changes are generated, now what?', 'Apply code changes', 'Reject code changes', true, options);
91
91
  putAssistantMessage('Code changes are generated, now what?');
92
- putUserMessage(confirmed.answer || 'Apply code changes.');
93
- prompt.push({
94
- type: 'assistant',
95
- text: 'Code changes are generated, now what?',
96
- }, {
97
- type: 'user',
98
- text: confirmed.answer || 'Apply code changes.',
99
- });
100
- if (confirmed.confirmed) {
92
+ if (confirmApply.confirmed) {
93
+ putUserMessage(confirmApply.answer || 'Apply code changes.');
94
+ prompt.push({
95
+ type: 'assistant',
96
+ text: 'Code changes are generated, now what?',
97
+ }, {
98
+ type: 'user',
99
+ text: 'Apply code changes. ' + confirmApply.answer,
100
+ });
101
101
  putSystemMessage('Applying code changes...');
102
102
  if (options.dryRun) {
103
103
  putSystemMessage('Dry run mode, not updating files');
@@ -108,35 +108,44 @@ export async function handleCodeGeneration({ generateContentFn, generateImageFn,
108
108
  putSystemMessage('Code changes applied successfully');
109
109
  }
110
110
  }
111
- if (confirmed.confirmed &&
112
- (await askUserForConfirmation('Code generation completed, do you want to continue conversation?', false, options, 'Continue conversation', 'End conversation')).confirmed) {
113
- putSystemMessage('Continuing conversation...');
114
- const compressionResult = await executeStepContextCompression(generateContentFn, prompt, options);
111
+ else {
112
+ putUserMessage(confirmApply.answer || 'Reject code changes.');
113
+ putSystemMessage('Rejecting code changes...');
115
114
  prompt.push({
116
115
  type: 'assistant',
117
- text: 'Code generation completed, changes applied successfully. Should we continue the conversation?',
116
+ text: 'Code changes are generated, now what?',
118
117
  }, {
119
118
  type: 'user',
120
- text: 'Thank you for doing the code generation, now lets continue the conversation.',
119
+ text: 'Reject code changes. ' + confirmApply.answer,
121
120
  });
122
- return {
123
- breakLoop: compressionResult !== StepResult.CONTINUE,
124
- stepResult: functionCalls,
125
- items: [],
126
- };
127
121
  }
128
- else {
122
+ if (!(await askUserForConfirmation('Code generation completed, do you want to continue conversation?', false, options, 'Continue conversation', 'End conversation')).confirmed) {
129
123
  return {
130
124
  breakLoop: true,
131
125
  stepResult: functionCalls,
132
126
  items: [],
133
127
  };
134
128
  }
129
+ putSystemMessage('Continuing conversation...');
130
+ const compressionResult = await executeStepContextCompression(generateContentFn, prompt, options);
131
+ prompt.push({
132
+ type: 'assistant',
133
+ text: `Code generation completed, changes ${confirmApply.confirmed ? 'were accepted and applied' : 'changes were rejected and not applied'}. Should we continue the conversation?`,
134
+ }, {
135
+ type: 'user',
136
+ text: 'Thank you for doing the code generation, now lets continue the conversation.',
137
+ });
138
+ return {
139
+ breakLoop: compressionResult !== StepResult.CONTINUE,
140
+ stepResult: functionCalls,
141
+ items: [],
142
+ };
135
143
  }
136
144
  catch (error) {
137
145
  putSystemMessage(`Error during code generation: ${error instanceof Error ? error.message : 'Unknown error'}`);
146
+ const tryAgainConfirm = await askUserForConfirmation('An error occurred during code generation. Would you like to try again or continue the conversation?', false, options, 'Try again', 'Continue conversation');
138
147
  return {
139
- breakLoop: true,
148
+ breakLoop: !tryAgainConfirm.confirmed,
140
149
  items: [
141
150
  {
142
151
  assistant: {
@@ -146,7 +155,9 @@ export async function handleCodeGeneration({ generateContentFn, generateImageFn,
146
155
  },
147
156
  user: {
148
157
  type: 'user',
149
- text: 'Error occurred during code generation.',
158
+ text: tryAgainConfirm.confirmed
159
+ ? 'Lets continue the conversation'
160
+ : 'Error occurred during code generation.',
150
161
  },
151
162
  },
152
163
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"code-generation.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/code-generation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC/G,OAAO,EAAE,sBAAsB,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AACnH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,W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CACE,MAAM,sBAAsB,CAC1B,kEAAkE,EAClE,KAAK,EACL,OAAO,EACP,uBAAuB,EACvB,kBAAkB,CACnB,CACF,CAAC,SAAS,EACX,CAAC;YACD,gBAAgB,CAAC,4BAA4B,CAAC,CAAC;YAC/C,MAAM,iBAAiB,GAAG,MAAM,6BAA6B,CAAC,iBAAiB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YAElG,MAAM,CAAC,IAAI,CACT;gBACE,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,+FAA+F;aACtG,EACD;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,8EAA8E;aACrF,CACF,CAAC;YAEF,OAAO;gBACL,SAAS,EAAE,iBAAiB,KAAK,UAAU,CAAC,QAAQ;gBACpD,UAAU,EAAE,aAAa;gBACzB,KAAK,EAAE,EAAE;aACV,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO;gBACL,SAAS,EAAE,IAAI;gBACf,UAAU,EAAE,aAAa;gBACzB,KAAK,EAAE,EAAE;aACV,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gBAAgB,CAAC,iCAAiC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;QAC9G,OAAO;YACL,SAAS,EAAE,IAAI;YACf,KAAK,EAAE;gBACL;oBACE,SAAS,EAAE;wBACT,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,qGAAqG;wBAC3G,aAAa,EAAE,EAAE;qBAClB;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,wCAAwC;qBAC/C;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"code-generation.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/code-generation.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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AC,CAAC,2BAA2B,CAAC,CAAC,CAAC,uCAAuC,wCAAwC;SACnL,EACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,8EAA8E;SACrF,CACF,CAAC;QAEF,OAAO;YACL,SAAS,EAAE,iBAAiB,KAAK,UAAU,CAAC,QAAQ;YACpD,UAAU,EAAE,aAAa;YACzB,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gBAAgB,CAAC,iCAAiC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;QAE9G,MAAM,eAAe,GAAG,MAAM,sBAAsB,CAClD,qGAAqG,EACrG,KAAK,EACL,OAAO,EACP,WAAW,EACX,uBAAuB,CACxB,CAAC;QAEF,OAAO;YACL,SAAS,EAAE,CAAC,eAAe,CAAC,SAAS;YACrC,KAAK,EAAE;gBACL;oBACE,SAAS,EAAE;wBACT,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,qGAAqG;wBAC3G,aAAa,EAAE,EAAE;qBAClB;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,eAAe,CAAC,SAAS;4BAC7B,CAAC,CAAC,gCAAgC;4BAClC,CAAC,CAAC,wCAAwC;qBAC7C;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { PromptItem } from '../../../../ai-service/common-types.js';
2
+ import { CodegenOptions } from '../../../../main/codegen-types.js';
3
+ /**
4
+ * Checks if a file's content is already provided in the conversation history
5
+ * @param filePath The path of the file to check
6
+ * @param prompt The conversation history
7
+ * @returns true if the file content is already available in the history
8
+ */
9
+ export declare function isFileContentAlreadyProvided(filePath: string, prompt: PromptItem[]): boolean;
10
+ /**
11
+ * Categorizes requested files into legitimate and illegitimate files
12
+ * @param requestedFiles Array of file paths to categorize
13
+ * @returns Object containing arrays of legitimate and illegitimate file paths
14
+ */
15
+ export declare function categorizeLegitimateFiles(requestedFiles: string[]): {
16
+ legitimateFiles: string[];
17
+ illegitimateFiles: string[];
18
+ };
19
+ /**
20
+ * Checks if a file path is legitimate (exists in the source files)
21
+ * @param filePath The path of the file to check
22
+ * @returns true if the file path is legitimate
23
+ */
24
+ export declare function isFilePathLegitimate(filePath: string): boolean;
25
+ /**
26
+ * Process file requests by checking if they are already provided and categorizing them
27
+ * @param requestedFiles Array of file paths to process
28
+ * @param prompt The conversation history
29
+ * @param options Codegen options
30
+ * @returns Processed file request information
31
+ */
32
+ export declare function processFileRequests(requestedFiles: string[], prompt: PromptItem[], options: CodegenOptions): {
33
+ requestedFiles: string[];
34
+ alreadyProvidedFiles: string[];
35
+ legitimateFiles: string[];
36
+ illegitimateFiles: string[];
37
+ };
38
+ /**
39
+ * Generate a user-friendly message about file processing status
40
+ * @param alreadyProvidedFiles Files already provided in conversation
41
+ * @param requestedFiles Files that were requested
42
+ * @param legitimateFiles Files that are legitimate and will be processed
43
+ * @param illegitimateFiles Files that are not legitimate
44
+ * @param type Type of content being provided ('content' or 'fragments')
45
+ * @returns A formatted message string
46
+ */
47
+ export declare function generateFilesContentPrompt(alreadyProvidedFiles: string[], requestedFiles: string[], legitimateFiles: string[], illegitimateFiles: string[], type: 'content' | 'fragments'): string;
@@ -0,0 +1,114 @@
1
+ import { getSourceFiles } from '../../../../files/find-files.js';
2
+ import { refreshFiles } from '../../../../files/find-files.js';
3
+ import { getExpandedContextPaths } from '../../../../files/source-code-utils.js';
4
+ import { putSystemMessage } from '../../../../main/common/content-bus.js';
5
+ /**
6
+ * Checks if a file's content is already provided in the conversation history
7
+ * @param filePath The path of the file to check
8
+ * @param prompt The conversation history
9
+ * @returns true if the file content is already available in the history
10
+ */
11
+ export function isFileContentAlreadyProvided(filePath, prompt) {
12
+ return prompt.some((item) => {
13
+ if (item.type !== 'user' || !item.functionResponses) {
14
+ return false;
15
+ }
16
+ return item.functionResponses.some((response) => {
17
+ if (response.name !== 'getSourceCode' || !response.content) {
18
+ return false;
19
+ }
20
+ try {
21
+ const sourceCodeMap = JSON.parse(response.content);
22
+ return (sourceCodeMap[filePath] &&
23
+ sourceCodeMap[filePath] &&
24
+ 'content' in sourceCodeMap[filePath] &&
25
+ sourceCodeMap[filePath].content !== null);
26
+ }
27
+ catch (error) {
28
+ console.warn('Error parsing getSourceCode response:', error);
29
+ return false;
30
+ }
31
+ });
32
+ });
33
+ }
34
+ /**
35
+ * Categorizes requested files into legitimate and illegitimate files
36
+ * @param requestedFiles Array of file paths to categorize
37
+ * @returns Object containing arrays of legitimate and illegitimate file paths
38
+ */
39
+ export function categorizeLegitimateFiles(requestedFiles) {
40
+ const legitimateFiles = [];
41
+ const illegitimateFiles = [];
42
+ requestedFiles.forEach((filePath) => {
43
+ if (isFilePathLegitimate(filePath)) {
44
+ legitimateFiles.push(filePath);
45
+ }
46
+ else {
47
+ illegitimateFiles.push(filePath);
48
+ }
49
+ });
50
+ return { legitimateFiles, illegitimateFiles };
51
+ }
52
+ /**
53
+ * Checks if a file path is legitimate (exists in the source files)
54
+ * @param filePath The path of the file to check
55
+ * @returns true if the file path is legitimate
56
+ */
57
+ export function isFilePathLegitimate(filePath) {
58
+ return getSourceFiles().includes(filePath);
59
+ }
60
+ /**
61
+ * Process file requests by checking if they are already provided and categorizing them
62
+ * @param requestedFiles Array of file paths to process
63
+ * @param prompt The conversation history
64
+ * @param options Codegen options
65
+ * @returns Processed file request information
66
+ */
67
+ export function processFileRequests(requestedFiles, prompt, options) {
68
+ // Expand context paths
69
+ requestedFiles = getExpandedContextPaths(requestedFiles, options);
70
+ // Check which files are already provided in the conversation history
71
+ const alreadyProvidedFiles = requestedFiles.filter((file) => isFileContentAlreadyProvided(file, prompt));
72
+ // Filter out already provided files
73
+ requestedFiles = requestedFiles.filter((file) => !isFileContentAlreadyProvided(file, prompt));
74
+ // Refresh files in case new files appeared
75
+ refreshFiles();
76
+ // Categorize files into legitimate and illegitimate
77
+ const { legitimateFiles, illegitimateFiles } = categorizeLegitimateFiles(requestedFiles);
78
+ putSystemMessage('Processing file requests', {
79
+ requestedFiles,
80
+ alreadyProvidedFiles,
81
+ legitimateFiles,
82
+ illegitimateFiles,
83
+ });
84
+ return {
85
+ requestedFiles,
86
+ alreadyProvidedFiles,
87
+ legitimateFiles,
88
+ illegitimateFiles,
89
+ };
90
+ }
91
+ /**
92
+ * Generate a user-friendly message about file processing status
93
+ * @param alreadyProvidedFiles Files already provided in conversation
94
+ * @param requestedFiles Files that were requested
95
+ * @param legitimateFiles Files that are legitimate and will be processed
96
+ * @param illegitimateFiles Files that are not legitimate
97
+ * @param type Type of content being provided ('content' or 'fragments')
98
+ * @returns A formatted message string
99
+ */
100
+ export function generateFilesContentPrompt(alreadyProvidedFiles, requestedFiles, legitimateFiles, illegitimateFiles, type) {
101
+ return ((alreadyProvidedFiles.length > 0
102
+ ? `Some files were already provided in the conversation history:
103
+ ${alreadyProvidedFiles.map((path) => `- ${path}`).join('\n')}
104
+
105
+ Providing ${type} for the remaining files:
106
+ ${requestedFiles.map((path) => `- ${path}`).join('\n')}`
107
+ : `All requested file ${type} have been provided:
108
+ ${legitimateFiles.map((path) => `- ${path}`).join('\n')}`) +
109
+ (illegitimateFiles.length > 0
110
+ ? `\n\nSome files are not legitimate and their ${type} cannot be provided:
111
+ ${illegitimateFiles.map((path) => `- ${path}`).join('\n')}`
112
+ : ''));
113
+ }
114
+ //# sourceMappingURL=file-request-utils.js.map