0
0
Fork 0
Codesys-MCP-SP21-plus/src
Karstein Phobic Nyvold Kvistad 41db7d86e9 fix(device): non-blocking pre-flight, always-force rebind, ensure connect()
End-to-end download via MCP was failing for three reasons; all three
fixed here so the agent can drive the whole flow without manual IDE
clicks.

1. verify_device_reachable did a live gateway.perform_network_scan()
   on every call. That freezes the CODESYS UI thread for the full
   scan duration, so the user couldn't interact with the IDE during
   pre-flight (and a 60s tool timeout was easy to hit). Now reads
   gateway.get_cached_network_scan_result() first (instant, no UI
   block), only falls back to a live scan when no cache exists.
   Adds scan_source ("cache" | "live") to the JSON so callers know
   which path was taken.

2. rebind_device_to_scan short-circuited with "already-bound" when
   the resolved address matched the cached one. But the IDE's
   Select-Device + OK flow re-applies set_gateway_and_address even
   when the address didn't change -- that's what refreshes the
   device's scanned_* properties and re-establishes a session.
   Skipping it left the binding stale even after a successful
   rebind call. Always apply now.

3. ensure_online_connection created an online_application but never
   opened a device session. login() then waited on (or popped a
   dialog for) a session nobody had opened -- which is what the
   user was doing manually as "right-click device -> Connect".
   Adds _ensure_device_connected() helper that locates the project's
   PLC device, creates a ScriptOnlineDevice, and calls connect() if
   not already connected. Idempotent; best-effort (logs and falls
   through on failure so login() can still try its own path).
2026-05-11 18:09:34 +02:00
..
scripts fix(device): non-blocking pre-flight, always-force rebind, ensure connect() 2026-05-11 18:09:34 +02:00
tui release: v0.8.0 -- phobiCS-tui v0.3 (inline live values) 2026-04-29 10:10:40 +02:00
approve-gate.ts feat(approve-gate): wire 9 modifying tools through phobiCS-tui 2026-04-29 08:22:09 +02:00
bin.ts fix: no headless fallback by default + clear stale lastError (v0.9.2) (#19) 2026-04-29 20:16:01 +02:00
detect.ts feat(open_project): pre-flight profile-mismatch check using offline .project inspection 2026-04-27 22:32:53 +02:00
headless.ts Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
inspect.ts feat(cli): --inspect <project> reads CODESYS profile + mandatory libs offline (no CODESYS needed) 2026-04-27 21:47:31 +02:00
ipc.ts Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
launcher.ts fix(launcher): wait for killed PIDs to evict before re-scan 2026-05-11 17:07:01 +02:00
live-values-pump.ts feat(live-values): depth-1 sub-property descent 2026-04-29 13:52:35 +02:00
live-values-write.ts Revert "feat(live-values): atomic writer for tui-live-values.json" 2026-04-29 10:03:32 +02:00
logger.ts Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
mirror-paths.ts fix(mirror): per-project mirror dir name when multiple .project files share a parent 2026-04-27 22:22:09 +02:00
preflight.ts feat(open_project): pre-flight profile-mismatch check using offline .project inspection 2026-04-27 22:32:53 +02:00
script-manager.ts fix(create_folder): try project.create_folder(name, SV_POU) first; drop ScriptManager cache 2026-04-26 17:16:44 +02:00
server.ts fix(device-tools): surface JSON output in tool responses 2026-05-11 17:45:30 +02:00
ssh-restart-runtime.ts feat(ssh): restart_runtime_ssh -- restart codesyscontrol over SSH (password auth + sudo -S + port-listen liveness probe) 2026-04-28 16:50:19 +02:00
ssh-version.ts feat(ssh): read_running_version_ssh -- read PLC project version over SSH, no CODESYS needed 2026-04-27 22:13:29 +02:00
state-read.ts feat(state): add CJS reader for phobiCS-tui state file 2026-04-28 22:26:15 +02:00
types.ts test(e2e): regression coverage for the four 2026-04-29 fixes (#14) 2026-04-29 13:44:02 +02:00