Documentation

Use the app

How it works

Build on it

Get involved

Microscopes and Tango

This page explains how a microscope becomes available to the assistant. An instrument is an AutoScript host:port, and you register and approve it on this computer. The twin and a real microscope take the same path.

Register a microscope

Open the control panel (Cmd+,) and choose Microscopes.

The Digital Twin is already listed. Select Register. The app starts the twin if it is not running.

Any other microscope:

  1. Select Add microscope.
  2. Enter a name using Latin letters or numbers, its AutoScript address, and the port (7521 by default).
  3. Select Add microscope. The app checks it can reach that address.
  4. Select Register.

Then, for either one:

  1. Wait for Waiting for your approval.
  2. Select Approve. A real instrument asks you to confirm first.
  3. The assistant restarts and the workspace reopens, which interrupts any reply in progress.
  4. In the workspace, tick the device under Instruments. Ticking is per conversation.
Status Meaning You can
Not registered Known, not running Register
Connecting… The device service is starting Wait
Waiting for your approval Running, but not offered to the assistant Approve, Reject
Online Available to the assistant Disconnect, Unregister
Registered, offline Approved, service not running Connect, Unregister
Needs attention Something failed; the reason is shown Register or Connect again

Approved devices are remembered. After restarting the app, select Connect; no new approval is needed.

How it is built

Each instrument gets its own Tango device and device service

Part Source Job
Device manager desktop/devices.mjs Devices, approval state, starting everything below
Stack launcher desktop/runtime/local_tango.py Starts the database, proxy devices and gateway in order
Gateway desktop/runtime/local_gateway.py The Tango MCP gateway plus a bearer token
Tango modules vendor/edmore_windows_node/source/tem_twin_autoscript tango_mcp, tango_stack, http_tango_device, unchanged in design from the cloud stack
Device service Same repository, edmore_tem_node and remote_monitor Exposes 40 tools over an authenticated local HTTP API

Tango runs from the moment the app starts, with no devices if none are approved. In that state the gateway offers only list_devices. Approving or unregistering writes devices/tango/http-nodes.json and restarts the stack, which is the same mechanism the cloud deployment calls a reload. The device list is fixed for each start of the stack, so the assistant restarts to pick up the new tools.

If the stack stops unexpectedly, the app restarts it. A failed start is retried once.

Tools the assistant gets

Tools are named mcp__tem_twin__<tool> and take a device argument. The server name stays tem_twin because the built-in tem-twin-* skills refer to it.

Group Examples
Discovery list_devices, select_device, microscope_status
Optics get_defocus, set_defocus, set_objective_stigmator, set_beam_tilt
Stage and beam get_stage, move_stage, blank_beam, unblank_beam
Acquisition acquire_camera_image, get_image_data_cached
Alignment align_beam_and_c2, align_gun_tilt, align_objective_stigmation
Measurement measure_beam, measure_objective_astigmatism

Each device reports a kind: simulation for the twin and hardware for everything else. While a device is offline it reports remote.

Rules the stack keeps

Troubleshooting

Message What to do
The local Tango service didn't start Read devices/tango/stack.log in the app data folder, or quit and reopen the app
Couldn't reach AutoScript at that address Check that AutoScript is running on that computer, and the network or VPN
The device service took too long to start Select Register or Connect again
The device service stopped unexpectedly Select Connect, and check the twin or instrument is running
A tool says the device is unavailable Tick the device under Instruments, or select Connect

Known limits

The cloud path

edmore_windows_node can also register a device with a shared EDMORE server, with pairing codes and administrator approval. This app does not use that path. See DEVICE_ACCESS.md in that repository.