@openclaw/msteams 2026.3.2 → 2026.3.7
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/CHANGELOG.md +12 -0
- package/index.ts +2 -2
- package/package.json +1 -1
- package/src/attachments/graph.ts +1 -1
- package/src/attachments/payload.ts +1 -1
- package/src/attachments/remote-media.ts +1 -1
- package/src/attachments/shared.ts +2 -2
- package/src/attachments.test.ts +1 -1
- package/src/channel.directory.test.ts +1 -1
- package/src/channel.ts +95 -101
- package/src/directory-live.ts +1 -1
- package/src/file-lock.ts +1 -1
- package/src/graph.ts +1 -1
- package/src/media-helpers.ts +1 -1
- package/src/messenger.test.ts +16 -19
- package/src/messenger.ts +1 -1
- package/src/monitor-handler/message-handler.authz.test.ts +1 -1
- package/src/monitor-handler/message-handler.ts +59 -53
- package/src/monitor-handler.file-consent.test.ts +1 -1
- package/src/monitor-handler.ts +1 -1
- package/src/monitor.lifecycle.test.ts +9 -3
- package/src/monitor.ts +1 -1
- package/src/onboarding.ts +23 -47
- package/src/outbound.test.ts +131 -0
- package/src/outbound.ts +1 -1
- package/src/policy.test.ts +1 -1
- package/src/policy.ts +9 -10
- package/src/probe.test.ts +1 -1
- package/src/probe.ts +6 -2
- package/src/reply-dispatcher.ts +1 -1
- package/src/resolve-allowlist.test.ts +78 -0
- package/src/resolve-allowlist.ts +70 -79
- package/src/runtime.ts +1 -1
- package/src/secret-input.ts +1 -1
- package/src/send-context.ts +1 -1
- package/src/send.test.ts +2 -2
- package/src/send.ts +42 -43
- package/src/store-fs.ts +1 -1
- package/src/test-runtime.ts +1 -1
- package/src/token.test.ts +1 -1
- package/src/token.ts +1 -1
package/src/send.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { OpenClawConfig } from "openclaw/plugin-sdk";
|
|
2
|
-
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk";
|
|
1
|
+
import type { OpenClawConfig } from "openclaw/plugin-sdk/msteams";
|
|
2
|
+
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/msteams";
|
|
3
3
|
import { createMSTeamsConversationStoreFs } from "./conversation-store-fs.js";
|
|
4
4
|
import {
|
|
5
5
|
classifyMSTeamsSendError,
|
|
@@ -157,24 +157,13 @@ export async function sendMessageMSTeams(
|
|
|
157
157
|
|
|
158
158
|
log.debug?.("sending file consent card", { uploadId, fileName, size: media.buffer.length });
|
|
159
159
|
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
messageId = extractMessageId(response) ?? "unknown";
|
|
168
|
-
});
|
|
169
|
-
} catch (err) {
|
|
170
|
-
const classification = classifyMSTeamsSendError(err);
|
|
171
|
-
const hint = formatMSTeamsSendErrorHint(classification);
|
|
172
|
-
const status = classification.statusCode ? ` (HTTP ${classification.statusCode})` : "";
|
|
173
|
-
throw new Error(
|
|
174
|
-
`msteams consent card send failed${status}: ${formatUnknownError(err)}${hint ? ` (${hint})` : ""}`,
|
|
175
|
-
{ cause: err },
|
|
176
|
-
);
|
|
177
|
-
}
|
|
160
|
+
const messageId = await sendProactiveActivity({
|
|
161
|
+
adapter,
|
|
162
|
+
appId,
|
|
163
|
+
ref,
|
|
164
|
+
activity,
|
|
165
|
+
errorPrefix: "msteams consent card send",
|
|
166
|
+
});
|
|
178
167
|
|
|
179
168
|
log.info("sent file consent card", { conversationId, messageId, uploadId });
|
|
180
169
|
|
|
@@ -245,14 +234,11 @@ export async function sendMessageMSTeams(
|
|
|
245
234
|
text: messageText || undefined,
|
|
246
235
|
attachments: [fileCardAttachment],
|
|
247
236
|
};
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
await adapter.continueConversation(appId, proactiveRef, async (turnCtx) => {
|
|
254
|
-
const response = await turnCtx.sendActivity(activity);
|
|
255
|
-
messageId = extractMessageId(response) ?? "unknown";
|
|
237
|
+
const messageId = await sendProactiveActivityRaw({
|
|
238
|
+
adapter,
|
|
239
|
+
appId,
|
|
240
|
+
ref,
|
|
241
|
+
activity,
|
|
256
242
|
});
|
|
257
243
|
|
|
258
244
|
log.info("sent native file card", {
|
|
@@ -288,14 +274,11 @@ export async function sendMessageMSTeams(
|
|
|
288
274
|
type: "message",
|
|
289
275
|
text: messageText ? `${messageText}\n\n${fileLink}` : fileLink,
|
|
290
276
|
};
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
await adapter.continueConversation(appId, proactiveRef, async (turnCtx) => {
|
|
297
|
-
const response = await turnCtx.sendActivity(activity);
|
|
298
|
-
messageId = extractMessageId(response) ?? "unknown";
|
|
277
|
+
const messageId = await sendProactiveActivityRaw({
|
|
278
|
+
adapter,
|
|
279
|
+
appId,
|
|
280
|
+
ref,
|
|
281
|
+
activity,
|
|
299
282
|
});
|
|
300
283
|
|
|
301
284
|
log.info("sent message with OneDrive file link", {
|
|
@@ -382,13 +365,14 @@ type ProactiveActivityParams = {
|
|
|
382
365
|
errorPrefix: string;
|
|
383
366
|
};
|
|
384
367
|
|
|
385
|
-
|
|
368
|
+
type ProactiveActivityRawParams = Omit<ProactiveActivityParams, "errorPrefix">;
|
|
369
|
+
|
|
370
|
+
async function sendProactiveActivityRaw({
|
|
386
371
|
adapter,
|
|
387
372
|
appId,
|
|
388
373
|
ref,
|
|
389
374
|
activity,
|
|
390
|
-
|
|
391
|
-
}: ProactiveActivityParams): Promise<string> {
|
|
375
|
+
}: ProactiveActivityRawParams): Promise<string> {
|
|
392
376
|
const baseRef = buildConversationReference(ref);
|
|
393
377
|
const proactiveRef = {
|
|
394
378
|
...baseRef,
|
|
@@ -396,12 +380,27 @@ async function sendProactiveActivity({
|
|
|
396
380
|
};
|
|
397
381
|
|
|
398
382
|
let messageId = "unknown";
|
|
383
|
+
await adapter.continueConversation(appId, proactiveRef, async (ctx) => {
|
|
384
|
+
const response = await ctx.sendActivity(activity);
|
|
385
|
+
messageId = extractMessageId(response) ?? "unknown";
|
|
386
|
+
});
|
|
387
|
+
return messageId;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
async function sendProactiveActivity({
|
|
391
|
+
adapter,
|
|
392
|
+
appId,
|
|
393
|
+
ref,
|
|
394
|
+
activity,
|
|
395
|
+
errorPrefix,
|
|
396
|
+
}: ProactiveActivityParams): Promise<string> {
|
|
399
397
|
try {
|
|
400
|
-
await
|
|
401
|
-
|
|
402
|
-
|
|
398
|
+
return await sendProactiveActivityRaw({
|
|
399
|
+
adapter,
|
|
400
|
+
appId,
|
|
401
|
+
ref,
|
|
402
|
+
activity,
|
|
403
403
|
});
|
|
404
|
-
return messageId;
|
|
405
404
|
} catch (err) {
|
|
406
405
|
const classification = classifyMSTeamsSendError(err);
|
|
407
406
|
const hint = formatMSTeamsSendErrorHint(classification);
|
package/src/store-fs.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
-
import { readJsonFileWithFallback, writeJsonFileAtomically } from "openclaw/plugin-sdk";
|
|
2
|
+
import { readJsonFileWithFallback, writeJsonFileAtomically } from "openclaw/plugin-sdk/msteams";
|
|
3
3
|
import { withFileLock as withPathLock } from "./file-lock.js";
|
|
4
4
|
|
|
5
5
|
const STORE_LOCK_OPTIONS = {
|
package/src/test-runtime.ts
CHANGED
package/src/token.test.ts
CHANGED
package/src/token.ts
CHANGED