genaicode 0.10.0 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/ai-service/ai-studio.js +69 -70
  2. package/dist/ai-service/ai-studio.js.map +1 -1
  3. package/dist/ai-service/common-types.d.ts +1 -0
  4. package/dist/ai-service/common.js +3 -0
  5. package/dist/ai-service/common.js.map +1 -1
  6. package/dist/help-docs/genaicode-help-document.d.ts +1 -1
  7. package/dist/help-docs/genaicode-help-document.js +1 -0
  8. package/dist/help-docs/genaicode-help-document.js.map +1 -1
  9. package/dist/main/common/user-actions.d.ts +1 -1
  10. package/dist/main/config-types.d.ts +1 -0
  11. package/dist/main/config.js +8 -1
  12. package/dist/main/config.js.map +1 -1
  13. package/dist/main/ui/common/api-types.d.ts +25 -0
  14. package/dist/main/ui/frontend/assets/index-DWyCD84H.js +2015 -0
  15. package/dist/main/ui/frontend/index.html +1 -1
  16. package/dist/prompt/function-calling-validate.d.ts +2 -1
  17. package/dist/prompt/function-calling-validate.js +2 -2
  18. package/dist/prompt/function-calling-validate.js.map +1 -1
  19. package/dist/prompt/function-calling.js +5 -2
  20. package/dist/prompt/function-calling.js.map +1 -1
  21. package/dist/prompt/function-defs/ask-question.d.ts +1 -0
  22. package/dist/prompt/function-defs/ask-question.js +33 -1
  23. package/dist/prompt/function-defs/ask-question.js.map +1 -1
  24. package/dist/prompt/function-defs/compound-action-list.d.ts +7 -0
  25. package/dist/prompt/function-defs/compound-action-list.js +38 -0
  26. package/dist/prompt/function-defs/compound-action-list.js.map +1 -0
  27. package/dist/prompt/function-defs/compound-action.d.ts +2 -0
  28. package/dist/prompt/function-defs/compound-action.js +43 -0
  29. package/dist/prompt/function-defs/compound-action.js.map +1 -0
  30. package/dist/prompt/function-defs/conversation-graph.d.ts +6 -6
  31. package/dist/prompt/limits.js +1 -1
  32. package/dist/prompt/steps/step-ask-question/handlers/handle-compound-action.d.ts +20 -0
  33. package/dist/prompt/steps/step-ask-question/handlers/handle-compound-action.js +253 -0
  34. package/dist/prompt/steps/step-ask-question/handlers/handle-compound-action.js.map +1 -0
  35. package/dist/prompt/steps/step-ask-question/handlers/handle-conversation-graph.d.ts +6 -7
  36. package/dist/prompt/steps/step-ask-question/handlers/handle-conversation-graph.js +406 -178
  37. package/dist/prompt/steps/step-ask-question/handlers/handle-conversation-graph.js.map +1 -1
  38. package/dist/prompt/steps/step-ask-question/handlers/handle-explore-external-directories.js +4 -1
  39. package/dist/prompt/steps/step-ask-question/handlers/handle-explore-external-directories.js.map +1 -1
  40. package/dist/prompt/steps/step-ask-question/handlers/handle-read-external-files.js +5 -0
  41. package/dist/prompt/steps/step-ask-question/handlers/handle-read-external-files.js.map +1 -1
  42. package/dist/prompt/steps/step-ask-question/handlers/handle-request-git-context.d.ts +3 -0
  43. package/dist/prompt/steps/step-ask-question/handlers/handle-request-git-context.js +184 -0
  44. package/dist/prompt/steps/step-ask-question/handlers/handle-request-git-context.js.map +1 -0
  45. package/dist/prompt/steps/step-ask-question/handlers/handle-update-file.js +8 -12
  46. package/dist/prompt/steps/step-ask-question/handlers/handle-update-file.js.map +1 -1
  47. package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts +25 -1
  48. package/dist/prompt/steps/step-ask-question/step-ask-question.d.ts +2 -0
  49. package/dist/prompt/steps/step-ask-question/step-ask-question.js +2 -0
  50. package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -1
  51. package/dist/prompt/steps/step-validate-recover.js +3 -3
  52. package/dist/prompt/steps/step-validate-recover.js.map +1 -1
  53. package/dist/prompt/systemprompt.d.ts +1 -1
  54. package/dist/prompt/systemprompt.js +7 -2
  55. package/dist/prompt/systemprompt.js.map +1 -1
  56. package/package.json +4 -3
  57. package/dist/main/ui/frontend/assets/index-BlVGo0E6.js +0 -1902
@@ -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-BlVGo0E6.js"></script>
10
+ <script type="module" crossorigin src="/assets/index-DWyCD84H.js"></script>
11
11
  <link rel="stylesheet" crossorigin href="/assets/index-5QDg_0vR.css">
12
12
  </head>
13
13
  <body data-security-token="__SECURITY_TOKEN__">
@@ -1,3 +1,4 @@
1
1
  import { ValidatorResult } from 'jsonschema';
2
2
  import { FunctionCall } from '../ai-service/common-types.js';
3
- export declare function validateFunctionCall(call: FunctionCall | undefined, requiredFunctionName: string, calls: FunctionCall[], rootDir: string): Omit<ValidatorResult, 'addError'> | undefined;
3
+ import { FunctionDef } from '../ai-service/common-types.js';
4
+ export declare function validateFunctionCall(call: FunctionCall | undefined, requiredFunctionName: string, calls: FunctionCall[], rootDir: string, functionDefs: FunctionDef[] | undefined): Omit<ValidatorResult, 'addError'> | undefined;
@@ -1,9 +1,9 @@
1
1
  import { Validator } from 'jsonschema';
2
2
  import path from 'path';
3
3
  import { getFunctionDefs } from './function-calling.js';
4
- export function validateFunctionCall(call, requiredFunctionName, calls, rootDir) {
4
+ export function validateFunctionCall(call, requiredFunctionName, calls, rootDir, functionDefs) {
5
5
  const validator = new Validator();
6
- const functionDef = getFunctionDefs().find((def) => def.name === call?.name);
6
+ const functionDef = (functionDefs ?? getFunctionDefs()).find((def) => def.name === call?.name);
7
7
  // Check if a function was called
8
8
  if (!call) {
9
9
  return makeError(`Function "${requiredFunctionName}" was not called.`, call, '');
@@ -1 +1 @@
1
- {"version":3,"file":"function-calling-validate.js","sourceRoot":"","sources":["../../src/prompt/function-calling-validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA4C,MAAM,YAAY,CAAC;AACjF,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,UAAU,oBAAoB,CAClC,IAA8B,EAC9B,o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,CAAC,IAAY;IAClC,OAAO;QACL,UAAU;QACV,QAAQ;QACR,aAAa;QACb,eAAe;QACf,gBAAgB;QAChB,cAAc;QACd,WAAW;QACX,qBAAqB;QACrB,iBAAiB;KAClB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACnB,CAAC;AAED,SAAS,SAAS,CAAC,OAAe,EAAE,IAA+C,EAAE,YAAoB;IACvG,OAAO;QACL,MAAM,EAAE;YACN;gBACE,OAAO;aACsB;SAChC;QACD,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAY;QACpB,YAAY;QACZ,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,IAAI;KACjB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"function-calling-validate.js","sourceRoot":"","sources":["../../src/prompt/function-calling-validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA4C,MAAM,YAAY,CAAC;AACjF,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,UAAU,oBAAoB,CAClC,IAA8B,EAC9B,oBAA4B,EAC5B,KAAqB,EACrB,OAAe,EACf,YAAuC;IAEvC,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;IAClC,MAAM,WAAW,GAA4B,CAAC,YAAY,IAAI,eAAe,EAAE,CAAC,CAAC,IAAI,CACnF,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,EAAE,IAAI,CACjC,CAAC;IAEF,iCAAiC;IACjC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,SAAS,CAAC,aAAa,oBAAoB,mBAAmB,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IACnF,CAAC;IAED,wCAAwC;IACxC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,SAAS,CACd,iCAAiC,KAA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+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, requestFilesFragments, sendMessage, } from './function-defs/ask-question.js';
7
+ import { getAskQuestionDef, requestPermissions, requestFilesContent, removeFilesFromContext, contextOptimization, searchCode, lint, pullAppContext, pushAppContext, requestFilesFragments, sendMessage, requestGitContextDef, } 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';
@@ -21,6 +21,7 @@ import { conversationGraph, evaluateEdge } from './function-defs/conversation-gr
21
21
  import { conversationSummaryDef } from './function-defs/conversation-summary.js';
22
22
  import { readExternalFiles } from './function-defs/read-external-files.js';
23
23
  import { exploreExternalDirectories } from './function-defs/explore-external-directories.js';
24
+ import { getCompoundActionDef } from './function-defs/compound-action.js';
24
25
  /**
25
26
  * Function definitions for function calling feature
26
27
  */
@@ -58,7 +59,9 @@ export function getFunctionDefs() {
58
59
  sendMessage,
59
60
  conversationSummaryDef,
60
61
  readExternalFiles,
61
- exploreExternalDirectories, // Added this line
62
+ exploreExternalDirectories,
63
+ requestGitContextDef,
64
+ getCompoundActionDef(),
62
65
  ...getOperationDefs(),
63
66
  ].map((fd) => {
64
67
  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,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,O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B,OAAO;QACL,aAAa;QACb,cAAc;QACd,oBAAoB,EAAE;QACtB,qBAAqB,EAAE;QACvB,WAAW;QACX,aAAa;QACb,iBAAiB,EAAE;QACnB,kBAAkB;QAClB,UAAU;QACV,IAAI;QACJ,mBAAmB;QACnB,sBAAsB;QACtB,mBAAmB;QACnB,eAAe;QACf,YAAY;QACZ,aAAa;QACb,WAAW;QACX,eAAe;QACf,cAAc;QACd,cAAc;QACd,cAAc;QACd,gBAAgB;QAChB,kBAAkB;QAClB,eAAe;QACf,0BAA0B;QAC1B,oBAAoB;QACpB,qBAAqB;QACrB,iBAAiB;QACjB,YAAY;QACZ,WAAW;QACX,sBAAsB;QACtB,iBAAiB;QACjB,0BAA0B,EAAE,kBAAkB;QAC9C,GAAG,gBAAgB,EAAE;KACtB,CAAC,GAAG,CAAC,CAAC,EAAe,EAAE,EAAE;QACxB,IACE,CAAC,mBAAmB;YACpB,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW;YACpC,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAC/C,CAAC;YACD,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,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"}
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,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;A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AM,UAAU,eAAe;IAC7B,OAAO;QACL,aAAa;QACb,cAAc;QACd,oBAAoB,EAAE;QACtB,qBAAqB,EAAE;QACvB,WAAW;QACX,aAAa;QACb,iBAAiB,EAAE;QACnB,kBAAkB;QAClB,UAAU;QACV,IAAI;QACJ,mBAAmB;QACnB,sBAAsB;QACtB,mBAAmB;QACnB,eAAe;QACf,YAAY;QACZ,aAAa;QACb,WAAW;QACX,eAAe;QACf,cAAc;QACd,cAAc;QACd,cAAc;QACd,gBAAgB;QAChB,kBAAkB;QAClB,eAAe;QACf,0BAA0B;QAC1B,oBAAoB;QACpB,qBAAqB;QACrB,iBAAiB;QACjB,YAAY;QACZ,WAAW;QACX,sBAAsB;QACtB,iBAAiB;QACjB,0BAA0B;QAC1B,oBAAoB;QACpB,oBAAoB,EAAE;QACtB,GAAG,gBAAgB,EAAE;KACtB,CAAC,GAAG,CAAC,CAAC,EAAe,EAAE,EAAE;QACxB,IACE,CAAC,mBAAmB;YACpB,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW;YACpC,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAC/C,CAAC;YACD,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,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"}
@@ -17,3 +17,4 @@ export declare const searchCode: FunctionDef;
17
17
  export declare const lint: FunctionDef;
18
18
  export declare const pullAppContext: FunctionDef;
19
19
  export declare const pushAppContext: FunctionDef;
20
+ export declare const requestGitContextDef: FunctionDef;
@@ -16,11 +16,12 @@ Detailed Explanation of actionTypes:
16
16
  - requestFilesContent: Use specifically when needing to access or review the contents of files, and it is **not already present in the \`sourceCode\`**. Only use this action if the file content is genuinely missing after the \`getSourceCode\` function response.
17
17
  - readExternalFiles: Use to request access to **read the content of specific files** located outside the project's root directory. User confirmation is required for the batch of external files. Only processed information (summary or extracted facts) will be returned, not the raw file content. **This function is for getting the *contents* of known external files, not for listing directory contents.**
18
18
  - exploreExternalDirectories: Use to **list files and subdirectories within directories** located outside the project's root directory. You can specify criteria to filter the files (recursive, depth, search phrases). User confirmation is required. **This function returns a list of file paths, allowing you to explore directory structures.**
19
+ ${rcConfig.featuresEnabled?.gitContext !== false ? '- requestGitContext: Use to request Git context information like recent commits, file changes, blame output, or file diffs for specific files/commits.' : ''}
19
20
  - removeFilesFromContext: Use to remove unnecessary file contents from context, optimizing token usage.
20
21
  - contextOptimization: Use to manage and optimize context during code generation tasks, allowing the LLM to provide guidance on what parts of the context are most relevant to keep.
21
22
  - contextCompression: Use to compress the context by removing unnecessary tokens and optimizing the context size while maintaining essential information.
22
23
  - 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.
23
- - confirmCodeGeneration: Use to confirm with the user before starting code generation tasks.
24
+ - confirmCodeGeneration: Use to confirm with the user before starting the main, multi-step code generation workflow for implementing features or significant code changes requiring analysis and potentially intertwined modifications across multiple files.
24
25
  - endConversation: Use to stop the conversation.
25
26
  - 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.
26
27
  ${rcConfig.featuresEnabled?.appContext
@@ -28,6 +29,7 @@ ${rcConfig.featuresEnabled?.appContext
28
29
  - pushAppContext: Use to update application context values based on conversation outcomes. This enables persisting conversation results back to the application.`
29
30
  : ''}
30
31
  - conversationGraph: Use for complex conversations needing multiple steps and decisions.
32
+ - compoundAction: Use when the user's request implies multiple *distinct*, *predefined* file operations (create, update, delete, move) or image manipulations that can be batched as a single logical step *within* the conversation flow. This action triggers an internal AI call to generate a list of specific operations based on the user's request, which is then shown to the user for confirmation before execution. **Important**: This is *not* for complex feature implementation or tasks requiring significant analysis and intertwined code generation (use **confirmCodeGeneration** for those instead).
31
33
  ${rcConfig.lintCommand ? '- lint: Use to check the code for errors and provide feedback on the quality of the code.' : ''}
32
34
  ${pluginDescriptions}
33
35
  - genaicodeHelp: Use to provide help to the user on how to use GenAIcode. The response will be grounded in the content of GenAIcode's documentation.
@@ -45,6 +47,7 @@ export const actionTypeOptions = [
45
47
  'requestFilesContent',
46
48
  'readExternalFiles',
47
49
  'exploreExternalDirectories',
50
+ ...(rcConfig.featuresEnabled?.gitContext !== false ? ['requestGitContext'] : ''),
48
51
  'removeFilesFromContext',
49
52
  'contextOptimization',
50
53
  'contextCompression',
@@ -58,6 +61,7 @@ export const actionTypeOptions = [
58
61
  'genaicodeHelp',
59
62
  'reasoningInference',
60
63
  'conversationGraph',
64
+ 'compoundAction',
61
65
  ];
62
66
  /**
63
67
  * Function definition for askQuestion
@@ -360,4 +364,32 @@ export const pushAppContext = {
360
364
  required: ['key', 'value'],
361
365
  },
362
366
  };
367
+ // requestGitContext
368
+ export const requestGitContextDef = {
369
+ name: 'requestGitContext',
370
+ description: 'Use this function to request Git context information like recent commits, file changes, blame output, or file diffs.',
371
+ parameters: {
372
+ type: 'object',
373
+ properties: {
374
+ requestType: {
375
+ type: 'string',
376
+ enum: ['commits', 'fileChanges', 'blame', 'fileDiff'],
377
+ description: 'The type of Git information to request.',
378
+ },
379
+ filePath: {
380
+ type: 'string',
381
+ description: "The absolute file path required for 'fileChanges', 'blame', and 'fileDiff' requests.",
382
+ },
383
+ commitHash: {
384
+ type: 'string',
385
+ description: "The specific commit hash for 'blame' and 'fileDiff' requests.",
386
+ },
387
+ count: {
388
+ type: 'number',
389
+ description: "The number of recent commits to retrieve for 'commits' requests.",
390
+ },
391
+ },
392
+ required: ['requestType'],
393
+ },
394
+ };
363
395
  //# sourceMappingURL=ask-question.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ask-question.js","sourceRoot":"","sources":["../../../src/prompt/function-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sH;IACxH,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,CAAC;gBACrD,WAAW,EAAE,yCAAyC;aACvD;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sFAAsF;aACpG;YACD,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+DAA+D;aAC7E;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,kEAAkE;aAChF;SACF;QACD,QAAQ,EAAE,CAAC,aAAa,CAAC;KAC1B;CACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { FunctionDef } from '../../ai-service/common-types.js';
2
+ /**
3
+ * Function definition for the internal `compoundActionList` function.
4
+ * This is used by the `handleCompoundAction` handler to structure the response
5
+ * from an internal inference call that generates a list of actions.
6
+ */
7
+ export declare const compoundActionListDef: FunctionDef;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Function definition for the internal `compoundActionList` function.
3
+ * This is used by the `handleCompoundAction` handler to structure the response
4
+ * from an internal inference call that generates a list of actions.
5
+ */
6
+ export const compoundActionListDef = {
7
+ name: 'compoundActionList',
8
+ description: 'Receives the list of actions generated by an internal inference call within the compoundAction handler. This function structures the output of the inference.',
9
+ parameters: {
10
+ type: 'object',
11
+ properties: {
12
+ actions: {
13
+ type: 'array',
14
+ description: 'An array of actions (like createFile, updateFile) to be executed as part of a compound operation.',
15
+ items: {
16
+ // Define the schema for CompoundActionItem here based on its definition in step-ask-question-types.ts
17
+ type: 'object',
18
+ properties: {
19
+ actionName: {
20
+ type: 'string',
21
+ description: 'The name of the operation to execute (e.g., createFile, updateFile).',
22
+ // Ideally, we could restrict this to known operation names, but string is safer for now.
23
+ },
24
+ params: {
25
+ type: 'object',
26
+ description: 'The parameters required by the specified actionName.',
27
+ // Using a generic object type as params vary significantly between actions.
28
+ // Additional properties are allowed implicitly.
29
+ },
30
+ },
31
+ required: ['actionName', 'params'],
32
+ },
33
+ },
34
+ },
35
+ required: ['actions'],
36
+ },
37
+ };
38
+ //# sourceMappingURL=compound-action-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compound-action-list.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/compound-action-list.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAgB;IAChD,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACT,+JAA+J;IACjK,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,IAAI,EAAE,OAAO;gBACb,WAAW,EACT,mGAAmG;gBACrG,KAAK,EAAE;oBACL,sGAAsG;oBACtG,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,UAAU,EAAE;4BACV,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,sEAAsE;4BACnF,yFAAyF;yBAC1F;wBACD,MAAM,EAAE;4BACN,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,sDAAsD;4BACnE,4EAA4E;4BAC5E,gDAAgD;yBACjD;qBACF;oBACD,QAAQ,EAAE,CAAC,YAAY,EAAE,QAAQ,CAAC;iBACnC;aACF;SACF;QACD,QAAQ,EAAE,CAAC,SAAS,CAAC;KACtB;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { FunctionDef } from '../../ai-service/common-types.js';
2
+ export declare const getCompoundActionDef: () => FunctionDef;
@@ -0,0 +1,43 @@
1
+ import { getOperationDefs } from '../../operations/operations-index.js';
2
+ export const getCompoundActionDef = () => ({
3
+ name: 'compoundAction',
4
+ description: 'Infers the types of actions required and a summary for user confirmation.',
5
+ parameters: {
6
+ type: 'object',
7
+ properties: {
8
+ actions: {
9
+ type: 'array',
10
+ description: 'An array of action names (e.g., createFile, updateFile) to be performed.',
11
+ items: {
12
+ type: 'object',
13
+ properties: {
14
+ id: {
15
+ type: 'string',
16
+ description: 'A unique identifier for the action.',
17
+ },
18
+ name: {
19
+ type: 'string',
20
+ description: 'The name of the action to be performed.',
21
+ enum: getOperationDefs().map((op) => op.name),
22
+ },
23
+ dependsOn: {
24
+ type: 'array',
25
+ description: 'An array of action IDs that this action depends on.',
26
+ items: {
27
+ type: 'string',
28
+ description: 'The ID of a dependent action.',
29
+ },
30
+ },
31
+ },
32
+ required: ['id', 'name'],
33
+ },
34
+ },
35
+ summary: {
36
+ type: 'string',
37
+ description: 'A user-facing summary of the proposed actions, asking for confirmation.',
38
+ },
39
+ },
40
+ required: ['actions', 'summary'],
41
+ },
42
+ });
43
+ //# sourceMappingURL=compound-action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compound-action.js","sourceRoot":"","sources":["../../../src/prompt/function-defs/compound-action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,MAAM,CAAC,MAAM,oBAAoB,GAAsB,GAAG,EAAE,CAAC,CAAC;IAC5D,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,2EAA2E;IACxF,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,0EAA0E;gBACvF,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,EAAE,EAAE;4BACF,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,qCAAqC;yBACnD;wBACD,IAAI,EAAE;4BACJ,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,yCAAyC;4BACtD,IAAI,EAAE,gBAAgB,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;yBAC9C;wBACD,SAAS,EAAE;4BACT,IAAI,EAAE,OAAO;4BACb,WAAW,EAAE,qDAAqD;4BAClE,KAAK,EAAE;gCACL,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,+BAA+B;6BAC7C;yBACF;qBACF;oBACD,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC;iBACzB;aACF;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yEAAyE;aACvF;SACF;QACD,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;KACjC;CACF,CAAC,CAAC"}
@@ -1,21 +1,21 @@
1
1
  import { FunctionCall, FunctionDef } from '../../ai-service/common-types.js';
2
2
  import { ActionType } from '../steps/step-ask-question/step-ask-question-types.js';
3
3
  export declare const conversationGraph: FunctionDef;
4
- export type ConverationNodeId = string & {
5
- __type: 'ConverationNodeId';
4
+ export type ConversationNodeId = string & {
5
+ __type: 'ConversationNodeId';
6
6
  };
7
7
  export type ConversationEdge = {
8
- sourceNode: ConverationNodeId;
9
- targetNode: ConverationNodeId;
8
+ sourceNode: ConversationNodeId;
9
+ targetNode: ConversationNodeId;
10
10
  instruction: string;
11
11
  };
12
12
  export type ConversationNode = {
13
- id: ConverationNodeId;
13
+ id: ConversationNodeId;
14
14
  actionType: ActionType;
15
15
  instruction: string;
16
16
  };
17
17
  export type ConversationGraphArgs = {
18
- entryNode: ConverationNodeId;
18
+ entryNode: ConversationNodeId;
19
19
  nodes: ConversationNode[];
20
20
  edges: ConversationEdge[];
21
21
  };
@@ -2,7 +2,7 @@ import assert from 'node:assert';
2
2
  import { estimateTokenCount } from './token-estimator.js';
3
3
  const SYSTEM_PROMPT_LIMIT = 3500;
4
4
  const CODEGEN_PROMPT_LIMIT = 1600;
5
- const SOURCE_CODE_LIMIT = 160000;
5
+ const SOURCE_CODE_LIMIT = 200000;
6
6
  function verifyPromptLimit(promptType, prompt, limit) {
7
7
  const tokenCount = estimateTokenCount(prompt);
8
8
  console.log(`${promptType} prompt estimated token count: ${tokenCount}`);
@@ -0,0 +1,20 @@
1
+ import { PromptItem, FunctionDef } from '../../../../ai-service/common-types.js';
2
+ import { ActionHandler } from '../step-ask-question-types.js';
3
+ /**
4
+ * Constructs the prompt for the initial planning phase of a compound action.
5
+ * @param basePrompt The current conversation history.
6
+ * @param assistantMessage The assistant's message initiating the compound action.
7
+ * @param compoundActionDef The function definition for the compound action planner.
8
+ * @returns The prompt items for the planning phase.
9
+ */
10
+ export declare function constructCompoundActionPlanningPrompt(basePrompt: PromptItem[], assistantMessage: string | undefined, compoundActionDef: FunctionDef): PromptItem[];
11
+ /**
12
+ * Constructs the prompt for inferring parameters for a specific action within a compound action.
13
+ * @param basePrompt The current conversation history (which includes prior planning and parameter inferences).
14
+ * @param actionId The unique ID of the current action.
15
+ * @param actionName The name of the current action (e.g., "createFile").
16
+ * @param operationDef The function definition for the current action.
17
+ * @returns The prompt items for the parameter inference phase.
18
+ */
19
+ export declare function constructCompoundActionParameterInferencePrompt(basePrompt: PromptItem[], actionId: string, actionName: string, operationDef: FunctionDef): PromptItem[];
20
+ export declare const handleCompoundAction: ActionHandler;
@@ -0,0 +1,253 @@
1
+ import { ModelType } from '../../../../ai-service/common-types.js';
2
+ import { askUserForConfirmation } from '../../../../main/common/user-actions.js';
3
+ import { getOperationExecutor, getOperationDefs } from '../../../../operations/operations-index.js';
4
+ import { registerActionHandler } from '../step-ask-question-handlers.js';
5
+ import { putAssistantMessage, putSystemMessage } from '../../../../main/common/content-bus.js';
6
+ import { getFunctionDefs } from '../../../function-calling.js';
7
+ import { getCompoundActionDef } from '../../../function-defs/compound-action.js';
8
+ /**
9
+ * Constructs the prompt for the initial planning phase of a compound action.
10
+ * @param basePrompt The current conversation history.
11
+ * @param assistantMessage The assistant's message initiating the compound action.
12
+ * @param compoundActionDef The function definition for the compound action planner.
13
+ * @returns The prompt items for the planning phase.
14
+ */
15
+ export function constructCompoundActionPlanningPrompt(basePrompt, assistantMessage, compoundActionDef) {
16
+ return [
17
+ ...basePrompt,
18
+ {
19
+ type: 'assistant',
20
+ text: assistantMessage ?? '',
21
+ },
22
+ {
23
+ type: 'user',
24
+ text: `Based on the conversation history and my last message, please identify the sequence of file operations (like ${getOperationDefs()
25
+ .map((op) => op.name)
26
+ .join(', ')}) needed to fulfill my request. Provide an array of action names and a concise summary message for my confirmation.
27
+ Please provide information about dependency between actions.
28
+ Use the "${compoundActionDef.name}" function to return this information.`,
29
+ },
30
+ ];
31
+ }
32
+ /**
33
+ * Constructs the prompt for inferring parameters for a specific action within a compound action.
34
+ * @param basePrompt The current conversation history (which includes prior planning and parameter inferences).
35
+ * @param actionId The unique ID of the current action.
36
+ * @param actionName The name of the current action (e.g., "createFile").
37
+ * @param operationDef The function definition for the current action.
38
+ * @returns The prompt items for the parameter inference phase.
39
+ */
40
+ export function constructCompoundActionParameterInferencePrompt(basePrompt, actionId, actionName, operationDef) {
41
+ return [
42
+ ...basePrompt,
43
+ {
44
+ type: 'user',
45
+ text: `Now, for the action "${actionId}:${actionName}", please determine the specific parameters required. Refer to its definition: ${JSON.stringify(operationDef.parameters)}. Use the "${actionName}" function to return these parameters.`,
46
+ },
47
+ ];
48
+ }
49
+ export const handleCompoundAction = async ({ askQuestionCall, options, generateContentFn, prompt, }) => {
50
+ const compoundActionDef = getCompoundActionDef();
51
+ let actions = [];
52
+ let summary = '';
53
+ let initialInferenceCall;
54
+ // Step 1: Infer High-Level Plan (Action Types and Summary)
55
+ try {
56
+ putSystemMessage('Inferring high-level plan for compound action...');
57
+ const initialInferencePrompt = constructCompoundActionPlanningPrompt(prompt, askQuestionCall.args?.message, compoundActionDef);
58
+ const initialResult = await generateContentFn(initialInferencePrompt, {
59
+ modelType: ModelType.CHEAP, // Use a capable model for planning
60
+ functionDefs: getFunctionDefs(), // getFunctionDefs() already includes compoundActionDef
61
+ requiredFunctionName: compoundActionDef.name,
62
+ temperature: 0.2,
63
+ expectedResponseType: { text: false, functionCall: true, media: false },
64
+ }, options);
65
+ initialInferenceCall = initialResult.find((part) => part.type === 'functionCall')?.functionCall;
66
+ if (!initialInferenceCall?.args?.actions || initialInferenceCall.args.actions.length === 0) {
67
+ putSystemMessage('AI failed to generate a list of action types or returned an empty list. Cannot proceed.');
68
+ prompt.push({
69
+ type: 'assistant',
70
+ text: askQuestionCall.args?.message ?? '',
71
+ });
72
+ prompt.push({
73
+ type: 'user',
74
+ text: 'I was unable to determine the necessary actions. Could you please clarify your request or try rephrasing it?',
75
+ });
76
+ return { breakLoop: false, items: [] };
77
+ }
78
+ actions = initialInferenceCall.args.actions;
79
+ summary = initialInferenceCall.args.summary;
80
+ putSystemMessage(`Inferred actions`, { actions, summary });
81
+ }
82
+ catch (error) {
83
+ const errorMessage = error instanceof Error ? error.message : String(error);
84
+ putSystemMessage(`Error during high-level plan inference: ${errorMessage}`);
85
+ prompt.push({
86
+ type: 'assistant',
87
+ text: askQuestionCall.args?.message ?? '',
88
+ }, {
89
+ type: 'user',
90
+ text: `I encountered an error while planning the actions: ${errorMessage}. Please clarify your request.`,
91
+ });
92
+ return { breakLoop: false, items: [] };
93
+ }
94
+ // Add initial planning call to conversation history
95
+ prompt.push({
96
+ type: 'assistant',
97
+ text: askQuestionCall.args?.message ?? '', // This is the original assistant message that triggered compound action
98
+ functionCalls: [initialInferenceCall], // The AI call for planning
99
+ }, {
100
+ type: 'user', // User function response for the planning call (empty content as it was a planning step)
101
+ functionResponses: [
102
+ {
103
+ name: initialInferenceCall.name,
104
+ call_id: initialInferenceCall.id,
105
+ content: '',
106
+ },
107
+ ],
108
+ },
109
+ // Assistant message indicating planning is done, before parameter inference starts
110
+ {
111
+ type: 'assistant',
112
+ text: `I have inferred the actions and I am ready to determine their parameters.`,
113
+ });
114
+ // Step 2: Infer Parameters for Each Action
115
+ const detailedActions = [];
116
+ let parameterInferenceFailed = false;
117
+ const completedActionIds = new Set();
118
+ let actionsToInfer = [...actions]; // Create a mutable copy
119
+ while (actionsToInfer.length > 0) {
120
+ const processableActions = actionsToInfer.filter((action) => !action.dependsOn || action.dependsOn.every((dep) => completedActionIds.has(dep)));
121
+ if (processableActions.length === 0 && actionsToInfer.length > 0) {
122
+ putSystemMessage('Error: Circular dependency or unresolvable dependencies in compound actions.');
123
+ parameterInferenceFailed = true;
124
+ break;
125
+ }
126
+ if (processableActions.length === 0)
127
+ break; // All done or stuck
128
+ const results = await Promise.allSettled(processableActions.map(async (actionToProcess) => {
129
+ const { id: actionId, name: actionName } = actionToProcess;
130
+ const currentOperationDef = getOperationDefs().find((op) => op.name === actionName);
131
+ if (!currentOperationDef) {
132
+ putSystemMessage(`Error: Operation definition not found for action "${actionId}:${actionName}". Skipping this action.`);
133
+ parameterInferenceFailed = true;
134
+ return { success: false, actionId };
135
+ }
136
+ try {
137
+ putSystemMessage(`Inferring parameters for action: ${actionId}:${actionName}...`);
138
+ const paramInferencePrompt = constructCompoundActionParameterInferencePrompt(prompt, // Pass the *current* prompt history
139
+ actionId, actionName, currentOperationDef);
140
+ const paramResult = await generateContentFn(paramInferencePrompt, {
141
+ modelType: ModelType.DEFAULT,
142
+ functionDefs: getFunctionDefs(), // getFunctionDefs() includes all operation defs
143
+ requiredFunctionName: actionName,
144
+ temperature: 0.1,
145
+ expectedResponseType: { text: false, functionCall: true, media: false },
146
+ }, options);
147
+ const paramFunctionCall = paramResult.find((part) => part.type === 'functionCall')?.functionCall;
148
+ if (!paramFunctionCall?.args) {
149
+ putSystemMessage(`AI failed to generate parameters for action "${actionId}:${actionName}".`);
150
+ parameterInferenceFailed = true;
151
+ return { success: false, actionId };
152
+ }
153
+ detailedActions.push({ name: actionName, args: paramFunctionCall.args });
154
+ putSystemMessage(`Inferred parameters for ${actionId}:${actionName}`, { ...paramFunctionCall });
155
+ // Add this specific parameter inference to the prompt history for subsequent inferences
156
+ prompt.push({
157
+ type: 'assistant',
158
+ text: `Inferring parameters for ${actionId}:${actionName}.`, // Short text for assistant turn
159
+ functionCalls: [paramFunctionCall],
160
+ }, {
161
+ type: 'user',
162
+ functionResponses: [
163
+ {
164
+ name: paramFunctionCall.name,
165
+ call_id: paramFunctionCall.id,
166
+ content: '', // Empty content for the function response
167
+ },
168
+ ],
169
+ });
170
+ completedActionIds.add(actionId);
171
+ return { success: true, actionId };
172
+ }
173
+ catch (error) {
174
+ const errorMessage = error instanceof Error ? error.message : String(error);
175
+ putSystemMessage(`Error inferring parameters for action "${actionName}": ${errorMessage}`);
176
+ parameterInferenceFailed = true;
177
+ return { success: false, actionId };
178
+ }
179
+ }));
180
+ // Filter out processed actions from actionsToInfer
181
+ actionsToInfer = actionsToInfer.filter((action) => !processableActions.find((pa) => pa.id === action.id));
182
+ if (results.some((result) => result.status === 'rejected' || (result.status === 'fulfilled' && !result.value.success))) {
183
+ putSystemMessage('Some actions failed to infer parameters. Stopping parameter inference.');
184
+ parameterInferenceFailed = true;
185
+ break;
186
+ }
187
+ }
188
+ if (parameterInferenceFailed) {
189
+ const assistantMessage = 'I was unable to determine all the necessary parameters for the requested actions. Please review the errors and try again, perhaps with more specific instructions.';
190
+ putAssistantMessage(assistantMessage);
191
+ prompt.push({
192
+ type: 'assistant',
193
+ text: assistantMessage,
194
+ });
195
+ // No user response needed here, assistant states the failure.
196
+ return { breakLoop: false, items: [] };
197
+ }
198
+ // Step 3: Consolidate and Confirm with User
199
+ putSystemMessage('Proposed actions', { actions: detailedActions });
200
+ // The summary is from Step 1, which should be user-friendly.
201
+ putAssistantMessage(summary);
202
+ const confirmation = await askUserForConfirmation(summary, true, options, 'Yes, execute all', 'No, cancel');
203
+ if (!confirmation.confirmed) {
204
+ putSystemMessage('User declined compound action execution.');
205
+ prompt.push({
206
+ type: 'user',
207
+ text: `User declined the proposed actions. ${confirmation.answer ?? ''}`,
208
+ });
209
+ return { breakLoop: false, items: [] };
210
+ }
211
+ // Step 4: Execute Actions
212
+ putSystemMessage('User confirmed compound action execution. Proceeding...');
213
+ let executionError = null;
214
+ let executionErrorMessage = '';
215
+ prompt.push({
216
+ type: 'user', // User confirms the plan
217
+ text: `User confirmed: ${confirmation.answer ?? 'Yes'}`,
218
+ });
219
+ for (const [index, action] of detailedActions.entries()) {
220
+ putSystemMessage(`Executing action ${index + 1}/${detailedActions.length}: ${action.name}`);
221
+ const executor = getOperationExecutor(action.name);
222
+ if (!executor) {
223
+ executionErrorMessage = `Error: Operation executor not found for action "${action.name}". Skipping this action.`;
224
+ putSystemMessage(executionErrorMessage);
225
+ continue;
226
+ }
227
+ try {
228
+ await executor(action.args, options);
229
+ putSystemMessage(`Action ${action.name} completed successfully.`);
230
+ }
231
+ catch (error) {
232
+ executionError = error instanceof Error ? error : new Error(String(error));
233
+ executionErrorMessage = `Error executing action ${index + 1} (${action.name}): ${executionError.message}. Stopping batch execution.`;
234
+ putSystemMessage(executionErrorMessage);
235
+ break;
236
+ }
237
+ }
238
+ const finalAssistantMessage = executionError
239
+ ? `Failed to execute the batch: ${executionErrorMessage}`
240
+ : 'Successfully executed all actions in the batch.';
241
+ putAssistantMessage(finalAssistantMessage);
242
+ prompt.push({
243
+ type: 'assistant',
244
+ text: finalAssistantMessage,
245
+ });
246
+ // No final user "Thank you" here, as it would be a new turn.
247
+ return {
248
+ breakLoop: false,
249
+ items: [],
250
+ };
251
+ };
252
+ registerActionHandler('compoundAction', handleCompoundAction);
253
+ //# sourceMappingURL=handle-compound-action.js.map