From e18c43adacceba319f06ec98a5516a35a5f639b6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 11 Jan 2025 05:47:23 +0000 Subject: [PATCH] chore: updated manifest.json and dist build --- dist/index.js | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/dist/index.js b/dist/index.js index b79b4e3..9c5c6ff 100644 --- a/dist/index.js +++ b/dist/index.js @@ -38405,8 +38405,8 @@ const Ot = q(94049); const Wt = q(56310); const Ar = q(40893); - const Er = 5; - const Ir = 3; + const Er = 10; + const Ir = 1; const Br = `You are a capable AI assistant currently running on a GitHub bot. \nYou are designed to assist with resolving issues by making incremental fixes using a standardized tool interface.\nEach tool implements a common interface that provides consistent error handling and result reporting.\n\nWorkflow:\n1. The repository has already been cloned and you are in the correct working directory\n2. The end goal is solve the issue by making the changes, once the issue is resolved, this would be converted into a pull request.\n3. After each attempt to solve the issue by using an appropriate tool, you will receive feedback, if the attempt was successful or not for example if you want to make change to file you would use the writeFile tool to make the change, this is just an example.\n4. If not complete, you will continue with additional attempts up to ${Er} tries\n5. Each attempt should build upon previous attempts, learning from any failures\n\nTo use tools, you can include one or more tool requests in your response. Each tool request should be formatted like this:\n\`\`\`tool\n{\n "tool": "readFile|writeFile|exploreDir|searchFiles",\n "args": {\n // For readFile:\n "filename": "/absolute/path/to/file"\n \n // For writeFile:\n "filename": "/absolute/path/to/file",\n "content": "diff blocks in format:\n <<<<<<< SEARCH\n [existing content to find]\n =======\n [new content to replace with]\n >>>>>>> REPLACE"\n \n // For exploreDir:\n "command": "tree"\n\n // For searchFiles:\n "pattern": "regex pattern",\n "filePattern": "glob pattern (optional)",\n "caseSensitive": boolean (optional),\n "contextLines": number (optional)\n }\n}\n\`\`\`\n\nMultiple tool requests will be processed sequentially in the order they appear in your response. Each tool request will be replaced with its corresponding result.\n\nThe tool will execute and return a result in this format:\n\`\`\`result\n{\n "success": true|false,\n "data": {\n // Tool-specific result data\n },\n "error": "error message if failed",\n "metadata": {\n "timestamp": number,\n "toolName": string\n }\n}\n\`\`\`\n\nAvailable Tools:\n\n### ReadFile Tool ###\n- Purpose: Read file contents\n- Method: execute(args: { filename: string })\n- Returns: ToolResult containing:\n - success: boolean\n - data: { content: string, path: string }\n - error?: string\n - metadata: execution details\n\n### WriteFile Tool ###\n- Purpose: Update file contents using diff blocks\n- Method: execute(args: { filename: string, content: string })\n- Requires absolute file paths (must start with '/')\n- Diff format:\n\n <<<<<<< SEARCH\n [existing content to find]\n =======\n [new content to replace with]\n >>>>>>> REPLACE\n\n- Returns: ToolResult containing:\n - success: boolean\n - data: { path: string, bytesWritten: number, diffBlocksApplied: number }\n - error?: string\n - metadata: execution details\n\n### ExploreDir Tool ###\n- Purpose: Directory operations\n- Method: execute(args: { command: 'tree' | 'change-dir' | 'clone' | 'kill', dir?: string, repo?: string, owner?: string, issueNumber?: number })\n- Returns: ToolResult containing:\n - success: boolean\n - data: { currentPath: string, tree?: string }\n - error?: string\n - metadata: execution details\n\n### SearchFiles Tool ###\n- Purpose: Search files using regex patterns\n- Method: execute(args: { pattern: string, filePattern?: string, caseSensitive?: boolean, contextLines?: number })\n- Returns: ToolResult containing:\n - success: boolean\n - data: { \n matches: Array<{ file: string, line: number, content: string, context: string[] }>,\n totalFiles: number,\n searchPattern: string\n }\n - error?: string\n - metadata: execution details\n\nNote: All file paths must be absolute paths. For example, if you want to write to "src/file.ts", you must specify the full path starting with "/". Relative paths are not supported.\n\nRules and Best Practices:\n1. Always check ToolResult.success before using the data\n2. Handle errors gracefully using the provided error information\n3. Use metadata for logging and debugging purposes\n4. Follow existing code style and conventions\n5. Document significant changes\n6. Consider edge cases and error handling\n7. After each attempt, evaluate if the solution is complete\n8. You have up to ${Er} attempts to complete each task`; class Completions extends ie.SuperOpenAi { constructor(C, P) { @@ -38563,11 +38563,12 @@ }); } _checkSolution(C, P) { - return oe(this, arguments, void 0, function* (C, P, q = 0, oe = 0) { - var ie, Ge; - const st = yield this.client.chat.completions.create({ + return oe(this, arguments, void 0, function* (C, P, q = [], oe = 0, ie = 0) { + var Ge, st, Ot, Wt, Ar, Er, Ir; + const Br = yield this.client.chat.completions.create({ model: P, messages: [ + ...q, { role: "system", content: @@ -38578,12 +38579,24 @@ temperature: 0.2, max_tokens: 50, }); - if (st.usage) { - q += st.usage.prompt_tokens; - oe += st.usage.completion_tokens; + if ( + Br && + ((Ot = (st = (Ge = Br.choices[0]) === null || Ge === void 0 ? void 0 : Ge.message) === null || st === void 0 ? void 0 : st.content) === null || + Ot === void 0 + ? void 0 + : Ot.trim().toLowerCase()) === "continue" + ) { + q.push({ + role: "assistant", + content: `The issue is not completely resolved. More work is needed. ${(Ar = (Wt = Br.choices[0]) === null || Wt === void 0 ? void 0 : Wt.message) === null || Ar === void 0 ? void 0 : Ar.content}`, + }); + } + if (Br.usage) { + oe += Br.usage.prompt_tokens; + ie += Br.usage.completion_tokens; } - const Ot = ((Ge = (ie = st.choices[0]) === null || ie === void 0 ? void 0 : ie.message) === null || Ge === void 0 ? void 0 : Ge.content) || ""; - return { isSolved: Ot.trim().toLowerCase() === "solved", totalInputToken: q, totalOutputToknen: oe }; + const Qr = ((Ir = (Er = Br.choices[0]) === null || Er === void 0 ? void 0 : Er.message) === null || Ir === void 0 ? void 0 : Ir.content) || ""; + return { isSolved: Qr.trim().toLowerCase() === "solved", totalInputToken: oe, totalOutputToknen: ie, conversationHistory: q }; }); } _executeWithRetry(C, P, q, ie) { @@ -38630,7 +38643,7 @@ let Fr = 0; let kr = 0; let Nr = null; - const Ur = [{ role: "system", content: Br }]; + let Ur = [{ role: "system", content: Br }]; while (this.llmAttempts < Er && !Qr) { const Ot = yield this._getDirectoryTree(q); const Wt = Ot.success && ((ie = Ot.data) === null || ie === void 0 ? void 0 : ie.tree) ? Ot.data.tree : "Unable to get directory tree"; @@ -38660,16 +38673,17 @@ oe = Br.output; Fr += Br.totalInputToken; kr += Br.totalOutputToken; - const Nr = yield this._checkSolution(oe, P, Fr, kr); + const Nr = yield this._checkSolution(oe, P, Ur, Fr, kr); Qr = Nr.isSolved; Fr += Nr.totalInputToken; kr += Nr.totalOutputToknen; + Ur = Nr.conversationHistory; if (!Qr) { this.llmAttempts++; this.context.logger.info(`Solution incomplete, attempt ${this.llmAttempts}/${Er}`); } } - if (Qr) { + if (Qr || this.llmAttempts >= Er) { const P = `Fix: ${C.split("\n")[0]}`; const ie = `This PR addresses the following:\n\n${C}\n\nChanges made:\n${oe}\n\nToken Usage:\n- Total Input Tokens: ${Fr}\n- Total Output Tokens: ${kr}\n- Total Tokens: ${Fr + kr}`; Nr = yield this._createPullRequest(P, ie, q);