dynos-client 0.2.0__tar.gz → 0.2.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 (27) hide show
  1. {dynos_client-0.2.0/src/dynos_client.egg-info → dynos_client-0.2.2}/PKG-INFO +27 -2
  2. dynos_client-0.2.0/PKG-INFO → dynos_client-0.2.2/README.md +25 -13
  3. {dynos_client-0.2.0 → dynos_client-0.2.2}/pyproject.toml +2 -2
  4. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/remote_orchestrator.py +71 -3
  5. dynos_client-0.2.0/README.md → dynos_client-0.2.2/src/dynos_client.egg-info/PKG-INFO +38 -0
  6. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client.egg-info/requires.txt +1 -1
  7. {dynos_client-0.2.0 → dynos_client-0.2.2}/setup.cfg +0 -0
  8. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/__init__.py +0 -0
  9. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/__main__.py +0 -0
  10. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/action.py +0 -0
  11. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/action_context.py +0 -0
  12. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/auth_cli.py +0 -0
  13. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/belief.py +0 -0
  14. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/call.py +0 -0
  15. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/cli.py +0 -0
  16. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/domain.py +0 -0
  17. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/expr_parser.py +0 -0
  18. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/hash_cli.py +0 -0
  19. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/mission.py +0 -0
  20. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/resolve_runnable.py +0 -0
  21. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/servant.py +0 -0
  22. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/session_cli.py +0 -0
  23. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client/session_manager.py +0 -0
  24. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client.egg-info/SOURCES.txt +0 -0
  25. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client.egg-info/dependency_links.txt +0 -0
  26. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client.egg-info/entry_points.txt +0 -0
  27. {dynos_client-0.2.0 → dynos_client-0.2.2}/src/dynos_client.egg-info/top_level.txt +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dynos-client
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Client and CLI for orchestrating DYNOS backends remotely
5
5
  License: Apache-2.0
6
6
  Requires-Python: >=3.8
7
7
  Description-Content-Type: text/markdown
8
- Requires-Dist: dynos-core>=0.2.0
8
+ Requires-Dist: dynos-core>=0.2.2
9
9
  Requires-Dist: requests
10
10
  Requires-Dist: typer
11
11
  Requires-Dist: bcrypt>=4.0
@@ -182,6 +182,31 @@ plan block is the normal building block; an action block (a single transition,
182
182
  no planning) strips out the replanning context and is reserved for genuine
183
183
  imperative primitives.
184
184
 
185
+ ## Objects, dedup, and handles
186
+
187
+ `create_object` returns the backend record by default. When you submit a point
188
+ whose coordinates match an existing one, the backend collapses them onto a
189
+ single object and reports the canonical name under `merged_into` -- so the name
190
+ you get back may differ from the one you sent, and you may no longer be holding
191
+ the object that another call created earlier.
192
+
193
+ Pass `return_ref=True` to get a client-side handle bound to that canonical name,
194
+ whether the object was freshly created or merged. Feed it straight into fluents
195
+ and `set_goal` -- no need to read `merged_into`, and no string references:
196
+
197
+ ```python
198
+ from dynos_sentry.sentry import Coordinate, at
199
+
200
+ target = orch.create_object(
201
+ Coordinate(latitude=45.95, longitude=-130.0, depth=100.0),
202
+ return_ref=True,
203
+ )
204
+ orch.set_goal([at(target)]) # canonical whether created or merged
205
+ ```
206
+
207
+ The raw record (`created`, `merged_into`, `warning`, ...) is still available on
208
+ the handle as `target._create_result` if you need it.
209
+
185
210
  ## Servants and `dynos connect`
186
211
 
187
212
  When the action's implementation lives on your machine; your ML model, a
@@ -1,16 +1,3 @@
1
- Metadata-Version: 2.1
2
- Name: dynos-client
3
- Version: 0.2.0
4
- Summary: Client and CLI for orchestrating DYNOS backends remotely
5
- License: Apache-2.0
6
- Requires-Python: >=3.8
7
- Description-Content-Type: text/markdown
8
- Requires-Dist: dynos-core>=0.2.0
9
- Requires-Dist: requests
10
- Requires-Dist: typer
11
- Requires-Dist: bcrypt>=4.0
12
- Requires-Dist: rich
13
-
14
1
  # dynos-client
15
2
 
16
3
  The HTTP client and command-line tool for talking to a DYNOS planning backend.
@@ -182,6 +169,31 @@ plan block is the normal building block; an action block (a single transition,
182
169
  no planning) strips out the replanning context and is reserved for genuine
183
170
  imperative primitives.
184
171
 
172
+ ## Objects, dedup, and handles
173
+
174
+ `create_object` returns the backend record by default. When you submit a point
175
+ whose coordinates match an existing one, the backend collapses them onto a
176
+ single object and reports the canonical name under `merged_into` -- so the name
177
+ you get back may differ from the one you sent, and you may no longer be holding
178
+ the object that another call created earlier.
179
+
180
+ Pass `return_ref=True` to get a client-side handle bound to that canonical name,
181
+ whether the object was freshly created or merged. Feed it straight into fluents
182
+ and `set_goal` -- no need to read `merged_into`, and no string references:
183
+
184
+ ```python
185
+ from dynos_sentry.sentry import Coordinate, at
186
+
187
+ target = orch.create_object(
188
+ Coordinate(latitude=45.95, longitude=-130.0, depth=100.0),
189
+ return_ref=True,
190
+ )
191
+ orch.set_goal([at(target)]) # canonical whether created or merged
192
+ ```
193
+
194
+ The raw record (`created`, `merged_into`, `warning`, ...) is still available on
195
+ the handle as `target._create_result` if you need it.
196
+
185
197
  ## Servants and `dynos connect`
186
198
 
187
199
  When the action's implementation lives on your machine; your ML model, a
@@ -4,12 +4,12 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dynos-client"
7
- version = "0.2.0"
7
+ version = "0.2.2"
8
8
  description = "Client and CLI for orchestrating DYNOS backends remotely"
9
9
  readme = "README.md"
10
10
  license = { text = "Apache-2.0" }
11
11
  requires-python = ">=3.8"
12
- dependencies = ["dynos-core>=0.2.0", "requests", "typer", "bcrypt>=4.0", "rich"]
12
+ dependencies = ["dynos-core>=0.2.2", "requests", "typer", "bcrypt>=4.0", "rich"]
13
13
 
14
14
  [project.scripts]
15
15
  dynos = "dynos_client.cli:main"
@@ -795,9 +795,31 @@ class RemoteOrchestrator:
795
795
  type_name_or_obj: Any,
796
796
  name: Optional[str] = None,
797
797
  *,
798
+ return_ref: bool = False,
798
799
  _bypass_string_safety_enforcement: bool = False,
799
800
  **kwargs: Any,
800
- ) -> Dict[str, Any]:
801
+ ) -> Any:
802
+ """Create a domain object on the backend.
803
+
804
+ By default returns the raw backend record (a dict with ``name``,
805
+ ``created`` and, on a dedup, ``merged_into`` / ``warning``).
806
+
807
+ Pass ``return_ref=True`` to instead get a client-side object HANDLE
808
+ bound to the object's CANONICAL name -- the merged-into name when the
809
+ backend collapses this submission onto a value-equivalent existing
810
+ object, or the created name otherwise. The handle carries the object's
811
+ value fields and can be passed straight into fluents / ``set_goal``
812
+ with no ``_bypass_string_safety_enforcement`` and no need to read
813
+ ``merged_into`` by hand::
814
+
815
+ target = orch.create_object(Coordinate(latitude=.., longitude=..,
816
+ depth=..), return_ref=True)
817
+ orch.set_goal([survey_at(target)]) # canonical whether created or merged
818
+
819
+ The raw record is still available on the handle as ``_create_result``.
820
+ ``return_ref`` requires the object SYMBOL (arg 0 must be an ObjectType
821
+ instance); it is not supported on the string-type wire path.
822
+ """
801
823
  if isinstance(type_name_or_obj, str):
802
824
  if not _bypass_string_safety_enforcement:
803
825
  raise TypeError(
@@ -808,6 +830,14 @@ class RemoteOrchestrator:
808
830
  f"(_bypass_string_safety_enforcement=True is for the DYNOS web-API "
809
831
  f"wire boundary ONLY -- client code must pass the object.)"
810
832
  )
833
+ if return_ref:
834
+ raise TypeError(
835
+ f"create_object({type_name_or_obj!r}, ..., return_ref=True) needs "
836
+ f"the ObjectType SYMBOL to build the handle, but arg 0 is a string. "
837
+ f"Pass the object, e.g. create_object(Coordinate(...), "
838
+ f"return_ref=True). return_ref is a client-code affordance, not a "
839
+ f"wire-boundary one."
840
+ )
811
841
  body: Dict[str, Any] = {"type": type_name_or_obj, "name": name}
812
842
  body.update(kwargs)
813
843
  return self._post("/objects", body)
@@ -819,12 +849,50 @@ class RemoteOrchestrator:
819
849
  getattr(obj, "_instance_name", None)
820
850
  or field_values.pop("name", None)
821
851
  or name
822
- or type_name
823
852
  )
853
+ if not obj_name:
854
+ # No name given. Do NOT fall back to the bare type name: an object
855
+ # named after its own type collides with the type in the planning
856
+ # problem (types and objects share one namespace), which surfaces as
857
+ # an opaque 500 at plan() time. Mint a unique, type-prefixed name
858
+ # via the shared generator -- pass return_ref=True to get it back on
859
+ # the handle.
860
+ from dynos_core.factories import generate_object_name
861
+
862
+ obj_name = generate_object_name(type_name)
863
+ elif obj_name == type_name:
864
+ # An object named after its own type collides with the type in the
865
+ # planning problem and fails at plan() time with an opaque backend
866
+ # error. Catch it here, at the create call, with the fix in hand.
867
+ raise ValueError(
868
+ f"create_object({type(obj).__name__}(name={obj_name!r}, ...)): an "
869
+ f"object may not share the name of its type ({type_name!r}); they "
870
+ f"share one namespace in the planner and collide at plan time. "
871
+ f"Give it a distinct name (e.g. {type_name}_1), or omit name= to "
872
+ f"get a generated one."
873
+ )
824
874
  body = {"type": type_name, "name": obj_name}
825
875
  body.update(field_values)
826
876
  body.update(kwargs)
827
- return self._post("/objects", body)
877
+ resp = self._post("/objects", body)
878
+ if not return_ref:
879
+ return resp
880
+
881
+ # Mint a handle bound to the CANONICAL name so callers never chase
882
+ # `merged_into`. On a dedup the backend reports the collapsed-onto name
883
+ # and that object's stored fields; on a fresh create the name is the one
884
+ # we submitted and the fields are what we sent. Unwrap the HTTP envelope
885
+ # ({"status", "object"}) defensively so the in-process path (bare record)
886
+ # works too.
887
+ rec = resp.get("object", resp) if isinstance(resp, dict) else {}
888
+ canonical = rec.get("merged_into") or rec.get("name") or obj_name
889
+ ref_fields = rec.get("value_fields")
890
+ if not ref_fields:
891
+ ref_fields = dict(field_values)
892
+ ref_fields.update(kwargs)
893
+ handle = type(obj)(name=canonical, **ref_fields)
894
+ object.__setattr__(handle, "_create_result", rec)
895
+ return handle
828
896
 
829
897
  def get_geojson(self) -> Dict[str, Any]:
830
898
  return self._get("/as_geojson")
@@ -1,3 +1,16 @@
1
+ Metadata-Version: 2.1
2
+ Name: dynos-client
3
+ Version: 0.2.2
4
+ Summary: Client and CLI for orchestrating DYNOS backends remotely
5
+ License: Apache-2.0
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: dynos-core>=0.2.2
9
+ Requires-Dist: requests
10
+ Requires-Dist: typer
11
+ Requires-Dist: bcrypt>=4.0
12
+ Requires-Dist: rich
13
+
1
14
  # dynos-client
2
15
 
3
16
  The HTTP client and command-line tool for talking to a DYNOS planning backend.
@@ -169,6 +182,31 @@ plan block is the normal building block; an action block (a single transition,
169
182
  no planning) strips out the replanning context and is reserved for genuine
170
183
  imperative primitives.
171
184
 
185
+ ## Objects, dedup, and handles
186
+
187
+ `create_object` returns the backend record by default. When you submit a point
188
+ whose coordinates match an existing one, the backend collapses them onto a
189
+ single object and reports the canonical name under `merged_into` -- so the name
190
+ you get back may differ from the one you sent, and you may no longer be holding
191
+ the object that another call created earlier.
192
+
193
+ Pass `return_ref=True` to get a client-side handle bound to that canonical name,
194
+ whether the object was freshly created or merged. Feed it straight into fluents
195
+ and `set_goal` -- no need to read `merged_into`, and no string references:
196
+
197
+ ```python
198
+ from dynos_sentry.sentry import Coordinate, at
199
+
200
+ target = orch.create_object(
201
+ Coordinate(latitude=45.95, longitude=-130.0, depth=100.0),
202
+ return_ref=True,
203
+ )
204
+ orch.set_goal([at(target)]) # canonical whether created or merged
205
+ ```
206
+
207
+ The raw record (`created`, `merged_into`, `warning`, ...) is still available on
208
+ the handle as `target._create_result` if you need it.
209
+
172
210
  ## Servants and `dynos connect`
173
211
 
174
212
  When the action's implementation lives on your machine; your ML model, a
@@ -1,4 +1,4 @@
1
- dynos-core>=0.2.0
1
+ dynos-core>=0.2.2
2
2
  requests
3
3
  typer
4
4
  bcrypt>=4.0
File without changes