@superdoc/mcp 1.21.0-next.30 → 1.21.0-next.35

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 (2) hide show
  1. package/dist/index.js +63 -10
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -31623,7 +31623,7 @@ var init_host = __esm(() => {
31623
31623
  });
31624
31624
 
31625
31625
  // ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
31626
- var SDK_VERSION = "2.34.0-next.30";
31626
+ var SDK_VERSION = "2.34.0-next.35";
31627
31627
 
31628
31628
  // ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
31629
31629
  import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
@@ -506977,6 +506977,8 @@ class HocuspocusBoundedTransport {
506977
506977
  this.onDownloadProgress = onDownloadProgress;
506978
506978
  this.applyPreparedUpdate = applyPreparedUpdate;
506979
506979
  this.state = "legacy";
506980
+ this.requestedSync = false;
506981
+ this.missedStockBroadcast = false;
506980
506982
  this.waitingForNegotiation = false;
506981
506983
  this.capabilityUnavailable = false;
506982
506984
  this.preparedCreate = false;
@@ -506994,6 +506996,32 @@ class HocuspocusBoundedTransport {
506994
506996
  get serverLacksBoundedTransfer() {
506995
506997
  return this.capabilityUnavailable;
506996
506998
  }
506999
+ nativeFraming(socket, syncType, oversized = false) {
507000
+ if (!socket || this.socket !== socket || socket.readyState !== 1)
507001
+ return "bounded";
507002
+ if (this.state === "stock")
507003
+ return "stock";
507004
+ if (this.generation !== undefined || !this.requestedSync)
507005
+ return "bounded";
507006
+ if (this.state !== "legacy" && !this.waitingForNegotiation)
507007
+ return "bounded";
507008
+ if (syncType === messageYjsUpdate && (oversized || this.missedStockBroadcast)) {
507009
+ this.missedStockBroadcast = true;
507010
+ if (!this.waitingForNegotiation)
507011
+ this.waitForNegotiation(socket);
507012
+ return "discard";
507013
+ }
507014
+ if (syncType !== messageYjsSyncStep2)
507015
+ return "bounded";
507016
+ clearTimeout(this.probe);
507017
+ this.waitingForNegotiation = false;
507018
+ this.state = "stock";
507019
+ const resync = this.missedStockBroadcast;
507020
+ this.missedStockBroadcast = false;
507021
+ this.flush();
507022
+ this.finishReconnect();
507023
+ return resync ? "resync" : "stock";
507024
+ }
506997
507025
  rejectOversizedLegacy(socket) {
506998
507026
  if (this.socket !== socket || this.negotiated) {
506999
507027
  socket.close(4400, "Oversized bounded collaboration message");
@@ -507008,7 +507036,14 @@ class HocuspocusBoundedTransport {
507008
507036
  return this.negotiated && this.preparedCreate;
507009
507037
  }
507010
507038
  start(socket, startSync) {
507039
+ if (this.socket === socket) {
507040
+ this.pendingSync = startSync;
507041
+ this.finishReconnect();
507042
+ return;
507043
+ }
507011
507044
  this.clearTimers();
507045
+ this.requestedSync = false;
507046
+ this.missedStockBroadcast = false;
507012
507047
  this.socket = socket;
507013
507048
  this.preparedCreate = false;
507014
507049
  this.reusePreparedUpdate = false;
@@ -507054,13 +507089,22 @@ class HocuspocusBoundedTransport {
507054
507089
  socket.close(4400, "Collaboration transfer exceeds runtime capacity");
507055
507090
  return true;
507056
507091
  }
507092
+ if (this.state === "stock") {
507093
+ this.sendNative(bytes);
507094
+ return true;
507095
+ }
507057
507096
  if (this.state === "probing") {
507058
507097
  this.enqueue(socket, bytes);
507059
507098
  return true;
507060
507099
  }
507061
507100
  if (!this.negotiated) {
507062
- if (bounded)
507101
+ if (bounded) {
507102
+ if (!this.requestedSync && socket.readyState === 1) {
507103
+ const message = createDecoder(bytes);
507104
+ this.requestedSync = readVarString(message) === this.roomName && readVarUint(message) === 0 && readVarUint(message) === 0;
507105
+ }
507063
507106
  return false;
507107
+ }
507064
507108
  this.waitForNegotiation(socket);
507065
507109
  this.enqueue(socket, bytes);
507066
507110
  return true;
@@ -507086,6 +507130,8 @@ class HocuspocusBoundedTransport {
507086
507130
  readVarUint(decoder19);
507087
507131
  const kind = readVarUint(decoder19);
507088
507132
  if (kind === TransferMessage.Hello) {
507133
+ if (this.missedStockBroadcast)
507134
+ throw new Error("Oversized native update before bounded negotiation.");
507089
507135
  if (this.state === "negotiated")
507090
507136
  throw new Error("Duplicate collaboration transfer negotiation.");
507091
507137
  const generation = readVarString(decoder19);
@@ -507451,6 +507497,7 @@ class HocuspocusBoundedTransport {
507451
507497
  }
507452
507498
  var BOUNDED_MESSAGE_BYTES, BOUNDED_MESSAGE_TYPE = 90, BOUNDED_VERSION = "1", BOUNDED_PARAMETER = "sdBoundedSync", BOUNDED_FEATURE_PREPARED_CREATE = 1, BOUNDED_FEATURE_REUSE_PREPARED_UPDATE = 2, REUSE_PREPARED_UPDATE = 1, MAX_LOGICAL_BYTES, SMALL_FRAME_BACKLOG_BYTES, MAX_PENDING_OVERSIZED_FRAMES = 2, CHUNK_BYTES, PROGRESS_IDLE_MS, APPLY_PROBE_MS = 1e4, HOCUSPOCUS_RECONNECT_CLOSE_CODE = 4205, TransferMessage;
507453
507499
  var init_hocuspocus_bounded_transport = __esm(() => {
507500
+ init_sync();
507454
507501
  init_decoding();
507455
507502
  init_encoding();
507456
507503
  init_sha256_sync2();
@@ -507833,8 +507880,9 @@ var init_hocuspocus_single_doc = __esm(() => {
507833
507880
  const decoder19 = createDecoder(bytes);
507834
507881
  if (readVarString(decoder19) !== this.configuration.name)
507835
507882
  return;
507836
- if (readVarUint(decoder19) === BOUNDED_MESSAGE_TYPE) {
507837
- const socket = this.configuration.websocketProvider.webSocket;
507883
+ const type = readVarUint(decoder19);
507884
+ const socket = this.configuration.websocketProvider.webSocket;
507885
+ if (type === BOUNDED_MESSAGE_TYPE) {
507838
507886
  this.bounded?.receive(socket, bytes, (download, apply) => {
507839
507887
  if (this.privateInitialSnapshot && this.applyPrivateVerifiedSnapshot(download)) {
507840
507888
  if (socket === this.configuration.websocketProvider.webSocket && apply.canPublishSync())
@@ -507846,13 +507894,18 @@ var init_hocuspocus_single_doc = __esm(() => {
507846
507894
  });
507847
507895
  return;
507848
507896
  }
507849
- if (this.bounded && bytes.byteLength > BOUNDED_MESSAGE_BYTES) {
507850
- const socket = this.configuration.websocketProvider.webSocket;
507897
+ const syncType = type === MESSAGE_SYNC ? bytes[decoder19.pos] : undefined;
507898
+ const oversized = bytes.byteLength > BOUNDED_MESSAGE_BYTES;
507899
+ const framing = this.bounded?.nativeFraming(socket, syncType, oversized);
507900
+ if (framing === "discard")
507901
+ return;
507902
+ if (framing === "resync") {
507903
+ this.configuration.websocketProvider.send(syncMessage(this.configuration.name, SYNC_STEP_1, encodeStateVector(this.document)));
507904
+ return;
507905
+ }
507906
+ if (framing === "bounded" && oversized) {
507851
507907
  if (socket) {
507852
- if (this.bounded.negotiated)
507853
- socket.close(4400, "Oversized bounded collaboration message");
507854
- else
507855
- this.bounded.rejectOversizedLegacy(socket);
507908
+ this.bounded?.rejectOversizedLegacy(socket);
507856
507909
  }
507857
507910
  return;
507858
507911
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc/mcp",
3
- "version": "1.21.0-next.30",
3
+ "version": "1.21.0-next.35",
4
4
  "description": "Model Context Protocol server for SuperDoc, giving an AI agent tools to read and edit .docx files.",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0",
@@ -24,13 +24,13 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "@modelcontextprotocol/sdk": "^1.26.0",
27
- "@superdoc/sdk": "2.34.0-next.30",
27
+ "@superdoc/sdk": "2.34.0-next.35",
28
28
  "debug": "^4.4.3",
29
29
  "zod": "^4.3.6"
30
30
  },
31
31
  "devDependencies": {
32
- "superdoc": "2.37.0-next.30",
33
- "@superdoc/docx-engine": "0.36.0-next.30",
32
+ "superdoc": "2.37.0-next.35",
33
+ "@superdoc/docx-engine": "0.36.0-next.35",
34
34
  "@superdoc/document-api": "0.1.0-alpha.0",
35
35
  "@types/bun": "^1.3.8",
36
36
  "@types/node": "22.19.2",