solari-runloop-compat 0.2.8__tar.gz → 0.2.10__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 (55) hide show
  1. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/COMPAT.md +2 -0
  2. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/PKG-INFO +2 -2
  3. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/pyproject.toml +2 -2
  4. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/__init__.py +1 -1
  5. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/_gateway.py +34 -14
  6. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/_mapping.py +10 -0
  7. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/.gitignore +0 -0
  8. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/LICENSE +0 -0
  9. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/NOTICE +0 -0
  10. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/README.md +0 -0
  11. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/_branding.py +0 -0
  12. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/_client.py +0 -0
  13. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/_config.py +0 -0
  14. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/_context.py +0 -0
  15. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/_dockerfile.py +0 -0
  16. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/_exceptions.py +0 -0
  17. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/_loop.py +0 -0
  18. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/_models.py +0 -0
  19. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/_options.py +0 -0
  20. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/_redact.py +0 -0
  21. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/_resources.py +0 -0
  22. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/_sync.py +0 -0
  23. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/_types.py +0 -0
  24. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/_vendor_user.py +0 -0
  25. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/lib/__init__.py +0 -0
  26. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/lib/polling.py +0 -0
  27. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/pagination.py +0 -0
  28. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/sdk.py +0 -0
  29. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/__init__.py +0 -0
  30. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/blueprint_build_log.py +0 -0
  31. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/blueprint_build_logs_list_view.py +0 -0
  32. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/blueprint_build_parameters.py +0 -0
  33. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/blueprint_list_view.py +0 -0
  34. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/blueprint_view.py +0 -0
  35. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/devbox_async_execution_detail_view.py +0 -0
  36. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/devbox_execution_detail_view.py +0 -0
  37. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/devbox_snapshot_list_view.py +0 -0
  38. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/devbox_snapshot_view.py +0 -0
  39. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/devbox_view.py +0 -0
  40. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/devboxes/__init__.py +0 -0
  41. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/devboxes/devbox_logs_list_view.py +0 -0
  42. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/devboxes/devbox_snapshot_async_status_view.py +0 -0
  43. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/devboxes/execution_update_chunk.py +0 -0
  44. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/object_download_url_view.py +0 -0
  45. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/object_view.py +0 -0
  46. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/secret_list_view.py +0 -0
  47. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/secret_view.py +0 -0
  48. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/shared/__init__.py +0 -0
  49. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/shared/after_idle.py +0 -0
  50. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/shared/code_mount_parameters.py +0 -0
  51. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/shared/launch_parameters.py +0 -0
  52. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/shared/lifecycle_configuration.py +0 -0
  53. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/shared/lifecycle_hooks.py +0 -0
  54. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/shared/resume_triggers.py +0 -0
  55. {solari_runloop_compat-0.2.8 → solari_runloop_compat-0.2.10}/solari_runloop/types/tunnel_view.py +0 -0
@@ -63,6 +63,7 @@ exactly Runloop's parameters. Details that differ from what the old signatures l
63
63
  - `executions.kill(kill_process_group=True)` and `send_std_in(signal="EOF")` raise (Solari kills the command, and a command handle cannot close stdin); `send_std_in(signal="INTERRUPT")` sends SIGINT to the command. `stream_*_updates` yields the output so far from `offset` and then what the command prints, until it exits (an iterator of `ExecutionUpdateChunk`; it takes no `timeout`).
64
64
  - `attach_stdin` on `execute_async` / `exec_async` is satisfied (the control channel can always be written to with `send_std_in`).
65
65
  - `shutdown(force=True)` is satisfied (Solari's shutdown always shuts down).
66
+ - A resource that does not exist raises `NotFoundError`, as in Runloop: `shutdown` and `get_tunnel` of an unknown devbox, and `snapshot.delete` / `disk_snapshots.delete` of an unknown snapshot (it used to return `{}` or a made-up view). A snapshot delete that the gateway finishes over several passes still ends quietly when a later pass finds it gone.
66
67
  - `list(include_total_count=True)` counts every matching devbox (it follows all pages); without it `total_count` is `None`. A `status` with no Solari state behind it (`failure`, `suspending`, `resuming`) raises instead of returning an empty list.
67
68
  - `list_disk_snapshots` / `disk_snapshots.list`: `devbox_id`, `source_devbox_id`, `limit`, `starting_after`, `name`, `source_blueprint_id` (the snapshot's template) and `include_total_count` are honoured; `total_count` is `None` when more pages exist and the count was not asked for, and when `starting_after` is used. `metadata_key` / `metadata_key_in` raise (Solari cannot filter by metadata).
68
69
  - `retrieve_resource_usage`, `create_ssh_key`, `create_pty_tunnel`, `create_gateway_token`, `create_mcp_token`, `watch_evictions`, `blueprints.preview`: NO, `SolariCompatUnsupported` naming the method. `client.accounts`, `agents`, `axons` (and `axons.events`, `axons.sql`), `apikeys`, `restricted_keys`, `pty`, `network_policies`, `gateway_configs`, `mcp_configs`, `objects`: NO at any depth. `with_raw_response` / `with_streaming_response`: NO.
@@ -160,6 +161,7 @@ Last run 2026-10-21 against the F15 integration build `desktop-gateway:staging-1
160
161
  Here, Runloop sandboxes run as `user` in `/home/user`; commands, code and files all start there, and relative paths resolve against it. This package
161
162
  asks the gateway for exactly that at create time (`user: "user"`, `cwd: "/home/user"`; the gateway creates the user at first boot with passwordless
162
163
  sudo). Restores from a snapshot keep the snapshot's own user.
164
+ - **File calls act as that user.** `files.*` / `fs.*` run with the sandbox user's permissions (not root): `/etc/shadow` is refused with `permission denied`, a write under `/etc` fails, and a file you create is owned by the user. Guest images built before this fix still ran them as root.
163
165
  - **Gateway that predates `user` / `cwd`** (it answers 400 naming them, or ignores them): the plain create is used and the sandbox runs as **root in
164
166
  `/home/root`**, which is what this package did before. Check `whoami` if code depends on it.
165
167
  - **Template or snapshot made before user support** (the server answers 400 naming `user`): the plain create is used, the sandbox runs as **root**, and one warning says so. Rebuild templates and snapshots to get the vendor user.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: solari-runloop-compat
3
- Version: 0.2.8
3
+ Version: 0.2.10
4
4
  Summary: Runloop-compatible Python interface over Solari Sandboxes. Not affiliated with Runloop.
5
5
  Project-URL: Homepage, https://getsolari.com
6
6
  Author: Solari
@@ -10,7 +10,7 @@ License-File: NOTICE
10
10
  Keywords: compatibility,runloop,sandbox,solari
11
11
  Requires-Python: >=3.9
12
12
  Requires-Dist: pydantic<3,>=2
13
- Requires-Dist: solari-core>=0.4.0
13
+ Requires-Dist: solari-core>=0.7.11
14
14
  Requires-Dist: solari-sandbox>=0.6.1
15
15
  Provides-Extra: test
16
16
  Requires-Dist: pytest-asyncio>=0.23; extra == 'test'
@@ -4,14 +4,14 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "solari-runloop-compat"
7
- version = "0.2.8"
7
+ version = "0.2.10"
8
8
  description = "Runloop-compatible Python interface over Solari Sandboxes. Not affiliated with Runloop."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
11
11
  license = { text = "MIT" }
12
12
  authors = [{ name = "Solari" }]
13
13
  keywords = ["solari", "sandbox", "runloop", "compatibility"]
14
- dependencies = ["solari-sandbox>=0.6.1", "solari-core>=0.4.0", "pydantic>=2,<3"]
14
+ dependencies = ["solari-sandbox>=0.6.1", "solari-core>=0.7.11", "pydantic>=2,<3"]
15
15
 
16
16
  [project.optional-dependencies]
17
17
  test = ["pytest>=7", "pytest-asyncio>=0.23"]
@@ -33,7 +33,7 @@ from ._types import NOT_GIVEN, NoneType, NotGiven, Omit, Timeout, not_given, omi
33
33
  from .lib.polling import PollingConfig, PollingTimeout
34
34
  from .sdk import AsyncRunloopSDK, RunloopSDK
35
35
 
36
- __version__ = "0.2.8"
36
+ __version__ = "0.2.10"
37
37
  Client = Runloop
38
38
  AsyncClient = AsyncRunloop
39
39
 
@@ -307,10 +307,8 @@ class Gateway:
307
307
  pass
308
308
 
309
309
  async def shutdown(self, devbox_id: str) -> DevboxView:
310
- try:
311
- raw = await self.get_raw(devbox_id)
312
- except ex.NotFoundError:
313
- raw = {"sandboxId": devbox_id, "state": "gone", "metadata": {}}
310
+ # A devbox that does not exist is a NotFoundError (the gateway's DELETE of an unknown id answers ok, so it cannot tell).
311
+ raw = await self.get_raw(devbox_id)
314
312
  await self._req("DELETE", f"/sandboxes/{_q(devbox_id)}")
315
313
  await self._drop_handle(devbox_id)
316
314
  raw = dict(raw, state="gone")
@@ -542,14 +540,30 @@ class Gateway:
542
540
  log.exception("streaming output of %s failed", eid)
543
541
  rec.flush()
544
542
 
543
+ #: How long a durable execution's watcher keeps asking while the devbox cannot answer (suspended, restarting, a pod
544
+ #: change) before it gives up; the process may well still be running, so this is NOT a verdict about it.
545
+ REMOTE_WATCH_PATIENCE_S = 600.0
546
+
545
547
  async def _remote_watch(self, rec: _Exec) -> None:
546
- try:
547
- final = await self.remote_wait(rec.devbox_id, rec.execution_id)
548
- rec.exit_code = final.exit_status
549
- rec.stdout, rec.stderr = [final.stdout or ""], [final.stderr or ""]
550
- rec.truncated = (bool(final.stdout_truncated), bool(final.stderr_truncated))
551
- except Exception as e: # noqa: BLE001
552
- rec.error = e if isinstance(e, ex.APIError) else ex.APIError(str(e), None, body=None)
548
+ deadline = time.monotonic() + self.REMOTE_WATCH_PATIENCE_S
549
+ delay = 0.5
550
+ while True:
551
+ try:
552
+ final = await self.remote_wait(rec.devbox_id, rec.execution_id)
553
+ rec.exit_code = final.exit_status
554
+ rec.stdout, rec.stderr = [final.stdout or ""], [final.stderr or ""]
555
+ rec.truncated = (bool(final.stdout_truncated), bool(final.stderr_truncated))
556
+ break
557
+ except Exception as e: # noqa: BLE001
558
+ # A wait that cannot be answered right now (the devbox is suspended: 409; connection or 5xx while it resumes) says
559
+ # nothing about the command: reading "completed" here told callers a process that was still alive had finished.
560
+ transient = isinstance(e, (ex.ConflictError, ex.APIConnectionError, ex.InternalServerError, ex.RateLimitError))
561
+ if transient and time.monotonic() < deadline:
562
+ await asyncio.sleep(delay)
563
+ delay = min(delay * 2, 10.0)
564
+ continue
565
+ rec.error = e if isinstance(e, ex.APIError) else ex.APIError(str(e), None, body=None)
566
+ break
553
567
  rec.status = "completed"
554
568
  rec.done.set() # type: ignore[union-attr]
555
569
 
@@ -1032,12 +1046,15 @@ class Gateway:
1032
1046
  {ok: false, status: "deleting"} and keeps the row until a retry finishes. Repeat the same DELETE (bounded, with backoff)."""
1033
1047
  end = time.monotonic() + max_seconds
1034
1048
  pause = 1.0
1049
+ repeat = False
1035
1050
  while True:
1036
1051
  try:
1037
1052
  reply = await self._req("DELETE", f"/snapshots/{_q(snapshot_id)}")
1038
1053
  except ex.NotFoundError:
1054
+ if not repeat:
1055
+ raise # there is no such snapshot
1039
1056
  self._deleted_snapshots.add(snapshot_id)
1040
- return # already gone
1057
+ return # a 404 after a 202 "deleting": the earlier pass finished
1041
1058
  if not (isinstance(reply, dict) and (reply.get("ok") is False or reply.get("status") == "deleting")):
1042
1059
  self._deleted_snapshots.add(snapshot_id)
1043
1060
  return
@@ -1045,6 +1062,7 @@ class Gateway:
1045
1062
  raise ex.RunloopError(f"snapshot {snapshot_id} is still being deleted after {max_seconds:.0f}s: {str(reply.get('error', ''))[:120]}")
1046
1063
  await asyncio.sleep(pause)
1047
1064
  pause = min(pause * 2, 5.0)
1065
+ repeat = True
1048
1066
 
1049
1067
  # --- blueprints (templates) -----------------------------------------------------------
1050
1068
 
@@ -1308,8 +1326,10 @@ class Gateway:
1308
1326
  async def tunnel_get(self, devbox_id: str) -> Any:
1309
1327
  try:
1310
1328
  d = await self._tunnel_call(devbox_id, "GET")
1311
- except ex.NotFoundError:
1312
- return None # no tunnel enabled: Runloop's get_tunnel returns None
1329
+ except ex.NotFoundError as e:
1330
+ if isinstance(e.body, dict) and e.body.get("code") == "TunnelNotEnabled":
1331
+ return None # no tunnel enabled: Runloop's get_tunnel returns None
1332
+ raise # a devbox that does not exist
1313
1333
  if d is None:
1314
1334
  return await self.tunnel_view(devbox_id)
1315
1335
  return self._tunnel_obj(d)
@@ -54,6 +54,10 @@ def resolve_size(lp: Optional[Dict[str, Any]]) -> Tuple[Optional[int], Optional[
54
54
  elif size == "CUSTOM_SIZE" or lp.get("custom_cpu_cores") or lp.get("custom_gb_memory"):
55
55
  cpu_f = lp.get("custom_cpu_cores")
56
56
  mem_gib = lp.get("custom_gb_memory")
57
+ if size and size != "CUSTOM_SIZE" and (lp.get("custom_cpu_cores") or lp.get("custom_gb_memory")):
58
+ # Same refusal as the TypeScript package: a named size and an explicit core / memory count disagree, and silently
59
+ # taking the named size dropped what the caller asked for.
60
+ raise ex.BadRequestError(f"custom_cpu_cores / custom_gb_memory need resource_size_request CUSTOM_SIZE (or none), not {size!r}", status_code=400)
57
61
  cpu = max(1, math.ceil(cpu_f)) if cpu_f else None
58
62
  mem_mb = int(mem_gib * 1024) if mem_gib else None
59
63
  if cpu is not None and cpu > SOLARI_MAX_VCPU:
@@ -438,6 +442,12 @@ def map_error(exc: BaseException) -> BaseException:
438
442
  out3 = ex.APIConnectionError(exc.message)
439
443
  out3.__cause__ = exc
440
444
  return out3
445
+ # A file or directory that does not exist is Runloop's 404, not a bare APIError: the guest answers the RPC with "open <path>: no such file
446
+ # or directory" and no code (fs.download / fs.list / fs.stat ...).
447
+ if isinstance(exc, core_errors.ActionError) and str(getattr(exc, "method", "")).startswith("fs.") and "no such file or directory" in exc.message.lower():
448
+ nf = ex.NotFoundError(exc.message, body={"message": exc.message})
449
+ nf.__cause__ = exc
450
+ return nf
441
451
  if isinstance(exc, core_errors.SolariError):
442
452
  out4 = ex.APIError(exc.message, None, body=None)
443
453
  out4.__cause__ = exc