claude-threads 1.17.3 → 1.18.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.
@@ -14574,6 +14574,7 @@ var require_receiver = __commonJS((exports, module) => {
14574
14574
  this._opcode = 0;
14575
14575
  this._totalPayloadLength = 0;
14576
14576
  this._messageLength = 0;
14577
+ this._numFragments = 0;
14577
14578
  this._fragments = [];
14578
14579
  this._errored = false;
14579
14580
  this._loop = false;
@@ -14783,17 +14784,17 @@ var require_receiver = __commonJS((exports, module) => {
14783
14784
  this.controlMessage(data, cb);
14784
14785
  return;
14785
14786
  }
14787
+ if (this._maxFragments > 0 && ++this._numFragments > this._maxFragments) {
14788
+ const error49 = this.createError(RangeError, "Too many message fragments", false, 1008, "WS_ERR_TOO_MANY_BUFFERED_PARTS");
14789
+ cb(error49);
14790
+ return;
14791
+ }
14786
14792
  if (this._compressed) {
14787
14793
  this._state = INFLATING;
14788
14794
  this.decompress(data, cb);
14789
14795
  return;
14790
14796
  }
14791
14797
  if (data.length) {
14792
- if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
14793
- const error49 = this.createError(RangeError, "Too many message fragments", false, 1008, "WS_ERR_TOO_MANY_BUFFERED_PARTS");
14794
- cb(error49);
14795
- return;
14796
- }
14797
14798
  this._messageLength = this._totalPayloadLength;
14798
14799
  this._fragments.push(data);
14799
14800
  }
@@ -14811,11 +14812,6 @@ var require_receiver = __commonJS((exports, module) => {
14811
14812
  cb(error49);
14812
14813
  return;
14813
14814
  }
14814
- if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
14815
- const error49 = this.createError(RangeError, "Too many message fragments", false, 1008, "WS_ERR_TOO_MANY_BUFFERED_PARTS");
14816
- cb(error49);
14817
- return;
14818
- }
14819
14815
  this._fragments.push(buf);
14820
14816
  }
14821
14817
  this.dataMessage(cb);
@@ -14833,6 +14829,7 @@ var require_receiver = __commonJS((exports, module) => {
14833
14829
  this._totalPayloadLength = 0;
14834
14830
  this._messageLength = 0;
14835
14831
  this._fragmented = 0;
14832
+ this._numFragments = 0;
14836
14833
  this._fragments = [];
14837
14834
  if (this._opcode === 2) {
14838
14835
  let data;
@@ -15967,8 +15964,8 @@ var require_websocket = __commonJS((exports, module) => {
15967
15964
  autoPong: true,
15968
15965
  closeTimeout: CLOSE_TIMEOUT,
15969
15966
  protocolVersion: protocolVersions[1],
15970
- maxBufferedChunks: 1024 * 1024,
15971
- maxFragments: 128 * 1024,
15967
+ maxBufferedChunks: 256 * 1024,
15968
+ maxFragments: 16 * 1024,
15972
15969
  maxPayload: 100 * 1024 * 1024,
15973
15970
  skipUTF8Validation: false,
15974
15971
  perMessageDeflate: true,
@@ -16544,8 +16541,8 @@ var require_websocket_server = __commonJS((exports, module) => {
16544
16541
  options = {
16545
16542
  allowSynchronousEvents: true,
16546
16543
  autoPong: true,
16547
- maxBufferedChunks: 1024 * 1024,
16548
- maxFragments: 128 * 1024,
16544
+ maxBufferedChunks: 256 * 1024,
16545
+ maxFragments: 16 * 1024,
16549
16546
  maxPayload: 100 * 1024 * 1024,
16550
16547
  skipUTF8Validation: false,
16551
16548
  perMessageDeflate: false,
@@ -57640,7 +57637,7 @@ var readPostInputSchema = {
57640
57637
  max_messages: exports_external.coerce.number().int().optional().describe(`Maximum thread messages to return when include_thread is true. Defaults to ${DEFAULT_THREAD_LIMIT}, capped at ${MAX_THREAD_LIMIT}.`)
57641
57638
  };
57642
57639
  var reactToPostInputSchema = {
57643
- url: exports_external.string().describe("Permalink URL to a post the bot can already see (its own channel, or a public channel on the same instance)."),
57640
+ url: exports_external.string().optional().describe("Permalink URL to a post the bot can already see (its own channel, or a public channel on the same instance). " + "Omit to react to the most recent message in the current session thread (e.g. to acknowledge the message " + "that triggered the current task) — this is the common case and does NOT default to the thread root."),
57644
57641
  emoji: exports_external.string().describe("Emoji name without colons, e.g. 'white_check_mark', '+1', 'eyes'. Platform-specific vocabulary applies.")
57645
57642
  };
57646
57643
  var updateOwnPostInputSchema = {
@@ -57788,6 +57785,27 @@ async function handleReadPost(args) {
57788
57785
  });
57789
57786
  }
57790
57787
  var EMOJI_NAME_RE = /^[a-z0-9_+-]{1,64}$/i;
57788
+ async function resolveLatestThreadPost(cfg) {
57789
+ if (!cfg.api.readThread) {
57790
+ return { ok: false, reason: "this platform does not support reading threads" };
57791
+ }
57792
+ if (!cfg.sessionThreadId) {
57793
+ return { ok: false, reason: "no session thread to react in — pass a permalink URL instead" };
57794
+ }
57795
+ let thread;
57796
+ try {
57797
+ thread = await cfg.api.readThread(cfg.sessionThreadId);
57798
+ } catch (err) {
57799
+ const reason = err instanceof Error ? err.message : String(err);
57800
+ mcpLogger.warn(`react_to_post: failed to resolve latest thread message: ${reason}`);
57801
+ return { ok: false, reason };
57802
+ }
57803
+ const latest = thread.at(-1);
57804
+ if (!latest) {
57805
+ return { ok: false, reason: "session thread is empty — pass a permalink URL instead" };
57806
+ }
57807
+ return { ok: true, post: latest };
57808
+ }
57791
57809
  async function handleReactToPostWith(args, cfg) {
57792
57810
  if (!cfg.api.addReaction) {
57793
57811
  return { ok: false, reason: "this platform does not support adding reactions" };
@@ -57798,7 +57816,7 @@ async function handleReactToPostWith(args, cfg) {
57798
57816
  reason: `invalid emoji name '${args.emoji}' — use names like 'white_check_mark' or '+1'`
57799
57817
  };
57800
57818
  }
57801
- const resolved = await resolvePostFromUrl(args.url, cfg);
57819
+ const resolved = args.url ? await resolvePostFromUrl(args.url, cfg) : await resolveLatestThreadPost(cfg);
57802
57820
  if (!resolved.ok)
57803
57821
  return { ok: false, reason: resolved.reason };
57804
57822
  try {
@@ -57815,7 +57833,8 @@ async function handleReactToPost(args) {
57815
57833
  api: getApi(),
57816
57834
  platformUrl: PLATFORM_URL,
57817
57835
  platformType: PLATFORM_TYPE,
57818
- channelId: PLATFORM_CHANNEL_ID
57836
+ channelId: PLATFORM_CHANNEL_ID,
57837
+ sessionThreadId: PLATFORM_THREAD_ID
57819
57838
  });
57820
57839
  }
57821
57840
  async function handleUpdateOwnPostWith(args, cfg) {
@@ -58367,7 +58386,7 @@ async function main() {
58367
58386
  content: [{ type: "text", text: JSON.stringify(result) }]
58368
58387
  };
58369
58388
  });
58370
- server.tool("react_to_post", "Add an emoji reaction to a post on the chat platform. Use this to acknowledge a request " + "(✅), flag something ambiguous (\uD83D\uDC40), mark a triggering message done, etc. The post must be in " + "the bot's own channel or in a public channel on the same instance. Returns { ok: true } on " + "success or { ok: false, reason } on failure.", reactToPostInputSchema, async ({ url: url2, emoji: emoji4 }) => {
58389
+ server.tool("react_to_post", "Add an emoji reaction to a post on the chat platform. Use this to acknowledge a request " + "(✅), flag something ambiguous (\uD83D\uDC40), mark a triggering message done, etc. Omit `url` to react " + "to the most recent message in the current session thread — the common case. The post must be " + "in the bot's own channel or in a public channel on the same instance. Returns { ok: true } on " + "success or { ok: false, reason } on failure.", reactToPostInputSchema, async ({ url: url2, emoji: emoji4 }) => {
58371
58390
  const result = await handleReactToPost({ url: url2, emoji: emoji4 });
58372
58391
  return {
58373
58392
  content: [{ type: "text", text: JSON.stringify(result) }]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-threads",
3
- "version": "1.17.3",
3
+ "version": "1.18.1",
4
4
  "description": "Share Claude Code sessions live in a Mattermost channel with interactive features",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -63,7 +63,7 @@
63
63
  "package.json"
64
64
  ],
65
65
  "dependencies": {
66
- "@hono/node-server": "2.0.6",
66
+ "@hono/node-server": "2.0.9",
67
67
  "@inkjs/ui": "^2.0.0",
68
68
  "@modelcontextprotocol/sdk": "^1.26.0",
69
69
  "@redactpii/node": "^1.0.16",
@@ -71,7 +71,7 @@
71
71
  "commander": "^14.0.2",
72
72
  "diff": "^8.0.3",
73
73
  "express-rate-limit": "^8.3.0",
74
- "hono": "4.12.27",
74
+ "hono": "4.12.30",
75
75
  "ink": "^6.6.0",
76
76
  "ink-scroll-view": "^0.3.5",
77
77
  "js-yaml": "^4.1.1",
@@ -79,25 +79,25 @@
79
79
  "react": "^19.2.3",
80
80
  "semver": "7.8.5",
81
81
  "update-notifier": "^7.3.1",
82
- "ws": "8.21.0",
82
+ "ws": "8.21.1",
83
83
  "zod": "^4.3.6"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@eslint/js": "^10.0.1",
87
87
  "@types/bun": "latest",
88
88
  "@types/js-yaml": "^4.0.9",
89
- "@types/node": "^26.0.1",
89
+ "@types/node": "^26.1.1",
90
90
  "@types/prompts": "^2.4.9",
91
91
  "@types/react": "^19.2.7",
92
92
  "@types/semver": "^7.7.1",
93
93
  "@types/update-notifier": "^6.0.8",
94
94
  "@types/ws": "^8.18.0",
95
- "eslint": "^10.1.0",
95
+ "eslint": "^10.7.0",
96
96
  "husky": "^9.1.7",
97
97
  "lint-staged": "^17.0.4",
98
- "prettier": "^3.4.2",
98
+ "prettier": "^3.9.5",
99
99
  "typescript": "^6.0.2",
100
- "typescript-eslint": "^8.57.2"
100
+ "typescript-eslint": "^8.64.0"
101
101
  },
102
102
  "engines": {
103
103
  "node": ">=20.0.0",