antioch-py 2.0.6__py3-none-any.whl → 3.0.12__py3-none-any.whl

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.

Potentially problematic release.


This version of antioch-py might be problematic. Click here for more details.

Files changed (109) hide show
  1. antioch/__init__.py +101 -0
  2. antioch/{module/execution.py → execution.py} +1 -1
  3. antioch/{module/input.py → input.py} +2 -4
  4. antioch/{module/module.py → module.py} +17 -34
  5. antioch/{module/node.py → node.py} +17 -16
  6. {antioch_py-2.0.6.dist-info → antioch_py-3.0.12.dist-info}/METADATA +8 -11
  7. antioch_py-3.0.12.dist-info/RECORD +61 -0
  8. {antioch_py-2.0.6.dist-info → antioch_py-3.0.12.dist-info}/WHEEL +1 -1
  9. antioch_py-3.0.12.dist-info/licenses/LICENSE +21 -0
  10. common/ark/__init__.py +6 -16
  11. common/ark/ark.py +23 -60
  12. common/ark/hardware.py +13 -37
  13. common/ark/kinematics.py +1 -1
  14. common/ark/module.py +22 -0
  15. common/ark/node.py +46 -3
  16. common/ark/scheduler.py +2 -29
  17. common/ark/sim.py +1 -1
  18. {antioch/module → common/ark}/token.py +17 -0
  19. common/assets/rigging.usd +0 -0
  20. common/constants.py +83 -4
  21. common/core/__init__.py +37 -24
  22. common/core/auth.py +87 -114
  23. common/core/container.py +261 -0
  24. common/core/registry.py +131 -152
  25. common/core/rome.py +251 -0
  26. common/core/telemetry.py +176 -0
  27. common/core/types.py +219 -0
  28. common/message/__init__.py +19 -3
  29. common/message/annotation.py +174 -23
  30. common/message/array.py +25 -1
  31. common/message/camera.py +23 -1
  32. common/message/color.py +32 -6
  33. common/message/detection.py +40 -0
  34. common/message/foxglove.py +20 -0
  35. common/message/frame.py +71 -7
  36. common/message/image.py +58 -9
  37. common/message/imu.py +24 -4
  38. common/message/joint.py +69 -10
  39. common/message/log.py +52 -7
  40. common/message/pir.py +22 -5
  41. common/message/plot.py +57 -0
  42. common/message/point.py +55 -6
  43. common/message/point_cloud.py +55 -19
  44. common/message/pose.py +59 -19
  45. common/message/quaternion.py +105 -92
  46. common/message/radar.py +195 -29
  47. common/message/twist.py +34 -0
  48. common/message/types.py +40 -5
  49. common/message/vector.py +180 -245
  50. common/sim/__init__.py +49 -0
  51. common/sim/objects.py +460 -0
  52. common/sim/state.py +11 -0
  53. common/utils/comms.py +30 -12
  54. common/utils/logger.py +26 -7
  55. antioch/message.py +0 -87
  56. antioch/module/__init__.py +0 -53
  57. antioch/session/__init__.py +0 -150
  58. antioch/session/ark.py +0 -504
  59. antioch/session/asset.py +0 -65
  60. antioch/session/error.py +0 -80
  61. antioch/session/record.py +0 -158
  62. antioch/session/scene.py +0 -1521
  63. antioch/session/session.py +0 -220
  64. antioch/session/task.py +0 -323
  65. antioch/session/views/__init__.py +0 -40
  66. antioch/session/views/animation.py +0 -189
  67. antioch/session/views/articulation.py +0 -245
  68. antioch/session/views/basis_curve.py +0 -186
  69. antioch/session/views/camera.py +0 -92
  70. antioch/session/views/collision.py +0 -75
  71. antioch/session/views/geometry.py +0 -74
  72. antioch/session/views/ground_plane.py +0 -63
  73. antioch/session/views/imu.py +0 -73
  74. antioch/session/views/joint.py +0 -64
  75. antioch/session/views/light.py +0 -175
  76. antioch/session/views/pir_sensor.py +0 -140
  77. antioch/session/views/radar.py +0 -73
  78. antioch/session/views/rigid_body.py +0 -282
  79. antioch/session/views/xform.py +0 -119
  80. antioch_py-2.0.6.dist-info/RECORD +0 -99
  81. antioch_py-2.0.6.dist-info/entry_points.txt +0 -2
  82. common/core/agent.py +0 -296
  83. common/core/task.py +0 -36
  84. common/rome/__init__.py +0 -9
  85. common/rome/client.py +0 -430
  86. common/rome/error.py +0 -16
  87. common/session/__init__.py +0 -54
  88. common/session/environment.py +0 -31
  89. common/session/sim.py +0 -240
  90. common/session/views/__init__.py +0 -263
  91. common/session/views/animation.py +0 -73
  92. common/session/views/articulation.py +0 -184
  93. common/session/views/basis_curve.py +0 -102
  94. common/session/views/camera.py +0 -147
  95. common/session/views/collision.py +0 -59
  96. common/session/views/geometry.py +0 -102
  97. common/session/views/ground_plane.py +0 -41
  98. common/session/views/imu.py +0 -66
  99. common/session/views/joint.py +0 -81
  100. common/session/views/light.py +0 -96
  101. common/session/views/pir_sensor.py +0 -115
  102. common/session/views/radar.py +0 -82
  103. common/session/views/rigid_body.py +0 -236
  104. common/session/views/viewport.py +0 -21
  105. common/session/views/xform.py +0 -39
  106. common/utils/usd.py +0 -12
  107. /antioch/{module/clock.py → clock.py} +0 -0
  108. {antioch_py-2.0.6.dist-info → antioch_py-3.0.12.dist-info}/top_level.txt +0 -0
  109. /common/message/{base.py → message.py} +0 -0
common/ark/hardware.py CHANGED
@@ -1,15 +1,12 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from enum import Enum
4
+ from typing import Annotated, Literal, Union
4
5
 
5
- from pydantic import Field, ValidationInfo, field_validator
6
+ from pydantic import Field
6
7
 
7
8
  from common.message import Message, Pose
8
- from common.session.views.articulation import ArticulationConfig
9
- from common.session.views.camera import CameraConfig
10
- from common.session.views.imu import ImuConfig
11
- from common.session.views.pir_sensor import PirSensorConfig
12
- from common.session.views.radar import RadarConfig
9
+ from common.sim import ArticulationConfig, CameraConfig, ImuConfig, PirSensorConfig, RadarConfig
13
10
 
14
11
 
15
12
  class HardwareType(str, Enum):
@@ -29,6 +26,7 @@ class ActuatorGroupHardware(Message):
29
26
  Actuator group hardware that controls multiple joints.
30
27
  """
31
28
 
29
+ type: Literal[HardwareType.ACTUATOR_GROUP] = HardwareType.ACTUATOR_GROUP
32
30
  module: str
33
31
  name: str
34
32
  config: ArticulationConfig
@@ -39,6 +37,7 @@ class ImuHardware(Message):
39
37
  IMU sensor hardware attached to a link.
40
38
  """
41
39
 
40
+ type: Literal[HardwareType.IMU] = HardwareType.IMU
42
41
  module: str
43
42
  name: str
44
43
  path: str
@@ -52,6 +51,7 @@ class PirHardware(Message):
52
51
  PIR (Passive Infrared) sensor hardware attached to a link.
53
52
  """
54
53
 
54
+ type: Literal[HardwareType.PIR] = HardwareType.PIR
55
55
  module: str
56
56
  name: str
57
57
  path: str
@@ -65,6 +65,7 @@ class RadarHardware(Message):
65
65
  Radar sensor hardware attached to a link.
66
66
  """
67
67
 
68
+ type: Literal[HardwareType.RADAR] = HardwareType.RADAR
68
69
  module: str
69
70
  name: str
70
71
  path: str
@@ -80,6 +81,7 @@ class CameraHardware(Message):
80
81
  Used for both RGB and depth cameras - the mode is specified in the config.
81
82
  """
82
83
 
84
+ type: Literal[HardwareType.CAMERA] = HardwareType.CAMERA
83
85
  module: str
84
86
  name: str
85
87
  path: str
@@ -88,34 +90,8 @@ class CameraHardware(Message):
88
90
  config: CameraConfig
89
91
 
90
92
 
91
- class Hardware(Message):
92
- """
93
- Union of all hardware types for an Ark.
94
- """
95
-
96
- type: HardwareType
97
- config: ActuatorGroupHardware | ImuHardware | PirHardware | RadarHardware | CameraHardware
98
-
99
- @field_validator("config", mode="before")
100
- @classmethod
101
- def validate_config(cls, config: dict, info: ValidationInfo):
102
- """
103
- Validate the hardware config based on the type field.
104
- """
105
-
106
- hw_type = info.data.get("type")
107
- if hw_type is None:
108
- raise ValueError("Hardware type is required")
109
- match hw_type:
110
- case HardwareType.ACTUATOR_GROUP:
111
- return ActuatorGroupHardware.model_validate(config)
112
- case HardwareType.IMU:
113
- return ImuHardware.model_validate(config)
114
- case HardwareType.PIR:
115
- return PirHardware.model_validate(config)
116
- case HardwareType.RADAR:
117
- return RadarHardware.model_validate(config)
118
- case HardwareType.CAMERA:
119
- return CameraHardware.model_validate(config)
120
- case _:
121
- raise ValueError(f"Unknown hardware type: {hw_type}")
93
+ # Discriminated union based on the 'type' field
94
+ Hardware = Annotated[
95
+ Union[ActuatorGroupHardware, ImuHardware, PirHardware, RadarHardware, CameraHardware],
96
+ Field(discriminator="type"),
97
+ ]
common/ark/kinematics.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from common.message import Message, Pose
2
- from common.session.views.joint import JointAxis, JointType
2
+ from common.sim import JointAxis, JointType
3
3
 
4
4
 
5
5
  class Joint(Message):
common/ark/module.py CHANGED
@@ -83,3 +83,25 @@ class Module(Message):
83
83
  info: ModuleInfo
84
84
  parameters: dict[str, ModuleParameter]
85
85
  nodes: dict[str, Node]
86
+
87
+
88
+ class ModuleReady(Message):
89
+ """
90
+ Message sent by a module when it is ready to start.
91
+
92
+ Published during agent handshake to signal module initialization complete.
93
+ """
94
+
95
+ _type = "antioch/agent/module_ready"
96
+ module_name: str
97
+
98
+
99
+ class ModuleStart(Message):
100
+ """
101
+ Message sent to all modules to signal the global start time.
102
+
103
+ Received during agent handshake to synchronize module execution.
104
+ """
105
+
106
+ _type = "antioch/agent/module_start"
107
+ global_start_time_us: int
common/ark/node.py CHANGED
@@ -3,6 +3,7 @@ from enum import Enum
3
3
 
4
4
  from pydantic import Field
5
5
 
6
+ from common.ark.token import InputToken
6
7
  from common.message import Message
7
8
 
8
9
 
@@ -42,10 +43,7 @@ class NodeTimer(Message):
42
43
  else:
43
44
  raise ValueError("Timer must specify frequency or period")
44
45
 
45
- # Convert to microseconds
46
46
  period_us = int(period_ms * 1000)
47
-
48
- # Round to nearest millisecond
49
47
  rounded_us = ((period_us + 500) // 1000) * 1000
50
48
  if rounded_us == 0:
51
49
  raise ValueError("Timer frequency is too high (sub-millisecond period)")
@@ -92,3 +90,48 @@ class Node(Message):
92
90
  inputs: dict[str, NodeInput] = Field(default_factory=dict)
93
91
  outputs: dict[str, NodeOutput] = Field(default_factory=dict)
94
92
  hardware_access: dict[str, HardwareAccessMode] = Field(default_factory=dict)
93
+
94
+
95
+ class NodeEdge(Message):
96
+ """
97
+ Directed edge representing data flow between nodes.
98
+ """
99
+
100
+ _type = "antioch/ark/node_edge"
101
+ source_module: str
102
+ source_node: str
103
+ source_output_name: str
104
+ target_module: str
105
+ target_node: str
106
+ target_input_name: str
107
+ type: str
108
+
109
+
110
+ class SimNodeStart(Message):
111
+ """
112
+ Ark signals node to start execution (sim mode).
113
+
114
+ Sent from Ark to node via publisher to trigger node start with hardware reads.
115
+ """
116
+
117
+ _type = "antioch/ark/sim_node_start"
118
+ module_name: str
119
+ node_name: str
120
+ start_let_us: int
121
+ start_timestamp_us: int
122
+ input_tokens: list[InputToken]
123
+ hardware_reads: dict[str, bytes]
124
+
125
+
126
+ class SimNodeComplete(Message):
127
+ """
128
+ Node signals completion to Ark (sim mode).
129
+
130
+ Sent from node to Ark to indicate completion with optional hardware writes.
131
+ """
132
+
133
+ _type = "antioch/ark/sim_node_complete"
134
+ module_name: str
135
+ node_name: str
136
+ completion_let_us: int
137
+ hardware_writes: dict[str, bytes] | None = None
common/ark/scheduler.py CHANGED
@@ -3,38 +3,11 @@ from abc import ABC, abstractmethod
3
3
  from sortedcontainers import SortedDict
4
4
 
5
5
  from common.ark.module import Module
6
+ from common.ark.node import NodeEdge
7
+ from common.ark.token import InputToken
6
8
  from common.message import Message
7
9
 
8
10
 
9
- class NodeEdge(Message):
10
- """
11
- Directed edge representing data flow between nodes.
12
- """
13
-
14
- _type = "antioch/ark/node_edge"
15
- source_module: str
16
- source_node: str
17
- source_output_name: str
18
- target_module: str
19
- target_node: str
20
- target_input_name: str
21
- type: str
22
-
23
-
24
- class InputToken(Message):
25
- """
26
- Input token representing data flow to a node.
27
- """
28
-
29
- _type = "antioch/ark/input_token"
30
- source_module: str
31
- source_node: str
32
- source_output_name: str
33
- target_input_name: str
34
- let_us: int
35
- budget_us: int
36
-
37
-
38
11
  class ScheduleEvent(Message, ABC):
39
12
  """
40
13
  Base class for schedule events.
common/ark/sim.py CHANGED
@@ -1,4 +1,4 @@
1
- from common.ark.scheduler import InputToken
1
+ from common.ark.token import InputToken
2
2
  from common.message import Message
3
3
 
4
4
 
@@ -3,6 +3,23 @@ from enum import Enum
3
3
  from common.message import Message
4
4
  from common.utils.time import now_us
5
5
 
6
+ # Synchronization path for token communication
7
+ ARK_TOKEN_PATH = "_ark/token/{path}"
8
+
9
+
10
+ class InputToken(Message):
11
+ """
12
+ Input token representing data flow to a node.
13
+ """
14
+
15
+ _type = "antioch/ark/input_token"
16
+ source_module: str
17
+ source_node: str
18
+ source_output_name: str
19
+ target_input_name: str
20
+ let_us: int
21
+ budget_us: int
22
+
6
23
 
7
24
  class TokenType(str, Enum):
8
25
  """
Binary file
common/constants.py CHANGED
@@ -1,8 +1,87 @@
1
1
  import os
2
2
  from pathlib import Path
3
3
 
4
- ANTIOCH_API_URL = os.environ.get("ANTIOCH_API_URL", "https://staging.api.antioch.com")
5
- ANTIOCH_DIR = os.environ.get("ANTIOCH_DIR", str(Path.home() / ".antioch"))
4
+ # =============================================================================
5
+ # Environment
6
+ # =============================================================================
7
+
8
+ ANTIOCH_ENV = os.environ.get("ANTIOCH_ENV", "prod").lower()
9
+ if ANTIOCH_ENV not in ("prod", "staging", "local"):
10
+ raise ValueError(f"Invalid ANTIOCH_ENV: {ANTIOCH_ENV}")
11
+
12
+ # =============================================================================
13
+ # API URLs
14
+ # =============================================================================
15
+
16
+ # Local dev uses staging APIs
17
+ if ANTIOCH_ENV in ("staging", "local"):
18
+ ANTIOCH_API_URL = "https://staging.api.antioch.com"
19
+ AUTH_DOMAIN = "https://staging.auth.antioch.com"
20
+ AUTH_CLIENT_ID = "x0aOquV43Xe76ehqAm6Zir80O0MWpqTV"
21
+ else:
22
+ ANTIOCH_API_URL = "https://api.antioch.com"
23
+ AUTH_DOMAIN = "https://auth.antioch.com"
24
+ AUTH_CLIENT_ID = "8RLoPEgMP3ih10sfJsGPkwbUWGilsoyX"
25
+
26
+ # Allow environment variable overrides
27
+ ANTIOCH_API_URL = os.environ.get("ANTIOCH_API_URL", ANTIOCH_API_URL)
28
+ AUTH_DOMAIN = os.environ.get("AUTH_DOMAIN", AUTH_DOMAIN)
29
+
30
+ # =============================================================================
31
+ # Local Storage Directories
32
+ # =============================================================================
33
+
34
+ ANTIOCH_DIR = os.environ.get("ANTIOCH_DIR", f"{os.environ.get('HOME', '.')}/.antioch/{ANTIOCH_ENV}")
35
+ ANTIOCH_ARKS_DIR = os.environ.get("ANTIOCH_ARKS_DIR", f"{ANTIOCH_DIR}/arks")
36
+ ANTIOCH_ASSETS_DIR = os.environ.get("ANTIOCH_ASSETS_DIR", f"{ANTIOCH_DIR}/assets")
37
+
38
+ # =============================================================================
39
+ # Auth0 Configuration
40
+ # =============================================================================
41
+
42
+ AUTH_TOKEN_URL = f"{AUTH_DOMAIN}/oauth/token"
43
+ DEVICE_CODE_URL = f"{AUTH_DOMAIN}/oauth/device/code"
44
+
45
+ AUTH_SCOPE = "openid profile email"
46
+ AUDIENCE = "https://sessions.antioch.com"
47
+ AUTH_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code"
48
+ AUTH_TIMEOUT_SECONDS = 120
49
+
50
+ # JWT claim names (namespaced for Auth0)
51
+ AUTH_ORG_ID_CLAIM = "https://antioch.com/org_id"
52
+ AUTH_ORG_NAME_CLAIM = "https://antioch.com/org_name"
53
+ AUTH_ORG_ROLE_CLAIM = "https://antioch.com/org_role"
54
+
55
+ # Organization roles (mutually exclusive within an org)
56
+ ORG_ROLE_ADMIN = "team_admin"
57
+ ORG_ROLE_MEMBER = "team_member"
58
+ ORG_ROLE_SUPPORT = "support_staff"
59
+ ORG_ROLES = (ORG_ROLE_ADMIN, ORG_ROLE_MEMBER, ORG_ROLE_SUPPORT)
60
+
61
+ # =============================================================================
62
+ # Telemetry Configuration
63
+ # =============================================================================
64
+
65
+ FOXGLOVE_WEBSOCKET_PORT = 8765
66
+
67
+ # =============================================================================
68
+ # Zenoh Shared Memory Configuration
69
+ # =============================================================================
70
+
71
+ # Enable shared memory transport for high-performance IPC between processes
72
+ # When enabled, large messages use shared memory instead of TCP, providing
73
+ # 4-8x latency improvement for messages > 64 KB. Falls back to TCP when SHM
74
+ # is unavailable (cross-machine, pool exhausted, etc.)
75
+ SHM_ENABLED = True
76
+
77
+ # Shared memory pool size in bytes (256 MB)
78
+ # This is the total amount of shared memory allocated for message transport
79
+ SHM_POOL_SIZE_BYTES = 256 * 1024 * 1024
80
+
81
+ # Message size threshold in bytes for SHM transport (64 KB)
82
+ # Messages larger than this use SHM; smaller messages use TCP
83
+ # Based on benchmarks showing SHM wins for messages >= 64 KB
84
+ SHM_MESSAGE_SIZE_THRESHOLD_BYTES = 64 * 1024
6
85
 
7
86
 
8
87
  def get_auth_dir() -> Path:
@@ -28,7 +107,7 @@ def get_ark_dir() -> Path:
28
107
  :return: Path to the arks directory.
29
108
  """
30
109
 
31
- ark_dir = Path(ANTIOCH_DIR) / "arks"
110
+ ark_dir = Path(ANTIOCH_ARKS_DIR)
32
111
  ark_dir.mkdir(parents=True, exist_ok=True)
33
112
  return ark_dir
34
113
 
@@ -42,6 +121,6 @@ def get_asset_dir() -> Path:
42
121
  :return: Path to the assets directory.
43
122
  """
44
123
 
45
- asset_dir = Path(ANTIOCH_DIR) / "assets"
124
+ asset_dir = Path(ANTIOCH_ASSETS_DIR)
46
125
  asset_dir.mkdir(parents=True, exist_ok=True)
47
126
  return asset_dir
common/core/__init__.py CHANGED
@@ -1,16 +1,5 @@
1
- from common.core.agent import (
2
- Agent,
3
- AgentError,
4
- AgentResponse,
5
- AgentStateResponse,
6
- AgentValidationError,
7
- ArkStateResponse,
8
- ContainerSource,
9
- ContainerState,
10
- RecordTelemetryRequest,
11
- StartArkRequest,
12
- )
13
1
  from common.core.auth import AuthError, AuthHandler, Organization
2
+ from common.core.container import ContainerManager, ContainerManagerError, ContainerSource
14
3
  from common.core.registry import (
15
4
  get_ark_version_reference,
16
5
  get_asset_path,
@@ -22,24 +11,41 @@ from common.core.registry import (
22
11
  pull_remote_ark,
23
12
  pull_remote_asset,
24
13
  )
14
+ from common.core.rome import RomeAuthError, RomeClient, RomeError, RomeNetworkError
15
+ from common.core.telemetry import TelemetryManager
16
+ from common.core.types import (
17
+ ArkReference,
18
+ ArkRegistryMetadata,
19
+ ArkVersionReference,
20
+ AssetReference,
21
+ AssetVersionReference,
22
+ TaskOutcome,
23
+ TaskRun,
24
+ TaskRunner,
25
+ TaskTriggerSource,
26
+ )
25
27
 
26
28
  __all__ = [
27
- # Agent
28
- "Agent",
29
- "AgentError",
30
- "AgentResponse",
31
- "AgentStateResponse",
32
- "AgentValidationError",
33
- "ArkStateResponse",
34
- "ContainerSource",
35
- "ContainerState",
36
- "RecordTelemetryRequest",
37
- "StartArkRequest",
38
29
  # Auth
39
30
  "AuthError",
40
31
  "AuthHandler",
41
32
  "Organization",
42
- # Registry
33
+ # Containers
34
+ "ContainerManager",
35
+ "ContainerManagerError",
36
+ "ContainerSource",
37
+ # Registry types
38
+ "ArkReference",
39
+ "ArkRegistryMetadata",
40
+ "ArkVersionReference",
41
+ "AssetReference",
42
+ "AssetVersionReference",
43
+ # Task types
44
+ "TaskOutcome",
45
+ "TaskRun",
46
+ "TaskRunner",
47
+ "TaskTriggerSource",
48
+ # Registry functions
43
49
  "get_ark_version_reference",
44
50
  "get_asset_path",
45
51
  "list_local_arks",
@@ -49,4 +55,11 @@ __all__ = [
49
55
  "load_local_ark",
50
56
  "pull_remote_ark",
51
57
  "pull_remote_asset",
58
+ # Rome
59
+ "RomeAuthError",
60
+ "RomeClient",
61
+ "RomeError",
62
+ "RomeNetworkError",
63
+ # Telemetry
64
+ "TelemetryManager",
52
65
  ]