Prefer BlueBubbles for iMessage; add BlueBubbles iMessage skill

This commit is contained in:
Tyler Yust committed 2026-01-29 12:45:50 -08:00
1 parent 4583f88626
commit 79130efcb3
17 files changed
+287 -40

No files matched your search

+6 -3
View File
@@ -86,6 +86,7 @@ async function promptIMessageAllowFrom(params: {
const existing = resolved.config.allowFrom ?? [];
await params.prompter.note(
[
"Legacy iMessage integration via imsg (deprecated). New setups: use BlueBubbles.",
"Allowlist iMessage DMs by handle or chat target.",
"Examples:",
"- +15555550123",
@@ -93,7 +94,7 @@ async function promptIMessageAllowFrom(params: {
"- chat_id:123",
"- chat_guid:... or chat_identifier:...",
"Multiple entries: comma-separated.",
`Docs: ${formatDocsLink("/imessage", "imessage")}`,
`Docs: ${formatDocsLink("/channels/imessage", "imessage")}`,
].join("\n"),
"iMessage allowlist",
);
@@ -239,11 +240,13 @@ export const imessageOnboardingAdapter: ChannelOnboardingAdapter = {
await prompter.note(
[
"This is still a work in progress.",
"Legacy iMessage integration via imsg (deprecated).",
"New setups: use BlueBubbles instead.",
"Ensure Moltbot has Full Disk Access to Messages DB.",
"Grant Automation permission for Messages when prompted.",
"List chats with: imsg chats --limit 20",
`Docs: ${formatDocsLink("/imessage", "imessage")}`,
`Docs (legacy): ${formatDocsLink("/channels/imessage", "imessage")}`,
`Docs (recommended): ${formatDocsLink("/channels/bluebubbles", "bluebubbles")}`,
].join("\n"),
"iMessage next steps",
);
+3 -3
View File
@@ -91,11 +91,11 @@ const CHAT_CHANNEL_META: Record<ChatChannelId, ChannelMeta> = {
imessage: {
id: "imessage",
label: "iMessage",
selectionLabel: "iMessage (imsg)",
detailLabel: "iMessage",
selectionLabel: "iMessage (legacy: imsg)",
detailLabel: "iMessage (legacy)",
docsPath: "/channels/imessage",
docsLabel: "imessage",
blurb: "this is still a work in progress.",
blurb: "legacy iMessage integration via imsg CLI (deprecated; prefer BlueBubbles).",
systemImage: "message.fill",
},
};
+41 -4
View File
@@ -385,6 +385,41 @@ export async function setupChannels(
};
});
const reorderEntriesByPreferOver = <T extends { id: ChannelChoice; meta: ChannelMeta }>(
entries: T[],
): T[] => {
const resolved = [...entries];
// Prefer-over ordering is a lightweight partial ordering used to make recommended
// providers show up before legacy ones (for example BlueBubbles over imessage).
for (let pass = 0; pass < 25; pass += 1) {
const indexById = new Map<string, number>();
for (let i = 0; i < resolved.length; i += 1) {
indexById.set(String(resolved[i]?.meta?.id ?? resolved[i]?.id), i);
}
let changed = false;
for (const entry of resolved) {
const preferOver = entry.meta.preferOver ?? [];
if (!Array.isArray(preferOver) || preferOver.length === 0) continue;
const entryKey = String(entry.meta.id ?? entry.id);
const entryIndex = indexById.get(entryKey);
if (entryIndex === undefined) continue;
for (const otherId of preferOver) {
const otherKey = String(otherId);
const otherIndex = indexById.get(otherKey);
if (otherIndex === undefined) continue;
if (entryIndex > otherIndex) {
resolved.splice(entryIndex, 1);
resolved.splice(otherIndex, 0, entry);
changed = true;
break;
}
}
if (changed) break;
}
if (!changed) break;
}
return resolved;
};
const getChannelEntries = () => {
const core = listChatChannels();
const installed = listChannelPlugins();
@@ -405,10 +440,12 @@ export async function setupChannels(
metaById.set(entry.id, entry.meta);
}
}
const entries = Array.from(metaById, ([id, meta]) => ({
id: id as ChannelChoice,
meta,
}));
const entries = reorderEntriesByPreferOver(
Array.from(metaById, ([id, meta]) => ({
id: id as ChannelChoice,
meta,
})),
);
return {
entries,
catalog,
+1 -1
View File
@@ -31,7 +31,7 @@ export const createIMessageTestPlugin = (params?: {
meta: {
id: "imessage",
label: "iMessage",
selectionLabel: "iMessage (imsg)",
selectionLabel: "iMessage (legacy: imsg)",
docsPath: "/channels/imessage",
blurb: "iMessage test stub.",
aliases: ["imsg"],