@morphllm/morphsdk 0.2.154 → 0.2.155

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 (168) hide show
  1. package/dist/{chunk-2WAHX6I2.js → chunk-372QEHFA.js} +2 -2
  2. package/dist/{chunk-MTRH7FMN.js → chunk-3ULQXPPO.js} +2 -2
  3. package/dist/{chunk-KRRO7FF2.js → chunk-AEYK5XL5.js} +2 -2
  4. package/dist/{chunk-VK76R3IN.js → chunk-CNKSTKRM.js} +2 -2
  5. package/dist/{chunk-QSATHLZJ.js → chunk-CZ2LZ4GV.js} +4 -3
  6. package/dist/{chunk-QSATHLZJ.js.map → chunk-CZ2LZ4GV.js.map} +1 -1
  7. package/dist/{chunk-UDI5U6QV.js → chunk-D34NUQGV.js} +2 -2
  8. package/dist/{chunk-3XO33KPS.js → chunk-DQJBEM4O.js} +2 -2
  9. package/dist/{chunk-3XO33KPS.js.map → chunk-DQJBEM4O.js.map} +1 -1
  10. package/dist/{chunk-P57SFOLD.js → chunk-GOKSI67V.js} +2 -2
  11. package/dist/{chunk-5IKDEESU.js → chunk-GPK433QG.js} +3 -3
  12. package/dist/{chunk-LK4C3NYX.js → chunk-GZXWWB4Z.js} +2 -2
  13. package/dist/{chunk-Y5O3A7SU.js → chunk-KQR3VCGR.js} +2 -2
  14. package/dist/{chunk-TAGDMT3K.js → chunk-L4GXXQEO.js} +2 -2
  15. package/dist/{chunk-ZSA3NL5T.js → chunk-MBVOMNXG.js} +2 -2
  16. package/dist/{chunk-J43SJUCO.js → chunk-NMBM37CB.js} +3 -2
  17. package/dist/{chunk-J43SJUCO.js.map → chunk-NMBM37CB.js.map} +1 -1
  18. package/dist/{chunk-A6T6E636.js → chunk-Q3HZGVQ2.js} +2 -2
  19. package/dist/{chunk-YKBVE3CE.js → chunk-TZCNMJHF.js} +2 -2
  20. package/dist/{chunk-4R6F66B7.js → chunk-V2BUYOKP.js} +2 -2
  21. package/dist/{chunk-PRHEWGWC.js → chunk-Y23PQQRM.js} +17 -17
  22. package/dist/{chunk-D5UUKDKL.js → chunk-Y3LQWQHU.js} +4 -4
  23. package/dist/chunk-Y3LQWQHU.js.map +1 -0
  24. package/dist/{chunk-WQU6QXSU.js → chunk-YCUX3ZNQ.js} +2 -2
  25. package/dist/{chunk-Q77CT3RI.js → chunk-YIUOPGWE.js} +2 -2
  26. package/dist/{chunk-ZHKANLAQ.js → chunk-YJEXFOLJ.js} +4 -4
  27. package/dist/chunk-YJEXFOLJ.js.map +1 -0
  28. package/dist/{chunk-FOKMTUWC.js → chunk-YRHDWJDA.js} +2 -2
  29. package/dist/{chunk-N4KLUOXK.js → chunk-YYOPTKC3.js} +2 -2
  30. package/dist/{chunk-3BTUUH23.js → chunk-ZMGKZNII.js} +6 -6
  31. package/dist/chunk-ZMGKZNII.js.map +1 -0
  32. package/dist/{client-BcO_qte8.d.ts → client-PkB7g9SA.d.ts} +1 -1
  33. package/dist/client.cjs +13 -11
  34. package/dist/client.cjs.map +1 -1
  35. package/dist/client.d.ts +1 -1
  36. package/dist/client.js +22 -22
  37. package/dist/edge.cjs +3 -2
  38. package/dist/edge.cjs.map +1 -1
  39. package/dist/edge.js +4 -4
  40. package/dist/index.cjs +13 -11
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.ts +1 -1
  43. package/dist/index.js +22 -22
  44. package/dist/modelrouter/core.cjs +1 -1
  45. package/dist/modelrouter/core.cjs.map +1 -1
  46. package/dist/modelrouter/core.js +3 -3
  47. package/dist/modelrouter/index.cjs +1 -1
  48. package/dist/modelrouter/index.cjs.map +1 -1
  49. package/dist/modelrouter/index.js +3 -3
  50. package/dist/subagents/anthropic.cjs +1 -1
  51. package/dist/subagents/anthropic.cjs.map +1 -1
  52. package/dist/subagents/anthropic.js +4 -4
  53. package/dist/subagents/vercel.cjs +1 -1
  54. package/dist/subagents/vercel.cjs.map +1 -1
  55. package/dist/subagents/vercel.js +4 -4
  56. package/dist/tools/browser/anthropic.cjs +1 -1
  57. package/dist/tools/browser/anthropic.cjs.map +1 -1
  58. package/dist/tools/browser/anthropic.js +5 -5
  59. package/dist/tools/browser/core.cjs +1 -1
  60. package/dist/tools/browser/core.cjs.map +1 -1
  61. package/dist/tools/browser/core.js +4 -4
  62. package/dist/tools/browser/index.cjs +1 -1
  63. package/dist/tools/browser/index.cjs.map +1 -1
  64. package/dist/tools/browser/index.js +7 -7
  65. package/dist/tools/browser/openai.cjs +1 -1
  66. package/dist/tools/browser/openai.cjs.map +1 -1
  67. package/dist/tools/browser/openai.js +5 -5
  68. package/dist/tools/browser/profiles/core.cjs +1 -1
  69. package/dist/tools/browser/profiles/core.cjs.map +1 -1
  70. package/dist/tools/browser/profiles/core.js +3 -3
  71. package/dist/tools/browser/profiles/index.cjs +1 -1
  72. package/dist/tools/browser/profiles/index.cjs.map +1 -1
  73. package/dist/tools/browser/profiles/index.js +3 -3
  74. package/dist/tools/browser/vercel.cjs +1 -1
  75. package/dist/tools/browser/vercel.cjs.map +1 -1
  76. package/dist/tools/browser/vercel.js +5 -5
  77. package/dist/tools/codebase_search/anthropic.cjs +1 -1
  78. package/dist/tools/codebase_search/anthropic.cjs.map +1 -1
  79. package/dist/tools/codebase_search/anthropic.js +4 -4
  80. package/dist/tools/codebase_search/core.cjs +1 -1
  81. package/dist/tools/codebase_search/core.cjs.map +1 -1
  82. package/dist/tools/codebase_search/core.js +3 -3
  83. package/dist/tools/codebase_search/index.cjs +1 -1
  84. package/dist/tools/codebase_search/index.cjs.map +1 -1
  85. package/dist/tools/codebase_search/index.js +6 -6
  86. package/dist/tools/codebase_search/openai.cjs +1 -1
  87. package/dist/tools/codebase_search/openai.cjs.map +1 -1
  88. package/dist/tools/codebase_search/openai.js +4 -4
  89. package/dist/tools/codebase_search/vercel.cjs +1 -1
  90. package/dist/tools/codebase_search/vercel.cjs.map +1 -1
  91. package/dist/tools/codebase_search/vercel.js +4 -4
  92. package/dist/tools/fastapply/anthropic.cjs +7 -5
  93. package/dist/tools/fastapply/anthropic.cjs.map +1 -1
  94. package/dist/tools/fastapply/anthropic.js +4 -4
  95. package/dist/tools/fastapply/apply.cjs +3 -2
  96. package/dist/tools/fastapply/apply.cjs.map +1 -1
  97. package/dist/tools/fastapply/apply.js +2 -2
  98. package/dist/tools/fastapply/core.cjs +5 -3
  99. package/dist/tools/fastapply/core.cjs.map +1 -1
  100. package/dist/tools/fastapply/core.js +3 -3
  101. package/dist/tools/fastapply/index.cjs +13 -11
  102. package/dist/tools/fastapply/index.cjs.map +1 -1
  103. package/dist/tools/fastapply/index.d.ts +1 -1
  104. package/dist/tools/fastapply/index.js +6 -6
  105. package/dist/tools/fastapply/openai.cjs +7 -5
  106. package/dist/tools/fastapply/openai.cjs.map +1 -1
  107. package/dist/tools/fastapply/openai.js +4 -4
  108. package/dist/tools/fastapply/types.cjs.map +1 -1
  109. package/dist/tools/fastapply/types.d.ts +6 -2
  110. package/dist/tools/fastapply/vercel.cjs +9 -7
  111. package/dist/tools/fastapply/vercel.cjs.map +1 -1
  112. package/dist/tools/fastapply/vercel.d.ts +1 -1
  113. package/dist/tools/fastapply/vercel.js +4 -4
  114. package/dist/tools/index.cjs +13 -11
  115. package/dist/tools/index.cjs.map +1 -1
  116. package/dist/tools/index.d.ts +1 -1
  117. package/dist/tools/index.js +6 -6
  118. package/dist/tools/utils/resilience.cjs +1 -1
  119. package/dist/tools/utils/resilience.cjs.map +1 -1
  120. package/dist/tools/utils/resilience.js +2 -2
  121. package/dist/tools/warp_grep/agent/runner.cjs +1 -1
  122. package/dist/tools/warp_grep/agent/runner.cjs.map +1 -1
  123. package/dist/tools/warp_grep/agent/runner.js +2 -2
  124. package/dist/tools/warp_grep/anthropic.cjs +1 -1
  125. package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
  126. package/dist/tools/warp_grep/anthropic.js +4 -4
  127. package/dist/tools/warp_grep/client.cjs +1 -1
  128. package/dist/tools/warp_grep/client.cjs.map +1 -1
  129. package/dist/tools/warp_grep/client.js +3 -3
  130. package/dist/tools/warp_grep/gemini.cjs +1 -1
  131. package/dist/tools/warp_grep/gemini.cjs.map +1 -1
  132. package/dist/tools/warp_grep/gemini.js +3 -3
  133. package/dist/tools/warp_grep/index.cjs +1 -1
  134. package/dist/tools/warp_grep/index.cjs.map +1 -1
  135. package/dist/tools/warp_grep/index.js +3 -3
  136. package/dist/tools/warp_grep/openai.cjs +1 -1
  137. package/dist/tools/warp_grep/openai.cjs.map +1 -1
  138. package/dist/tools/warp_grep/openai.js +4 -4
  139. package/dist/tools/warp_grep/vercel.cjs +1 -1
  140. package/dist/tools/warp_grep/vercel.cjs.map +1 -1
  141. package/dist/tools/warp_grep/vercel.js +4 -4
  142. package/dist/{vercel-B1GZ_g9N.d.ts → vercel-Cg38kNm4.d.ts} +2 -2
  143. package/dist/version.cjs +1 -1
  144. package/dist/version.cjs.map +1 -1
  145. package/dist/version.js +1 -1
  146. package/package.json +1 -1
  147. package/dist/chunk-3BTUUH23.js.map +0 -1
  148. package/dist/chunk-D5UUKDKL.js.map +0 -1
  149. package/dist/chunk-ZHKANLAQ.js.map +0 -1
  150. /package/dist/{chunk-2WAHX6I2.js.map → chunk-372QEHFA.js.map} +0 -0
  151. /package/dist/{chunk-MTRH7FMN.js.map → chunk-3ULQXPPO.js.map} +0 -0
  152. /package/dist/{chunk-KRRO7FF2.js.map → chunk-AEYK5XL5.js.map} +0 -0
  153. /package/dist/{chunk-VK76R3IN.js.map → chunk-CNKSTKRM.js.map} +0 -0
  154. /package/dist/{chunk-UDI5U6QV.js.map → chunk-D34NUQGV.js.map} +0 -0
  155. /package/dist/{chunk-P57SFOLD.js.map → chunk-GOKSI67V.js.map} +0 -0
  156. /package/dist/{chunk-5IKDEESU.js.map → chunk-GPK433QG.js.map} +0 -0
  157. /package/dist/{chunk-LK4C3NYX.js.map → chunk-GZXWWB4Z.js.map} +0 -0
  158. /package/dist/{chunk-Y5O3A7SU.js.map → chunk-KQR3VCGR.js.map} +0 -0
  159. /package/dist/{chunk-TAGDMT3K.js.map → chunk-L4GXXQEO.js.map} +0 -0
  160. /package/dist/{chunk-ZSA3NL5T.js.map → chunk-MBVOMNXG.js.map} +0 -0
  161. /package/dist/{chunk-A6T6E636.js.map → chunk-Q3HZGVQ2.js.map} +0 -0
  162. /package/dist/{chunk-YKBVE3CE.js.map → chunk-TZCNMJHF.js.map} +0 -0
  163. /package/dist/{chunk-4R6F66B7.js.map → chunk-V2BUYOKP.js.map} +0 -0
  164. /package/dist/{chunk-PRHEWGWC.js.map → chunk-Y23PQQRM.js.map} +0 -0
  165. /package/dist/{chunk-WQU6QXSU.js.map → chunk-YCUX3ZNQ.js.map} +0 -0
  166. /package/dist/{chunk-Q77CT3RI.js.map → chunk-YIUOPGWE.js.map} +0 -0
  167. /package/dist/{chunk-FOKMTUWC.js.map → chunk-YRHDWJDA.js.map} +0 -0
  168. /package/dist/{chunk-N4KLUOXK.js.map → chunk-YYOPTKC3.js.map} +0 -0
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-63WE2C5R.js";
5
5
  import {
6
6
  executeEditFile
7
- } from "./chunk-J43SJUCO.js";
7
+ } from "./chunk-NMBM37CB.js";
8
8
  import {
9
9
  __export
10
10
  } from "./chunk-PZ5AY32C.js";
@@ -31,7 +31,7 @@ var editFileTool = {
31
31
  type: "string",
32
32
  description: "The path of the target file to modify"
33
33
  },
34
- instructions: {
34
+ instruction: {
35
35
  type: "string",
36
36
  description: "A single sentence describing what you are changing (first person)"
37
37
  },
@@ -40,7 +40,7 @@ var editFileTool = {
40
40
  description: "The lazy edit with // ... existing code ... markers"
41
41
  }
42
42
  },
43
- required: ["target_filepath", "instructions", "code_edit"]
43
+ required: ["target_filepath", "instruction", "code_edit"]
44
44
  }
45
45
  }
46
46
  };
@@ -91,4 +91,4 @@ export {
91
91
  openai_default,
92
92
  openai_exports
93
93
  };
94
- //# sourceMappingURL=chunk-ZHKANLAQ.js.map
94
+ //# sourceMappingURL=chunk-YJEXFOLJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../tools/fastapply/openai.ts"],"sourcesContent":["/**\n * OpenAI SDK adapter for edit_file tool\n */\n\nimport type { ChatCompletionTool } from 'openai/resources/chat/completions';\nimport { executeEditFile } from './core.js';\nimport { EDIT_FILE_TOOL_DESCRIPTION, EDIT_FILE_SYSTEM_PROMPT } from './prompts.js';\nimport type { EditFileInput, EditFileResult, EditFileConfig } from './types.js';\n\n/**\n * OpenAI-native tool definition for edit_file\n * \n * @example\n * ```ts\n * import OpenAI from 'openai';\n * import { editFileTool } from 'morphsdk/tools/openai';\n * \n * const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });\n * \n * const response = await client.chat.completions.create({\n * model: \"gpt-4o\",\n * tools: [editFileTool],\n * messages: [{ role: \"user\", content: \"Fix the bug in app.ts\" }]\n * });\n * ```\n */\nexport const editFileTool: ChatCompletionTool = {\n type: 'function',\n function: {\n name: 'edit_file',\n description: EDIT_FILE_TOOL_DESCRIPTION,\n parameters: {\n type: 'object',\n properties: {\n target_filepath: {\n type: 'string',\n description: 'The path of the target file to modify',\n },\n instruction: {\n type: 'string',\n description: 'A single sentence describing what you are changing (first person)',\n },\n code_edit: {\n type: 'string',\n description: 'The lazy edit with // ... existing code ... markers',\n },\n },\n required: ['target_filepath', 'instruction', 'code_edit'],\n },\n },\n};\n\n/**\n * Execute an edit_file tool call\n * \n * @param input - The tool input from GPT (parsed from tool_calls)\n * @param config - Optional configuration\n * @returns The result of the edit operation\n * \n * @example\n * ```ts\n * const args = JSON.parse(toolCall.function.arguments);\n * const result = await execute(args);\n * console.log('Changes applied:', result.udiff);\n * ```\n */\nexport async function execute(\n input: EditFileInput,\n config?: EditFileConfig\n): Promise<EditFileResult> {\n return executeEditFile(input, config);\n}\n\n/**\n * Get the system prompt for edit_file usage\n * \n * Add this to your system message to guide GPT on using edit_file properly.\n * \n * @example\n * ```ts\n * const response = await client.chat.completions.create({\n * model: \"gpt-4o\",\n * messages: [\n * { role: \"system\", content: getSystemPrompt() },\n * { role: \"user\", content: \"Fix bugs\" }\n * ],\n * tools: [editFileTool]\n * });\n * ```\n */\nexport function getSystemPrompt(): string {\n return EDIT_FILE_SYSTEM_PROMPT;\n}\n\n/**\n * Format the result for passing back to GPT\n * \n * @param result - The edit result\n * @returns Formatted string for tool message\n */\nexport function formatResult(result: EditFileResult): string {\n if (!result.success) {\n return `Error editing file: ${result.error}`;\n }\n \n const { changes } = result;\n return `Successfully applied changes to ${result.filepath}. Added ${changes.linesAdded}, removed ${changes.linesRemoved}, modified ${changes.linesModified}.`;\n}\n\n/**\n * Create a custom edit_file tool with configuration and methods\n * \n * @param config - Configuration options\n * @returns Tool definition with execute and formatResult methods\n * \n * @example\n * ```ts\n * import OpenAI from 'openai';\n * import { createEditFileTool } from 'morphsdk/tools/fastapply/openai';\n * \n * const tool = createEditFileTool({\n * baseDir: './src',\n * generateUdiff: true,\n * description: 'Custom tool description for your use case'\n * });\n * \n * const client = new OpenAI();\n * \n * const response = await client.chat.completions.create({\n * model: 'gpt-4o',\n * tools: [tool], // tool itself is the ChatCompletionTool\n * messages: [{ role: 'user', content: 'Fix bug in app.ts' }]\n * });\n * \n * // Execute and format\n * const result = await tool.execute(toolCallArgs);\n * const formatted = tool.formatResult(result);\n * ```\n */\nexport function createEditFileTool(config: EditFileConfig = {}) {\n const toolDef: ChatCompletionTool = {\n ...editFileTool,\n ...(config.description && {\n function: {\n ...editFileTool.function,\n description: config.description,\n },\n }),\n };\n \n return Object.assign({}, toolDef, {\n execute: async (input: EditFileInput | string): Promise<EditFileResult> => {\n const parsedInput = typeof input === 'string' ? JSON.parse(input) : input;\n return execute(parsedInput, config);\n },\n formatResult: (result: EditFileResult): string => {\n return formatResult(result);\n },\n getSystemPrompt: (): string => {\n return getSystemPrompt();\n },\n });\n}\n\n// Default export for convenience\nexport default editFileTool;\n\n"],"mappings":";;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BO,IAAM,eAAmC;AAAA,EAC9C,MAAM;AAAA,EACN,UAAU;AAAA,IACR,MAAM;AAAA,IACN,aAAa;AAAA,IACb,YAAY;AAAA,MACV,MAAM;AAAA,MACN,YAAY;AAAA,QACV,iBAAiB;AAAA,UACf,MAAM;AAAA,UACN,aAAa;AAAA,QACf;AAAA,QACA,aAAa;AAAA,UACX,MAAM;AAAA,UACN,aAAa;AAAA,QACf;AAAA,QACA,WAAW;AAAA,UACT,MAAM;AAAA,UACN,aAAa;AAAA,QACf;AAAA,MACF;AAAA,MACA,UAAU,CAAC,mBAAmB,eAAe,WAAW;AAAA,IAC1D;AAAA,EACF;AACF;AAgBA,eAAsB,QACpB,OACA,QACyB;AACzB,SAAO,gBAAgB,OAAO,MAAM;AACtC;AAmBO,SAAS,kBAA0B;AACxC,SAAO;AACT;AAQO,SAAS,aAAa,QAAgC;AAC3D,MAAI,CAAC,OAAO,SAAS;AACnB,WAAO,uBAAuB,OAAO,KAAK;AAAA,EAC5C;AAEA,QAAM,EAAE,QAAQ,IAAI;AACpB,SAAO,mCAAmC,OAAO,QAAQ,WAAW,QAAQ,UAAU,aAAa,QAAQ,YAAY,cAAc,QAAQ,aAAa;AAC5J;AAgCO,SAAS,mBAAmB,SAAyB,CAAC,GAAG;AAC9D,QAAM,UAA8B;AAAA,IAClC,GAAG;AAAA,IACH,GAAI,OAAO,eAAe;AAAA,MACxB,UAAU;AAAA,QACR,GAAG,aAAa;AAAA,QAChB,aAAa,OAAO;AAAA,MACtB;AAAA,IACF;AAAA,EACF;AAEA,SAAO,OAAO,OAAO,CAAC,GAAG,SAAS;AAAA,IAChC,SAAS,OAAO,UAA2D;AACzE,YAAM,cAAc,OAAO,UAAU,WAAW,KAAK,MAAM,KAAK,IAAI;AACpE,aAAO,QAAQ,aAAa,MAAM;AAAA,IACpC;AAAA,IACA,cAAc,CAAC,WAAmC;AAChD,aAAO,aAAa,MAAM;AAAA,IAC5B;AAAA,IACA,iBAAiB,MAAc;AAC7B,aAAO,gBAAgB;AAAA,IACzB;AAAA,EACF,CAAC;AACH;AAGA,IAAO,iBAAQ;","names":[]}
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-2VERUKO2.js";
13
13
  import {
14
14
  fetchWithRetry
15
- } from "./chunk-ZSA3NL5T.js";
15
+ } from "./chunk-MBVOMNXG.js";
16
16
 
17
17
  // tools/browser/profiles/core.ts
18
18
  var DEFAULT_API_URL = process.env.MORPH_ENVIRONMENT === "DEV" ? "http://localhost:8000" : "https://browser.morphllm.com";
@@ -386,4 +386,4 @@ export {
386
386
  listRepos,
387
387
  getProfileState
388
388
  };
389
- //# sourceMappingURL=chunk-FOKMTUWC.js.map
389
+ //# sourceMappingURL=chunk-YRHDWJDA.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  executeCodebaseSearch
3
- } from "./chunk-4R6F66B7.js";
3
+ } from "./chunk-V2BUYOKP.js";
4
4
  import {
5
5
  CODEBASE_SEARCH_DESCRIPTION,
6
6
  CODEBASE_SEARCH_SYSTEM_PROMPT
@@ -125,4 +125,4 @@ export {
125
125
  getSystemPrompt,
126
126
  openai_default
127
127
  };
128
- //# sourceMappingURL=chunk-N4KLUOXK.js.map
128
+ //# sourceMappingURL=chunk-YYOPTKC3.js.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-63WE2C5R.js";
5
5
  import {
6
6
  executeEditFile
7
- } from "./chunk-J43SJUCO.js";
7
+ } from "./chunk-NMBM37CB.js";
8
8
  import {
9
9
  __export
10
10
  } from "./chunk-PZ5AY32C.js";
@@ -21,7 +21,7 @@ import { tool } from "ai";
21
21
  import { z } from "zod";
22
22
  var editFileSchema = z.object({
23
23
  target_filepath: z.string().describe("The path of the target file to modify"),
24
- instructions: z.string().describe("A single sentence describing what you are changing (first person)"),
24
+ instruction: z.string().describe("A single sentence describing what you are changing (first person)"),
25
25
  code_edit: z.string().describe("The lazy edit with // ... existing code ... markers")
26
26
  });
27
27
  var editFileTool = tool({
@@ -30,7 +30,7 @@ var editFileTool = tool({
30
30
  execute: async (params) => {
31
31
  const result = await executeEditFile({
32
32
  target_filepath: params.target_filepath,
33
- instructions: params.instructions,
33
+ instruction: params.instruction,
34
34
  code_edit: params.code_edit
35
35
  });
36
36
  if (!result.success) {
@@ -50,7 +50,7 @@ function getSystemPrompt() {
50
50
  function createEditFileTool(config = {}) {
51
51
  const schema = z.object({
52
52
  target_filepath: z.string().describe("The path of the target file to modify"),
53
- instructions: z.string().describe("A single sentence describing what you are changing (first person)"),
53
+ instruction: z.string().describe("A single sentence describing what you are changing (first person)"),
54
54
  code_edit: z.string().describe("The lazy edit with // ... existing code ... markers")
55
55
  });
56
56
  return tool({
@@ -60,7 +60,7 @@ function createEditFileTool(config = {}) {
60
60
  const result = await executeEditFile(
61
61
  {
62
62
  target_filepath: params.target_filepath,
63
- instructions: params.instructions,
63
+ instruction: params.instruction,
64
64
  code_edit: params.code_edit
65
65
  },
66
66
  config
@@ -86,4 +86,4 @@ export {
86
86
  vercel_default,
87
87
  vercel_exports
88
88
  };
89
- //# sourceMappingURL=chunk-3BTUUH23.js.map
89
+ //# sourceMappingURL=chunk-ZMGKZNII.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../tools/fastapply/vercel.ts"],"sourcesContent":["/**\n * Vercel AI SDK adapter for edit_file tool\n */\n\nimport { tool } from 'ai';\nimport { z } from 'zod';\nimport { executeEditFile } from './core.js';\nimport { EDIT_FILE_TOOL_DESCRIPTION, EDIT_FILE_SYSTEM_PROMPT } from './prompts.js';\nimport type { EditFileConfig } from './types.js';\n\n/**\n * Vercel AI SDK tool for edit_file\n * \n * @example\n * ```ts\n * import { generateText } from 'ai';\n * import { anthropic } from '@ai-sdk/anthropic';\n * import { editFileTool } from 'morphsdk/tools/vercel';\n * \n * const result = await generateText({\n * model: anthropic('claude-sonnet-4-5-20250929'),\n * tools: { editFile: editFileTool },\n * prompt: \"Fix the bug in app.ts\"\n * });\n * ```\n */\nconst editFileSchema = z.object({\n target_filepath: z.string().describe('The path of the target file to modify'),\n instruction: z\n .string()\n .describe('A single sentence describing what you are changing (first person)'),\n code_edit: z\n .string()\n .describe('The lazy edit with // ... existing code ... markers'),\n});\n\nexport const editFileTool = tool({\n description: EDIT_FILE_TOOL_DESCRIPTION,\n inputSchema: editFileSchema,\n execute: async (params) => {\n const result = await executeEditFile({\n target_filepath: params.target_filepath,\n instruction: params.instruction,\n code_edit: params.code_edit,\n });\n \n if (!result.success) {\n throw new Error(`Failed to edit file: ${result.error}`);\n }\n \n return {\n success: true,\n filepath: result.filepath,\n changes: result.changes,\n udiff: result.udiff,\n };\n },\n});\n\n/**\n * Get the system prompt for edit_file usage\n * \n * Add this to your system message to guide the model on using edit_file properly.\n * \n * @example\n * ```ts\n * const result = await generateText({\n * model: anthropic('claude-sonnet-4-5-20250929'),\n * system: getSystemPrompt(),\n * tools: { editFile: editFileTool },\n * prompt: \"Fix bugs\"\n * });\n * ```\n */\nexport function getSystemPrompt(): string {\n return EDIT_FILE_SYSTEM_PROMPT;\n}\n\n/**\n * Create a custom edit_file tool with configuration\n * \n * @param config - Configuration options\n * @returns Vercel AI SDK tool with custom config\n * \n * @example\n * ```ts\n * const customEditTool = createEditFileTool({\n * baseDir: './src',\n * generateUdiff: true,\n * description: 'Custom tool description for your use case'\n * });\n * \n * const result = await generateText({\n * model: anthropic('claude-sonnet-4-5-20250929'),\n * tools: { editFile: customEditTool },\n * prompt: \"Fix bugs\"\n * });\n * ```\n */\nexport function createEditFileTool(config: EditFileConfig = {}) {\n const schema = z.object({\n target_filepath: z.string().describe('The path of the target file to modify'),\n instruction: z\n .string()\n .describe('A single sentence describing what you are changing (first person)'),\n code_edit: z\n .string()\n .describe('The lazy edit with // ... existing code ... markers'),\n });\n\n return tool({\n description: config.description || EDIT_FILE_TOOL_DESCRIPTION,\n inputSchema: schema,\n execute: async (params) => {\n const result = await executeEditFile(\n {\n target_filepath: params.target_filepath,\n instruction: params.instruction,\n code_edit: params.code_edit,\n },\n config\n );\n \n if (!result.success) {\n throw new Error(`Failed to edit file: ${result.error}`);\n }\n \n return {\n success: true,\n filepath: result.filepath,\n changes: result.changes,\n udiff: result.udiff,\n };\n },\n });\n}\n\n// Default export for convenience\nexport default editFileTool;\n\n"],"mappings":";;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,SAAS,YAAY;AACrB,SAAS,SAAS;AAqBlB,IAAM,iBAAiB,EAAE,OAAO;AAAA,EAC9B,iBAAiB,EAAE,OAAO,EAAE,SAAS,uCAAuC;AAAA,EAC5E,aAAa,EACV,OAAO,EACP,SAAS,mEAAmE;AAAA,EAC/E,WAAW,EACR,OAAO,EACP,SAAS,qDAAqD;AACnE,CAAC;AAEM,IAAM,eAAe,KAAK;AAAA,EAC/B,aAAa;AAAA,EACb,aAAa;AAAA,EACb,SAAS,OAAO,WAAW;AACzB,UAAM,SAAS,MAAM,gBAAgB;AAAA,MACnC,iBAAiB,OAAO;AAAA,MACxB,aAAa,OAAO;AAAA,MACpB,WAAW,OAAO;AAAA,IACpB,CAAC;AAED,QAAI,CAAC,OAAO,SAAS;AACnB,YAAM,IAAI,MAAM,wBAAwB,OAAO,KAAK,EAAE;AAAA,IACxD;AAEA,WAAO;AAAA,MACL,SAAS;AAAA,MACT,UAAU,OAAO;AAAA,MACjB,SAAS,OAAO;AAAA,MAChB,OAAO,OAAO;AAAA,IAChB;AAAA,EACF;AACF,CAAC;AAiBM,SAAS,kBAA0B;AACxC,SAAO;AACT;AAuBO,SAAS,mBAAmB,SAAyB,CAAC,GAAG;AAC9D,QAAM,SAAS,EAAE,OAAO;AAAA,IACtB,iBAAiB,EAAE,OAAO,EAAE,SAAS,uCAAuC;AAAA,IAC5E,aAAa,EACV,OAAO,EACP,SAAS,mEAAmE;AAAA,IAC/E,WAAW,EACR,OAAO,EACP,SAAS,qDAAqD;AAAA,EACnE,CAAC;AAED,SAAO,KAAK;AAAA,IACV,aAAa,OAAO,eAAe;AAAA,IACnC,aAAa;AAAA,IACb,SAAS,OAAO,WAAW;AACzB,YAAM,SAAS,MAAM;AAAA,QACnB;AAAA,UACE,iBAAiB,OAAO;AAAA,UACxB,aAAa,OAAO;AAAA,UACpB,WAAW,OAAO;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAEA,UAAI,CAAC,OAAO,SAAS;AACnB,cAAM,IAAI,MAAM,wBAAwB,OAAO,KAAK,EAAE;AAAA,MACxD;AAEA,aAAO;AAAA,QACL,SAAS;AAAA,QACT,UAAU,OAAO;AAAA,QACjB,SAAS,OAAO;AAAA,QAChB,OAAO,OAAO;AAAA,MAChB;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAGA,IAAO,iBAAQ;","names":[]}
@@ -851,7 +851,7 @@ declare class VercelToolFactory {
851
851
  */
852
852
  createEditFileTool(toolConfig?: Omit<EditFileConfig, 'morphApiKey'>): ai.Tool<{
853
853
  target_filepath: string;
854
- instructions: string;
854
+ instruction: string;
855
855
  code_edit: string;
856
856
  }, {
857
857
  success: boolean;
package/dist/client.cjs CHANGED
@@ -36,7 +36,7 @@ var init_package = __esm({
36
36
  "package.json"() {
37
37
  package_default = {
38
38
  name: "@morphllm/morphsdk",
39
- version: "0.2.154",
39
+ version: "0.2.155",
40
40
  description: "TypeScript SDK and CLI for Morph Fast Apply integration",
41
41
  type: "module",
42
42
  main: "./dist/index.cjs",
@@ -367,10 +367,11 @@ async function applyEdit(input, config = {}) {
367
367
  if (debug) {
368
368
  console.log(`[FastApply] Applying edit to code (${input.originalCode.length} chars)`);
369
369
  }
370
+ const instruction = input.instruction ?? input.instructions ?? "";
370
371
  const { content: mergedCode, completionId } = await callMorphAPI(
371
372
  input.originalCode,
372
373
  input.codeEdit,
373
- input.instructions,
374
+ instruction,
374
375
  filepath,
375
376
  config
376
377
  );
@@ -1084,7 +1085,8 @@ async function executeEditFile(input, config = {}) {
1084
1085
  }
1085
1086
  if (debug) console.log(`[FastApply] File doesn't exist, will create new file`);
1086
1087
  }
1087
- const { content: mergedCode, completionId } = await callMorphAPI2(originalCode, input.code_edit, input.instructions, input.target_filepath, config);
1088
+ const instruction = input.instruction ?? input.instructions ?? "";
1089
+ const { content: mergedCode, completionId } = await callMorphAPI2(originalCode, input.code_edit, instruction, input.target_filepath, config);
1088
1090
  const udiff = config.generateUdiff !== false ? generateUdiff2(originalCode, mergedCode, input.target_filepath) : void 0;
1089
1091
  if (config.autoWrite !== false) {
1090
1092
  await writeFile(fullPath, mergedCode, "utf-8");
@@ -5153,7 +5155,7 @@ var editFileTool = {
5153
5155
  type: "string",
5154
5156
  description: "The path of the target file to modify"
5155
5157
  },
5156
- instructions: {
5158
+ instruction: {
5157
5159
  type: "string",
5158
5160
  description: "A single sentence describing what you are changing (first person)"
5159
5161
  },
@@ -5162,7 +5164,7 @@ var editFileTool = {
5162
5164
  description: "The lazy edit with // ... existing code ... markers"
5163
5165
  }
5164
5166
  },
5165
- required: ["target_filepath", "instructions", "code_edit"]
5167
+ required: ["target_filepath", "instruction", "code_edit"]
5166
5168
  }
5167
5169
  }
5168
5170
  };
@@ -5384,7 +5386,7 @@ var editFileTool2 = {
5384
5386
  type: "string",
5385
5387
  description: "The path of the target file to modify"
5386
5388
  },
5387
- instructions: {
5389
+ instruction: {
5388
5390
  type: "string",
5389
5391
  description: "A single sentence describing what you are changing (first person)"
5390
5392
  },
@@ -5393,7 +5395,7 @@ var editFileTool2 = {
5393
5395
  description: "The lazy edit with // ... existing code ... markers"
5394
5396
  }
5395
5397
  },
5396
- required: ["target_filepath", "instructions", "code_edit"]
5398
+ required: ["target_filepath", "instruction", "code_edit"]
5397
5399
  }
5398
5400
  };
5399
5401
  function formatResult5(result) {
@@ -5938,7 +5940,7 @@ var import_ai3 = require("ai");
5938
5940
  var import_zod3 = require("zod");
5939
5941
  var editFileSchema = import_zod3.z.object({
5940
5942
  target_filepath: import_zod3.z.string().describe("The path of the target file to modify"),
5941
- instructions: import_zod3.z.string().describe("A single sentence describing what you are changing (first person)"),
5943
+ instruction: import_zod3.z.string().describe("A single sentence describing what you are changing (first person)"),
5942
5944
  code_edit: import_zod3.z.string().describe("The lazy edit with // ... existing code ... markers")
5943
5945
  });
5944
5946
  var editFileTool3 = (0, import_ai3.tool)({
@@ -5947,7 +5949,7 @@ var editFileTool3 = (0, import_ai3.tool)({
5947
5949
  execute: async (params) => {
5948
5950
  const result = await executeEditFile({
5949
5951
  target_filepath: params.target_filepath,
5950
- instructions: params.instructions,
5952
+ instruction: params.instruction,
5951
5953
  code_edit: params.code_edit
5952
5954
  });
5953
5955
  if (!result.success) {
@@ -5964,7 +5966,7 @@ var editFileTool3 = (0, import_ai3.tool)({
5964
5966
  function createEditFileTool3(config = {}) {
5965
5967
  const schema = import_zod3.z.object({
5966
5968
  target_filepath: import_zod3.z.string().describe("The path of the target file to modify"),
5967
- instructions: import_zod3.z.string().describe("A single sentence describing what you are changing (first person)"),
5969
+ instruction: import_zod3.z.string().describe("A single sentence describing what you are changing (first person)"),
5968
5970
  code_edit: import_zod3.z.string().describe("The lazy edit with // ... existing code ... markers")
5969
5971
  });
5970
5972
  return (0, import_ai3.tool)({
@@ -5974,7 +5976,7 @@ function createEditFileTool3(config = {}) {
5974
5976
  const result = await executeEditFile(
5975
5977
  {
5976
5978
  target_filepath: params.target_filepath,
5977
- instructions: params.instructions,
5979
+ instruction: params.instruction,
5978
5980
  code_edit: params.code_edit
5979
5981
  },
5980
5982
  config