fix: resolve rebase type fallout in channel setup seams
This commit is contained in:
parent
c1e5697889
commit
42c8c3c983
@ -48,7 +48,7 @@ import { resolveDiscordUserAllowlist } from "./resolve-users.js";
|
||||
import { getDiscordRuntime } from "./runtime.js";
|
||||
import { fetchChannelPermissionsDiscord } from "./send.js";
|
||||
import { discordSetupAdapter } from "./setup-core.js";
|
||||
import { createDiscordPluginBase } from "./shared.js";
|
||||
import { createDiscordPluginBase, discordConfigAccessors } from "./shared.js";
|
||||
import { collectDiscordStatusIssues } from "./status-issues.js";
|
||||
import { parseDiscordTarget } from "./targets.js";
|
||||
import { DiscordUiContainer } from "./ui.js";
|
||||
|
||||
@ -100,28 +100,20 @@ async function resolveDiscordGroupAllowlist(params: {
|
||||
});
|
||||
}
|
||||
|
||||
export const discordSetupWizard: ChannelSetupWizard = createDiscordSetupWizardBase(async () => ({
|
||||
discordSetupWizard: {
|
||||
dmPolicy: {
|
||||
promptAllowFrom: promptDiscordAllowFrom,
|
||||
},
|
||||
groupAccess: {
|
||||
resolveAllowlist: async ({ cfg, accountId, credentialValues, entries }) =>
|
||||
await resolveDiscordGroupAllowlist({
|
||||
cfg,
|
||||
accountId,
|
||||
credentialValues,
|
||||
entries,
|
||||
}),
|
||||
},
|
||||
allowFrom: {
|
||||
resolveEntries: async ({ cfg, accountId, credentialValues, entries }) =>
|
||||
await resolveDiscordAllowFromEntries({
|
||||
token:
|
||||
resolveDiscordAccount({ cfg, accountId }).token ||
|
||||
(typeof credentialValues.token === "string" ? credentialValues.token : ""),
|
||||
entries,
|
||||
}),
|
||||
},
|
||||
} as ChannelSetupWizard,
|
||||
}));
|
||||
export const discordSetupWizard: ChannelSetupWizard = createDiscordSetupWizardBase({
|
||||
promptAllowFrom: promptDiscordAllowFrom,
|
||||
resolveGroupAllowlist: async ({ cfg, accountId, credentialValues, entries }) =>
|
||||
await resolveDiscordGroupAllowlist({
|
||||
cfg,
|
||||
accountId,
|
||||
credentialValues,
|
||||
entries,
|
||||
}),
|
||||
resolveAllowFromEntries: async ({ cfg, accountId, credentialValues, entries }) =>
|
||||
await resolveDiscordAllowFromEntries({
|
||||
token:
|
||||
resolveDiscordAccount({ cfg, accountId }).token ||
|
||||
(typeof credentialValues.token === "string" ? credentialValues.token : ""),
|
||||
entries,
|
||||
}),
|
||||
});
|
||||
|
||||
@ -486,7 +486,13 @@ export const slackPlugin: ChannelPlugin<ResolvedSlackAccount> = {
|
||||
},
|
||||
actions: createSlackActions(SLACK_CHANNEL, {
|
||||
invoke: async (action, cfg, toolContext) =>
|
||||
await getSlackRuntime().channel.slack.handleSlackAction(action, cfg, toolContext),
|
||||
await getSlackRuntime().channel.slack.handleSlackAction(
|
||||
action,
|
||||
cfg as OpenClawConfig,
|
||||
toolContext as Parameters<
|
||||
ReturnType<typeof getSlackRuntime>["channel"]["slack"]["handleSlackAction"]
|
||||
>[2],
|
||||
),
|
||||
}),
|
||||
setup: slackSetupAdapter,
|
||||
outbound: {
|
||||
|
||||
@ -130,27 +130,19 @@ async function resolveSlackGroupAllowlist(params: {
|
||||
return keys;
|
||||
}
|
||||
|
||||
export const slackSetupWizard: ChannelSetupWizard = createSlackSetupWizardBase(async () => ({
|
||||
slackSetupWizard: {
|
||||
dmPolicy: {
|
||||
promptAllowFrom: promptSlackAllowFrom,
|
||||
},
|
||||
allowFrom: {
|
||||
resolveEntries: async ({ credentialValues, entries }) =>
|
||||
await resolveSlackAllowFromEntries({
|
||||
token: credentialValues.botToken,
|
||||
entries,
|
||||
}),
|
||||
},
|
||||
groupAccess: {
|
||||
resolveAllowlist: async ({ cfg, accountId, credentialValues, entries, prompter }) =>
|
||||
await resolveSlackGroupAllowlist({
|
||||
cfg,
|
||||
accountId,
|
||||
credentialValues,
|
||||
entries,
|
||||
prompter,
|
||||
}),
|
||||
},
|
||||
} as ChannelSetupWizard,
|
||||
}));
|
||||
export const slackSetupWizard: ChannelSetupWizard = createSlackSetupWizardBase({
|
||||
promptAllowFrom: promptSlackAllowFrom,
|
||||
resolveAllowFromEntries: async ({ credentialValues, entries }) =>
|
||||
await resolveSlackAllowFromEntries({
|
||||
token: credentialValues.botToken,
|
||||
entries,
|
||||
}),
|
||||
resolveGroupAllowlist: async ({ cfg, accountId, credentialValues, entries, prompter }) =>
|
||||
await resolveSlackGroupAllowlist({
|
||||
cfg,
|
||||
accountId,
|
||||
credentialValues,
|
||||
entries,
|
||||
prompter,
|
||||
}),
|
||||
});
|
||||
|
||||
@ -175,6 +175,7 @@ describe("createEnvPatchedAccountSetupAdapter", () => {
|
||||
|
||||
expect(
|
||||
adapter.validateInput?.({
|
||||
cfg: asConfig({}),
|
||||
accountId: "work",
|
||||
input: { useEnv: true },
|
||||
}),
|
||||
@ -182,6 +183,7 @@ describe("createEnvPatchedAccountSetupAdapter", () => {
|
||||
|
||||
expect(
|
||||
adapter.validateInput?.({
|
||||
cfg: asConfig({}),
|
||||
accountId: DEFAULT_ACCOUNT_ID,
|
||||
input: {},
|
||||
}),
|
||||
@ -189,6 +191,7 @@ describe("createEnvPatchedAccountSetupAdapter", () => {
|
||||
|
||||
expect(
|
||||
adapter.validateInput?.({
|
||||
cfg: asConfig({}),
|
||||
accountId: DEFAULT_ACCOUNT_ID,
|
||||
input: { token: "tok" },
|
||||
}),
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import type { AgentToolResult } from "@mariozechner/pi-agent-core";
|
||||
import { handleSlackAction, type SlackActionContext } from "../../agents/tools/slack-actions.js";
|
||||
import {
|
||||
extractSlackToolSend,
|
||||
@ -12,7 +13,7 @@ type SlackActionInvoke = (
|
||||
action: Record<string, unknown>,
|
||||
cfg: unknown,
|
||||
toolContext: unknown,
|
||||
) => Promise<unknown>;
|
||||
) => Promise<AgentToolResult<unknown>>;
|
||||
|
||||
export function createSlackActions(
|
||||
providerId: string,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user