sbuilder-mcp 0.98.6 → 0.98.8
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 +21 -0
- package/CHANGELOG.vi.md +21 -0
- package/dist/catalog/deadkeys.generated.js +2 -2
- package/dist/catalog/shapes.generated.js +15 -1
- package/dist/catalog/source.generated.js +2 -2
- package/dist/domains/site/builder.js +13 -0
- package/dist/domains/site/findings.js +3 -0
- package/dist/domains/site/formdoc.js +4 -1
- package/dist/domains/site/review.js +17 -0
- package/dist/domains/site/writecheck.js +9 -7
- package/dist/mcp/serial.js +12 -2
- package/dist/tools/page.js +42 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,27 @@ 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.8] - 2026-10-29
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- `sb_review` reports `hidden_desktop_dead` for a node with a dead `responsive.desktop.config.hidden` slot and says how to fix it.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- The catalog regenerates so that `POST /_wb/account/register` accepts `phone`, `form` and `answers`, where `form` and `answers` only let the platform check the form's rules and are not stored.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- `sb_set` removes the dead desktop `hidden` slot when it writes or unsets `hidden` at desktop or base.
|
|
19
|
+
- `sb_add` and `sb_set` no longer report `hidden_band` as visible in a band where a parent node is already hidden.
|
|
20
|
+
- A phone re-entry field that the builder generates is no longer treated as the phone field of a register form.
|
|
21
|
+
- `sb_publish`, `sb_page_state` and the next `sb_publish` use the remembered cascade state only while the page's `publishedAt` is still the one the cascade recorded, so a page published through the editor or `sb_api_call`, or unpublished, is no longer treated as cascaded.
|
|
22
|
+
|
|
23
|
+
## [0.98.7] - 2026-10-29
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
- `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.
|
|
27
|
+
- `sb_page_state` reports `draft_ahead` for a page whose draft is hidden by the cascade, matching `unpublished_drafts`.
|
|
28
|
+
- 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.
|
|
29
|
+
|
|
9
30
|
## [0.98.6] - 2026-10-29
|
|
10
31
|
|
|
11
32
|
### Added
|
package/CHANGELOG.vi.md
CHANGED
|
@@ -6,6 +6,27 @@ 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.8] - 2026-10-29
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- `sb_review` báo `hidden_desktop_dead` với node có slot `responsive.desktop.config.hidden` chết và nêu cách sửa.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- Catalog được tái sinh để `POST /_wb/account/register` nhận thêm `phone`, `form` và `answers`, trong đó `form` và `answers` chỉ để platform kiểm luật của form và không được lưu.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- `sb_set` xoá slot `hidden` chết ở desktop khi ghi hoặc unset `hidden` ở desktop hoặc base.
|
|
19
|
+
- `sb_add` và `sb_set` không còn báo `hidden_band` là còn hiện ở dải mà node cha đã bị ẩn.
|
|
20
|
+
- Ô nhập lại số điện thoại do builder tự dựng không còn bị coi là trường phone của form đăng ký.
|
|
21
|
+
- `sb_publish`, `sb_page_state` và lần `sb_publish` kế tiếp chỉ dùng trạng thái cascade đã nhớ khi `publishedAt` của trang vẫn là mốc cascade đã ghi, nên trang được publish qua editor hoặc `sb_api_call`, hoặc bị gỡ publish, không còn bị coi là đã cascade.
|
|
22
|
+
|
|
23
|
+
## [0.98.7] - 2026-10-29
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
- `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ô.
|
|
27
|
+
- `sb_page_state` báo `draft_ahead` với trang có bản nháp bị cascade che, khớp với `unpublished_drafts`.
|
|
28
|
+
- 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.
|
|
29
|
+
|
|
9
30
|
## [0.98.6] - 2026-10-29
|
|
10
31
|
|
|
11
32
|
### Added
|
|
@@ -4,7 +4,7 @@ export const SHAPE_SOURCE = {
|
|
|
4
4
|
"fromHandlers": 334,
|
|
5
5
|
"fromSwaggerOnly": 10,
|
|
6
6
|
"withReadOnly": 29,
|
|
7
|
-
"structsRead":
|
|
7
|
+
"structsRead": 3469
|
|
8
8
|
};
|
|
9
9
|
export const REQUEST_SHAPES = {
|
|
10
10
|
"post:/api/sites/{id}/ai-credits/purchase": {
|
|
@@ -3238,6 +3238,20 @@ export const REQUEST_SHAPES = {
|
|
|
3238
3238
|
{
|
|
3239
3239
|
"name": "password",
|
|
3240
3240
|
"type": "string"
|
|
3241
|
+
},
|
|
3242
|
+
{
|
|
3243
|
+
"name": "phone",
|
|
3244
|
+
"type": "string",
|
|
3245
|
+
"note": "Optional — a register form with a phone field (control name \"phone\", the palette's contact-phone row) sends it."
|
|
3246
|
+
},
|
|
3247
|
+
{
|
|
3248
|
+
"name": "form",
|
|
3249
|
+
"type": "string",
|
|
3250
|
+
"note": "Form + Answers: which register form sent this, and its answers (passwords excluded) — read only to check the form's own rules, never stored."
|
|
3251
|
+
},
|
|
3252
|
+
{
|
|
3253
|
+
"name": "answers",
|
|
3254
|
+
"type": "{ [string]: string }"
|
|
3241
3255
|
}
|
|
3242
3256
|
],
|
|
3243
3257
|
"source": "go",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// GENERATED by scripts/gen-catalog.ts — do not edit by hand.
|
|
2
2
|
// The platform commit every other generated file here describes.
|
|
3
3
|
export const PLATFORM_SOURCE = {
|
|
4
|
-
"commit": "
|
|
5
|
-
"committedAt": "2026-10-
|
|
4
|
+
"commit": "a666c262a63a0057ce25db75d983e1325b1fde8b",
|
|
5
|
+
"committedAt": "2026-10-29T12:22:29+07:00",
|
|
6
6
|
"dirty": false
|
|
7
7
|
};
|
|
@@ -471,6 +471,17 @@ export function setKeys(doc, id, keys, opts) {
|
|
|
471
471
|
if (Object.keys(seeds).length)
|
|
472
472
|
keys = { ...seeds, ...keys };
|
|
473
473
|
}
|
|
474
|
+
// A DEAD `responsive.desktop.config.hidden` — where sb_set wrote a desktop
|
|
475
|
+
// `hidden` before 0.98.6, and read by nothing (render/css.go hiddenAt reads
|
|
476
|
+
// base for desktop). A desktop/base write or unset of `hidden` now lands at
|
|
477
|
+
// base, so it would never reach that slot: clear it in the same call.
|
|
478
|
+
const deskCfg = doc.node(id).responsive?.desktop?.config ?? {};
|
|
479
|
+
const deadHidden = namespace === 'config' &&
|
|
480
|
+
'hidden' in deskCfg &&
|
|
481
|
+
('hidden' in keys || (opts.unset ?? []).includes('hidden')) &&
|
|
482
|
+
(opts.base || (opts.breakpoint ?? 'desktop') === 'desktop')
|
|
483
|
+
? [{ op: 'unset', path: ['nodes', id, 'responsive', 'desktop', 'config', 'hidden'] }]
|
|
484
|
+
: [];
|
|
474
485
|
if (opts.base) {
|
|
475
486
|
// Base IS legitimate, and this used to throw for anything that was not an
|
|
476
487
|
// identity key — a refusal built on a misread of the platform's responsive
|
|
@@ -497,6 +508,7 @@ export function setKeys(doc, id, keys, opts) {
|
|
|
497
508
|
value: v,
|
|
498
509
|
})),
|
|
499
510
|
...removals,
|
|
511
|
+
...deadHidden,
|
|
500
512
|
...(rebind ? [rebind] : []),
|
|
501
513
|
];
|
|
502
514
|
}
|
|
@@ -528,6 +540,7 @@ export function setKeys(doc, id, keys, opts) {
|
|
|
528
540
|
path: ['nodes', id, 'responsive', bp, namespace, k],
|
|
529
541
|
})),
|
|
530
542
|
...unsetSplit.base.map((k) => ({ op: 'unset', path: ['nodes', id, namespace, k] })),
|
|
543
|
+
...deadHidden,
|
|
531
544
|
...(rebind ? [rebind] : []),
|
|
532
545
|
];
|
|
533
546
|
}
|
|
@@ -170,6 +170,9 @@ export const FIX = {
|
|
|
170
170
|
'{ "position": "sticky" } — sb_set seeds the offset and the layer order with it. Until ' +
|
|
171
171
|
'then the platform compiles no rule for this state at all, so the override is stored, ' +
|
|
172
172
|
'published and never painted. To drop it instead, remove the stuck slot.',
|
|
173
|
+
hidden_desktop_dead: 'To hide it at ≥1440px: sb_set id "<id>", namespace config, keys { "hidden": true } (lands at base). ' +
|
|
174
|
+
'To show it: sb_set id "<id>", namespace config, unset ["hidden"]. Either call also clears the dead ' +
|
|
175
|
+
'desktop slot.',
|
|
173
176
|
// FORM DOCUMENT findings (`sb_page_open form_id`) — stored by the platform, answerable by nobody.
|
|
174
177
|
form_options_empty: 'Give it choices: sb_set id "<id>", namespace specials, keys { "options": ["…", "…"] } — ' +
|
|
175
178
|
'each string is both what the visitor sees and the value posted. Or sb_remove it.',
|
|
@@ -176,9 +176,12 @@ export function formFieldFindings(d, formType) {
|
|
|
176
176
|
// when some field already posts as `phone`; the re-entry box is not a phone.
|
|
177
177
|
if (formType === 'register') {
|
|
178
178
|
const fields = formFields(d).filter((n) => collectsValue(n.data.type));
|
|
179
|
+
// A hand-built confirm box (tel, no mapTo) is told apart by its name or label.
|
|
180
|
+
const reentry = (n) => /confirm|repeat|re_?enter|xac_?nhan|nhap_?lai/i.test(`${postedName(n)} ${nameFromLabel(String(n.specials?.label ?? ''))}`);
|
|
179
181
|
const phoneish = fields.find((n) => {
|
|
180
182
|
const s = n.specials ?? {};
|
|
181
|
-
return s.mapTo === 'customer.phone' ||
|
|
183
|
+
return (s.mapTo === 'customer.phone' ||
|
|
184
|
+
(s.inputType === 'tel' && s.mapTo !== 'customer.confirmPhone' && !reentry(n)));
|
|
182
185
|
});
|
|
183
186
|
if (phoneish && !fields.some((n) => postedName(n) === 'phone')) {
|
|
184
187
|
out.push({
|
|
@@ -1192,6 +1192,23 @@ opts = {}) {
|
|
|
1192
1192
|
fix: fill('stuck_no_host', { id }),
|
|
1193
1193
|
});
|
|
1194
1194
|
}
|
|
1195
|
+
// A DEAD DESKTOP `hidden`. Before 0.98.6 sb_set's default desktop write put
|
|
1196
|
+
// config.hidden in responsive.desktop, which nothing reads: desktop takes
|
|
1197
|
+
// BASE config.hidden (render/css.go hiddenAt), so the node still shows.
|
|
1198
|
+
const deskHidden = n
|
|
1199
|
+
.responsive?.desktop?.config;
|
|
1200
|
+
if (deskHidden && 'hidden' in deskHidden) {
|
|
1201
|
+
const baseHidden = n.config?.hidden === true;
|
|
1202
|
+
out.push({
|
|
1203
|
+
code: 'hidden_desktop_dead',
|
|
1204
|
+
nodeId: id,
|
|
1205
|
+
type,
|
|
1206
|
+
problem: `responsive.desktop.config.hidden (${JSON.stringify(deskHidden.hidden)}) is read by nothing — desktop reads base ` +
|
|
1207
|
+
`config.hidden, so this node ${baseHidden ? 'is hidden at ≥1440px by base, not by this slot' : 'still shows at ≥1440px'}.`,
|
|
1208
|
+
key: 'config.hidden',
|
|
1209
|
+
fix: fill('hidden_desktop_dead', { id }),
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1195
1212
|
const bindings = n.bindings ?? [];
|
|
1196
1213
|
// A container with nothing in it is a band of empty space. The commonest way
|
|
1197
1214
|
// to ship one is to add the section and then get distracted.
|
|
@@ -448,10 +448,11 @@ export function cascadeTail(node, written, id) {
|
|
|
448
448
|
* base expects it gone everywhere, so say which bands still show it — once per
|
|
449
449
|
* process, since the fact is the same for every node. `node` is AS IT WILL BE.
|
|
450
450
|
*/
|
|
451
|
-
export function hiddenBand(node, id) {
|
|
451
|
+
export function hiddenBand(node, id, above = []) {
|
|
452
452
|
if (node.config?.hidden !== true)
|
|
453
453
|
return [];
|
|
454
|
-
|
|
454
|
+
// A band an ANCESTOR hides there is not showing this node either (`above`).
|
|
455
|
+
const shown = ['laptop', 'tablet', 'mobile'].filter((bp) => [node, ...above].every((n) => n.responsive?.[bp]?.config?.hidden !== true));
|
|
455
456
|
if (!shown.length)
|
|
456
457
|
return [];
|
|
457
458
|
return [
|
|
@@ -470,9 +471,9 @@ export function hiddenBand(node, id) {
|
|
|
470
471
|
];
|
|
471
472
|
}
|
|
472
473
|
/** The same, for every node of a nested `sb_add` spec, as each will be born. */
|
|
473
|
-
export function specCheck(spec, idOf) {
|
|
474
|
+
export function specCheck(spec, idOf, above = []) {
|
|
474
475
|
const out = [];
|
|
475
|
-
const walk = (s) => {
|
|
476
|
+
const walk = (s, up) => {
|
|
476
477
|
// addSubtree's minted id, so a per-node note names (and dedupes on) its node.
|
|
477
478
|
const id = idOf?.get(s);
|
|
478
479
|
const d = ELEMENTS[s.type]?.defaults;
|
|
@@ -480,7 +481,8 @@ export function specCheck(spec, idOf) {
|
|
|
480
481
|
if (s.config)
|
|
481
482
|
out.push(...writeCheck(s.type, 'config', s.config));
|
|
482
483
|
// Born as addSubtree stores it: a desktop-slot `hidden` lands at base.
|
|
483
|
-
|
|
484
|
+
const self = { config: { hidden: s.responsive?.desktop?.config?.hidden ?? s.config?.hidden }, responsive: s.responsive };
|
|
485
|
+
out.push(...hiddenBand(self, id, up));
|
|
484
486
|
for (const slot of Object.values(s.responsive ?? {}))
|
|
485
487
|
if (slot.config)
|
|
486
488
|
out.push(...writeCheck(s.type, 'config', slot.config));
|
|
@@ -517,9 +519,9 @@ export function specCheck(spec, idOf) {
|
|
|
517
519
|
}
|
|
518
520
|
}
|
|
519
521
|
for (const c of s.children ?? [])
|
|
520
|
-
walk(c);
|
|
522
|
+
walk(c, [self, ...up]);
|
|
521
523
|
};
|
|
522
|
-
walk(spec);
|
|
524
|
+
walk(spec, above);
|
|
523
525
|
return out;
|
|
524
526
|
}
|
|
525
527
|
/** The notes `say` has not said yet, deduped within the call too. */
|
package/dist/mcp/serial.js
CHANGED
|
@@ -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(() =>
|
|
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
|
}));
|
package/dist/tools/page.js
CHANGED
|
@@ -19,7 +19,7 @@ import { skinLevelNote } from '../domains/site/fieldskin.js';
|
|
|
19
19
|
import { siteTheme } from '../domains/site/theme-fetch.js';
|
|
20
20
|
import { ensureSiteTheme } from './theme.js';
|
|
21
21
|
import { request, redact, watchPageWrites, onPageSourceWrite, onGlobalWrite, onFormDocumentWrite } from '../transport/http.js';
|
|
22
|
-
import { SPEC_GLOBAL_ID, SPEC_GLOBAL_REV, SPEC_OVERLAY_ID, SPEC_OVERLAY_REV, subtreeIds } from '../core/tree.js';
|
|
22
|
+
import { SPEC_GLOBAL_ID, SPEC_GLOBAL_REV, SPEC_OVERLAY_ID, SPEC_OVERLAY_REV, subtreeIds, ancestors } from '../core/tree.js';
|
|
23
23
|
import { siteToken } from './credentialpick.js';
|
|
24
24
|
import { validateForSave } from '../domains/site/validate.js';
|
|
25
25
|
import { cascadeTail, formDocChecks, hiddenBand, sayChecks, specCheck, writeCheck } from '../domains/site/writecheck.js';
|
|
@@ -1487,7 +1487,7 @@ export function registerPageTools(server, ctx) {
|
|
|
1487
1487
|
.join(' ');
|
|
1488
1488
|
// Keys an element does not read, and values it does not know — on EVERY
|
|
1489
1489
|
// node of the nested spec, as each will be born. Warned, still written.
|
|
1490
|
-
const found = sayChecks([...specCheck(spec, idOf), ...session.formChecks(patches)], say);
|
|
1490
|
+
const found = sayChecks([...specCheck(spec, idOf, [parent_id, ...ancestors(d.doc, parent_id)].map((a) => d.doc.nodes[a])), ...session.formChecks(patches)], say);
|
|
1491
1491
|
const checks = found.length ? { checks: found } : {};
|
|
1492
1492
|
// A base-only key in a breakpoint slot lands at BASE (addSubtree routes it,
|
|
1493
1493
|
// as sb_set does) and so reaches every width — routed AND said.
|
|
@@ -1721,7 +1721,7 @@ export function registerPageTools(server, ctx) {
|
|
|
1721
1721
|
return [];
|
|
1722
1722
|
const probe = { nodes: { [e.id]: JSON.parse(JSON.stringify(d.doc.nodes[e.id])) } };
|
|
1723
1723
|
applyPatches(probe, patches.filter((p) => p.path[0] === 'nodes' && p.path[1] === e.id));
|
|
1724
|
-
return hiddenBand(probe.nodes[e.id], e.id);
|
|
1724
|
+
return hiddenBand(probe.nodes[e.id], e.id, ancestors(d.doc, e.id).map((a) => d.doc.nodes[a]));
|
|
1725
1725
|
});
|
|
1726
1726
|
const found = sayChecks([...checked, ...tail, ...hidden, ...session.formChecks(patches)], say);
|
|
1727
1727
|
const checks = found.length ? { checks: found } : {};
|
|
@@ -2606,11 +2606,16 @@ export function registerPageTools(server, ctx) {
|
|
|
2606
2606
|
// publishSourceFor, by design) and writes a fresh published row — and the
|
|
2607
2607
|
// page list's `publishedAt` is denormalised from that row, so the draft that
|
|
2608
2608
|
// did NOT go live now reads older than "published". Remembered here until the
|
|
2609
|
-
// page is published by name
|
|
2609
|
+
// page is published by name — or until its publishedAt is no longer the one
|
|
2610
|
+
// the cascade wrote: the editor or sb_api_call published it, or it was
|
|
2611
|
+
// unpublished, and the timestamps tell the truth again.
|
|
2610
2612
|
// ponytail: in-process; a new process sees only timestamps again. Exact would
|
|
2611
2613
|
// compare each page's updatedAt with its live version's createdAt
|
|
2612
2614
|
// (GET …/versions, isLive) — a heavy listing per page.
|
|
2613
2615
|
const cascadeMasked = new Map();
|
|
2616
|
+
// Compared as instants (ms): the publish answer and the listings may print
|
|
2617
|
+
// the same time at different precision.
|
|
2618
|
+
const stillCascaded = (m, now) => typeof m.publishedAt === 'string' && typeof now === 'string' && Date.parse(m.publishedAt) === Date.parse(now);
|
|
2614
2619
|
server.registerTool('sb_publish', {
|
|
2615
2620
|
description: 'Compile the draft into the live page, and report which revision went live (id, ' +
|
|
2616
2621
|
'publishedAt, fromVersionId). PUBLISH CASCADES: a page sharing a global section with ' +
|
|
@@ -2661,9 +2666,18 @@ export function registerPageTools(server, ctx) {
|
|
|
2661
2666
|
});
|
|
2662
2667
|
const state = (p) => driftOf(p.updatedAt, p.publishedAt).state;
|
|
2663
2668
|
drafts = others.filter((p) => state(p) === 'draft_ahead').map(row);
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2669
|
+
// A remembered page no longer listed was DELETED: sending its id makes
|
|
2670
|
+
// the platform's publishTargets refuse the whole batch (ErrPageNotFound),
|
|
2671
|
+
// on every publish_drafts:true until restart. Forget it.
|
|
2672
|
+
// Published or unpublished by another door since: publishedAt moved, forget it too.
|
|
2673
|
+
const listed = new Map((got.pages ?? []).map((p) => [String(p.id), p]));
|
|
2674
|
+
const memory = cascadeMasked.get(site_id);
|
|
2675
|
+
for (const m of memory?.values() ?? []) {
|
|
2676
|
+
const id = m.row.pageId;
|
|
2677
|
+
if (!listed.has(id) || !stillCascaded(m, listed.get(id).publishedAt))
|
|
2678
|
+
memory.delete(id);
|
|
2679
|
+
else if (id !== page_id && !drafts.some((d) => d.pageId === id))
|
|
2680
|
+
drafts.push(m.row);
|
|
2667
2681
|
}
|
|
2668
2682
|
const unborn = others.filter((p) => state(p) === 'never_published').map(row);
|
|
2669
2683
|
fresh = unborn.filter((r) => !heldFromFirstPublish(r.type));
|
|
@@ -2743,9 +2757,12 @@ export function registerPageTools(server, ctx) {
|
|
|
2743
2757
|
cascadeMasked.set(site_id, masked);
|
|
2744
2758
|
for (const id of asked)
|
|
2745
2759
|
masked.delete(id);
|
|
2746
|
-
for (const d of drafts)
|
|
2747
|
-
if (cascaded.includes(d.pageId))
|
|
2748
|
-
|
|
2760
|
+
for (const d of drafts) {
|
|
2761
|
+
if (!cascaded.includes(d.pageId))
|
|
2762
|
+
continue;
|
|
2763
|
+
const at = published.find((p) => String(p.pageId) === d.pageId)?.publishedAt;
|
|
2764
|
+
masked.set(d.pageId, { row: d, publishedAt: at });
|
|
2765
|
+
}
|
|
2749
2766
|
// A 200 PROVES A ROW WAS STORED, NOT THAT A VISITOR IS BEING SERVED IT.
|
|
2750
2767
|
// The storefront answers `cache-control: public, max-age=60`, so the two
|
|
2751
2768
|
// legitimately differ for up to a minute — long enough for a caller to
|
|
@@ -2835,7 +2852,21 @@ export function registerPageTools(server, ctx) {
|
|
|
2835
2852
|
}));
|
|
2836
2853
|
const row = (live.published ?? []).find((p) => p.pageId === pageId);
|
|
2837
2854
|
const publishedNodes = Object.keys((row?.document?.nodes ?? {})).length;
|
|
2838
|
-
|
|
2855
|
+
// The same cascade memory sb_publish lists unpublished_drafts from: a
|
|
2856
|
+
// cascade moved publishedAt past this draft, so the timestamps lie —
|
|
2857
|
+
// while the live row still carries the publishedAt that cascade wrote.
|
|
2858
|
+
const memory = cascadeMasked.get(site_id);
|
|
2859
|
+
const remembered = memory?.get(pageId);
|
|
2860
|
+
if (remembered && !stillCascaded(remembered, row?.publishedAt))
|
|
2861
|
+
memory.delete(pageId);
|
|
2862
|
+
const drift = memory?.has(pageId)
|
|
2863
|
+
? {
|
|
2864
|
+
state: 'draft_ahead',
|
|
2865
|
+
note: 'The draft has changes the live page does not. A cascade this process ran republished ' +
|
|
2866
|
+
'this page from its LAST PUBLISHED version and moved publishedAt past the draft, so the ' +
|
|
2867
|
+
'timestamps read in step. Publish it by its own page_id.',
|
|
2868
|
+
}
|
|
2869
|
+
: driftOf(src.updatedAt, row?.publishedAt);
|
|
2839
2870
|
// Projected to id + label + when, never the documents: one version of a
|
|
2840
2871
|
// two-node page measured 1,690 bytes over the wire, so a realistic page
|
|
2841
2872
|
// 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.
|
|
3
|
+
"version": "0.98.8",
|
|
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",
|