@poncho-ai/messaging 0.5.0 → 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.
- package/.turbo/turbo-build.log +5 -5
- package/.turbo/turbo-test.log +33 -9
- package/CHANGELOG.md +13 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +4 -1
- package/package.json +2 -2
- package/src/bridge.ts +3 -1
- package/src/index.ts +1 -1
- package/src/types.ts +7 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @poncho-ai/messaging@0.
|
|
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
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
[34mCLI[39m tsup v8.5.1
|
|
8
8
|
[34mCLI[39m Target: es2022
|
|
9
9
|
[34mESM[39m Build start
|
|
10
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
11
|
-
[32mESM[39m ⚡️ Build success in
|
|
10
|
+
[32mESM[39m [1mdist/index.js [22m[32m46.08 KB[39m
|
|
11
|
+
[32mESM[39m ⚡️ Build success in 161ms
|
|
12
12
|
[34mDTS[39m Build start
|
|
13
|
-
[32mDTS[39m ⚡️ Build success in
|
|
14
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m10.
|
|
13
|
+
[32mDTS[39m ⚡️ Build success in 2515ms
|
|
14
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m10.53 KB[39m
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
> @poncho-ai/messaging@0.
|
|
2
|
+
> @poncho-ai/messaging@0.5.1 test /Users/cesar/Dev/latitude/poncho-ai/packages/messaging
|
|
3
3
|
> vitest
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
[7m[1m[36m RUN [39m[22m[27m [36mv1.6.1[39m [90m/Users/cesar/Dev/latitude/poncho-ai/packages/messaging[39m
|
|
7
7
|
|
|
8
|
+
[32m✓[39m test/adapters/resend.test.ts [2m ([22m[2m13 tests[22m[2m)[22m[90m 4[2mms[22m[39m
|
|
8
9
|
[90mstderr[2m | test/bridge.test.ts[2m > [22m[2mAgentBridge[2m > [22m[2mposts an error message and cleans up on runner failure[22m[39m
|
|
9
10
|
[agent-bridge] handleMessage error: Model overloaded
|
|
10
11
|
|
|
@@ -15,15 +16,38 @@
|
|
|
15
16
|
[agent-bridge] handleMessage error: Oops
|
|
16
17
|
|
|
17
18
|
[90mstderr[2m | test/bridge.test.ts[2m > [22m[2mAgentBridge[2m > [22m[2mcalls resetRequestState before handling each message[22m[39m
|
|
19
|
+
[33m❯[39m test/bridge.test.ts [2m ([22m[2m15 tests[22m [2m|[22m [31m1 failed[39m[2m)[22m[90m 11[2mms[22m[39m
|
|
20
|
+
[31m [33m❯[31m test/bridge.test.ts[2m > [22mAgentBridge[2m > [22mderives deterministic conversation IDs from ThreadRef[39m
|
|
18
21
|
[agent-bridge] tool mode completed without send_email being called; no reply sent
|
|
22
|
+
[31m → expected 'c61bdca0-71e1-4785-869c-5552b90054c5' to be 'test:C001:ts_123' // Object.is equality[39m
|
|
19
23
|
|
|
20
|
-
[32m✓[39m test/
|
|
21
|
-
[32m✓[39m test/adapters/
|
|
22
|
-
[32m✓[39m test/adapters/resend.test.ts [2m ([22m[2m13 tests[22m[2m)[22m[90m 7[2mms[22m[39m
|
|
23
|
-
[32m✓[39m test/adapters/slack.test.ts [2m ([22m[2m17 tests[22m[2m)[22m[90m 61[2mms[22m[39m
|
|
24
|
+
[32m✓[39m test/adapters/email-utils.test.ts [2m ([22m[2m44 tests[22m[2m)[22m[90m 7[2mms[22m[39m
|
|
25
|
+
[32m✓[39m test/adapters/slack.test.ts [2m ([22m[2m17 tests[22m[2m)[22m[90m 63[2mms[22m[39m
|
|
24
26
|
|
|
25
|
-
[
|
|
26
|
-
[2m Tests [22m [1m[32m89 passed[39m[22m[90m (89)[39m
|
|
27
|
-
[2m Start at [22m 17:47:42
|
|
28
|
-
[2m Duration [22m 442ms[2m (transform 223ms, setup 0ms, collect 336ms, tests 88ms, environment 0ms, prepare 304ms)[22m
|
|
27
|
+
[31m⎯⎯⎯⎯⎯⎯⎯[1m[7m Failed Tests 1 [27m[22m⎯⎯⎯⎯⎯⎯⎯[39m
|
|
29
28
|
|
|
29
|
+
[31m[1m[7m FAIL [27m[22m[39m test/bridge.test.ts[2m > [22mAgentBridge[2m > [22mderives deterministic conversation IDs from ThreadRef
|
|
30
|
+
[31m[1mAssertionError[22m: expected 'c61bdca0-71e1-4785-869c-5552b90054c5' to be 'test:C001:ts_123' // Object.is equality[39m
|
|
31
|
+
|
|
32
|
+
[32m- Expected[39m
|
|
33
|
+
[31m+ Received[39m
|
|
34
|
+
|
|
35
|
+
[32m- test:C001:ts_123[39m
|
|
36
|
+
[31m+ c61bdca0-71e1-4785-869c-5552b90054c5[39m
|
|
37
|
+
|
|
38
|
+
[36m [2m❯[22m test/bridge.test.ts:[2m88:33[22m[39m
|
|
39
|
+
[90m 86| [39m
|
|
40
|
+
[90m 87| [39m [34mexpect[39m(runner[33m.[39m_runs)[33m.[39m[34mtoHaveLength[39m([34m1[39m)[33m;[39m
|
|
41
|
+
[90m 88| [39m [34mexpect[39m(runner[33m.[39m_runs[[34m0[39m][33m![39m[33m.[39mid)[33m.[39m[34mtoBe[39m([32m"test:C001:ts_123"[39m)[33m;[39m
|
|
42
|
+
[90m | [39m [31m^[39m
|
|
43
|
+
[90m 89| [39m })[33m;[39m
|
|
44
|
+
[90m 90| [39m
|
|
45
|
+
|
|
46
|
+
[2m Test Files [22m [1m[31m1 failed[39m[22m[2m | [22m[1m[32m3 passed[39m[22m[90m (4)[39m
|
|
47
|
+
[31m[2m⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯[22m[39m
|
|
48
|
+
|
|
49
|
+
[2m Tests [22m [1m[31m1 failed[39m[22m[2m | [22m[1m[32m88 passed[39m[22m[90m (89)[39m
|
|
50
|
+
[2m Start at [22m 21:53:18
|
|
51
|
+
[2m Duration [22m 639ms[2m (transform 246ms, setup 0ms, collect 323ms, tests 85ms, environment 0ms, prepare 392ms)[22m
|
|
52
|
+
|
|
53
|
+
ELIFECYCLE Test failed. See above for more details.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
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
|
+
|
|
9
|
+
## 0.5.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`6f0abfd`](https://github.com/cesr/poncho-ai/commit/6f0abfd9f729b545cf293741ee813f705910aaf3)]:
|
|
14
|
+
- @poncho-ai/sdk@1.5.0
|
|
15
|
+
|
|
3
16
|
## 0.5.0
|
|
4
17
|
|
|
5
18
|
### Minor 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.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Messaging platform adapters for Poncho agents (Slack, Telegram, etc.)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@poncho-ai/sdk": "1.
|
|
23
|
+
"@poncho-ai/sdk": "1.5.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"resend": ">=4.0.0"
|
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: {
|
|
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(
|