MSTeams: split setup adapter helpers

This commit is contained in:
Vincent Koc 2026-03-15 19:32:48 -07:00
parent 7212b5f01a
commit 0c9428a865
4 changed files with 22 additions and 19 deletions

View File

@ -26,7 +26,8 @@ import {
resolveMSTeamsUserAllowlist,
} from "./resolve-allowlist.js";
import { getMSTeamsRuntime } from "./runtime.js";
import { msteamsSetupAdapter, msteamsSetupWizard } from "./setup-surface.js";
import { msteamsSetupAdapter } from "./setup-core.js";
import { msteamsSetupWizard } from "./setup-surface.js";
import { resolveMSTeamsCredentials } from "./token.js";
type ResolvedMSTeamsAccount = {

View File

@ -0,0 +1,16 @@
import type { ChannelSetupAdapter } from "../../../src/channels/plugins/types.adapters.js";
import { DEFAULT_ACCOUNT_ID } from "../../../src/routing/session-key.js";
export const msteamsSetupAdapter: ChannelSetupAdapter = {
resolveAccountId: () => DEFAULT_ACCOUNT_ID,
applyAccountConfig: ({ cfg }) => ({
...cfg,
channels: {
...cfg.channels,
msteams: {
...cfg.channels?.msteams,
enabled: true,
},
},
}),
};

View File

@ -8,7 +8,6 @@ import {
splitOnboardingEntries,
} from "../../../src/channels/plugins/onboarding/helpers.js";
import type { ChannelSetupWizard } from "../../../src/channels/plugins/setup-wizard.js";
import type { ChannelSetupAdapter } from "../../../src/channels/plugins/types.adapters.js";
import type { OpenClawConfig } from "../../../src/config/config.js";
import type { DmPolicy, MSTeamsTeamConfig } from "../../../src/config/types.js";
import { DEFAULT_ACCOUNT_ID } from "../../../src/routing/session-key.js";
@ -20,6 +19,7 @@ import {
resolveMSTeamsUserAllowlist,
} from "./resolve-allowlist.js";
import { normalizeSecretInputString } from "./secret-input.js";
import { msteamsSetupAdapter } from "./setup-core.js";
import { hasConfiguredMSTeamsCredentials, resolveMSTeamsCredentials } from "./token.js";
const channel = "msteams" as const;
@ -201,19 +201,7 @@ const msteamsDmPolicy: ChannelOnboardingDmPolicy = {
promptAllowFrom: promptMSTeamsAllowFrom,
};
export const msteamsSetupAdapter: ChannelSetupAdapter = {
resolveAccountId: () => DEFAULT_ACCOUNT_ID,
applyAccountConfig: ({ cfg }) => ({
...cfg,
channels: {
...cfg.channels,
msteams: {
...cfg.channels?.msteams,
enabled: true,
},
},
}),
};
export { msteamsSetupAdapter } from "./setup-core.js";
export const msteamsSetupWizard: ChannelSetupWizard = {
channel,

View File

@ -117,7 +117,5 @@ export {
createDefaultChannelRuntimeState,
} from "./status-helpers.js";
export { normalizeStringEntries } from "../shared/string-normalization.js";
export {
msteamsSetupAdapter,
msteamsSetupWizard,
} from "../../extensions/msteams/src/setup-surface.js";
export { msteamsSetupWizard } from "../../extensions/msteams/src/setup-surface.js";
export { msteamsSetupAdapter } from "../../extensions/msteams/src/setup-core.js";