amiagent is the Amiga half of amimcp. It is a small TCP daemon that lets a
program on another machine work on this Amiga: run AmigaDOS commands, read and
write files, list drawers, report system state, capture the screen, run ARexx,
and inject mouse and keyboard input.
The other half is an MCP server that runs on a Mac or PC, which is how Claude
(Anthropic's LLM) talks to it. Nothing about the agent is specific to that,
though - the wire protocol is documented (PROTOCOL.md, now in this archive)
and simple enough to drive from a shell script if you would rather.
It is written in plain C against the OS libraries, needs no third-party
dependencies, and runs on AmigaOS 2.0 upwards. Two builds of each program are
included:
amiagent 68000 - runs on any Amiga
amiagent.020 68020+ - slightly smaller and faster
amimon 68000 - the status window, GadTools (runs everywhere)
amimon.020 68020+ - the same, for an 020 and up
amimon-mui 68000 - the status window, MUI (needs MUI 3.8+)
amimon-mui.020 68020+ - the same, for an 020 and up
NEW IN 0.13.0 - STARTING IT FROM AN ICON
Double-click amiagent and the settings come from the icon's TOOL TYPES,
because a Workbench start has no command line to put them on. Select the
icon, Icons/Information, and edit:
TOKEN=pickasecret the shared secret. SET THIS ONE.
PORT=7846 the port to listen on
VERBOSE open a window and log every request to it
DONOTWAIT for a copy of the icon in SYS:WBStartup - read by
Workbench itself, not by the agent
The icon in this archive already carries all four, in parentheses -
"(TOKEN=put-your-secret-here)" - which is the Workbench convention for
"present but inactive". Take the parentheses off the ones you want.
Started that way there is no console, so the two things you would
otherwise never see are requesters instead: no TOKEN set (start anyway,
or quit) and a startup failure such as the TCP/IP stack not being up
yet. VERBOSE opens a window instead, and Ctrl-C in that window stops
the agent.
Without a window, what stops a Workbench-started agent is the ARexx port
- there is no CLI number for Status/Break to find:
address AMIAGENT
'QUIT'
Requested by djbase, who runs it on a machine with no Shell open.
NEW IN 0.12.0
TASKPRI and TASKLIST on the AMIAGENT ARexx port:
address AMIAGENT
'TASKPRI "imp3" -1' /* RESULT: imp3 pri 0 -> -1 */
'TASKLIST "imp"' /* RESULT: IMP3 - Debugger (0), imp3 (-1) */
TASKPRI sets a task's priority BY NAME - the reach ChangeTaskPri lacks:
it only addresses CLI process numbers, while the tasks you actually need
to re-prioritise (a Workbench-started player spinning at 100% CPU and
starving its own audio decoder) have no CLI number at all. Exact name
match beats substring, rc=0/5, RESULT reports "name pri old -> new".
Plus a fix worth having if you script the port from the network side: a
client-sent ARexx program that itself did "address AMIAGENT" deadlocked
the agent. It now keeps serving its port while such a program runs.
NEW IN 0.11.0 - A LOCAL AREXX PORT
The agent now opens a public ARexx port, "AMIAGENT", so your own ARexx
scripts and ARexx-aware applications can drive its input machinery
directly - no network, no AI, just ARexx:
/* activate a window by title pattern, then type into it */
address AMIAGENT
'ACTIVATEWINDOW "CHAT --*"' /* rc=0 found+activated, rc=5 not */
'ENTERTEXT "hello there<enter>"'
Commands:
ACTIVATEWINDOW <pattern> AmigaDOS wildcards ('*' accepted as #?),
plain text matches as a substring, any
screen; on success RESULT holds the
matched window title.
ENTERTEXT <text> (alias TYPE) typed through YOUR keymap, so
umlauts come out right. Inline key tokens
in the commodities style: <enter>, <esc>,
<tab>, <f1>..<f10>, <up>, <ctrl c>,
<shift tab>, <lamiga q>, ... - "<<" gives
a literal '<'.
KEY <name> one key press, same names as above.
VERSION / HELP what you would expect.
rc=0 means it worked, rc=5 window not found, rc=10 bad command - so
your script can check whether the window even opened. Test for the
port with show('P','AMIAGENT') and fall back to whatever you did
before; if a second agent instance is started it simply runs without
the port rather than fighting over it.
ALSO RECENT (0.9.0 / 0.10.0)
* CMD_AREXX - clients can run ARexx programs here and read the RESULT;
REXXPORTS lists what is scriptable right now.
* A semantic GUI layer: walk windows/gadgets as objects, click "the OK
button" by name, enumerate menus and invoke by shortcut.
* GETRANGE - chunked download for big files.
* Optional TLS via AmiSSL 5 (opt-in SSL=1 rebuild; self-signs a cert on
first run). The binaries in this archive are plain TCP.
RUNNING IT
Bring your TCP/IP stack up first (Roadshow, AmiTCP, ...), then:
amiagent TOKEN=somesecret
It listens on port 7846 and prints that it is waiting. Ctrl-C stops it
(from a Shell: Status, then Break <n> - the agent exits cleanly). To
start it at boot, add this to S:User-Startup AFTER your TCP/IP stack:
run >NIL: <path-to>/amiagent TOKEN=somesecret QUIET
Or double-click the icon and put TOKEN=somesecret in its tool types -
see NEW IN 0.13.0 above.
Then, optionally, run amimon (or amimon-mui) from the drawer to watch it
work.
SECURITY - PLEASE READ
amiagent runs whatever commands it is sent, and the connection is NOT
encrypted. Always set a TOKEN, keep it on a LAN you trust, and never forward
the port through your router. Without a TOKEN, anything on the network can
run any command on this machine - both monitors say so in red-letter terms,
showing "OPEN, no token", and a Workbench start stops to ask.
Source, the MCP server, the protocol document and the issue tracker:
https://github.com/thomas-luebker/amimcp
Distributed under the licence in the archive.
|