@jini-ai/integrations 0.7.3-next.1 → 0.7.3-next.3
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 +6 -0
- package/README.md +1 -0
- package/dist/api-connections/bundled-client-namespace.d.ts +24 -0
- package/dist/api-connections/bundled-client-namespace.js +22 -0
- package/dist/api-connections/connect.d.ts +2 -10
- package/dist/api-connections/contribution.d.ts +71 -0
- package/dist/api-connections/contribution.js +69 -0
- package/dist/api-connections/form-delivery-connection.d.ts +68 -0
- package/dist/api-connections/form-delivery-connection.js +73 -0
- package/dist/api-connections/hosted-mcp/contracts.d.ts +4 -171
- package/dist/api-connections/hosted-mcp/index.d.ts +2 -0
- package/dist/api-connections/hosted-mcp/oauth-row-writes.d.ts +3 -1
- package/dist/api-connections/hosted-mcp/oauth-row-writes.js +6 -3
- package/dist/api-connections/hosted-mcp/shared-sign-in.d.ts +2 -1
- package/dist/api-connections/hosted-mcp/sign-in-configuration.js +1 -1
- package/dist/api-connections/hosted-mcp/sign-in-discovery.js +1 -1
- package/dist/api-connections/hosted-mcp/sign-in-flow.d.ts +9 -3
- package/dist/api-connections/hosted-mcp/sign-in-flow.js +6 -6
- package/dist/api-connections/hosted-mcp/sign-in-provider.d.ts +16 -4
- package/dist/api-connections/hosted-mcp/sign-in-provider.js +3 -3
- package/dist/api-connections/hosted-mcp/sign-in-status.d.ts +13 -2
- package/dist/api-connections/hosted-mcp/sign-in-status.js +17 -4
- package/dist/api-connections/hosted-mcp/sign-in.d.ts +1 -1
- package/dist/api-connections/hosted-mcp/sign-in.js +28 -30
- package/dist/api-connections/shared-api.d.ts +87 -0
- package/dist/api-connections/shared-api.js +135 -0
- package/dist/api-connections/shared-oauth-disconnect.d.ts +73 -0
- package/dist/api-connections/shared-oauth-disconnect.js +41 -0
- package/dist/api-connections/shared-owner.d.ts +107 -0
- package/dist/api-connections/shared-owner.js +79 -0
- package/dist/api-connections/vault-stores.d.ts +110 -0
- package/dist/api-connections/vault-stores.js +202 -0
- package/dist/credentialed-http/auth-schemes.d.ts +2 -9
- package/dist/credentialed-http/tools/index.d.ts +30 -0
- package/dist/credentialed-http/tools/index.js +19 -0
- package/dist/credentialed-http/tools/tool-registrations.js +0 -1
- package/dist/custom-credentials/agent-tools.d.ts +79 -0
- package/dist/custom-credentials/agent-tools.js +98 -0
- package/dist/custom-credentials/card-token.d.ts +15 -0
- package/dist/custom-credentials/card-token.js +35 -0
- package/dist/custom-credentials/credential-ports.d.ts +70 -0
- package/dist/custom-credentials/credential-ports.js +41 -0
- package/dist/custom-credentials/credential-recovery.d.ts +20 -0
- package/dist/custom-credentials/credential-recovery.js +22 -0
- package/dist/custom-credentials/credentialed-request.d.ts +83 -0
- package/dist/custom-credentials/credentialed-request.js +93 -0
- package/dist/custom-credentials/custom-credential-create-ui.d.ts +106 -0
- package/dist/custom-credentials/custom-credential-create-ui.js +136 -0
- package/dist/custom-credentials/custom-credential-set-token-ui.d.ts +84 -0
- package/dist/custom-credentials/custom-credential-set-token-ui.js +104 -0
- package/dist/custom-credentials/delete-request-confirmation-ui.d.ts +33 -0
- package/dist/custom-credentials/delete-request-confirmation-ui.js +35 -0
- package/dist/custom-credentials/provider-settings-card.d.ts +109 -0
- package/dist/custom-credentials/provider-settings-card.js +166 -0
- package/dist/custom-credentials/write-files-validation.d.ts +102 -0
- package/dist/custom-credentials/write-files-validation.js +202 -0
- package/dist/media-providers/catalog-projection.d.ts +29 -0
- package/dist/media-providers/catalog-projection.js +45 -0
- package/dist/media-providers/catalog.d.ts +6 -3
- package/dist/media-providers/catalog.js +4 -3
- package/dist/media-providers/configurable-catalog.d.ts +9 -0
- package/dist/media-providers/configurable-catalog.js +70 -0
- package/dist/media-providers/dispatch/builtin-vendors.js +0 -2
- package/dist/media-providers/dispatch/credentials.d.ts +4 -1
- package/dist/media-providers/dispatch/credentials.js +3 -2
- package/dist/media-providers/dispatch/engine.d.ts +1 -1
- package/dist/media-providers/dispatch/engine.js +17 -5
- package/dist/media-providers/dispatch/index.d.ts +3 -2
- package/dist/media-providers/dispatch/index.js +2 -2
- package/dist/media-providers/dispatch/media-provider-registry.d.ts +23 -4
- package/dist/media-providers/dispatch/media-provider-registry.js +26 -11
- package/dist/media-providers/dispatch/media-wire.d.ts +14 -0
- package/dist/media-providers/dispatch/media-wire.js +22 -0
- package/dist/media-providers/dispatch/node.d.ts +5 -0
- package/dist/media-providers/dispatch/node.js +5 -1
- package/dist/media-providers/dispatch/openai-compatible.d.ts +3 -1
- package/dist/media-providers/dispatch/openai-compatible.js +1 -1
- package/dist/media-providers/dispatch/operation-runtime.js +5 -4
- package/dist/media-providers/dispatch/outbound.d.ts +28 -3
- package/dist/media-providers/dispatch/outbound.js +10 -3
- package/dist/media-providers/dispatch/providers/custom-image.js +1 -1
- package/dist/media-providers/dispatch/providers/imagerouter.js +1 -1
- package/dist/media-providers/dispatch/providers/nanobanana.js +1 -1
- package/dist/media-providers/dispatch/providers/openrouter.js +1 -1
- package/dist/media-providers/dispatch/ssrf-guard.js +2 -2
- package/dist/media-providers/dispatch/types.d.ts +13 -4
- package/dist/media-providers/dispatch/vendor-adapter.js +2 -2
- package/dist/media-providers/index.d.ts +2 -0
- package/dist/media-providers/providers.d.ts +9 -5
- package/dist/media-providers/providers.js +9 -12
- package/dist/media-providers/sqlite-task-store.d.ts +4 -4
- package/dist/media-providers/task-store.d.ts +1 -1
- package/dist/media-providers/task-store.js +1 -1
- package/dist/media-providers/types.d.ts +0 -36
- package/dist/media-providers/ui-defaults.js +0 -4
- package/dist/react/admin-credentials/AdminByokKeyPanel.d.ts +130 -0
- package/dist/react/admin-credentials/AdminByokKeyPanel.js +115 -0
- package/dist/react/admin-credentials/byok-footer-status.d.ts +37 -0
- package/dist/react/admin-credentials/byok-footer-status.js +25 -0
- package/dist/react/credentials/OtherCredentialsSection.d.ts +36 -0
- package/dist/react/credentials/OtherCredentialsSection.hooks.d.ts +55 -0
- package/dist/react/credentials/OtherCredentialsSection.hooks.js +26 -0
- package/dist/react/credentials/OtherCredentialsSection.js +120 -0
- package/dist/react/credentials/access-token-forms.d.ts +219 -0
- package/dist/react/credentials/access-token-forms.js +114 -0
- package/dist/react/credentials/credential-copy.d.ts +17 -0
- package/dist/react/credentials/credential-copy.js +7 -0
- package/dist/react/credentials/other-credential-stores.d.ts +115 -0
- package/dist/react/credentials/other-credential-stores.js +76 -0
- package/dist/react/site-key/SiteKeyRecoveryCard.d.ts +16 -0
- package/dist/react/site-key/SiteKeyRecoveryCard.js +36 -0
- package/dist/react/site-key/SiteKeyTab.d.ts +100 -0
- package/dist/react/site-key/SiteKeyTab.js +127 -0
- package/dist/react/site-key/hooks/use-site-key-recovery.hooks.d.ts +77 -0
- package/dist/react/site-key/hooks/use-site-key-recovery.hooks.js +126 -0
- package/dist/react/site-key/hooks/use-site-key.hooks.d.ts +120 -0
- package/dist/react/site-key/hooks/use-site-key.hooks.js +95 -0
- package/dist/react/webhooks/IntegrationDeliveries.d.ts +41 -0
- package/dist/react/webhooks/IntegrationDeliveries.js +24 -0
- package/dist/react/webhooks/Integrations.d.ts +73 -0
- package/dist/react/webhooks/Integrations.js +97 -0
- package/dist/react/webhooks/hooks/use-integration-deliveries.hooks.d.ts +59 -0
- package/dist/react/webhooks/hooks/use-integration-deliveries.hooks.js +11 -0
- package/dist/react/webhooks/hooks/use-integrations.hooks.d.ts +119 -0
- package/dist/react/webhooks/hooks/use-integrations.hooks.js +129 -0
- package/dist/react/webhooks/rules.d.ts +118 -0
- package/dist/react/webhooks/rules.js +103 -0
- package/dist/saved-requests/execute.js +2 -3
- package/dist/saved-requests/types.d.ts +4 -1
- package/dist/secrets/index.d.ts +3 -0
- package/dist/secrets/index.js +3 -0
- package/dist/secrets/ports.d.ts +25 -0
- package/dist/secrets/ports.js +2 -0
- package/dist/secrets/types.d.ts +10 -0
- package/dist/secrets/types.js +2 -0
- package/dist/vendor-credentials/abort-guarded-repo.d.ts +14 -0
- package/dist/vendor-credentials/abort-guarded-repo.js +41 -0
- package/dist/vendor-credentials/project-scope.d.ts +43 -0
- package/dist/vendor-credentials/project-scope.js +32 -0
- package/dist/vendor-credentials/vault-adapter.d.ts +147 -0
- package/dist/vendor-credentials/vault-adapter.js +195 -0
- package/dist/web-screenshot/capture-files.d.ts +44 -0
- package/dist/web-screenshot/capture-files.js +62 -0
- package/dist/web-screenshot/capture-retention.d.ts +157 -0
- package/dist/web-screenshot/capture-retention.js +134 -0
- package/dist/web-screenshot/capture-root-file-lock.d.ts +20 -0
- package/dist/web-screenshot/capture-root-file-lock.js +15 -0
- package/dist/web-screenshot/desktop-page-capture.d.ts +37 -0
- package/dist/web-screenshot/desktop-page-capture.js +62 -0
- package/dist/web-screenshot/own-site-opener.d.ts +40 -0
- package/dist/web-screenshot/own-site-opener.js +27 -0
- package/dist/web-screenshot/screenshot-image.d.ts +11 -0
- package/dist/web-screenshot/screenshot-image.js +12 -0
- package/dist/web-screenshot/web-screenshot.d.ts +188 -0
- package/dist/web-screenshot/web-screenshot.js +329 -0
- package/dist/webhooks/delivery.d.ts +16 -0
- package/dist/webhooks/delivery.js +41 -1
- package/dist/webhooks/ports.d.ts +1 -29
- package/dist/webhooks/signing.keyring.d.ts +1 -1
- package/dist/webhooks/site/delivery.d.ts +60 -0
- package/dist/webhooks/site/delivery.js +45 -0
- package/dist/webhooks/site/http.memory.d.ts +51 -0
- package/dist/webhooks/site/http.memory.js +28 -0
- package/dist/webhooks/site/repo.memory.d.ts +136 -0
- package/dist/webhooks/site/repo.memory.js +215 -0
- package/dist/webhooks/site/seal-aad-invariant.d.ts +26 -0
- package/dist/webhooks/site/seal-aad-invariant.js +61 -0
- package/dist/webhooks/site/seal-aad-invariant.node.d.ts +42 -0
- package/dist/webhooks/site/seal-aad-invariant.node.js +52 -0
- package/dist/webhooks/site/signing.d.ts +28 -0
- package/dist/webhooks/site/signing.js +27 -0
- package/dist/webhooks/site/signing.keyring.d.ts +29 -0
- package/dist/webhooks/site/signing.keyring.js +30 -0
- package/dist/webhooks/site/subscriptions.d.ts +118 -0
- package/dist/webhooks/site/subscriptions.js +98 -0
- package/dist/webhooks/sql/index.d.ts +4 -0
- package/dist/webhooks/sql/index.js +2 -0
- package/dist/webhooks/sql/repo.rows.d.ts +47 -0
- package/dist/webhooks/sql/repo.rows.js +2 -0
- package/dist/webhooks/sql/webhook-repo.d.ts +152 -0
- package/dist/webhooks/sql/webhook-repo.js +308 -0
- package/dist/webhooks/subscriptions.d.ts +3 -1
- package/dist/webhooks/subscriptions.js +4 -1
- package/dist/webhooks/tools/tool-handlers.js +2 -1
- package/dist/webhooks/types.d.ts +6 -10
- package/package.json +518 -13
- package/dist/media-providers/dispatch/providers/grok.d.ts +0 -55
- package/dist/media-providers/dispatch/providers/grok.js +0 -116
|
@@ -1,10 +1,30 @@
|
|
|
1
|
-
import type { HttpClientPort } from '@jini-ai/core/primitives';
|
|
1
|
+
import type { HttpClientPort, HttpRequest, RequestRedirect } from '@jini-ai/core/primitives';
|
|
2
|
+
/** The wire options media outbound hands the injected guarded fetch. */
|
|
3
|
+
export interface MediaGuardedFetchOptions {
|
|
4
|
+
readonly method?: HttpRequest['method'];
|
|
5
|
+
readonly headers?: ConstructorParameters<typeof Headers>[0];
|
|
6
|
+
readonly body?: string | URLSearchParams;
|
|
7
|
+
readonly signal?: AbortSignal;
|
|
8
|
+
readonly redirect?: RequestRedirect;
|
|
9
|
+
/** Deadline over DNS, redirects and the complete decoded body. */
|
|
10
|
+
readonly totalDeadlineMs?: number;
|
|
11
|
+
}
|
|
12
|
+
/** Projects a guarded client's complete, bounded response into a fetch `Response`.
|
|
13
|
+
* Composition binds the platform's guarded fetch adapter (see `node.ts`); this module never imports one.
|
|
14
|
+
*/
|
|
15
|
+
export type MediaGuardedFetch = (required: {
|
|
16
|
+
client: HttpClientPort;
|
|
17
|
+
url: string;
|
|
18
|
+
timeoutMs: number;
|
|
19
|
+
}, options?: MediaGuardedFetchOptions) => Promise<Response>;
|
|
2
20
|
/** The host supplies a policy-enforcing client, never a raw fetch implementation. */
|
|
3
21
|
export interface MediaOutboundOptions {
|
|
4
22
|
/** Override caller-facing transport diagnostics without changing policy. */
|
|
5
23
|
readonly outboundMessages?: Partial<typeof defaultMediaOutboundMessages>;
|
|
6
24
|
/** Required for network I/O. Pure context/request builders may omit it. */
|
|
7
25
|
readonly httpClient?: HttpClientPort;
|
|
26
|
+
/** Required for network I/O alongside `httpClient`. Pure context/request builders may omit it. */
|
|
27
|
+
readonly guardedFetch?: MediaGuardedFetch;
|
|
8
28
|
/** @deprecated Configure allowPrivateNetwork on the explicit Node client adapter instead. */
|
|
9
29
|
readonly allowPrivateNetwork?: boolean;
|
|
10
30
|
}
|
|
@@ -21,15 +41,20 @@ export declare const defaultMediaOutboundMessages: {
|
|
|
21
41
|
* @throws Policy refusals, DNS/transport failures, unsupported bodies or methods.
|
|
22
42
|
* @complexity O(h + b) for h headers and b bounded decoded response bytes.
|
|
23
43
|
*/
|
|
24
|
-
export declare function fetchMediaOutbound({ url, timeoutMs, httpClient }: {
|
|
44
|
+
export declare function fetchMediaOutbound({ url, timeoutMs, httpClient, guardedFetch }: {
|
|
25
45
|
url: string;
|
|
26
46
|
timeoutMs: number;
|
|
27
47
|
httpClient: HttpClientPort;
|
|
28
|
-
|
|
48
|
+
guardedFetch: MediaGuardedFetch;
|
|
49
|
+
}, { init, outboundMessages }?: Omit<MediaOutboundOptions, 'httpClient' | 'guardedFetch'> & {
|
|
29
50
|
init?: RequestInit;
|
|
30
51
|
}): Promise<Response>;
|
|
31
52
|
/** Resolve the trusted client on legacy context carriers without constructing a fallback.
|
|
32
53
|
* @throws TypeError before I/O if a standalone renderer/runtime has no injected client.
|
|
33
54
|
*/
|
|
34
55
|
export declare function requireMediaHttpClient({ httpClient }: Pick<MediaOutboundOptions, 'httpClient'>): HttpClientPort;
|
|
56
|
+
/** Resolve the injected guarded fetch on context carriers without constructing a fallback.
|
|
57
|
+
* @throws TypeError before I/O if a standalone renderer/runtime has no injected guarded fetch.
|
|
58
|
+
*/
|
|
59
|
+
export declare function requireMediaGuardedFetch({ guardedFetch }: Pick<MediaOutboundOptions, 'guardedFetch'>): MediaGuardedFetch;
|
|
35
60
|
//# sourceMappingURL=outbound.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { guardedFetch } from '@jini-ai/platform/http/guarded';
|
|
2
1
|
export const defaultMediaOutboundMessages = {
|
|
3
2
|
unsupportedMethod: 'Unsupported media HTTP method',
|
|
4
3
|
unsupportedBody: 'Media HTTP body must be a string or URLSearchParams',
|
|
@@ -12,12 +11,12 @@ export const defaultMediaOutboundMessages = {
|
|
|
12
11
|
* @throws Policy refusals, DNS/transport failures, unsupported bodies or methods.
|
|
13
12
|
* @complexity O(h + b) for h headers and b bounded decoded response bytes.
|
|
14
13
|
*/
|
|
15
|
-
export async function fetchMediaOutbound({ url, timeoutMs, httpClient }, { init = {}, outboundMessages } = {}) {
|
|
14
|
+
export async function fetchMediaOutbound({ url, timeoutMs, httpClient, guardedFetch }, { init = {}, outboundMessages } = {}) {
|
|
16
15
|
const messages = { ...defaultMediaOutboundMessages, ...outboundMessages };
|
|
17
16
|
// Every wire refusal happens before any I/O starts.
|
|
18
17
|
const { method, body } = validateMediaWireRequest({ init, messages });
|
|
19
18
|
const client = requireMediaHttpClient({ httpClient });
|
|
20
|
-
return guardedFetch({ client, url, timeoutMs }, {
|
|
19
|
+
return requireMediaGuardedFetch({ guardedFetch })({ client, url, timeoutMs }, {
|
|
21
20
|
method,
|
|
22
21
|
...(init.headers === undefined ? {} : { headers: init.headers }),
|
|
23
22
|
...(body == null ? {} : { body }),
|
|
@@ -49,6 +48,14 @@ export function requireMediaHttpClient({ httpClient }) {
|
|
|
49
48
|
throw new TypeError('Media outbound requires an injected guarded HttpClientPort');
|
|
50
49
|
return httpClient;
|
|
51
50
|
}
|
|
51
|
+
/** Resolve the injected guarded fetch on context carriers without constructing a fallback.
|
|
52
|
+
* @throws TypeError before I/O if a standalone renderer/runtime has no injected guarded fetch.
|
|
53
|
+
*/
|
|
54
|
+
export function requireMediaGuardedFetch({ guardedFetch }) {
|
|
55
|
+
if (!guardedFetch)
|
|
56
|
+
throw new TypeError('Media outbound requires an injected guarded fetch');
|
|
57
|
+
return guardedFetch;
|
|
58
|
+
}
|
|
52
59
|
const MEDIA_METHODS = new Set(['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE']);
|
|
53
60
|
function isMediaMethod(method) {
|
|
54
61
|
return MEDIA_METHODS.has(method);
|
|
@@ -56,7 +56,7 @@ const imageRouterImageAdapter = {
|
|
|
56
56
|
return {
|
|
57
57
|
bytes,
|
|
58
58
|
providerNote: `imagerouter/${request.meta.wireModel} · ${request.meta.size} · ${bytes.length} bytes`,
|
|
59
|
-
suggestedExt: sniffImageExt(bytes),
|
|
59
|
+
suggestedExt: sniffImageExt({ bytes }),
|
|
60
60
|
};
|
|
61
61
|
},
|
|
62
62
|
};
|
|
@@ -122,7 +122,7 @@ const nanoBananaImageAdapter = {
|
|
|
122
122
|
return {
|
|
123
123
|
bytes,
|
|
124
124
|
providerNote: `nano-banana/${request.meta.wireModel} · ${request.meta.aspectRatio} · ${NANOBANANA_DEFAULT_IMAGE_SIZE} · ${bytes.length} bytes`,
|
|
125
|
-
suggestedExt: sniffImageExt(bytes),
|
|
125
|
+
suggestedExt: sniffImageExt({ bytes }),
|
|
126
126
|
};
|
|
127
127
|
},
|
|
128
128
|
};
|
|
@@ -41,7 +41,7 @@ import { isLoopbackApiHost, isBlockedExternalApiHostname, FETCH_TIMEOUT_MS } fro
|
|
|
41
41
|
import { promises as dnsPromises } from 'node:dns';
|
|
42
42
|
import { isIpLiteralHostname } from '@jini-ai/core';
|
|
43
43
|
import { trimCharsEnd } from '@jini-ai/core/primitives';
|
|
44
|
-
import { defaultMediaOutboundMessages, fetchMediaOutbound, requireMediaHttpClient } from './outbound.js';
|
|
44
|
+
import { defaultMediaOutboundMessages, fetchMediaOutbound, requireMediaGuardedFetch, requireMediaHttpClient } from './outbound.js';
|
|
45
45
|
const defaultDnsLookup = async ({ hostname }) => {
|
|
46
46
|
const result = await dnsPromises.lookup(hostname, { all: true, family: 0 });
|
|
47
47
|
return result.map(({ address, family }) => ({ address, family }));
|
|
@@ -143,7 +143,7 @@ export async function assertAndFetchExternalAsset({ url }, { init = {}, lookup:
|
|
|
143
143
|
throw new Error(`blocked download url (${check.error})`);
|
|
144
144
|
}
|
|
145
145
|
// Downloading an already-generated asset, not waiting on generation — UPLOAD-class (2min).
|
|
146
|
-
return fetchMediaOutbound({ url, timeoutMs: FETCH_TIMEOUT_MS.UPLOAD, httpClient: requireMediaHttpClient(outbound) }, {
|
|
146
|
+
return fetchMediaOutbound({ url, timeoutMs: FETCH_TIMEOUT_MS.UPLOAD, httpClient: requireMediaHttpClient(outbound), guardedFetch: requireMediaGuardedFetch(outbound) }, {
|
|
147
147
|
...outbound,
|
|
148
148
|
init: { ...init, redirect: 'error' },
|
|
149
149
|
});
|
|
@@ -23,8 +23,9 @@ import type { RequiredArgs, OptionalArgs } from '../../args.js';
|
|
|
23
23
|
* attachments; provider dispatch performs network I/O through its transport.
|
|
24
24
|
*/
|
|
25
25
|
import type { HttpClientPort } from '@jini-ai/core/primitives';
|
|
26
|
-
import type { MediaOutboundOptions } from './outbound.js';
|
|
27
|
-
import type { AudioKind,
|
|
26
|
+
import type { MediaGuardedFetch, MediaOutboundOptions } from './outbound.js';
|
|
27
|
+
import type { AudioKind, MediaSurface } from '../types.js';
|
|
28
|
+
import type { MediaModel, MediaProvider } from '@jini-ai/core/contracts/site/media-providers-catalog';
|
|
28
29
|
/** Per-provider credentials a host resolves however it wants (env vars, a secrets manager, a config file, ...). This engine never reads `process.env` itself — see `resolveProviderCredentialsFromEnv` in `credentials.ts` for an opt-in reference resolver a host may use to build this map. */
|
|
29
30
|
export interface ProviderCredentials {
|
|
30
31
|
readonly apiKey?: string;
|
|
@@ -102,8 +103,14 @@ export interface VendorAdapterLookup {
|
|
|
102
103
|
export interface MediaDispatchEngineRequired {
|
|
103
104
|
readonly registry: VendorAdapterLookup;
|
|
104
105
|
readonly httpClient: HttpClientPort;
|
|
106
|
+
/**
|
|
107
|
+
* Projects `httpClient` responses into fetch `Response`s for vendor adapters. Composition binds
|
|
108
|
+
* `nodeMediaGuardedFetch` from `@jini-ai/integrations/media-providers/node`; the engine binds no
|
|
109
|
+
* default and refuses construction without it.
|
|
110
|
+
*/
|
|
111
|
+
readonly guardedFetch: MediaGuardedFetch;
|
|
105
112
|
}
|
|
106
|
-
export interface MediaDispatchEngineOptions extends Omit<MediaOutboundOptions, 'httpClient'> {
|
|
113
|
+
export interface MediaDispatchEngineOptions extends Omit<MediaOutboundOptions, 'httpClient' | 'guardedFetch'> {
|
|
107
114
|
/** Per-provider credentials, keyed by provider id (see `providers.ts`'s `MEDIA_PROVIDERS` for valid ids). */
|
|
108
115
|
readonly credentials?: Readonly<Record<string, ProviderCredentials>>;
|
|
109
116
|
/**
|
|
@@ -138,7 +145,9 @@ export interface MediaModelCatalog {
|
|
|
138
145
|
}): readonly MediaModel[];
|
|
139
146
|
}
|
|
140
147
|
export interface MediaDispatchEngine {
|
|
141
|
-
generate(required: RequiredArgs<MediaGenerationRequest>, optional?: OptionalArgs<MediaGenerationRequest>
|
|
148
|
+
generate(required: RequiredArgs<MediaGenerationRequest>, optional?: OptionalArgs<MediaGenerationRequest> & {
|
|
149
|
+
signal?: AbortSignal;
|
|
150
|
+
}): Promise<MediaGenerationResult>;
|
|
142
151
|
}
|
|
143
152
|
/** Internal: the pure shape rendered by `render*` provider functions, before the engine attaches `providerId`/`usedStubFallback`/`warnings`. */
|
|
144
153
|
export interface RenderResult {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* reusable piece.
|
|
28
28
|
*/
|
|
29
29
|
import { FETCH_TIMEOUT_MS } from '@jini-ai/core/net';
|
|
30
|
-
import { fetchMediaOutbound, requireMediaHttpClient } from './outbound.js';
|
|
30
|
+
import { fetchMediaOutbound, requireMediaGuardedFetch, requireMediaHttpClient } from './outbound.js';
|
|
31
31
|
/**
|
|
32
32
|
* The generic dispatch core: `requireCredential` -> `buildRequest` -> one
|
|
33
33
|
* `fetch` -> `parseResponse`. Every migrated vendor's `render*` export is
|
|
@@ -51,7 +51,7 @@ export async function dispatchVendorRequest({ adapter, ctx, credentials }) {
|
|
|
51
51
|
// still applies unchanged; `GENERATE` (10min) matches what those two vendors already picked
|
|
52
52
|
// deliberately for the same reason — media generation genuinely finishes on that order, not in
|
|
53
53
|
// seconds, so anything shorter would abort a legitimately still-generating request.
|
|
54
|
-
const resp = await fetchMediaOutbound({ url: request.url, timeoutMs: FETCH_TIMEOUT_MS.GENERATE, httpClient: requireMediaHttpClient(ctx) }, { ...ctx, init: request.init });
|
|
54
|
+
const resp = await fetchMediaOutbound({ url: request.url, timeoutMs: FETCH_TIMEOUT_MS.GENERATE, httpClient: requireMediaHttpClient(ctx), guardedFetch: requireMediaGuardedFetch(ctx) }, { ...ctx, init: request.init });
|
|
55
55
|
return adapter.parseResponse({ resp: resp, ctx: ctx, request: request });
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* deferred, and this package's not-yet-locked status.
|
|
10
10
|
*/
|
|
11
11
|
export * from './types.js';
|
|
12
|
+
/** Deprecated re-export: import these from `@jini-ai/core/contracts/site/media-providers-catalog`; removed at the next major. */
|
|
13
|
+
export type { MediaModel, MediaProvider } from '@jini-ai/core/contracts/site/media-providers-catalog';
|
|
12
14
|
export * from './providers.js';
|
|
13
15
|
export * from './capability-registry.js';
|
|
14
16
|
export * from './seed.js';
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* concept, so per the AGENTS.md boundary rule (no product-identity strings)
|
|
7
7
|
* it ports as data. See `archived provenance ledger` for exactly what was dropped.
|
|
8
8
|
*/
|
|
9
|
-
import type { AudioKind,
|
|
9
|
+
import type { AudioKind, MediaSurface } from './types.js';
|
|
10
|
+
import type { MediaModel, MediaProvider } from '@jini-ai/core/contracts/site/media-providers-catalog';
|
|
10
11
|
export declare const VENDOR_API_BASE_URLS: {
|
|
11
12
|
readonly anthropic: "https://api.anthropic.com";
|
|
12
13
|
readonly openai: "https://api.openai.com/v1";
|
|
@@ -15,7 +16,6 @@ export declare const VENDOR_API_BASE_URLS: {
|
|
|
15
16
|
readonly openrouter: "https://openrouter.ai/api/v1";
|
|
16
17
|
readonly ollama: "http://localhost:11434/v1";
|
|
17
18
|
readonly volcengine: "https://ark.cn-beijing.volces.com/api/v3";
|
|
18
|
-
readonly grok: "https://api.x.ai/v1";
|
|
19
19
|
readonly imagerouter: "https://api.imagerouter.io/v1/openai";
|
|
20
20
|
readonly comfyui: "http://127.0.0.1:8188";
|
|
21
21
|
readonly bfl: "https://api.bfl.ai";
|
|
@@ -31,15 +31,19 @@ export declare const VENDOR_API_BASE_URLS: {
|
|
|
31
31
|
};
|
|
32
32
|
/** Old UI ids remain accepted at boundaries; canonical ids match the existing dispatch catalog. */
|
|
33
33
|
export declare const MEDIA_PROVIDER_ID_ALIASES: Readonly<Record<string, string>>;
|
|
34
|
-
/** Resolve legacy aliases without changing unknown extension IDs. @complexity O(1). */
|
|
34
|
+
/** Resolve legacy aliases without changing unknown extension IDs. `aliases` is host-injected legacy ids layered over the built-in table. @complexity O(1). */
|
|
35
35
|
export declare function canonicalMediaProviderId({ id }: {
|
|
36
36
|
id: string;
|
|
37
|
-
},
|
|
37
|
+
}, { aliases }?: {
|
|
38
|
+
aliases?: Readonly<Record<string, string>>;
|
|
39
|
+
}): string;
|
|
38
40
|
/** Canonical entries win conflicts, so an old alias can never replace a newer explicit edit.
|
|
39
41
|
* Returns a copy without changing supplied values or reading credentials. @complexity O(n) entries. */
|
|
40
42
|
export declare function normalizeMediaProviderMap<T>({ providers }: {
|
|
41
43
|
providers: Readonly<Record<string, T>>;
|
|
42
|
-
},
|
|
44
|
+
}, { aliases }?: {
|
|
45
|
+
aliases?: Readonly<Record<string, string>>;
|
|
46
|
+
}): Record<string, T>;
|
|
43
47
|
/** Host-injected UI policy; reuse the catalog's existing identity and normalization owner. */
|
|
44
48
|
export declare const mediaProviderCatalogPolicy: {
|
|
45
49
|
canonicalMediaProviderId: typeof canonicalMediaProviderId;
|
|
@@ -5,7 +5,6 @@ export const VENDOR_API_BASE_URLS = {
|
|
|
5
5
|
anthropic: 'https://api.anthropic.com', openai: 'https://api.openai.com/v1', azure: '',
|
|
6
6
|
google: 'https://generativelanguage.googleapis.com', openrouter: 'https://openrouter.ai/api/v1',
|
|
7
7
|
ollama: 'http://localhost:11434/v1', volcengine: 'https://ark.cn-beijing.volces.com/api/v3',
|
|
8
|
-
grok: 'https://api.x.ai/v1',
|
|
9
8
|
imagerouter: 'https://api.imagerouter.io/v1/openai', comfyui: 'http://127.0.0.1:8188',
|
|
10
9
|
bfl: 'https://api.bfl.ai', fal: 'https://fal.run', leonardo: 'https://cloud.leonardo.ai/api/rest/v1',
|
|
11
10
|
replicate: 'https://api.replicate.com', minimax: 'https://api.minimaxi.chat/v1',
|
|
@@ -15,19 +14,22 @@ export const VENDOR_API_BASE_URLS = {
|
|
|
15
14
|
/** Old UI ids remain accepted at boundaries; canonical ids match the existing dispatch catalog. */
|
|
16
15
|
export const MEDIA_PROVIDER_ID_ALIASES = {
|
|
17
16
|
'nano-banana': 'nanobanana', 'custom-image-api': CUSTOM_IMAGE_PROVIDER_ID, 'fal-ai': 'fal',
|
|
18
|
-
'leonardo-ai': 'leonardo', 'tavily-search': 'tavily', 'volcengine-ark': 'volcengine',
|
|
17
|
+
'leonardo-ai': 'leonardo', 'tavily-search': 'tavily', 'volcengine-ark': 'volcengine',
|
|
19
18
|
};
|
|
20
|
-
/** Resolve legacy aliases without changing unknown extension IDs. @complexity O(1). */
|
|
21
|
-
export function canonicalMediaProviderId({ id },
|
|
19
|
+
/** Resolve legacy aliases without changing unknown extension IDs. `aliases` is host-injected legacy ids layered over the built-in table. @complexity O(1). */
|
|
20
|
+
export function canonicalMediaProviderId({ id }, { aliases = {} } = {}) {
|
|
21
|
+
if (Object.prototype.hasOwnProperty.call(aliases, id))
|
|
22
|
+
return aliases[id];
|
|
22
23
|
return Object.prototype.hasOwnProperty.call(MEDIA_PROVIDER_ID_ALIASES, id) ? MEDIA_PROVIDER_ID_ALIASES[id] : id;
|
|
23
24
|
}
|
|
24
25
|
/** Canonical entries win conflicts, so an old alias can never replace a newer explicit edit.
|
|
25
26
|
* Returns a copy without changing supplied values or reading credentials. @complexity O(n) entries. */
|
|
26
|
-
export function normalizeMediaProviderMap({ providers },
|
|
27
|
+
export function normalizeMediaProviderMap({ providers }, { aliases = {} } = {}) {
|
|
27
28
|
const entries = Object.entries(providers);
|
|
29
|
+
const canonical = (id) => canonicalMediaProviderId({ id }, { aliases });
|
|
28
30
|
return Object.fromEntries([
|
|
29
|
-
...entries.filter(([id]) =>
|
|
30
|
-
...entries.filter(([id]) =>
|
|
31
|
+
...entries.filter(([id]) => canonical(id) !== id).map(([id, value]) => [canonical(id), value]),
|
|
32
|
+
...entries.filter(([id]) => canonical(id) === id),
|
|
31
33
|
]);
|
|
32
34
|
}
|
|
33
35
|
/** Host-injected UI policy; reuse the catalog's existing identity and normalization owner. */
|
|
@@ -35,7 +37,6 @@ export const mediaProviderCatalogPolicy = { canonicalMediaProviderId, normalizeM
|
|
|
35
37
|
export const MEDIA_PROVIDERS = [
|
|
36
38
|
{ id: 'openai', label: 'OpenAI', hint: 'gpt-image-2 / dall-e-3', integrated: true, defaultBaseUrl: VENDOR_API_BASE_URLS.openai },
|
|
37
39
|
{ id: 'volcengine', label: 'Volcengine Ark (Doubao)', hint: 'Seedance 2.0 / Seedream', integrated: true, defaultBaseUrl: VENDOR_API_BASE_URLS.volcengine },
|
|
38
|
-
{ id: 'grok', label: 'xAI Grok Imagine', hint: 'grok-imagine — image + video with native audio', integrated: true, defaultBaseUrl: VENDOR_API_BASE_URLS.grok },
|
|
39
40
|
{ id: 'hyperframes', label: 'HyperFrames', hint: 'Local HTML -> MP4 renderer', integrated: false, credentialsRequired: false, settingsVisible: false },
|
|
40
41
|
{ id: 'nanobanana', label: 'Nano Banana', hint: 'Google official by default; custom gateway configurable', integrated: true, defaultBaseUrl: VENDOR_API_BASE_URLS.google, supportsCustomModel: true },
|
|
41
42
|
{ id: 'imagerouter', label: 'ImageRouter', hint: 'OpenAI-compatible image + video routing', integrated: true, defaultBaseUrl: VENDOR_API_BASE_URLS.imagerouter, docsUrl: 'https://docs.imagerouter.io/api-reference/image-generation/', supportsCustomModel: true, customModelPlaceholder: 'openai/gpt-image-2 or xAI/grok-imagine-video' },
|
|
@@ -84,7 +85,6 @@ export const IMAGE_MODELS = [
|
|
|
84
85
|
{ id: 'doubao-seedream-5-0-260128', label: 'seedream-5.0', hint: 'SenseAudio · ByteDance Seedream 5.0 hi-res', provider: 'senseaudio', caps: ['t2i', 'i2i'] },
|
|
85
86
|
{ id: 'aihubmix-gpt-image-1', label: 'gpt-image-1 (AIHubMix)', hint: 'AIHubMix · OpenAI gpt-image-1', provider: 'aihubmix', caps: ['t2i', 'i2i'] },
|
|
86
87
|
{ id: 'aihubmix-dall-e-3', label: 'dall-e-3 (AIHubMix)', hint: 'AIHubMix · OpenAI DALL·E 3', provider: 'aihubmix', caps: ['t2i'] },
|
|
87
|
-
{ id: 'grok-imagine-image', label: 'grok-imagine-image', hint: 'xAI · 2K text-to-image', provider: 'grok', caps: ['t2i'] },
|
|
88
88
|
{ id: 'gemini-3.1-flash-image-preview', label: 'nano-banana-2', hint: 'Nano Banana · text-to-image', provider: 'nanobanana', caps: ['t2i'] },
|
|
89
89
|
{ id: 'openai/gpt-image-2', label: 'openai/gpt-image-2', hint: 'ImageRouter · routed GPT Image', provider: 'imagerouter', caps: ['t2i'] },
|
|
90
90
|
{ id: 'openai/gpt-image-1.5', label: 'openai/gpt-image-1.5', hint: 'ImageRouter · routed GPT Image', provider: 'imagerouter', caps: ['t2i'] },
|
|
@@ -122,7 +122,6 @@ export const VIDEO_MODELS = [
|
|
|
122
122
|
{ id: 'doubao-seedance-1-0-pro-250528', label: 'seedance-1.0-pro', hint: 'ByteDance · 1.0', provider: 'volcengine', caps: ['t2v', 'i2v'] },
|
|
123
123
|
{ id: 'doubao-seedance-1-0-lite-i2v-250428', label: 'seedance-1.0-lite-i2v', hint: 'ByteDance · image-to-video', provider: 'volcengine', caps: ['i2v'] },
|
|
124
124
|
{ id: 'doubao-seedance-1-0-lite-t2v-250428', label: 'seedance-1.0-lite-t2v', hint: 'ByteDance · text-to-video', provider: 'volcengine', caps: ['t2v'] },
|
|
125
|
-
{ id: 'grok-imagine-video', label: 'grok-imagine-video', hint: 'xAI · 720p t2v + i2v + native audio', provider: 'grok', caps: ['t2v', 'i2v', 'audio'] },
|
|
126
125
|
{ id: 'openrouter/bytedance/seedance-2.0:1080p', label: 'seedance-2.0 1080p (OR)', hint: 'OpenRouter · ByteDance · 1080p', provider: 'openrouter', caps: ['t2v', 'i2v'], default: true },
|
|
127
126
|
{ id: 'openrouter/bytedance/seedance-2.0', label: 'seedance-2.0 720p (OR)', hint: 'OpenRouter · ByteDance · 720p', provider: 'openrouter', caps: ['t2v', 'i2v'] },
|
|
128
127
|
{ id: 'openrouter/bytedance/seedance-2.0:480p', label: 'seedance-2.0 480p (OR)', hint: 'OpenRouter · ByteDance · 480p', provider: 'openrouter', caps: ['t2v', 'i2v'] },
|
|
@@ -163,7 +162,6 @@ export const AUDIO_MODELS_BY_KIND = {
|
|
|
163
162
|
{ id: 'doubao-tts', label: 'doubao-tts', hint: 'Volcengine', provider: 'volcengine', caps: ['tts'] },
|
|
164
163
|
{ id: 'gpt-4o-mini-tts', label: 'gpt-4o-mini-tts', hint: 'OpenAI', provider: 'openai', caps: ['tts'] },
|
|
165
164
|
{ id: 'aihubmix-tts-1', label: 'tts-1 (AIHubMix)', hint: 'AIHubMix · OpenAI tts-1', provider: 'aihubmix', caps: ['tts'] },
|
|
166
|
-
{ id: 'grok-tts', label: 'grok-tts', hint: 'xAI · multilingual · uses Grok subscription', provider: 'grok', caps: ['tts'] },
|
|
167
165
|
],
|
|
168
166
|
sfx: [
|
|
169
167
|
{ id: 'elevenlabs-sfx', label: 'elevenlabs-sfx', hint: 'ElevenLabs SFX', provider: 'elevenlabs', caps: ['sfx'], default: true },
|
|
@@ -213,7 +211,6 @@ export function modelsForSurface({ surface }, { audioKind } = {}) {
|
|
|
213
211
|
export const PROVIDER_CREDENTIAL_ENV_VARS = {
|
|
214
212
|
openai: ['OPENAI_API_KEY'],
|
|
215
213
|
volcengine: ['ARK_API_KEY', 'VOLCENGINE_API_KEY'],
|
|
216
|
-
grok: ['XAI_API_KEY'],
|
|
217
214
|
nanobanana: ['GOOGLE_API_KEY', 'GEMINI_API_KEY'],
|
|
218
215
|
imagerouter: ['IMAGEROUTER_API_KEY'],
|
|
219
216
|
openrouter: ['OPENROUTER_API_KEY'],
|
|
@@ -17,19 +17,19 @@
|
|
|
17
17
|
* addition beyond the port interface to release the file handle — the same
|
|
18
18
|
* shape `SqliteEventLog extends EventLog` already established.
|
|
19
19
|
*
|
|
20
|
-
* **Why this lives in `@jini-ai/media` itself, not
|
|
20
|
+
* **Why this lives in `@jini-ai/media` itself, not a separate SQLite storage package** (the
|
|
21
21
|
* "natural" home per the `EventLog` precedent, where the durable adapter
|
|
22
|
-
* lives in a separate package from the port it implements):
|
|
22
|
+
* lives in a separate package from the port it implements): that package
|
|
23
23
|
* is one of `scripts/check-engine-boundaries.ts`'s 14 *locked* packages;
|
|
24
24
|
* `@jini-ai/media` is listed in `UNLOCKED.md` with `status: "incubating"`.
|
|
25
25
|
* `check-engine-boundaries.ts`'s R7 rule forbids a locked package from
|
|
26
|
-
* importing an unlocked, non-`"stable"` one —
|
|
26
|
+
* importing an unlocked, non-`"stable"` one — that package depending on
|
|
27
27
|
* `@jini-ai/media` for `MediaTaskStore`'s types would fail `pnpm guard`
|
|
28
28
|
* outright. Implementing the adapter inside `@jini-ai/media` (itself
|
|
29
29
|
* unlocked, so unrestricted in what it may depend on) keeps the exact same
|
|
30
30
|
* schema/transaction/WAL/`close()` conventions without a guard violation.
|
|
31
31
|
* See `ADS-memory/reports/proposals/PROP-media-durable-tasks-2026-07-21.md`
|
|
32
|
-
* for the open question of whether this should move
|
|
32
|
+
* for the open question of whether this should move beside the other SQLite stores (for example `@jini-ai/daemon/store/event-log/sqlite`) once
|
|
33
33
|
* `@jini-ai/media` is promoted to `"stable"`.
|
|
34
34
|
*
|
|
35
35
|
* Implements `task-store.ts`'s `MediaTaskStore` port exactly: same
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* (queued → running → done|failed|interrupted, boot-time reconciliation of
|
|
12
12
|
* orphaned in-flight tasks, TTL-based terminal-task pruning) without a SQL
|
|
13
13
|
* schema or an OD project reference. A durable adapter (a future
|
|
14
|
-
*
|
|
14
|
+
* SQLite store addition) implements the same interface — see
|
|
15
15
|
* `archived provenance ledger`.
|
|
16
16
|
*/
|
|
17
17
|
export type MediaTaskStatus = 'queued' | 'running' | 'done' | 'failed' | 'interrupted';
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* (queued → running → done|failed|interrupted, boot-time reconciliation of
|
|
12
12
|
* orphaned in-flight tasks, TTL-based terminal-task pruning) without a SQL
|
|
13
13
|
* schema or an OD project reference. A durable adapter (a future
|
|
14
|
-
*
|
|
14
|
+
* SQLite store addition) implements the same interface — see
|
|
15
15
|
* `archived provenance ledger`.
|
|
16
16
|
*/
|
|
17
17
|
import { applyTaskPatch, assertValidTerminalTtl, buildNewTask, reconcileAction, TERMINAL_STATUSES } from './task-lifecycle.js';
|
|
@@ -12,42 +12,6 @@
|
|
|
12
12
|
export type MediaSurface = 'image' | 'video' | 'audio';
|
|
13
13
|
/** Sub-kind of `'audio'` — audio generation splits into three distinct model families. */
|
|
14
14
|
export type AudioKind = 'music' | 'speech' | 'sfx';
|
|
15
|
-
/**
|
|
16
|
-
* A third-party media-generation vendor (e.g. OpenAI, Fal.ai, ElevenLabs).
|
|
17
|
-
* Reference/catalogue data, not a live connection — a host resolves
|
|
18
|
-
* `credentialsRequired`/`defaultBaseUrl` into its own credential storage.
|
|
19
|
-
*/
|
|
20
|
-
export interface MediaProvider {
|
|
21
|
-
readonly id: string;
|
|
22
|
-
readonly label: string;
|
|
23
|
-
readonly hint: string;
|
|
24
|
-
/**
|
|
25
|
-
* Whether this package's dispatch engine has a real adapter/renderer registered for this
|
|
26
|
-
* provider (vs. a planned/future integration that exists only as this catalogue entry). See
|
|
27
|
-
* `dispatch/vendor-registry.ts`'s `mediaVendorRegistry` and `dispatch/engine.ts`'s `ROUTES`
|
|
28
|
-
* table for where that registration actually lives — `providers.test.ts` asserts every
|
|
29
|
-
* `true` entry with a catalogued model resolves to one, so this flag can't drift from
|
|
30
|
-
* reality the way it did for `hyperframes`/`fal`/`leonardo` (all three claimed `true` with
|
|
31
|
-
* no adapter anywhere).
|
|
32
|
-
*/
|
|
33
|
-
readonly integrated: boolean;
|
|
34
|
-
readonly defaultBaseUrl?: string;
|
|
35
|
-
readonly docsUrl?: string;
|
|
36
|
-
readonly credentialsRequired?: boolean;
|
|
37
|
-
readonly settingsVisible?: boolean;
|
|
38
|
-
readonly supportsCustomModel?: boolean;
|
|
39
|
-
readonly customModelPlaceholder?: string;
|
|
40
|
-
}
|
|
41
|
-
/** A specific generation model offered by a `MediaProvider`. */
|
|
42
|
-
export interface MediaModel {
|
|
43
|
-
readonly id: string;
|
|
44
|
-
readonly label: string;
|
|
45
|
-
readonly hint: string;
|
|
46
|
-
readonly provider: string;
|
|
47
|
-
/** Capability tags, e.g. `t2i`/`i2i`/`inpaint`/`t2v`/`i2v`/`tts`. Open-ended by design — see `archived provenance ledger`. */
|
|
48
|
-
readonly caps: readonly string[];
|
|
49
|
-
readonly default?: boolean;
|
|
50
|
-
}
|
|
51
15
|
/**
|
|
52
16
|
* Request-shape family, keyed off the resolved upstream model name. Each
|
|
53
17
|
* family is a distinct wire shape a real vendor gateway expects — see
|
|
@@ -71,10 +71,6 @@ const starterCatalog = [
|
|
|
71
71
|
id: 'volcengine-ark',
|
|
72
72
|
label: 'Volcengine Ark (Doubao)',
|
|
73
73
|
},
|
|
74
|
-
{
|
|
75
|
-
id: 'xai-grok-imagine',
|
|
76
|
-
label: 'xAI Grok Imagine',
|
|
77
|
-
},
|
|
78
74
|
];
|
|
79
75
|
export const DEFAULT_MEDIA_PROVIDER_CATALOG = starterCatalog.map((entry) => {
|
|
80
76
|
const id = canonicalMediaProviderId({ id: entry.id });
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
type Empty = Record<string, never>;
|
|
2
|
+
type AdminByokSaveState = {
|
|
3
|
+
status: "idle";
|
|
4
|
+
} | {
|
|
5
|
+
status: "saving";
|
|
6
|
+
} | {
|
|
7
|
+
status: "saved";
|
|
8
|
+
} | {
|
|
9
|
+
status: "error";
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
interface AdminExecutionCredentialController {
|
|
13
|
+
legacyKey: string | null;
|
|
14
|
+
saveState: AdminByokSaveState;
|
|
15
|
+
migrateLegacyKey: () => Promise<void>;
|
|
16
|
+
dismissLegacyPrompt: () => void;
|
|
17
|
+
canSaveKey: boolean;
|
|
18
|
+
stored: {
|
|
19
|
+
isSet: boolean;
|
|
20
|
+
} | null;
|
|
21
|
+
storedKeyIsForOtherEndpoint: boolean;
|
|
22
|
+
saveKey: () => Promise<void>;
|
|
23
|
+
settingsSaveState: AdminByokSaveState;
|
|
24
|
+
saveSettings: () => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export interface AdminByokMigrationPromptProps {
|
|
27
|
+
controller: Pick<AdminExecutionCredentialController, "legacyKey" | "saveState" | "migrateLegacyKey" | "dismissLegacyPrompt">;
|
|
28
|
+
/** This prompt's own base handle — see this file's header for the derived `-save`/`-dismiss`
|
|
29
|
+
* sub-handles. Omit to leave it untagged. */
|
|
30
|
+
agentHandle?: string;
|
|
31
|
+
useAdminLocaleHook: () => string;
|
|
32
|
+
createTranslator: (required: {
|
|
33
|
+
locale: string;
|
|
34
|
+
}, options?: Empty) => (required: {
|
|
35
|
+
key: string;
|
|
36
|
+
}, options?: Empty) => string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The one-time "we found a saved key in this browser — save it to your account?" prompt (owner-
|
|
40
|
+
* approved rollout, design doc §6). Renders nothing once `controller.legacyKey` is `null` —
|
|
41
|
+
* migrated, declined this session, or there was never a local key to find.
|
|
42
|
+
*
|
|
43
|
+
* @complexity Time/space: O(1) — fixed markup, no iteration.
|
|
44
|
+
* @overallScore 100
|
|
45
|
+
*/
|
|
46
|
+
export declare function AdminByokMigrationPrompt({ controller, agentHandle: base, useAdminLocaleHook, createTranslator }: AdminByokMigrationPromptProps): import("react").JSX.Element | null;
|
|
47
|
+
export interface AdminByokKeyFooterProps {
|
|
48
|
+
resolveByokFooterStatusLine: (required: {
|
|
49
|
+
status: AdminByokSaveState["status"];
|
|
50
|
+
isStored: boolean;
|
|
51
|
+
}, options?: {
|
|
52
|
+
storedKeyIsForOtherEndpoint?: boolean;
|
|
53
|
+
t?: (key: string) => string;
|
|
54
|
+
}) => string | null;
|
|
55
|
+
controller: Pick<AdminExecutionCredentialController, "saveState" | "canSaveKey" | "stored" | "storedKeyIsForOtherEndpoint" | "saveKey">;
|
|
56
|
+
/** Publishes the "Save key" button as agent-addressable via `agentHandle()` (`@jini-ai/agentic`).
|
|
57
|
+
* Omit to leave it untagged. */
|
|
58
|
+
agentHandle?: string;
|
|
59
|
+
/** The host screen's `t`, for the status line. Omit for English passthrough. */
|
|
60
|
+
t?: (key: string) => string;
|
|
61
|
+
useAdminLocaleHook: () => string;
|
|
62
|
+
createTranslator: (required: {
|
|
63
|
+
locale: string;
|
|
64
|
+
}, options?: Empty) => (required: {
|
|
65
|
+
key: string;
|
|
66
|
+
}, options?: Empty) => string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The explicit "Save key" control and its status line — the ONLY control on either screen that
|
|
70
|
+
* writes the admin's KEY. Meant for `ExecutionTab`'s `apiKeyFooter` slot, directly under the
|
|
71
|
+
* API-key field. Its sibling {@link AdminByokSettingsFooter} writes the non-secret fields and
|
|
72
|
+
* nothing else.
|
|
73
|
+
*
|
|
74
|
+
* While idle with a key stored for another endpoint (a provider switch), the line asks for this
|
|
75
|
+
* provider's key rather than reporting a stored key this provider cannot use.
|
|
76
|
+
*
|
|
77
|
+
* @complexity Time/space: O(1).
|
|
78
|
+
*/
|
|
79
|
+
export declare function AdminByokKeyFooter({ controller, agentHandle: handle, t, useAdminLocaleHook, createTranslator, resolveByokFooterStatusLine }: AdminByokKeyFooterProps): import("react").JSX.Element;
|
|
80
|
+
export interface AdminByokSettingsFooterProps {
|
|
81
|
+
controller: Pick<AdminExecutionCredentialController, "settingsSaveState" | "saveSettings">;
|
|
82
|
+
/** Publishes the "Save settings" button as agent-addressable via `agentHandle()`
|
|
83
|
+
* (`@jini-ai/agentic`). Omit to leave it untagged. */
|
|
84
|
+
agentHandle?: string;
|
|
85
|
+
/** The host screen's `t`, for the status line. Omit for English passthrough. */
|
|
86
|
+
t?: (key: string) => string;
|
|
87
|
+
useAdminLocaleHook: () => string;
|
|
88
|
+
createTranslator: (required: {
|
|
89
|
+
locale: string;
|
|
90
|
+
}, options?: Empty) => (required: {
|
|
91
|
+
key: string;
|
|
92
|
+
}, options?: Empty) => string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* {@link AdminByokSettingsFooter}'s status line, as a single string (or `null`) — the sibling of
|
|
96
|
+
* {@link resolveByokFooterStatusLine}, kept as its own pure function for the same reason.
|
|
97
|
+
*
|
|
98
|
+
* Deliberately says "Settings saved." and never anything about encryption or the server holding a
|
|
99
|
+
* key. This button sends no `apiKey`, so borrowing the key footer's "Saved to the server,
|
|
100
|
+
* encrypted." would recreate — under a new button — the exact false confirmation the split exists to
|
|
101
|
+
* remove.
|
|
102
|
+
*
|
|
103
|
+
* `error` returns `null` because the message itself is rendered separately, same division of labour
|
|
104
|
+
* as the key footer.
|
|
105
|
+
*
|
|
106
|
+
* @param input.status - The `settingsSaveState` status this footer reports on.
|
|
107
|
+
* @param options.t - The host screen's translator. Defaults to English passthrough.
|
|
108
|
+
* @returns The line to render, or `null` when there is nothing to say.
|
|
109
|
+
* @complexity O(1).
|
|
110
|
+
*/
|
|
111
|
+
export declare function resolveByokSettingsStatusLine({ status }: {
|
|
112
|
+
status: AdminByokSaveState["status"];
|
|
113
|
+
}, { t }?: {
|
|
114
|
+
t?: (key: string) => string;
|
|
115
|
+
}): string | null;
|
|
116
|
+
/**
|
|
117
|
+
* The explicit "Save settings" control and its status line — the ONLY control on either screen that
|
|
118
|
+
* writes the credential row's protocol/providerId/base URL/model/max-tokens snapshot. Meant for
|
|
119
|
+
* `ExecutionTab`'s `formFooter` slot, at the foot of the BYOK card under the fields it writes.
|
|
120
|
+
*
|
|
121
|
+
* Never disabled by the key field's state, only by its own in-flight save: settings are not the key,
|
|
122
|
+
* and a blank key field is no reason to refuse a model change. That independence is the point of the
|
|
123
|
+
* split — see the controller's `saveSettings` doc for why this button, not `saveKey`, is what keeps
|
|
124
|
+
* the server-side turn-execution fallback current.
|
|
125
|
+
*
|
|
126
|
+
* @complexity Time/space: O(1).
|
|
127
|
+
*/
|
|
128
|
+
export declare function AdminByokSettingsFooter({ controller, agentHandle: handle, t, useAdminLocaleHook, createTranslator }: AdminByokSettingsFooterProps): import("react").JSX.Element;
|
|
129
|
+
export {};
|
|
130
|
+
//# sourceMappingURL=AdminByokKeyPanel.d.ts.map
|