@open1s/ezbos 1.3.2 → 1.3.3
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/dist/agent.d.ts +1 -1
- package/dist/agent.js +7 -2
- package/package.json +1 -1
- package/src/agent.ts +8 -3
package/dist/agent.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface JsContent {
|
|
|
8
8
|
base64?: string;
|
|
9
9
|
name?: string;
|
|
10
10
|
}
|
|
11
|
-
export type McpStatusCallback = (namespace: string, status: 'connected' | 'failed', error?: string) => void;
|
|
11
|
+
export type McpStatusCallback = (namespace: string, type: 'process' | 'http', comm: string, status: 'connected' | 'failed', error?: string) => void;
|
|
12
12
|
export declare class AgentBuilder {
|
|
13
13
|
private _inner;
|
|
14
14
|
private _tools;
|
package/dist/agent.js
CHANGED
|
@@ -161,17 +161,22 @@ export class AgentBuilder {
|
|
|
161
161
|
}) : undefined);
|
|
162
162
|
}
|
|
163
163
|
for (const mcp of this._mcp) {
|
|
164
|
+
let added = false;
|
|
164
165
|
try {
|
|
165
166
|
if (mcp.type === 'process' && mcp.command && mcp.args) {
|
|
166
167
|
await this._inner.addMcpServer(mcp.namespace, mcp.command, mcp.args);
|
|
168
|
+
added = true;
|
|
167
169
|
}
|
|
168
170
|
else if (mcp.type === 'http' && mcp.url) {
|
|
169
171
|
await this._inner.addMcpServerHttp(mcp.namespace, mcp.url);
|
|
172
|
+
added = true;
|
|
173
|
+
}
|
|
174
|
+
if (added) {
|
|
175
|
+
this._onMcpStatus?.(mcp.namespace, mcp.type, mcp.type === 'process' ? mcp.command : mcp.url, 'connected');
|
|
170
176
|
}
|
|
171
|
-
this._onMcpStatus?.(mcp.namespace, 'connected');
|
|
172
177
|
}
|
|
173
178
|
catch (err) {
|
|
174
|
-
this._onMcpStatus?.(mcp.namespace, 'failed', String(err));
|
|
179
|
+
this._onMcpStatus?.(mcp.namespace, mcp.type, mcp.type === 'process' ? mcp.command : mcp.url, 'failed', String(err));
|
|
175
180
|
console.warn(`[agent] MCP server "${mcp.namespace}" connection failed, skipping:`, err);
|
|
176
181
|
}
|
|
177
182
|
}
|
package/package.json
CHANGED
package/src/agent.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface JsContent {
|
|
|
17
17
|
const DEFAULT_MODEL = 'nvidia/meta/llama-3.1-8b-instruct';
|
|
18
18
|
const DEFAULT_BASE_URL = 'https://integrate.api.nvidia.com/v1';
|
|
19
19
|
|
|
20
|
-
export type McpStatusCallback = (namespace: string, status: 'connected' | 'failed', error?: string) => void;
|
|
20
|
+
export type McpStatusCallback = (namespace: string,type: 'process' | 'http',comm: string, status: 'connected' | 'failed', error?: string) => void;
|
|
21
21
|
|
|
22
22
|
export class AgentBuilder {
|
|
23
23
|
private _inner: jsbos.Agent | null = null;
|
|
@@ -238,15 +238,20 @@ export class AgentBuilder {
|
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
for (const mcp of this._mcp) {
|
|
241
|
+
let added = false;
|
|
241
242
|
try {
|
|
242
243
|
if (mcp.type === 'process' && mcp.command && mcp.args) {
|
|
243
244
|
await this._inner.addMcpServer(mcp.namespace, mcp.command, mcp.args);
|
|
245
|
+
added = true;
|
|
244
246
|
} else if (mcp.type === 'http' && mcp.url) {
|
|
245
247
|
await this._inner.addMcpServerHttp(mcp.namespace, mcp.url);
|
|
248
|
+
added = true;
|
|
249
|
+
}
|
|
250
|
+
if (added) {
|
|
251
|
+
this._onMcpStatus?.(mcp.namespace, mcp.type, mcp.type === 'process' ? mcp.command! : mcp.url!, 'connected');
|
|
246
252
|
}
|
|
247
|
-
this._onMcpStatus?.(mcp.namespace, 'connected');
|
|
248
253
|
} catch (err) {
|
|
249
|
-
this._onMcpStatus?.(mcp.namespace, 'failed', String(err));
|
|
254
|
+
this._onMcpStatus?.(mcp.namespace, mcp.type, mcp.type === 'process' ? mcp.command! : mcp.url!, 'failed', String(err));
|
|
250
255
|
console.warn(`[agent] MCP server "${mcp.namespace}" connection failed, skipping:`, err);
|
|
251
256
|
}
|
|
252
257
|
}
|