@providerkit/core 0.28.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/auth/oauth.d.ts +2 -1
  2. package/dist/auth/oauth.d.ts.map +1 -1
  3. package/dist/auth/oauth.js.map +1 -1
  4. package/dist/capability.d.ts +2 -1
  5. package/dist/capability.d.ts.map +1 -1
  6. package/dist/capability.js.map +1 -1
  7. package/dist/decisions.d.ts +2 -1
  8. package/dist/decisions.d.ts.map +1 -1
  9. package/dist/decisions.js.map +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/providers/anthropic.d.ts +2 -1
  14. package/dist/providers/anthropic.d.ts.map +1 -1
  15. package/dist/providers/anthropic.js.map +1 -1
  16. package/dist/providers/elevenlabs-speech.d.ts +41 -0
  17. package/dist/providers/elevenlabs-speech.d.ts.map +1 -0
  18. package/dist/providers/elevenlabs-speech.js +181 -0
  19. package/dist/providers/elevenlabs-speech.js.map +1 -0
  20. package/dist/providers/factory.d.ts +2 -1
  21. package/dist/providers/factory.d.ts.map +1 -1
  22. package/dist/providers/factory.js.map +1 -1
  23. package/dist/providers/gemini-speech.d.ts +5 -3
  24. package/dist/providers/gemini-speech.d.ts.map +1 -1
  25. package/dist/providers/gemini-speech.js +8 -9
  26. package/dist/providers/gemini-speech.js.map +1 -1
  27. package/dist/providers/gemini.d.ts +2 -1
  28. package/dist/providers/gemini.d.ts.map +1 -1
  29. package/dist/providers/gemini.js.map +1 -1
  30. package/dist/providers/openai-speech.d.ts +2 -1
  31. package/dist/providers/openai-speech.d.ts.map +1 -1
  32. package/dist/providers/openai-speech.js.map +1 -1
  33. package/dist/providers/openai.d.ts +2 -1
  34. package/dist/providers/openai.d.ts.map +1 -1
  35. package/dist/providers/openai.js.map +1 -1
  36. package/dist/providers/responses.d.ts +2 -1
  37. package/dist/providers/responses.d.ts.map +1 -1
  38. package/dist/providers/responses.js.map +1 -1
  39. package/dist/providers/speech-factory.d.ts +2 -1
  40. package/dist/providers/speech-factory.d.ts.map +1 -1
  41. package/dist/providers/speech-factory.js.map +1 -1
  42. package/dist/speech.d.ts +2 -0
  43. package/dist/speech.d.ts.map +1 -1
  44. package/dist/speech.js +1 -0
  45. package/dist/speech.js.map +1 -1
  46. package/dist/transport.d.ts +7 -1
  47. package/dist/transport.d.ts.map +1 -1
  48. package/dist/transport.js.map +1 -1
  49. package/package.json +1 -1
  50. package/src/auth/oauth.ts +2 -1
  51. package/src/capability.ts +2 -1
  52. package/src/decisions.ts +2 -2
  53. package/src/index.ts +1 -0
  54. package/src/providers/anthropic.ts +2 -2
  55. package/src/providers/elevenlabs-speech.ts +242 -0
  56. package/src/providers/factory.ts +4 -3
  57. package/src/providers/gemini-speech.ts +14 -12
  58. package/src/providers/gemini.ts +2 -2
  59. package/src/providers/openai-speech.ts +2 -2
  60. package/src/providers/openai.ts +2 -2
  61. package/src/providers/responses.ts +2 -2
  62. package/src/providers/speech-factory.ts +2 -1
  63. package/src/speech.ts +3 -0
  64. package/src/transport.ts +8 -1
@@ -10,6 +10,7 @@ import type { Attribution } from "../attribution.ts";
10
10
  import type { SpeechFormat, SpeechLimits, SpeechProvider } from "../speech-core.ts";
11
11
  import { createGeminiSpeechProvider } from "./gemini-speech.ts";
12
12
  import { createOpenAISpeechProvider } from "./openai-speech.ts";
13
+ import type { FetchLike } from "../transport.ts";
13
14
 
14
15
  export interface SpeechProviderConfig extends SpeechLimits, Attribution {
15
16
  apiKey: string;
@@ -30,7 +31,7 @@ export interface SpeechProviderConfig extends SpeechLimits, Attribution {
30
31
  /** The `google` preset only: caps the audio tokens generated. Refused on a wire that has no such field. */
31
32
  maxOutputTokens?: number;
32
33
  /** Swapped in tests, or to route through a proxy. Defaults to global fetch. */
33
- fetchImpl?: typeof fetch;
34
+ fetchImpl?: FetchLike;
34
35
  }
35
36
 
36
37
  /**
package/src/speech.ts CHANGED
@@ -18,7 +18,10 @@ export {
18
18
  type SpeechUsage,
19
19
  type WavInfo,
20
20
  } from "./speech-core.ts";
21
+ // The `fetchImpl` option's type, so a speech-only app can type its wrapper without the main entry.
22
+ export type { FetchLike } from "./transport.ts";
21
23
  export * from "./providers/openai-speech.ts";
22
24
  export * from "./providers/gemini-speech.ts";
25
+ export * from "./providers/elevenlabs-speech.ts";
23
26
  export * from "./providers/speech-factory.ts";
24
27
  export { SPEECH_PRESET_IDS, type PresetSpeech } from "./presets.ts";
package/src/transport.ts CHANGED
@@ -11,6 +11,13 @@ import {
11
11
  type RateLimitReading,
12
12
  } from "./rate-limit.ts";
13
13
 
14
+ /**
15
+ * What a `fetchImpl` option takes: anything called like `fetch` that answers with a `Response`.
16
+ * Narrower than `typeof fetch`, which a runtime may widen (Bun's adds `preconnect`), so a plain
17
+ * wrapper or a test double fits without a cast. Global `fetch` still fits.
18
+ */
19
+ export type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
20
+
14
21
  export interface RequestInit_ {
15
22
  url: string;
16
23
  headers?: Record<string, string>;
@@ -19,7 +26,7 @@ export interface RequestInit_ {
19
26
  provider: string;
20
27
  signal?: AbortSignal;
21
28
  /** Swapped in tests, or to route through a proxy. Defaults to global fetch. */
22
- fetchImpl?: typeof fetch;
29
+ fetchImpl?: FetchLike;
23
30
  /** Called when the response headers arrive and on every body read after,
24
31
  * keep-alives included. What the watchdog's idle clock runs on. */
25
32
  onActivity?: () => void;