grok-cli-hurry-mode 1.0.0

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 (137) hide show
  1. package/.grok/settings.json +3 -0
  2. package/LICENSE +21 -0
  3. package/README.md +452 -0
  4. package/dist/agent/grok-agent.d.ts +54 -0
  5. package/dist/agent/grok-agent.js +674 -0
  6. package/dist/agent/grok-agent.js.map +1 -0
  7. package/dist/agent/index.d.ts +14 -0
  8. package/dist/agent/index.js +137 -0
  9. package/dist/agent/index.js.map +1 -0
  10. package/dist/commands/mcp.d.ts +2 -0
  11. package/dist/commands/mcp.js +245 -0
  12. package/dist/commands/mcp.js.map +1 -0
  13. package/dist/grok/client.d.ts +49 -0
  14. package/dist/grok/client.js +85 -0
  15. package/dist/grok/client.js.map +1 -0
  16. package/dist/grok/tools.d.ts +8 -0
  17. package/dist/grok/tools.js +357 -0
  18. package/dist/grok/tools.js.map +1 -0
  19. package/dist/hooks/use-enhanced-input.d.ts +37 -0
  20. package/dist/hooks/use-enhanced-input.js +217 -0
  21. package/dist/hooks/use-enhanced-input.js.map +1 -0
  22. package/dist/hooks/use-input-handler.d.ts +34 -0
  23. package/dist/hooks/use-input-handler.js +611 -0
  24. package/dist/hooks/use-input-handler.js.map +1 -0
  25. package/dist/hooks/use-input-history.d.ts +9 -0
  26. package/dist/hooks/use-input-history.js +64 -0
  27. package/dist/hooks/use-input-history.js.map +1 -0
  28. package/dist/index.d.ts +2 -0
  29. package/dist/index.js +151949 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/mcp/client.d.ts +29 -0
  32. package/dist/mcp/client.js +167 -0
  33. package/dist/mcp/client.js.map +1 -0
  34. package/dist/mcp/config.d.ts +13 -0
  35. package/dist/mcp/config.js +51 -0
  36. package/dist/mcp/config.js.map +1 -0
  37. package/dist/mcp/transports.d.ts +51 -0
  38. package/dist/mcp/transports.js +229 -0
  39. package/dist/mcp/transports.js.map +1 -0
  40. package/dist/node_modules/react/index.js +1841 -0
  41. package/dist/tools/bash.d.ts +10 -0
  42. package/dist/tools/bash.js +81 -0
  43. package/dist/tools/bash.js.map +1 -0
  44. package/dist/tools/confirmation-tool.d.ts +16 -0
  45. package/dist/tools/confirmation-tool.js +75 -0
  46. package/dist/tools/confirmation-tool.js.map +1 -0
  47. package/dist/tools/index.d.ts +6 -0
  48. package/dist/tools/index.js +16 -0
  49. package/dist/tools/index.js.map +1 -0
  50. package/dist/tools/morph-editor.d.ts +36 -0
  51. package/dist/tools/morph-editor.js +347 -0
  52. package/dist/tools/morph-editor.js.map +1 -0
  53. package/dist/tools/search.d.ts +69 -0
  54. package/dist/tools/search.js +341 -0
  55. package/dist/tools/search.js.map +1 -0
  56. package/dist/tools/text-editor.d.ts +16 -0
  57. package/dist/tools/text-editor.js +565 -0
  58. package/dist/tools/text-editor.js.map +1 -0
  59. package/dist/tools/todo-tool.d.ts +20 -0
  60. package/dist/tools/todo-tool.js +135 -0
  61. package/dist/tools/todo-tool.js.map +1 -0
  62. package/dist/types/index.d.ts +30 -0
  63. package/dist/types/index.js +3 -0
  64. package/dist/types/index.js.map +1 -0
  65. package/dist/ui/app.d.ts +7 -0
  66. package/dist/ui/app.js +160 -0
  67. package/dist/ui/app.js.map +1 -0
  68. package/dist/ui/components/api-key-input.d.ts +7 -0
  69. package/dist/ui/components/api-key-input.js +124 -0
  70. package/dist/ui/components/api-key-input.js.map +1 -0
  71. package/dist/ui/components/chat-history.d.ts +8 -0
  72. package/dist/ui/components/chat-history.js +177 -0
  73. package/dist/ui/components/chat-history.js.map +1 -0
  74. package/dist/ui/components/chat-input.d.ts +9 -0
  75. package/dist/ui/components/chat-input.js +87 -0
  76. package/dist/ui/components/chat-input.js.map +1 -0
  77. package/dist/ui/components/chat-interface.d.ts +8 -0
  78. package/dist/ui/components/chat-interface.js +344 -0
  79. package/dist/ui/components/chat-interface.js.map +1 -0
  80. package/dist/ui/components/command-suggestions.d.ts +17 -0
  81. package/dist/ui/components/command-suggestions.js +68 -0
  82. package/dist/ui/components/command-suggestions.js.map +1 -0
  83. package/dist/ui/components/confirmation-dialog.d.ts +11 -0
  84. package/dist/ui/components/confirmation-dialog.js +167 -0
  85. package/dist/ui/components/confirmation-dialog.js.map +1 -0
  86. package/dist/ui/components/diff-renderer.d.ts +13 -0
  87. package/dist/ui/components/diff-renderer.js +217 -0
  88. package/dist/ui/components/diff-renderer.js.map +1 -0
  89. package/dist/ui/components/loading-spinner.d.ts +8 -0
  90. package/dist/ui/components/loading-spinner.js +92 -0
  91. package/dist/ui/components/loading-spinner.js.map +1 -0
  92. package/dist/ui/components/mcp-status.d.ts +5 -0
  93. package/dist/ui/components/mcp-status.js +74 -0
  94. package/dist/ui/components/mcp-status.js.map +1 -0
  95. package/dist/ui/components/model-selection.d.ts +12 -0
  96. package/dist/ui/components/model-selection.js +28 -0
  97. package/dist/ui/components/model-selection.js.map +1 -0
  98. package/dist/ui/shared/max-sized-box.d.ts +8 -0
  99. package/dist/ui/shared/max-sized-box.js +15 -0
  100. package/dist/ui/shared/max-sized-box.js.map +1 -0
  101. package/dist/ui/utils/code-colorizer.d.ts +2 -0
  102. package/dist/ui/utils/code-colorizer.js +18 -0
  103. package/dist/ui/utils/code-colorizer.js.map +1 -0
  104. package/dist/ui/utils/colors.d.ts +14 -0
  105. package/dist/ui/utils/colors.js +18 -0
  106. package/dist/ui/utils/colors.js.map +1 -0
  107. package/dist/ui/utils/markdown-renderer.d.ts +4 -0
  108. package/dist/ui/utils/markdown-renderer.js +29 -0
  109. package/dist/ui/utils/markdown-renderer.js.map +1 -0
  110. package/dist/utils/confirmation-service.d.ts +33 -0
  111. package/dist/utils/confirmation-service.js +113 -0
  112. package/dist/utils/confirmation-service.js.map +1 -0
  113. package/dist/utils/custom-instructions.d.ts +1 -0
  114. package/dist/utils/custom-instructions.js +53 -0
  115. package/dist/utils/custom-instructions.js.map +1 -0
  116. package/dist/utils/model-config.d.ts +28 -0
  117. package/dist/utils/model-config.js +49 -0
  118. package/dist/utils/model-config.js.map +1 -0
  119. package/dist/utils/settings-manager.d.ts +94 -0
  120. package/dist/utils/settings-manager.js +275 -0
  121. package/dist/utils/settings-manager.js.map +1 -0
  122. package/dist/utils/settings.d.ts +1 -0
  123. package/dist/utils/settings.js +8 -0
  124. package/dist/utils/settings.js.map +1 -0
  125. package/dist/utils/text-utils.d.ts +80 -0
  126. package/dist/utils/text-utils.js +197 -0
  127. package/dist/utils/text-utils.js.map +1 -0
  128. package/dist/utils/token-counter.d.ts +33 -0
  129. package/dist/utils/token-counter.js +83 -0
  130. package/dist/utils/token-counter.js.map +1 -0
  131. package/dist/yoga.wasm +0 -0
  132. package/eslint.config.mjs +28 -0
  133. package/fix.awk +41 -0
  134. package/grok-logo-screenshot.png +0 -0
  135. package/package.json +68 -0
  136. package/sed_cmd.sh +35 -0
  137. package/temp.txt +29 -0
@@ -0,0 +1,10 @@
1
+ import { ToolResult } from '../types/index.js';
2
+ export declare class BashTool {
3
+ private currentDirectory;
4
+ private confirmationService;
5
+ execute(command: string, timeout?: number): Promise<ToolResult>;
6
+ getCurrentDirectory(): string;
7
+ listFiles(directory?: string): Promise<ToolResult>;
8
+ findFiles(pattern: string, directory?: string): Promise<ToolResult>;
9
+ grep(pattern: string, files?: string): Promise<ToolResult>;
10
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BashTool = void 0;
4
+ const child_process_1 = require("child_process");
5
+ const util_1 = require("util");
6
+ const confirmation_service_js_1 = require("../utils/confirmation-service.js");
7
+ const execAsync = (0, util_1.promisify)(child_process_1.exec);
8
+ class BashTool {
9
+ constructor() {
10
+ this.currentDirectory = process.cwd();
11
+ this.confirmationService = confirmation_service_js_1.ConfirmationService.getInstance();
12
+ }
13
+ async execute(command, timeout = 30000) {
14
+ try {
15
+ // Check if user has already accepted bash commands for this session
16
+ const sessionFlags = this.confirmationService.getSessionFlags();
17
+ if (!sessionFlags.bashCommands && !sessionFlags.allOperations) {
18
+ // Request confirmation showing the command
19
+ const confirmationResult = await this.confirmationService.requestConfirmation({
20
+ operation: 'Run bash command',
21
+ filename: command,
22
+ showVSCodeOpen: false,
23
+ content: `Command: ${command}\nWorking directory: ${this.currentDirectory}`
24
+ }, 'bash');
25
+ if (!confirmationResult.confirmed) {
26
+ return {
27
+ success: false,
28
+ error: confirmationResult.feedback || 'Command execution cancelled by user'
29
+ };
30
+ }
31
+ }
32
+ if (command.startsWith('cd ')) {
33
+ const newDir = command.substring(3).trim();
34
+ try {
35
+ process.chdir(newDir);
36
+ this.currentDirectory = process.cwd();
37
+ return {
38
+ success: true,
39
+ output: `Changed directory to: ${this.currentDirectory}`
40
+ };
41
+ }
42
+ catch (error) {
43
+ return {
44
+ success: false,
45
+ error: `Cannot change directory: ${error.message}`
46
+ };
47
+ }
48
+ }
49
+ const { stdout, stderr } = await execAsync(command, {
50
+ cwd: this.currentDirectory,
51
+ timeout,
52
+ maxBuffer: 1024 * 1024
53
+ });
54
+ const output = stdout + (stderr ? `\nSTDERR: ${stderr}` : '');
55
+ return {
56
+ success: true,
57
+ output: output.trim() || 'Command executed successfully (no output)'
58
+ };
59
+ }
60
+ catch (error) {
61
+ return {
62
+ success: false,
63
+ error: `Command failed: ${error.message}`
64
+ };
65
+ }
66
+ }
67
+ getCurrentDirectory() {
68
+ return this.currentDirectory;
69
+ }
70
+ async listFiles(directory = '.') {
71
+ return this.execute(`ls -la ${directory}`);
72
+ }
73
+ async findFiles(pattern, directory = '.') {
74
+ return this.execute(`find ${directory} -name "${pattern}" -type f`);
75
+ }
76
+ async grep(pattern, files = '.') {
77
+ return this.execute(`grep -r "${pattern}" ${files}`);
78
+ }
79
+ }
80
+ exports.BashTool = BashTool;
81
+ //# sourceMappingURL=bash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bash.js","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":";;;AAAA,iDAAqC;AACrC,+BAAiC;AAEjC,8EAAuE;AAEvE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EAAE,CAAC,CAAC;IACvD,CAAC;CACF;AA9ED,4BA8EC"}
@@ -0,0 +1,16 @@
1
+ import { ToolResult } from '../types/index.js';
2
+ export interface ConfirmationRequest {
3
+ operation: string;
4
+ filename: string;
5
+ description?: string;
6
+ showVSCodeOpen?: boolean;
7
+ autoAccept?: boolean;
8
+ }
9
+ export declare class ConfirmationTool {
10
+ private confirmationService;
11
+ constructor();
12
+ requestConfirmation(request: ConfirmationRequest): Promise<ToolResult>;
13
+ checkSessionAcceptance(): Promise<ToolResult>;
14
+ resetSession(): void;
15
+ isPending(): boolean;
16
+ }
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConfirmationTool = void 0;
4
+ const confirmation_service_js_1 = require("../utils/confirmation-service.js");
5
+ class ConfirmationTool {
6
+ constructor() {
7
+ this.confirmationService = confirmation_service_js_1.ConfirmationService.getInstance();
8
+ }
9
+ async requestConfirmation(request) {
10
+ try {
11
+ // If autoAccept is true, skip the confirmation dialog
12
+ if (request.autoAccept) {
13
+ return {
14
+ success: true,
15
+ output: `Auto-accepted: ${request.operation}(${request.filename})${request.description ? ` - ${request.description}` : ''}`
16
+ };
17
+ }
18
+ const options = {
19
+ operation: request.operation,
20
+ filename: request.filename,
21
+ showVSCodeOpen: request.showVSCodeOpen || false
22
+ };
23
+ // Determine operation type based on operation name
24
+ const operationType = request.operation.toLowerCase().includes('bash') ? 'bash' : 'file';
25
+ const result = await this.confirmationService.requestConfirmation(options, operationType);
26
+ if (result.confirmed) {
27
+ return {
28
+ success: true,
29
+ output: `User confirmed: ${request.operation}(${request.filename})${request.description ? ` - ${request.description}` : ''}${result.dontAskAgain ? ' (Don\'t ask again enabled)' : ''}`
30
+ };
31
+ }
32
+ else {
33
+ return {
34
+ success: false,
35
+ error: result.feedback || `User rejected: ${request.operation}(${request.filename})`
36
+ };
37
+ }
38
+ }
39
+ catch (error) {
40
+ return {
41
+ success: false,
42
+ error: `Confirmation error: ${error.message}`
43
+ };
44
+ }
45
+ }
46
+ async checkSessionAcceptance() {
47
+ try {
48
+ const sessionFlags = this.confirmationService.getSessionFlags();
49
+ // Return structured data without JSON output to avoid displaying raw JSON
50
+ return {
51
+ success: true,
52
+ data: {
53
+ fileOperationsAccepted: sessionFlags.fileOperations,
54
+ bashCommandsAccepted: sessionFlags.bashCommands,
55
+ allOperationsAccepted: sessionFlags.allOperations,
56
+ hasAnyAcceptance: sessionFlags.fileOperations || sessionFlags.bashCommands || sessionFlags.allOperations
57
+ }
58
+ };
59
+ }
60
+ catch (error) {
61
+ return {
62
+ success: false,
63
+ error: `Error checking session acceptance: ${error.message}`
64
+ };
65
+ }
66
+ }
67
+ resetSession() {
68
+ this.confirmationService.resetSession();
69
+ }
70
+ isPending() {
71
+ return this.confirmationService.isPending();
72
+ }
73
+ }
74
+ exports.ConfirmationTool = ConfirmationTool;
75
+ //# sourceMappingURL=confirmation-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirmation-tool.js","sourceRoot":"","sources":["../../src/tools/confirmation-tool.ts"],"names":[],"mappings":";;;AACA,8EAA4F;AAU5F,MAAa,gBAAgB;IAG3B;QACE,IAAI,CAAC,mBAAmB,GAAG,6CAAmB,CAAC,WAAW,EAAE,CAAC;IAC/D,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,OAA4B;QACpD,IAAI,CAAC;YACH,sDAAsD;YACtD,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;gBACvB,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,MAAM,EAAE,kBAAkB,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;iBAC5H,CAAC;YACJ,CAAC;YAED,MAAM,OAAO,GAAwB;gBACnC,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,QAAQ,EA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sB,EAAE,YAAY,CAAC,cAAc;oBACnD,oBAAoB,EAAE,YAAY,CAAC,YAAY;oBAC/C,qBAAqB,EAAE,YAAY,CAAC,aAAa;oBACjD,gBAAgB,EAAE,YAAY,CAAC,cAAc,IAAI,YAAY,CAAC,YAAY,IAAI,YAAY,CAAC,aAAa;iBACzG;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,sCAAsC,KAAK,CAAC,OAAO,EAAE;aAC7D,CAAC;QACJ,CAAC;IACH,CAAC;IAED,YAAY;QACV,IAAI,CAAC,mBAAmB,CAAC,YAAY,EAAE,CAAC;IAC1C,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,CAAC;IAC9C,CAAC;CACF;AA1ED,4CA0EC"}
@@ -0,0 +1,6 @@
1
+ export { BashTool } from "./bash.js";
2
+ export { TextEditorTool } from "./text-editor.js";
3
+ export { MorphEditorTool } from "./morph-editor.js";
4
+ export { TodoTool } from "./todo-tool.js";
5
+ export { ConfirmationTool } from "./confirmation-tool.js";
6
+ export { SearchTool } from "./search.js";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SearchTool = exports.ConfirmationTool = exports.TodoTool = exports.MorphEditorTool = exports.TextEditorTool = exports.BashTool = void 0;
4
+ var bash_js_1 = require("./bash.js");
5
+ Object.defineProperty(exports, "BashTool", { enumerable: true, get: function () { return bash_js_1.BashTool; } });
6
+ var text_editor_js_1 = require("./text-editor.js");
7
+ Object.defineProperty(exports, "TextEditorTool", { enumerable: true, get: function () { return text_editor_js_1.TextEditorTool; } });
8
+ var morph_editor_js_1 = require("./morph-editor.js");
9
+ Object.defineProperty(exports, "MorphEditorTool", { enumerable: true, get: function () { return morph_editor_js_1.MorphEditorTool; } });
10
+ var todo_tool_js_1 = require("./todo-tool.js");
11
+ Object.defineProperty(exports, "TodoTool", { enumerable: true, get: function () { return todo_tool_js_1.TodoTool; } });
12
+ var confirmation_tool_js_1 = require("./confirmation-tool.js");
13
+ Object.defineProperty(exports, "ConfirmationTool", { enumerable: true, get: function () { return confirmation_tool_js_1.ConfirmationTool; } });
14
+ var search_js_1 = require("./search.js");
15
+ Object.defineProperty(exports, "SearchTool", { enumerable: true, get: function () { return search_js_1.SearchTool; } });
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAA5B,mGAAA,QAAQ,OAAA;AACjB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,+CAA0C;AAAjC,wGAAA,QAAQ,OAAA;AACjB,+DAA0D;AAAjD,wHAAA,gBAAgB,OAAA;AACzB,yCAAyC;AAAhC,uGAAA,UAAU,OAAA"}
@@ -0,0 +1,36 @@
1
+ import { ToolResult } from "../types/index.js";
2
+ export declare class MorphEditorTool {
3
+ private confirmationService;
4
+ private morphApiKey;
5
+ private morphBaseUrl;
6
+ constructor(apiKey?: string);
7
+ /**
8
+ * Use this tool to make an edit to an existing file.
9
+ *
10
+ * This will be read by a less intelligent model, which will quickly apply the edit. You should make it clear what the edit is, while also minimizing the unchanged code you write.
11
+ * When writing the edit, you should specify each edit in sequence, with the special comment // ... existing code ... to represent unchanged code in between edited lines.
12
+ *
13
+ * For example:
14
+ *
15
+ * // ... existing code ...
16
+ * FIRST_EDIT
17
+ * // ... existing code ...
18
+ * SECOND_EDIT
19
+ * // ... existing code ...
20
+ * THIRD_EDIT
21
+ * // ... existing code ...
22
+ *
23
+ * You should still bias towards repeating as few lines of the original file as possible to convey the change.
24
+ * But, each edit should contain sufficient context of unchanged lines around the code you're editing to resolve ambiguity.
25
+ * DO NOT omit spans of pre-existing code (or comments) without using the // ... existing code ... comment to indicate its absence. If you omit the existing code comment, the model may inadvertently delete these lines.
26
+ * If you plan on deleting a section, you must provide context before and after to delete it. If the initial code is ```code \n Block 1 \n Block 2 \n Block 3 \n code```, and you want to remove Block 2, you would output ```// ... existing code ... \n Block 1 \n Block 3 \n // ... existing code ...```.
27
+ * Make sure it is clear what the edit should be, and where it should be applied.
28
+ * Make edits to a file in a single edit_file call instead of multiple edit_file calls to the same file. The apply model can handle many distinct edits at once.
29
+ */
30
+ editFile(targetFile: string, instructions: string, codeEdit: string): Promise<ToolResult>;
31
+ private callMorphApply;
32
+ private generateDiff;
33
+ view(filePath: string, viewRange?: [number, number]): Promise<ToolResult>;
34
+ setApiKey(apiKey: string): void;
35
+ getApiKey(): string;
36
+ }
@@ -0,0 +1,347 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.MorphEditorTool = void 0;
40
+ const fs = __importStar(require("fs-extra"));
41
+ const path = __importStar(require("path"));
42
+ const axios_1 = __importDefault(require("axios"));
43
+ const confirmation_service_js_1 = require("../utils/confirmation-service.js");
44
+ class MorphEditorTool {
45
+ constructor(apiKey) {
46
+ this.confirmationService = confirmation_service_js_1.ConfirmationService.getInstance();
47
+ this.morphBaseUrl = "https://api.morphllm.com/v1";
48
+ this.morphApiKey = apiKey || process.env.MORPH_API_KEY || "";
49
+ if (!this.morphApiKey) {
50
+ console.warn("MORPH_API_KEY not found. Morph editor functionality will be limited.");
51
+ }
52
+ }
53
+ /**
54
+ * Use this tool to make an edit to an existing file.
55
+ *
56
+ * This will be read by a less intelligent model, which will quickly apply the edit. You should make it clear what the edit is, while also minimizing the unchanged code you write.
57
+ * When writing the edit, you should specify each edit in sequence, with the special comment // ... existing code ... to represent unchanged code in between edited lines.
58
+ *
59
+ * For example:
60
+ *
61
+ * // ... existing code ...
62
+ * FIRST_EDIT
63
+ * // ... existing code ...
64
+ * SECOND_EDIT
65
+ * // ... existing code ...
66
+ * THIRD_EDIT
67
+ * // ... existing code ...
68
+ *
69
+ * You should still bias towards repeating as few lines of the original file as possible to convey the change.
70
+ * But, each edit should contain sufficient context of unchanged lines around the code you're editing to resolve ambiguity.
71
+ * DO NOT omit spans of pre-existing code (or comments) without using the // ... existing code ... comment to indicate its absence. If you omit the existing code comment, the model may inadvertently delete these lines.
72
+ * If you plan on deleting a section, you must provide context before and after to delete it. If the initial code is ```code \n Block 1 \n Block 2 \n Block 3 \n code```, and you want to remove Block 2, you would output ```// ... existing code ... \n Block 1 \n Block 3 \n // ... existing code ...```.
73
+ * Make sure it is clear what the edit should be, and where it should be applied.
74
+ * Make edits to a file in a single edit_file call instead of multiple edit_file calls to the same file. The apply model can handle many distinct edits at once.
75
+ */
76
+ async editFile(targetFile, instructions, codeEdit) {
77
+ try {
78
+ const resolvedPath = path.resolve(targetFile);
79
+ if (!(await fs.pathExists(resolvedPath))) {
80
+ return {
81
+ success: false,
82
+ error: `File not found: ${targetFile}`,
83
+ };
84
+ }
85
+ if (!this.morphApiKey) {
86
+ return {
87
+ success: false,
88
+ error: "MORPH_API_KEY not configured. Please set your Morph API key.",
89
+ };
90
+ }
91
+ // Read the initial code
92
+ const initialCode = await fs.readFile(resolvedPath, "utf-8");
93
+ // Check user confirmation before proceeding
94
+ const sessionFlags = this.confirmationService.getSessionFlags();
95
+ if (!sessionFlags.fileOperations && !sessionFlags.allOperations) {
96
+ const confirmationResult = await this.confirmationService.requestConfirmation({
97
+ operation: "Edit file with Morph Fast Apply",
98
+ filename: targetFile,
99
+ showVSCodeOpen: false,
100
+ content: `Instructions: ${instructions}\n\nEdit:\n${codeEdit}`,
101
+ }, "file");
102
+ if (!confirmationResult.confirmed) {
103
+ return {
104
+ success: false,
105
+ error: confirmationResult.feedback || "File edit cancelled by user",
106
+ };
107
+ }
108
+ }
109
+ // Call Morph Fast Apply API
110
+ const mergedCode = await this.callMorphApply(instructions, initialCode, codeEdit);
111
+ // Write the merged code back to file
112
+ await fs.writeFile(resolvedPath, mergedCode, "utf-8");
113
+ // Generate diff for display
114
+ const oldLines = initialCode.split("\n");
115
+ const newLines = mergedCode.split("\n");
116
+ const diff = this.generateDiff(oldLines, newLines, targetFile);
117
+ return {
118
+ success: true,
119
+ output: diff,
120
+ };
121
+ }
122
+ catch (error) {
123
+ return {
124
+ success: false,
125
+ error: `Error editing ${targetFile} with Morph: ${error.message}`,
126
+ };
127
+ }
128
+ }
129
+ async callMorphApply(instructions, initialCode, editSnippet) {
130
+ try {
131
+ const response = await axios_1.default.post(`${this.morphBaseUrl}/chat/completions`, {
132
+ model: "morph-v3-large",
133
+ messages: [
134
+ {
135
+ role: "user",
136
+ content: `<instruction>${instructions}</instruction>\n<code>${initialCode}</code>\n<update>${editSnippet}</update>`,
137
+ },
138
+ ],
139
+ }, {
140
+ headers: {
141
+ "Authorization": `Bearer ${this.morphApiKey}`,
142
+ "Content-Type": "application/json",
143
+ },
144
+ });
145
+ if (!response.data.choices || !response.data.choices[0] || !response.data.choices[0].message) {
146
+ throw new Error("Invalid response format from Morph API");
147
+ }
148
+ return response.data.choices[0].message.content;
149
+ }
150
+ catch (error) {
151
+ if (error.response) {
152
+ throw new Error(`Morph API error (${error.response.status}): ${error.response.data}`);
153
+ }
154
+ throw error;
155
+ }
156
+ }
157
+ generateDiff(oldLines, newLines, filePath) {
158
+ const CONTEXT_LINES = 3;
159
+ const changes = [];
160
+ let i = 0, j = 0;
161
+ while (i < oldLines.length || j < newLines.length) {
162
+ while (i < oldLines.length && j < newLines.length && oldLines[i] === newLines[j]) {
163
+ i++;
164
+ j++;
165
+ }
166
+ if (i < oldLines.length || j < newLines.length) {
167
+ const changeStart = { old: i, new: j };
168
+ let oldEnd = i;
169
+ let newEnd = j;
170
+ while (oldEnd < oldLines.length || newEnd < newLines.length) {
171
+ let matchFound = false;
172
+ let matchLength = 0;
173
+ for (let k = 0; k < Math.min(2, oldLines.length - oldEnd, newLines.length - newEnd); k++) {
174
+ if (oldEnd + k < oldLines.length &&
175
+ newEnd + k < newLines.length &&
176
+ oldLines[oldEnd + k] === newLines[newEnd + k]) {
177
+ matchLength++;
178
+ }
179
+ else {
180
+ break;
181
+ }
182
+ }
183
+ if (matchLength >= 2 || (oldEnd >= oldLines.length && newEnd >= newLines.length)) {
184
+ matchFound = true;
185
+ }
186
+ if (matchFound) {
187
+ break;
188
+ }
189
+ if (oldEnd < oldLines.length)
190
+ oldEnd++;
191
+ if (newEnd < newLines.length)
192
+ newEnd++;
193
+ }
194
+ changes.push({
195
+ oldStart: changeStart.old,
196
+ oldEnd: oldEnd,
197
+ newStart: changeStart.new,
198
+ newEnd: newEnd
199
+ });
200
+ i = oldEnd;
201
+ j = newEnd;
202
+ }
203
+ }
204
+ const hunks = [];
205
+ let accumulatedOffset = 0;
206
+ for (let changeIdx = 0; changeIdx < changes.length; changeIdx++) {
207
+ const change = changes[changeIdx];
208
+ let contextStart = Math.max(0, change.oldStart - CONTEXT_LINES);
209
+ let contextEnd = Math.min(oldLines.length, change.oldEnd + CONTEXT_LINES);
210
+ if (hunks.length > 0) {
211
+ const lastHunk = hunks[hunks.length - 1];
212
+ const lastHunkEnd = lastHunk.oldStart + lastHunk.oldCount;
213
+ if (lastHunkEnd >= contextStart) {
214
+ const oldHunkEnd = lastHunk.oldStart + lastHunk.oldCount;
215
+ const newContextEnd = Math.min(oldLines.length, change.oldEnd + CONTEXT_LINES);
216
+ for (let idx = oldHunkEnd; idx < change.oldStart; idx++) {
217
+ lastHunk.lines.push({ type: ' ', content: oldLines[idx] });
218
+ }
219
+ for (let idx = change.oldStart; idx < change.oldEnd; idx++) {
220
+ lastHunk.lines.push({ type: '-', content: oldLines[idx] });
221
+ }
222
+ for (let idx = change.newStart; idx < change.newEnd; idx++) {
223
+ lastHunk.lines.push({ type: '+', content: newLines[idx] });
224
+ }
225
+ for (let idx = change.oldEnd; idx < newContextEnd && idx < oldLines.length; idx++) {
226
+ lastHunk.lines.push({ type: ' ', content: oldLines[idx] });
227
+ }
228
+ lastHunk.oldCount = newContextEnd - lastHunk.oldStart;
229
+ lastHunk.newCount = lastHunk.oldCount + (change.newEnd - change.newStart) - (change.oldEnd - change.oldStart);
230
+ continue;
231
+ }
232
+ }
233
+ const hunk = {
234
+ oldStart: contextStart + 1,
235
+ oldCount: contextEnd - contextStart,
236
+ newStart: contextStart + 1 + accumulatedOffset,
237
+ newCount: contextEnd - contextStart + (change.newEnd - change.newStart) - (change.oldEnd - change.oldStart),
238
+ lines: []
239
+ };
240
+ for (let idx = contextStart; idx < change.oldStart; idx++) {
241
+ hunk.lines.push({ type: ' ', content: oldLines[idx] });
242
+ }
243
+ for (let idx = change.oldStart; idx < change.oldEnd; idx++) {
244
+ hunk.lines.push({ type: '-', content: oldLines[idx] });
245
+ }
246
+ for (let idx = change.newStart; idx < change.newEnd; idx++) {
247
+ hunk.lines.push({ type: '+', content: newLines[idx] });
248
+ }
249
+ for (let idx = change.oldEnd; idx < contextEnd && idx < oldLines.length; idx++) {
250
+ hunk.lines.push({ type: ' ', content: oldLines[idx] });
251
+ }
252
+ hunks.push(hunk);
253
+ accumulatedOffset += (change.newEnd - change.newStart) - (change.oldEnd - change.oldStart);
254
+ }
255
+ let addedLines = 0;
256
+ let removedLines = 0;
257
+ for (const hunk of hunks) {
258
+ for (const line of hunk.lines) {
259
+ if (line.type === '+')
260
+ addedLines++;
261
+ if (line.type === '-')
262
+ removedLines++;
263
+ }
264
+ }
265
+ let summary = `Updated ${filePath} with Morph Fast Apply`;
266
+ if (addedLines > 0 && removedLines > 0) {
267
+ summary += ` - ${addedLines} addition${addedLines !== 1 ? "s" : ""} and ${removedLines} removal${removedLines !== 1 ? "s" : ""}`;
268
+ }
269
+ else if (addedLines > 0) {
270
+ summary += ` - ${addedLines} addition${addedLines !== 1 ? "s" : ""}`;
271
+ }
272
+ else if (removedLines > 0) {
273
+ summary += ` - ${removedLines} removal${removedLines !== 1 ? "s" : ""}`;
274
+ }
275
+ else if (changes.length === 0) {
276
+ return `No changes applied to ${filePath}`;
277
+ }
278
+ let diff = summary + "\n";
279
+ diff += `--- a/${filePath}\n`;
280
+ diff += `+++ b/${filePath}\n`;
281
+ for (const hunk of hunks) {
282
+ diff += `@@ -${hunk.oldStart},${hunk.oldCount} +${hunk.newStart},${hunk.newCount} @@\n`;
283
+ for (const line of hunk.lines) {
284
+ diff += `${line.type}${line.content}\n`;
285
+ }
286
+ }
287
+ return diff.trim();
288
+ }
289
+ async view(filePath, viewRange) {
290
+ try {
291
+ const resolvedPath = path.resolve(filePath);
292
+ if (await fs.pathExists(resolvedPath)) {
293
+ const stats = await fs.stat(resolvedPath);
294
+ if (stats.isDirectory()) {
295
+ const files = await fs.readdir(resolvedPath);
296
+ return {
297
+ success: true,
298
+ output: `Directory contents of ${filePath}:\n${files.join("\n")}`,
299
+ };
300
+ }
301
+ const content = await fs.readFile(resolvedPath, "utf-8");
302
+ const lines = content.split("\n");
303
+ if (viewRange) {
304
+ const [start, end] = viewRange;
305
+ const selectedLines = lines.slice(start - 1, end);
306
+ const numberedLines = selectedLines
307
+ .map((line, idx) => `${start + idx}: ${line}`)
308
+ .join("\n");
309
+ return {
310
+ success: true,
311
+ output: `Lines ${start}-${end} of ${filePath}:\n${numberedLines}`,
312
+ };
313
+ }
314
+ const totalLines = lines.length;
315
+ const displayLines = totalLines > 10 ? lines.slice(0, 10) : lines;
316
+ const numberedLines = displayLines
317
+ .map((line, idx) => `${idx + 1}: ${line}`)
318
+ .join("\n");
319
+ const additionalLinesMessage = totalLines > 10 ? `\n... +${totalLines - 10} lines` : "";
320
+ return {
321
+ success: true,
322
+ output: `Contents of ${filePath}:\n${numberedLines}${additionalLinesMessage}`,
323
+ };
324
+ }
325
+ else {
326
+ return {
327
+ success: false,
328
+ error: `File or directory not found: ${filePath}`,
329
+ };
330
+ }
331
+ }
332
+ catch (error) {
333
+ return {
334
+ success: false,
335
+ error: `Error viewing ${filePath}: ${error.message}`,
336
+ };
337
+ }
338
+ }
339
+ setApiKey(apiKey) {
340
+ this.morphApiKey = apiKey;
341
+ }
342
+ getApiKey() {
343
+ return this.morphApiKey;
344
+ }
345
+ }
346
+ exports.MorphEditorTool = MorphEditorTool;
347
+ //# sourceMappingURL=morph-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"morph-editor.js","sourceRoot":"","sources":["../../src/tools/morph-editor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,2CAA6B;AAC7B,kDAA0B;AAE1B,8EAAuE;AAEvE,MAAa,eAAe;IAK1B,YAAY,MAAe;QAJn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