


























@@ -1035,6 +1035,50 @@ describe("gateway send mirroring", () => {
10351035);
10361036});
103710371038+it("passes agent-scoped media roots to gateway message actions", async () => {
1039+let capturedMediaLocalRoots: readonly string[] | undefined;
1040+const mediaActionPlugin: ChannelPlugin = {
1041+id: "telegram",
1042+meta: {
1043+id: "telegram",
1044+label: "Telegram",
1045+selectionLabel: "Telegram",
1046+docsPath: "/channels/telegram",
1047+blurb: "Telegram media action dispatch test plugin.",
1048+},
1049+capabilities: { chatTypes: ["direct"] },
1050+config: {
1051+listAccountIds: () => ["default"],
1052+resolveAccount: () => ({ enabled: true }),
1053+isConfigured: () => true,
1054+},
1055+actions: {
1056+describeMessageTool: () => ({ actions: ["sendAttachment"] }),
1057+supportsAction: ({ action }) => action === "sendAttachment",
1058+handleAction: async ({ mediaLocalRoots }) => {
1059+capturedMediaLocalRoots = mediaLocalRoots;
1060+return jsonResult({ ok: true });
1061+},
1062+},
1063+};
1064+mocks.getChannelPlugin.mockReturnValue(mediaActionPlugin);
1065+setActivePluginRegistry(
1066+createTestRegistry([{ pluginId: "telegram", source: "test", plugin: mediaActionPlugin }]),
1067+"send-test-message-action-media-roots",
1068+);
1069+1070+const { respond } = await runMessageActionRequest({
1071+channel: "telegram",
1072+action: "sendAttachment",
1073+params: { chatId: "123", mediaUrl: `${TEST_AGENT_WORKSPACE}/render.png` },
1074+agentId: "work",
1075+idempotencyKey: "idem-message-action-media-roots",
1076+});
1077+1078+expect(firstRespondCall(respond)?.[0]).toBe(true);
1079+expect(capturedMediaLocalRoots).toEqual(expect.arrayContaining([TEST_AGENT_WORKSPACE]));
1080+});
1081+10381082it("forces senderIsOwner=false for narrowly-scoped callers but honors it for full operators", async () => {
10391083const capture = { senderIsOwner: undefined as boolean | undefined };
10401084const reactPlugin: ChannelPlugin = {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。