mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-18 13:30:48 +00:00
48 lines
1.6 KiB
TypeScript
48 lines
1.6 KiB
TypeScript
import { setSetupChannelEnabled, type ChannelSetupWizard } from "openclaw/plugin-sdk/setup";
|
|
import { detectBinary } from "../../../src/plugins/setup-binary.js";
|
|
import { listIMessageAccountIds, resolveIMessageAccount } from "./accounts.js";
|
|
import {
|
|
createIMessageCliPathTextInput,
|
|
imessageCompletionNote,
|
|
imessageDmPolicy,
|
|
imessageSetupAdapter,
|
|
imessageSetupStatusBase,
|
|
parseIMessageAllowFromEntries,
|
|
} from "./setup-core.js";
|
|
|
|
const channel = "imessage" as const;
|
|
|
|
export const imessageSetupWizard: ChannelSetupWizard = {
|
|
channel,
|
|
status: {
|
|
...imessageSetupStatusBase,
|
|
resolveStatusLines: async ({ cfg, configured }) => {
|
|
const cliPath = cfg.channels?.imessage?.cliPath ?? "imsg";
|
|
const cliDetected = await detectBinary(cliPath);
|
|
return [
|
|
`iMessage: ${configured ? "configured" : "needs setup"}`,
|
|
`imsg: ${cliDetected ? "found" : "missing"} (${cliPath})`,
|
|
];
|
|
},
|
|
resolveSelectionHint: async ({ cfg }) => {
|
|
const cliPath = cfg.channels?.imessage?.cliPath ?? "imsg";
|
|
return (await detectBinary(cliPath)) ? "imsg found" : "imsg missing";
|
|
},
|
|
resolveQuickstartScore: async ({ cfg }) => {
|
|
const cliPath = cfg.channels?.imessage?.cliPath ?? "imsg";
|
|
return (await detectBinary(cliPath)) ? 1 : 0;
|
|
},
|
|
},
|
|
credentials: [],
|
|
textInputs: [
|
|
createIMessageCliPathTextInput(async ({ currentValue }) => {
|
|
return !(await detectBinary(currentValue ?? "imsg"));
|
|
}),
|
|
],
|
|
completionNote: imessageCompletionNote,
|
|
dmPolicy: imessageDmPolicy,
|
|
disable: (cfg) => setSetupChannelEnabled(cfg, channel, false),
|
|
};
|
|
|
|
export { imessageSetupAdapter, parseIMessageAllowFromEntries };
|