@blogmcp/sdk 0.10.0 → 0.11.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.
Files changed (53) hide show
  1. package/dist/community/channels.d.ts +3 -2
  2. package/dist/community/client.d.ts +129 -2
  3. package/dist/community/client.js +231 -161
  4. package/dist/community/forum.d.ts +82 -0
  5. package/dist/community/forum.js +96 -0
  6. package/dist/community/index.d.ts +14 -7
  7. package/dist/community/index.js +185 -121
  8. package/dist/community/links.d.ts +38 -0
  9. package/dist/community/links.js +98 -71
  10. package/dist/community/messages.cs.d.ts +160 -1
  11. package/dist/community/messages.cs.js +178 -1
  12. package/dist/community/messages.d.ts +19 -1
  13. package/dist/community/messages.en.d.ts +150 -1
  14. package/dist/community/messages.en.js +161 -1
  15. package/dist/community/messages.js +37 -28
  16. package/dist/community/outcome.d.ts +8 -3
  17. package/dist/community/outcome.js +64 -20
  18. package/dist/community/poll.d.ts +28 -4
  19. package/dist/community/poll.js +70 -47
  20. package/dist/community/realtime/index.d.ts +19 -3
  21. package/dist/community/realtime/index.js +175 -145
  22. package/dist/community/routes.d.ts +36 -1
  23. package/dist/community/routes.js +51 -21
  24. package/dist/community/server/bff.d.ts +25 -2
  25. package/dist/community/server/bff.js +135 -118
  26. package/dist/community/server/host-routes.d.ts +3 -0
  27. package/dist/community/server/host-routes.js +17 -0
  28. package/dist/community/server/index.d.ts +5 -1
  29. package/dist/community/shapes.d.ts +634 -7
  30. package/dist/community/shapes.js +92 -61
  31. package/dist/community/store.d.ts +15 -0
  32. package/dist/community/store.js +65 -61
  33. package/dist/community/topic.d.ts +173 -0
  34. package/dist/community/topic.js +225 -0
  35. package/package.json +3 -3
  36. package/src/community/channels.ts +3 -2
  37. package/src/community/client.ts +209 -5
  38. package/src/community/forum.ts +209 -0
  39. package/src/community/index.ts +146 -2
  40. package/src/community/links.ts +64 -4
  41. package/src/community/messages.cs.ts +179 -1
  42. package/src/community/messages.en.ts +162 -1
  43. package/src/community/messages.ts +25 -2
  44. package/src/community/outcome.ts +50 -1
  45. package/src/community/poll.ts +79 -17
  46. package/src/community/realtime/index.ts +124 -48
  47. package/src/community/routes.ts +42 -1
  48. package/src/community/server/bff.ts +89 -30
  49. package/src/community/server/host-routes.ts +20 -0
  50. package/src/community/server/index.ts +5 -1
  51. package/src/community/shapes.ts +662 -6
  52. package/src/community/store.ts +11 -5
  53. package/src/community/topic.ts +521 -0
@@ -27,6 +27,10 @@ const e = {
27
27
  "error.mentionLimit": "This post mentions more people than you can mention yet. Remove some of the mentions and send it again.",
28
28
  "error.pushRefused": "Notifications cannot be switched on in this browser. Try another browser, or keep an eye on the notifications page.",
29
29
  "error.realtimeOff": "New posts do not show up instantly here right now. The discussion refreshes itself every so often.",
30
+ "error.membersOnly": "The forum is open to community members. Sign in and join the community to see it.",
31
+ "error.topicLocked": "This topic is closed, so you can't post in it any more. You can still read it.",
32
+ "error.topicCreationClosed": "You can't start a new topic in this category. Please try another one.",
33
+ "error.followLimit": "You're already following a lot. Please unfollow something and try again.",
30
34
  "error.submit": "That didn't work. Please reload the page and try again.",
31
35
  "need.sign_in": "Sign in to write in the discussion.",
32
36
  "need.onboarding": "Before your first comment, choose a name and confirm the discussion rules.",
@@ -269,6 +273,10 @@ const e = {
269
273
  "appealStatus.upheld": "The decision stands",
270
274
  "appealStatus.reversed": "The decision was reversed",
271
275
  "appealStatus.withdrawn": "Withdrawn",
276
+ // M3 F6/F9 (m3-contracts.md §3.5, §4.7): what the team recorded on an adverse-event case (adverseOutcomeMessageKey).
277
+ "adverseOutcome.recorded": "Assessed as a possible adverse reaction and recorded in the register.",
278
+ "adverseOutcome.reported_to_authority": "Assessed as a possible adverse reaction and reported to the competent authority.",
279
+ "adverseOutcome.not_adverse": "Assessed: it is not an adverse reaction.",
272
280
  "notification.decision": "There is a new decision about your content.",
273
281
  "notification.appeal_resolved": "Your appeal has been resolved.",
274
282
  "notification.erasure_scheduled": "The deletion of your discussion profile is scheduled.",
@@ -279,6 +287,9 @@ const e = {
279
287
  "notification.mention": "Someone mentioned you in a discussion.",
280
288
  "notification.module_push_reset": "Browser notifications need to be switched on again in your community settings.",
281
289
  "notification.age_limit_changed": "The community is now for adults only, so your profile is read-only. The details are on the My community page.",
290
+ "notification.topic_update": "A discussion you follow has a new post.",
291
+ "notification.category_topic": "A category you follow has a new topic.",
292
+ "notification.category_topic.article": "A category you follow has a new discussion under an article.",
282
293
  "centre.title": "Notifications",
283
294
  "centre.empty": "New notifications will show here.",
284
295
  "centre.markAllRead": "Mark all as read",
@@ -320,7 +331,8 @@ const e = {
320
331
  "trust.0": "New member",
321
332
  "trust.1": "Member",
322
333
  "trust.2": "Regular",
323
- "trust.3": "Moderator",
334
+ "trust.3": "Trusted member",
335
+ "role.moderator": "Moderator",
324
336
  "welcome.title": "Welcome to the community",
325
337
  "welcome.lede": "Here are a few things that help at the start.",
326
338
  "welcome.rules": "How the discussion works",
@@ -330,6 +342,151 @@ const e = {
330
342
  "realtime.off": "Live updates are off right now. The discussion refreshes itself every so often.",
331
343
  "state.readOnly": "The community's extra features are switched off for now. The discussion under the article goes on.",
332
344
  "state.braked": "Writing is paused for a while. You can keep reading.",
345
+ "state.away": "The team is away for now; new topics will wait for review.",
346
+ "topic.deleted": "Deleted topic",
347
+ // M3 (§3.1, B06): a title §3.1's placeholder rule keeps from the viewer (held, removed or held back) — never a deletion,
348
+ // wherever a title reads: a topic, a category's row, a search hit, a moderator's package (M3 FX2, S12: a deleted
349
+ // opening post reads `topic.deleted` in each — topicTitleOf over `openingState`).
350
+ "topic.withheld": "Topic title unavailable",
351
+ // M3 F9 (§3.3, B16): the follow button — following needs a target the member may read now; unfollowing never fails.
352
+ "follow.follow": "Follow",
353
+ "follow.following": "Following",
354
+ "follow.followed": "You're following. You'll see what's new in your notifications.",
355
+ "follow.unfollowed": "You've stopped following.",
356
+ "follow.unavailable": "You can't follow this right now.",
357
+ // ── M3 F9: the forum's elements (forum.*, forumCategory.*, topic.*, search.*, moderation.*; m3-contracts.md §5.3) ──
358
+ "forum.title": "Forum",
359
+ "forum.loading": "Loading the forum…",
360
+ "forum.empty": "The forum has no categories yet.",
361
+ "forum.topicCount_one": "{count} topic",
362
+ "forum.topicCount_other": "{count} topics",
363
+ "forum.discussionCount_one": "{count} discussion",
364
+ "forum.discussionCount_other": "{count} discussions",
365
+ "forum.lastActivity": "Last activity {date}",
366
+ "forum.latest": "Latest topics",
367
+ "forum.allTopics": "All topics",
368
+ "forum.allCategories": "All categories",
369
+ "forum.search": "Search the forum",
370
+ "forum.searchSubmit": "Search",
371
+ "forum.modePre": "New posts here wait for review before they appear.",
372
+ "forum.teamTopics": "The team starts the topics here.",
373
+ "forum.join": "Join the community",
374
+ "forum.back": "Back to the forum",
375
+ // The forum's own brake (§4.9): its writes pause, the article discussions go on.
376
+ "state.forumBraked": "Posting in the forum is paused for a while. You can keep reading.",
377
+ "forumCategory.notFound": "We couldn't find this category.",
378
+ "forumCategory.empty": "There are no topics in this category yet.",
379
+ "forumCategory.articlesEmpty": "There are no article discussions here yet.",
380
+ "forumCategory.sort": "Sort",
381
+ "forumCategory.sortActivity": "By activity",
382
+ "forumCategory.sortNew": "Newest",
383
+ "forumCategory.newTopic": "New topic",
384
+ "topic.loading": "Loading the topic…",
385
+ "topic.notFound": "We couldn't find this topic. It may no longer be available.",
386
+ "topic.count_one": "{count} post",
387
+ "topic.count_other": "{count} posts",
388
+ "topic.locked": "Closed",
389
+ "topic.archived": "Archived",
390
+ "topic.pinned": "Pinned",
391
+ "topic.titleLabel": "Topic title",
392
+ "topic.titleMissing": "Please give the topic a title.",
393
+ "topic.titleTooLong": "The title is too long. Please shorten it to {max} characters at most.",
394
+ "topic.bodyLabel": "Opening post",
395
+ "topic.create": "Start the topic",
396
+ "topic.created": "The topic is up.",
397
+ "topic.createdHeld": "We've got the topic; it's awaiting review now.",
398
+ "topic.open": "Open the topic",
399
+ // A topic's thread reads the discussion's texts with these words of the forum's (the topic element maps the keys).
400
+ "forumText.composer.label": "Your post",
401
+ "forumText.composer.editLabel": "Editing the post",
402
+ "forumText.composer.placeholder": "Write a post…",
403
+ "forumText.composer.tooLong": "The post is too long. Please shorten it to {max} characters at most.",
404
+ "forumText.composer.linksNote_one": "A post can hold up to {count} link.",
405
+ "forumText.composer.linksNote_other": "A post can hold up to {count} links.",
406
+ "forumText.composer.posted": "The post is published.",
407
+ "forumText.composer.held": "We've got the post; it's awaiting review now.",
408
+ "forumText.composer.cooldown_one": "You can post again in {count} second.",
409
+ "forumText.composer.cooldown_other": "You can post again in {count} seconds.",
410
+ "forumText.discussion.empty": "There aren't any replies yet. Be the first to reply.",
411
+ "forumText.discussion.deleteTitle": "Delete the post?",
412
+ "forumText.discussion.deleteExplain": "The post disappears. If someone has replied to it, an empty placeholder stays in its place.",
413
+ "forumText.discussion.collapsed": "A post by an author you've blocked.",
414
+ "forumText.discussion.heldNote": "The post is awaiting review and only you can see it for now. After the review it shows to others, or you'll find out why not in My community.",
415
+ "forumText.discussion.hiddenUntilConsentNote": "Only you can see this post for now. Others will see it once you give your consent to the processing.",
416
+ "forumText.discussion.removedNote": "We removed this post; others can't see it.",
417
+ "forumText.discussion.placeholderHeld": "This post is awaiting review.",
418
+ "forumText.discussion.placeholderRemoved": "This post was removed.",
419
+ "forumText.discussion.placeholderDeleted": "This post was deleted.",
420
+ "forumText.report.title": "Report the post",
421
+ "forumText.report.category": "What's wrong with the post?",
422
+ "forumText.error.links": "This post has more links than fit. Please remove some of them.",
423
+ "forumText.error.blocked": "This post can't be published as it is. Please try editing it.",
424
+ "forumText.error.confirm": "Before you send the post, please confirm one thing.",
425
+ "forumText.confirm.other": "I understand the notice and want to send the post.",
426
+ "forumText.warning.identifier": "The post seems to contain an e-mail address, a phone number or an account number. If it shouldn't be there, edit the post.",
427
+ "forumText.warning.other": "The post is published, but the discussion rules flag something in it. Please look it over.",
428
+ "forumText.need.onboarding": "Before your first post, choose a name and confirm the discussion rules.",
429
+ "forumText.need.art9_consent": "To write in the forum, we need your consent to the processing.",
430
+ "search.title": "Search the forum",
431
+ "search.label": "What are you looking for?",
432
+ "search.submit": "Search",
433
+ "search.searching": "Searching…",
434
+ "search.tooShort": "Please type at least {min} characters.",
435
+ "search.tooLong": "The search text is too long. Please shorten it to {max} characters at most.",
436
+ "search.empty": "We found no results for that. Try other words.",
437
+ "search.more": "More results",
438
+ "search.lastPage": "We don't show more results. Try narrowing the search.",
439
+ "search.space": "Where to search",
440
+ "search.spaceAll": "Everywhere",
441
+ "search.spaceForum": "In the forum",
442
+ "search.spaceArticle": "In article discussions",
443
+ "search.category": "Category",
444
+ "search.topic": "Topic",
445
+ "search.message": "Post",
446
+ "search.inArticle": "An article discussion",
447
+ "moderation.title": "Moderation",
448
+ "moderation.loading": "Loading the queue…",
449
+ "moderation.empty": "The queue is empty right now.",
450
+ "moderation.source.member_report": "Reported by a member",
451
+ "moderation.source.filter": "Caught by the filters",
452
+ "moderation.source.staff": "From the team",
453
+ "moderation.premod": "Awaiting approval",
454
+ "moderation.heldBySystem": "Hidden automatically for now",
455
+ "moderation.deadline": "Due by {date}",
456
+ "moderation.open": "Review",
457
+ "moderation.package": "Content to review",
458
+ "moderation.itemWithheld": "Others can't see this post now, so it isn't shown here.",
459
+ "moderation.restriction": "Decision",
460
+ "moderation.factsHint": "Describe what you found. The text becomes part of the statement of reasons for the author.",
461
+ "moderation.ruleRequired": "Please choose the rule the decision rests on.",
462
+ "moderation.preview": "Preview the statement",
463
+ "moderation.previewTitle": "This is the statement the author will see",
464
+ "moderation.decide": "Decide",
465
+ "moderation.decided": "Decided.",
466
+ "moderation.escalate": "Pass to the team",
467
+ "moderation.escalateLede": "Do you think it's illegal? Pass it to the site's team to assess.",
468
+ "moderation.escalateCategory": "What is it?",
469
+ "moderation.escalated": "Passed to the team.",
470
+ "moderation.remove": "Remove as a moderator",
471
+ "moderation.removeLede": "The post disappears and its author gets a statement of reasons they can appeal.",
472
+ "moderation.removed": "Removed. The author got a statement of reasons.",
473
+ "moderation.approve": "Publish",
474
+ "moderation.approved": "Published.",
475
+ "moderation.reject": "Reject",
476
+ "moderation.rejected": "Rejected. The author got a statement of reasons.",
477
+ "moderation.gone": "This item is no longer in the queue.",
478
+ // M3 FX (R3): a pre-moderated text the author edited while it was being reviewed.
479
+ "moderation.textChanged": "The author has edited the text since. Read the new version and decide again.",
480
+ "moderation.lock": "Close the topic",
481
+ "moderation.unlock": "Reopen the topic",
482
+ "moderation.pin": "Pin the topic",
483
+ "moderation.unpin": "Unpin the topic",
484
+ "moderation.move": "Move the topic",
485
+ "moderation.moveTo": "Where to move the topic?",
486
+ "moderation.done": "Done.",
487
+ "moderation.openTopic": "View in the topic",
488
+ // A member's profile: the categories they moderate now (PublicProfile.moderates; „Moderátor" is role.moderator).
489
+ "profile.moderates": "In the categories",
333
490
  "mention.limit": "This post mentions more people than you can mention yet.",
334
491
  "notice.title": "Report content",
335
492
  "notice.lede": "You can report a comment, a profile or an article, even without signing in.",
@@ -359,6 +516,9 @@ const e = {
359
516
  "notice.submittedAt": "Sent on {date}",
360
517
  "notice.decidedAt": "Decided on {date}",
361
518
  "notice.statement": "Statement of reasons",
519
+ // M3 F6/F9: a notice closed by an adverse-event outcome alone — the outcome in plain words and the redress line.
520
+ "notice.outcome": "Outcome",
521
+ "notice.redress": "If you disagree with how it was dealt with, you can turn to a court or use an out-of-court dispute settlement.",
362
522
  "notice.appealTitle": "Appeal",
363
523
  "notice.appealLede": "Don't agree with how we handled the report? Tell us why.",
364
524
  "notice.appealBody": "Why don't you agree with the decision?",
@@ -1,15 +1,15 @@
1
- import { COMMUNITY_MESSAGES_CS as a } from "./messages.cs.js";
2
- import { COMMUNITY_MESSAGES_EN as p } from "./messages.en.js";
3
- import { NOTIFICATION_CODES as M, TRUST_LABELS as y } from "./shapes.js";
1
+ import { COMMUNITY_MESSAGES_CS as g } from "./messages.cs.js";
2
+ import { COMMUNITY_MESSAGES_EN as y } from "./messages.en.js";
3
+ import { NOTIFICATION_CODES as p, TRUST_LABELS as M, ADVERSE_EVENT_OUTCOMES as O } from "./shapes.js";
4
4
  const c = Object.freeze({
5
- cs: Object.freeze(a),
6
- en: Object.freeze(p)
5
+ cs: Object.freeze(g),
6
+ en: Object.freeze(y)
7
7
  });
8
- function h(t) {
8
+ function S(t) {
9
9
  return (typeof t == "string" ? t.toLowerCase().split("-")[0] : "") === "cs" ? "cs" : "en";
10
10
  }
11
11
  const u = /* @__PURE__ */ new Map();
12
- function m(t, n) {
12
+ function _(t, n) {
13
13
  if (!u.has(t)) {
14
14
  let e = null;
15
15
  try {
@@ -20,57 +20,66 @@ function m(t, n) {
20
20
  }
21
21
  return u.get(t)?.select(n) ?? "other";
22
22
  }
23
- function O(t) {
23
+ function h(t) {
24
24
  const n = typeof t == "number" ? t : typeof t == "string" && t.trim() !== "" ? Number(t) : Number.NaN;
25
25
  return Number.isFinite(n) ? n : null;
26
26
  }
27
27
  function i(t, n) {
28
28
  return Object.prototype.hasOwnProperty.call(t, n) ? t[n] : void 0;
29
29
  }
30
- function S(t, n) {
30
+ function m(t, n) {
31
31
  return n ? t.replace(
32
32
  /\{(\w+)\}/g,
33
33
  (e, r) => Object.prototype.hasOwnProperty.call(n, r) && n[r] != null ? String(n[r]) : e
34
34
  ) : t;
35
35
  }
36
- function w(t, n, e) {
37
- const r = h(t), s = c[r];
36
+ function C(t, n, e) {
37
+ const r = S(t), s = c[r];
38
38
  let o = i(s, n);
39
39
  if (o === void 0) {
40
- const f = O(e?.count), g = f === null ? "other" : m(r, f);
41
- o = i(s, `${n}_${g}`) ?? i(s, `${n}_other`);
40
+ const f = h(e?.count), a = f === null ? "other" : _(r, f);
41
+ o = i(s, `${n}_${a}`) ?? i(s, `${n}_other`);
42
42
  }
43
- return o === void 0 ? String(n) : S(o, e);
43
+ return o === void 0 ? String(n) : m(o, e);
44
44
  }
45
45
  function l(t) {
46
46
  return typeof t != "string" ? !1 : i(c.en, t) !== void 0 || i(c.en, `${t}_other`) !== void 0;
47
47
  }
48
- function C(t) {
48
+ function I(t) {
49
49
  return typeof t == "string" && t.startsWith("identifier_") ? "warning.identifier" : t === "invisible_chars" ? "warning.invisible_chars" : "warning.other";
50
50
  }
51
- function E(t) {
51
+ function d(t) {
52
52
  const n = `confirm.${t}`;
53
53
  return t !== "title" && t !== "submit" && t !== "other" && l(n) ? n : "confirm.other";
54
54
  }
55
- function $(t) {
55
+ function T(t) {
56
56
  const n = `note.${t}`;
57
57
  return l(n) ? n : null;
58
58
  }
59
- function I(t) {
60
- return M.includes(t) ? `notification.${t}` : null;
59
+ function E(t) {
60
+ return p.includes(t) ? `notification.${t}` : null;
61
61
  }
62
- function T(t) {
63
- const n = typeof t == "string" ? y.indexOf(t) : -1;
62
+ function $(t) {
63
+ const n = E(t.code);
64
+ return n === "notification.category_topic" && typeof t.articleId == "string" && t.articleId !== "" ? "notification.category_topic.article" : n;
65
+ }
66
+ function K(t) {
67
+ const n = typeof t == "string" ? M.indexOf(t) : -1;
64
68
  return n < 0 ? null : `trust.${n}`;
65
69
  }
70
+ function v(t) {
71
+ return typeof t == "string" && O.includes(t) ? `adverseOutcome.${t}` : null;
72
+ }
66
73
  export {
67
74
  c as COMMUNITY_MESSAGES,
68
- w as communityMessage,
69
- h as communityMessageLanguage,
70
- E as confirmMessageKey,
75
+ v as adverseOutcomeMessageKey,
76
+ C as communityMessage,
77
+ S as communityMessageLanguage,
78
+ d as confirmMessageKey,
71
79
  l as hasCommunityMessage,
72
- $ as noteMessageKey,
73
- I as notificationMessageKey,
74
- T as trustLabelMessageKey,
75
- C as warningMessageKey
80
+ T as noteMessageKey,
81
+ $ as notificationItemMessageKey,
82
+ E as notificationMessageKey,
83
+ K as trustLabelMessageKey,
84
+ I as warningMessageKey
76
85
  };
@@ -11,9 +11,9 @@
11
11
  *
12
12
  * Browser-safe and server-safe: no I/O, no globals.
13
13
  */
14
- import type { KnownNeed } from './shapes.js';
14
+ import type { BrakeSurface, KnownNeed } from './shapes.js';
15
15
  /** The codes a page can be told. */
16
- export declare const COMMUNITY_UI_CODES: readonly ["method", "origin", "unavailable", "invalid", "signIn", "onboarding", "age", "name", "handle", "restricted", "suspended", "terminated", "links", "fast", "blocked", "confirm", "removed", "quota", "captcha", "notFound", "surfaceOff", "notMoved", "ledger", "readOnly", "braked", "mentionLimit", "pushRefused", "realtimeOff", "submit"];
16
+ export declare const COMMUNITY_UI_CODES: readonly ["method", "origin", "unavailable", "invalid", "signIn", "onboarding", "age", "name", "handle", "restricted", "suspended", "terminated", "links", "fast", "blocked", "confirm", "removed", "quota", "captcha", "notFound", "surfaceOff", "notMoved", "ledger", "readOnly", "braked", "mentionLimit", "pushRefused", "realtimeOff", "membersOnly", "topicLocked", "topicCreationClosed", "followLimit", "submit"];
17
17
  export type CommunityUiCode = (typeof COMMUNITY_UI_CODES)[number];
18
18
  /** True for one of COMMUNITY_UI_CODES. */
19
19
  export declare function isCommunityUiCode(code: unknown): code is CommunityUiCode;
@@ -29,6 +29,11 @@ export interface CommunityFailure {
29
29
  codes?: string[];
30
30
  /** POSTING_RESTRICTED, ACCOUNT_SUSPENDED, MODULE_READ_ONLY, BRAKED: when it ends (absent: no end set). */
31
31
  until?: string;
32
+ /**
33
+ * M3 (m3-contracts.md §1.2, §4.9): BRAKED by ONE surface's brake — `forum` or `article_discussions` (an open set):
34
+ * that surface is paused and the other one works. Absent on BRAKED: the module's brake, which pauses both.
35
+ */
36
+ surface?: BrakeSurface;
32
37
  /** VALIDATION: the paths of the refused fields (`displayName`, `body`, …), never their values. */
33
38
  fields?: string[];
34
39
  /**
@@ -46,7 +51,7 @@ export type CommunityOutcome<T> = {
46
51
  * Every code kb-api's community routers answer: their own, and the member, trust and quota codes they pass
47
52
  * through. A copy of `COMMUNITY_API_CODES` in kb-api's `routes/community-codes.ts`, in its order.
48
53
  */
49
- export declare const COMMUNITY_API_CODES: readonly ["SURFACE_OFF", "CUTOVER_NOT_MOVED", "NOT_FOUND", "ONBOARDING_REQUIRED", "AGE_BELOW_MINIMUM", "NAME_RESERVED", "NAME_BLOCKED", "HANDLE_TAKEN", "HANDLE_RATE", "POSTING_RESTRICTED", "ACCOUNT_SUSPENDED", "ACCOUNT_TERMINATED", "TOO_MANY_LINKS", "TOO_FAST", "FILTER_BLOCKED", "CONFIRMATION_REQUIRED", "MESSAGE_REMOVED", "REACTION_NOT_ALLOWED", "CAPTCHA_FAILED", "UNAUTHORIZED", "VALIDATION", "UNAVAILABLE", "STALE_LEASE", "STAFF_POSTING_OFF", "PRESET_CONFLICT", "INTERNAL", "MODULE_DARK", "MODULE_READ_ONLY", "BRAKED", "BRAKE_PLATFORM", "MODULE_CONDITIONS", "TRUST_LEVEL_INVALID", "MENTION_LIMIT", "DIGEST_UNSUBSCRIBE_INVALID", "PUSH_ENDPOINT_REFUSED", "PUSH_LIMIT", "REALTIME_OFF", "BUSY", "NOT_A_MEMBER_SESSION", "IDENTITY_NOT_ADMITTED", "ACCOUNT_NOT_ELIGIBLE", "MEMBER_READ_ONLY", "MEMBER_DELETION_REQUESTED", "PRIVATE_SPACE", "WRONG_PROVIDER", "CASE_CLOSED", "NOTIFIER_NOT_ALLOWED", "UNSUPPORTED_RESTRICTION", "LADDER_EXCEEDED", "PERSON_REQUIRED", "APPEAL_OPEN", "APPEAL_WINDOW_CLOSED", "APPEAL_NEEDS_ANOTHER_PERSON", "GAG_PLATFORM_ONLY", "ORDER_FINAL", "BODY_JSON_INVALID", "AUDIT_DETAIL_NOT_CODE", "LEDGER_UNAVAILABLE", "INVALID_INPUT", "LEGAL_HOLD", "TEXT_MISSING", "AGE16_NOT_ALLOWED", "QUOTA_DAILY", "QUOTA_IP_HOURLY"];
54
+ export declare const COMMUNITY_API_CODES: readonly ["SURFACE_OFF", "CUTOVER_NOT_MOVED", "NOT_FOUND", "ONBOARDING_REQUIRED", "AGE_BELOW_MINIMUM", "NAME_RESERVED", "NAME_BLOCKED", "HANDLE_TAKEN", "HANDLE_RATE", "POSTING_RESTRICTED", "ACCOUNT_SUSPENDED", "ACCOUNT_TERMINATED", "TOO_MANY_LINKS", "TOO_FAST", "FILTER_BLOCKED", "CONFIRMATION_REQUIRED", "MESSAGE_REMOVED", "REACTION_NOT_ALLOWED", "CAPTCHA_FAILED", "UNAUTHORIZED", "VALIDATION", "UNAVAILABLE", "STALE_LEASE", "STAFF_POSTING_OFF", "PRESET_CONFLICT", "INTERNAL", "MODULE_DARK", "MODULE_READ_ONLY", "BRAKED", "BRAKE_PLATFORM", "MODULE_CONDITIONS", "TRUST_LEVEL_INVALID", "MENTION_LIMIT", "DIGEST_UNSUBSCRIBE_INVALID", "PUSH_ENDPOINT_REFUSED", "PUSH_LIMIT", "REALTIME_OFF", "BUSY", "BRAKE_KIND_MISMATCH", "MEMBERS_ONLY", "TOPIC_LOCKED", "TOPIC_CREATION_CLOSED", "BRAND_RESTRICTED", "CATEGORY_NOT_EMPTY", "SLUG_TAKEN", "MODERATOR_NOT_ELIGIBLE", "FOLLOW_LIMIT", "STALE_REVISION", "CASE_UNDECIDED", "NOT_A_MEMBER_SESSION", "IDENTITY_NOT_ADMITTED", "ACCOUNT_NOT_ELIGIBLE", "MEMBER_READ_ONLY", "MEMBER_DELETION_REQUESTED", "PRIVATE_SPACE", "WRONG_PROVIDER", "CASE_CLOSED", "NOTIFIER_NOT_ALLOWED", "UNSUPPORTED_RESTRICTION", "LADDER_EXCEEDED", "PERSON_REQUIRED", "APPEAL_OPEN", "APPEAL_WINDOW_CLOSED", "APPEAL_NEEDS_ANOTHER_PERSON", "GAG_PLATFORM_ONLY", "ORDER_FINAL", "BODY_JSON_INVALID", "AUDIT_DETAIL_NOT_CODE", "LEDGER_UNAVAILABLE", "INVALID_INPUT", "LEGAL_HOLD", "TEXT_MISSING", "AGE16_NOT_ALLOWED", "QUOTA_DAILY", "QUOTA_IP_HOURLY"];
50
55
  /** A code kb-api's community routers answer. */
51
56
  export type CommunityApiCode = (typeof COMMUNITY_API_CODES)[number];
52
57
  /**
@@ -1,4 +1,4 @@
1
- const T = [
1
+ const t = [
2
2
  /** The host refused the method (a programming error: every operation is a POST). */
3
3
  "method",
4
4
  /** The host refused the request's origin (the page and its API are on different sites). */
@@ -55,9 +55,20 @@ const T = [
55
55
  "pushRefused",
56
56
  /** M2 T5: live updates are not on here: the discussion keeps itself fresh by polling (pollDiscussionHead). */
57
57
  "realtimeOff",
58
+ /**
59
+ * M3: the forum is for the community's members — sign in, or finish joining (`needs` says what is missing for a
60
+ * member session that has not finished onboarding; absent for a visitor: offer the sign-in).
61
+ */
62
+ "membersOnly",
63
+ /** M3: the topic is closed (locked or archived): it takes no new message, and its messages no edit. */
64
+ "topicLocked",
65
+ /** M3: no new topic can be opened in this category (the article discussions' category, or the team's alone). */
66
+ "topicCreationClosed",
67
+ /** M3: the member follows as much as one member may (COMMUNITY_FOLLOWS_MAX): unfollow something first. */
68
+ "followLimit",
58
69
  /** Anything else: "that did not work, try again". */
59
70
  "submit"
60
- ], D = new Set(T);
71
+ ], D = new Set(t);
61
72
  function e(E) {
62
73
  return typeof E == "string" && D.has(E);
63
74
  }
@@ -100,6 +111,17 @@ const r = [
100
111
  "PUSH_LIMIT",
101
112
  "REALTIME_OFF",
102
113
  "BUSY",
114
+ "BRAKE_KIND_MISMATCH",
115
+ "MEMBERS_ONLY",
116
+ "TOPIC_LOCKED",
117
+ "TOPIC_CREATION_CLOSED",
118
+ "BRAND_RESTRICTED",
119
+ "CATEGORY_NOT_EMPTY",
120
+ "SLUG_TAKEN",
121
+ "MODERATOR_NOT_ELIGIBLE",
122
+ "FOLLOW_LIMIT",
123
+ "STALE_REVISION",
124
+ "CASE_UNDECIDED",
103
125
  "NOT_A_MEMBER_SESSION",
104
126
  "IDENTITY_NOT_ADMITTED",
105
127
  "ACCOUNT_NOT_ELIGIBLE",
@@ -126,7 +148,7 @@ const r = [
126
148
  "AGE16_NOT_ALLOWED",
127
149
  "QUOTA_DAILY",
128
150
  "QUOTA_IP_HOURLY"
129
- ], A = Object.freeze({
151
+ ], T = Object.freeze({
130
152
  SURFACE_OFF: "surfaceOff",
131
153
  CUTOVER_NOT_MOVED: "notMoved",
132
154
  NOT_FOUND: "notFound",
@@ -174,6 +196,28 @@ const r = [
174
196
  REALTIME_OFF: "realtimeOff",
175
197
  // F-W0-M4: the team router's lock timeout or deadlock (module/enable's first ranking) — no public operation produces it.
176
198
  BUSY: "submit",
199
+ // M2 follow-up F3: the platform's brakes/lift found another kind of brake (no public operation produces it).
200
+ BRAKE_KIND_MISMATCH: "submit",
201
+ // M3 (m3-contracts.md §1.2): the forum is for onboarded members and the team (`needs` for a member session short of
202
+ // its onboarding); a closed topic; a category that takes no topic from the member; the 500 follows.
203
+ MEMBERS_ONLY: "membersOnly",
204
+ TOPIC_LOCKED: "topicLocked",
205
+ TOPIC_CREATION_CLOSED: "topicCreationClosed",
206
+ FOLLOW_LIMIT: "followLimit",
207
+ // M3: the team router's own (§1.2 names them the team's: the elements never meet them). `submit`, as every code no
208
+ // element meets (above) — not §1.2's `unavailable`, which says „try later" where nothing will change. BRAND_RESTRICTED
209
+ // also answers a moderator's `moderation/topics/pin` under a preset without brand reactions; the only such preset
210
+ // admits no member moderators, so no element meets it there either.
211
+ BRAND_RESTRICTED: "submit",
212
+ CATEGORY_NOT_EMPTY: "submit",
213
+ SLUG_TAKEN: "submit",
214
+ MODERATOR_NOT_ELIGIBLE: "submit",
215
+ // M3 FX (m3-contracts.md §1.2; the review of wave 1, R3, R6). STALE_REVISION: a pre-moderation review of a text the
216
+ // author edited since the reviewer read it (the team's premod/review, the moderator's moderation/premod/review) —
217
+ // nothing was written: the moderation element re-reads the item (moderation.queue), shows the new text and asks again.
218
+ // CASE_UNDECIDED: the team's adverse-events/close while the case's message is held by no decision (decide it first).
219
+ STALE_REVISION: "submit",
220
+ CASE_UNDECIDED: "submit",
177
221
  // A session that is not a reader's (the team, a key) or an identity the tenant does not admit: sign in as a reader.
178
222
  NOT_A_MEMBER_SESSION: "signIn",
179
223
  IDENTITY_NOT_ADMITTED: "signIn",
@@ -206,50 +250,50 @@ const r = [
206
250
  AGE16_NOT_ALLOWED: "submit",
207
251
  QUOTA_DAILY: "quota",
208
252
  QUOTA_IP_HOURLY: "quota"
209
- }), S = ["METHOD", "ORIGIN", "TOO_LARGE", "INVALID_JSON"], N = Object.freeze({
253
+ }), S = ["METHOD", "ORIGIN", "TOO_LARGE", "INVALID_JSON"], I = Object.freeze({
210
254
  METHOD: "method",
211
255
  ORIGIN: "origin",
212
256
  TOO_LARGE: "invalid",
213
257
  INVALID_JSON: "invalid"
214
- }), t = (E, O) => Object.prototype.hasOwnProperty.call(E, O);
258
+ }), A = (E, O) => Object.prototype.hasOwnProperty.call(E, O);
215
259
  function s(E) {
216
- return typeof E != "string" || E === "" ? "submit" : t(A, E) ? A[E] : t(N, E) ? N[E] : "submit";
260
+ return typeof E != "string" || E === "" ? "submit" : A(T, E) ? T[E] : A(I, E) ? I[E] : "submit";
217
261
  }
218
- const I = /* @__PURE__ */ Symbol.for("@blogmcp/sdk/CommunityTransportError");
219
- function n(E) {
262
+ const N = /* @__PURE__ */ Symbol.for("@blogmcp/sdk/CommunityTransportError");
263
+ function L(E) {
220
264
  return typeof E == "number" && Number.isInteger(E) && E >= 100 && E <= 599 ? E : null;
221
265
  }
222
266
  function i(E) {
223
267
  return typeof E == "number" && Number.isFinite(E) && E >= 0 ? Math.ceil(E) : null;
224
268
  }
225
- class L extends Error {
269
+ class R extends Error {
226
270
  /** The HTTP status, or null when there was no response (network, timeout). */
227
271
  status;
228
272
  /** Seconds to wait before retrying (`Retry-After`), or null. */
229
273
  retryAfterS;
230
274
  constructor(O, _ = {}) {
231
- super(O), this.name = "CommunityTransportError", this.status = n(_.status), this.retryAfterS = i(_.retryAfterS), Object.defineProperty(this, I, { value: !0 });
275
+ super(O), this.name = "CommunityTransportError", this.status = L(_.status), this.retryAfterS = i(_.retryAfterS), Object.defineProperty(this, N, { value: !0 });
232
276
  }
233
277
  }
234
- function R(E) {
235
- return E instanceof L ? !0 : E instanceof Error && E[I] === !0;
278
+ function n(E) {
279
+ return E instanceof R ? !0 : E instanceof Error && E[N] === !0;
236
280
  }
237
281
  function u(E) {
238
- return R(E) && E.retryAfterS !== null ? { ok: !1, code: "unavailable", retryAfterS: E.retryAfterS } : { ok: !1, code: "unavailable" };
282
+ return n(E) && E.retryAfterS !== null ? { ok: !1, code: "unavailable", retryAfterS: E.retryAfterS } : { ok: !1, code: "unavailable" };
239
283
  }
240
- function a(E) {
284
+ function C(E) {
241
285
  return E === "unavailable" || E === "submit" || E === "method" || E === "origin" || E === "invalid" || E === "ledger";
242
286
  }
243
287
  export {
244
288
  r as COMMUNITY_API_CODES,
245
289
  S as COMMUNITY_HOST_CODES,
246
- N as COMMUNITY_OUTCOME_OF_HOST,
247
- A as COMMUNITY_OUTCOME_OF_KB,
248
- T as COMMUNITY_UI_CODES,
249
- L as CommunityTransportError,
290
+ I as COMMUNITY_OUTCOME_OF_HOST,
291
+ T as COMMUNITY_OUTCOME_OF_KB,
292
+ t as COMMUNITY_UI_CODES,
293
+ R as CommunityTransportError,
250
294
  u as communityFailureOf,
251
295
  s as communityOutcomeOf,
252
- R as isCommunityTransportError,
296
+ n as isCommunityTransportError,
253
297
  e as isCommunityUiCode,
254
- a as isLoggedCommunityOutcome
298
+ C as isLoggedCommunityOutcome
255
299
  };
@@ -8,28 +8,52 @@
8
8
  * onChange: (heads) => { if (heads.some((h) => store.applyHead(h))) void refreshDiscussion(store, client, input) },
9
9
  * })
10
10
  * // on unmount: poller.stop()
11
+ *
12
+ * M3 (m3-contracts.md §3.2, §5.2): `pollTopicHead` polls `forum/topics/head` by the same rules, for forum topics
13
+ * (refreshTopic re-reads one); it stops for good on `membersOnly` too — the forum is not open to the viewer.
11
14
  */
12
15
  import type { CommunityClient } from './client.js';
13
16
  import type { CommunityFailure } from './outcome.js';
14
- import type { DiscussionHead } from './shapes.js';
15
- export interface PollDiscussionHeadOptions {
17
+ import type { DiscussionHead, TopicHead } from './shapes.js';
18
+ /** What a head poller takes, whatever it polls (the head of an article discussion, of a topic). */
19
+ export interface PollHeadOptions<H> {
16
20
  /** Whether the discussion is seen now; default: the document is visible. Polls only while true. */
17
21
  visible?: () => boolean;
18
22
  /** Default 20 s (at least 1 s). */
19
23
  intervalMs?: number;
20
24
  /** The heads that differ from the previous answer (the first answer: every head). */
21
- onChange(heads: DiscussionHead[]): void;
22
- /** A poll that failed; the poller goes on, slower — `surfaceOff` stops it (discussions are switched off). */
25
+ onChange(heads: H[]): void;
26
+ /**
27
+ * A poll that failed; the poller goes on, slower — `surfaceOff` stops it (the surface is switched off), and for a
28
+ * topic `membersOnly` too (the forum is not open to the viewer).
29
+ */
23
30
  onFailure?(failure: CommunityFailure): void;
24
31
  /** Aborting it stops the poller (the element's lifetime). */
25
32
  signal?: AbortSignal;
26
33
  }
34
+ export interface PollDiscussionHeadOptions extends PollHeadOptions<DiscussionHead> {
35
+ }
36
+ /** M3: pollTopicHead's options — `onChange` gets the topics' heads. */
37
+ export interface PollTopicHeadOptions extends PollHeadOptions<TopicHead> {
38
+ }
27
39
  export interface DiscussionHeadPoller {
28
40
  /** Stops for good: no timer, no listener, the request in flight aborted. */
29
41
  stop(): void;
30
42
  /** Polls now (the element came into view) — or when a failure's wait ends, if one runs. */
31
43
  now(): void;
32
44
  }
45
+ /** M3: pollTopicHead's poller (the same two methods). */
46
+ export type TopicHeadPoller = DiscussionHeadPoller;
33
47
  export declare const POLL_INTERVAL_MS = 20000;
34
48
  export declare const POLL_MAX_BACKOFF_MS: number;
35
49
  export declare function pollDiscussionHead(client: Pick<CommunityClient, 'discussions'>, articleIds: readonly string[], options: PollDiscussionHeadOptions): DiscussionHeadPoller;
50
+ /**
51
+ * M3 (m3-contracts.md §3.2, §5.2): polls `forum/topics/head` while the page shows the topics — pollDiscussionHead's
52
+ * rules over up to COMMUNITY_HEAD_TOPICS_MAX conversation ids. A topic the viewer may not see is left out of the
53
+ * answer (never refused one by one); `surfaceOff` (the forum switched off) and `membersOnly` stop the poller.
54
+ *
55
+ * const poller = pollTopicHead(client, [conversationId], {
56
+ * onChange: (heads) => { if (heads.some((h) => store.applyHead(h))) void refreshTopic(store, client, input) },
57
+ * })
58
+ */
59
+ export declare function pollTopicHead(client: Pick<CommunityClient, 'forum'>, conversationIds: readonly string[], options: PollTopicHeadOptions): TopicHeadPoller;