@tmcp/transport-http 0.8.4 → 0.8.5
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/package.json +2 -2
- package/src/index.js +21 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmcp/transport-http",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"description": "Transport for TMCP using HTTP",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"vitest": "^4.0.0",
|
|
49
49
|
"@tmcp/adapter-valibot": "^0.1.5",
|
|
50
50
|
"@tmcp/auth": "^0.4.0",
|
|
51
|
-
"tmcp": "^1.19.
|
|
51
|
+
"tmcp": "^1.19.3"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
package/src/index.js
CHANGED
|
@@ -393,17 +393,28 @@ export class HttpTransport {
|
|
|
393
393
|
|
|
394
394
|
const session_id_storage = this.#session_id_storage;
|
|
395
395
|
|
|
396
|
+
const messages = Array.isArray(body) ? body : [body];
|
|
397
|
+
|
|
396
398
|
const handle = async () => {
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
const
|
|
402
|
-
.
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
399
|
+
const init_message = messages.find(
|
|
400
|
+
(/** @type {any} */ m) => m.method === 'initialize',
|
|
401
|
+
);
|
|
402
|
+
|
|
403
|
+
const client_capabilities = init_message
|
|
404
|
+
? init_message.params?.capabilities
|
|
405
|
+
: await this.#options.sessionManager.info
|
|
406
|
+
.getClientCapabilities(session_id)
|
|
407
|
+
.catch(() => undefined);
|
|
408
|
+
const client_info = init_message
|
|
409
|
+
? init_message.params?.clientInfo
|
|
410
|
+
: await this.#options.sessionManager.info
|
|
411
|
+
.getClientInfo(session_id)
|
|
412
|
+
.catch(() => undefined);
|
|
413
|
+
const log_level = init_message
|
|
414
|
+
? undefined
|
|
415
|
+
: await this.#options.sessionManager.info
|
|
416
|
+
.getLogLevel(session_id)
|
|
417
|
+
.catch(() => undefined);
|
|
407
418
|
|
|
408
419
|
const response = await this.#controller_storage.run(
|
|
409
420
|
controller,
|
|
@@ -434,8 +445,6 @@ export class HttpTransport {
|
|
|
434
445
|
|
|
435
446
|
handle();
|
|
436
447
|
|
|
437
|
-
const messages = Array.isArray(body) ? body : [body];
|
|
438
|
-
|
|
439
448
|
const has_request = messages.some((message) => message.id != null);
|
|
440
449
|
|
|
441
450
|
// Determine status code based on response type
|