@kolbo/mcp 1.55.0 → 1.56.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/package.json +1 -1
- package/src/apps/widgets/upload.js +19 -2
- package/src/tools/generate.js +7 -2
package/package.json
CHANGED
|
@@ -123,7 +123,8 @@ function addFiles(list) {
|
|
|
123
123
|
if (items.length >= maxFiles) break;
|
|
124
124
|
var f = list[i];
|
|
125
125
|
var kind = classify(f.name);
|
|
126
|
-
var it = { file: f, kind: kind, status: 'queued', pct: 0, url: null, err: null, id: nextItemId
|
|
126
|
+
var it = { file: f, kind: kind, status: 'queued', pct: 0, url: null, err: null, id: nextItemId++, thumb: null };
|
|
127
|
+
if (kind === 'image') { try { it.thumb = URL.createObjectURL(f); } catch (e) {} }
|
|
127
128
|
var allowedKinds = state.kinds && state.kinds.length ? state.kinds : ['image','video','audio','document'];
|
|
128
129
|
if (!kind || allowedKinds.indexOf(kind) === -1) {
|
|
129
130
|
it.status = 'error'; it.err = 'Unsupported file type';
|
|
@@ -201,9 +202,12 @@ function rowHtml(it) {
|
|
|
201
202
|
var bar = it.status === 'uploading'
|
|
202
203
|
? '<div style="height:3px;border-radius:2px;background:var(--surface);margin-top:5px;overflow:hidden"><div id="bar-' + it.id + '" style="height:100%;width:' + it.pct + '%;background:var(--accent,#7c6cff);transition:width .2s"></div></div>'
|
|
203
204
|
: '';
|
|
205
|
+
var left = it.thumb
|
|
206
|
+
? '<img data-thumb="' + it.id + '" src="' + it.thumb + '" alt="" style="width:34px;height:34px;object-fit:cover;border-radius:7px;flex:none;border:1px solid var(--border);background:var(--surface)">'
|
|
207
|
+
: '<span>' + icon + '</span>';
|
|
204
208
|
return '<div id="row-' + it.id + '" style="padding:8px 10px;border:1px solid var(--border);border-radius:10px;margin-bottom:6px;background:var(--surface)">' +
|
|
205
209
|
'<div style="display:flex;align-items:center;gap:8px;font-size:12.5px">' +
|
|
206
|
-
|
|
210
|
+
left +
|
|
207
211
|
'<span style="flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap" title="' + esc(it.file.name) + '">' + esc(it.file.name) + '</span>' +
|
|
208
212
|
'<span style="color:var(--text-muted);font-size:11px">' + fmtSize(it.file.size) + '</span>' +
|
|
209
213
|
'<span id="status-' + it.id + '" style="font-size:11.5px">' + right + '</span>' +
|
|
@@ -219,6 +223,19 @@ function renderRow(it) {
|
|
|
219
223
|
|
|
220
224
|
function render() {
|
|
221
225
|
el('rows').innerHTML = items.map(rowHtml).join('');
|
|
226
|
+
// Thumbnail fallback chain: local blob preview -> CDN URL (allowlisted in the
|
|
227
|
+
// host CSP) once uploaded -> plain type icon.
|
|
228
|
+
Array.prototype.forEach.call(el('rows').querySelectorAll('[data-thumb]'), function (img) {
|
|
229
|
+
img.onerror = function () {
|
|
230
|
+
var id = Number(img.getAttribute('data-thumb'));
|
|
231
|
+
for (var i = 0; i < items.length; i++) {
|
|
232
|
+
if (items[i].id !== id) continue;
|
|
233
|
+
if (items[i].url && img.src !== items[i].url) { img.src = items[i].url; return; }
|
|
234
|
+
items[i].thumb = null;
|
|
235
|
+
}
|
|
236
|
+
render();
|
|
237
|
+
};
|
|
238
|
+
});
|
|
222
239
|
Array.prototype.forEach.call(el('rows').querySelectorAll('[data-retry]'), function (a) {
|
|
223
240
|
a.onclick = function (e) {
|
|
224
241
|
e.preventDefault();
|
package/src/tools/generate.js
CHANGED
|
@@ -767,9 +767,13 @@ function registerGenerateTools(server, client, options = {}) {
|
|
|
767
767
|
enhance_prompt: z.boolean().optional().describe('Enhance the prompt. Default: false — only pass true if the user explicitly asks to enhance/improve the prompt.'),
|
|
768
768
|
visual_dna_ids: z.array(z.string()).optional().describe('Array of Visual DNA profile IDs to apply for character/style consistency across outputs. **Cap: pass at most `max_visual_dna` IDs from list_models for the chosen model.**'),
|
|
769
769
|
resolution: z.string().optional().describe('Video resolution tier (vertical pixels): "720p" / "1080p" / "1440p" / "2160p". Model-dependent — call list_models and read supported_resolutions.'),
|
|
770
|
+
keyframes: z.array(z.object({
|
|
771
|
+
image_url: z.string().describe('Public URL of the keyframe image'),
|
|
772
|
+
timestamp_seconds: z.number().describe('Moment on the OUTPUT timeline (seconds, 0 = first frame) where this image is pinned')
|
|
773
|
+
})).optional().describe('Timeline-pinned keyframes for multi-keyframe models (e.g. "flux-3-keyframes", "luma-ray-3-2-storyboard"): the model generates the motion BETWEEN the pinned images. Only models with `supports_keyframes: true` in list_models accept this; cap = `max_keyframes` (FLUX 3: 10). Requires an explicit `duration` — timestamps beyond it are clamped. Ignored by ordinary elements models. OPTIONAL for flux-3-keyframes: if omitted, pass the images via reference_images instead — they are played through IN ORDER, timed from timing language in the prompt or spaced evenly. Pass explicit keyframes only when you need exact control.'),
|
|
770
774
|
project_id: projectIdField
|
|
771
775
|
},
|
|
772
|
-
async ({ prompt, model, reference_images, reference_videos, reference_audio_urls, audio_url, files, duration, aspect_ratio, motion, preset_id, enhance_prompt = false, visual_dna_ids, resolution, project_id }) => {
|
|
776
|
+
async ({ prompt, model, reference_images, reference_videos, reference_audio_urls, audio_url, files, duration, aspect_ratio, motion, preset_id, enhance_prompt = false, visual_dna_ids, resolution, keyframes, project_id }) => {
|
|
773
777
|
model = await canonicalModelId(client, model); // lenient id resolution ("z-image" → "z-image/turbo")
|
|
774
778
|
if (!prompt) throw new Error('prompt is required');
|
|
775
779
|
|
|
@@ -791,6 +795,7 @@ function registerGenerateTools(server, client, options = {}) {
|
|
|
791
795
|
if (reference_audio_urls) form.append('reference_audio_urls', JSON.stringify(reference_audio_urls));
|
|
792
796
|
if (audio_url) form.append('audio_url', audio_url);
|
|
793
797
|
if (resolution) form.append('resolution', resolution);
|
|
798
|
+
if (keyframes) form.append('keyframes', JSON.stringify(keyframes));
|
|
794
799
|
if (project_id) form.append('project_id', project_id);
|
|
795
800
|
for (const f of resolved) {
|
|
796
801
|
form.append('files', f.buffer, { filename: f.filename, contentType: f.contentType });
|
|
@@ -799,7 +804,7 @@ function registerGenerateTools(server, client, options = {}) {
|
|
|
799
804
|
} else {
|
|
800
805
|
// URL-only mode: plain JSON.
|
|
801
806
|
startResponse = await client.post('/v1/generate/elements', {
|
|
802
|
-
prompt, model, reference_images, reference_videos, reference_audio_urls, audio_url, duration, aspect_ratio, motion, preset_id, enhance_prompt, visual_dna_ids, resolution, project_id
|
|
807
|
+
prompt, model, reference_images, reference_videos, reference_audio_urls, audio_url, duration, aspect_ratio, motion, preset_id, enhance_prompt, visual_dna_ids, resolution, keyframes, project_id
|
|
803
808
|
});
|
|
804
809
|
}
|
|
805
810
|
|