@shop-os/modelkit 0.2.25 → 0.2.27

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 CHANGED
@@ -9,6 +9,19 @@ header in the release PR.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [0.2.27] - Unreleased
13
+
14
+ ### Fixed
15
+ - A `sloosh` call never goes through the Cloudflare AI Gateway. With `routing.fal: "cloudflare-passthrough"` or `routing.text: "cloudflare"` the gateway's BYOK secrets are the pro provider keys, so a sloosh call through it spent the pro account and, because the tier had no gateway token, failed first with `auth` ("Missing Sloosh API key for cloudflare"). The kit now resolves the routing per tier: sloosh calls the provider directly with `keys.sloosh` (`fal`, or the vendor key); pro and enterprise keep the gateway (ENG-2990).
16
+
17
+ ## [0.2.26] - Unreleased
18
+
19
+ ### Added
20
+ - `providerOptions.modelkit.inputSpec` now works on Replicate image rows, so a new Replicate image model is a database row with no kit change. Image rows use `IMAGE_INPUT_SPEC_KEYS`: `prompt`, `references` (an array, mapped to the provider's field such as `images`), `aspectRatio`, `size`, `outputFormat`, `seed`. Use `values` to remap `size` (`1K` to `1k`) and `outputFormat` (`jpeg` to `jpg`) and `static` for literal fields. `outputFormat` and `seed` fields need the matching `constraints.supports` entry. `aspectRatio: "adaptive"` is omitted. A Replicate image row with a hard-coded kind (topaz, upscaler, wan, qwen) ignores `inputSpec`; a row with no `inputSpec` keeps the old generic `prompt` + `image` request. `upscale` and `bg-remove` rows still reject `inputSpec`.
21
+
22
+ ### Live rows to add after publish
23
+ Add a Replicate image row that carries an `inputSpec` (for example `black-forest-labs/flux-3-image`) to pro-backend's `model_catalog` only after every app that will call it runs 0.2.26. An older kit accepts the row but ignores the `inputSpec`, so it sends only `prompt` and a single `image` and drops the references, ratio and size.
24
+
12
25
  ## [0.2.25] - Unreleased
13
26
 
14
27
  ### Added
package/README.md CHANGED
@@ -194,12 +194,15 @@ The Bedrock model id is `<routing.bedrockProfile>.anthropic.<providerModelId>`
194
194
  breaks the pattern sets `providerOptions.modelkit.bedrockModelId` on its row.
195
195
  See the CHANGELOG entry for the caller-visible Bedrock limits.
196
196
 
197
- A Replicate video or audio row for a new model carries `providerOptions.modelkit.inputSpec`
197
+ A Replicate video, image or audio row for a new model carries `providerOptions.modelkit.inputSpec`
198
198
  instead of a kit change. It is read by the Replicate adapter only. `fields` maps a canonical key to the provider field name,
199
199
  `values` remaps canonical values per key, and `static` merges literal provider fields
200
200
  last. Video rows use `VIDEO_INPUT_SPEC_KEYS` (`prompt`, `durationSeconds`,
201
201
  `aspectRatio`, `resolution`, `firstFrame`, `lastFrame`, `seed`, `negativePrompt`,
202
- `generateAudio`, `cfgScale`, `promptExpansion`, `referenceImages`); audio rows use
202
+ `generateAudio`, `cfgScale`, `promptExpansion`, `referenceImages`); image rows use
203
+ `IMAGE_INPUT_SPEC_KEYS` (`prompt`, `references`, `aspectRatio`, `size`, `outputFormat`,
204
+ `seed`; map `references` to the provider's array field and remap `size` and `outputFormat`
205
+ with `values`); audio rows use
203
206
  `AUDIO_INPUT_SPEC_KEYS` (`prompt`, `durationSeconds`, `seed`, `negativePrompt`,
204
207
  `references`, `sourceVideo`, `instrumental`). `aspectRatio: "adaptive"` is omitted.
205
208
  `validateInputSpec` is the shared contract the write schema, `dataOnlyCapable`, and
package/dist/catalog.cjs CHANGED
@@ -2154,6 +2154,14 @@ var VIDEO_INPUT_SPEC_KEYS = [
2154
2154
  "promptExpansion",
2155
2155
  "referenceImages"
2156
2156
  ];
2157
+ var IMAGE_INPUT_SPEC_KEYS = [
2158
+ "prompt",
2159
+ "references",
2160
+ "aspectRatio",
2161
+ "size",
2162
+ "outputFormat",
2163
+ "seed"
2164
+ ];
2157
2165
  var AUDIO_INPUT_SPEC_KEYS = [
2158
2166
  "prompt",
2159
2167
  "durationSeconds",
@@ -2170,14 +2178,22 @@ var INPUT_SPEC_SUPPORTS_KEYS = [
2170
2178
  "generateAudio",
2171
2179
  "cfgScale",
2172
2180
  "promptExpansion",
2181
+ "outputFormat",
2173
2182
  "instrumental"
2174
2183
  ];
2175
2184
  var VIDEO_KEY_SET = new Set(VIDEO_INPUT_SPEC_KEYS);
2185
+ var IMAGE_KEY_SET = new Set(IMAGE_INPUT_SPEC_KEYS);
2176
2186
  var AUDIO_KEY_SET = new Set(AUDIO_INPUT_SPEC_KEYS);
2177
2187
  var ALL_KEY_SET = /* @__PURE__ */ new Set([
2178
2188
  ...VIDEO_INPUT_SPEC_KEYS,
2189
+ ...IMAGE_INPUT_SPEC_KEYS,
2179
2190
  ...AUDIO_INPUT_SPEC_KEYS
2180
2191
  ]);
2192
+ var ALLOWED_KEYS_BY_TYPE = /* @__PURE__ */ new Map([
2193
+ ["video", VIDEO_KEY_SET],
2194
+ ["image", IMAGE_KEY_SET],
2195
+ ["audio", AUDIO_KEY_SET]
2196
+ ]);
2181
2197
  var ProviderScalarSchema = import_zod2.z.union([import_zod2.z.string(), import_zod2.z.number(), import_zod2.z.boolean()]);
2182
2198
  var FieldsSchema = import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string().min(1)).superRefine((fields, ctx) => {
2183
2199
  const keys = Object.keys(fields);
@@ -2243,13 +2259,13 @@ function validateInputSpec(raw, row) {
2243
2259
  };
2244
2260
  }
2245
2261
  const issues = [];
2246
- if (row.type !== "video" && row.type !== "audio") {
2262
+ const allowed = ALLOWED_KEYS_BY_TYPE.get(row.type);
2263
+ if (allowed === void 0) {
2247
2264
  issues.push({
2248
2265
  path: [],
2249
2266
  message: `inputSpec is not supported for "${row.type}" rows`
2250
2267
  });
2251
2268
  } else {
2252
- const allowed = row.type === "video" ? VIDEO_KEY_SET : AUDIO_KEY_SET;
2253
2269
  for (const key of Object.keys(spec.fields)) {
2254
2270
  if (!allowed.has(key)) {
2255
2271
  issues.push({