feat(limrun): drive an existing instance with its own URL and token

Merged
TH
2mo ago
+1003-85

Summary

A sandboxed agent can drive an existing Limrun instance, such as a live preview, with only that instance's URL and token. It needs no organization API key. agent-device reads the lim CLI's variables:

export LIM_IOS_INSTANCE_URL=...    # status.apiUrl
export LIM_IOS_INSTANCE_TOKEN=...  # status.token
agent-device connect limrun --platform ios
# Android also needs LIM_ANDROID_INSTANCE_ADB_URL

Node.js: new LimrunRuntime({ instances: { ios: { apiUrl, token } } }).

  • agent-device never creates or deletes an attached instance. On Android, teardown removes only the reverse mappings this session created.
  • Instance access takes precedence over LIMRUN_API_KEY for its platform.
  • Without a key, install and apps before the first open fail with UNSUPPORTED_OPERATION.
  • Sessions and app-log descriptors carry ownership: 'created' | 'attached'.
  • A partial set of variables fails connect with INVALID_ARGS. The daemon skips Limrun and logs provider_runtime_skipped; every other provider still boots.
  • src/provider-limrun-credentials.ts is the only reader of Limrun env vars.

34 files, including help and docs; 997 gross diff lines.

Validation

  • a86348e533: pnpm check:affected --run passes (1159 related tests), and eager-closure-budgets passes. Mutating the no-delete guard, the reverse cleanup, the reconnect routing, the composition skip, the descriptor default, or the skip-log ordering fails the matching test.
  • Live at 62dd1463f6 (also run by @jbroma at d0234a0): with LIMRUN_API_KEY unset, connect, open, snapshot -i, apps and disconnect worked on real Limrun iOS and Android instances. Both were still ready afterwards, then deleted.