@jini-ai/integrations 0.3.6 → 0.4.1

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 (211) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.md +72 -24
  3. package/dist/args.d.ts +8 -0
  4. package/dist/args.js +10 -0
  5. package/dist/argument-error.d.ts +9 -0
  6. package/dist/argument-error.js +7 -0
  7. package/dist/credentialed-http/auth-schemes.d.ts +29 -0
  8. package/dist/credentialed-http/auth-schemes.js +60 -0
  9. package/dist/credentialed-http/credentialed-request.d.ts +132 -0
  10. package/dist/credentialed-http/credentialed-request.js +365 -0
  11. package/dist/credentialed-http/index.d.ts +4 -0
  12. package/dist/credentialed-http/index.js +4 -0
  13. package/dist/credentialed-http/ports.d.ts +42 -0
  14. package/dist/credentialed-http/ports.js +2 -0
  15. package/dist/media-providers/capability-registry.d.ts +13 -7
  16. package/dist/media-providers/capability-registry.js +6 -6
  17. package/dist/media-providers/dispatch/async-operation-store.d.ts +25 -8
  18. package/dist/media-providers/dispatch/async-operation-store.js +12 -32
  19. package/dist/media-providers/dispatch/builtin-vendors.d.ts +6 -0
  20. package/dist/media-providers/dispatch/builtin-vendors.js +30 -0
  21. package/dist/media-providers/dispatch/context.d.ts +7 -2
  22. package/dist/media-providers/dispatch/context.js +1 -1
  23. package/dist/media-providers/dispatch/credentials.d.ts +4 -1
  24. package/dist/media-providers/dispatch/credentials.js +1 -1
  25. package/dist/media-providers/dispatch/engine.d.ts +5 -13
  26. package/dist/media-providers/dispatch/engine.js +25 -26
  27. package/dist/media-providers/dispatch/index.d.ts +4 -1
  28. package/dist/media-providers/dispatch/index.js +4 -2
  29. package/dist/media-providers/dispatch/openai-compatible.d.ts +12 -2
  30. package/dist/media-providers/dispatch/openai-compatible.js +9 -5
  31. package/dist/media-providers/dispatch/operation-runtime.d.ts +16 -8
  32. package/dist/media-providers/dispatch/operation-runtime.js +93 -76
  33. package/dist/media-providers/dispatch/outbound.d.ts +31 -0
  34. package/dist/media-providers/dispatch/outbound.js +54 -0
  35. package/dist/media-providers/dispatch/polling-adapter.d.ts +26 -8
  36. package/dist/media-providers/dispatch/polling-adapter.js +2 -2
  37. package/dist/media-providers/dispatch/providers/aihubmix-shared.d.ts +2 -2
  38. package/dist/media-providers/dispatch/providers/aihubmix-shared.js +2 -2
  39. package/dist/media-providers/dispatch/providers/aihubmix.d.ts +13 -2
  40. package/dist/media-providers/dispatch/providers/aihubmix.js +18 -16
  41. package/dist/media-providers/dispatch/providers/custom-image.d.ts +16 -2
  42. package/dist/media-providers/dispatch/providers/custom-image.js +12 -9
  43. package/dist/media-providers/dispatch/providers/elevenlabs.d.ts +13 -2
  44. package/dist/media-providers/dispatch/providers/elevenlabs.js +16 -14
  45. package/dist/media-providers/dispatch/providers/fishaudio.d.ts +9 -1
  46. package/dist/media-providers/dispatch/providers/fishaudio.js +10 -8
  47. package/dist/media-providers/dispatch/providers/grok.d.ts +16 -3
  48. package/dist/media-providers/dispatch/providers/grok.js +19 -17
  49. package/dist/media-providers/dispatch/providers/imagerouter-video-async.d.ts +1 -1
  50. package/dist/media-providers/dispatch/providers/imagerouter-video-async.js +23 -22
  51. package/dist/media-providers/dispatch/providers/imagerouter.d.ts +17 -3
  52. package/dist/media-providers/dispatch/providers/imagerouter.js +21 -19
  53. package/dist/media-providers/dispatch/providers/minimax.d.ts +9 -1
  54. package/dist/media-providers/dispatch/providers/minimax.js +9 -7
  55. package/dist/media-providers/dispatch/providers/nanobanana.d.ts +9 -1
  56. package/dist/media-providers/dispatch/providers/nanobanana.js +10 -8
  57. package/dist/media-providers/dispatch/providers/openai.d.ts +13 -2
  58. package/dist/media-providers/dispatch/providers/openai.js +23 -28
  59. package/dist/media-providers/dispatch/providers/openrouter.d.ts +12 -2
  60. package/dist/media-providers/dispatch/providers/openrouter.js +14 -12
  61. package/dist/media-providers/dispatch/providers/senseaudio.d.ts +13 -2
  62. package/dist/media-providers/dispatch/providers/senseaudio.js +16 -14
  63. package/dist/media-providers/dispatch/providers/volcengine.d.ts +9 -1
  64. package/dist/media-providers/dispatch/providers/volcengine.js +11 -9
  65. package/dist/media-providers/dispatch/response-parsers.d.ts +21 -7
  66. package/dist/media-providers/dispatch/response-parsers.js +15 -11
  67. package/dist/media-providers/dispatch/sqlite-async-operation-store.d.ts +3 -1
  68. package/dist/media-providers/dispatch/sqlite-async-operation-store.js +30 -28
  69. package/dist/media-providers/dispatch/ssrf-guard.d.ts +27 -14
  70. package/dist/media-providers/dispatch/ssrf-guard.js +46 -105
  71. package/dist/media-providers/dispatch/stub.d.ts +7 -2
  72. package/dist/media-providers/dispatch/stub.js +4 -3
  73. package/dist/media-providers/dispatch/types.d.ts +17 -13
  74. package/dist/media-providers/dispatch/vendor-adapter.d.ts +22 -5
  75. package/dist/media-providers/dispatch/vendor-adapter.js +13 -10
  76. package/dist/media-providers/dispatch/vendor-registry.d.ts +14 -11
  77. package/dist/media-providers/dispatch/vendor-registry.js +33 -4
  78. package/dist/media-providers/index.d.ts +1 -1
  79. package/dist/media-providers/index.js +1 -1
  80. package/dist/media-providers/policy.d.ts +3 -2
  81. package/dist/media-providers/policy.js +4 -2
  82. package/dist/media-providers/providers.d.ts +12 -4
  83. package/dist/media-providers/providers.js +3 -3
  84. package/dist/media-providers/staging.d.ts +8 -2
  85. package/dist/media-providers/staging.js +13 -4
  86. package/dist/media-providers/task-store.d.ts +2 -2
  87. package/dist/media-providers/task-store.js +2 -2
  88. package/dist/media-providers/tokens.js +3 -3
  89. package/dist/media-providers/types.d.ts +4 -4
  90. package/dist/media-providers/types.js +1 -1
  91. package/dist/media-providers/video-request.d.ts +35 -15
  92. package/dist/media-providers/video-request.js +15 -15
  93. package/dist/webhooks/delivery.d.ts +76 -0
  94. package/dist/webhooks/delivery.js +222 -0
  95. package/dist/webhooks/index.d.ts +7 -0
  96. package/dist/webhooks/index.js +7 -0
  97. package/dist/webhooks/ports.d.ts +113 -0
  98. package/dist/webhooks/ports.js +2 -0
  99. package/dist/webhooks/signing.d.ts +38 -0
  100. package/dist/webhooks/signing.js +83 -0
  101. package/dist/webhooks/signing.keyring.d.ts +8 -0
  102. package/dist/webhooks/signing.keyring.js +18 -0
  103. package/dist/webhooks/subscriptions.d.ts +78 -0
  104. package/dist/webhooks/subscriptions.js +139 -0
  105. package/dist/webhooks/types.d.ts +103 -0
  106. package/dist/webhooks/types.js +2 -0
  107. package/package.json +36 -22
  108. package/dist/composio/bounded-data.d.ts.map +0 -1
  109. package/dist/composio/bounded-data.js.map +0 -1
  110. package/dist/composio/catalog.d.ts.map +0 -1
  111. package/dist/composio/catalog.js.map +0 -1
  112. package/dist/composio/composio-config.d.ts.map +0 -1
  113. package/dist/composio/composio-config.js.map +0 -1
  114. package/dist/composio/composio-descriptions.d.ts.map +0 -1
  115. package/dist/composio/composio-descriptions.js.map +0 -1
  116. package/dist/composio/composio.d.ts.map +0 -1
  117. package/dist/composio/composio.js.map +0 -1
  118. package/dist/composio/errors.d.ts.map +0 -1
  119. package/dist/composio/errors.js.map +0 -1
  120. package/dist/composio/file-lock.d.ts.map +0 -1
  121. package/dist/composio/file-lock.js.map +0 -1
  122. package/dist/composio/index.d.ts.map +0 -1
  123. package/dist/composio/index.js.map +0 -1
  124. package/dist/composio/json-schema.d.ts.map +0 -1
  125. package/dist/composio/json-schema.js.map +0 -1
  126. package/dist/composio/output-protection.d.ts.map +0 -1
  127. package/dist/composio/output-protection.js.map +0 -1
  128. package/dist/composio/service.d.ts.map +0 -1
  129. package/dist/composio/service.js.map +0 -1
  130. package/dist/media-providers/capability-registry.d.ts.map +0 -1
  131. package/dist/media-providers/capability-registry.js.map +0 -1
  132. package/dist/media-providers/catalog.d.ts.map +0 -1
  133. package/dist/media-providers/catalog.js.map +0 -1
  134. package/dist/media-providers/dispatch/async-operation-store.d.ts.map +0 -1
  135. package/dist/media-providers/dispatch/async-operation-store.js.map +0 -1
  136. package/dist/media-providers/dispatch/context.d.ts.map +0 -1
  137. package/dist/media-providers/dispatch/context.js.map +0 -1
  138. package/dist/media-providers/dispatch/credentials.d.ts.map +0 -1
  139. package/dist/media-providers/dispatch/credentials.js.map +0 -1
  140. package/dist/media-providers/dispatch/engine.d.ts.map +0 -1
  141. package/dist/media-providers/dispatch/engine.js.map +0 -1
  142. package/dist/media-providers/dispatch/index.d.ts.map +0 -1
  143. package/dist/media-providers/dispatch/index.js.map +0 -1
  144. package/dist/media-providers/dispatch/openai-compatible.d.ts.map +0 -1
  145. package/dist/media-providers/dispatch/openai-compatible.js.map +0 -1
  146. package/dist/media-providers/dispatch/operation-runtime.d.ts.map +0 -1
  147. package/dist/media-providers/dispatch/operation-runtime.js.map +0 -1
  148. package/dist/media-providers/dispatch/polling-adapter.d.ts.map +0 -1
  149. package/dist/media-providers/dispatch/polling-adapter.js.map +0 -1
  150. package/dist/media-providers/dispatch/providers/aihubmix-shared.d.ts.map +0 -1
  151. package/dist/media-providers/dispatch/providers/aihubmix-shared.js.map +0 -1
  152. package/dist/media-providers/dispatch/providers/aihubmix.d.ts.map +0 -1
  153. package/dist/media-providers/dispatch/providers/aihubmix.js.map +0 -1
  154. package/dist/media-providers/dispatch/providers/custom-image.d.ts.map +0 -1
  155. package/dist/media-providers/dispatch/providers/custom-image.js.map +0 -1
  156. package/dist/media-providers/dispatch/providers/elevenlabs.d.ts.map +0 -1
  157. package/dist/media-providers/dispatch/providers/elevenlabs.js.map +0 -1
  158. package/dist/media-providers/dispatch/providers/fishaudio.d.ts.map +0 -1
  159. package/dist/media-providers/dispatch/providers/fishaudio.js.map +0 -1
  160. package/dist/media-providers/dispatch/providers/grok.d.ts.map +0 -1
  161. package/dist/media-providers/dispatch/providers/grok.js.map +0 -1
  162. package/dist/media-providers/dispatch/providers/imagerouter-video-async.d.ts.map +0 -1
  163. package/dist/media-providers/dispatch/providers/imagerouter-video-async.js.map +0 -1
  164. package/dist/media-providers/dispatch/providers/imagerouter.d.ts.map +0 -1
  165. package/dist/media-providers/dispatch/providers/imagerouter.js.map +0 -1
  166. package/dist/media-providers/dispatch/providers/minimax.d.ts.map +0 -1
  167. package/dist/media-providers/dispatch/providers/minimax.js.map +0 -1
  168. package/dist/media-providers/dispatch/providers/nanobanana.d.ts.map +0 -1
  169. package/dist/media-providers/dispatch/providers/nanobanana.js.map +0 -1
  170. package/dist/media-providers/dispatch/providers/openai.d.ts.map +0 -1
  171. package/dist/media-providers/dispatch/providers/openai.js.map +0 -1
  172. package/dist/media-providers/dispatch/providers/openrouter.d.ts.map +0 -1
  173. package/dist/media-providers/dispatch/providers/openrouter.js.map +0 -1
  174. package/dist/media-providers/dispatch/providers/senseaudio.d.ts.map +0 -1
  175. package/dist/media-providers/dispatch/providers/senseaudio.js.map +0 -1
  176. package/dist/media-providers/dispatch/providers/volcengine.d.ts.map +0 -1
  177. package/dist/media-providers/dispatch/providers/volcengine.js.map +0 -1
  178. package/dist/media-providers/dispatch/response-parsers.d.ts.map +0 -1
  179. package/dist/media-providers/dispatch/response-parsers.js.map +0 -1
  180. package/dist/media-providers/dispatch/sqlite-async-operation-store.d.ts.map +0 -1
  181. package/dist/media-providers/dispatch/sqlite-async-operation-store.js.map +0 -1
  182. package/dist/media-providers/dispatch/ssrf-guard.d.ts.map +0 -1
  183. package/dist/media-providers/dispatch/ssrf-guard.js.map +0 -1
  184. package/dist/media-providers/dispatch/stub.d.ts.map +0 -1
  185. package/dist/media-providers/dispatch/stub.js.map +0 -1
  186. package/dist/media-providers/dispatch/types.d.ts.map +0 -1
  187. package/dist/media-providers/dispatch/types.js.map +0 -1
  188. package/dist/media-providers/dispatch/vendor-adapter.d.ts.map +0 -1
  189. package/dist/media-providers/dispatch/vendor-adapter.js.map +0 -1
  190. package/dist/media-providers/dispatch/vendor-registry.d.ts.map +0 -1
  191. package/dist/media-providers/dispatch/vendor-registry.js.map +0 -1
  192. package/dist/media-providers/index.d.ts.map +0 -1
  193. package/dist/media-providers/index.js.map +0 -1
  194. package/dist/media-providers/policy.d.ts.map +0 -1
  195. package/dist/media-providers/policy.js.map +0 -1
  196. package/dist/media-providers/providers.d.ts.map +0 -1
  197. package/dist/media-providers/providers.js.map +0 -1
  198. package/dist/media-providers/seed.d.ts.map +0 -1
  199. package/dist/media-providers/seed.js.map +0 -1
  200. package/dist/media-providers/sqlite-task-store.d.ts.map +0 -1
  201. package/dist/media-providers/sqlite-task-store.js.map +0 -1
  202. package/dist/media-providers/staging.d.ts.map +0 -1
  203. package/dist/media-providers/staging.js.map +0 -1
  204. package/dist/media-providers/task-store.d.ts.map +0 -1
  205. package/dist/media-providers/task-store.js.map +0 -1
  206. package/dist/media-providers/tokens.d.ts.map +0 -1
  207. package/dist/media-providers/tokens.js.map +0 -1
  208. package/dist/media-providers/types.d.ts.map +0 -1
  209. package/dist/media-providers/types.js.map +0 -1
  210. package/dist/media-providers/video-request.d.ts.map +0 -1
  211. package/dist/media-providers/video-request.js.map +0 -1
@@ -4,7 +4,7 @@
4
4
  * Open Design's `apps/daemon/src/media/index.ts` `renderNanoBananaImage`
5
5
  * (plus its `nanoBananaHeaders`/`usesOfficialGoogleApiKeyHeader`/
6
6
  * `nanoBananaAspectFor`/`inlineImageBytesFromGenerateContent` helpers) —
7
- * see `source-map.md`.
7
+ * see `archived provenance ledger`.
8
8
  *
9
9
  * Not OpenAI-images-wire-compatible — Gemini's `generateContent` request
10
10
  * shape (`contents[].parts[].text` + `generationConfig`) and response shape
@@ -27,7 +27,6 @@
27
27
  */
28
28
  import { sniffImageExt, truncate, withRequestInit } from '../openai-compatible.js';
29
29
  import { dispatchVendorRequest, requireApiKey } from '../vendor-adapter.js';
30
- import { mediaVendorRegistry } from '../vendor-registry.js';
31
30
  const NANOBANANA_DEFAULT_BASE_URL = 'https://generativelanguage.googleapis.com';
32
31
  const NANOBANANA_DEFAULT_MODEL = 'gemini-3.1-flash-image-preview';
33
32
  const NANOBANANA_DEFAULT_IMAGE_SIZE = '1K';
@@ -89,8 +88,8 @@ function inlineImageBytesFromGenerateContent(data) {
89
88
  }
90
89
  const NO_CREDENTIAL_MESSAGE = 'no Nano Banana credential — configure an API key or set GOOGLE_API_KEY / GEMINI_API_KEY.';
91
90
  const nanoBananaImageAdapter = {
92
- requireCredential: requireApiKey(NO_CREDENTIAL_MESSAGE),
93
- buildRequest(ctx, credentials) {
91
+ requireCredential: requireApiKey({ message: NO_CREDENTIAL_MESSAGE }),
92
+ buildRequest({ ctx, credentials }) {
94
93
  const apiKey = credentials.apiKey; // requireCredential already validated this.
95
94
  const baseUrl = (credentials.baseUrl || NANOBANANA_DEFAULT_BASE_URL).replace(/\/$/, '');
96
95
  const wireModel = (credentials.model || ctx.wireModel || NANOBANANA_DEFAULT_MODEL).trim();
@@ -115,7 +114,7 @@ const nanoBananaImageAdapter = {
115
114
  meta: { wireModel, aspectRatio },
116
115
  };
117
116
  },
118
- async parseResponse(resp, _ctx, request) {
117
+ async parseResponse({ resp, ctx: _ctx, request }) {
119
118
  const text = await resp.text();
120
119
  if (!resp.ok) {
121
120
  throw new Error(`nano-banana image ${resp.status}: ${truncate(text, 240)}`);
@@ -135,8 +134,11 @@ const nanoBananaImageAdapter = {
135
134
  };
136
135
  },
137
136
  };
138
- mediaVendorRegistry.register('nanobanana', 'image', nanoBananaImageAdapter);
139
- export async function renderNanoBananaImage(ctx, credentials) {
140
- return dispatchVendorRequest(nanoBananaImageAdapter, ctx, credentials);
137
+ export async function renderNanoBananaImage({ ctx, credentials }) {
138
+ return dispatchVendorRequest({ adapter: nanoBananaImageAdapter, ctx: ctx, credentials: credentials });
139
+ }
140
+ /** Explicit composition: importing a renderer never changes another module's registry. */
141
+ export function registerVendorAdapters({ registry }, _optional = {}) {
142
+ registry.register({ providerId: 'nanobanana', routeKey: 'image', adapter: nanoBananaImageAdapter });
141
143
  }
142
144
  //# sourceMappingURL=nanobanana.js.map
@@ -1,4 +1,15 @@
1
1
  import type { ProviderCredentials, RenderContext, RenderResult } from '../types.js';
2
- export declare function renderOpenAIImage(ctx: RenderContext, credentials: ProviderCredentials): Promise<RenderResult>;
3
- export declare function renderOpenAISpeech(ctx: RenderContext, credentials: ProviderCredentials): Promise<RenderResult>;
2
+ import type { VendorAdapterRegistry } from '../vendor-registry.js';
3
+ export declare function renderOpenAIImage({ ctx, credentials }: {
4
+ ctx: RenderContext;
5
+ credentials: ProviderCredentials;
6
+ }): Promise<RenderResult>;
7
+ export declare function renderOpenAISpeech({ ctx, credentials }: {
8
+ ctx: RenderContext;
9
+ credentials: ProviderCredentials;
10
+ }): Promise<RenderResult>;
11
+ /** Explicit composition: importing a renderer never changes another module's registry. */
12
+ export declare function registerVendorAdapters({ registry }: {
13
+ registry: Pick<VendorAdapterRegistry, 'register'>;
14
+ }, _optional?: Record<string, never>): void;
4
15
  //# sourceMappingURL=openai.d.ts.map
@@ -2,7 +2,7 @@
2
2
  * Provider: OpenAI Images API (gpt-image-2, gpt-image-1.5, dall-e-3, ...)
3
3
  * and text-to-speech via `/v1/audio/speech`. Ported near-verbatim from
4
4
  * Open Design's `apps/daemon/src/media/index.ts` `renderOpenAIImage`/
5
- * `renderOpenAISpeech` — see `source-map.md`.
5
+ * `renderOpenAISpeech` — see `archived provenance ledger`.
6
6
  *
7
7
  * 2026-07-21: migrated onto the generic vendor-adapter dispatch engine
8
8
  * (`vendor-adapter.ts`/`vendor-registry.ts`). External behavior is
@@ -43,28 +43,21 @@
43
43
  * integration already excluded from `providers.ts`'s catalogue, not a REST
44
44
  * credential shape any other Jini consumer could use.
45
45
  */
46
- import { FETCH_TIMEOUT_MS, fetchWithTimeout } from '@jini-ai/platform';
47
- import { Agent as UndiciAgent } from 'undici';
46
+ import { assertAndFetchExternalAsset } from '../ssrf-guard.js';
48
47
  import { buildOpenAIImageUrl, buildOpenAISpeechUrl, detectAzureEndpoint, openaiSizeFor, OPENAI_TTS_VOICES, truncate, withRequestInit, } from '../openai-compatible.js';
49
48
  import { createRawBytesParser } from '../response-parsers.js';
50
49
  import { dispatchVendorRequest, requireApiKey } from '../vendor-adapter.js';
51
- import { mediaVendorRegistry } from '../vendor-registry.js';
52
50
  // Image generation can legitimately take minutes (gpt-image-2 4K renders
53
- // especially). A generous default headers/body timeout dispatcher is
54
- // applied so a caller-configured global fetch default doesn't cut a
55
- // legitimately-slow-but-succeeding generation short; a caller can still
56
- // override via `requestInit.dispatcher`.
51
+ // especially). The guarded client owns the socket and deadline budgets,
52
+ // so a caller-configured global fetch default cannot cut a legitimately
53
+ // slow-but-succeeding generation short. Pooling belongs to the injected guarded client.
57
54
  const OPENAI_IMAGE_HEADERS_TIMEOUT_MS = 10 * 60 * 1000;
58
55
  const OPENAI_IMAGE_BODY_TIMEOUT_MS = 10 * 60 * 1000;
59
- const openAIImageDispatcher = new UndiciAgent({
60
- headersTimeout: OPENAI_IMAGE_HEADERS_TIMEOUT_MS,
61
- bodyTimeout: OPENAI_IMAGE_BODY_TIMEOUT_MS,
62
- });
63
56
  const OPENAI_IMAGE_NO_CREDENTIAL_MESSAGE = 'no OpenAI credential — configure an API key or set OPENAI_API_KEY.';
64
57
  const OPENAI_SPEECH_NO_CREDENTIAL_MESSAGE = 'no OpenAI credential — configure an API key or set OPENAI_API_KEY';
65
58
  const openAIImageAdapter = {
66
- requireCredential: requireApiKey(OPENAI_IMAGE_NO_CREDENTIAL_MESSAGE),
67
- buildRequest(ctx, credentials) {
59
+ requireCredential: requireApiKey({ message: OPENAI_IMAGE_NO_CREDENTIAL_MESSAGE }),
60
+ buildRequest({ ctx, credentials }) {
68
61
  const apiKey = credentials.apiKey; // requireCredential already validated this.
69
62
  const rawBase = credentials.baseUrl || 'https://api.openai.com/v1';
70
63
  const azure = detectAzureEndpoint(rawBase);
@@ -109,13 +102,12 @@ const openAIImageAdapter = {
109
102
  method: 'POST',
110
103
  headers,
111
104
  body: JSON.stringify(body),
112
- dispatcher: ctx.requestInit.dispatcher ?? openAIImageDispatcher,
113
105
  signal: AbortSignal.timeout(Math.max(OPENAI_IMAGE_HEADERS_TIMEOUT_MS, OPENAI_IMAGE_BODY_TIMEOUT_MS)),
114
106
  }),
115
107
  meta: { tag: azure ? 'azure-openai' : 'openai', wireModel: ctx.wireModel },
116
108
  };
117
109
  },
118
- async parseResponse(resp, ctx, request) {
110
+ async parseResponse({ resp, ctx, request }) {
119
111
  const text = await resp.text();
120
112
  if (!resp.ok) {
121
113
  throw new Error(`${request.meta.tag} ${resp.status}: ${truncate(text, 240)}`);
@@ -139,7 +131,7 @@ const openAIImageAdapter = {
139
131
  else if (entry.url) {
140
132
  // Downloading already-generated bytes, not waiting on generation — UPLOAD-class (2min), not
141
133
  // the 10-minute GENERATE-class timeout the generation call itself uses above.
142
- const imgResp = await fetchWithTimeout(entry.url, withRequestInit(ctx), { timeoutMs: FETCH_TIMEOUT_MS.UPLOAD });
134
+ const imgResp = await assertAndFetchExternalAsset({ url: entry.url }, { ...ctx, init: withRequestInit(ctx) });
143
135
  if (!imgResp.ok)
144
136
  throw new Error(`openai image fetch ${imgResp.status}`);
145
137
  const arr = await imgResp.arrayBuffer();
@@ -155,13 +147,12 @@ const openAIImageAdapter = {
155
147
  };
156
148
  },
157
149
  };
158
- mediaVendorRegistry.register('openai', 'image', openAIImageAdapter);
159
- export async function renderOpenAIImage(ctx, credentials) {
160
- return dispatchVendorRequest(openAIImageAdapter, ctx, credentials);
150
+ export async function renderOpenAIImage({ ctx, credentials }) {
151
+ return dispatchVendorRequest({ adapter: openAIImageAdapter, ctx: ctx, credentials: credentials });
161
152
  }
162
153
  const openAISpeechAdapter = {
163
- requireCredential: requireApiKey(OPENAI_SPEECH_NO_CREDENTIAL_MESSAGE),
164
- buildRequest(ctx, credentials) {
154
+ requireCredential: requireApiKey({ message: OPENAI_SPEECH_NO_CREDENTIAL_MESSAGE }),
155
+ buildRequest({ ctx, credentials }) {
165
156
  const apiKey = credentials.apiKey; // requireCredential already validated this.
166
157
  const rawBase = credentials.baseUrl || 'https://api.openai.com/v1';
167
158
  const azure = detectAzureEndpoint(rawBase);
@@ -211,21 +202,25 @@ const openAISpeechAdapter = {
211
202
  };
212
203
  },
213
204
  parseResponse: createRawBytesParser({
214
- errorTag: (meta) => `${meta.tag} speech`,
205
+ errorTag: ({ meta }) => `${meta.tag} speech`,
215
206
  // Deliberately not azure-tag-aware — matches the origin exactly (see
216
207
  // this module's doc comment).
217
208
  zeroBytesMessage: 'openai speech returned zero bytes',
218
- note: (bytes, meta) => {
209
+ note: ({ bytes, meta }) => {
219
210
  const noteBits = [`${meta.tag}/${meta.wireModel}`, meta.voiceId, meta.format, `${bytes.length} bytes`];
220
211
  if (meta.instructions)
221
212
  noteBits.splice(2, 0, 'styled');
222
213
  return noteBits.join(' · ');
223
214
  },
224
- suggestedExt: (_bytes, meta) => (meta.format === 'opus' ? '.ogg' : `.${meta.format}`),
215
+ suggestedExt: ({ bytes: _bytes, meta }) => (meta.format === 'opus' ? '.ogg' : `.${meta.format}`),
225
216
  }),
226
217
  };
227
- mediaVendorRegistry.register('openai', 'audio:speech', openAISpeechAdapter);
228
- export async function renderOpenAISpeech(ctx, credentials) {
229
- return dispatchVendorRequest(openAISpeechAdapter, ctx, credentials);
218
+ export async function renderOpenAISpeech({ ctx, credentials }) {
219
+ return dispatchVendorRequest({ adapter: openAISpeechAdapter, ctx: ctx, credentials: credentials });
220
+ }
221
+ /** Explicit composition: importing a renderer never changes another module's registry. */
222
+ export function registerVendorAdapters({ registry }, _optional = {}) {
223
+ registry.register({ providerId: 'openai', routeKey: 'image', adapter: openAIImageAdapter });
224
+ registry.register({ providerId: 'openai', routeKey: 'audio:speech', adapter: openAISpeechAdapter });
230
225
  }
231
226
  //# sourceMappingURL=openai.js.map
@@ -1,4 +1,5 @@
1
1
  import type { ProviderCredentials, RenderContext, RenderResult } from '../types.js';
2
+ import type { VendorAdapterRegistry } from '../vendor-registry.js';
2
3
  /**
3
4
  * OpenRouter normalizes aspect ratios across the providers it fronts;
4
5
  * `providers.ts`'s `MEDIA_ASPECTS` are all natively supported, default to
@@ -8,6 +9,15 @@ import type { ProviderCredentials, RenderContext, RenderResult } from '../types.
8
9
  * `imageRouterSizeFor`) — same input -> output mapping for every case, not
9
10
  * a behavior change.
10
11
  */
11
- export declare function openRouterAspectFor(aspect: string | undefined): string;
12
- export declare function renderOpenRouterImage(ctx: RenderContext, credentials: ProviderCredentials): Promise<RenderResult>;
12
+ export declare function openRouterAspectFor({ aspect }: {
13
+ aspect: string | undefined;
14
+ }): string;
15
+ export declare function renderOpenRouterImage({ ctx, credentials }: {
16
+ ctx: RenderContext;
17
+ credentials: ProviderCredentials;
18
+ }): Promise<RenderResult>;
19
+ /** Explicit composition: importing a renderer never changes another module's registry. */
20
+ export declare function registerVendorAdapters({ registry }: {
21
+ registry: Pick<VendorAdapterRegistry, 'register'>;
22
+ }, _optional?: Record<string, never>): void;
13
23
  //# sourceMappingURL=openrouter.d.ts.map
@@ -4,7 +4,7 @@
4
4
  * `modalities: ["image"]`), not the dedicated `/images/generations` shape
5
5
  * OpenRouter's own *video* generation uses. Ported near-verbatim from Open
6
6
  * Design's `apps/daemon/src/media/index.ts` `renderOpenRouterImage` — see
7
- * `source-map.md`.
7
+ * `archived provenance ledger`.
8
8
  *
9
9
  * Not OpenAI-images-wire-compatible (chat-completions request shape;
10
10
  * `choices[0].message.images[].image_url.url` response shape), so this
@@ -30,10 +30,9 @@
30
30
  * base64) has no other current consumer, so it correctly stays a bespoke
31
31
  * `parseResponse`.
32
32
  */
33
- import { FETCH_TIMEOUT_MS, fetchWithTimeout } from '@jini-ai/platform';
33
+ import { assertAndFetchExternalAsset } from '../ssrf-guard.js';
34
34
  import { sniffImageExt, truncate, withRequestInit } from '../openai-compatible.js';
35
35
  import { dispatchVendorRequest, requireApiKey } from '../vendor-adapter.js';
36
- import { mediaVendorRegistry } from '../vendor-registry.js';
37
36
  // Chat-completions image generation can take a while for some routed
38
37
  // models; matches the same 10-minute ceiling `openai.ts`'s image dispatcher
39
38
  // uses for the same reason (see `OPENAI_IMAGE_HEADERS_TIMEOUT_MS`/
@@ -49,7 +48,7 @@ const OPENROUTER_IMAGE_TIMEOUT_MS = 10 * 60 * 1000;
49
48
  * `imageRouterSizeFor`) — same input -> output mapping for every case, not
50
49
  * a behavior change.
51
50
  */
52
- export function openRouterAspectFor(aspect) {
51
+ export function openRouterAspectFor({ aspect }) {
53
52
  if (aspect === '1:1')
54
53
  return '1:1';
55
54
  if (aspect === '16:9')
@@ -64,8 +63,8 @@ export function openRouterAspectFor(aspect) {
64
63
  }
65
64
  const NO_CREDENTIAL_MESSAGE = 'no OpenRouter API key — configure it or set OPENROUTER_API_KEY';
66
65
  const openRouterImageAdapter = {
67
- requireCredential: requireApiKey(NO_CREDENTIAL_MESSAGE),
68
- buildRequest(ctx, credentials) {
66
+ requireCredential: requireApiKey({ message: NO_CREDENTIAL_MESSAGE }),
67
+ buildRequest({ ctx, credentials }) {
69
68
  const apiKey = credentials.apiKey; // requireCredential already validated this.
70
69
  const baseUrl = (credentials.baseUrl || 'https://openrouter.ai/api/v1').replace(/\/$/, '');
71
70
  // credentials.model (a host's own model-aliasing layer) wins over
@@ -77,7 +76,7 @@ const openRouterImageAdapter = {
77
76
  // output; image-only models (Flux, Recraft, Sourceful) only accept
78
77
  // ["image"]. A simple heuristic on the slug, matching the origin.
79
78
  const modalities = wireModel.includes('gemini') ? ['image', 'text'] : ['image'];
80
- const aspectRatio = openRouterAspectFor(ctx.aspect);
79
+ const aspectRatio = openRouterAspectFor({ aspect: ctx.aspect });
81
80
  const body = {
82
81
  model: wireModel,
83
82
  messages: [{ role: 'user', content: ctx.prompt || 'A high-quality reference image.' }],
@@ -99,7 +98,7 @@ const openRouterImageAdapter = {
99
98
  meta: { wireModel, aspectRatio },
100
99
  };
101
100
  },
102
- async parseResponse(resp, ctx, request) {
101
+ async parseResponse({ resp, ctx, request }) {
103
102
  const { wireModel, aspectRatio } = request.meta;
104
103
  const text = await resp.text();
105
104
  if (!resp.ok) {
@@ -130,7 +129,7 @@ const openRouterImageAdapter = {
130
129
  else if (dataUrl.startsWith('http')) {
131
130
  // Downloading already-generated bytes, not waiting on generation — UPLOAD-class (2min), not
132
131
  // the 10-minute GENERATE-class timeout the chat-completions call itself uses above.
133
- const imgResp = await fetchWithTimeout(dataUrl, withRequestInit(ctx), { timeoutMs: FETCH_TIMEOUT_MS.UPLOAD });
132
+ const imgResp = await assertAndFetchExternalAsset({ url: dataUrl }, { ...ctx, init: withRequestInit(ctx) });
134
133
  if (!imgResp.ok)
135
134
  throw new Error(`openrouter image download ${imgResp.status}`);
136
135
  bytes = Buffer.from(await imgResp.arrayBuffer());
@@ -145,8 +144,11 @@ const openRouterImageAdapter = {
145
144
  };
146
145
  },
147
146
  };
148
- mediaVendorRegistry.register('openrouter', 'image', openRouterImageAdapter);
149
- export async function renderOpenRouterImage(ctx, credentials) {
150
- return dispatchVendorRequest(openRouterImageAdapter, ctx, credentials);
147
+ export async function renderOpenRouterImage({ ctx, credentials }) {
148
+ return dispatchVendorRequest({ adapter: openRouterImageAdapter, ctx: ctx, credentials: credentials });
149
+ }
150
+ /** Explicit composition: importing a renderer never changes another module's registry. */
151
+ export function registerVendorAdapters({ registry }, _optional = {}) {
152
+ registry.register({ providerId: 'openrouter', routeKey: 'image', adapter: openRouterImageAdapter });
151
153
  }
152
154
  //# sourceMappingURL=openrouter.js.map
@@ -1,4 +1,15 @@
1
1
  import type { ProviderCredentials, RenderContext, RenderResult } from '../types.js';
2
- export declare function renderSenseAudioTTS(ctx: RenderContext, credentials: ProviderCredentials): Promise<RenderResult>;
3
- export declare function renderSenseAudioImage(ctx: RenderContext, credentials: ProviderCredentials): Promise<RenderResult>;
2
+ import type { VendorAdapterRegistry } from '../vendor-registry.js';
3
+ export declare function renderSenseAudioTTS({ ctx, credentials }: {
4
+ ctx: RenderContext;
5
+ credentials: ProviderCredentials;
6
+ }): Promise<RenderResult>;
7
+ export declare function renderSenseAudioImage({ ctx, credentials }: {
8
+ ctx: RenderContext;
9
+ credentials: ProviderCredentials;
10
+ }): Promise<RenderResult>;
11
+ /** Explicit composition: importing a renderer never changes another module's registry. */
12
+ export declare function registerVendorAdapters({ registry }: {
13
+ registry: Pick<VendorAdapterRegistry, 'register'>;
14
+ }, _optional?: Record<string, never>): void;
4
15
  //# sourceMappingURL=senseaudio.d.ts.map
@@ -4,7 +4,7 @@
4
4
  * (`renderSenseAudioImage`, `POST /v1/image/sync`), both synchronous.
5
5
  * Ported near-verbatim from Open Design's
6
6
  * `apps/daemon/src/media/index.ts` `renderSenseAudioTTS`/
7
- * `renderSenseAudioImage` — see `source-map.md`.
7
+ * `renderSenseAudioImage` — see `archived provenance ledger`.
8
8
  *
9
9
  * 2026-07-21: migrated onto the generic vendor-adapter dispatch engine
10
10
  * (`vendor-adapter.ts`/`vendor-registry.ts`). External behavior (URLs,
@@ -47,7 +47,6 @@ import { truncate, withRequestInit } from '../openai-compatible.js';
47
47
  import { createHexEnvelopeAudioParser } from '../response-parsers.js';
48
48
  import { assertAndFetchExternalAsset } from '../ssrf-guard.js';
49
49
  import { dispatchVendorRequest, requireApiKey } from '../vendor-adapter.js';
50
- import { mediaVendorRegistry } from '../vendor-registry.js';
51
50
  const SENSEAUDIO_DEFAULT_BASE_URL = 'https://api.senseaudio.cn';
52
51
  const SENSEAUDIO_DEFAULT_VOICE_ID = 'female_0033_b';
53
52
  const SENSEAUDIO_IMAGE_PROMPT_LIMIT = 2000;
@@ -56,8 +55,8 @@ const SENSEAUDIO_TTS_MODEL_MAP = {
56
55
  };
57
56
  const NO_CREDENTIAL_MESSAGE = 'no SenseAudio credential — configure an API key or set SENSEAUDIO_API_KEY.';
58
57
  const senseAudioTTSAdapter = {
59
- requireCredential: requireApiKey(NO_CREDENTIAL_MESSAGE),
60
- buildRequest(ctx, credentials) {
58
+ requireCredential: requireApiKey({ message: NO_CREDENTIAL_MESSAGE }),
59
+ buildRequest({ ctx, credentials }) {
61
60
  const apiKey = credentials.apiKey; // requireCredential already validated this.
62
61
  const baseUrl = (credentials.baseUrl || SENSEAUDIO_DEFAULT_BASE_URL).replace(/\/$/, '');
63
62
  const wireModel = SENSEAUDIO_TTS_MODEL_MAP[ctx.model] || ctx.model;
@@ -95,9 +94,8 @@ const senseAudioTTSAdapter = {
95
94
  },
96
95
  parseResponse: createHexEnvelopeAudioParser({ errorTag: 'senseaudio tts', providerId: 'senseaudio' }),
97
96
  };
98
- mediaVendorRegistry.register('senseaudio', 'audio:speech', senseAudioTTSAdapter);
99
- export async function renderSenseAudioTTS(ctx, credentials) {
100
- return dispatchVendorRequest(senseAudioTTSAdapter, ctx, credentials);
97
+ export async function renderSenseAudioTTS({ ctx, credentials }) {
98
+ return dispatchVendorRequest({ adapter: senseAudioTTSAdapter, ctx: ctx, credentials: credentials });
101
99
  }
102
100
  /** SenseAudio's image gateway rejects non-standard pixel sizes with a 400; keep this mapping in sync with any other SenseAudio-image call site a future host adds. */
103
101
  function senseAudioImageSize(aspect) {
@@ -112,8 +110,8 @@ function senseAudioImageSize(aspect) {
112
110
  return '1024x1024';
113
111
  }
114
112
  const senseAudioImageAdapter = {
115
- requireCredential: requireApiKey(NO_CREDENTIAL_MESSAGE),
116
- buildRequest(ctx, credentials) {
113
+ requireCredential: requireApiKey({ message: NO_CREDENTIAL_MESSAGE }),
114
+ buildRequest({ ctx, credentials }) {
117
115
  const apiKey = credentials.apiKey; // requireCredential already validated this.
118
116
  const baseUrl = (credentials.baseUrl || SENSEAUDIO_DEFAULT_BASE_URL).replace(/\/$/, '');
119
117
  const promptRaw = (ctx.prompt && ctx.prompt.trim()) || 'A high-quality reference image.';
@@ -146,7 +144,7 @@ const senseAudioImageAdapter = {
146
144
  meta: { size, hasReference: Boolean(reference) },
147
145
  };
148
146
  },
149
- async parseResponse(resp, ctx, request) {
147
+ async parseResponse({ resp, ctx, request }) {
150
148
  const respText = await resp.text();
151
149
  if (!resp.ok) {
152
150
  throw new Error(`senseaudio image ${resp.status}: ${truncate(respText, 240)}`);
@@ -168,7 +166,7 @@ const senseAudioImageAdapter = {
168
166
  if (!url) {
169
167
  throw new Error('senseaudio image response missing url');
170
168
  }
171
- const imgResp = await assertAndFetchExternalAsset(url, withRequestInit(ctx));
169
+ const imgResp = await assertAndFetchExternalAsset({ url: url }, { ...ctx, init: withRequestInit(ctx) });
172
170
  if (!imgResp.ok) {
173
171
  throw new Error(`senseaudio image fetch ${imgResp.status}`);
174
172
  }
@@ -183,8 +181,12 @@ const senseAudioImageAdapter = {
183
181
  };
184
182
  },
185
183
  };
186
- mediaVendorRegistry.register('senseaudio', 'image', senseAudioImageAdapter);
187
- export async function renderSenseAudioImage(ctx, credentials) {
188
- return dispatchVendorRequest(senseAudioImageAdapter, ctx, credentials);
184
+ export async function renderSenseAudioImage({ ctx, credentials }) {
185
+ return dispatchVendorRequest({ adapter: senseAudioImageAdapter, ctx: ctx, credentials: credentials });
186
+ }
187
+ /** Explicit composition: importing a renderer never changes another module's registry. */
188
+ export function registerVendorAdapters({ registry }, _optional = {}) {
189
+ registry.register({ providerId: 'senseaudio', routeKey: 'audio:speech', adapter: senseAudioTTSAdapter });
190
+ registry.register({ providerId: 'senseaudio', routeKey: 'image', adapter: senseAudioImageAdapter });
189
191
  }
190
192
  //# sourceMappingURL=senseaudio.js.map
@@ -1,3 +1,11 @@
1
1
  import type { ProviderCredentials, RenderContext, RenderResult } from '../types.js';
2
- export declare function renderVolcengineImage(ctx: RenderContext, credentials: ProviderCredentials): Promise<RenderResult>;
2
+ import type { VendorAdapterRegistry } from '../vendor-registry.js';
3
+ export declare function renderVolcengineImage({ ctx, credentials }: {
4
+ ctx: RenderContext;
5
+ credentials: ProviderCredentials;
6
+ }): Promise<RenderResult>;
7
+ /** Explicit composition: importing a renderer never changes another module's registry. */
8
+ export declare function registerVendorAdapters({ registry }: {
9
+ registry: Pick<VendorAdapterRegistry, 'register'>;
10
+ }, _optional?: Record<string, never>): void;
3
11
  //# sourceMappingURL=volcengine.d.ts.map
@@ -2,7 +2,7 @@
2
2
  * Provider: Volcengine Ark (Doubao) — Seedream / Seededit image generation
3
3
  * via an OpenAI-images-compatible `/images/generations` endpoint. Ported
4
4
  * near-verbatim from Open Design's `apps/daemon/src/media/index.ts`
5
- * `renderVolcengineImage` — see `source-map.md`.
5
+ * `renderVolcengineImage` — see `archived provenance ledger`.
6
6
  *
7
7
  * The response shape (`{ data: [{ b64_json | url }] }`) matches OpenAI's
8
8
  * images API, so this routes through `openai-compatible.ts`'s already-
@@ -48,11 +48,10 @@
48
48
  */
49
49
  import { buildOpenAIImageUrl, bytesFromOpenAICompatibleData, openaiSizeFor, parseOpenAICompatibleJson, withRequestInit } from '../openai-compatible.js';
50
50
  import { dispatchVendorRequest, requireApiKey } from '../vendor-adapter.js';
51
- import { mediaVendorRegistry } from '../vendor-registry.js';
52
51
  const NO_CREDENTIAL_MESSAGE = 'no Volcengine Ark credential — configure an API key or set ARK_API_KEY.';
53
52
  const volcengineImageAdapter = {
54
- requireCredential: requireApiKey(NO_CREDENTIAL_MESSAGE),
55
- buildRequest(ctx, credentials) {
53
+ requireCredential: requireApiKey({ message: NO_CREDENTIAL_MESSAGE }),
54
+ buildRequest({ ctx, credentials }) {
56
55
  const apiKey = credentials.apiKey; // requireCredential already validated this.
57
56
  const baseUrl = (credentials.baseUrl || 'https://ark.cn-beijing.volces.com/api/v3').replace(/\/$/, '');
58
57
  const body = {
@@ -78,9 +77,9 @@ const volcengineImageAdapter = {
78
77
  meta: undefined,
79
78
  };
80
79
  },
81
- async parseResponse(resp, ctx) {
80
+ async parseResponse({ resp, ctx }) {
82
81
  const data = await parseOpenAICompatibleJson(resp, 'volcengine image');
83
- const bytes = await bytesFromOpenAICompatibleData(data, 'volcengine image', ctx.requestInit);
82
+ const bytes = await bytesFromOpenAICompatibleData({ data, providerTag: 'volcengine image' }, ctx);
84
83
  return {
85
84
  bytes,
86
85
  providerNote: `volcengine/${ctx.wireModel} · ${ctx.aspect} · ${bytes.length} bytes`,
@@ -88,8 +87,11 @@ const volcengineImageAdapter = {
88
87
  };
89
88
  },
90
89
  };
91
- mediaVendorRegistry.register('volcengine', 'image', volcengineImageAdapter);
92
- export async function renderVolcengineImage(ctx, credentials) {
93
- return dispatchVendorRequest(volcengineImageAdapter, ctx, credentials);
90
+ export async function renderVolcengineImage({ ctx, credentials }) {
91
+ return dispatchVendorRequest({ adapter: volcengineImageAdapter, ctx: ctx, credentials: credentials });
92
+ }
93
+ /** Explicit composition: importing a renderer never changes another module's registry. */
94
+ export function registerVendorAdapters({ registry }, _optional = {}) {
95
+ registry.register({ providerId: 'volcengine', routeKey: 'image', adapter: volcengineImageAdapter });
94
96
  }
95
97
  //# sourceMappingURL=volcengine.js.map
@@ -1,14 +1,24 @@
1
1
  import type { VendorResponseParser } from './vendor-adapter.js';
2
- type Resolvable<T, Args extends readonly unknown[]> = T | ((...args: Args) => T);
2
+ type Resolvable<T, Args extends object> = T | ((required: Args) => T);
3
3
  export interface RawBytesParserOptions<Meta> {
4
4
  /** Used in the `${tag} ${status}: ${truncated body}` message thrown on a non-OK response. A function receives the request's `meta` (e.g. so a dynamically-computed azure/non-azure tag survives the port — see `providers/openai.ts`). */
5
- readonly errorTag: Resolvable<string, [meta: Meta]>;
5
+ readonly errorTag: Resolvable<string, {
6
+ meta: Meta;
7
+ }>;
6
8
  /** Thrown verbatim when the response body decodes to zero bytes. */
7
- readonly zeroBytesMessage: Resolvable<string, [meta: Meta]>;
9
+ readonly zeroBytesMessage: Resolvable<string, {
10
+ meta: Meta;
11
+ }>;
8
12
  /** Builds the successful `RenderResult.providerNote`. */
9
- readonly note: (bytes: Buffer, meta: Meta) => string;
13
+ readonly note: (required: {
14
+ bytes: Buffer;
15
+ meta: Meta;
16
+ }) => string;
10
17
  /** The successful `RenderResult.suggestedExt`. */
11
- readonly suggestedExt: Resolvable<string, [bytes: Buffer, meta: Meta]>;
18
+ readonly suggestedExt: Resolvable<string, {
19
+ bytes: Buffer;
20
+ meta: Meta;
21
+ }>;
12
22
  }
13
23
  /**
14
24
  * A `VendorResponseParser` for vendors that return raw bytes directly (no
@@ -36,8 +46,12 @@ export interface HexEnvelopeAudioParserOptions {
36
46
  * a *logical* failure) — the exact shape MiniMax's and SenseAudio's TTS
37
47
  * endpoints both independently return, verified identical (down to the
38
48
  * literal error-message templates) by reading both origin renderers in
39
- * full. `extra_info.audio_length` is centiseconds; `seconds` is `'?'` when
40
- * absent, matching both vendors' own formatting.
49
+ * full. `extra_info.audio_length` is milliseconds; the note rounds it to
50
+ * tenths of a second. `seconds` is `'?'` when absent, matching both vendors'
51
+ * own formatting. MiniMax's `/v1/t2a_v2` response contract is documented at
52
+ * https://platform.minimax.io/docs/api-reference/speech-t2a-http; the explicit
53
+ * field units are also listed by its hosted API adapter at
54
+ * https://help.aliyun.com/zh/model-studio/minimax-synchronous-speech-synthesis-api.
41
55
  */
42
56
  export declare function createHexEnvelopeAudioParser<Meta extends HexEnvelopeAudioMeta>(options: HexEnvelopeAudioParserOptions): VendorResponseParser<Meta>;
43
57
  export {};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Reusable `VendorResponseParser` factories for the two response shapes
3
3
  * that genuinely repeat, byte-for-byte, across multiple already-ported
4
- * vendors (verified by reading their real bodies — see `source-map.md`'s
4
+ * vendors (verified by reading their real bodies — see `archived provenance ledger`'s
5
5
  * 2026-07-21 dispatch-engine-generalization section, not assumed from
6
6
  * their doc comments alone):
7
7
  *
@@ -10,7 +10,7 @@
10
10
  * `renderFishAudioTTS` and `providers/openai.ts`'s `renderOpenAISpeech`.
11
11
  * xAI TTS (`grok.ts`'s `renderXAITTS`) and ElevenLabs's two renderers
12
12
  * have the identical shape and are natural future migrations onto this
13
- * same parser, not yet done this pass (see source-map.md for why).
13
+ * same parser, not yet done this pass (see archived provenance ledger for why).
14
14
  * - `createHexEnvelopeAudioParser` — "POST JSON, get hex-encoded audio back
15
15
  * inside a `base_resp`-enveloped JSON body" — used today by
16
16
  * `providers/minimax.ts` and `providers/senseaudio.ts`'s TTS renderers,
@@ -30,7 +30,7 @@
30
30
  */
31
31
  import { truncate } from './openai-compatible.js';
32
32
  function resolve(value, args) {
33
- return typeof value === 'function' ? value(...args) : value;
33
+ return typeof value === 'function' ? value(args) : value;
34
34
  }
35
35
  /**
36
36
  * A `VendorResponseParser` for vendors that return raw bytes directly (no
@@ -41,20 +41,20 @@ function resolve(value, args) {
41
41
  * `renderOpenAISpeech` each independently hand-wrote before this pass.
42
42
  */
43
43
  export function createRawBytesParser(options) {
44
- return async (resp, _ctx, request) => {
44
+ return async ({ resp, request }) => {
45
45
  if (!resp.ok) {
46
46
  const text = await resp.text();
47
- const tag = resolve(options.errorTag, [request.meta]);
47
+ const tag = resolve(options.errorTag, { meta: request.meta });
48
48
  throw new Error(`${tag} ${resp.status}: ${truncate(text, 240)}`);
49
49
  }
50
50
  const bytes = Buffer.from(await resp.arrayBuffer());
51
51
  if (bytes.length === 0) {
52
- throw new Error(resolve(options.zeroBytesMessage, [request.meta]));
52
+ throw new Error(resolve(options.zeroBytesMessage, { meta: request.meta }));
53
53
  }
54
54
  return {
55
55
  bytes,
56
- providerNote: options.note(bytes, request.meta),
57
- suggestedExt: resolve(options.suggestedExt, [bytes, request.meta]),
56
+ providerNote: options.note({ bytes, meta: request.meta }),
57
+ suggestedExt: resolve(options.suggestedExt, { bytes, meta: request.meta }),
58
58
  };
59
59
  };
60
60
  }
@@ -64,11 +64,15 @@ export function createRawBytesParser(options) {
64
64
  * a *logical* failure) — the exact shape MiniMax's and SenseAudio's TTS
65
65
  * endpoints both independently return, verified identical (down to the
66
66
  * literal error-message templates) by reading both origin renderers in
67
- * full. `extra_info.audio_length` is centiseconds; `seconds` is `'?'` when
68
- * absent, matching both vendors' own formatting.
67
+ * full. `extra_info.audio_length` is milliseconds; the note rounds it to
68
+ * tenths of a second. `seconds` is `'?'` when absent, matching both vendors'
69
+ * own formatting. MiniMax's `/v1/t2a_v2` response contract is documented at
70
+ * https://platform.minimax.io/docs/api-reference/speech-t2a-http; the explicit
71
+ * field units are also listed by its hosted API adapter at
72
+ * https://help.aliyun.com/zh/model-studio/minimax-synchronous-speech-synthesis-api.
69
73
  */
70
74
  export function createHexEnvelopeAudioParser(options) {
71
- return async (resp, _ctx, request) => {
75
+ return async ({ resp, request }) => {
72
76
  const respText = await resp.text();
73
77
  if (!resp.ok) {
74
78
  throw new Error(`${options.errorTag} ${resp.status}: ${truncate(respText, 240)}`);
@@ -12,5 +12,7 @@ export interface SqliteAsyncOperationStore extends AsyncOperationStore {
12
12
  * operation exactly as it was left, and `recoverAfterRestart`/`reconcileOnBoot` can then release
13
13
  * dead leases and expire blown deadlines.
14
14
  */
15
- export declare function createSqliteAsyncOperationStore(dbPath: string): Promise<SqliteAsyncOperationStore>;
15
+ export declare function createSqliteAsyncOperationStore({ dbPath }: {
16
+ dbPath: string;
17
+ }): Promise<SqliteAsyncOperationStore>;
16
18
  //# sourceMappingURL=sqlite-async-operation-store.d.ts.map