Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/eve/src/public/channels/chat-sdk/chatSdkChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ export function chatSdkChannel<TAdapters extends ChatSdkAdapters>(
{ inputResponses: [response] },
{
auth: config.resolveInputAuth ? await config.resolveInputAuth(event) : null,
thread: event.thread,
// ActionEvent types `thread` as `Thread<TRawMessage>` (generic in the wrong slot),
// so narrow to the bridgeSend-accepted Thread<Record<string, unknown>, unknown>.
thread: event.thread as unknown as Thread,
},
);
});
Expand Down
12 changes: 10 additions & 2 deletions packages/eve/src/public/channels/photon/inboundContent.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import { describe, expect, it } from "vitest";

import { Message } from "#compiled/chat/index.js";
import { Message, parseMarkdown } from "#compiled/chat/index.js";
import { photonInboundContent } from "#public/channels/photon/inboundContent.js";

function message(text: string, attachments: Message["attachments"] = []): Message {
return new Message({
attachments,
author: { isBot: false, isMe: false, userId: "user", userName: "user" },
author: {
fullName: "Test User",
isBot: false,
isMe: false,
userId: "user",
userName: "user",
},
formatted: parseMarkdown(text),
id: "message-id",
metadata: { dateSent: new Date("2026-01-01T00:00:00.000Z"), edited: false },
raw: {},
text,
threadId: "thread-id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,26 @@ vi.mock("#compiled/@photon-ai/chat-adapter-imessage/index.js", () => ({
vi.mock("#public/channels/auth.js", () => ({ vercelOidc: vi.fn() }));

import { photonIMessageChannel } from "#public/channels/photon/photonIMessageChannel.js";
import { Message } from "#compiled/chat/index.js";
import { Message, parseMarkdown } from "#compiled/chat/index.js";

function buildMessage(text: string, threadId: string): Message {
return new Message({
attachments: [],
author: {
fullName: "Test User",
isBot: false,
isMe: false,
userId: "user",
userName: "user",
},
formatted: parseMarkdown(text),
id: "message-id",
metadata: { dateSent: new Date("2026-01-01T00:00:00.000Z"), edited: false },
raw: {},
text,
threadId,
});
}

describe("photonIMessageChannel", () => {
beforeEach(() => {
Expand All @@ -41,13 +60,7 @@ describe("photonIMessageChannel", () => {
const handler = directMessage.mock.calls[0]?.[0];
if (handler === undefined) throw new Error("Expected an inbound direct-message handler.");
const thread = { id: "thread-id" };
const message = new Message({
author: { isBot: false, isMe: false, userId: "user", userName: "user" },
id: "message-id",
raw: {},
text: "Steer this response",
threadId: thread.id,
});
const message = buildMessage("Steer this response", thread.id);

await handler(thread, message);

Expand All @@ -64,13 +77,7 @@ describe("photonIMessageChannel", () => {
const handler = directMessage.mock.calls[0]?.[0];
if (handler === undefined) throw new Error("Expected an inbound direct-message handler.");
const thread = { id: "thread-id" };
const message = new Message({
author: { isBot: false, isMe: false, userId: "user", userName: "user" },
id: "message-id",
raw: {},
text: " \n",
threadId: thread.id,
});
const message = buildMessage(" \n", thread.id);

await handler(thread, message);

Expand All @@ -86,13 +93,7 @@ describe("photonIMessageChannel", () => {
throw new Error("Expected an inbound group-message handler.");
}
const thread = { id: "group-thread-id" };
const message = new Message({
author: { isBot: false, isMe: false, userId: "user", userName: "user" },
id: "message-id",
raw: {},
text: "Hello group",
threadId: thread.id,
});
const message = buildMessage("Hello group", thread.id);

expect(pattern.test(message.text)).toBe(true);
await handler(thread, message);
Expand Down
Loading