easyeda-mcp-pro 0.2.0 → 0.3.1
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/LICENSE +21 -0
- package/README.md +127 -38
- package/dist/bridge/manager.d.ts +18 -11
- package/dist/bridge/manager.js +176 -113
- package/dist/bridge/manager.js.map +1 -1
- package/dist/bridge/protocol.d.ts +2 -4
- package/dist/bridge/protocol.js +2 -0
- package/dist/bridge/protocol.js.map +1 -1
- package/dist/bridge/types.d.ts +19 -42
- package/dist/bridge/types.js +11 -0
- package/dist/bridge/types.js.map +1 -1
- package/dist/cli/local-setup.d.ts +33 -0
- package/dist/cli/local-setup.js +181 -0
- package/dist/cli/local-setup.js.map +1 -0
- package/dist/config/env.d.ts +1 -0
- package/dist/config/env.js +2 -1
- package/dist/config/env.js.map +1 -1
- package/dist/config/profiles.js +8 -8
- package/dist/config/profiles.js.map +1 -1
- package/dist/config/version.d.ts +1 -0
- package/dist/config/version.js +2 -0
- package/dist/config/version.js.map +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +40 -64
- package/dist/index.js.map +1 -1
- package/dist/schemas/common.d.ts +1 -108
- package/dist/schemas/common.js +0 -62
- package/dist/schemas/common.js.map +1 -1
- package/dist/server/factory.d.ts +6 -3
- package/dist/server/factory.js +20 -13
- package/dist/server/factory.js.map +1 -1
- package/dist/server/transports/http.js +85 -1
- package/dist/server/transports/http.js.map +1 -1
- package/dist/storage/database.js +5 -4
- package/dist/storage/database.js.map +1 -1
- package/dist/storage/types.d.ts +0 -9
- package/dist/storage/types.js +1 -8
- package/dist/storage/types.js.map +1 -1
- package/dist/tools/L0_diagnostics.js +169 -9
- package/dist/tools/L0_diagnostics.js.map +1 -1
- package/dist/tools/L1_board.js +43 -15
- package/dist/tools/L1_board.js.map +1 -1
- package/dist/tools/L1_bom.js +18 -0
- package/dist/tools/L1_bom.js.map +1 -1
- package/dist/tools/L1_schematic.js +241 -1
- package/dist/tools/L1_schematic.js.map +1 -1
- package/dist/tools/register.d.ts +3 -0
- package/dist/tools/register.js +15 -0
- package/dist/tools/register.js.map +1 -0
- package/dist/tools/registry.d.ts +2 -2
- package/dist/tools/registry.js +17 -16
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/types.d.ts +2 -21
- package/dist/vendors/jlcpcb/client.d.ts +3 -2
- package/dist/vendors/lcsc/client.d.ts +0 -9
- package/dist/vendors/lcsc/client.js.map +1 -1
- package/dist/vendors/mouser/client.d.ts +2 -5
- package/dist/vendors/mouser/client.js.map +1 -1
- package/easyeda-bridge-extension.eext +0 -0
- package/package.json +12 -6
- package/dist/bridge/client.d.ts +0 -16
- package/dist/bridge/client.js +0 -48
- package/dist/bridge/client.js.map +0 -1
- package/dist/bridge/extension.d.ts +0 -26
- package/dist/bridge/extension.js +0 -556
- package/dist/bridge/extension.js.map +0 -1
- package/dist/server/errors.d.ts +0 -3
- package/dist/server/errors.js +0 -59
- package/dist/server/errors.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 oaslananka
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -17,24 +17,36 @@ npx easyeda-mcp-pro
|
|
|
17
17
|
|
|
18
18
|
Point your MCP client (Claude, Cursor, etc.) to the stdio transport. Create a `.env` file to configure suppliers and AI providers (see [Configuration](#configuration)).
|
|
19
19
|
|
|
20
|
+
For the recommended no-terminal workflow, let your MCP client auto-start the server:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx easyeda-mcp-pro --setup-local
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The setup command prints:
|
|
27
|
+
|
|
28
|
+
- the EasyEDA Pro extension package path (`easyeda-bridge-extension.eext`)
|
|
29
|
+
- a local MCP client config that starts `dist/index.js` automatically
|
|
30
|
+
- an npm/npx MCP client config for published package usage
|
|
31
|
+
|
|
20
32
|
---
|
|
21
33
|
|
|
22
34
|
## Overview
|
|
23
35
|
|
|
24
|
-
easyeda-mcp-pro is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that bridges AI assistants with hardware design workflows in EasyEDA Pro. It exposes
|
|
36
|
+
easyeda-mcp-pro is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that bridges AI assistants with hardware design workflows in EasyEDA Pro. It exposes 34 profile-gated MCP tools for schematic inspection and editing, controlled EasyEDA Pro API calls, BOM management, design rule checks, PCB board analysis, fabrication exports, and supplier integration.
|
|
25
37
|
|
|
26
38
|
The server connects to EasyEDA Pro via a WebSocket bridge extension, enabling real-time access to open project data. It integrates with JLCPCB, LCSC, Mouser, and DigiKey for BOM sourcing and pricing.
|
|
27
39
|
|
|
28
40
|
### Key Capabilities
|
|
29
41
|
|
|
30
|
-
| Area | What you can do
|
|
31
|
-
| --------------- |
|
|
32
|
-
| **Schematic** | List nets and
|
|
33
|
-
| **BOM** | Generate, validate, export, and source bill of materials
|
|
34
|
-
| **DRC/ERC** | Run design rule and electrical rule checks
|
|
35
|
-
| **Board** | Inspect layers, stackup, dimensions, features
|
|
36
|
-
| **Export** | Export Gerbers, pick-and-place, PDF, netlist
|
|
37
|
-
| **Diagnostics** | Health check, bridge status, capabilities, self-test
|
|
42
|
+
| Area | What you can do |
|
|
43
|
+
| --------------- | --------------------------------------------------------------------- |
|
|
44
|
+
| **Schematic** | List nets/components, search and place devices, edit wires/primitives |
|
|
45
|
+
| **BOM** | Generate, validate, export, and source bill of materials |
|
|
46
|
+
| **DRC/ERC** | Run design rule and electrical rule checks |
|
|
47
|
+
| **Board** | Inspect layers, stackup, dimensions, features |
|
|
48
|
+
| **Export** | Export Gerbers, pick-and-place, PDF, netlist |
|
|
49
|
+
| **Diagnostics** | Health check, bridge status, API inventory, capabilities, self-test |
|
|
38
50
|
|
|
39
51
|
---
|
|
40
52
|
|
|
@@ -42,7 +54,7 @@ The server connects to EasyEDA Pro via a WebSocket bridge extension, enabling re
|
|
|
42
54
|
|
|
43
55
|
- **Node.js** >=24 <27 (required for the latest JavaScript features)
|
|
44
56
|
- **pnpm** >=11 (for local development; the npm package is self-contained)
|
|
45
|
-
- **EasyEDA Pro** with the
|
|
57
|
+
- **EasyEDA Pro** with the bundled bridge extension installed and running
|
|
46
58
|
- For supplier integration: API credentials from JLCPCB, LCSC, Mouser, or DigiKey
|
|
47
59
|
|
|
48
60
|
---
|
|
@@ -69,10 +81,19 @@ git clone https://github.com/oaslananka/easyeda-mcp-pro.git
|
|
|
69
81
|
cd easyeda-mcp-pro
|
|
70
82
|
cp .env.example .env
|
|
71
83
|
pnpm install
|
|
72
|
-
pnpm
|
|
73
|
-
pnpm start
|
|
84
|
+
pnpm setup:local
|
|
74
85
|
```
|
|
75
86
|
|
|
87
|
+
Install or reload the generated `easyeda-bridge-extension.eext` package in EasyEDA Pro. Then add the printed MCP config to your MCP client. After that, your MCP client starts the server automatically; do not keep a separate `node dist/index.js` terminal running.
|
|
88
|
+
|
|
89
|
+
### Local health check
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pnpm doctor
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The doctor command checks the Node.js runtime, built server entry, generated EasyEDA extension package, and local bridge port reachability. If the bridge server is offline, that is normal until your MCP client starts `easyeda-mcp-pro`.
|
|
96
|
+
|
|
76
97
|
---
|
|
77
98
|
|
|
78
99
|
## Configuration
|
|
@@ -90,11 +111,14 @@ Copy `.env.example` to `.env` and edit. All variables have safe defaults — onl
|
|
|
90
111
|
|
|
91
112
|
### Bridge (EasyEDA Pro connection)
|
|
92
113
|
|
|
93
|
-
| Variable
|
|
94
|
-
|
|
|
95
|
-
| `BRIDGE_HOST`
|
|
96
|
-
| `BRIDGE_PORT`
|
|
97
|
-
| `
|
|
114
|
+
| Variable | Default | Description |
|
|
115
|
+
| --------------------- | ------------------- | -------------------------------- |
|
|
116
|
+
| `BRIDGE_HOST` | `127.0.0.1` | Bridge WebSocket host |
|
|
117
|
+
| `BRIDGE_PORT` | `18601` | Primary bridge port |
|
|
118
|
+
| `BRIDGE_PORT_SCAN` | `18601,49620-49629` | Port scan spec (comma/range) |
|
|
119
|
+
| `BRIDGE_TIMEOUT_MS` | `15000` | Bridge call timeout (ms) |
|
|
120
|
+
| `BRIDGE_HEARTBEAT_MS` | `10000` | Heartbeat interval (ms) |
|
|
121
|
+
| `BRIDGE_TOKEN` | `''` | Session token for extension auth |
|
|
98
122
|
|
|
99
123
|
### Storage
|
|
100
124
|
|
|
@@ -124,21 +148,42 @@ Configure an AI provider for LLM-assisted design review:
|
|
|
124
148
|
|
|
125
149
|
When using `TRANSPORT=http`:
|
|
126
150
|
|
|
127
|
-
| Variable
|
|
128
|
-
|
|
|
129
|
-
| `HTTP_HOST`
|
|
130
|
-
| `HTTP_PORT`
|
|
131
|
-
| `
|
|
151
|
+
| Variable | Default | Description |
|
|
152
|
+
| --------------------- | ----------- | ----------------------------------------- |
|
|
153
|
+
| `HTTP_HOST` | `127.0.0.1` | Bind address (use `0.0.0.0` with caution) |
|
|
154
|
+
| `HTTP_PORT` | `3000` | Port |
|
|
155
|
+
| `HTTP_RATE_LIMIT_MAX` | `100` | Max requests per minute per IP |
|
|
156
|
+
| `CORS_ORIGIN` | `''` | Allowed CORS origin |
|
|
157
|
+
|
|
158
|
+
#### Production HTTP Security
|
|
159
|
+
|
|
160
|
+
For remote HTTP deployments, OAuth 2.0 / OpenID Connect is strongly recommended:
|
|
161
|
+
|
|
162
|
+
| Variable | Default | Description |
|
|
163
|
+
| ----------------------- | ----------------- | -------------------------------------------- |
|
|
164
|
+
| `OAUTH_ENABLED` | `false` | Enable Bearer token validation |
|
|
165
|
+
| `OAUTH_ISSUER` | `''` | Expected token issuer (`iss` claim) |
|
|
166
|
+
| `OAUTH_AUDIENCE` | `easyeda-mcp-pro` | Expected token audience (`aud` claim) |
|
|
167
|
+
| `OAUTH_JWKS_URI` | `''` | JWKS endpoint for token signature validation |
|
|
168
|
+
| `OAUTH_REQUIRED_SCOPES` | `easyeda:read` | Required token scope |
|
|
169
|
+
|
|
170
|
+
When `OAUTH_ENABLED=true`, every request to `/mcp` must include an `Authorization: Bearer <token>` header. Tokens are validated against the JWKS endpoint if configured, or structurally validated otherwise.
|
|
171
|
+
|
|
172
|
+
The server enforces a safety check at startup: **non-loopback `HTTP_HOST` without OAuth is rejected**.
|
|
132
173
|
|
|
133
|
-
|
|
174
|
+
#### HTTP Security Features
|
|
134
175
|
|
|
135
|
-
|
|
176
|
+
- **Rate limiting**: Per-IP sliding window (configurable via `HTTP_RATE_LIMIT_MAX`), returns `429 Too Many Requests` with retry-after header
|
|
177
|
+
- **Security headers**: `X-Content-Type-Options: nosniff`, `X-Frame-Options: DENY`, `X-XSS-Protection: 0`, `Referrer-Policy: strict-origin-when-cross-origin`
|
|
178
|
+
- **Health endpoints**: `/healthz` (liveness) and `/readyz` (readiness) return JSON status
|
|
179
|
+
|
|
180
|
+
See `.env.example` for the complete list of configuration variables.
|
|
136
181
|
|
|
137
182
|
---
|
|
138
183
|
|
|
139
184
|
## MCP Tools
|
|
140
185
|
|
|
141
|
-
|
|
186
|
+
The server currently registers 34 tools. Tools are filtered by the active `TOOL_PROFILE`: `core` exposes the normal workflow tools, `pro` adds manufacturing exports, `full` adds controlled documented EasyEDA API calls, and `dev` adds runtime probes for debugging.
|
|
142
187
|
|
|
143
188
|
### L0 — Diagnostics (core)
|
|
144
189
|
|
|
@@ -151,14 +196,38 @@ All 25 tools are available via the MCP server. Tools are filtered by the active
|
|
|
151
196
|
| `easyeda_get_tool_profiles` | Available tool profiles |
|
|
152
197
|
| `easyeda_get_feature_flags` | Current feature flags |
|
|
153
198
|
| `easyeda_run_self_test` | Internal self-test |
|
|
199
|
+
| `easyeda_api_inventory` | Live EasyEDA API classes, runtime paths, and methods |
|
|
200
|
+
|
|
201
|
+
### L0 — Full-control and dev probes
|
|
202
|
+
|
|
203
|
+
| Tool | Profile | Description |
|
|
204
|
+
| ------------------------------ | ------- | ------------------------------------------------------------------ |
|
|
205
|
+
| `easyeda_api_call` | full | Call a documented EasyEDA `Class.method` path through the bridge |
|
|
206
|
+
| `easyeda_bridge_probe_methods` | dev | Probe bridge method availability |
|
|
207
|
+
| `easyeda_component_probe` | dev | Inspect live schematic component runtime objects and state getters |
|
|
208
|
+
|
|
209
|
+
`easyeda_api_call` is intentionally not raw JavaScript execution. It only accepts documented EasyEDA Pro API class prefixes (`DMT_`, `SCH_`, `PCB_`, `LIB_`) and a direct method name such as `SCH_PrimitiveWire.getAll`. Methods that can mutate project state, such as `create`, `delete`, `modify`, `openProject`, `save`, `import`, or `export`, require `confirmWrite=true`.
|
|
210
|
+
|
|
211
|
+
To enable the controlled full-control API tool in your MCP client, set:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
TOOL_PROFILE=full
|
|
215
|
+
```
|
|
154
216
|
|
|
155
217
|
### L1 — Schematic (core)
|
|
156
218
|
|
|
157
|
-
| Tool
|
|
158
|
-
|
|
|
159
|
-
| `easyeda_schematic_nets`
|
|
160
|
-
| `easyeda_schematic_components`
|
|
161
|
-
| `easyeda_schematic_net_detail`
|
|
219
|
+
| Tool | Description |
|
|
220
|
+
| ------------------------------------ | ----------------------------------------------------------- |
|
|
221
|
+
| `easyeda_schematic_nets` | List all nets with node connections |
|
|
222
|
+
| `easyeda_schematic_components` | List components with ref, value, footprint, LCSC, datasheet |
|
|
223
|
+
| `easyeda_schematic_net_detail` | Full detail for a specific net |
|
|
224
|
+
| `easyeda_schematic_search_device` | Search EasyEDA library devices |
|
|
225
|
+
| `easyeda_schematic_place_component` | Place a library component on the active schematic sheet |
|
|
226
|
+
| `easyeda_schematic_add_wire` | Add a schematic wire segment |
|
|
227
|
+
| `easyeda_schematic_delete_primitive` | Delete schematic components or wires by primitive ID |
|
|
228
|
+
| `easyeda_schematic_modify_primitive` | Modify schematic component or wire properties |
|
|
229
|
+
|
|
230
|
+
The schematic write APIs use EasyEDA Pro extension APIs that EasyEDA currently marks as beta. The bridge checks for the documented API class names at runtime and returns an explicit error when the installed EasyEDA Pro build does not expose a required method.
|
|
162
231
|
|
|
163
232
|
### L1 — BOM (core)
|
|
164
233
|
|
|
@@ -210,7 +279,7 @@ All 25 tools are available via the MCP server. Tools are filtered by the active
|
|
|
210
279
|
│ (via Plugin) │ Protocol │ └───────────────┘ │
|
|
211
280
|
└─────────────────┘ │ ┌───────────────┐ │
|
|
212
281
|
│ │ ToolRegistry │ │
|
|
213
|
-
│ │ (
|
|
282
|
+
│ │ (34 tools) │ │
|
|
214
283
|
│ └───────────────┘ │
|
|
215
284
|
│ ┌───────────────┐ │
|
|
216
285
|
│ │ Storage │──┼──► SQLite
|
|
@@ -228,6 +297,19 @@ All 25 tools are available via the MCP server. Tools are filtered by the active
|
|
|
228
297
|
- **stdio** (default): Standard MCP transport — works with Claude Desktop, Cursor, and most MCP clients
|
|
229
298
|
- **HTTP**: Streamable HTTP transport with `/healthz`, `/readyz`, `/mcp` endpoints, CORS, and optional OAuth — suitable for remote deployments
|
|
230
299
|
|
|
300
|
+
### Bridge extension
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
pnpm build:extension
|
|
304
|
+
pnpm verify:extension
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
The extension build writes `easyeda-bridge-extension.eext` at the repository root.
|
|
308
|
+
It contains `extension.json`, the bundled browser script, and the image assets
|
|
309
|
+
required by EasyEDA Pro.
|
|
310
|
+
|
|
311
|
+
Installation: Open EasyEDA Pro → **Settings** → **Extensions** → **Extension Manager...** → **Import Extension**, then select the `.eext` file. Make sure **Allow External Interaction** is enabled for the extension.
|
|
312
|
+
|
|
231
313
|
---
|
|
232
314
|
|
|
233
315
|
## Development
|
|
@@ -243,11 +325,13 @@ pnpm typecheck # TypeScript
|
|
|
243
325
|
pnpm lint # ESLint
|
|
244
326
|
|
|
245
327
|
# Test
|
|
246
|
-
pnpm test # Vitest (
|
|
328
|
+
pnpm test # Vitest (97 tests across 13 files)
|
|
247
329
|
pnpm test:coverage # With coverage report
|
|
248
330
|
|
|
249
331
|
# Build & run
|
|
250
332
|
pnpm build # tsc -> dist/
|
|
333
|
+
pnpm build:extension # Bundle EasyEDA Pro extension
|
|
334
|
+
pnpm verify:extension # Verify extension package contents
|
|
251
335
|
pnpm dev # Hot-reload dev mode
|
|
252
336
|
pnpm start # Run compiled build
|
|
253
337
|
|
|
@@ -259,9 +343,9 @@ pnpm inspector
|
|
|
259
343
|
|
|
260
344
|
```
|
|
261
345
|
src/
|
|
262
|
-
├── index.ts # Entry point
|
|
346
|
+
├── index.ts # Entry point (stdio or HTTP)
|
|
263
347
|
├── bridge/ # EasyEDA Pro WebSocket bridge protocol
|
|
264
|
-
│ ├── manager.ts,
|
|
348
|
+
│ ├── manager.ts, protocol.ts, types.ts
|
|
265
349
|
├── config/ # Environment configuration
|
|
266
350
|
│ ├── env.ts, profiles.ts, feature-flags.ts
|
|
267
351
|
├── schemas/ # Shared Zod schemas
|
|
@@ -269,13 +353,15 @@ src/
|
|
|
269
353
|
│ ├── factory.ts, errors.ts
|
|
270
354
|
│ └── transports/
|
|
271
355
|
│ └── http.ts # HTTP/Streamable HTTP transport
|
|
272
|
-
├── storage/ #
|
|
273
|
-
├── tools/ #
|
|
274
|
-
│ ├── registry.ts, types.ts
|
|
356
|
+
├── storage/ # Node.js sqlite storage (cache, artifacts)
|
|
357
|
+
├── tools/ # 34 MCP tool definitions (6 groups)
|
|
358
|
+
│ ├── register.ts, registry.ts, types.ts
|
|
275
359
|
│ ├── L0_diagnostics.ts, L1_schematic.ts, L1_bom.ts
|
|
276
360
|
│ ├── L1_drc_erc.ts, L1_board.ts, L1_export.ts
|
|
277
361
|
└── vendors/ # Supplier API clients
|
|
278
362
|
├── lcsc/, jlcpcb/, mouser/, digikey/
|
|
363
|
+
|
|
364
|
+
easyeda-bridge-extension/ # EasyEDA Pro bridge extension workspace package
|
|
279
365
|
```
|
|
280
366
|
|
|
281
367
|
---
|
|
@@ -283,10 +369,14 @@ src/
|
|
|
283
369
|
## Security
|
|
284
370
|
|
|
285
371
|
- **Production safety**: Validates config at startup — rejects non-loopback HTTP without OAuth, blocks dangerous features in production
|
|
372
|
+
- **OAuth/JWKS**: Optional Bearer token validation via JWKS endpoint for HTTP transport
|
|
373
|
+
- **Rate limiting**: Per-IP sliding window rate limiter on HTTP transport (default 100 req/min)
|
|
374
|
+
- **Path traversal protection**: All file export paths validated against `ARTIFACT_DIR`
|
|
286
375
|
- **Secret redaction**: API keys, tokens, passwords are redacted from logs and diagnostic output
|
|
287
376
|
- **Branch protection**: `main` branch requires review and up-to-date status checks
|
|
288
377
|
- **Code scanning**: CodeQL analysis runs on every push and PR (security-extended + security-and-quality queries)
|
|
289
378
|
- **Dependency management**: Renovate automatically updates dependencies with security patches
|
|
379
|
+
- **Supply-chain hygiene**: pnpm workspace build, pinned GitHub Actions, and no native SQLite addon dependency
|
|
290
380
|
- **Reporting**: See [SECURITY.md](SECURITY.md) for vulnerability disclosure
|
|
291
381
|
|
|
292
382
|
---
|
|
@@ -299,6 +389,5 @@ src/
|
|
|
299
389
|
|
|
300
390
|
## Related
|
|
301
391
|
|
|
302
|
-
- [easyeda-bridge](https://github.com/oaslananka/easyeda-bridge) — EasyEDA Pro plugin that exposes the bridge WebSocket API
|
|
303
392
|
- [Model Context Protocol](https://modelcontextprotocol.io) — Standard protocol for AI tool integration
|
|
304
393
|
- [EasyEDA Pro](https://pro.easyeda.com) — Professional PCB design tool
|
package/dist/bridge/manager.d.ts
CHANGED
|
@@ -2,36 +2,43 @@ import { EventEmitter } from 'node:events';
|
|
|
2
2
|
import { type EnvConfig } from '../config/env.js';
|
|
3
3
|
import { type BridgeHello } from './protocol.js';
|
|
4
4
|
export type BridgeState = 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
5
|
-
export interface BridgeEvents {
|
|
6
|
-
stateChanged: (state: BridgeState, previous: BridgeState) => void;
|
|
7
|
-
connected: (hello: BridgeHello) => void;
|
|
8
|
-
disconnected: (reason: string) => void;
|
|
9
|
-
error: (error: Error) => void;
|
|
10
|
-
heartbeat: (timestamp: number) => void;
|
|
11
|
-
}
|
|
12
5
|
export declare class BridgeManager extends EventEmitter {
|
|
13
6
|
state: BridgeState;
|
|
14
7
|
hello: BridgeHello | null;
|
|
8
|
+
private wss;
|
|
15
9
|
private ws;
|
|
16
10
|
private heartbeatTimer;
|
|
17
11
|
private reconnectTimer;
|
|
12
|
+
private _activePort;
|
|
13
|
+
private _connectedAtMs;
|
|
18
14
|
private requestMap;
|
|
19
15
|
private requestIdCounter;
|
|
20
16
|
private config;
|
|
21
17
|
private _lastHeartbeatMs;
|
|
22
18
|
constructor(config: EnvConfig);
|
|
23
19
|
get lastHeartbeatMs(): number;
|
|
20
|
+
get activePort(): number;
|
|
21
|
+
get uptimeMs(): number;
|
|
24
22
|
get connected(): boolean;
|
|
25
23
|
connect(): Promise<void>;
|
|
24
|
+
private tryListen;
|
|
25
|
+
private handleConnection;
|
|
26
26
|
call<TParams, TResult>(method: string, params?: TParams, opts?: {
|
|
27
27
|
timeoutMs?: number;
|
|
28
28
|
traceparent?: string;
|
|
29
29
|
}): Promise<TResult>;
|
|
30
30
|
disconnect(reason?: string): void;
|
|
31
|
-
private tryConnect;
|
|
32
|
-
private sendHandshake;
|
|
33
|
-
private handleHello;
|
|
34
31
|
private handleResponse;
|
|
32
|
+
private rejectPending;
|
|
35
33
|
private startHeartbeat;
|
|
36
|
-
private
|
|
34
|
+
private stopHeartbeat;
|
|
37
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Parse a port scan specification string into an ordered array of ports.
|
|
38
|
+
* Supports comma-separated values and dash ranges:
|
|
39
|
+
* "18601" → [18601]
|
|
40
|
+
* "18601,49620" → [18601, 49620]
|
|
41
|
+
* "49620-49629" → [49620, 49621, ..., 49629]
|
|
42
|
+
* "18601,49620-49629" → [18601, 49620, 49621, ..., 49629]
|
|
43
|
+
*/
|
|
44
|
+
export declare function parsePortScanSpec(spec: string): number[];
|