diff --git a/openspec/changes/macro-from-vba-source/.openspec.yaml b/openspec/changes/archive/2026-11-17-macro-from-vba-source/.openspec.yaml similarity index 100% rename from openspec/changes/macro-from-vba-source/.openspec.yaml rename to openspec/changes/archive/2026-11-17-macro-from-vba-source/.openspec.yaml diff --git a/openspec/changes/macro-from-vba-source/design.md b/openspec/changes/archive/2026-11-17-macro-from-vba-source/design.md similarity index 100% rename from openspec/changes/macro-from-vba-source/design.md rename to openspec/changes/archive/2026-11-17-macro-from-vba-source/design.md diff --git a/openspec/changes/macro-from-vba-source/proposal.md b/openspec/changes/archive/2026-11-17-macro-from-vba-source/proposal.md similarity index 100% rename from openspec/changes/macro-from-vba-source/proposal.md rename to openspec/changes/archive/2026-11-17-macro-from-vba-source/proposal.md diff --git a/openspec/changes/macro-from-vba-source/specs/tools/macro-execution/spec.md b/openspec/changes/archive/2026-11-17-macro-from-vba-source/specs/tools/macro-execution/spec.md similarity index 100% rename from openspec/changes/macro-from-vba-source/specs/tools/macro-execution/spec.md rename to openspec/changes/archive/2026-11-17-macro-from-vba-source/specs/tools/macro-execution/spec.md diff --git a/openspec/changes/macro-from-vba-source/tasks.md b/openspec/changes/archive/2026-11-17-macro-from-vba-source/tasks.md similarity index 86% rename from openspec/changes/macro-from-vba-source/tasks.md rename to openspec/changes/archive/2026-11-17-macro-from-vba-source/tasks.md index 81f7ae30..87470585 100644 --- a/openspec/changes/macro-from-vba-source/tasks.md +++ b/openspec/changes/archive/2026-11-17-macro-from-vba-source/tasks.md @@ -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 diff --git a/openspec/changes/save-body-no-stray-assembly/.openspec.yaml b/openspec/changes/archive/2026-11-17-save-body-no-stray-assembly/.openspec.yaml similarity index 100% rename from openspec/changes/save-body-no-stray-assembly/.openspec.yaml rename to openspec/changes/archive/2026-11-17-save-body-no-stray-assembly/.openspec.yaml diff --git a/openspec/changes/save-body-no-stray-assembly/design.md b/openspec/changes/archive/2026-11-17-save-body-no-stray-assembly/design.md similarity index 100% rename from openspec/changes/save-body-no-stray-assembly/design.md rename to openspec/changes/archive/2026-11-17-save-body-no-stray-assembly/design.md diff --git a/openspec/changes/save-body-no-stray-assembly/proposal.md b/openspec/changes/archive/2026-11-17-save-body-no-stray-assembly/proposal.md similarity index 100% rename from openspec/changes/save-body-no-stray-assembly/proposal.md rename to openspec/changes/archive/2026-11-17-save-body-no-stray-assembly/proposal.md diff --git a/openspec/changes/save-body-no-stray-assembly/specs/tools/multibody-part-export/spec.md b/openspec/changes/archive/2026-11-17-save-body-no-stray-assembly/specs/tools/multibody-part-export/spec.md similarity index 100% rename from openspec/changes/save-body-no-stray-assembly/specs/tools/multibody-part-export/spec.md rename to openspec/changes/archive/2026-11-17-save-body-no-stray-assembly/specs/tools/multibody-part-export/spec.md diff --git a/openspec/changes/save-body-no-stray-assembly/tasks.md b/openspec/changes/archive/2026-11-17-save-body-no-stray-assembly/tasks.md similarity index 69% rename from openspec/changes/save-body-no-stray-assembly/tasks.md rename to openspec/changes/archive/2026-11-17-save-body-no-stray-assembly/tasks.md index ea47f33e..5d41cfff 100644 --- a/openspec/changes/save-body-no-stray-assembly/tasks.md +++ b/openspec/changes/archive/2026-11-17-save-body-no-stray-assembly/tasks.md @@ -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 diff --git a/openspec/changes/vba-source-restricted/.openspec.yaml b/openspec/changes/archive/2026-11-17-vba-source-restricted/.openspec.yaml similarity index 100% rename from openspec/changes/vba-source-restricted/.openspec.yaml rename to openspec/changes/archive/2026-11-17-vba-source-restricted/.openspec.yaml diff --git a/openspec/changes/vba-source-restricted/design.md b/openspec/changes/archive/2026-11-17-vba-source-restricted/design.md similarity index 100% rename from openspec/changes/vba-source-restricted/design.md rename to openspec/changes/archive/2026-11-17-vba-source-restricted/design.md diff --git a/openspec/changes/vba-source-restricted/proposal.md b/openspec/changes/archive/2026-11-17-vba-source-restricted/proposal.md similarity index 100% rename from openspec/changes/vba-source-restricted/proposal.md rename to openspec/changes/archive/2026-11-17-vba-source-restricted/proposal.md diff --git a/openspec/changes/vba-source-restricted/specs/tools/macro-execution/spec.md b/openspec/changes/archive/2026-11-17-vba-source-restricted/specs/tools/macro-execution/spec.md similarity index 100% rename from openspec/changes/vba-source-restricted/specs/tools/macro-execution/spec.md rename to openspec/changes/archive/2026-11-17-vba-source-restricted/specs/tools/macro-execution/spec.md diff --git a/openspec/changes/vba-source-restricted/tasks.md b/openspec/changes/archive/2026-11-17-vba-source-restricted/tasks.md similarity index 87% rename from openspec/changes/vba-source-restricted/tasks.md rename to openspec/changes/archive/2026-11-17-vba-source-restricted/tasks.md index d572b992..d47a9504 100644 --- a/openspec/changes/vba-source-restricted/tasks.md +++ b/openspec/changes/archive/2026-11-17-vba-source-restricted/tasks.md @@ -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 diff --git a/openspec/queue.md b/openspec/queue.md index f3ea8842..4b129ce7 100644 --- a/openspec/queue.md +++ b/openspec/queue.md @@ -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` 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 diff --git a/openspec/specs/tools/macro-execution/spec.md b/openspec/specs/tools/macro-execution/spec.md index a613a6fd..596e06b2 100644 --- a/openspec/specs/tools/macro-execution/spec.md +++ b/openspec/specs/tools/macro-execution/spec.md @@ -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 + diff --git a/openspec/specs/tools/multibody-part-export/spec.md b/openspec/specs/tools/multibody-part-export/spec.md index f948a974..7bfbd931 100644 --- a/openspec/specs/tools/multibody-part-export/spec.md +++ b/openspec/specs/tools/multibody-part-export/spec.md @@ -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 +