@openclaw/msteams 2026.5.2 → 2026.5.3-beta.1
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/dist/api.js +3 -0
- package/dist/channel-D7hdreTh.js +984 -0
- package/dist/channel-config-api.js +2 -0
- package/dist/channel-plugin-api.js +2 -0
- package/dist/channel.runtime-BC1ruIfN.js +573 -0
- package/dist/config-schema-B8QezH6t.js +15 -0
- package/dist/contract-api.js +2 -0
- package/dist/graph-users-9uQJepqr.js +1354 -0
- package/dist/index.js +22 -0
- package/dist/oauth-BWJyilR1.js +114 -0
- package/dist/oauth.token-xxpoLWy5.js +115 -0
- package/dist/policy-DTnU2GR7.js +142 -0
- package/dist/probe-D_H8yFps.js +2194 -0
- package/dist/resolve-allowlist-D41JSziq.js +219 -0
- package/dist/runtime-api-DV1iVMn1.js +28 -0
- package/dist/runtime-api.js +2 -0
- package/dist/secret-contract-BuoEXmPS.js +35 -0
- package/dist/secret-contract-api.js +2 -0
- package/dist/setup-entry.js +15 -0
- package/dist/setup-plugin-api.js +64 -0
- package/dist/setup-surface-BLkFQYIQ.js +313 -0
- package/dist/src-CFp1QpFd.js +4064 -0
- package/dist/test-api.js +2 -0
- package/package.json +14 -6
- package/api.ts +0 -3
- package/channel-config-api.ts +0 -1
- package/channel-plugin-api.ts +0 -2
- package/config-api.ts +0 -4
- package/contract-api.ts +0 -4
- package/index.ts +0 -20
- package/runtime-api.ts +0 -73
- package/secret-contract-api.ts +0 -5
- package/setup-entry.ts +0 -13
- package/setup-plugin-api.ts +0 -3
- package/src/ai-entity.ts +0 -7
- package/src/approval-auth.ts +0 -44
- package/src/attachments/bot-framework.test.ts +0 -461
- package/src/attachments/bot-framework.ts +0 -362
- package/src/attachments/download.ts +0 -311
- package/src/attachments/graph.test.ts +0 -416
- package/src/attachments/graph.ts +0 -484
- package/src/attachments/html.ts +0 -122
- package/src/attachments/payload.ts +0 -14
- package/src/attachments/remote-media.test.ts +0 -137
- package/src/attachments/remote-media.ts +0 -112
- package/src/attachments/shared.test.ts +0 -530
- package/src/attachments/shared.ts +0 -626
- package/src/attachments/types.ts +0 -47
- package/src/attachments.graph.test.ts +0 -342
- package/src/attachments.helpers.test.ts +0 -246
- package/src/attachments.test-helpers.ts +0 -17
- package/src/attachments.test.ts +0 -687
- package/src/attachments.ts +0 -18
- package/src/block-streaming-config.test.ts +0 -61
- package/src/channel-api.ts +0 -1
- package/src/channel.actions.test.ts +0 -742
- package/src/channel.directory.test.ts +0 -200
- package/src/channel.runtime.ts +0 -56
- package/src/channel.setup.ts +0 -77
- package/src/channel.test.ts +0 -128
- package/src/channel.ts +0 -1136
- package/src/config-schema.ts +0 -6
- package/src/config-ui-hints.ts +0 -12
- package/src/conversation-store-fs.test.ts +0 -74
- package/src/conversation-store-fs.ts +0 -149
- package/src/conversation-store-helpers.test.ts +0 -202
- package/src/conversation-store-helpers.ts +0 -105
- package/src/conversation-store-memory.ts +0 -51
- package/src/conversation-store.shared.test.ts +0 -225
- package/src/conversation-store.ts +0 -71
- package/src/directory-live.test.ts +0 -156
- package/src/directory-live.ts +0 -111
- package/src/doctor.ts +0 -27
- package/src/errors.test.ts +0 -133
- package/src/errors.ts +0 -246
- package/src/feedback-reflection-prompt.ts +0 -117
- package/src/feedback-reflection-store.ts +0 -114
- package/src/feedback-reflection.test.ts +0 -237
- package/src/feedback-reflection.ts +0 -283
- package/src/file-consent-helpers.test.ts +0 -326
- package/src/file-consent-helpers.ts +0 -126
- package/src/file-consent-invoke.ts +0 -150
- package/src/file-consent.test.ts +0 -363
- package/src/file-consent.ts +0 -287
- package/src/graph-chat.ts +0 -55
- package/src/graph-group-management.test.ts +0 -318
- package/src/graph-group-management.ts +0 -168
- package/src/graph-members.test.ts +0 -89
- package/src/graph-members.ts +0 -48
- package/src/graph-messages.actions.test.ts +0 -243
- package/src/graph-messages.read.test.ts +0 -391
- package/src/graph-messages.search.test.ts +0 -213
- package/src/graph-messages.test-helpers.ts +0 -50
- package/src/graph-messages.ts +0 -534
- package/src/graph-teams.test.ts +0 -215
- package/src/graph-teams.ts +0 -114
- package/src/graph-thread.test.ts +0 -246
- package/src/graph-thread.ts +0 -146
- package/src/graph-upload.test.ts +0 -258
- package/src/graph-upload.ts +0 -531
- package/src/graph-users.ts +0 -29
- package/src/graph.test.ts +0 -516
- package/src/graph.ts +0 -293
- package/src/inbound.test.ts +0 -221
- package/src/inbound.ts +0 -148
- package/src/index.ts +0 -4
- package/src/media-helpers.test.ts +0 -202
- package/src/media-helpers.ts +0 -105
- package/src/mentions.test.ts +0 -244
- package/src/mentions.ts +0 -114
- package/src/messenger.test.ts +0 -865
- package/src/messenger.ts +0 -605
- package/src/monitor-handler/access.ts +0 -125
- package/src/monitor-handler/inbound-media.test.ts +0 -289
- package/src/monitor-handler/inbound-media.ts +0 -180
- package/src/monitor-handler/message-handler-mock-support.test-support.ts +0 -28
- package/src/monitor-handler/message-handler.authz.test.ts +0 -669
- package/src/monitor-handler/message-handler.dm-media.test.ts +0 -54
- package/src/monitor-handler/message-handler.test-support.ts +0 -100
- package/src/monitor-handler/message-handler.thread-parent.test.ts +0 -223
- package/src/monitor-handler/message-handler.thread-session.test.ts +0 -77
- package/src/monitor-handler/message-handler.ts +0 -1000
- package/src/monitor-handler/reaction-handler.test.ts +0 -267
- package/src/monitor-handler/reaction-handler.ts +0 -210
- package/src/monitor-handler/thread-session.ts +0 -17
- package/src/monitor-handler.adaptive-card.test.ts +0 -162
- package/src/monitor-handler.feedback-authz.test.ts +0 -314
- package/src/monitor-handler.file-consent.test.ts +0 -423
- package/src/monitor-handler.sso.test.ts +0 -563
- package/src/monitor-handler.test-helpers.ts +0 -180
- package/src/monitor-handler.ts +0 -534
- package/src/monitor-handler.types.ts +0 -27
- package/src/monitor-types.ts +0 -6
- package/src/monitor.lifecycle.test.ts +0 -278
- package/src/monitor.test.ts +0 -119
- package/src/monitor.ts +0 -442
- package/src/oauth.flow.ts +0 -77
- package/src/oauth.shared.ts +0 -37
- package/src/oauth.test.ts +0 -305
- package/src/oauth.token.ts +0 -158
- package/src/oauth.ts +0 -130
- package/src/outbound.test.ts +0 -130
- package/src/outbound.ts +0 -71
- package/src/pending-uploads-fs.test.ts +0 -246
- package/src/pending-uploads-fs.ts +0 -235
- package/src/pending-uploads.test.ts +0 -173
- package/src/pending-uploads.ts +0 -121
- package/src/policy.test.ts +0 -240
- package/src/policy.ts +0 -262
- package/src/polls-store-memory.ts +0 -32
- package/src/polls.test.ts +0 -160
- package/src/polls.ts +0 -323
- package/src/presentation.ts +0 -68
- package/src/probe.test.ts +0 -77
- package/src/probe.ts +0 -132
- package/src/reply-dispatcher.test.ts +0 -437
- package/src/reply-dispatcher.ts +0 -346
- package/src/reply-stream-controller.test.ts +0 -235
- package/src/reply-stream-controller.ts +0 -147
- package/src/resolve-allowlist.test.ts +0 -250
- package/src/resolve-allowlist.ts +0 -309
- package/src/revoked-context.ts +0 -17
- package/src/runtime.ts +0 -9
- package/src/sdk-types.ts +0 -59
- package/src/sdk.test.ts +0 -666
- package/src/sdk.ts +0 -884
- package/src/secret-contract.ts +0 -49
- package/src/secret-input.ts +0 -7
- package/src/send-context.ts +0 -231
- package/src/send.test.ts +0 -493
- package/src/send.ts +0 -637
- package/src/sent-message-cache.test.ts +0 -15
- package/src/sent-message-cache.ts +0 -56
- package/src/session-route.ts +0 -40
- package/src/setup-core.ts +0 -160
- package/src/setup-surface.test.ts +0 -202
- package/src/setup-surface.ts +0 -320
- package/src/sso-token-store.test.ts +0 -72
- package/src/sso-token-store.ts +0 -166
- package/src/sso.ts +0 -300
- package/src/storage.ts +0 -25
- package/src/store-fs.ts +0 -44
- package/src/streaming-message.test.ts +0 -262
- package/src/streaming-message.ts +0 -297
- package/src/test-runtime.ts +0 -16
- package/src/thread-parent-context.test.ts +0 -224
- package/src/thread-parent-context.ts +0 -159
- package/src/token-response.ts +0 -11
- package/src/token.test.ts +0 -259
- package/src/token.ts +0 -195
- package/src/user-agent.test.ts +0 -86
- package/src/user-agent.ts +0 -53
- package/src/webhook-timeouts.ts +0 -27
- package/src/welcome-card.test.ts +0 -81
- package/src/welcome-card.ts +0 -57
- package/test-api.ts +0 -1
- package/tsconfig.json +0 -16
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
import { access, mkdtemp, readFile, rm } from "node:fs/promises";
|
|
2
|
-
import { tmpdir } from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
-
import type { OpenClawConfig, PluginRuntime, RuntimeEnv } from "../runtime-api.js";
|
|
6
|
-
import {
|
|
7
|
-
type MSTeamsActivityHandler,
|
|
8
|
-
type MSTeamsMessageHandlerDeps,
|
|
9
|
-
registerMSTeamsHandlers,
|
|
10
|
-
} from "./monitor-handler.js";
|
|
11
|
-
import {
|
|
12
|
-
createActivityHandler,
|
|
13
|
-
createMSTeamsMessageHandlerDeps,
|
|
14
|
-
} from "./monitor-handler.test-helpers.js";
|
|
15
|
-
import { setMSTeamsRuntime } from "./runtime.js";
|
|
16
|
-
import type { MSTeamsTurnContext } from "./sdk-types.js";
|
|
17
|
-
|
|
18
|
-
const feedbackReflectionMockState = vi.hoisted(() => ({
|
|
19
|
-
runFeedbackReflection: vi.fn(),
|
|
20
|
-
}));
|
|
21
|
-
|
|
22
|
-
vi.mock("./monitor-handler/message-handler.js", () => ({
|
|
23
|
-
createMSTeamsMessageHandler: () => async () => {},
|
|
24
|
-
}));
|
|
25
|
-
|
|
26
|
-
vi.mock("./monitor-handler/reaction-handler.js", () => ({
|
|
27
|
-
createMSTeamsReactionHandler: () => async () => {},
|
|
28
|
-
}));
|
|
29
|
-
|
|
30
|
-
vi.mock("./feedback-reflection.js", async () => {
|
|
31
|
-
const actual = await vi.importActual<typeof import("./feedback-reflection.js")>(
|
|
32
|
-
"./feedback-reflection.js",
|
|
33
|
-
);
|
|
34
|
-
return {
|
|
35
|
-
...actual,
|
|
36
|
-
runFeedbackReflection: feedbackReflectionMockState.runFeedbackReflection,
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
function createRuntimeStub(readAllowFromStore: ReturnType<typeof vi.fn>): PluginRuntime {
|
|
41
|
-
return {
|
|
42
|
-
logging: {
|
|
43
|
-
shouldLogVerbose: () => false,
|
|
44
|
-
},
|
|
45
|
-
channel: {
|
|
46
|
-
debounce: {
|
|
47
|
-
resolveInboundDebounceMs: () => 0,
|
|
48
|
-
createInboundDebouncer: () => ({
|
|
49
|
-
enqueue: async () => {},
|
|
50
|
-
}),
|
|
51
|
-
},
|
|
52
|
-
pairing: {
|
|
53
|
-
readAllowFromStore,
|
|
54
|
-
upsertPairingRequest: vi.fn(async () => null),
|
|
55
|
-
},
|
|
56
|
-
routing: {
|
|
57
|
-
resolveAgentRoute: ({ peer }: { peer: { kind: string; id: string } }) => ({
|
|
58
|
-
sessionKey: `msteams:${peer.kind}:${peer.id}`,
|
|
59
|
-
agentId: "default",
|
|
60
|
-
}),
|
|
61
|
-
},
|
|
62
|
-
session: {
|
|
63
|
-
resolveStorePath: (storePath?: string) => storePath ?? tmpdir(),
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
} as unknown as PluginRuntime;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function createDeps(params: {
|
|
70
|
-
cfg: OpenClawConfig;
|
|
71
|
-
readAllowFromStore?: ReturnType<typeof vi.fn>;
|
|
72
|
-
}): MSTeamsMessageHandlerDeps {
|
|
73
|
-
const readAllowFromStore = params.readAllowFromStore ?? vi.fn(async () => []);
|
|
74
|
-
setMSTeamsRuntime(createRuntimeStub(readAllowFromStore));
|
|
75
|
-
return createMSTeamsMessageHandlerDeps({
|
|
76
|
-
cfg: params.cfg,
|
|
77
|
-
runtime: { error: vi.fn() } as unknown as RuntimeEnv,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function createFeedbackInvokeContext(params: {
|
|
82
|
-
reaction: "like" | "dislike";
|
|
83
|
-
conversationId: string;
|
|
84
|
-
conversationType: string;
|
|
85
|
-
senderId: string;
|
|
86
|
-
senderName?: string;
|
|
87
|
-
teamId?: string;
|
|
88
|
-
channelName?: string;
|
|
89
|
-
comment?: string;
|
|
90
|
-
}): MSTeamsTurnContext {
|
|
91
|
-
return {
|
|
92
|
-
activity: {
|
|
93
|
-
id: `invoke-${params.reaction}`,
|
|
94
|
-
type: "invoke",
|
|
95
|
-
name: "message/submitAction",
|
|
96
|
-
channelId: "msteams",
|
|
97
|
-
serviceUrl: "https://service.example.test",
|
|
98
|
-
from: {
|
|
99
|
-
id: `${params.senderId}-botframework`,
|
|
100
|
-
aadObjectId: params.senderId,
|
|
101
|
-
name: params.senderName ?? "Sender",
|
|
102
|
-
},
|
|
103
|
-
recipient: {
|
|
104
|
-
id: "bot-id",
|
|
105
|
-
name: "Bot",
|
|
106
|
-
},
|
|
107
|
-
conversation: {
|
|
108
|
-
id: params.conversationId,
|
|
109
|
-
conversationType: params.conversationType,
|
|
110
|
-
tenantId: params.teamId ? "tenant-1" : undefined,
|
|
111
|
-
},
|
|
112
|
-
channelData: params.teamId
|
|
113
|
-
? {
|
|
114
|
-
team: { id: params.teamId, name: "Team 1" },
|
|
115
|
-
channel: params.channelName ? { name: params.channelName } : undefined,
|
|
116
|
-
}
|
|
117
|
-
: {},
|
|
118
|
-
value: {
|
|
119
|
-
actionName: "feedback",
|
|
120
|
-
actionValue: {
|
|
121
|
-
reaction: params.reaction,
|
|
122
|
-
feedback: JSON.stringify({ feedbackText: params.comment ?? "feedback text" }),
|
|
123
|
-
},
|
|
124
|
-
replyToId: "bot-msg-1",
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
sendActivity: vi.fn(async () => ({ id: "ignored" })),
|
|
128
|
-
sendActivities: async () => [],
|
|
129
|
-
} as unknown as MSTeamsTurnContext;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
async function expectFileMissing(filePath: string) {
|
|
133
|
-
await expect(access(filePath)).rejects.toThrow();
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
async function withFeedbackHandler(params: {
|
|
137
|
-
cfg: OpenClawConfig;
|
|
138
|
-
context: Parameters<typeof createFeedbackInvokeContext>[0];
|
|
139
|
-
assertResult: (args: { tmpDir: string; originalRun: ReturnType<typeof vi.fn> }) => Promise<void>;
|
|
140
|
-
}) {
|
|
141
|
-
const tmpDir = await mkdtemp(path.join(tmpdir(), "openclaw-msteams-feedback-"));
|
|
142
|
-
try {
|
|
143
|
-
const originalRun = vi.fn(async () => undefined);
|
|
144
|
-
const handler = registerMSTeamsHandlers(
|
|
145
|
-
createActivityHandler(originalRun),
|
|
146
|
-
createDeps({
|
|
147
|
-
cfg: {
|
|
148
|
-
...params.cfg,
|
|
149
|
-
session: { store: tmpDir },
|
|
150
|
-
},
|
|
151
|
-
}),
|
|
152
|
-
) as MSTeamsActivityHandler & {
|
|
153
|
-
run: NonNullable<MSTeamsActivityHandler["run"]>;
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
await handler.run(createFeedbackInvokeContext(params.context));
|
|
157
|
-
await params.assertResult({ tmpDir, originalRun });
|
|
158
|
-
} finally {
|
|
159
|
-
await rm(tmpDir, { recursive: true, force: true });
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
describe("msteams feedback invoke authz", () => {
|
|
164
|
-
beforeEach(() => {
|
|
165
|
-
feedbackReflectionMockState.runFeedbackReflection.mockReset();
|
|
166
|
-
feedbackReflectionMockState.runFeedbackReflection.mockResolvedValue(undefined);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
it("records feedback for an allowlisted DM sender", async () => {
|
|
170
|
-
await withFeedbackHandler({
|
|
171
|
-
cfg: {
|
|
172
|
-
channels: {
|
|
173
|
-
msteams: {
|
|
174
|
-
dmPolicy: "allowlist",
|
|
175
|
-
allowFrom: ["owner-aad"],
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
} as OpenClawConfig,
|
|
179
|
-
context: {
|
|
180
|
-
reaction: "like",
|
|
181
|
-
conversationId: "a:personal-chat;messageid=bot-msg-1",
|
|
182
|
-
conversationType: "personal",
|
|
183
|
-
senderId: "owner-aad",
|
|
184
|
-
senderName: "Owner",
|
|
185
|
-
comment: "allowed feedback",
|
|
186
|
-
},
|
|
187
|
-
assertResult: async ({ tmpDir, originalRun }) => {
|
|
188
|
-
const transcript = await readFile(
|
|
189
|
-
path.join(tmpDir, "msteams_direct_owner-aad.jsonl"),
|
|
190
|
-
"utf-8",
|
|
191
|
-
);
|
|
192
|
-
expect(JSON.parse(transcript.trim())).toMatchObject({
|
|
193
|
-
event: "feedback",
|
|
194
|
-
messageId: "bot-msg-1",
|
|
195
|
-
value: "positive",
|
|
196
|
-
comment: "allowed feedback",
|
|
197
|
-
sessionKey: "msteams:direct:owner-aad",
|
|
198
|
-
conversationId: "a:personal-chat",
|
|
199
|
-
});
|
|
200
|
-
expect(originalRun).not.toHaveBeenCalled();
|
|
201
|
-
},
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
it("keeps DM feedback allowed when team route allowlists exist", async () => {
|
|
206
|
-
await withFeedbackHandler({
|
|
207
|
-
cfg: {
|
|
208
|
-
channels: {
|
|
209
|
-
msteams: {
|
|
210
|
-
dmPolicy: "allowlist",
|
|
211
|
-
allowFrom: ["owner-aad"],
|
|
212
|
-
teams: {
|
|
213
|
-
team123: {
|
|
214
|
-
channels: {
|
|
215
|
-
"19:group@thread.tacv2": { requireMention: false },
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
},
|
|
221
|
-
} as OpenClawConfig,
|
|
222
|
-
context: {
|
|
223
|
-
reaction: "like",
|
|
224
|
-
conversationId: "a:personal-chat;messageid=bot-msg-1",
|
|
225
|
-
conversationType: "personal",
|
|
226
|
-
senderId: "owner-aad",
|
|
227
|
-
senderName: "Owner",
|
|
228
|
-
comment: "allowed dm feedback",
|
|
229
|
-
},
|
|
230
|
-
assertResult: async ({ tmpDir, originalRun }) => {
|
|
231
|
-
const transcript = await readFile(
|
|
232
|
-
path.join(tmpDir, "msteams_direct_owner-aad.jsonl"),
|
|
233
|
-
"utf-8",
|
|
234
|
-
);
|
|
235
|
-
expect(JSON.parse(transcript.trim())).toMatchObject({
|
|
236
|
-
event: "feedback",
|
|
237
|
-
value: "positive",
|
|
238
|
-
comment: "allowed dm feedback",
|
|
239
|
-
sessionKey: "msteams:direct:owner-aad",
|
|
240
|
-
});
|
|
241
|
-
expect(originalRun).not.toHaveBeenCalled();
|
|
242
|
-
},
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
it("does not record feedback for a DM sender outside allowFrom", async () => {
|
|
247
|
-
await withFeedbackHandler({
|
|
248
|
-
cfg: {
|
|
249
|
-
channels: {
|
|
250
|
-
msteams: {
|
|
251
|
-
dmPolicy: "allowlist",
|
|
252
|
-
allowFrom: ["owner-aad"],
|
|
253
|
-
},
|
|
254
|
-
},
|
|
255
|
-
} as OpenClawConfig,
|
|
256
|
-
context: {
|
|
257
|
-
reaction: "like",
|
|
258
|
-
conversationId: "a:personal-chat;messageid=bot-msg-1",
|
|
259
|
-
conversationType: "personal",
|
|
260
|
-
senderId: "attacker-aad",
|
|
261
|
-
senderName: "Attacker",
|
|
262
|
-
comment: "blocked feedback",
|
|
263
|
-
},
|
|
264
|
-
assertResult: async ({ tmpDir, originalRun }) => {
|
|
265
|
-
await expectFileMissing(path.join(tmpDir, "msteams_direct_attacker-aad.jsonl"));
|
|
266
|
-
expect(feedbackReflectionMockState.runFeedbackReflection).not.toHaveBeenCalled();
|
|
267
|
-
expect(originalRun).not.toHaveBeenCalled();
|
|
268
|
-
},
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
it("does not trigger reflection for a group sender outside groupAllowFrom", async () => {
|
|
273
|
-
const tmpDir = await mkdtemp(path.join(tmpdir(), "openclaw-msteams-feedback-"));
|
|
274
|
-
try {
|
|
275
|
-
const originalRun = vi.fn(async () => undefined);
|
|
276
|
-
const handler = registerMSTeamsHandlers(
|
|
277
|
-
createActivityHandler(originalRun),
|
|
278
|
-
createDeps({
|
|
279
|
-
cfg: {
|
|
280
|
-
session: { store: tmpDir },
|
|
281
|
-
channels: {
|
|
282
|
-
msteams: {
|
|
283
|
-
groupPolicy: "allowlist",
|
|
284
|
-
groupAllowFrom: ["owner-aad"],
|
|
285
|
-
feedbackReflection: true,
|
|
286
|
-
},
|
|
287
|
-
},
|
|
288
|
-
} as OpenClawConfig,
|
|
289
|
-
}),
|
|
290
|
-
) as MSTeamsActivityHandler & {
|
|
291
|
-
run: NonNullable<MSTeamsActivityHandler["run"]>;
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
await handler.run(
|
|
295
|
-
createFeedbackInvokeContext({
|
|
296
|
-
reaction: "dislike",
|
|
297
|
-
conversationId: "19:group@thread.tacv2;messageid=bot-msg-1",
|
|
298
|
-
conversationType: "groupChat",
|
|
299
|
-
senderId: "attacker-aad",
|
|
300
|
-
senderName: "Attacker",
|
|
301
|
-
teamId: "team-1",
|
|
302
|
-
channelName: "General",
|
|
303
|
-
comment: "blocked reflection",
|
|
304
|
-
}),
|
|
305
|
-
);
|
|
306
|
-
|
|
307
|
-
await expectFileMissing(path.join(tmpDir, "msteams_group_19_group_thread_tacv2.jsonl"));
|
|
308
|
-
expect(feedbackReflectionMockState.runFeedbackReflection).not.toHaveBeenCalled();
|
|
309
|
-
expect(originalRun).not.toHaveBeenCalled();
|
|
310
|
-
} finally {
|
|
311
|
-
await rm(tmpDir, { recursive: true, force: true });
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
});
|