@morphllm/morphsdk 0.2.7 → 0.2.13

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 (72) hide show
  1. package/dist/{chunk-ZQEWQ7LJ.js → chunk-4F6DRRCR.js} +10 -10
  2. package/dist/chunk-4F6DRRCR.js.map +1 -0
  3. package/dist/{chunk-G4DJ6VSM.js → chunk-7NG7SI6M.js} +6 -2
  4. package/dist/{chunk-G4DJ6VSM.js.map → chunk-7NG7SI6M.js.map} +1 -1
  5. package/dist/{chunk-OI5YYE36.js → chunk-AKVAAKRB.js} +7 -60
  6. package/dist/chunk-AKVAAKRB.js.map +1 -0
  7. package/dist/{chunk-5COKN3XD.js → chunk-IUCGXKTX.js} +2 -2
  8. package/dist/{chunk-5COKN3XD.js.map → chunk-IUCGXKTX.js.map} +1 -1
  9. package/dist/{chunk-4UVEBIDK.js → chunk-OWXIAZUZ.js} +150 -6
  10. package/dist/chunk-OWXIAZUZ.js.map +1 -0
  11. package/dist/{chunk-YWS2GRQC.js → chunk-QFUHDWGY.js} +11 -2
  12. package/dist/{chunk-YWS2GRQC.js.map → chunk-QFUHDWGY.js.map} +1 -1
  13. package/dist/client.cjs +151 -64
  14. package/dist/client.cjs.map +1 -1
  15. package/dist/client.js +4 -4
  16. package/dist/index.cjs +151 -64
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.js +10 -10
  19. package/dist/{tools/modelrouter → modelrouter}/core.cjs +7 -60
  20. package/dist/modelrouter/core.cjs.map +1 -0
  21. package/dist/modelrouter/core.js +13 -0
  22. package/dist/{tools/modelrouter → modelrouter}/index.cjs +7 -60
  23. package/dist/modelrouter/index.cjs.map +1 -0
  24. package/dist/modelrouter/index.js +13 -0
  25. package/dist/{tools/modelrouter → modelrouter}/types.cjs +1 -1
  26. package/dist/modelrouter/types.cjs.map +1 -0
  27. package/dist/tools/browser/anthropic.cjs +9 -3
  28. package/dist/tools/browser/anthropic.cjs.map +1 -1
  29. package/dist/tools/browser/anthropic.js +1 -1
  30. package/dist/tools/browser/core.cjs +145 -5
  31. package/dist/tools/browser/core.cjs.map +1 -1
  32. package/dist/tools/browser/core.js +1 -1
  33. package/dist/tools/browser/index.cjs +153 -5
  34. package/dist/tools/browser/index.cjs.map +1 -1
  35. package/dist/tools/browser/index.js +9 -1
  36. package/dist/tools/browser/openai.cjs +9 -3
  37. package/dist/tools/browser/openai.cjs.map +1 -1
  38. package/dist/tools/browser/openai.js +1 -1
  39. package/dist/tools/browser/types.cjs.map +1 -1
  40. package/dist/tools/browser/vercel.cjs +9 -3
  41. package/dist/tools/browser/vercel.cjs.map +1 -1
  42. package/dist/tools/browser/vercel.js +1 -1
  43. package/dist/tools/codebase_search/index.js +3 -3
  44. package/dist/tools/fastapply/anthropic.cjs +5 -1
  45. package/dist/tools/fastapply/anthropic.cjs.map +1 -1
  46. package/dist/tools/fastapply/anthropic.js +1 -1
  47. package/dist/tools/fastapply/index.cjs +16 -3
  48. package/dist/tools/fastapply/index.cjs.map +1 -1
  49. package/dist/tools/fastapply/index.js +5 -5
  50. package/dist/tools/fastapply/openai.cjs +10 -1
  51. package/dist/tools/fastapply/openai.cjs.map +1 -1
  52. package/dist/tools/fastapply/openai.js +1 -1
  53. package/dist/tools/fastapply/types.cjs.map +1 -1
  54. package/dist/tools/fastapply/vercel.cjs +1 -1
  55. package/dist/tools/fastapply/vercel.cjs.map +1 -1
  56. package/dist/tools/fastapply/vercel.js +1 -1
  57. package/dist/tools/index.cjs +16 -3
  58. package/dist/tools/index.cjs.map +1 -1
  59. package/dist/tools/index.js +5 -5
  60. package/package.json +11 -8
  61. package/dist/chunk-4UVEBIDK.js.map +0 -1
  62. package/dist/chunk-OI5YYE36.js.map +0 -1
  63. package/dist/chunk-ZQEWQ7LJ.js.map +0 -1
  64. package/dist/tools/modelrouter/core.cjs.map +0 -1
  65. package/dist/tools/modelrouter/core.js +0 -13
  66. package/dist/tools/modelrouter/index.cjs.map +0 -1
  67. package/dist/tools/modelrouter/index.js +0 -13
  68. package/dist/tools/modelrouter/types.cjs.map +0 -1
  69. /package/dist/{tools/modelrouter → modelrouter}/core.js.map +0 -0
  70. /package/dist/{tools/modelrouter → modelrouter}/index.js.map +0 -0
  71. /package/dist/{tools/modelrouter → modelrouter}/types.js +0 -0
  72. /package/dist/{tools/modelrouter → modelrouter}/types.js.map +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../tools/modelrouter/index.ts","../../../tools/utils/resilience.ts","../../../tools/modelrouter/core.ts"],"sourcesContent":["/**\n * Intelligent model routing based on task complexity\n * \n * @module modelrouter\n */\n\nexport { OpenAIRouter, AnthropicRouter, GeminiRouter } from './core.js';\nexport type {\n RouterConfig,\n RouterInput,\n RouterResult,\n ComplexityLevel,\n RouterMode,\n Provider,\n} from './types.js';\n","/**\n * Resilience utilities for retry logic and timeout handling\n */\n\nexport interface RetryConfig {\n maxRetries?: number; // Default: 3\n initialDelay?: number; // Default: 1000ms\n maxDelay?: number; // Default: 30000ms\n backoffMultiplier?: number; // Default: 2\n retryableErrors?: string[]; // Default: ['ECONNREFUSED', 'ETIMEDOUT', 'ENOTFOUND']\n onRetry?: (attempt: number, error: Error) => void;\n}\n\nconst DEFAULT_RETRY_CONFIG: Required<Omit<RetryConfig, 'onRetry'>> = {\n maxRetries: 3,\n initialDelay: 1000,\n maxDelay: 30000,\n backoffMultiplier: 2,\n retryableErrors: ['ECONNREFUSED', 'ETIMEDOUT', 'ENOTFOUND'],\n};\n\n/**\n * Retry a fetch request with exponential backoff\n * \n * @param url - Request URL\n * @param options - Fetch options\n * @param retryConfig - Retry configuration\n * @returns Response from fetch\n * \n * @example\n * ```typescript\n * const response = await fetchWithRetry(\n * 'https://api.example.com/data',\n * { method: 'POST', body: JSON.stringify(data) },\n * { maxRetries: 5, initialDelay: 500 }\n * );\n * ```\n */\nexport async function fetchWithRetry(\n url: string,\n options: RequestInit,\n retryConfig: RetryConfig = {}\n): Promise<Response> {\n const {\n maxRetries = DEFAULT_RETRY_CONFIG.maxRetries,\n initialDelay = DEFAULT_RETRY_CONFIG.initialDelay,\n maxDelay = DEFAULT_RETRY_CONFIG.maxDelay,\n backoffMultiplier = DEFAULT_RETRY_CONFIG.backoffMultiplier,\n retryableErrors = DEFAULT_RETRY_CONFIG.retryableErrors,\n onRetry,\n } = retryConfig;\n\n let lastError: Error | null = null;\n let delay = initialDelay;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n const response = await fetch(url, options);\n \n // Retry on 429 (rate limit) or 503 (service unavailable)\n if (response.status === 429 || response.status === 503) {\n if (attempt < maxRetries) {\n // Check for Retry-After header\n const retryAfter = response.headers.get('Retry-After');\n const waitTime = retryAfter \n ? parseInt(retryAfter) * 1000 \n : Math.min(delay, maxDelay);\n \n const error = new Error(`HTTP ${response.status}: Retrying after ${waitTime}ms`);\n if (onRetry) {\n onRetry(attempt + 1, error);\n }\n \n await sleep(waitTime);\n delay *= backoffMultiplier;\n continue;\n }\n }\n\n return response;\n } catch (error) {\n lastError = error as Error;\n \n // Check if error is retryable\n const isRetryable = retryableErrors.some(errType => \n lastError?.message?.includes(errType)\n );\n\n if (!isRetryable || attempt === maxRetries) {\n throw lastError;\n }\n\n // Exponential backoff\n const waitTime = Math.min(delay, maxDelay);\n if (onRetry) {\n onRetry(attempt + 1, lastError);\n }\n \n await sleep(waitTime);\n delay *= backoffMultiplier;\n }\n }\n\n throw lastError || new Error('Max retries exceeded');\n}\n\n/**\n * Add timeout to any promise\n * \n * @param promise - Promise to wrap with timeout\n * @param timeoutMs - Timeout in milliseconds\n * @param errorMessage - Optional custom error message\n * @returns Promise that rejects if timeout is reached\n * \n * @example\n * ```typescript\n * const result = await withTimeout(\n * fetchData(),\n * 5000,\n * 'Data fetch timed out'\n * );\n * ```\n */\nexport async function withTimeout<T>(\n promise: Promise<T>,\n timeoutMs: number,\n errorMessage?: string\n): Promise<T> {\n let timeoutId: NodeJS.Timeout | number;\n \n const timeoutPromise = new Promise<never>((_, reject) => {\n timeoutId = setTimeout(() => {\n reject(new Error(errorMessage || `Operation timed out after ${timeoutMs}ms`));\n }, timeoutMs);\n });\n\n try {\n const result = await Promise.race([promise, timeoutPromise]);\n clearTimeout(timeoutId!);\n return result;\n } catch (error) {\n clearTimeout(timeoutId!);\n throw error;\n }\n}\n\n/**\n * Sleep for specified milliseconds\n */\nfunction sleep(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n/**\n * Unified error type for all tools\n */\nexport class MorphError extends Error {\n constructor(\n message: string,\n public code: string,\n public statusCode?: number,\n public retryable: boolean = false\n ) {\n super(message);\n this.name = 'MorphError';\n }\n}\n\n\n","/**\n * Core implementation for intelligent model routing\n */\n\nimport { fetchWithRetry, withTimeout } from '../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: 10000, // 10 seconds\n debug: false,\n};\n\nconst MODEL_MAPPINGS: Record<Provider, Record<RouterMode, Record<ComplexityLevel, string>>> = {\n openai: {\n balanced: {\n easy: 'gpt-5-mini',\n medium: 'gpt-5-low',\n hard: 'gpt-5-medium',\n 'needs-info': 'gpt-5-mini',\n },\n aggressive: {\n easy: 'gpt-5-low',\n medium: 'gpt-5-medium',\n hard: 'gpt-5-high',\n 'needs-info': 'gpt-5-mini',\n },\n },\n anthropic: {\n balanced: {\n easy: 'claude-4.5-haiku',\n medium: 'claude-4.5-haiku',\n hard: 'claude-4.5-sonnet',\n 'needs-info': 'claude-4.5-haiku',\n },\n aggressive: {\n easy: 'claude-4.5-haiku',\n medium: 'claude-4.5-sonnet',\n hard: 'claude-4.5-sonnet',\n 'needs-info': 'claude-4.5-haiku',\n },\n },\n gemini: {\n balanced: {\n easy: 'gemini-2.5-flash',\n medium: 'gemini-2.5-flash',\n hard: 'gemini-2.5-pro',\n 'needs-info': 'gemini-2.5-flash',\n },\n aggressive: {\n easy: 'gemini-2.5-flash',\n medium: 'gemini-2.5-pro',\n hard: 'gemini-2.5-pro',\n 'needs-info': 'gemini-2.5-flash',\n },\n },\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 * Map backend complexity classification to actual model name\n */\n protected mapComplexityToModel(complexity: ComplexityLevel, mode: RouterMode): string {\n const mapping = MODEL_MAPPINGS[this.provider][mode];\n return mapping[complexity];\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}/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: ComplexityLevel; reasoning?: string } = await response.json();\n const actualModel = this.mapComplexityToModel(apiResult.model, mode);\n\n const result: RouterResult = {\n model: actualModel,\n reasoning: apiResult.reasoning,\n };\n\n if (this.config.debug) {\n console.log(`[ModelRouter] Complexity: ${apiResult.model}, Selected model: ${actualModel}`);\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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaA,IAAM,uBAA+D;AAAA,EACnE,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,UAAU;AAAA,EACV,mBAAmB;AAAA,EACnB,iBAAiB,CAAC,gBAAgB,aAAa,WAAW;AAC5D;AAmBA,eAAs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;AACF;","names":[]}
@@ -1,13 +0,0 @@
1
- import {
2
- AnthropicRouter,
3
- GeminiRouter,
4
- OpenAIRouter
5
- } from "../../chunk-OI5YYE36.js";
6
- import "../../chunk-4VWJFZVS.js";
7
- import "../../chunk-PZ5AY32C.js";
8
- export {
9
- AnthropicRouter,
10
- GeminiRouter,
11
- OpenAIRouter
12
- };
13
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../tools/modelrouter/types.ts"],"sourcesContent":["/**\n * Model router types for intelligent model selection\n */\n\nexport type ComplexityLevel = 'easy' | 'medium' | 'hard' | 'needs-info';\nexport type RouterMode = 'balanced' | 'aggressive';\nexport type Provider = 'openai' | 'anthropic' | 'gemini';\n\nexport interface RouterConfig {\n /** Morph API key (defaults to MORPH_API_KEY env var) */\n apiKey?: string;\n /** Router API URL (defaults to https://api.morphllm.com) */\n apiUrl?: string;\n /** Request timeout in milliseconds (default: 10000) */\n timeout?: number;\n /** Enable debug logging */\n debug?: boolean;\n /** Retry configuration */\n retryConfig?: {\n maxRetries?: number;\n initialDelay?: number;\n maxDelay?: number;\n backoffMultiplier?: number;\n };\n}\n\nexport interface RouterInput {\n /** User input or task description */\n input: string;\n /** Routing mode: balanced (cheaper models) or aggressive (more capable models) */\n mode?: RouterMode;\n}\n\nexport interface RouterResult {\n /** Selected model name */\n model: string;\n /** Reasoning for model selection */\n reasoning?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}