@openclaw/msteams 2026.10.10 → 2026.11.5-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.
Files changed (32) hide show
  1. package/dist/.setup/{adapter.runtime-BMvpm7sS.cjs → adapter.runtime-UOD_H_ph.cjs} +20 -23
  2. package/dist/.setup/{approval-card-Bo8kHYbj.cjs → approval-card-CD5q0Nla.cjs} +5 -9
  3. package/dist/.setup/{approval-handler.runtime-BS3avHFu.cjs → approval-handler.runtime-DbPxvynk.cjs} +4 -4
  4. package/dist/.setup/{channel-CdCSk3Rg.cjs → channel-DQrXOfhf.cjs} +24 -224
  5. package/dist/.setup/{channel.runtime--ZjTYgkY.cjs → channel.runtime-Du4GPMES.cjs} +65 -106
  6. package/dist/.setup/{channel.setup-nSTtK77J.cjs → channel.setup--7ko_Kxv.cjs} +161 -262
  7. package/dist/.setup/{config-schema-Bm15lF-j.cjs → config-schema-BEXDIOC-.cjs} +120 -123
  8. package/dist/.setup/{conversation-store-state-NJU9osd-.cjs → conversation-store-state-AVgRyNE9.cjs} +411 -598
  9. package/dist/.setup/{delegated-state-CbMd3rIh.cjs → delegated-state-DhIHahf1.cjs} +68 -6
  10. package/dist/.setup/{monitor-BxLDs5fk.cjs → monitor-CXjIKz7o.cjs} +1883 -2284
  11. package/dist/.setup/{oauth-B-Y5pNM4.cjs → oauth-BWG6qWCd.cjs} +10 -20
  12. package/dist/.setup/presentation-CaLawc5j.cjs +211 -0
  13. package/dist/.setup/{reaction-types-BaL1EVBS.cjs → reaction-types-DOzN5oTl.cjs} +1 -1
  14. package/dist/.setup/{resolve-allowlist-CqNzS9bZ.cjs → resolve-allowlist-Drj1jaq0.cjs} +213 -90
  15. package/dist/.setup/{secret-contract-api-BOzdWSn9.cjs → secret-contract-api-DFqDvc_a.cjs} +4 -6
  16. package/dist/.setup/{secret-contract-api-5aH1Fl_c.cjs → secret-contract-api-YGHrfAT0.cjs} +1 -1
  17. package/dist/.setup/{send-BXjI3ufq.cjs → send-BRUztzVJ.cjs} +86 -182
  18. package/dist/.setup/{setup-plugin-api-lPpin6Gg.cjs → setup-plugin-api-BHEfter5.cjs} +1 -1
  19. package/dist/.setup/{thread-session-DZMoCsSR.cjs → thread-session-BUUV1zk_.cjs} +4 -6
  20. package/dist/.setup/{token-config-DTZ00Ibq.cjs → token-config-7K6UbNCo.cjs} +0 -2
  21. package/dist/.source-module-urls/7e43ee3ae4faab430a47269c8217f8d99ec60ecd85233f40e81d03efeb543068.json +1 -1
  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 +6 -13
  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-DTZ00Ibq.cjs");
2
- const require_resolve_allowlist = require("./resolve-allowlist-CqNzS9bZ.cjs");
1
+ const require_token_config = require("./token-config-7K6UbNCo.cjs");
2
+ const require_resolve_allowlist = require("./resolve-allowlist-Drj1jaq0.cjs");
3
3
  require("../runtime-api.cjs");
4
- const require_delegated_state = require("./delegated-state-CbMd3rIh.cjs");
5
- const require_config_schema = require("./config-schema-Bm15lF-j.cjs");
4
+ const require_delegated_state = require("./delegated-state-DhIHahf1.cjs");
5
+ const require_config_schema = require("./config-schema-BEXDIOC-.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
  // 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
@@ -110,7 +104,7 @@ const collectMSTeamsSecurityWarnings = (0, openclaw_plugin_sdk_channel_policy.cr
110
104
  accountId
111
105
  });
112
106
  const accounts = cfg.channels?.msteams?.accounts;
113
- const rawAccountKey = accounts ? Object.keys(accounts).find((key) => (0, openclaw_plugin_sdk_account_id.normalizeAccountId)(key) === account.accountId) : void 0;
107
+ const rawAccountKey = require_resolve_allowlist.resolveMSTeamsAccountEntryKey(accounts, account.accountId);
114
108
  const hasAccountPolicyOverride = rawAccountKey !== void 0 && accounts?.[rawAccountKey]?.groupPolicy !== void 0;
115
109
  const configPath = account.accountId === openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID && !hasAccountPolicyOverride ? "channels.msteams" : `channels.msteams.accounts.${rawAccountKey ?? account.accountId}`;
116
110
  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.`];
@@ -185,29 +179,9 @@ const msteamsConfigAdapter = {
185
179
  // extensions/msteams/src/setup-core.ts
186
180
  const t$1 = (0, openclaw_plugin_sdk_setup.createSetupTranslator)();
187
181
  const channel$1 = "msteams";
188
- function applySecretAuthCredentials(patch, existing) {
189
- return {
190
- ...patch,
191
- authType: "secret",
192
- ...existing.certificatePath !== void 0 ? { certificatePath: void 0 } : {},
193
- ...existing.certificateThumbprint !== void 0 ? { certificateThumbprint: void 0 } : {},
194
- ...existing.useManagedIdentity !== void 0 ? { useManagedIdentity: void 0 } : {},
195
- ...existing.managedIdentityClientId !== void 0 ? { managedIdentityClientId: void 0 } : {}
196
- };
197
- }
198
182
  function resolveSetupAccountId(cfg, accountId) {
199
183
  return (0, openclaw_plugin_sdk_setup.normalizeAccountId)(accountId ?? require_resolve_allowlist.resolveDefaultMSTeamsAccountId(cfg));
200
184
  }
201
- function resolveRawMSTeamsAccountConfig(cfg, accountId) {
202
- const normalized = (0, openclaw_plugin_sdk_setup.normalizeAccountId)(accountId);
203
- const msteams = cfg.channels?.msteams ?? {};
204
- if (normalized === openclaw_plugin_sdk_setup.DEFAULT_ACCOUNT_ID) {
205
- const rawAccountKey = require_resolve_allowlist.resolveMSTeamsAccountEntryKey(msteams.accounts, normalized);
206
- return (rawAccountKey ? msteams.accounts?.[rawAccountKey] : void 0) ?? msteams;
207
- }
208
- const rawAccountKey = require_resolve_allowlist.resolveMSTeamsAccountEntryKey(msteams.accounts, normalized);
209
- return (rawAccountKey ? msteams.accounts?.[rawAccountKey] : void 0) ?? {};
210
- }
211
185
  function resolveCredentialsForSetup(cfg, accountId) {
212
186
  return require_token_config.resolveMSTeamsCredentials(require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, accountId), {
213
187
  allowEnvFallback: accountId === openclaw_plugin_sdk_setup.DEFAULT_ACCOUNT_ID,
@@ -307,7 +281,9 @@ const msteamsSetupAdapter = {
307
281
  const appId = input.appId;
308
282
  const appPassword = input.appPassword;
309
283
  const tenantId = input.tenantId;
310
- const existing = resolveRawMSTeamsAccountConfig(cfg, resolvedAccountId);
284
+ const msteams = cfg.channels?.msteams ?? {};
285
+ const rawAccountKey = require_resolve_allowlist.resolveMSTeamsAccountEntryKey(msteams.accounts, resolvedAccountId);
286
+ const existing = (rawAccountKey ? msteams.accounts?.[rawAccountKey] : void 0) ?? (resolvedAccountId === openclaw_plugin_sdk_setup.DEFAULT_ACCOUNT_ID ? msteams : {});
311
287
  const patch = {};
312
288
  if (appId?.trim()) patch.appId = appId.trim();
313
289
  if (appPassword?.trim()) patch.appPassword = appPassword.trim();
@@ -318,7 +294,14 @@ const msteamsSetupAdapter = {
318
294
  };
319
295
  const inheritedTenantId = require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, resolvedAccountId).tenantId?.trim();
320
296
  const replacesWithSecretAuth = Boolean(appId?.trim() && appPassword?.trim() && (tenantId?.trim() || inheritedTenantId));
321
- const credentialPatch = replacesWithSecretAuth ? applySecretAuthCredentials(patch, existing) : patch;
297
+ const credentialPatch = replacesWithSecretAuth ? {
298
+ ...patch,
299
+ authType: "secret",
300
+ ...existing.certificatePath !== void 0 ? { certificatePath: void 0 } : {},
301
+ ...existing.certificateThumbprint !== void 0 ? { certificateThumbprint: void 0 } : {},
302
+ ...existing.useManagedIdentity !== void 0 ? { useManagedIdentity: void 0 } : {},
303
+ ...existing.managedIdentityClientId !== void 0 ? { managedIdentityClientId: void 0 } : {}
304
+ } : patch;
322
305
  return patchMSTeamsAccountConfig({
323
306
  cfg: input.useEnv && !replacesWithSecretAuth ? selectMSTeamsEnvironmentCredentials(cfg) : cfg,
324
307
  accountId: resolvedAccountId,
@@ -388,15 +371,6 @@ async function promptMSTeamsCredentials(prompter) {
388
371
  tenantId: await promptRequired(t$1("wizard.msteams.tenantIdPrompt"))
389
372
  };
390
373
  }
391
- async function noteMSTeamsCredentialHelp(prompter) {
392
- await prompter.note([
393
- t$1("wizard.msteams.helpAzureBot"),
394
- t$1("wizard.msteams.helpClientSecret"),
395
- t$1("wizard.msteams.helpWebhook"),
396
- t$1("wizard.msteams.helpEnvTip"),
397
- t$1("wizard.channels.docs", { link: (0, openclaw_plugin_sdk_setup_tools.formatDocsLink)("/channels/msteams", "msteams") })
398
- ].join("\n"), t$1("wizard.msteams.credentialsTitle"));
399
- }
400
374
  function createMSTeamsSetupWizardBase() {
401
375
  return {
402
376
  channel: channel$1,
@@ -423,7 +397,13 @@ function createMSTeamsSetupWizardBase() {
423
397
  const hasConfigCreds = require_token_config.hasConfiguredMSTeamsCredentials(require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, resolvedAccountId), { allowEnvFallback: false });
424
398
  const canUseEnv = Boolean(resolvedAccountId === openclaw_plugin_sdk_setup.DEFAULT_ACCOUNT_ID && !hasConfigCreds && resolveEnvironmentCredentialsForSetup());
425
399
  let next = cfg;
426
- if (!resolved && !hasConfigCreds) await noteMSTeamsCredentialHelp(prompter);
400
+ if (!resolved && !hasConfigCreds) await prompter.note([
401
+ t$1("wizard.msteams.helpAzureBot"),
402
+ t$1("wizard.msteams.helpClientSecret"),
403
+ t$1("wizard.msteams.helpWebhook"),
404
+ t$1("wizard.msteams.helpEnvTip"),
405
+ t$1("wizard.channels.docs", { link: (0, openclaw_plugin_sdk_setup_tools.formatDocsLink)("/channels/msteams", "msteams") })
406
+ ].join("\n"), t$1("wizard.msteams.credentialsTitle"));
427
407
  const keep = (canUseEnv || hasConfigCreds) && await prompter.confirm({
428
408
  message: t$1(canUseEnv ? "wizard.msteams.envPrompt" : "wizard.msteams.credentialsKeep"),
429
409
  initialValue: true
@@ -441,7 +421,6 @@ function createMSTeamsSetupWizardBase() {
441
421
  };
442
422
  }
443
423
  // extensions/msteams/src/errors.ts
444
- const MAX_SAFE_RETRY_AFTER_SECONDS = Number.MAX_SAFE_INTEGER / 1e3;
445
424
  function formatUnknownError(err) {
446
425
  if (err instanceof Error) return err.message;
447
426
  if (typeof err === "symbol") return err.description ?? err.toString();
@@ -454,57 +433,21 @@ function formatUnknownError(err) {
454
433
  }
455
434
  }
456
435
  function extractStatusCode(err) {
457
- if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(err)) return null;
458
- const parseStatusCode = (value) => {
459
- if (typeof value === "number") return Number.isInteger(value) && value >= 100 && value <= 599 ? value : null;
460
- if (typeof value === "string") {
461
- const trimmed = value.trim();
462
- if (!/^\d{3}$/.test(trimmed)) return null;
463
- const parsed = Number(trimmed);
464
- return parsed >= 100 && parsed <= 599 ? parsed : null;
465
- }
466
- return null;
436
+ const range = {
437
+ min: 100,
438
+ max: 599
467
439
  };
468
- const directStatus = parseStatusCode(err.statusCode ?? err.status);
469
- if (directStatus !== null) return directStatus;
470
- const response = err.response;
471
- if ((0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(response)) {
472
- const responseStatus = parseStatusCode(response.status);
473
- if (responseStatus !== null) return responseStatus;
474
- }
475
- return null;
476
- }
477
- function extractErrorCode(err) {
478
- if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(err)) return null;
479
- const direct = err.code;
480
- if (typeof direct === "string" && direct.trim()) return direct;
440
+ const directStatus = (0, openclaw_plugin_sdk_number_runtime.asSafeIntegerInRange)(err.statusCode ?? err.status, range);
441
+ if (directStatus !== void 0) return directStatus;
481
442
  const response = err.response;
482
- if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(response)) return null;
483
- const body = response.body;
484
- if ((0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(body)) {
485
- const error = body.error;
486
- if ((0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(error) && typeof error.code === "string" && error.code.trim()) return error.code;
487
- }
488
- return null;
443
+ return (0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(response) ? (0, openclaw_plugin_sdk_number_runtime.asSafeIntegerInRange)(response.status, range) ?? null : null;
489
444
  }
490
445
  function extractRetryAfterMs(err) {
491
- if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(err)) return null;
492
- const direct = err.retryAfterMs ?? err.retry_after_ms;
493
- const directMs = (0, openclaw_plugin_sdk_number_runtime.asFiniteNumberInRange)(direct, {
446
+ const directMs = (0, openclaw_plugin_sdk_number_runtime.asFiniteNumberInRange)(err.retryAfterMs, {
494
447
  min: 0,
495
448
  max: Number.MAX_SAFE_INTEGER
496
449
  });
497
450
  if (directMs !== void 0) return directMs;
498
- const retryAfter = err.retryAfter ?? err.retry_after;
499
- const retryAfterSeconds = (0, openclaw_plugin_sdk_number_runtime.asFiniteNumberInRange)(retryAfter, {
500
- min: 0,
501
- max: MAX_SAFE_RETRY_AFTER_SECONDS
502
- });
503
- if (retryAfterSeconds !== void 0) return retryAfterSeconds * 1e3;
504
- if (typeof retryAfter === "string") {
505
- const parsed = parseNonNegativeRetryAfterSeconds(retryAfter);
506
- if (parsed !== void 0) return parsed * 1e3;
507
- }
508
451
  const response = err.response;
509
452
  if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(response)) return null;
510
453
  const headers = response.headers;
@@ -525,22 +468,15 @@ function extractRetryAfterMs(err) {
525
468
  }
526
469
  return null;
527
470
  }
528
- function parseNonNegativeRetryAfterSeconds(raw) {
529
- const trimmed = raw.trim();
530
- if (!/^\d+(?:\.\d+)?$/.test(trimmed)) return;
531
- return (0, openclaw_plugin_sdk_number_runtime.asFiniteNumberInRange)((0, openclaw_plugin_sdk_number_runtime.parseStrictFiniteNumber)(trimmed), {
532
- min: 0,
533
- max: MAX_SAFE_RETRY_AFTER_SECONDS
534
- });
535
- }
536
471
  /**
537
472
  * Owns retry safety and delivery ambiguity for Teams send failures.
538
473
  * Only Teams rate-limit rejection proves this unkeyed POST safe to replay.
539
474
  */
540
475
  function classifyMSTeamsSendError(err) {
541
- const statusCode = extractStatusCode(err);
542
- const retryAfterMs = extractRetryAfterMs(err);
543
- const errorCode = extractErrorCode(err) ?? void 0;
476
+ const error = (0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(err) ? err : {};
477
+ const statusCode = extractStatusCode(error);
478
+ const retryAfterMs = extractRetryAfterMs(error);
479
+ const errorCode = typeof error.code === "string" && error.code.trim() ? error.code : void 0;
544
480
  if (statusCode === 401) return {
545
481
  kind: "auth",
546
482
  statusCode,
@@ -586,18 +522,6 @@ function classifyMSTeamsSendError(err) {
586
522
  errorCode
587
523
  };
588
524
  }
589
- /**
590
- * Detect whether an error is caused by a revoked Proxy.
591
- *
592
- * The Bot Framework SDK wraps TurnContext in a Proxy that is revoked once the
593
- * turn handler returns. Any later access (e.g. from a debounced callback)
594
- * throws a TypeError whose message contains the distinctive "proxy that has
595
- * been revoked" string.
596
- */
597
- function isRevokedProxyError(err) {
598
- if (!(err instanceof TypeError)) return false;
599
- return /proxy that has been revoked/i.test(err.message);
600
- }
601
525
  function formatMSTeamsSendErrorHint(classification) {
602
526
  if (classification.kind === "auth") return "check msteams appId/appPassword/tenantId (or env vars MSTEAMS_APP_ID/MSTEAMS_APP_PASSWORD/MSTEAMS_TENANT_ID)";
603
527
  if (classification.errorCode === "ContentStreamNotAllowed") return "Teams expired the content stream; stop streaming earlier and fall back to normal message delivery";
@@ -617,148 +541,79 @@ const channel = "msteams";
617
541
  function openDelegatedOAuthUrl(url) {
618
542
  return Promise.reject(/* @__PURE__ */ new Error(`Automatic browser launch is not available. Open this URL manually: ${url}`));
619
543
  }
620
- function looksLikeGuid(value) {
621
- return /^[0-9a-fA-F-]{16,}$/.test(value);
622
- }
623
- async function promptMSTeamsAllowFrom(params) {
624
- const accountId = (0, openclaw_plugin_sdk_account_id.normalizeAccountId)(params.accountId ?? require_resolve_allowlist.resolveDefaultMSTeamsAccountId(params.cfg));
625
- const existing = require_resolve_allowlist.resolveMSTeamsAccountConfig(params.cfg, accountId).allowFrom ?? [];
626
- await params.prompter.note([
627
- t("wizard.msteams.allowlistIntro"),
628
- t("wizard.msteams.allowlistResolve"),
629
- t("wizard.msteams.examples"),
630
- "- alex@example.com",
631
- "- Alex Johnson",
632
- "- 00000000-0000-0000-0000-000000000000"
633
- ].join("\n"), t("wizard.msteams.allowlistTitle"));
634
- while (true) {
635
- const entry = await params.prompter.text({
636
- message: t("wizard.msteams.allowFromPrompt"),
637
- placeholder: "alex@example.com, Alex Johnson",
638
- initialValue: existing[0] ? existing[0] : void 0,
639
- validate: (value) => value.trim() ? void 0 : t("common.required")
640
- });
641
- const parts = (0, openclaw_plugin_sdk_setup.splitSetupEntries)(entry);
642
- if (parts.length === 0) {
643
- await params.prompter.note(t("wizard.msteams.enterAtLeastOneUser"), t("wizard.msteams.allowlistTitle"));
644
- continue;
645
- }
646
- const resolved = await require_resolve_allowlist.resolveMSTeamsUserAllowlist({
647
- cfg: params.cfg,
648
- accountId,
649
- entries: parts
650
- }).catch(() => null);
651
- let ids;
652
- if (!resolved) {
653
- ids = parts.filter((part) => looksLikeGuid(part));
654
- if (ids.length !== parts.length) {
655
- await params.prompter.note(t("wizard.msteams.graphLookupUnavailable"), t("wizard.msteams.allowlistTitle"));
656
- continue;
657
- }
658
- } else {
659
- const unresolved = resolved.filter((item) => !item.resolved || !item.id);
660
- if (unresolved.length > 0) {
661
- await params.prompter.note(t("wizard.msteams.couldNotResolve", { entries: unresolved.map((item) => item.input).join(", ") }), t("wizard.msteams.allowlistTitle"));
662
- continue;
663
- }
664
- ids = resolved.flatMap((item) => item.id ? [item.id] : []);
665
- }
666
- const unique = (0, openclaw_plugin_sdk_setup.mergeAllowFromEntries)(existing, ids);
667
- return patchMSTeamsAccountConfig({
668
- cfg: params.cfg,
669
- accountId,
670
- patch: {
671
- dmPolicy: "allowlist",
672
- allowFrom: unique
673
- },
674
- scopeDefaultToAccounts: shouldScopeMSTeamsDefaultToAccounts(params.cfg, accountId)
675
- });
676
- }
677
- }
678
544
  function shouldScopeMSTeamsDefaultToAccounts(cfg, accountId) {
679
545
  if ((0, openclaw_plugin_sdk_account_id.normalizeAccountId)(accountId) !== openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID) return false;
680
546
  return Object.keys(cfg.channels?.msteams?.accounts ?? {}).length > 0;
681
547
  }
682
- function setMSTeamsTeamsAllowlist(cfg, accountId, entries) {
683
- const teams = { ...require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, accountId).teams ?? {} };
684
- for (const entry of entries) {
685
- const teamKey = entry.teamKey;
686
- if (!teamKey) continue;
687
- const existing = teams[teamKey] ?? {};
688
- if (entry.channelKey) {
689
- const channels = { ...existing.channels };
690
- channels[entry.channelKey] = channels[entry.channelKey] ?? {};
691
- teams[teamKey] = {
692
- ...existing,
693
- channels
694
- };
695
- } else teams[teamKey] = existing;
696
- }
697
- return patchMSTeamsAccountConfig({
698
- cfg,
699
- accountId,
700
- patch: { teams },
701
- scopeDefaultToAccounts: shouldScopeMSTeamsDefaultToAccounts(cfg, accountId)
702
- });
703
- }
704
- function listMSTeamsGroupEntries(cfg, accountId) {
705
- return Object.entries(require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, accountId).teams ?? {}).flatMap(([teamKey, value]) => {
706
- const channels = value?.channels ?? {};
707
- const channelKeys = Object.keys(channels);
708
- if (channelKeys.length === 0) return [teamKey];
709
- return channelKeys.map((channelKey) => `${teamKey}/${channelKey}`);
710
- });
711
- }
712
- async function resolveMSTeamsGroupAllowlist(params) {
713
- let resolvedEntries = params.entries.map((entry) => require_resolve_allowlist.parseMSTeamsTeamEntry(entry)).filter((entry) => entry !== null);
714
- if (params.entries.length === 0 || !require_token_config.resolveMSTeamsCredentials(require_resolve_allowlist.resolveMSTeamsAccountConfig(params.cfg, params.accountId), {
715
- allowEnvFallback: params.accountId === "default",
716
- pathPrefix: require_resolve_allowlist.resolveMSTeamsAccountConfigPath(params.cfg, params.accountId)
717
- })) return resolvedEntries;
718
- try {
719
- const lookups = await require_resolve_allowlist.resolveMSTeamsChannelAllowlist({
720
- cfg: params.cfg,
721
- accountId: params.accountId,
722
- entries: params.entries
723
- });
724
- const resolvedChannels = lookups.filter((entry) => entry.resolved && entry.teamId && entry.channelId);
725
- const resolvedTeams = lookups.filter((entry) => entry.resolved && entry.teamId && !entry.channelId);
726
- const unresolved = lookups.filter((entry) => !entry.resolved).map((entry) => entry.input);
727
- resolvedEntries = [
728
- ...resolvedChannels.flatMap((entry) => entry.teamId && entry.channelId ? [{
729
- teamKey: entry.teamId,
730
- channelKey: entry.channelId
731
- }] : []),
732
- ...resolvedTeams.flatMap((entry) => entry.teamId ? [{ teamKey: entry.teamId }] : []),
733
- ...unresolved.map((entry) => require_resolve_allowlist.parseMSTeamsTeamEntry(entry)).filter((entry) => entry !== null)
734
- ];
735
- const summary = [];
736
- if (resolvedChannels.length > 0) summary.push(t("wizard.msteams.resolvedChannels", { entries: resolvedChannels.map((entry) => entry.channelId).filter(Boolean).join(", ") }));
737
- if (resolvedTeams.length > 0) summary.push(t("wizard.msteams.resolvedTeams", { entries: resolvedTeams.map((entry) => entry.teamId).filter(Boolean).join(", ") }));
738
- if (unresolved.length > 0) summary.push(t("wizard.msteams.unresolvedKept", { entries: unresolved.join(", ") }));
739
- if (summary.length > 0) await params.prompter.note(summary.join("\n"), t("wizard.msteams.channelsLabel"));
740
- return resolvedEntries;
741
- } catch (err) {
742
- await params.prompter.note(t("wizard.msteams.channelLookupFailed", { error: formatUnknownError(err) }), t("wizard.msteams.channelsLabel"));
743
- return resolvedEntries;
744
- }
745
- }
746
548
  const msteamsGroupAccess = {
747
549
  ...(0, openclaw_plugin_sdk_setup_runtime.createAccountScopedGroupAccessSection)({
748
550
  channel,
749
551
  label: t("wizard.msteams.channelsLabel"),
750
552
  placeholder: "Team Name/Channel Name, teamId/conversationId",
751
553
  currentPolicy: ({ cfg, accountId }) => require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, accountId).groupPolicy ?? "allowlist",
752
- currentEntries: ({ cfg, accountId }) => listMSTeamsGroupEntries(cfg, accountId),
753
- updatePrompt: ({ cfg, accountId }) => Boolean(require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, accountId).teams),
754
- resolveAllowlist: ({ cfg, accountId, entries, prompter }) => resolveMSTeamsGroupAllowlist({
755
- cfg,
756
- accountId,
757
- entries,
758
- prompter
554
+ currentEntries: ({ cfg, accountId }) => Object.entries(require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, accountId).teams ?? {}).flatMap(([teamKey, value]) => {
555
+ const channels = value?.channels ?? {};
556
+ const channelKeys = Object.keys(channels);
557
+ if (channelKeys.length === 0) return [teamKey];
558
+ return channelKeys.map((channelKey) => `${teamKey}/${channelKey}`);
759
559
  }),
560
+ updatePrompt: ({ cfg, accountId }) => Boolean(require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, accountId).teams),
561
+ resolveAllowlist: async (params) => {
562
+ let resolvedEntries = params.entries.map((entry) => require_resolve_allowlist.parseMSTeamsTeamEntry(entry)).filter((entry) => entry !== null);
563
+ if (params.entries.length === 0 || !require_token_config.resolveMSTeamsCredentials(require_resolve_allowlist.resolveMSTeamsAccountConfig(params.cfg, params.accountId), {
564
+ allowEnvFallback: params.accountId === "default",
565
+ pathPrefix: require_resolve_allowlist.resolveMSTeamsAccountConfigPath(params.cfg, params.accountId)
566
+ })) return resolvedEntries;
567
+ try {
568
+ const lookups = await require_resolve_allowlist.resolveMSTeamsChannelAllowlist({
569
+ cfg: params.cfg,
570
+ accountId: params.accountId,
571
+ entries: params.entries
572
+ });
573
+ const resolvedChannels = lookups.flatMap((entry) => entry.resolved && entry.teamId && entry.channelId ? [{
574
+ teamKey: entry.teamId,
575
+ channelKey: entry.channelId
576
+ }] : []);
577
+ const resolvedTeams = lookups.flatMap((entry) => entry.resolved && entry.teamId && !entry.channelId ? [{ teamKey: entry.teamId }] : []);
578
+ const unresolved = lookups.filter((entry) => !entry.resolved).map((entry) => entry.input);
579
+ resolvedEntries = [
580
+ ...resolvedChannels,
581
+ ...resolvedTeams,
582
+ ...unresolved.map((entry) => require_resolve_allowlist.parseMSTeamsTeamEntry(entry)).filter((entry) => entry !== null)
583
+ ];
584
+ const summary = [];
585
+ if (resolvedChannels.length > 0) summary.push(t("wizard.msteams.resolvedChannels", { entries: resolvedChannels.map((entry) => entry.channelKey).join(", ") }));
586
+ if (resolvedTeams.length > 0) summary.push(t("wizard.msteams.resolvedTeams", { entries: resolvedTeams.map((entry) => entry.teamKey).join(", ") }));
587
+ if (unresolved.length > 0) summary.push(t("wizard.msteams.unresolvedKept", { entries: unresolved.join(", ") }));
588
+ if (summary.length > 0) await params.prompter.note(summary.join("\n"), t("wizard.msteams.channelsLabel"));
589
+ return resolvedEntries;
590
+ } catch (err) {
591
+ await params.prompter.note(t("wizard.msteams.channelLookupFailed", { error: formatUnknownError(err) }), t("wizard.msteams.channelsLabel"));
592
+ return resolvedEntries;
593
+ }
594
+ },
760
595
  fallbackResolved: (entries) => entries.map((entry) => require_resolve_allowlist.parseMSTeamsTeamEntry(entry)).filter((entry) => entry !== null),
761
- applyAllowlist: ({ cfg, accountId, resolved }) => setMSTeamsTeamsAllowlist(cfg, accountId, resolved)
596
+ applyAllowlist: ({ cfg, accountId, resolved: entries }) => {
597
+ const teams = { ...require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, accountId).teams ?? {} };
598
+ for (const entry of entries) {
599
+ const teamKey = entry.teamKey;
600
+ const existing = teams[teamKey] ?? {};
601
+ if (entry.channelKey) {
602
+ const channels = { ...existing.channels };
603
+ channels[entry.channelKey] = channels[entry.channelKey] ?? {};
604
+ teams[teamKey] = {
605
+ ...existing,
606
+ channels
607
+ };
608
+ } else teams[teamKey] = existing;
609
+ }
610
+ return patchMSTeamsAccountConfig({
611
+ cfg,
612
+ accountId,
613
+ patch: { teams },
614
+ scopeDefaultToAccounts: shouldScopeMSTeamsDefaultToAccounts(cfg, accountId)
615
+ });
616
+ }
762
617
  }),
763
618
  setPolicy: ({ cfg, accountId, policy }) => patchMSTeamsAccountConfig({
764
619
  cfg,
@@ -793,16 +648,69 @@ const msteamsDmPolicy = (0, openclaw_plugin_sdk_channel_dm_policy.createChannelD
793
648
  patch,
794
649
  scopeDefaultToAccounts: shouldScopeMSTeamsDefaultToAccounts(cfg, account.accountId)
795
650
  }),
796
- promptAllowFrom: promptMSTeamsAllowFrom
651
+ promptAllowFrom: async (params) => {
652
+ const accountId = (0, openclaw_plugin_sdk_account_id.normalizeAccountId)(params.accountId ?? require_resolve_allowlist.resolveDefaultMSTeamsAccountId(params.cfg));
653
+ const existing = require_resolve_allowlist.resolveMSTeamsAccountConfig(params.cfg, accountId).allowFrom ?? [];
654
+ await params.prompter.note([
655
+ t("wizard.msteams.allowlistIntro"),
656
+ t("wizard.msteams.allowlistResolve"),
657
+ t("wizard.msteams.examples"),
658
+ "- alex@example.com",
659
+ "- Alex Johnson",
660
+ "- 00000000-0000-0000-0000-000000000000"
661
+ ].join("\n"), t("wizard.msteams.allowlistTitle"));
662
+ while (true) {
663
+ const entry = await params.prompter.text({
664
+ message: t("wizard.msteams.allowFromPrompt"),
665
+ placeholder: "alex@example.com, Alex Johnson",
666
+ initialValue: existing[0] ? existing[0] : void 0,
667
+ validate: (value) => value.trim() ? void 0 : t("common.required")
668
+ });
669
+ const parts = (0, openclaw_plugin_sdk_setup.splitSetupEntries)(entry);
670
+ if (parts.length === 0) {
671
+ await params.prompter.note(t("wizard.msteams.enterAtLeastOneUser"), t("wizard.msteams.allowlistTitle"));
672
+ continue;
673
+ }
674
+ const resolved = await require_resolve_allowlist.resolveMSTeamsUserAllowlist({
675
+ cfg: params.cfg,
676
+ accountId,
677
+ entries: parts
678
+ }).catch(() => null);
679
+ let ids;
680
+ if (!resolved) {
681
+ ids = parts.filter((part) => /^[0-9a-fA-F-]{16,}$/.test(part));
682
+ if (ids.length !== parts.length) {
683
+ await params.prompter.note(t("wizard.msteams.graphLookupUnavailable"), t("wizard.msteams.allowlistTitle"));
684
+ continue;
685
+ }
686
+ } else {
687
+ const unresolved = resolved.filter((item) => !item.resolved || !item.id);
688
+ if (unresolved.length > 0) {
689
+ await params.prompter.note(t("wizard.msteams.couldNotResolve", { entries: unresolved.map((item) => item.input).join(", ") }), t("wizard.msteams.allowlistTitle"));
690
+ continue;
691
+ }
692
+ ids = resolved.flatMap((item) => item.id ? [item.id] : []);
693
+ }
694
+ const unique = (0, openclaw_plugin_sdk_setup.mergeAllowFromEntries)(existing, ids);
695
+ return patchMSTeamsAccountConfig({
696
+ cfg: params.cfg,
697
+ accountId,
698
+ patch: {
699
+ dmPolicy: "allowlist",
700
+ allowFrom: unique
701
+ },
702
+ scopeDefaultToAccounts: shouldScopeMSTeamsDefaultToAccounts(params.cfg, accountId)
703
+ });
704
+ }
705
+ }
797
706
  });
798
707
  const msteamsSetupWizardBase = createMSTeamsSetupWizardBase();
799
708
  const msteamsSetupWizard = {
800
709
  ...msteamsSetupWizardBase,
801
710
  finalize: async (params) => {
802
- const baseFinalize = msteamsSetupWizardBase.finalize;
803
- const baseResult = baseFinalize ? await baseFinalize(params) : void 0;
804
- let next = baseResult?.cfg ?? params.cfg;
805
- const resolvedAccountId = baseResult && "accountId" in baseResult && typeof baseResult.accountId === "string" ? baseResult.accountId : params.accountId;
711
+ const baseResult = await msteamsSetupWizardBase.finalize(params);
712
+ let next = baseResult.cfg;
713
+ const resolvedAccountId = baseResult.accountId;
806
714
  const finalCreds = require_token_config.resolveMSTeamsCredentials(require_resolve_allowlist.resolveMSTeamsAccountConfig(next, resolvedAccountId), {
807
715
  allowEnvFallback: resolvedAccountId === "default",
808
716
  pathPrefix: require_resolve_allowlist.resolveMSTeamsAccountConfigPath(next, resolvedAccountId)
@@ -823,7 +731,7 @@ const msteamsSetupWizard = {
823
731
  };
824
732
  let oauthModule;
825
733
  try {
826
- oauthModule = await Promise.resolve().then(() => require("./oauth-B-Y5pNM4.cjs"));
734
+ oauthModule = await Promise.resolve().then(() => require("./oauth-BWG6qWCd.cjs"));
827
735
  } catch (err) {
828
736
  await noteDelegatedAuthFailure(err);
829
737
  return {
@@ -877,10 +785,7 @@ const msteamsSetupWizard = {
877
785
  // extensions/msteams/src/channel.setup.ts
878
786
  const msteamsSetupPlugin = {
879
787
  id: "msteams",
880
- meta: {
881
- ...msteamsMeta,
882
- aliases: [...msteamsMeta.aliases]
883
- },
788
+ meta: msteamsMeta,
884
789
  capabilities: {
885
790
  chatTypes: [
886
791
  "direct",
@@ -946,12 +851,6 @@ Object.defineProperty(exports, "formatUnknownError", {
946
851
  return formatUnknownError;
947
852
  }
948
853
  });
949
- Object.defineProperty(exports, "isRevokedProxyError", {
950
- enumerable: true,
951
- get: function() {
952
- return isRevokedProxyError;
953
- }
954
- });
955
854
  Object.defineProperty(exports, "msteamsConfigAdapter", {
956
855
  enumerable: true,
957
856
  get: function() {