@kolbo/mcp 1.105.0 → 1.105.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolbo/mcp",
3
- "version": "1.105.0",
3
+ "version": "1.105.1",
4
4
  "description": "Kolbo AI MCP Server - Generate images, videos, music, speech, and sound effects from Claude Code",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -55,6 +55,8 @@ function pageSize() {
55
55
  var audio = items.filter(isAudio).length;
56
56
  return audio > items.length / 2 ? 6 : 12;
57
57
  }
58
+ // Items fetched per Next when the widget pages the server itself.
59
+ var FETCH_BATCH = 24;
58
60
  function pageCount() { return Math.max(1, Math.ceil(((state && state.items) || []).length / pageSize())); }
59
61
  // Only a tool that told us HOW to page can go past what is already loaded.
60
62
  // Every other grid used to render a Load more that did nothing.
@@ -250,6 +252,10 @@ function fetchNextPage(btn) {
250
252
  // when it shipped next_args, send exactly that. The query+page shape is the
251
253
  // legacy fallback list_media has always used.
252
254
  var args = {};
255
+ // Set when the first page was too small to page with (the model asked
256
+ // list_media for 3 items): re-read from the start in a full batch instead of
257
+ // adding 3 more tiles per Next.
258
+ var replaceFrom = -1;
253
259
  if (state.next_args) {
254
260
  for (var nk in state.next_args) { if (state.next_args[nk] !== undefined && state.next_args[nk] !== null) args[nk] = state.next_args[nk]; }
255
261
  } else {
@@ -257,6 +263,15 @@ function fetchNextPage(btn) {
257
263
  for (var k in q) { if (q[k] !== undefined && q[k] !== null && q[k] !== '') args[k] = q[k]; }
258
264
  args.page = nextPage;
259
265
  if (state.page_size) args.page_size = state.page_size;
266
+ var loaded = (state.items || []).length;
267
+ if ((state.page_size || 0) < FETCH_BATCH && loaded < 200 - FETCH_BATCH) {
268
+ // One aligned batch: page 1 at a size that is a whole number of batches
269
+ // covering everything loaded plus one more batch. After this the batch
270
+ // size divides the loaded count, so later Nexts append normally.
271
+ args.page = 1;
272
+ args.page_size = Math.ceil((loaded + 1) / FETCH_BATCH) * FETCH_BATCH;
273
+ replaceFrom = loaded;
274
+ }
260
275
  }
261
276
 
262
277
  window.kolbo.callTool(state.page_tool, args).then(function (res) {
@@ -276,6 +291,18 @@ function fetchNextPage(btn) {
276
291
  render();
277
292
  return;
278
293
  }
294
+ if (replaceFrom >= 0) {
295
+ // Keep the view on the first tile the user has not seen yet.
296
+ state.items = more;
297
+ state.page = (args.page_size / FETCH_BATCH);
298
+ state.page_size = FETCH_BATCH;
299
+ state.next_args = undefined;
300
+ if (sc && sc.total != null && sc.total >= 0) state.total = sc.total;
301
+ state.has_next = sc && typeof sc.has_next === 'boolean' ? sc.has_next : undefined;
302
+ page = Math.floor(replaceFrom / pageSize());
303
+ render();
304
+ return;
305
+ }
279
306
  state.items = (state.items || []).concat(more);
280
307
  state.page = (sc && sc.page) || nextPage;
281
308
  // The next page's args come from THIS response; none means this was the last page.