moflo 4.8.19 → 4.8.20
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/.claude/guidance/shipped/moflo.md +45 -0
- package/.claude/helpers/statusline.cjs +1 -1
- package/.claude/workflow-state.json +9 -0
- package/package.json +2 -2
- package/src/@claude-flow/cli/dist/src/init/statusline-generator.js +1 -1
- package/src/@claude-flow/cli/dist/src/services/agentic-flow-bridge.js +5 -3
- package/src/@claude-flow/cli/package.json +1 -1
- package/src/@claude-flow/memory/dist/agent-memory-scope.d.ts +131 -0
- package/src/@claude-flow/memory/dist/agent-memory-scope.js +223 -0
- package/src/@claude-flow/memory/dist/agent-memory-scope.test.d.ts +8 -0
- package/src/@claude-flow/memory/dist/agent-memory-scope.test.js +466 -0
- package/src/@claude-flow/memory/dist/agentdb-adapter.d.ts +165 -0
- package/src/@claude-flow/memory/dist/agentdb-adapter.js +806 -0
- package/src/@claude-flow/memory/dist/agentdb-backend.d.ts +212 -0
- package/src/@claude-flow/memory/dist/agentdb-backend.js +842 -0
- package/src/@claude-flow/memory/dist/agentdb-backend.test.d.ts +7 -0
- package/src/@claude-flow/memory/dist/agentdb-backend.test.js +258 -0
- package/src/@claude-flow/memory/dist/application/commands/delete-memory.command.d.ts +65 -0
- package/src/@claude-flow/memory/dist/application/commands/delete-memory.command.js +129 -0
- package/src/@claude-flow/memory/dist/application/commands/store-memory.command.d.ts +48 -0
- package/src/@claude-flow/memory/dist/application/commands/store-memory.command.js +72 -0
- package/src/@claude-flow/memory/dist/application/index.d.ts +12 -0
- package/src/@claude-flow/memory/dist/application/index.js +15 -0
- package/src/@claude-flow/memory/dist/application/queries/search-memory.query.d.ts +72 -0
- package/src/@claude-flow/memory/dist/application/queries/search-memory.query.js +143 -0
- package/src/@claude-flow/memory/dist/application/services/memory-application-service.d.ts +121 -0
- package/src/@claude-flow/memory/dist/application/services/memory-application-service.js +190 -0
- package/src/@claude-flow/memory/dist/auto-memory-bridge.d.ts +226 -0
- package/src/@claude-flow/memory/dist/auto-memory-bridge.js +709 -0
- package/src/@claude-flow/memory/dist/auto-memory-bridge.test.d.ts +8 -0
- package/src/@claude-flow/memory/dist/auto-memory-bridge.test.js +757 -0
- package/src/@claude-flow/memory/dist/benchmark.test.d.ts +2 -0
- package/src/@claude-flow/memory/dist/benchmark.test.js +277 -0
- package/src/@claude-flow/memory/dist/cache-manager.d.ts +134 -0
- package/src/@claude-flow/memory/dist/cache-manager.js +407 -0
- package/src/@claude-flow/memory/dist/controller-registry.d.ts +216 -0
- package/src/@claude-flow/memory/dist/controller-registry.js +893 -0
- package/src/@claude-flow/memory/dist/controller-registry.test.d.ts +14 -0
- package/src/@claude-flow/memory/dist/controller-registry.test.js +593 -0
- package/src/@claude-flow/memory/dist/database-provider.d.ts +87 -0
- package/src/@claude-flow/memory/dist/database-provider.js +372 -0
- package/src/@claude-flow/memory/dist/database-provider.test.d.ts +7 -0
- package/src/@claude-flow/memory/dist/database-provider.test.js +287 -0
- package/src/@claude-flow/memory/dist/domain/entities/memory-entry.d.ts +143 -0
- package/src/@claude-flow/memory/dist/domain/entities/memory-entry.js +226 -0
- package/src/@claude-flow/memory/dist/domain/index.d.ts +11 -0
- package/src/@claude-flow/memory/dist/domain/index.js +12 -0
- package/src/@claude-flow/memory/dist/domain/repositories/memory-repository.interface.d.ts +102 -0
- package/src/@claude-flow/memory/dist/domain/repositories/memory-repository.interface.js +11 -0
- package/src/@claude-flow/memory/dist/domain/services/memory-domain-service.d.ts +105 -0
- package/src/@claude-flow/memory/dist/domain/services/memory-domain-service.js +297 -0
- package/src/@claude-flow/memory/dist/hnsw-index.d.ts +111 -0
- package/src/@claude-flow/memory/dist/hnsw-index.js +781 -0
- package/src/@claude-flow/memory/dist/hnsw-lite.d.ts +23 -0
- package/src/@claude-flow/memory/dist/hnsw-lite.js +168 -0
- package/src/@claude-flow/memory/dist/index.d.ts +204 -0
- package/src/@claude-flow/memory/dist/index.js +358 -0
- package/src/@claude-flow/memory/dist/infrastructure/index.d.ts +17 -0
- package/src/@claude-flow/memory/dist/infrastructure/index.js +16 -0
- package/src/@claude-flow/memory/dist/infrastructure/repositories/hybrid-memory-repository.d.ts +66 -0
- package/src/@claude-flow/memory/dist/infrastructure/repositories/hybrid-memory-repository.js +409 -0
- package/src/@claude-flow/memory/dist/learning-bridge.d.ts +137 -0
- package/src/@claude-flow/memory/dist/learning-bridge.js +335 -0
- package/src/@claude-flow/memory/dist/learning-bridge.test.d.ts +8 -0
- package/src/@claude-flow/memory/dist/learning-bridge.test.js +578 -0
- package/src/@claude-flow/memory/dist/memory-graph.d.ts +100 -0
- package/src/@claude-flow/memory/dist/memory-graph.js +333 -0
- package/src/@claude-flow/memory/dist/memory-graph.test.d.ts +8 -0
- package/src/@claude-flow/memory/dist/memory-graph.test.js +609 -0
- package/src/@claude-flow/memory/dist/migration.d.ts +68 -0
- package/src/@claude-flow/memory/dist/migration.js +513 -0
- package/src/@claude-flow/memory/dist/persistent-sona.d.ts +144 -0
- package/src/@claude-flow/memory/dist/persistent-sona.js +332 -0
- package/src/@claude-flow/memory/dist/query-builder.d.ts +211 -0
- package/src/@claude-flow/memory/dist/query-builder.js +438 -0
- package/src/@claude-flow/memory/dist/rvf-backend.d.ts +51 -0
- package/src/@claude-flow/memory/dist/rvf-backend.js +481 -0
- package/src/@claude-flow/memory/dist/rvf-learning-store.d.ts +139 -0
- package/src/@claude-flow/memory/dist/rvf-learning-store.js +295 -0
- package/src/@claude-flow/memory/dist/rvf-migration.d.ts +45 -0
- package/src/@claude-flow/memory/dist/rvf-migration.js +234 -0
- package/src/@claude-flow/memory/dist/sqljs-backend.d.ts +127 -0
- package/src/@claude-flow/memory/dist/sqljs-backend.js +600 -0
- package/src/@claude-flow/memory/dist/types.d.ts +484 -0
- package/src/@claude-flow/memory/dist/types.js +58 -0
- package/src/@claude-flow/shared/dist/core/config/defaults.d.ts +41 -0
- package/src/@claude-flow/shared/dist/core/config/defaults.js +186 -0
- package/src/@claude-flow/shared/dist/core/config/index.d.ts +8 -0
- package/src/@claude-flow/shared/dist/core/config/index.js +12 -0
- package/src/@claude-flow/shared/dist/core/config/loader.d.ts +45 -0
- package/src/@claude-flow/shared/dist/core/config/loader.js +222 -0
- package/src/@claude-flow/shared/dist/core/config/schema.d.ts +1134 -0
- package/src/@claude-flow/shared/dist/core/config/schema.js +158 -0
- package/src/@claude-flow/shared/dist/core/config/validator.d.ts +92 -0
- package/src/@claude-flow/shared/dist/core/config/validator.js +147 -0
- package/src/@claude-flow/shared/dist/core/event-bus.d.ts +31 -0
- package/src/@claude-flow/shared/dist/core/event-bus.js +197 -0
- package/src/@claude-flow/shared/dist/core/index.d.ts +15 -0
- package/src/@claude-flow/shared/dist/core/index.js +19 -0
- package/src/@claude-flow/shared/dist/core/interfaces/agent.interface.d.ts +200 -0
- package/src/@claude-flow/shared/dist/core/interfaces/agent.interface.js +6 -0
- package/src/@claude-flow/shared/dist/core/interfaces/coordinator.interface.d.ts +310 -0
- package/src/@claude-flow/shared/dist/core/interfaces/coordinator.interface.js +7 -0
- package/src/@claude-flow/shared/dist/core/interfaces/event.interface.d.ts +224 -0
- package/src/@claude-flow/shared/dist/core/interfaces/event.interface.js +46 -0
- package/src/@claude-flow/shared/dist/core/interfaces/index.d.ts +10 -0
- package/src/@claude-flow/shared/dist/core/interfaces/index.js +15 -0
- package/src/@claude-flow/shared/dist/core/interfaces/memory.interface.d.ts +298 -0
- package/src/@claude-flow/shared/dist/core/interfaces/memory.interface.js +7 -0
- package/src/@claude-flow/shared/dist/core/interfaces/task.interface.d.ts +185 -0
- package/src/@claude-flow/shared/dist/core/interfaces/task.interface.js +6 -0
- package/src/@claude-flow/shared/dist/core/orchestrator/event-coordinator.d.ts +35 -0
- package/src/@claude-flow/shared/dist/core/orchestrator/event-coordinator.js +101 -0
- package/src/@claude-flow/shared/dist/core/orchestrator/health-monitor.d.ts +60 -0
- package/src/@claude-flow/shared/dist/core/orchestrator/health-monitor.js +166 -0
- package/src/@claude-flow/shared/dist/core/orchestrator/index.d.ts +46 -0
- package/src/@claude-flow/shared/dist/core/orchestrator/index.js +64 -0
- package/src/@claude-flow/shared/dist/core/orchestrator/lifecycle-manager.d.ts +56 -0
- package/src/@claude-flow/shared/dist/core/orchestrator/lifecycle-manager.js +195 -0
- package/src/@claude-flow/shared/dist/core/orchestrator/session-manager.d.ts +83 -0
- package/src/@claude-flow/shared/dist/core/orchestrator/session-manager.js +193 -0
- package/src/@claude-flow/shared/dist/core/orchestrator/task-manager.d.ts +49 -0
- package/src/@claude-flow/shared/dist/core/orchestrator/task-manager.js +253 -0
- package/src/@claude-flow/shared/dist/events/domain-events.d.ts +282 -0
- package/src/@claude-flow/shared/dist/events/domain-events.js +165 -0
- package/src/@claude-flow/shared/dist/events/event-store.d.ts +126 -0
- package/src/@claude-flow/shared/dist/events/event-store.js +432 -0
- package/src/@claude-flow/shared/dist/events/event-store.test.d.ts +8 -0
- package/src/@claude-flow/shared/dist/events/event-store.test.js +297 -0
- package/src/@claude-flow/shared/dist/events/example-usage.d.ts +10 -0
- package/src/@claude-flow/shared/dist/events/example-usage.js +193 -0
- package/src/@claude-flow/shared/dist/events/index.d.ts +21 -0
- package/src/@claude-flow/shared/dist/events/index.js +22 -0
- package/src/@claude-flow/shared/dist/events/projections.d.ts +177 -0
- package/src/@claude-flow/shared/dist/events/projections.js +421 -0
- package/src/@claude-flow/shared/dist/events/rvf-event-log.d.ts +82 -0
- package/src/@claude-flow/shared/dist/events/rvf-event-log.js +340 -0
- package/src/@claude-flow/shared/dist/events/state-reconstructor.d.ts +101 -0
- package/src/@claude-flow/shared/dist/events/state-reconstructor.js +263 -0
- package/src/@claude-flow/shared/dist/events.d.ts +80 -0
- package/src/@claude-flow/shared/dist/events.js +249 -0
- package/src/@claude-flow/shared/dist/hooks/example-usage.d.ts +42 -0
- package/src/@claude-flow/shared/dist/hooks/example-usage.js +351 -0
- package/src/@claude-flow/shared/dist/hooks/executor.d.ts +100 -0
- package/src/@claude-flow/shared/dist/hooks/executor.js +267 -0
- package/src/@claude-flow/shared/dist/hooks/hooks.test.d.ts +9 -0
- package/src/@claude-flow/shared/dist/hooks/hooks.test.js +322 -0
- package/src/@claude-flow/shared/dist/hooks/index.d.ts +52 -0
- package/src/@claude-flow/shared/dist/hooks/index.js +51 -0
- package/src/@claude-flow/shared/dist/hooks/registry.d.ts +133 -0
- package/src/@claude-flow/shared/dist/hooks/registry.js +277 -0
- package/src/@claude-flow/shared/dist/hooks/safety/bash-safety.d.ts +105 -0
- package/src/@claude-flow/shared/dist/hooks/safety/bash-safety.js +481 -0
- package/src/@claude-flow/shared/dist/hooks/safety/file-organization.d.ts +144 -0
- package/src/@claude-flow/shared/dist/hooks/safety/file-organization.js +328 -0
- package/src/@claude-flow/shared/dist/hooks/safety/git-commit.d.ts +158 -0
- package/src/@claude-flow/shared/dist/hooks/safety/git-commit.js +450 -0
- package/src/@claude-flow/shared/dist/hooks/safety/index.d.ts +17 -0
- package/src/@claude-flow/shared/dist/hooks/safety/index.js +17 -0
- package/src/@claude-flow/shared/dist/hooks/session-hooks.d.ts +234 -0
- package/src/@claude-flow/shared/dist/hooks/session-hooks.js +334 -0
- package/src/@claude-flow/shared/dist/hooks/task-hooks.d.ts +163 -0
- package/src/@claude-flow/shared/dist/hooks/task-hooks.js +326 -0
- package/src/@claude-flow/shared/dist/hooks/types.d.ts +267 -0
- package/src/@claude-flow/shared/dist/hooks/types.js +62 -0
- package/src/@claude-flow/shared/dist/hooks/verify-exports.test.d.ts +9 -0
- package/src/@claude-flow/shared/dist/hooks/verify-exports.test.js +93 -0
- package/src/@claude-flow/shared/dist/index.d.ts +20 -0
- package/src/@claude-flow/shared/dist/index.js +50 -0
- package/src/@claude-flow/shared/dist/mcp/connection-pool.d.ts +98 -0
- package/src/@claude-flow/shared/dist/mcp/connection-pool.js +364 -0
- package/src/@claude-flow/shared/dist/mcp/index.d.ts +69 -0
- package/src/@claude-flow/shared/dist/mcp/index.js +84 -0
- package/src/@claude-flow/shared/dist/mcp/server.d.ts +166 -0
- package/src/@claude-flow/shared/dist/mcp/server.js +593 -0
- package/src/@claude-flow/shared/dist/mcp/session-manager.d.ts +136 -0
- package/src/@claude-flow/shared/dist/mcp/session-manager.js +335 -0
- package/src/@claude-flow/shared/dist/mcp/tool-registry.d.ts +178 -0
- package/src/@claude-flow/shared/dist/mcp/tool-registry.js +439 -0
- package/src/@claude-flow/shared/dist/mcp/transport/http.d.ts +104 -0
- package/src/@claude-flow/shared/dist/mcp/transport/http.js +476 -0
- package/src/@claude-flow/shared/dist/mcp/transport/index.d.ts +102 -0
- package/src/@claude-flow/shared/dist/mcp/transport/index.js +238 -0
- package/src/@claude-flow/shared/dist/mcp/transport/stdio.d.ts +104 -0
- package/src/@claude-flow/shared/dist/mcp/transport/stdio.js +263 -0
- package/src/@claude-flow/shared/dist/mcp/transport/websocket.d.ts +133 -0
- package/src/@claude-flow/shared/dist/mcp/transport/websocket.js +396 -0
- package/src/@claude-flow/shared/dist/mcp/types.d.ts +438 -0
- package/src/@claude-flow/shared/dist/mcp/types.js +54 -0
- package/src/@claude-flow/shared/dist/plugin-interface.d.ts +544 -0
- package/src/@claude-flow/shared/dist/plugin-interface.js +23 -0
- package/src/@claude-flow/shared/dist/plugin-loader.d.ts +139 -0
- package/src/@claude-flow/shared/dist/plugin-loader.js +434 -0
- package/src/@claude-flow/shared/dist/plugin-registry.d.ts +183 -0
- package/src/@claude-flow/shared/dist/plugin-registry.js +457 -0
- package/src/@claude-flow/shared/dist/plugins/index.d.ts +10 -0
- package/src/@claude-flow/shared/dist/plugins/index.js +10 -0
- package/src/@claude-flow/shared/dist/plugins/official/hive-mind-plugin.d.ts +106 -0
- package/src/@claude-flow/shared/dist/plugins/official/hive-mind-plugin.js +241 -0
- package/src/@claude-flow/shared/dist/plugins/official/index.d.ts +10 -0
- package/src/@claude-flow/shared/dist/plugins/official/index.js +10 -0
- package/src/@claude-flow/shared/dist/plugins/official/maestro-plugin.d.ts +121 -0
- package/src/@claude-flow/shared/dist/plugins/official/maestro-plugin.js +355 -0
- package/src/@claude-flow/shared/dist/plugins/types.d.ts +93 -0
- package/src/@claude-flow/shared/dist/plugins/types.js +9 -0
- package/src/@claude-flow/shared/dist/resilience/bulkhead.d.ts +105 -0
- package/src/@claude-flow/shared/dist/resilience/bulkhead.js +206 -0
- package/src/@claude-flow/shared/dist/resilience/circuit-breaker.d.ts +132 -0
- package/src/@claude-flow/shared/dist/resilience/circuit-breaker.js +233 -0
- package/src/@claude-flow/shared/dist/resilience/index.d.ts +19 -0
- package/src/@claude-flow/shared/dist/resilience/index.js +19 -0
- package/src/@claude-flow/shared/dist/resilience/rate-limiter.d.ts +168 -0
- package/src/@claude-flow/shared/dist/resilience/rate-limiter.js +314 -0
- package/src/@claude-flow/shared/dist/resilience/retry.d.ts +91 -0
- package/src/@claude-flow/shared/dist/resilience/retry.js +159 -0
- package/src/@claude-flow/shared/dist/security/index.d.ts +10 -0
- package/src/@claude-flow/shared/dist/security/index.js +12 -0
- package/src/@claude-flow/shared/dist/security/input-validation.d.ts +73 -0
- package/src/@claude-flow/shared/dist/security/input-validation.js +201 -0
- package/src/@claude-flow/shared/dist/security/secure-random.d.ts +92 -0
- package/src/@claude-flow/shared/dist/security/secure-random.js +142 -0
- package/src/@claude-flow/shared/dist/services/index.d.ts +7 -0
- package/src/@claude-flow/shared/dist/services/index.js +7 -0
- package/src/@claude-flow/shared/dist/services/v3-progress.service.d.ts +124 -0
- package/src/@claude-flow/shared/dist/services/v3-progress.service.js +402 -0
- package/src/@claude-flow/shared/dist/types/agent.types.d.ts +137 -0
- package/src/@claude-flow/shared/dist/types/agent.types.js +6 -0
- package/src/@claude-flow/shared/dist/types/index.d.ts +11 -0
- package/src/@claude-flow/shared/dist/types/index.js +17 -0
- package/src/@claude-flow/shared/dist/types/mcp.types.d.ts +266 -0
- package/src/@claude-flow/shared/dist/types/mcp.types.js +7 -0
- package/src/@claude-flow/shared/dist/types/memory.types.d.ts +236 -0
- package/src/@claude-flow/shared/dist/types/memory.types.js +7 -0
- package/src/@claude-flow/shared/dist/types/swarm.types.d.ts +186 -0
- package/src/@claude-flow/shared/dist/types/swarm.types.js +65 -0
- package/src/@claude-flow/shared/dist/types/task.types.d.ts +178 -0
- package/src/@claude-flow/shared/dist/types/task.types.js +32 -0
- package/src/@claude-flow/shared/dist/types.d.ts +197 -0
- package/src/@claude-flow/shared/dist/types.js +21 -0
- package/src/@claude-flow/shared/dist/utils/secure-logger.d.ts +69 -0
- package/src/@claude-flow/shared/dist/utils/secure-logger.js +208 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V3 MCP Session Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages MCP sessions with:
|
|
5
|
+
* - Session lifecycle management
|
|
6
|
+
* - Authentication integration
|
|
7
|
+
* - Session timeout handling
|
|
8
|
+
* - Concurrent session support
|
|
9
|
+
* - Session metrics and monitoring
|
|
10
|
+
*
|
|
11
|
+
* Performance Targets:
|
|
12
|
+
* - Session creation: <5ms
|
|
13
|
+
* - Session lookup: <1ms
|
|
14
|
+
* - Session cleanup: <10ms
|
|
15
|
+
*/
|
|
16
|
+
import { EventEmitter } from 'events';
|
|
17
|
+
import { MCPSession, SessionState, SessionMetrics, MCPInitializeParams, TransportType, ILogger } from './types.js';
|
|
18
|
+
/**
|
|
19
|
+
* Session configuration
|
|
20
|
+
*/
|
|
21
|
+
export interface SessionConfig {
|
|
22
|
+
maxSessions?: number;
|
|
23
|
+
sessionTimeout?: number;
|
|
24
|
+
cleanupInterval?: number;
|
|
25
|
+
enableMetrics?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Session Manager
|
|
29
|
+
*
|
|
30
|
+
* Handles creation, tracking, and cleanup of MCP sessions
|
|
31
|
+
*/
|
|
32
|
+
export declare class SessionManager extends EventEmitter {
|
|
33
|
+
private readonly logger;
|
|
34
|
+
private readonly sessions;
|
|
35
|
+
private readonly config;
|
|
36
|
+
private cleanupTimer?;
|
|
37
|
+
private sessionCounter;
|
|
38
|
+
private totalCreated;
|
|
39
|
+
private totalClosed;
|
|
40
|
+
private totalExpired;
|
|
41
|
+
constructor(logger: ILogger, config?: SessionConfig);
|
|
42
|
+
/**
|
|
43
|
+
* Create a new session
|
|
44
|
+
*/
|
|
45
|
+
createSession(transport: TransportType): MCPSession;
|
|
46
|
+
/**
|
|
47
|
+
* Initialize a session with client information
|
|
48
|
+
*/
|
|
49
|
+
initializeSession(sessionId: string, params: MCPInitializeParams): MCPSession | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Authenticate a session
|
|
52
|
+
*/
|
|
53
|
+
authenticateSession(sessionId: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Get a session by ID
|
|
56
|
+
*/
|
|
57
|
+
getSession(sessionId: string): MCPSession | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Check if session exists
|
|
60
|
+
*/
|
|
61
|
+
hasSession(sessionId: string): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Get all active sessions
|
|
64
|
+
*/
|
|
65
|
+
getActiveSessions(): MCPSession[];
|
|
66
|
+
/**
|
|
67
|
+
* Update session activity timestamp
|
|
68
|
+
*/
|
|
69
|
+
updateActivity(sessionId: string): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Set session state
|
|
72
|
+
*/
|
|
73
|
+
setState(sessionId: string, state: SessionState): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Set session metadata
|
|
76
|
+
*/
|
|
77
|
+
setMetadata(sessionId: string, key: string, value: unknown): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Get session metadata
|
|
80
|
+
*/
|
|
81
|
+
getMetadata(sessionId: string, key: string): unknown;
|
|
82
|
+
/**
|
|
83
|
+
* Close a session
|
|
84
|
+
*/
|
|
85
|
+
closeSession(sessionId: string, reason?: string): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Remove a session (alias for closeSession)
|
|
88
|
+
*/
|
|
89
|
+
removeSession(sessionId: string): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Get session metrics
|
|
92
|
+
*/
|
|
93
|
+
getSessionMetrics(): SessionMetrics;
|
|
94
|
+
/**
|
|
95
|
+
* Get detailed statistics
|
|
96
|
+
*/
|
|
97
|
+
getStats(): {
|
|
98
|
+
total: number;
|
|
99
|
+
byState: Record<SessionState, number>;
|
|
100
|
+
byTransport: Record<TransportType, number>;
|
|
101
|
+
totalCreated: number;
|
|
102
|
+
totalClosed: number;
|
|
103
|
+
totalExpired: number;
|
|
104
|
+
oldestSession?: Date;
|
|
105
|
+
newestSession?: Date;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Clean up expired sessions
|
|
109
|
+
*/
|
|
110
|
+
cleanupExpiredSessions(): number;
|
|
111
|
+
/**
|
|
112
|
+
* Start cleanup timer
|
|
113
|
+
*/
|
|
114
|
+
private startCleanupTimer;
|
|
115
|
+
/**
|
|
116
|
+
* Stop cleanup timer
|
|
117
|
+
*/
|
|
118
|
+
private stopCleanupTimer;
|
|
119
|
+
/**
|
|
120
|
+
* Generate a unique session ID
|
|
121
|
+
*/
|
|
122
|
+
private generateSessionId;
|
|
123
|
+
/**
|
|
124
|
+
* Clear all sessions
|
|
125
|
+
*/
|
|
126
|
+
clearAll(): void;
|
|
127
|
+
/**
|
|
128
|
+
* Destroy the session manager
|
|
129
|
+
*/
|
|
130
|
+
destroy(): void;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Create a session manager
|
|
134
|
+
*/
|
|
135
|
+
export declare function createSessionManager(logger: ILogger, config?: SessionConfig): SessionManager;
|
|
136
|
+
//# sourceMappingURL=session-manager.d.ts.map
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V3 MCP Session Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages MCP sessions with:
|
|
5
|
+
* - Session lifecycle management
|
|
6
|
+
* - Authentication integration
|
|
7
|
+
* - Session timeout handling
|
|
8
|
+
* - Concurrent session support
|
|
9
|
+
* - Session metrics and monitoring
|
|
10
|
+
*
|
|
11
|
+
* Performance Targets:
|
|
12
|
+
* - Session creation: <5ms
|
|
13
|
+
* - Session lookup: <1ms
|
|
14
|
+
* - Session cleanup: <10ms
|
|
15
|
+
*/
|
|
16
|
+
import { EventEmitter } from 'events';
|
|
17
|
+
/**
|
|
18
|
+
* Default session configuration
|
|
19
|
+
*/
|
|
20
|
+
const DEFAULT_SESSION_CONFIG = {
|
|
21
|
+
maxSessions: 100,
|
|
22
|
+
sessionTimeout: 30 * 60 * 1000, // 30 minutes
|
|
23
|
+
cleanupInterval: 60 * 1000, // 1 minute
|
|
24
|
+
enableMetrics: true,
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Session Manager
|
|
28
|
+
*
|
|
29
|
+
* Handles creation, tracking, and cleanup of MCP sessions
|
|
30
|
+
*/
|
|
31
|
+
export class SessionManager extends EventEmitter {
|
|
32
|
+
logger;
|
|
33
|
+
sessions = new Map();
|
|
34
|
+
config;
|
|
35
|
+
cleanupTimer;
|
|
36
|
+
sessionCounter = 0;
|
|
37
|
+
// Statistics
|
|
38
|
+
totalCreated = 0;
|
|
39
|
+
totalClosed = 0;
|
|
40
|
+
totalExpired = 0;
|
|
41
|
+
constructor(logger, config = {}) {
|
|
42
|
+
super();
|
|
43
|
+
this.logger = logger;
|
|
44
|
+
this.config = { ...DEFAULT_SESSION_CONFIG, ...config };
|
|
45
|
+
this.startCleanupTimer();
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create a new session
|
|
49
|
+
*/
|
|
50
|
+
createSession(transport) {
|
|
51
|
+
// Check max sessions
|
|
52
|
+
if (this.sessions.size >= this.config.maxSessions) {
|
|
53
|
+
throw new Error(`Maximum sessions (${this.config.maxSessions}) reached`);
|
|
54
|
+
}
|
|
55
|
+
const id = this.generateSessionId();
|
|
56
|
+
const now = new Date();
|
|
57
|
+
const session = {
|
|
58
|
+
id,
|
|
59
|
+
state: 'created',
|
|
60
|
+
transport,
|
|
61
|
+
createdAt: now,
|
|
62
|
+
lastActivityAt: now,
|
|
63
|
+
isInitialized: false,
|
|
64
|
+
isAuthenticated: false,
|
|
65
|
+
};
|
|
66
|
+
this.sessions.set(id, session);
|
|
67
|
+
this.totalCreated++;
|
|
68
|
+
this.logger.debug('Session created', { id, transport });
|
|
69
|
+
this.emit('session:created', session);
|
|
70
|
+
return session;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Initialize a session with client information
|
|
74
|
+
*/
|
|
75
|
+
initializeSession(sessionId, params) {
|
|
76
|
+
const session = this.sessions.get(sessionId);
|
|
77
|
+
if (!session) {
|
|
78
|
+
this.logger.warn('Session not found for initialization', { sessionId });
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
session.state = 'ready';
|
|
82
|
+
session.isInitialized = true;
|
|
83
|
+
session.clientInfo = params.clientInfo;
|
|
84
|
+
session.protocolVersion = params.protocolVersion;
|
|
85
|
+
session.capabilities = params.capabilities;
|
|
86
|
+
session.lastActivityAt = new Date();
|
|
87
|
+
this.logger.info('Session initialized', {
|
|
88
|
+
sessionId,
|
|
89
|
+
clientInfo: params.clientInfo,
|
|
90
|
+
protocolVersion: params.protocolVersion,
|
|
91
|
+
});
|
|
92
|
+
this.emit('session:initialized', session);
|
|
93
|
+
return session;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Authenticate a session
|
|
97
|
+
*/
|
|
98
|
+
authenticateSession(sessionId) {
|
|
99
|
+
const session = this.sessions.get(sessionId);
|
|
100
|
+
if (!session) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
session.isAuthenticated = true;
|
|
104
|
+
session.lastActivityAt = new Date();
|
|
105
|
+
this.logger.debug('Session authenticated', { sessionId });
|
|
106
|
+
this.emit('session:authenticated', session);
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get a session by ID
|
|
111
|
+
*/
|
|
112
|
+
getSession(sessionId) {
|
|
113
|
+
return this.sessions.get(sessionId);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Check if session exists
|
|
117
|
+
*/
|
|
118
|
+
hasSession(sessionId) {
|
|
119
|
+
return this.sessions.has(sessionId);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get all active sessions
|
|
123
|
+
*/
|
|
124
|
+
getActiveSessions() {
|
|
125
|
+
return Array.from(this.sessions.values()).filter((s) => s.state === 'ready' || s.state === 'created' || s.state === 'initializing');
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Update session activity timestamp
|
|
129
|
+
*/
|
|
130
|
+
updateActivity(sessionId) {
|
|
131
|
+
const session = this.sessions.get(sessionId);
|
|
132
|
+
if (!session) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
session.lastActivityAt = new Date();
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Set session state
|
|
140
|
+
*/
|
|
141
|
+
setState(sessionId, state) {
|
|
142
|
+
const session = this.sessions.get(sessionId);
|
|
143
|
+
if (!session) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
const oldState = session.state;
|
|
147
|
+
session.state = state;
|
|
148
|
+
session.lastActivityAt = new Date();
|
|
149
|
+
this.logger.debug('Session state changed', {
|
|
150
|
+
sessionId,
|
|
151
|
+
oldState,
|
|
152
|
+
newState: state,
|
|
153
|
+
});
|
|
154
|
+
this.emit('session:stateChanged', { session, oldState, newState: state });
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Set session metadata
|
|
159
|
+
*/
|
|
160
|
+
setMetadata(sessionId, key, value) {
|
|
161
|
+
const session = this.sessions.get(sessionId);
|
|
162
|
+
if (!session) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
if (!session.metadata) {
|
|
166
|
+
session.metadata = {};
|
|
167
|
+
}
|
|
168
|
+
session.metadata[key] = value;
|
|
169
|
+
session.lastActivityAt = new Date();
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Get session metadata
|
|
174
|
+
*/
|
|
175
|
+
getMetadata(sessionId, key) {
|
|
176
|
+
const session = this.sessions.get(sessionId);
|
|
177
|
+
return session?.metadata?.[key];
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Close a session
|
|
181
|
+
*/
|
|
182
|
+
closeSession(sessionId, reason) {
|
|
183
|
+
const session = this.sessions.get(sessionId);
|
|
184
|
+
if (!session) {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
session.state = 'closed';
|
|
188
|
+
this.sessions.delete(sessionId);
|
|
189
|
+
this.totalClosed++;
|
|
190
|
+
this.logger.info('Session closed', { sessionId, reason });
|
|
191
|
+
this.emit('session:closed', { session, reason });
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Remove a session (alias for closeSession)
|
|
196
|
+
*/
|
|
197
|
+
removeSession(sessionId) {
|
|
198
|
+
return this.closeSession(sessionId);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Get session metrics
|
|
202
|
+
*/
|
|
203
|
+
getSessionMetrics() {
|
|
204
|
+
let authenticated = 0;
|
|
205
|
+
let active = 0;
|
|
206
|
+
for (const session of this.sessions.values()) {
|
|
207
|
+
if (session.isAuthenticated)
|
|
208
|
+
authenticated++;
|
|
209
|
+
if (session.state === 'ready')
|
|
210
|
+
active++;
|
|
211
|
+
}
|
|
212
|
+
return {
|
|
213
|
+
total: this.sessions.size,
|
|
214
|
+
active,
|
|
215
|
+
authenticated,
|
|
216
|
+
expired: this.totalExpired,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Get detailed statistics
|
|
221
|
+
*/
|
|
222
|
+
getStats() {
|
|
223
|
+
const byState = {
|
|
224
|
+
created: 0,
|
|
225
|
+
initializing: 0,
|
|
226
|
+
ready: 0,
|
|
227
|
+
closing: 0,
|
|
228
|
+
closed: 0,
|
|
229
|
+
error: 0,
|
|
230
|
+
};
|
|
231
|
+
const byTransport = {
|
|
232
|
+
stdio: 0,
|
|
233
|
+
http: 0,
|
|
234
|
+
websocket: 0,
|
|
235
|
+
'in-process': 0,
|
|
236
|
+
};
|
|
237
|
+
let oldest;
|
|
238
|
+
let newest;
|
|
239
|
+
for (const session of this.sessions.values()) {
|
|
240
|
+
byState[session.state] = (byState[session.state] || 0) + 1;
|
|
241
|
+
byTransport[session.transport] = (byTransport[session.transport] || 0) + 1;
|
|
242
|
+
if (!oldest || session.createdAt < oldest) {
|
|
243
|
+
oldest = session.createdAt;
|
|
244
|
+
}
|
|
245
|
+
if (!newest || session.createdAt > newest) {
|
|
246
|
+
newest = session.createdAt;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
total: this.sessions.size,
|
|
251
|
+
byState: byState,
|
|
252
|
+
byTransport: byTransport,
|
|
253
|
+
totalCreated: this.totalCreated,
|
|
254
|
+
totalClosed: this.totalClosed,
|
|
255
|
+
totalExpired: this.totalExpired,
|
|
256
|
+
oldestSession: oldest,
|
|
257
|
+
newestSession: newest,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Clean up expired sessions
|
|
262
|
+
*/
|
|
263
|
+
cleanupExpiredSessions() {
|
|
264
|
+
const now = Date.now();
|
|
265
|
+
const expired = [];
|
|
266
|
+
for (const [id, session] of this.sessions) {
|
|
267
|
+
const inactiveTime = now - session.lastActivityAt.getTime();
|
|
268
|
+
if (inactiveTime > this.config.sessionTimeout) {
|
|
269
|
+
expired.push(id);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
for (const id of expired) {
|
|
273
|
+
const session = this.sessions.get(id);
|
|
274
|
+
if (session) {
|
|
275
|
+
session.state = 'closed';
|
|
276
|
+
this.sessions.delete(id);
|
|
277
|
+
this.totalExpired++;
|
|
278
|
+
this.logger.info('Session expired', { sessionId: id });
|
|
279
|
+
this.emit('session:expired', session);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (expired.length > 0) {
|
|
283
|
+
this.logger.info('Cleaned up expired sessions', { count: expired.length });
|
|
284
|
+
}
|
|
285
|
+
return expired.length;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Start cleanup timer
|
|
289
|
+
*/
|
|
290
|
+
startCleanupTimer() {
|
|
291
|
+
this.cleanupTimer = setInterval(() => {
|
|
292
|
+
this.cleanupExpiredSessions();
|
|
293
|
+
}, this.config.cleanupInterval);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Stop cleanup timer
|
|
297
|
+
*/
|
|
298
|
+
stopCleanupTimer() {
|
|
299
|
+
if (this.cleanupTimer) {
|
|
300
|
+
clearInterval(this.cleanupTimer);
|
|
301
|
+
this.cleanupTimer = undefined;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Generate a unique session ID
|
|
306
|
+
*/
|
|
307
|
+
generateSessionId() {
|
|
308
|
+
return `session-${++this.sessionCounter}-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Clear all sessions
|
|
312
|
+
*/
|
|
313
|
+
clearAll() {
|
|
314
|
+
for (const id of this.sessions.keys()) {
|
|
315
|
+
this.closeSession(id, 'Session manager cleared');
|
|
316
|
+
}
|
|
317
|
+
this.logger.info('All sessions cleared');
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Destroy the session manager
|
|
321
|
+
*/
|
|
322
|
+
destroy() {
|
|
323
|
+
this.stopCleanupTimer();
|
|
324
|
+
this.clearAll();
|
|
325
|
+
this.removeAllListeners();
|
|
326
|
+
this.logger.info('Session manager destroyed');
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Create a session manager
|
|
331
|
+
*/
|
|
332
|
+
export function createSessionManager(logger, config) {
|
|
333
|
+
return new SessionManager(logger, config);
|
|
334
|
+
}
|
|
335
|
+
//# sourceMappingURL=session-manager.js.map
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V3 MCP Tool Registry
|
|
3
|
+
*
|
|
4
|
+
* High-performance tool management with:
|
|
5
|
+
* - Fast O(1) lookup using Map
|
|
6
|
+
* - Category-based organization
|
|
7
|
+
* - Tool validation on registration
|
|
8
|
+
* - Dynamic registration/unregistration
|
|
9
|
+
* - Caching for frequently used tools
|
|
10
|
+
*
|
|
11
|
+
* Performance Targets:
|
|
12
|
+
* - Tool registration: <10ms
|
|
13
|
+
* - Tool lookup: <1ms
|
|
14
|
+
* - Tool validation: <5ms
|
|
15
|
+
*/
|
|
16
|
+
import { EventEmitter } from 'events';
|
|
17
|
+
import { MCPTool, JSONSchema, ToolHandler, ToolContext, ToolCallResult, ToolRegistrationOptions, ILogger } from './types.js';
|
|
18
|
+
/**
|
|
19
|
+
* Tool metadata for enhanced lookup
|
|
20
|
+
*/
|
|
21
|
+
interface ToolMetadata {
|
|
22
|
+
tool: MCPTool;
|
|
23
|
+
registeredAt: Date;
|
|
24
|
+
callCount: number;
|
|
25
|
+
lastCalled?: Date;
|
|
26
|
+
avgExecutionTime: number;
|
|
27
|
+
errorCount: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Tool search options
|
|
31
|
+
*/
|
|
32
|
+
interface ToolSearchOptions {
|
|
33
|
+
category?: string;
|
|
34
|
+
tags?: string[];
|
|
35
|
+
deprecated?: boolean;
|
|
36
|
+
cacheable?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Tool Registry
|
|
40
|
+
*
|
|
41
|
+
* Manages registration, lookup, and execution of MCP tools
|
|
42
|
+
*/
|
|
43
|
+
export declare class ToolRegistry extends EventEmitter {
|
|
44
|
+
private readonly logger;
|
|
45
|
+
private readonly tools;
|
|
46
|
+
private readonly categoryIndex;
|
|
47
|
+
private readonly tagIndex;
|
|
48
|
+
private defaultContext?;
|
|
49
|
+
private totalRegistrations;
|
|
50
|
+
private totalLookups;
|
|
51
|
+
private totalExecutions;
|
|
52
|
+
constructor(logger: ILogger);
|
|
53
|
+
/**
|
|
54
|
+
* Register a tool
|
|
55
|
+
*/
|
|
56
|
+
register(tool: MCPTool, options?: ToolRegistrationOptions): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Register multiple tools at once
|
|
59
|
+
*/
|
|
60
|
+
registerBatch(tools: MCPTool[], options?: ToolRegistrationOptions): {
|
|
61
|
+
registered: number;
|
|
62
|
+
failed: string[];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Unregister a tool
|
|
66
|
+
*/
|
|
67
|
+
unregister(name: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Get a tool by name
|
|
70
|
+
*/
|
|
71
|
+
getTool(name: string): MCPTool | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Check if a tool exists
|
|
74
|
+
*/
|
|
75
|
+
hasTool(name: string): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Get tool count
|
|
78
|
+
*/
|
|
79
|
+
getToolCount(): number;
|
|
80
|
+
/**
|
|
81
|
+
* Get all tool names
|
|
82
|
+
*/
|
|
83
|
+
getToolNames(): string[];
|
|
84
|
+
/**
|
|
85
|
+
* List all tools with metadata
|
|
86
|
+
*/
|
|
87
|
+
listTools(): Array<{
|
|
88
|
+
name: string;
|
|
89
|
+
description: string;
|
|
90
|
+
category?: string;
|
|
91
|
+
tags?: string[];
|
|
92
|
+
deprecated?: boolean;
|
|
93
|
+
}>;
|
|
94
|
+
/**
|
|
95
|
+
* Search tools by criteria
|
|
96
|
+
*/
|
|
97
|
+
search(options: ToolSearchOptions): MCPTool[];
|
|
98
|
+
/**
|
|
99
|
+
* Get tools by category
|
|
100
|
+
*/
|
|
101
|
+
getByCategory(category: string): MCPTool[];
|
|
102
|
+
/**
|
|
103
|
+
* Get tools by tag
|
|
104
|
+
*/
|
|
105
|
+
getByTag(tag: string): MCPTool[];
|
|
106
|
+
/**
|
|
107
|
+
* Get all categories
|
|
108
|
+
*/
|
|
109
|
+
getCategories(): string[];
|
|
110
|
+
/**
|
|
111
|
+
* Get all tags
|
|
112
|
+
*/
|
|
113
|
+
getTags(): string[];
|
|
114
|
+
/**
|
|
115
|
+
* Execute a tool
|
|
116
|
+
*/
|
|
117
|
+
execute(name: string, input: Record<string, unknown>, context?: ToolContext): Promise<ToolCallResult>;
|
|
118
|
+
/**
|
|
119
|
+
* Set default execution context
|
|
120
|
+
*/
|
|
121
|
+
setDefaultContext(context: ToolContext): void;
|
|
122
|
+
/**
|
|
123
|
+
* Get tool metadata
|
|
124
|
+
*/
|
|
125
|
+
getMetadata(name: string): ToolMetadata | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* Get registry statistics
|
|
128
|
+
*/
|
|
129
|
+
getStats(): {
|
|
130
|
+
totalTools: number;
|
|
131
|
+
totalCategories: number;
|
|
132
|
+
totalTags: number;
|
|
133
|
+
totalRegistrations: number;
|
|
134
|
+
totalLookups: number;
|
|
135
|
+
totalExecutions: number;
|
|
136
|
+
topTools: Array<{
|
|
137
|
+
name: string;
|
|
138
|
+
calls: number;
|
|
139
|
+
}>;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Validate a tool definition
|
|
143
|
+
*/
|
|
144
|
+
validateTool(tool: MCPTool): {
|
|
145
|
+
valid: boolean;
|
|
146
|
+
errors: string[];
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Validate JSON Schema
|
|
150
|
+
*/
|
|
151
|
+
private validateSchema;
|
|
152
|
+
/**
|
|
153
|
+
* Update average execution time
|
|
154
|
+
*/
|
|
155
|
+
private updateAverageExecutionTime;
|
|
156
|
+
/**
|
|
157
|
+
* Clear all tools
|
|
158
|
+
*/
|
|
159
|
+
clear(): void;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Create a tool registry
|
|
163
|
+
*/
|
|
164
|
+
export declare function createToolRegistry(logger: ILogger): ToolRegistry;
|
|
165
|
+
/**
|
|
166
|
+
* Helper to create a tool definition
|
|
167
|
+
*/
|
|
168
|
+
export declare function defineTool<TInput = Record<string, unknown>, TOutput = unknown>(name: string, description: string, inputSchema: JSONSchema, handler: ToolHandler<TInput, TOutput>, options?: {
|
|
169
|
+
category?: string;
|
|
170
|
+
tags?: string[];
|
|
171
|
+
version?: string;
|
|
172
|
+
deprecated?: boolean;
|
|
173
|
+
cacheable?: boolean;
|
|
174
|
+
cacheTTL?: number;
|
|
175
|
+
timeout?: number;
|
|
176
|
+
}): MCPTool<TInput, TOutput>;
|
|
177
|
+
export {};
|
|
178
|
+
//# sourceMappingURL=tool-registry.d.ts.map
|