fix: use clean VM reset and resilient agent listener

This commit is contained in:
2026-08-16 16:36:24 +09:00
parent a637e591e1
commit 5d9cd90299
4 changed files with 63 additions and 33 deletions
+9 -5
View File
@@ -20,14 +20,14 @@ Windows named pipe `\\.\pipe\ferrolang-vm`; there is no controller or observer
TCP port. Monitor the append-only structured log in another terminal:
```powershell
lnav .qemu/ferro-vm.log
uv run ferro-vm logs
```
Commands:
```powershell
uv run ferro-vm reset # clean QEMU quit and restart
uv run ferro-vm soft-reset # QEMU system_reset
uv run ferro-vm wait-ready --timeout 45
uv run ferro-vm ping
uv run ferro-vm exec 'dir C:\FEC'
uv run ferro-vm put fec/src/check.c 'C:\FEC\SRC\CHECK.C'
@@ -37,9 +37,13 @@ uv run ferro-vm ocr
uv run ferro-vm stop
```
Both reset modes wait for FreeDOS to boot, submit the default boot-menu Enter,
and require TCPAGENT `PING`/`PONG` before succeeding. The daemon logs command
metadata, DOS output, exit status, transfers, and agent lifecycle events as UTF-8 lines. It deliberately never logs raw binary
`reset` cleanly quits and restarts QEMU, waits for FreeDOS to boot, submits
the default boot-menu Enter, and requires TCPAGENT `PING`/`PONG`. QEMU
`system_reset` is intentionally unsupported because repeated soft resets leave
the FreeDOS NE2000 packet driver stuck during initialization. `logs` starts
`lnav` when installed and otherwise falls back to PowerShell `Get-Content
-Wait`. The daemon logs command metadata, DOS output, exit status, transfers,
and agent lifecycle events as UTF-8 lines. It deliberately never logs raw binary
payloads or protocol hex.
## Standalone OCR
+1 -2
View File
@@ -176,10 +176,9 @@ int main(void) {
int used,rc; uint16_t key;
if(Utils::parseEnv()!=0)return 2;
if(Utils::initStack(1,TCP_SOCKET_RING_SIZE,ctrl_break,ctrl_c))return 3;
cprintf("[TCPAGENT] Connecting to 10.0.2.2:%u\r\n",SERVER_PORT);
while(!stop_requested) {
if(connect_host()!=0){unsigned long spins=0;while(spins++<60000UL&&!stop_requested)drive();continue;}
cprintf("[TCPAGENT] Connected. Alt-X stops.\r\n"); write_text("TCPAGENT READY\r\n"); used=0;
write_text("TCPAGENT READY\r\n"); used=0;
while(!stop_requested&&!socketp->isRemoteClosed()) {
drive(); rc=socketp->recv((uint8_t *)data,CHUNK_SIZE);
if(rc<0)break;