sequence-ai 0.67.2__tar.gz → 0.67.3__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 (142) hide show
  1. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/PKG-INFO +2 -2
  2. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/pyproject.toml +2 -2
  3. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/cli_parser.py +29 -6
  4. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/__init__.py +5 -5
  5. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/dataset.py +5 -6
  6. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/transport.py +7 -6
  7. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/worker_link.py +61 -10
  8. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/errors.py +1 -13
  9. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/.gitignore +0 -0
  10. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/LICENSE +0 -0
  11. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/NOTICE +0 -0
  12. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/README.md +0 -0
  13. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/THIRD_PARTY_NOTICES.md +0 -0
  14. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/__init__.py +0 -0
  15. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/__main__.py +0 -0
  16. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/_account.py +0 -0
  17. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/_http.py +0 -0
  18. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/_partial.py +0 -0
  19. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/base.py +0 -0
  20. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/cli.py +0 -0
  21. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/cli_json.py +0 -0
  22. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/clock.py +0 -0
  23. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/columns.py +0 -0
  24. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/discover.py +0 -0
  25. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/errors.py +0 -0
  26. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/image.py +0 -0
  27. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/loading.py +0 -0
  28. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/named.py +0 -0
  29. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/params.py +0 -0
  30. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/policy.py +0 -0
  31. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/project_files.py +0 -0
  32. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/registry.py +0 -0
  33. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/safe_path.py +0 -0
  34. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/safety.py +0 -0
  35. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/secret.py +0 -0
  36. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/serve_local.py +0 -0
  37. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/source.py +0 -0
  38. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/template_fetch.py +0 -0
  39. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/volume.py +0 -0
  40. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/weights.py +0 -0
  41. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq/weights_get.py +0 -0
  42. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/seq_launch.py +0 -0
  43. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/__init__.py +0 -0
  44. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/act_size.py +0 -0
  45. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/blocks.py +0 -0
  46. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/capacity.py +0 -0
  47. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/catalogue.py +0 -0
  48. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/compress.py +0 -0
  49. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/connect_trace.py +0 -0
  50. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/direct.py +0 -0
  51. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/direct_episode.py +0 -0
  52. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/direct_observe.py +0 -0
  53. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/encode.py +0 -0
  54. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/error_codes.py +0 -0
  55. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/error_report.py +0 -0
  56. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/gil.py +0 -0
  57. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/heartbeat.py +0 -0
  58. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/hosted_frame.py +0 -0
  59. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/late.py +0 -0
  60. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/latency_stats.py +0 -0
  61. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/lines_stream.py +0 -0
  62. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/marked_observe.py +0 -0
  63. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/mock_gate.py +0 -0
  64. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/money.py +0 -0
  65. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/msgpack_io.py +0 -0
  66. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/names.py +0 -0
  67. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/notice_words.py +0 -0
  68. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/observe_stream.py +0 -0
  69. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/outside.py +0 -0
  70. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/own_server.py +0 -0
  71. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/pinned_tls.py +0 -0
  72. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/plugins.py +0 -0
  73. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/recorder.py +0 -0
  74. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/reporting.py +0 -0
  75. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/rid.py +0 -0
  76. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/seat.py +0 -0
  77. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/server_token.py +0 -0
  78. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/signin.py +0 -0
  79. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/stale.py +0 -0
  80. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/warn.py +0 -0
  81. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/wifi_power.py +0 -0
  82. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/worker_stream.py +0 -0
  83. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/_core/worker_transport.py +0 -0
  84. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/act/__init__.py +0 -0
  85. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/act/policy.py +0 -0
  86. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/act/types.py +0 -0
  87. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/act/waits.py +0 -0
  88. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/chat/__init__.py +0 -0
  89. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/chat/content.py +0 -0
  90. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/chat/conversation.py +0 -0
  91. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/chat/infer.py +0 -0
  92. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/chat/servers.py +0 -0
  93. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/chat/types.py +0 -0
  94. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/check.py +0 -0
  95. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/__init__.py +0 -0
  96. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/adapter.py +0 -0
  97. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/batcher.py +0 -0
  98. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/cfg_parallel.py +0 -0
  99. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/compiled.py +0 -0
  100. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/convert.py +0 -0
  101. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/cuda_graphs.py +0 -0
  102. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/data_plane.py +0 -0
  103. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/episodes.py +0 -0
  104. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/failed.py +0 -0
  105. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/fp8.py +0 -0
  106. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/fused.py +0 -0
  107. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/kept.py +0 -0
  108. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/load.py +0 -0
  109. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/obs_format.py +0 -0
  110. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/optimize.py +0 -0
  111. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/owned.py +0 -0
  112. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/pipeline_parallel.py +0 -0
  113. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/plan_clock.py +0 -0
  114. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/ranks.py +0 -0
  115. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/record.py +0 -0
  116. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/recorder.py +0 -0
  117. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/replicas.py +0 -0
  118. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/robot_view.py +0 -0
  119. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/serve.py +0 -0
  120. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/slack.py +0 -0
  121. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/split_trials.py +0 -0
  122. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/stack.py +0 -0
  123. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/stream.py +0 -0
  124. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/stream_intake.py +0 -0
  125. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/thumbnails.py +0 -0
  126. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/engine/xla.py +0 -0
  127. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/markers.py +0 -0
  128. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/network/__init__.py +0 -0
  129. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/network/_warn.py +0 -0
  130. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/network/bind.py +0 -0
  131. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/network/frames.py +0 -0
  132. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/network/latency_stats.py +0 -0
  133. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/network/loop.py +0 -0
  134. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/network/msgpack_io.py +0 -0
  135. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/network/one_write.py +0 -0
  136. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/network/ping.py +0 -0
  137. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/network/record.py +0 -0
  138. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/network/tcp_link.py +0 -0
  139. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/network/websocket.py +0 -0
  140. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/network/wifi_power.py +0 -0
  141. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/network/window.py +0 -0
  142. {sequence_ai-0.67.2 → sequence_ai-0.67.3}/sequence_ai/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sequence-ai
3
- Version: 0.67.2
3
+ Version: 0.67.3
4
4
  Summary: SequenceLink is an open-source framework for serving robot policies from remote GPUs over wide-area networks (WANs).
5
5
  Project-URL: Homepage, https://generalsequences.com
6
6
  Project-URL: Documentation, https://generalsequences.com/docs/
@@ -34,7 +34,7 @@ Requires-Dist: numpy>=1.24
34
34
  Requires-Dist: pillow>=10
35
35
  Requires-Dist: pydantic>=2; python_version >= '3.10'
36
36
  Requires-Dist: sequence-base<0.9,>=0.8.15; python_version >= '3.10'
37
- Requires-Dist: sequence-cloud~=0.67.2; python_version >= '3.10' and platform_python_implementation == 'CPython' and (sys_platform == 'darwin' or (sys_platform == 'linux' and (platform_machine == 'x86_64' or platform_machine == 'aarch64')) or (sys_platform == 'win32' and platform_machine == 'AMD64'))
37
+ Requires-Dist: sequence-cloud~=0.67.3; python_version >= '3.10' and platform_python_implementation == 'CPython' and (sys_platform == 'darwin' or (sys_platform == 'linux' and (platform_machine == 'x86_64' or platform_machine == 'aarch64')) or (sys_platform == 'win32' and platform_machine == 'AMD64'))
38
38
  Requires-Dist: uvicorn<1,>=0.30
39
39
  Requires-Dist: zstandard>=0.22; python_version < '3.15'
40
40
  Provides-Extra: data
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "sequence-ai"
7
- version = "0.67.2"
7
+ version = "0.67.3"
8
8
  description = "SequenceLink is an open-source framework for serving robot policies from remote GPUs over wide-area networks (WANs)."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -34,7 +34,7 @@ dependencies = [
34
34
  "httpx>=0.24,<1",
35
35
  "pydantic>=2; python_version >= '3.10'",
36
36
  "sequence-base>=0.8.15,<0.9; python_version >= '3.10'",
37
- "sequence-cloud~=0.67.2; python_version >= '3.10' and platform_python_implementation == 'CPython' and (sys_platform == 'darwin' or (sys_platform == 'linux' and (platform_machine == 'x86_64' or platform_machine == 'aarch64')) or (sys_platform == 'win32' and platform_machine == 'AMD64'))",
37
+ "sequence-cloud~=0.67.3; python_version >= '3.10' and platform_python_implementation == 'CPython' and (sys_platform == 'darwin' or (sys_platform == 'linux' and (platform_machine == 'x86_64' or platform_machine == 'aarch64')) or (sys_platform == 'win32' and platform_machine == 'AMD64'))",
38
38
  "pillow>=10",
39
39
  "uvicorn>=0.30,<1",
40
40
  "numpy>=1.24",
@@ -42,10 +42,27 @@ _SAME = {"delete": "rm", "remove": "rm", "list": "ls"}
42
42
 
43
43
 
44
44
 
45
- _CLOUD_COMMANDS = frozenset(("deploy eval policy robot key benchmark adapter volume secret login logout profile "
45
+ _CLOUD_COMMANDS = frozenset(("deploy eval policy key benchmark adapter volume secret login logout profile "
46
46
  "audit models gpus gpu account billing storage usage").split())
47
47
 
48
48
 
49
+
50
+
51
+
52
+ _REMOVED = {
53
+ "robots": "Robots and their keys were removed from the platform: connect to a policy with your account's API key.",
54
+ "recording": "Recording was removed from the platform.",
55
+ "follow": "GPU follow was removed from the platform: set the addresses a GPU lets in with its allow list "
56
+ "(PUT /v1/gpus/{id}/allow).",
57
+ "benchmarks": "Registering your own benchmark was removed from the platform: evaluate your policy on the "
58
+ "platform's benchmarks.",
59
+ }
60
+
61
+ _GONE = {"robot": "robots", "record": "recording", "gpu follow": "follow", "gpu follow-token": "follow",
62
+ **{f"benchmark {verb}": "benchmarks" for verb in (
63
+ "register", "create", "upgrade", "source", "logs", "shell", "status", "cancel", "rm")}}
64
+
65
+
49
66
  def _meant(prog: str, value: str, choices: list[str]) -> list[str]:
50
67
  """The one or two commands `prog value` most likely meant: another name for one of `choices`, a command elsewhere
51
68
  the word names, else the nearest spellings among `choices`; none when nothing is near."""
@@ -89,7 +106,12 @@ class _Parser(argparse.ArgumentParser):
89
106
 
90
107
  def _check_value(self, action: argparse.Action, value: Any) -> None:
91
108
  if isinstance(action, argparse._SubParsersAction) and value not in action.choices:
92
- if self.prog == PROG and value in _CLOUD_COMMANDS:
109
+ gone = _GONE.get(f"{self.prog[len(PROG):]} {value}".strip())
110
+ if gone is not None:
111
+
112
+ self.exit(2, f"error[invalid_request]: `{self.prog} {value}` is no command: {_REMOVED[gone]}\n")
113
+ if self.prog == PROG and value in _CLOUD_COMMANDS and not loaded("seq.commands"):
114
+
93
115
 
94
116
  self.exit(2, f"error[invalid_request]: {needs_cloud(f'`{PROG} {value}`')}\n")
95
117
  meant = _meant(self.prog, value, list(action.choices))
@@ -246,10 +268,11 @@ def build_parser() -> argparse.ArgumentParser:
246
268
 
247
269
  dsub = _group(ap, sub, "data", "A robot's recordings on this machine as a dataset.")
248
270
  p = dsub.add_parser("export", help="a robot's recordings as a LeRobot v3.0 dataset, or JSON lines",
249
- description="Write the recordings named - .msgpack files, or folders of them, that `sequence "
250
- "robot record` wrote - as one LeRobot v3.0 dataset: a frame for every step "
251
- "observed, each camera an image column, every other number an array, the action "
252
- "each step was given, each episode's instruction its task and its label "
271
+ description="Write the recordings named - .msgpack files, or folders of them, that a recorder "
272
+ "of your own policy server saved (python -m sequence_ai.network.record) - as one "
273
+ "LeRobot v3.0 dataset: a frame for every step observed, each camera an image "
274
+ "column, every other number an array, the action each step was given, each "
275
+ "episode's instruction its task and its label "
253
276
  "next.success. --format jsonl writes every item as a line of JSON instead, a file "
254
277
  "a recording. The LeRobot format needs pyarrow: pip install 'sequence-ai[data]'.")
255
278
  p.add_argument("recordings", nargs="+", help="the recordings: .msgpack files, or folders holding them")
@@ -51,8 +51,8 @@ checking and an e-stop belong between this library and your motors. connect(on_s
51
51
  the moment the arm runs out of answer, so that you can hold it; it is no emergency stop, which stays physical.
52
52
 
53
53
  ── On GS's platform ──────────────────────────────────────────────────
54
- A deployment by its name - connect("my_policy_user") - the platform's recorder, models - text to speech and speech to
55
- text among them, speech() and transcribe() - your account, GPUs, billing and usage are
54
+ A deployment by its name - connect("my_policy_user") - models - text to speech and speech to text among them, speech()
55
+ and transcribe() - your account, GPUs, billing and usage are
56
56
  sequence-cloud's, GS's client for its platform, which `pip install sequence-ai` installs with it on Python 3.10 or
57
57
  later, your key in SEQUENCES_API_KEY.
58
58
  """
@@ -377,9 +377,9 @@ def _name_of(url: str) -> str:
377
377
 
378
378
  def read_record(path: str) -> Iterator[dict[str, Any]]:
379
379
  """
380
- The items a recording file holds - what `seq robot record` wrote - in order, each as Recorder.steps() gave it: one
381
- msgpack map after another, which any msgpack reader reads too (its first map the file's header, "kind"
382
- "recording"). Read a chunk at a time, so a file of hours is never held whole.
380
+ The items a recording file holds - what a recorder saved (sequence_ai.network.record.save) - in order, each as
381
+ Recorder.steps() gave it: one msgpack map after another, which any msgpack reader reads too (its first map the
382
+ file's header, "kind" "recording"). Read a chunk at a time, so a file of hours is never held whole.
383
383
  """
384
384
  from ._core import recorder as _recorder
385
385
 
@@ -1,7 +1,7 @@
1
1
  """
2
2
  A robot's steps as a dataset: LeRobot v3.0, or every field kept as it was (JSON lines). What `seq data export` writes
3
- from recordings of your own - `seq robot record`'s files - and what sequence-cloud's `seq policy data export` writes
4
- from what it downloads of a deployment's.
3
+ from recordings of your own - the files a policy server of your own's recorder saved (sequence_ai.network.record.save) -
4
+ and what sequence-cloud's `seq policy data export` writes from what it downloads of a deployment's.
5
5
 
6
6
  In one sentence: each recording's items, read in order (sequence_ai.read_record) → episodes_of: by episode, each
7
7
  observation an "observe" row and each act's answer an "act" row placed by its step, each label its episode's →
@@ -571,8 +571,7 @@ def episodes_of(items: Iterable[dict]) -> tuple[dict[str, list[dict]], dict[str,
571
571
 
572
572
 
573
573
  def recordings(paths: Iterable[str]) -> list[str]:
574
- """Each recording a path names: a file as it is, a folder's *.msgpack files in name order - which a robot names by
575
- its name and when it began (seq robot record: <robot>-<when>.msgpack)."""
574
+ """Each recording a path names: a file as it is, a folder's *.msgpack files in name order."""
576
575
  out: list[str] = []
577
576
  for path in paths:
578
577
  if os.path.isdir(path):
@@ -582,8 +581,8 @@ def recordings(paths: Iterable[str]) -> list[str]:
582
581
  else:
583
582
  raise InvalidRequest(f"{path}: no such file or folder")
584
583
  if not out:
585
- raise InvalidRequest(f"no recording in {', '.join(paths)}: a recording is a .msgpack file `seq robot record` "
586
- "wrote")
584
+ raise InvalidRequest(f"no recording in {', '.join(paths)}: a recording is a .msgpack file a recorder saved "
585
+ "(sequence_ai.network.record.save)")
587
586
  return out
588
587
 
589
588
 
@@ -147,14 +147,15 @@ def read_again_wait(response: httpx.Response) -> Optional[float]:
147
147
 
148
148
 
149
149
  def _no_key(login: bool, robot_of: Optional[str]) -> str:
150
- """What a call with no key is told: a robot's (connect(), `robot_of` the policy it connects to), how its robot key is
151
- made - a robot never uses your seq login sign-in; any other, where a key is set or made.
152
-
150
+ """What a call with no key is told: a robot's (connect(), `robot_of` the policy it connects to), that it connects
151
+ with the account's API key - a robot never uses your seq login sign-in; any other, where a key is
152
+ set or made. (A robot's own key went with robots, #708: the platform says "connect to a policy with your account's
153
+ API key".)
153
154
  """
154
155
  if robot_of:
155
- return ("no API key. A robot connects with its own robot key, which `seq robot create <name>` makes (and "
156
- "prints once): set SEQUENCES_API_KEY to it or pass api_key=... (a seq login sign-in is yours, never a "
157
- "robot's)")
156
+ return ("no API key. A robot connects with your account's API key: set SEQUENCES_API_KEY to it or pass "
157
+ "api_key=... (a seq login sign-in is yours, never a robot's). Create a key at "
158
+ "https://app.generalsequences.com/")
158
159
  return ("no API key. Set SEQUENCES_API_KEY or pass api_key=..." + (", or sign in with seq login" if login else "")
159
160
  + ". Create a key at https://app.generalsequences.com/")
160
161
 
@@ -8,6 +8,7 @@ worker_stream's; the transport's own state - its lock and what is on its way - i
8
8
  """
9
9
  from __future__ import annotations
10
10
 
11
+ import ipaddress
11
12
  import json
12
13
  import logging
13
14
  import socket
@@ -15,7 +16,7 @@ import ssl
15
16
  import threading
16
17
  import time
17
18
  from typing import Any, Callable, Optional
18
- from urllib.parse import urlencode
19
+ from urllib.parse import urlencode, urlsplit
19
20
 
20
21
  import httpx
21
22
 
@@ -70,18 +71,67 @@ def _built_before() -> InvalidRequest:
70
71
  hint="`seq deploy` the same code again")
71
72
 
72
73
 
73
- def _refused(exc: _stream.StreamRefused) -> Optional[Exception]:
74
- """What a robot is told when its stream's upgrade was answered `exc.status`: its secret turned away (AuthError: a new
75
- worker epoch, DirectConnection connects again) - or a proxy's refusal, which reads the same; a worker built before it
76
- took a stream; a worker in front of which something answered for it (5xx: None - a worker not reached, as any); anything
77
- else, a network that lets no WebSocket through."""
74
+
75
+
76
+ _PING_STATUS = frozenset(("not-ready", "failed", "draining", "healthy", "error", "loading"))
77
+ _PING_BESIDE = ("policy", "load_error", "oldest_act_s")
78
+
79
+ _WHO_S = 3.0
80
+
81
+
82
+ def _is_local(host: str) -> bool:
83
+ """Whether `host`, an address's, is this machine's own: localhost, or a loopback address."""
84
+ try:
85
+ return ipaddress.ip_address(host).is_loopback
86
+ except ValueError:
87
+ return host == "localhost"
88
+
89
+
90
+ def _no_worker(base: str, verify: Any) -> Optional[InvalidRequest]:
91
+ """What a robot is told where a program that is no policy worker of Sequence's answers at `base`: asked its GET
92
+ /ping - with no token, whose answer names a worker: 200 for a platform worker's, whoever asks, 401 from serve() - it
93
+ says neither X-Seq-Server, which serve() says on every answer, nor a worker's status beside what it serves
94
+ (PingAnswer). None where it is a worker, or where nothing said who it is: what is said of one then stands. A
95
+ robot's own address, on this machine, is named; one further away never is, as a worker's never is.
96
+
97
+
98
+ """
99
+ try:
100
+ answer = httpx.get(f"{base}/ping", timeout=_WHO_S, verify=verify if verify is not None else True)
101
+ except (httpx.HTTPError, httpx.InvalidURL, ValueError):
102
+ return None
103
+ if "x-seq-server" in answer.headers:
104
+ return None
105
+ try:
106
+ said = answer.json()
107
+ except ValueError:
108
+ said = None
109
+ if (isinstance(said, dict) and said.get("status") in _PING_STATUS and any(key in said for key in _PING_BESIDE)):
110
+ return None
111
+ at = urlsplit(base)
112
+ there = "what answers there"
113
+ if at.hostname and _is_local(at.hostname):
114
+ there = f"what answers at {at.hostname}:{at.port or (443 if at.scheme == 'https' else 80)}"
115
+ return InvalidRequest(f"{there} is not a Sequence policy worker: another program may hold the port",
116
+ hint="serve the policy on another port, or stop that program")
117
+
118
+
119
+ def _refused(exc: _stream.StreamRefused, base: str, verify: Any) -> Optional[Exception]:
120
+ """What a robot is told when its stream's upgrade was answered `exc.status`: its secret turned away (AuthError: a
121
+ new worker epoch, DirectConnection connects again) - or a proxy's refusal, which reads the same; a worker in front of
122
+ which something answered for it (5xx: None - a worker not reached, as any); a program that is no worker of
123
+ Sequence's (_no_worker); a worker built before it took a stream (404); anything else, a network that lets no
124
+ WebSocket through."""
78
125
  if exc.status in (401, 403):
79
126
  return AuthError(f"the worker refused this robot's stream ({exc})", status=exc.status,
80
127
  hint=_MAY_BE_THE_NETWORK)
81
- if exc.status == 404:
82
- return _built_before()
83
128
  if exc.status >= 500:
84
129
  return None
130
+ other = _no_worker(base, verify)
131
+ if other is not None:
132
+ return other
133
+ if exc.status == 404:
134
+ return _built_before()
85
135
  return StreamRefused(f"{_NO_WEBSOCKET}: the answer was \"{exc}\"", status=exc.status or None,
86
136
  hint="let wss to the policy's workers through this network's proxy or firewall")
87
137
 
@@ -124,7 +174,8 @@ class StreamLink:
124
174
  if isinstance(exc, (TimeoutError, socket.timeout)) and bound < left and not self._closed:
125
175
  continue
126
176
  self._stream_error = (exc if isinstance(exc, CertPinError)
127
- else _refused(exc) if isinstance(exc, _stream.StreamRefused)
177
+ else _refused(exc, self._base, self._verify)
178
+ if isinstance(exc, _stream.StreamRefused)
128
179
  else CertPinError("worker certificate is not valid for the name it was "
129
180
  "given; refusing to connect") if _gone_cert(exc) else None)
130
181
  self._warm_failed = (str(self._stream_error) if self._stream_error is not None else
@@ -136,7 +187,7 @@ class StreamLink:
136
187
  said = stream.said.get("x-seq-act-formats")
137
188
  if _stream.FORMAT not in {part.strip().lower() for part in (said or "").split(",")}:
138
189
  stream.close()
139
- self._stream_error = _built_before()
190
+ self._stream_error = _no_worker(self._base, self._verify) or _built_before()
140
191
  self._warm_failed = str(self._stream_error)
141
192
  _log.debug("the connection to its worker: its stream did not open: %s", self._warm_failed)
142
193
  return
@@ -276,18 +276,6 @@ def _number(v: Any) -> Optional[float]:
276
276
  return None
277
277
 
278
278
 
279
- def _on_the_list(details: Mapping[str, Any]) -> Optional[str]:
280
- """The command that puts a name a robot was refused on its list. The platform's words name no client's command: it
281
- hands over the robot, the name and the list as it stands. `seq robot set` replaces the whole list, so the command
282
- carries what is on it now and this one; a refusal with no list (one the platform could not read, or a key of no
283
- robot's) names none, because without the list it would take the rest off.
284
- """
285
- robot, name, listed = details.get("robot"), details.get("name"), details.get("policies")
286
- if details.get("reason") != "key_bound" or not robot or not name or not isinstance(listed, list):
287
- return None
288
- return f"run `seq robot set {robot} policies={','.join(map(str, [*listed, name]))}`, then connect again"
289
-
290
-
291
279
  def from_response(status: int, body: Any = None, *, text: Optional[str] = None,
292
280
  headers: Optional[Mapping[str, str]] = None) -> BaseException:
293
281
  """
@@ -322,7 +310,7 @@ def from_response(status: int, body: Any = None, *, text: Optional[str] = None,
322
310
  message = explain(details, retry_after_s=retry) or message
323
311
  retryable = b.get("retryable") if isinstance(b.get("retryable"), bool) else None
324
312
  common: Dict[str, Any] = dict(status=status, code=code, retryable=retryable, retry_after_s=retry,
325
- request_id=rid, hint=b.get("hint") or _on_the_list(details), details=details,
313
+ request_id=rid, hint=b.get("hint"), details=details,
326
314
  body=text)
327
315
 
328
316
  if code == "policy_error":
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes