@mulmobridge/discord 1.1.0 → 1.2.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.
package/README.md CHANGED
@@ -53,16 +53,18 @@ npx @mulmobridge/discord
53
53
  |---|---|---|
54
54
  | `DISCORD_BOT_TOKEN` | Yes | Bot token from Developer Portal |
55
55
  | `DISCORD_ALLOWED_CHANNELS` | No | CSV of channel IDs to restrict (empty = all) |
56
- | `MULMOCLAUDE_API_URL` | No | Default `http://localhost:3001` |
56
+ | `MULMOCLAUDE_API_URL` | No | Default: auto (`.server-port`; waits if nothing is published) |
57
57
  | `MULMOCLAUDE_AUTH_TOKEN` | No | Bearer token (auto-read from workspace) |
58
58
  | `DISCORD_BRIDGE_DEFAULT_ROLE` | No | Role id to seed new bridge sessions with (e.g. `coder`, `general`). Applied ONLY when a discord session first appears — once the user switches role via `/role <id>` the session's own role wins. Unknown role ids silently fall back to the server's default with a warn log. |
59
59
  | `BRIDGE_DEFAULT_ROLE` | No | Same as above but shared across every bridge. Transport-specific `DISCORD_BRIDGE_DEFAULT_ROLE` wins when both are set. |
60
60
 
61
61
  ### Auth token persistence across server restarts
62
62
 
63
- The MulmoClaude server regenerates a fresh bearer token on every startup and writes it to `~/mulmoclaude/.session-token`. The bridge reads that file once at launch and keeps the token in memory — so if the server restarts while the bridge is running, the bridge keeps using the **old** token and every API call returns **401**, silently.
63
+ The MulmoClaude server regenerates a fresh bearer token on every startup and writes it to `<workspace>/.session-token` (`$MULMOCLAUDE_WORKSPACE_PATH`, or `~/mulmoclaude` when unset), alongside the port it bound in `.server-port`.
64
64
 
65
- **Fix**: set `MULMOCLAUDE_AUTH_TOKEN` to the same long random value on **both** the server and the bridge. The server uses it verbatim instead of regenerating, so the token survives restarts and the bridge stays authenticated.
65
+ **The bridge follows a restart on its own.** When the connection fails it re-reads both files, and if the server came back as a different generation — new token, new port, or both — it rebuilds its socket against it (#3078). You do not have to restart the bridge.
66
+
67
+ Pinning the token is still useful when the bridge runs **on a different machine** from the server, where it cannot read the workspace at all: set `MULMOCLAUDE_AUTH_TOKEN` to the same long random value on both sides. The server then uses it verbatim instead of regenerating.
66
68
 
67
69
  ```bash
68
70
  # Server (one-time setup — same value across restarts)
package/dist/index.js CHANGED
@@ -6,14 +6,16 @@
6
6
  //
7
7
  // Optional:
8
8
  // DISCORD_ALLOWED_CHANNELS — CSV of channel IDs (empty = allow all)
9
- // MULMOCLAUDE_API_URL — default http://localhost:3001
9
+ // MULMOCLAUDE_API_URL — default: the port in <workspace>/.server-port.
10
+ // With none published the client waits (#3078)
10
11
  // MULMOCLAUDE_AUTH_TOKEN — bearer token (or read from workspace)
11
12
  import "dotenv/config";
12
13
  import { Client, GatewayIntentBits, Partials } from "discord.js";
13
- import { createBridgeClient } from "@mulmobridge/client";
14
+ import { createBridgeClient, installProcessGuards } from "@mulmobridge/client";
14
15
  import { parseCsvSet } from "@mulmoclaude/common";
15
16
  import { collectAttachments, resolveMessageText } from "./attachments.js";
16
17
  const TRANSPORT_ID = "discord";
18
+ installProcessGuards({ name: TRANSPORT_ID });
17
19
  const MAX_DISCORD_LENGTH = 2000;
18
20
  const token = process.env.DISCORD_BOT_TOKEN;
19
21
  if (!token) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mulmobridge/discord",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "Discord bridge for MulmoBridge — connect a Discord bot to MulmoClaude",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,15 +22,15 @@
22
22
  "license": "MIT",
23
23
  "author": "Receptron Team",
24
24
  "dependencies": {
25
- "@mulmobridge/client": "^1.0.2",
25
+ "@mulmobridge/client": "^1.3.0",
26
26
  "@mulmobridge/protocol": "^1.0.1",
27
- "@mulmoclaude/common": "^1.2.0",
27
+ "@mulmoclaude/common": "^1.3.0",
28
28
  "discord.js": "^14.27.0",
29
29
  "dotenv": "^17.0.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/node": "^26.1.2",
33
- "tsx": "^4.23.5",
32
+ "@types/node": "^26.5.1",
33
+ "tsx": "^4.23.13",
34
34
  "typescript": "^6.0.3"
35
35
  },
36
36
  "homepage": "https://github.com/receptron/mulmoclaude/tree/main/packages/bridges/discord#readme",