# Windows Local Agent Foundation v53

## Objective
v53 introduces the first executable Windows hardware bridge while preserving the cloud-first architecture.

## Security
The previous v51 pairing token remains short-lived and one-time.

v53 adds a long-lived Agent secret:
- generated during pairing
- returned once to the Agent
- SHA-256 hash stored in PostgreSQL
- every heartbeat/claim/status call authenticates with `X-Agent-Token`

This closes the v51 foundation gap where possession of the Agent public ULID alone could address Agent endpoints.

## Local Agent stack
- .NET 8 Worker Service
- Windows Service hosting
- HttpClient API bridge
- SQLite technical state
- Windows RAW spooler
- ESC/POS TCP adapter
- structured-v1 document parser

## SQLite boundary
SQLite contains technical hardware state only:
- processed print-job ids
- content hash
- processing state
- printer mappings
- technical errors

It does not contain:
- sales
- inventory
- customer records
- payments
- restaurant orders
- accounting data

## Lease/retry
PostgreSQL remains authoritative for job leases.
Local SQLite is only crash-recovery protection.

If the Agent printed a job but crashed before cloud acknowledgement, local `printed` state allows the Agent to acknowledge it without physically printing again.

## Windows spooler
v53 supports RAW Windows spooler output using `winspool.drv`.

## ESC/POS
v53 supports basic network transport on host:port, typically port 9100.

Arabic production rendering is not claimed complete. Raw UTF-8 is insufficient for many thermal printers; shaping/rasterization remains a dedicated renderer task.

## Next
v54 should add:
- Local Agent configuration UI
- printer discovery
- server printer-to-local target sync
- test print endpoint
- Arabic raster renderer
- QR/barcode operators
- install/update packaging
