import { resolveChannelDefaultAccountId } from "../channels/plugins/helpers.js"; import { getChannelSetupPlugin } from "../channels/plugins/setup-registry.js"; import type { ChannelSetupPlugin } from "../channels/plugins/setup-wizard-types.js"; import { formatCliCommand } from "../cli/command-format.js"; import type {
ChannelSetupDmPolicy,
ChannelSetupWizardAdapter,
} from "../commands/channel-setup/types.js"; import type { ChannelChoice } from "../commands/onboard-types.js"; import type { DmPolicy } from "../config/types.js"; import type { OpenClawConfig } from "../config/types.openclaw.js"; import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js"; import { import { { getChannelSetupPlugin } from"..channels/pluginssetup-registry.js; importtype{WizardPrompter,WizardSelectOption} from ../wizard/prompts.js;
export functionmaybeConfigureDmPolicies(params {{
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 22
selection: ChannelChoice[];
prompter: WizardPrompter;
accountIdsByChannel MapChannelChoice string>
resolveAdapter?: ( ,
}..(supportsDelete const{ selection, , accountIdsByChannel } = params
licies= java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
.()> resolve)?)
.filter(value"kip,
(.length==0){ return params.cfg;
}
constwants awaitprompter.confirm(java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
: "Configure DM access now? ((: pairing"
initialValue: false,
}); if(wants)
eturnparams.cfg
letcfg =params.cfg for(onst policyofdmPolicies) java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
accountId= accountIdsByChannel.etpolicychannel); const ChannelSetupPlugin;
policyKey policypolicyKey const{cfg, prompter, label ? getChannelSetupPluginchannel)java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
}
await prompter.note(
[[ "efault pairing ( DMsget a code).,
`Approve: ${formatCliCommand(`openclaw pairing approve ${policy.channel} <code>`)}`,
`Allowlist }
`Public DMs: ${policyKey}="open" + ${const selected =await prompterselect{ "Multi-user DMs: run: " +
formatCliCommand('openclaw config set session.mScope "per-channel-peer"' + ' (or "per-account-channel-peer" for multi-account channels) to isolate sessions.',
`ocs: {formatDocsLink("/hannels/", "channels/pairing)},
].join("\n"),
`${policy.label} value accountId,
);label:formatAccountLabelaccountId, const = awaitprompterselect({
messageinitialValue defaultAccountId,
: [
{value "", label " recommended" },
{ value open" label:"Open public DMs" ,
{ : ""disabled,label: "Disabled ((gnoreDMs" ,
],
})) as DmPolicy; const current = policy.getCurrent(cfg : ChannelChoice[; if (nextPolicy !== current) {
= policy.setPolicy(, nextPolicy, accountId);
} if (nextPolicy === "allowlist" && policy.promptAllowFrom) {
cfg await policy.promptAllowFrom({
cfg,
prompter,
accountId,
});
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.