sbuilder-mcp 0.98.6 → 0.98.7

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
@@ -6,6 +6,13 @@ All notable changes to this project are documented in this file.
6
6
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
7
7
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
+ ## [0.98.7] - 2026-10-29
10
+
11
+ ### Fixed
12
+ - `sb_publish` drops remembered cascade page ids that no longer exist in the page list instead of sending them, so an unknown id no longer makes the platform refuse the whole batch.
13
+ - `sb_page_state` reports `draft_ahead` for a page whose draft is hidden by the cascade, matching `unpublished_drafts`.
14
+ - A queued request that is cancelled before it reaches the front of the line no longer runs, so `sb_add` no longer saves a section twice.
15
+
9
16
  ## [0.98.6] - 2026-10-29
10
17
 
11
18
  ### Added
package/CHANGELOG.vi.md CHANGED
@@ -6,6 +6,13 @@ Mọi thay đổi đáng chú ý của dự án được ghi lại trong file n
6
6
  Định dạng dựa trên [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
7
7
  và dự án tuân theo [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
+ ## [0.98.7] - 2026-10-29
10
+
11
+ ### Fixed
12
+ - `sb_publish` xoá khỏi bộ nhớ cascade các page id đã nhớ mà không còn trong danh sách trang thay vì gửi đi, nên một id lạ không còn làm platform từ chối cả lô.
13
+ - `sb_page_state` báo `draft_ahead` với trang có bản nháp bị cascade che, khớp với `unpublished_drafts`.
14
+ - Request đang xếp hàng mà bị huỷ trước khi tới đầu hàng không còn chạy, nên `sb_add` không còn lưu một section hai lần.
15
+
9
16
  ## [0.98.6] - 2026-10-29
10
17
 
11
18
  ### Added
@@ -1,4 +1,4 @@
1
- import { CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';
1
+ import { CallToolRequestSchema, ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';
2
2
  /**
3
3
  * ONE OPEN DOCUMENT, ONE CALL AT A TIME, IN ARRIVAL ORDER.
4
4
  *
@@ -15,6 +15,12 @@ import { CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';
15
15
  * library) and stay parallel. Call before the first `registerTool`, which is
16
16
  * when McpServer installs its `tools/call` handler.
17
17
  *
18
+ * A call the client CANCELLED while it waited (notifications/cancelled, or its
19
+ * own timeout) is skipped when it reaches the head: the SDK sends nothing for an
20
+ * aborted request either way, so running it only performs a write nobody sees —
21
+ * a timed-out sb_add, retried, stored its section twice. Thrown the way the SDK's
22
+ * own sendRequest refuses a cancelled call; the SDK discards it unsent.
23
+ *
18
24
  * ponytail: one FIFO for every session tool, so a slow sb_look delays the next
19
25
  * sb_set; a per-document lock only matters if two documents are ever open.
20
26
  */
@@ -28,7 +34,11 @@ export function serializeToolCalls(server, free) {
28
34
  return set(schema, ((req, extra) => {
29
35
  if (free(req.params.name))
30
36
  return handler(req, extra);
31
- const run = tail.then(() => handler(req, extra));
37
+ const run = tail.then(() => {
38
+ if (extra?.signal?.aborted)
39
+ throw new McpError(ErrorCode.ConnectionClosed, 'Request was cancelled');
40
+ return handler(req, extra);
41
+ });
32
42
  tail = run.catch(() => undefined);
33
43
  return run;
34
44
  }));
@@ -2661,8 +2661,15 @@ export function registerPageTools(server, ctx) {
2661
2661
  });
2662
2662
  const state = (p) => driftOf(p.updatedAt, p.publishedAt).state;
2663
2663
  drafts = others.filter((p) => state(p) === 'draft_ahead').map(row);
2664
- for (const m of cascadeMasked.get(site_id)?.values() ?? []) {
2665
- if (m.pageId !== page_id && !drafts.some((d) => d.pageId === m.pageId))
2664
+ // A remembered page no longer listed was DELETED: sending its id makes
2665
+ // the platform's publishTargets refuse the whole batch (ErrPageNotFound),
2666
+ // on every publish_drafts:true until restart. Forget it.
2667
+ const listed = new Set((got.pages ?? []).map((p) => String(p.id)));
2668
+ const memory = cascadeMasked.get(site_id);
2669
+ for (const m of memory?.values() ?? []) {
2670
+ if (!listed.has(m.pageId))
2671
+ memory.delete(m.pageId);
2672
+ else if (m.pageId !== page_id && !drafts.some((d) => d.pageId === m.pageId))
2666
2673
  drafts.push(m);
2667
2674
  }
2668
2675
  const unborn = others.filter((p) => state(p) === 'never_published').map(row);
@@ -2835,7 +2842,16 @@ export function registerPageTools(server, ctx) {
2835
2842
  }));
2836
2843
  const row = (live.published ?? []).find((p) => p.pageId === pageId);
2837
2844
  const publishedNodes = Object.keys((row?.document?.nodes ?? {})).length;
2838
- const drift = driftOf(src.updatedAt, row?.publishedAt);
2845
+ // The same cascade memory sb_publish lists unpublished_drafts from: a
2846
+ // cascade moved publishedAt past this draft, so the timestamps lie.
2847
+ const drift = cascadeMasked.get(site_id)?.has(pageId)
2848
+ ? {
2849
+ state: 'draft_ahead',
2850
+ note: 'The draft has changes the live page does not. A cascade this process ran republished ' +
2851
+ 'this page from its LAST PUBLISHED version and moved publishedAt past the draft, so the ' +
2852
+ 'timestamps read in step. Publish it by its own page_id.',
2853
+ }
2854
+ : driftOf(src.updatedAt, row?.publishedAt);
2839
2855
  // Projected to id + label + when, never the documents: one version of a
2840
2856
  // two-node page measured 1,690 bytes over the wire, so a realistic page
2841
2857
  // is ~70 KB per version and a listing of twenty is 1.4 MB in one answer.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbuilder-mcp",
3
- "version": "0.98.6",
3
+ "version": "0.98.7",
4
4
  "description": "MCP server that designs and operates a Store Builder site — pages, data, theme and publish — through the platform's own API and live-edit protocol.",
5
5
  "mcpName": "io.github.vuluu2k/sbuilder-mcp",
6
6
  "type": "module",