Skip to content

Commit fcc640a

Browse files
fix: support botschat plugin reload and default target
1 parent 7bf7977 commit fcc640a

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

packages/plugin/src/channel.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,10 @@ export const botschatPlugin = {
242242
},
243243
},
244244

245-
reload: { configPrefixes: ["channels.botschat"] },
245+
reload: {
246+
configPrefixes: ["channels.botschat"],
247+
noopPrefixes: ["plugins.installs.botschat"],
248+
},
246249

247250
config: {
248251
listAccountIds: (cfg: unknown) => listBotsChatAccountIds(cfg),
@@ -267,6 +270,12 @@ export const botschatPlugin = {
267270
outbound: {
268271
deliveryMode: "direct" as const,
269272

273+
resolveTarget: ({ to }: { to?: string; allowFrom?: string[]; accountId?: string | null; mode?: string }) => {
274+
const trimmed = to?.trim();
275+
if (trimmed) return { ok: true as const, to: trimmed };
276+
return { ok: true as const, to: "@default" };
277+
},
278+
270279
sendText: async (ctx: {
271280
to: string;
272281
text: string;

packages/plugin/src/types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ export type BotsChatChannelConfig = {
3939

4040
/** Plugin → Cloud (outbound, agent responses) */
4141
export type CloudOutbound =
42-
| { type: "auth"; token: string; agents?: string[]; model?: string }
42+
| { type: "auth"; token: string; agentId?: string; agentType?: string; agents?: string[]; model?: string }
4343
| {
4444
type: "agent.text";
45+
agentId?: string;
4546
sessionKey: string;
4647
text: string;
4748
replyToId?: string;
@@ -141,14 +142,15 @@ export type CloudOutbound =
141142

142143
/** Cloud → Plugin (inbound, user messages) */
143144
export type CloudInbound =
144-
| { type: "auth.ok"; userId?: string }
145+
| { type: "auth.ok"; userId?: string; agentId?: string; availableAgents?: Array<{ id: string; name: string; type: string; role: string; capabilities: string[]; status: string }> }
145146
| { type: "auth.fail"; reason: string }
146147
| {
147148
type: "user.message";
148149
sessionKey: string;
149150
text: string;
150151
userId: string;
151152
messageId: string;
153+
targetAgentId?: string;
152154
mediaUrl?: string;
153155
/** Parent message fields — attached by ConnectionDO for thread messages */
154156
parentMessageId?: string;

0 commit comments

Comments
 (0)