Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions docs/HTTP-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,8 @@ URL answers `404`.
token's principal, and the lease ID is the 32-hex ID the CLI chose. `close`
ends the agent-device lease and then frees the Simlock lease, so Simlock
wipes the device for the next agent.
- **`devices` lists only the agent's own devices.** Before `open` it answers
an empty list; after, the devices Simlock leased to that token.
- **Heartbeats keep the lease.** The CLI sends one before every command except
`devices`. Once agent-device answers it, Simlock renews the lease to now plus
its TTL, unless the lease already runs longer (a longer renewal by the agent
Expand Down Expand Up @@ -1516,8 +1518,30 @@ the status.
- `timed out waiting for a device; nothing was leased`.
- `refused by simlock: <message>`: Simlock refused the lease request, for
example a model it does not know, or a `ttlMs` above `lease.maxTtlMs`.
- `refused: only iOS and Android`, `refused: name --platform ios or android`.
- `refused: simlock picks the device`: `--udid` or `--serial` on `open`.
- `refused: only iOS and Android`, `refused: name --platform ios or android`,
and `refused: <platform> is not available on this simlock` for a platform
whose driver is off on this worker.
- `refused: simlock picks the device`: a `--udid`, `--serial`, `--device` or
device key that is not the device Simlock leased to the agent. A
`--device` naming the leased device's model is sent on as that device's ID.
- `refused: simlock chooses the device set; run disconnect, then connect proxy
without --ios-simulator-device-set` and `refused: simlock chooses the
devices; run disconnect, then connect proxy without
--android-device-allowlist`: on any command.
- `refused: send the app from your machine as an upload`: `install` or
`reinstall` of a path on the worker.
- `refused: no device leased; run open first`: a sharded `test` with no
`--device` from an agent holding no matching device. With a device leased,
Simlock adds the agent's leased devices as `--device`.
- `refused: name the device with --udid <id>; run devices to see yours`:
`capabilities` or `doctor` that names no device from an agent not holding
exactly one.
- `refused: run devices on its own`, `refused: devices does not stream through
simlock`, `refused: a batch step cannot name another lease`,
`refused: malformed <field>`, `refused: unknown method <method>`, and
`refused: unknown route <method> <path>` (answered `404`).
- `could not check your leases; try again`: Simlock could not list the
agent's leases within 5 seconds.
- `refused: this agent-device is too old for simlock; upgrade it`: the CLI
sent no lease ID.
- `refused: send lease calls as lease RPCs`: a lease call inside
Expand Down
4 changes: 2 additions & 2 deletions docs/internal/COMPONENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ modules with.
| `AgentDeviceSupervisor` | `src/agent-device/host/agent-device-supervisor.ts` | Starting, watching and stopping the one agent-device daemon: reaping one a killed simlock left (by a pid record and an identity check), the private state dir and policy file, the daemon's environment, readiness through `daemon.json`, the port and `/health`, restart on death, and the availability state (`off`, `starting`, `running`, `unavailable` with a reason and remedy). | Serve agent-device traffic; report to `simlock doctor`; decide which devices exist (the drivers' environments do). |
| Install lookup, compatibility, daemon environment | `src/agent-device/host/install.ts`, `src/agent-device/shared/` | Finding the agent-device install and its daemon entry; the minimum versions and RPC protocol; the environment and policy data. | Run a process. |
| `AgentDeviceHealthProbe` | `src/agent-device/host/health.ts` | The `GET /health` read, with a time limit. | Judge the answer. |
| Front | `src/agent-device/front/` | The `/v1/agent-device/*` mount: the role check, the `/rpc` body check, turning an agent-device `allocate` into a simlock `lease.request` (and its cancel when the CLI leaves) and a `release` into a `lease.release`, the front map of the leases it made, and who ended each; the heartbeat, which renews the simlock lease after agent-device answers, and the renewals while a command runs. | Check a token (the app does); run the proxy. |
| Front | `src/agent-device/front/` | The `/v1/agent-device/*` mount: the role check, the route list, the `/rpc` body check, the request rules (platform, device selectors, device set, sharding, install, `devices`) and the `devices` filter, turning an agent-device `allocate` into a simlock `lease.request` (and its cancel when the CLI leaves) and a `release` into a `lease.release`, the front map of the leases it made, and who ended each; the heartbeat, which renews the simlock lease after agent-device answers, and the renewals while a command runs. | Check a token (the app does); run the proxy. |
| `AgentDeviceHost`, `AgentDeviceUpstream` | `src/agent-device/host/host.ts`, `host/upstream.ts` | `@agent-device/proxy` in front of the daemon, one proxy per daemon start; the tenant each request acts as; the port the daemon is reached through and its supervisor adapter. | Know simlock leases. |
| `ReleaseScopeRecord`, `AgentDeviceLeaseEnd` | `src/agent-device/host/lease-end.ts` | The host's record of each agent-device lease's release scope (filled by a recording wrapper around the proxy's upstream fetch), and the `LeaseEndParticipant` that, when simlock ends a lease, waits for a running allocate or release and releases the agent-device lease with that scope before the wipe. | Write to the front map; bound a wait with a timer (leasing's signal bounds it). |
| Wire rules | `src/agent-device/shared/` | The path prefixes, the `/rpc` body reader, the call classifier, the lease-call field reader, the release scope reader, the reply reader (an allocate reply is a success only when its release scope passes) and the front's replies. | Decide what a call means. |
| Wire rules | `src/agent-device/shared/` | The path prefixes, the route and RPC method lists, the selector reader, the `/rpc` body reader, the call classifier, the lease-call field reader, the release scope reader, the reply reader (an allocate reply is a success only when its release scope passes) and the front's replies. | Decide what a call means. |
| `FakeAgentDevice` | `src/agent-device/testing.ts` | The in-memory agent-device daemon the proxy sits in front of in tests. | Appear in production code. |

## Drivers
Expand Down
Loading
Loading