{"version":3,"sources":["../src/types.ts"],"sourcesContent":["export interface CoolhandOptions {\n  apiKey: string;\n  silent?: boolean;\n  patternsFile?: string;\n  debug?: boolean;\n  dryRun?: boolean;\n  baseUrl?: string;\n  excludeApiPatterns?: string[];\n  /** @deprecated Use `baseUrl` instead. Removed in v0.4.0; shim will be removed after v1.x.x. */\n  environment?: 'local' | 'production';\n}\n\nexport interface CoolhandCallData {\n  id: number;\n  timestamp: string;\n  method: string;\n  url: string;\n  headers: Record<string, any>;\n  request_body: any;\n  response_body: any;\n  response_headers: Record<string, any> | null;\n  status_code: number | null;\n  protocol: string;\n}\n\nexport interface CoolhandStats {\n  totalRequests: number;\n  interceptedCalls: number;\n  apiEndpoint: string;\n}\n\nexport interface CoolhandRequestOptions {\n  hostname?: string;\n  host?: string;\n  port?: number;\n  path?: string;\n  method?: string;\n  headers?: Record<string, any>;\n  href?: string;\n  url?: string;\n  auth?: string;\n}\n\nexport interface CoolhandLogPayload {\n  llm_request_log: {\n    raw_request: CoolhandCallData;\n    collector?: string;\n    metadata?: Record<string, unknown>;\n  };\n}\n\nexport interface CoolhandLogResponse {\n  /**\n   * A raw integer database ID today; becomes a hashid string once\n   * Coolhand-Labs/coolhand#1096 ships (its blueprint change applies to `create`'s response too,\n   * not just `index`/`show` — see docs/log-search.md's \"IDs\" note). Widened ahead of that so this\n   * type doesn't need another breaking change when it happens.\n   */\n  id?: number | string;\n  source_api?: string | null;\n  source_api_result?: string | null;\n  llm_provider_unique_id?: string | null;\n  warnings?: string[];\n  metadata?: Record<string, unknown> | null;\n  [key: string]: unknown;\n}\n\nexport interface CoolhandClientFilePayload {\n  name: string;\n  file_type?: 'slide_deck' | 'report' | 'document';\n  description?: string;\n  file: Buffer | Blob;\n  filename: string;\n  metadata?: Record<string, unknown>;\n}\n\nexport interface CoolhandClientFileResponse {\n  id: string;\n  name: string;\n  file_type: string;\n  status: string;\n  description: string | null;\n  metadata: Record<string, unknown>;\n  created_at: string;\n}\n\nexport interface CoolhandAPIPattern {\n  id?: string;\n  name: string;\n  domains: string[];\n  paths?: string[];\n  /** Allow `paths` to match regardless of hostname (e.g. a self-hosted proxy under an\n   *  unrelated domain). Off by default — a wrong opt-in lets unrelated hosts sharing a\n   *  common path fragment (e.g. `/v1/models`) be captured and forwarded to Coolhand. */\n  allowPathMatchAcrossDomains?: boolean;\n  headers?: Record<string, string>;\n}\n\nexport interface CoolhandAPIPatterns {\n  patterns: CoolhandAPIPattern[];\n}\n\nexport interface CoolhandMatchedPattern {\n  pattern: CoolhandAPIPattern;\n  matchType: 'domain' | 'path';\n  matchValue: string;\n}\n\n// Types for LLM Request Log Feedback endpoint\nexport interface LLMRequestLogFeedback {\n  /** Either the raw integer FK or a hashid string (e.g. from a prior response's llm_request_log_id) — the server accepts both on write. */\n  llm_request_log_id?: number | string;\n  /** @deprecated Use `sentiment` instead */\n  like?: boolean;\n  sentiment?: \"like\" | \"dislike\" | \"neutral\";\n  /** What kind of creator supplied the feedback. Defaults to \"unknown\" server-side when omitted. */\n  creator_type?: \"human\" | \"agent\" | \"unknown\";\n  creator_unique_id?: string;\n  workload_hashid?: string;\n  explanation?: string;\n  revised_output?: string;\n  llm_provider_unique_id?: string;\n  original_output?: string;\n  client_unique_id?: string;\n  collector?: string;\n}\n\nexport interface LLMRequestLogFeedbackPayload {\n  llm_request_log_feedback: LLMRequestLogFeedback;\n}\n\n// JSON-RPC 2.0 response shape from the `/mcp` endpoint's `tools/call` method.\nexport interface McpToolCallResponse {\n  result?: unknown;\n  error?: { message?: string; [key: string]: unknown };\n}\n\nexport interface LLMRequestLogFeedbackResponse {\n  /** Hashid, not the raw integer FK. */\n  id: string;\n  /** Hashid, not the raw integer FK — null when this feedback isn't linked to a specific logged request. */\n  llm_request_log_id: string | null;\n  /** @deprecated Use `sentiment` instead */\n  like?: boolean;\n  sentiment?: \"like\" | \"dislike\" | \"neutral\";\n  /** What kind of creator submitted the feedback: \"human\", \"agent\", or \"unknown\". */\n  creator_type?: \"human\" | \"agent\" | \"unknown\";\n  creator_unique_id?: string;\n  /** Hashid of the workload this feedback is associated with, set server-side from workload_hashid on create.\n   *  (There is no separate workload_hashid field on responses — workload_hashid is write-only, on LLMRequestLogFeedback.) */\n  workload_id?: string | null;\n  explanation?: string;\n  revised_output?: string;\n  llm_provider_unique_id?: string;\n  original_output?: string;\n  client_unique_id?: string;\n  /** Hashid of the client that owns this feedback entry, matching every other external-facing identifier on this record. */\n  client_id?: string;\n  collector?: string;\n  coolhand_fingerprint_id?: string;\n  /** Validation issues encountered while creating this feedback record. */\n  warnings?: { message: string; timestamp: string }[];\n  /** Hashid of the `FeedbackPartial` generated when this feedback was created with sectional highlighting. */\n  created_partial_id?: string;\n  created_at: string;\n  updated_at: string;\n}\n\n// Params for GET /api/v2/llm_request_log_feedbacks (search). Close to the wire format: raw\n// Ransack predicate keys (e.g. `sentiment_eq`, `explanation_cont`) are wrapped as `q[<key>]`,\n// `s` is the Ransack sort expression, and `page`/`per` are top-level pagination params. Exact\n// supported predicates are whatever Api::V2::LlmRequestLogFeedbacksController#index accepts.\nexport interface SearchFeedbackParams {\n  /** Ransack sort expression, e.g. \"created_at desc\". */\n  s?: string;\n  /**\n   * Sentiment is stored server-side as an integer code — 0=dislike, 1=neutral, 2=like — which\n   * responses render back as the `sentiment` string enum. Ransack's `sentiment_eq` predicate\n   * takes the raw integer code, not the string label.\n   */\n  sentiment_eq?: 0 | 1 | 2;\n  explanation_cont?: string;\n  page?: number;\n  per?: number;\n  /** Any other Ransack predicate the search endpoint accepts (wrapped as q[<key>]=<value>). */\n  [ransackPredicate: string]: string | number | boolean | undefined;\n}\n\n// :summary blueprint view for a search result item — omits `original_output`/`revised_output`,\n// which can each hold up to 1GB.\nexport interface LLMRequestLogFeedbackSummary {\n  /** Hashid identifier for the feedback record (not a raw integer). */\n  id: string;\n  /** Hashid, not the raw integer FK — null when this feedback isn't linked to a specific logged request. */\n  llm_request_log_id: string | null;\n  /** @deprecated Use `sentiment` instead */\n  like?: boolean;\n  sentiment?: \"like\" | \"dislike\" | \"neutral\";\n  creator_type?: \"human\" | \"agent\" | \"unknown\";\n  creator_unique_id?: string;\n  /** Hashid of the associated workload (see {@link LLMRequestLogFeedbackResponse.workload_id}). */\n  workload_id?: string | null;\n  explanation?: string;\n  llm_provider_unique_id?: string;\n  client_unique_id?: string;\n  /** Hashid of the client that owns this feedback entry, matching every other external-facing identifier on this record. */\n  client_id?: string;\n  collector?: string;\n  coolhand_fingerprint_id?: string;\n  created_at: string;\n  updated_at: string;\n}\n\n// Shared pagination shape across paginated coolhand endpoints. Once Coolhand-Labs/coolhand#1096\n// ships, X-Total-Count/X-Page/X-Per-Page/X-Total-Pages response headers (see SearchLogsResponse)\n// become the universal delivery mechanism, present on every paginated v2 endpoint; the feedback\n// endpoint additionally keeps a legacy body envelope with this same shape (SearchFeedbackResponse\n// below), which is what searchFeedback reads. Neither endpoint sends these headers yet today.\nexport interface Pagination {\n  current_page: number;\n  per_page: number;\n  total_count: number;\n  total_pages: number;\n  has_next_page: boolean;\n  has_prev_page: boolean;\n}\n\n/** @deprecated Renamed to {@link Pagination} — kept as an alias for existing imports. */\nexport type FeedbackPagination = Pagination;\n\nexport interface SearchFeedbackResponse {\n  feedback: LLMRequestLogFeedbackSummary[];\n  pagination: Pagination;\n}\n\nexport interface LLMRequestLogFeedbackFocusRange {\n  start: number;\n  end: number;\n}\n\n// A single underlying feedback partial that was rolled up into a feedback record's aggregate\n// sentiment/explanation (e.g. one highlighted span of a longer response).\nexport interface LLMRequestLogFeedbackPartial {\n  id: string;\n  llm_request_log_feedback_id: string;\n  /** Hashid of the client that owns the parent feedback record (matches {@link LLMRequestLogFeedbackResponse.client_id}). */\n  client_id: string;\n  focus_section?: string | null;\n  focus_range?: LLMRequestLogFeedbackFocusRange | null;\n  sentiment?: \"like\" | \"dislike\" | \"neutral\" | null;\n  /** @deprecated Use `sentiment` instead */\n  like?: boolean | null;\n  explanation?: string | null;\n  creator_unique_id?: string | null;\n  coolhand_fingerprint_id?: string | null;\n  created_at: string;\n  updated_at: string;\n}\n\n// :with_partials blueprint view returned by GET /api/v2/llm_request_log_feedbacks/{id} — the full\n// record, including original_output/revised_output plus the underlying feedback_partials.\nexport interface LLMRequestLogFeedbackDetail extends LLMRequestLogFeedbackResponse {\n  feedback_partials?: LLMRequestLogFeedbackPartial[];\n}\n\n// Options for GET /api/v2/llm_request_logs/{id} (getLogContent). `searchQuery` is mutually\n// exclusive with `section`/`maxChars` on the server — it returns matching snippets instead of\n// raw content — so this is modeled as a discriminated union rather than one interface with all\n// four fields optional, enforcing the exclusivity at compile time instead of just documenting it.\nexport interface GetLogContentSliceOptions {\n  /**\n   * Which part of each content field to return (default: `\"full\"`). Only takes effect together\n   * with `maxChars` — without it, the server returns the entire field regardless of `section`\n   * (and sets neither `truncated` nor `total_chars`), which is the opposite of what a caller\n   * reaching for `\"end\"`/`\"beginning\"` on a huge log is usually trying to avoid.\n   */\n  section?: 'full' | 'beginning' | 'end';\n  /** Max characters per content field — slices from the start, or the requested `section`. */\n  maxChars?: number;\n  searchQuery?: undefined;\n  /** Include `thinking_response` in the result (default: false). */\n  includeThinking?: boolean;\n}\n\nexport interface GetLogContentSearchOptions {\n  section?: undefined;\n  maxChars?: undefined;\n  /** Text to search for; returns up to 5 matching snippets per field with surrounding context. */\n  searchQuery: string;\n  /** Include `thinking_response` in the result (default: false). */\n  includeThinking?: boolean;\n}\n\nexport type GetLogContentOptions = GetLogContentSliceOptions | GetLogContentSearchOptions;\n\nexport interface LlmRequestLogContentFields {\n  system_prompt: string | null;\n  user_prompt: string | null;\n  output: string | null;\n}\n\nexport interface LlmRequestLogContentBase {\n  /** Hashid. */\n  id: string;\n  url: string;\n  model: string | null;\n  source_api: string | null;\n  /** Hashid, null when this log isn't matched to a template. */\n  template_id: string | null;\n  template_name: string | null;\n  input_tokens: number | null;\n  output_tokens: number | null;\n  latency_ms: number | null;\n  created_at: string;\n  /**\n   * Only present when `includeThinking` was set; null when the log has no thinking response.\n   * An array of thinking blocks (the backend stores/returns this as `jsonb`, not a single string).\n   */\n  thinking_response?: string[] | null;\n}\n\n// Returned when getLogContent was called without `searchQuery` — the (optionally sliced)\n// content fields.\nexport interface LlmRequestLogContentFull extends LlmRequestLogContentBase, LlmRequestLogContentFields {\n  /** Set when `section`/`maxChars` produced a partial result. */\n  truncated?: boolean;\n  /** Full length of each field, present alongside `truncated`. */\n  total_chars?: Record<keyof LlmRequestLogContentFields, number>;\n}\n\n// Returned when getLogContent was called with `searchQuery` — snippet matches instead of raw content.\nexport interface LlmRequestLogContentSearchResult extends LlmRequestLogContentBase {\n  search_query: string;\n  matches: Record<keyof LlmRequestLogContentFields, string[]>;\n}\n\nexport type LlmRequestLogContent = LlmRequestLogContentFull | LlmRequestLogContentSearchResult;\n\n// Params for GET /api/v2/llm_request_logs (searchLogs). `templateId` through `includePrompts`\n// are dedicated named filters rather than raw Ransack `q[...]` predicates — several (workload_id,\n// the *Contains filters) need joins/hashid-decoding/ILIKE that don't fit the Ransack allowlist.\n// They're applied on top of the endpoint's existing Ransack-backed search/sort, not in place of\n// it — `sort` below reaches that directly (as `q[s]`).\nexport interface SearchLogsParams {\n  /** Template hashid. */\n  templateId?: string;\n  /** Workload hashid — matches all templates in that workload. */\n  workloadId?: string;\n  /** Case-insensitive substring match against the system prompt. */\n  systemPromptContains?: string;\n  /** Case-insensitive substring match against the user prompt. */\n  userPromptContains?: string;\n  model?: string;\n  sourceApi?: string;\n  sourceApiResult?: string;\n  /** Only return logs with no assigned template. */\n  unmatchedOnly?: boolean;\n  /** Limit to logs created in the last N days. Unrestricted when omitted — there's no implicit default. */\n  daysBack?: number;\n  /** Include `system_prompt`/`user_prompt` (truncated to 500 chars) on each result. */\n  includePrompts?: boolean;\n  /** Ransack sort expression, e.g. `\"created_at desc\"` — sent as `q[s]`. The endpoint defaults to\n   *  newest-first (`id desc`) when omitted, so pagination stays deterministic. */\n  sort?: string;\n  /** Page number. */\n  page?: number;\n  /** Page size (default 25, max 100 — enforced server-side; `per_page` is also accepted on the wire but this SDK only sends `per`). */\n  per?: number;\n  /** Ask the backend to compute exact `total_count`/`total_pages` (via `X-Total-Count`/\n   *  `X-Total-Pages` response headers) instead of the client-side lower-bound estimate. Costs a\n   *  `COUNT(*)` on the backend, so it's opt-in and defaults to off — leave it unset for\n   *  high-frequency polling. No effect until Coolhand-Labs/coolhand#1096 ships. */\n  includeTotal?: boolean;\n}\n\n// Blueprint fields for a log returned by searchLogs — system_prompt/user_prompt only present\n// when `includePrompts` was set.\nexport interface LlmRequestLogSummary {\n  /** Hashid. */\n  id: string;\n  collector: string | null;\n  source_api: string | null;\n  source_api_result: string | null;\n  model: string | null;\n  /** Hashid, null when this log isn't matched to a template. */\n  template_id: string | null;\n  template_name: string | null;\n  input_tokens: number | null;\n  output_tokens: number | null;\n  latency_ms: number | null;\n  created_at: string;\n  updated_at: string;\n  system_prompt?: string | null;\n  user_prompt?: string | null;\n}\n\n// searchLogs' backing endpoint renders a bare array of matches on the wire (unlike\n// searchFeedback's { feedback:, pagination: } body) and, once Coolhand-Labs/coolhand#1096 ships,\n// exposes pagination via response headers instead — LoggingService#searchLogs reads those headers\n// when present and synthesizes this same Pagination shape client-side (same field names, shape,\n// and semantics as searchFeedback — both back onto will_paginate server-side), falling back to\n// values derived from the result/request until then (see docs/log-search.md).\nexport interface SearchLogsResponse {\n  logs: LlmRequestLogSummary[];\n  pagination: Pagination;\n}"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}