@openclaw/msteams 2026.9.4 → 2026.9.6
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/assets/activity.svg +40 -0
- package/assets/icon.png +0 -0
- package/dist/{adapter.runtime-BzR3RK2J.cjs → .setup/adapter.runtime-CQWZeqB5.cjs} +5 -3
- package/dist/{approval-handler.runtime-DRhFNeJS.cjs → .setup/approval-handler.runtime-CUnanUdR.cjs} +3 -3
- package/dist/{channel-B9LIyYeu.cjs → .setup/channel-BDp16XRR.cjs} +128 -89
- package/dist/{channel.runtime-BergqMHg.cjs → .setup/channel.runtime-Cv5F8JCa.cjs} +61 -34
- package/dist/{channel.setup-BhxokviI.cjs → .setup/channel.setup-BVDfgdCc.cjs} +3 -3
- package/dist/{delegated-state-DiEz9JIa.cjs → .setup/delegated-state-u-ywZyZT.cjs} +5 -5
- package/dist/{messenger-TLdZf9Ar.cjs → .setup/messenger-8RA1FUJa.cjs} +112 -188
- package/dist/{oauth-DUtLTz2u.cjs → .setup/oauth-C6m7dvHj.cjs} +1 -1
- package/dist/{polls-BBdZPx_R.cjs → .setup/polls-BJ4-4uZm.cjs} +14 -7
- package/dist/{reaction-types-BbBBdnQ5.cjs → .setup/reaction-types-C7RA7Wxt.cjs} +1 -1
- package/dist/{resolve-allowlist-DmUTQxEz.cjs → .setup/resolve-allowlist-CHzaaWiC.cjs} +135 -93
- package/dist/.setup/secret-contract-api-ChQdBeU1.cjs +4 -0
- package/dist/.setup/secret-contract-api-ipiUsANg.cjs +28 -0
- package/dist/{send-CU61PSDN.cjs → .setup/send-CYN_N7O1.cjs} +99 -34
- package/dist/.setup/setup-plugin-api-DpiaA8z1.cjs +3 -0
- package/dist/{src-D7Do7sM5.cjs → .setup/src-BfOCwlHp.cjs} +150 -125
- package/dist/{sso-token-store-DTeYxubp.cjs → .setup/sso-token-store-YYLHXgFH.cjs} +1 -1
- package/dist/{thread-session-NmA7_njI.cjs → .setup/thread-session-CXgHK-yi.cjs} +1 -1
- package/dist/api.cjs +2 -2
- package/dist/channel-config-api.cjs +1 -1
- package/dist/channel-plugin-api.cjs +1 -1
- package/dist/configured-state.cjs +1 -1
- package/dist/directory-contract-api.cjs +1 -1
- package/dist/doctor-contract-api.cjs +64 -62
- package/dist/qa-runner-api.cjs +1 -1
- package/dist/runtime-api.cjs +1 -1
- package/dist/secret-contract-api.cjs +4 -13
- package/dist/setup-entry.cjs +5 -3
- package/dist/setup-plugin-api.cjs +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +14 -11
- /package/dist/{approval-card-CPNH_q3P.cjs → .setup/approval-card-CPNH_q3P.cjs} +0 -0
- /package/dist/{config-schema-D22Lr1Qk.cjs → .setup/config-schema-D22Lr1Qk.cjs} +0 -0
- /package/dist/{rolldown-runtime-VH7oDXx4.cjs → .setup/rolldown-runtime-VH7oDXx4.cjs} +0 -0
- /package/dist/{runtime-gZTAuFux.cjs → .setup/runtime-gZTAuFux.cjs} +0 -0
- /package/dist/{secret-input-C65t6kjM.cjs → .setup/secret-input-C65t6kjM.cjs} +0 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
const require_runtime = require("./runtime-gZTAuFux.cjs");
|
|
2
|
-
require("
|
|
3
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
4
|
-
const require_channel = require("./channel-
|
|
5
|
-
const require_channel_setup = require("./channel.setup-
|
|
6
|
-
const require_polls = require("./polls-
|
|
7
|
-
const require_messenger = require("./messenger-
|
|
2
|
+
require("../runtime-api.cjs");
|
|
3
|
+
const require_resolve_allowlist = require("./resolve-allowlist-CHzaaWiC.cjs");
|
|
4
|
+
const require_channel = require("./channel-BDp16XRR.cjs");
|
|
5
|
+
const require_channel_setup = require("./channel.setup-BVDfgdCc.cjs");
|
|
6
|
+
const require_polls = require("./polls-BJ4-4uZm.cjs");
|
|
7
|
+
const require_messenger = require("./messenger-8RA1FUJa.cjs");
|
|
8
8
|
let openclaw_plugin_sdk_channel_outbound = require("openclaw/plugin-sdk/channel-outbound");
|
|
9
9
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
10
|
+
let openclaw_plugin_sdk_error_runtime = require("openclaw/plugin-sdk/error-runtime");
|
|
11
|
+
let openclaw_plugin_sdk_channel_inbound = require("openclaw/plugin-sdk/channel-inbound");
|
|
10
12
|
let openclaw_plugin_sdk_markdown_table_runtime = require("openclaw/plugin-sdk/markdown-table-runtime");
|
|
11
13
|
let openclaw_plugin_sdk_account_helpers = require("openclaw/plugin-sdk/account-helpers");
|
|
12
14
|
let openclaw_plugin_sdk_outbound_media = require("openclaw/plugin-sdk/outbound-media");
|
|
@@ -176,11 +178,27 @@ const FILE_CONSENT_THRESHOLD_BYTES = 4194304;
|
|
|
176
178
|
*/
|
|
177
179
|
const MSTEAMS_MAX_MEDIA_BYTES = 104857600;
|
|
178
180
|
function createMSTeamsSendError(errorPrefix, error) {
|
|
181
|
+
if (error instanceof Error && (error instanceof openclaw_plugin_sdk_error_runtime.PlatformMessageNotDispatchedError || (0, openclaw_plugin_sdk_channel_inbound.isChannelPartialDeliveryError)(error))) return error;
|
|
179
182
|
const classification = require_channel_setup.classifyMSTeamsSendError(error);
|
|
180
183
|
const hint = require_channel_setup.formatMSTeamsSendErrorHint(classification);
|
|
181
184
|
const status = classification.statusCode ? ` (HTTP ${classification.statusCode})` : "";
|
|
182
185
|
return new Error(`${errorPrefix} failed${status}: ${require_channel_setup.formatUnknownError(error)}${hint ? ` (${hint})` : ""}`, { cause: error });
|
|
183
186
|
}
|
|
187
|
+
function createMSTeamsPartialSendError(error, receipt) {
|
|
188
|
+
return (0, openclaw_plugin_sdk_channel_inbound.createChannelPartialDeliveryError)(error, {
|
|
189
|
+
visibleReplySent: true,
|
|
190
|
+
messageIds: receipt.platformMessageIds,
|
|
191
|
+
receipt
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
async function finishMSTeamsSend(result, settle) {
|
|
195
|
+
try {
|
|
196
|
+
await settle();
|
|
197
|
+
} catch (error) {
|
|
198
|
+
throw createMSTeamsPartialSendError(error, result.receipt);
|
|
199
|
+
}
|
|
200
|
+
return result;
|
|
201
|
+
}
|
|
184
202
|
function createMSTeamsSendReceipt(params) {
|
|
185
203
|
const receipt = (0, openclaw_plugin_sdk_channel_outbound.createMessageReceiptFromOutboundResults)({
|
|
186
204
|
kind: params.kind,
|
|
@@ -232,6 +250,7 @@ function createMSTeamsSendResult(params) {
|
|
|
232
250
|
* - Group chats / channels: files require configured SharePoint storage
|
|
233
251
|
*/
|
|
234
252
|
async function sendMessageMSTeams(params) {
|
|
253
|
+
require_resolve_allowlist.assertMSTeamsSendHandoff(params);
|
|
235
254
|
const { cfg, to, text, mediaUrl, filename, mediaAccess, mediaLocalRoots, mediaReadFile } = params;
|
|
236
255
|
const tableMode = (0, openclaw_plugin_sdk_markdown_table_runtime.resolveMarkdownTableMode)({
|
|
237
256
|
cfg,
|
|
@@ -275,6 +294,7 @@ async function sendMessageMSTeams(params) {
|
|
|
275
294
|
bufferSize: media.buffer.length,
|
|
276
295
|
thresholdBytes: FILE_CONSENT_THRESHOLD_BYTES
|
|
277
296
|
})) {
|
|
297
|
+
require_resolve_allowlist.assertMSTeamsSendHandoff(params);
|
|
278
298
|
const { activity, uploadId } = await require_messenger.prepareFileConsentActivityFs({
|
|
279
299
|
media: {
|
|
280
300
|
buffer: media.buffer,
|
|
@@ -292,29 +312,37 @@ async function sendMessageMSTeams(params) {
|
|
|
292
312
|
const messageId = await sendProactiveActivity({
|
|
293
313
|
ctx,
|
|
294
314
|
activity,
|
|
295
|
-
errorPrefix: "msteams consent card send"
|
|
315
|
+
errorPrefix: "msteams consent card send",
|
|
316
|
+
assertDirectAdapterHandoff: params.assertDirectAdapterHandoff,
|
|
317
|
+
onPlatformSendDispatch: params.onPlatformSendDispatch
|
|
296
318
|
});
|
|
297
|
-
|
|
298
|
-
await require_messenger.setPendingUploadActivityIdFs(uploadId, messageId);
|
|
299
|
-
log.info("sent file consent card", {
|
|
300
|
-
conversationId,
|
|
301
|
-
messageId,
|
|
302
|
-
uploadId
|
|
303
|
-
});
|
|
304
|
-
return createMSTeamsSendResult({
|
|
319
|
+
const result = createMSTeamsSendResult({
|
|
305
320
|
messageId,
|
|
306
321
|
conversationId,
|
|
307
322
|
kind: "card",
|
|
308
323
|
pendingUploadId: uploadId
|
|
309
324
|
});
|
|
325
|
+
return finishMSTeamsSend(result, async () => {
|
|
326
|
+
require_messenger.setPendingUploadActivityId(uploadId, messageId);
|
|
327
|
+
try {
|
|
328
|
+
await params.onDeliveryResult?.(result);
|
|
329
|
+
} finally {
|
|
330
|
+
await require_messenger.setPendingUploadActivityIdFs(uploadId, messageId);
|
|
331
|
+
}
|
|
332
|
+
log.info("sent file consent card", {
|
|
333
|
+
conversationId,
|
|
334
|
+
messageId,
|
|
335
|
+
uploadId
|
|
336
|
+
});
|
|
337
|
+
});
|
|
310
338
|
}
|
|
311
339
|
if (conversationType === "personal") {
|
|
312
340
|
const base64 = media.buffer.toString("base64");
|
|
313
|
-
return sendTextWithMedia(ctx, messageText, `data:${media.contentType};base64,${base64}
|
|
341
|
+
return sendTextWithMedia(ctx, messageText, `data:${media.contentType};base64,${base64}`, params);
|
|
314
342
|
}
|
|
315
343
|
if (isImage && !sharePointSiteId) {
|
|
316
344
|
const base64 = media.buffer.toString("base64");
|
|
317
|
-
return sendTextWithMedia(ctx, messageText, `data:${media.contentType};base64,${base64}
|
|
345
|
+
return sendTextWithMedia(ctx, messageText, `data:${media.contentType};base64,${base64}`, params);
|
|
318
346
|
}
|
|
319
347
|
try {
|
|
320
348
|
const siteId = require_messenger.requireMSTeamsSharePointSiteId(sharePointSiteId);
|
|
@@ -324,6 +352,7 @@ async function sendMessageMSTeams(params) {
|
|
|
324
352
|
siteId
|
|
325
353
|
});
|
|
326
354
|
const uploaded = await require_messenger.uploadAndShareSharePoint({
|
|
355
|
+
assertDirectAdapterHandoff: params.assertDirectAdapterHandoff,
|
|
327
356
|
buffer: media.buffer,
|
|
328
357
|
filename: fileName,
|
|
329
358
|
contentType: media.contentType,
|
|
@@ -337,6 +366,7 @@ async function sendMessageMSTeams(params) {
|
|
|
337
366
|
shareUrl: uploaded.shareUrl
|
|
338
367
|
});
|
|
339
368
|
const driveItem = await require_messenger.getDriveItemProperties({
|
|
369
|
+
assertDirectAdapterHandoff: params.assertDirectAdapterHandoff,
|
|
340
370
|
siteId,
|
|
341
371
|
itemId: uploaded.itemId,
|
|
342
372
|
tokenProvider
|
|
@@ -351,36 +381,55 @@ async function sendMessageMSTeams(params) {
|
|
|
351
381
|
activity: {
|
|
352
382
|
...require_messenger.buildMSTeamsMessageActivity(messageText || void 0),
|
|
353
383
|
attachments: [fileCardAttachment]
|
|
354
|
-
}
|
|
384
|
+
},
|
|
385
|
+
assertDirectAdapterHandoff: params.assertDirectAdapterHandoff,
|
|
386
|
+
onPlatformSendDispatch: params.onPlatformSendDispatch
|
|
355
387
|
});
|
|
356
388
|
log.info("sent native file card", {
|
|
357
389
|
conversationId,
|
|
358
390
|
messageId,
|
|
359
391
|
fileName: driveItem.name
|
|
360
392
|
});
|
|
361
|
-
|
|
393
|
+
const result = createMSTeamsSendResult({
|
|
362
394
|
messageId,
|
|
363
395
|
conversationId,
|
|
364
396
|
kind: "media"
|
|
365
397
|
});
|
|
398
|
+
return await finishMSTeamsSend(result, async () => {
|
|
399
|
+
await params.onDeliveryResult?.(result);
|
|
400
|
+
});
|
|
366
401
|
} catch (err) {
|
|
367
402
|
throw createMSTeamsSendError("msteams file send", err);
|
|
368
403
|
}
|
|
369
404
|
}
|
|
370
|
-
return sendTextWithMedia(ctx, messageText, void 0);
|
|
405
|
+
return sendTextWithMedia(ctx, messageText, void 0, params);
|
|
371
406
|
}
|
|
372
407
|
/**
|
|
373
408
|
* Send a text message with optional base64 media URL.
|
|
374
409
|
*/
|
|
375
|
-
async function sendTextWithMedia(ctx, text, mediaUrl) {
|
|
410
|
+
async function sendTextWithMedia(ctx, text, mediaUrl, options) {
|
|
376
411
|
const { app, appId, conversationId, ref, log, tokenProvider, sharePointSiteId, mediaMaxBytes, replyStyle } = ctx;
|
|
377
412
|
const messages = text && mediaUrl ? [{ text }, { mediaUrl }] : [{
|
|
378
413
|
text: text || void 0,
|
|
379
414
|
mediaUrl
|
|
380
415
|
}];
|
|
381
416
|
let platformMessageIds;
|
|
417
|
+
const acceptedIds = [];
|
|
418
|
+
const acceptedKinds = [];
|
|
382
419
|
try {
|
|
383
420
|
platformMessageIds = await require_messenger.sendMSTeamsMessages({
|
|
421
|
+
assertDirectAdapterHandoff: options.assertDirectAdapterHandoff,
|
|
422
|
+
onPlatformSendDispatch: options.onPlatformSendDispatch,
|
|
423
|
+
onMessageSent: async (messageId, messageIndex) => {
|
|
424
|
+
const kind = messages[messageIndex]?.mediaUrl ? "media" : "text";
|
|
425
|
+
acceptedIds.push(messageId);
|
|
426
|
+
acceptedKinds.push(kind);
|
|
427
|
+
await options.onDeliveryResult?.(createMSTeamsSendResult({
|
|
428
|
+
conversationId,
|
|
429
|
+
messageId,
|
|
430
|
+
kind
|
|
431
|
+
}));
|
|
432
|
+
},
|
|
384
433
|
replyStyle,
|
|
385
434
|
app,
|
|
386
435
|
appId,
|
|
@@ -399,7 +448,14 @@ async function sendTextWithMedia(ctx, text, mediaUrl) {
|
|
|
399
448
|
serviceUrlBoundary: ctx.sdkCloudOptions
|
|
400
449
|
});
|
|
401
450
|
} catch (err) {
|
|
402
|
-
|
|
451
|
+
const error = createMSTeamsSendError("msteams send", err);
|
|
452
|
+
if (acceptedIds.length > 0) throw createMSTeamsPartialSendError(error, createMSTeamsSendReceipt({
|
|
453
|
+
conversationId,
|
|
454
|
+
platformMessageIds: acceptedIds,
|
|
455
|
+
kind: mediaUrl ? "media" : "text",
|
|
456
|
+
kinds: acceptedKinds
|
|
457
|
+
}));
|
|
458
|
+
throw error;
|
|
403
459
|
}
|
|
404
460
|
const messageId = platformMessageIds[0] ?? "unknown";
|
|
405
461
|
log.info("sent proactive message", {
|
|
@@ -417,28 +473,28 @@ async function sendTextWithMedia(ctx, text, mediaUrl) {
|
|
|
417
473
|
})
|
|
418
474
|
};
|
|
419
475
|
}
|
|
420
|
-
async function sendProactiveActivityRaw({ ctx, activity }) {
|
|
476
|
+
async function sendProactiveActivityRaw({ ctx, activity, assertDirectAdapterHandoff, onPlatformSendDispatch }) {
|
|
421
477
|
const baseRef = require_messenger.buildConversationReference(ctx.ref);
|
|
422
478
|
const response = await require_messenger.sendMSTeamsActivityWithReference(ctx.app, baseRef, activity, {
|
|
479
|
+
assertDirectAdapterHandoff,
|
|
480
|
+
onPlatformSendDispatch,
|
|
423
481
|
...ctx.threadActivityId ? { threadActivityId: ctx.threadActivityId } : {},
|
|
424
482
|
serviceUrlBoundary: ctx.sdkCloudOptions
|
|
425
483
|
});
|
|
426
484
|
return require_messenger.extractMessageId(response) ?? "unknown";
|
|
427
485
|
}
|
|
428
|
-
async function sendProactiveActivity(
|
|
486
|
+
async function sendProactiveActivity(params) {
|
|
429
487
|
try {
|
|
430
|
-
return await sendProactiveActivityRaw(
|
|
431
|
-
ctx,
|
|
432
|
-
activity
|
|
433
|
-
});
|
|
488
|
+
return await sendProactiveActivityRaw(params);
|
|
434
489
|
} catch (err) {
|
|
435
|
-
throw createMSTeamsSendError(errorPrefix, err);
|
|
490
|
+
throw createMSTeamsSendError(params.errorPrefix, err);
|
|
436
491
|
}
|
|
437
492
|
}
|
|
438
493
|
/**
|
|
439
494
|
* Send a poll (Adaptive Card) to a Teams conversation or user.
|
|
440
495
|
*/
|
|
441
496
|
async function sendPollMSTeams(params) {
|
|
497
|
+
require_resolve_allowlist.assertMSTeamsSendHandoff(params);
|
|
442
498
|
const { cfg, to, question, options, maxSelections } = params;
|
|
443
499
|
const ctx = await resolveMSTeamsSendContext({
|
|
444
500
|
cfg,
|
|
@@ -464,7 +520,9 @@ async function sendPollMSTeams(params) {
|
|
|
464
520
|
content: pollCard.card
|
|
465
521
|
}]
|
|
466
522
|
},
|
|
467
|
-
errorPrefix: "msteams poll send"
|
|
523
|
+
errorPrefix: "msteams poll send",
|
|
524
|
+
assertDirectAdapterHandoff: params.assertDirectAdapterHandoff,
|
|
525
|
+
onPlatformSendDispatch: params.onPlatformSendDispatch
|
|
468
526
|
});
|
|
469
527
|
log.info("sent poll", {
|
|
470
528
|
conversationId,
|
|
@@ -481,6 +539,7 @@ async function sendPollMSTeams(params) {
|
|
|
481
539
|
* Send an arbitrary Adaptive Card to a Teams conversation or user.
|
|
482
540
|
*/
|
|
483
541
|
async function sendAdaptiveCardMSTeams(params) {
|
|
542
|
+
require_resolve_allowlist.assertMSTeamsSendHandoff(params);
|
|
484
543
|
const { cfg, to, card } = params;
|
|
485
544
|
const ctx = await resolveMSTeamsSendContext({
|
|
486
545
|
cfg,
|
|
@@ -501,16 +560,22 @@ async function sendAdaptiveCardMSTeams(params) {
|
|
|
501
560
|
content: card
|
|
502
561
|
}]
|
|
503
562
|
},
|
|
504
|
-
errorPrefix: "msteams card send"
|
|
563
|
+
errorPrefix: "msteams card send",
|
|
564
|
+
assertDirectAdapterHandoff: params.assertDirectAdapterHandoff,
|
|
565
|
+
onPlatformSendDispatch: params.onPlatformSendDispatch
|
|
505
566
|
});
|
|
506
567
|
log.info("sent adaptive card", {
|
|
507
568
|
conversationId,
|
|
508
569
|
messageId
|
|
509
570
|
});
|
|
510
|
-
|
|
571
|
+
const result = createMSTeamsSendResult({
|
|
511
572
|
messageId,
|
|
512
|
-
conversationId
|
|
513
|
-
|
|
573
|
+
conversationId,
|
|
574
|
+
kind: "card"
|
|
575
|
+
});
|
|
576
|
+
return finishMSTeamsSend(result, async () => {
|
|
577
|
+
await params.onDeliveryResult?.(result);
|
|
578
|
+
});
|
|
514
579
|
}
|
|
515
580
|
/**
|
|
516
581
|
* Edit (update) a previously sent message in a Teams conversation.
|