@agentforge-io/core 2.0.1 → 2.0.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/services/agent.service.js +7 -0
- package/dist/services/mcp-client.service.js +3 -0
- package/dist/services/mcp-server.service.d.ts +16 -3
- package/dist/services/mcp-server.service.js +18 -3
- package/dist/services/tool-registry.service.d.ts +7 -0
- package/dist/services/tool-registry.service.js +3 -0
- package/dist/types/agent.types.d.ts +7 -0
- package/package.json +1 -1
|
@@ -315,11 +315,16 @@ exports.AgentService = AgentService;
|
|
|
315
315
|
* Map a persisted `AgentRecord` to the runtime `AgentDefinition` the runner
|
|
316
316
|
* expects. The `context` column (plain-text knowledge) is prepended to the
|
|
317
317
|
* system prompt — the cheapest path before RAG is implemented.
|
|
318
|
+
*
|
|
319
|
+
* Extra host fields (`appearance`, `slug`) are passed through as opaque
|
|
320
|
+
* properties so callers like `PublicChatController` can surface them to the
|
|
321
|
+
* widget. The runner ignores anything it doesn't recognize.
|
|
318
322
|
*/
|
|
319
323
|
function toAgentDefinition(record) {
|
|
320
324
|
const systemPrompt = record.context
|
|
321
325
|
? `${record.systemPrompt}\n\n--- Knowledge ---\n${record.context}`
|
|
322
326
|
: record.systemPrompt;
|
|
327
|
+
const extra = record;
|
|
323
328
|
return {
|
|
324
329
|
id: record.id,
|
|
325
330
|
name: record.name,
|
|
@@ -333,5 +338,7 @@ function toAgentDefinition(record) {
|
|
|
333
338
|
mcpServers: record.mcpServers,
|
|
334
339
|
metadata: record.metadata,
|
|
335
340
|
connectorOwnerUserId: record.connectorOwnerUserId,
|
|
341
|
+
...(record.slug !== undefined ? { slug: record.slug } : {}),
|
|
342
|
+
...(extra.appearance !== undefined ? { appearance: extra.appearance } : {}),
|
|
336
343
|
};
|
|
337
344
|
}
|
|
@@ -68,6 +68,9 @@ class McpClientService {
|
|
|
68
68
|
execute: async (input) => {
|
|
69
69
|
return this.callTool(config.name, tool.name, input);
|
|
70
70
|
},
|
|
71
|
+
// Carry the MCP origin through to the registry so /tools can label
|
|
72
|
+
// and group these distinctly from built-ins / connector tools.
|
|
73
|
+
mcpServerName: config.name,
|
|
71
74
|
};
|
|
72
75
|
this.registry.register(wrapped);
|
|
73
76
|
handles.push({
|
|
@@ -31,13 +31,26 @@ export declare class McpServerService {
|
|
|
31
31
|
constructor(repo: McpServerRepository, client?: McpClientService | undefined);
|
|
32
32
|
create(input: CreateMcpServerInput): Promise<McpServerRecord>;
|
|
33
33
|
listForTenant(tenantId: string): Promise<McpServerRecord[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Active rows across every tenant. The platform's boot orchestrator uses
|
|
36
|
+
* this to (re)connect MCPs after a process restart; per-request code
|
|
37
|
+
* paths should keep using `listForTenant` to avoid leaking other tenants'
|
|
38
|
+
* configs into a response.
|
|
39
|
+
*/
|
|
40
|
+
listAllActive(): Promise<McpServerRecord[]>;
|
|
34
41
|
getById(id: string): Promise<McpServerRecord>;
|
|
35
42
|
getByIdForTenant(id: string, tenantId: string): Promise<McpServerRecord>;
|
|
36
43
|
update(id: string, tenantId: string, patch: McpServerRecordPatch): Promise<McpServerRecord>;
|
|
37
44
|
delete(id: string, tenantId: string): Promise<void>;
|
|
38
|
-
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated Headers are passed through to `McpClientService.register`
|
|
47
|
+
* exactly as stored — no `{{KEY}}` resolution against the host's vault.
|
|
48
|
+
* Hosts wiring secrets-in-vault should call `listAllActive()` and run
|
|
49
|
+
* their own bootstrapper instead (see `apps/server/src/modules/mcp/`).
|
|
50
|
+
* This method survives only to keep the legacy in-lib `McpModule`
|
|
51
|
+
* working during the deprecation lap; it will be removed in the same
|
|
52
|
+
* release that drops `McpModule` itself.
|
|
53
|
+
*/
|
|
41
54
|
registerAllActive(): Promise<void>;
|
|
42
55
|
private assertName;
|
|
43
56
|
private assertUrl;
|
|
@@ -57,6 +57,15 @@ class McpServerService {
|
|
|
57
57
|
async listForTenant(tenantId) {
|
|
58
58
|
return this.repo.listForTenant(tenantId);
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Active rows across every tenant. The platform's boot orchestrator uses
|
|
62
|
+
* this to (re)connect MCPs after a process restart; per-request code
|
|
63
|
+
* paths should keep using `listForTenant` to avoid leaking other tenants'
|
|
64
|
+
* configs into a response.
|
|
65
|
+
*/
|
|
66
|
+
async listAllActive() {
|
|
67
|
+
return this.repo.listActive();
|
|
68
|
+
}
|
|
60
69
|
async getById(id) {
|
|
61
70
|
const r = await this.repo.findById(id);
|
|
62
71
|
if (!r)
|
|
@@ -102,9 +111,15 @@ class McpServerService {
|
|
|
102
111
|
}
|
|
103
112
|
await this.repo.delete(id);
|
|
104
113
|
}
|
|
105
|
-
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
114
|
+
/**
|
|
115
|
+
* @deprecated Headers are passed through to `McpClientService.register`
|
|
116
|
+
* exactly as stored — no `{{KEY}}` resolution against the host's vault.
|
|
117
|
+
* Hosts wiring secrets-in-vault should call `listAllActive()` and run
|
|
118
|
+
* their own bootstrapper instead (see `apps/server/src/modules/mcp/`).
|
|
119
|
+
* This method survives only to keep the legacy in-lib `McpModule`
|
|
120
|
+
* working during the deprecation lap; it will be removed in the same
|
|
121
|
+
* release that drops `McpModule` itself.
|
|
122
|
+
*/
|
|
108
123
|
async registerAllActive() {
|
|
109
124
|
if (!this.client)
|
|
110
125
|
return;
|
|
@@ -48,4 +48,11 @@ export interface ToolDescription {
|
|
|
48
48
|
connectorId?: string;
|
|
49
49
|
/** Human-readable connector label paired with `connectorId`. */
|
|
50
50
|
connectorName?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Set when this tool was discovered from an MCP server. The tool's
|
|
53
|
+
* `name` is already prefixed `<server>__<tool>`, but the UI uses this
|
|
54
|
+
* field to group tools by their MCP origin and label them distinctly
|
|
55
|
+
* from built-ins / connector tools.
|
|
56
|
+
*/
|
|
57
|
+
mcpServerName?: string;
|
|
51
58
|
}
|
|
@@ -95,6 +95,9 @@ class ToolRegistryService {
|
|
|
95
95
|
description: t.description,
|
|
96
96
|
inputSchema: t.inputSchema,
|
|
97
97
|
agents: t.agents,
|
|
98
|
+
...(t.connectorId ? { connectorId: t.connectorId } : {}),
|
|
99
|
+
...(t.connectorName ? { connectorName: t.connectorName } : {}),
|
|
100
|
+
...(t.mcpServerName ? { mcpServerName: t.mcpServerName } : {}),
|
|
98
101
|
}));
|
|
99
102
|
}
|
|
100
103
|
}
|
|
@@ -90,6 +90,13 @@ export interface AgentToolDefinition {
|
|
|
90
90
|
execute: (input: Record<string, unknown>, context: ToolExecutionContext) => Promise<string>;
|
|
91
91
|
/** Restrict to specific agents */
|
|
92
92
|
agents?: string[];
|
|
93
|
+
/** OAuth connector this tool belongs to. Set by ConnectorRegistryService
|
|
94
|
+
* when materializing per-user toolbelts; left undefined for built-ins. */
|
|
95
|
+
connectorId?: string;
|
|
96
|
+
connectorName?: string;
|
|
97
|
+
/** MCP server this tool was discovered from. Set by McpClientService when
|
|
98
|
+
* wrapping a remote tool; left undefined for built-ins and connector tools. */
|
|
99
|
+
mcpServerName?: string;
|
|
93
100
|
}
|
|
94
101
|
export interface ToolExecutionContext {
|
|
95
102
|
userId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Framework-free AI runtime SDK. Owns: agent loop (Anthropic), conversations, tools, streaming, agent-job queue, SdkHooks. Identity, billing, infra (email/uploads/secrets) live in the host's modules — not here.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|