Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
## 2. Checks and docs

- [x] 2.1 Unit tests: allowed, refused, two sources, bad characters
- [ ] 2.2 Live test written (run pending): a sketch added by VBA source
- [x] 2.2 Live test: a sketch added by VBA source (passed live 2026-11-17)
- [x] 2.3 Catalog entry, installation guide (the setting and its risk), CHANGELOG; full suite, ruff, mypy, docs strict
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

- [x] 1.1 Note the open documents before Save Bodies; close new unsaved assemblies after; reactivate the part; `closed_documents` in the reply
- [x] 1.2 Unit test: the new assembly closed, the user's saved one left
- [ ] 1.3 Live: `test_save_body_as_part_writes_the_body_file` checks no unsaved assembly is open afterwards (run pending)
- [x] 1.3 Live: `test_save_body_as_part_writes_the_body_file` checks no unsaved assembly is open afterwards (passed live 2026-11-17)
- [x] 1.4 Tool description, mock adapter, CHANGELOG; full suite, ruff, mypy
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

- [x] 2.1 `allow_vba_source`: `off` / `restricted` / `full`; other values stop the server with the valid ones
- [x] 2.2 `execute_macro`: restricted runs the check against the type-library index; `vba_source_refused` classifier rule; no index means a refusal
- [ ] 2.3 Live test (written, run pending): the sketch macro runs in restricted mode; a `Shell` line is refused
- [x] 2.3 Live test: the sketch macro runs in restricted mode; a `Shell` line is refused (passed live 2026-11-17)

## 3. Docs

Expand Down
6 changes: 3 additions & 3 deletions openspec/queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ Last updated 2026-11-16.
| 23 | Enum values: an enum's members and their integers, read from SolidWorks' constants type library, so an agent never guesses one (`swUnitSystem_IPS` is 3, not 4). Named `get_api_enum` under the tool-naming rule | #95 | `api-enum-lookup` (archived) | Done 2026-11-16: `get_api_enum`, checked live against this machine's swconst.tlb (983 enums) |
| 24 | The tool catalog pages drift from the registered tools with no check: some tools are missing and some sample payloads are null. A check that every registered tool has a catalog entry with its inputs, and the gaps filled | #156 | `tool-catalog-check` (archived) | Done 2026-11-16: a check reads every catalog page against the registered tools; 20 missing entries written, about 30 stale tables and samples fixed; the generator removed |
| 25 | `execute_macro` hangs with no timeout on a macro that waits for the user: a time limit, and a clear error when it's hit | #97 | `macro-dialog-watchdog` (archived) | Done 2026-11-17: a dialog left waiting is answered (Cancel, or its only button) and the run fails as `macro_waited_for_user`; checked live (#244) |
| 26 | `execute_macro` runs VBA source text (a `generate_vba_*` result, or the agent's own), saved as a `.swb` and run with the dialog watchdog. Opt-in (`SOLIDWORKS_MCP_ALLOW_VBA_SOURCE`), the user's choice 2026-11-17 | #96 | `macro-from-vba-source` | Built, unit-tested; live check pending (`tests/live/test_live_sw_macro_source.py`) |
| 27 | `save_body_as_part` leaves an extra unsaved assembly open (the Save Bodies feature's create-assembly option) | #101 | `save-body-no-stray-assembly` | Built, unit-tested; live check pending (`test_live_sw_wave3.py::test_save_body_as_part_writes_the_body_file`) |
| 28 | Restricted VBA source: `SOLIDWORKS_MCP_ALLOW_VBA_SOURCE` = off / restricted / full; `restricted` checks the source against the SolidWorks type library and a blocklist before it runs, with every default and option disclosed in the docs (the user's choice 2026-11-17) | none | `vba-source-restricted` | Built, unit-tested; live check pending (`tests/live/test_live_sw_macro_source.py`) |
| 26 | `execute_macro` runs VBA source text (a `generate_vba_*` result, or the agent's own), saved as a `.swb` and run with the dialog watchdog. Opt-in (`SOLIDWORKS_MCP_ALLOW_VBA_SOURCE`), the user's choice 2026-11-17 | #96 | `macro-from-vba-source` (archived) | Done 2026-11-17 (#246), checked live |
| 27 | `save_body_as_part` leaves an extra unsaved assembly open (the Save Bodies feature's create-assembly option) | #101 | `save-body-no-stray-assembly` (archived) | Done 2026-11-17 (#247), checked live: the stray `Assem<N>` is closed |
| 28 | Restricted VBA source: `SOLIDWORKS_MCP_ALLOW_VBA_SOURCE` = off / restricted / full; `restricted` checks the source against the SolidWorks type library and a blocklist before it runs, with every default and option disclosed in the docs (the user's choice 2026-11-17) | none | `vba-source-restricted` (archived) | Done 2026-11-17 (#248), checked live: restricted source runs, a `Shell` line is refused, `off` refuses |
## Removed tools (item 10, release 2.1.0)

33 tools were registered but never implemented: every call returned
Expand Down
64 changes: 64 additions & 0 deletions openspec/specs/tools/macro-execution/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,67 @@ SHALL be left open and logged. The watchdog SHALL make no COM calls.
- **WHEN** a macro runs for longer than the timeout without opening a dialog
- **THEN** it is not interrupted and its result is returned as before

### Requirement: VBA source runs only when the user allowed it

`execute_macro` SHALL accept `vba_source` in place of a macro file. When
the server's `allow_vba_source` setting is on, the source SHALL be written
to a new `.swb` file and run as a macro file is, and the reply SHALL give
the file's path and the source that ran. When the setting is off, the call
SHALL be refused with `error_type` `vba_source_off`, and nothing SHALL be
written or run.

#### Scenario: Allowed
- **WHEN** `allow_vba_source` is on and an agent calls `execute_macro` with `vba_source`
- **THEN** a `.swb` holding that source is run, and the reply names the file and repeats the source

#### Scenario: Not allowed
- **WHEN** the setting is off
- **THEN** the reply is an error, `vba_source_off`, naming `SOLIDWORKS_MCP_ALLOW_VBA_SOURCE`, and no file is written

#### Scenario: Two sources
- **WHEN** both `vba_source` and `macro_path` are given
- **THEN** the input is refused as invalid

### Requirement: Restricted VBA source reaches SolidWorks only

With `allow_vba_source` set to `restricted`, `execute_macro` SHALL run
`vba_source` only when every name in it, outside comments and string
literals, is a VBA keyword, a listed safe VBA function, a name the source
declares, a SolidWorks enum or type name, `Application.SldWorks`, or,
after a `.`, a member of the installed SolidWorks type library that isn't
on the blocked list. Otherwise it SHALL refuse with `error_type`
`vba_source_refused`, naming each refused name and its line, and write
nothing. With `full` it SHALL run unchecked; with `off` (the default) it
SHALL refuse as `vba_source_off`.

#### Scenario: A SolidWorks-only macro
- **WHEN** restricted source sketches a point with `Application.SldWorks`, `ActiveDoc`, `SelectByID2` and `SketchManager`
- **THEN** it runs

#### Scenario: Reaching outside SolidWorks
- **WHEN** restricted source calls `Shell`, `CreateObject` or `Kill`, or opens a file with `Open ... For Output`
- **THEN** it is refused as `vba_source_refused`, naming each and its line, and nothing runs

#### Scenario: A blocked SolidWorks member
- **WHEN** restricted source calls `SaveAs3` or `RunMacro2`
- **THEN** it is refused, naming the member

#### Scenario: Hidden in a string or comment
- **WHEN** `Shell` appears only inside quotes or after `'`
- **THEN** it doesn't count, and the source can run

#### Scenario: No type library
- **WHEN** the setting is `restricted` and the SolidWorks type library can't be read
- **THEN** the source is refused, saying the check needs it

### Requirement: The defaults and options are disclosed

The installation guide SHALL list every value of
`SOLIDWORKS_MCP_ALLOW_VBA_SOURCE`, the default, what each allows and
refuses, the blocked SolidWorks members, and what the restricted check
does not promise.

#### Scenario: Reading the guide
- **WHEN** a user reads the VBA source section
- **THEN** it states the default is `off`, and what `restricted` and `full` each allow

15 changes: 15 additions & 0 deletions openspec/specs/tools/multibody-part-export/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,18 @@ write a file — when the named body doesn't exist on the active document.
body on the active part
- **THEN** the response status indicates failure and no file is written

### Requirement: Save Bodies leaves no document behind

After `save_body_as_part`, no document SHALL be open that wasn't open
before the call, except the part itself. A new, unsaved assembly that
SolidWorks opened alongside SHALL be closed, the part made active again,
and the reply's `closed_documents` SHALL name it.

#### Scenario: SolidWorks opens an assembly
- **WHEN** the Save Bodies call leaves a new, unsaved assembly open
- **THEN** it is closed, the part is active, and `closed_documents` names it

#### Scenario: The user's own assembly
- **WHEN** an assembly was open before the call, or has a file
- **THEN** it is left open

Loading