{"version":3,"sources":["../../git/index.ts","../../git/client.ts","../../package.json","../../version.ts","../../tools/utils/resilience.ts","../../logger.ts","../../core/error.ts","../../core/client.ts","../../core/resource.ts"],"sourcesContent":["/**\n * Morph Git SDK\n * \n * Git operations for AI agents using Morph's backend infrastructure.\n * \n * @example\n * ```typescript\n * import { MorphGit } from 'morphsdk/git';\n * \n * const morphGit = new MorphGit({\n *   apiKey: process.env.MORPH_API_KEY!\n * });\n * \n * // Initialize and push\n * await morphGit.init({ repoId: 'my-project', dir: './my-project' });\n * await morphGit.add({ dir: './my-project', filepath: 'src/app.ts' });\n * await morphGit.commit({ dir: './my-project', message: 'Update' });\n * await morphGit.push({ dir: './my-project', branch: 'main' });\n * ```\n */\n\nexport { MorphGit } from './client.js';\nexport type {\n  MorphGitConfig,\n  CloneOptions,\n  PushOptions,\n  PullOptions,\n  AddOptions,\n  CommitOptions,\n  StatusOptions,\n  LogOptions,\n  CheckoutOptions,\n  BranchOptions,\n  DiffOptions,\n  CommitObject,\n  StatusResult,\n  ChatMessage,\n  CommitMetadata,\n  MorphNotesSchema,\n} from './types.js';\n\n// Re-export isomorphic-git for advanced use cases\nexport { default as git } from 'isomorphic-git';\nexport { default as http } from 'isomorphic-git/http/node';\n\n","/**\n * Morph Git Client - Simple, high-level Git operations\n * Built on isomorphic-git with explicit configuration\n */\n\n\nimport git from 'isomorphic-git';\nimport http from 'isomorphic-git/http/node';\nimport fs from 'fs';\nimport type {\n  CloneOptions,\n  PushOptions,\n  PullOptions,\n  AddOptions,\n  CommitOptions,\n  StatusOptions,\n  LogOptions,\n  CheckoutOptions,\n  BranchOptions,\n  DiffOptions,\n  CommitObject,\n  StatusResult,\n  MorphGitConfig,\n  MorphNotesSchema,\n  WaitForEmbeddingsOptions,\n  EmbeddingProgress,\n} from './types.js';\nimport { MorphAPIClient } from '../core/client.js';\nimport { APIResource } from '../core/resource.js';\n\nconst DEFAULT_PROXY_URL = 'https://repos.morphllm.com';\n\n/**\n * MorphGit - Git operations for AI agents with Morph backend\n * \n * @example\n * ```typescript\n * import { MorphGit } from 'morphsdk/git';\n * \n * const morphGit = new MorphGit({\n *   apiKey: process.env.MORPH_API_KEY!,\n *   proxyUrl: 'https://repos.morphllm.com' // Optional\n * });\n * \n * await morphGit.init({ repoId: 'my-project', dir: './my-project' });\n * await morphGit.push({ dir: './my-project' });\n * ```\n *\n * @deprecated Prefer the unified `MorphClient` (`new MorphClient({ apiKey }).git`).\n * Standalone clients remain only for backwards compatibility and may be removed in a future\n * major version — do not use them in new code.\n */\nexport class MorphGit extends APIResource {\n  private readonly apiKey: string;\n  private readonly proxyUrl: string;\n\n  constructor(clientOrConfig: MorphAPIClient | MorphGitConfig) {\n    const isClient = clientOrConfig instanceof MorphAPIClient;\n\n    // Standalone construction validates the key eagerly (mirrors the historical\n    // contract). When sharing a transport, MorphClient has already validated it.\n    if (!isClient) {\n      if (!clientOrConfig.apiKey) {\n        throw new Error('API key is required. Get one at https://morphllm.com/dashboard');\n      }\n      if (!clientOrConfig.apiKey.startsWith('sk-') && !clientOrConfig.apiKey.startsWith('morph-')) {\n        throw new Error('Invalid API key format. Expected: sk-... or morph-...');\n      }\n    }\n\n    super(\n      isClient\n        ? clientOrConfig\n        : new MorphAPIClient({\n            apiKey: clientOrConfig.apiKey,\n            reposURL: clientOrConfig.proxyUrl,\n            retryConfig: clientOrConfig.retryConfig,\n          }),\n    );\n\n    // Git is a distinct service (isomorphic-git + raw fetch to the repos host);\n    // it keeps its own wire but sources the key/host from the shared transport.\n    this.apiKey = this._client.resolveApiKey() ?? '';\n    this.proxyUrl = isClient ? this._client.reposURL : (clientOrConfig.proxyUrl || DEFAULT_PROXY_URL);\n  }\n  \n  /**\n   * Get auth callback for isomorphic-git operations\n   * @private\n   */\n  private getAuthCallback() {\n    return () => ({\n      username: 'morph',\n      password: this.apiKey,\n    });\n  }\n\n  /**\n   * Initialize a new repository\n   * Creates the repo in the database and in the git provider\n   * \n   * @example\n   * ```ts\n   * await morphGit.init({\n   *   repoId: 'my-project',\n   *   dir: './my-project',\n   *   defaultBranch: 'main'\n   * });\n   * ```\n   */\n  async init(options: {\n    repoId: string;\n    dir: string;\n    defaultBranch?: string;\n  }): Promise<void> {\n    const { repoId, dir, defaultBranch = 'main' } = options;\n\n    // Call backend API to create repository\n    const response = await fetch(`${this.proxyUrl}/v1/repos`, {\n      method: 'POST',\n      headers: {\n        'Authorization': `Bearer ${this.apiKey}`,\n        'Content-Type': 'application/json',\n      },\n      body: JSON.stringify({\n        repoId,\n        name: repoId,\n        defaultBranch,\n      }),\n    });\n\n    if (!response.ok) {\n      const error = await response.text();\n      throw new Error(`Failed to create repository: ${error}`);\n    }\n\n    // Initialize local git repository (industry standard: no clone needed)\n    await git.init({\n      fs,\n      dir,\n      defaultBranch,\n    });\n\n    // Add remote pointing to Morph git-proxy\n    await git.addRemote({\n      fs,\n      dir,\n      remote: 'origin',\n      url: `${this.proxyUrl}/v1/repos/${repoId}`,\n    });\n\n    console.log(`✓ Repository '${repoId}' initialized`);\n  }\n\n  /**\n   * Clone a repository from Morph repos\n   * \n   * @example\n   * ```ts\n   * await morphGit.clone({\n   *   repoId: 'my-project',\n   *   dir: './my-project'\n   * });\n   * ```\n   */\n  async clone(options: CloneOptions): Promise<void> {\n    const { repoId, dir, branch = 'main', depth, singleBranch = true } = options;\n\n    await git.clone({\n      fs,\n      http,\n      dir,\n      url: `${this.proxyUrl}/v1/repos/${repoId}`,\n      ref: branch,\n      singleBranch,\n      depth,\n      onAuth: this.getAuthCallback(),\n    });\n  }\n\n  /**\n   * Push changes to remote repository\n   * \n   * @example\n   * ```ts\n   * await morphGit.push({ \n   *   dir: './my-project',\n   *   branch: 'main', // Required: explicit branch name\n   *   index: true     // Optional: generate embeddings for semantic search\n   * });\n   * ```\n   */\n  async push(options: PushOptions): Promise<void> {\n    const { dir, remote = 'origin', branch, waitForEmbeddings, index = false } = options;\n\n    if (!branch) {\n      throw new Error(\n        'branch is required for push operations. ' +\n        'Specify the branch explicitly: { dir: \"./my-project\", branch: \"main\" }'\n      );\n    }\n\n    // Get commit hash and repoId before pushing\n    const commitHash = await git.resolveRef({ fs, dir, ref: 'HEAD' });\n    \n    // Get repoId from git remote URL\n    let repoId: string | undefined;\n    const remotes = await git.listRemotes({ fs, dir });\n    const originRemote = remotes.find(r => r.remote === remote);\n    if (originRemote) {\n      // Extract repoId from URL: https://repos.morphllm.com/v1/repos/{repoId}\n      const match = originRemote.url.match(/\\/repos\\/([^\\/]+)$/);\n      if (match) {\n        repoId = match[1];\n      }\n    }\n\n    await git.push({\n      fs,\n      http,\n      dir,\n      remote,\n      ref: branch,\n      onAuth: this.getAuthCallback(),\n    });\n    \n    // Configure commit after successful push (set index flag)\n    if (repoId && commitHash) {\n      await this.configureCommit({ repoId, commitHash, branch, index });\n    }\n    \n    // Wait for embeddings if requested (and indexing is enabled)\n    if (waitForEmbeddings && repoId && commitHash && index) {\n      await this.waitForEmbeddings({ repoId, commitHash });\n    }\n  }\n\n  /**\n   * Configure commit settings on the backend after push.\n   * Sets the index flag to control embedding generation.\n   * @private\n   */\n  private async configureCommit(options: {\n    repoId: string;\n    commitHash: string;\n    branch: string;\n    index: boolean;\n  }): Promise<void> {\n    const { repoId, commitHash, branch, index } = options;\n    \n    const response = await fetch(\n      `${this.proxyUrl}/v1/repos/${repoId}/commits/${commitHash}/config`,\n      {\n        method: 'POST',\n        headers: {\n          'Authorization': `Bearer ${this.apiKey}`,\n          'Content-Type': 'application/json',\n        },\n        body: JSON.stringify({ index, branch }),\n      }\n    );\n\n    if (!response.ok) {\n      // Non-fatal: log warning but don't throw\n      console.warn(`Failed to configure commit: ${response.status}`);\n    }\n  }\n\n  /**\n   * Pull changes from remote repository\n   * \n   * @example\n   * ```ts\n   * await morphGit.pull({ \n   *   dir: './my-project',\n   *   branch: 'main' // Required: explicit branch name\n   * });\n   * ```\n   */\n  async pull(options: PullOptions): Promise<void> {\n    const { dir, remote = 'origin', branch } = options;\n\n    if (!branch) {\n      throw new Error(\n        'branch is required for pull operations. ' +\n        'Specify the branch explicitly: { dir: \"./my-project\", branch: \"main\" }'\n      );\n    }\n\n    await git.pull({\n      fs,\n      http,\n      dir,\n      remote,\n      ref: branch,\n      onAuth: this.getAuthCallback(),\n      author: {\n        name: 'Morph Agent',\n        email: 'agent@morph.com',\n      },\n    });\n  }\n\n  /**\n   * Wait for embeddings to complete after push.\n   * Polls status endpoint until embeddings are done.\n   * \n   * @example\n   * ```ts\n   * await morphGit.push({ dir: './my-project', branch: 'main' });\n   * await morphGit.waitForEmbeddings({\n   *   repoId: 'my-project',\n   *   onProgress: (p) => console.log(`${p.filesProcessed}/${p.totalFiles}`)\n   * });\n   * ```\n   */\n  async waitForEmbeddings(options: WaitForEmbeddingsOptions): Promise<void> {\n    const { repoId, commitHash, timeout = 120000, onProgress } = options;\n    const startTime = Date.now();\n    const pollInterval = 1000;  // Poll every 1s\n    \n    while (Date.now() - startTime < timeout) {\n      const statusUrl = `${this.proxyUrl}/v1/repos/${repoId}/embedding-status` +\n        (commitHash ? `?commit_hash=${commitHash}` : '');\n      \n      const response = await fetch(statusUrl, {\n        headers: { 'Authorization': `Bearer ${this.apiKey}` }\n      });\n      \n      if (response.status === 404) {\n        // No job found yet - might still be creating\n        await new Promise(resolve => setTimeout(resolve, pollInterval));\n        continue;\n      }\n      \n      if (!response.ok) {\n        throw new Error(`Failed to get embedding status: ${response.status}`);\n      }\n      \n      const status = await response.json();\n      \n      if (onProgress && status.progress) {\n        onProgress(status.progress);\n      }\n      \n      if (status.status === 'completed') {\n        return;  // Done!\n      }\n      \n      if (status.status === 'failed') {\n        throw new Error(`Embeddings failed: ${status.error || 'Unknown error'}`);\n      }\n      \n      // Still processing (queued or processing), wait and poll again\n      await new Promise(resolve => setTimeout(resolve, pollInterval));\n    }\n    \n    throw new Error(`Embeddings timed out after ${timeout}ms`);\n  }\n\n  /**\n   * Stage a file for commit\n   * \n   * @example\n   * ```ts\n   * await morphGit.add({\n   *   dir: './my-project',\n   *   filepath: 'src/app.ts'\n   * });\n   * ```\n   */\n  async add(options: AddOptions): Promise<void> {\n    const { dir, filepath } = options;\n\n    await git.add({\n      fs,\n      dir,\n      filepath,\n    });\n  }\n\n  /**\n   * Remove a file from staging\n   * \n   * @example\n   * ```ts\n   * await morphGit.remove({\n   *   dir: './my-project',\n   *   filepath: 'src/old-file.ts'\n   * });\n   * ```\n   */\n  async remove(options: AddOptions): Promise<void> {\n    const { dir, filepath } = options;\n\n    await git.remove({\n      fs,\n      dir,\n      filepath,\n    });\n  }\n\n  /**\n   * Commit staged changes\n   * \n   * @example\n   * ```ts\n   * await morphGit.commit({\n   *   dir: './my-project',\n   *   message: 'Add new feature',\n   *   author: {\n   *     name: 'AI Agent',\n   *     email: 'ai@example.com'\n   *   },\n   *   metadata: { issueId: 'PROJ-123', source: 'agent' },\n   *   chatHistory: [\n   *     { role: 'user', content: 'Please add a new feature' },\n   *     { role: 'assistant', content: 'I will add that feature' }\n   *   ],\n   *   recordingId: 'rec_123'\n   * });\n   * ```\n   */\n  async commit(options: CommitOptions): Promise<string> {\n    const { dir, message, author, metadata, chatHistory, recordingId } = options;\n\n    // Provide default author if not specified\n    const commitAuthor = author || {\n      name: 'Morph SDK',\n      email: 'sdk@morphllm.com'\n    };\n\n    const sha = await git.commit({\n      fs,\n      dir,\n      message,\n      author: commitAuthor,\n    });\n\n    // Store notes if any note fields are provided\n    if (metadata || chatHistory || recordingId) {\n      const notes: MorphNotesSchema = {\n        metadata,\n        chatHistory,\n        recordingId,\n        _version: 1\n      };\n      \n      await git.addNote({\n        fs,\n        dir,\n        ref: 'refs/notes/morph-metadata',\n        oid: sha,\n        note: JSON.stringify(notes, null, 2),\n        author: commitAuthor\n      });\n    }\n\n    return sha;\n  }\n\n  /**\n   * Get status of a file\n   * \n   * @example\n   * ```ts\n   * const status = await morphGit.status({\n   *   dir: './my-project',\n   *   filepath: 'src/app.ts'\n   * });\n   * console.log(status); // 'modified', '*added', etc.\n   * ```\n   */\n  async status(options: StatusOptions): Promise<string> {\n    const { dir, filepath } = options;\n\n    if (!filepath) {\n      throw new Error('filepath is required for status check');\n    }\n\n    const status = await git.status({\n      fs,\n      dir,\n      filepath,\n    });\n\n    return status;\n  }\n\n  /**\n   * Get commit history\n   * \n   * @example\n   * ```ts\n   * const commits = await morphGit.log({\n   *   dir: './my-project',\n   *   depth: 10\n   * });\n   * ```\n   */\n  async log(options: LogOptions): Promise<CommitObject[]> {\n    const { dir, depth, ref } = options;\n\n    const commits = await git.log({\n      fs,\n      dir,\n      depth,\n      ref,\n    });\n\n    return commits as CommitObject[];\n  }\n\n  /**\n   * Checkout a branch or commit\n   * \n   * @example\n   * ```ts\n   * await morphGit.checkout({\n   *   dir: './my-project',\n   *   ref: 'feature-branch'\n   * });\n   * ```\n   */\n  async checkout(options: CheckoutOptions): Promise<void> {\n    const { dir, ref } = options;\n\n    await git.checkout({\n      fs,\n      dir,\n      ref,\n    });\n  }\n\n  /**\n   * Create a new branch\n   * \n   * @example\n   * ```ts\n   * await morphGit.branch({\n   *   dir: './my-project',\n   *   name: 'feature-branch',\n   *   checkout: true\n   * });\n   * ```\n   */\n  async branch(options: BranchOptions): Promise<void> {\n    const { dir, name, checkout = false } = options;\n\n    await git.branch({\n      fs,\n      dir,\n      ref: name,\n      checkout,\n    });\n  }\n\n  /**\n   * List all branches\n   * \n   * @example\n   * ```ts\n   * const branches = await morphGit.listBranches({\n   *   dir: './my-project'\n   * });\n   * ```\n   */\n  async listBranches(options: { dir: string }): Promise<string[]> {\n    const { dir } = options;\n\n    const branches = await git.listBranches({\n      fs,\n      dir,\n    });\n\n    return branches;\n  }\n\n  /**\n   * Get the current branch name\n   * \n   * @example\n   * ```ts\n   * const branch = await morphGit.currentBranch({\n   *   dir: './my-project'\n   * });\n   * ```\n   */\n  async currentBranch(options: { dir: string }): Promise<string | undefined> {\n    const { dir } = options;\n\n    const branch = await git.currentBranch({\n      fs,\n      dir,\n    });\n\n    return branch || undefined;\n  }\n\n  /**\n   * Get list of changed files (similar to git diff --name-only)\n   * \n   * @example\n   * ```ts\n   * const changes = await morphGit.statusMatrix({\n   *   dir: './my-project'\n   * });\n   * ```\n   */\n  async statusMatrix(options: { dir: string }): Promise<StatusResult[]> {\n    const { dir } = options;\n\n    const matrix = await git.statusMatrix({\n      fs,\n      dir,\n    });\n\n    return matrix.map(([filepath, HEADStatus, workdirStatus, stageStatus]) => {\n      let status: StatusResult['status'] = 'unmodified';\n\n      // Determine status based on statusMatrix values\n      if (HEADStatus === 1 && workdirStatus === 2 && stageStatus === 2) {\n        status = 'modified';\n      } else if (HEADStatus === 1 && workdirStatus === 2 && stageStatus === 1) {\n        status = '*modified';\n      } else if (HEADStatus === 0 && workdirStatus === 2 && stageStatus === 2) {\n        status = 'added';\n      } else if (HEADStatus === 0 && workdirStatus === 2 && stageStatus === 0) {\n        status = '*added';\n      } else if (HEADStatus === 1 && workdirStatus === 0 && stageStatus === 0) {\n        status = 'deleted';\n      } else if (HEADStatus === 1 && workdirStatus === 0 && stageStatus === 1) {\n        status = '*deleted';\n      } else if (HEADStatus === 1 && workdirStatus === 1 && stageStatus === 1) {\n        status = 'unmodified';\n      } else if (HEADStatus === 0 && workdirStatus === 0 && stageStatus === 0) {\n        status = 'absent';\n      }\n\n      return {\n        filepath,\n        status,\n      };\n    });\n  }\n\n  /**\n   * Get the current commit hash\n   * \n   * @example\n   * ```ts\n   * const hash = await morphGit.resolveRef({\n   *   dir: './my-project',\n   *   ref: 'HEAD'\n   * });\n   * ```\n   */\n  async resolveRef(options: { dir: string; ref: string }): Promise<string> {\n    const { dir, ref } = options;\n\n    const oid = await git.resolveRef({\n      fs,\n      dir,\n      ref,\n    });\n\n    return oid;\n  }\n\n  /**\n   * Get notes (metadata, chat history, recording ID) attached to a commit\n   * \n   * @example\n   * ```ts\n   * const notes = await morphGit.getCommitMetadata({\n   *   dir: './my-project',\n   *   commitSha: 'abc123...'\n   * });\n   * \n   * if (notes) {\n   *   console.log('Metadata:', notes.metadata);\n   *   console.log('Chat history:', notes.chatHistory);\n   *   console.log('Recording ID:', notes.recordingId);\n   * }\n   * ```\n   */\n  async getCommitMetadata(options: {\n    dir: string;\n    commitSha: string;\n  }): Promise<MorphNotesSchema | null> {\n    try {\n      const note = await git.readNote({\n        fs,\n        dir: options.dir,\n        ref: 'refs/notes/morph-metadata',\n        oid: options.commitSha\n      });\n      \n      const notes: MorphNotesSchema = JSON.parse(new TextDecoder().decode(note));\n      return notes;\n    } catch (err) {\n      // No notes found for this commit\n      return null;\n    }\n  }\n}\n\n","{\n  \"name\": \"@morphllm/morphsdk\",\n  \"version\": \"0.2.194\",\n  \"description\": \"TypeScript SDK and CLI for Morph Fast Apply integration\",\n  \"type\": \"module\",\n  \"main\": \"./dist/index.cjs\",\n  \"module\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"types\": \"./dist/index.d.ts\",\n      \"import\": \"./dist/index.js\",\n      \"require\": \"./dist/index.cjs\"\n    },\n    \"./logger\": {\n      \"types\": \"./dist/logger.d.ts\",\n      \"import\": \"./dist/logger.js\",\n      \"require\": \"./dist/logger.cjs\"\n    },\n    \"./edge\": {\n      \"types\": \"./dist/edge.d.ts\",\n      \"import\": \"./dist/edge.js\",\n      \"require\": \"./dist/edge.cjs\"\n    },\n    \"./tools/warp-grep\": {\n      \"types\": \"./dist/tools/warp_grep/index.d.ts\",\n      \"import\": \"./dist/tools/warp_grep/index.js\",\n      \"require\": \"./dist/tools/warp_grep/index.cjs\"\n    },\n    \"./tools/warp-grep/openai\": {\n      \"types\": \"./dist/tools/warp_grep/openai.d.ts\",\n      \"import\": \"./dist/tools/warp_grep/openai.js\",\n      \"require\": \"./dist/tools/warp_grep/openai.cjs\"\n    },\n    \"./tools/warp-grep/anthropic\": {\n      \"types\": \"./dist/tools/warp_grep/anthropic.d.ts\",\n      \"import\": \"./dist/tools/warp_grep/anthropic.js\",\n      \"require\": \"./dist/tools/warp_grep/anthropic.cjs\"\n    },\n    \"./tools/warp-grep/vercel\": {\n      \"types\": \"./dist/tools/warp_grep/vercel.d.ts\",\n      \"import\": \"./dist/tools/warp_grep/vercel.js\",\n      \"require\": \"./dist/tools/warp_grep/vercel.cjs\"\n    },\n    \"./tools/warp-grep/client\": {\n      \"types\": \"./dist/tools/warp_grep/client.d.ts\",\n      \"import\": \"./dist/tools/warp_grep/client.js\",\n      \"require\": \"./dist/tools/warp_grep/client.cjs\"\n    },\n    \"./tools/warp-grep/gemini\": {\n      \"types\": \"./dist/tools/warp_grep/gemini.d.ts\",\n      \"import\": \"./dist/tools/warp_grep/gemini.js\",\n      \"require\": \"./dist/tools/warp_grep/gemini.cjs\"\n    },\n    \"./tools/warp-grep/harness\": {\n      \"types\": \"./dist/tools/warp_grep/harness.d.ts\",\n      \"import\": \"./dist/tools/warp_grep/harness.js\",\n      \"require\": \"./dist/tools/warp_grep/harness.cjs\"\n    },\n    \"./tracing\": {\n      \"types\": \"./dist/tracing/index.d.ts\",\n      \"import\": \"./dist/tracing/index.js\",\n      \"require\": \"./dist/tracing/index.cjs\"\n    },\n    \"./tracing/otel\": {\n      \"types\": \"./dist/tracing/otel.d.ts\",\n      \"import\": \"./dist/tracing/otel.js\",\n      \"require\": \"./dist/tracing/otel.cjs\"\n    },\n    \"./tools/fastapply\": {\n      \"types\": \"./dist/tools/fastapply/index.d.ts\",\n      \"import\": \"./dist/tools/fastapply/index.js\",\n      \"require\": \"./dist/tools/fastapply/index.cjs\"\n    },\n    \"./tools/fastapply/anthropic\": {\n      \"types\": \"./dist/tools/fastapply/anthropic.d.ts\",\n      \"import\": \"./dist/tools/fastapply/anthropic.js\",\n      \"require\": \"./dist/tools/fastapply/anthropic.cjs\"\n    },\n    \"./tools/fastapply/openai\": {\n      \"types\": \"./dist/tools/fastapply/openai.d.ts\",\n      \"import\": \"./dist/tools/fastapply/openai.js\",\n      \"require\": \"./dist/tools/fastapply/openai.cjs\"\n    },\n    \"./tools/fastapply/vercel\": {\n      \"types\": \"./dist/tools/fastapply/vercel.d.ts\",\n      \"import\": \"./dist/tools/fastapply/vercel.js\",\n      \"require\": \"./dist/tools/fastapply/vercel.cjs\"\n    },\n    \"./tools/codebase-search\": {\n      \"types\": \"./dist/tools/codebase_search/index.d.ts\",\n      \"import\": \"./dist/tools/codebase_search/index.js\",\n      \"require\": \"./dist/tools/codebase_search/index.cjs\"\n    },\n    \"./tools/codebase-search/anthropic\": {\n      \"types\": \"./dist/tools/codebase_search/anthropic.d.ts\",\n      \"import\": \"./dist/tools/codebase_search/anthropic.js\",\n      \"require\": \"./dist/tools/codebase_search/anthropic.cjs\"\n    },\n    \"./tools/codebase-search/openai\": {\n      \"types\": \"./dist/tools/codebase_search/openai.d.ts\",\n      \"import\": \"./dist/tools/codebase_search/openai.js\",\n      \"require\": \"./dist/tools/codebase_search/openai.cjs\"\n    },\n    \"./tools/codebase-search/vercel\": {\n      \"types\": \"./dist/tools/codebase_search/vercel.d.ts\",\n      \"import\": \"./dist/tools/codebase_search/vercel.js\",\n      \"require\": \"./dist/tools/codebase_search/vercel.cjs\"\n    },\n    \"./tools/git\": {\n      \"types\": \"./dist/git/index.d.ts\",\n      \"import\": \"./dist/git/index.js\",\n      \"require\": \"./dist/git/index.cjs\"\n    },\n    \"./tools/browser\": {\n      \"types\": \"./dist/tools/browser/index.d.ts\",\n      \"import\": \"./dist/tools/browser/index.js\",\n      \"require\": \"./dist/tools/browser/index.cjs\"\n    },\n    \"./tools/browser/anthropic\": {\n      \"types\": \"./dist/tools/browser/anthropic.d.ts\",\n      \"import\": \"./dist/tools/browser/anthropic.js\",\n      \"require\": \"./dist/tools/browser/anthropic.cjs\"\n    },\n    \"./tools/browser/openai\": {\n      \"types\": \"./dist/tools/browser/openai.d.ts\",\n      \"import\": \"./dist/tools/browser/openai.js\",\n      \"require\": \"./dist/tools/browser/openai.cjs\"\n    },\n    \"./tools/browser/vercel\": {\n      \"types\": \"./dist/tools/browser/vercel.d.ts\",\n      \"import\": \"./dist/tools/browser/vercel.js\",\n      \"require\": \"./dist/tools/browser/vercel.cjs\"\n    },\n    \"./tools/browser/profiles\": {\n      \"types\": \"./dist/tools/browser/profiles/index.d.ts\",\n      \"import\": \"./dist/tools/browser/profiles/index.js\",\n      \"require\": \"./dist/tools/browser/profiles/index.cjs\"\n    },\n    \"./modelrouter\": {\n      \"types\": \"./dist/modelrouter/index.d.ts\",\n      \"import\": \"./dist/modelrouter/index.js\",\n      \"require\": \"./dist/modelrouter/index.cjs\"\n    },\n    \"./tools/compact\": {\n      \"types\": \"./dist/tools/compact/index.d.ts\",\n      \"import\": \"./dist/tools/compact/index.js\",\n      \"require\": \"./dist/tools/compact/index.cjs\"\n    },\n    \"./tools/reflex\": {\n      \"types\": \"./dist/tools/reflex/index.d.ts\",\n      \"import\": \"./dist/tools/reflex/index.js\",\n      \"require\": \"./dist/tools/reflex/index.cjs\"\n    },\n    \"./tools/traces\": {\n      \"types\": \"./dist/tools/traces/index.d.ts\",\n      \"import\": \"./dist/tools/traces/index.js\",\n      \"require\": \"./dist/tools/traces/index.cjs\"\n    },\n    \"./subagents\": {\n      \"types\": \"./dist/subagents/index.d.ts\",\n      \"import\": \"./dist/subagents/index.js\",\n      \"require\": \"./dist/subagents/index.cjs\"\n    },\n    \"./subagents/vercel\": {\n      \"types\": \"./dist/subagents/vercel.d.ts\",\n      \"import\": \"./dist/subagents/vercel.js\",\n      \"require\": \"./dist/subagents/vercel.cjs\"\n    },\n    \"./subagents/anthropic\": {\n      \"types\": \"./dist/subagents/anthropic.d.ts\",\n      \"import\": \"./dist/subagents/anthropic.js\",\n      \"require\": \"./dist/subagents/anthropic.cjs\"\n    }\n  },\n  \"files\": [\n    \"dist/**/*.js\",\n    \"dist/**/*.cjs\",\n    \"dist/**/*.d.ts\",\n    \"dist/**/*.map\",\n    \"!dist/**/__tests__/**\",\n    \"!dist/**/*.test.*\"\n  ],\n  \"scripts\": {\n    \"build\": \"tsup version.ts index.ts edge.ts client.ts core/index.ts core/client.ts core/resource.ts core/error.ts tools/index.ts tools/fastapply/index.ts tools/fastapply/core.ts tools/fastapply/apply.ts tools/fastapply/types.ts tools/fastapply/prompts.ts tools/fastapply/anthropic.ts tools/fastapply/openai.ts tools/fastapply/vercel.ts tools/codebase_search/index.ts tools/codebase_search/core.ts tools/codebase_search/types.ts tools/codebase_search/prompts.ts tools/codebase_search/anthropic.ts tools/codebase_search/openai.ts tools/codebase_search/vercel.ts tools/warp_grep/index.ts tools/warp_grep/client.ts tools/warp_grep/openai.ts tools/warp_grep/anthropic.ts tools/warp_grep/vercel.ts tools/warp_grep/gemini.ts tools/warp_grep/harness.ts tools/warp_grep/agent/config.ts tools/warp_grep/agent/parser.ts tools/warp_grep/agent/runner.ts tools/warp_grep/agent/types.ts tools/warp_grep/agent/formatter.ts tools/warp_grep/providers/types.ts tools/warp_grep/providers/local.ts tools/warp_grep/providers/remote.ts tools/warp_grep/providers/code_storage_http.ts tools/warp_grep/tools/grep.ts tools/warp_grep/tools/analyse.ts tools/warp_grep/tools/read.ts tools/warp_grep/tools/finish.ts tools/warp_grep/utils/paths.ts tools/warp_grep/utils/github.ts tools/warp_grep/utils/ripgrep.ts tools/warp_grep/utils/format.ts tools/warp_grep/utils/files.ts git/index.ts git/client.ts git/config.ts git/types.ts tools/browser/index.ts tools/browser/core.ts tools/browser/types.ts tools/browser/prompts.ts tools/browser/anthropic.ts tools/browser/openai.ts tools/browser/vercel.ts tools/browser/live.ts tools/browser/errors.ts tools/browser/profiles/index.ts tools/browser/profiles/core.ts tools/browser/profiles/types.ts modelrouter/index.ts modelrouter/core.ts modelrouter/types.ts tools/compact/index.ts tools/compact/core.ts tools/compact/types.ts tools/reflex/index.ts tools/reflex/core.ts tools/reflex/types.ts tools/traces/index.ts tools/traces/core.ts tools/traces/types.ts tools/utils/resilience.ts subagents/index.ts subagents/types.ts subagents/prompts.ts subagents/vercel.ts subagents/anthropic.ts tracing/index.ts tracing/core.ts tracing/interaction.ts tracing/otel.ts tracing/types.ts --format esm,cjs --sourcemap --clean --dts --dts-resolve\",\n    \"prepare\": \"npm run build\",\n    \"typecheck\": \"tsc --noEmit\",\n    \"lint\": \"eslint .\",\n    \"test\": \"vitest run\",\n    \"test:watch\": \"vitest watch\",\n    \"test:anthropic\": \"vitest run anthropic\",\n    \"test:openai\": \"vitest run openai\",\n    \"test:vercel\": \"vitest run vercel\",\n    \"test:git\": \"vitest run git\",\n    \"test:browser\": \"vitest run browser\",\n    \"test:agent\": \"npx tsx tests/fullAgentTest.ts\",\n    \"test:integration\": \"npx tsx tests/fullIntegrationTest.ts\",\n    \"test:e2e\": \"vitest run --config vitest.e2e.config.ts\",\n    \"release:patch\": \"npm version patch && npm publish\",\n    \"release:minor\": \"npm version minor && npm publish\",\n    \"release:major\": \"npm version major && npm publish\"\n  },\n  \"keywords\": [\n    \"morph\",\n    \"fast-apply\",\n    \"cli\",\n    \"sdk\",\n    \"edit-file\"\n  ],\n  \"engines\": {\n    \"node\": \">=18\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"@opentelemetry/api\": \"^1.9.0\",\n    \"@opentelemetry/exporter-trace-otlp-http\": \"^0.203.0\",\n    \"@opentelemetry/sdk-trace-base\": \"^2.7.1\",\n    \"@traceloop/node-server-sdk\": \"^0.27.0\",\n    \"@vscode/ripgrep\": \"^1.17.0\",\n    \"ai\": \">=5.0.0\",\n    \"diff\": \"^7.0.0\",\n    \"isomorphic-git\": \"^1.25.10\",\n    \"openai\": \"^4.52.7\",\n    \"zod\": \">=3.23.0\"\n  },\n  \"devDependencies\": {\n    \"@ai-sdk/anthropic\": \"^2.0.70\",\n    \"@ai-sdk/openai\": \"^2.0.35\",\n    \"@anthropic-ai/sdk\": \"^0.30.1\",\n    \"@google/generative-ai\": \"^0.24.1\",\n    \"@types/diff\": \"^7.0.2\",\n    \"@types/node\": \"^20.14.10\",\n    \"@typescript-eslint/eslint-plugin\": \"^7.18.0\",\n    \"@typescript-eslint/parser\": \"^7.18.0\",\n    \"dotenv\": \"^16.4.5\",\n    \"eslint\": \"^8.57.0\",\n    \"shx\": \"^0.3.4\",\n    \"tsup\": \"^8.5.0\",\n    \"tsx\": \"^4.16.2\",\n    \"typescript\": \"^5.5.4\",\n    \"vitest\": \"^2.1.6\"\n  },\n  \"peerDependencies\": {\n    \"@anthropic-ai/sdk\": \">=0.25.0\",\n    \"@google/generative-ai\": \">=0.21.0\",\n    \"ai\": \">=5.0.0\",\n    \"zod\": \">=3.23.0\"\n  },\n  \"peerDependenciesMeta\": {\n    \"@anthropic-ai/sdk\": {\n      \"optional\": true\n    },\n    \"@google/generative-ai\": {\n      \"optional\": true\n    },\n    \"ai\": {\n      \"optional\": true\n    },\n    \"zod\": {\n      \"optional\": true\n    }\n  },\n  \"publishConfig\": {\n    \"access\": \"public\"\n  }\n}\n","import pkg from './package.json' with { type: 'json' };\nexport const SDK_VERSION: string = pkg.version;\n","/**\n * Resilience utilities for retry logic and timeout handling\n */\n\nimport { SDK_VERSION } from '../../version.js';\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  // Inject SDK version header (caller-provided headers can override)\n  options = { ...options, headers: { 'X-Morph-SDK-Version': SDK_VERSION, ...options.headers } };\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 * Edge-safe logger.\n *\n * This module is imported transitively by the edge entrypoint\n * (`@morphllm/morphsdk/edge`) via fastapply, modelrouter, etc.\n * Edge runtimes (Vercel Edge Functions, Cloudflare Workers, Deno Deploy)\n * run on V8 isolates — not Node.js — so Node built-ins like fs don't\n * exist. A top-level static import of fs would crash at module-load time,\n * even if createWriteStream is only called conditionally.\n *\n * Fix: we use a dynamic import() behind a runtime check. In Node the\n * import resolves and file logging works normally. In edge runtimes the\n * import rejects and we silently fall back to console-only logging.\n */\n\ntype LogLevel = 'debug' | 'info' | 'warn' | 'error';\n\ninterface WriteStream {\n  write(chunk: string): boolean;\n}\n\nclass MorphLogger {\n  private enabled: boolean;\n  private fileStream: WriteStream | null;\n  /** Resolves once the file stream is initialized (or immediately if no file logging). */\n  readonly ready: Promise<void>;\n\n  constructor() {\n    this.enabled = typeof process !== 'undefined' &&\n      (process.env.MORPH_DEBUG === '1' || !!process.env.MORPH_LOG_FILE);\n    this.fileStream = null;\n\n    const f = typeof process !== 'undefined' ? process.env.MORPH_LOG_FILE : undefined;\n    if (f) {\n      // Dynamic import — never evaluated at parse time, so edge runtimes\n      // don't blow up with \"Module 'fs' not found\".\n      this.ready = import('fs')\n        .then((fs) => {\n          this.fileStream = fs.createWriteStream(f, { flags: 'a' });\n        })\n        .catch(() => {\n          // Edge runtime — fs unavailable, silently skip file logging\n        });\n    } else {\n      this.ready = Promise.resolve();\n    }\n  }\n\n  debug(component: string, msg: string, data?: Record<string, unknown>) { this._log('debug', component, msg, data); }\n  info(component: string, msg: string, data?: Record<string, unknown>) { this._log('info', component, msg, data); }\n  warn(component: string, msg: string, data?: Record<string, unknown>) { this._log('warn', component, msg, data); }\n  error(component: string, msg: string, data?: Record<string, unknown>) { this._log('error', component, msg, data); }\n\n  enable() { this.enabled = true; }\n  get isEnabled() { return this.enabled; }\n\n  private _log(level: LogLevel, component: string, msg: string, data?: Record<string, unknown>) {\n    if (level !== 'error' && !this.enabled) return;\n    const ts = new Date().toISOString();\n    const prefix = `[${ts}] [${level.toUpperCase()}] [${component}]`;\n    console.error(data ? `${prefix} ${msg} ${JSON.stringify(data)}` : `${prefix} ${msg}`);\n    this.fileStream?.write(JSON.stringify({ ts, level, component, msg, ...(data && { data }) }) + '\\n');\n  }\n}\n\nexport const logger = new MorphLogger();\n","/**\n * Single error mapper for the SDK transport.\n *\n * Consolidates the per-tool error handling that used to live in every client\n * (compact, reflex, github, …) into one place, preserving the actionable\n * 401/429 messaging. Reuses the existing `MorphError` type so callers that\n * `instanceof MorphError` keep working.\n */\nimport { MorphError } from '../tools/utils/resilience.js';\n\ninterface ApiErrorBody {\n  error?: { message?: string; code?: string; type?: string };\n  message?: string;\n}\n\n/**\n * Turn a non-OK `Response` into a `MorphError`, extracting the API's error\n * message when present and marking 429/503 as retryable.\n */\nexport async function toMorphError(response: Response): Promise<MorphError> {\n  let message = `Morph API request failed (${response.status})`;\n  let code = 'api_error';\n\n  try {\n    const body = (await response.json()) as ApiErrorBody;\n    message = body.error?.message ?? body.message ?? message;\n    code = body.error?.code ?? body.error?.type ?? code;\n  } catch {\n    // Non-JSON body — keep the status-based default message.\n  }\n\n  if (response.status === 401) code = 'authentication_error';\n  if (response.status === 429) code = 'rate_limit_exceeded';\n\n  const retryable = response.status === 429 || response.status === 503;\n  return new MorphError(message, code, response.status, retryable);\n}\n","/**\n * MorphAPIClient — the SDK transport.\n *\n * One place owns authentication, the Morph service hosts, default headers,\n * retries, timeouts, and error mapping. Every resource (FastApply, Compact,\n * Reflex, …) holds a reference to this client and delegates HTTP to it via\n * `get`/`post`/`delete`/`request`, exactly like the OpenAI SDK.\n *\n * This module is intentionally free of tool imports and Node built-ins so it\n * stays edge-safe (it is reachable from `@morphllm/morphsdk/edge` through the\n * Compact and model-router resources).\n */\nimport { fetchWithRetry, withTimeout, MorphError, type RetryConfig } from '../tools/utils/resilience.js';\nimport { logger } from '../logger.js';\nimport { SDK_VERSION } from '../version.js';\nimport { toMorphError } from './error.js';\n\n/** The Morph services the SDK talks to. */\nconst DEFAULT_BASE_URL = 'https://api.morphllm.com';\nconst DEFAULT_REPOS_URL = 'https://repos.morphllm.com';\nconst DEFAULT_BROWSER_URL = 'https://browser.morphllm.com';\nconst DEFAULT_TIMEOUT = 60_000;\n\nconst env = (name: string): string | undefined =>\n  typeof process !== 'undefined' ? process.env?.[name] : undefined;\n\nconst stripTrailingSlash = (url: string): string => url.replace(/\\/+$/, '');\n\nexport interface MorphAPIClientOptions {\n  /** Morph API key. Resolved against `MORPH_API_KEY` at request time if omitted. */\n  apiKey?: string;\n  /** Primary API host (default `https://api.morphllm.com`). */\n  baseURL?: string;\n  /** Code-storage host for codebase search and git (default `https://repos.morphllm.com`). */\n  reposURL?: string;\n  /** Browser-automation host (default `https://browser.morphllm.com`). */\n  browserURL?: string;\n  /** Default per-request timeout in ms (default 60s). Resources may override per call. */\n  timeout?: number;\n  /** Retry policy for transient failures. */\n  retryConfig?: RetryConfig;\n  /** Enable debug logging. */\n  debug?: boolean;\n}\n\n/** Per-request options accepted by `request`/`get`/`post`/`delete`. */\nexport interface RequestOptions {\n  /** JSON body; serialized with `JSON.stringify`. */\n  body?: unknown;\n  /** Query parameters; `undefined`/`null` values are dropped. */\n  query?: Record<string, string | number | boolean | undefined | null>;\n  /** Extra headers, merged over (and able to override) the defaults. */\n  headers?: Record<string, string>;\n  /** Override the timeout for this call. */\n  timeout?: number;\n  /** Hit a different host than the default (e.g. `this._client.reposURL`). */\n  baseURL?: string;\n  /** Return the raw `Response` of a successful (2xx) request instead of parsed JSON (for streaming). */\n  stream?: boolean;\n  /**\n   * Return the raw `Response` without throwing on non-2xx and without parsing.\n   * For resources that map errors into their own taxonomy (e.g. GitHub).\n   */\n  raw?: boolean;\n  /** Caller-supplied abort signal. */\n  signal?: AbortSignal;\n}\n\nexport class MorphAPIClient {\n  /** Explicit key as provided; resolved against env at request time. */\n  apiKey?: string;\n  baseURL: string;\n  reposURL: string;\n  browserURL: string;\n  /** Explicit default timeout (ms), if set. The request default is applied lazily so\n   * resources can read an undefined value and supply their own fallback. */\n  timeout?: number;\n  retryConfig?: RetryConfig;\n  debug: boolean;\n\n  constructor(options: MorphAPIClientOptions = {}) {\n    this.apiKey = options.apiKey;\n    this.baseURL = stripTrailingSlash(options.baseURL ?? DEFAULT_BASE_URL);\n    this.reposURL = stripTrailingSlash(options.reposURL ?? env('MORPH_SEARCH_URL') ?? DEFAULT_REPOS_URL);\n    this.browserURL = stripTrailingSlash(\n      options.browserURL ?? (env('MORPH_ENVIRONMENT') === 'DEV' ? 'http://localhost:8000' : DEFAULT_BROWSER_URL),\n    );\n    this.timeout = options.timeout;\n    this.retryConfig = options.retryConfig;\n    this.debug = options.debug ?? false;\n    if (this.debug) logger.enable();\n  }\n\n  /** The key actually used for requests: explicit, else `MORPH_API_KEY`. */\n  resolveApiKey(): string | undefined {\n    return this.apiKey ?? env('MORPH_API_KEY');\n  }\n\n  /** Headers shared with tools that bring their own HTTP client (FastApply/WarpGrep via the `openai` package). */\n  defaultHeaders(): Record<string, string> {\n    return { 'X-Morph-SDK-Version': SDK_VERSION };\n  }\n\n  buildURL(path: string, baseURL?: string): string {\n    if (/^https?:\\/\\//i.test(path)) return path;\n    const base = stripTrailingSlash(baseURL ?? this.baseURL);\n    return `${base}${path.startsWith('/') ? '' : '/'}${path}`;\n  }\n\n  private buildHeaders(apiKey: string, extra?: Record<string, string>): Record<string, string> {\n    return {\n      'Content-Type': 'application/json',\n      'X-Morph-SDK-Version': SDK_VERSION,\n      Authorization: `Bearer ${apiKey}`,\n      ...extra,\n    };\n  }\n\n  private applyQuery(url: string, query?: RequestOptions['query']): string {\n    if (!query) return url;\n    const params = new URLSearchParams();\n    for (const [key, value] of Object.entries(query)) {\n      if (value !== undefined && value !== null) params.set(key, String(value));\n    }\n    const qs = params.toString();\n    return qs ? `${url}${url.includes('?') ? '&' : '?'}${qs}` : url;\n  }\n\n  async request<T>(method: string, path: string, opts: RequestOptions = {}): Promise<T> {\n    const apiKey = this.resolveApiKey();\n    if (!apiKey) {\n      throw new MorphError(\n        'Morph API key not found. Set the MORPH_API_KEY environment variable or pass apiKey in config.',\n        'missing_api_key',\n        401,\n      );\n    }\n\n    const url = this.applyQuery(this.buildURL(path, opts.baseURL), opts.query);\n    const timeout = opts.timeout ?? this.timeout ?? DEFAULT_TIMEOUT;\n\n    const init: RequestInit = {\n      method,\n      headers: this.buildHeaders(apiKey, opts.headers),\n      ...(opts.body !== undefined ? { body: JSON.stringify(opts.body) } : {}),\n      ...(opts.signal ? { signal: opts.signal } : {}),\n    };\n\n    logger.debug('MorphAPIClient', 'request', { method, url });\n\n    const response = await withTimeout(\n      fetchWithRetry(url, init, this.retryConfig ?? {}),\n      timeout,\n      `Morph request to ${url} timed out after ${timeout}ms`,\n    );\n\n    if (opts.raw) return response as unknown as T;\n    if (!response.ok) throw await toMorphError(response);\n    if (opts.stream) return response as unknown as T;\n    if (response.status === 204) return undefined as T;\n\n    const text = await response.text();\n    return (text ? JSON.parse(text) : undefined) as T;\n  }\n\n  get<T>(path: string, opts?: RequestOptions): Promise<T> {\n    return this.request<T>('GET', path, opts);\n  }\n\n  post<T>(path: string, opts?: RequestOptions): Promise<T> {\n    return this.request<T>('POST', path, opts);\n  }\n\n  delete<T>(path: string, opts?: RequestOptions): Promise<T> {\n    return this.request<T>('DELETE', path, opts);\n  }\n}\n","/**\n * Base class for every API resource (FastApply, Compact, Reflex, …).\n *\n * Mirrors the OpenAI SDK's `APIResource`: a resource holds nothing but a\n * reference to the transport (`MorphAPIClient`) and delegates all HTTP to it.\n * Sub-resources receive the same client by reference, so configuration and the\n * fetch/retry/auth machinery live in exactly one place.\n */\nimport type { MorphAPIClient } from './client.js';\n\nexport abstract class APIResource {\n  protected _client: MorphAPIClient;\n\n  constructor(client: MorphAPIClient) {\n    this._client = client;\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMA,4BAAgB;AAChB,kBAAiB;AACjB,gBAAe;;;ACRf;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,MAAQ;AAAA,EACR,QAAU;AAAA,EACV,OAAS;AAAA,EACT,SAAW;AAAA,IACT,KAAK;AAAA,MACH,OAAS;AAAA,MACT,QAAU;AAAA,MACV,SAAW;AAAA,IACb;AAAA,IACA,YAAY;AAAA,MACV,OAAS;AAAA,MACT,QAAU;AAAA,MACV,SAAW;AAAA,IACb;AAAA,IACA,UAAU;AAAA,MACR,OAAS;AAAA,MACT,QAAU;AAAA,MACV,SAAW;AAAA,IACb;AAAA,IACA,qBAAqB;AAAA,MACnB,OAAS;AAAA,MACT,QAAU;AAAA,MACV,SAAW;AAAA,IACb;AAAA,IACA,4BAA4B;AAAA,MAC1B,OAAS;AAAA,MACT,QAAU;AAAA,MACV,SAAW;AAAA,IACb;A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