@beeper/desktop-mcp 4.1.293 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -7
- package/handlers/get-accounts.d.mts +3 -0
- package/handlers/get-accounts.d.mts.map +1 -0
- package/handlers/get-accounts.d.ts +3 -0
- package/handlers/get-accounts.d.ts.map +1 -0
- package/handlers/get-accounts.js +32 -0
- package/handlers/get-accounts.js.map +1 -0
- package/handlers/get-accounts.mjs +28 -0
- package/handlers/get-accounts.mjs.map +1 -0
- package/handlers/get-chat.d.mts +3 -0
- package/handlers/get-chat.d.mts.map +1 -0
- package/handlers/get-chat.d.ts +3 -0
- package/handlers/get-chat.d.ts.map +1 -0
- package/handlers/get-chat.js +20 -0
- package/handlers/get-chat.js.map +1 -0
- package/handlers/get-chat.mjs +16 -0
- package/handlers/get-chat.mjs.map +1 -0
- package/handlers/index.d.mts +3 -0
- package/handlers/index.d.mts.map +1 -0
- package/handlers/index.d.ts +3 -0
- package/handlers/index.d.ts.map +1 -0
- package/handlers/index.js +30 -0
- package/handlers/index.js.map +1 -0
- package/handlers/index.mjs +27 -0
- package/handlers/index.mjs.map +1 -0
- package/handlers/list-chats.d.mts +3 -0
- package/handlers/list-chats.d.mts.map +1 -0
- package/handlers/list-chats.d.ts +3 -0
- package/handlers/list-chats.d.ts.map +1 -0
- package/handlers/list-chats.js +46 -0
- package/handlers/list-chats.js.map +1 -0
- package/handlers/list-chats.mjs +42 -0
- package/handlers/list-chats.mjs.map +1 -0
- package/handlers/list-messages.d.mts +3 -0
- package/handlers/list-messages.d.mts.map +1 -0
- package/handlers/list-messages.d.ts +3 -0
- package/handlers/list-messages.d.ts.map +1 -0
- package/handlers/list-messages.js +34 -0
- package/handlers/list-messages.js.map +1 -0
- package/handlers/list-messages.mjs +30 -0
- package/handlers/list-messages.mjs.map +1 -0
- package/handlers/open-app.d.mts +3 -0
- package/handlers/open-app.d.mts.map +1 -0
- package/handlers/open-app.d.ts +3 -0
- package/handlers/open-app.d.ts.map +1 -0
- package/handlers/open-app.js +26 -0
- package/handlers/open-app.js.map +1 -0
- package/handlers/open-app.mjs +22 -0
- package/handlers/open-app.mjs.map +1 -0
- package/handlers/search-chats.d.mts +3 -0
- package/handlers/search-chats.d.mts.map +1 -0
- package/handlers/search-chats.d.ts +3 -0
- package/handlers/search-chats.d.ts.map +1 -0
- package/handlers/search-chats.js +38 -0
- package/handlers/search-chats.js.map +1 -0
- package/handlers/search-chats.mjs +34 -0
- package/handlers/search-chats.mjs.map +1 -0
- package/handlers/search-messages.d.mts +3 -0
- package/handlers/search-messages.d.mts.map +1 -0
- package/handlers/search-messages.d.ts +3 -0
- package/handlers/search-messages.d.ts.map +1 -0
- package/handlers/search-messages.js +11 -0
- package/handlers/search-messages.js.map +1 -0
- package/handlers/search-messages.mjs +7 -0
- package/handlers/search-messages.mjs.map +1 -0
- package/handlers/search.d.mts +3 -0
- package/handlers/search.d.mts.map +1 -0
- package/handlers/search.d.ts +3 -0
- package/handlers/search.d.ts.map +1 -0
- package/handlers/search.js +29 -0
- package/handlers/search.js.map +1 -0
- package/handlers/search.mjs +25 -0
- package/handlers/search.mjs.map +1 -0
- package/handlers/send-message.d.mts +3 -0
- package/handlers/send-message.d.mts.map +1 -0
- package/handlers/send-message.d.ts +3 -0
- package/handlers/send-message.d.ts.map +1 -0
- package/handlers/send-message.js +20 -0
- package/handlers/send-message.js.map +1 -0
- package/handlers/send-message.mjs +16 -0
- package/handlers/send-message.mjs.map +1 -0
- package/handlers/utils.d.mts +29 -0
- package/handlers/utils.d.mts.map +1 -0
- package/handlers/utils.d.ts +29 -0
- package/handlers/utils.d.ts.map +1 -0
- package/handlers/utils.js +296 -0
- package/handlers/utils.js.map +1 -0
- package/handlers/utils.mjs +282 -0
- package/handlers/utils.mjs.map +1 -0
- package/http.d.mts +6 -0
- package/http.d.mts.map +1 -1
- package/http.d.ts +6 -0
- package/http.d.ts.map +1 -1
- package/http.js +7 -4
- package/http.js.map +1 -1
- package/http.mjs +3 -3
- package/http.mjs.map +1 -1
- package/package.json +13 -2
- package/server.js +1 -1
- package/server.js.map +1 -1
- package/server.mjs +1 -1
- package/server.mjs.map +1 -1
- package/src/handlers/get-accounts.ts +28 -0
- package/src/handlers/get-chat.ts +18 -0
- package/src/handlers/index.ts +29 -0
- package/src/handlers/list-chats.ts +47 -0
- package/src/handlers/list-messages.ts +33 -0
- package/src/handlers/open-app.ts +20 -0
- package/src/handlers/search-chats.ts +39 -0
- package/src/handlers/search-messages.ts +8 -0
- package/src/handlers/search.ts +24 -0
- package/src/handlers/send-message.ts +17 -0
- package/src/handlers/utils.ts +381 -0
- package/src/http.ts +3 -3
- package/src/server.ts +1 -1
- package/src/tools/index.ts +2 -1
- package/tools/index.d.mts.map +1 -1
- package/tools/index.d.ts.map +1 -1
- package/tools/index.js +2 -1
- package/tools/index.js.map +1 -1
- package/tools/index.mjs +2 -1
- package/tools/index.mjs.map +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { asMarkdownContentResult, formatChatToMarkdown } from "./utils.mjs";
|
|
2
|
+
export const handler = async (client, args) => {
|
|
3
|
+
const body = args;
|
|
4
|
+
const output = await client.chats.search(body);
|
|
5
|
+
const lines = [];
|
|
6
|
+
lines.push('# Chats');
|
|
7
|
+
const items = output.items || [];
|
|
8
|
+
const hasMore = !!output.hasMore;
|
|
9
|
+
if (hasMore) {
|
|
10
|
+
lines.push(`\nFound ${items.length}+ chats (showing ${items.length})`);
|
|
11
|
+
if (output.oldestCursor) {
|
|
12
|
+
lines.push(`Next page (older): cursor='${output.oldestCursor}', direction='before'`);
|
|
13
|
+
}
|
|
14
|
+
if (output.newestCursor) {
|
|
15
|
+
lines.push(`Previous page (newer): cursor='${output.newestCursor}', direction='after'`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else if (items.length > 0) {
|
|
19
|
+
lines.push(`\nFound ${items.length} chat${items.length === 1 ? '' : 's'}`);
|
|
20
|
+
}
|
|
21
|
+
if (items.length === 0) {
|
|
22
|
+
lines.push('\nNo chats found.');
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
for (const chat of items) {
|
|
26
|
+
lines.push(formatChatToMarkdown(chat, undefined));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
lines.push('\n# Using this information\n');
|
|
30
|
+
lines.push('- Pass the "chatID" to get_chat or search_messages for details about a chat, or send_message to send a message to a chat.');
|
|
31
|
+
lines.push('- Link the "open" link to the user to allow them to view the chat in Beeper Desktop.');
|
|
32
|
+
return asMarkdownContentResult(lines);
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=search-chats.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-chats.mjs","sourceRoot":"","sources":["../src/handlers/search-chats.ts"],"names":[],"mappings":"OACO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE;AAExD,MAAM,CAAC,MAAM,OAAO,GAAoB,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IAC7D,MAAM,IAAI,GAAG,IAAW,CAAC;IACzB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE/C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAEtB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;IACjC,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;IAEjC,IAAI,OAAO,EAAE,CAAC;QACZ,KAAK,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,MAAM,oBAAoB,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QACvE,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,8BAA8B,MAAM,CAAC,YAAY,uBAAuB,CAAC,CAAC;QACvF,CAAC;QACD,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,kCAAkC,MAAM,CAAC,YAAY,sBAAsB,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC;SAAM,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,KAAK,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,MAAM,QAAQ,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAClC,CAAC;SAAM,CAAC;QACN,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;IAC3C,KAAK,CAAC,IAAI,CACR,2HAA2H,CAC5H,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,sFAAsF,CAAC,CAAC;IACnG,OAAO,uBAAuB,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-messages.d.mts","sourceRoot":"","sources":["../src/handlers/search-messages.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,eAAe,EAAE;AAG/B,eAAO,MAAM,OAAO,EAAE,eAIrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-messages.d.ts","sourceRoot":"","sources":["../src/handlers/search-messages.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,eAAe,EAAE;AAG/B,eAAO,MAAM,OAAO,EAAE,eAIrB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = void 0;
|
|
4
|
+
const utils_1 = require("./utils.js");
|
|
5
|
+
const handler = async (client, args) => {
|
|
6
|
+
const body = args;
|
|
7
|
+
const output = await client.messages.search(body);
|
|
8
|
+
return (0, utils_1.asMarkdownContentResult)((0, utils_1.mapMessagesToText)(output, body, undefined));
|
|
9
|
+
};
|
|
10
|
+
exports.handler = handler;
|
|
11
|
+
//# sourceMappingURL=search-messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-messages.js","sourceRoot":"","sources":["../src/handlers/search-messages.ts"],"names":[],"mappings":";;;AACA,sCAAqE;AAE9D,MAAM,OAAO,GAAoB,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IAC7D,MAAM,IAAI,GAAG,IAAW,CAAC;IACzB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClD,OAAO,IAAA,+BAAuB,EAAC,IAAA,yBAAiB,EAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;AAC7E,CAAC,CAAC;AAJW,QAAA,OAAO,WAIlB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { mapMessagesToText, asMarkdownContentResult } from "./utils.mjs";
|
|
2
|
+
export const handler = async (client, args) => {
|
|
3
|
+
const body = args;
|
|
4
|
+
const output = await client.messages.search(body);
|
|
5
|
+
return asMarkdownContentResult(mapMessagesToText(output, body, undefined));
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=search-messages.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-messages.mjs","sourceRoot":"","sources":["../src/handlers/search-messages.ts"],"names":[],"mappings":"OACO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE;AAErD,MAAM,CAAC,MAAM,OAAO,GAAoB,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IAC7D,MAAM,IAAI,GAAG,IAAW,CAAC;IACzB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClD,OAAO,uBAAuB,CAAC,iBAAiB,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;AAC7E,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.mts","sourceRoot":"","sources":["../src/handlers/search.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,eAAe,EAAE;AAG/B,eAAO,MAAM,OAAO,EAAE,eAoBrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/handlers/search.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,eAAe,EAAE;AAG/B,eAAO,MAAM,OAAO,EAAE,eAoBrB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = void 0;
|
|
4
|
+
const utils_1 = require("./utils.js");
|
|
5
|
+
const handler = async (client, args) => {
|
|
6
|
+
const body = args;
|
|
7
|
+
const output = await client.search(body);
|
|
8
|
+
const lines = [];
|
|
9
|
+
if (body?.query)
|
|
10
|
+
lines.push(`Query: "${body.query}"`);
|
|
11
|
+
const results = output?.results;
|
|
12
|
+
if (results?.chats?.length) {
|
|
13
|
+
lines.push('\n# Chats');
|
|
14
|
+
for (const chat of results.chats)
|
|
15
|
+
lines.push((0, utils_1.formatChatToMarkdown)(chat, undefined));
|
|
16
|
+
}
|
|
17
|
+
if (results?.in_groups?.length) {
|
|
18
|
+
lines.push('\n# In Groups');
|
|
19
|
+
for (const chat of results.in_groups)
|
|
20
|
+
lines.push((0, utils_1.formatChatToMarkdown)(chat, undefined));
|
|
21
|
+
}
|
|
22
|
+
if (results?.messages?.items?.length) {
|
|
23
|
+
lines.push('\n# Messages');
|
|
24
|
+
lines.push((0, utils_1.mapMessagesToText)(results.messages, body, undefined));
|
|
25
|
+
}
|
|
26
|
+
return (0, utils_1.asMarkdownContentResult)(lines);
|
|
27
|
+
};
|
|
28
|
+
exports.handler = handler;
|
|
29
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../src/handlers/search.ts"],"names":[],"mappings":";;;AACA,sCAA2F;AAEpF,MAAM,OAAO,GAAoB,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IAC7D,MAAM,IAAI,GAAG,IAAW,CAAC;IACzB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEzC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,IAAI,EAAE,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,MAAM,EAAE,OAAO,CAAC;IAChC,IAAI,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACxB,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK;YAAE,KAAK,CAAC,IAAI,CAAC,IAAA,4BAAoB,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IACtF,CAAC;IACD,IAAI,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC5B,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,SAAS;YAAE,KAAK,CAAC,IAAI,CAAC,IAAA,4BAAoB,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IAC1F,CAAC;IACD,IAAI,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QACrC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,IAAA,yBAAiB,EAAC,OAAO,CAAC,QAAe,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,IAAA,+BAAuB,EAAC,KAAK,CAAC,CAAC;AACxC,CAAC,CAAC;AApBW,QAAA,OAAO,WAoBlB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { asMarkdownContentResult, formatChatToMarkdown, mapMessagesToText } from "./utils.mjs";
|
|
2
|
+
export const handler = async (client, args) => {
|
|
3
|
+
const body = args;
|
|
4
|
+
const output = await client.search(body);
|
|
5
|
+
const lines = [];
|
|
6
|
+
if (body?.query)
|
|
7
|
+
lines.push(`Query: "${body.query}"`);
|
|
8
|
+
const results = output?.results;
|
|
9
|
+
if (results?.chats?.length) {
|
|
10
|
+
lines.push('\n# Chats');
|
|
11
|
+
for (const chat of results.chats)
|
|
12
|
+
lines.push(formatChatToMarkdown(chat, undefined));
|
|
13
|
+
}
|
|
14
|
+
if (results?.in_groups?.length) {
|
|
15
|
+
lines.push('\n# In Groups');
|
|
16
|
+
for (const chat of results.in_groups)
|
|
17
|
+
lines.push(formatChatToMarkdown(chat, undefined));
|
|
18
|
+
}
|
|
19
|
+
if (results?.messages?.items?.length) {
|
|
20
|
+
lines.push('\n# Messages');
|
|
21
|
+
lines.push(mapMessagesToText(results.messages, body, undefined));
|
|
22
|
+
}
|
|
23
|
+
return asMarkdownContentResult(lines);
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=search.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.mjs","sourceRoot":"","sources":["../src/handlers/search.ts"],"names":[],"mappings":"OACO,EA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@
|
|
|
1
|
+
{"version":3,"file":"send-message.d.mts","sourceRoot":"","sources":["../src/handlers/send-message.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,eAAe,EAAE;AAG/B,eAAO,MAAM,OAAO,EAAE,eAarB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-message.d.ts","sourceRoot":"","sources":["../src/handlers/send-message.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,eAAe,EAAE;AAG/B,eAAO,MAAM,OAAO,EAAE,eAarB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = void 0;
|
|
4
|
+
const utils_1 = require("./utils.js");
|
|
5
|
+
const handler = async (client, args) => {
|
|
6
|
+
const body = args;
|
|
7
|
+
const output = await client.messages.send(body);
|
|
8
|
+
const lines = [];
|
|
9
|
+
if (output.pendingMessageID) {
|
|
10
|
+
const deeplink = (0, utils_1.createOpenLink)('', body?.chatID ?? '');
|
|
11
|
+
if (deeplink)
|
|
12
|
+
lines.push(`**Open the chat in Beeper**: ${deeplink}`);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
lines.push('Failed to send message.');
|
|
16
|
+
}
|
|
17
|
+
return (0, utils_1.asMarkdownContentResult)(lines);
|
|
18
|
+
};
|
|
19
|
+
exports.handler = handler;
|
|
20
|
+
//# sourceMappingURL=send-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-message.js","sourceRoot":"","sources":["../src/handlers/send-message.ts"],"names":[],"mappings":";;;AACA,sCAAkE;AAE3D,MAAM,OAAO,GAAoB,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IAC7D,MAAM,IAAI,GAAG,IAAW,CAAC;IACzB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEhD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,IAAA,sBAAc,EAAC,EAAE,EAAE,IAAI,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC;QACxD,IAAI,QAAQ;YAAE,KAAK,CAAC,IAAI,CAAC,gCAAgC,QAAQ,EAAE,CAAC,CAAC;IACvE,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,IAAA,+BAAuB,EAAC,KAAK,CAAC,CAAC;AACxC,CAAC,CAAC;AAbW,QAAA,OAAO,WAalB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { asMarkdownContentResult, createOpenLink } from "./utils.mjs";
|
|
2
|
+
export const handler = async (client, args) => {
|
|
3
|
+
const body = args;
|
|
4
|
+
const output = await client.messages.send(body);
|
|
5
|
+
const lines = [];
|
|
6
|
+
if (output.pendingMessageID) {
|
|
7
|
+
const deeplink = createOpenLink('', body?.chatID ?? '');
|
|
8
|
+
if (deeplink)
|
|
9
|
+
lines.push(`**Open the chat in Beeper**: ${deeplink}`);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
lines.push('Failed to send message.');
|
|
13
|
+
}
|
|
14
|
+
return asMarkdownContentResult(lines);
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=send-message.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-message.mjs","sourceRoot":"","sources":["../src/handlers/send-message.ts"],"names":[],"mappings":"OACO,EAAE,uBAAuB,EAAE,cAAc,EAAE;AAElD,MAAM,CAAC,MAAM,OAAO,GAAoB,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IAC7D,MAAM,IAAI,GAAG,IAAW,CAAC;IACzB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEhD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,cAAc,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC;QACxD,IAAI,QAAQ;YAAE,KAAK,CAAC,IAAI,CAAC,gCAAgC,QAAQ,EAAE,CAAC,CAAC;IACvE,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,uBAAuB,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type * as Shared from '@beeper/desktop-api/resources/shared';
|
|
2
|
+
import type * as ChatsAPI from '@beeper/desktop-api/resources/chats/chats';
|
|
3
|
+
import { ToolCallResult } from "../tools/types.mjs";
|
|
4
|
+
type Message = Shared.Message;
|
|
5
|
+
type Chat = ChatsAPI.Chat;
|
|
6
|
+
type User = Shared.User;
|
|
7
|
+
type MessageReaction = NonNullable<Message['reactions']>[number];
|
|
8
|
+
export declare const formatRelativeDate: (date: Date) => string;
|
|
9
|
+
export declare const formatBytes: (bytes: number, decimals?: number) => string;
|
|
10
|
+
export declare function groupReactions(reactions: MessageReaction[]): {
|
|
11
|
+
[key: string]: MessageReaction[];
|
|
12
|
+
};
|
|
13
|
+
export declare const getParticipantName: (participant: User, preferFirstName?: boolean) => string;
|
|
14
|
+
export declare const createOpenLink: (baseURL: string, localChatIDOrChatID: string, messageKey?: string) => string;
|
|
15
|
+
export declare const formatParticipantsToMarkdown: (participants: User[] | undefined, limit?: number) => string;
|
|
16
|
+
export declare const formatReactionsToMarkdown: (reactions: Message["reactions"], participants?: Map<string, User>) => string;
|
|
17
|
+
export declare const formatAttachmentToMarkdown: (attachment: Shared.Attachment | undefined) => string;
|
|
18
|
+
export declare const formatChatToMarkdown: (chat: Chat, baseURL: string | undefined) => string;
|
|
19
|
+
export declare const mapMessagesToText: (output: Shared.MessagesCursorSearch, input?: {
|
|
20
|
+
query?: string;
|
|
21
|
+
sender?: string;
|
|
22
|
+
mediaTypes?: string[];
|
|
23
|
+
}, ctx?: {
|
|
24
|
+
apiBaseURL?: string;
|
|
25
|
+
maxTextLength?: number;
|
|
26
|
+
}) => string;
|
|
27
|
+
export declare function asMarkdownContentResult(text: string | string[]): ToolCallResult;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=utils.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../src/handlers/utils.ts"],"names":[],"mappings":"OAUO,KAAK,KAAK,MAAM,MAAM,sCAAsC;OAC5D,KAAK,KAAK,QAAQ,MAAM,2CAA2C;OACnE,EAAE,cAAc,EAAE;AAIzB,KAAK,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;AAC9B,KAAK,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;AAC1B,KAAK,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;AACxB,KAAK,eAAe,GAAG,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,eAAO,MAAM,kBAAkB,GAAI,MAAM,IAAI,WAwB5C,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,EAAE,iBAAY,WAQtD,CAAC;AAKF,wBAAgB,cAAc,CAAC,SAAS,EAAE,eAAe,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,CAAA;CAAE,CASjG;AAED,eAAO,MAAM,kBAAkB,GAAI,aAAa,IAAI,EAAE,kBAAkB,OAAO,KAAG,MAOhE,CAAC;AAEnB,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,EAAE,qBAAqB,MAAM,EAAE,aAAa,MAAM,WACG,CAAC;AAEpG,eAAO,MAAM,4BAA4B,GAAI,cAAc,IAAI,EAAE,GAAG,SAAS,EAAE,cAAS,KAAG,MAc1F,CAAC;AAEF,eAAO,MAAM,yBAAyB,GACpC,WAAW,OAAO,CAAC,WAAW,CAAC,EAC/B,eAAe,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,KAC/B,MA8BF,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAI,YAAY,MAAM,CAAC,UAAU,GAAG,SAAS,KAAG,MA2BtF,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,MAAM,IAAI,EAAE,SAAS,MAAM,GAAG,SAAS,KAAG,MAqB9E,CAAC;AAkBF,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,MAAM,CAAC,oBAAoB,EACnC,QAAQ;IACN,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,EACD,MAAM;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,WAgKtD,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc,CAS/E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type * as Shared from '@beeper/desktop-api/resources/shared';
|
|
2
|
+
import type * as ChatsAPI from '@beeper/desktop-api/resources/chats/chats';
|
|
3
|
+
import { ToolCallResult } from "../tools/types.js";
|
|
4
|
+
type Message = Shared.Message;
|
|
5
|
+
type Chat = ChatsAPI.Chat;
|
|
6
|
+
type User = Shared.User;
|
|
7
|
+
type MessageReaction = NonNullable<Message['reactions']>[number];
|
|
8
|
+
export declare const formatRelativeDate: (date: Date) => string;
|
|
9
|
+
export declare const formatBytes: (bytes: number, decimals?: number) => string;
|
|
10
|
+
export declare function groupReactions(reactions: MessageReaction[]): {
|
|
11
|
+
[key: string]: MessageReaction[];
|
|
12
|
+
};
|
|
13
|
+
export declare const getParticipantName: (participant: User, preferFirstName?: boolean) => string;
|
|
14
|
+
export declare const createOpenLink: (baseURL: string, localChatIDOrChatID: string, messageKey?: string) => string;
|
|
15
|
+
export declare const formatParticipantsToMarkdown: (participants: User[] | undefined, limit?: number) => string;
|
|
16
|
+
export declare const formatReactionsToMarkdown: (reactions: Message["reactions"], participants?: Map<string, User>) => string;
|
|
17
|
+
export declare const formatAttachmentToMarkdown: (attachment: Shared.Attachment | undefined) => string;
|
|
18
|
+
export declare const formatChatToMarkdown: (chat: Chat, baseURL: string | undefined) => string;
|
|
19
|
+
export declare const mapMessagesToText: (output: Shared.MessagesCursorSearch, input?: {
|
|
20
|
+
query?: string;
|
|
21
|
+
sender?: string;
|
|
22
|
+
mediaTypes?: string[];
|
|
23
|
+
}, ctx?: {
|
|
24
|
+
apiBaseURL?: string;
|
|
25
|
+
maxTextLength?: number;
|
|
26
|
+
}) => string;
|
|
27
|
+
export declare function asMarkdownContentResult(text: string | string[]): ToolCallResult;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/handlers/utils.ts"],"names":[],"mappings":"OAUO,KAAK,KAAK,MAAM,MAAM,sCAAsC;OAC5D,KAAK,KAAK,QAAQ,MAAM,2CAA2C;OACnE,EAAE,cAAc,EAAE;AAIzB,KAAK,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;AAC9B,KAAK,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;AAC1B,KAAK,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;AACxB,KAAK,eAAe,GAAG,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,eAAO,MAAM,kBAAkB,GAAI,MAAM,IAAI,WAwB5C,CAAC;AAEF,eAAO,MAAM,WAAW,GAA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
exports.mapMessagesToText = exports.formatChatToMarkdown = exports.formatAttachmentToMarkdown = exports.formatReactionsToMarkdown = exports.formatParticipantsToMarkdown = exports.createOpenLink = exports.getParticipantName = exports.formatBytes = exports.formatRelativeDate = void 0;
|
|
4
|
+
exports.groupReactions = groupReactions;
|
|
5
|
+
exports.asMarkdownContentResult = asMarkdownContentResult;
|
|
6
|
+
const date_fns_1 = require("date-fns");
|
|
7
|
+
const MILLIS_IN_WEEK = 86400000 * 7;
|
|
8
|
+
const formatRelativeDate = (date) => {
|
|
9
|
+
const timeDifference = (0, date_fns_1.differenceInMilliseconds)((0, date_fns_1.endOfDay)(new Date()), date);
|
|
10
|
+
if ((0, date_fns_1.isToday)(date))
|
|
11
|
+
return 'Today';
|
|
12
|
+
if ((0, date_fns_1.isYesterday)(date))
|
|
13
|
+
return 'Yesterday';
|
|
14
|
+
return new Intl.DateTimeFormat('default', timeDifference < MILLIS_IN_WEEK ?
|
|
15
|
+
{
|
|
16
|
+
weekday: 'long',
|
|
17
|
+
}
|
|
18
|
+
: (0, date_fns_1.isSameYear)(date, new Date()) ?
|
|
19
|
+
{
|
|
20
|
+
weekday: 'short',
|
|
21
|
+
month: 'short',
|
|
22
|
+
day: 'numeric',
|
|
23
|
+
}
|
|
24
|
+
: {
|
|
25
|
+
year: 'numeric',
|
|
26
|
+
month: 'short',
|
|
27
|
+
day: 'numeric',
|
|
28
|
+
}).format(date);
|
|
29
|
+
};
|
|
30
|
+
exports.formatRelativeDate = formatRelativeDate;
|
|
31
|
+
const formatBytes = (bytes, decimals = 0) => {
|
|
32
|
+
if (bytes === 0)
|
|
33
|
+
return '0 B';
|
|
34
|
+
const k = 1024;
|
|
35
|
+
const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
36
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
37
|
+
return `${Math.floor(parseFloat((bytes / k ** i).toFixed(decimals)))}${sizes[i]}`;
|
|
38
|
+
};
|
|
39
|
+
exports.formatBytes = formatBytes;
|
|
40
|
+
const skinToneRegex = /\uD83C[\uDFFB-\uDFFF]/g;
|
|
41
|
+
const removeSkinTone = (emojiString) => emojiString.replace(skinToneRegex, '');
|
|
42
|
+
function groupReactions(reactions) {
|
|
43
|
+
const map = {};
|
|
44
|
+
reactions.forEach((reaction) => {
|
|
45
|
+
if (!reaction.reactionKey)
|
|
46
|
+
return;
|
|
47
|
+
const key = removeSkinTone(reaction.reactionKey);
|
|
48
|
+
map[key] || (map[key] = []);
|
|
49
|
+
map[key].push(reaction);
|
|
50
|
+
});
|
|
51
|
+
return map;
|
|
52
|
+
}
|
|
53
|
+
const getParticipantName = (participant, preferFirstName) => participant.fullName && preferFirstName ?
|
|
54
|
+
participant.fullName.split(' ')[0]
|
|
55
|
+
: participant.fullName ||
|
|
56
|
+
participant.username ||
|
|
57
|
+
participant.email ||
|
|
58
|
+
participant.phoneNumber ||
|
|
59
|
+
participant.id;
|
|
60
|
+
exports.getParticipantName = getParticipantName;
|
|
61
|
+
const createOpenLink = (baseURL, localChatIDOrChatID, messageKey) => `${baseURL}/open/${encodeURIComponent(localChatIDOrChatID)}${messageKey ? `/${messageKey}` : ''}`;
|
|
62
|
+
exports.createOpenLink = createOpenLink;
|
|
63
|
+
const formatParticipantsToMarkdown = (participants, limit = 3) => {
|
|
64
|
+
if (!participants || participants.length === 0)
|
|
65
|
+
return '';
|
|
66
|
+
const names = participants
|
|
67
|
+
.slice(0, limit)
|
|
68
|
+
.map((p) => p.fullName || p.username || p.id)
|
|
69
|
+
.filter(Boolean);
|
|
70
|
+
if (participants.length > limit) {
|
|
71
|
+
const othersCount = participants.length - limit;
|
|
72
|
+
names.push(`& ${othersCount} other${othersCount === 1 ? '' : 's'}`);
|
|
73
|
+
}
|
|
74
|
+
return names.join(', ');
|
|
75
|
+
};
|
|
76
|
+
exports.formatParticipantsToMarkdown = formatParticipantsToMarkdown;
|
|
77
|
+
const formatReactionsToMarkdown = (reactions, participants) => {
|
|
78
|
+
if (!reactions || reactions.length === 0)
|
|
79
|
+
return '';
|
|
80
|
+
const reactionMap = groupReactions(reactions);
|
|
81
|
+
const reactionParts = [];
|
|
82
|
+
for (const [reactionKey, reactionList] of Object.entries(reactionMap)) {
|
|
83
|
+
const count = reactionList.length;
|
|
84
|
+
const reactorNames = reactionList
|
|
85
|
+
.slice(0, 5)
|
|
86
|
+
.map((r) => {
|
|
87
|
+
if (!r.participantID)
|
|
88
|
+
return null;
|
|
89
|
+
const participant = participants?.get(r.participantID);
|
|
90
|
+
return participant ? (0, exports.getParticipantName)(participant) : r.participantID;
|
|
91
|
+
})
|
|
92
|
+
.filter(Boolean);
|
|
93
|
+
let reactorInfo = '';
|
|
94
|
+
if (reactorNames.length > 0) {
|
|
95
|
+
if (count > 5) {
|
|
96
|
+
const othersCount = count - 5;
|
|
97
|
+
reactorInfo = ` (${reactorNames.join(', ')} & ${othersCount} other${othersCount === 1 ? '' : 's'})`;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
reactorInfo = ` (${reactorNames.join(', ')})`;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
reactionParts.push(`${reactionKey} ${count}${reactorInfo}`);
|
|
104
|
+
}
|
|
105
|
+
return reactionParts.length > 0 ? ` [${reactionParts.join(' ')}]` : '';
|
|
106
|
+
};
|
|
107
|
+
exports.formatReactionsToMarkdown = formatReactionsToMarkdown;
|
|
108
|
+
const formatAttachmentToMarkdown = (attachment) => {
|
|
109
|
+
if (!attachment)
|
|
110
|
+
return '';
|
|
111
|
+
const typeEmoji = {
|
|
112
|
+
img: '🖼',
|
|
113
|
+
video: '🎥',
|
|
114
|
+
audio: '🎵',
|
|
115
|
+
unknown: '📎',
|
|
116
|
+
}[attachment.type] || '📎';
|
|
117
|
+
const fileName = attachment.fileName || 'file';
|
|
118
|
+
const url = attachment.srcURL || '';
|
|
119
|
+
const hasBothDimensions = typeof attachment.size?.width === 'number' && typeof attachment.size?.height === 'number';
|
|
120
|
+
const metaInfo = [];
|
|
121
|
+
if (attachment.fileSize) {
|
|
122
|
+
metaInfo.push((0, exports.formatBytes)(attachment.fileSize));
|
|
123
|
+
}
|
|
124
|
+
if (hasBothDimensions) {
|
|
125
|
+
metaInfo.push(`${attachment.size.width}x${attachment.size.height}`);
|
|
126
|
+
}
|
|
127
|
+
const metaString = metaInfo.length > 0 ? ` (${metaInfo.join(', ')})` : '';
|
|
128
|
+
return `\n${typeEmoji} [${fileName}](${url})${metaString}`;
|
|
129
|
+
};
|
|
130
|
+
exports.formatAttachmentToMarkdown = formatAttachmentToMarkdown;
|
|
131
|
+
const formatChatToMarkdown = (chat, baseURL) => {
|
|
132
|
+
const openURL = baseURL ? (0, exports.createOpenLink)(baseURL, chat.localChatID ?? chat.id) : undefined;
|
|
133
|
+
const title = openURL ? `[${chat.title}](${openURL})` : chat.title;
|
|
134
|
+
const participantList = chat.participants?.items ? (0, exports.formatParticipantsToMarkdown)(chat.participants.items, 3) : '';
|
|
135
|
+
const participantInfo = participantList ? ` with ${participantList}` : '';
|
|
136
|
+
const lines = [];
|
|
137
|
+
lines.push(`\n## ${title} (chatID: ${chat.localChatID})`);
|
|
138
|
+
let chatLine = `Chat on ${chat.network}${participantInfo}.`;
|
|
139
|
+
if (typeof chat.unreadCount === 'number' && chat.unreadCount > 0) {
|
|
140
|
+
chatLine += ` It has ${chat.unreadCount} unread message${chat.unreadCount === 1 ? '' : 's'}.`;
|
|
141
|
+
}
|
|
142
|
+
lines.push(chatLine);
|
|
143
|
+
lines.push(`**Type**: ${chat.type}`);
|
|
144
|
+
if (chat.lastActivity)
|
|
145
|
+
lines.push(`**Last Activity**: ${chat.lastActivity}`);
|
|
146
|
+
const status = [];
|
|
147
|
+
if (chat.isArchived)
|
|
148
|
+
status.push('archived');
|
|
149
|
+
if (chat.isMuted)
|
|
150
|
+
status.push('muted');
|
|
151
|
+
if (chat.isPinned)
|
|
152
|
+
status.push('pinned');
|
|
153
|
+
if (status.length > 0)
|
|
154
|
+
lines.push(`This chat is ${status.join(', ')}.`);
|
|
155
|
+
return lines.join('\n');
|
|
156
|
+
};
|
|
157
|
+
exports.formatChatToMarkdown = formatChatToMarkdown;
|
|
158
|
+
const parseLocalDateKey = (key) => {
|
|
159
|
+
const parsed = (0, date_fns_1.parse)(key, 'yyyy-MM-dd', new Date());
|
|
160
|
+
if (isNaN(parsed.getTime())) {
|
|
161
|
+
throw new Error(`Invalid date key: ${key}`);
|
|
162
|
+
}
|
|
163
|
+
return parsed;
|
|
164
|
+
};
|
|
165
|
+
const mapMessagesToText = (output, input, ctx) => {
|
|
166
|
+
const { items, hasMore } = output;
|
|
167
|
+
const chats = output?.body?.chats ?? {};
|
|
168
|
+
const messageCount = items.length;
|
|
169
|
+
const chatCount = Object.keys(chats).length;
|
|
170
|
+
// Determine if search filters would cause gaps in timeline
|
|
171
|
+
// Gaps occur when filtering by: query text, sender, or media types
|
|
172
|
+
// Gaps do NOT occur when only filtering by: chatIDs, accountIDs, chatType, or date ranges
|
|
173
|
+
const hasGapCausingFilters = input && (input.query || input.sender || (input.mediaTypes && input.mediaTypes.length > 0));
|
|
174
|
+
const paginationInfo = [];
|
|
175
|
+
if (messageCount === 0) {
|
|
176
|
+
if (!chats || chatCount === 0) {
|
|
177
|
+
paginationInfo.push('No matching chats found');
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
paginationInfo.push(`No messages found in ${chatCount} chat${chatCount === 1 ? '' : 's'}`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
else if (hasMore) {
|
|
184
|
+
paginationInfo.push(`Found ${messageCount}+ messages across ${chatCount} chat${chatCount === 1 ? '' : 's'} (showing ${messageCount})`);
|
|
185
|
+
if (output.oldestCursor) {
|
|
186
|
+
paginationInfo.push(`Next page (older): cursor='${output.oldestCursor}', direction='before'`);
|
|
187
|
+
}
|
|
188
|
+
if (output.newestCursor) {
|
|
189
|
+
paginationInfo.push(`Previous page (newer): cursor='${output.newestCursor}', direction='after'`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
paginationInfo.push(`Found ${messageCount} message${messageCount === 1 ? '' : 's'} across ${chatCount} chat${chatCount === 1 ? '' : 's'} (complete)`);
|
|
194
|
+
}
|
|
195
|
+
if (hasGapCausingFilters && messageCount > 0) {
|
|
196
|
+
paginationInfo.push('⚠️ Filtered results: only showing messages matching your search criteria.');
|
|
197
|
+
}
|
|
198
|
+
const messagesByChat = new Map();
|
|
199
|
+
for (const message of items) {
|
|
200
|
+
const chatMessages = messagesByChat.get(message.chatID) || [];
|
|
201
|
+
chatMessages.push(message);
|
|
202
|
+
messagesByChat.set(message.chatID, chatMessages);
|
|
203
|
+
}
|
|
204
|
+
const chatSummaries = [];
|
|
205
|
+
for (const [chatID, messages] of messagesByChat) {
|
|
206
|
+
const chat = chats[chatID];
|
|
207
|
+
if (chat) {
|
|
208
|
+
chatSummaries.push(`# ${chat.title} [${messages.length} message${messages.length === 1 ? '' : 's'}]`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const headerLines = [...paginationInfo, '', ...chatSummaries];
|
|
212
|
+
const summary = headerLines.join('\n');
|
|
213
|
+
const chatSections = [];
|
|
214
|
+
for (const [chatID, messages] of messagesByChat) {
|
|
215
|
+
const chat = chats[chatID];
|
|
216
|
+
if (!chat)
|
|
217
|
+
continue;
|
|
218
|
+
const participantList = chat.participants?.items ? (0, exports.formatParticipantsToMarkdown)(chat.participants.items, 3) : '';
|
|
219
|
+
const participantInfo = participantList ? ` with ${participantList}` : '';
|
|
220
|
+
const openURL = ctx?.apiBaseURL ? (0, exports.createOpenLink)(ctx.apiBaseURL, chat.localChatID ?? chat.id) : undefined;
|
|
221
|
+
const title = openURL ? `[${chat.title}](${openURL})` : chat.title;
|
|
222
|
+
chatSections.push(`# ${title} (chatID: ${chat.localChatID})`);
|
|
223
|
+
chatSections.push(`Chat on ${chat.network}${participantInfo}.`);
|
|
224
|
+
chatSections.push('');
|
|
225
|
+
const messagesByDate = new Map();
|
|
226
|
+
for (const message of messages) {
|
|
227
|
+
const dateKey = (0, date_fns_1.format)(new Date(message.timestamp), 'yyyy-MM-dd');
|
|
228
|
+
const dateMessages = messagesByDate.get(dateKey) || [];
|
|
229
|
+
dateMessages.push(message);
|
|
230
|
+
messagesByDate.set(dateKey, dateMessages);
|
|
231
|
+
}
|
|
232
|
+
const sortedDates = Array.from(messagesByDate.keys()).sort();
|
|
233
|
+
const participantMap = chat?.participants?.items ?
|
|
234
|
+
new Map(chat.participants.items.map((p) => [p.id, p]))
|
|
235
|
+
: undefined;
|
|
236
|
+
for (let i = 0; i < sortedDates.length; i++) {
|
|
237
|
+
const dateKey = sortedDates[i];
|
|
238
|
+
const dateObj = parseLocalDateKey(dateKey);
|
|
239
|
+
const relativeTime = (0, exports.formatRelativeDate)(dateObj);
|
|
240
|
+
chatSections.push(`## ${relativeTime} (${dateKey})`);
|
|
241
|
+
chatSections.push('');
|
|
242
|
+
const dateMessages = messagesByDate.get(dateKey) || [];
|
|
243
|
+
dateMessages.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
244
|
+
for (const message of dateMessages) {
|
|
245
|
+
const time = new Date(message.timestamp);
|
|
246
|
+
const timeStr = (0, date_fns_1.format)(time, 'HH:mm');
|
|
247
|
+
const baseSenderName = message.senderName || message.senderID;
|
|
248
|
+
const senderName = message.isSender ? `${baseSenderName} (You)` : baseSenderName;
|
|
249
|
+
const maxTextLength = ctx?.maxTextLength ?? 1000;
|
|
250
|
+
let text = message.text || '';
|
|
251
|
+
if (text && text.length > maxTextLength) {
|
|
252
|
+
const remainingChars = text.length - maxTextLength;
|
|
253
|
+
text = text.substring(0, maxTextLength) + `... [+${remainingChars} chars]`;
|
|
254
|
+
}
|
|
255
|
+
const attachment = message.attachments?.[0]; // Assume single attachment
|
|
256
|
+
const attachmentChatID = chat.localChatID ?? chat.id;
|
|
257
|
+
const attachmentLink = attachment && attachmentChatID ?
|
|
258
|
+
`\n📎 [${attachment.fileName || 'attachment'}](beeper-mcp://attachments/${attachmentChatID}/${message.id}/0)`
|
|
259
|
+
: '';
|
|
260
|
+
const reactionsStr = (0, exports.formatReactionsToMarkdown)(message.reactions, participantMap);
|
|
261
|
+
const sortKeyLink = chat.localChatID ?
|
|
262
|
+
`([open at sort key](${(0, exports.createOpenLink)(ctx?.apiBaseURL || '', chat.localChatID, String(message.sortKey))}))`
|
|
263
|
+
: `(sortKey: ${message.sortKey})`;
|
|
264
|
+
const messageStr = `**${senderName}** (${timeStr}): ${text}${attachmentLink}${reactionsStr} ${sortKeyLink}`;
|
|
265
|
+
chatSections.push(messageStr);
|
|
266
|
+
chatSections.push('');
|
|
267
|
+
}
|
|
268
|
+
// Add date gap indicator when dates are not consecutive
|
|
269
|
+
if (i < sortedDates.length - 1) {
|
|
270
|
+
const nextDateKey = sortedDates[i + 1];
|
|
271
|
+
const currentDate = parseLocalDateKey(dateKey);
|
|
272
|
+
const nextDate = parseLocalDateKey(nextDateKey);
|
|
273
|
+
const dayDiff = (0, date_fns_1.differenceInDays)(nextDate, currentDate);
|
|
274
|
+
// Only show gap if dates are not consecutive
|
|
275
|
+
if (dayDiff > 1) {
|
|
276
|
+
const gapDays = dayDiff - 1;
|
|
277
|
+
chatSections.push(`*[... ${gapDays} day${gapDays === 1 ? '' : 's'} gap ...]*`);
|
|
278
|
+
chatSections.push('');
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return [summary, '', ...chatSections].join('\n');
|
|
284
|
+
};
|
|
285
|
+
exports.mapMessagesToText = mapMessagesToText;
|
|
286
|
+
function asMarkdownContentResult(text) {
|
|
287
|
+
return {
|
|
288
|
+
content: [
|
|
289
|
+
{
|
|
290
|
+
type: 'text',
|
|
291
|
+
text: Array.isArray(text) ? text.join('\n') : text,
|
|
292
|
+
},
|
|
293
|
+
],
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingUR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