@deadragdoll/tellymcp 0.0.13 → 0.0.15
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/.env.example.client +23 -39
- package/.env.example.gateway +52 -61
- package/CHANGELOG.md +57 -0
- package/README-ru.md +80 -6
- package/README.md +80 -6
- package/TOOLS.md +219 -10
- package/config/templates/env.both.template +19 -7
- package/config/templates/env.client.template +9 -19
- package/config/templates/env.gateway.template +19 -31
- package/dist/cli.js +252 -47
- package/dist/configureServer.js +966 -0
- package/dist/envMigration.js +316 -0
- package/dist/moleculer.config.js +1 -3
- package/dist/services/features/telegram-mcp/approval.service.js +1 -1
- package/dist/services/features/telegram-mcp/browser.service.js +18 -0
- package/dist/services/features/telegram-mcp/collaboration.service.js +2 -2
- package/dist/services/features/telegram-mcp/ensuredb.service.js +1 -1
- package/dist/services/features/telegram-mcp/file-content.service.js +94 -0
- package/dist/services/features/telegram-mcp/gateway-delivery.service.js +5 -1
- package/dist/services/features/telegram-mcp/gateway-socket.service.js +43 -11
- package/dist/services/features/telegram-mcp/gateway.service.js +1 -1
- package/dist/services/features/telegram-mcp/mcp-http.service.js +1 -0
- package/dist/services/features/telegram-mcp/mcp-server.service.js +20 -0
- package/dist/services/features/telegram-mcp/session-context.service.js +25 -1
- package/dist/services/features/telegram-mcp/src/app/bootstrap/runtime.js +79 -67
- package/dist/services/features/telegram-mcp/src/app/config/env.js +129 -38
- package/dist/services/features/telegram-mcp/src/app/config/environmentContract.js +66 -0
- package/dist/services/features/telegram-mcp/src/app/http.js +139 -99
- package/dist/services/features/telegram-mcp/src/app/oauthFacade.js +642 -0
- package/dist/services/features/telegram-mcp/src/app/webapp/assets.js +151 -170
- package/dist/services/features/telegram-mcp/src/app/webapp/auth.js +96 -99
- package/dist/services/features/telegram-mcp/src/entities/request/model/schema.js +88 -19
- package/dist/services/features/telegram-mcp/src/features/browser/model/browserAttachActiveTabTool.js +28 -0
- package/dist/services/features/telegram-mcp/src/features/browser/model/browserAttachTabTool.js +28 -0
- package/dist/services/features/telegram-mcp/src/features/browser/model/browserDetachTabTool.js +28 -0
- package/dist/services/features/telegram-mcp/src/features/browser/model/browserListAttachedInstancesTool.js +1 -1
- package/dist/services/features/telegram-mcp/src/features/browser/model/browserListTabsTool.js +1 -1
- package/dist/services/features/telegram-mcp/src/features/browser/model/browserService.js +412 -29
- package/dist/services/features/telegram-mcp/src/features/browser-attach/model/browserRecordingBundle.js +37 -3
- package/dist/services/features/telegram-mcp/src/features/browser-attach/model/firefoxAttachRegistry.js +7 -6
- package/dist/services/features/telegram-mcp/src/features/browser-attach/model/firefoxAttachServer.js +214 -37
- package/dist/services/features/telegram-mcp/src/features/browser-attach/model/types.js +186 -0
- package/dist/services/features/telegram-mcp/src/features/collaboration/model/collaborationService.js +2 -0
- package/dist/services/features/telegram-mcp/src/features/collaboration/model/gatewaySessionsService.js +5 -5
- package/dist/services/features/telegram-mcp/src/features/collaboration/model/sendPartnerFileService.js +6 -3
- package/dist/services/features/telegram-mcp/src/features/distributed-client/model/gatewayClientAccess.js +5 -2
- package/dist/services/features/telegram-mcp/src/features/distributed-client/model/gatewayCollaborationBackend.js +4 -4
- package/dist/services/features/telegram-mcp/src/features/distributed-gateway/model/gatewayHttpService.js +33 -36
- package/dist/services/features/telegram-mcp/src/features/distributed-gateway/model/remoteConsoleActionClient.js +4 -3
- package/dist/services/features/telegram-mcp/src/features/file-content/model/getFileListTool.js +33 -0
- package/dist/services/features/telegram-mcp/src/features/file-content/model/getFileService.js +327 -0
- package/dist/services/features/telegram-mcp/src/features/file-content/model/getFileTool.js +81 -0
- package/dist/services/features/telegram-mcp/src/features/file-content/model/temporaryFileLinkStore.js +307 -0
- package/dist/services/features/telegram-mcp/src/features/file-content/model/workspaceFilePolicy.js +115 -0
- package/dist/services/features/telegram-mcp/src/features/notify/model/notifyService.js +9 -5
- package/dist/services/features/telegram-mcp/src/features/session-context/model/getRuntimeDiagnosticsTool.js +30 -0
- package/dist/services/features/telegram-mcp/src/features/session-context/model/sessionContextService.js +169 -7
- package/dist/services/features/telegram-mcp/src/shared/integrations/memory/processLocalStateStore.js +260 -0
- package/dist/services/features/telegram-mcp/src/shared/integrations/object-storage/minioExchangeStore.js +1 -1
- package/dist/services/features/telegram-mcp/src/shared/integrations/telegram/transport.js +4 -1
- package/dist/services/features/telegram-mcp/src/shared/integrations/telegram/transportConsoleRegistry.js +2 -2
- package/dist/services/features/telegram-mcp/src/shared/integrations/telegram/transportFileHandoffActions.js +6 -3
- package/dist/services/features/telegram-mcp/src/shared/integrations/telegram/transportMessageFlow.js +1 -1
- package/dist/services/features/telegram-mcp/src/shared/integrations/telegram/transportProjectState.js +2 -2
- package/dist/services/features/telegram-mcp/src/shared/integrations/terminal/client.js +29 -6
- package/dist/services/features/telegram-mcp/src/shared/integrations/terminal/ptyRegistry.js +100 -2
- package/dist/services/features/telegram-mcp/src/shared/lib/bodyLimits.js +63 -0
- package/dist/services/features/telegram-mcp/src/shared/lib/gatewayAuth.js +13 -0
- package/dist/services/features/telegram-mcp/src/shared/lib/gatewayScope.js +5 -5
- package/dist/services/features/telegram-mcp/src/shared/lib/project-identity/projectIdentity.js +10 -0
- package/dist/services/features/telegram-mcp/src/shared/lib/time/localTimestamp.js +21 -0
- package/docs/CHAT_CONNECTOR.md +134 -0
- package/docs/STANDALONE-ru.md +41 -3
- package/docs/STANDALONE.md +41 -3
- package/package.json +5 -3
- package/packages/chrome-attach-extension/dist/background.js +572 -163
- package/packages/chrome-attach-extension/dist/manifest.json +2 -1
- package/packages/chrome-attach-extension/dist/options.js +15 -2
- package/packages/chrome-attach-extension/dist/recorder-content.js +14 -1
- package/packages/chrome-attach-extension/dist/recorder-page.js +34 -18
- package/packages/firefox-attach-extension/dist/background.js +413 -33
- package/packages/firefox-attach-extension/dist/manifest.json +0 -12
- package/packages/firefox-attach-extension/dist/options.js +14 -1
- package/packages/firefox-attach-extension/dist/recorder-content.js +14 -1
- package/packages/firefox-attach-extension/dist/recorder-page.js +34 -18
- package/scripts/postinstall.js +33 -1
|
@@ -124,27 +124,42 @@ function normalizeTelegramWebAppInitData(rawInitData) {
|
|
|
124
124
|
}
|
|
125
125
|
return normalized.trim();
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
if (!user || typeof user !== "object"
|
|
127
|
+
function normalizeTelegramWebAppUser(user) {
|
|
128
|
+
if (!user || typeof user !== "object") {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
const record = user;
|
|
132
|
+
if (typeof record.id !== "number" ||
|
|
133
|
+
!Number.isSafeInteger(record.id) ||
|
|
134
|
+
record.id <= 0) {
|
|
129
135
|
return null;
|
|
130
136
|
}
|
|
131
137
|
return {
|
|
132
|
-
id:
|
|
133
|
-
...(typeof
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
...(typeof
|
|
137
|
-
? {
|
|
138
|
+
id: record.id,
|
|
139
|
+
...(typeof record.first_name === "string"
|
|
140
|
+
? { first_name: record.first_name }
|
|
141
|
+
: {}),
|
|
142
|
+
...(typeof record.last_name === "string"
|
|
143
|
+
? { last_name: record.last_name }
|
|
144
|
+
: {}),
|
|
145
|
+
...(typeof record.username === "string"
|
|
146
|
+
? { username: record.username }
|
|
147
|
+
: {}),
|
|
148
|
+
...(typeof record.language_code === "string"
|
|
149
|
+
? { language_code: record.language_code }
|
|
150
|
+
: {}),
|
|
151
|
+
...(typeof record.photo_url === "string"
|
|
152
|
+
? { photo_url: record.photo_url }
|
|
138
153
|
: {}),
|
|
139
|
-
...(typeof user.photo_url === "string" ? { photo_url: user.photo_url } : {}),
|
|
140
154
|
};
|
|
141
155
|
}
|
|
142
|
-
function
|
|
156
|
+
function validateOfficialRawHash(rawInitData, botToken) {
|
|
143
157
|
const params = new URLSearchParams(rawInitData);
|
|
144
|
-
const
|
|
145
|
-
if (!
|
|
146
|
-
|
|
158
|
+
const receivedHashes = params.getAll("hash");
|
|
159
|
+
if (receivedHashes.length !== 1 || !receivedHashes[0]) {
|
|
160
|
+
throw new Error("Telegram WebApp initData hash validation failed.");
|
|
147
161
|
}
|
|
162
|
+
const receivedHash = receivedHashes[0];
|
|
148
163
|
const checkString = [...params.entries()]
|
|
149
164
|
.filter(([key, value]) => key !== "hash" && value !== undefined)
|
|
150
165
|
.sort((left, right) => left[0].localeCompare(right[0]))
|
|
@@ -158,83 +173,86 @@ function buildOfficialRawValidation(rawInitData, botToken) {
|
|
|
158
173
|
.digest("hex");
|
|
159
174
|
const matches = computed.length === receivedHash.length &&
|
|
160
175
|
(0, node_crypto_1.timingSafeEqual)(Buffer.from(computed, "utf8"), Buffer.from(receivedHash, "utf8"));
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
matches,
|
|
166
|
-
};
|
|
176
|
+
if (!matches) {
|
|
177
|
+
throw new Error("Telegram WebApp initData hash validation failed.");
|
|
178
|
+
}
|
|
179
|
+
return params;
|
|
167
180
|
}
|
|
168
|
-
function
|
|
169
|
-
|
|
170
|
-
|
|
181
|
+
function readSignedParam(params, key, required) {
|
|
182
|
+
const values = params.getAll(key);
|
|
183
|
+
if (values.length > 1) {
|
|
184
|
+
throw new Error(`Telegram WebApp initData contains duplicate ${key}.`);
|
|
171
185
|
}
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
186
|
+
const value = values[0];
|
|
187
|
+
if (required && (value === undefined || value.length === 0)) {
|
|
188
|
+
throw new Error(`Telegram WebApp initData is missing ${key}.`);
|
|
189
|
+
}
|
|
190
|
+
return value;
|
|
191
|
+
}
|
|
192
|
+
function parseSignedUser(value) {
|
|
193
|
+
let parsed;
|
|
194
|
+
try {
|
|
195
|
+
parsed = JSON.parse(value);
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
throw new Error("Telegram WebApp signed user is malformed.");
|
|
199
|
+
}
|
|
200
|
+
const user = normalizeTelegramWebAppUser(parsed);
|
|
201
|
+
if (!user) {
|
|
202
|
+
throw new Error("Telegram WebApp signed user is invalid.");
|
|
203
|
+
}
|
|
204
|
+
return user;
|
|
205
|
+
}
|
|
206
|
+
function assertUnsafeDataMatchesSigned(unsafe, signed) {
|
|
207
|
+
const unsafeUser = normalizeTelegramWebAppUser(unsafe.user);
|
|
208
|
+
if (!unsafeUser ||
|
|
209
|
+
JSON.stringify(unsafeUser) !== JSON.stringify(signed.user)) {
|
|
210
|
+
throw new Error("Telegram WebApp unsafe user does not match signed initData.");
|
|
211
|
+
}
|
|
212
|
+
const unsafeAuthDate = typeof unsafe.auth_date === "number" || typeof unsafe.auth_date === "string"
|
|
213
|
+
? String(unsafe.auth_date)
|
|
178
214
|
: undefined;
|
|
179
|
-
if (
|
|
180
|
-
|
|
215
|
+
if (unsafeAuthDate !== String(signed.authDate)) {
|
|
216
|
+
throw new Error("Telegram WebApp unsafe auth_date does not match signed initData.");
|
|
217
|
+
}
|
|
218
|
+
if (unsafe.query_id !== signed.queryId) {
|
|
219
|
+
throw new Error("Telegram WebApp unsafe query_id does not match signed initData.");
|
|
220
|
+
}
|
|
221
|
+
if (unsafe.start_param !== signed.startParam) {
|
|
222
|
+
throw new Error("Telegram WebApp unsafe start_param does not match signed initData.");
|
|
223
|
+
}
|
|
224
|
+
if (unsafe.hash !== undefined && unsafe.hash !== signed.hash) {
|
|
225
|
+
throw new Error("Telegram WebApp unsafe hash does not match signed initData.");
|
|
181
226
|
}
|
|
182
|
-
const params = {
|
|
183
|
-
id: user.id,
|
|
184
|
-
first_name: user.first_name,
|
|
185
|
-
last_name: user.last_name,
|
|
186
|
-
username: user.username,
|
|
187
|
-
photo_url: user.photo_url,
|
|
188
|
-
auth_date: authDateValue,
|
|
189
|
-
};
|
|
190
|
-
const checkString = Object.keys(params)
|
|
191
|
-
.sort()
|
|
192
|
-
.filter((key) => params[key] !== undefined)
|
|
193
|
-
.map((key) => `${key}=${params[key]}`)
|
|
194
|
-
.join("\n");
|
|
195
|
-
const secretKey = (0, node_crypto_1.createHash)("sha256")
|
|
196
|
-
.update(botToken.trim())
|
|
197
|
-
.digest();
|
|
198
|
-
const computed = (0, node_crypto_1.createHmac)("sha256", secretKey)
|
|
199
|
-
.update(checkString)
|
|
200
|
-
.digest("hex");
|
|
201
|
-
const matches = computed.length === receivedHash.length &&
|
|
202
|
-
(0, node_crypto_1.timingSafeEqual)(Buffer.from(computed, "utf8"), Buffer.from(receivedHash, "utf8"));
|
|
203
|
-
return {
|
|
204
|
-
checkString,
|
|
205
|
-
computedHash: computed,
|
|
206
|
-
providedHash: receivedHash,
|
|
207
|
-
matches,
|
|
208
|
-
};
|
|
209
227
|
}
|
|
210
228
|
function validateTelegramWebAppInitData(rawInitData, unsafeInitData, botToken, maxAgeSeconds) {
|
|
211
229
|
const normalizedRaw = rawInitData
|
|
212
230
|
? normalizeTelegramWebAppInitData(rawInitData)
|
|
213
231
|
: "";
|
|
214
|
-
|
|
215
|
-
if (!normalizedRaw && !normalizedUnsafe) {
|
|
232
|
+
if (!normalizedRaw) {
|
|
216
233
|
throw new Error("Telegram WebApp initData is empty.");
|
|
217
234
|
}
|
|
218
|
-
const
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
if (!normalizedUnsafe) {
|
|
224
|
-
throw new Error("Telegram WebApp unsafe init data is missing.");
|
|
225
|
-
}
|
|
226
|
-
const user = normalizeUnsafeUser(normalizedUnsafe.user);
|
|
227
|
-
const authDateRaw = typeof normalizedUnsafe.auth_date === "number" ||
|
|
228
|
-
typeof normalizedUnsafe.auth_date === "string"
|
|
229
|
-
? String(normalizedUnsafe.auth_date)
|
|
230
|
-
: null;
|
|
231
|
-
if (!authDateRaw || !user) {
|
|
232
|
-
throw new Error("Telegram WebApp initData is missing auth_date or user.");
|
|
235
|
+
const signedParams = validateOfficialRawHash(normalizedRaw, botToken);
|
|
236
|
+
const user = parseSignedUser(readSignedParam(signedParams, "user", true));
|
|
237
|
+
const authDateRaw = readSignedParam(signedParams, "auth_date", true);
|
|
238
|
+
if (!/^\d+$/.test(authDateRaw)) {
|
|
239
|
+
throw new Error("Telegram WebApp auth_date is invalid.");
|
|
233
240
|
}
|
|
234
|
-
const authDate = Number
|
|
235
|
-
if (!Number.
|
|
241
|
+
const authDate = Number(authDateRaw);
|
|
242
|
+
if (!Number.isSafeInteger(authDate) || authDate <= 0) {
|
|
236
243
|
throw new Error("Telegram WebApp auth_date is invalid.");
|
|
237
244
|
}
|
|
245
|
+
const queryId = readSignedParam(signedParams, "query_id", false);
|
|
246
|
+
const startParam = readSignedParam(signedParams, "start_param", false);
|
|
247
|
+
if (unsafeInitData) {
|
|
248
|
+
assertUnsafeDataMatchesSigned(unsafeInitData, {
|
|
249
|
+
user,
|
|
250
|
+
authDate,
|
|
251
|
+
...(queryId !== undefined ? { queryId } : {}),
|
|
252
|
+
...(startParam !== undefined ? { startParam } : {}),
|
|
253
|
+
hash: readSignedParam(signedParams, "hash", true),
|
|
254
|
+
});
|
|
255
|
+
}
|
|
238
256
|
const nowSeconds = Math.floor(Date.now() / 1000);
|
|
239
257
|
if (nowSeconds - authDate > maxAgeSeconds) {
|
|
240
258
|
throw new Error("Telegram WebApp initData is expired.");
|
|
@@ -243,28 +261,7 @@ function validateTelegramWebAppInitData(rawInitData, unsafeInitData, botToken, m
|
|
|
243
261
|
user,
|
|
244
262
|
authDate,
|
|
245
263
|
rawInitData: normalizedRaw,
|
|
246
|
-
...(
|
|
247
|
-
|
|
248
|
-
: {}),
|
|
249
|
-
...(typeof normalizedUnsafe.start_param === "string"
|
|
250
|
-
? { startParam: normalizedUnsafe.start_param }
|
|
251
|
-
: {}),
|
|
252
|
-
validationDebug: {
|
|
253
|
-
providedHash: officialRawValidation?.providedHash ??
|
|
254
|
-
userFieldsValidation?.providedHash ??
|
|
255
|
-
"",
|
|
256
|
-
officialRaw: {
|
|
257
|
-
checkString: officialRawValidation?.checkString ?? "",
|
|
258
|
-
computedHash: officialRawValidation?.computedHash ?? "",
|
|
259
|
-
matches: officialRawValidation?.matches ?? false,
|
|
260
|
-
},
|
|
261
|
-
userFields: userFieldsValidation
|
|
262
|
-
? {
|
|
263
|
-
checkString: userFieldsValidation.checkString,
|
|
264
|
-
computedHash: userFieldsValidation.computedHash,
|
|
265
|
-
matches: userFieldsValidation.matches,
|
|
266
|
-
}
|
|
267
|
-
: null,
|
|
268
|
-
},
|
|
264
|
+
...(queryId !== undefined ? { queryId } : {}),
|
|
265
|
+
...(startParam !== undefined ? { startParam } : {}),
|
|
269
266
|
};
|
|
270
267
|
}
|
|
@@ -33,9 +33,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
37
|
-
exports.markXchangeRecordReadOutputSchema = exports.markXchangeRecordReadInputSchema = exports.getXchangeRecordOutputSchema = exports.getXchangeRecordInputSchema = exports.listXchangeRecordsOutputSchema = exports.listXchangeRecordsInputSchema = exports.sendPartnerNoteOutputSchema = exports.sendPartnerFileInputSchema = exports.sendPartnerNoteInputSchema = exports.browserCloseOutputSchema = exports.browserCloseInputSchema = exports.browserScreenshotOutputSchema = exports.browserScreenshotInputSchema = exports.browserComputedStyleOutputSchema = exports.browserComputedStyleInputSchema = exports.browserDomOutputSchema = exports.browserDomInputSchema = exports.browserClearLogsOutputSchema = exports.browserClearLogsInputSchema = exports.browserNetworkFailuresOutputSchema = exports.browserNetworkFailuresInputSchema = exports.browserErrorsOutputSchema = exports.browserErrorsInputSchema = exports.browserConsoleOutputSchema = void 0;
|
|
36
|
+
exports.browserInjectScriptInputSchema = exports.browserPressOutputSchema = exports.browserPressInputSchema = exports.browserFillOutputSchema = exports.browserFillInputSchema = exports.browserClickOutputSchema = exports.browserClickInputSchema = exports.browserReloadOutputSchema = exports.browserReloadInputSchema = exports.browserRecordingStatusOutputSchema = exports.browserRecordingStatusInputSchema = exports.browserRecordingStopOutputSchema = exports.browserRecordingStopInputSchema = exports.browserRecordingStartOutputSchema = exports.browserRecordingStartInputSchema = exports.browserDetachTabOutputSchema = exports.browserDetachTabInputSchema = exports.browserAttachTabOutputSchema = exports.browserAttachTabInputSchema = exports.browserAttachActiveTabInputSchema = exports.browserListTabsOutputSchema = exports.browserListTabsInputSchema = exports.browserListAttachedInstancesOutputSchema = exports.browserListAttachedInstancesInputSchema = exports.browserOpenOutputSchema = exports.browserOpenInputSchema = exports.clearSessionContextOutputSchema = exports.clearSessionContextInputSchema = exports.getRuntimeDiagnosticsOutputSchema = exports.getRuntimeDiagnosticsInputSchema = exports.getSessionContextOutputSchema = exports.getSessionContextInputSchema = exports.setSessionContextOutputSchema = exports.renameSessionOutputSchema = exports.renameSessionInputSchema = exports.setSessionContextInputSchema = exports.refreshToolsMarkdownOutputSchema = exports.refreshToolsMarkdownInputSchema = exports.listGatewaySessionsOutputSchema = exports.listGatewaySessionsInputSchema = exports.getFileListOutputSchema = exports.getFileListInputSchema = exports.getFileOutputSchema = exports.getFileInputSchema = exports.sendFileToTelegramOutputSchema = exports.sendFileToTelegramInputSchema = exports.notifyTelegramOutputSchema = exports.notifyTelegramInputSchema = exports.askUserTelegramOutputSchema = exports.askUserTelegramInputSchema = void 0;
|
|
37
|
+
exports.markXchangeRecordReadOutputSchema = exports.markXchangeRecordReadInputSchema = exports.getXchangeRecordOutputSchema = exports.getXchangeRecordInputSchema = exports.listXchangeRecordsOutputSchema = exports.listXchangeRecordsInputSchema = exports.sendPartnerNoteOutputSchema = exports.sendPartnerFileInputSchema = exports.sendPartnerNoteInputSchema = exports.browserCloseOutputSchema = exports.browserCloseInputSchema = exports.browserScreenshotOutputSchema = exports.browserScreenshotInputSchema = exports.browserComputedStyleOutputSchema = exports.browserComputedStyleInputSchema = exports.browserDomOutputSchema = exports.browserDomInputSchema = exports.browserClearLogsOutputSchema = exports.browserClearLogsInputSchema = exports.browserNetworkFailuresOutputSchema = exports.browserNetworkFailuresInputSchema = exports.browserErrorsOutputSchema = exports.browserErrorsInputSchema = exports.browserConsoleOutputSchema = exports.browserConsoleInputSchema = exports.browserWaitForUrlOutputSchema = exports.browserWaitForUrlInputSchema = exports.browserWaitForOutputSchema = exports.browserWaitForInputSchema = exports.browserInjectScriptOutputSchema = void 0;
|
|
38
38
|
const z = __importStar(require("zod/v4"));
|
|
39
|
+
const bodyLimits_1 = require("../../../shared/lib/bodyLimits");
|
|
40
|
+
const bodyStringSchema = z.string().max(bodyLimits_1.MAX_BODY_SIZE_BYTES);
|
|
39
41
|
const partnerNoteKindSchema = z.enum([
|
|
40
42
|
"share",
|
|
41
43
|
"question",
|
|
@@ -87,6 +89,45 @@ exports.sendFileToTelegramOutputSchema = z.object({
|
|
|
87
89
|
sent: z.boolean(),
|
|
88
90
|
message_id: z.number().int().positive().optional(),
|
|
89
91
|
});
|
|
92
|
+
exports.getFileInputSchema = z
|
|
93
|
+
.object({
|
|
94
|
+
session_id: z.string().trim().min(1).optional(),
|
|
95
|
+
file_path: z.string().trim().min(1).optional(),
|
|
96
|
+
selector: z.enum(["latest_screenshot"]).optional(),
|
|
97
|
+
type: z.enum(["url", "image", "text", "base64"]).optional(),
|
|
98
|
+
})
|
|
99
|
+
.refine((input) => Boolean(input.file_path) !== Boolean(input.selector), {
|
|
100
|
+
message: "Provide exactly one of file_path or selector.",
|
|
101
|
+
});
|
|
102
|
+
exports.getFileOutputSchema = z.object({
|
|
103
|
+
type: z.enum(["url", "image", "text", "base64"]),
|
|
104
|
+
data: bodyStringSchema,
|
|
105
|
+
mimetype: z.string().trim().min(1),
|
|
106
|
+
filename: z.string().trim().min(1),
|
|
107
|
+
size_bytes: z.number().int().nonnegative(),
|
|
108
|
+
expires_at: z.string().trim().min(1).optional(),
|
|
109
|
+
});
|
|
110
|
+
const getFileListSourceSchema = z.enum([
|
|
111
|
+
"telegram-upload",
|
|
112
|
+
"browser-screenshot",
|
|
113
|
+
"partner-artifact",
|
|
114
|
+
]);
|
|
115
|
+
exports.getFileListInputSchema = z.object({
|
|
116
|
+
session_id: z.string().trim().min(1).optional(),
|
|
117
|
+
source: getFileListSourceSchema.optional(),
|
|
118
|
+
limit: z.number().int().positive().max(200).optional(),
|
|
119
|
+
});
|
|
120
|
+
exports.getFileListOutputSchema = z.object({
|
|
121
|
+
total: z.number().int().nonnegative(),
|
|
122
|
+
files: z.array(z.object({
|
|
123
|
+
file_path: z.string().trim().min(1),
|
|
124
|
+
filename: z.string().trim().min(1),
|
|
125
|
+
mimetype: z.string().trim().min(1),
|
|
126
|
+
source: getFileListSourceSchema,
|
|
127
|
+
size_bytes: z.number().int().nonnegative().optional(),
|
|
128
|
+
created_at: z.string().trim().min(1),
|
|
129
|
+
})),
|
|
130
|
+
});
|
|
90
131
|
exports.listGatewaySessionsInputSchema = z.object({
|
|
91
132
|
client_uuid: z.string().trim().min(1).optional(),
|
|
92
133
|
connected_only: z.boolean().optional(),
|
|
@@ -183,6 +224,32 @@ exports.getSessionContextOutputSchema = z.object({
|
|
|
183
224
|
})
|
|
184
225
|
.optional(),
|
|
185
226
|
});
|
|
227
|
+
const runtimeDiagnosticCheckSchema = z.object({
|
|
228
|
+
status: z.enum(["ok", "warn", "error"]),
|
|
229
|
+
message: z.string(),
|
|
230
|
+
});
|
|
231
|
+
exports.getRuntimeDiagnosticsInputSchema = z.object({
|
|
232
|
+
session_id: z.string().trim().min(1).optional(),
|
|
233
|
+
});
|
|
234
|
+
exports.getRuntimeDiagnosticsOutputSchema = z.object({
|
|
235
|
+
status: z.enum(["ok", "degraded"]),
|
|
236
|
+
checked_at: z.string(),
|
|
237
|
+
session_id: z.string(),
|
|
238
|
+
runtime: z.object({
|
|
239
|
+
mode: z.enum(["client", "gateway", "both"]),
|
|
240
|
+
package_version: z.string(),
|
|
241
|
+
protocol_version: z.string(),
|
|
242
|
+
node_id: z.string().optional(),
|
|
243
|
+
}),
|
|
244
|
+
checks: z.object({
|
|
245
|
+
configuration: runtimeDiagnosticCheckSchema,
|
|
246
|
+
redis: runtimeDiagnosticCheckSchema,
|
|
247
|
+
session_store: runtimeDiagnosticCheckSchema,
|
|
248
|
+
terminal: runtimeDiagnosticCheckSchema,
|
|
249
|
+
gateway_configuration: runtimeDiagnosticCheckSchema,
|
|
250
|
+
relay: runtimeDiagnosticCheckSchema,
|
|
251
|
+
}),
|
|
252
|
+
});
|
|
186
253
|
exports.clearSessionContextInputSchema = z.object({
|
|
187
254
|
session_id: z.string().trim().min(1).optional(),
|
|
188
255
|
});
|
|
@@ -218,7 +285,7 @@ exports.browserListAttachedInstancesOutputSchema = z.object({
|
|
|
218
285
|
total: z.number().int().nonnegative(),
|
|
219
286
|
instances: z.array(z.object({
|
|
220
287
|
instance_id: z.string().trim().min(1),
|
|
221
|
-
browser: z.
|
|
288
|
+
browser: z.enum(["firefox", "chrome"]),
|
|
222
289
|
extension_version: z.string().trim().min(1),
|
|
223
290
|
profile_name: z.string().trim().min(1).optional(),
|
|
224
291
|
connected_at: z.string().trim().min(1),
|
|
@@ -344,7 +411,7 @@ exports.browserReloadInputSchema = z.object({
|
|
|
344
411
|
exports.browserReloadOutputSchema = z.object({
|
|
345
412
|
session_id: z.string(),
|
|
346
413
|
reloaded: z.boolean(),
|
|
347
|
-
url: z.string()
|
|
414
|
+
url: z.string(),
|
|
348
415
|
title: z.string().optional(),
|
|
349
416
|
});
|
|
350
417
|
const browserLocatorInputShape = {
|
|
@@ -367,7 +434,7 @@ exports.browserClickOutputSchema = z.object({
|
|
|
367
434
|
ai_tag: z.string().optional(),
|
|
368
435
|
selector: z.string().optional(),
|
|
369
436
|
text: z.string().optional(),
|
|
370
|
-
url: z.string()
|
|
437
|
+
url: z.string(),
|
|
371
438
|
title: z.string().optional(),
|
|
372
439
|
});
|
|
373
440
|
exports.browserFillInputSchema = z
|
|
@@ -386,7 +453,7 @@ exports.browserFillOutputSchema = z.object({
|
|
|
386
453
|
selector: z.string().optional(),
|
|
387
454
|
text: z.string().optional(),
|
|
388
455
|
value_length: z.number().int().nonnegative(),
|
|
389
|
-
url: z.string()
|
|
456
|
+
url: z.string(),
|
|
390
457
|
title: z.string().optional(),
|
|
391
458
|
});
|
|
392
459
|
exports.browserPressInputSchema = z.object({
|
|
@@ -400,7 +467,7 @@ exports.browserPressOutputSchema = z.object({
|
|
|
400
467
|
ai_tag: z.string().optional(),
|
|
401
468
|
selector: z.string().optional(),
|
|
402
469
|
text: z.string().optional(),
|
|
403
|
-
url: z.string()
|
|
470
|
+
url: z.string(),
|
|
404
471
|
title: z.string().optional(),
|
|
405
472
|
});
|
|
406
473
|
exports.browserInjectScriptInputSchema = z
|
|
@@ -420,7 +487,7 @@ exports.browserInjectScriptOutputSchema = z.object({
|
|
|
420
487
|
namespace: z.string(),
|
|
421
488
|
source_type: z.enum(["inline", "file"]),
|
|
422
489
|
bytes: z.number().int().nonnegative(),
|
|
423
|
-
url: z.string()
|
|
490
|
+
url: z.string(),
|
|
424
491
|
title: z.string().optional(),
|
|
425
492
|
});
|
|
426
493
|
exports.browserWaitForInputSchema = z
|
|
@@ -439,7 +506,7 @@ exports.browserWaitForOutputSchema = z.object({
|
|
|
439
506
|
ai_tag: z.string().optional(),
|
|
440
507
|
selector: z.string().optional(),
|
|
441
508
|
text: z.string().optional(),
|
|
442
|
-
url: z.string()
|
|
509
|
+
url: z.string(),
|
|
443
510
|
title: z.string().optional(),
|
|
444
511
|
});
|
|
445
512
|
exports.browserWaitForUrlInputSchema = z
|
|
@@ -459,7 +526,7 @@ exports.browserWaitForUrlOutputSchema = z.object({
|
|
|
459
526
|
matched: z.enum(["url", "url_contains"]),
|
|
460
527
|
url: z.string().optional(),
|
|
461
528
|
url_contains: z.string().optional(),
|
|
462
|
-
current_url: z.string()
|
|
529
|
+
current_url: z.string(),
|
|
463
530
|
title: z.string().optional(),
|
|
464
531
|
});
|
|
465
532
|
exports.browserConsoleInputSchema = z.object({
|
|
@@ -497,7 +564,7 @@ exports.browserNetworkFailuresOutputSchema = z.object({
|
|
|
497
564
|
session_id: z.string(),
|
|
498
565
|
total: z.number().int().nonnegative(),
|
|
499
566
|
failures: z.array(z.object({
|
|
500
|
-
url: z.string()
|
|
567
|
+
url: z.string(),
|
|
501
568
|
method: z.string(),
|
|
502
569
|
status: z.number().int().optional(),
|
|
503
570
|
error_text: z.string().optional(),
|
|
@@ -585,9 +652,9 @@ exports.sendPartnerNoteInputSchema = z.object({
|
|
|
585
652
|
target_local_session_id: z.string().trim().min(1).optional(),
|
|
586
653
|
project_uuid: z.string().trim().min(1).optional(),
|
|
587
654
|
kind: partnerNoteKindSchema,
|
|
588
|
-
summary:
|
|
589
|
-
message:
|
|
590
|
-
expected_reply:
|
|
655
|
+
summary: bodyStringSchema.trim().min(1),
|
|
656
|
+
message: bodyStringSchema.trim().min(1),
|
|
657
|
+
expected_reply: bodyStringSchema.trim().min(1).optional(),
|
|
591
658
|
requires_reply: z.boolean().optional(),
|
|
592
659
|
in_reply_to: z.string().trim().min(1).optional(),
|
|
593
660
|
artifacts: z.array(z.string().trim().min(1)).optional(),
|
|
@@ -599,7 +666,7 @@ exports.sendPartnerNoteInputSchema = z.object({
|
|
|
599
666
|
mime_type: z.string().trim().min(1).optional(),
|
|
600
667
|
size_bytes: z.number().int().nonnegative().optional(),
|
|
601
668
|
storage_ref: z.string().trim().min(1).optional(),
|
|
602
|
-
content_base64:
|
|
669
|
+
content_base64: bodyStringSchema.trim().min(1).optional(),
|
|
603
670
|
}))
|
|
604
671
|
.optional(),
|
|
605
672
|
});
|
|
@@ -612,9 +679,9 @@ exports.sendPartnerFileInputSchema = z.object({
|
|
|
612
679
|
cwd: z.string().trim().min(1).optional(),
|
|
613
680
|
file_path: z.string().trim().min(1),
|
|
614
681
|
kind: partnerNoteKindSchema.optional(),
|
|
615
|
-
summary:
|
|
616
|
-
message:
|
|
617
|
-
expected_reply:
|
|
682
|
+
summary: bodyStringSchema.trim().min(1).optional(),
|
|
683
|
+
message: bodyStringSchema.trim().min(1).optional(),
|
|
684
|
+
expected_reply: bodyStringSchema.trim().min(1).optional(),
|
|
618
685
|
requires_reply: z.boolean().optional(),
|
|
619
686
|
in_reply_to: z.string().trim().min(1).optional(),
|
|
620
687
|
});
|
|
@@ -678,7 +745,9 @@ const xchangeRecordSchema = z.object({
|
|
|
678
745
|
exports.listXchangeRecordsInputSchema = z.object({
|
|
679
746
|
session_id: z.string().trim().min(1).optional(),
|
|
680
747
|
status: z.enum(["new", "read", "archived"]).optional(),
|
|
681
|
-
category: z
|
|
748
|
+
category: z
|
|
749
|
+
.enum(["partner_note", "local_handoff", "telegram_message"])
|
|
750
|
+
.optional(),
|
|
682
751
|
direction: z.enum(["incoming", "outgoing", "local"]).optional(),
|
|
683
752
|
limit: z.number().int().positive().max(200).optional(),
|
|
684
753
|
});
|
package/dist/services/features/telegram-mcp/src/features/browser/model/browserAttachActiveTabTool.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrowserAttachActiveTabTool = void 0;
|
|
4
|
+
const schema_1 = require("../../../entities/request/model/schema");
|
|
5
|
+
function createContent(output) {
|
|
6
|
+
return [{ type: "text", text: JSON.stringify(output, null, 2) }];
|
|
7
|
+
}
|
|
8
|
+
class BrowserAttachActiveTabTool {
|
|
9
|
+
browserService;
|
|
10
|
+
constructor(browserService) {
|
|
11
|
+
this.browserService = browserService;
|
|
12
|
+
}
|
|
13
|
+
register(server) {
|
|
14
|
+
server.registerTool("browser_attach_active_tab", {
|
|
15
|
+
title: "Browser Attach Active Tab",
|
|
16
|
+
description: "Attach the current MCP session to the active tab of a connected attached browser instance. If only one instance is connected, instance_id can be omitted.",
|
|
17
|
+
inputSchema: schema_1.browserAttachActiveTabInputSchema,
|
|
18
|
+
outputSchema: schema_1.browserAttachTabOutputSchema,
|
|
19
|
+
}, async (args) => {
|
|
20
|
+
const output = await this.browserService.attachActiveTab(args);
|
|
21
|
+
return {
|
|
22
|
+
content: createContent(output),
|
|
23
|
+
structuredContent: output,
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.BrowserAttachActiveTabTool = BrowserAttachActiveTabTool;
|
package/dist/services/features/telegram-mcp/src/features/browser/model/browserAttachTabTool.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrowserAttachTabTool = void 0;
|
|
4
|
+
const schema_1 = require("../../../entities/request/model/schema");
|
|
5
|
+
function createContent(output) {
|
|
6
|
+
return [{ type: "text", text: JSON.stringify(output, null, 2) }];
|
|
7
|
+
}
|
|
8
|
+
class BrowserAttachTabTool {
|
|
9
|
+
browserService;
|
|
10
|
+
constructor(browserService) {
|
|
11
|
+
this.browserService = browserService;
|
|
12
|
+
}
|
|
13
|
+
register(server) {
|
|
14
|
+
server.registerTool("browser_attach_tab", {
|
|
15
|
+
title: "Browser Attach Tab",
|
|
16
|
+
description: "Attach the current MCP session to a specific tab in a connected attached browser instance by tab_id.",
|
|
17
|
+
inputSchema: schema_1.browserAttachTabInputSchema,
|
|
18
|
+
outputSchema: schema_1.browserAttachTabOutputSchema,
|
|
19
|
+
}, async (args) => {
|
|
20
|
+
const output = await this.browserService.attachTab(args);
|
|
21
|
+
return {
|
|
22
|
+
content: createContent(output),
|
|
23
|
+
structuredContent: output,
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.BrowserAttachTabTool = BrowserAttachTabTool;
|
package/dist/services/features/telegram-mcp/src/features/browser/model/browserDetachTabTool.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrowserDetachTabTool = void 0;
|
|
4
|
+
const schema_1 = require("../../../entities/request/model/schema");
|
|
5
|
+
function createContent(output) {
|
|
6
|
+
return [{ type: "text", text: JSON.stringify(output, null, 2) }];
|
|
7
|
+
}
|
|
8
|
+
class BrowserDetachTabTool {
|
|
9
|
+
browserService;
|
|
10
|
+
constructor(browserService) {
|
|
11
|
+
this.browserService = browserService;
|
|
12
|
+
}
|
|
13
|
+
register(server) {
|
|
14
|
+
server.registerTool("browser_detach_tab", {
|
|
15
|
+
title: "Browser Detach Tab",
|
|
16
|
+
description: "Detach the current MCP session from the currently selected attached browser tab.",
|
|
17
|
+
inputSchema: schema_1.browserDetachTabInputSchema,
|
|
18
|
+
outputSchema: schema_1.browserDetachTabOutputSchema,
|
|
19
|
+
}, async (args) => {
|
|
20
|
+
const output = await this.browserService.detachTab(args);
|
|
21
|
+
return {
|
|
22
|
+
content: createContent(output),
|
|
23
|
+
structuredContent: output,
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.BrowserDetachTabTool = BrowserDetachTabTool;
|
|
@@ -18,7 +18,7 @@ class BrowserListAttachedInstancesTool {
|
|
|
18
18
|
register(server) {
|
|
19
19
|
server.registerTool("browser_list_attached_instances", {
|
|
20
20
|
title: "Browser List Attached Instances",
|
|
21
|
-
description: "List
|
|
21
|
+
description: "List browser instances currently attached through the local browser-attach extension bridge for the current console.",
|
|
22
22
|
inputSchema: schema_1.browserListAttachedInstancesInputSchema,
|
|
23
23
|
outputSchema: schema_1.browserListAttachedInstancesOutputSchema,
|
|
24
24
|
}, async (args) => {
|
package/dist/services/features/telegram-mcp/src/features/browser/model/browserListTabsTool.js
CHANGED
|
@@ -18,7 +18,7 @@ class BrowserListTabsTool {
|
|
|
18
18
|
register(server) {
|
|
19
19
|
server.registerTool("browser_list_tabs", {
|
|
20
20
|
title: "Browser List Tabs",
|
|
21
|
-
description: "List tabs from
|
|
21
|
+
description: "List tabs from an attached browser instance connected through the local browser-attach extension bridge. If only one instance is connected, instance_id can be omitted. Note: active=true is per browser window; for the tab selected for the current MCP session, use selected=true.",
|
|
22
22
|
inputSchema: schema_1.browserListTabsInputSchema,
|
|
23
23
|
outputSchema: schema_1.browserListTabsOutputSchema,
|
|
24
24
|
}, async (args) => {
|