@poncho-ai/messaging 0.5.1 → 0.6.0

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.5.1 build /home/runner/work/poncho-ai/poncho-ai/packages/messaging
2
+ > @poncho-ai/messaging@0.6.0 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 45.94 KB
11
- ESM ⚡️ Build success in 66ms
10
+ ESM dist/index.js 46.08 KB
11
+ ESM ⚡️ Build success in 161ms
12
12
  DTS Build start
13
- DTS ⚡️ Build success in 5216ms
14
- DTS dist/index.d.ts 10.13 KB
13
+ DTS ⚡️ Build success in 2515ms
14
+ DTS dist/index.d.ts 10.53 KB
@@ -0,0 +1,53 @@
1
+
2
+ > @poncho-ai/messaging@0.5.1 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
+ ✓ test/adapters/resend.test.ts  (13 tests) 4ms
9
+ stderr | test/bridge.test.ts > AgentBridge > posts an error message and cleans up on runner failure
10
+ [agent-bridge] handleMessage error: Model overloaded
11
+
12
+ stderr | test/bridge.test.ts > AgentBridge > skips sendReply when autoReply is false
13
+ [agent-bridge] tool mode completed without send_email being called; no reply sent
14
+
15
+ stderr | test/bridge.test.ts > AgentBridge > suppresses error reply when hasSentInCurrentRequest is true
16
+ [agent-bridge] handleMessage error: Oops
17
+
18
+ stderr | test/bridge.test.ts > AgentBridge > calls resetRequestState before handling each message
19
+ ❯ test/bridge.test.ts  (15 tests | 1 failed) 11ms
20
+  ❯ test/bridge.test.ts > AgentBridge > derives deterministic conversation IDs from ThreadRef
21
+ [agent-bridge] tool mode completed without send_email being called; no reply sent
22
+  → expected 'c61bdca0-71e1-4785-869c-5552b90054c5' to be 'test:C001:ts_123' // Object.is equality
23
+
24
+ ✓ test/adapters/email-utils.test.ts  (44 tests) 7ms
25
+ ✓ test/adapters/slack.test.ts  (17 tests) 63ms
26
+
27
+ ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
28
+
29
+  FAIL  test/bridge.test.ts > AgentBridge > derives deterministic conversation IDs from ThreadRef
30
+ AssertionError: expected 'c61bdca0-71e1-4785-869c-5552b90054c5' to be 'test:C001:ts_123' // Object.is equality
31
+
32
+ - Expected
33
+ + Received
34
+
35
+ - test:C001:ts_123
36
+ + c61bdca0-71e1-4785-869c-5552b90054c5
37
+
38
+  ❯ test/bridge.test.ts:88:33
39
+  86| 
40
+  87|  expect(runner._runs).toHaveLength(1);
41
+  88|  expect(runner._runs[0]!.id).toBe("test:C001:ts_123");
42
+  |  ^
43
+  89|  });
44
+  90| 
45
+
46
+  Test Files  1 failed | 3 passed (4)
47
+ ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
48
+
49
+  Tests  1 failed | 88 passed (89)
50
+  Start at  21:53:18
51
+  Duration  639ms (transform 246ms, setup 0ms, collect 323ms, tests 85ms, environment 0ms, prepare 392ms)
52
+
53
+  ELIFECYCLE  Test failed. See above for more details.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @poncho-ai/messaging
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`d1e1bfb`](https://github.com/cesr/poncho-ai/commit/d1e1bfbf35b18788ab79231ca675774e949f5116) Thanks [@cesr](https://github.com/cesr)! - Add proactive scheduled messaging via channel-targeted cron jobs. Cron jobs with `channel: telegram` (or `slack`) now automatically discover known conversations and send the agent's response directly to each chat, continuing the existing conversation history.
8
+
3
9
  ## 0.5.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -65,6 +65,8 @@ interface AgentRunner {
65
65
  platform: string;
66
66
  ownerId: string;
67
67
  title?: string;
68
+ channelId?: string;
69
+ platformThreadId?: string;
68
70
  }): Promise<{
69
71
  messages: Message[];
70
72
  }>;
@@ -104,6 +106,12 @@ interface AgentBridgeOptions {
104
106
  ownerId?: string;
105
107
  }
106
108
 
109
+ /**
110
+ * Derive a deterministic UUID from a platform thread reference.
111
+ * SHA-256 hashes the composite key and formats 16 bytes as a UUID v4-shaped
112
+ * string, ensuring a valid UUID that's stable across requests for the same thread.
113
+ */
114
+ declare const conversationIdFromThread: (platform: string, ref: ThreadRef) => string;
107
115
  declare class AgentBridge {
108
116
  private readonly adapter;
109
117
  private readonly runner;
@@ -276,4 +284,4 @@ declare function markdownToEmailHtml(text: string): string;
276
284
  */
277
285
  declare function matchesSenderPattern(sender: string, patterns: string[] | undefined): boolean;
278
286
 
279
- export { AgentBridge, type AgentBridgeOptions, type AgentRunner, type FileAttachment, type IncomingMessage, type IncomingMessageHandler, type MessagingAdapter, ResendAdapter, type ResendAdapterOptions, type RouteHandler, type RouteRegistrar, SlackAdapter, type SlackAdapterOptions, TelegramAdapter, type TelegramAdapterOptions, type ThreadRef, buildReplyHeaders, buildReplySubject, deriveRootMessageId, extractDisplayName, extractEmailAddress, markdownToEmailHtml, matchesSenderPattern, parseReferences, stripQuotedReply };
287
+ export { AgentBridge, type AgentBridgeOptions, type AgentRunner, type FileAttachment, type IncomingMessage, type IncomingMessageHandler, type MessagingAdapter, ResendAdapter, type ResendAdapterOptions, type RouteHandler, type RouteRegistrar, SlackAdapter, type SlackAdapterOptions, TelegramAdapter, type TelegramAdapterOptions, type ThreadRef, buildReplyHeaders, buildReplySubject, conversationIdFromThread, deriveRootMessageId, extractDisplayName, extractEmailAddress, markdownToEmailHtml, matchesSenderPattern, parseReferences, stripQuotedReply };
package/dist/index.js CHANGED
@@ -65,7 +65,9 @@ ${message.text}`;
65
65
  {
66
66
  platform: message.platform,
67
67
  ownerId: this.ownerIdOverride ?? message.sender.id,
68
- title
68
+ title,
69
+ channelId: message.threadRef.channelId,
70
+ platformThreadId: message.threadRef.platformThreadId
69
71
  }
70
72
  );
71
73
  const result = await this.runner.run(conversationId, {
@@ -1391,6 +1393,7 @@ export {
1391
1393
  TelegramAdapter,
1392
1394
  buildReplyHeaders,
1393
1395
  buildReplySubject,
1396
+ conversationIdFromThread,
1394
1397
  deriveRootMessageId,
1395
1398
  extractDisplayName,
1396
1399
  extractEmailAddress,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/messaging",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "Messaging platform adapters for Poncho agents (Slack, Telegram, etc.)",
5
5
  "repository": {
6
6
  "type": "git",
package/src/bridge.ts CHANGED
@@ -13,7 +13,7 @@ import type {
13
13
  * SHA-256 hashes the composite key and formats 16 bytes as a UUID v4-shaped
14
14
  * string, ensuring a valid UUID that's stable across requests for the same thread.
15
15
  */
16
- const conversationIdFromThread = (
16
+ export const conversationIdFromThread = (
17
17
  platform: string,
18
18
  ref: ThreadRef,
19
19
  ): string => {
@@ -94,6 +94,8 @@ export class AgentBridge {
94
94
  platform: message.platform,
95
95
  ownerId: this.ownerIdOverride ?? message.sender.id,
96
96
  title,
97
+ channelId: message.threadRef.channelId,
98
+ platformThreadId: message.threadRef.platformThreadId,
97
99
  },
98
100
  );
99
101
 
package/src/index.ts CHANGED
@@ -10,7 +10,7 @@ export type {
10
10
  ThreadRef,
11
11
  } from "./types.js";
12
12
 
13
- export { AgentBridge } from "./bridge.js";
13
+ export { AgentBridge, conversationIdFromThread } from "./bridge.js";
14
14
  export { SlackAdapter } from "./adapters/slack/index.js";
15
15
  export type { SlackAdapterOptions } from "./adapters/slack/index.js";
16
16
  export { ResendAdapter } from "./adapters/resend/index.js";
package/src/types.ts CHANGED
@@ -105,7 +105,13 @@ export interface MessagingAdapter {
105
105
  export interface AgentRunner {
106
106
  getOrCreateConversation(
107
107
  conversationId: string,
108
- meta: { platform: string; ownerId: string; title?: string },
108
+ meta: {
109
+ platform: string;
110
+ ownerId: string;
111
+ title?: string;
112
+ channelId?: string;
113
+ platformThreadId?: string;
114
+ },
109
115
  ): Promise<{ messages: Message[] }>;
110
116
 
111
117
  run(