@mulmobridge/chat-service 1.2.0 → 1.3.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 (2) hide show
  1. package/dist/relay.js +13 -6
  2. package/package.json +3 -3
package/dist/relay.js CHANGED
@@ -6,10 +6,8 @@
6
6
  // point, session events, role lookup, logger) arrive through
7
7
  // `createRelay(deps)` so the module has no direct imports from the
8
8
  // host.
9
- import { EVENT_TYPES } from "@mulmobridge/protocol";
9
+ import { EVENT_TYPES, resolveReplyTimeoutMs } from "@mulmobridge/protocol";
10
10
  import { createKeyedSerializer } from "./keyed-serializer.js";
11
- // ── Constants ────────────────────────────────────────────────
12
- const REPLY_TIMEOUT_MS = 5 * 60 * 1000;
13
11
  // ── Factory ──────────────────────────────────────────────────
14
12
  export function createRelay(deps) {
15
13
  const serialize = createKeyedSerializer();
@@ -96,7 +94,8 @@ async function processRelayMessage(deps, params) {
96
94
  };
97
95
  }
98
96
  try {
99
- const reply = await collectAgentReply(onSessionEvent, chatState.sessionId, params.onChunk);
97
+ const replyTimeoutMs = resolveBridgeReplyTimeout(bridgeOptions, logger, transportId);
98
+ const reply = await collectAgentReply(onSessionEvent, chatState.sessionId, replyTimeoutMs, params.onChunk);
100
99
  await store.setChatState(transportId, {
101
100
  ...chatState,
102
101
  updatedAt: new Date().toISOString(),
@@ -139,15 +138,23 @@ export function resolveDefaultRole(bridgeOptions, getRole, fallbackRoleId, logge
139
138
  }
140
139
  return resolved.id;
141
140
  }
141
+ // The bridge client reads the same option for its ack timer, so a bad value
142
+ // is warned about on both ends and both fall back to the same default.
143
+ function resolveBridgeReplyTimeout(bridgeOptions, logger, transportId) {
144
+ const { replyTimeoutMs, warning } = resolveReplyTimeoutMs(bridgeOptions?.replyTimeoutMs);
145
+ if (warning)
146
+ logger.warn("chat-service", "bridge reply timeout option ignored", { transportId, warning });
147
+ return replyTimeoutMs;
148
+ }
142
149
  // Kept out of the factory closure so future packaging doesn't need
143
150
  // to re-capture anything; `onSessionEvent` arrives as a plain param.
144
- function collectAgentReply(onSessionEvent, chatSessionId, onChunk) {
151
+ function collectAgentReply(onSessionEvent, chatSessionId, replyTimeoutMs, onChunk) {
145
152
  return new Promise((resolve) => {
146
153
  const textChunks = [];
147
154
  const timer = setTimeout(() => {
148
155
  unsubscribe();
149
156
  resolve(textChunks.join("") || "The request timed out before a reply was generated.");
150
- }, REPLY_TIMEOUT_MS);
157
+ }, replyTimeoutMs);
151
158
  const unsubscribe = onSessionEvent(chatSessionId, (event) => {
152
159
  const type = event.type;
153
160
  if (type === EVENT_TYPES.text) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mulmobridge/chat-service",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Server-side chat service for MulmoBridge — socket.io + REST bridge to Claude Code agents",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,14 +20,14 @@
20
20
  "scripts": {
21
21
  "build": "tsc",
22
22
  "prepack": "yarn build",
23
- "typecheck": "tsc --noEmit",
23
+ "typecheck": "tsc -p tsconfig.typecheck.json",
24
24
  "test": "tsx --test test/test_*.ts",
25
25
  "lint": "eslint src test"
26
26
  },
27
27
  "license": "MIT",
28
28
  "author": "Receptron Team",
29
29
  "dependencies": {
30
- "@mulmobridge/protocol": "^1.0.1"
30
+ "@mulmobridge/protocol": "^1.1.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "express": "^5.0.0",