feat(environment): system_launch, preference whitelist and operator prompts on COM; declared refusals headlessly

user_pick_point / user_select answer {cancelled: true} on ESC (DISP_E_EXCEPTION)
and {timed_out: true} past COM_CALL_TIMEOUT; preferences_set refuses read-only,
unknown and out-of-range keys before any ActiveX call.

The read-only key is Files.PrinterStyleSheetPath, not the spec's
PrintStyleSheetPath: IAcadPreferencesFiles has no member of that name
(measured live on AutoCAD 2026 / R25.1), and a misspelt key would make
preferences_get() raise on every live call.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
This commit is contained in:
Umut CAN
2026-09-21 18:34:09 +03:00
co-authored by Claude Opus 5
parent c7dd72410a
commit b83a74e969
9 changed files with 1153 additions and 11 deletions
+64
View File
@@ -76,6 +76,9 @@ class ToolAliases:
# (document_close); a drafter typing it could mean either.
# LAYERSTATE, VIEW, UCS -- umbrella dialog/option commands (save, restore,
# list, delete in one) that this server splits into discrete tools.
# OPTIONS -- one dialog both reads and writes a preference; the server
# splits read (system_preferences_get) and write (system_preferences_set),
# the SETVAR precedent.
#
# Every other AutoCAD command must map to exactly one tool.
SHARED_ACAD_COMMANDS: frozenset[str] = frozenset(
@@ -89,6 +92,7 @@ SHARED_ACAD_COMMANDS: frozenset[str] = frozenset(
"LAYERSTATE",
"LAYOUT",
"MEASUREGEOM",
"OPTIONS",
"PLINE",
"QSELECT",
"SETVAR",
@@ -1503,6 +1507,46 @@ TOOL_ALIASES: dict[str, ToolAliases] = {
"save which layers are frozen",
),
),
"system_launch": ToolAliases(
acad=(),
synonyms=(
"start autocad",
"launch autocad",
"attach to the running autocad",
"is autocad running",
"open autocad with this file",
),
),
"system_preferences_get": ToolAliases(
acad=("OPTIONS",),
synonyms=(
"read a preference",
"autosave interval",
"support file search path",
"what is the pickbox size",
"options dialog value",
),
),
"system_preferences_set": ToolAliases(
acad=("OPTIONS",),
synonyms=(
"change a preference",
"set the autosave interval",
"cursor size",
"pickbox size",
"default plot style table",
),
),
"system_prompt_message": ToolAliases(
acad=(),
synonyms=(
"message on the command line",
"tell the operator",
"print to the command line",
"command line note",
"say something in autocad",
),
),
"ucs_list": ToolAliases(
acad=("UCS", "UCSMAN"),
synonyms=("the current ucs", "list coordinate systems", "named ucs", "ucs manager"),
@@ -1527,6 +1571,26 @@ TOOL_ALIASES: dict[str, ToolAliases] = {
"ucs origin",
),
),
"user_pick_point": ToolAliases(
acad=("ID",),
synonyms=(
"pick a point",
"click a point on screen",
"ask the operator for a point",
"where should this go",
"let me click",
),
),
"user_select": ToolAliases(
acad=("SELECT",),
synonyms=(
"let me select",
"pick objects on screen",
"ask the operator to select",
"select on screen",
"hand me the selection",
),
),
"view_named_list": ToolAliases(
acad=("VIEW",),
synonyms=("saved views", "existing named views", "list the views"),