@opentabs-dev/opentabs-plugin-linkedin 0.0.74
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 +159 -0
- package/dist/adapter.iife.js +14733 -0
- package/dist/adapter.iife.js.map +7 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/linkedin-api.d.ts +34 -0
- package/dist/linkedin-api.d.ts.map +1 -0
- package/dist/linkedin-api.js +200 -0
- package/dist/linkedin-api.js.map +1 -0
- package/dist/tools/get-conversation-messages.d.ts +14 -0
- package/dist/tools/get-conversation-messages.d.ts.map +1 -0
- package/dist/tools/get-conversation-messages.js +27 -0
- package/dist/tools/get-conversation-messages.js.map +1 -0
- package/dist/tools/get-current-user.d.ts +14 -0
- package/dist/tools/get-current-user.d.ts.map +1 -0
- package/dist/tools/get-current-user.js +21 -0
- package/dist/tools/get-current-user.js.map +1 -0
- package/dist/tools/get-mailbox-counts.d.ts +8 -0
- package/dist/tools/get-mailbox-counts.d.ts.map +1 -0
- package/dist/tools/get-mailbox-counts.js +26 -0
- package/dist/tools/get-mailbox-counts.js.map +1 -0
- package/dist/tools/get-user-profile.d.ts +19 -0
- package/dist/tools/get-user-profile.d.ts.map +1 -0
- package/dist/tools/get-user-profile.js +37 -0
- package/dist/tools/get-user-profile.js.map +1 -0
- package/dist/tools/list-conversations.d.ts +17 -0
- package/dist/tools/list-conversations.d.ts.map +1 -0
- package/dist/tools/list-conversations.js +26 -0
- package/dist/tools/list-conversations.js.map +1 -0
- package/dist/tools/schemas.d.ts +213 -0
- package/dist/tools/schemas.d.ts.map +1 -0
- package/dist/tools/schemas.js +128 -0
- package/dist/tools/schemas.js.map +1 -0
- package/dist/tools/send-message.d.ts +8 -0
- package/dist/tools/send-message.d.ts.map +1 -0
- package/dist/tools/send-message.js +38 -0
- package/dist/tools/send-message.js.map +1 -0
- package/dist/tools.json +421 -0
- package/package.json +54 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OpenTabsPlugin } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import type { ToolDefinition } from '@opentabs-dev/plugin-sdk';
|
|
3
|
+
declare class LinkedInPlugin extends OpenTabsPlugin {
|
|
4
|
+
readonly name = "linkedin";
|
|
5
|
+
readonly description = "OpenTabs plugin for LinkedIn";
|
|
6
|
+
readonly displayName = "LinkedIn";
|
|
7
|
+
readonly urlPatterns: string[];
|
|
8
|
+
readonly homepage = "https://www.linkedin.com";
|
|
9
|
+
readonly tools: ToolDefinition[];
|
|
10
|
+
isReady(): Promise<boolean>;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: LinkedInPlugin;
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAS/D,cAAM,cAAe,SAAQ,cAAc;IACzC,QAAQ,CAAC,IAAI,cAAc;IAC3B,QAAQ,CAAC,WAAW,kCAAkC;IACtD,SAAkB,WAAW,cAAc;IAC3C,QAAQ,CAAC,WAAW,WAA4B;IAChD,SAAkB,QAAQ,8BAA8B;IACxD,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,CAS9B;IAEI,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;CAIlC;;AAED,wBAAoC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { OpenTabsPlugin } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { isAuthenticated, waitForAuth } from './linkedin-api.js';
|
|
3
|
+
import { getConversationMessages } from './tools/get-conversation-messages.js';
|
|
4
|
+
import { getCurrentUser } from './tools/get-current-user.js';
|
|
5
|
+
import { getMailboxCounts } from './tools/get-mailbox-counts.js';
|
|
6
|
+
import { getUserProfile } from './tools/get-user-profile.js';
|
|
7
|
+
import { listConversations } from './tools/list-conversations.js';
|
|
8
|
+
import { sendMessage } from './tools/send-message.js';
|
|
9
|
+
class LinkedInPlugin extends OpenTabsPlugin {
|
|
10
|
+
name = 'linkedin';
|
|
11
|
+
description = 'OpenTabs plugin for LinkedIn';
|
|
12
|
+
displayName = 'LinkedIn';
|
|
13
|
+
urlPatterns = ['*://*.linkedin.com/*'];
|
|
14
|
+
homepage = 'https://www.linkedin.com';
|
|
15
|
+
tools = [
|
|
16
|
+
// Profile
|
|
17
|
+
getCurrentUser,
|
|
18
|
+
getUserProfile,
|
|
19
|
+
// Messaging
|
|
20
|
+
listConversations,
|
|
21
|
+
getConversationMessages,
|
|
22
|
+
sendMessage,
|
|
23
|
+
getMailboxCounts,
|
|
24
|
+
];
|
|
25
|
+
async isReady() {
|
|
26
|
+
if (isAuthenticated())
|
|
27
|
+
return true;
|
|
28
|
+
return waitForAuth();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export default new LinkedInPlugin();
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,cAAe,SAAQ,cAAc;IAChC,IAAI,GAAG,UAAU,CAAC;IAClB,WAAW,GAAG,8BAA8B,CAAC;IACpC,WAAW,GAAG,UAAU,CAAC;IAClC,WAAW,GAAG,CAAC,sBAAsB,CAAC,CAAC;IAC9B,QAAQ,GAAG,0BAA0B,CAAC;IAC/C,KAAK,GAAqB;QACjC,UAAU;QACV,cAAc;QACd,cAAc;QACd,YAAY;QACZ,iBAAiB;QACjB,uBAAuB;QACvB,WAAW;QACX,gBAAgB;KACjB,CAAC;IAEF,KAAK,CAAC,OAAO;QACX,IAAI,eAAe,EAAE;YAAE,OAAO,IAAI,CAAC;QACnC,OAAO,WAAW,EAAE,CAAC;IACvB,CAAC;CACF;AAED,eAAe,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const isAuthenticated: () => boolean;
|
|
2
|
+
export declare const waitForAuth: () => Promise<boolean>;
|
|
3
|
+
/**
|
|
4
|
+
* Call a LinkedIn Voyager REST API endpoint.
|
|
5
|
+
*/
|
|
6
|
+
export declare const api: <T>(endpoint: string, options?: {
|
|
7
|
+
method?: string;
|
|
8
|
+
body?: Record<string, unknown>;
|
|
9
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
10
|
+
}) => Promise<T>;
|
|
11
|
+
/**
|
|
12
|
+
* Encode a LinkedIn URN for use in GraphQL variable strings.
|
|
13
|
+
* LinkedIn requires full URI encoding of URN values within variable parentheses,
|
|
14
|
+
* including parentheses themselves which encodeURIComponent does not encode.
|
|
15
|
+
*/
|
|
16
|
+
export declare const encodeUrn: (urn: string) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Fetch the current user's profile URN from the /me endpoint.
|
|
19
|
+
* Used by messaging tools that need the mailboxUrn or hostUrn.
|
|
20
|
+
*/
|
|
21
|
+
export declare const getMyProfileUrn: () => Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Call the LinkedIn Messaging GraphQL API.
|
|
24
|
+
* Uses a separate endpoint and accept header from the main Voyager API.
|
|
25
|
+
*
|
|
26
|
+
* queryId hashes are persisted query hashes that change with LinkedIn deployments.
|
|
27
|
+
* When a hash expires, the server returns status 500 with body {"status":500}.
|
|
28
|
+
*/
|
|
29
|
+
export declare const messagingGraphql: <T>(queryId: string, variables: string) => Promise<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Post a messaging action (send message, mark read, etc.) via the messaging REST API.
|
|
32
|
+
*/
|
|
33
|
+
export declare const messagingAction: <T>(endpoint: string, body: Record<string, unknown>) => Promise<T>;
|
|
34
|
+
//# sourceMappingURL=linkedin-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkedin-api.d.ts","sourceRoot":"","sources":["../src/linkedin-api.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,eAAe,QAAO,OAAkC,CAAC;AAEtE,eAAO,MAAM,WAAW,QAAO,OAAO,CAAC,OAAO,CAI3C,CAAC;AAmCJ;;GAEG;AACH,eAAO,MAAM,GAAG,GAAU,CAAC,EACzB,UAAU,MAAM,EAChB,UAAS;IACP,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;CAC1D,KACL,OAAO,CAAC,CAAC,CA2CX,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,KAAG,MAA6E,CAAC;AAMtH;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAa,OAAO,CAAC,MAAM,CAKtD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAU,CAAC,EAAE,SAAS,MAAM,EAAE,WAAW,MAAM,KAAG,OAAO,CAAC,CAAC,CAwCvF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAU,CAAC,EAAE,UAAU,MAAM,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,OAAO,CAAC,CAAC,CAsCnG,CAAC"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { ToolError, getCookie, parseRetryAfterMs, waitUntil } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
const VOYAGER_BASE = '/voyager/api';
|
|
3
|
+
const MESSAGING_GRAPHQL_BASE = '/voyager/api/voyagerMessagingGraphQL/graphql';
|
|
4
|
+
/**
|
|
5
|
+
* LinkedIn uses the JSESSIONID cookie value as the CSRF token.
|
|
6
|
+
* The cookie is non-HttpOnly and accessible via document.cookie.
|
|
7
|
+
*/
|
|
8
|
+
const getCsrfToken = () => {
|
|
9
|
+
const value = getCookie('JSESSIONID');
|
|
10
|
+
if (!value)
|
|
11
|
+
return null;
|
|
12
|
+
return value.replace(/"/g, '');
|
|
13
|
+
};
|
|
14
|
+
export const isAuthenticated = () => getCsrfToken() !== null;
|
|
15
|
+
export const waitForAuth = () => waitUntil(() => isAuthenticated(), { interval: 500, timeout: 5000 }).then(() => true, () => false);
|
|
16
|
+
const getHeaders = () => {
|
|
17
|
+
const csrf = getCsrfToken();
|
|
18
|
+
if (!csrf)
|
|
19
|
+
throw ToolError.auth('Not authenticated — please log in to LinkedIn.');
|
|
20
|
+
return {
|
|
21
|
+
'csrf-token': csrf,
|
|
22
|
+
'x-restli-protocol-version': '2.0.0',
|
|
23
|
+
'x-li-lang': 'en_US',
|
|
24
|
+
'x-li-track': JSON.stringify({
|
|
25
|
+
clientVersion: '1.13.42665',
|
|
26
|
+
mpVersion: '1.13.42665',
|
|
27
|
+
osName: 'web',
|
|
28
|
+
timezoneOffset: new Date().getTimezoneOffset() / -60,
|
|
29
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
30
|
+
deviceFormFactor: 'DESKTOP',
|
|
31
|
+
mpName: 'voyager-web',
|
|
32
|
+
displayDensity: window.devicePixelRatio,
|
|
33
|
+
displayWidth: window.screen.width,
|
|
34
|
+
displayHeight: window.screen.height,
|
|
35
|
+
}),
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const classifyError = (status, body, endpoint, headers) => {
|
|
39
|
+
if (status === 429) {
|
|
40
|
+
const retryAfter = headers.get('Retry-After');
|
|
41
|
+
throw ToolError.rateLimited(`Rate limited: ${endpoint}`, retryAfter ? parseRetryAfterMs(retryAfter) : undefined);
|
|
42
|
+
}
|
|
43
|
+
if (status === 401 || status === 403)
|
|
44
|
+
throw ToolError.auth(`Auth error (${status}): ${body}`);
|
|
45
|
+
if (status === 404)
|
|
46
|
+
throw ToolError.notFound(`Not found: ${endpoint}`);
|
|
47
|
+
if (status === 422)
|
|
48
|
+
throw ToolError.validation(`Validation error: ${body}`);
|
|
49
|
+
throw ToolError.internal(`API error (${status}): ${endpoint} — ${body}`);
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Call a LinkedIn Voyager REST API endpoint.
|
|
53
|
+
*/
|
|
54
|
+
export const api = async (endpoint, options = {}) => {
|
|
55
|
+
const headers = getHeaders();
|
|
56
|
+
let url = `${VOYAGER_BASE}${endpoint}`;
|
|
57
|
+
if (options.query) {
|
|
58
|
+
const params = new URLSearchParams();
|
|
59
|
+
for (const [k, v] of Object.entries(options.query))
|
|
60
|
+
if (v !== undefined)
|
|
61
|
+
params.append(k, String(v));
|
|
62
|
+
const qs = params.toString();
|
|
63
|
+
if (qs)
|
|
64
|
+
url += `?${qs}`;
|
|
65
|
+
}
|
|
66
|
+
let fetchBody;
|
|
67
|
+
if (options.body) {
|
|
68
|
+
headers['Content-Type'] = 'application/json';
|
|
69
|
+
fetchBody = JSON.stringify(options.body);
|
|
70
|
+
}
|
|
71
|
+
const method = options.method ?? 'GET';
|
|
72
|
+
let response;
|
|
73
|
+
try {
|
|
74
|
+
response = await fetch(url, {
|
|
75
|
+
method,
|
|
76
|
+
headers,
|
|
77
|
+
body: fetchBody,
|
|
78
|
+
credentials: 'include',
|
|
79
|
+
signal: AbortSignal.timeout(30_000),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
if (err instanceof DOMException && err.name === 'TimeoutError')
|
|
84
|
+
throw ToolError.timeout(`Timed out: ${endpoint}`);
|
|
85
|
+
throw new ToolError(`Network error: ${err instanceof Error ? err.message : String(err)}`, 'network_error', {
|
|
86
|
+
category: 'internal',
|
|
87
|
+
retryable: true,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (!response.ok) {
|
|
91
|
+
const body = (await response.text().catch(() => '')).substring(0, 512);
|
|
92
|
+
classifyError(response.status, body, endpoint, response.headers);
|
|
93
|
+
}
|
|
94
|
+
if (response.status === 204)
|
|
95
|
+
return {};
|
|
96
|
+
return (await response.json());
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Encode a LinkedIn URN for use in GraphQL variable strings.
|
|
100
|
+
* LinkedIn requires full URI encoding of URN values within variable parentheses,
|
|
101
|
+
* including parentheses themselves which encodeURIComponent does not encode.
|
|
102
|
+
*/
|
|
103
|
+
export const encodeUrn = (urn) => encodeURIComponent(urn).replace(/\(/g, '%28').replace(/\)/g, '%29');
|
|
104
|
+
/**
|
|
105
|
+
* Fetch the current user's profile URN from the /me endpoint.
|
|
106
|
+
* Used by messaging tools that need the mailboxUrn or hostUrn.
|
|
107
|
+
*/
|
|
108
|
+
export const getMyProfileUrn = async () => {
|
|
109
|
+
const me = await api('/me');
|
|
110
|
+
const profileUrn = me.miniProfile?.dashEntityUrn;
|
|
111
|
+
if (!profileUrn)
|
|
112
|
+
throw ToolError.auth('Could not determine current user profile URN.');
|
|
113
|
+
return profileUrn;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Call the LinkedIn Messaging GraphQL API.
|
|
117
|
+
* Uses a separate endpoint and accept header from the main Voyager API.
|
|
118
|
+
*
|
|
119
|
+
* queryId hashes are persisted query hashes that change with LinkedIn deployments.
|
|
120
|
+
* When a hash expires, the server returns status 500 with body {"status":500}.
|
|
121
|
+
*/
|
|
122
|
+
export const messagingGraphql = async (queryId, variables) => {
|
|
123
|
+
const csrf = getCsrfToken();
|
|
124
|
+
if (!csrf)
|
|
125
|
+
throw ToolError.auth('Not authenticated — please log in to LinkedIn.');
|
|
126
|
+
const headers = {
|
|
127
|
+
'csrf-token': csrf,
|
|
128
|
+
'x-restli-protocol-version': '2.0.0',
|
|
129
|
+
accept: 'application/graphql',
|
|
130
|
+
};
|
|
131
|
+
const url = `${MESSAGING_GRAPHQL_BASE}?queryId=${queryId}&variables=${variables}`;
|
|
132
|
+
let response;
|
|
133
|
+
try {
|
|
134
|
+
response = await fetch(url, {
|
|
135
|
+
method: 'GET',
|
|
136
|
+
headers,
|
|
137
|
+
credentials: 'include',
|
|
138
|
+
signal: AbortSignal.timeout(30_000),
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
if (err instanceof DOMException && err.name === 'TimeoutError')
|
|
143
|
+
throw ToolError.timeout(`Timed out: messaging graphql ${queryId}`);
|
|
144
|
+
throw new ToolError(`Network error: ${err instanceof Error ? err.message : String(err)}`, 'network_error', {
|
|
145
|
+
category: 'internal',
|
|
146
|
+
retryable: true,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
if (!response.ok) {
|
|
150
|
+
const body = (await response.text().catch(() => '')).substring(0, 512);
|
|
151
|
+
if (response.status === 500 && body.includes('"status":500')) {
|
|
152
|
+
throw ToolError.internal('Persisted query hash expired — LinkedIn may have deployed a new client version. Try reloading the LinkedIn tab.');
|
|
153
|
+
}
|
|
154
|
+
classifyError(response.status, body, `messaging:${queryId}`, response.headers);
|
|
155
|
+
}
|
|
156
|
+
return (await response.json());
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Post a messaging action (send message, mark read, etc.) via the messaging REST API.
|
|
160
|
+
*/
|
|
161
|
+
export const messagingAction = async (endpoint, body) => {
|
|
162
|
+
const csrf = getCsrfToken();
|
|
163
|
+
if (!csrf)
|
|
164
|
+
throw ToolError.auth('Not authenticated — please log in to LinkedIn.');
|
|
165
|
+
const headers = {
|
|
166
|
+
'csrf-token': csrf,
|
|
167
|
+
'x-restli-protocol-version': '2.0.0',
|
|
168
|
+
'Content-Type': 'application/json',
|
|
169
|
+
};
|
|
170
|
+
const url = `${VOYAGER_BASE}${endpoint}`;
|
|
171
|
+
let response;
|
|
172
|
+
try {
|
|
173
|
+
response = await fetch(url, {
|
|
174
|
+
method: 'POST',
|
|
175
|
+
headers,
|
|
176
|
+
body: JSON.stringify(body),
|
|
177
|
+
credentials: 'include',
|
|
178
|
+
signal: AbortSignal.timeout(30_000),
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
catch (err) {
|
|
182
|
+
if (err instanceof DOMException && err.name === 'TimeoutError')
|
|
183
|
+
throw ToolError.timeout(`Timed out: ${endpoint}`);
|
|
184
|
+
throw new ToolError(`Network error: ${err instanceof Error ? err.message : String(err)}`, 'network_error', {
|
|
185
|
+
category: 'internal',
|
|
186
|
+
retryable: true,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
if (!response.ok) {
|
|
190
|
+
const text = (await response.text().catch(() => '')).substring(0, 512);
|
|
191
|
+
classifyError(response.status, text, endpoint, response.headers);
|
|
192
|
+
}
|
|
193
|
+
if (response.status === 204)
|
|
194
|
+
return {};
|
|
195
|
+
const text = await response.text();
|
|
196
|
+
if (!text)
|
|
197
|
+
return {};
|
|
198
|
+
return JSON.parse(text);
|
|
199
|
+
};
|
|
200
|
+
//# sourceMappingURL=linkedin-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkedin-api.js","sourceRoot":"","sources":["../src/linkedin-api.ts"],"names":[],"mappings":"AAAA,OAA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GAAG,CAAC,EAAE,EAAE,eAAe,EAAE;YACzG,QAAQ,EAAE,UAAU;YACpB,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACvE,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IACnE,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG;QAAE,OAAO,EAAO,CAAC;IAC5C,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,IAAI,CAAC,IAAI;QAAE,OAAO,EAAO,CAAC;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC;AAC/B,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getConversationMessages: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
conversation_urn: z.ZodString;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
6
|
+
message_urn: z.ZodString;
|
|
7
|
+
text: z.ZodString;
|
|
8
|
+
sender_name: z.ZodString;
|
|
9
|
+
sender_profile_urn: z.ZodString;
|
|
10
|
+
delivered_at: z.ZodNumber;
|
|
11
|
+
subject: z.ZodString;
|
|
12
|
+
}, z.core.$strip>>;
|
|
13
|
+
}, z.core.$strip>>;
|
|
14
|
+
//# sourceMappingURL=get-conversation-messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-conversation-messages.d.ts","sourceRoot":"","sources":["../../src/tools/get-conversation-messages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,eAAO,MAAM,uBAAuB;;;;;;;;;;;kBAyBlC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { encodeUrn, messagingGraphql } from '../linkedin-api.js';
|
|
4
|
+
import { mapMessage, messageSchema } from './schemas.js';
|
|
5
|
+
/** Persisted query hash for messages in a conversation — changes with LinkedIn deployments. */
|
|
6
|
+
const MESSAGES_QUERY_ID = 'messengerMessages.5846eeb71c981f11e0134cb6626cc314';
|
|
7
|
+
export const getConversationMessages = defineTool({
|
|
8
|
+
name: 'get_conversation_messages',
|
|
9
|
+
displayName: 'Get Conversation Messages',
|
|
10
|
+
description: 'Get messages from a specific LinkedIn messaging conversation. Requires the conversation URN from list_conversations. Returns messages with sender info and timestamps.',
|
|
11
|
+
summary: 'Read messages in a conversation',
|
|
12
|
+
icon: 'message-square-text',
|
|
13
|
+
group: 'Messaging',
|
|
14
|
+
input: z.object({
|
|
15
|
+
conversation_urn: z.string().describe('Conversation URN (e.g., "urn:li:msg_conversation:(...)")'),
|
|
16
|
+
}),
|
|
17
|
+
output: z.object({
|
|
18
|
+
messages: z.array(messageSchema).describe('Messages in the conversation'),
|
|
19
|
+
}),
|
|
20
|
+
handle: async (params) => {
|
|
21
|
+
const data = await messagingGraphql(MESSAGES_QUERY_ID, `(conversationUrn:${encodeUrn(params.conversation_urn)})`);
|
|
22
|
+
const elements = data.data?.messengerMessagesBySyncToken?.elements ?? [];
|
|
23
|
+
const messages = elements.map(el => mapMessage(el));
|
|
24
|
+
return { messages };
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=get-conversation-messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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,EAAE,QAAQ,EAAE,CAAC;IACtB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getCurrentUser: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
3
|
+
user: z.ZodObject<{
|
|
4
|
+
plain_id: z.ZodNumber;
|
|
5
|
+
first_name: z.ZodString;
|
|
6
|
+
last_name: z.ZodString;
|
|
7
|
+
occupation: z.ZodString;
|
|
8
|
+
public_identifier: z.ZodString;
|
|
9
|
+
profile_urn: z.ZodString;
|
|
10
|
+
profile_picture_url: z.ZodString;
|
|
11
|
+
is_premium: z.ZodBoolean;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
}, z.core.$strip>>;
|
|
14
|
+
//# sourceMappingURL=get-current-user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-current-user.d.ts","sourceRoot":"","sources":["../../src/tools/get-current-user.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,cAAc;;;;;;;;;;;kBAgBzB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { api } from '../linkedin-api.js';
|
|
4
|
+
import { currentUserSchema, mapCurrentUser } from './schemas.js';
|
|
5
|
+
export const getCurrentUser = defineTool({
|
|
6
|
+
name: 'get_current_user',
|
|
7
|
+
displayName: 'Get Current User',
|
|
8
|
+
description: 'Get the authenticated LinkedIn user profile including name, headline, public identifier, and profile picture.',
|
|
9
|
+
summary: 'Get the current authenticated user',
|
|
10
|
+
icon: 'user',
|
|
11
|
+
group: 'Profile',
|
|
12
|
+
input: z.object({}),
|
|
13
|
+
output: z.object({
|
|
14
|
+
user: currentUserSchema.describe('Current user profile'),
|
|
15
|
+
}),
|
|
16
|
+
handle: async () => {
|
|
17
|
+
const data = await api('/me');
|
|
18
|
+
return { user: mapCurrentUser(data) };
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=get-current-user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-current-user.js","sourceRoot":"","sources":["../../src/tools/get-current-user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAsB,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAErF,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EACT,+GAA+G;IACjH,OAAO,EAAE,oCAAoC;IAC7C,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACnB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,iBAAiB,CAAC,QAAQ,CAAC,sBAAsB,CAAC;KACzD,CAAC;IACF,MAAM,EAAE,KAAK,IAAI,EAAE;QACjB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAgB,KAAK,CAAC,CAAC;QAC7C,OAAO,EAAE,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;IACxC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getMailboxCounts: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
3
|
+
counts: z.ZodArray<z.ZodObject<{
|
|
4
|
+
category: z.ZodString;
|
|
5
|
+
unread_count: z.ZodNumber;
|
|
6
|
+
}, z.core.$strip>>;
|
|
7
|
+
}, z.core.$strip>>;
|
|
8
|
+
//# sourceMappingURL=get-mailbox-counts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-mailbox-counts.d.ts","sourceRoot":"","sources":["../../src/tools/get-mailbox-counts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,eAAO,MAAM,gBAAgB;;;;;kBAyB3B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { encodeUrn, getMyProfileUrn, messagingGraphql } from '../linkedin-api.js';
|
|
4
|
+
import { mailboxCountSchema, mapMailboxCount } from './schemas.js';
|
|
5
|
+
/** Persisted query hash for mailbox counts — changes with LinkedIn deployments. */
|
|
6
|
+
const MAILBOX_COUNTS_QUERY_ID = 'messengerMailboxCounts.fc528a5a81a76dff212a4a3d2d48e84b';
|
|
7
|
+
export const getMailboxCounts = defineTool({
|
|
8
|
+
name: 'get_mailbox_counts',
|
|
9
|
+
displayName: 'Get Mailbox Counts',
|
|
10
|
+
description: 'Get unread message counts per mailbox category (Inbox, Secondary Inbox, Message Requests, Archive, Spam).',
|
|
11
|
+
summary: 'Get unread message counts',
|
|
12
|
+
icon: 'inbox',
|
|
13
|
+
group: 'Messaging',
|
|
14
|
+
input: z.object({}),
|
|
15
|
+
output: z.object({
|
|
16
|
+
counts: z.array(mailboxCountSchema).describe('Unread counts per mailbox category'),
|
|
17
|
+
}),
|
|
18
|
+
handle: async () => {
|
|
19
|
+
const profileUrn = await getMyProfileUrn();
|
|
20
|
+
const data = await messagingGraphql(MAILBOX_COUNTS_QUERY_ID, `(mailboxUrn:${encodeUrn(profileUrn)})`);
|
|
21
|
+
const elements = data.data?.messengerMailboxCountsByMailbox?.elements ?? [];
|
|
22
|
+
const counts = elements.map(el => mapMailboxCount(el));
|
|
23
|
+
return { counts };
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=get-mailbox-counts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-mailbox-counts.js","sourceRoot":"","sources":["../../src/tools/get-mailbox-counts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEnE,mFAAmF;AACnF,MAAM,uBAAuB,GAAG,yDAAyD,CAAC;AAU1F,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;IACzC,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EACT,2GAA2G;IAC7G,OAAO,EAAE,2BAA2B;IACpC,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACnB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,oCAAoC,CAAC;KACnF,CAAC;IACF,MAAM,EAAE,KAAK,IAAI,EAAE;QACjB,MAAM,UAAU,GAAG,MAAM,eAAe,EAAE,CAAC;QAE3C,MAAM,IAAI,GAAG,MAAM,gBAAgB,CACjC,uBAAuB,EACvB,eAAe,SAAS,CAAC,UAAU,CAAC,GAAG,CACxC,CAAC;QAEF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,EAAE,+BAA+B,EAAE,QAAQ,IAAI,EAAE,CAAC;QAC5E,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,eAAe,CAAC,EAA2C,CAAC,CAAC,CAAC;QAEhG,OAAO,EAAE,MAAM,EAAE,CAAC;IACpB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getUserProfile: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
public_identifier: z.ZodString;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
profile: z.ZodObject<{
|
|
6
|
+
first_name: z.ZodString;
|
|
7
|
+
last_name: z.ZodString;
|
|
8
|
+
headline: z.ZodString;
|
|
9
|
+
public_identifier: z.ZodString;
|
|
10
|
+
profile_urn: z.ZodString;
|
|
11
|
+
profile_picture_url: z.ZodString;
|
|
12
|
+
location: z.ZodString;
|
|
13
|
+
country: z.ZodString;
|
|
14
|
+
is_premium: z.ZodBoolean;
|
|
15
|
+
is_influencer: z.ZodBoolean;
|
|
16
|
+
is_creator: z.ZodBoolean;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
}, z.core.$strip>>;
|
|
19
|
+
//# sourceMappingURL=get-user-profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-user-profile.d.ts","sourceRoot":"","sources":["../../src/tools/get-user-profile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;kBAkCzB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ToolError, defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { api } from '../linkedin-api.js';
|
|
4
|
+
import { mapProfile, profileSchema } from './schemas.js';
|
|
5
|
+
export const getUserProfile = defineTool({
|
|
6
|
+
name: 'get_user_profile',
|
|
7
|
+
displayName: 'Get User Profile',
|
|
8
|
+
description: 'Get a LinkedIn user profile by their public identifier (the slug from their profile URL, e.g., "williamhgates" for linkedin.com/in/williamhgates). Returns name, headline, location, and profile picture.',
|
|
9
|
+
summary: "Get a user's LinkedIn profile",
|
|
10
|
+
icon: 'user-search',
|
|
11
|
+
group: 'Profile',
|
|
12
|
+
input: z.object({
|
|
13
|
+
public_identifier: z
|
|
14
|
+
.string()
|
|
15
|
+
.describe('Public profile identifier — the slug from the LinkedIn profile URL (e.g., "williamhgates")'),
|
|
16
|
+
}),
|
|
17
|
+
output: z.object({
|
|
18
|
+
profile: profileSchema.describe('User profile'),
|
|
19
|
+
}),
|
|
20
|
+
handle: async (params) => {
|
|
21
|
+
const data = await api('/identity/dash/profiles', {
|
|
22
|
+
query: {
|
|
23
|
+
q: 'memberIdentity',
|
|
24
|
+
memberIdentity: params.public_identifier,
|
|
25
|
+
decorationId: 'com.linkedin.voyager.dash.deco.identity.profile.WebTopCardCore-18',
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
const element = data.elements?.[0];
|
|
29
|
+
if (!element) {
|
|
30
|
+
throw ToolError.notFound(`Profile not found: ${params.public_identifier}`);
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
profile: mapProfile(element),
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=get-user-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-user-profile.js","sourceRoot":"","sources":["../../src/tools/get-user-profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAMzD,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EACT,2MAA2M;IAC7M,OAAO,EAAE,+BAA+B;IACxC,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,iBAAiB,EAAE,CAAC;aACjB,MAAM,EAAE;aACR,QAAQ,CAAC,4FAA4F,CAAC;KAC1G,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,cAAc,CAAC;KAChD,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAkB,yBAAyB,EAAE;YACjE,KAAK,EAAE;gBACL,CAAC,EAAE,gBAAgB;gBACnB,cAAc,EAAE,MAAM,CAAC,iBAAiB;gBACxC,YAAY,EAAE,mEAAmE;aAClF;SACF,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QACnC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,SAAS,CAAC,QAAQ,CAAC,sBAAsB,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAC7E,CAAC;QAED,OAAO;YACL,OAAO,EAAE,UAAU,CAAC,OAA2C,CAAC;SACjE,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const listConversations: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
3
|
+
conversations: z.ZodArray<z.ZodObject<{
|
|
4
|
+
conversation_urn: z.ZodString;
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
last_message_text: z.ZodString;
|
|
7
|
+
last_message_at: z.ZodNumber;
|
|
8
|
+
is_read: z.ZodBoolean;
|
|
9
|
+
notification_status: z.ZodString;
|
|
10
|
+
participants: z.ZodArray<z.ZodObject<{
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
profile_urn: z.ZodString;
|
|
13
|
+
profile_picture_url: z.ZodString;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
}, z.core.$strip>>;
|
|
17
|
+
//# sourceMappingURL=list-conversations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-conversations.d.ts","sourceRoot":"","sources":["../../src/tools/list-conversations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;kBAyB5B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { encodeUrn, getMyProfileUrn, messagingGraphql } from '../linkedin-api.js';
|
|
4
|
+
import { conversationSchema, mapConversation } from './schemas.js';
|
|
5
|
+
/** Persisted query hash for listing conversations — changes with LinkedIn deployments. */
|
|
6
|
+
const CONVERSATIONS_QUERY_ID = 'messengerConversations.0d5e6781bbee71c3e51c8843c6519f48';
|
|
7
|
+
export const listConversations = defineTool({
|
|
8
|
+
name: 'list_conversations',
|
|
9
|
+
displayName: 'List Conversations',
|
|
10
|
+
description: 'List recent messaging conversations from the LinkedIn inbox. Returns conversations with participant names, last message preview, and read status. Results are ordered by most recent activity.',
|
|
11
|
+
summary: 'List messaging conversations',
|
|
12
|
+
icon: 'messages-square',
|
|
13
|
+
group: 'Messaging',
|
|
14
|
+
input: z.object({}),
|
|
15
|
+
output: z.object({
|
|
16
|
+
conversations: z.array(conversationSchema).describe('List of recent conversations'),
|
|
17
|
+
}),
|
|
18
|
+
handle: async () => {
|
|
19
|
+
const profileUrn = await getMyProfileUrn();
|
|
20
|
+
const data = await messagingGraphql(CONVERSATIONS_QUERY_ID, `(mailboxUrn:${encodeUrn(profileUrn)})`);
|
|
21
|
+
const elements = data.data?.messengerConversationsBySyncToken?.elements ?? [];
|
|
22
|
+
const conversations = elements.map(el => mapConversation(el));
|
|
23
|
+
return { conversations };
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=list-conversations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-conversations.js","sourceRoot":"","sources":["../../src/tools/list-conversations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEnE,0FAA0F;AAC1F,MAAM,sBAAsB,GAAG,yDAAyD,CAAC;AAUzF,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;IAC1C,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EACT,gMAAgM;IAClM,OAAO,EAAE,8BAA8B;IACvC,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACnB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,8BAA8B,CAAC;KACpF,CAAC;IACF,MAAM,EAAE,KAAK,IAAI,EAAE;QACjB,MAAM,UAAU,GAAG,MAAM,e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