getpatter 0.6.4 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -909,6 +909,9 @@ interface CallMetrics {
909
909
  readonly stt_model?: string;
910
910
  readonly tts_model?: string;
911
911
  readonly llm_model?: string;
912
+ /** Terminal error code when the call ended abnormally (a lowercased ErrorCode
913
+ * value or "other"); empty/absent for a clean call. Never the message. */
914
+ readonly error_code?: string;
912
915
  }
913
916
  /** Programmatic control surface for a live call (transfer, hangup, DTMF). */
914
917
  interface CallControl {
@@ -949,6 +952,7 @@ declare class CallMetricsAccumulator {
949
952
  readonly ttsModel: string;
950
953
  readonly realtimeModel: string;
951
954
  private readonly _pricing;
955
+ private _errorCode;
952
956
  private readonly _callStart;
953
957
  private readonly _turns;
954
958
  private _turnStart;
@@ -1259,6 +1263,12 @@ declare class CallMetricsAccumulator {
1259
1263
  recordLlmUsage(provider: string, model: string, inputTokens: number, outputTokens: number, cacheReadTokens?: number, cacheWriteTokens?: number): void;
1260
1264
  /** Finalize the call: flush any in-flight turn, compute aggregates, and return `CallMetrics`. */
1261
1265
  endCall(): CallMetrics;
1266
+ /**
1267
+ * Record the call's terminal error as a coarse, anonymous code. Stores the
1268
+ * PatterError `.code` lowercased; maps common timeout/connection errors; falls
1269
+ * back to "other". Never stores the message. Last write wins.
1270
+ */
1271
+ recordError(err: unknown): void;
1262
1272
  /** Return the cost breakdown for the call so far without ending it. */
1263
1273
  getCostSoFar(): CostBreakdown;
1264
1274
  /**
@@ -2254,6 +2264,29 @@ interface LLMChunk {
2254
2264
  */
2255
2265
  interface LLMStreamOptions {
2256
2266
  signal?: AbortSignal;
2267
+ /**
2268
+ * Stable per-call id (the same value the stream handler builds into
2269
+ * ``callCtx.call_id``). Threaded through purely so session-aware providers
2270
+ * — currently {@link OpenAICompatibleLLMProvider} and its Hermes / OpenClaw
2271
+ * presets — can emit the OpenAI ``user`` field as ``patter-call-<callId>``,
2272
+ * giving the upstream agent runtime one durable session per phone call.
2273
+ *
2274
+ * Additive and optional: every existing provider reads only ``signal`` and
2275
+ * is unaffected. When unset (or when a provider has no session-continuity
2276
+ * config) no ``user`` field is sent — fully backward compatible.
2277
+ */
2278
+ callId?: string;
2279
+ /**
2280
+ * Caller / callee for this turn (the same values the stream handler builds
2281
+ * into ``callCtx.caller`` / ``callCtx.callee``). Threaded purely so a
2282
+ * session-aware provider with a ``sessionKeyFactory`` can derive a per-caller
2283
+ * memory scope from the NON-REVERSIBLE caller hash. Additive and optional:
2284
+ * providers that read only ``signal`` / ``callId`` ignore them, and the raw
2285
+ * ``caller`` is never logged. Mirrors the Python loop threading
2286
+ * ``caller`` / ``callee`` into the provider's ``stream``.
2287
+ */
2288
+ caller?: string;
2289
+ callee?: string;
2257
2290
  }
2258
2291
  interface LLMProvider {
2259
2292
  stream(messages: Array<Record<string, unknown>>, tools?: Array<Record<string, unknown>> | null, opts?: LLMStreamOptions): AsyncGenerator<LLMChunk, void, unknown>;
@@ -2807,6 +2840,18 @@ interface LocalOptions {
2807
2840
  * used via ``phone.agent({ engine: new OpenAIRealtime({ apiKey }) })``.
2808
2841
  */
2809
2842
  readonly openaiKey?: string;
2843
+ /**
2844
+ * Anonymous usage telemetry (opt-out, **on by default**). Lets the Patter
2845
+ * maintainers see coarse, anonymous usage (engines/providers/carriers, OS,
2846
+ * SDK version) — never PII or call content. Fire-and-forget and fail-safe.
2847
+ *
2848
+ * - omitted / ``true``: enabled (unless disabled by ``PATTER_TELEMETRY_DISABLED=1``,
2849
+ * ``DO_NOT_TRACK=1``, or a CI/test environment).
2850
+ * - ``false``: opt out in code.
2851
+ *
2852
+ * Inspect-without-send with ``PATTER_TELEMETRY_DEBUG=1``. See the telemetry docs.
2853
+ */
2854
+ readonly telemetry?: boolean;
2810
2855
  }
2811
2856
  /** Internal shape of a guardrail (matches `Guardrail` class from `public-api.ts`). */
2812
2857
  interface Guardrail {
@@ -2924,6 +2969,28 @@ interface BackgroundAudioPlayer$1 {
2924
2969
  * (see ``Patter.agent()`` for the resolution).
2925
2970
  * 3. Otherwise, the AgentOptions default is used.
2926
2971
  */
2972
+ /**
2973
+ * Per-call context handed to a ``sessionKeyFactory`` (see
2974
+ * {@link OpenAICompatibleLLMOptions.sessionKeyFactory}).
2975
+ *
2976
+ * A session-aware LLM provider (e.g. the Hermes preset) can derive its
2977
+ * memory-scope header value per call from this — most usefully from
2978
+ * {@link SessionContext.callerHash}, a stable non-reversible hash of the
2979
+ * caller, so one phone number maps to one durable memory namespace across calls
2980
+ * WITHOUT the raw number ever being emitted or logged.
2981
+ *
2982
+ * All fields are optional: ``callId`` / ``caller`` / ``callee`` are present when
2983
+ * the call provides them; ``callerHash`` is {@link hashCaller} of ``caller``
2984
+ * (``undefined`` when there is no caller). The raw ``caller`` is carried here
2985
+ * only so a factory CAN re-derive its own scope — it must never be put on the
2986
+ * wire or logged beyond what already exists. Mirrors Python ``SessionContext``.
2987
+ */
2988
+ interface SessionContext {
2989
+ readonly callId?: string;
2990
+ readonly caller?: string;
2991
+ readonly callee?: string;
2992
+ readonly callerHash?: string;
2993
+ }
2927
2994
  /** Configuration for a local-mode voice AI agent (passed to `phone.agent({...})`). */
2928
2995
  interface AgentOptions {
2929
2996
  readonly systemPrompt: string;
@@ -2947,6 +3014,38 @@ interface AgentOptions {
2947
3014
  */
2948
3015
  readonly language?: string;
2949
3016
  readonly firstMessage?: string;
3017
+ /**
3018
+ * Opt-in spoken fallback for pipeline mode when the per-turn LLM stream
3019
+ * throws (gateway-down / 120 s timeout) BEFORE any assistant text was
3020
+ * spoken. Agent-runtime providers (Hermes / OpenClaw) run tools+memory
3021
+ * internally so a turn can take 30-90 s; on failure the caller currently
3022
+ * hears SILENCE then a silent turn-end. When set to a non-empty string,
3023
+ * the SDK synthesizes and speaks this line through the normal TTS turn
3024
+ * lifecycle (subject to barge-in). ``undefined`` (default) preserves
3025
+ * today's behaviour: nothing is spoken on LLM error. Pipeline mode only.
3026
+ * Mirrors Python ``llm_error_message`` on ``Patter.agent()`` / ``Agent``.
3027
+ */
3028
+ readonly llmErrorMessage?: string;
3029
+ /**
3030
+ * Opt-in short filler spoken when an LLM turn is SLOW (e.g. an agent runtime
3031
+ * running tools / memory) and no audio has reached the carrier yet — DISTINCT
3032
+ * from ``llmErrorMessage`` (which fires on an ERROR; this fires on SLOWNESS).
3033
+ * When set to a non-empty string and the turn has produced NO audio after
3034
+ * ``longTurnMessageAfterS`` seconds, the SDK synthesizes this line ONCE
3035
+ * through the normal TTS turn lifecycle (subject to barge-in) to fill the
3036
+ * gap. It never fires once real audio has started this turn, and never
3037
+ * double-speaks. ``undefined`` (default) keeps today's behaviour: nothing is
3038
+ * spoken while a slow turn runs. Pipeline mode only. Mirrors Python
3039
+ * ``long_turn_message`` on ``Patter.agent()`` / ``Agent``.
3040
+ */
3041
+ readonly longTurnMessage?: string;
3042
+ /**
3043
+ * Seconds to wait after the turn begins speaking before the
3044
+ * ``longTurnMessage`` filler fires (only consulted when ``longTurnMessage``
3045
+ * is set and no audio has reached the carrier yet). Default ``4.0``. Mirrors
3046
+ * Python ``long_turn_message_after_s``.
3047
+ */
3048
+ readonly longTurnMessageAfterS?: number;
2950
3049
  /** Tool definitions — ``Tool`` class instances from ``getpatter``. */
2951
3050
  readonly tools?: ReadonlyArray<Tool>;
2952
3051
  /**
@@ -3866,6 +3965,14 @@ declare class Patter {
3866
3965
  * ``Cannot use both tunnel: true and webhookUrl``.
3867
3966
  */
3868
3967
  private tunnelOwnsWebhookUrl;
3968
+ /**
3969
+ * Anonymous usage telemetry (opt-out, default ON). Separate from
3970
+ * ``./observability`` (user-facing OTel). Fire-and-forget and fail-safe — it
3971
+ * can never block or break a call. See ``./telemetry``.
3972
+ */
3973
+ private readonly telemetry;
3974
+ private readonly telemetrySeenEngines;
3975
+ private readonly telemetrySeenAgentShapes;
3869
3976
  /**
3870
3977
  * Pre-rendered first-message TTS audio per outbound call_id. Populated
3871
3978
  * by :meth:`call` when ``agent.prewarmFirstMessage`` is true; consumed
@@ -4940,6 +5047,7 @@ declare class PatterTool {
4940
5047
  private readonly maxDurationSec;
4941
5048
  private readonly recording;
4942
5049
  private started;
5050
+ private hermesTelemetryEmitted;
4943
5051
  /** Cached in-progress (or completed) start promise so concurrent execute()
4944
5052
  * callers all await the same boot sequence instead of each racing into
4945
5053
  * phone.serve(). Reset to null on failure so callers can retry after a
@@ -6973,7 +7081,7 @@ interface OpenAILLMOptions {
6973
7081
  * const llm = new openai.LLM({ apiKey: "sk-...", model: "gpt-4o-mini", temperature: 0.4 });
6974
7082
  * ```
6975
7083
  */
6976
- declare class LLM$4 extends OpenAILLMProvider {
7084
+ declare class LLM$8 extends OpenAILLMProvider {
6977
7085
  static readonly providerKey = "openai";
6978
7086
  constructor(opts?: OpenAILLMOptions);
6979
7087
  }
@@ -7084,7 +7192,7 @@ interface AnthropicLLMOptions {
7084
7192
  * const llm = new anthropic.LLM({ promptCaching: false }); // opt out of caching
7085
7193
  * ```
7086
7194
  */
7087
- declare class LLM$3 extends AnthropicLLMProvider {
7195
+ declare class LLM$7 extends AnthropicLLMProvider {
7088
7196
  static readonly providerKey = "anthropic";
7089
7197
  constructor(opts?: AnthropicLLMOptions);
7090
7198
  }
@@ -7192,7 +7300,7 @@ interface GroqLLMOptions {
7192
7300
  * const llm = new groq.LLM({ apiKey: "gsk_...", model: "llama-3.3-70b-versatile" });
7193
7301
  * ```
7194
7302
  */
7195
- declare class LLM$2 extends GroqLLMProvider {
7303
+ declare class LLM$6 extends GroqLLMProvider {
7196
7304
  static readonly providerKey = "groq";
7197
7305
  constructor(opts?: GroqLLMOptions);
7198
7306
  }
@@ -7337,7 +7445,7 @@ interface CerebrasLLMOptions {
7337
7445
  * const llm = new cerebras.LLM({ apiKey: "csk-...", model: "llama3.1-8b" });
7338
7446
  * ```
7339
7447
  */
7340
- declare class LLM$1 extends CerebrasLLMProvider {
7448
+ declare class LLM$5 extends CerebrasLLMProvider {
7341
7449
  static readonly providerKey = "cerebras";
7342
7450
  constructor(opts?: CerebrasLLMOptions);
7343
7451
  }
@@ -7419,11 +7527,491 @@ interface GoogleLLMOptions {
7419
7527
  * const llm = new google.LLM({ apiKey: "AIza...", model: "gemini-2.5-flash" });
7420
7528
  * ```
7421
7529
  */
7422
- declare class LLM extends GoogleLLMProvider {
7530
+ declare class LLM$4 extends GoogleLLMProvider {
7423
7531
  static readonly providerKey = "google";
7424
7532
  constructor(opts?: GoogleLLMOptions);
7425
7533
  }
7426
7534
 
7535
+ /**
7536
+ * Generic OpenAI-compatible LLM provider for Patter's pipeline mode.
7537
+ *
7538
+ * Drives *any* OpenAI-compatible ``/chat/completions`` endpoint — an agent
7539
+ * runtime (Hermes, OpenClaw) or a local inference gateway (Ollama, vLLM,
7540
+ * LM Studio). Patter owns the carrier + STT + turn-taking + TTS; this
7541
+ * provider turns each conversation turn into a single
7542
+ * ``POST {baseUrl}/chat/completions`` request and speaks the response.
7543
+ *
7544
+ * PARITY NOTE (internal divergence, allowed by ``sdk-parity.md``): on the
7545
+ * Python side this provider subclasses ``OpenAILLMProvider`` and merely swaps
7546
+ * the ``AsyncOpenAI`` client (passing ``timeout=`` / ``base_url=``). The TS
7547
+ * base ``OpenAILLMProvider`` is a raw-``fetch`` class with a HARDCODED 30 s
7548
+ * timeout and ``baseUrl`` exposed as a ``protected get`` rather than a
7549
+ * constructor field, so the "swap the client" trick is impossible here.
7550
+ * Instead this is a STANDALONE ``implements LLMProvider`` class (same shape as
7551
+ * {@link GroqLLMProvider} / {@link CerebrasLLMProvider}) that owns its own
7552
+ * configurable timeout and reuses {@link parseOpenAISseStream}. Observably
7553
+ * identical to Python (same 60 s / 120 s ceilings, same ``user`` field, same
7554
+ * headers); only the timeout *mechanism* differs.
7555
+ *
7556
+ * Two additions over the base OpenAI provider:
7557
+ *
7558
+ * - **Long timeout.** Agent runtimes execute tools / memory / skills before
7559
+ * replying, so a turn can take 30-90 s. The default is 60 s here (the
7560
+ * presets raise it to 120 s), REPLACING the base provider's hardcoded 30 s.
7561
+ * - **Session continuity.** Three independent, opt-in signals — each gated on
7562
+ * its own config, none coupled to another:
7563
+ * - ``sessionUserPrefix`` → emits the OpenAI ``user`` field as
7564
+ * ``` `${sessionUserPrefix}${callId}` ```. Used by runtimes that derive
7565
+ * a session from ``user`` (e.g. OpenClaw's gateway).
7566
+ * - ``sessionIdHeader`` (+ optional ``sessionIdPrefix``) → emits a per-call
7567
+ * header carrying ``` `${sessionIdPrefix}${callId}` ``` for per-call
7568
+ * session / transcript continuity on stateless runtimes that key off
7569
+ * headers (e.g. Hermes' ``X-Hermes-Session-Id``).
7570
+ * - ``sessionKeyHeader`` (+ ``sessionKey``) → emits a STATIC header for
7571
+ * long-term memory scoping (e.g. Hermes' ``X-Hermes-Session-Key``); the
7572
+ * value is the raw ``sessionKey``, never interpolated with the call id.
7573
+ * All three are OFF by default — fully backward compatible. ``sessionKey`` is
7574
+ * a credential-grade memory scope and is NEVER logged.
7575
+ *
7576
+ * Keyless gateways (Ollama / vLLM / LM Studio accept no key) are supported:
7577
+ * the ``Authorization`` header is simply omitted from the request (sending a
7578
+ * ``Bearer EMPTY`` placeholder breaks some gateways).
7579
+ */
7580
+
7581
+ /**
7582
+ * Stable, non-reversible 16-char hash of a caller for session scoping.
7583
+ *
7584
+ * Used to derive a per-caller memory namespace (e.g. an agent runtime's session
7585
+ * key) WITHOUT ever exposing the raw phone number — the call site keys cross-
7586
+ * call memory off the hash, never the number itself. Returns the first 16 hex
7587
+ * chars of the SHA-256 digest of the UTF-8 ``caller`` string, or ``undefined``
7588
+ * when ``caller`` is undefined / empty. The 16-char (64-bit) truncation is
7589
+ * plenty for namespacing while keeping the emitted header value compact; it is
7590
+ * NOT a security primitive (a phone number has too little entropy to make the
7591
+ * digest a secret) — its only job is to keep the raw number off the wire / out
7592
+ * of logs. Mirrors Python ``hash_caller``.
7593
+ */
7594
+ declare function hashCaller(caller?: string): string | undefined;
7595
+ /** Constructor options for {@link OpenAICompatibleLLMProvider}. */
7596
+ interface OpenAICompatibleLLMOptions {
7597
+ /**
7598
+ * Bearer token. If omitted and ``apiKeyEnv`` is given, read from that
7599
+ * environment variable. May resolve to undefined for keyless local
7600
+ * gateways — the ``Authorization`` header is then omitted entirely.
7601
+ */
7602
+ apiKey?: string;
7603
+ /**
7604
+ * Environment variable to read the bearer from when ``apiKey`` is not given
7605
+ * (e.g. ``"OPENCLAW_API_KEY"``).
7606
+ */
7607
+ apiKeyEnv?: string;
7608
+ /**
7609
+ * OpenAI-compatible base URL ending in ``/v1`` — the whole point of this
7610
+ * provider, so it is **required**. Operator-controlled config, never derived
7611
+ * from caller / transcript input.
7612
+ */
7613
+ baseUrl: string;
7614
+ /** Model / agent target — **required**. */
7615
+ model: string;
7616
+ /**
7617
+ * Per-request timeout in **seconds**. Default ``60`` (the base OpenAI
7618
+ * provider hardcodes 30 s — raised here because agent runtimes run tools
7619
+ * before replying). Converted to ``AbortSignal.timeout(timeout * 1000)``.
7620
+ */
7621
+ timeout?: number;
7622
+ /**
7623
+ * Extra headers merged into the request *after* the ``User-Agent`` so the
7624
+ * SDK attribution is not silently clobbered (a caller can still override
7625
+ * ``User-Agent`` explicitly).
7626
+ */
7627
+ extraHeaders?: Record<string, string>;
7628
+ /**
7629
+ * When set, emits the OpenAI ``user`` field as
7630
+ * ``` `${sessionUserPrefix}${callId}` ``` for per-call session continuity.
7631
+ * ``undefined`` (default) means no ``user`` field is sent. Independent of the
7632
+ * session headers below.
7633
+ */
7634
+ sessionUserPrefix?: string;
7635
+ /**
7636
+ * Optional header NAME carrying a per-call session id, e.g.
7637
+ * ``"X-Hermes-Session-Id"`` or ``"x-openclaw-session-key"``. When set AND a
7638
+ * ``callId`` is available, the header VALUE is
7639
+ * ``` `${sessionIdPrefix}${callId}` ```. ``undefined`` (default) means off.
7640
+ */
7641
+ sessionIdHeader?: string;
7642
+ /**
7643
+ * Prefix for the session-id header VALUE. Defaults to ``""`` (raw call id).
7644
+ * Only meaningful when ``sessionIdHeader`` is set.
7645
+ */
7646
+ sessionIdPrefix?: string;
7647
+ /**
7648
+ * Optional STATIC header NAME for long-term memory scoping, e.g.
7649
+ * ``"X-Hermes-Session-Key"``. Emitted with the raw ``sessionKey`` value (no
7650
+ * call-id interpolation) only when BOTH ``sessionKeyHeader`` and
7651
+ * ``sessionKey`` are set. ``undefined`` (default) means off.
7652
+ */
7653
+ sessionKeyHeader?: string;
7654
+ /**
7655
+ * Static value emitted in ``sessionKeyHeader``. Credential-grade memory
7656
+ * scope — NEVER logged. ``undefined`` (default) means the header is omitted.
7657
+ */
7658
+ sessionKey?: string;
7659
+ /**
7660
+ * Optional callback that derives the ``sessionKeyHeader`` VALUE per call from
7661
+ * a {@link SessionContext} (carrying ``callId`` / ``caller`` / ``callee`` /
7662
+ * ``callerHash``). When set it takes PRECEDENCE over the static ``sessionKey``:
7663
+ * at request-build time the factory is called and its return value is emitted
7664
+ * in ``sessionKeyHeader``. A falsy return (``undefined`` / ``''``) omits the
7665
+ * header for that call. The static ``sessionKey`` remains the simple fallback
7666
+ * used when no factory is configured. The returned value is a credential-grade
7667
+ * memory scope and is NEVER logged. Mirrors Python ``session_key_factory``.
7668
+ */
7669
+ sessionKeyFactory?: (ctx: SessionContext) => string | undefined;
7670
+ /**
7671
+ * Convenience selector for a built-in per-call key derivation (requires
7672
+ * ``sessionKeyHeader``). Set to ``'caller_hash'`` to derive the session key
7673
+ * per call as ``` `patter-caller-${ctx.callerHash}` ``` (a stable,
7674
+ * non-reversible hash of the caller — never the raw number), enabling
7675
+ * per-caller cross-call memory on any runtime that scopes memory by header.
7676
+ * ``undefined`` (default) uses the static ``sessionKey`` path. Ignored when
7677
+ * ``sessionKeyFactory`` is given explicitly. Same semantics as the Hermes
7678
+ * preset's selector; mirrors Python ``session_key_from``.
7679
+ */
7680
+ sessionKeyFrom?: 'caller_hash';
7681
+ /** Sampling temperature [0, 2]. */
7682
+ temperature?: number;
7683
+ /** Max tokens in the assistant response (sent as ``max_completion_tokens``). */
7684
+ maxTokens?: number;
7685
+ /** OpenAI-style ``response_format`` for JSON mode / structured outputs. */
7686
+ responseFormat?: Record<string, unknown>;
7687
+ /** Whether to allow parallel tool calls. */
7688
+ parallelToolCalls?: boolean;
7689
+ /** ``"auto" | "none" | "required"`` or a specific tool object. */
7690
+ toolChoice?: string | Record<string, unknown>;
7691
+ /** Sampling seed for reproducible outputs. */
7692
+ seed?: number;
7693
+ /** Nucleus sampling cutoff in [0, 1]. */
7694
+ topP?: number;
7695
+ /** Penalty in [-2, 2] applied to repeated tokens. */
7696
+ frequencyPenalty?: number;
7697
+ /** Penalty in [-2, 2] applied to seen tokens. */
7698
+ presencePenalty?: number;
7699
+ /** Stop sequence(s). */
7700
+ stop?: string | string[];
7701
+ }
7702
+ /**
7703
+ * LLM provider for any OpenAI-compatible ``/chat/completions`` endpoint.
7704
+ *
7705
+ * Streams in the same ``{ type: "text" | "tool_call" | "usage" }`` chunk
7706
+ * format as the base OpenAI provider via the shared {@link parseOpenAISseStream}.
7707
+ */
7708
+ declare class OpenAICompatibleLLMProvider implements LLMProvider {
7709
+ /**
7710
+ * Stable pricing/dashboard key — read by stream-handler/metrics. Typed as
7711
+ * ``string`` (not the narrowed literal) so the Hermes / OpenClaw presets can
7712
+ * override it with their own key while still extending this class.
7713
+ */
7714
+ static readonly providerKey: string;
7715
+ /** Resolved bearer; undefined for keyless gateways. */
7716
+ private readonly apiKey?;
7717
+ readonly model: string;
7718
+ private readonly baseUrl;
7719
+ private readonly timeoutMs;
7720
+ private readonly extraHeaders?;
7721
+ private readonly sessionUserPrefix?;
7722
+ private readonly sessionIdHeader?;
7723
+ private readonly sessionIdPrefix?;
7724
+ private readonly sessionKeyHeader?;
7725
+ private readonly sessionKey?;
7726
+ private readonly sessionKeyFactory?;
7727
+ private readonly temperature?;
7728
+ private readonly maxTokens?;
7729
+ private readonly responseFormat?;
7730
+ private readonly parallelToolCalls?;
7731
+ private readonly toolChoice?;
7732
+ private readonly seed?;
7733
+ private readonly topP?;
7734
+ private readonly frequencyPenalty?;
7735
+ private readonly presencePenalty?;
7736
+ private readonly stop?;
7737
+ constructor(options: OpenAICompatibleLLMOptions);
7738
+ /**
7739
+ * Assemble the request headers. ``User-Agent`` is set first so any
7740
+ * ``extraHeaders`` (and the per-call session headers) layer on top without
7741
+ * silently dropping the SDK attribution, and the ``Authorization`` header is
7742
+ * only added when a key is present (keyless gateways omit it).
7743
+ *
7744
+ * The two session headers are emitted INDEPENDENTLY, each gated on its own
7745
+ * config (decoupled from ``sessionUserPrefix`` and from each other):
7746
+ * - ``sessionIdHeader`` (+ ``callId``) → ``` `${sessionIdPrefix}${callId}` ```
7747
+ * - ``sessionKeyHeader`` (+ ``sessionKey``) → the static ``sessionKey`` value.
7748
+ * ``sessionKey`` is a credential-grade memory scope and is never logged.
7749
+ */
7750
+ private buildHeaders;
7751
+ /**
7752
+ * Resolve the ``sessionKeyHeader`` VALUE for this call. When a
7753
+ * ``sessionKeyFactory`` is configured it is called with a
7754
+ * {@link SessionContext} (the raw ``caller`` plus its non-reversible
7755
+ * {@link hashCaller}) and its return value wins — a falsy return omits the
7756
+ * header. Otherwise the static ``sessionKey`` is used. Never logged.
7757
+ */
7758
+ private resolveSessionKey;
7759
+ /**
7760
+ * Pre-call DNS / TLS warmup for the configured endpoint. Best-effort:
7761
+ * 5 s timeout, all exceptions swallowed at debug level. The ``Authorization``
7762
+ * header is only sent when a key is present so the operator-grade bearer is
7763
+ * never echoed for keyless gateways (and the key is never logged).
7764
+ */
7765
+ warmup(): Promise<void>;
7766
+ /**
7767
+ * Build the request body. Mirrors the base OpenAI provider's sampling-kwarg
7768
+ * assembly and additionally sets ``user`` for session continuity when
7769
+ * ``sessionUserPrefix`` is set AND a ``callId`` is available — so the default
7770
+ * (prefix unset) behaviour is byte-identical to the base provider.
7771
+ */
7772
+ private buildBody;
7773
+ /** Stream Patter-format LLM chunks from the configured chat completions API. */
7774
+ stream(messages: Array<Record<string, unknown>>, tools?: Array<Record<string, unknown>> | null, opts?: LLMStreamOptions): AsyncGenerator<LLMChunk, void, unknown>;
7775
+ }
7776
+ /**
7777
+ * Public alias of {@link OpenAICompatibleLLMProvider} for the
7778
+ * ``getpatter/llm/openai-compatible`` namespace.
7779
+ *
7780
+ * @example
7781
+ * ```ts
7782
+ * import * as openaiCompatible from "getpatter/llm/openai-compatible";
7783
+ * // Ollama / vLLM / LM Studio (keyless local gateway):
7784
+ * const llm = new openaiCompatible.LLM({
7785
+ * baseUrl: "http://127.0.0.1:11434/v1",
7786
+ * model: "llama3.1",
7787
+ * });
7788
+ * ```
7789
+ */
7790
+ declare class LLM$3 extends OpenAICompatibleLLMProvider {
7791
+ static readonly providerKey = "openai_compatible";
7792
+ }
7793
+
7794
+ /**
7795
+ * Custom LLM — point Patter's pipeline at ANY OpenAI-compatible endpoint.
7796
+ *
7797
+ * The industry-standard "Custom LLM" pattern (the same concept ElevenLabs
7798
+ * Agents, Retell, and Vapi expose under that name): Patter owns the phone leg
7799
+ * — carrier, STT, turn-taking, barge-in, TTS — and POSTs each conversation
7800
+ * turn to YOUR ``/chat/completions`` endpoint. That endpoint can be:
7801
+ *
7802
+ * - an **agent runtime** (Hermes, OpenClaw — prefer the dedicated presets in
7803
+ * ``llm/hermes`` / ``llm/openclaw``, thin subclasses of this same engine
7804
+ * with the right defaults baked in),
7805
+ * - a **local inference gateway** (Ollama, vLLM, LM Studio — keyless OK),
7806
+ * - or **your own service** that speaks the OpenAI Chat Completions protocol
7807
+ * (SSE streaming, optional tool calls).
7808
+ *
7809
+ * ``CustomLLM`` is the canonical name for the generic engine
7810
+ * ({@link OpenAICompatibleLLMProvider}): same streaming loop, same barge-in
7811
+ * cancellation, same opt-in session continuity (per-call ``user`` field,
7812
+ * per-call session-id header, and a static or factory-derived memory-scope
7813
+ * header).
7814
+ *
7815
+ * @example
7816
+ * ```ts
7817
+ * import { CustomLLM } from "getpatter";
7818
+ *
7819
+ * // Your own agent service (any OpenAI-compatible /chat/completions):
7820
+ * const llm = new CustomLLM({
7821
+ * baseUrl: "http://127.0.0.1:9000/v1",
7822
+ * model: "my-agent",
7823
+ * apiKeyEnv: "MY_AGENT_KEY",
7824
+ * timeout: 120, // agent runtimes run tools before replying
7825
+ * });
7826
+ *
7827
+ * // Keyless local gateway (Ollama / vLLM / LM Studio):
7828
+ * const llm = new CustomLLM({ baseUrl: "http://127.0.0.1:11434/v1", model: "llama3.1" });
7829
+ *
7830
+ * // Per-call session continuity + per-caller long-term memory, on a runtime
7831
+ * // that scopes sessions/memory by header:
7832
+ * const llm = new CustomLLM({
7833
+ * baseUrl: "http://127.0.0.1:9000/v1",
7834
+ * model: "my-agent",
7835
+ * sessionIdHeader: "X-My-Session-Id", // value = `${prefix}${callId}`
7836
+ * sessionIdPrefix: "patter-call-",
7837
+ * sessionKeyHeader: "X-My-Memory-Key",
7838
+ * sessionKeyFrom: "caller_hash", // patter-caller-<hash>
7839
+ * });
7840
+ * ```
7841
+ */
7842
+
7843
+ /** Constructor options for the generic Custom LLM provider. */
7844
+ type CustomLLMOptions = OpenAICompatibleLLMOptions;
7845
+ /**
7846
+ * Generic "Custom LLM" provider for any OpenAI-compatible endpoint.
7847
+ *
7848
+ * All constructor options are inherited from
7849
+ * {@link OpenAICompatibleLLMOptions} (``baseUrl`` and ``model`` are
7850
+ * required). The Hermes / OpenClaw presets are subclasses of the same engine
7851
+ * — use them when they exist; use this for everything else.
7852
+ */
7853
+ declare class LLM$2 extends OpenAICompatibleLLMProvider {
7854
+ /** Stable pricing/dashboard key — read by stream-handler/metrics. */
7855
+ static readonly providerKey: string;
7856
+ }
7857
+
7858
+ /**
7859
+ * Hermes agent-runtime LLM preset for Patter's pipeline mode.
7860
+ *
7861
+ * Thin preset over {@link OpenAICompatibleLLMProvider}: defaults the base URL,
7862
+ * model, env-key name, timeout, and session-continuity prefix for the Hermes
7863
+ * agent runtime so a user just writes ``phone.agent({ llm: new hermes.LLM() })``.
7864
+ *
7865
+ * Hermes runs tools / memory / skills internally before replying, so a single
7866
+ * conversation turn can take 30-90 s — hence the 120 s default timeout. Hermes
7867
+ * is stateless and keys continuity off HEADERS, not the OpenAI ``user`` field:
7868
+ * the preset sends ``X-Hermes-Session-Id: patter-call-<callId>`` on every turn
7869
+ * for per-call session / transcript continuity (on by default), and optionally
7870
+ * ``X-Hermes-Session-Key: <sessionKey>`` for long-term memory scoping when you
7871
+ * pass ``sessionKey``. (It also still emits ``user=patter-call-<callId>`` for
7872
+ * upstream-log correlation, but that is not what drives the session.)
7873
+ */
7874
+
7875
+ /** Constructor options for the Hermes ``LLM`` preset. */
7876
+ interface HermesLLMOptions {
7877
+ /** Bearer token. Falls back to ``API_SERVER_KEY`` env var when omitted. */
7878
+ apiKey?: string;
7879
+ /** Override the Hermes base URL (rarely needed). */
7880
+ baseUrl?: string;
7881
+ /** Model id. Falls back to ``API_SERVER_MODEL_NAME`` env, then ``"hermes-agent"``. */
7882
+ model?: string;
7883
+ /** Per-request timeout in seconds. Default ``120``. */
7884
+ timeout?: number;
7885
+ /**
7886
+ * Static long-term memory scope. When set, emits ``X-Hermes-Session-Key`` so
7887
+ * Hermes scopes durable memory to this value across calls. ``undefined``
7888
+ * (default) means the header is not sent. Credential-grade — never logged.
7889
+ */
7890
+ sessionKey?: string;
7891
+ /**
7892
+ * Convenience selector for a built-in per-call key derivation. Set to
7893
+ * ``'caller_hash'`` to derive the session key per call as
7894
+ * ``` `patter-caller-${ctx.callerHash}` ``` (a stable, non-reversible hash of
7895
+ * the caller — never the raw number), enabling per-caller cross-call memory.
7896
+ * ``undefined`` (default) uses the static ``sessionKey`` path. Ignored when
7897
+ * ``sessionKeyFactory`` is given explicitly. Mirrors Python
7898
+ * ``session_key_from``.
7899
+ */
7900
+ sessionKeyFrom?: 'caller_hash';
7901
+ /**
7902
+ * Custom callback deriving the ``X-Hermes-Session-Key`` value per call from a
7903
+ * {@link SessionContext}. Takes precedence over both ``sessionKey`` and
7904
+ * ``sessionKeyFrom``. A falsy return omits the header for that call.
7905
+ * Credential-grade — never logged. Mirrors Python ``session_key_factory``.
7906
+ */
7907
+ sessionKeyFactory?: (ctx: SessionContext) => string | undefined;
7908
+ /** Extra headers merged after the SDK ``User-Agent``. */
7909
+ extraHeaders?: Record<string, string>;
7910
+ /** Sampling temperature [0, 2]. */
7911
+ temperature?: number;
7912
+ /** Max tokens in the assistant response (sent as ``max_completion_tokens``). */
7913
+ maxTokens?: number;
7914
+ /** OpenAI-style ``response_format`` for JSON mode / structured outputs. */
7915
+ responseFormat?: Record<string, unknown>;
7916
+ /** Whether to allow parallel tool calls. */
7917
+ parallelToolCalls?: boolean;
7918
+ /** ``"auto" | "none" | "required"`` or a specific tool object. */
7919
+ toolChoice?: string | Record<string, unknown>;
7920
+ /** Sampling seed for reproducible outputs. */
7921
+ seed?: number;
7922
+ /** Nucleus sampling cutoff in [0, 1]. */
7923
+ topP?: number;
7924
+ /** Penalty in [-2, 2] applied to repeated tokens. */
7925
+ frequencyPenalty?: number;
7926
+ /** Penalty in [-2, 2] applied to seen tokens. */
7927
+ presencePenalty?: number;
7928
+ /** Stop sequence(s). */
7929
+ stop?: string | string[];
7930
+ }
7931
+ /**
7932
+ * Hermes agent-runtime LLM provider (OpenAI-compatible, streaming).
7933
+ *
7934
+ * @example
7935
+ * ```ts
7936
+ * import * as hermes from "getpatter/llm/hermes";
7937
+ * const llm = new hermes.LLM(); // env-defaulted, keyless OK
7938
+ * const llm = new hermes.LLM({ apiKey: "...", model: "hermes-7b" });
7939
+ * ```
7940
+ */
7941
+ declare class LLM$1 extends OpenAICompatibleLLMProvider {
7942
+ static readonly providerKey = "hermes";
7943
+ constructor(opts?: HermesLLMOptions);
7944
+ }
7945
+
7946
+ /**
7947
+ * OpenClaw agent-runtime LLM preset for Patter's pipeline mode.
7948
+ *
7949
+ * Thin preset over {@link OpenAICompatibleLLMProvider}, aligned with the
7950
+ * shipped ``openclawConsult`` builder in ``src/consult.ts``: same loopback
7951
+ * base URL (``:18789/v1``), same ``OPENCLAW_API_KEY`` env var, same
7952
+ * ``model="openclaw/<agent>"`` pass-through convention, same agent-id charset
7953
+ * rule, and the same ``x-openclaw-session-key`` session header. Takes an
7954
+ * ``agent`` id (not a raw model string), exactly like ``openclawConsult``.
7955
+ *
7956
+ * OpenClaw runs tools / memory / skills internally before replying, so a turn
7957
+ * can take 30-90 s — hence the 120 s default timeout (unlike the consult
7958
+ * preset's phone-safe 30 s filler default; here the runtime IS the per-turn
7959
+ * brain, not an on-demand escalation). It keys sessions off BOTH the OpenAI
7960
+ * ``user`` field and the ``x-openclaw-session-key`` header, so the preset
7961
+ * enables both for one runtime session per phone call.
7962
+ */
7963
+
7964
+ /** Constructor options for the OpenClaw ``LLM`` preset. */
7965
+ interface OpenClawLLMOptions {
7966
+ /**
7967
+ * OpenClaw agent id (e.g. ``"receptionist"``). Mapped to
7968
+ * ``model="openclaw/<agent>"``; an already-namespaced id (``"openclaw/x"``,
7969
+ * ``"agent:x"``) is passed through unchanged. **Required.**
7970
+ */
7971
+ agent: string;
7972
+ /** Override the OpenClaw base URL (rarely needed). */
7973
+ baseUrl?: string;
7974
+ /** Bearer token. Falls back to ``OPENCLAW_API_KEY`` env var when omitted. */
7975
+ apiKey?: string;
7976
+ /** Per-request timeout in seconds. Default ``120``. */
7977
+ timeout?: number;
7978
+ /** Extra headers merged after the SDK ``User-Agent``. */
7979
+ extraHeaders?: Record<string, string>;
7980
+ /** Sampling temperature [0, 2]. */
7981
+ temperature?: number;
7982
+ /** Max tokens in the assistant response (sent as ``max_completion_tokens``). */
7983
+ maxTokens?: number;
7984
+ /** OpenAI-style ``response_format`` for JSON mode / structured outputs. */
7985
+ responseFormat?: Record<string, unknown>;
7986
+ /** Whether to allow parallel tool calls. */
7987
+ parallelToolCalls?: boolean;
7988
+ /** ``"auto" | "none" | "required"`` or a specific tool object. */
7989
+ toolChoice?: string | Record<string, unknown>;
7990
+ /** Sampling seed for reproducible outputs. */
7991
+ seed?: number;
7992
+ /** Nucleus sampling cutoff in [0, 1]. */
7993
+ topP?: number;
7994
+ /** Penalty in [-2, 2] applied to repeated tokens. */
7995
+ frequencyPenalty?: number;
7996
+ /** Penalty in [-2, 2] applied to seen tokens. */
7997
+ presencePenalty?: number;
7998
+ /** Stop sequence(s). */
7999
+ stop?: string | string[];
8000
+ }
8001
+ /**
8002
+ * OpenClaw agent-runtime LLM provider (OpenAI-compatible, streaming).
8003
+ *
8004
+ * @example
8005
+ * ```ts
8006
+ * import * as openclaw from "getpatter/llm/openclaw";
8007
+ * const llm = new openclaw.LLM({ agent: "receptionist" }); // reads OPENCLAW_API_KEY
8008
+ * ```
8009
+ */
8010
+ declare class LLM extends OpenAICompatibleLLMProvider {
8011
+ static readonly providerKey = "openclaw";
8012
+ constructor(opts: OpenClawLLMOptions);
8013
+ }
8014
+
7427
8015
  /**
7428
8016
  * Silero VAD provider.
7429
8017
  *
@@ -8829,4 +9417,17 @@ interface CallEvent {
8829
9417
  readonly direction?: string;
8830
9418
  }
8831
9419
 
8832
- export { type AgentOptions, type AgentState, AllProvidersFailedError, type AnthropicConversion, LLM$3 as AnthropicLLM, type AnthropicLLMOptions, type AnthropicMessage, AssemblyAIEncoding, AssemblyAIModel, STT$1 as AssemblyAISTT, type AssemblyAISTTOptions, type AudioConfig, type AudioSource, AuthenticationError, type BackgroundAudioOptions, BackgroundAudioPlayer, type EvaluateContext as BargeInEvaluateContext, type BargeInStrategy, BuiltinAudioClip, type BuiltinAudioClipName, type BuiltinPcmSource, type CallControl, type CallEvent, type CallEventHandler, type CallMetrics, CallMetricsAccumulator, type CallOutcome, type CallRecord, type CallResult, type CarrierKind, type CartesiaEncoding, STT$3 as CartesiaSTT, type CartesiaSTTOptions, TTS$3 as CartesiaTTS, CartesiaTTSModel, type CartesiaTTSOptions, CartesiaTTSVoiceMode, LLM$1 as CerebrasLLM, type CerebrasLLMOptions, ChatContext, type ChatMessage, type ChatRole, CloudflareTunnel, type ConsultConfig, type ConversationStateSnapshot, type CostBreakdown, DEFAULT_MIN_SENTENCE_LEN, DEFAULT_PRICING, DTMF_EVENTS, DeepFilterNetFilter, type DeepFilterNetOptions, DeepgramModel, STT$6 as DeepgramSTT, type DeepgramSTTOptions, DefaultToolExecutor, type DefaultToolExecutorOptions, type DefineToolInput, type DtmfEvent, ConvAI as ElevenLabsConvAI, ElevenLabsConvAIAdapter, type ConvAIOptions as ElevenLabsConvAIOptions, ElevenLabsModel, ElevenLabsOutputFormat, ElevenLabsTTS as ElevenLabsRestTTS, TTS$6 as ElevenLabsTTS, type ElevenLabsTTSOptions, type ElevenLabsWebSocketOptions, TTS$5 as ElevenLabsWebSocketTTS, type EouTrigger, ErrorCode, EventBus, FallbackLLMProvider, type FallbackLLMProviderOptions, type FilePcmSource, GEMINI_DEFAULT_INPUT_SR, GEMINI_DEFAULT_OUTPUT_SR, GeminiLiveAdapter, type GeminiLiveEventHandler, LLM as GoogleLLM, type GoogleLLMOptions, LLM$2 as GroqLLM, type GroqLLMOptions, Guardrail$1 as Guardrail, type GuardrailOptions, type HookContext, IVRActivity, type IVRActivityOptions, type IVRToolDefinition, type IncomingMessage, type InitTracingOptions, TTS as InworldTTS, type InworldTTSOptions, type JobCallback, KrispFrameDuration, KrispSampleRate, KrispVivaFilter, type KrispVivaFilterOptions, type LLMChunk, LLMLoop, type LLMProvider, LMNTAudioFormat, LMNTModel, LMNTSampleRate, TTS$1 as LMNTTTS, type LMNTTTSOptions, type LatencyBreakdown, type LocalCallOptions, type LocalConfig, type LocalOptions, type Logger, type LoopCallback, type MessageHandler, MetricsStore, MinWordsStrategy, type MinWordsStrategyOptions, type ModelPricing, Ngrok, type OpenAICompatibleConsult, LLM$4 as OpenAILLM, type OpenAILLMOptions, OpenAILLMProvider, type OpenAIMessage, Realtime as OpenAIRealtime, Realtime2 as OpenAIRealtime2, OpenAIRealtime2Adapter, type Realtime2Options as OpenAIRealtime2Options, OpenAIRealtimeAdapter, OpenAIRealtimeAudioFormat, OpenAIRealtimeModel, type RealtimeOptions as OpenAIRealtimeOptions, OpenAIRealtimeVADType, TTS$4 as OpenAITTS, type OpenAITTSOptions, STT$4 as OpenAITranscribeSTT, type OpenAITranscribeSTTOptions, OpenAITranscriptionModel, OpenAIVoice, PRICING_LAST_UPDATED, PRICING_VERSION, type ParamSpec, PartialStreamError, Patter, PatterConfigError, PatterConnectionError, PatterError, type PatterEventType, PatterTool, type PatterToolExecuteArgs, type PatterToolOptions, type PatterToolResult, PcmCarry, PipelineHookExecutor, type PipelineHooks, type PipelineMessageHandler, Carrier as Plivo, PlivoAdapter, type PlivoCarrierOptions, type InitiateCallOptions as PlivoInitiateCallOptions, type InitiateCallResult as PlivoInitiateCallResult, PricingUnit, type PricingUnitValue, type ProviderPricing, ProvisionError, RateLimitError, type RawPcmSource, type RealtimeConfig, type RealtimeTurnDetection, RemoteMessageHandler, RimeAudioFormat, RimeModel, TTS$2 as RimeTTS, type RimeTTSOptions, SPAN_BARGEIN, SPAN_CALL, SPAN_ENDPOINT, SPAN_LLM, SPAN_STT, SPAN_TOOL, SPAN_TTS, type SSEEvent, type STTConfig, type ScheduleHandle, SentenceChunker, type ServeOptions, type SilenceCallback, type SileroSampleRate, SileroVAD, type SileroVADOptions, STT$2 as SonioxSTT, type SonioxSTTOptions$1 as SonioxSTTOptions, type Span, type SpeechEventCallback, SpeechEvents, SpeechmaticsAudioEncoding, SpeechmaticsOperatingPoint, STT as SpeechmaticsSTT, type SpeechmaticsSTTOptions, SpeechmaticsSampleRate, SpeechmaticsServerMessage, TurnDetectionMode as SpeechmaticsTurnDetectionMode, StatefulResampler, type StatefulResamplerOptions, Static as StaticTunnel, type TTSConfig, Carrier$1 as Telnyx, TelnyxAdapter, type TelnyxCarrierOptions, type ConfigureNumberOptions as TelnyxConfigureNumberOptions, type EndCallOptions as TelnyxEndCallOptions, type InitiateCallOptions$1 as TelnyxInitiateCallOptions, type InitiateCallResult$1 as TelnyxInitiateCallResult, type ProvisionNumberOptions as TelnyxProvisionNumberOptions, type ProvisionNumberResult as TelnyxProvisionNumberResult, TelnyxSTT, TelnyxSTTInputFormat, TelnyxSTTSampleRate, type Transcript as TelnyxSTTTranscript, TelnyxTTS, TelnyxTTSSampleRate, TelnyxTTSVoice, type TelnyxTranscriptionEngine, TestSession, TfidfLoopDetector, type TfidfLoopDetectorOptions, Tool, type ToolDefinition, type ToolExecutor, type ToolHandler, type ToolOptions, type TunnelHandle, type TurnMetrics, Carrier$2 as Twilio, TwilioAdapter, type TwilioAdapterOptions, type TwilioCarrierOptions, type ConfigureNumberOptions$1 as TwilioConfigureNumberOptions, type InitiateCallOptions$2 as TwilioInitiateCallOptions, type InitiateCallResult$2 as TwilioInitiateCallResult, type ProvisionNumberOptions$1 as TwilioProvisionNumberOptions, type ProvisionNumberResult$1 as TwilioProvisionNumberResult, ULTRAVOX_DEFAULT_API_BASE, ULTRAVOX_DEFAULT_SR, type UltravoxEventHandler, UltravoxRealtimeAdapter, type UserState, STT$5 as WhisperSTT, type WhisperSTTOptions, assemblyai, builtinClipPath, calculateRealtimeCost, calculateSttCost, calculateTelephonyCost, calculateTtsCost, callsToCsv, callsToJson, cartesia, createResampler16kTo8k, createResampler24kTo16k, createResampler24kTo8k, createResampler8kTo16k, deepgram, defineTool, elevenlabs, evaluateStrategies as evaluateBargeInStrategies, filterEmoji, filterForTTS, filterMarkdown, formatDtmf, geminiLive, getLogger, guardrail, initTracing, isRemoteUrl, isTracingEnabled, isWebSocketUrl, lmnt, makeAuthMiddleware, mergePricing, mixPcm, mountApi, mountDashboard, mulawToPcm16, notifyDashboard, openaiTts, openclawConsult, openclawPostCallNotifier, pcm16ToMulaw, resample16kTo8k, resample24kTo16k, resample8kTo16k, resamplePcm, resetStrategies as resetBargeInStrategies, rime, scheduleCron, scheduleInterval, scheduleOnce, selectSoundFromList, setLogger, soniox, speechmatics, startSpan, startTunnel, tool, ultravox, whisper };
9420
+ declare const hermes: Readonly<{
9421
+ LLM: typeof LLM$1;
9422
+ }>;
9423
+ declare const openclaw: Readonly<{
9424
+ LLM: typeof LLM;
9425
+ }>;
9426
+ declare const openaiCompatible: Readonly<{
9427
+ LLM: typeof LLM$3;
9428
+ }>;
9429
+ declare const custom: Readonly<{
9430
+ LLM: typeof LLM$2;
9431
+ }>;
9432
+
9433
+ export { type AgentOptions, type AgentState, AllProvidersFailedError, type AnthropicConversion, LLM$7 as AnthropicLLM, type AnthropicLLMOptions, type AnthropicMessage, AssemblyAIEncoding, AssemblyAIModel, STT$1 as AssemblyAISTT, type AssemblyAISTTOptions, type AudioConfig, type AudioSource, AuthenticationError, type BackgroundAudioOptions, BackgroundAudioPlayer, type EvaluateContext as BargeInEvaluateContext, type BargeInStrategy, BuiltinAudioClip, type BuiltinAudioClipName, type BuiltinPcmSource, type CallControl, type CallEvent, type CallEventHandler, type CallMetrics, CallMetricsAccumulator, type CallOutcome, type CallRecord, type CallResult, type CarrierKind, type CartesiaEncoding, STT$3 as CartesiaSTT, type CartesiaSTTOptions, TTS$3 as CartesiaTTS, CartesiaTTSModel, type CartesiaTTSOptions, CartesiaTTSVoiceMode, LLM$5 as CerebrasLLM, type CerebrasLLMOptions, ChatContext, type ChatMessage, type ChatRole, CloudflareTunnel, type ConsultConfig, type ConversationStateSnapshot, type CostBreakdown, LLM$2 as CustomLLM, type CustomLLMOptions, DEFAULT_MIN_SENTENCE_LEN, DEFAULT_PRICING, DTMF_EVENTS, DeepFilterNetFilter, type DeepFilterNetOptions, DeepgramModel, STT$6 as DeepgramSTT, type DeepgramSTTOptions, DefaultToolExecutor, type DefaultToolExecutorOptions, type DefineToolInput, type DtmfEvent, ConvAI as ElevenLabsConvAI, ElevenLabsConvAIAdapter, type ConvAIOptions as ElevenLabsConvAIOptions, ElevenLabsModel, ElevenLabsOutputFormat, ElevenLabsTTS as ElevenLabsRestTTS, TTS$6 as ElevenLabsTTS, type ElevenLabsTTSOptions, type ElevenLabsWebSocketOptions, TTS$5 as ElevenLabsWebSocketTTS, type EouTrigger, ErrorCode, EventBus, FallbackLLMProvider, type FallbackLLMProviderOptions, type FilePcmSource, GEMINI_DEFAULT_INPUT_SR, GEMINI_DEFAULT_OUTPUT_SR, GeminiLiveAdapter, type GeminiLiveEventHandler, LLM$4 as GoogleLLM, type GoogleLLMOptions, LLM$6 as GroqLLM, type GroqLLMOptions, Guardrail$1 as Guardrail, type GuardrailOptions, LLM$1 as HermesLLM, type HermesLLMOptions, type HookContext, IVRActivity, type IVRActivityOptions, type IVRToolDefinition, type IncomingMessage, type InitTracingOptions, TTS as InworldTTS, type InworldTTSOptions, type JobCallback, KrispFrameDuration, KrispSampleRate, KrispVivaFilter, type KrispVivaFilterOptions, type LLMChunk, LLMLoop, type LLMProvider, LMNTAudioFormat, LMNTModel, LMNTSampleRate, TTS$1 as LMNTTTS, type LMNTTTSOptions, type LatencyBreakdown, type LocalCallOptions, type LocalConfig, type LocalOptions, type Logger, type LoopCallback, type MessageHandler, MetricsStore, MinWordsStrategy, type MinWordsStrategyOptions, type ModelPricing, Ngrok, type OpenAICompatibleConsult, LLM$3 as OpenAICompatibleLLM, type OpenAICompatibleLLMOptions, OpenAICompatibleLLMProvider, LLM$8 as OpenAILLM, type OpenAILLMOptions, OpenAILLMProvider, type OpenAIMessage, Realtime as OpenAIRealtime, Realtime2 as OpenAIRealtime2, OpenAIRealtime2Adapter, type Realtime2Options as OpenAIRealtime2Options, OpenAIRealtimeAdapter, OpenAIRealtimeAudioFormat, OpenAIRealtimeModel, type RealtimeOptions as OpenAIRealtimeOptions, OpenAIRealtimeVADType, TTS$4 as OpenAITTS, type OpenAITTSOptions, STT$4 as OpenAITranscribeSTT, type OpenAITranscribeSTTOptions, OpenAITranscriptionModel, OpenAIVoice, LLM as OpenClawLLM, type OpenClawLLMOptions, PRICING_LAST_UPDATED, PRICING_VERSION, type ParamSpec, PartialStreamError, Patter, PatterConfigError, PatterConnectionError, PatterError, type PatterEventType, PatterTool, type PatterToolExecuteArgs, type PatterToolOptions, type PatterToolResult, PcmCarry, PipelineHookExecutor, type PipelineHooks, type PipelineMessageHandler, Carrier as Plivo, PlivoAdapter, type PlivoCarrierOptions, type InitiateCallOptions as PlivoInitiateCallOptions, type InitiateCallResult as PlivoInitiateCallResult, PricingUnit, type PricingUnitValue, type ProviderPricing, ProvisionError, RateLimitError, type RawPcmSource, type RealtimeConfig, type RealtimeTurnDetection, RemoteMessageHandler, RimeAudioFormat, RimeModel, TTS$2 as RimeTTS, type RimeTTSOptions, SPAN_BARGEIN, SPAN_CALL, SPAN_ENDPOINT, SPAN_LLM, SPAN_STT, SPAN_TOOL, SPAN_TTS, type SSEEvent, type STTConfig, type ScheduleHandle, SentenceChunker, type ServeOptions, type SessionContext, type SilenceCallback, type SileroSampleRate, SileroVAD, type SileroVADOptions, STT$2 as SonioxSTT, type SonioxSTTOptions$1 as SonioxSTTOptions, type Span, type SpeechEventCallback, SpeechEvents, SpeechmaticsAudioEncoding, SpeechmaticsOperatingPoint, STT as SpeechmaticsSTT, type SpeechmaticsSTTOptions, SpeechmaticsSampleRate, SpeechmaticsServerMessage, TurnDetectionMode as SpeechmaticsTurnDetectionMode, StatefulResampler, type StatefulResamplerOptions, Static as StaticTunnel, type TTSConfig, Carrier$1 as Telnyx, TelnyxAdapter, type TelnyxCarrierOptions, type ConfigureNumberOptions as TelnyxConfigureNumberOptions, type EndCallOptions as TelnyxEndCallOptions, type InitiateCallOptions$1 as TelnyxInitiateCallOptions, type InitiateCallResult$1 as TelnyxInitiateCallResult, type ProvisionNumberOptions as TelnyxProvisionNumberOptions, type ProvisionNumberResult as TelnyxProvisionNumberResult, TelnyxSTT, TelnyxSTTInputFormat, TelnyxSTTSampleRate, type Transcript as TelnyxSTTTranscript, TelnyxTTS, TelnyxTTSSampleRate, TelnyxTTSVoice, type TelnyxTranscriptionEngine, TestSession, TfidfLoopDetector, type TfidfLoopDetectorOptions, Tool, type ToolDefinition, type ToolExecutor, type ToolHandler, type ToolOptions, type TunnelHandle, type TurnMetrics, Carrier$2 as Twilio, TwilioAdapter, type TwilioAdapterOptions, type TwilioCarrierOptions, type ConfigureNumberOptions$1 as TwilioConfigureNumberOptions, type InitiateCallOptions$2 as TwilioInitiateCallOptions, type InitiateCallResult$2 as TwilioInitiateCallResult, type ProvisionNumberOptions$1 as TwilioProvisionNumberOptions, type ProvisionNumberResult$1 as TwilioProvisionNumberResult, ULTRAVOX_DEFAULT_API_BASE, ULTRAVOX_DEFAULT_SR, type UltravoxEventHandler, UltravoxRealtimeAdapter, type UserState, STT$5 as WhisperSTT, type WhisperSTTOptions, assemblyai, builtinClipPath, calculateRealtimeCost, calculateSttCost, calculateTelephonyCost, calculateTtsCost, callsToCsv, callsToJson, cartesia, createResampler16kTo8k, createResampler24kTo16k, createResampler24kTo8k, createResampler8kTo16k, custom, deepgram, defineTool, elevenlabs, evaluateStrategies as evaluateBargeInStrategies, filterEmoji, filterForTTS, filterMarkdown, formatDtmf, geminiLive, getLogger, guardrail, hashCaller, hermes, initTracing, isRemoteUrl, isTracingEnabled, isWebSocketUrl, lmnt, makeAuthMiddleware, mergePricing, mixPcm, mountApi, mountDashboard, mulawToPcm16, notifyDashboard, openaiCompatible, openaiTts, openclaw, openclawConsult, openclawPostCallNotifier, pcm16ToMulaw, resample16kTo8k, resample24kTo16k, resample8kTo16k, resamplePcm, resetStrategies as resetBargeInStrategies, rime, scheduleCron, scheduleInterval, scheduleOnce, selectSoundFromList, setLogger, soniox, speechmatics, startSpan, startTunnel, tool, ultravox, whisper };