@kybernesis/buzz 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/relay.js +14 -1
  2. package/package.json +1 -1
package/dist/relay.js CHANGED
@@ -33,6 +33,18 @@ export const KIND_DM_OPEN = 41010;
33
33
  export const TYPING_INTERVAL_MS = 3_000;
34
34
  export const PRESENCE_INTERVAL_MS = 60_000;
35
35
  const now = () => Math.floor(Date.now() / 1000);
36
+ /**
37
+ * The payload out of a command acknowledgement.
38
+ *
39
+ * @remarks
40
+ * A command's answer arrives as `response:{…}` rather than as bare JSON, and the prefix is easy
41
+ * to miss because the request itself succeeds: the server accepts the command, does the work,
42
+ * and reports it — and a parser that chokes on the prefix reports the whole thing as a failure.
43
+ * The visible symptom is a feature that silently never happens.
44
+ */
45
+ function stripAckPrefix(message) {
46
+ return message.startsWith("response:") ? message.slice("response:".length) : message;
47
+ }
36
48
  export class BuzzRelay {
37
49
  socket = null;
38
50
  authenticated = false;
@@ -250,10 +262,11 @@ export class BuzzRelay {
250
262
  return null;
251
263
  }
252
264
  try {
253
- const ack = JSON.parse(result.message);
265
+ const ack = JSON.parse(stripAckPrefix(result.message));
254
266
  return typeof ack.channel_id === "string" ? ack.channel_id : null;
255
267
  }
256
268
  catch {
269
+ this.log(`could not read the reply to opening a direct message: ${result.message.slice(0, 120)}`);
257
270
  return null;
258
271
  }
259
272
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kybernesis/buzz",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Put an eve agent in a Buzz workspace as a member: per-speaker verified identity resolved through the control plane, self-service identity linking, presence, typing and seen signals.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",