@friendlyrobot/discord-pi-agent 0.9.2 → 0.9.3

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/index.js +10 -21
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -975,27 +975,16 @@ var typingIntervals = new Map;
975
975
  async function sendTypingSafe(channel, channelKey) {
976
976
  logger5.info({ channelKey }, "[TYPING] calling sendTyping()");
977
977
  try {
978
- const rawFetchPromise = (async () => {
979
- const token = channel.client.token;
980
- const url = `https://discord.com/api/v10/channels/${channel.id}/typing`;
981
- const response = await fetch(url, {
982
- method: "POST",
983
- headers: { Authorization: `Bot ${token}` }
984
- });
985
- logger5.info({ channelKey, status: response.status }, "[TYPING] raw fetch status");
986
- return "raw-ok";
987
- })();
988
- const result = await Promise.race([
989
- channel.sendTyping().then(() => "ok"),
990
- rawFetchPromise,
991
- new Promise((resolve) => setTimeout(() => resolve("timeout"), 5000))
992
- ]);
993
- if (result === "timeout") {
994
- logger5.warn({ channelKey }, "[TYPING] BOTH calls TIMEOUT after 5s");
995
- } else if (result === "raw-ok") {
996
- logger5.info({ channelKey }, "[TYPING] raw fetch OK, discord.js STUCK");
997
- } else {
998
- logger5.info({ channelKey }, "[TYPING] sendTyping() OK");
978
+ const token = channel.client.token;
979
+ const url = `https://discord.com/api/v10/channels/${channel.id}/typing`;
980
+ const res = await fetch(url, {
981
+ method: "POST",
982
+ headers: { Authorization: `Bot ${token}` }
983
+ });
984
+ const body = await res.text();
985
+ logger5.info({ channelKey, status: res.status, headers: Object.fromEntries(res.headers.entries()), body }, "[TYPING] raw fetch response");
986
+ if (res.ok) {
987
+ logger5.info({ channelKey }, "[TYPING] raw fetch OK — Discord accepted typing");
999
988
  }
1000
989
  } catch (error) {
1001
990
  logger5.warn({ channelKey, error }, "[TYPING] sendTyping() FAILED");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@friendlyrobot/discord-pi-agent",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "Reusable Discord gateway bridge for persistent pi agent sessions",
5
5
  "license": "MIT",
6
6
  "type": "module",