@donghanh/hono 0.3.4 → 0.4.0
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/LICENSE +21 -0
- package/package.json +6 -3
- package/src/catalog.test.ts +525 -0
- package/src/catalog.ts +212 -0
- package/src/chat.test.ts +20 -0
- package/src/chat.ts +13 -3
- package/src/exposure.test.ts +137 -0
- package/src/exposure.ts +93 -0
- package/src/gpt.test.ts +30 -1
- package/src/gpt.ts +6 -1
- package/src/index.ts +12 -1
- package/src/mcp.test.ts +541 -3
- package/src/mcp.ts +462 -114
- package/src/openapi.test.ts +1 -1
- package/src/protocol.ts +18 -0
package/src/openapi.test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
1
|
import type { OperationComponent, OperationConfig } from "@donghanh/core";
|
|
3
2
|
import { App, Brief, buildRegistry, Message } from "@donghanh/core";
|
|
3
|
+
import { describe, expect, test } from "vitest";
|
|
4
4
|
import { generateOpenApi } from "./openapi";
|
|
5
5
|
|
|
6
6
|
function makeOp(
|
package/src/protocol.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** MCP protocol versions this server speaks, newest first. */
|
|
2
|
+
export const SUPPORTED_PROTOCOL_VERSIONS = [
|
|
3
|
+
"2025-11-25",
|
|
4
|
+
"2025-06-18",
|
|
5
|
+
"2025-03-26",
|
|
6
|
+
"2024-11-05",
|
|
7
|
+
] as const;
|
|
8
|
+
|
|
9
|
+
/** Echo the requested version when supported; otherwise answer with the newest. */
|
|
10
|
+
export function negotiateProtocolVersion(requested: unknown): string {
|
|
11
|
+
if (
|
|
12
|
+
typeof requested === "string" &&
|
|
13
|
+
(SUPPORTED_PROTOCOL_VERSIONS as readonly string[]).includes(requested)
|
|
14
|
+
) {
|
|
15
|
+
return requested;
|
|
16
|
+
}
|
|
17
|
+
return SUPPORTED_PROTOCOL_VERSIONS[0];
|
|
18
|
+
}
|