@jini-ai/integrations 0.3.5 → 0.4.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.
- package/CHANGELOG.md +84 -0
- package/README.md +72 -24
- package/dist/args.d.ts +8 -0
- package/dist/args.js +10 -0
- package/dist/argument-error.d.ts +9 -0
- package/dist/argument-error.js +7 -0
- package/dist/credentialed-http/auth-schemes.d.ts +29 -0
- package/dist/credentialed-http/auth-schemes.js +60 -0
- package/dist/credentialed-http/credentialed-request.d.ts +132 -0
- package/dist/credentialed-http/credentialed-request.js +365 -0
- package/dist/credentialed-http/index.d.ts +4 -0
- package/dist/credentialed-http/index.js +4 -0
- package/dist/credentialed-http/ports.d.ts +42 -0
- package/dist/credentialed-http/ports.js +2 -0
- package/dist/media-providers/capability-registry.d.ts +12 -4
- package/dist/media-providers/capability-registry.js +6 -6
- package/dist/media-providers/dispatch/async-operation-store.d.ts +33 -8
- package/dist/media-providers/dispatch/async-operation-store.js +20 -32
- package/dist/media-providers/dispatch/context.d.ts +7 -2
- package/dist/media-providers/dispatch/context.js +1 -1
- package/dist/media-providers/dispatch/credentials.d.ts +4 -1
- package/dist/media-providers/dispatch/credentials.js +1 -1
- package/dist/media-providers/dispatch/engine.d.ts +5 -2
- package/dist/media-providers/dispatch/engine.js +23 -15
- package/dist/media-providers/dispatch/index.d.ts +4 -1
- package/dist/media-providers/dispatch/index.js +4 -2
- package/dist/media-providers/dispatch/openai-compatible.d.ts +12 -2
- package/dist/media-providers/dispatch/openai-compatible.js +9 -5
- package/dist/media-providers/dispatch/operation-runtime.d.ts +16 -8
- package/dist/media-providers/dispatch/operation-runtime.js +93 -76
- package/dist/media-providers/dispatch/outbound.d.ts +31 -0
- package/dist/media-providers/dispatch/outbound.js +54 -0
- package/dist/media-providers/dispatch/polling-adapter.d.ts +26 -8
- package/dist/media-providers/dispatch/polling-adapter.js +2 -2
- package/dist/media-providers/dispatch/providers/aihubmix-shared.d.ts +2 -2
- package/dist/media-providers/dispatch/providers/aihubmix-shared.js +2 -2
- package/dist/media-providers/dispatch/providers/aihubmix.d.ts +8 -2
- package/dist/media-providers/dispatch/providers/aihubmix.js +15 -15
- package/dist/media-providers/dispatch/providers/custom-image.d.ts +11 -2
- package/dist/media-providers/dispatch/providers/custom-image.js +9 -8
- package/dist/media-providers/dispatch/providers/elevenlabs.d.ts +8 -2
- package/dist/media-providers/dispatch/providers/elevenlabs.js +13 -13
- package/dist/media-providers/dispatch/providers/fishaudio.d.ts +4 -1
- package/dist/media-providers/dispatch/providers/fishaudio.js +7 -7
- package/dist/media-providers/dispatch/providers/grok.d.ts +11 -3
- package/dist/media-providers/dispatch/providers/grok.js +16 -16
- package/dist/media-providers/dispatch/providers/imagerouter-video-async.d.ts +1 -1
- package/dist/media-providers/dispatch/providers/imagerouter-video-async.js +23 -22
- package/dist/media-providers/dispatch/providers/imagerouter.d.ts +12 -3
- package/dist/media-providers/dispatch/providers/imagerouter.js +18 -18
- package/dist/media-providers/dispatch/providers/minimax.d.ts +4 -1
- package/dist/media-providers/dispatch/providers/minimax.js +6 -6
- package/dist/media-providers/dispatch/providers/nanobanana.d.ts +4 -1
- package/dist/media-providers/dispatch/providers/nanobanana.js +7 -7
- package/dist/media-providers/dispatch/providers/openai.d.ts +8 -2
- package/dist/media-providers/dispatch/providers/openai.js +20 -27
- package/dist/media-providers/dispatch/providers/openrouter.d.ts +7 -2
- package/dist/media-providers/dispatch/providers/openrouter.js +11 -11
- package/dist/media-providers/dispatch/providers/senseaudio.d.ts +8 -2
- package/dist/media-providers/dispatch/providers/senseaudio.js +13 -13
- package/dist/media-providers/dispatch/providers/volcengine.d.ts +4 -1
- package/dist/media-providers/dispatch/providers/volcengine.js +8 -8
- package/dist/media-providers/dispatch/response-parsers.d.ts +21 -7
- package/dist/media-providers/dispatch/response-parsers.js +15 -11
- package/dist/media-providers/dispatch/sqlite-async-operation-store.d.ts +3 -1
- package/dist/media-providers/dispatch/sqlite-async-operation-store.js +53 -39
- package/dist/media-providers/dispatch/ssrf-guard.d.ts +27 -14
- package/dist/media-providers/dispatch/ssrf-guard.js +46 -105
- package/dist/media-providers/dispatch/stub.d.ts +7 -2
- package/dist/media-providers/dispatch/stub.js +4 -3
- package/dist/media-providers/dispatch/types.d.ts +17 -13
- package/dist/media-providers/dispatch/vendor-adapter.d.ts +22 -5
- package/dist/media-providers/dispatch/vendor-adapter.js +13 -10
- package/dist/media-providers/dispatch/vendor-registry.d.ts +14 -4
- package/dist/media-providers/dispatch/vendor-registry.js +3 -3
- package/dist/media-providers/index.d.ts +1 -1
- package/dist/media-providers/index.js +1 -1
- package/dist/media-providers/policy.d.ts +3 -2
- package/dist/media-providers/policy.js +4 -2
- package/dist/media-providers/providers.d.ts +12 -4
- package/dist/media-providers/providers.js +3 -3
- package/dist/media-providers/staging.d.ts +8 -2
- package/dist/media-providers/staging.js +13 -4
- package/dist/media-providers/task-store.d.ts +2 -2
- package/dist/media-providers/task-store.js +2 -2
- package/dist/media-providers/tokens.js +3 -3
- package/dist/media-providers/types.d.ts +4 -4
- package/dist/media-providers/types.js +1 -1
- package/dist/media-providers/video-request.d.ts +32 -9
- package/dist/media-providers/video-request.js +15 -15
- package/dist/webhooks/delivery.d.ts +76 -0
- package/dist/webhooks/delivery.js +222 -0
- package/dist/webhooks/index.d.ts +7 -0
- package/dist/webhooks/index.js +7 -0
- package/dist/webhooks/ports.d.ts +113 -0
- package/dist/webhooks/ports.js +2 -0
- package/dist/webhooks/signing.d.ts +38 -0
- package/dist/webhooks/signing.js +83 -0
- package/dist/webhooks/signing.keyring.d.ts +8 -0
- package/dist/webhooks/signing.keyring.js +18 -0
- package/dist/webhooks/subscriptions.d.ts +78 -0
- package/dist/webhooks/subscriptions.js +139 -0
- package/dist/webhooks/types.d.ts +103 -0
- package/dist/webhooks/types.js +2 -0
- package/package.json +29 -18
- package/dist/composio/bounded-data.d.ts.map +0 -1
- package/dist/composio/bounded-data.js.map +0 -1
- package/dist/composio/catalog.d.ts.map +0 -1
- package/dist/composio/catalog.js.map +0 -1
- package/dist/composio/composio-config.d.ts.map +0 -1
- package/dist/composio/composio-config.js.map +0 -1
- package/dist/composio/composio-descriptions.d.ts.map +0 -1
- package/dist/composio/composio-descriptions.js.map +0 -1
- package/dist/composio/composio.d.ts.map +0 -1
- package/dist/composio/composio.js.map +0 -1
- package/dist/composio/errors.d.ts.map +0 -1
- package/dist/composio/errors.js.map +0 -1
- package/dist/composio/file-lock.d.ts.map +0 -1
- package/dist/composio/file-lock.js.map +0 -1
- package/dist/composio/index.d.ts.map +0 -1
- package/dist/composio/index.js.map +0 -1
- package/dist/composio/json-schema.d.ts.map +0 -1
- package/dist/composio/json-schema.js.map +0 -1
- package/dist/composio/output-protection.d.ts.map +0 -1
- package/dist/composio/output-protection.js.map +0 -1
- package/dist/composio/service.d.ts.map +0 -1
- package/dist/composio/service.js.map +0 -1
- package/dist/media-providers/capability-registry.d.ts.map +0 -1
- package/dist/media-providers/capability-registry.js.map +0 -1
- package/dist/media-providers/catalog.d.ts.map +0 -1
- package/dist/media-providers/catalog.js.map +0 -1
- package/dist/media-providers/dispatch/async-operation-store.d.ts.map +0 -1
- package/dist/media-providers/dispatch/async-operation-store.js.map +0 -1
- package/dist/media-providers/dispatch/context.d.ts.map +0 -1
- package/dist/media-providers/dispatch/context.js.map +0 -1
- package/dist/media-providers/dispatch/credentials.d.ts.map +0 -1
- package/dist/media-providers/dispatch/credentials.js.map +0 -1
- package/dist/media-providers/dispatch/engine.d.ts.map +0 -1
- package/dist/media-providers/dispatch/engine.js.map +0 -1
- package/dist/media-providers/dispatch/index.d.ts.map +0 -1
- package/dist/media-providers/dispatch/index.js.map +0 -1
- package/dist/media-providers/dispatch/openai-compatible.d.ts.map +0 -1
- package/dist/media-providers/dispatch/openai-compatible.js.map +0 -1
- package/dist/media-providers/dispatch/operation-runtime.d.ts.map +0 -1
- package/dist/media-providers/dispatch/operation-runtime.js.map +0 -1
- package/dist/media-providers/dispatch/polling-adapter.d.ts.map +0 -1
- package/dist/media-providers/dispatch/polling-adapter.js.map +0 -1
- package/dist/media-providers/dispatch/providers/aihubmix-shared.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/aihubmix-shared.js.map +0 -1
- package/dist/media-providers/dispatch/providers/aihubmix.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/aihubmix.js.map +0 -1
- package/dist/media-providers/dispatch/providers/custom-image.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/custom-image.js.map +0 -1
- package/dist/media-providers/dispatch/providers/elevenlabs.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/elevenlabs.js.map +0 -1
- package/dist/media-providers/dispatch/providers/fishaudio.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/fishaudio.js.map +0 -1
- package/dist/media-providers/dispatch/providers/grok.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/grok.js.map +0 -1
- package/dist/media-providers/dispatch/providers/imagerouter-video-async.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/imagerouter-video-async.js.map +0 -1
- package/dist/media-providers/dispatch/providers/imagerouter.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/imagerouter.js.map +0 -1
- package/dist/media-providers/dispatch/providers/minimax.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/minimax.js.map +0 -1
- package/dist/media-providers/dispatch/providers/nanobanana.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/nanobanana.js.map +0 -1
- package/dist/media-providers/dispatch/providers/openai.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/openai.js.map +0 -1
- package/dist/media-providers/dispatch/providers/openrouter.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/openrouter.js.map +0 -1
- package/dist/media-providers/dispatch/providers/senseaudio.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/senseaudio.js.map +0 -1
- package/dist/media-providers/dispatch/providers/volcengine.d.ts.map +0 -1
- package/dist/media-providers/dispatch/providers/volcengine.js.map +0 -1
- package/dist/media-providers/dispatch/response-parsers.d.ts.map +0 -1
- package/dist/media-providers/dispatch/response-parsers.js.map +0 -1
- package/dist/media-providers/dispatch/sqlite-async-operation-store.d.ts.map +0 -1
- package/dist/media-providers/dispatch/sqlite-async-operation-store.js.map +0 -1
- package/dist/media-providers/dispatch/ssrf-guard.d.ts.map +0 -1
- package/dist/media-providers/dispatch/ssrf-guard.js.map +0 -1
- package/dist/media-providers/dispatch/stub.d.ts.map +0 -1
- package/dist/media-providers/dispatch/stub.js.map +0 -1
- package/dist/media-providers/dispatch/types.d.ts.map +0 -1
- package/dist/media-providers/dispatch/types.js.map +0 -1
- package/dist/media-providers/dispatch/vendor-adapter.d.ts.map +0 -1
- package/dist/media-providers/dispatch/vendor-adapter.js.map +0 -1
- package/dist/media-providers/dispatch/vendor-registry.d.ts.map +0 -1
- package/dist/media-providers/dispatch/vendor-registry.js.map +0 -1
- package/dist/media-providers/index.d.ts.map +0 -1
- package/dist/media-providers/index.js.map +0 -1
- package/dist/media-providers/policy.d.ts.map +0 -1
- package/dist/media-providers/policy.js.map +0 -1
- package/dist/media-providers/providers.d.ts.map +0 -1
- package/dist/media-providers/providers.js.map +0 -1
- package/dist/media-providers/seed.d.ts.map +0 -1
- package/dist/media-providers/seed.js.map +0 -1
- package/dist/media-providers/sqlite-task-store.d.ts.map +0 -1
- package/dist/media-providers/sqlite-task-store.js.map +0 -1
- package/dist/media-providers/staging.d.ts.map +0 -1
- package/dist/media-providers/staging.js.map +0 -1
- package/dist/media-providers/task-store.d.ts.map +0 -1
- package/dist/media-providers/task-store.js.map +0 -1
- package/dist/media-providers/tokens.d.ts.map +0 -1
- package/dist/media-providers/tokens.js.map +0 -1
- package/dist/media-providers/types.d.ts.map +0 -1
- package/dist/media-providers/types.js.map +0 -1
- package/dist/media-providers/video-request.d.ts.map +0 -1
- package/dist/media-providers/video-request.js.map +0 -1
|
@@ -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 `
|
|
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,22 @@
|
|
|
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 {
|
|
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
50
|
import { mediaVendorRegistry } from '../vendor-registry.js';
|
|
52
51
|
// Image generation can legitimately take minutes (gpt-image-2 4K renders
|
|
53
|
-
// especially).
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
// override via `requestInit.dispatcher`.
|
|
52
|
+
// especially). The guarded client owns the socket and deadline budgets,
|
|
53
|
+
// so a caller-configured global fetch default cannot cut a legitimately
|
|
54
|
+
// slow-but-succeeding generation short. Pooling belongs to the injected guarded client.
|
|
57
55
|
const OPENAI_IMAGE_HEADERS_TIMEOUT_MS = 10 * 60 * 1000;
|
|
58
56
|
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
57
|
const OPENAI_IMAGE_NO_CREDENTIAL_MESSAGE = 'no OpenAI credential — configure an API key or set OPENAI_API_KEY.';
|
|
64
58
|
const OPENAI_SPEECH_NO_CREDENTIAL_MESSAGE = 'no OpenAI credential — configure an API key or set OPENAI_API_KEY';
|
|
65
59
|
const openAIImageAdapter = {
|
|
66
|
-
requireCredential: requireApiKey(OPENAI_IMAGE_NO_CREDENTIAL_MESSAGE),
|
|
67
|
-
buildRequest(ctx, credentials) {
|
|
60
|
+
requireCredential: requireApiKey({ message: OPENAI_IMAGE_NO_CREDENTIAL_MESSAGE }),
|
|
61
|
+
buildRequest({ ctx, credentials }) {
|
|
68
62
|
const apiKey = credentials.apiKey; // requireCredential already validated this.
|
|
69
63
|
const rawBase = credentials.baseUrl || 'https://api.openai.com/v1';
|
|
70
64
|
const azure = detectAzureEndpoint(rawBase);
|
|
@@ -109,13 +103,12 @@ const openAIImageAdapter = {
|
|
|
109
103
|
method: 'POST',
|
|
110
104
|
headers,
|
|
111
105
|
body: JSON.stringify(body),
|
|
112
|
-
dispatcher: ctx.requestInit.dispatcher ?? openAIImageDispatcher,
|
|
113
106
|
signal: AbortSignal.timeout(Math.max(OPENAI_IMAGE_HEADERS_TIMEOUT_MS, OPENAI_IMAGE_BODY_TIMEOUT_MS)),
|
|
114
107
|
}),
|
|
115
108
|
meta: { tag: azure ? 'azure-openai' : 'openai', wireModel: ctx.wireModel },
|
|
116
109
|
};
|
|
117
110
|
},
|
|
118
|
-
async parseResponse(resp, ctx, request) {
|
|
111
|
+
async parseResponse({ resp, ctx, request }) {
|
|
119
112
|
const text = await resp.text();
|
|
120
113
|
if (!resp.ok) {
|
|
121
114
|
throw new Error(`${request.meta.tag} ${resp.status}: ${truncate(text, 240)}`);
|
|
@@ -139,7 +132,7 @@ const openAIImageAdapter = {
|
|
|
139
132
|
else if (entry.url) {
|
|
140
133
|
// Downloading already-generated bytes, not waiting on generation — UPLOAD-class (2min), not
|
|
141
134
|
// the 10-minute GENERATE-class timeout the generation call itself uses above.
|
|
142
|
-
const imgResp = await
|
|
135
|
+
const imgResp = await assertAndFetchExternalAsset({ url: entry.url }, { ...ctx, init: withRequestInit(ctx) });
|
|
143
136
|
if (!imgResp.ok)
|
|
144
137
|
throw new Error(`openai image fetch ${imgResp.status}`);
|
|
145
138
|
const arr = await imgResp.arrayBuffer();
|
|
@@ -155,13 +148,13 @@ const openAIImageAdapter = {
|
|
|
155
148
|
};
|
|
156
149
|
},
|
|
157
150
|
};
|
|
158
|
-
mediaVendorRegistry.register('openai', 'image', openAIImageAdapter);
|
|
159
|
-
export async function renderOpenAIImage(ctx, credentials) {
|
|
160
|
-
return dispatchVendorRequest(openAIImageAdapter, ctx, credentials);
|
|
151
|
+
mediaVendorRegistry.register({ providerId: 'openai', routeKey: 'image', adapter: openAIImageAdapter });
|
|
152
|
+
export async function renderOpenAIImage({ ctx, credentials }) {
|
|
153
|
+
return dispatchVendorRequest({ adapter: openAIImageAdapter, ctx: ctx, credentials: credentials });
|
|
161
154
|
}
|
|
162
155
|
const openAISpeechAdapter = {
|
|
163
|
-
requireCredential: requireApiKey(OPENAI_SPEECH_NO_CREDENTIAL_MESSAGE),
|
|
164
|
-
buildRequest(ctx, credentials) {
|
|
156
|
+
requireCredential: requireApiKey({ message: OPENAI_SPEECH_NO_CREDENTIAL_MESSAGE }),
|
|
157
|
+
buildRequest({ ctx, credentials }) {
|
|
165
158
|
const apiKey = credentials.apiKey; // requireCredential already validated this.
|
|
166
159
|
const rawBase = credentials.baseUrl || 'https://api.openai.com/v1';
|
|
167
160
|
const azure = detectAzureEndpoint(rawBase);
|
|
@@ -211,21 +204,21 @@ const openAISpeechAdapter = {
|
|
|
211
204
|
};
|
|
212
205
|
},
|
|
213
206
|
parseResponse: createRawBytesParser({
|
|
214
|
-
errorTag: (meta) => `${meta.tag} speech`,
|
|
207
|
+
errorTag: ({ meta }) => `${meta.tag} speech`,
|
|
215
208
|
// Deliberately not azure-tag-aware — matches the origin exactly (see
|
|
216
209
|
// this module's doc comment).
|
|
217
210
|
zeroBytesMessage: 'openai speech returned zero bytes',
|
|
218
|
-
note: (bytes, meta) => {
|
|
211
|
+
note: ({ bytes, meta }) => {
|
|
219
212
|
const noteBits = [`${meta.tag}/${meta.wireModel}`, meta.voiceId, meta.format, `${bytes.length} bytes`];
|
|
220
213
|
if (meta.instructions)
|
|
221
214
|
noteBits.splice(2, 0, 'styled');
|
|
222
215
|
return noteBits.join(' · ');
|
|
223
216
|
},
|
|
224
|
-
suggestedExt: (_bytes, meta) => (meta.format === 'opus' ? '.ogg' : `.${meta.format}`),
|
|
217
|
+
suggestedExt: ({ bytes: _bytes, meta }) => (meta.format === 'opus' ? '.ogg' : `.${meta.format}`),
|
|
225
218
|
}),
|
|
226
219
|
};
|
|
227
|
-
mediaVendorRegistry.register('openai', 'audio:speech', openAISpeechAdapter);
|
|
228
|
-
export async function renderOpenAISpeech(ctx, credentials) {
|
|
229
|
-
return dispatchVendorRequest(openAISpeechAdapter, ctx, credentials);
|
|
220
|
+
mediaVendorRegistry.register({ providerId: 'openai', routeKey: 'audio:speech', adapter: openAISpeechAdapter });
|
|
221
|
+
export async function renderOpenAISpeech({ ctx, credentials }) {
|
|
222
|
+
return dispatchVendorRequest({ adapter: openAISpeechAdapter, ctx: ctx, credentials: credentials });
|
|
230
223
|
}
|
|
231
224
|
//# sourceMappingURL=openai.js.map
|
|
@@ -8,6 +8,11 @@ import type { ProviderCredentials, RenderContext, RenderResult } from '../types.
|
|
|
8
8
|
* `imageRouterSizeFor`) — same input -> output mapping for every case, not
|
|
9
9
|
* a behavior change.
|
|
10
10
|
*/
|
|
11
|
-
export declare function openRouterAspectFor(aspect
|
|
12
|
-
|
|
11
|
+
export declare function openRouterAspectFor({ aspect }: {
|
|
12
|
+
aspect: string | undefined;
|
|
13
|
+
}): string;
|
|
14
|
+
export declare function renderOpenRouterImage({ ctx, credentials }: {
|
|
15
|
+
ctx: RenderContext;
|
|
16
|
+
credentials: ProviderCredentials;
|
|
17
|
+
}): Promise<RenderResult>;
|
|
13
18
|
//# 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
|
-
* `
|
|
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,7 +30,7 @@
|
|
|
30
30
|
* base64) has no other current consumer, so it correctly stays a bespoke
|
|
31
31
|
* `parseResponse`.
|
|
32
32
|
*/
|
|
33
|
-
import {
|
|
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
36
|
import { mediaVendorRegistry } from '../vendor-registry.js';
|
|
@@ -49,7 +49,7 @@ const OPENROUTER_IMAGE_TIMEOUT_MS = 10 * 60 * 1000;
|
|
|
49
49
|
* `imageRouterSizeFor`) — same input -> output mapping for every case, not
|
|
50
50
|
* a behavior change.
|
|
51
51
|
*/
|
|
52
|
-
export function openRouterAspectFor(aspect) {
|
|
52
|
+
export function openRouterAspectFor({ aspect }) {
|
|
53
53
|
if (aspect === '1:1')
|
|
54
54
|
return '1:1';
|
|
55
55
|
if (aspect === '16:9')
|
|
@@ -64,8 +64,8 @@ export function openRouterAspectFor(aspect) {
|
|
|
64
64
|
}
|
|
65
65
|
const NO_CREDENTIAL_MESSAGE = 'no OpenRouter API key — configure it or set OPENROUTER_API_KEY';
|
|
66
66
|
const openRouterImageAdapter = {
|
|
67
|
-
requireCredential: requireApiKey(NO_CREDENTIAL_MESSAGE),
|
|
68
|
-
buildRequest(ctx, credentials) {
|
|
67
|
+
requireCredential: requireApiKey({ message: NO_CREDENTIAL_MESSAGE }),
|
|
68
|
+
buildRequest({ ctx, credentials }) {
|
|
69
69
|
const apiKey = credentials.apiKey; // requireCredential already validated this.
|
|
70
70
|
const baseUrl = (credentials.baseUrl || 'https://openrouter.ai/api/v1').replace(/\/$/, '');
|
|
71
71
|
// credentials.model (a host's own model-aliasing layer) wins over
|
|
@@ -77,7 +77,7 @@ const openRouterImageAdapter = {
|
|
|
77
77
|
// output; image-only models (Flux, Recraft, Sourceful) only accept
|
|
78
78
|
// ["image"]. A simple heuristic on the slug, matching the origin.
|
|
79
79
|
const modalities = wireModel.includes('gemini') ? ['image', 'text'] : ['image'];
|
|
80
|
-
const aspectRatio = openRouterAspectFor(ctx.aspect);
|
|
80
|
+
const aspectRatio = openRouterAspectFor({ aspect: ctx.aspect });
|
|
81
81
|
const body = {
|
|
82
82
|
model: wireModel,
|
|
83
83
|
messages: [{ role: 'user', content: ctx.prompt || 'A high-quality reference image.' }],
|
|
@@ -99,7 +99,7 @@ const openRouterImageAdapter = {
|
|
|
99
99
|
meta: { wireModel, aspectRatio },
|
|
100
100
|
};
|
|
101
101
|
},
|
|
102
|
-
async parseResponse(resp, ctx, request) {
|
|
102
|
+
async parseResponse({ resp, ctx, request }) {
|
|
103
103
|
const { wireModel, aspectRatio } = request.meta;
|
|
104
104
|
const text = await resp.text();
|
|
105
105
|
if (!resp.ok) {
|
|
@@ -130,7 +130,7 @@ const openRouterImageAdapter = {
|
|
|
130
130
|
else if (dataUrl.startsWith('http')) {
|
|
131
131
|
// Downloading already-generated bytes, not waiting on generation — UPLOAD-class (2min), not
|
|
132
132
|
// the 10-minute GENERATE-class timeout the chat-completions call itself uses above.
|
|
133
|
-
const imgResp = await
|
|
133
|
+
const imgResp = await assertAndFetchExternalAsset({ url: dataUrl }, { ...ctx, init: withRequestInit(ctx) });
|
|
134
134
|
if (!imgResp.ok)
|
|
135
135
|
throw new Error(`openrouter image download ${imgResp.status}`);
|
|
136
136
|
bytes = Buffer.from(await imgResp.arrayBuffer());
|
|
@@ -145,8 +145,8 @@ const openRouterImageAdapter = {
|
|
|
145
145
|
};
|
|
146
146
|
},
|
|
147
147
|
};
|
|
148
|
-
mediaVendorRegistry.register('openrouter', 'image', openRouterImageAdapter);
|
|
149
|
-
export async function renderOpenRouterImage(ctx, credentials) {
|
|
150
|
-
return dispatchVendorRequest(openRouterImageAdapter, ctx, credentials);
|
|
148
|
+
mediaVendorRegistry.register({ providerId: 'openrouter', routeKey: 'image', adapter: openRouterImageAdapter });
|
|
149
|
+
export async function renderOpenRouterImage({ ctx, credentials }) {
|
|
150
|
+
return dispatchVendorRequest({ adapter: openRouterImageAdapter, ctx: ctx, credentials: credentials });
|
|
151
151
|
}
|
|
152
152
|
//# sourceMappingURL=openrouter.js.map
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { ProviderCredentials, RenderContext, RenderResult } from '../types.js';
|
|
2
|
-
export declare function renderSenseAudioTTS(ctx
|
|
3
|
-
|
|
2
|
+
export declare function renderSenseAudioTTS({ ctx, credentials }: {
|
|
3
|
+
ctx: RenderContext;
|
|
4
|
+
credentials: ProviderCredentials;
|
|
5
|
+
}): Promise<RenderResult>;
|
|
6
|
+
export declare function renderSenseAudioImage({ ctx, credentials }: {
|
|
7
|
+
ctx: RenderContext;
|
|
8
|
+
credentials: ProviderCredentials;
|
|
9
|
+
}): Promise<RenderResult>;
|
|
4
10
|
//# 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 `
|
|
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,
|
|
@@ -56,8 +56,8 @@ const SENSEAUDIO_TTS_MODEL_MAP = {
|
|
|
56
56
|
};
|
|
57
57
|
const NO_CREDENTIAL_MESSAGE = 'no SenseAudio credential — configure an API key or set SENSEAUDIO_API_KEY.';
|
|
58
58
|
const senseAudioTTSAdapter = {
|
|
59
|
-
requireCredential: requireApiKey(NO_CREDENTIAL_MESSAGE),
|
|
60
|
-
buildRequest(ctx, credentials) {
|
|
59
|
+
requireCredential: requireApiKey({ message: NO_CREDENTIAL_MESSAGE }),
|
|
60
|
+
buildRequest({ ctx, credentials }) {
|
|
61
61
|
const apiKey = credentials.apiKey; // requireCredential already validated this.
|
|
62
62
|
const baseUrl = (credentials.baseUrl || SENSEAUDIO_DEFAULT_BASE_URL).replace(/\/$/, '');
|
|
63
63
|
const wireModel = SENSEAUDIO_TTS_MODEL_MAP[ctx.model] || ctx.model;
|
|
@@ -95,9 +95,9 @@ const senseAudioTTSAdapter = {
|
|
|
95
95
|
},
|
|
96
96
|
parseResponse: createHexEnvelopeAudioParser({ errorTag: 'senseaudio tts', providerId: 'senseaudio' }),
|
|
97
97
|
};
|
|
98
|
-
mediaVendorRegistry.register('senseaudio', 'audio:speech', senseAudioTTSAdapter);
|
|
99
|
-
export async function renderSenseAudioTTS(ctx, credentials) {
|
|
100
|
-
return dispatchVendorRequest(senseAudioTTSAdapter, ctx, credentials);
|
|
98
|
+
mediaVendorRegistry.register({ providerId: 'senseaudio', routeKey: 'audio:speech', adapter: senseAudioTTSAdapter });
|
|
99
|
+
export async function renderSenseAudioTTS({ ctx, credentials }) {
|
|
100
|
+
return dispatchVendorRequest({ adapter: senseAudioTTSAdapter, ctx: ctx, credentials: credentials });
|
|
101
101
|
}
|
|
102
102
|
/** 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
103
|
function senseAudioImageSize(aspect) {
|
|
@@ -112,8 +112,8 @@ function senseAudioImageSize(aspect) {
|
|
|
112
112
|
return '1024x1024';
|
|
113
113
|
}
|
|
114
114
|
const senseAudioImageAdapter = {
|
|
115
|
-
requireCredential: requireApiKey(NO_CREDENTIAL_MESSAGE),
|
|
116
|
-
buildRequest(ctx, credentials) {
|
|
115
|
+
requireCredential: requireApiKey({ message: NO_CREDENTIAL_MESSAGE }),
|
|
116
|
+
buildRequest({ ctx, credentials }) {
|
|
117
117
|
const apiKey = credentials.apiKey; // requireCredential already validated this.
|
|
118
118
|
const baseUrl = (credentials.baseUrl || SENSEAUDIO_DEFAULT_BASE_URL).replace(/\/$/, '');
|
|
119
119
|
const promptRaw = (ctx.prompt && ctx.prompt.trim()) || 'A high-quality reference image.';
|
|
@@ -146,7 +146,7 @@ const senseAudioImageAdapter = {
|
|
|
146
146
|
meta: { size, hasReference: Boolean(reference) },
|
|
147
147
|
};
|
|
148
148
|
},
|
|
149
|
-
async parseResponse(resp, ctx, request) {
|
|
149
|
+
async parseResponse({ resp, ctx, request }) {
|
|
150
150
|
const respText = await resp.text();
|
|
151
151
|
if (!resp.ok) {
|
|
152
152
|
throw new Error(`senseaudio image ${resp.status}: ${truncate(respText, 240)}`);
|
|
@@ -168,7 +168,7 @@ const senseAudioImageAdapter = {
|
|
|
168
168
|
if (!url) {
|
|
169
169
|
throw new Error('senseaudio image response missing url');
|
|
170
170
|
}
|
|
171
|
-
const imgResp = await assertAndFetchExternalAsset(url, withRequestInit(ctx));
|
|
171
|
+
const imgResp = await assertAndFetchExternalAsset({ url: url }, { ...ctx, init: withRequestInit(ctx) });
|
|
172
172
|
if (!imgResp.ok) {
|
|
173
173
|
throw new Error(`senseaudio image fetch ${imgResp.status}`);
|
|
174
174
|
}
|
|
@@ -183,8 +183,8 @@ const senseAudioImageAdapter = {
|
|
|
183
183
|
};
|
|
184
184
|
},
|
|
185
185
|
};
|
|
186
|
-
mediaVendorRegistry.register('senseaudio', 'image', senseAudioImageAdapter);
|
|
187
|
-
export async function renderSenseAudioImage(ctx, credentials) {
|
|
188
|
-
return dispatchVendorRequest(senseAudioImageAdapter, ctx, credentials);
|
|
186
|
+
mediaVendorRegistry.register({ providerId: 'senseaudio', routeKey: 'image', adapter: senseAudioImageAdapter });
|
|
187
|
+
export async function renderSenseAudioImage({ ctx, credentials }) {
|
|
188
|
+
return dispatchVendorRequest({ adapter: senseAudioImageAdapter, ctx: ctx, credentials: credentials });
|
|
189
189
|
}
|
|
190
190
|
//# sourceMappingURL=senseaudio.js.map
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { ProviderCredentials, RenderContext, RenderResult } from '../types.js';
|
|
2
|
-
export declare function renderVolcengineImage(ctx
|
|
2
|
+
export declare function renderVolcengineImage({ ctx, credentials }: {
|
|
3
|
+
ctx: RenderContext;
|
|
4
|
+
credentials: ProviderCredentials;
|
|
5
|
+
}): Promise<RenderResult>;
|
|
3
6
|
//# 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 `
|
|
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-
|
|
@@ -51,8 +51,8 @@ import { dispatchVendorRequest, requireApiKey } from '../vendor-adapter.js';
|
|
|
51
51
|
import { mediaVendorRegistry } from '../vendor-registry.js';
|
|
52
52
|
const NO_CREDENTIAL_MESSAGE = 'no Volcengine Ark credential — configure an API key or set ARK_API_KEY.';
|
|
53
53
|
const volcengineImageAdapter = {
|
|
54
|
-
requireCredential: requireApiKey(NO_CREDENTIAL_MESSAGE),
|
|
55
|
-
buildRequest(ctx, credentials) {
|
|
54
|
+
requireCredential: requireApiKey({ message: NO_CREDENTIAL_MESSAGE }),
|
|
55
|
+
buildRequest({ ctx, credentials }) {
|
|
56
56
|
const apiKey = credentials.apiKey; // requireCredential already validated this.
|
|
57
57
|
const baseUrl = (credentials.baseUrl || 'https://ark.cn-beijing.volces.com/api/v3').replace(/\/$/, '');
|
|
58
58
|
const body = {
|
|
@@ -78,9 +78,9 @@ const volcengineImageAdapter = {
|
|
|
78
78
|
meta: undefined,
|
|
79
79
|
};
|
|
80
80
|
},
|
|
81
|
-
async parseResponse(resp, ctx) {
|
|
81
|
+
async parseResponse({ resp, ctx }) {
|
|
82
82
|
const data = await parseOpenAICompatibleJson(resp, 'volcengine image');
|
|
83
|
-
const bytes = await bytesFromOpenAICompatibleData(data, 'volcengine image', ctx
|
|
83
|
+
const bytes = await bytesFromOpenAICompatibleData({ data, providerTag: 'volcengine image' }, ctx);
|
|
84
84
|
return {
|
|
85
85
|
bytes,
|
|
86
86
|
providerNote: `volcengine/${ctx.wireModel} · ${ctx.aspect} · ${bytes.length} bytes`,
|
|
@@ -88,8 +88,8 @@ const volcengineImageAdapter = {
|
|
|
88
88
|
};
|
|
89
89
|
},
|
|
90
90
|
};
|
|
91
|
-
mediaVendorRegistry.register('volcengine', 'image', volcengineImageAdapter);
|
|
92
|
-
export async function renderVolcengineImage(ctx, credentials) {
|
|
93
|
-
return dispatchVendorRequest(volcengineImageAdapter, ctx, credentials);
|
|
91
|
+
mediaVendorRegistry.register({ providerId: 'volcengine', routeKey: 'image', adapter: volcengineImageAdapter });
|
|
92
|
+
export async function renderVolcengineImage({ ctx, credentials }) {
|
|
93
|
+
return dispatchVendorRequest({ adapter: volcengineImageAdapter, ctx: ctx, credentials: credentials });
|
|
94
94
|
}
|
|
95
95
|
//# sourceMappingURL=volcengine.js.map
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import type { VendorResponseParser } from './vendor-adapter.js';
|
|
2
|
-
type Resolvable<T, Args extends
|
|
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,
|
|
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,
|
|
9
|
+
readonly zeroBytesMessage: Resolvable<string, {
|
|
10
|
+
meta: Meta;
|
|
11
|
+
}>;
|
|
8
12
|
/** Builds the successful `RenderResult.providerNote`. */
|
|
9
|
-
readonly note: (
|
|
13
|
+
readonly note: (required: {
|
|
14
|
+
bytes: Buffer;
|
|
15
|
+
meta: Meta;
|
|
16
|
+
}) => string;
|
|
10
17
|
/** The successful `RenderResult.suggestedExt`. */
|
|
11
|
-
readonly suggestedExt: Resolvable<string,
|
|
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
|
|
40
|
-
* absent, matching both vendors'
|
|
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 `
|
|
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
|
|
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(
|
|
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,
|
|
44
|
+
return async ({ resp, request }) => {
|
|
45
45
|
if (!resp.ok) {
|
|
46
46
|
const text = await resp.text();
|
|
47
|
-
const tag = resolve(options.errorTag,
|
|
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,
|
|
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,
|
|
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
|
|
68
|
-
* absent, matching both vendors'
|
|
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,
|
|
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
|
|
15
|
+
export declare function createSqliteAsyncOperationStore({ dbPath }: {
|
|
16
|
+
dbPath: string;
|
|
17
|
+
}): Promise<SqliteAsyncOperationStore>;
|
|
16
18
|
//# sourceMappingURL=sqlite-async-operation-store.d.ts.map
|