@imgly/plugin-ai-generation-web 1.74.0-nightly.20260421 → 1.74.0-rc.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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/gateway/index.d.ts +1 -1
- package/dist/gateway/types.d.ts +64 -2
- package/dist/index.mjs +9 -9
- package/dist/index.mjs.map +3 -3
- package/package.json +2 -2
package/dist/gateway/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type CreativeEditorSDK from '@cesdk/cesdk-js';
|
|
2
2
|
import type { OutputKind, Output, RenderCustomProperty, QuickActionsInput } from '../core/provider';
|
|
3
|
+
import type { Middleware } from '../middleware/middleware';
|
|
3
4
|
import type { GatewayClient } from './createGatewayClient';
|
|
4
5
|
export interface GatewayProviderConfiguration {
|
|
5
6
|
/**
|
|
@@ -37,6 +38,12 @@ export interface GatewayProviderConfiguration {
|
|
|
37
38
|
* Generation errors are handled separately via middleware.
|
|
38
39
|
*/
|
|
39
40
|
onError?: (error: Error) => void;
|
|
41
|
+
/**
|
|
42
|
+
* Middlewares to add to the provider generation. Middlewares run around the
|
|
43
|
+
* base `generate` call and can observe/modify input, retry on failure, add
|
|
44
|
+
* logging, rate limiting, etc.
|
|
45
|
+
*/
|
|
46
|
+
middlewares?: Middleware<any, any>[];
|
|
40
47
|
/**
|
|
41
48
|
* How long (in milliseconds) to cache auth tokens before re-fetching.
|
|
42
49
|
* Concurrent requests while a fetch is in-flight share the same call.
|
|
@@ -44,6 +51,34 @@ export interface GatewayProviderConfiguration {
|
|
|
44
51
|
* @default 300000 (5 minutes)
|
|
45
52
|
*/
|
|
46
53
|
tokenCacheTTL?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Override or disable individual quick actions on top of the provider's
|
|
56
|
+
* capability-derived defaults.
|
|
57
|
+
*
|
|
58
|
+
* - Set a quick-action ID to `false` (or `null`) to disable it for this provider.
|
|
59
|
+
* - Set it to an object with `mapInput` to override how the quick action's
|
|
60
|
+
* input is mapped to the provider's input.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* ImageGatewayProvider('fal-ai/some-model', {
|
|
65
|
+
* gatewayUrl,
|
|
66
|
+
* supportedQuickActions: {
|
|
67
|
+
* 'ly.img.editImage': false, // disable
|
|
68
|
+
* 'ly.img.swapBackground': { // override mapping
|
|
69
|
+
* mapInput: (input) => ({ prompt: input.prompt, image_urls: [input.uri] })
|
|
70
|
+
* }
|
|
71
|
+
* }
|
|
72
|
+
* })
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
supportedQuickActions?: {
|
|
76
|
+
[quickActionId: string]: {
|
|
77
|
+
mapInput: (input: any) => GatewayInput;
|
|
78
|
+
} | {
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
} | true | false | null;
|
|
81
|
+
};
|
|
47
82
|
/**
|
|
48
83
|
* Enable debug logging.
|
|
49
84
|
*/
|
|
@@ -113,8 +148,24 @@ export interface GatewayProviderOptions<K extends OutputKind, O extends Output>
|
|
|
113
148
|
*/
|
|
114
149
|
outputFilter?: (output: GatewaySSEOutput) => boolean;
|
|
115
150
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
151
|
+
* Returns the default quick actions for this model based on its schema
|
|
152
|
+
* (specifically `schema.capability`). Called once after the schema
|
|
153
|
+
* resolves; the result is merged with any `supportedQuickActions`
|
|
154
|
+
* overrides from the provider configuration.
|
|
155
|
+
*
|
|
156
|
+
* Return `undefined` when the model has no quick actions (e.g. a pure
|
|
157
|
+
* text2image model).
|
|
158
|
+
*/
|
|
159
|
+
resolveQuickActions?: (context: {
|
|
160
|
+
schema: GatewaySchemaResult;
|
|
161
|
+
providerId: string;
|
|
162
|
+
cesdk: CreativeEditorSDK;
|
|
163
|
+
}) => QuickActionsInput<GatewayInput> | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* Unconditional quick actions for this provider. Used by content types
|
|
166
|
+
* with a single capability (e.g., text generation where every model
|
|
167
|
+
* accepts the same chat-style input). Mutually exclusive with
|
|
168
|
+
* `resolveQuickActions`.
|
|
118
169
|
*/
|
|
119
170
|
quickActions?: QuickActionsInput<GatewayInput>;
|
|
120
171
|
/**
|
|
@@ -123,10 +174,21 @@ export interface GatewayProviderOptions<K extends OutputKind, O extends Output>
|
|
|
123
174
|
*/
|
|
124
175
|
userFlow?: 'placeholder' | 'generation-only';
|
|
125
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Known gateway capabilities. Unknown string values are allowed for
|
|
179
|
+
* forward compatibility with capabilities added on the server side
|
|
180
|
+
* before the client is updated.
|
|
181
|
+
*/
|
|
182
|
+
export type GatewayCapability = 'text2text' | 'text2image' | 'image2image' | 'text2video' | 'image2video' | 'text2speech' | (string & {});
|
|
126
183
|
export interface GatewaySchemaResult {
|
|
127
184
|
model: string;
|
|
128
185
|
name?: string;
|
|
129
186
|
type: string;
|
|
187
|
+
/**
|
|
188
|
+
* The model's capability (e.g., 'image2image'). Used by the gateway
|
|
189
|
+
* providers to decide which default quick actions to offer.
|
|
190
|
+
*/
|
|
191
|
+
capability: GatewayCapability;
|
|
130
192
|
input_schema: {
|
|
131
193
|
type: 'object';
|
|
132
194
|
required: string[];
|