@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
@@ -2,15 +2,16 @@ const require_rolldown_runtime = require("./rolldown-runtime-CiKaZLfC.cjs");
2
2
  const require_runtime = require("./runtime-CbKazLGv.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
  // 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);
@@ -26,24 +27,73 @@ const MSTEAMS_DELEGATED_TOKEN_LEGACY_FILENAME = "msteams-delegated.json";
26
27
  const MSTEAMS_DELEGATED_TOKEN_NAMESPACE = "delegated-token";
27
28
  const MSTEAMS_DELEGATED_TOKEN_KEY = "current";
28
29
  function openDelegatedTokenStore(accountId) {
29
- return require_runtime.getMSTeamsRuntime().state.openKeyedStore({
30
+ const runtime = require_runtime.getMSTeamsRuntime();
31
+ return runtime.state.openKeyedStoreV2({
30
32
  namespace: resolveMSTeamsAccountStateNamespace(MSTEAMS_DELEGATED_TOKEN_NAMESPACE, accountId),
31
33
  maxEntries: 1,
32
34
  overflowPolicy: "reject-new"
33
- });
35
+ }, { assertCurrent() {
36
+ if (require_runtime.getMSTeamsRuntime() !== runtime) throw new Error("Microsoft Teams token owner changed");
37
+ } });
34
38
  }
35
39
  function normalizeMSTeamsDelegatedTokens(value) {
36
40
  if (!value || typeof value !== "object") return null;
37
- const token = value;
41
+ const candidate = value;
42
+ const token = candidate.refreshClaim ? candidate.credential : candidate;
43
+ if (!token) return null;
38
44
  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;
39
45
  return {
40
46
  accessToken: token.accessToken,
41
47
  refreshToken: token.refreshToken,
42
48
  expiresAt: token.expiresAt,
43
- scopes: [...token.scopes],
49
+ scopes: token.scopes,
44
50
  ...typeof token.userPrincipalName === "string" ? { userPrincipalName: token.userPrincipalName } : {}
45
51
  };
46
52
  }
53
+ async function loadMSTeamsDelegatedTokenState(accountId) {
54
+ return await openDelegatedTokenStore(accountId).lookup(MSTEAMS_DELEGATED_TOKEN_KEY);
55
+ }
56
+ async function claimMSTeamsDelegatedTokenRefresh(tokens, requestKey, callerKey, accountId) {
57
+ const store = openDelegatedTokenStore(accountId);
58
+ const observed = await store.observe(MSTEAMS_DELEGATED_TOKEN_KEY);
59
+ if (!(0, node_util.isDeepStrictEqual)(normalizeMSTeamsDelegatedTokens(observed.value), tokens)) return;
60
+ const claim = {
61
+ refreshClaim: (0, node_crypto.randomUUID)(),
62
+ requestKey,
63
+ callerKey,
64
+ credential: tokens
65
+ };
66
+ if ((await store.compareAndApply("current", observed.comparison, {
67
+ operation: "update",
68
+ action: "set",
69
+ value: claim
70
+ })).status !== "applied") return;
71
+ return {
72
+ async reject() {
73
+ const current = await store.observe(MSTEAMS_DELEGATED_TOKEN_KEY);
74
+ if ((0, node_util.isDeepStrictEqual)(current.value, claim)) await store.compareAndApply(MSTEAMS_DELEGATED_TOKEN_KEY, current.comparison, {
75
+ operation: "update",
76
+ action: "set",
77
+ value: {
78
+ refreshClaim: claim.refreshClaim,
79
+ requestKey,
80
+ callerKey
81
+ }
82
+ });
83
+ },
84
+ async settle(replacement) {
85
+ const current = await store.observe(MSTEAMS_DELEGATED_TOKEN_KEY);
86
+ if (!(0, node_util.isDeepStrictEqual)(current.value, claim)) return false;
87
+ const normalized = normalizeMSTeamsDelegatedTokens(replacement);
88
+ if (!normalized) throw new Error("Invalid Microsoft Teams delegated token payload");
89
+ return (await store.compareAndApply(MSTEAMS_DELEGATED_TOKEN_KEY, current.comparison, {
90
+ operation: "update",
91
+ action: "set",
92
+ value: normalized
93
+ })).status === "applied";
94
+ }
95
+ };
96
+ }
47
97
  async function loadMSTeamsDelegatedTokens(accountId) {
48
98
  return normalizeMSTeamsDelegatedTokens(await openDelegatedTokenStore(accountId).lookup("current")) ?? void 0;
49
99
  }
@@ -70,6 +120,18 @@ Object.defineProperty(exports, "MSTEAMS_DELEGATED_TOKEN_NAMESPACE", {
70
120
  return MSTEAMS_DELEGATED_TOKEN_NAMESPACE;
71
121
  }
72
122
  });
123
+ Object.defineProperty(exports, "claimMSTeamsDelegatedTokenRefresh", {
124
+ enumerable: true,
125
+ get: function() {
126
+ return claimMSTeamsDelegatedTokenRefresh;
127
+ }
128
+ });
129
+ Object.defineProperty(exports, "loadMSTeamsDelegatedTokenState", {
130
+ enumerable: true,
131
+ get: function() {
132
+ return loadMSTeamsDelegatedTokenState;
133
+ }
134
+ });
73
135
  Object.defineProperty(exports, "loadMSTeamsDelegatedTokens", {
74
136
  enumerable: true,
75
137
  get: function() {