{"version":3,"sources":["../../../tools/reflex/core.ts","../../../package.json","../../../version.ts","../../../tools/utils/resilience.ts","../../../logger.ts","../../../core/error.ts","../../../core/client.ts","../../../core/resource.ts"],"sourcesContent":["/**\n * Reflex: train and serve small text classifiers.\n *\n *   const morph = new MorphClient({ apiKey });\n *   const job   = await morph.reflex.jobs.create({ trainingData: rows, suffix: 'support' });\n *   const ready = await morph.reflex.jobs.waitForReady(job.id);\n *   const out   = await morph.reflex.predict({ model: ready.fineTunedModel!, text: 'refund please' });\n *\n * Mirrors the OpenAI fine-tuning shape (`reflex.jobs.create/retrieve/list/cancel/delete`)\n * plus `reflex.predict`. All HTTP goes through the shared `MorphAPIClient` transport.\n */\nimport { MorphAPIClient } from '../../core/client.js';\nimport { APIResource } from '../../core/resource.js';\nimport { MorphError } from '../utils/resilience.js';\nimport type {\n  CreateReflexJobInput,\n  DeletedReflexJob,\n  ListReflexJobsInput,\n  ReflexClassification,\n  ReflexConfig,\n  ReflexEvent,\n  ReflexJob,\n  ReflexJobList,\n  ReflexPrediction,\n  ReflexPredictClass,\n  ReflexPredictInput,\n  ReflexPredictManyInput,\n  ReflexPredictManyResult,\n  ReflexPredictResult,\n} from './types.js';\n\nconst BASE_MODEL = 'morph-reflex-v1';\n\n/** Build a transport from either a shared client or a standalone `ReflexConfig`. */\nfunction resolveClient(clientOrConfig: MorphAPIClient | ReflexConfig): MorphAPIClient {\n  if (clientOrConfig instanceof MorphAPIClient) return clientOrConfig;\n  return new MorphAPIClient({\n    apiKey: clientOrConfig.apiKey,\n    baseURL: clientOrConfig.baseUrl,\n    timeout: clientOrConfig.timeout,\n    retryConfig: clientOrConfig.retryConfig,\n    debug: clientOrConfig.debug,\n  });\n}\n\n/**\n * @deprecated Prefer the unified `MorphClient` (`new MorphClient({ apiKey }).reflex`).\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 ReflexClient extends APIResource {\n  /** Train, retrieve, and manage classifier jobs. */\n  public readonly jobs: ReflexJobsResource;\n\n  constructor(clientOrConfig: MorphAPIClient | ReflexConfig = {}) {\n    super(resolveClient(clientOrConfig));\n    this.jobs = new ReflexJobsResource(this._client);\n  }\n\n  /** Classify text against one trained model. The model must be `succeeded`. */\n  async predict(input: ReflexPredictInput): Promise<ReflexPredictResult> {\n    const completionId = input.completionId ?? crypto.randomUUID();\n    const raw = await this._client.post<RawPredict>('/v1/reflex/predict', {\n      body: { model: input.model, text: input.text },\n      headers: { 'X-Completion-Id': completionId },\n    });\n    return {\n      ...toClassification(raw),\n      inferenceTimeMs: raw.inference_time_ms,\n      prefillTokens: raw.prefill_tokens ?? 0,\n      completionId,\n    };\n  }\n\n  /**\n   * Classify text against several models in one request. They share a single\n   * prefill, so the input is tokenized once — cheaper and faster than a call per\n   * model. Each model returns its own prediction (or an `error` if it failed).\n   */\n  async predictMany(input: ReflexPredictManyInput): Promise<ReflexPredictManyResult> {\n    const completionId = input.completionId ?? crypto.randomUUID();\n    const raw = await this._client.post<RawPredictMany>('/v1/reflex/predict', {\n      body: { models: input.models, text: input.text },\n      headers: { 'X-Completion-Id': completionId },\n    });\n    return {\n      predictions: (raw.predictions ?? []).map(toPrediction),\n      inferenceTimeMs: raw.inference_time_ms,\n      prefillTokens: raw.prefill_tokens ?? 0,\n      completionId,\n    };\n  }\n}\n\nexport class ReflexJobsResource extends APIResource {\n  /** Start a training job from labeled data, a description, or unlabeled text. */\n  async create(input: CreateReflexJobInput): Promise<ReflexJob> {\n    return toReflexJob(await this._client.post<RawJob>('/v1/fine_tuning/jobs', { body: createBody(input) }));\n  }\n\n  /** Fetch a job by id. */\n  async retrieve(id: string): Promise<ReflexJob> {\n    return toReflexJob(await this._client.get<RawJob>(`/v1/fine_tuning/jobs/${encodeURIComponent(id)}`));\n  }\n\n  /** List the caller's jobs, newest first. */\n  async list(input: ListReflexJobsInput = {}): Promise<ReflexJobList> {\n    const raw = await this._client.get<RawJobList>('/v1/fine_tuning/jobs', {\n      query: { limit: input.limit, after: input.after },\n    });\n    return { data: (raw.data ?? []).map(toReflexJob), hasMore: Boolean(raw.has_more) };\n  }\n\n  /** Stop a queued or running job. */\n  async cancel(id: string): Promise<ReflexJob> {\n    return toReflexJob(await this._client.post<RawJob>(`/v1/fine_tuning/jobs/${encodeURIComponent(id)}/cancel`));\n  }\n\n  /** Delete a job and its trained model. */\n  async delete(id: string): Promise<DeletedReflexJob> {\n    const raw = await this._client.delete<{ id: string; deleted?: boolean }>(\n      `/v1/fine_tuning/jobs/${encodeURIComponent(id)}`,\n    );\n    return { id: raw.id, deleted: Boolean(raw.deleted) };\n  }\n\n  /** The training loss curve as events, plus a terminal event. */\n  async events(id: string): Promise<ReflexEvent[]> {\n    const raw = await this._client.get<{ data?: RawEvent[] }>(\n      `/v1/fine_tuning/jobs/${encodeURIComponent(id)}/events`,\n    );\n    return (raw.data ?? []).map(toReflexEvent);\n  }\n\n  /**\n   * Poll until the job reaches a terminal status and return it on success.\n   * Throws a `MorphError` if it fails, is cancelled, or exceeds `timeoutMs`.\n   */\n  async waitForReady(id: string, opts: { pollMs?: number; timeoutMs?: number } = {}): Promise<ReflexJob> {\n    const pollMs = opts.pollMs ?? 3_000;\n    const deadline = Date.now() + (opts.timeoutMs ?? 15 * 60_000);\n\n    for (;;) {\n      const job = await this.retrieve(id);\n      if (job.status === 'succeeded') return job;\n      if (job.status === 'failed' || job.status === 'cancelled') {\n        throw new MorphError(job.error?.message ?? `Reflex job ${job.status}`, `reflex_job_${job.status}`);\n      }\n      if (Date.now() >= deadline) {\n        throw new MorphError(`Reflex job ${id} did not finish in time`, 'reflex_timeout');\n      }\n      await sleep(pollMs);\n    }\n  }\n}\n\n// ---------------------------------------------------------------------------\n// Mapping (camelCase <-> snake_case) and helpers\n// ---------------------------------------------------------------------------\n\ninterface RawJob {\n  id: string;\n  model: string;\n  created_at: number;\n  finished_at: number | null;\n  fine_tuned_model: string | null;\n  status: ReflexJob['status'];\n  labels?: string[];\n  trained_examples?: number;\n  result?: { accuracy: number | null; f1_score: number | null } | null;\n  error?: { message: string } | null;\n  suffix?: string | null;\n}\ninterface RawJobList {\n  data?: RawJob[];\n  has_more?: boolean;\n}\ninterface RawPredictClass {\n  class_id: number;\n  label: string;\n  score: number;\n  selected: boolean;\n}\ninterface RawPredict {\n  model: string;\n  mode?: string;\n  classes?: RawPredictClass[];\n  inference_time_ms: number;\n  prefill_tokens?: number;\n}\ninterface RawPredictionEntry {\n  model: string;\n  mode?: string;\n  classes?: RawPredictClass[];\n  error?: { message: string } | string;\n}\ninterface RawPredictMany {\n  predictions?: RawPredictionEntry[];\n  inference_time_ms: number;\n  prefill_tokens?: number;\n}\ninterface RawEvent {\n  id: string;\n  created_at: number;\n  level: ReflexEvent['level'];\n  message: string;\n  type: ReflexEvent['type'];\n  data?: { epoch?: number; step?: number; train_loss?: number };\n}\n\nfunction createBody(input: CreateReflexJobInput): Record<string, unknown> {\n  const base: Record<string, unknown> = { model: BASE_MODEL };\n  if (input.suffix) base.suffix = input.suffix;\n\n  if ('trainingData' in input) {\n    if (input.labels) base.labels = input.labels;\n    return { ...base, training_data: input.trainingData };\n  }\n  if ('generate' in input) {\n    return {\n      ...base,\n      labels: input.labels,\n      generate: {\n        description: input.generate.description,\n        ...(input.generate.examplesPerLabel != null ? { examples_per_label: input.generate.examplesPerLabel } : {}),\n      },\n    };\n  }\n  return {\n    ...base,\n    labels: input.labels,\n    label_data: {\n      texts: input.labelData.texts,\n      ...(input.labelData.description ? { description: input.labelData.description } : {}),\n    },\n  };\n}\n\nfunction toReflexJob(raw: RawJob): ReflexJob {\n  return {\n    id: raw.id,\n    object: 'fine_tuning.job',\n    model: raw.model,\n    createdAt: raw.created_at,\n    finishedAt: raw.finished_at ?? null,\n    fineTunedModel: raw.fine_tuned_model ?? null,\n    status: raw.status,\n    labels: raw.labels ?? [],\n    trainedExamples: raw.trained_examples ?? 0,\n    result: raw.result ? { accuracy: raw.result.accuracy ?? null, f1Score: raw.result.f1_score ?? null } : null,\n    error: raw.error ? { message: raw.error.message } : null,\n    suffix: raw.suffix ?? null,\n  };\n}\n\n/** Map a raw classification envelope (`{ model, mode, classes }`) to the shared shape. */\nfunction toClassification(raw: { model: string; mode?: string; classes?: RawPredictClass[] }): ReflexClassification {\n  const classes: ReflexPredictClass[] = (raw.classes ?? []).map(c => ({\n    classId: c.class_id,\n    label: c.label,\n    score: c.score,\n    selected: c.selected,\n  }));\n  const selectedClasses = classes.filter(c => c.selected);\n  // Top selected class by score derives label/confidence.\n  const top = selectedClasses.reduce<ReflexPredictClass | null>(\n    (best, c) => (best === null || c.score > best.score ? c : best),\n    null,\n  );\n  return {\n    model: raw.model,\n    mode: raw.mode === 'multi_label' ? 'multi_label' : 'single_label',\n    classes,\n    selected: selectedClasses.map(c => c.label),\n    label: top ? top.label : null,\n    confidence: top ? top.score : null,\n  };\n}\n\n/** Map one `predictMany` entry: a classification, or an `error` if that model failed. */\nfunction toPrediction(raw: RawPredictionEntry): ReflexPrediction {\n  const error = raw.error\n    ? { message: typeof raw.error === 'string' ? raw.error : raw.error.message }\n    : null;\n  return { ...toClassification(raw), error };\n}\n\nfunction toReflexEvent(raw: RawEvent): ReflexEvent {\n  return {\n    id: raw.id,\n    createdAt: raw.created_at,\n    level: raw.level,\n    message: raw.message,\n    type: raw.type,\n    data: { epoch: raw.data?.epoch ?? 0, step: raw.data?.step ?? 0, trainLoss: raw.data?.train_loss ?? 0 },\n  };\n}\n\nfunction sleep(ms: number): Promise<void> {\n  return new Promise(resolve => setTimeout(resolve, ms));\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;AA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