@tritard/waterbrother 0.16.45 → 0.16.46

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/package.json +1 -1
  2. package/src/gateway.js +22 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tritard/waterbrother",
3
- "version": "0.16.45",
3
+ "version": "0.16.46",
4
4
  "description": "Waterbrother: bring-your-own-model coding CLI with local tools, sessions, operator modes, and approval controls",
5
5
  "type": "module",
6
6
  "bin": {
package/src/gateway.js CHANGED
@@ -678,6 +678,14 @@ class TelegramGateway {
678
678
  return sent;
679
679
  }
680
680
 
681
+ async sendMarkup(chatId, html, replyToMessageId = null, options = {}) {
682
+ return this.sendMessage(chatId, html, replyToMessageId, {
683
+ parseMode: "HTML",
684
+ rawHtml: true,
685
+ ...options
686
+ });
687
+ }
688
+
681
689
  async editMessage(chatId, messageId, text, { parseMode = "HTML", disableWebPagePreview = true } = {}) {
682
690
  return this.callApi("editMessageText", {
683
691
  chat_id: chatId,
@@ -1338,7 +1346,7 @@ class TelegramGateway {
1338
1346
  const member = Array.isArray(project?.members)
1339
1347
  ? project.members.find((entry) => String(entry?.id || "").trim() === userId) || null
1340
1348
  : null;
1341
- await this.sendMessage(
1349
+ await this.sendMarkup(
1342
1350
  message.chat.id,
1343
1351
  formatTelegramWhoamiMarkup({ message, member, invites, sharedEnabled: project?.enabled === true }),
1344
1352
  message.message_id
@@ -1348,7 +1356,7 @@ class TelegramGateway {
1348
1356
 
1349
1357
  if (text === "/people") {
1350
1358
  const { project } = await this.bindSharedRoomForMessage(message, sessionId);
1351
- await this.sendMessage(
1359
+ await this.sendMarkup(
1352
1360
  message.chat.id,
1353
1361
  formatTelegramPeopleMarkup({ people: this.listKnownChatPeople(message), project }),
1354
1362
  message.message_id
@@ -1357,7 +1365,7 @@ class TelegramGateway {
1357
1365
  }
1358
1366
 
1359
1367
  if (text === "/status") {
1360
- await this.sendMessage(
1368
+ await this.sendMarkup(
1361
1369
  message.chat.id,
1362
1370
  formatGatewaySessionStatus({
1363
1371
  sessionId,
@@ -1374,13 +1382,13 @@ class TelegramGateway {
1374
1382
  }
1375
1383
 
1376
1384
  if (text === "/room") {
1377
- await this.sendMessage(message.chat.id, await this.buildRoomMarkup(message, sessionId), message.message_id);
1385
+ await this.sendMarkup(message.chat.id, await this.buildRoomMarkup(message, sessionId), message.message_id);
1378
1386
  return;
1379
1387
  }
1380
1388
 
1381
1389
  if (text === "/members") {
1382
1390
  const { project } = await this.bindSharedRoomForMessage(message, sessionId);
1383
- await this.sendMessage(message.chat.id, formatTelegramMembersMarkup(project), message.message_id);
1391
+ await this.sendMarkup(message.chat.id, formatTelegramMembersMarkup(project), message.message_id);
1384
1392
  return;
1385
1393
  }
1386
1394
 
@@ -1392,7 +1400,7 @@ class TelegramGateway {
1392
1400
  }
1393
1401
  try {
1394
1402
  const invites = await listSharedInvites(session.cwd || this.cwd);
1395
- await this.sendMessage(message.chat.id, formatTelegramInvitesMarkup(invites), message.message_id);
1403
+ await this.sendMarkup(message.chat.id, formatTelegramInvitesMarkup(invites), message.message_id);
1396
1404
  } catch (error) {
1397
1405
  await this.sendMessage(message.chat.id, escapeTelegramHtml(error instanceof Error ? error.message : String(error)), message.message_id);
1398
1406
  }
@@ -1407,7 +1415,7 @@ class TelegramGateway {
1407
1415
  }
1408
1416
  try {
1409
1417
  const events = await listSharedEvents(session.cwd || this.cwd, 12);
1410
- await this.sendMessage(message.chat.id, formatTelegramEventsMarkup(events), message.message_id);
1418
+ await this.sendMarkup(message.chat.id, formatTelegramEventsMarkup(events), message.message_id);
1411
1419
  } catch (error) {
1412
1420
  await this.sendMessage(message.chat.id, escapeTelegramHtml(error instanceof Error ? error.message : String(error)), message.message_id);
1413
1421
  }
@@ -1421,7 +1429,7 @@ class TelegramGateway {
1421
1429
  return;
1422
1430
  }
1423
1431
  const tasks = await listSharedTasks(session.cwd || this.cwd);
1424
- await this.sendMessage(message.chat.id, formatTelegramTasksMarkup(tasks), message.message_id);
1432
+ await this.sendMarkup(message.chat.id, formatTelegramTasksMarkup(tasks), message.message_id);
1425
1433
  return;
1426
1434
  }
1427
1435
 
@@ -1435,7 +1443,7 @@ class TelegramGateway {
1435
1443
 
1436
1444
  if (text === "/room-runtime") {
1437
1445
  const { project } = await this.bindSharedRoomForMessage(message, sessionId);
1438
- await this.sendMessage(
1446
+ await this.sendMarkup(
1439
1447
  message.chat.id,
1440
1448
  project?.enabled
1441
1449
  ? `<b>Shared room runtime profile</b>\n<code>${escapeTelegramHtml(project.runtimeProfile || "none")}</code>`
@@ -1447,7 +1455,7 @@ class TelegramGateway {
1447
1455
 
1448
1456
  if (text === "/mode") {
1449
1457
  const { project } = await this.bindSharedRoomForMessage(message, sessionId);
1450
- await this.sendMessage(
1458
+ await this.sendMarkup(
1451
1459
  message.chat.id,
1452
1460
  project?.enabled
1453
1461
  ? `<b>Shared room mode</b>\n<code>${escapeTelegramHtml(project.roomMode || "chat")}</code>`
@@ -1466,7 +1474,7 @@ class TelegramGateway {
1466
1474
  }
1467
1475
  try {
1468
1476
  const next = await setSharedRoomMode(session.cwd || this.cwd, requestedMode, { actorId: userId });
1469
- await this.sendMessage(message.chat.id, `Shared room mode set to <code>${escapeTelegramHtml(next.roomMode)}</code>`, message.message_id);
1477
+ await this.sendMarkup(message.chat.id, `Shared room mode set to <code>${escapeTelegramHtml(next.roomMode)}</code>`, message.message_id);
1470
1478
  } catch (error) {
1471
1479
  await this.sendMessage(message.chat.id, escapeTelegramHtml(error instanceof Error ? error.message : String(error)), message.message_id);
1472
1480
  }
@@ -1914,7 +1922,7 @@ Ask them to run <code>/whoami</code> and then <code>/accept-invite ${escapeTeleg
1914
1922
  }
1915
1923
  if (this.isGroupChat(message) && groupIntent.kind !== "execution") {
1916
1924
  if (localConceptAnswer) {
1917
- await this.sendMessage(message.chat.id, renderTelegramChunks(localConceptAnswer).join("\n\n"), message.message_id, { parseMode: "HTML" });
1925
+ await this.sendMarkup(message.chat.id, renderTelegramChunks(localConceptAnswer).join("\n\n"), message.message_id);
1918
1926
  return;
1919
1927
  }
1920
1928
  const suggestion = suggestTaskText(promptText);
@@ -1925,7 +1933,7 @@ Ask them to run <code>/whoami</code> and then <code>/accept-invite ${escapeTeleg
1925
1933
  return;
1926
1934
  }
1927
1935
  if (this.isGroupChat(message) && groupIntent.kind === "execution" && !isExplicitRun) {
1928
- await this.sendMessage(
1936
+ await this.sendMarkup(
1929
1937
  message.chat.id,
1930
1938
  "Execution requests in groups must use <code>/run &lt;prompt&gt;</code>. Discussion and planning can stay as normal targeted messages.",
1931
1939
  message.message_id
@@ -1933,7 +1941,7 @@ Ask them to run <code>/whoami</code> and then <code>/accept-invite ${escapeTeleg
1933
1941
  return;
1934
1942
  }
1935
1943
  if (localConceptAnswer) {
1936
- await this.sendMessage(message.chat.id, renderTelegramChunks(localConceptAnswer).join("\n\n"), message.message_id, { parseMode: "HTML" });
1944
+ await this.sendMarkup(message.chat.id, renderTelegramChunks(localConceptAnswer).join("\n\n"), message.message_id);
1937
1945
  return;
1938
1946
  }
1939
1947