@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
@@ -2,15 +2,16 @@ const require_rolldown_runtime = require("./rolldown-runtime-BloeesfJ.cjs");
2
2
  const require_runtime = require("./runtime-gZTAuFux.cjs");
3
3
  let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
4
4
  let node_crypto = require("node:crypto");
5
- node_crypto = require_rolldown_runtime.__toESM(node_crypto, 1);
5
+ let node_util = require("node:util");
6
6
  let node_path = require("node:path");
7
7
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
8
8
  let openclaw_plugin_sdk_keyed_async_queue = require("openclaw/plugin-sdk/keyed-async-queue");
9
+ let openclaw_plugin_sdk_node_crypto_runtime = require("openclaw/plugin-sdk/node-crypto-runtime");
9
10
  //#region extensions/msteams/src/sqlite-state.ts
10
11
  function resolveMSTeamsAccountStateNamespace(namespace, accountId) {
11
12
  const normalizedAccountId = (0, openclaw_plugin_sdk_account_id.normalizeAccountId)(accountId);
12
13
  if (normalizedAccountId === openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID) return namespace;
13
- return `${namespace}-${node_crypto.default.createHash("sha256").update(normalizedAccountId).digest("hex")}`;
14
+ return `${namespace}-${(0, openclaw_plugin_sdk_node_crypto_runtime.sha256Hex)(normalizedAccountId)}`;
14
15
  }
15
16
  function toPluginJsonValue(value) {
16
17
  const serialized = JSON.stringify(value);
@@ -27,24 +28,73 @@ const MSTEAMS_DELEGATED_TOKEN_LEGACY_FILENAME = "msteams-delegated.json";
27
28
  const MSTEAMS_DELEGATED_TOKEN_NAMESPACE = "delegated-token";
28
29
  const MSTEAMS_DELEGATED_TOKEN_KEY = "current";
29
30
  function openDelegatedTokenStore(accountId) {
30
- return require_runtime.getMSTeamsRuntime().state.openKeyedStore({
31
+ const runtime = require_runtime.getMSTeamsRuntime();
32
+ return runtime.state.openKeyedStoreV2({
31
33
  namespace: resolveMSTeamsAccountStateNamespace(MSTEAMS_DELEGATED_TOKEN_NAMESPACE, accountId),
32
34
  maxEntries: 1,
33
35
  overflowPolicy: "reject-new"
34
- });
36
+ }, { assertCurrent() {
37
+ if (require_runtime.getMSTeamsRuntime() !== runtime) throw new Error("Microsoft Teams token owner changed");
38
+ } });
35
39
  }
36
40
  function normalizeMSTeamsDelegatedTokens(value) {
37
41
  if (!value || typeof value !== "object") return null;
38
- const token = value;
42
+ const candidate = value;
43
+ const token = candidate.refreshClaim ? candidate.credential : candidate;
44
+ if (!token) return null;
39
45
  if (typeof token.accessToken !== "string" || !token.accessToken || typeof token.refreshToken !== "string" || !token.refreshToken || typeof token.expiresAt !== "number" || !Number.isFinite(token.expiresAt) || !Array.isArray(token.scopes) || !token.scopes.every((scope) => typeof scope === "string" && scope.length > 0)) return null;
40
46
  return {
41
47
  accessToken: token.accessToken,
42
48
  refreshToken: token.refreshToken,
43
49
  expiresAt: token.expiresAt,
44
- scopes: [...token.scopes],
50
+ scopes: token.scopes,
45
51
  ...typeof token.userPrincipalName === "string" ? { userPrincipalName: token.userPrincipalName } : {}
46
52
  };
47
53
  }
54
+ async function loadMSTeamsDelegatedTokenState(accountId) {
55
+ return await openDelegatedTokenStore(accountId).lookup(MSTEAMS_DELEGATED_TOKEN_KEY);
56
+ }
57
+ async function claimMSTeamsDelegatedTokenRefresh(tokens, requestKey, callerKey, accountId) {
58
+ const store = openDelegatedTokenStore(accountId);
59
+ const observed = await store.observe(MSTEAMS_DELEGATED_TOKEN_KEY);
60
+ if (!(0, node_util.isDeepStrictEqual)(normalizeMSTeamsDelegatedTokens(observed.value), tokens)) return;
61
+ const claim = {
62
+ refreshClaim: (0, node_crypto.randomUUID)(),
63
+ requestKey,
64
+ callerKey,
65
+ credential: tokens
66
+ };
67
+ if ((await store.compareAndApply("current", observed.comparison, {
68
+ operation: "update",
69
+ action: "set",
70
+ value: claim
71
+ })).status !== "applied") return;
72
+ return {
73
+ async reject() {
74
+ const current = await store.observe(MSTEAMS_DELEGATED_TOKEN_KEY);
75
+ if ((0, node_util.isDeepStrictEqual)(current.value, claim)) await store.compareAndApply(MSTEAMS_DELEGATED_TOKEN_KEY, current.comparison, {
76
+ operation: "update",
77
+ action: "set",
78
+ value: {
79
+ refreshClaim: claim.refreshClaim,
80
+ requestKey,
81
+ callerKey
82
+ }
83
+ });
84
+ },
85
+ async settle(replacement) {
86
+ const current = await store.observe(MSTEAMS_DELEGATED_TOKEN_KEY);
87
+ if (!(0, node_util.isDeepStrictEqual)(current.value, claim)) return false;
88
+ const normalized = normalizeMSTeamsDelegatedTokens(replacement);
89
+ if (!normalized) throw new Error("Invalid Microsoft Teams delegated token payload");
90
+ return (await store.compareAndApply(MSTEAMS_DELEGATED_TOKEN_KEY, current.comparison, {
91
+ operation: "update",
92
+ action: "set",
93
+ value: normalized
94
+ })).status === "applied";
95
+ }
96
+ };
97
+ }
48
98
  async function loadMSTeamsDelegatedTokens(accountId) {
49
99
  return normalizeMSTeamsDelegatedTokens(await openDelegatedTokenStore(accountId).lookup("current")) ?? void 0;
50
100
  }
@@ -72,6 +122,18 @@ Object.defineProperty(exports, "MSTEAMS_DELEGATED_TOKEN_NAMESPACE", {
72
122
  return MSTEAMS_DELEGATED_TOKEN_NAMESPACE;
73
123
  }
74
124
  });
125
+ Object.defineProperty(exports, "claimMSTeamsDelegatedTokenRefresh", {
126
+ enumerable: true,
127
+ get: function() {
128
+ return claimMSTeamsDelegatedTokenRefresh;
129
+ }
130
+ });
131
+ Object.defineProperty(exports, "loadMSTeamsDelegatedTokenState", {
132
+ enumerable: true,
133
+ get: function() {
134
+ return loadMSTeamsDelegatedTokenState;
135
+ }
136
+ });
75
137
  Object.defineProperty(exports, "loadMSTeamsDelegatedTokens", {
76
138
  enumerable: true,
77
139
  get: function() {