@morphllm/morphsdk 0.2.7 → 0.2.8

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.
@@ -3,57 +3,13 @@ import {
3
3
  withTimeout
4
4
  } from "./chunk-4VWJFZVS.js";
5
5
 
6
- // tools/modelrouter/core.ts
6
+ // modelrouter/core.ts
7
7
  var DEFAULT_CONFIG = {
8
8
  apiUrl: "https://api.morphllm.com",
9
- timeout: 1e4,
10
- // 10 seconds
9
+ timeout: 5e3,
10
+ // 5 seconds (responses typically <500ms)
11
11
  debug: false
12
12
  };
13
- var MODEL_MAPPINGS = {
14
- openai: {
15
- balanced: {
16
- easy: "gpt-5-mini",
17
- medium: "gpt-5-low",
18
- hard: "gpt-5-medium",
19
- "needs-info": "gpt-5-mini"
20
- },
21
- aggressive: {
22
- easy: "gpt-5-low",
23
- medium: "gpt-5-medium",
24
- hard: "gpt-5-high",
25
- "needs-info": "gpt-5-mini"
26
- }
27
- },
28
- anthropic: {
29
- balanced: {
30
- easy: "claude-4.5-haiku",
31
- medium: "claude-4.5-haiku",
32
- hard: "claude-4.5-sonnet",
33
- "needs-info": "claude-4.5-haiku"
34
- },
35
- aggressive: {
36
- easy: "claude-4.5-haiku",
37
- medium: "claude-4.5-sonnet",
38
- hard: "claude-4.5-sonnet",
39
- "needs-info": "claude-4.5-haiku"
40
- }
41
- },
42
- gemini: {
43
- balanced: {
44
- easy: "gemini-2.5-flash",
45
- medium: "gemini-2.5-flash",
46
- hard: "gemini-2.5-pro",
47
- "needs-info": "gemini-2.5-flash"
48
- },
49
- aggressive: {
50
- easy: "gemini-2.5-flash",
51
- medium: "gemini-2.5-pro",
52
- hard: "gemini-2.5-pro",
53
- "needs-info": "gemini-2.5-flash"
54
- }
55
- }
56
- };
57
13
  var BaseRouter = class {
58
14
  config;
59
15
  provider;
@@ -67,13 +23,6 @@ var BaseRouter = class {
67
23
  retryConfig: config.retryConfig
68
24
  };
69
25
  }
70
- /**
71
- * Map backend complexity classification to actual model name
72
- */
73
- mapComplexityToModel(complexity, mode) {
74
- const mapping = MODEL_MAPPINGS[this.provider][mode];
75
- return mapping[complexity];
76
- }
77
26
  /**
78
27
  * Select the optimal model for a given input and mode
79
28
  */
@@ -85,7 +34,7 @@ var BaseRouter = class {
85
34
  "Morph API key is required. Set MORPH_API_KEY environment variable or pass apiKey in config."
86
35
  );
87
36
  }
88
- const url = `${this.config.apiUrl}/router/${this.provider}`;
37
+ const url = `${this.config.apiUrl}/v1/router/${this.provider}`;
89
38
  const payload = {
90
39
  input: input.input,
91
40
  mode
@@ -121,13 +70,11 @@ var BaseRouter = class {
121
70
  );
122
71
  }
123
72
  const apiResult = await response.json();
124
- const actualModel = this.mapComplexityToModel(apiResult.model, mode);
125
73
  const result = {
126
- model: actualModel,
127
- reasoning: apiResult.reasoning
74
+ model: apiResult.model
128
75
  };
129
76
  if (this.config.debug) {
130
- console.log(`[ModelRouter] Complexity: ${apiResult.model}, Selected model: ${actualModel}`);
77
+ console.log(`[ModelRouter] Selected model: ${apiResult.model}, Confidence: ${apiResult.confidence?.toFixed(3)}`);
131
78
  }
132
79
  return result;
133
80
  } catch (error) {
@@ -186,4 +133,4 @@ export {
186
133
  AnthropicRouter,
187
134
  GeminiRouter
188
135
  };
189
- //# sourceMappingURL=chunk-OI5YYE36.js.map
136
+ //# sourceMappingURL=chunk-AKVAAKRB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../modelrouter/core.ts"],"sourcesContent":["/**\n * Core implementation for intelligent model routing\n */\n\nimport { fetchWithRetry, withTimeout } from '../tools/utils/resilience.js';\nimport type {\n RouterConfig,\n RouterInput,\n RouterResult,\n ComplexityLevel,\n RouterMode,\n Provider,\n} from './types.js';\n\nconst DEFAULT_CONFIG = {\n apiUrl: 'https://api.morphllm.com',\n timeout: 5000, // 5 seconds (responses typically <500ms)\n debug: false,\n};\n\nabstract class BaseRouter {\n protected config: Required<Omit<RouterConfig, 'apiKey' | 'retryConfig'>> & Pick<RouterConfig, 'apiKey' | 'retryConfig'>;\n protected provider: Provider;\n\n constructor(provider: Provider, config: RouterConfig = {}) {\n this.provider = provider;\n this.config = {\n apiKey: config.apiKey,\n apiUrl: config.apiUrl || DEFAULT_CONFIG.apiUrl,\n timeout: config.timeout || DEFAULT_CONFIG.timeout,\n debug: config.debug || DEFAULT_CONFIG.debug,\n retryConfig: config.retryConfig,\n };\n }\n\n /**\n * Select the optimal model for a given input and mode\n */\n async selectModel(input: RouterInput): Promise<RouterResult> {\n const mode = input.mode || 'balanced';\n const apiKey = this.config.apiKey || process.env.MORPH_API_KEY;\n\n if (!apiKey) {\n throw new Error(\n 'Morph API key is required. Set MORPH_API_KEY environment variable or pass apiKey in config.'\n );\n }\n\n const url = `${this.config.apiUrl}/v1/router/${this.provider}`;\n const payload = {\n input: input.input,\n mode,\n };\n\n if (this.config.debug) {\n console.log(`[ModelRouter] Requesting ${this.provider} model selection:`, {\n mode,\n inputLength: input.input.length,\n });\n }\n\n try {\n const fetchPromise = fetchWithRetry(\n url,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${apiKey}`,\n },\n body: JSON.stringify(payload),\n },\n this.config.retryConfig\n );\n\n const response = await withTimeout(\n fetchPromise,\n this.config.timeout,\n `Router API request timed out after ${this.config.timeout}ms`\n );\n\n if (!response.ok) {\n const errorText = await response.text();\n throw new Error(\n `Router API error (${response.status}): ${errorText || response.statusText}`\n );\n }\n\n const apiResult: { model: string; confidence?: number } = await response.json();\n\n const result: RouterResult = {\n model: apiResult.model,\n };\n\n if (this.config.debug) {\n console.log(`[ModelRouter] Selected model: ${apiResult.model}, Confidence: ${apiResult.confidence?.toFixed(3)}`);\n }\n\n return result;\n } catch (error) {\n if (this.config.debug) {\n console.error(`[ModelRouter] Error selecting model:`, error);\n }\n throw error;\n }\n }\n}\n\n/**\n * OpenAI model router for GPT-5 series\n */\nexport class OpenAIRouter extends BaseRouter {\n constructor(config: RouterConfig = {}) {\n super('openai', config);\n }\n\n /**\n * Select optimal GPT-5 model\n * \n * @param input - User input and mode\n * @returns Selected model name (gpt-5-mini | gpt-5-low | gpt-5-medium | gpt-5-high)\n */\n async selectModel(input: RouterInput): Promise<RouterResult> {\n return super.selectModel(input);\n }\n}\n\n/**\n * Anthropic model router for Claude 4.5 series\n */\nexport class AnthropicRouter extends BaseRouter {\n constructor(config: RouterConfig = {}) {\n super('anthropic', config);\n }\n\n /**\n * Select optimal Claude model\n * \n * @param input - User input and mode\n * @returns Selected model name (claude-4.5-haiku | claude-4.5-sonnet)\n */\n async selectModel(input: RouterInput): Promise<RouterResult> {\n return super.selectModel(input);\n }\n}\n\n/**\n * Google Gemini model router\n */\nexport class GeminiRouter extends BaseRouter {\n constructor(config: RouterConfig = {}) {\n super('gemini', config);\n }\n\n /**\n * Select optimal Gemini model\n * \n * @param input - User input and mode\n * @returns Selected model name (gemini-2.5-flash | gemini-2.5-pro)\n */\n async selectModel(input: RouterInput): Promise<RouterResult> {\n return super.selectModel(input);\n }\n}\n"],"mappings":"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","names":[]}
@@ -2,7 +2,7 @@ import {
2
2
  AnthropicRouter,
3
3
  GeminiRouter,
4
4
  OpenAIRouter
5
- } from "./chunk-OI5YYE36.js";
5
+ } from "./chunk-AKVAAKRB.js";
6
6
  import {
7
7
  CodebaseSearchClient
8
8
  } from "./chunk-VJK4PH5V.js";
@@ -94,4 +94,4 @@ var MorphClient = class {
94
94
  export {
95
95
  MorphClient
96
96
  };
97
- //# sourceMappingURL=chunk-ZQEWQ7LJ.js.map
97
+ //# sourceMappingURL=chunk-BWI43OMO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../client.ts"],"sourcesContent":["/**\n * Unified Morph SDK Client\n * \n * Provides access to all Morph tools through a single interface\n * \n * @example\n * ```typescript\n * import { MorphClient } from '@cuda_oom/morphsdk';\n * \n * const morph = new MorphClient({ \n * apiKey: process.env.MORPH_API_KEY,\n * debug: true,\n * timeout: 60000\n * });\n * \n * // Use FastApply\n * const editResult = await morph.fastApply.execute({\n * target_filepath: 'src/index.ts',\n * instructions: 'Add error handling',\n * code_edit: 'try { ... } catch (e) { ... }'\n * });\n * \n * // Use CodebaseSearch\n * const searchResult = await morph.codebaseSearch.search({\n * query: 'authentication logic',\n * repoId: 'my-project'\n * });\n * \n * // Use Browser automation\n * const browserResult = await morph.browser.execute({\n * task: 'Test the checkout flow',\n * url: 'https://example.com'\n * });\n * \n * // Use Model Router\n * const { model } = await morph.routers.openai.selectModel({\n * input: 'Complex refactoring task',\n * mode: 'balanced'\n * });\n * ```\n */\n\nimport type { RetryConfig } from './tools/utils/resilience.js';\nimport { FastApplyClient } from './tools/fastapply/core.js';\nimport { CodebaseSearchClient } from './tools/codebase_search/core.js';\nimport { BrowserClient } from './tools/browser/core.js';\nimport { MorphGit } from './git/index.js';\nimport { OpenAIRouter, AnthropicRouter, GeminiRouter } from './modelrouter/core.js';\n\n/**\n * Configuration for the MorphClient\n */\nexport interface MorphClientConfig {\n /** Morph API key for authentication (defaults to MORPH_API_KEY env var) */\n apiKey?: string;\n /** Enable debug logging across all tools */\n debug?: boolean;\n /** Default timeout in milliseconds for API requests */\n timeout?: number;\n /** Retry configuration for failed requests */\n retryConfig?: RetryConfig;\n}\n\n/**\n * Unified Morph SDK Client\n * \n * Provides access to all Morph tools through a single interface:\n * - fastApply: AI-powered file editing with intelligent merging\n * - codebaseSearch: Semantic code search\n * - browser: AI-powered browser automation\n * - git: Version control operations\n * - routers: Intelligent model selection (OpenAI, Anthropic, Gemini)\n */\nexport class MorphClient {\n /** Client configuration */\n public config: MorphClientConfig;\n\n /** FastApply tool for editing files with AI-powered merge */\n public fastApply: FastApplyClient;\n\n /** CodebaseSearch tool for semantic code search */\n public codebaseSearch: CodebaseSearchClient;\n\n /** Browser tool for AI-powered browser automation */\n public browser: BrowserClient;\n\n /** Git tool for version control operations */\n public git: MorphGit;\n\n /** Model routers for intelligent model selection */\n public routers: {\n openai: OpenAIRouter;\n anthropic: AnthropicRouter;\n gemini: GeminiRouter;\n };\n\n /**\n * Create a new Morph SDK client\n * \n * @param config - Client configuration (apiKey, debug, timeout, retryConfig)\n * \n * @example\n * ```typescript\n * const morph = new MorphClient({ \n * apiKey: process.env.MORPH_API_KEY,\n * debug: true,\n * timeout: 60000\n * });\n * ```\n */\n constructor(config: MorphClientConfig = {}) {\n this.config = config;\n\n // Initialize all sub-clients with shared config\n this.fastApply = new FastApplyClient({\n apiKey: config.apiKey,\n debug: config.debug,\n timeout: config.timeout,\n retryConfig: config.retryConfig,\n });\n\n this.codebaseSearch = new CodebaseSearchClient({\n apiKey: config.apiKey,\n debug: config.debug,\n timeout: config.timeout,\n retryConfig: config.retryConfig,\n });\n\n this.browser = new BrowserClient({\n apiKey: config.apiKey,\n debug: config.debug,\n timeout: config.timeout,\n retryConfig: config.retryConfig,\n });\n\n this.git = new MorphGit({\n apiKey: config.apiKey,\n retryConfig: config.retryConfig,\n });\n\n this.routers = {\n openai: new OpenAIRouter({\n apiKey: config.apiKey,\n debug: config.debug,\n timeout: config.timeout,\n retryConfig: config.retryConfig,\n }),\n anthropic: new AnthropicRouter({\n apiKey: config.apiKey,\n debug: config.debug,\n timeout: config.timeout,\n retryConfig: config.retryConfig,\n }),\n gemini: new GeminiRouter({\n apiKey: config.apiKey,\n debug: config.debug,\n timeout: config.timeout,\n retryConfig: config.retryConfig,\n }),\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyEO,IAAM,cAAN,MAAkB;AAAA;AAAA,EAEhB;AAAA;AAAA,EAGA;AAAA;AAAA,EAGA;AAAA;AAAA,EAGA;AAAA;AAAA,EAGA;AAAA;AAAA,EAGA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBP,YAAY,SAA4B,CAAC,GAAG;AAC1C,SAAK,SAAS;AAGd,SAAK,YAAY,IAAI,gBAAgB;AAAA,MACnC,QAAQ,OAAO;AAAA,MACf,OAAO,OAAO;AAAA,MACd,SAAS,OAAO;AAAA,MAChB,aAAa,OAAO;AAAA,IACtB,CAAC;AAED,SAAK,iBAAiB,IAAI,qBAAqB;AAAA,MAC7C,QAAQ,OAAO;AAAA,MACf,OAAO,OAAO;AAAA,MACd,SAAS,OAAO;AAAA,MAChB,aAAa,OAAO;AAAA,IACtB,CAAC;AAED,SAAK,UAAU,IAAI,cAAc;AAAA,MAC/B,QAAQ,OAAO;AAAA,MACf,OAAO,OAAO;AAAA,MACd,SAAS,OAAO;AAAA,MAChB,aAAa,OAAO;AAAA,IACtB,CAAC;AAED,SAAK,MAAM,IAAI,SAAS;AAAA,MACtB,QAAQ,OAAO;AAAA,MACf,aAAa,OAAO;AAAA,IACtB,CAAC;AAED,SAAK,UAAU;AAAA,MACb,QAAQ,IAAI,aAAa;AAAA,QACvB,QAAQ,OAAO;AAAA,QACf,OAAO,OAAO;AAAA,QACd,SAAS,OAAO;AAAA,QAChB,aAAa,OAAO;AAAA,MACtB,CAAC;AAAA,MACD,WAAW,IAAI,gBAAgB;AAAA,QAC7B,QAAQ,OAAO;AAAA,QACf,OAAO,OAAO;AAAA,QACd,SAAS,OAAO;AAAA,QAChB,aAAa,OAAO;AAAA,MACtB,CAAC;AAAA,MACD,QAAQ,IAAI,aAAa;AAAA,QACvB,QAAQ,OAAO;AAAA,QACf,OAAO,OAAO;AAAA,QACd,SAAS,OAAO;AAAA,QAChB,aAAa,OAAO;AAAA,MACtB,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":[]}
package/dist/client.cjs CHANGED
@@ -1099,57 +1099,13 @@ var MorphGit = class {
1099
1099
  var import_isomorphic_git2 = __toESM(require("isomorphic-git"), 1);
1100
1100
  var import_node2 = __toESM(require("isomorphic-git/http/node"), 1);
1101
1101
 
1102
- // tools/modelrouter/core.ts
1102
+ // modelrouter/core.ts
1103
1103
  var DEFAULT_CONFIG3 = {
1104
1104
  apiUrl: "https://api.morphllm.com",
1105
- timeout: 1e4,
1106
- // 10 seconds
1105
+ timeout: 5e3,
1106
+ // 5 seconds (responses typically <500ms)
1107
1107
  debug: false
1108
1108
  };
1109
- var MODEL_MAPPINGS = {
1110
- openai: {
1111
- balanced: {
1112
- easy: "gpt-5-mini",
1113
- medium: "gpt-5-low",
1114
- hard: "gpt-5-medium",
1115
- "needs-info": "gpt-5-mini"
1116
- },
1117
- aggressive: {
1118
- easy: "gpt-5-low",
1119
- medium: "gpt-5-medium",
1120
- hard: "gpt-5-high",
1121
- "needs-info": "gpt-5-mini"
1122
- }
1123
- },
1124
- anthropic: {
1125
- balanced: {
1126
- easy: "claude-4.5-haiku",
1127
- medium: "claude-4.5-haiku",
1128
- hard: "claude-4.5-sonnet",
1129
- "needs-info": "claude-4.5-haiku"
1130
- },
1131
- aggressive: {
1132
- easy: "claude-4.5-haiku",
1133
- medium: "claude-4.5-sonnet",
1134
- hard: "claude-4.5-sonnet",
1135
- "needs-info": "claude-4.5-haiku"
1136
- }
1137
- },
1138
- gemini: {
1139
- balanced: {
1140
- easy: "gemini-2.5-flash",
1141
- medium: "gemini-2.5-flash",
1142
- hard: "gemini-2.5-pro",
1143
- "needs-info": "gemini-2.5-flash"
1144
- },
1145
- aggressive: {
1146
- easy: "gemini-2.5-flash",
1147
- medium: "gemini-2.5-pro",
1148
- hard: "gemini-2.5-pro",
1149
- "needs-info": "gemini-2.5-flash"
1150
- }
1151
- }
1152
- };
1153
1109
  var BaseRouter = class {
1154
1110
  config;
1155
1111
  provider;
@@ -1163,13 +1119,6 @@ var BaseRouter = class {
1163
1119
  retryConfig: config.retryConfig
1164
1120
  };
1165
1121
  }
1166
- /**
1167
- * Map backend complexity classification to actual model name
1168
- */
1169
- mapComplexityToModel(complexity, mode) {
1170
- const mapping = MODEL_MAPPINGS[this.provider][mode];
1171
- return mapping[complexity];
1172
- }
1173
1122
  /**
1174
1123
  * Select the optimal model for a given input and mode
1175
1124
  */
@@ -1181,7 +1130,7 @@ var BaseRouter = class {
1181
1130
  "Morph API key is required. Set MORPH_API_KEY environment variable or pass apiKey in config."
1182
1131
  );
1183
1132
  }
1184
- const url = `${this.config.apiUrl}/router/${this.provider}`;
1133
+ const url = `${this.config.apiUrl}/v1/router/${this.provider}`;
1185
1134
  const payload = {
1186
1135
  input: input.input,
1187
1136
  mode
@@ -1217,13 +1166,11 @@ var BaseRouter = class {
1217
1166
  );
1218
1167
  }
1219
1168
  const apiResult = await response.json();
1220
- const actualModel = this.mapComplexityToModel(apiResult.model, mode);
1221
1169
  const result = {
1222
- model: actualModel,
1223
- reasoning: apiResult.reasoning
1170
+ model: apiResult.model
1224
1171
  };
1225
1172
  if (this.config.debug) {
1226
- console.log(`[ModelRouter] Complexity: ${apiResult.model}, Selected model: ${actualModel}`);
1173
+ console.log(`[ModelRouter] Selected model: ${apiResult.model}, Confidence: ${apiResult.confidence?.toFixed(3)}`);
1227
1174
  }
1228
1175
  return result;
1229
1176
  } catch (error) {