@poncho-ai/messaging 0.2.8 → 0.2.9

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @poncho-ai/messaging@0.2.8 build /home/runner/work/poncho-ai/poncho-ai/packages/messaging
2
+ > @poncho-ai/messaging@0.2.9 build /Users/cesar/Dev/latitude/poncho-ai/packages/messaging
3
3
  > tsup src/index.ts --format esm --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -7,8 +7,8 @@
7
7
  CLI tsup v8.5.1
8
8
  CLI Target: es2022
9
9
  ESM Build start
10
- ESM dist/index.js 30.13 KB
11
- ESM ⚡️ Build success in 77ms
10
+ ESM dist/index.js 30.49 KB
11
+ ESM ⚡️ Build success in 58ms
12
12
  DTS Build start
13
- DTS ⚡️ Build success in 5331ms
13
+ DTS ⚡️ Build success in 1611ms
14
14
  DTS dist/index.d.ts 8.98 KB
@@ -0,0 +1,29 @@
1
+
2
+ > @poncho-ai/messaging@0.2.4 test /Users/cesar/Dev/latitude/poncho-ai/packages/messaging
3
+ > vitest
4
+
5
+
6
+  RUN  v1.6.1 /Users/cesar/Dev/latitude/poncho-ai/packages/messaging
7
+
8
+ stderr | test/bridge.test.ts > AgentBridge > posts an error message and cleans up on runner failure
9
+ [agent-bridge] handleMessage error: Model overloaded
10
+
11
+ stderr | test/bridge.test.ts > AgentBridge > skips sendReply when autoReply is false
12
+ [agent-bridge] tool mode completed without send_email being called; no reply sent
13
+
14
+ stderr | test/bridge.test.ts > AgentBridge > suppresses error reply when hasSentInCurrentRequest is true
15
+ [agent-bridge] handleMessage error: Oops
16
+
17
+ stderr | test/bridge.test.ts > AgentBridge > calls resetRequestState before handling each message
18
+ [agent-bridge] tool mode completed without send_email being called; no reply sent
19
+
20
+ ✓ test/bridge.test.ts  (15 tests) 7ms
21
+ ✓ test/adapters/email-utils.test.ts  (44 tests) 13ms
22
+ ✓ test/adapters/resend.test.ts  (13 tests) 7ms
23
+ ✓ test/adapters/slack.test.ts  (17 tests) 61ms
24
+
25
+  Test Files  4 passed (4)
26
+  Tests  89 passed (89)
27
+  Start at  17:47:42
28
+  Duration  442ms (transform 223ms, setup 0ms, collect 336ms, tests 88ms, environment 0ms, prepare 304ms)
29
+
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @poncho-ai/messaging
2
2
 
3
+ ## 0.2.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e9b801f`](https://github.com/cesr/poncho-ai/commit/e9b801f0c70ffab6cb434b7adf05df22b29ea9fe) Thanks [@cesr](https://github.com/cesr)! - Derive deterministic UUIDs for messaging conversation IDs instead of composite strings. Fixes Latitude telemetry rejection and ensures consistency with web UI/API conversations.
8
+
3
9
  ## 0.2.8
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,5 +1,16 @@
1
1
  // src/bridge.ts
2
- var conversationIdFromThread = (platform, ref) => `${platform}:${ref.channelId}:${ref.platformThreadId}`;
2
+ import { createHash } from "crypto";
3
+ var conversationIdFromThread = (platform, ref) => {
4
+ const key = `${platform}:${ref.channelId}:${ref.platformThreadId}`;
5
+ const hex = createHash("sha256").update(key).digest("hex").slice(0, 32);
6
+ return [
7
+ hex.slice(0, 8),
8
+ hex.slice(8, 12),
9
+ `4${hex.slice(13, 16)}`,
10
+ (parseInt(hex.slice(16, 18), 16) & 63 | 128).toString(16).padStart(2, "0") + hex.slice(18, 20),
11
+ hex.slice(20, 32)
12
+ ].join("-");
13
+ };
3
14
  var AgentBridge = class {
4
15
  adapter;
5
16
  runner;
@@ -319,7 +330,7 @@ var SlackAdapter = class {
319
330
  import { createHmac as createHmac2 } from "crypto";
320
331
 
321
332
  // src/adapters/email/utils.ts
322
- import { createHash } from "crypto";
333
+ import { createHash as createHash2 } from "crypto";
323
334
  var ADDR_RE = /<([^>]+)>/;
324
335
  function extractEmailAddress(formatted) {
325
336
  const match = ADDR_RE.exec(formatted);
@@ -350,7 +361,7 @@ function deriveRootMessageId(references, currentMessageId, fallback) {
350
361
  if (references.length > 0) return references[0];
351
362
  if (fallback) {
352
363
  const normalised = normaliseSubject(fallback.subject) + "\0" + fallback.sender.toLowerCase();
353
- const hash = createHash("sha256").update(normalised).digest("hex").slice(0, 16);
364
+ const hash = createHash2("sha256").update(normalised).digest("hex").slice(0, 16);
354
365
  return `<fallback:${hash}>`;
355
366
  }
356
367
  return currentMessageId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/messaging",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Messaging platform adapters for Poncho agents (Slack, Telegram, etc.)",
5
5
  "repository": {
6
6
  "type": "git",
package/src/bridge.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { createHash } from "node:crypto";
1
2
  import type {
2
3
  AgentBridgeOptions,
3
4
  IncomingMessage,
@@ -7,13 +8,24 @@ import type {
7
8
  } from "./types.js";
8
9
 
9
10
  /**
10
- * Derive a stable conversation ID from a platform thread reference.
11
- * Format: `<platform>:<channelId>:<threadId>`
11
+ * Derive a deterministic UUID from a platform thread reference.
12
+ * SHA-256 hashes the composite key and formats 16 bytes as a UUID v4-shaped
13
+ * string, ensuring a valid UUID that's stable across requests for the same thread.
12
14
  */
13
15
  const conversationIdFromThread = (
14
16
  platform: string,
15
17
  ref: ThreadRef,
16
- ): string => `${platform}:${ref.channelId}:${ref.platformThreadId}`;
18
+ ): string => {
19
+ const key = `${platform}:${ref.channelId}:${ref.platformThreadId}`;
20
+ const hex = createHash("sha256").update(key).digest("hex").slice(0, 32);
21
+ return [
22
+ hex.slice(0, 8),
23
+ hex.slice(8, 12),
24
+ `4${hex.slice(13, 16)}`,
25
+ ((parseInt(hex.slice(16, 18), 16) & 0x3f) | 0x80).toString(16).padStart(2, "0") + hex.slice(18, 20),
26
+ hex.slice(20, 32),
27
+ ].join("-");
28
+ };
17
29
 
18
30
  export class AgentBridge {
19
31
  private readonly adapter: MessagingAdapter;