@tritard/waterbrother 0.16.149 → 0.16.151

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
@@ -185,6 +185,8 @@ waterbrother onboarding
185
185
  waterbrother update
186
186
  ```
187
187
 
188
+ If you are using Discord and want native slash commands to appear immediately in one server, set `channels.discord.guildId` before running `waterbrother discord sync-commands`.
189
+
188
190
  Web research examples:
189
191
 
190
192
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tritard/waterbrother",
3
- "version": "0.16.149",
3
+ "version": "0.16.151",
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/cli.js CHANGED
@@ -3420,7 +3420,9 @@ function formatTelegramRemoteActor(request = {}) {
3420
3420
  function parseTerminalLabelIntent(text = "") {
3421
3421
  const value = String(text || "").trim();
3422
3422
  if (!value) return null;
3423
- const match = value.match(/^(?:name|label|rename|call)\s+(?:this\s+|my\s+)?(?:terminal|tui|session)(?:\s+(?:to|as))?\s+(.+?)\s*$/i);
3423
+ const match =
3424
+ value.match(/^(?:name|label|rename|call)\s+(?:this\s+|my\s+)?(?:terminal|tui|session)(?:\s+(?:to|as))?\s+(.+?)\s*$/i)
3425
+ || value.match(/^(?:this|my)\s+(?:terminal|tui|session)\s+(?:is\s+named|is\s+called|should\s+be\s+called|is)\s+(.+?)\s*$/i);
3424
3426
  if (!match?.[1]) return null;
3425
3427
  const label = String(match[1] || "").trim().replace(/^["'`]+|["'`]+$/g, "").trim();
3426
3428
  if (!label) return null;
package/src/discord.js CHANGED
@@ -1543,18 +1543,23 @@ async function handleDiscordSessionCommand(runtime, state, message, command) {
1543
1543
 
1544
1544
  async function handleDiscordSlashInteraction(runtime, interaction, { log = () => {} } = {}) {
1545
1545
  const discord = normalizeDiscordRuntime(runtime);
1546
- const message = buildInteractionMessage(interaction);
1547
- const rawText = buildDiscordCommandTextFromInteraction(interaction);
1548
- if (!rawText) {
1549
- await createInteractionResponse(discord, interaction, {
1550
- type: 4,
1551
- data: { content: "Unsupported slash command payload." }
1552
- });
1553
- return;
1554
- }
1555
-
1556
- await deferInteractionResponse(discord, interaction);
1546
+ let acknowledged = false;
1557
1547
  try {
1548
+ const message = buildInteractionMessage(interaction);
1549
+ const rawText = buildDiscordCommandTextFromInteraction(interaction);
1550
+ if (!rawText) {
1551
+ await createInteractionResponse(discord, interaction, {
1552
+ type: 4,
1553
+ data: {
1554
+ content: "Unsupported slash command payload.",
1555
+ ...(shouldUseEphemeralInteraction(interaction) ? { flags: 64 } : {})
1556
+ }
1557
+ });
1558
+ return;
1559
+ }
1560
+
1561
+ await deferInteractionResponse(discord, interaction);
1562
+ acknowledged = true;
1558
1563
  const state = await loadDiscordGatewayState();
1559
1564
  let reply = await handleDiscordControlCommand(runtime, state, message, rawText);
1560
1565
  if (!reply) {
@@ -1567,7 +1572,17 @@ async function handleDiscordSlashInteraction(runtime, interaction, { log = () =>
1567
1572
  log(`discord: interaction reply in ${message.channel_id}`);
1568
1573
  } catch (error) {
1569
1574
  const text = error instanceof Error ? error.message : String(error);
1570
- await sendInteractionReply(discord, interaction, `Slash command failed: ${text}`);
1575
+ if (acknowledged) {
1576
+ await sendInteractionReply(discord, interaction, `Slash command failed: ${text}`);
1577
+ } else {
1578
+ await createInteractionResponse(discord, interaction, {
1579
+ type: 4,
1580
+ data: {
1581
+ content: `Slash command failed: ${text}`,
1582
+ ...(shouldUseEphemeralInteraction(interaction) ? { flags: 64 } : {})
1583
+ }
1584
+ }).catch(() => null);
1585
+ }
1571
1586
  throw error;
1572
1587
  }
1573
1588
  }