@openclaw/msteams 2026.2.14 → 2026.2.15
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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/channel.ts +4 -13
- package/src/onboarding.ts +29 -54
- package/src/policy.ts +2 -18
- package/src/probe.ts +2 -4
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/channel.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ChannelMessageActionName, ChannelPlugin, OpenClawConfig } from "openclaw/plugin-sdk";
|
|
2
2
|
import {
|
|
3
|
+
buildBaseChannelStatusSummary,
|
|
3
4
|
buildChannelConfigSchema,
|
|
5
|
+
createDefaultChannelRuntimeState,
|
|
4
6
|
DEFAULT_ACCOUNT_ID,
|
|
5
7
|
MSTeamsConfigSchema,
|
|
6
8
|
PAIRING_APPROVED_MESSAGE,
|
|
@@ -415,20 +417,9 @@ export const msteamsPlugin: ChannelPlugin<ResolvedMSTeamsAccount> = {
|
|
|
415
417
|
},
|
|
416
418
|
outbound: msteamsOutbound,
|
|
417
419
|
status: {
|
|
418
|
-
defaultRuntime: {
|
|
419
|
-
accountId: DEFAULT_ACCOUNT_ID,
|
|
420
|
-
running: false,
|
|
421
|
-
lastStartAt: null,
|
|
422
|
-
lastStopAt: null,
|
|
423
|
-
lastError: null,
|
|
424
|
-
port: null,
|
|
425
|
-
},
|
|
420
|
+
defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID, { port: null }),
|
|
426
421
|
buildChannelSummary: ({ snapshot }) => ({
|
|
427
|
-
|
|
428
|
-
running: snapshot.running ?? false,
|
|
429
|
-
lastStartAt: snapshot.lastStartAt ?? null,
|
|
430
|
-
lastStopAt: snapshot.lastStopAt ?? null,
|
|
431
|
-
lastError: snapshot.lastError ?? null,
|
|
422
|
+
...buildBaseChannelStatusSummary(snapshot),
|
|
432
423
|
port: snapshot.port ?? null,
|
|
433
424
|
probe: snapshot.probe,
|
|
434
425
|
lastProbeAt: snapshot.lastProbeAt ?? null,
|
package/src/onboarding.ts
CHANGED
|
@@ -63,6 +63,32 @@ function looksLikeGuid(value: string): boolean {
|
|
|
63
63
|
return /^[0-9a-fA-F-]{16,}$/.test(value);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
async function promptMSTeamsCredentials(prompter: WizardPrompter): Promise<{
|
|
67
|
+
appId: string;
|
|
68
|
+
appPassword: string;
|
|
69
|
+
tenantId: string;
|
|
70
|
+
}> {
|
|
71
|
+
const appId = String(
|
|
72
|
+
await prompter.text({
|
|
73
|
+
message: "Enter MS Teams App ID",
|
|
74
|
+
validate: (value) => (value?.trim() ? undefined : "Required"),
|
|
75
|
+
}),
|
|
76
|
+
).trim();
|
|
77
|
+
const appPassword = String(
|
|
78
|
+
await prompter.text({
|
|
79
|
+
message: "Enter MS Teams App Password",
|
|
80
|
+
validate: (value) => (value?.trim() ? undefined : "Required"),
|
|
81
|
+
}),
|
|
82
|
+
).trim();
|
|
83
|
+
const tenantId = String(
|
|
84
|
+
await prompter.text({
|
|
85
|
+
message: "Enter MS Teams Tenant ID",
|
|
86
|
+
validate: (value) => (value?.trim() ? undefined : "Required"),
|
|
87
|
+
}),
|
|
88
|
+
).trim();
|
|
89
|
+
return { appId, appPassword, tenantId };
|
|
90
|
+
}
|
|
91
|
+
|
|
66
92
|
async function promptMSTeamsAllowFrom(params: {
|
|
67
93
|
cfg: OpenClawConfig;
|
|
68
94
|
prompter: WizardPrompter;
|
|
@@ -251,24 +277,7 @@ export const msteamsOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
251
277
|
},
|
|
252
278
|
};
|
|
253
279
|
} else {
|
|
254
|
-
appId =
|
|
255
|
-
await prompter.text({
|
|
256
|
-
message: "Enter MS Teams App ID",
|
|
257
|
-
validate: (value) => (value?.trim() ? undefined : "Required"),
|
|
258
|
-
}),
|
|
259
|
-
).trim();
|
|
260
|
-
appPassword = String(
|
|
261
|
-
await prompter.text({
|
|
262
|
-
message: "Enter MS Teams App Password",
|
|
263
|
-
validate: (value) => (value?.trim() ? undefined : "Required"),
|
|
264
|
-
}),
|
|
265
|
-
).trim();
|
|
266
|
-
tenantId = String(
|
|
267
|
-
await prompter.text({
|
|
268
|
-
message: "Enter MS Teams Tenant ID",
|
|
269
|
-
validate: (value) => (value?.trim() ? undefined : "Required"),
|
|
270
|
-
}),
|
|
271
|
-
).trim();
|
|
280
|
+
({ appId, appPassword, tenantId } = await promptMSTeamsCredentials(prompter));
|
|
272
281
|
}
|
|
273
282
|
} else if (hasConfigCreds) {
|
|
274
283
|
const keep = await prompter.confirm({
|
|
@@ -276,44 +285,10 @@ export const msteamsOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
276
285
|
initialValue: true,
|
|
277
286
|
});
|
|
278
287
|
if (!keep) {
|
|
279
|
-
appId =
|
|
280
|
-
await prompter.text({
|
|
281
|
-
message: "Enter MS Teams App ID",
|
|
282
|
-
validate: (value) => (value?.trim() ? undefined : "Required"),
|
|
283
|
-
}),
|
|
284
|
-
).trim();
|
|
285
|
-
appPassword = String(
|
|
286
|
-
await prompter.text({
|
|
287
|
-
message: "Enter MS Teams App Password",
|
|
288
|
-
validate: (value) => (value?.trim() ? undefined : "Required"),
|
|
289
|
-
}),
|
|
290
|
-
).trim();
|
|
291
|
-
tenantId = String(
|
|
292
|
-
await prompter.text({
|
|
293
|
-
message: "Enter MS Teams Tenant ID",
|
|
294
|
-
validate: (value) => (value?.trim() ? undefined : "Required"),
|
|
295
|
-
}),
|
|
296
|
-
).trim();
|
|
288
|
+
({ appId, appPassword, tenantId } = await promptMSTeamsCredentials(prompter));
|
|
297
289
|
}
|
|
298
290
|
} else {
|
|
299
|
-
appId =
|
|
300
|
-
await prompter.text({
|
|
301
|
-
message: "Enter MS Teams App ID",
|
|
302
|
-
validate: (value) => (value?.trim() ? undefined : "Required"),
|
|
303
|
-
}),
|
|
304
|
-
).trim();
|
|
305
|
-
appPassword = String(
|
|
306
|
-
await prompter.text({
|
|
307
|
-
message: "Enter MS Teams App Password",
|
|
308
|
-
validate: (value) => (value?.trim() ? undefined : "Required"),
|
|
309
|
-
}),
|
|
310
|
-
).trim();
|
|
311
|
-
tenantId = String(
|
|
312
|
-
await prompter.text({
|
|
313
|
-
message: "Enter MS Teams Tenant ID",
|
|
314
|
-
validate: (value) => (value?.trim() ? undefined : "Required"),
|
|
315
|
-
}),
|
|
316
|
-
).trim();
|
|
291
|
+
({ appId, appPassword, tenantId } = await promptMSTeamsCredentials(prompter));
|
|
317
292
|
}
|
|
318
293
|
|
|
319
294
|
if (appId && appPassword && tenantId) {
|
package/src/policy.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
import {
|
|
12
12
|
buildChannelKeyCandidates,
|
|
13
13
|
normalizeChannelSlug,
|
|
14
|
+
resolveAllowlistMatchSimple,
|
|
14
15
|
resolveToolsBySender,
|
|
15
16
|
resolveChannelEntryMatchWithFallback,
|
|
16
17
|
resolveNestedAllowlistDecision,
|
|
@@ -209,24 +210,7 @@ export function resolveMSTeamsAllowlistMatch(params: {
|
|
|
209
210
|
senderId: string;
|
|
210
211
|
senderName?: string | null;
|
|
211
212
|
}): MSTeamsAllowlistMatch {
|
|
212
|
-
|
|
213
|
-
.map((entry) => String(entry).trim().toLowerCase())
|
|
214
|
-
.filter(Boolean);
|
|
215
|
-
if (allowFrom.length === 0) {
|
|
216
|
-
return { allowed: false };
|
|
217
|
-
}
|
|
218
|
-
if (allowFrom.includes("*")) {
|
|
219
|
-
return { allowed: true, matchKey: "*", matchSource: "wildcard" };
|
|
220
|
-
}
|
|
221
|
-
const senderId = params.senderId.toLowerCase();
|
|
222
|
-
if (allowFrom.includes(senderId)) {
|
|
223
|
-
return { allowed: true, matchKey: senderId, matchSource: "id" };
|
|
224
|
-
}
|
|
225
|
-
const senderName = params.senderName?.toLowerCase();
|
|
226
|
-
if (senderName && allowFrom.includes(senderName)) {
|
|
227
|
-
return { allowed: true, matchKey: senderName, matchSource: "name" };
|
|
228
|
-
}
|
|
229
|
-
return { allowed: false };
|
|
213
|
+
return resolveAllowlistMatchSimple(params);
|
|
230
214
|
}
|
|
231
215
|
|
|
232
216
|
export function resolveMSTeamsReplyPolicy(params: {
|
package/src/probe.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import type { MSTeamsConfig } from "openclaw/plugin-sdk";
|
|
1
|
+
import type { BaseProbeResult, MSTeamsConfig } from "openclaw/plugin-sdk";
|
|
2
2
|
import { formatUnknownError } from "./errors.js";
|
|
3
3
|
import { loadMSTeamsSdkWithAuth } from "./sdk.js";
|
|
4
4
|
import { resolveMSTeamsCredentials } from "./token.js";
|
|
5
5
|
|
|
6
|
-
export type ProbeMSTeamsResult = {
|
|
7
|
-
ok: boolean;
|
|
8
|
-
error?: string;
|
|
6
|
+
export type ProbeMSTeamsResult = BaseProbeResult<string> & {
|
|
9
7
|
appId?: string;
|
|
10
8
|
graph?: {
|
|
11
9
|
ok: boolean;
|