sierra-dev 2.0.0__tar.gz → 2.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.
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/PKG-INFO +1 -1
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/pyproject.toml +1 -1
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/setup.py +3 -3
- sierra_dev-2.2.0/sierra/__init__.py +321 -0
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/_about.py +2 -2
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/abc/__init__.py +1 -3
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/abc/sierra.py +31 -12
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/cli.py +136 -138
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/client.py +17 -31
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/core/base.py +1 -3
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/core/builder.py +280 -229
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/core/checker.py +185 -154
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/core/compiler.py +72 -67
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/core/environment.py +28 -64
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/core/loader.py +25 -73
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/internal/__init__.py +10 -9
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/internal/cache.py +15 -29
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/internal/logger.py +9 -17
- sierra_dev-2.2.0/sierra/invoker.py +395 -0
- sierra_dev-2.2.0/sierra/options.py +112 -0
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/package_manager/__init__.py +3 -3
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/package_manager/installer.py +66 -72
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/package_manager/registry.py +50 -49
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/package_manager/repository.py +92 -100
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/package_manager/search.py +25 -30
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/package_manager/type_validator.py +45 -44
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/package_manager/updater.py +35 -37
- sierra_dev-2.2.0/sierra/results.py +451 -0
- sierra_dev-2.2.0/sierra/stream.py +293 -0
- sierra_dev-2.2.0/sierra/validators.py +396 -0
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra_dev.egg-info/PKG-INFO +1 -1
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra_dev.egg-info/SOURCES.txt +2 -0
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/tests/test_results.py +18 -13
- sierra_dev-2.0.0/sierra/__init__.py +0 -127
- sierra_dev-2.0.0/sierra/invoker.py +0 -186
- sierra_dev-2.0.0/sierra/options.py +0 -28
- sierra_dev-2.0.0/sierra/results.py +0 -174
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/LICENSE +0 -0
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/README.md +0 -0
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/setup.cfg +0 -0
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/__main__.py +0 -0
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/abc/base.py +0 -0
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/core/__init__.py +0 -0
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/internal/errors.py +0 -0
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra/py.typed +0 -0
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra_dev.egg-info/dependency_links.txt +0 -0
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra_dev.egg-info/entry_points.txt +0 -0
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra_dev.egg-info/not-zip-safe +0 -0
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra_dev.egg-info/requires.txt +0 -0
- {sierra_dev-2.0.0 → sierra_dev-2.2.0}/sierra_dev.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "sierra-dev"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.2.0"
|
|
8
8
|
description = "Modern framework for building investigation invoker scripts with APT-like package management"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from setuptools import find_packages, setup
|
|
2
2
|
|
|
3
|
-
with open("README.md",
|
|
3
|
+
with open("README.md", encoding="utf-8") as fh:
|
|
4
4
|
long_description = fh.read()
|
|
5
5
|
|
|
6
6
|
# MkDocs documentation dependencies
|
|
@@ -43,7 +43,7 @@ dev_requirements: list[str] = [
|
|
|
43
43
|
# Core runtime dependencies
|
|
44
44
|
requirements: list[str] = [
|
|
45
45
|
"colorama==0.4.6", # Terminal colors
|
|
46
|
-
"httpx==0.28.1",
|
|
46
|
+
"httpx==0.28.1", # HTTP client for package manager
|
|
47
47
|
"dnspython==2.6.1", # DNS operations for OSINT tools
|
|
48
48
|
"requests==2.32.0", # HTTP requests for OSINT tools
|
|
49
49
|
"beautifulsoup4==4.12.3", # HTML parsing for tech detection
|
|
@@ -51,7 +51,7 @@ requirements: list[str] = [
|
|
|
51
51
|
|
|
52
52
|
setup(
|
|
53
53
|
name="sierra-dev",
|
|
54
|
-
version="2.
|
|
54
|
+
version="2.2.0",
|
|
55
55
|
author="Xsyncio",
|
|
56
56
|
author_email="dev@xsyncio.com",
|
|
57
57
|
description="Sierra Dev - Modern Invoker Package Manager and Development Framework",
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"""
|
|
2
|
+
sierra-dev.
|
|
3
|
+
==========
|
|
4
|
+
|
|
5
|
+
A framework for building and managing invoker scripts that can be used across different nodes in Sierra during any investigation.
|
|
6
|
+
|
|
7
|
+
# Overview
|
|
8
|
+
--------
|
|
9
|
+
|
|
10
|
+
This package provides a comprehensive framework for building, compiling, and loading Sierra applications, including abstract base classes, core components, and internal utilities.
|
|
11
|
+
|
|
12
|
+
# Exposed Components
|
|
13
|
+
-----------------
|
|
14
|
+
|
|
15
|
+
- `create_error_result`: Function to create an error result.
|
|
16
|
+
- `create_tree_result`: Function to create a tree result.
|
|
17
|
+
- `SierraABC`: Abstract base class for Sierra components.
|
|
18
|
+
- `SierraBuilder`: Base class for building Sierra components.
|
|
19
|
+
- `SierraCompiler`: Base class for compiling Sierra components.
|
|
20
|
+
- `SierraConfig`: Top-level configuration for SIERRA invoker scripts.
|
|
21
|
+
- `SierraCoreObject`: Base class for all Sierra components.
|
|
22
|
+
- `SierraDevelopmentEnvironment`: Environment configuration class for Sierra development.
|
|
23
|
+
- `SierraInvokerBuilder`: Builder for Sierra invoker scripts.
|
|
24
|
+
- `SierraLoader`: Base class for loading Sierra components.
|
|
25
|
+
- `SierraSideloader`: Base class for side-loading Sierra components.
|
|
26
|
+
- `UniversalLogger`: Logger class for logging Sierra events.
|
|
27
|
+
- `StreamEmitter`: V2 streaming event emitter with context manager support.
|
|
28
|
+
- `stream_context`: Convenience context manager for V2 streaming sessions.
|
|
29
|
+
|
|
30
|
+
# V2 Streaming
|
|
31
|
+
-----------
|
|
32
|
+
|
|
33
|
+
For V2 invokers that stream results in real-time, use the ``StreamEmitter``:
|
|
34
|
+
|
|
35
|
+
>>> from sierra.stream import StreamEmitter
|
|
36
|
+
>>> with StreamEmitter() as stream:
|
|
37
|
+
... stream.progress("Scanning targets...")
|
|
38
|
+
... stream.result(id="node_1", content="### Target Found")
|
|
39
|
+
... stream.end(summary="Scan complete.")
|
|
40
|
+
|
|
41
|
+
# Integration Notes
|
|
42
|
+
-----------------
|
|
43
|
+
|
|
44
|
+
This package is designed to be used as a foundation for building complex Sierra applications, providing a robust and flexible framework for managing invoker scripts across different nodes.
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
import json
|
|
48
|
+
import os
|
|
49
|
+
import pathlib
|
|
50
|
+
import typing
|
|
51
|
+
|
|
52
|
+
from sierra._about import (
|
|
53
|
+
FEATURES,
|
|
54
|
+
RELEASE_NOTES,
|
|
55
|
+
VERSION_INFO,
|
|
56
|
+
VERSION_MAJOR,
|
|
57
|
+
VERSION_MINOR,
|
|
58
|
+
VERSION_PATCH,
|
|
59
|
+
__author__,
|
|
60
|
+
__author_email__,
|
|
61
|
+
__copyright__,
|
|
62
|
+
__description__,
|
|
63
|
+
__license__,
|
|
64
|
+
__title__,
|
|
65
|
+
__url__,
|
|
66
|
+
__version__,
|
|
67
|
+
)
|
|
68
|
+
from sierra.abc import (
|
|
69
|
+
SierraABC,
|
|
70
|
+
SierraConfig,
|
|
71
|
+
SierraInvokerParam,
|
|
72
|
+
SierraInvokerScript,
|
|
73
|
+
)
|
|
74
|
+
from sierra.client import SierraDevelopmentClient
|
|
75
|
+
from sierra.core import (
|
|
76
|
+
SierraCompiler,
|
|
77
|
+
SierraCoreObject,
|
|
78
|
+
SierraDevelopmentEnvironment,
|
|
79
|
+
SierraInvokerBuilder,
|
|
80
|
+
SierraSideloader,
|
|
81
|
+
)
|
|
82
|
+
from sierra.internal import (
|
|
83
|
+
BaseSierraError,
|
|
84
|
+
CacheManager,
|
|
85
|
+
CompressionType,
|
|
86
|
+
SierraCacheError,
|
|
87
|
+
SierraClientLoadError,
|
|
88
|
+
SierraExecutionError,
|
|
89
|
+
SierraHTTPError,
|
|
90
|
+
SierraPathError,
|
|
91
|
+
SierraPathNotFoundError,
|
|
92
|
+
UniversalLogger,
|
|
93
|
+
)
|
|
94
|
+
from sierra.invoker import InvokerScript
|
|
95
|
+
from sierra.options import Param, SierraOption
|
|
96
|
+
from sierra.results import Chart, Network, Table, Timeline, Tree
|
|
97
|
+
from sierra.stream import StreamEmitter, stream_context
|
|
98
|
+
from sierra.validators import (
|
|
99
|
+
InvokerValidationResult,
|
|
100
|
+
sanitize_description,
|
|
101
|
+
validate_invoker_name,
|
|
102
|
+
validate_node_id,
|
|
103
|
+
validate_param_type,
|
|
104
|
+
validate_protocol,
|
|
105
|
+
validate_yaml_safe,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def create_tree_result(
|
|
110
|
+
results: list[str | dict[str, list[str]]],
|
|
111
|
+
) -> str:
|
|
112
|
+
"""
|
|
113
|
+
Create a tree result containing a list of results.
|
|
114
|
+
|
|
115
|
+
Parameters
|
|
116
|
+
----------
|
|
117
|
+
results : list[Union[str, dict[str, list[str]]]]
|
|
118
|
+
List of results, where each result is either a string or a dictionary with a single key-value pair.
|
|
119
|
+
The key in the dictionary must be "children" and the value is a list of strings.
|
|
120
|
+
|
|
121
|
+
Returns
|
|
122
|
+
-------
|
|
123
|
+
str
|
|
124
|
+
A JSON-formatted string containing the tree result.
|
|
125
|
+
"""
|
|
126
|
+
result: dict[str, typing.Any] = {
|
|
127
|
+
"type": "Tree",
|
|
128
|
+
"results": results,
|
|
129
|
+
}
|
|
130
|
+
return json.dumps(result, indent=4)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def create_network_result(
|
|
134
|
+
origins: list[str],
|
|
135
|
+
nodes: list[dict[str, str]],
|
|
136
|
+
edges: list[dict[str, str]],
|
|
137
|
+
) -> str:
|
|
138
|
+
"""
|
|
139
|
+
Create a network result containing a list of nodes and edges.
|
|
140
|
+
|
|
141
|
+
Parameters
|
|
142
|
+
----------
|
|
143
|
+
origins : list[str]
|
|
144
|
+
List of origin node IDs.
|
|
145
|
+
nodes : list[dict[str, str]]
|
|
146
|
+
List of node definitions, where each node is a dictionary with a single key-value pair.
|
|
147
|
+
The key in the dictionary must be "id" and the value is a string representing the node ID.
|
|
148
|
+
edges : list[dict[str, str]]
|
|
149
|
+
List of edge definitions, where each edge is a dictionary with two key-value pairs.
|
|
150
|
+
The keys in the dictionary must be "from" and "to", and the values are strings representing the node IDs.
|
|
151
|
+
|
|
152
|
+
Returns
|
|
153
|
+
-------
|
|
154
|
+
str
|
|
155
|
+
A JSON-formatted string containing the network result.
|
|
156
|
+
"""
|
|
157
|
+
result: dict[str, typing.Any] = {
|
|
158
|
+
"type": "Network",
|
|
159
|
+
"origins": origins,
|
|
160
|
+
"nodes": nodes,
|
|
161
|
+
"edges": edges,
|
|
162
|
+
}
|
|
163
|
+
return json.dumps(result, indent=4)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def create_error_result(message: str) -> str:
|
|
167
|
+
"""Create an error JSON result."""
|
|
168
|
+
return json.dumps({"type": "Error", "message": message}, indent=4)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def respond(result: typing.Any) -> None:
|
|
172
|
+
"""
|
|
173
|
+
Print the result to stdout.
|
|
174
|
+
|
|
175
|
+
Handles both string and object results. If the result has a ``__str__``
|
|
176
|
+
method (e.g., ``Tree``, ``Network``, ``Table``), it is automatically
|
|
177
|
+
stringified.
|
|
178
|
+
|
|
179
|
+
Parameters
|
|
180
|
+
----------
|
|
181
|
+
result : Any
|
|
182
|
+
The result to print. Can be a JSON string, a result builder object,
|
|
183
|
+
or any printable value.
|
|
184
|
+
"""
|
|
185
|
+
print(result)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
# ---------------------------------------------------------------------------
|
|
189
|
+
# Cross-platform Image parameter class
|
|
190
|
+
# ---------------------------------------------------------------------------
|
|
191
|
+
|
|
192
|
+
if os.name == "nt":
|
|
193
|
+
|
|
194
|
+
class Image(pathlib.WindowsPath):
|
|
195
|
+
"""Represents an image parameter path in SIERRA (Windows)."""
|
|
196
|
+
|
|
197
|
+
pass
|
|
198
|
+
else:
|
|
199
|
+
|
|
200
|
+
class Image(pathlib.PosixPath):
|
|
201
|
+
"""Represents an image parameter path in SIERRA (Unix/macOS)."""
|
|
202
|
+
|
|
203
|
+
pass
|
|
204
|
+
|
|
205
|
+
# ---------------------------------------------------------------------------
|
|
206
|
+
# V2 Event Emission Helpers (module-level convenience functions)
|
|
207
|
+
# ---------------------------------------------------------------------------
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def emit(event_type: str, **kwargs: typing.Any) -> None:
|
|
211
|
+
"""
|
|
212
|
+
Emit a Protocol V2 streaming event to stdout.
|
|
213
|
+
|
|
214
|
+
Parameters
|
|
215
|
+
----------
|
|
216
|
+
event_type : str
|
|
217
|
+
One of ``"progress"``, ``"result"``, ``"end"``, ``"error"``.
|
|
218
|
+
**kwargs
|
|
219
|
+
Additional event fields. ``None`` values are stripped.
|
|
220
|
+
"""
|
|
221
|
+
event: dict[str, typing.Any] = {"version": 2, "type": event_type}
|
|
222
|
+
event.update(kwargs)
|
|
223
|
+
filtered = {k: v for k, v in event.items() if v is not None}
|
|
224
|
+
print(json.dumps(filtered), flush=True)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def emit_progress(message: str) -> None:
|
|
228
|
+
"""Emit a Protocol V2 progress update."""
|
|
229
|
+
emit("progress", message=message)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def emit_result(content: str, id: str | None = None, parent: str | None = None) -> None:
|
|
233
|
+
"""Emit a Protocol V2 incremental graph node."""
|
|
234
|
+
emit("result", id=id, content=content, parent=parent)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def emit_end(summary: str | None = None) -> None:
|
|
238
|
+
"""Emit a Protocol V2 end event."""
|
|
239
|
+
emit("end", summary=summary)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def emit_error(message: str) -> None:
|
|
243
|
+
"""Emit a Protocol V2 error event."""
|
|
244
|
+
emit("error", message=message)
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
# ---------------------------------------------------------------------------
|
|
248
|
+
# Convenience error class
|
|
249
|
+
# ---------------------------------------------------------------------------
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
class SierraError(Exception):
|
|
253
|
+
"""
|
|
254
|
+
Convenience exception that auto-formats as a SIERRA error result.
|
|
255
|
+
|
|
256
|
+
When raised inside an invoker entry point, the builder's exception
|
|
257
|
+
handler will catch it and emit either a V1 error JSON or a V2
|
|
258
|
+
stream error event, depending on the protocol.
|
|
259
|
+
|
|
260
|
+
Parameters
|
|
261
|
+
----------
|
|
262
|
+
message : str
|
|
263
|
+
Human-readable error description.
|
|
264
|
+
|
|
265
|
+
Examples
|
|
266
|
+
--------
|
|
267
|
+
>>> raise sierra.SierraError("API key expired")
|
|
268
|
+
"""
|
|
269
|
+
|
|
270
|
+
def __init__(self, message: str) -> None:
|
|
271
|
+
self.message = message
|
|
272
|
+
super().__init__(message)
|
|
273
|
+
|
|
274
|
+
def to_json(self) -> str:
|
|
275
|
+
"""Serialize to a V1 error result JSON string."""
|
|
276
|
+
return create_error_result(self.message)
|
|
277
|
+
|
|
278
|
+
def to_v2_json(self) -> str:
|
|
279
|
+
"""Serialize to a V2 stream error event JSON string."""
|
|
280
|
+
event = {"version": 2, "type": "error", "message": self.message}
|
|
281
|
+
return json.dumps(event)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
__all__ = [
|
|
285
|
+
# Core invoker
|
|
286
|
+
"InvokerScript",
|
|
287
|
+
"Param",
|
|
288
|
+
"SierraOption",
|
|
289
|
+
# Result builders
|
|
290
|
+
"Tree",
|
|
291
|
+
"Network",
|
|
292
|
+
"Table",
|
|
293
|
+
"Timeline",
|
|
294
|
+
"Chart",
|
|
295
|
+
# Client & infrastructure
|
|
296
|
+
"SierraDevelopmentClient",
|
|
297
|
+
"SierraError",
|
|
298
|
+
# Result helpers
|
|
299
|
+
"create_error_result",
|
|
300
|
+
"create_tree_result",
|
|
301
|
+
"create_network_result",
|
|
302
|
+
"respond",
|
|
303
|
+
# Image type
|
|
304
|
+
"Image",
|
|
305
|
+
# V2 streaming
|
|
306
|
+
"emit",
|
|
307
|
+
"emit_progress",
|
|
308
|
+
"emit_result",
|
|
309
|
+
"emit_end",
|
|
310
|
+
"emit_error",
|
|
311
|
+
"StreamEmitter",
|
|
312
|
+
"stream_context",
|
|
313
|
+
# Validators
|
|
314
|
+
"InvokerValidationResult",
|
|
315
|
+
"validate_node_id",
|
|
316
|
+
"validate_yaml_safe",
|
|
317
|
+
"validate_param_type",
|
|
318
|
+
"validate_protocol",
|
|
319
|
+
"validate_invoker_name",
|
|
320
|
+
"sanitize_description",
|
|
321
|
+
]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Sierra Dev version and metadata.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
__version__ = "2.
|
|
5
|
+
__version__ = "2.2.0"
|
|
6
6
|
__title__ = "Sierra Dev"
|
|
7
7
|
__description__ = "Modern framework for building and managing investigation invoker scripts for the Sierra platform"
|
|
8
8
|
__url__ = "https://github.com/xsyncio/sierra-dev"
|
|
@@ -13,7 +13,7 @@ __copyright__ = "Copyright 2024 Xsyncio"
|
|
|
13
13
|
|
|
14
14
|
# Version info
|
|
15
15
|
VERSION_MAJOR = 2
|
|
16
|
-
VERSION_MINOR =
|
|
16
|
+
VERSION_MINOR = 2
|
|
17
17
|
VERSION_PATCH = 0
|
|
18
18
|
VERSION_INFO = (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
|
|
19
19
|
|
|
@@ -21,9 +21,7 @@ Sierra Dev framework.
|
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
23
|
from sierra.abc.base import SierraABC
|
|
24
|
-
from sierra.abc.sierra import SierraConfig
|
|
25
|
-
from sierra.abc.sierra import SierraInvokerParam
|
|
26
|
-
from sierra.abc.sierra import SierraInvokerScript
|
|
24
|
+
from sierra.abc.sierra import SierraConfig, SierraInvokerParam, SierraInvokerScript
|
|
27
25
|
|
|
28
26
|
__all__ = [
|
|
29
27
|
"SierraABC",
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Sierra ABC Schema Models.
|
|
3
|
+
=========================
|
|
4
|
+
|
|
5
|
+
Typed dictionary models defining the structural contracts for invoker
|
|
6
|
+
scripts, parameters, and top-level configurations. These are used
|
|
7
|
+
throughout the compiler and builder pipelines.
|
|
8
|
+
"""
|
|
9
|
+
|
|
1
10
|
import typing
|
|
2
11
|
|
|
3
12
|
import sierra.abc.base as sierra_abc_base
|
|
@@ -10,19 +19,26 @@ class SierraInvokerParam(sierra_abc_base.SierraABC):
|
|
|
10
19
|
Attributes
|
|
11
20
|
----------
|
|
12
21
|
Name : str
|
|
13
|
-
The parameter's name.
|
|
14
|
-
Description : str
|
|
22
|
+
The parameter's name (must be a valid Python identifier).
|
|
23
|
+
Description : str or None
|
|
15
24
|
Human-readable description of the parameter.
|
|
16
|
-
Type :
|
|
17
|
-
The data type of the parameter (e.g.,
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
Type : Any
|
|
26
|
+
The data type of the parameter (e.g., ``str``, ``int``, ``pathlib.Path``,
|
|
27
|
+
``Image``).
|
|
28
|
+
Options : list[str] or None
|
|
29
|
+
List of constraint flags. Supported values:
|
|
30
|
+
- ``"MANDATORY"`` — execution is blocked if the value is empty.
|
|
31
|
+
- ``"PRIMARY"`` — SIERRA auto-populates from the active node value.
|
|
20
32
|
"""
|
|
21
33
|
|
|
22
34
|
Name: str
|
|
23
|
-
Type:
|
|
35
|
+
Type: typing.Any
|
|
24
36
|
Description: str | None
|
|
25
|
-
Options:
|
|
37
|
+
Options: list[str] | None
|
|
38
|
+
MinValue: int | float | None
|
|
39
|
+
MaxValue: int | float | None
|
|
40
|
+
Choices: list[typing.Any] | None
|
|
41
|
+
Pattern: str | None
|
|
26
42
|
|
|
27
43
|
|
|
28
44
|
class SierraInvokerScript(sierra_abc_base.SierraABC):
|
|
@@ -33,16 +49,19 @@ class SierraInvokerScript(sierra_abc_base.SierraABC):
|
|
|
33
49
|
----------
|
|
34
50
|
Name : str
|
|
35
51
|
Unique name of the script.
|
|
36
|
-
Description : str
|
|
52
|
+
Description : str or None
|
|
37
53
|
Brief description of the script.
|
|
38
|
-
|
|
54
|
+
Protocol : str or None
|
|
55
|
+
The execution protocol (``"V1"`` for batch, ``"V2"`` for streaming).
|
|
56
|
+
Params : list[SierraInvokerParam] or None
|
|
39
57
|
List of parameters for the script.
|
|
40
|
-
Command : str
|
|
58
|
+
Command : str or None
|
|
41
59
|
Shell or Python command template, with placeholders for parameters.
|
|
42
60
|
"""
|
|
43
61
|
|
|
44
62
|
Name: str
|
|
45
63
|
Description: str | None
|
|
64
|
+
Protocol: typing.Literal["V1", "V2"] | None
|
|
46
65
|
Params: list[SierraInvokerParam] | None
|
|
47
66
|
Command: str | None
|
|
48
67
|
|
|
@@ -53,7 +72,7 @@ class SierraConfig(sierra_abc_base.SierraABC):
|
|
|
53
72
|
|
|
54
73
|
Attributes
|
|
55
74
|
----------
|
|
56
|
-
PATHS : list[str]
|
|
75
|
+
PATHS : list[str] or None
|
|
57
76
|
Optional list of directories to search for scripts.
|
|
58
77
|
SCRIPTS : list[SierraInvokerScript]
|
|
59
78
|
Definitions of all invoker scripts.
|