lacelang-executor 0.1.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.
- lacelang_executor-0.1.0/LICENSE +191 -0
- lacelang_executor-0.1.0/NOTICE +23 -0
- lacelang_executor-0.1.0/PKG-INFO +285 -0
- lacelang_executor-0.1.0/README.md +255 -0
- lacelang_executor-0.1.0/pyproject.toml +59 -0
- lacelang_executor-0.1.0/setup.cfg +4 -0
- lacelang_executor-0.1.0/src/lacelang_executor/__init__.py +6 -0
- lacelang_executor-0.1.0/src/lacelang_executor/__main__.py +4 -0
- lacelang_executor-0.1.0/src/lacelang_executor/api.py +430 -0
- lacelang_executor-0.1.0/src/lacelang_executor/cli.py +290 -0
- lacelang_executor-0.1.0/src/lacelang_executor/config.py +274 -0
- lacelang_executor-0.1.0/src/lacelang_executor/executor.py +1554 -0
- lacelang_executor-0.1.0/src/lacelang_executor/extensions/badNamespace.laceext +21 -0
- lacelang_executor-0.1.0/src/lacelang_executor/extensions/configDemo.config +7 -0
- lacelang_executor-0.1.0/src/lacelang_executor/extensions/configDemo.laceext +29 -0
- lacelang_executor-0.1.0/src/lacelang_executor/extensions/hookTrace.laceext +103 -0
- lacelang_executor-0.1.0/src/lacelang_executor/extensions/laceBaseline.config +18 -0
- lacelang_executor-0.1.0/src/lacelang_executor/extensions/laceBaseline.laceext +211 -0
- lacelang_executor-0.1.0/src/lacelang_executor/extensions/laceNotifications.config +6 -0
- lacelang_executor-0.1.0/src/lacelang_executor/extensions/laceNotifications.laceext +279 -0
- lacelang_executor-0.1.0/src/lacelang_executor/extensions/notifCounter.laceext +23 -0
- lacelang_executor-0.1.0/src/lacelang_executor/extensions/notifRelay.laceext +25 -0
- lacelang_executor-0.1.0/src/lacelang_executor/extensions/notifWatch.laceext +31 -0
- lacelang_executor-0.1.0/src/lacelang_executor/http_timing.py +320 -0
- lacelang_executor-0.1.0/src/lacelang_executor/laceext/__init__.py +15 -0
- lacelang_executor-0.1.0/src/lacelang_executor/laceext/dsl_lexer.py +273 -0
- lacelang_executor-0.1.0/src/lacelang_executor/laceext/dsl_parser.py +498 -0
- lacelang_executor-0.1.0/src/lacelang_executor/laceext/interpreter.py +352 -0
- lacelang_executor-0.1.0/src/lacelang_executor/laceext/loader.py +390 -0
- lacelang_executor-0.1.0/src/lacelang_executor/laceext/primitives.py +105 -0
- lacelang_executor-0.1.0/src/lacelang_executor/laceext/registry.py +353 -0
- lacelang_executor-0.1.0/src/lacelang_executor.egg-info/PKG-INFO +285 -0
- lacelang_executor-0.1.0/src/lacelang_executor.egg-info/SOURCES.txt +40 -0
- lacelang_executor-0.1.0/src/lacelang_executor.egg-info/dependency_links.txt +1 -0
- lacelang_executor-0.1.0/src/lacelang_executor.egg-info/entry_points.txt +2 -0
- lacelang_executor-0.1.0/src/lacelang_executor.egg-info/requires.txt +9 -0
- lacelang_executor-0.1.0/src/lacelang_executor.egg-info/top_level.txt +1 -0
- lacelang_executor-0.1.0/tests/test_api.py +122 -0
- lacelang_executor-0.1.0/tests/test_config.py +119 -0
- lacelang_executor-0.1.0/tests/test_integration.py +306 -0
- lacelang_executor-0.1.0/tests/test_schema.py +117 -0
- lacelang_executor-0.1.0/tests/test_smoke.py +104 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding any notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2026 lacelang contributors
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
lacelang-executor
|
|
2
|
+
Copyright 2026 lacelang contributors
|
|
3
|
+
|
|
4
|
+
This product includes software developed by the Lace project
|
|
5
|
+
(https://github.com/tracedown/lacelang).
|
|
6
|
+
|
|
7
|
+
RESPONSIBLE USE
|
|
8
|
+
|
|
9
|
+
This software is designed for legitimate HTTP monitoring, uptime
|
|
10
|
+
checking, and API testing against endpoints you own or have explicit
|
|
11
|
+
authorization to probe. The user is solely responsible for ensuring
|
|
12
|
+
that their use of this software complies with all applicable laws,
|
|
13
|
+
regulations, terms of service, and acceptable use policies.
|
|
14
|
+
|
|
15
|
+
Using this software to send unsolicited, unauthorized, or excessive
|
|
16
|
+
requests to third-party services — including but not limited to
|
|
17
|
+
denial-of-service attacks, unauthorized vulnerability scanning, or
|
|
18
|
+
any form of abuse — is strictly prohibited and is the sole
|
|
19
|
+
responsibility of the user. The authors and contributors of this
|
|
20
|
+
software bear no liability for any misuse.
|
|
21
|
+
|
|
22
|
+
By using this software, you acknowledge that you have obtained proper
|
|
23
|
+
authorization for all endpoints targeted by your probes.
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lacelang-executor
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Reference Python executor for the Lace probe scripting language. Depends on lacelang-validator for parsing and semantic checks.
|
|
5
|
+
Author: lacelang contributors
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/tracedown/lacelang-python-executor
|
|
8
|
+
Project-URL: Validator, https://github.com/tracedown/lacelang-python-validator
|
|
9
|
+
Project-URL: Specification, https://github.com/tracedown/lacelang
|
|
10
|
+
Keywords: lace,lacelang,executor,http,probe,monitoring
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Software Development :: Interpreters
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
License-File: NOTICE
|
|
23
|
+
Requires-Dist: lacelang-validator<0.2,>=0.1
|
|
24
|
+
Requires-Dist: tomli>=2.0; python_version < "3.11"
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
27
|
+
Requires-Dist: mypy>=1.5; extra == "dev"
|
|
28
|
+
Requires-Dist: ruff>=0.1; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# lacelang-executor (python)
|
|
32
|
+
|
|
33
|
+
Canonical Python executor for [Lace](https://github.com/tracedown/lacelang) —
|
|
34
|
+
the reference implementation with **100% spec conformance**. Runs `.lace`
|
|
35
|
+
scripts against real HTTP endpoints and emits ProbeResult JSON.
|
|
36
|
+
|
|
37
|
+
This is the executor that the Lace specification is developed and tested
|
|
38
|
+
against. Conformance vectors, error codes, and wire-format schemas are
|
|
39
|
+
verified against this implementation before each spec release.
|
|
40
|
+
|
|
41
|
+
Parsing and semantic validation are delegated to
|
|
42
|
+
[`lacelang-validator`](https://github.com/tracedown/lacelang-python-validator) — this package contains
|
|
43
|
+
only the runtime (HTTP client, assertion evaluation, cookie jars, extension
|
|
44
|
+
dispatch). See `lace-spec.md` §15 for the validator / executor package
|
|
45
|
+
separation rule.
|
|
46
|
+
|
|
47
|
+
## Install
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install lacelang-executor
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This automatically installs `lacelang-validator` as a dependency.
|
|
54
|
+
|
|
55
|
+
Or from source:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install git+https://github.com/tracedown/lacelang-python-executor.git
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Parse (delegates to validator)
|
|
65
|
+
lacelang-executor parse script.lace
|
|
66
|
+
|
|
67
|
+
# Validate (delegates to validator)
|
|
68
|
+
lacelang-executor validate script.lace --context context.json --vars-list vars.json
|
|
69
|
+
|
|
70
|
+
# Run — full HTTP execution
|
|
71
|
+
lacelang-executor run script.lace \
|
|
72
|
+
--vars vars.json \
|
|
73
|
+
--prev prev.json \
|
|
74
|
+
--bodies-dir ./bodies
|
|
75
|
+
|
|
76
|
+
# Enable extensions (laceNotifications is built in)
|
|
77
|
+
lacelang-executor run script.lace --enable-extension laceNotifications
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
All subcommands support `--pretty` for indented JSON.
|
|
81
|
+
|
|
82
|
+
## Library usage
|
|
83
|
+
|
|
84
|
+
### Project layout
|
|
85
|
+
|
|
86
|
+
The executor expects Lace files under a dedicated `lace/` directory:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
my-project/
|
|
90
|
+
lace/
|
|
91
|
+
lace.config # executor config (auto-discovered)
|
|
92
|
+
config.staging.json # env-specific overrides (optional)
|
|
93
|
+
extensions/ # third-party extensions
|
|
94
|
+
myext/
|
|
95
|
+
myext.laceext
|
|
96
|
+
myext.config
|
|
97
|
+
scripts/
|
|
98
|
+
health/
|
|
99
|
+
health.lace # script (name = directory name)
|
|
100
|
+
vars.json # default variables
|
|
101
|
+
vars.staging.json # env-specific variables
|
|
102
|
+
auth-flow/
|
|
103
|
+
auth-flow.lace
|
|
104
|
+
vars.json
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
All paths are overridable at runtime — the layout is a convention,
|
|
108
|
+
not a requirement.
|
|
109
|
+
|
|
110
|
+
### `LaceExecutor` + `LaceProbe`
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
from lacelang_executor import LaceExecutor
|
|
114
|
+
|
|
115
|
+
# Point to the lace/ directory — config loaded once
|
|
116
|
+
executor = LaceExecutor("lace")
|
|
117
|
+
|
|
118
|
+
# Or override the config path directly
|
|
119
|
+
executor = LaceExecutor(config="path/to/lace.config", env="staging")
|
|
120
|
+
|
|
121
|
+
# Register third-party extensions
|
|
122
|
+
executor.extension("lace/extensions/myext") # directory (finds myext.laceext + myext.config)
|
|
123
|
+
executor.extension("path/to/custom.laceext", "path/to/custom.config") # explicit paths
|
|
124
|
+
|
|
125
|
+
# Prepare a probe by name — resolves to lace/scripts/health/health.lace
|
|
126
|
+
# AST is parsed and validated once, reused across runs
|
|
127
|
+
probe = executor.probe("health")
|
|
128
|
+
|
|
129
|
+
# Run — returns a ProbeResult dict
|
|
130
|
+
result = probe.run(vars={"base_url": "https://api.example.com"})
|
|
131
|
+
|
|
132
|
+
# Run again — prev result from last run injected automatically
|
|
133
|
+
result = probe.run()
|
|
134
|
+
|
|
135
|
+
# All inputs accept file paths or dicts
|
|
136
|
+
result = probe.run(
|
|
137
|
+
vars="lace/scripts/health/vars.staging.json",
|
|
138
|
+
prev="results/last_run.json", # explicit prev overrides auto-tracking
|
|
139
|
+
)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### One-shot execution
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
# No probe caching, no prev tracking
|
|
146
|
+
result = executor.run("lace/scripts/health/health.lace", vars={"key": "val"})
|
|
147
|
+
|
|
148
|
+
# Inline source
|
|
149
|
+
result = executor.run('''
|
|
150
|
+
get("https://api.example.com/health")
|
|
151
|
+
.expect(status: 200)
|
|
152
|
+
''')
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Development mode
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
# Re-read and re-parse the script file on every run()
|
|
159
|
+
probe = executor.probe("health", always_reparse=True)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### API reference
|
|
163
|
+
|
|
164
|
+
**`LaceExecutor(root, *, config, env, extensions, track_prev)`**
|
|
165
|
+
|
|
166
|
+
| Parameter | Type | Default | Description |
|
|
167
|
+
|-----------|------|---------|-------------|
|
|
168
|
+
| `root` | `str \| None` | `None` | Path to the `lace/` directory. Discovers `lace.config` and resolves script names relative to `{root}/scripts/`. |
|
|
169
|
+
| `config` | `str \| None` | `None` | Explicit path to `lace.config` (overrides root-based discovery). |
|
|
170
|
+
| `env` | `str \| None` | `None` | Selects `[lace.config.{env}]` section (overrides `LACE_ENV`). |
|
|
171
|
+
| `extensions` | `list[str] \| None` | `None` | Built-in extensions to activate (e.g. `["laceNotifications"]`). |
|
|
172
|
+
| `track_prev` | `bool` | `True` | Auto-store last result as `prev` for next run on each probe. |
|
|
173
|
+
|
|
174
|
+
**`executor.extension(path, config_path=None)`** — register a third-party extension.
|
|
175
|
+
|
|
176
|
+
**`executor.probe(script, *, vars, always_reparse)`** — prepare a reusable probe.
|
|
177
|
+
|
|
178
|
+
| Parameter | Type | Default | Description |
|
|
179
|
+
|-----------|------|---------|-------------|
|
|
180
|
+
| `script` | `str` | — | Script name (`"health"`), file path (`"path/to.lace"`), or inline source. |
|
|
181
|
+
| `always_reparse` | `bool` | `False` | Re-read script file on every `run()`. |
|
|
182
|
+
|
|
183
|
+
**`probe.run(vars, prev, *, reparse)`** — execute and return ProbeResult.
|
|
184
|
+
|
|
185
|
+
| Parameter | Type | Default | Description |
|
|
186
|
+
|-----------|------|---------|-------------|
|
|
187
|
+
| `vars` | `str \| dict \| None` | `None` | Script variables — dict or path to JSON. |
|
|
188
|
+
| `prev` | `str \| dict \| None` | `None` | Previous result — dict or path to JSON. Overrides auto-tracking. |
|
|
189
|
+
| `reparse` | `bool` | `False` | Re-read script from disk for this run only. |
|
|
190
|
+
|
|
191
|
+
### Config and environment overrides
|
|
192
|
+
|
|
193
|
+
There is exactly **one config file** per executor. The `env` parameter
|
|
194
|
+
selects a **section within that file**, not a different file.
|
|
195
|
+
|
|
196
|
+
```toml
|
|
197
|
+
# lace/lace.config
|
|
198
|
+
|
|
199
|
+
[executor]
|
|
200
|
+
maxRedirects = 10
|
|
201
|
+
maxTimeoutMs = 300000
|
|
202
|
+
|
|
203
|
+
# Staging overlay — deep-merged on top of base.
|
|
204
|
+
# Only the keys you specify are overridden; the rest is inherited.
|
|
205
|
+
[lace.config.staging]
|
|
206
|
+
[lace.config.staging.executor]
|
|
207
|
+
maxTimeoutMs = 60000 # overridden
|
|
208
|
+
# maxRedirects is inherited (10)
|
|
209
|
+
|
|
210
|
+
[lace.config.production]
|
|
211
|
+
[lace.config.production.executor]
|
|
212
|
+
user_agent = "lace-probe/0.9.1 (acme-platform)"
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Resolution by constructor arguments:
|
|
216
|
+
|
|
217
|
+
| Constructor | Config file | Env overlay |
|
|
218
|
+
|-------------|-------------|-------------|
|
|
219
|
+
| `LaceExecutor("lace")` | `lace/lace.config` | none (base only) |
|
|
220
|
+
| `LaceExecutor("lace", env="staging")` | `lace/lace.config` | `[lace.config.staging]` merged on base |
|
|
221
|
+
| `LaceExecutor(config="/path/lace.config", env="prod")` | `/path/lace.config` | `[lace.config.prod]` merged on base |
|
|
222
|
+
| `LaceExecutor("lace", config="/other/lace.config")` | `/other/lace.config` | none (root still used for script names) |
|
|
223
|
+
| `LACE_ENV=staging` + `LaceExecutor("lace")` | `lace/lace.config` | `[lace.config.staging]` (from env var) |
|
|
224
|
+
| `LACE_ENV=staging` + `LaceExecutor("lace", env="prod")` | `lace/lace.config` | `[lace.config.prod]` (kwarg wins) |
|
|
225
|
+
|
|
226
|
+
The `config=` kwarg overrides where the file is loaded from.
|
|
227
|
+
The `env=` kwarg (or `LACE_ENV`) selects which section inside
|
|
228
|
+
that file is overlaid. They are independent — setting one does
|
|
229
|
+
not affect the other.
|
|
230
|
+
|
|
231
|
+
### Return value
|
|
232
|
+
|
|
233
|
+
Both `probe.run()` and `executor.run()` return a `dict` matching the
|
|
234
|
+
ProbeResult wire format (spec §9):
|
|
235
|
+
|
|
236
|
+
```python
|
|
237
|
+
{
|
|
238
|
+
"outcome": "success", # "success" | "failure" | "timeout"
|
|
239
|
+
"startedAt": "2026-04-20T10:00:00.000Z",
|
|
240
|
+
"endedAt": "2026-04-20T10:00:01.234Z",
|
|
241
|
+
"elapsedMs": 1234,
|
|
242
|
+
"runVars": {}, # run-scoped variables from .store()
|
|
243
|
+
"calls": [...], # per-call result records
|
|
244
|
+
"actions": {}, # write-back variables, notifications, etc.
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Low-level API
|
|
249
|
+
|
|
250
|
+
The stateless `run_script()` function is available for callers that need
|
|
251
|
+
full control over parsing, validation, and config:
|
|
252
|
+
|
|
253
|
+
```python
|
|
254
|
+
from lacelang_validator.parser import parse
|
|
255
|
+
from lacelang_executor.executor import run_script
|
|
256
|
+
from lacelang_executor.config import load_config
|
|
257
|
+
|
|
258
|
+
ast = parse(open("script.lace").read())
|
|
259
|
+
config = load_config(explicit_path="lace.config")
|
|
260
|
+
|
|
261
|
+
result = run_script(ast, script_vars={"key": "val"}, config=config)
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## User-Agent
|
|
265
|
+
|
|
266
|
+
Per `lace-spec.md` §3.6, this executor sets a default `User-Agent` on
|
|
267
|
+
outgoing requests:
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
User-Agent: lace-probe/<version> (lacelang-python)
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Precedence (highest first): per-request `headers: { "User-Agent": ... }` →
|
|
274
|
+
`lace.config [executor].user_agent` → the default above.
|
|
275
|
+
|
|
276
|
+
## Responsible use
|
|
277
|
+
|
|
278
|
+
This software is designed for monitoring endpoints you **own or have
|
|
279
|
+
explicit authorization to probe**. You are solely responsible for
|
|
280
|
+
ensuring your use complies with all applicable laws, terms of service,
|
|
281
|
+
and acceptable use policies. See `NOTICE` for the full statement.
|
|
282
|
+
|
|
283
|
+
## License
|
|
284
|
+
|
|
285
|
+
Apache License 2.0
|