RemoteRF 2.13.0__tar.gz → 2.13.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. {remoterf-2.13.0/src/remoterf.egg-info → remoterf-2.13.2}/PKG-INFO +1 -1
  2. {remoterf-2.13.0 → remoterf-2.13.2}/pyproject.toml +1 -1
  3. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/core/app.py +5 -5
  4. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/core/direct_path.py +4 -4
  5. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/core/grpc_acc.py +2 -2
  6. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/core/grpc_client.py +16 -7
  7. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/data/agent_guide.md +2 -1
  8. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/deployment/backend.py +8 -3
  9. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/deployment/http.py +2 -1
  10. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/dynamic_device.py +1 -1
  11. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/ops.py +4 -3
  12. {remoterf-2.13.0 → remoterf-2.13.2/src/remoterf.egg-info}/PKG-INFO +1 -1
  13. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_device_routes.py +22 -11
  14. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_direct_path_global.py +5 -4
  15. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_federated_devices.py +34 -0
  16. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_ops.py +2 -2
  17. {remoterf-2.13.0 → remoterf-2.13.2}/LICENSE +0 -0
  18. {remoterf-2.13.0 → remoterf-2.13.2}/README.md +0 -0
  19. {remoterf-2.13.0 → remoterf-2.13.2}/setup.cfg +0 -0
  20. {remoterf-2.13.0 → remoterf-2.13.2}/setup.py +0 -0
  21. {remoterf-2.13.0 → remoterf-2.13.2}/src/_remoterf_alias.py +0 -0
  22. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/__init__.py +0 -0
  23. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/admin.py +0 -0
  24. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/agent_cli.py +0 -0
  25. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/agent_docs.py +0 -0
  26. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/common/__init__.py +0 -0
  27. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/common/grpc/__init__.py +0 -0
  28. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/common/grpc/deployment_capabilities.proto +0 -0
  29. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/common/grpc/deployment_capabilities_pb2.py +0 -0
  30. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/common/grpc/deployment_capabilities_pb2_grpc.py +0 -0
  31. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/common/grpc/grpc.proto +0 -0
  32. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/common/grpc/grpc_pb2.py +0 -0
  33. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/common/grpc/grpc_pb2_grpc.py +0 -0
  34. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/common/grpc/v2_codec.py +0 -0
  35. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/common/tos_notice.txt +0 -0
  36. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/common/utils/__init__.py +0 -0
  37. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/common/utils/ansi_codes.py +0 -0
  38. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/common/utils/api_token.py +0 -0
  39. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/common/utils/banner.py +0 -0
  40. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/common/utils/list_string.py +0 -0
  41. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/common/utils/process_arg.py +0 -0
  42. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/config/__init__.py +0 -0
  43. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/config/cert_fetcher.py +0 -0
  44. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/config/config.py +0 -0
  45. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/core/__init__.py +0 -0
  46. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/core/acc_login.py +0 -0
  47. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/core/availability.py +0 -0
  48. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/core/banner_note.txt +0 -0
  49. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/core/dynamic_v2_transport.py +0 -0
  50. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/core/messages.py +0 -0
  51. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/core/secure_channel.py +0 -0
  52. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/core/v2_errors.py +0 -0
  53. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/data/mcp_tools.json +0 -0
  54. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/deployment/__init__.py +0 -0
  55. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/deployment/direct.py +0 -0
  56. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/deployment/homes.py +0 -0
  57. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/deployment/lanpass.py +0 -0
  58. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/deployment/state.py +0 -0
  59. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/__init__.py +0 -0
  60. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/_virtual.py +0 -0
  61. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/adalm_pluto/__init__.py +0 -0
  62. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/adalm_pluto/adalm_pluto_remote.py +0 -0
  63. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/dynamic_v2.py +0 -0
  64. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/hackrf/__init__.py +0 -0
  65. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/hackrf/hackrf_remote.py +0 -0
  66. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/rtl_sdr/__init__.py +0 -0
  67. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/rtl_sdr/rtl_sdr_remote.py +0 -0
  68. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/schema_review.py +0 -0
  69. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/sim_sdr/__init__.py +0 -0
  70. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/sim_sdr/sim_sdr_remote.py +0 -0
  71. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/support/__init__.py +0 -0
  72. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/support/ti_mmwave.py +0 -0
  73. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/support/uhd.py +0 -0
  74. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/support/uhd_dsp.py +0 -0
  75. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/support/uhd_v2.py +0 -0
  76. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/ti_mmwave/__init__.py +0 -0
  77. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/ti_mmwave/ti_mmwave_remote.py +0 -0
  78. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/usrp/__init__.py +0 -0
  79. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/usrp/usrp_remote.py +0 -0
  80. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/drivers/usrp/usrp_remote.pyi +0 -0
  81. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/mcp_server.py +0 -0
  82. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/remoterf_cli.py +0 -0
  83. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf/version.py +0 -0
  84. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf.egg-info/SOURCES.txt +0 -0
  85. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf.egg-info/dependency_links.txt +0 -0
  86. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf.egg-info/entry_points.txt +0 -0
  87. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf.egg-info/requires.txt +0 -0
  88. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf.egg-info/top_level.txt +0 -0
  89. {remoterf-2.13.0 → remoterf-2.13.2}/src/remoterf.py +0 -0
  90. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_agent_cli.py +0 -0
  91. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_agent_docs.py +0 -0
  92. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_banner.py +0 -0
  93. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_batch.py +0 -0
  94. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_bundled_drivers.py +0 -0
  95. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_cli_login_fresh.py +0 -0
  96. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_config_address.py +0 -0
  97. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_deployment_accounts.py +0 -0
  98. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_devices_api.py +0 -0
  99. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_direct_path_fixed.py +0 -0
  100. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_direct_path_partner.py +0 -0
  101. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_direct_path_race.py +0 -0
  102. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_direct_path_relay.py +0 -0
  103. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_dynamic_device_codegen.py +0 -0
  104. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_dynamic_v2.py +0 -0
  105. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_fetch_idl_fallback.py +0 -0
  106. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_finish_prompt.py +0 -0
  107. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_gate_i_direct_path.py +0 -0
  108. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_grpc_client_target.py +0 -0
  109. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_homes.py +0 -0
  110. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_lan_fallback.py +0 -0
  111. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_mcp_server.py +0 -0
  112. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_messages.py +0 -0
  113. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_native_account_credentials.py +0 -0
  114. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_native_devices.py +0 -0
  115. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_old_import_name.py +0 -0
  116. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_partner_dynamic_v2.py +0 -0
  117. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_pluto_virtual.py +0 -0
  118. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_process_arg.py +0 -0
  119. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_relay_paging.py +0 -0
  120. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_remote_admin.py +0 -0
  121. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_remoterf_cli.py +0 -0
  122. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_rx_readahead.py +0 -0
  123. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_schema_review.py +0 -0
  124. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_ti_mmwave.py +0 -0
  125. {remoterf-2.13.0 → remoterf-2.13.2}/tests/test_upgrade_rescue.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: remoterf
3
- Version: 2.13.0
3
+ Version: 2.13.2
4
4
  Summary: A python API to remotely access signal centric hardware. Client-side only! Courtesy of Wireless Lab @ UCLA & Prof. Ian Roberts.
5
5
  Author-email: Ethan Ge <84103791+ethange1@users.noreply.github.com>
6
6
  License-Expression: GPL-3.0-or-later
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "remoterf"
7
- version = "2.13.0"
7
+ version = "2.13.2"
8
8
  description = "A python API to remotely access signal centric hardware. Client-side only! Courtesy of Wireless Lab @ UCLA & Prof. Ian Roberts."
9
9
  readme = "README.md"
10
10
  license = "GPL-3.0-or-later"
@@ -13,7 +13,7 @@
13
13
  # You should have received a copy of the GNU General Public License
14
14
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
15
 
16
- from remoterf.core.grpc_client import addr as server_addr, handle_admin_command, _key
16
+ from remoterf.core.grpc_client import addr as server_addr, handle_admin_command, _key, is_global_token
17
17
  from . import *
18
18
  from ..common.utils import *
19
19
 
@@ -154,7 +154,7 @@ def _native_label(label):
154
154
 
155
155
 
156
156
  def _print_reserved(where, when, token, handle, logged_in_to, install, no_handle=_NO_HANDLE):
157
- """The token and, when the device has one, its handle (both @<deployment>).
157
+ """The token and, when the device has one, its handle (Name@<deployment>).
158
158
  Boxed before the driver install, which can fail or stall; the usage box
159
159
  follows it, once the device type is known. `no_handle`: why no handle is
160
160
  shown."""
@@ -850,15 +850,15 @@ def _federated_reserve_slot(device_id, chosen_day, chosen_slot, slot_start_str,
850
850
  return
851
851
  when = _format_reservation_range(*chosen_slot)
852
852
  install = lambda: account.install_reserved_driver(token, device_id)
853
- slug = _global_slug(device_id, deployment_name) if token.startswith("rfg_") else None
853
+ slug = _global_slug(device_id, deployment_name) if is_global_token(token) else None
854
854
  label = _device_label(device_name, device_handle, slug or deployment_name)
855
- if not token.startswith("rfg_"):
855
+ if not is_global_token(token):
856
856
  # An older Global: the HOME reference goes where a token goes.
857
857
  _panel("Reserved", [(label, (Sty.BOLD, Sty.MAGENTA), f" {when}", Sty.CYAN), (),
858
858
  ("Token ", Sty.BOLD, token, (Sty.BOLD, Sty.GREEN))])
859
859
  _print_usage(install(), token)
860
860
  return
861
- _print_reserved(label, when, f"{token}@{slug}" if slug else token,
861
+ _print_reserved(label, when, token,
862
862
  f"{device_handle}@{slug}" if device_handle and slug else None, "RemoteRF Global", install,
863
863
  _UNROUTABLE.format(device_handle, "this deployment's Global name is unknown") if device_handle else _NO_HANDLE)
864
864
 
@@ -23,7 +23,7 @@ punch fails or the path dies, calls fall back to gRPC; a Global host relay is
23
23
  tried first after both QUIC paths fail. A path that died is retried after 30 s,
24
24
  a failed attempt only once a device call wants it.
25
25
  Signaling is ACC:direct_offer over the channel the client already has. See
26
- RemoteRF-Server docs/gate-i-direct-path.md. A Global device ref or rfg_
26
+ RemoteRF-Server docs/gate-i-direct-path.md. A Global device ref or Global
27
27
  token signals through Global instead (global_path).
28
28
 
29
29
  A partner lab's device (one the home lists on a federation agreement) gets a
@@ -896,12 +896,12 @@ def _partner(token: str) -> Optional[DirectPath]:
896
896
 
897
897
 
898
898
  def _global_offer(ref: str, deployment_id: Optional[str]) -> Callable[[dict], dict]:
899
- """The offer through Global: an ``rfg_`` token is its own credential, a ref takes the login."""
899
+ """The offer through Global: a Global token is its own credential, a ref takes the login."""
900
900
  def send(offer: dict) -> dict:
901
901
  from ..deployment.http import AccountBackendError
902
902
  from . import grpc_client
903
903
 
904
- backend = grpc_client._token_backend() if ref.startswith("rfg_") else grpc_client.federated_backend()
904
+ backend = grpc_client._token_backend() if grpc_client.is_global_token(ref) else grpc_client.federated_backend()
905
905
  try:
906
906
  answer = json.loads(backend.device_direct(ref, deployment_id, json.dumps(offer)))
907
907
  except AccountBackendError as exc:
@@ -917,7 +917,7 @@ def _global_offer(ref: str, deployment_id: Optional[str]) -> Callable[[dict], di
917
917
 
918
918
 
919
919
  def global_path(ref: str, deployment_id: Optional[str] = None) -> Optional[DirectPath]:
920
- """The path to the lab behind a Global device ref or ``rfg_`` token,
920
+ """The path to the lab behind a Global device ref or Global token,
921
921
  signaled through Global, when it is ready for this call."""
922
922
  if not enabled():
923
923
  return None
@@ -129,7 +129,7 @@ class RemoteRFAccount:
129
129
  if self.is_https_home:
130
130
  with self._busy("Reserving…"):
131
131
  reservation = self.backend.reserve(device_id, int(start_time.timestamp()), int(end_time.timestamp()))
132
- # Global's device API token (rfg_...), else (an older Global) the
132
+ # Global's device API token, else (an older Global) the
133
133
  # HOME reference, which also drives: adi.Pluto("<deployment>:<id>")
134
134
  return reservation.get('token') or reservation['device_id']
135
135
  username, credential_secret = self._rpc_credentials()
@@ -148,7 +148,7 @@ class RemoteRFAccount:
148
148
  try:
149
149
  from ..drivers.dynamic_device import install_driver
150
150
  if self.is_https_home:
151
- # By the ref, which needs no live slot (an rfg_ token does).
151
+ # By the ref, which needs no live slot (a Global token does).
152
152
  return install_driver(device_id=device_id).name
153
153
  return install_driver(token=handle, device_id=device_id).name
154
154
  except Exception as e:
@@ -189,6 +189,15 @@ def get_tcp_calls():
189
189
  # relayed through the HOME; the response is the destination's ordinary
190
190
  # GenericRPCResponse, so generated drivers do not know the difference.
191
191
 
192
+ _GLOBAL_TOKEN = re.compile(r"[a-z0-9]{12}")
193
+
194
+
195
+ def is_global_token(s) -> bool:
196
+ """A Global device token: 12 lowercase letters and digits, or a legacy
197
+ ``rfg_`` one. A lab token is 11 characters, so it never matches."""
198
+ return isinstance(s, str) and (s.startswith("rfg_") or _GLOBAL_TOKEN.fullmatch(s) is not None)
199
+
200
+
192
201
  _federated_backend = None
193
202
  # A direct-path thread may ask at the same moment: two backends would each
194
203
  # refresh the stored session, and Global revokes a replayed refresh token.
@@ -227,7 +236,7 @@ def _federated_ref(function_name, args):
227
236
 
228
237
 
229
238
  def _federated_call(route, function_name, args):
230
- """Relay through Global: an ``rfg_`` token needs no login, a ref the bearer."""
239
+ """Relay through Global: a Global token needs no login, a ref the bearer."""
231
240
  from ..deployment.http import AccountBackendError
232
241
  ref = getattr(route, "wire", route)
233
242
  # A driver schema always takes the relay, in one piece: Global screens each one it carries.
@@ -246,7 +255,7 @@ def _federated_call(route, function_name, args):
246
255
  if not refused:
247
256
  return response
248
257
  def send(request):
249
- if ref.startswith("rfg_"):
258
+ if is_global_token(ref):
250
259
  return _token_backend().device_token_rpc(
251
260
  ref, getattr(route, "deployment_id", None), request.SerializeToString()
252
261
  )
@@ -274,7 +283,7 @@ def _federated_call(route, function_name, args):
274
283
  "768 KiB limit for one call and this deployment does not page it; read fewer "
275
284
  "samples per call (about 98k complex64) or use a direct path"
276
285
  ) from None
277
- if ref.startswith("rfg_") and str(exc) == "not_found":
286
+ if is_global_token(ref) and str(exc) == "not_found":
278
287
  raise RuntimeError(
279
288
  "this RemoteRF Global does not accept device tokens yet; use the device reference"
280
289
  ) from None
@@ -298,7 +307,7 @@ _token_backend_cache = None
298
307
 
299
308
 
300
309
  def _token_backend():
301
- """Global, unauthenticated: an ``rfg_`` token is its own credential."""
310
+ """Global, unauthenticated: a Global token is its own credential."""
302
311
  global _token_backend_cache
303
312
  if _token_backend_cache is None:
304
313
  from ..deployment import homes
@@ -388,7 +397,7 @@ def _resolve(t):
388
397
  from remoterf_federation_core import is_global_ref
389
398
 
390
399
  if "@" not in t:
391
- return DeviceRoute(t, "global" if t.startswith("rfg_") or is_global_ref(t) else "active")
400
+ return DeviceRoute(t, "global" if is_global_token(t) or is_global_ref(t) else "active")
392
401
  x, _, dep = t.rpartition("@")
393
402
  dep = dep.strip().lower()
394
403
  if not x or not dep:
@@ -848,8 +857,8 @@ def _dispatch(function_name, args, connection):
848
857
 
849
858
  def _route_call(route, function_name, args):
850
859
  key = "token" if function_name == "IDL:get_drivers" else "a"
851
- if route.wire.startswith("rfg_"):
852
- # The rfg_ token is Global's credential and goes only in the request body;
860
+ if route.kind == "global" and is_global_token(route.wire):
861
+ # The Global token is Global's credential and goes only in the request body;
853
862
  # the frame is relayed to the lab, which pins the device itself.
854
863
  args = {**args, key: map_arg("")}
855
864
  elif unmap_arg(args[key]) != route.wire:
@@ -48,7 +48,8 @@ Close the device in `finally`. `adi.Pluto(virtual=True)` simulates a Pluto offli
48
48
  As a token it works for the logged-in account that holds the reservation, on a machine with that saved login.
49
49
  With no live reservation of that account on the device, the client reserves the current slot if it is free
50
50
  (`REMOTERF_AUTO_RESERVE=0` turns this off).
51
- - A Global token `rfg_...@deployment` works from any machine, with no login.
51
+ - A Global token is a bare 12-character code (for example `k3v9qlw2mxb7`); it works from any machine, with no login.
52
+ Handles are always `Name@deployment`.
52
53
  - A deployment's own token (11 characters) works on a machine whose client is set up for that deployment.
53
54
  - Every token works only inside its reservation window, from start to end.
54
55
  - Drivers take `token=`, and fall back to the `REMOTERF_TOKEN` environment variable. Generated scripts use
@@ -211,6 +211,9 @@ class HttpsJsonAccountBackend(DeploymentAccountBackend):
211
211
  "POST",
212
212
  self.base + "/refresh",
213
213
  data={"refresh_token": old["refresh_token"]},
214
+ # Past Caddy's 45 s hold, so a restart answers or 502s (never sent)
215
+ # instead of timing out ambiguously, which clears the saved login.
216
+ overall_timeout=50.0,
214
217
  ),
215
218
  old["subject_id"],
216
219
  )
@@ -399,7 +402,7 @@ class HttpsJsonAccountBackend(DeploymentAccountBackend):
399
402
  )
400
403
 
401
404
  def device_token_rpc(self, token, deployment_id, request_bytes):
402
- """Relay one frame on a Global device API token (``rfg_``): the token
405
+ """Relay one frame on a Global device API token: the token
403
406
  is the credential, so there is no login and no bearer."""
404
407
 
405
408
  data = {"token": token}
@@ -430,10 +433,12 @@ class HttpsJsonAccountBackend(DeploymentAccountBackend):
430
433
 
431
434
  def device_direct(self, ref, deployment_id, ice):
432
435
  """Signal a direct path to the lab behind ``ref`` (a device ref under
433
- this login, or an ``rfg_`` token with no login): the ICE offer goes in,
436
+ this login, or a Global token with no login): the ICE offer goes in,
434
437
  the lab's signed answer comes back as Global relayed it."""
435
438
 
436
- if ref.startswith("rfg_"):
439
+ from ..core.grpc_client import is_global_token
440
+
441
+ if is_global_token(ref):
437
442
  data, auth = {"token": ref, "ice": ice}, {}
438
443
  if deployment_id is not None:
439
444
  data["deployment_id"] = deployment_id
@@ -74,8 +74,9 @@ class JsonTransport:
74
74
  headers["Content-Type"] = FRAMED_CONTENT_TYPE
75
75
  if access:
76
76
  headers["Authorization"] = "Bearer " + access
77
+ # Longer than a Global restart: Caddy holds a request until the new container answers.
77
78
  overall_timeout = (
78
- 5.0 if overall_timeout is None else float(overall_timeout)
79
+ 20.0 if overall_timeout is None else float(overall_timeout)
79
80
  )
80
81
  if overall_timeout <= 0 or max_response_bytes <= 0:
81
82
  raise ValueError("invalid account operation budget")
@@ -95,7 +95,7 @@ def fetch_idl(
95
95
  from remoterf_federation_core import is_global_ref
96
96
 
97
97
  # A bare HOME-minted device reference is fetched through the same relayed
98
- # IDL RPC every driver uses; an rfg_ token tries v2 over the relayed device
98
+ # IDL RPC every driver uses; a Global token tries v2 over the relayed device
99
99
  # plane first.
100
100
  federated = is_global_ref(token) or is_global_ref(device_id)
101
101
  if token is not None and device_id is None and prefer_v2 and not federated:
@@ -27,7 +27,7 @@ from datetime import date, datetime, time, timedelta, timezone
27
27
  import grpc
28
28
 
29
29
  from .common.utils import map_arg, str_to_list, unmap_arg
30
- from .core.grpc_client import _key
30
+ from .core.grpc_client import _key, is_global_token
31
31
  from .core.messages import explain
32
32
  from .deployment.http import AccountBackendError
33
33
 
@@ -750,8 +750,9 @@ def reserve(s, handle, start, end, *, reveal_token=False) -> dict:
750
750
  minutes=int(row.get("max_reservation_time_sec") or 0) // 60 or None,
751
751
  days=_days(row.get("max_horizon_sec"))) from exc
752
752
  rid, token = reservation["reservation_id"], reservation.get("token")
753
- # An older Global issues no rfg_ token; the handle still works.
754
- token = f"{token}@{h.rpartition('@')[2]}" if token and token.startswith("rfg_") else None
753
+ # Global's token is bare and works as is; an older Global issues none,
754
+ # and the handle still works.
755
+ token = token if is_global_token(token) else None
755
756
  else:
756
757
  before = _native_reservations(s)
757
758
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: remoterf
3
- Version: 2.13.0
3
+ Version: 2.13.2
4
4
  Summary: A python API to remotely access signal centric hardware. Client-side only! Courtesy of Wireless Lab @ UCLA & Prof. Ian Roberts.
5
5
  Author-email: Ethan Ge <84103791+ethange1@users.noreply.github.com>
6
6
  License-Expression: GPL-3.0-or-later
@@ -24,7 +24,8 @@ from remoterf.deployment.http import JsonTransport
24
24
  GLOBAL = "550e8400-e29b-41d4-a716-446655440000"
25
25
  DEST = "11111111-1111-4111-8111-111111111111"
26
26
  REF = f"{DEST}:12"
27
- RFG = "rfg_" + "A" * 43
27
+ RFG = "rfg_" + "A" * 43 # the legacy shape
28
+ TOKEN = "k3v9qlw2mxb7" # Global's bare 12-character token
28
29
  SLOT = (datetime.datetime(2026, 1, 1, 10), datetime.datetime(2026, 1, 1, 11))
29
30
  WHEN = ("2026-01-01", "from", "10:00", "AM", "to", "11:00", "AM")
30
31
  GET = "pluto:tx_lo:GET"
@@ -107,6 +108,10 @@ def test_bare_strings_route_as_before(routes):
107
108
  assert grpc_client.device_route("Zm9vYmFy") == grpc_client.DeviceRoute("Zm9vYmFy", "active")
108
109
  assert grpc_client.device_route(REF).kind == "global"
109
110
  assert grpc_client.device_route(RFG) == grpc_client.DeviceRoute(RFG, "global")
111
+ assert grpc_client.device_route(TOKEN) == grpc_client.DeviceRoute(TOKEN, "global")
112
+ # A lab token is 11 characters; 12 that are not all lowercase or digits are no Global token.
113
+ for lab in ("Zm9vYmFyAbc", "k3v9qlw2mxb", "K3v9qlw2mxb7", "k3v9qlw2mx-7", "k3v9qlw2mxb7x"):
114
+ assert grpc_client.device_route(lab) == grpc_client.DeviceRoute(lab, "active")
110
115
  grpc_client.rpc_client(function_name=GET, args={"a": map_arg("Zm9vYmFy")})
111
116
  assert routes.calls == [(GET, {"a": "Zm9vYmFy"})]
112
117
 
@@ -118,15 +123,16 @@ def test_raw_tokens_never_auto_reserve(monkeypatch, routes):
118
123
  assert grpc_client.device_route(RFG).wire == RFG
119
124
 
120
125
 
121
- def test_a_bare_rfg_token_needs_no_login(monkeypatch, routes):
126
+ @pytest.mark.parametrize("token", [RFG, TOKEN])
127
+ def test_a_bare_global_token_needs_no_login(monkeypatch, routes, token):
122
128
  transport = _token_backend(monkeypatch)
123
- response = grpc_client.rpc_client(function_name=GET, args={"a": map_arg(RFG)})
129
+ response = grpc_client.rpc_client(function_name=GET, args={"a": map_arg(token)})
124
130
  assert unmap_arg(response.results["tx_lo"]) == 7
125
131
  method, path = transport.request.call_args.args
126
132
  kwargs = transport.request.call_args.kwargs
127
133
  assert (method, path) == ("POST", "/v2/deployment/devices/token-rpc")
128
134
  assert "access" not in kwargs and set(kwargs["data"]) == {"token", "request_b64"}
129
- assert kwargs["data"]["token"] == RFG
135
+ assert kwargs["data"]["token"] == token
130
136
  assert routes.calls == []
131
137
 
132
138
 
@@ -150,13 +156,15 @@ def test_rfg_at_deployment_is_bound_to_that_deployment(monkeypatch, routes):
150
156
  assert routes.calls == []
151
157
 
152
158
 
159
+ @pytest.mark.parametrize("token", [RFG, TOKEN])
153
160
  @pytest.mark.parametrize("fn, key", [(GET, "a"), ("IDL:get_drivers", "token")])
154
- def test_the_rfg_token_never_leaves_global(monkeypatch, routes, fn, key):
161
+ def test_the_global_token_never_leaves_global(monkeypatch, routes, fn, key, token):
155
162
  transport = _token_backend(monkeypatch)
156
- grpc_client.rpc_client(function_name=fn, args={key: map_arg(RFG)})
163
+ grpc_client.rpc_client(function_name=fn, args={key: map_arg(token)})
157
164
  data = transport.request.call_args.kwargs["data"]
158
165
  sent = grpc_pb2.GenericRPCRequest.FromString(base64.b64decode(data["request_b64"]))
159
- assert data["token"] == RFG and unmap_arg(sent.args[key]) == ""
166
+ assert data["token"] == token and unmap_arg(sent.args[key]) == ""
167
+ assert routes.calls == []
160
168
 
161
169
 
162
170
  def test_an_old_global_says_it_takes_no_device_tokens(monkeypatch, routes):
@@ -175,6 +183,9 @@ def test_a_handle_without_a_saved_login_is_a_plain_token(monkeypatch, routes):
175
183
  _login(monkeypatch, None)
176
184
  grpc_client.rpc_client(function_name=GET, args={"a": map_arg("PlutoA@ucla")})
177
185
  assert routes.calls == [(GET, {"a": "PlutoA"})]
186
+ # With an @ it is a handle, even when the name has a Global token's shape.
187
+ grpc_client.rpc_client(function_name=GET, args={"a": map_arg(f"{TOKEN}@ucla")})
188
+ assert routes.calls[-1] == (GET, {"a": TOKEN})
178
189
 
179
190
 
180
191
  def test_a_handle_is_exchanged_once_at_the_active_lab(monkeypatch, routes):
@@ -668,7 +679,7 @@ def test_a_global_reservation_shows_the_token_and_the_handle(monkeypatch):
668
679
 
669
680
  lines = _shown(monkeypatch, client_app)
670
681
  account = Mock()
671
- account.reserve_device.return_value = RFG
682
+ account.reserve_device.return_value = TOKEN
672
683
  account.install_reserved_driver.return_value = "pluto"
673
684
  monkeypatch.setattr(client_app, "account", account)
674
685
  monkeypatch.setattr(homes, "discover", lambda host: {"deployment_id": DEST})
@@ -676,8 +687,8 @@ def test_a_global_reservation_shows_the_token_and_the_handle(monkeypatch):
676
687
  client_app._federated_reserve_slot(REF, day, SLOT, "10:00", "11:00", deployment_name="UCLA",
677
688
  device_name="Pluto SDR", device_handle="PlutoA")
678
689
  assert _row(lines, "PlutoA@ucla", *WHEN)
679
- assert _row(lines, "Token", f"{RFG}@ucla") and _row(lines, "Handle", "PlutoA@ucla")
680
- assert any(line.startswith("│ Token rfg_") for line in lines) # lines up with "Handle "
690
+ assert _row(lines, "Token", TOKEN) and _row(lines, "Handle", "PlutoA@ucla") # bare, no @ucla
691
+ assert any(line.startswith(f"│ Token {TOKEN}") for line in lines) # lines up with "Handle "
681
692
  assert any("logged in to RemoteRF Global" in line for line in lines)
682
693
  # A display name that is not the lab's slug: the bare token, which works
683
694
  # as is, and no handle (it needs @<slug> to route).
@@ -685,7 +696,7 @@ def test_a_global_reservation_shows_the_token_and_the_handle(monkeypatch):
685
696
  client_app._federated_reserve_slot(REF, day, SLOT, "10:00", "11:00", deployment_name="UCLA Lab",
686
697
  device_name="Pluto SDR", device_handle="PlutoA")
687
698
  assert _row(lines, "PlutoA@UCLA", "Lab", *WHEN)
688
- assert _row(lines, "Token", RFG) and not any("Handle" in line for line in lines)
699
+ assert _row(lines, "Token", TOKEN) and not any("Handle" in line for line in lines)
689
700
  assert not any("has no handle" in line for line in lines)
690
701
  assert "Its handle PlutoA can't be used from here: this deployment's Global name is unknown" in _text(lines)
691
702
 
@@ -88,14 +88,15 @@ def test_non_device_calls_and_REMOTERF_DIRECT_0_stay_on_the_relay(fresh, monkeyp
88
88
  assert FakePath.instances == [] and fresh.device_rpc.call_count == 2
89
89
 
90
90
 
91
- def test_an_rfg_token_signals_with_the_token_and_no_bearer(fresh, monkeypatch):
91
+ @pytest.mark.parametrize("token, dep", [(RFG, DEST), ("k3v9qlw2mxb7", None)])
92
+ def test_a_global_token_signals_with_the_token_and_no_bearer(fresh, monkeypatch, token, dep):
92
93
  monkeypatch.setattr(grpc_client, "federated_backend", Mock(side_effect=AssertionError("no login")))
93
- route = grpc_client.DeviceRoute(RFG, "global", deployment_id=DEST)
94
+ route = grpc_client.DeviceRoute(token, "global", deployment_id=dep)
94
95
  grpc_client._federated_call(route, "pluto:rx_lo:GET", {"a": map_arg("")})
95
96
  path = FakePath.instances[0]
96
- assert path.memo == DEST
97
+ assert path.memo == (dep or token)
97
98
  assert path.offer({"id": "x"}) == PIN
98
- fresh.device_direct.assert_called_once_with(RFG, DEST, json.dumps({"id": "x"}))
99
+ fresh.device_direct.assert_called_once_with(token, dep, json.dumps({"id": "x"}))
99
100
 
100
101
 
101
102
  @pytest.mark.parametrize("code, unavailable", [
@@ -133,6 +133,9 @@ def test_device_direct_posts_bearer_or_token_body():
133
133
  assert kwargs["data"] == {"token": rfg, "deployment_id": DEST, "ice": "OFFER"} and "access" not in kwargs
134
134
  backend.device_direct(rfg, None, "OFFER")
135
135
  assert transport.request.call_args.kwargs["data"] == {"token": rfg, "ice": "OFFER"}
136
+ backend.device_direct("k3v9qlw2mxb7", None, "OFFER") # Global's bare token
137
+ kwargs = transport.request.call_args.kwargs
138
+ assert kwargs["data"] == {"token": "k3v9qlw2mxb7", "ice": "OFFER"} and "access" not in kwargs
136
139
 
137
140
  for bad in ({"provenance": "home", "ice": "x"}, {"provenance": "destination"}, {"provenance": "destination", "ice": 1}):
138
141
  transport.request.return_value = bad
@@ -183,6 +186,37 @@ def test_refresh_never_posts_a_token_another_process_spent():
183
186
  assert not transport.request.called and backend.credentials is None
184
187
 
185
188
 
189
+ def test_account_calls_outwait_a_global_restart(monkeypatch):
190
+ # Caddy holds a request for up to 45 s while Global restarts: a refresh waits past
191
+ # that (an ambiguous timeout would clear the login), other account calls 20 s.
192
+ from remoterf.deployment import http
193
+
194
+ backend, transport = _backend("ACC:refresh_session")
195
+ backend.credentials = {"access_token": "old", "refresh_token": "r1", "access_expires_at": 0, "subject_id": HOME}
196
+ backend.store.load.return_value = backend.credentials
197
+ transport.request.return_value = {
198
+ "deployment_id": HOME, "subject_id": HOME, "username": "jdoe", "access_token": "new", "refresh_token": "r2",
199
+ "token_type": "Bearer", "access_expires_at": 10**12, "refresh_expires_at": 10**12}
200
+ assert backend._access() == "new"
201
+ assert transport.request.call_args.kwargs["overall_timeout"] == 50.0
202
+
203
+ seen = {}
204
+
205
+ class Stop(Exception):
206
+ pass
207
+
208
+ def stream(*args, **kwargs):
209
+ seen["timeout"] = kwargs["timeout"]
210
+ raise Stop
211
+
212
+ client = Mock()
213
+ client.stream.side_effect = stream
214
+ monkeypatch.setattr(http.httpx, "Client", lambda **kwargs: client)
215
+ with pytest.raises(Stop):
216
+ http.JsonTransport("https://home.example").request("GET", "/me")
217
+ assert seen["timeout"].read == 20.0
218
+
219
+
186
220
  def test_https_keeps_an_idle_connection_for_a_minute(monkeypatch):
187
221
  from remoterf.deployment import http
188
222
 
@@ -85,7 +85,7 @@ class Home:
85
85
  "destinations": [{"deployment_id": DEP, "display_name": "ucla", "status": "ok"}]}
86
86
 
87
87
  def reserve(self, device_id, start, end):
88
- return {"reservation_id": f"{DEP}:10", "device_id": device_id, "token": "rfg_abc"}
88
+ return {"reservation_id": f"{DEP}:10", "device_id": device_id, "token": "k3v9qlw2mxb7"}
89
89
 
90
90
  def cancel(self, rid):
91
91
  return True
@@ -233,7 +233,7 @@ def test_lab_reserve_finds_its_id_when_the_lab_is_in_another_zone(lab, monkeypat
233
233
 
234
234
  def test_global_reserve_and_reservations(home):
235
235
  out = ops.reserve(home, "Pluto_01@ucla", "2026-03-02T15:00:00Z", "2026-03-02T15:30:00Z", reveal_token=True)
236
- assert (out["reservation_id"], out["token"], out["use_as_token"]) == (f"{DEP}:10", "rfg_abc@ucla", "Pluto_01@ucla")
236
+ assert (out["reservation_id"], out["token"], out["use_as_token"]) == (f"{DEP}:10", "k3v9qlw2mxb7", "Pluto_01@ucla") # bare, no @ucla
237
237
  assert out["start"] == "2026-03-02T15:00:00Z"
238
238
  rows = ops.list_reservations(home)["reservations"]
239
239
  assert [(r["handle"], r["device"], r["deployment"], r["start"], r["mine"]) for r in rows] == [
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes