@openclaw/msteams 2026.8.1-beta.3 → 2026.8.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.
- package/dist/api.cjs +2 -2
- package/dist/approval-card-B6ZIMO83.cjs +303 -0
- package/dist/approval-handler.runtime-B-ZA6Vjp.cjs +107 -0
- package/dist/{channel-KpWENcgK.cjs → channel-ChmCvkuA.cjs} +157 -46
- package/dist/channel-config-api.cjs +1 -1
- package/dist/channel-plugin-api.cjs +1 -1
- package/dist/{channel.runtime-Bkzj8jZ0.cjs → channel.runtime-D3qqruU3.cjs} +17 -590
- package/dist/{channel.setup-mOFtsfYz.cjs → channel.setup-CKb8aKCV.cjs} +11 -4
- package/dist/{config-schema-C4CszdDi.cjs → config-schema-MyN2lamA.cjs} +12 -11
- package/dist/configured-state.cjs +20 -0
- package/dist/directory-contract-api.cjs +1 -1
- package/dist/doctor-contract-api.cjs +76 -39
- package/dist/{messenger-IISPSOvj.cjs → messenger-Ctb9_CO7.cjs} +10 -158
- package/dist/{oauth-C9So7uld.cjs → oauth-BV7HWGe0.cjs} +1 -1
- package/dist/reaction-types-DtWOWuDN.cjs +149 -0
- package/dist/{resolve-allowlist-CIfWUwuc.cjs → resolve-allowlist-CWbvAW4v.cjs} +21 -47
- package/dist/runtime-api.cjs +2 -1
- package/dist/secret-input-C65t6kjM.cjs +1 -0
- package/dist/send-Bym7IH-v.cjs +627 -0
- package/dist/setup-plugin-api.cjs +1 -1
- package/dist/{src-C127-DcQ.cjs → src-BGhvpEOP.cjs} +146 -18
- package/dist/thread-session-Br3R0ovy.cjs +63 -0
- package/package.json +13 -11
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
2
|
-
|
|
1
|
+
const require_resolve_allowlist = require("./resolve-allowlist-CWbvAW4v.cjs");
|
|
2
|
+
require("./secret-input-C65t6kjM.cjs");
|
|
3
|
+
const require_config_schema = require("./config-schema-MyN2lamA.cjs");
|
|
3
4
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
4
5
|
let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
|
|
5
6
|
let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
|
|
7
|
+
let openclaw_plugin_sdk_account_helpers = require("openclaw/plugin-sdk/account-helpers");
|
|
6
8
|
let openclaw_plugin_sdk_number_runtime = require("openclaw/plugin-sdk/number-runtime");
|
|
7
9
|
let openclaw_plugin_sdk_channel_config_helpers = require("openclaw/plugin-sdk/channel-config-helpers");
|
|
8
10
|
let openclaw_plugin_sdk_secret_file_runtime = require("openclaw/plugin-sdk/secret-file-runtime");
|
|
9
|
-
let openclaw_plugin_sdk_account_helpers = require("openclaw/plugin-sdk/account-helpers");
|
|
10
11
|
let openclaw_plugin_sdk_channel_setup = require("openclaw/plugin-sdk/channel-setup");
|
|
11
12
|
let openclaw_plugin_sdk_setup = require("openclaw/plugin-sdk/setup");
|
|
12
13
|
let openclaw_plugin_sdk_setup_tools = require("openclaw/plugin-sdk/setup-tools");
|
|
@@ -478,7 +479,7 @@ const msteamsSetupWizard = {
|
|
|
478
479
|
};
|
|
479
480
|
let oauthModule;
|
|
480
481
|
try {
|
|
481
|
-
oauthModule = await Promise.resolve().then(() => require("./oauth-
|
|
482
|
+
oauthModule = await Promise.resolve().then(() => require("./oauth-BV7HWGe0.cjs"));
|
|
482
483
|
} catch (err) {
|
|
483
484
|
await noteDelegatedAuthFailure(err);
|
|
484
485
|
return {
|
|
@@ -602,6 +603,12 @@ Object.defineProperty(exports, "isRevokedProxyError", {
|
|
|
602
603
|
return isRevokedProxyError;
|
|
603
604
|
}
|
|
604
605
|
});
|
|
606
|
+
Object.defineProperty(exports, "msteamsConfigAdapter", {
|
|
607
|
+
enumerable: true,
|
|
608
|
+
get: function() {
|
|
609
|
+
return msteamsConfigAdapter;
|
|
610
|
+
}
|
|
611
|
+
});
|
|
605
612
|
Object.defineProperty(exports, "msteamsSetupAdapter", {
|
|
606
613
|
enumerable: true,
|
|
607
614
|
get: function() {
|
|
@@ -80,18 +80,19 @@ function isAzureChinaBotFrameworkServiceUrl(value) {
|
|
|
80
80
|
return false;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
+
const { accountShape, rootPolicyShape } = (0, openclaw_plugin_sdk_channel_config_schema.buildChannelAccountSchemaParts)({
|
|
84
|
+
omit: [
|
|
85
|
+
"name",
|
|
86
|
+
"mentionPatterns",
|
|
87
|
+
"replyToMode"
|
|
88
|
+
],
|
|
89
|
+
allowFrom: zod.z.array(zod.z.string()).optional(),
|
|
90
|
+
groupAllowFrom: zod.z.array(zod.z.string()).optional(),
|
|
91
|
+
streaming: openclaw_plugin_sdk_channel_config_schema.ChannelPreviewStreamingConfigSchema.optional()
|
|
92
|
+
});
|
|
83
93
|
const MSTeamsConfigSchema = zod.z.object({
|
|
84
|
-
...
|
|
85
|
-
|
|
86
|
-
omit: [
|
|
87
|
-
"name",
|
|
88
|
-
"mentionPatterns",
|
|
89
|
-
"replyToMode"
|
|
90
|
-
],
|
|
91
|
-
allowFrom: zod.z.array(zod.z.string()).optional(),
|
|
92
|
-
groupAllowFrom: zod.z.array(zod.z.string()).optional(),
|
|
93
|
-
streaming: openclaw_plugin_sdk_channel_config_schema.ChannelPreviewStreamingConfigSchema.optional()
|
|
94
|
-
}),
|
|
94
|
+
...accountShape,
|
|
95
|
+
...rootPolicyShape,
|
|
95
96
|
dangerouslyAllowNameMatching: openclaw_plugin_sdk_channel_config_schema.ChannelDangerouslyAllowNameMatchingSchema,
|
|
96
97
|
appId: zod.z.string().optional(),
|
|
97
98
|
appPassword: (0, openclaw_plugin_sdk_secret_input.registerSensitiveConfigSchema)(SecretInputSchema.optional()),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./secret-input-C65t6kjM.cjs");
|
|
3
|
+
let openclaw_plugin_sdk_secret_input = require("openclaw/plugin-sdk/secret-input");
|
|
4
|
+
//#region extensions/msteams/configured-state.ts
|
|
5
|
+
/** Mirror Teams auth-mode requirements without loading the Azure SDK or full channel. */
|
|
6
|
+
function hasConfiguredMSTeamsChannelState(params) {
|
|
7
|
+
const config = params.cfg.channels?.msteams;
|
|
8
|
+
if (config?.enabled === false) return false;
|
|
9
|
+
const env = params.env ?? process.env;
|
|
10
|
+
const appId = (0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(config && Object.hasOwn(config, "appId") ? config.appId : env.MSTEAMS_APP_ID);
|
|
11
|
+
const tenantId = (0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(config && Object.hasOwn(config, "tenantId") ? config.tenantId : env.MSTEAMS_TENANT_ID);
|
|
12
|
+
if (!appId || !tenantId) return false;
|
|
13
|
+
if ((config?.authType ?? env.MSTEAMS_AUTH_TYPE ?? "secret") === "federated") {
|
|
14
|
+
const certificatePath = (0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(config && Object.hasOwn(config, "certificatePath") ? config.certificatePath : env.MSTEAMS_CERTIFICATE_PATH);
|
|
15
|
+
return Boolean(certificatePath || (config?.useManagedIdentity ?? env.MSTEAMS_USE_MANAGED_IDENTITY === "true"));
|
|
16
|
+
}
|
|
17
|
+
return config && Object.hasOwn(config, "appPassword") ? (0, openclaw_plugin_sdk_secret_input.hasConfiguredSecretInput)(config.appPassword) : Boolean((0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(env.MSTEAMS_APP_PASSWORD));
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.hasConfiguredMSTeamsChannelState = hasConfiguredMSTeamsChannelState;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
2
|
+
const require_resolve_allowlist = require("./resolve-allowlist-CWbvAW4v.cjs");
|
|
3
3
|
let openclaw_plugin_sdk_directory_runtime = require("openclaw/plugin-sdk/directory-runtime");
|
|
4
4
|
const msteamsDirectoryContractPlugin = {
|
|
5
5
|
id: "msteams",
|
|
@@ -11,7 +11,7 @@ node_fs_promises = require_rolldown_runtime.__toESM(node_fs_promises, 1);
|
|
|
11
11
|
let node_path = require("node:path");
|
|
12
12
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
13
13
|
let openclaw_plugin_sdk_runtime_doctor_migrations = require("openclaw/plugin-sdk/runtime-doctor-migrations");
|
|
14
|
-
//#region extensions/msteams/doctor-
|
|
14
|
+
//#region extensions/msteams/config-doctor-api.ts
|
|
15
15
|
const streamingAliasMigration = (0, openclaw_plugin_sdk_runtime_doctor_migrations.defineChannelAliasMigration)({
|
|
16
16
|
channelId: "msteams",
|
|
17
17
|
streaming: { defaultMode: "partial" }
|
|
@@ -20,6 +20,8 @@ const legacyConfigRules = streamingAliasMigration.legacyConfigRules;
|
|
|
20
20
|
function normalizeCompatibilityConfig({ cfg }) {
|
|
21
21
|
return streamingAliasMigration.normalizeChannelConfig({ cfg });
|
|
22
22
|
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region extensions/msteams/doctor-contract-api.ts
|
|
23
25
|
const LEARNINGS_NAMESPACE = "feedback-learnings";
|
|
24
26
|
const MAX_LEARNING_ENTRIES = 1e4;
|
|
25
27
|
const MSTEAMS_PLUGIN_ID = "Microsoft Teams";
|
|
@@ -165,6 +167,33 @@ function mergeLearnings(legacy, existing) {
|
|
|
165
167
|
}
|
|
166
168
|
return merged.slice(-10);
|
|
167
169
|
}
|
|
170
|
+
async function completeLegacyKeyedImport(params) {
|
|
171
|
+
const { filePath, label, imported, warnings } = params;
|
|
172
|
+
const changes = [];
|
|
173
|
+
let missing = 0;
|
|
174
|
+
for (const { store, requiredKeys } of params.stores) {
|
|
175
|
+
const retainedKeys = new Set((await store.entries()).map((entry) => entry.key));
|
|
176
|
+
missing += [...requiredKeys].filter((key) => !retainedKeys.has(key)).length;
|
|
177
|
+
}
|
|
178
|
+
if (missing > 0) {
|
|
179
|
+
warnings.push(`Incomplete ${label} migration: plugin state failed to retain every required entry (${missing} missing); left legacy source in place`);
|
|
180
|
+
return {
|
|
181
|
+
changes,
|
|
182
|
+
warnings
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
changes.push(`Migrated ${imported} ${label} ${imported === 1 ? "entry" : "entries"} -> plugin state`);
|
|
186
|
+
await (0, openclaw_plugin_sdk_runtime_doctor_migrations.archiveLegacyStateSource)({
|
|
187
|
+
filePath,
|
|
188
|
+
label: params.archiveLabel ?? label,
|
|
189
|
+
changes,
|
|
190
|
+
warnings
|
|
191
|
+
});
|
|
192
|
+
return {
|
|
193
|
+
changes,
|
|
194
|
+
warnings
|
|
195
|
+
};
|
|
196
|
+
}
|
|
168
197
|
const stateMigrations = [
|
|
169
198
|
{
|
|
170
199
|
id: "msteams-conversations-json-to-plugin-state",
|
|
@@ -175,35 +204,36 @@ const stateMigrations = [
|
|
|
175
204
|
return { preview: [`- ${MSTEAMS_PLUGIN_ID} conversations: ${Object.keys(state.conversations).length} entries -> plugin state (${require_polls.MSTEAMS_CONVERSATIONS_NAMESPACE})`] };
|
|
176
205
|
},
|
|
177
206
|
async migrateLegacyState(params) {
|
|
178
|
-
const changes = [];
|
|
179
|
-
const warnings = [];
|
|
180
207
|
const filePath = resolveStateFilePath(params.stateDir, require_polls.MSTEAMS_CONVERSATIONS_LEGACY_FILENAME);
|
|
181
208
|
const state = await readLegacyJsonFile(filePath, parseLegacyConversationStore);
|
|
182
209
|
if (!state) return {
|
|
183
|
-
changes,
|
|
184
|
-
warnings
|
|
210
|
+
changes: [],
|
|
211
|
+
warnings: []
|
|
185
212
|
};
|
|
186
213
|
const store = params.context.openPluginStateKeyedStore({
|
|
187
214
|
namespace: require_polls.MSTEAMS_CONVERSATIONS_NAMESPACE,
|
|
188
215
|
maxEntries: require_polls.MSTEAMS_SQLITE_MAX_CONVERSATION_ROWS
|
|
189
216
|
});
|
|
217
|
+
const requiredKeys = new Set((await store.entries()).map((entry) => entry.key));
|
|
190
218
|
let imported = 0;
|
|
191
219
|
for (const [rawConversationId, reference] of require_polls.selectRetainedMSTeamsConversations(state.conversations)) {
|
|
192
220
|
const conversationId = require_polls.normalizeStoredConversationId(rawConversationId);
|
|
193
221
|
if (!conversationId) continue;
|
|
194
|
-
|
|
222
|
+
const key = require_polls.buildMSTeamsConversationStateKey(conversationId);
|
|
223
|
+
requiredKeys.add(key);
|
|
224
|
+
const storedReference = require_polls.prepareMSTeamsConversationReferenceForStorage(conversationId, reference);
|
|
225
|
+
if (await store.registerIfAbsent(key, storedReference)) imported++;
|
|
195
226
|
}
|
|
196
|
-
|
|
197
|
-
await (0, openclaw_plugin_sdk_runtime_doctor_migrations.archiveLegacyStateSource)({
|
|
227
|
+
return completeLegacyKeyedImport({
|
|
198
228
|
filePath,
|
|
199
229
|
label: `${MSTEAMS_PLUGIN_ID} conversation`,
|
|
200
|
-
|
|
201
|
-
warnings
|
|
230
|
+
imported,
|
|
231
|
+
warnings: [],
|
|
232
|
+
stores: [{
|
|
233
|
+
store,
|
|
234
|
+
requiredKeys
|
|
235
|
+
}]
|
|
202
236
|
});
|
|
203
|
-
return {
|
|
204
|
-
changes,
|
|
205
|
-
warnings
|
|
206
|
-
};
|
|
207
237
|
}
|
|
208
238
|
},
|
|
209
239
|
{
|
|
@@ -215,13 +245,11 @@ const stateMigrations = [
|
|
|
215
245
|
return { preview: [`- ${MSTEAMS_PLUGIN_ID} polls: ${Object.keys(state.polls).length} entries -> plugin state (${require_polls.MSTEAMS_POLLS_NAMESPACE})`] };
|
|
216
246
|
},
|
|
217
247
|
async migrateLegacyState(params) {
|
|
218
|
-
const changes = [];
|
|
219
|
-
const warnings = [];
|
|
220
248
|
const filePath = resolveStateFilePath(params.stateDir, require_polls.MSTEAMS_POLLS_LEGACY_FILENAME);
|
|
221
249
|
const state = await readLegacyJsonFile(filePath, parseLegacyPollStore);
|
|
222
250
|
if (!state) return {
|
|
223
|
-
changes,
|
|
224
|
-
warnings
|
|
251
|
+
changes: [],
|
|
252
|
+
warnings: []
|
|
225
253
|
};
|
|
226
254
|
const pollStore = params.context.openPluginStateKeyedStore({
|
|
227
255
|
namespace: require_polls.MSTEAMS_POLLS_NAMESPACE,
|
|
@@ -231,10 +259,14 @@ const stateMigrations = [
|
|
|
231
259
|
namespace: require_polls.MSTEAMS_POLL_VOTE_BUCKETS_NAMESPACE,
|
|
232
260
|
maxEntries: require_polls.MSTEAMS_MAX_POLL_VOTE_BUCKET_ROWS
|
|
233
261
|
});
|
|
262
|
+
const requiredPollKeys = new Set((await pollStore.entries()).map((entry) => entry.key));
|
|
263
|
+
const requiredVoteKeys = new Set((await voteBucketStore.entries()).map((entry) => entry.key));
|
|
234
264
|
let imported = 0;
|
|
235
265
|
for (const [pollId, poll] of require_polls.selectRetainedMSTeamsPolls(state.polls)) {
|
|
236
266
|
const { metadata, votes } = require_polls.splitMSTeamsPoll(poll);
|
|
237
|
-
const
|
|
267
|
+
const pollKey = require_polls.buildMSTeamsPollStateKey(pollId);
|
|
268
|
+
requiredPollKeys.add(pollKey);
|
|
269
|
+
const didImportPoll = await pollStore.registerIfAbsent(pollKey, metadata);
|
|
238
270
|
const buckets = /* @__PURE__ */ new Map();
|
|
239
271
|
for (const [voterId, selections] of Object.entries(votes)) {
|
|
240
272
|
const bucket = require_polls.selectMSTeamsPollVoteBucket(pollId, voterId);
|
|
@@ -245,6 +277,7 @@ const stateMigrations = [
|
|
|
245
277
|
let importedVoteBucket = false;
|
|
246
278
|
for (const [bucket, bucketVotes] of buckets) {
|
|
247
279
|
const key = require_polls.buildMSTeamsPollVoteBucketKey(pollId, bucket);
|
|
280
|
+
requiredVoteKeys.add(key);
|
|
248
281
|
const existing = await voteBucketStore.lookup(key);
|
|
249
282
|
await voteBucketStore.register(key, {
|
|
250
283
|
pollId,
|
|
@@ -259,17 +292,19 @@ const stateMigrations = [
|
|
|
259
292
|
}
|
|
260
293
|
if (didImportPoll || importedVoteBucket) imported++;
|
|
261
294
|
}
|
|
262
|
-
|
|
263
|
-
await (0, openclaw_plugin_sdk_runtime_doctor_migrations.archiveLegacyStateSource)({
|
|
295
|
+
return completeLegacyKeyedImport({
|
|
264
296
|
filePath,
|
|
265
297
|
label: `${MSTEAMS_PLUGIN_ID} poll`,
|
|
266
|
-
|
|
267
|
-
warnings
|
|
298
|
+
imported,
|
|
299
|
+
warnings: [],
|
|
300
|
+
stores: [{
|
|
301
|
+
store: pollStore,
|
|
302
|
+
requiredKeys: requiredPollKeys
|
|
303
|
+
}, {
|
|
304
|
+
store: voteBucketStore,
|
|
305
|
+
requiredKeys: requiredVoteKeys
|
|
306
|
+
}]
|
|
268
307
|
});
|
|
269
|
-
return {
|
|
270
|
-
changes,
|
|
271
|
-
warnings
|
|
272
|
-
};
|
|
273
308
|
}
|
|
274
309
|
},
|
|
275
310
|
{
|
|
@@ -281,18 +316,18 @@ const stateMigrations = [
|
|
|
281
316
|
return { preview: [`- ${MSTEAMS_PLUGIN_ID} SSO tokens: ${Object.keys(state.tokens).length} entries -> plugin state (${require_sso_token_store.MSTEAMS_SSO_TOKENS_NAMESPACE})`] };
|
|
282
317
|
},
|
|
283
318
|
async migrateLegacyState(params) {
|
|
284
|
-
const changes = [];
|
|
285
319
|
const warnings = [];
|
|
286
320
|
const filePath = resolveStateFilePath(params.stateDir, require_sso_token_store.MSTEAMS_SSO_TOKENS_LEGACY_FILENAME);
|
|
287
321
|
const state = await readLegacyJsonFile(filePath, (value) => require_sso_token_store.isMSTeamsSsoStoreData(value) ? value : null);
|
|
288
322
|
if (!state) return {
|
|
289
|
-
changes,
|
|
323
|
+
changes: [],
|
|
290
324
|
warnings
|
|
291
325
|
};
|
|
292
326
|
const store = params.context.openPluginStateKeyedStore({
|
|
293
327
|
namespace: require_sso_token_store.MSTEAMS_SSO_TOKENS_NAMESPACE,
|
|
294
328
|
maxEntries: require_sso_token_store.MSTEAMS_MAX_SSO_TOKENS
|
|
295
329
|
});
|
|
330
|
+
const requiredKeys = new Set((await store.entries()).map((entry) => entry.key));
|
|
296
331
|
let imported = 0;
|
|
297
332
|
let skipped = 0;
|
|
298
333
|
for (const token of Object.values(state.tokens)) {
|
|
@@ -301,20 +336,22 @@ const stateMigrations = [
|
|
|
301
336
|
skipped++;
|
|
302
337
|
continue;
|
|
303
338
|
}
|
|
304
|
-
|
|
339
|
+
const key = require_sso_token_store.makeMSTeamsSsoTokenStoreKey(normalized.connectionName, normalized.userId);
|
|
340
|
+
requiredKeys.add(key);
|
|
341
|
+
if (await store.registerIfAbsent(key, normalized)) imported++;
|
|
305
342
|
}
|
|
306
|
-
changes.push(`Migrated ${imported} ${MSTEAMS_PLUGIN_ID} SSO token ${imported === 1 ? "entry" : "entries"} -> plugin state`);
|
|
307
343
|
if (skipped > 0) warnings.push(`Skipped ${skipped} malformed ${MSTEAMS_PLUGIN_ID} SSO token ${skipped === 1 ? "entry" : "entries"} during migration`);
|
|
308
|
-
|
|
344
|
+
return completeLegacyKeyedImport({
|
|
309
345
|
filePath,
|
|
310
|
-
label: `${MSTEAMS_PLUGIN_ID} SSO
|
|
311
|
-
|
|
312
|
-
|
|
346
|
+
label: `${MSTEAMS_PLUGIN_ID} SSO token`,
|
|
347
|
+
archiveLabel: `${MSTEAMS_PLUGIN_ID} SSO-token`,
|
|
348
|
+
imported,
|
|
349
|
+
warnings,
|
|
350
|
+
stores: [{
|
|
351
|
+
store,
|
|
352
|
+
requiredKeys
|
|
353
|
+
}]
|
|
313
354
|
});
|
|
314
|
-
return {
|
|
315
|
-
changes,
|
|
316
|
-
warnings
|
|
317
|
-
};
|
|
318
355
|
}
|
|
319
356
|
},
|
|
320
357
|
{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-D6vf50IK.cjs");
|
|
2
2
|
const require_runtime = require("./runtime-gZTAuFux.cjs");
|
|
3
3
|
require("./runtime-api.cjs");
|
|
4
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
5
|
-
const require_channel_setup = require("./channel.setup-
|
|
4
|
+
const require_resolve_allowlist = require("./resolve-allowlist-CWbvAW4v.cjs");
|
|
5
|
+
const require_channel_setup = require("./channel.setup-CKb8aKCV.cjs");
|
|
6
6
|
const require_polls = require("./polls-DvuJvaDG.cjs");
|
|
7
7
|
let openclaw_plugin_sdk_lazy_runtime = require("openclaw/plugin-sdk/lazy-runtime");
|
|
8
8
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
@@ -12,123 +12,17 @@ let openclaw_plugin_sdk_text_chunking = require("openclaw/plugin-sdk/text-chunki
|
|
|
12
12
|
let node_dns_promises = require("node:dns/promises");
|
|
13
13
|
let openclaw_plugin_sdk_ssrf_policy = require("openclaw/plugin-sdk/ssrf-policy");
|
|
14
14
|
let openclaw_plugin_sdk_text_utility_runtime = require("openclaw/plugin-sdk/text-utility-runtime");
|
|
15
|
-
let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
|
|
16
15
|
let openclaw_plugin_sdk_retry_runtime = require("openclaw/plugin-sdk/retry-runtime");
|
|
17
16
|
let node_crypto = require("node:crypto");
|
|
18
17
|
node_crypto = require_rolldown_runtime.__toESM(node_crypto, 1);
|
|
19
18
|
let node_path = require("node:path");
|
|
20
19
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
20
|
+
let openclaw_plugin_sdk_runtime_env = require("openclaw/plugin-sdk/runtime-env");
|
|
21
21
|
let openclaw_plugin_sdk_global_singleton = require("openclaw/plugin-sdk/global-singleton");
|
|
22
22
|
let openclaw_plugin_sdk_error_runtime = require("openclaw/plugin-sdk/error-runtime");
|
|
23
23
|
let openclaw_plugin_sdk_reply_chunking = require("openclaw/plugin-sdk/reply-chunking");
|
|
24
|
-
let openclaw_plugin_sdk_runtime_env = require("openclaw/plugin-sdk/runtime-env");
|
|
25
24
|
let openclaw_plugin_sdk_web_media = require("openclaw/plugin-sdk/web-media");
|
|
26
25
|
let openclaw_plugin_sdk_media_runtime = require("openclaw/plugin-sdk/media-runtime");
|
|
27
|
-
//#region extensions/msteams/src/graph-thread.ts
|
|
28
|
-
/**
|
|
29
|
-
* Strip HTML tags from Teams message content, preserving @mention display names.
|
|
30
|
-
* Teams wraps mentions in <at>Name</at> tags.
|
|
31
|
-
*/
|
|
32
|
-
function stripHtmlFromTeamsMessage(html) {
|
|
33
|
-
let text = html.replace(/<at[^>]*>(.*?)<\/at>/gi, "@$1");
|
|
34
|
-
text = text.replace(/<[^>]*>/g, " ");
|
|
35
|
-
text = (0, openclaw_plugin_sdk_html_entity_runtime.decodeHtmlEntities)(text).replaceAll("\xA0", " ");
|
|
36
|
-
return text.replace(/\s+/g, " ").trim();
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Fetch a single channel message (the parent/root of a thread).
|
|
40
|
-
* Returns undefined on error so callers can degrade gracefully.
|
|
41
|
-
*/
|
|
42
|
-
async function fetchChannelMessage(token, groupId, channelId, messageId, deadline) {
|
|
43
|
-
const path = `/teams/${encodeURIComponent(groupId)}/channels/${encodeURIComponent(channelId)}/messages/${encodeURIComponent(messageId)}?$select=id,from,body,createdDateTime`;
|
|
44
|
-
try {
|
|
45
|
-
return await require_resolve_allowlist.fetchGraphJson({
|
|
46
|
-
token,
|
|
47
|
-
path,
|
|
48
|
-
...deadline ? { deadline } : {}
|
|
49
|
-
});
|
|
50
|
-
} catch {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Fetch a single chat message's full text via Graph and return plain text.
|
|
56
|
-
*
|
|
57
|
-
* Used to recover the complete quoted message for Teams quote replies: the
|
|
58
|
-
* inbound blockquote only carries a Teams-truncated `preview` snippet. The
|
|
59
|
-
* app-only `GET /chats/{chatId}/messages/{messageId}` endpoint IS permitted
|
|
60
|
-
* with the `Chat.Read.All` application permission.
|
|
61
|
-
*
|
|
62
|
-
* Returns undefined on any failure so callers degrade to the truncated preview.
|
|
63
|
-
*/
|
|
64
|
-
async function fetchChatMessageText(token, chatId, messageId, deadline) {
|
|
65
|
-
const path = `/chats/${encodeURIComponent(chatId)}/messages/${encodeURIComponent(messageId)}`;
|
|
66
|
-
try {
|
|
67
|
-
const msg = await require_resolve_allowlist.fetchGraphJson({
|
|
68
|
-
token,
|
|
69
|
-
path,
|
|
70
|
-
...deadline ? { deadline } : {}
|
|
71
|
-
});
|
|
72
|
-
const raw = msg.body?.content ?? "";
|
|
73
|
-
return (msg.body?.contentType === "html" ? stripHtmlFromTeamsMessage(raw) : raw.trim()) || void 0;
|
|
74
|
-
} catch {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Fetch thread replies for a channel message, ordered chronologically.
|
|
80
|
-
*
|
|
81
|
-
* **Limitation:** The Graph API replies endpoint (`/messages/{id}/replies`) does not
|
|
82
|
-
* support `$orderby`, so results are always returned in ascending (oldest-first) order.
|
|
83
|
-
* Combined with the `$top` cap of 50, this means only the **oldest 50 replies** are
|
|
84
|
-
* returned for long threads — newer replies are silently omitted. There is currently no
|
|
85
|
-
* Graph API workaround for this; pagination via `@odata.nextLink` can retrieve more
|
|
86
|
-
* replies but still in ascending order only.
|
|
87
|
-
*/
|
|
88
|
-
async function fetchThreadReplies(token, groupId, channelId, messageId, limit = 50, deadline) {
|
|
89
|
-
return (await require_resolve_allowlist.fetchGraphJson({
|
|
90
|
-
token,
|
|
91
|
-
path: `/teams/${encodeURIComponent(groupId)}/channels/${encodeURIComponent(channelId)}/messages/${encodeURIComponent(messageId)}/replies?$top=${Math.min(Math.max(limit, 1), 50)}&$select=id,from,body,createdDateTime`,
|
|
92
|
-
...deadline ? { deadline } : {}
|
|
93
|
-
})).value ?? [];
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Format thread messages into a context string for the agent.
|
|
97
|
-
* Skips the current message (by id) and blank messages.
|
|
98
|
-
*/
|
|
99
|
-
function formatThreadContext(messages, currentMessageId) {
|
|
100
|
-
const lines = [];
|
|
101
|
-
for (const msg of messages) {
|
|
102
|
-
if (msg.id && msg.id === currentMessageId) continue;
|
|
103
|
-
const sender = msg.from?.user?.displayName ?? msg.from?.application?.displayName ?? "unknown";
|
|
104
|
-
const contentType = msg.body?.contentType ?? "text";
|
|
105
|
-
const rawContent = msg.body?.content ?? "";
|
|
106
|
-
const content = contentType === "html" ? stripHtmlFromTeamsMessage(rawContent) : rawContent.trim();
|
|
107
|
-
if (!content) continue;
|
|
108
|
-
lines.push(`${sender}: ${content}`);
|
|
109
|
-
}
|
|
110
|
-
return lines.join("\n");
|
|
111
|
-
}
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region extensions/msteams/src/reaction-types.ts
|
|
114
|
-
const TEAMS_REACTION_EMOJI = {
|
|
115
|
-
like: "👍",
|
|
116
|
-
heart: "❤️",
|
|
117
|
-
laugh: "😆",
|
|
118
|
-
surprised: "😮",
|
|
119
|
-
sad: "😢",
|
|
120
|
-
angry: "😡"
|
|
121
|
-
};
|
|
122
|
-
const TEAMS_REACTION_TYPES = Object.keys(TEAMS_REACTION_EMOJI);
|
|
123
|
-
function getMSTeamsReactionEmoji(raw) {
|
|
124
|
-
return TEAMS_REACTION_EMOJI[raw.trim().toLowerCase()];
|
|
125
|
-
}
|
|
126
|
-
function resolveMSTeamsReactionEmoji(raw) {
|
|
127
|
-
const normalized = raw.trim();
|
|
128
|
-
if (!normalized) throw new Error(`Reaction type is required. Common types: ${TEAMS_REACTION_TYPES.join(", ")}`);
|
|
129
|
-
return getMSTeamsReactionEmoji(normalized) ?? normalized;
|
|
130
|
-
}
|
|
131
|
-
//#endregion
|
|
132
26
|
//#region extensions/msteams/src/file-consent.ts
|
|
133
27
|
/**
|
|
134
28
|
* FileConsentCard utilities for MS Teams large file uploads (>4MB) in personal chats.
|
|
@@ -1394,10 +1288,9 @@ async function withRevokedProxyFallback(params) {
|
|
|
1394
1288
|
}
|
|
1395
1289
|
//#endregion
|
|
1396
1290
|
//#region extensions/msteams/src/sdk-proactive.ts
|
|
1397
|
-
const
|
|
1398
|
-
const loadMSTeamsQuoteModule = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeModule)(() => import("@microsoft/teams.api/dist/activities/message/message.js").then((message) => ({ MessageActivityInput: message.MessageActivityInput })));
|
|
1291
|
+
const loadMSTeamsApiModule = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeModule)(() => import("@microsoft/teams.api"));
|
|
1399
1292
|
async function quoteMSTeamsActivity(activity, messageId) {
|
|
1400
|
-
const { MessageActivityInput } = await
|
|
1293
|
+
const { MessageActivityInput } = await loadMSTeamsApiModule();
|
|
1401
1294
|
if (typeof activity === "string") return new MessageActivityInput(activity).prependQuote(messageId);
|
|
1402
1295
|
if (activity.type !== "message") return activity;
|
|
1403
1296
|
return MessageActivityInput.from(activity).prependQuote(messageId);
|
|
@@ -1466,7 +1359,7 @@ async function getApiClientForReference(app, ref) {
|
|
|
1466
1359
|
const appInternals = app;
|
|
1467
1360
|
const httpClient = appInternals.api?.http ?? appInternals.client;
|
|
1468
1361
|
if (!httpClient) return api;
|
|
1469
|
-
const { Client } = await
|
|
1362
|
+
const { Client } = await loadMSTeamsApiModule();
|
|
1470
1363
|
return new Client(ref.serviceUrl, httpClient);
|
|
1471
1364
|
}
|
|
1472
1365
|
function mergeReferenceIntoActivity(activity, ref) {
|
|
@@ -1747,13 +1640,14 @@ async function sendMSTeamsMessages(params) {
|
|
|
1747
1640
|
};
|
|
1748
1641
|
let providerDispatchStarted = false;
|
|
1749
1642
|
const sendMessageInContext = async (sendFn, message, messageIndex) => {
|
|
1643
|
+
let activity;
|
|
1750
1644
|
let pendingUploadId;
|
|
1751
1645
|
let response;
|
|
1752
1646
|
try {
|
|
1753
1647
|
response = await sendWithRetry(async () => {
|
|
1754
|
-
|
|
1755
|
-
pendingUploadId
|
|
1756
|
-
|
|
1648
|
+
activity ??= await buildActivity(message, params.conversationRef, params.tokenProvider, params.sharePointSiteId, params.mediaMaxBytes, { feedbackLoopEnabled: params.feedbackLoopEnabled });
|
|
1649
|
+
pendingUploadId ??= typeof activity["_pendingUploadId"] === "string" ? activity["_pendingUploadId"] : void 0;
|
|
1650
|
+
delete activity["_pendingUploadId"];
|
|
1757
1651
|
providerDispatchStarted = true;
|
|
1758
1652
|
return await sendFn(activity);
|
|
1759
1653
|
}, {
|
|
@@ -1852,48 +1746,18 @@ Object.defineProperty(exports, "extractMessageId", {
|
|
|
1852
1746
|
return extractMessageId;
|
|
1853
1747
|
}
|
|
1854
1748
|
});
|
|
1855
|
-
Object.defineProperty(exports, "fetchChannelMessage", {
|
|
1856
|
-
enumerable: true,
|
|
1857
|
-
get: function() {
|
|
1858
|
-
return fetchChannelMessage;
|
|
1859
|
-
}
|
|
1860
|
-
});
|
|
1861
|
-
Object.defineProperty(exports, "fetchChatMessageText", {
|
|
1862
|
-
enumerable: true,
|
|
1863
|
-
get: function() {
|
|
1864
|
-
return fetchChatMessageText;
|
|
1865
|
-
}
|
|
1866
|
-
});
|
|
1867
|
-
Object.defineProperty(exports, "fetchThreadReplies", {
|
|
1868
|
-
enumerable: true,
|
|
1869
|
-
get: function() {
|
|
1870
|
-
return fetchThreadReplies;
|
|
1871
|
-
}
|
|
1872
|
-
});
|
|
1873
1749
|
Object.defineProperty(exports, "formatMSTeamsMarkdown", {
|
|
1874
1750
|
enumerable: true,
|
|
1875
1751
|
get: function() {
|
|
1876
1752
|
return formatMSTeamsMarkdown;
|
|
1877
1753
|
}
|
|
1878
1754
|
});
|
|
1879
|
-
Object.defineProperty(exports, "formatThreadContext", {
|
|
1880
|
-
enumerable: true,
|
|
1881
|
-
get: function() {
|
|
1882
|
-
return formatThreadContext;
|
|
1883
|
-
}
|
|
1884
|
-
});
|
|
1885
1755
|
Object.defineProperty(exports, "getDriveItemProperties", {
|
|
1886
1756
|
enumerable: true,
|
|
1887
1757
|
get: function() {
|
|
1888
1758
|
return getDriveItemProperties;
|
|
1889
1759
|
}
|
|
1890
1760
|
});
|
|
1891
|
-
Object.defineProperty(exports, "getMSTeamsReactionEmoji", {
|
|
1892
|
-
enumerable: true,
|
|
1893
|
-
get: function() {
|
|
1894
|
-
return getMSTeamsReactionEmoji;
|
|
1895
|
-
}
|
|
1896
|
-
});
|
|
1897
1761
|
Object.defineProperty(exports, "getPendingUpload", {
|
|
1898
1762
|
enumerable: true,
|
|
1899
1763
|
get: function() {
|
|
@@ -1948,12 +1812,6 @@ Object.defineProperty(exports, "requiresFileConsent", {
|
|
|
1948
1812
|
return requiresFileConsent;
|
|
1949
1813
|
}
|
|
1950
1814
|
});
|
|
1951
|
-
Object.defineProperty(exports, "resolveMSTeamsReactionEmoji", {
|
|
1952
|
-
enumerable: true,
|
|
1953
|
-
get: function() {
|
|
1954
|
-
return resolveMSTeamsReactionEmoji;
|
|
1955
|
-
}
|
|
1956
|
-
});
|
|
1957
1815
|
Object.defineProperty(exports, "sendMSTeamsActivityWithReference", {
|
|
1958
1816
|
enumerable: true,
|
|
1959
1817
|
get: function() {
|
|
@@ -1978,12 +1836,6 @@ Object.defineProperty(exports, "setPendingUploadActivityIdFs", {
|
|
|
1978
1836
|
return setPendingUploadActivityIdFs;
|
|
1979
1837
|
}
|
|
1980
1838
|
});
|
|
1981
|
-
Object.defineProperty(exports, "stripHtmlFromTeamsMessage", {
|
|
1982
|
-
enumerable: true,
|
|
1983
|
-
get: function() {
|
|
1984
|
-
return stripHtmlFromTeamsMessage;
|
|
1985
|
-
}
|
|
1986
|
-
});
|
|
1987
1839
|
Object.defineProperty(exports, "updateMSTeamsActivityWithReference", {
|
|
1988
1840
|
enumerable: true,
|
|
1989
1841
|
get: function() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
1
|
+
const require_resolve_allowlist = require("./resolve-allowlist-CWbvAW4v.cjs");
|
|
2
2
|
let openclaw_plugin_sdk_runtime_env = require("openclaw/plugin-sdk/runtime-env");
|
|
3
3
|
let openclaw_plugin_sdk_provider_auth = require("openclaw/plugin-sdk/provider-auth");
|
|
4
4
|
let openclaw_plugin_sdk_provider_auth_runtime = require("openclaw/plugin-sdk/provider-auth-runtime");
|