@opentiny/next 0.2.0 → 0.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/client.d.ts +12 -5
- package/client.js +509 -444
- package/package.json +1 -1
- package/server.d.ts +3 -3
- package/server.js +449 -397
package/client.d.ts
CHANGED
|
@@ -96,7 +96,7 @@ declare const createTransportPair: () => [MessageChannelTransport, MessageChanne
|
|
|
96
96
|
|
|
97
97
|
declare module '@modelcontextprotocol/sdk/client/sse.js' {
|
|
98
98
|
interface SSEClientTransport {
|
|
99
|
-
sessionId:
|
|
99
|
+
sessionId: string;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
@@ -118,7 +118,7 @@ interface ClientProxyOption {
|
|
|
118
118
|
/**
|
|
119
119
|
* 可选的会话 ID,用于标识当前会话
|
|
120
120
|
*/
|
|
121
|
-
sessionId?:
|
|
121
|
+
sessionId?: string;
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
124
|
* 创建一个 SSE 客户端代理
|
|
@@ -151,7 +151,7 @@ declare const createStreamProxy: (option: ClientProxyOption) => Promise<{
|
|
|
151
151
|
* - requestInit:fetch 请求的初始化配置,自动带上认证头。
|
|
152
152
|
* - eventSourceInit:自定义 fetch 方法,确保 SSE 连接也带上认证头。
|
|
153
153
|
*/
|
|
154
|
-
declare const sseOptions: (token: string, sessionId?:
|
|
154
|
+
declare const sseOptions: (token: string, sessionId?: string) => {
|
|
155
155
|
requestInit: {
|
|
156
156
|
headers: {
|
|
157
157
|
Authorization: string;
|
|
@@ -171,7 +171,7 @@ declare const sseOptions: (token: string, sessionId?: `${string}-${string}-${str
|
|
|
171
171
|
* @returns 返回传输配置对象,包含以下内容:
|
|
172
172
|
* - requestInit:fetch 请求的初始化配置,自动带上认证头,并设置 Streamable HTTP 代理的会话 ID。
|
|
173
173
|
*/
|
|
174
|
-
declare const streamOptions: (token: string, sessionId?:
|
|
174
|
+
declare const streamOptions: (token: string, sessionId?: string) => {
|
|
175
175
|
requestInit: {
|
|
176
176
|
headers: {
|
|
177
177
|
Authorization: string;
|
|
@@ -180,5 +180,12 @@ declare const streamOptions: (token: string, sessionId?: `${string}-${string}-${
|
|
|
180
180
|
};
|
|
181
181
|
};
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
/**
|
|
184
|
+
* 兼容安全策略的 UUID 生成方法,支持浏览器和 Node.js 环境
|
|
185
|
+
*
|
|
186
|
+
* @returns 返回一个 UUID 字符串
|
|
187
|
+
*/
|
|
188
|
+
declare const generateUUID: () => string;
|
|
189
|
+
|
|
190
|
+
export { MessageChannelClientTransport, MessageChannelServerTransport, MessageChannelTransport, createSseProxy, createStreamProxy, createTransportPair, generateUUID, sseOptions, streamOptions };
|
|
184
191
|
export type { ClientProxyOption };
|