@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/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 baseRef = buildConversationReference(ref);
161
- const proactiveRef = { ...baseRef, activityId: undefined };
162
-
163
- let messageId = "unknown";
164
- try {
165
- await adapter.continueConversation(appId, proactiveRef, async (turnCtx) => {
166
- const response = await turnCtx.sendActivity(activity);
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
- const baseRef = buildConversationReference(ref);
250
- const proactiveRef = { ...baseRef, activityId: undefined };
251
-
252
- let messageId = "unknown";
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
- const baseRef = buildConversationReference(ref);
293
- const proactiveRef = { ...baseRef, activityId: undefined };
294
-
295
- let messageId = "unknown";
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
- async function sendProactiveActivity({
368
+ type ProactiveActivityRawParams = Omit<ProactiveActivityParams, "errorPrefix">;
369
+
370
+ async function sendProactiveActivityRaw({
386
371
  adapter,
387
372
  appId,
388
373
  ref,
389
374
  activity,
390
- errorPrefix,
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 adapter.continueConversation(appId, proactiveRef, async (ctx) => {
401
- const response = await ctx.sendActivity(activity);
402
- messageId = extractMessageId(response) ?? "unknown";
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 = {
@@ -1,6 +1,6 @@
1
1
  import os from "node:os";
2
2
  import path from "node:path";
3
- import type { PluginRuntime } from "openclaw/plugin-sdk";
3
+ import type { PluginRuntime } from "openclaw/plugin-sdk/msteams";
4
4
 
5
5
  export const msteamsRuntimeStub = {
6
6
  state: {
package/src/token.test.ts CHANGED
@@ -35,7 +35,7 @@ describe("resolveMSTeamsCredentials", () => {
35
35
 
36
36
  expect(resolved).toEqual({
37
37
  appId: "app-id",
38
- appPassword: "app-password",
38
+ appPassword: "app-password", // pragma: allowlist secret
39
39
  tenantId: "tenant-id",
40
40
  });
41
41
  });
package/src/token.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { MSTeamsConfig } from "openclaw/plugin-sdk";
1
+ import type { MSTeamsConfig } from "openclaw/plugin-sdk/msteams";
2
2
  import {
3
3
  hasConfiguredSecretInput,
4
4
  normalizeResolvedSecretInputString,