matrx-graph 0.2.332__py3-none-any.whl → 0.2.334__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.
matrx_graph/overview.py CHANGED
@@ -19,7 +19,9 @@ The spec has no place for the real node ids (Archify's node schema is closed), s
19
19
 
20
20
  ``definition_structure_hash`` is the staleness key: sha256 over the nodes (id, type) and the edges
21
21
  (source, target, kind) only — never positions, labels, config or any other cosmetic field — so
22
- dragging a node does not invalidate an overview and adding a connection does.
22
+ dragging a node does not invalidate an overview and adding a connection does. Because the collapse
23
+ also reads labels, lanes and the title, ``definition_collapse_hash`` covers those inputs; a host
24
+ re-collapses when EITHER hash differs.
23
25
  """
24
26
 
25
27
  from __future__ import annotations
@@ -132,6 +134,23 @@ def definition_structure_hash(definition: Definition) -> str:
132
134
  return hashlib.sha256(payload.encode("utf-8")).hexdigest()
133
135
 
134
136
 
137
+ def definition_collapse_hash(
138
+ definition: Definition, *, title: str = "Workflow overview", categories: dict[str, str] | None = None
139
+ ) -> str:
140
+ """sha256 over everything ``collapse_definition_detailed`` READS, so a stored overview is re-collapsed
141
+ whenever its picture could differ. Derived from the collapse code: per node, in definition order (the
142
+ order breaks ties), the id, the spec type, the plain-words label (``_label_of``: label, else id, else
143
+ spec tail) and the lane (``node_family``: registry category, ``data.category``, spec name); per edge
144
+ (sorted) source, target and kind; and the workflow title. Positions, config and every field the
145
+ collapse never reads are ignored, so dragging a node leaves it unchanged while renaming a step changes
146
+ it. Complements ``definition_structure_hash`` (which means STRUCTURE only); bump ``COLLAPSE_VERSION``
147
+ when the collapse starts reading something new."""
148
+ nodes = [[n.id, n.spec_type, _label_of(n), node_family(n, categories)] for n in definition.nodes]
149
+ edges = sorted((e.source, e.target, e.kind.value) for e in definition.edges)
150
+ payload = json.dumps({"title": title, "nodes": nodes, "edges": edges}, sort_keys=True, separators=(",", ":"))
151
+ return hashlib.sha256(payload.encode("utf-8")).hexdigest()
152
+
153
+
135
154
  # --------------------------------------------------------------------------- labels
136
155
 
137
156
  _STOPWORDS = frozenset({"the", "and", "for", "from", "with", "your", "step", "agent", "source", "run", "make", "new"})
@@ -199,6 +218,8 @@ class CollapseResult:
199
218
  hidden: list[str]
200
219
  structure_hash: str
201
220
  collapse_version: int = COLLAPSE_VERSION
221
+ #: ``definition_collapse_hash`` of the inputs this picture was built from.
222
+ collapse_hash: str = ""
202
223
 
203
224
 
204
225
  def collapse_definition(
@@ -392,7 +413,10 @@ def collapse_definition_detailed(
392
413
  if cards:
393
414
  spec["cards"] = cards
394
415
  node_map = {ids[k]: list(items[k].members) for k in items}
395
- return CollapseResult(spec=spec, node_map=node_map, hidden=hidden, structure_hash=structure_hash)
416
+ return CollapseResult(
417
+ spec=spec, node_map=node_map, hidden=hidden, structure_hash=structure_hash,
418
+ collapse_hash=definition_collapse_hash(definition, title=title, categories=categories),
419
+ )
396
420
 
397
421
 
398
422
  # --------------------------------------------------------------------------- folding
@@ -48,7 +48,8 @@ class JobLease:
48
48
  #: the copy finished its work and is settling the job (``complete``): a renewal that lands after the settle
49
49
  #: commits answers "not ours", and that is not a loss (K1b, M1)
50
50
  settling: bool = False
51
- #: per-copy fencing token for anything this copy holds (an import slot): a newer copy's is always greater
51
+ #: per-copy fencing token for anything this copy holds (an import slot): a newer copy's is always greater. The
52
+ #: runner sets the job's attempt (bumped by every claim); a lease made by hand defaults to its creation time
52
53
  generation: float = field(default_factory=time.time)
53
54
  visibility_timeout: int = 600
54
55
  lost: bool = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: matrx-graph
3
- Version: 0.2.332
3
+ Version: 0.2.334
4
4
  Summary: Channel-based, super-step workflow orchestration engine for the Matrx ecosystem
5
5
  Project-URL: Homepage, https://github.com/AI-Matrix-Engine/aidream-current
6
6
  Project-URL: Repository, https://github.com/AI-Matrix-Engine/aidream-current
@@ -19,14 +19,14 @@ Requires-Python: >=3.13
19
19
  Requires-Dist: croniter>=2.0
20
20
  Requires-Dist: httpx>=0.27
21
21
  Requires-Dist: jsonschema>=4.20
22
- Requires-Dist: matrx-connect>=0.1.236
22
+ Requires-Dist: matrx-connect>=0.1.237
23
23
  Requires-Dist: matrx-utils>=2.0.83
24
24
  Requires-Dist: pydantic>=2.12
25
25
  Requires-Dist: pyyaml>=6.0
26
26
  Provides-Extra: otel
27
27
  Requires-Dist: opentelemetry-api>=1.25; extra == 'otel'
28
28
  Provides-Extra: postgres
29
- Requires-Dist: matrx-orm>=3.1.242; extra == 'postgres'
29
+ Requires-Dist: matrx-orm>=3.1.243; extra == 'postgres'
30
30
  Description-Content-Type: text/markdown
31
31
 
32
32
  # matrx-graph
@@ -17,7 +17,7 @@ matrx_graph/kind_fields.py,sha256=6F9jmJNz9-104FSAqIwx8xcy5HqeeYxedgyoyPJf0mk,21
17
17
  matrx_graph/kinds.py,sha256=Uh1KmVBL46EpC4ojKCq7eOom8SVleEROUmRYzz27BU4,37751
18
18
  matrx_graph/knobs.py,sha256=tZMlF7YV3GZw3liccEnFdOkYBbvOeFxgc25oetdEOGo,22463
19
19
  matrx_graph/mapping_sources.py,sha256=8VGTbPmib7uyh2L8ZnjsJa6h57lKgz0JOpJ9fmkcYxU,3910
20
- matrx_graph/overview.py,sha256=3_hxx3dFZQtZkVE-9TcdU8udK4GWndnHKKPNU__aTws,24406
20
+ matrx_graph/overview.py,sha256=gFDOBmZXZMePTpmhuoaanUMk1jS1aEabzp-kcrGEJeE,26081
21
21
  matrx_graph/patch.py,sha256=DCd7MioacEfcaPxuvrDZS9uxfUE-3EKN7FBL4vLc9y0,10675
22
22
  matrx_graph/paths.py,sha256=n2taRh5w2FiRZgrwnDMoipJ7xD-E-DposJAspge0kbE,3802
23
23
  matrx_graph/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -251,10 +251,10 @@ matrx_graph/workers/__init__.py,sha256=G8e24ryKLafH_NggiiGIb9EZ7YparOJ5DaBOw0bbP
251
251
  matrx_graph/workers/capability.py,sha256=9kFjZCfuie5GkevLLTBJVJ3m9NeeS36RJhbjK0r86fw,11058
252
252
  matrx_graph/workers/cron_watcher.py,sha256=JVzUJ7Wmtz9PPwUtkxnSyqkheK3nEM-7lHUlecdazYY,3988
253
253
  matrx_graph/workers/event_watcher.py,sha256=DYk4RgapiJJDyKY8zirBpp3HAlqi7BWExf4rWW97FHY,6263
254
- matrx_graph/workers/job_lease.py,sha256=pYZidqPB4hgHa8KKZqSJDGetsW7Wm_aVwSXM0ycrrfY,7213
254
+ matrx_graph/workers/job_lease.py,sha256=6f-02QMfRDuh39dPr8FdNqsoX3SP-5XsmthxuWfiKww,7331
255
255
  matrx_graph/workers/queue.py,sha256=GGzuJju1DvrZFPbfvGQEMuWay-2m18NzZPNlWligS4Q,32413
256
256
  matrx_graph/workers/runner.py,sha256=6ALoNst6LY9pK-8I7r0QPLjdKpSfyimp5JwFb1PFdmI,23946
257
257
  matrx_graph/workers/sleep_wake.py,sha256=1V-opM2zYtuN3n4ez85C4trYHoEapVwz8F7_MAex8HI,5970
258
- matrx_graph-0.2.332.dist-info/METADATA,sha256=Xtv8QD6KJcjVl9GHAwEdySTwocg45udFubgG2r2VWYk,5480
259
- matrx_graph-0.2.332.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
260
- matrx_graph-0.2.332.dist-info/RECORD,,
258
+ matrx_graph-0.2.334.dist-info/METADATA,sha256=jYjh5pzwYSkINtlCky_o2JZwVaT8_5wFKjdU1lojBtM,5480
259
+ matrx_graph-0.2.334.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
260
+ matrx_graph-0.2.334.dist-info/RECORD,,