solidworks-mcp-server 2.1.0 → 3.0.0

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.
Files changed (116) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +105 -15
  3. package/dist/application/services/command-bus.d.ts +39 -0
  4. package/dist/application/services/command-bus.d.ts.map +1 -0
  5. package/dist/application/services/command-bus.js +88 -0
  6. package/dist/application/services/command-bus.js.map +1 -0
  7. package/dist/application/services/event-bus.d.ts +31 -0
  8. package/dist/application/services/event-bus.d.ts.map +1 -0
  9. package/dist/application/services/event-bus.js +83 -0
  10. package/dist/application/services/event-bus.js.map +1 -0
  11. package/dist/application/services/query-bus.d.ts +30 -0
  12. package/dist/application/services/query-bus.d.ts.map +1 -0
  13. package/dist/application/services/query-bus.js +59 -0
  14. package/dist/application/services/query-bus.js.map +1 -0
  15. package/dist/application/services/tool-registry.d.ts +53 -0
  16. package/dist/application/services/tool-registry.d.ts.map +1 -0
  17. package/dist/application/services/tool-registry.js +81 -0
  18. package/dist/application/services/tool-registry.js.map +1 -0
  19. package/dist/application/use-cases/analysis/index.d.ts +13 -0
  20. package/dist/application/use-cases/analysis/index.d.ts.map +1 -0
  21. package/dist/application/use-cases/analysis/index.js +17 -0
  22. package/dist/application/use-cases/analysis/index.js.map +1 -0
  23. package/dist/application/use-cases/drawing/index.d.ts +13 -0
  24. package/dist/application/use-cases/drawing/index.d.ts.map +1 -0
  25. package/dist/application/use-cases/drawing/index.js +17 -0
  26. package/dist/application/use-cases/drawing/index.js.map +1 -0
  27. package/dist/application/use-cases/export/index.d.ts +13 -0
  28. package/dist/application/use-cases/export/index.d.ts.map +1 -0
  29. package/dist/application/use-cases/export/index.js +17 -0
  30. package/dist/application/use-cases/export/index.js.map +1 -0
  31. package/dist/application/use-cases/macro/index.d.ts +13 -0
  32. package/dist/application/use-cases/macro/index.d.ts.map +1 -0
  33. package/dist/application/use-cases/macro/index.js +17 -0
  34. package/dist/application/use-cases/macro/index.js.map +1 -0
  35. package/dist/application/use-cases/modeling/index.d.ts +56 -0
  36. package/dist/application/use-cases/modeling/index.d.ts.map +1 -0
  37. package/dist/application/use-cases/modeling/index.js +385 -0
  38. package/dist/application/use-cases/modeling/index.js.map +1 -0
  39. package/dist/core/interfaces/core-abstractions.d.ts +289 -0
  40. package/dist/core/interfaces/core-abstractions.d.ts.map +1 -0
  41. package/dist/core/interfaces/core-abstractions.js +121 -0
  42. package/dist/core/interfaces/core-abstractions.js.map +1 -0
  43. package/dist/index.refactored.d.ts +7 -0
  44. package/dist/index.refactored.d.ts.map +1 -0
  45. package/dist/index.refactored.js +254 -0
  46. package/dist/index.refactored.js.map +1 -0
  47. package/dist/infrastructure/config/configuration-manager.d.ts +381 -0
  48. package/dist/infrastructure/config/configuration-manager.d.ts.map +1 -0
  49. package/dist/infrastructure/config/configuration-manager.js +566 -0
  50. package/dist/infrastructure/config/configuration-manager.js.map +1 -0
  51. package/dist/infrastructure/container/service-locator.d.ts +14 -0
  52. package/dist/infrastructure/container/service-locator.d.ts.map +1 -0
  53. package/dist/infrastructure/container/service-locator.js +38 -0
  54. package/dist/infrastructure/container/service-locator.js.map +1 -0
  55. package/dist/infrastructure/logging/logger.d.ts +24 -0
  56. package/dist/infrastructure/logging/logger.d.ts.map +1 -0
  57. package/dist/infrastructure/logging/logger.js +65 -0
  58. package/dist/infrastructure/logging/logger.js.map +1 -0
  59. package/dist/infrastructure/solidworks/solidworks-adapter.d.ts +43 -0
  60. package/dist/infrastructure/solidworks/solidworks-adapter.d.ts.map +1 -0
  61. package/dist/infrastructure/solidworks/solidworks-adapter.js +527 -0
  62. package/dist/infrastructure/solidworks/solidworks-adapter.js.map +1 -0
  63. package/dist/presentation/mcp/request-handler.d.ts +41 -0
  64. package/dist/presentation/mcp/request-handler.d.ts.map +1 -0
  65. package/dist/presentation/mcp/request-handler.js +100 -0
  66. package/dist/presentation/mcp/request-handler.js.map +1 -0
  67. package/dist/presentation/transformers/error-transformer.d.ts +16 -0
  68. package/dist/presentation/transformers/error-transformer.d.ts.map +1 -0
  69. package/dist/presentation/transformers/error-transformer.js +44 -0
  70. package/dist/presentation/transformers/error-transformer.js.map +1 -0
  71. package/dist/presentation/transformers/response-transformer.d.ts +24 -0
  72. package/dist/presentation/transformers/response-transformer.d.ts.map +1 -0
  73. package/dist/presentation/transformers/response-transformer.js +102 -0
  74. package/dist/presentation/transformers/response-transformer.js.map +1 -0
  75. package/dist/resources/design-table.d.ts +28 -28
  76. package/dist/resources/pdm.d.ts +70 -70
  77. package/dist/shared/constants/solidworks-constants.d.ts +302 -0
  78. package/dist/shared/constants/solidworks-constants.d.ts.map +1 -0
  79. package/dist/shared/constants/solidworks-constants.js +471 -0
  80. package/dist/shared/constants/solidworks-constants.js.map +1 -0
  81. package/dist/solidworks/api.d.ts +1 -0
  82. package/dist/solidworks/api.d.ts.map +1 -1
  83. package/dist/solidworks/api.js +328 -56
  84. package/dist/solidworks/api.js.map +1 -1
  85. package/dist/tools/diagnostics.d.ts +21 -0
  86. package/dist/tools/diagnostics.d.ts.map +1 -0
  87. package/dist/tools/diagnostics.js +120 -0
  88. package/dist/tools/diagnostics.js.map +1 -0
  89. package/dist/tools/drawing-analysis.d.ts +9 -0
  90. package/dist/tools/drawing-analysis.d.ts.map +1 -0
  91. package/dist/tools/drawing-analysis.js +239 -0
  92. package/dist/tools/drawing-analysis.js.map +1 -0
  93. package/dist/tools/drawing.d.ts +4 -4
  94. package/dist/tools/enhanced-drawing.d.ts +51 -0
  95. package/dist/tools/enhanced-drawing.d.ts.map +1 -0
  96. package/dist/tools/enhanced-drawing.js +193 -0
  97. package/dist/tools/enhanced-drawing.js.map +1 -0
  98. package/dist/tools/export.d.ts +6 -6
  99. package/dist/tools/macro-security.d.ts +9 -0
  100. package/dist/tools/macro-security.d.ts.map +1 -0
  101. package/dist/tools/macro-security.js +86 -0
  102. package/dist/tools/macro-security.js.map +1 -0
  103. package/dist/tools/modeling.d.ts.map +1 -1
  104. package/dist/tools/modeling.js +58 -2
  105. package/dist/tools/modeling.js.map +1 -1
  106. package/dist/tools/vba-advanced.d.ts +12 -12
  107. package/dist/tools/vba-assembly.d.ts +8 -8
  108. package/dist/tools/vba-drawing.d.ts +14 -14
  109. package/dist/tools/vba-file-management.d.ts +16 -16
  110. package/dist/tools/vba-part.d.ts +10 -10
  111. package/dist/tools/vba.d.ts +67 -67
  112. package/dist/tools/vba.d.ts.map +1 -1
  113. package/dist/tools/vba.js +72 -19
  114. package/dist/tools/vba.js.map +1 -1
  115. package/package.json +15 -8
  116. package/scripts/setup.js +71 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,29 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.2.0] - 2025-01-19
9
+
10
+ ### Fixed
11
+ - **Critical: Handlebars Helper Registration** - Added all necessary Handlebars helpers (eq, ne, lt, gt, lte, gte, and, or, not) to fix VBA generation tools
12
+ - **Template Name Mismatch** - Fixed batch_export template mapping and created proper batch_export.vba template
13
+ - **Rebuild Model API** - Updated to use correct SolidWorks API methods (ForceRebuild3, EditRebuild, Rebuild) with fallback strategies
14
+ - **Close Model Error Handling** - Added safe error handling for title retrieval preventing COM object access errors
15
+ - **Export File Robustness** - Enhanced export functionality with format-specific handling and retry logic
16
+ - **Mass Properties Extraction** - Improved getMassProperties with comprehensive error handling
17
+
18
+ ### Added
19
+ - batch_export.vba template for batch export operations
20
+ - Debug scripts (debug-server.mjs, debug-wrapper.mjs, test-fixes.mjs) for troubleshooting
21
+ - SWChecklist.md comprehensive testing checklist
22
+ - zod-to-json-schema dependency for schema validation
23
+ - ensureCurrentModel helper method in api.ts
24
+
25
+ ### Improved
26
+ - Enhanced error handling across all API methods with multiple fallback strategies
27
+ - Better COM object access patterns for Windows SolidWorks compatibility
28
+ - Template compilation with proper error recovery
29
+ - API compatibility for different SolidWorks versions
30
+
8
31
  ## [2.1.0] - 2025-01-11
9
32
 
10
33
  ### Added
package/README.md CHANGED
@@ -1,7 +1,50 @@
1
- # SolidWorks MCP Server v2.0
1
+ # SolidWorks MCP Server
2
+
3
+ <div align="center">
4
+
5
+ [![CI](https://github.com/vespo92/SolidworksMCP-TS/actions/workflows/ci.yml/badge.svg)](https://github.com/vespo92/SolidworksMCP-TS/actions/workflows/ci.yml)
6
+ [![npm version](https://badge.fury.io/js/solidworks-mcp-server.svg)](https://www.npmjs.com/package/solidworks-mcp-server)
7
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.5-blue?logo=typescript)](https://www.typescriptlang.org/)
8
+ [![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-green?logo=anthropic)](https://modelcontextprotocol.com)
9
+ [![Node.js](https://img.shields.io/badge/Node.js-20+-green?logo=node.js)](https://nodejs.org/)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/vespo92/SolidworksMCP-TS/pulls)
12
+ [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/vespo92/SolidworksMCP-TS/graphs/commit-activity)
13
+
14
+ </div>
2
15
 
3
16
  A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with SolidWorks CAD software, providing automated design capabilities, macro recording, design tables with SQL integration, VBA generation, and PDM configuration management.
4
17
 
18
+ ## 🎯 Quick Start
19
+
20
+ ### Option 1: Install from npm (Recommended)
21
+ ```bash
22
+ # Install globally from npm registry
23
+ npm install -g solidworks-mcp-server
24
+ ```
25
+
26
+ ### Option 2: Manual Installation
27
+ ```bash
28
+ # Clone the repository
29
+ git clone https://github.com/vespo92/SolidworksMCP-TS
30
+ cd SolidworksMCP-TS
31
+ npm install
32
+ npm run build
33
+
34
+ # Link globally for use with Claude Desktop
35
+ npm link
36
+ ```
37
+
38
+ ### Configure Claude Desktop
39
+ After installation, add to your Claude Desktop config and restart Claude Desktop.
40
+
41
+ Then in Claude Desktop:
42
+ ```
43
+ "Generate VBA to batch export all parts in my folder to STEP format"
44
+ "Create a parametric design table for a configurable bracket"
45
+ "Check for interferences in my assembly"
46
+ ```
47
+
5
48
  ## 🚀 Key Features
6
49
 
7
50
  ### Core Capabilities
@@ -13,7 +56,16 @@ A comprehensive Model Context Protocol (MCP) server that enables AI assistants t
13
56
  - **State Management** - Persistent resource states with auto-save
14
57
  - **Resource-Based Architecture** - Modular, extensible design pattern
15
58
 
16
- ### New in v2.0
59
+ ### New in v2.1.0 - Comprehensive VBA Generation Suite
60
+ ⚠️ **IMPORTANT: VBA script generation features are NOT WORKING in the current iteration and require additional testing**
61
+ - 🔧 **Part Modeling VBA** - Advanced features, patterns, sheet metal, surfaces
62
+ - 🏗️ **Assembly Automation** - Mates, components, interference analysis
63
+ - 📐 **Drawing Generation** - Views, dimensions, annotations, tables
64
+ - 📁 **File & PDM Operations** - Batch processing, custom properties, vault management
65
+ - ⚙️ **Advanced Features** - Configurations, equations, simulation setup
66
+ - 🎯 **100+ VBA Tools** - Generate production-ready VBA without coding knowledge
67
+
68
+ ### Enterprise Features (v2.0)
17
69
  - 🎯 **Macro Recording System** - Record actions and export to VBA
18
70
  - 📊 **SQL-Driven Design Tables** - Connect to databases for parametric designs
19
71
  - 🗄️ **PDM Configuration** - Manage vault operations, workflows, and automation
@@ -32,12 +84,22 @@ A comprehensive Model Context Protocol (MCP) server that enables AI assistants t
32
84
 
33
85
  ## 🛠️ Installation
34
86
 
35
- ### 1. Install from npm
87
+ ### 1. Install the MCP Server
36
88
 
89
+ #### From npm Registry (Recommended):
37
90
  ```bash
38
91
  npm install -g solidworks-mcp-server
39
92
  ```
40
93
 
94
+ #### Or Manual Installation:
95
+ ```bash
96
+ git clone https://github.com/vespo92/SolidworksMCP-TS
97
+ cd SolidworksMCP-TS
98
+ npm install
99
+ npm run build
100
+ npm link # Makes it available globally
101
+ ```
102
+
41
103
  ### 2. Configure Claude Desktop
42
104
 
43
105
  Add to your Claude Desktop configuration:
@@ -113,14 +175,43 @@ LOG_LEVEL=info
113
175
  "Create folder structure with permissions for project team"
114
176
  ```
115
177
 
116
- ### Advanced VBA Generation
178
+ ### Advanced VBA Generation (v2.1.0)
179
+
180
+ #### Part Modeling
181
+ ```
182
+ "Generate VBA to create a parametric bracket with:
183
+ - Reference planes offset by 50mm
184
+ - Sweep feature along a 3D curve
185
+ - Linear pattern with 5 instances
186
+ - Sheet metal conversion with 2mm thickness"
187
+ ```
188
+
189
+ #### Assembly Automation
190
+ ```
191
+ "Generate VBA for assembly that:
192
+ - Inserts components from a folder
193
+ - Creates coincident and distance mates
194
+ - Checks for interferences
195
+ - Exports mass properties to Excel"
196
+ ```
197
+
198
+ #### Batch Operations
199
+ ```
200
+ "Generate VBA to process all files in C:\Parts that:
201
+ - Opens each SLDPRT file
202
+ - Updates custom properties (Part Number, Revision)
203
+ - Exports to STEP format
204
+ - Checks into PDM vault with comment"
205
+ ```
117
206
 
207
+ #### Drawing Automation
118
208
  ```
119
- "Generate VBA script that:
120
- 1. Opens all parts in folder
121
- 2. Updates material to Aluminum
122
- 3. Runs stress analysis
123
- 4. Exports results to Excel"
209
+ "Generate VBA to create drawings that:
210
+ - Creates standard 3-view layout
211
+ - Adds section view A-A
212
+ - Dimensions all features
213
+ - Inserts BOM table
214
+ - Exports to PDF"
124
215
  ```
125
216
 
126
217
  ## 🔧 Available Tools
@@ -128,7 +219,7 @@ LOG_LEVEL=info
128
219
  ### Macro Tools
129
220
  - `macro_start_recording` - Begin recording operations
130
221
  - `macro_stop_recording` - End recording and save
131
- - `macro_export_vba` - Export macro to VBA code
222
+ - `macro_export_vba` - Export macro to VBA code ⚠️ **NOT WORKING - Requires additional testing**
132
223
  - `macro_execute` - Run recorded macro
133
224
 
134
225
  ### Design Table Tools
@@ -156,7 +247,7 @@ All original tools remain available:
156
247
  - Modeling tools (create, modify, analyze)
157
248
  - Drawing tools (views, dimensions, annotations)
158
249
  - Export tools (STEP, IGES, STL, PDF, etc.)
159
- - VBA tools (generate, execute scripts)
250
+ - VBA tools ⚠️ **NOTE: VBA script generation is NOT WORKING in the current iteration and requires additional testing**
160
251
  - Analysis tools (mass properties, interference)
161
252
 
162
253
  ## 📚 API Reference
@@ -208,7 +299,7 @@ All original tools remain available:
208
299
  ### Building from Source
209
300
 
210
301
  ```bash
211
- git clone https://github.com/vinnieespo/solidworks-mcp-server
302
+ git clone https://github.com/vespo92/SolidworksMCP-TS
212
303
  cd solidworks-mcp-server
213
304
  npm install
214
305
  npm run build
@@ -306,9 +397,8 @@ We welcome contributions! Please see CONTRIBUTING.md for guidelines.
306
397
 
307
398
  ## 📞 Support
308
399
 
309
- - Issues: [GitHub Issues](https://github.com/vinnieespo/solidworks-mcp-server/issues)
310
- - Discussions: [GitHub Discussions](https://github.com/vinnieespo/solidworks-mcp-server/discussions)
311
- - Email: support@solidworksmcp.dev
400
+ - Issues: [GitHub Issues](https://github.com/vespo92/SolidworksMCP-TS/issues)
401
+ - Discussions: [GitHub Discussions](https://github.com/vespo92/SolidworksMCP-TS/discussions)
312
402
 
313
403
  ## 🚀 Roadmap
314
404
 
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Command Bus Implementation
3
+ * Handles command execution with middleware support
4
+ */
5
+ import { Result, ILogger, IMiddleware } from '../../core/interfaces/core-abstractions.js';
6
+ export interface CommandHandler<TParams = unknown, TResult = unknown> {
7
+ handle(params: TParams): Promise<Result<TResult>>;
8
+ }
9
+ export declare class CommandBus {
10
+ private logger;
11
+ private handlers;
12
+ private middleware;
13
+ constructor(logger: ILogger);
14
+ /**
15
+ * Register a command handler
16
+ */
17
+ register<TParams, TResult>(commandName: string, handler: CommandHandler<TParams, TResult>): void;
18
+ /**
19
+ * Execute a command
20
+ */
21
+ execute<TParams, TResult>(commandName: string, params: TParams): Promise<Result<TResult>>;
22
+ /**
23
+ * Add middleware
24
+ */
25
+ use(middleware: IMiddleware): void;
26
+ /**
27
+ * Apply middleware chain
28
+ */
29
+ private applyMiddleware;
30
+ /**
31
+ * Check if a handler is registered
32
+ */
33
+ hasHandler(commandName: string): boolean;
34
+ /**
35
+ * Clear all handlers
36
+ */
37
+ clear(): void;
38
+ }
39
+ //# sourceMappingURL=command-bus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-bus.d.ts","sourceRoot":"","sources":["../../../src/application/services/command-bus.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,MAAM,EAEN,OAAO,EACP,WAAW,EACZ,MAAM,4CAA4C,CAAC;AAEpD,MAAM,WAAW,cAAc,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IAClE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;CACnD;AAED,qBAAa,UAAU;IAIT,OAAO,CAAC,MAAM;IAH1B,OAAO,CAAC,QAAQ,CAA0C;IAC1D,OAAO,CAAC,UAAU,CAAqB;gBAEnB,MAAM,EAAE,OAAO;IAEnC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,EACvB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,GACxC,IAAI;IAQP;;OAEG;IACG,OAAO,CAAC,OAAO,EAAE,OAAO,EAC5B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAiC3B;;OAEG;IACH,GAAG,CAAC,UAAU,EAAE,WAAW,GAAG,IAAI;IAIlC;;OAEG;YACW,eAAe;IAe7B;;OAEG;IACH,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAIxC;;OAEG;IACH,KAAK,IAAI,IAAI;CAId"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Command Bus Implementation
3
+ * Handles command execution with middleware support
4
+ */
5
+ import { ResultUtil } from '../../core/interfaces/core-abstractions.js';
6
+ export class CommandBus {
7
+ logger;
8
+ handlers = new Map();
9
+ middleware = [];
10
+ constructor(logger) {
11
+ this.logger = logger;
12
+ }
13
+ /**
14
+ * Register a command handler
15
+ */
16
+ register(commandName, handler) {
17
+ if (this.handlers.has(commandName)) {
18
+ this.logger.warn(`Command handler ${commandName} is already registered`);
19
+ }
20
+ this.handlers.set(commandName, handler);
21
+ this.logger.debug(`Registered command handler: ${commandName}`);
22
+ }
23
+ /**
24
+ * Execute a command
25
+ */
26
+ async execute(commandName, params) {
27
+ try {
28
+ const handler = this.handlers.get(commandName);
29
+ if (!handler) {
30
+ return ResultUtil.fail(new Error(`No handler registered for command: ${commandName}`));
31
+ }
32
+ // Apply middleware
33
+ const context = { commandName, params, handler };
34
+ const middlewareResult = await this.applyMiddleware(context);
35
+ if (!ResultUtil.isSuccess(middlewareResult)) {
36
+ return middlewareResult;
37
+ }
38
+ // Execute the command
39
+ this.logger.debug(`Executing command: ${commandName}`, { params });
40
+ const result = await handler.handle(params);
41
+ if (ResultUtil.isSuccess(result)) {
42
+ this.logger.debug(`Command executed successfully: ${commandName}`);
43
+ }
44
+ else {
45
+ this.logger.warn(`Command failed: ${commandName}`, { error: result.error });
46
+ }
47
+ return result;
48
+ }
49
+ catch (error) {
50
+ this.logger.error(`Unexpected error executing command: ${commandName}`, error);
51
+ return ResultUtil.fail(error);
52
+ }
53
+ }
54
+ /**
55
+ * Add middleware
56
+ */
57
+ use(middleware) {
58
+ this.middleware.push(middleware);
59
+ }
60
+ /**
61
+ * Apply middleware chain
62
+ */
63
+ async applyMiddleware(context) {
64
+ let index = 0;
65
+ const next = async () => {
66
+ if (index >= this.middleware.length) {
67
+ return ResultUtil.ok(undefined);
68
+ }
69
+ const currentMiddleware = this.middleware[index++];
70
+ return currentMiddleware.execute(context, next);
71
+ };
72
+ return next();
73
+ }
74
+ /**
75
+ * Check if a handler is registered
76
+ */
77
+ hasHandler(commandName) {
78
+ return this.handlers.has(commandName);
79
+ }
80
+ /**
81
+ * Clear all handlers
82
+ */
83
+ clear() {
84
+ this.handlers.clear();
85
+ this.middleware = [];
86
+ }
87
+ }
88
+ //# sourceMappingURL=command-bus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-bus.js","sourceRoot":"","sources":["../../../src/application/services/command-bus.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGL,UAAU,EAGX,MAAM,4CAA4C,CAAC;AAMpD,MAAM,OAAO,UAAU;IAID;IAHZ,QAAQ,GAAgC,IAAI,GAAG,EAAE,CAAC;IAClD,UAAU,GAAkB,EAAE,CAAC;IAEvC,YAAoB,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;IAAG,CAAC;IAEvC;;OAEG;IACH,QAAQ,CACN,WAAmB,EACnB,OAAyC;QAEzC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,WAAW,wBAAwB,CAAC,CAAC;QAC3E,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,WAAW,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CACX,WAAmB,EACnB,MAAe;QAEf,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAC/C,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,UAAU,CAAC,IAAI,CACpB,IAAI,KAAK,CAAC,sCAAsC,WAAW,EAAE,CAAC,CAC/D,CAAC;YACJ,CAAC;YAED,mBAAmB;YACnB,MAAM,OAAO,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,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AU,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;YAClC,CAAC;YAED,MAAM,iBAAiB,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;YACnD,OAAO,iBAAiB,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAClD,CAAC,CAAC;QAEF,OAAO,IAAI,EAAE,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,WAAmB;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Event Bus Implementation
3
+ * Handles event publishing and subscription
4
+ */
5
+ import { IEventBus, IEvent, IEventHandler, Result, ILogger } from '../../core/interfaces/core-abstractions.js';
6
+ export declare class EventBus implements IEventBus {
7
+ private logger;
8
+ private handlers;
9
+ constructor(logger: ILogger);
10
+ /**
11
+ * Publish an event to all registered handlers
12
+ */
13
+ publish(event: IEvent): Promise<Result<void>>;
14
+ /**
15
+ * Subscribe to an event type
16
+ */
17
+ subscribe(eventType: string, handler: IEventHandler): void;
18
+ /**
19
+ * Unsubscribe from an event type
20
+ */
21
+ unsubscribe(eventType: string, handler: IEventHandler): void;
22
+ /**
23
+ * Clear all subscriptions
24
+ */
25
+ clear(): void;
26
+ /**
27
+ * Get the number of handlers for an event type
28
+ */
29
+ getHandlerCount(eventType: string): number;
30
+ }
31
+ //# sourceMappingURL=event-bus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-bus.d.ts","sourceRoot":"","sources":["../../../src/application/services/event-bus.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,SAAS,EACT,MAAM,EACN,aAAa,EACb,MAAM,EAEN,OAAO,EACR,MAAM,4CAA4C,CAAC;AAEpD,qBAAa,QAAS,YAAW,SAAS;IAG5B,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,QAAQ,CAA8C;gBAE1C,MAAM,EAAE,OAAO;IAEnC;;OAEG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAuCnD;;OAEG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI;IAQ1D;;OAEG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI;IAW5D;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;CAI3C"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Event Bus Implementation
3
+ * Handles event publishing and subscription
4
+ */
5
+ import { ResultUtil } from '../../core/interfaces/core-abstractions.js';
6
+ export class EventBus {
7
+ logger;
8
+ handlers = new Map();
9
+ constructor(logger) {
10
+ this.logger = logger;
11
+ }
12
+ /**
13
+ * Publish an event to all registered handlers
14
+ */
15
+ async publish(event) {
16
+ try {
17
+ const handlers = this.handlers.get(event.type);
18
+ if (!handlers || handlers.size === 0) {
19
+ this.logger.debug(`No handlers for event type: ${event.type}`);
20
+ return ResultUtil.ok(undefined);
21
+ }
22
+ this.logger.debug(`Publishing event: ${event.type}`, {
23
+ eventId: event.id,
24
+ handlerCount: handlers.size
25
+ });
26
+ const promises = [];
27
+ for (const handler of handlers) {
28
+ if (handler.canHandle(event)) {
29
+ promises.push(handler.handle(event));
30
+ }
31
+ }
32
+ const results = await Promise.allSettled(promises);
33
+ const failures = results.filter((result) => result.status === 'rejected');
34
+ if (failures.length > 0) {
35
+ this.logger.warn(`Some event handlers failed for: ${event.type}`, {
36
+ failures: failures.map(f => f.reason)
37
+ });
38
+ }
39
+ return ResultUtil.ok(undefined);
40
+ }
41
+ catch (error) {
42
+ this.logger.error(`Failed to publish event: ${event.type}`, error);
43
+ return ResultUtil.fail(error);
44
+ }
45
+ }
46
+ /**
47
+ * Subscribe to an event type
48
+ */
49
+ subscribe(eventType, handler) {
50
+ if (!this.handlers.has(eventType)) {
51
+ this.handlers.set(eventType, new Set());
52
+ }
53
+ this.handlers.get(eventType).add(handler);
54
+ this.logger.debug(`Subscribed to event: ${eventType}`);
55
+ }
56
+ /**
57
+ * Unsubscribe from an event type
58
+ */
59
+ unsubscribe(eventType, handler) {
60
+ const handlers = this.handlers.get(eventType);
61
+ if (handlers) {
62
+ handlers.delete(handler);
63
+ if (handlers.size === 0) {
64
+ this.handlers.delete(eventType);
65
+ }
66
+ this.logger.debug(`Unsubscribed from event: ${eventType}`);
67
+ }
68
+ }
69
+ /**
70
+ * Clear all subscriptions
71
+ */
72
+ clear() {
73
+ this.handlers.clear();
74
+ }
75
+ /**
76
+ * Get the number of handlers for an event type
77
+ */
78
+ getHandlerCount(eventType) {
79
+ const handlers = this.handlers.get(eventType);
80
+ return handlers ? handlers.size : 0;
81
+ }
82
+ }
83
+ //# sourceMappingURL=event-bus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../../src/application/services/event-bus.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAKL,UAAU,EAEX,MAAM,4CAA4C,CAAC;AAEpD,MAAM,OAAO,QAAQ;IAGC;IAFZ,QAAQ,GAAoC,IAAI,GAAG,EAAE,CAAC;IAE9D,YAAoB,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;IAAG,CAAC;IAEvC;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,KAAa;QACzB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC/C,IAAI,CAAC,QAAQ,IAAI,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CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC;CACF"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Query Bus Implementation
3
+ * Handles query execution for read operations
4
+ */
5
+ import { Result, ILogger } from '../../core/interfaces/core-abstractions.js';
6
+ export interface QueryHandler<TParams = unknown, TResult = unknown> {
7
+ handle(params: TParams): Promise<Result<TResult>>;
8
+ }
9
+ export declare class QueryBus {
10
+ private logger;
11
+ private handlers;
12
+ constructor(logger: ILogger);
13
+ /**
14
+ * Register a query handler
15
+ */
16
+ register<TParams, TResult>(queryName: string, handler: QueryHandler<TParams, TResult>): void;
17
+ /**
18
+ * Execute a query
19
+ */
20
+ execute<TParams, TResult>(queryName: string, params: TParams): Promise<Result<TResult>>;
21
+ /**
22
+ * Check if a handler is registered
23
+ */
24
+ hasHandler(queryName: string): boolean;
25
+ /**
26
+ * Clear all handlers
27
+ */
28
+ clear(): void;
29
+ }
30
+ //# sourceMappingURL=query-bus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-bus.d.ts","sourceRoot":"","sources":["../../../src/application/services/query-bus.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,MAAM,EAEN,OAAO,EACR,MAAM,4CAA4C,CAAC;AAEpD,MAAM,WAAW,YAAY,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IAChE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;CACnD;AAED,qBAAa,QAAQ;IAGP,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,QAAQ,CAAwC;gBAEpC,MAAM,EAAE,OAAO;IAEnC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,GACtC,IAAI;IAQP;;OAEG;IACG,OAAO,CAAC,OAAO,EAAE,OAAO,EAC5B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAyB3B;;OAEG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAItC;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Query Bus Implementation
3
+ * Handles query execution for read operations
4
+ */
5
+ import { ResultUtil } from '../../core/interfaces/core-abstractions.js';
6
+ export class QueryBus {
7
+ logger;
8
+ handlers = new Map();
9
+ constructor(logger) {
10
+ this.logger = logger;
11
+ }
12
+ /**
13
+ * Register a query handler
14
+ */
15
+ register(queryName, handler) {
16
+ if (this.handlers.has(queryName)) {
17
+ this.logger.warn(`Query handler ${queryName} is already registered`);
18
+ }
19
+ this.handlers.set(queryName, handler);
20
+ this.logger.debug(`Registered query handler: ${queryName}`);
21
+ }
22
+ /**
23
+ * Execute a query
24
+ */
25
+ async execute(queryName, params) {
26
+ try {
27
+ const handler = this.handlers.get(queryName);
28
+ if (!handler) {
29
+ return ResultUtil.fail(new Error(`No handler registered for query: ${queryName}`));
30
+ }
31
+ this.logger.debug(`Executing query: ${queryName}`, { params });
32
+ const result = await handler.handle(params);
33
+ if (ResultUtil.isSuccess(result)) {
34
+ this.logger.debug(`Query executed successfully: ${queryName}`);
35
+ }
36
+ else {
37
+ this.logger.warn(`Query failed: ${queryName}`, { error: result.error });
38
+ }
39
+ return result;
40
+ }
41
+ catch (error) {
42
+ this.logger.error(`Unexpected error executing query: ${queryName}`, error);
43
+ return ResultUtil.fail(error);
44
+ }
45
+ }
46
+ /**
47
+ * Check if a handler is registered
48
+ */
49
+ hasHandler(queryName) {
50
+ return this.handlers.has(queryName);
51
+ }
52
+ /**
53
+ * Clear all handlers
54
+ */
55
+ clear() {
56
+ this.handlers.clear();
57
+ }
58
+ }
59
+ //# sourceMappingURL=query-bus.js.map
@@ -0,0 +1 @@
1
+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C,SAAS,EAAE,CAAC,CAAC;YACjE,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;YAC1E,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qCAAqC,SAAS,EAAE,EAAE,KAAc,CAAC,CAAC;YACpF,OAAO,UAAU,CAAC,IAAI,CAAC,KAAc,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,SAAiB;QAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACF"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Tool Registry Service
3
+ * Manages and provides access to all available tools
4
+ */
5
+ import { z } from 'zod';
6
+ import { ILogger } from '../../core/interfaces/core-abstractions.js';
7
+ export interface Tool {
8
+ name: string;
9
+ description: string;
10
+ inputSchema: z.ZodSchema;
11
+ handler: (args: any) => Promise<any> | any;
12
+ category?: string;
13
+ tags?: string[];
14
+ }
15
+ export declare class ToolRegistry {
16
+ private logger;
17
+ private tools;
18
+ private categories;
19
+ constructor(logger: ILogger);
20
+ /**
21
+ * Register a new tool
22
+ */
23
+ register(tool: Tool): void;
24
+ /**
25
+ * Get a tool by name
26
+ */
27
+ get(name: string): Tool | undefined;
28
+ /**
29
+ * Get all tools
30
+ */
31
+ getAll(): Tool[];
32
+ /**
33
+ * Get tools by category
34
+ */
35
+ getByCategory(category: string): Tool[];
36
+ /**
37
+ * Check if a tool exists
38
+ */
39
+ has(name: string): boolean;
40
+ /**
41
+ * Get the number of registered tools
42
+ */
43
+ count(): number;
44
+ /**
45
+ * Get all categories
46
+ */
47
+ getCategories(): string[];
48
+ /**
49
+ * Clear all tools
50
+ */
51
+ clear(): void;
52
+ }
53
+ //# sourceMappingURL=tool-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-registry.d.ts","sourceRoot":"","sources":["../../../src/application/services/tool-registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,4CAA4C,CAAC;AAErE,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC;IACzB,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,qBAAa,YAAY;IAIX,OAAO,CAAC,MAAM;IAH1B,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,UAAU,CAAuC;gBAErC,MAAM,EAAE,OAAO;IAEnC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAqB1B;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAInC;;OAEG;IACH,MAAM,IAAI,IAAI,EAAE;IAIhB;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE;IASvC;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B;;OAEG;IACH,KAAK,IAAI,MAAM;IAIf;;OAEG;IACH,aAAa,IAAI,MAAM,EAAE;IAIzB;;OAEG;IACH,KAAK,IAAI,IAAI;CAId"}