@glodon-aiot/bot-client-sdk 3.26.0-alpha.31 → 3.26.0-alpha.33
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 +3 -8
- package/dist/es/AgentSession.mjs +63 -59
- package/dist/es/BotClient.mjs +32 -31
- package/dist/es/localMcp/client.mjs +101 -90
- package/dist/es/localMcp/endpoints.mjs +94 -0
- package/dist/es/localMcp/register.mjs +149 -97
- package/dist/es/localMcp/registry.mjs +22 -18
- package/dist/es/package.json.mjs +2 -2
- package/dist/lib/index.js +45 -45
- package/dist/src/AgentSession.d.ts +1 -0
- package/dist/src/localMcp/client.d.ts +4 -0
- package/dist/src/localMcp/endpoints.d.ts +19 -0
- package/dist/src/localMcp/register.d.ts +2 -0
- package/dist/src/localMcp/registry.d.ts +1 -0
- package/package.json +2 -2
|
@@ -5,6 +5,7 @@ import { default as BotClient } from './BotClient';
|
|
|
5
5
|
export default class AgentSession extends Session {
|
|
6
6
|
private readonly inflightCalls;
|
|
7
7
|
private localMcpTicket;
|
|
8
|
+
private stopLocalMcpUpdates?;
|
|
8
9
|
constructor(token: string, _id?: string, _data?: Partial<ISession>, lazyload?: boolean, application?: IApplication, client?: BotClient);
|
|
9
10
|
prepareConnection(): Promise<boolean>;
|
|
10
11
|
registerMcpFromClientConfig(): Promise<boolean>;
|
|
@@ -9,3 +9,7 @@ export declare function mcpToolText(result: unknown): string;
|
|
|
9
9
|
export declare function listMcpTools(binding: LocalMcpBinding, fetchImpl?: typeof fetch): Promise<McpToolSchema[]>;
|
|
10
10
|
export declare function callMcpTool(binding: LocalMcpBinding, name: string, args: unknown, signal?: AbortSignal, fetchImpl?: typeof fetch): Promise<string>;
|
|
11
11
|
export declare function resetMcpSessions(): void;
|
|
12
|
+
/** 地址或 Header 已变化的连接不再复用。仍在使用的绑定保留会话。 */
|
|
13
|
+
export declare function retainMcpSessions(bindings: LocalMcpBinding[]): void;
|
|
14
|
+
/** 过期注册创建的会话如果已经不在当前工具表里,就丢掉。 */
|
|
15
|
+
export declare function dropUnusedMcpSession(binding: LocalMcpBinding, live: LocalMcpBinding[]): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface LocalMcpEndpoint {
|
|
2
|
+
id: string;
|
|
3
|
+
code?: string;
|
|
4
|
+
url: string;
|
|
5
|
+
token?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface LocalMcpEndpointState {
|
|
8
|
+
revision?: number;
|
|
9
|
+
servers: LocalMcpEndpoint[];
|
|
10
|
+
}
|
|
11
|
+
export declare function currentLocalMcpEndpoints(): LocalMcpEndpointState;
|
|
12
|
+
export declare function subscribeLocalMcpEndpoints(listener: () => void): () => boolean;
|
|
13
|
+
/** 只接受显式端口的宿主回环 HTTP 地址。 */
|
|
14
|
+
export declare function loopbackMcpUrl(value: string): string | undefined;
|
|
15
|
+
/** 接受更新的完整快照。返回是否替换了当前状态。 */
|
|
16
|
+
export declare function applyLocalMcpSnapshot(message: Record<string, unknown>): boolean;
|
|
17
|
+
/** 监听宿主推送的本地 MCP 地址。没有工程目录授权也可以接收。 */
|
|
18
|
+
export declare function connectLocalMcpBridge(): () => void;
|
|
19
|
+
export declare function resetLocalMcpEndpoints(): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MCPConfig } from '../Config';
|
|
2
|
+
import { LocalMcpEndpoint } from './endpoints';
|
|
2
3
|
export interface ArrangeLocalMcp {
|
|
3
4
|
id?: string;
|
|
4
5
|
runtime?: string;
|
|
@@ -18,6 +19,7 @@ export declare function listedLocalMcps(arrange?: {
|
|
|
18
19
|
export declare function detailMatchesInit(keys: string[] | null, id: string, code: string): boolean;
|
|
19
20
|
export declare function parseMcpDetail(body: unknown): McpServerDetail | null;
|
|
20
21
|
export declare function fetchMcpDetail(apiRoot: string, token: string, id: string, fetchImpl?: typeof fetch): Promise<McpServerDetail>;
|
|
22
|
+
export declare function headersForEndpoint(headers: Record<string, string>, endpoint?: LocalMcpEndpoint): Record<string, string>;
|
|
21
23
|
export declare function registerLocalMcp(input: {
|
|
22
24
|
arrange?: {
|
|
23
25
|
mcps?: ArrangeLocalMcp[];
|
|
@@ -20,6 +20,7 @@ export declare function replaceLocalMcpTools(tools: {
|
|
|
20
20
|
handler: LocalMcpHandler;
|
|
21
21
|
}[]): void;
|
|
22
22
|
export declare function localMcpBinding(name: string): LocalMcpBinding | undefined;
|
|
23
|
+
export declare function localMcpBindings(): LocalMcpBinding[];
|
|
23
24
|
/** 把本机 MCP 工具合并进插件表。业务插件里同编码的其它函数保留。 */
|
|
24
25
|
export declare function applyLocalMcpPlugins(plugins: AgentPluginMap): void;
|
|
25
26
|
export declare function resetLocalMcpTools(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glodon-aiot/bot-client-sdk",
|
|
3
|
-
"version": "3.26.0-alpha.
|
|
3
|
+
"version": "3.26.0-alpha.33",
|
|
4
4
|
"author": "glodoncv",
|
|
5
5
|
"description": "aiot bot client js sdk",
|
|
6
6
|
"type": "module",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"registry": "https://registry.npmjs.org/"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@glodon-aiot/apis": "^3.26.0-alpha.
|
|
91
|
+
"@glodon-aiot/apis": "^3.26.0-alpha.33",
|
|
92
92
|
"axios": "0.24.0",
|
|
93
93
|
"buffer": "^6.0.3",
|
|
94
94
|
"dayjs": "^1.11.13",
|