@openclaw/msteams 2026.11.3 → 2026.11.5-beta.2

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.
Files changed (32) hide show
  1. package/dist/.setup/{adapter.runtime-B-6Q3nMI.cjs → adapter.runtime-BB38Rdj_.cjs} +20 -23
  2. package/dist/.setup/{approval-card-DWPDItvq.cjs → approval-card-BHAKsdAM.cjs} +5 -9
  3. package/dist/.setup/{approval-handler.runtime-D0jbDypb.cjs → approval-handler.runtime-C16UvawQ.cjs} +4 -4
  4. package/dist/.setup/{channel-Ci6K9Njb.cjs → channel-BaTw0JW3.cjs} +35 -254
  5. package/dist/.setup/{channel.runtime-DeHVAVxL.cjs → channel.runtime-Ch2M_-jN.cjs} +65 -107
  6. package/dist/.setup/{channel.setup-BN3uhq3r.cjs → channel.setup-B9yKGEse.cjs} +161 -262
  7. package/dist/.setup/{config-schema-CkKdphSp.cjs → config-schema-3lVZ45cB.cjs} +120 -125
  8. package/dist/.setup/{conversation-store-state-B-4g4uq5.cjs → conversation-store-state-CVhMM0QY.cjs} +411 -601
  9. package/dist/.setup/{delegated-state-Bv5cWuec.cjs → delegated-state-ilYzKwD8.cjs} +68 -6
  10. package/dist/.setup/{monitor-cuifGELM.cjs → monitor-b0zPpnmW.cjs} +1883 -2310
  11. package/dist/.setup/{oauth-BBUQCwmq.cjs → oauth-CUtfkgKE.cjs} +10 -21
  12. package/dist/.setup/presentation-Duoi9Ijn.cjs +213 -0
  13. package/dist/.setup/{reaction-types-CwP5RVQB.cjs → reaction-types-C6F6g2nk.cjs} +1 -1
  14. package/dist/.setup/{resolve-allowlist-gI34MnpE.cjs → resolve-allowlist-7mIEepXB.cjs} +214 -90
  15. package/dist/.setup/{secret-contract-api-wAyY5UHv.cjs → secret-contract-api-D554HIrH.cjs} +4 -6
  16. package/dist/.setup/{secret-contract-api-YY3v6MP8.cjs → secret-contract-api-r3hRtbBW.cjs} +1 -1
  17. package/dist/.setup/{send-C9JY42T6.cjs → send-D1w7a_ip.cjs} +86 -182
  18. package/dist/.setup/{setup-plugin-api-B-NYBLkF.cjs → setup-plugin-api-ChovZJU6.cjs} +1 -1
  19. package/dist/.setup/{thread-session-BWVCoYza.cjs → thread-session-CeWYiol_.cjs} +4 -6
  20. package/dist/.setup/{token-config-bEpua_Q7.cjs → token-config-DICiuJWr.cjs} +0 -2
  21. package/dist/.source-module-urls/7e43ee3ae4faab430a47269c8217f8d99ec60ecd85233f40e81d03efeb543068.json +1 -0
  22. package/dist/api.cjs +2 -2
  23. package/dist/channel-config-api.cjs +1 -1
  24. package/dist/channel-plugin-api.cjs +1 -1
  25. package/dist/directory-contract-api.cjs +1 -1
  26. package/dist/doctor-contract-api.cjs +3 -11
  27. package/dist/qa-runner-api.cjs +1 -1
  28. package/dist/secret-contract-api.cjs +1 -1
  29. package/dist/setup-entry.cjs +2 -2
  30. package/dist/setup-plugin-api.cjs +1 -1
  31. package/openclaw.plugin.json +0 -30
  32. package/package.json +11 -11
@@ -1,8 +1,8 @@
1
- const require_token_config = require("./token-config-bEpua_Q7.cjs");
2
- const require_resolve_allowlist = require("./resolve-allowlist-gI34MnpE.cjs");
1
+ const require_token_config = require("./token-config-DICiuJWr.cjs");
2
+ const require_resolve_allowlist = require("./resolve-allowlist-7mIEepXB.cjs");
3
3
  require("../runtime-api.cjs");
4
- const require_delegated_state = require("./delegated-state-Bv5cWuec.cjs");
5
- const require_config_schema = require("./config-schema-CkKdphSp.cjs");
4
+ const require_delegated_state = require("./delegated-state-ilYzKwD8.cjs");
5
+ const require_config_schema = require("./config-schema-3lVZ45cB.cjs");
6
6
  let openclaw_plugin_sdk_channel_policy = require("openclaw/plugin-sdk/channel-policy");
7
7
  let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
8
8
  let openclaw_plugin_sdk_account_helpers = require("openclaw/plugin-sdk/account-helpers");
@@ -17,17 +17,6 @@ let openclaw_plugin_sdk_channel_dm_policy = require("openclaw/plugin-sdk/channel
17
17
  let openclaw_plugin_sdk_setup_runtime = require("openclaw/plugin-sdk/setup-runtime");
18
18
  let openclaw_plugin_sdk_retry_runtime = require("openclaw/plugin-sdk/retry-runtime");
19
19
  //#region extensions/msteams/src/accounts-mutations.ts
20
- function splitRootIdentity(msteams) {
21
- const { appId, appPassword, ...root } = msteams;
22
- return {
23
- root,
24
- defaultAccount: {
25
- ...msteams.enabled === false && (appId !== void 0 || appPassword !== void 0 || require_token_config.hasConfiguredMSTeamsCredentials(msteams)) ? { enabled: false } : {},
26
- ...appId !== void 0 ? { appId } : {},
27
- ...appPassword !== void 0 ? { appPassword } : {}
28
- }
29
- };
30
- }
31
20
  function patchMSTeamsAccountConfig(params) {
32
21
  const accountId = (0, openclaw_plugin_sdk_account_id.normalizeAccountId)(params.accountId);
33
22
  const msteams = params.cfg.channels?.msteams ?? {};
@@ -44,7 +33,12 @@ function patchMSTeamsAccountConfig(params) {
44
33
  }
45
34
  }
46
35
  };
47
- const { root: baseMsteams, defaultAccount } = splitRootIdentity(msteams);
36
+ const { appId, appPassword, ...baseMsteams } = msteams;
37
+ const defaultAccount = {
38
+ ...msteams.enabled === false && (appId !== void 0 || appPassword !== void 0 || require_token_config.hasConfiguredMSTeamsCredentials(msteams)) ? { enabled: false } : {},
39
+ ...appId !== void 0 ? { appId } : {},
40
+ ...appPassword !== void 0 ? { appPassword } : {}
41
+ };
48
42
  const baseAccounts = ensureEnabled && msteams.enabled === false ? Object.fromEntries(Object.entries(baseMsteams.accounts ?? {}).map(([key, account]) => [key, {
49
43
  ...account,
50
44
  enabled: false
@@ -111,7 +105,7 @@ const collectMSTeamsSecurityWarnings = (0, openclaw_plugin_sdk_channel_policy.cr
111
105
  accountId
112
106
  });
113
107
  const accounts = cfg.channels?.msteams?.accounts;
114
- const rawAccountKey = accounts ? Object.keys(accounts).find((key) => (0, openclaw_plugin_sdk_account_id.normalizeAccountId)(key) === account.accountId) : void 0;
108
+ const rawAccountKey = require_resolve_allowlist.resolveMSTeamsAccountEntryKey(accounts, account.accountId);
115
109
  const hasAccountPolicyOverride = rawAccountKey !== void 0 && accounts?.[rawAccountKey]?.groupPolicy !== void 0;
116
110
  const configPath = account.accountId === openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID && !hasAccountPolicyOverride ? "channels.msteams" : `channels.msteams.accounts.${rawAccountKey ?? account.accountId}`;
117
111
  return [`- ${configPath === "channels.msteams" ? "MS Teams" : `MS Teams[${account.accountId}]`} groups: groupPolicy="open" allows any member to trigger (mention-gated). Set ${configPath}.groupPolicy="allowlist" + ${configPath}.groupAllowFrom to restrict senders.`];
@@ -187,29 +181,9 @@ const msteamsConfigAdapter = {
187
181
  //#region extensions/msteams/src/setup-core.ts
188
182
  const t$1 = (0, openclaw_plugin_sdk_setup.createSetupTranslator)();
189
183
  const channel$1 = "msteams";
190
- function applySecretAuthCredentials(patch, existing) {
191
- return {
192
- ...patch,
193
- authType: "secret",
194
- ...existing.certificatePath !== void 0 ? { certificatePath: void 0 } : {},
195
- ...existing.certificateThumbprint !== void 0 ? { certificateThumbprint: void 0 } : {},
196
- ...existing.useManagedIdentity !== void 0 ? { useManagedIdentity: void 0 } : {},
197
- ...existing.managedIdentityClientId !== void 0 ? { managedIdentityClientId: void 0 } : {}
198
- };
199
- }
200
184
  function resolveSetupAccountId(cfg, accountId) {
201
185
  return (0, openclaw_plugin_sdk_setup.normalizeAccountId)(accountId ?? require_resolve_allowlist.resolveDefaultMSTeamsAccountId(cfg));
202
186
  }
203
- function resolveRawMSTeamsAccountConfig(cfg, accountId) {
204
- const normalized = (0, openclaw_plugin_sdk_setup.normalizeAccountId)(accountId);
205
- const msteams = cfg.channels?.msteams ?? {};
206
- if (normalized === openclaw_plugin_sdk_setup.DEFAULT_ACCOUNT_ID) {
207
- const rawAccountKey = require_resolve_allowlist.resolveMSTeamsAccountEntryKey(msteams.accounts, normalized);
208
- return (rawAccountKey ? msteams.accounts?.[rawAccountKey] : void 0) ?? msteams;
209
- }
210
- const rawAccountKey = require_resolve_allowlist.resolveMSTeamsAccountEntryKey(msteams.accounts, normalized);
211
- return (rawAccountKey ? msteams.accounts?.[rawAccountKey] : void 0) ?? {};
212
- }
213
187
  function resolveCredentialsForSetup(cfg, accountId) {
214
188
  return require_token_config.resolveMSTeamsCredentials(require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, accountId), {
215
189
  allowEnvFallback: accountId === openclaw_plugin_sdk_setup.DEFAULT_ACCOUNT_ID,
@@ -309,7 +283,9 @@ const msteamsSetupAdapter = {
309
283
  const appId = input.appId;
310
284
  const appPassword = input.appPassword;
311
285
  const tenantId = input.tenantId;
312
- const existing = resolveRawMSTeamsAccountConfig(cfg, resolvedAccountId);
286
+ const msteams = cfg.channels?.msteams ?? {};
287
+ const rawAccountKey = require_resolve_allowlist.resolveMSTeamsAccountEntryKey(msteams.accounts, resolvedAccountId);
288
+ const existing = (rawAccountKey ? msteams.accounts?.[rawAccountKey] : void 0) ?? (resolvedAccountId === openclaw_plugin_sdk_setup.DEFAULT_ACCOUNT_ID ? msteams : {});
313
289
  const patch = {};
314
290
  if (appId?.trim()) patch.appId = appId.trim();
315
291
  if (appPassword?.trim()) patch.appPassword = appPassword.trim();
@@ -320,7 +296,14 @@ const msteamsSetupAdapter = {
320
296
  };
321
297
  const inheritedTenantId = require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, resolvedAccountId).tenantId?.trim();
322
298
  const replacesWithSecretAuth = Boolean(appId?.trim() && appPassword?.trim() && (tenantId?.trim() || inheritedTenantId));
323
- const credentialPatch = replacesWithSecretAuth ? applySecretAuthCredentials(patch, existing) : patch;
299
+ const credentialPatch = replacesWithSecretAuth ? {
300
+ ...patch,
301
+ authType: "secret",
302
+ ...existing.certificatePath !== void 0 ? { certificatePath: void 0 } : {},
303
+ ...existing.certificateThumbprint !== void 0 ? { certificateThumbprint: void 0 } : {},
304
+ ...existing.useManagedIdentity !== void 0 ? { useManagedIdentity: void 0 } : {},
305
+ ...existing.managedIdentityClientId !== void 0 ? { managedIdentityClientId: void 0 } : {}
306
+ } : patch;
324
307
  return patchMSTeamsAccountConfig({
325
308
  cfg: input.useEnv && !replacesWithSecretAuth ? selectMSTeamsEnvironmentCredentials(cfg) : cfg,
326
309
  accountId: resolvedAccountId,
@@ -390,15 +373,6 @@ async function promptMSTeamsCredentials(prompter) {
390
373
  tenantId: await promptRequired(t$1("wizard.msteams.tenantIdPrompt"))
391
374
  };
392
375
  }
393
- async function noteMSTeamsCredentialHelp(prompter) {
394
- await prompter.note([
395
- t$1("wizard.msteams.helpAzureBot"),
396
- t$1("wizard.msteams.helpClientSecret"),
397
- t$1("wizard.msteams.helpWebhook"),
398
- t$1("wizard.msteams.helpEnvTip"),
399
- t$1("wizard.channels.docs", { link: (0, openclaw_plugin_sdk_setup_tools.formatDocsLink)("/channels/msteams", "msteams") })
400
- ].join("\n"), t$1("wizard.msteams.credentialsTitle"));
401
- }
402
376
  function createMSTeamsSetupWizardBase() {
403
377
  return {
404
378
  channel: channel$1,
@@ -425,7 +399,13 @@ function createMSTeamsSetupWizardBase() {
425
399
  const hasConfigCreds = require_token_config.hasConfiguredMSTeamsCredentials(require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, resolvedAccountId), { allowEnvFallback: false });
426
400
  const canUseEnv = Boolean(resolvedAccountId === openclaw_plugin_sdk_setup.DEFAULT_ACCOUNT_ID && !hasConfigCreds && resolveEnvironmentCredentialsForSetup());
427
401
  let next = cfg;
428
- if (!resolved && !hasConfigCreds) await noteMSTeamsCredentialHelp(prompter);
402
+ if (!resolved && !hasConfigCreds) await prompter.note([
403
+ t$1("wizard.msteams.helpAzureBot"),
404
+ t$1("wizard.msteams.helpClientSecret"),
405
+ t$1("wizard.msteams.helpWebhook"),
406
+ t$1("wizard.msteams.helpEnvTip"),
407
+ t$1("wizard.channels.docs", { link: (0, openclaw_plugin_sdk_setup_tools.formatDocsLink)("/channels/msteams", "msteams") })
408
+ ].join("\n"), t$1("wizard.msteams.credentialsTitle"));
429
409
  const keep = (canUseEnv || hasConfigCreds) && await prompter.confirm({
430
410
  message: t$1(canUseEnv ? "wizard.msteams.envPrompt" : "wizard.msteams.credentialsKeep"),
431
411
  initialValue: true
@@ -444,7 +424,6 @@ function createMSTeamsSetupWizardBase() {
444
424
  }
445
425
  //#endregion
446
426
  //#region extensions/msteams/src/errors.ts
447
- const MAX_SAFE_RETRY_AFTER_SECONDS = Number.MAX_SAFE_INTEGER / 1e3;
448
427
  function formatUnknownError(err) {
449
428
  if (err instanceof Error) return err.message;
450
429
  if (typeof err === "symbol") return err.description ?? err.toString();
@@ -457,57 +436,21 @@ function formatUnknownError(err) {
457
436
  }
458
437
  }
459
438
  function extractStatusCode(err) {
460
- if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(err)) return null;
461
- const parseStatusCode = (value) => {
462
- if (typeof value === "number") return Number.isInteger(value) && value >= 100 && value <= 599 ? value : null;
463
- if (typeof value === "string") {
464
- const trimmed = value.trim();
465
- if (!/^\d{3}$/.test(trimmed)) return null;
466
- const parsed = Number(trimmed);
467
- return parsed >= 100 && parsed <= 599 ? parsed : null;
468
- }
469
- return null;
439
+ const range = {
440
+ min: 100,
441
+ max: 599
470
442
  };
471
- const directStatus = parseStatusCode(err.statusCode ?? err.status);
472
- if (directStatus !== null) return directStatus;
473
- const response = err.response;
474
- if ((0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(response)) {
475
- const responseStatus = parseStatusCode(response.status);
476
- if (responseStatus !== null) return responseStatus;
477
- }
478
- return null;
479
- }
480
- function extractErrorCode(err) {
481
- if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(err)) return null;
482
- const direct = err.code;
483
- if (typeof direct === "string" && direct.trim()) return direct;
443
+ const directStatus = (0, openclaw_plugin_sdk_number_runtime.asSafeIntegerInRange)(err.statusCode ?? err.status, range);
444
+ if (directStatus !== void 0) return directStatus;
484
445
  const response = err.response;
485
- if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(response)) return null;
486
- const body = response.body;
487
- if ((0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(body)) {
488
- const error = body.error;
489
- if ((0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(error) && typeof error.code === "string" && error.code.trim()) return error.code;
490
- }
491
- return null;
446
+ return (0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(response) ? (0, openclaw_plugin_sdk_number_runtime.asSafeIntegerInRange)(response.status, range) ?? null : null;
492
447
  }
493
448
  function extractRetryAfterMs(err) {
494
- if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(err)) return null;
495
- const direct = err.retryAfterMs ?? err.retry_after_ms;
496
- const directMs = (0, openclaw_plugin_sdk_number_runtime.asFiniteNumberInRange)(direct, {
449
+ const directMs = (0, openclaw_plugin_sdk_number_runtime.asFiniteNumberInRange)(err.retryAfterMs, {
497
450
  min: 0,
498
451
  max: Number.MAX_SAFE_INTEGER
499
452
  });
500
453
  if (directMs !== void 0) return directMs;
501
- const retryAfter = err.retryAfter ?? err.retry_after;
502
- const retryAfterSeconds = (0, openclaw_plugin_sdk_number_runtime.asFiniteNumberInRange)(retryAfter, {
503
- min: 0,
504
- max: MAX_SAFE_RETRY_AFTER_SECONDS
505
- });
506
- if (retryAfterSeconds !== void 0) return retryAfterSeconds * 1e3;
507
- if (typeof retryAfter === "string") {
508
- const parsed = parseNonNegativeRetryAfterSeconds(retryAfter);
509
- if (parsed !== void 0) return parsed * 1e3;
510
- }
511
454
  const response = err.response;
512
455
  if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(response)) return null;
513
456
  const headers = response.headers;
@@ -528,22 +471,15 @@ function extractRetryAfterMs(err) {
528
471
  }
529
472
  return null;
530
473
  }
531
- function parseNonNegativeRetryAfterSeconds(raw) {
532
- const trimmed = raw.trim();
533
- if (!/^\d+(?:\.\d+)?$/.test(trimmed)) return;
534
- return (0, openclaw_plugin_sdk_number_runtime.asFiniteNumberInRange)((0, openclaw_plugin_sdk_number_runtime.parseStrictFiniteNumber)(trimmed), {
535
- min: 0,
536
- max: MAX_SAFE_RETRY_AFTER_SECONDS
537
- });
538
- }
539
474
  /**
540
475
  * Owns retry safety and delivery ambiguity for Teams send failures.
541
476
  * Only Teams rate-limit rejection proves this unkeyed POST safe to replay.
542
477
  */
543
478
  function classifyMSTeamsSendError(err) {
544
- const statusCode = extractStatusCode(err);
545
- const retryAfterMs = extractRetryAfterMs(err);
546
- const errorCode = extractErrorCode(err) ?? void 0;
479
+ const error = (0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(err) ? err : {};
480
+ const statusCode = extractStatusCode(error);
481
+ const retryAfterMs = extractRetryAfterMs(error);
482
+ const errorCode = typeof error.code === "string" && error.code.trim() ? error.code : void 0;
547
483
  if (statusCode === 401) return {
548
484
  kind: "auth",
549
485
  statusCode,
@@ -589,18 +525,6 @@ function classifyMSTeamsSendError(err) {
589
525
  errorCode
590
526
  };
591
527
  }
592
- /**
593
- * Detect whether an error is caused by a revoked Proxy.
594
- *
595
- * The Bot Framework SDK wraps TurnContext in a Proxy that is revoked once the
596
- * turn handler returns. Any later access (e.g. from a debounced callback)
597
- * throws a TypeError whose message contains the distinctive "proxy that has
598
- * been revoked" string.
599
- */
600
- function isRevokedProxyError(err) {
601
- if (!(err instanceof TypeError)) return false;
602
- return /proxy that has been revoked/i.test(err.message);
603
- }
604
528
  function formatMSTeamsSendErrorHint(classification) {
605
529
  if (classification.kind === "auth") return "check msteams appId/appPassword/tenantId (or env vars MSTEAMS_APP_ID/MSTEAMS_APP_PASSWORD/MSTEAMS_TENANT_ID)";
606
530
  if (classification.errorCode === "ContentStreamNotAllowed") return "Teams expired the content stream; stop streaming earlier and fall back to normal message delivery";
@@ -621,148 +545,79 @@ const channel = "msteams";
621
545
  function openDelegatedOAuthUrl(url) {
622
546
  return Promise.reject(/* @__PURE__ */ new Error(`Automatic browser launch is not available. Open this URL manually: ${url}`));
623
547
  }
624
- function looksLikeGuid(value) {
625
- return /^[0-9a-fA-F-]{16,}$/.test(value);
626
- }
627
- async function promptMSTeamsAllowFrom(params) {
628
- const accountId = (0, openclaw_plugin_sdk_account_id.normalizeAccountId)(params.accountId ?? require_resolve_allowlist.resolveDefaultMSTeamsAccountId(params.cfg));
629
- const existing = require_resolve_allowlist.resolveMSTeamsAccountConfig(params.cfg, accountId).allowFrom ?? [];
630
- await params.prompter.note([
631
- t("wizard.msteams.allowlistIntro"),
632
- t("wizard.msteams.allowlistResolve"),
633
- t("wizard.msteams.examples"),
634
- "- alex@example.com",
635
- "- Alex Johnson",
636
- "- 00000000-0000-0000-0000-000000000000"
637
- ].join("\n"), t("wizard.msteams.allowlistTitle"));
638
- while (true) {
639
- const entry = await params.prompter.text({
640
- message: t("wizard.msteams.allowFromPrompt"),
641
- placeholder: "alex@example.com, Alex Johnson",
642
- initialValue: existing[0] ? existing[0] : void 0,
643
- validate: (value) => value.trim() ? void 0 : t("common.required")
644
- });
645
- const parts = (0, openclaw_plugin_sdk_setup.splitSetupEntries)(entry);
646
- if (parts.length === 0) {
647
- await params.prompter.note(t("wizard.msteams.enterAtLeastOneUser"), t("wizard.msteams.allowlistTitle"));
648
- continue;
649
- }
650
- const resolved = await require_resolve_allowlist.resolveMSTeamsUserAllowlist({
651
- cfg: params.cfg,
652
- accountId,
653
- entries: parts
654
- }).catch(() => null);
655
- let ids;
656
- if (!resolved) {
657
- ids = parts.filter((part) => looksLikeGuid(part));
658
- if (ids.length !== parts.length) {
659
- await params.prompter.note(t("wizard.msteams.graphLookupUnavailable"), t("wizard.msteams.allowlistTitle"));
660
- continue;
661
- }
662
- } else {
663
- const unresolved = resolved.filter((item) => !item.resolved || !item.id);
664
- if (unresolved.length > 0) {
665
- await params.prompter.note(t("wizard.msteams.couldNotResolve", { entries: unresolved.map((item) => item.input).join(", ") }), t("wizard.msteams.allowlistTitle"));
666
- continue;
667
- }
668
- ids = resolved.flatMap((item) => item.id ? [item.id] : []);
669
- }
670
- const unique = (0, openclaw_plugin_sdk_setup.mergeAllowFromEntries)(existing, ids);
671
- return patchMSTeamsAccountConfig({
672
- cfg: params.cfg,
673
- accountId,
674
- patch: {
675
- dmPolicy: "allowlist",
676
- allowFrom: unique
677
- },
678
- scopeDefaultToAccounts: shouldScopeMSTeamsDefaultToAccounts(params.cfg, accountId)
679
- });
680
- }
681
- }
682
548
  function shouldScopeMSTeamsDefaultToAccounts(cfg, accountId) {
683
549
  if ((0, openclaw_plugin_sdk_account_id.normalizeAccountId)(accountId) !== openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID) return false;
684
550
  return Object.keys(cfg.channels?.msteams?.accounts ?? {}).length > 0;
685
551
  }
686
- function setMSTeamsTeamsAllowlist(cfg, accountId, entries) {
687
- const teams = { ...require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, accountId).teams ?? {} };
688
- for (const entry of entries) {
689
- const teamKey = entry.teamKey;
690
- if (!teamKey) continue;
691
- const existing = teams[teamKey] ?? {};
692
- if (entry.channelKey) {
693
- const channels = { ...existing.channels };
694
- channels[entry.channelKey] = channels[entry.channelKey] ?? {};
695
- teams[teamKey] = {
696
- ...existing,
697
- channels
698
- };
699
- } else teams[teamKey] = existing;
700
- }
701
- return patchMSTeamsAccountConfig({
702
- cfg,
703
- accountId,
704
- patch: { teams },
705
- scopeDefaultToAccounts: shouldScopeMSTeamsDefaultToAccounts(cfg, accountId)
706
- });
707
- }
708
- function listMSTeamsGroupEntries(cfg, accountId) {
709
- return Object.entries(require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, accountId).teams ?? {}).flatMap(([teamKey, value]) => {
710
- const channels = value?.channels ?? {};
711
- const channelKeys = Object.keys(channels);
712
- if (channelKeys.length === 0) return [teamKey];
713
- return channelKeys.map((channelKey) => `${teamKey}/${channelKey}`);
714
- });
715
- }
716
- async function resolveMSTeamsGroupAllowlist(params) {
717
- let resolvedEntries = params.entries.map((entry) => require_resolve_allowlist.parseMSTeamsTeamEntry(entry)).filter((entry) => entry !== null);
718
- if (params.entries.length === 0 || !require_token_config.resolveMSTeamsCredentials(require_resolve_allowlist.resolveMSTeamsAccountConfig(params.cfg, params.accountId), {
719
- allowEnvFallback: params.accountId === "default",
720
- pathPrefix: require_resolve_allowlist.resolveMSTeamsAccountConfigPath(params.cfg, params.accountId)
721
- })) return resolvedEntries;
722
- try {
723
- const lookups = await require_resolve_allowlist.resolveMSTeamsChannelAllowlist({
724
- cfg: params.cfg,
725
- accountId: params.accountId,
726
- entries: params.entries
727
- });
728
- const resolvedChannels = lookups.filter((entry) => entry.resolved && entry.teamId && entry.channelId);
729
- const resolvedTeams = lookups.filter((entry) => entry.resolved && entry.teamId && !entry.channelId);
730
- const unresolved = lookups.filter((entry) => !entry.resolved).map((entry) => entry.input);
731
- resolvedEntries = [
732
- ...resolvedChannels.flatMap((entry) => entry.teamId && entry.channelId ? [{
733
- teamKey: entry.teamId,
734
- channelKey: entry.channelId
735
- }] : []),
736
- ...resolvedTeams.flatMap((entry) => entry.teamId ? [{ teamKey: entry.teamId }] : []),
737
- ...unresolved.map((entry) => require_resolve_allowlist.parseMSTeamsTeamEntry(entry)).filter((entry) => entry !== null)
738
- ];
739
- const summary = [];
740
- if (resolvedChannels.length > 0) summary.push(t("wizard.msteams.resolvedChannels", { entries: resolvedChannels.map((entry) => entry.channelId).filter(Boolean).join(", ") }));
741
- if (resolvedTeams.length > 0) summary.push(t("wizard.msteams.resolvedTeams", { entries: resolvedTeams.map((entry) => entry.teamId).filter(Boolean).join(", ") }));
742
- if (unresolved.length > 0) summary.push(t("wizard.msteams.unresolvedKept", { entries: unresolved.join(", ") }));
743
- if (summary.length > 0) await params.prompter.note(summary.join("\n"), t("wizard.msteams.channelsLabel"));
744
- return resolvedEntries;
745
- } catch (err) {
746
- await params.prompter.note(t("wizard.msteams.channelLookupFailed", { error: formatUnknownError(err) }), t("wizard.msteams.channelsLabel"));
747
- return resolvedEntries;
748
- }
749
- }
750
552
  const msteamsGroupAccess = {
751
553
  ...(0, openclaw_plugin_sdk_setup_runtime.createAccountScopedGroupAccessSection)({
752
554
  channel,
753
555
  label: t("wizard.msteams.channelsLabel"),
754
556
  placeholder: "Team Name/Channel Name, teamId/conversationId",
755
557
  currentPolicy: ({ cfg, accountId }) => require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, accountId).groupPolicy ?? "allowlist",
756
- currentEntries: ({ cfg, accountId }) => listMSTeamsGroupEntries(cfg, accountId),
757
- updatePrompt: ({ cfg, accountId }) => Boolean(require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, accountId).teams),
758
- resolveAllowlist: ({ cfg, accountId, entries, prompter }) => resolveMSTeamsGroupAllowlist({
759
- cfg,
760
- accountId,
761
- entries,
762
- prompter
558
+ currentEntries: ({ cfg, accountId }) => Object.entries(require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, accountId).teams ?? {}).flatMap(([teamKey, value]) => {
559
+ const channels = value?.channels ?? {};
560
+ const channelKeys = Object.keys(channels);
561
+ if (channelKeys.length === 0) return [teamKey];
562
+ return channelKeys.map((channelKey) => `${teamKey}/${channelKey}`);
763
563
  }),
564
+ updatePrompt: ({ cfg, accountId }) => Boolean(require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, accountId).teams),
565
+ resolveAllowlist: async (params) => {
566
+ let resolvedEntries = params.entries.map((entry) => require_resolve_allowlist.parseMSTeamsTeamEntry(entry)).filter((entry) => entry !== null);
567
+ if (params.entries.length === 0 || !require_token_config.resolveMSTeamsCredentials(require_resolve_allowlist.resolveMSTeamsAccountConfig(params.cfg, params.accountId), {
568
+ allowEnvFallback: params.accountId === "default",
569
+ pathPrefix: require_resolve_allowlist.resolveMSTeamsAccountConfigPath(params.cfg, params.accountId)
570
+ })) return resolvedEntries;
571
+ try {
572
+ const lookups = await require_resolve_allowlist.resolveMSTeamsChannelAllowlist({
573
+ cfg: params.cfg,
574
+ accountId: params.accountId,
575
+ entries: params.entries
576
+ });
577
+ const resolvedChannels = lookups.flatMap((entry) => entry.resolved && entry.teamId && entry.channelId ? [{
578
+ teamKey: entry.teamId,
579
+ channelKey: entry.channelId
580
+ }] : []);
581
+ const resolvedTeams = lookups.flatMap((entry) => entry.resolved && entry.teamId && !entry.channelId ? [{ teamKey: entry.teamId }] : []);
582
+ const unresolved = lookups.filter((entry) => !entry.resolved).map((entry) => entry.input);
583
+ resolvedEntries = [
584
+ ...resolvedChannels,
585
+ ...resolvedTeams,
586
+ ...unresolved.map((entry) => require_resolve_allowlist.parseMSTeamsTeamEntry(entry)).filter((entry) => entry !== null)
587
+ ];
588
+ const summary = [];
589
+ if (resolvedChannels.length > 0) summary.push(t("wizard.msteams.resolvedChannels", { entries: resolvedChannels.map((entry) => entry.channelKey).join(", ") }));
590
+ if (resolvedTeams.length > 0) summary.push(t("wizard.msteams.resolvedTeams", { entries: resolvedTeams.map((entry) => entry.teamKey).join(", ") }));
591
+ if (unresolved.length > 0) summary.push(t("wizard.msteams.unresolvedKept", { entries: unresolved.join(", ") }));
592
+ if (summary.length > 0) await params.prompter.note(summary.join("\n"), t("wizard.msteams.channelsLabel"));
593
+ return resolvedEntries;
594
+ } catch (err) {
595
+ await params.prompter.note(t("wizard.msteams.channelLookupFailed", { error: formatUnknownError(err) }), t("wizard.msteams.channelsLabel"));
596
+ return resolvedEntries;
597
+ }
598
+ },
764
599
  fallbackResolved: (entries) => entries.map((entry) => require_resolve_allowlist.parseMSTeamsTeamEntry(entry)).filter((entry) => entry !== null),
765
- applyAllowlist: ({ cfg, accountId, resolved }) => setMSTeamsTeamsAllowlist(cfg, accountId, resolved)
600
+ applyAllowlist: ({ cfg, accountId, resolved: entries }) => {
601
+ const teams = { ...require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, accountId).teams ?? {} };
602
+ for (const entry of entries) {
603
+ const teamKey = entry.teamKey;
604
+ const existing = teams[teamKey] ?? {};
605
+ if (entry.channelKey) {
606
+ const channels = { ...existing.channels };
607
+ channels[entry.channelKey] = channels[entry.channelKey] ?? {};
608
+ teams[teamKey] = {
609
+ ...existing,
610
+ channels
611
+ };
612
+ } else teams[teamKey] = existing;
613
+ }
614
+ return patchMSTeamsAccountConfig({
615
+ cfg,
616
+ accountId,
617
+ patch: { teams },
618
+ scopeDefaultToAccounts: shouldScopeMSTeamsDefaultToAccounts(cfg, accountId)
619
+ });
620
+ }
766
621
  }),
767
622
  setPolicy: ({ cfg, accountId, policy }) => patchMSTeamsAccountConfig({
768
623
  cfg,
@@ -797,16 +652,69 @@ const msteamsDmPolicy = (0, openclaw_plugin_sdk_channel_dm_policy.createChannelD
797
652
  patch,
798
653
  scopeDefaultToAccounts: shouldScopeMSTeamsDefaultToAccounts(cfg, account.accountId)
799
654
  }),
800
- promptAllowFrom: promptMSTeamsAllowFrom
655
+ promptAllowFrom: async (params) => {
656
+ const accountId = (0, openclaw_plugin_sdk_account_id.normalizeAccountId)(params.accountId ?? require_resolve_allowlist.resolveDefaultMSTeamsAccountId(params.cfg));
657
+ const existing = require_resolve_allowlist.resolveMSTeamsAccountConfig(params.cfg, accountId).allowFrom ?? [];
658
+ await params.prompter.note([
659
+ t("wizard.msteams.allowlistIntro"),
660
+ t("wizard.msteams.allowlistResolve"),
661
+ t("wizard.msteams.examples"),
662
+ "- alex@example.com",
663
+ "- Alex Johnson",
664
+ "- 00000000-0000-0000-0000-000000000000"
665
+ ].join("\n"), t("wizard.msteams.allowlistTitle"));
666
+ while (true) {
667
+ const entry = await params.prompter.text({
668
+ message: t("wizard.msteams.allowFromPrompt"),
669
+ placeholder: "alex@example.com, Alex Johnson",
670
+ initialValue: existing[0] ? existing[0] : void 0,
671
+ validate: (value) => value.trim() ? void 0 : t("common.required")
672
+ });
673
+ const parts = (0, openclaw_plugin_sdk_setup.splitSetupEntries)(entry);
674
+ if (parts.length === 0) {
675
+ await params.prompter.note(t("wizard.msteams.enterAtLeastOneUser"), t("wizard.msteams.allowlistTitle"));
676
+ continue;
677
+ }
678
+ const resolved = await require_resolve_allowlist.resolveMSTeamsUserAllowlist({
679
+ cfg: params.cfg,
680
+ accountId,
681
+ entries: parts
682
+ }).catch(() => null);
683
+ let ids;
684
+ if (!resolved) {
685
+ ids = parts.filter((part) => /^[0-9a-fA-F-]{16,}$/.test(part));
686
+ if (ids.length !== parts.length) {
687
+ await params.prompter.note(t("wizard.msteams.graphLookupUnavailable"), t("wizard.msteams.allowlistTitle"));
688
+ continue;
689
+ }
690
+ } else {
691
+ const unresolved = resolved.filter((item) => !item.resolved || !item.id);
692
+ if (unresolved.length > 0) {
693
+ await params.prompter.note(t("wizard.msteams.couldNotResolve", { entries: unresolved.map((item) => item.input).join(", ") }), t("wizard.msteams.allowlistTitle"));
694
+ continue;
695
+ }
696
+ ids = resolved.flatMap((item) => item.id ? [item.id] : []);
697
+ }
698
+ const unique = (0, openclaw_plugin_sdk_setup.mergeAllowFromEntries)(existing, ids);
699
+ return patchMSTeamsAccountConfig({
700
+ cfg: params.cfg,
701
+ accountId,
702
+ patch: {
703
+ dmPolicy: "allowlist",
704
+ allowFrom: unique
705
+ },
706
+ scopeDefaultToAccounts: shouldScopeMSTeamsDefaultToAccounts(params.cfg, accountId)
707
+ });
708
+ }
709
+ }
801
710
  });
802
711
  const msteamsSetupWizardBase = createMSTeamsSetupWizardBase();
803
712
  const msteamsSetupWizard = {
804
713
  ...msteamsSetupWizardBase,
805
714
  finalize: async (params) => {
806
- const baseFinalize = msteamsSetupWizardBase.finalize;
807
- const baseResult = baseFinalize ? await baseFinalize(params) : void 0;
808
- let next = baseResult?.cfg ?? params.cfg;
809
- const resolvedAccountId = baseResult && "accountId" in baseResult && typeof baseResult.accountId === "string" ? baseResult.accountId : params.accountId;
715
+ const baseResult = await msteamsSetupWizardBase.finalize(params);
716
+ let next = baseResult.cfg;
717
+ const resolvedAccountId = baseResult.accountId;
810
718
  const finalCreds = require_token_config.resolveMSTeamsCredentials(require_resolve_allowlist.resolveMSTeamsAccountConfig(next, resolvedAccountId), {
811
719
  allowEnvFallback: resolvedAccountId === "default",
812
720
  pathPrefix: require_resolve_allowlist.resolveMSTeamsAccountConfigPath(next, resolvedAccountId)
@@ -827,7 +735,7 @@ const msteamsSetupWizard = {
827
735
  };
828
736
  let oauthModule;
829
737
  try {
830
- oauthModule = await Promise.resolve().then(() => require("./oauth-BBUQCwmq.cjs"));
738
+ oauthModule = await Promise.resolve().then(() => require("./oauth-CUtfkgKE.cjs"));
831
739
  } catch (err) {
832
740
  await noteDelegatedAuthFailure(err);
833
741
  return {
@@ -882,10 +790,7 @@ const msteamsSetupWizard = {
882
790
  //#region extensions/msteams/src/channel.setup.ts
883
791
  const msteamsSetupPlugin = {
884
792
  id: "msteams",
885
- meta: {
886
- ...msteamsMeta,
887
- aliases: [...msteamsMeta.aliases]
888
- },
793
+ meta: msteamsMeta,
889
794
  capabilities: {
890
795
  chatTypes: [
891
796
  "direct",
@@ -952,12 +857,6 @@ Object.defineProperty(exports, "formatUnknownError", {
952
857
  return formatUnknownError;
953
858
  }
954
859
  });
955
- Object.defineProperty(exports, "isRevokedProxyError", {
956
- enumerable: true,
957
- get: function() {
958
- return isRevokedProxyError;
959
- }
960
- });
961
860
  Object.defineProperty(exports, "msteamsConfigAdapter", {
962
861
  enumerable: true,
963
862
  get: function() {