Skip to content

Commit

Permalink
chore: updated manifest.json and dist build
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Jan 11, 2025
1 parent 1a3f5c9 commit e6e8619
Showing 1 changed file with 41 additions and 19 deletions.
60 changes: 41 additions & 19 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38407,9 +38407,7 @@
const Ar = q(40893);
const Er = 5;
const Ir = 3;
const Br =
null &&
`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<FileReadResult> 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<FileWriteResult> 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<DirectoryExploreResult> 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<SearchResult> 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`;
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<FileReadResult> 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<FileWriteResult> 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<DirectoryExploreResult> 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<SearchResult> 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) {
super(C, P);
Expand Down Expand Up @@ -38610,21 +38608,45 @@
}
createCompletion(C, P, q) {
return oe(this, arguments, void 0, function* (C, P, q, oe = "") {
var ie, Ge, st;
this.llmAttempts = 0;
this._toolAttempts.clear();
this.tools.exploreDir = new Ot.ExploreDir(this.context, q);
this.tools.createPr = new Ar.CreatePr(this.context, q);
this.tools.searchFiles = new Wt.SearchFiles(q);
let ie = false;
yield this.tools.writeFile.execute({
filename: q + "/wrangler.toml",
content: "<<<<<<< SEARCH\nenabled = true\n=======\nenabled = false\n>>>>>>> REPLACE",
});
const Ge = yield this.tools.readFile.execute({ filename: q + "/wrangler.toml" });
yield this.tools.writeFile.execute({ filename: q + "/new.md", content: "Hello, world!" });
console.log(JSON.stringify(Ge, null, 2));
ie = true;
if (ie) {
let Ir = false;
let Qr = null;
const Dr = [{ role: "system", content: Br }];
while (this.llmAttempts < Er && !Ir) {
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";
this.context.logger.info("Directory tree:", { tree: Wt });
Dr.push({
role: "user",
content: `Current LLM attempt: ${this.llmAttempts + 1}/${Er}\nWorking directory: ${q}\n\nDirectory structure:\n${Wt}\n\nPrevious solution state: ${oe}\n\nOriginal request: ${C}`,
});
const Ar = yield this.client.chat.completions.create({
model: P,
messages: Dr,
temperature: 0.2,
max_tokens: this.maxTokens,
top_p: 0.5,
frequency_penalty: 0,
presence_penalty: 0,
});
this.context.logger.info("LLM response:", { response: Ar });
Qr = Ar;
const Br = ((st = (Ge = Ar.choices[0]) === null || Ge === void 0 ? void 0 : Ge.message) === null || st === void 0 ? void 0 : st.content) || "";
const Fr = yield this._processResponse(Br, q, P, oe, Dr);
Dr.push({ role: "assistant", content: Fr });
oe = Fr;
Ir = yield this._checkSolution(oe, P);
if (!Ir) {
this.llmAttempts++;
this.context.logger.info(`Solution incomplete, attempt ${this.llmAttempts}/${Er}`);
}
}
if (Ir) {
const P = `Fix: ${C.split("\n")[0]}`;
const ie = `This PR addresses the following:\n\n${C}\n\nChanges made:\n${oe}`;
const Ge = yield this._createPullRequest(P, ie, q);
Expand All @@ -38634,32 +38656,32 @@
this.context.logger.error("Failed to create pull request:", { error: new Error(Ge.error || "Unknown error"), metadata: Ge.metadata });
}
}
return "finalResponse";
return Qr;
});
}
_createPullRequest(C, P, q) {
return oe(this, void 0, void 0, function* () {
return yield this._executeWithRetry(this.tools.createPr, "execute", q, { title: C, body: P, workingDir: q });
return this._executeWithRetry(this.tools.createPr, "execute", q, { title: C, body: P, workingDir: q });
});
}
_readFile(C, P) {
return oe(this, void 0, void 0, function* () {
return yield this._executeWithRetry(this.tools.readFile, "execute", P, { filename: C });
return this._executeWithRetry(this.tools.readFile, "execute", P, { filename: C });
});
}
_writeFile(C, P, q) {
return oe(this, void 0, void 0, function* () {
return yield this._executeWithRetry(this.tools.writeFile, "execute", q, { filename: C, content: P });
return this._executeWithRetry(this.tools.writeFile, "execute", q, { filename: C, content: P });
});
}
_getDirectoryTree(C) {
return oe(this, void 0, void 0, function* () {
return yield this._executeWithRetry(this.tools.exploreDir, "execute", C, { command: "tree" });
return this._executeWithRetry(this.tools.exploreDir, "execute", C, { command: "tree" });
});
}
_searchFiles(C, P, q) {
return oe(this, void 0, void 0, function* () {
return yield this._executeWithRetry(this.tools.searchFiles, "execute", P, Object.assign({ pattern: C }, q));
return this._executeWithRetry(this.tools.searchFiles, "execute", P, Object.assign({ pattern: C }, q));
});
}
}
Expand Down

0 comments on commit e6e8619

Please sign in to comment.