urirun-flow 0.2.0__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.
- urirun_flow-0.2.0/LICENSE +201 -0
- urirun_flow-0.2.0/NOTICE +5 -0
- urirun_flow-0.2.0/PKG-INFO +78 -0
- urirun_flow-0.2.0/README.md +66 -0
- urirun_flow-0.2.0/pyproject.toml +18 -0
- urirun_flow-0.2.0/setup.cfg +4 -0
- urirun_flow-0.2.0/tests/test_conformance.py +12 -0
- urirun_flow-0.2.0/tests/test_flow.py +62 -0
- urirun_flow-0.2.0/tests/test_resilience.py +208 -0
- urirun_flow-0.2.0/tests/test_run.py +32 -0
- urirun_flow-0.2.0/urirun_flow.egg-info/PKG-INFO +78 -0
- urirun_flow-0.2.0/urirun_flow.egg-info/SOURCES.txt +13 -0
- urirun_flow-0.2.0/urirun_flow.egg-info/dependency_links.txt +1 -0
- urirun_flow-0.2.0/urirun_flow.egg-info/requires.txt +1 -0
- urirun_flow-0.2.0/urirun_flow.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
urirun_flow-0.2.0/NOTICE
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: urirun-flow
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Meta-package: author urirun URI flows in typed Python (Pydantic) and convert to/from YAML. The `urirun_flow` import package (DSL + engine) and the `urirun-flow` console script now ship inside the `urirun` distribution (the single source of truth); this distribution just depends on it so `pip install urirun-flow` and `import urirun_flow` keep working.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
License-File: NOTICE
|
|
10
|
+
Requires-Dist: urirun>=0.4.186
|
|
11
|
+
Dynamic: license-file
|
|
12
|
+
|
|
13
|
+
# urirun-flow
|
|
14
|
+
|
|
15
|
+
Author urirun **URI flows** in a typed programming language, and convert them
|
|
16
|
+
to/from the canonical YAML flow format — the way **Pydantic** gives data a typed,
|
|
17
|
+
validated model that serializes to a schema.
|
|
18
|
+
|
|
19
|
+
A urirun *flow* is an ordered DAG of URI steps (`query` reads, `command` mutates),
|
|
20
|
+
chaining prior results. The interchange format is YAML
|
|
21
|
+
(see [examples/17-flows](https://examples.ifuri.com/)); `urirun-flow` lets you build
|
|
22
|
+
and validate that flow in code, with autocompletion, and emit the exact YAML a
|
|
23
|
+
runner executes.
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
|
|
27
|
+
YAML is great for sharing and running a flow, but a typed language gives you
|
|
28
|
+
**control**: autocompletion of step references, compile-/run-time validation of the
|
|
29
|
+
DAG, refactorability, and the ability to compute a flow (loops, conditionals,
|
|
30
|
+
parameters) instead of hand-writing YAML. `urirun-flow` is the bridge — round-trip
|
|
31
|
+
between the two.
|
|
32
|
+
|
|
33
|
+
## Use (Python, Pydantic)
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from urirun_flow import Flow
|
|
37
|
+
|
|
38
|
+
flow = Flow(task={"title": "Web recon"}, registry="tools.bindings.json",
|
|
39
|
+
allow=["httpcheck://*", "browser://*", "log://*"])
|
|
40
|
+
|
|
41
|
+
up = flow.step("httpcheck://host/url/query/status", id="up", payload={"url": URL})
|
|
42
|
+
read = flow.step("browser://chrome/page/query/dom", id="read",
|
|
43
|
+
payload={"url": URL}, after=[up])
|
|
44
|
+
flow.step("log://host/run/command/write", id="audit",
|
|
45
|
+
payload={"detail": read.ref("text")}, after=[read]) # typed reference
|
|
46
|
+
|
|
47
|
+
print(flow.to_yaml()) # canonical urirun flow YAML
|
|
48
|
+
Flow.from_yaml(text) # parse + validate back into the model
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`.step()` returns the typed `Step`, so a later step references its output with
|
|
52
|
+
`step.ref("field")` — a checked `<id>.<field>` chain rather than a magic string.
|
|
53
|
+
|
|
54
|
+
The model validates on every build: URIs are well-formed, `depends_on` resolves to a
|
|
55
|
+
real step, and the graph is acyclic. `kind` (`query`/`command`) is derived from the URI.
|
|
56
|
+
|
|
57
|
+
## CLI
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
urirun-flow to-yaml web_recon:flow # import a Python flow object → YAML
|
|
61
|
+
urirun-flow validate flow.yaml # DAG / deps / URIs
|
|
62
|
+
urirun-flow from-yaml flow.yaml # parse + re-emit (normalize / round-trip)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Proposal: typed flows in any language
|
|
66
|
+
|
|
67
|
+
The flow is a **language-agnostic contract** (`{task, registry, allow, steps:[{id,
|
|
68
|
+
uri, payload, depends_on}]}`). `urirun-flow` is its Python (Pydantic) model; the same
|
|
69
|
+
builder→dict mapping is implementable in any typed language and emits the identical
|
|
70
|
+
YAML — exactly how the urirun connector SDKs stay in lockstep across languages.
|
|
71
|
+
|
|
72
|
+
`js/urirun-flow.js` is a runnable JS/TS emitter (typed via `js/urirun-flow.d.ts`) that
|
|
73
|
+
builds the **identical** flow contract. `make conformance` builds the same reference
|
|
74
|
+
flow in every language and asserts they agree — like `make conformance` for connector
|
|
75
|
+
bindings. Verified: **2/2 emitters agree** (Python + JS).
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
Apache-2.0 — see [LICENSE](LICENSE) / [NOTICE](NOTICE).
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# urirun-flow
|
|
2
|
+
|
|
3
|
+
Author urirun **URI flows** in a typed programming language, and convert them
|
|
4
|
+
to/from the canonical YAML flow format — the way **Pydantic** gives data a typed,
|
|
5
|
+
validated model that serializes to a schema.
|
|
6
|
+
|
|
7
|
+
A urirun *flow* is an ordered DAG of URI steps (`query` reads, `command` mutates),
|
|
8
|
+
chaining prior results. The interchange format is YAML
|
|
9
|
+
(see [examples/17-flows](https://examples.ifuri.com/)); `urirun-flow` lets you build
|
|
10
|
+
and validate that flow in code, with autocompletion, and emit the exact YAML a
|
|
11
|
+
runner executes.
|
|
12
|
+
|
|
13
|
+
## Why
|
|
14
|
+
|
|
15
|
+
YAML is great for sharing and running a flow, but a typed language gives you
|
|
16
|
+
**control**: autocompletion of step references, compile-/run-time validation of the
|
|
17
|
+
DAG, refactorability, and the ability to compute a flow (loops, conditionals,
|
|
18
|
+
parameters) instead of hand-writing YAML. `urirun-flow` is the bridge — round-trip
|
|
19
|
+
between the two.
|
|
20
|
+
|
|
21
|
+
## Use (Python, Pydantic)
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from urirun_flow import Flow
|
|
25
|
+
|
|
26
|
+
flow = Flow(task={"title": "Web recon"}, registry="tools.bindings.json",
|
|
27
|
+
allow=["httpcheck://*", "browser://*", "log://*"])
|
|
28
|
+
|
|
29
|
+
up = flow.step("httpcheck://host/url/query/status", id="up", payload={"url": URL})
|
|
30
|
+
read = flow.step("browser://chrome/page/query/dom", id="read",
|
|
31
|
+
payload={"url": URL}, after=[up])
|
|
32
|
+
flow.step("log://host/run/command/write", id="audit",
|
|
33
|
+
payload={"detail": read.ref("text")}, after=[read]) # typed reference
|
|
34
|
+
|
|
35
|
+
print(flow.to_yaml()) # canonical urirun flow YAML
|
|
36
|
+
Flow.from_yaml(text) # parse + validate back into the model
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`.step()` returns the typed `Step`, so a later step references its output with
|
|
40
|
+
`step.ref("field")` — a checked `<id>.<field>` chain rather than a magic string.
|
|
41
|
+
|
|
42
|
+
The model validates on every build: URIs are well-formed, `depends_on` resolves to a
|
|
43
|
+
real step, and the graph is acyclic. `kind` (`query`/`command`) is derived from the URI.
|
|
44
|
+
|
|
45
|
+
## CLI
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
urirun-flow to-yaml web_recon:flow # import a Python flow object → YAML
|
|
49
|
+
urirun-flow validate flow.yaml # DAG / deps / URIs
|
|
50
|
+
urirun-flow from-yaml flow.yaml # parse + re-emit (normalize / round-trip)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Proposal: typed flows in any language
|
|
54
|
+
|
|
55
|
+
The flow is a **language-agnostic contract** (`{task, registry, allow, steps:[{id,
|
|
56
|
+
uri, payload, depends_on}]}`). `urirun-flow` is its Python (Pydantic) model; the same
|
|
57
|
+
builder→dict mapping is implementable in any typed language and emits the identical
|
|
58
|
+
YAML — exactly how the urirun connector SDKs stay in lockstep across languages.
|
|
59
|
+
|
|
60
|
+
`js/urirun-flow.js` is a runnable JS/TS emitter (typed via `js/urirun-flow.d.ts`) that
|
|
61
|
+
builds the **identical** flow contract. `make conformance` builds the same reference
|
|
62
|
+
flow in every language and asserts they agree — like `make conformance` for connector
|
|
63
|
+
bindings. Verified: **2/2 emitters agree** (Python + JS).
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
Apache-2.0 — see [LICENSE](LICENSE) / [NOTICE](NOTICE).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "urirun-flow"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Meta-package: author urirun URI flows in typed Python (Pydantic) and convert to/from YAML. The `urirun_flow` import package (DSL + engine) and the `urirun-flow` console script now ship inside the `urirun` distribution (the single source of truth); this distribution just depends on it so `pip install urirun-flow` and `import urirun_flow` keep working."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
# Meta-package: ships NO import package of its own (the bundled `urirun` owns `urirun_flow`,
|
|
13
|
+
# which holds both the typed-flow DSL and the flow engine), so installing this alongside
|
|
14
|
+
# `urirun` cannot shadow the bundle copy. The `urirun-flow` console script comes from `urirun`.
|
|
15
|
+
dependencies = ["urirun>=0.4.186"]
|
|
16
|
+
|
|
17
|
+
[tool.setuptools]
|
|
18
|
+
packages = [] # meta-package — no import package shipped
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""Every language flow emitter agrees with the Python reference."""
|
|
2
|
+
import shutil, subprocess, sys, pathlib
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@pytest.mark.skipif(not shutil.which("node"), reason="node not installed")
|
|
9
|
+
def test_flow_conformance_all_emitters_agree():
|
|
10
|
+
r = subprocess.run([sys.executable, str(ROOT / "conformance.py")], capture_output=True, text=True)
|
|
11
|
+
assert r.returncode == 0, r.stdout + r.stderr
|
|
12
|
+
assert "0 error(s)" in r.stdout
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""urirun-flow: typed authoring, validation and YAML round-trip."""
|
|
2
|
+
import pytest
|
|
3
|
+
from pydantic import ValidationError
|
|
4
|
+
|
|
5
|
+
from urirun_flow import Flow, Step, FlowError
|
|
6
|
+
|
|
7
|
+
# Pydantic wraps validator errors raised during construction in ValidationError;
|
|
8
|
+
# the builder path (flow.step) raises FlowError directly. Accept either.
|
|
9
|
+
INVALID = (FlowError, ValidationError)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_builder_chains_refs_and_derives_kind():
|
|
13
|
+
flow = Flow(task={"title": "t"})
|
|
14
|
+
a = flow.step("ocr://host/image/latest/query/text", id="read")
|
|
15
|
+
flow.step("llm://host/vision/query/analyze", id="analyze",
|
|
16
|
+
payload={"text": a.ref("text")}, after=[a])
|
|
17
|
+
assert flow.steps[0].kind == "query" # derived from the URI tail
|
|
18
|
+
assert flow.steps[1].depends_on == ["read"]
|
|
19
|
+
assert flow.steps[1].payload["text"] == "read.text"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_to_yaml_shape_matches_urirun_flow():
|
|
23
|
+
flow = Flow(task={"title": "t"}, registry="r.json", allow=["ocr://*"])
|
|
24
|
+
flow.step("ocr://host/image/latest/query/text", id="read", payload={"src": "x"})
|
|
25
|
+
data = flow.to_dict()
|
|
26
|
+
assert set(data) == {"task", "registry", "allow", "steps"}
|
|
27
|
+
assert data["steps"][0] == {"id": "read", "uri": "ocr://host/image/latest/query/text",
|
|
28
|
+
"payload": {"src": "x"}}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_round_trip_is_stable():
|
|
32
|
+
flow = Flow(task={"title": "t"})
|
|
33
|
+
up = flow.step("httpcheck://host/url/query/status", id="up", payload={"url": "u"})
|
|
34
|
+
flow.step("log://host/run/command/write", id="audit", after=[up], payload={"e": 1})
|
|
35
|
+
text = flow.to_yaml()
|
|
36
|
+
assert Flow.from_yaml(text).to_yaml() == text
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_rejects_dangling_dependency():
|
|
40
|
+
with pytest.raises(INVALID):
|
|
41
|
+
Flow(steps=[Step(id="a", uri="x://h/r/query/op", depends_on=["nope"])])
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_rejects_cycle():
|
|
45
|
+
with pytest.raises(INVALID):
|
|
46
|
+
Flow(steps=[
|
|
47
|
+
Step(id="a", uri="x://h/r/query/op", depends_on=["b"]),
|
|
48
|
+
Step(id="b", uri="x://h/r/query/op2", depends_on=["a"]),
|
|
49
|
+
])
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_rejects_non_uri():
|
|
53
|
+
with pytest.raises(INVALID):
|
|
54
|
+
Step(id="a", uri="not-a-uri")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def test_order_respects_dependencies():
|
|
58
|
+
flow = Flow()
|
|
59
|
+
a = flow.step("x://h/r/query/a", id="a")
|
|
60
|
+
b = flow.step("x://h/r/query/b", id="b", after=[a])
|
|
61
|
+
flow.step("x://h/r/query/c", id="c", after=[b])
|
|
62
|
+
assert [s.id for s in flow.order()] == ["a", "b", "c"]
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"""Per-step resilience: retry (by error category), fallback URI, assertion gating, and a flow
|
|
2
|
+
that skips a failed step's dependents instead of crashing.
|
|
3
|
+
|
|
4
|
+
The resolve_step tests are pure (a scripted run_call, no urirun). The run_flow tests exercise
|
|
5
|
+
the real runtime with a tiny argv registry.
|
|
6
|
+
"""
|
|
7
|
+
import json
|
|
8
|
+
|
|
9
|
+
import pytest
|
|
10
|
+
|
|
11
|
+
from urirun_flow import Flow, Step
|
|
12
|
+
from urirun_flow.run import resolve_step, run_flow, flow_summary, envelope_ok, error_category
|
|
13
|
+
|
|
14
|
+
_NOSLEEP = lambda _s: None
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _okenv():
|
|
18
|
+
return {"ok": True, "result": {"value": {"ok": True}}}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _failenv(category):
|
|
22
|
+
return {"ok": False, "error": {"type": "x", "category": category, "message": "boom"}}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# --- resolve_step (pure) --------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
def test_retry_retryable_then_succeeds():
|
|
28
|
+
calls = []
|
|
29
|
+
|
|
30
|
+
def run_call(uri, pl):
|
|
31
|
+
calls.append(uri)
|
|
32
|
+
return _okenv() if len(calls) >= 3 else _failenv("UNAVAILABLE")
|
|
33
|
+
|
|
34
|
+
step = Step(id="s", uri="demo://h/x/command/run", retry={"max": 3, "backoff_ms": 0})
|
|
35
|
+
env = resolve_step(step, {}, run_call, sleep=_NOSLEEP)
|
|
36
|
+
assert envelope_ok(env) and env["attempts"] == 3 and len(calls) == 3
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_terminal_error_not_retried():
|
|
40
|
+
calls = []
|
|
41
|
+
|
|
42
|
+
def run_call(uri, pl):
|
|
43
|
+
calls.append(uri)
|
|
44
|
+
return _failenv("NOT_FOUND") # terminal — must not retry
|
|
45
|
+
|
|
46
|
+
step = Step(id="s", uri="demo://h/x/command/run", retry={"max": 5, "backoff_ms": 0})
|
|
47
|
+
env = resolve_step(step, {}, run_call, sleep=_NOSLEEP)
|
|
48
|
+
assert not envelope_ok(env) and env["attempts"] == 1 and len(calls) == 1
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def test_fallback_used_when_primary_fails():
|
|
52
|
+
def run_call(uri, pl):
|
|
53
|
+
return _failenv("NOT_FOUND") if "primary" in uri else _okenv()
|
|
54
|
+
|
|
55
|
+
step = Step(id="s", uri="demo://h/primary/command/run", fallback="demo://h/backup/command/run")
|
|
56
|
+
env = resolve_step(step, {}, run_call, sleep=_NOSLEEP)
|
|
57
|
+
assert envelope_ok(env) and env["fallbackUsed"] and env["fallbackFor"].endswith("/primary/command/run")
|
|
58
|
+
assert env["primaryError"]["category"] == "NOT_FOUND"
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def test_retry_exhausted_then_fallback():
|
|
62
|
+
calls = []
|
|
63
|
+
|
|
64
|
+
def run_call(uri, pl):
|
|
65
|
+
calls.append(uri)
|
|
66
|
+
return _failenv("UNAVAILABLE") if "primary" in uri else _okenv()
|
|
67
|
+
|
|
68
|
+
step = Step(id="s", uri="demo://h/primary/command/run", retry={"max": 2, "backoff_ms": 0},
|
|
69
|
+
fallback="demo://h/backup/command/run")
|
|
70
|
+
env = resolve_step(step, {}, run_call, sleep=_NOSLEEP)
|
|
71
|
+
primary_calls = [u for u in calls if "primary" in u]
|
|
72
|
+
assert len(primary_calls) == 3 # 1 + 2 retries
|
|
73
|
+
assert envelope_ok(env) and env["fallbackUsed"]
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def test_assertion_failure_marks_step_failed():
|
|
77
|
+
def run_call(uri, pl):
|
|
78
|
+
return {"ok": True, "result": {"value": {"ok": True, "passed": False}}}
|
|
79
|
+
|
|
80
|
+
step = Step(id="a", uri="check://h/x/assertion/passes")
|
|
81
|
+
assert step.kind == "assertion"
|
|
82
|
+
env = resolve_step(step, {}, run_call, sleep=_NOSLEEP)
|
|
83
|
+
assert not envelope_ok(env) and env["error"]["type"] == "assertion"
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def test_assertion_pass_stays_ok():
|
|
87
|
+
def run_call(uri, pl):
|
|
88
|
+
return {"ok": True, "result": {"value": {"ok": True, "passed": True}}}
|
|
89
|
+
|
|
90
|
+
step = Step(id="a", uri="check://h/x/assertion/passes")
|
|
91
|
+
env = resolve_step(step, {}, run_call, sleep=_NOSLEEP)
|
|
92
|
+
assert envelope_ok(env)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def test_error_category_classifies_unstamped():
|
|
96
|
+
# no explicit category -> classified from the exception type
|
|
97
|
+
assert error_category({"error": {"type": "TimeoutError", "message": "timed out"}}) == "DEADLINE_EXCEEDED"
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
# --- flow_summary (surface a broken chain as a tagged artifact) -----------------------------
|
|
101
|
+
|
|
102
|
+
def test_flow_summary_partial_failure():
|
|
103
|
+
results = {
|
|
104
|
+
"a": _okenv(),
|
|
105
|
+
"b": {"ok": False, "error": {"type": "x", "category": "UNAVAILABLE", "message": "down"}},
|
|
106
|
+
"c": {"ok": False, "skipped": True, "error": {"message": "skipped: dependencies ..."}},
|
|
107
|
+
}
|
|
108
|
+
s = flow_summary(results)
|
|
109
|
+
assert s["ok"] is False and s["steps"] == 3
|
|
110
|
+
assert s["succeeded"] == ["a"] and s["failed"] == ["b"] and s["skipped"] == ["c"]
|
|
111
|
+
assert s["firstError"]["step"] == "b" and s["firstError"]["category"] == "UNAVAILABLE"
|
|
112
|
+
# surfaced as a frozen artifact via the shared contract
|
|
113
|
+
assert s["kind"] == "flow-failure" and s["live"] is False
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def test_flow_summary_all_ok():
|
|
117
|
+
s = flow_summary({"a": _okenv(), "b": _okenv()})
|
|
118
|
+
assert s["ok"] is True and not s["failed"] and not s["skipped"]
|
|
119
|
+
assert s["kind"] == "flow-result" and s["live"] is False
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
# --- run_flow (real runtime) ----------------------------------------------------------------
|
|
123
|
+
|
|
124
|
+
pytest.importorskip("urirun")
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def _registry(tmp_path):
|
|
128
|
+
from urirun import v2
|
|
129
|
+
doc = {"version": v2.VERSION, "bindings": {
|
|
130
|
+
"demo://host/ok/command/run": {"uri": "demo://host/ok/command/run", "kind": "command",
|
|
131
|
+
"adapter": "argv-template", "argv": ["true"], "policy": {"allowExecute": True}},
|
|
132
|
+
"demo://host/fail/command/run": {"uri": "demo://host/fail/command/run", "kind": "command",
|
|
133
|
+
"adapter": "argv-template", "argv": ["false"], "policy": {"allowExecute": True}},
|
|
134
|
+
"demo://host/echo/command/say": {"uri": "demo://host/echo/command/say", "kind": "command",
|
|
135
|
+
"adapter": "argv-template", "argv": ["printf", "%s", "ok"], "policy": {"allowExecute": True}}}}
|
|
136
|
+
(tmp_path / "reg.json").write_text(json.dumps(v2.compile_registry(doc)))
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def test_failed_step_skips_dependents_no_crash(tmp_path):
|
|
140
|
+
_registry(tmp_path)
|
|
141
|
+
flow = Flow(registry="reg.json", allow=["demo://*"])
|
|
142
|
+
a = flow.step("demo://host/fail/command/run", id="a")
|
|
143
|
+
flow.step("demo://host/echo/command/say", id="b", after=[a])
|
|
144
|
+
results = run_flow(flow, tmp_path, execute=True) # must not raise
|
|
145
|
+
assert results["a"]["ok"] is False
|
|
146
|
+
assert results["b"].get("skipped") is True
|
|
147
|
+
assert "a" in results["b"]["error"]["message"]
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def test_step_fallback_in_flow(tmp_path):
|
|
151
|
+
_registry(tmp_path)
|
|
152
|
+
flow = Flow(registry="reg.json", allow=["demo://*"])
|
|
153
|
+
flow.step("demo://host/fail/command/run", id="a", fallback="demo://host/ok/command/run")
|
|
154
|
+
results = run_flow(flow, tmp_path, execute=True)
|
|
155
|
+
assert results["a"]["ok"] is True and results["a"].get("fallbackUsed") is True
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def test_catch_abort_stops_flow(tmp_path):
|
|
159
|
+
_registry(tmp_path)
|
|
160
|
+
flow = Flow(registry="reg.json", allow=["demo://*"])
|
|
161
|
+
flow.step("demo://host/fail/command/run", id="a", catch="abort")
|
|
162
|
+
flow.step("demo://host/ok/command/run", id="b") # independent, but flow aborts before it
|
|
163
|
+
results = run_flow(flow, tmp_path, execute=True)
|
|
164
|
+
assert results["a"]["ok"] is False
|
|
165
|
+
assert results["b"].get("skipped") is True
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def test_degrade_serves_last_good_when_step_fails(tmp_path):
|
|
169
|
+
# a failed live step degrades to an earlier good step's result (live widget -> last artifact)
|
|
170
|
+
_registry(tmp_path)
|
|
171
|
+
flow = Flow(registry="reg.json", allow=["demo://*"])
|
|
172
|
+
good = flow.step("demo://host/echo/command/say", id="good") # produces a result
|
|
173
|
+
flow.step("demo://host/fail/command/run", id="live", degrade=good) # fails -> degrade
|
|
174
|
+
dep = flow.step("demo://host/echo/command/say", id="dep", after=["live"]) # must still run
|
|
175
|
+
results = run_flow(flow, tmp_path, execute=True)
|
|
176
|
+
assert results["live"]["degraded"] is True and results["live"]["ok"] is True
|
|
177
|
+
assert results["live"]["live"] is False and results["live"]["degradedFrom"] == "good"
|
|
178
|
+
# the served result is the good step's result (last-good data)
|
|
179
|
+
assert results["live"]["result"] == results["good"]["result"]
|
|
180
|
+
# the dependent ran (chain kept alive on degraded data)
|
|
181
|
+
assert results["dep"].get("skipped") is not True and results["dep"]["ok"] is True
|
|
182
|
+
s = flow_summary(results)
|
|
183
|
+
assert s["degraded"] == ["live"] and s["ok"] is True
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def test_degrade_not_used_when_primary_ok(tmp_path):
|
|
187
|
+
_registry(tmp_path)
|
|
188
|
+
flow = Flow(registry="reg.json", allow=["demo://*"])
|
|
189
|
+
flow.step("demo://host/echo/command/say", id="good")
|
|
190
|
+
flow.step("demo://host/ok/command/run", id="live", degrade="good")
|
|
191
|
+
results = run_flow(flow, tmp_path, execute=True)
|
|
192
|
+
assert results["live"]["ok"] is True and results["live"].get("degraded") is not True
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def test_degrade_to_unknown_step_rejected():
|
|
196
|
+
with pytest.raises(Exception): # FlowError
|
|
197
|
+
f = Flow(registry="r.json")
|
|
198
|
+
f.step("demo://h/x/command/run", id="a", degrade="nope")
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def test_happy_flow_unchanged(tmp_path):
|
|
202
|
+
# a flow with no resilience config and all-ok steps behaves exactly as before
|
|
203
|
+
_registry(tmp_path)
|
|
204
|
+
flow = Flow(registry="reg.json", allow=["demo://*"])
|
|
205
|
+
a = flow.step("demo://host/ok/command/run", id="a")
|
|
206
|
+
flow.step("demo://host/echo/command/say", id="b", after=[a])
|
|
207
|
+
results = run_flow(flow, tmp_path, execute=True)
|
|
208
|
+
assert results["a"]["ok"] and results["b"]["ok"]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""urirun-flow run: a typed flow executes through urirun with `_from` chaining."""
|
|
2
|
+
import json, pathlib
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
pytest.importorskip("urirun")
|
|
6
|
+
from urirun import v2
|
|
7
|
+
from urirun_flow import Flow
|
|
8
|
+
from urirun_flow.run import run_flow
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _registry(tmp_path):
|
|
12
|
+
doc = {"version": v2.VERSION, "bindings": {
|
|
13
|
+
"demo://host/clock/query/now": {"uri": "demo://host/clock/query/now", "kind": "command",
|
|
14
|
+
"adapter": "argv-template", "argv": ["date", "+%FT%TZ"],
|
|
15
|
+
"policy": {"allowExecute": True}},
|
|
16
|
+
"demo://host/echo/command/say": {"uri": "demo://host/echo/command/say", "kind": "command",
|
|
17
|
+
"adapter": "argv-template", "argv": ["printf", "%s", "{text}"],
|
|
18
|
+
"inputSchema": {"type": "object", "properties": {"text": {"type": "string"}}},
|
|
19
|
+
"policy": {"allowExecute": True}}}}
|
|
20
|
+
(tmp_path / "reg.json").write_text(json.dumps(v2.compile_registry(doc)))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_typed_flow_runs_and_chains(tmp_path):
|
|
24
|
+
_registry(tmp_path)
|
|
25
|
+
flow = Flow(registry="reg.json", allow=["demo://*"])
|
|
26
|
+
clock = flow.step("demo://host/clock/query/now", id="clock")
|
|
27
|
+
flow.step("demo://host/echo/command/say", id="echo",
|
|
28
|
+
payload={"text_from": clock.ref("result.stdout")}, after=[clock])
|
|
29
|
+
results = run_flow(flow, tmp_path, execute=True)
|
|
30
|
+
assert results["clock"]["ok"] and results["echo"]["ok"]
|
|
31
|
+
# the echo step received the clock's stdout (the chain resolved)
|
|
32
|
+
assert results["clock"]["result"]["stdout"].strip() in results["echo"]["result"]["stdout"]
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: urirun-flow
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Meta-package: author urirun URI flows in typed Python (Pydantic) and convert to/from YAML. The `urirun_flow` import package (DSL + engine) and the `urirun-flow` console script now ship inside the `urirun` distribution (the single source of truth); this distribution just depends on it so `pip install urirun-flow` and `import urirun_flow` keep working.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
License-File: NOTICE
|
|
10
|
+
Requires-Dist: urirun>=0.4.186
|
|
11
|
+
Dynamic: license-file
|
|
12
|
+
|
|
13
|
+
# urirun-flow
|
|
14
|
+
|
|
15
|
+
Author urirun **URI flows** in a typed programming language, and convert them
|
|
16
|
+
to/from the canonical YAML flow format — the way **Pydantic** gives data a typed,
|
|
17
|
+
validated model that serializes to a schema.
|
|
18
|
+
|
|
19
|
+
A urirun *flow* is an ordered DAG of URI steps (`query` reads, `command` mutates),
|
|
20
|
+
chaining prior results. The interchange format is YAML
|
|
21
|
+
(see [examples/17-flows](https://examples.ifuri.com/)); `urirun-flow` lets you build
|
|
22
|
+
and validate that flow in code, with autocompletion, and emit the exact YAML a
|
|
23
|
+
runner executes.
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
|
|
27
|
+
YAML is great for sharing and running a flow, but a typed language gives you
|
|
28
|
+
**control**: autocompletion of step references, compile-/run-time validation of the
|
|
29
|
+
DAG, refactorability, and the ability to compute a flow (loops, conditionals,
|
|
30
|
+
parameters) instead of hand-writing YAML. `urirun-flow` is the bridge — round-trip
|
|
31
|
+
between the two.
|
|
32
|
+
|
|
33
|
+
## Use (Python, Pydantic)
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from urirun_flow import Flow
|
|
37
|
+
|
|
38
|
+
flow = Flow(task={"title": "Web recon"}, registry="tools.bindings.json",
|
|
39
|
+
allow=["httpcheck://*", "browser://*", "log://*"])
|
|
40
|
+
|
|
41
|
+
up = flow.step("httpcheck://host/url/query/status", id="up", payload={"url": URL})
|
|
42
|
+
read = flow.step("browser://chrome/page/query/dom", id="read",
|
|
43
|
+
payload={"url": URL}, after=[up])
|
|
44
|
+
flow.step("log://host/run/command/write", id="audit",
|
|
45
|
+
payload={"detail": read.ref("text")}, after=[read]) # typed reference
|
|
46
|
+
|
|
47
|
+
print(flow.to_yaml()) # canonical urirun flow YAML
|
|
48
|
+
Flow.from_yaml(text) # parse + validate back into the model
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`.step()` returns the typed `Step`, so a later step references its output with
|
|
52
|
+
`step.ref("field")` — a checked `<id>.<field>` chain rather than a magic string.
|
|
53
|
+
|
|
54
|
+
The model validates on every build: URIs are well-formed, `depends_on` resolves to a
|
|
55
|
+
real step, and the graph is acyclic. `kind` (`query`/`command`) is derived from the URI.
|
|
56
|
+
|
|
57
|
+
## CLI
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
urirun-flow to-yaml web_recon:flow # import a Python flow object → YAML
|
|
61
|
+
urirun-flow validate flow.yaml # DAG / deps / URIs
|
|
62
|
+
urirun-flow from-yaml flow.yaml # parse + re-emit (normalize / round-trip)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Proposal: typed flows in any language
|
|
66
|
+
|
|
67
|
+
The flow is a **language-agnostic contract** (`{task, registry, allow, steps:[{id,
|
|
68
|
+
uri, payload, depends_on}]}`). `urirun-flow` is its Python (Pydantic) model; the same
|
|
69
|
+
builder→dict mapping is implementable in any typed language and emits the identical
|
|
70
|
+
YAML — exactly how the urirun connector SDKs stay in lockstep across languages.
|
|
71
|
+
|
|
72
|
+
`js/urirun-flow.js` is a runnable JS/TS emitter (typed via `js/urirun-flow.d.ts`) that
|
|
73
|
+
builds the **identical** flow contract. `make conformance` builds the same reference
|
|
74
|
+
flow in every language and asserts they agree — like `make conformance` for connector
|
|
75
|
+
bindings. Verified: **2/2 emitters agree** (Python + JS).
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
Apache-2.0 — see [LICENSE](LICENSE) / [NOTICE](NOTICE).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
NOTICE
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
tests/test_conformance.py
|
|
6
|
+
tests/test_flow.py
|
|
7
|
+
tests/test_resilience.py
|
|
8
|
+
tests/test_run.py
|
|
9
|
+
urirun_flow.egg-info/PKG-INFO
|
|
10
|
+
urirun_flow.egg-info/SOURCES.txt
|
|
11
|
+
urirun_flow.egg-info/dependency_links.txt
|
|
12
|
+
urirun_flow.egg-info/requires.txt
|
|
13
|
+
urirun_flow.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
urirun>=0.4.186
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|