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
4 changes: 3 additions & 1 deletion src/agent-device/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Off unless `capabilities.agent-device.enabled` (false). Off: nothing mounted, no

| File | Role |
| ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `definition.ts` | `agentDeviceModule`: config, defaults, cap check; loads `worker.ts` only when on |
| `definition.ts` | `agentDeviceModule`: config, defaults, cap check, `localProfile` (file name, token label, `render`); loads `worker.ts` only when on |
| `worker.ts` | `createWorker`: both supervisors, edge parts, capability, relay target, mount, hooks |
| `host/agent-device-supervisor.ts` | Reap, start, watch, stop one role's daemon (`simulators` or `phones`); availability state |
| `host/install.ts` | `findAgentDevice`: command → install root → daemon entry |
Expand Down Expand Up @@ -133,6 +133,8 @@ under leasing's signal (`lease.endWaitMs`).
Disk: `<data dir>/agent-device/` and `<data dir>/agent-device-phones/` (agent-device's own files) and the two pid records. Front map,
renewals and release scopes: memory only.

Local profile: a standalone worker with HTTP and this module on keeps `<data dir>/agent-device-profile.json` (0600) so an agent on the same Mac connects with `agent-device connect --remote-config <file>` and no token of its own ([ADR 0046](../../docs/internal/adr/0046-a-standalone-worker-serves-agent-device-by-default-with-a-private-profile.md)). `definition.ts` declares the file as plain data; the module host writes it at each start, reuses the one `agent`-role token labelled `agent-device on this Mac` (so an agent's saved connection stays valid), revokes other tokens with that label, and deletes the file and revokes the token when HTTP or the module is off. No worker code runs for it.

## Rules

- The simlock lease is the only clock; an agent-device lease never outlives it.
Expand Down
18 changes: 18 additions & 0 deletions src/agent-device/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ export const agentDeviceModule: OptionalModuleDefinition<AgentDeviceModuleConfig
leaseTtlCapMs: integerInRange(MIN_AGENT_DEVICE_LEASE_TTL_MS, Number.MAX_SAFE_INTEGER),
}),
},
localProfile: {
fileName: "agent-device-profile.json",
render: (origin, secret) =>
`${JSON.stringify(
{
daemonAuthToken: secret,
daemonBaseUrl: `${origin}/v1/agent-device`,
daemonTransport: "http",
leaseProvider: "proxy",
runId: "simlock-local",
sessionIsolation: "tenant",
tenant: "local",
},
null,
2,
)}\n`,
tokenLabel: "agent-device on this Mac",
},
loadGateway: () => import("./gateway.js"),
loadWorker: () => import("./worker.js"),
name: "agent-device",
Expand Down
Loading
Loading