streamflow-pulse-client 2.5.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pulse_client/__init__.py +41 -0
- pulse_client/client.py +455 -0
- pulse_client/exceptions.py +77 -0
- streamflow_pulse_client-2.5.8.dist-info/METADATA +192 -0
- streamflow_pulse_client-2.5.8.dist-info/RECORD +7 -0
- streamflow_pulse_client-2.5.8.dist-info/WHEEL +4 -0
- streamflow_pulse_client-2.5.8.dist-info/licenses/LICENSE +201 -0
pulse_client/__init__.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Official Python client for StreamFlow Pulse.
|
|
2
|
+
|
|
3
|
+
Quick start:
|
|
4
|
+
|
|
5
|
+
>>> from pulse_client import PulseClient
|
|
6
|
+
>>> client = PulseClient("http://localhost:9090")
|
|
7
|
+
>>> client.auth.login("alice", "secret")
|
|
8
|
+
>>> for pipeline in client.pipelines.list():
|
|
9
|
+
... print(pipeline["name"])
|
|
10
|
+
>>> client.close()
|
|
11
|
+
|
|
12
|
+
Or as a context manager:
|
|
13
|
+
|
|
14
|
+
>>> with PulseClient("http://localhost:9090", token="ey...") as client:
|
|
15
|
+
... print(client.version())
|
|
16
|
+
|
|
17
|
+
See README.md for the full surface.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from pulse_client.client import PulseClient
|
|
21
|
+
from pulse_client.exceptions import (
|
|
22
|
+
PulseAPIError,
|
|
23
|
+
PulseAuthError,
|
|
24
|
+
PulseClientError,
|
|
25
|
+
PulseNotFoundError,
|
|
26
|
+
PulseRateLimitError,
|
|
27
|
+
PulseValidationError,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
__version__ = "2.5.8"
|
|
31
|
+
|
|
32
|
+
__all__ = [
|
|
33
|
+
"PulseClient",
|
|
34
|
+
"PulseAPIError",
|
|
35
|
+
"PulseAuthError",
|
|
36
|
+
"PulseClientError",
|
|
37
|
+
"PulseNotFoundError",
|
|
38
|
+
"PulseRateLimitError",
|
|
39
|
+
"PulseValidationError",
|
|
40
|
+
"__version__",
|
|
41
|
+
]
|
pulse_client/client.py
ADDED
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
"""The main ``PulseClient`` and its sub-resource accessors.
|
|
2
|
+
|
|
3
|
+
Design: every API surface (auth, pipelines, agents, etc.) is its own small
|
|
4
|
+
class accessed via an attribute on the client (``client.pipelines``,
|
|
5
|
+
``client.agents``). The classes share the HTTP transport via composition
|
|
6
|
+
rather than inheritance — keeps each resource focused.
|
|
7
|
+
|
|
8
|
+
The wire format is the Pulse REST surface described by
|
|
9
|
+
``streamflow-pulse/src/main/resources/openapi/openapi.yaml`` (B-103). When
|
|
10
|
+
a new endpoint lands in the spec, add a method here and a matching test.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import json
|
|
16
|
+
from collections.abc import Iterator
|
|
17
|
+
from types import TracebackType
|
|
18
|
+
from typing import Any, cast
|
|
19
|
+
|
|
20
|
+
import httpx
|
|
21
|
+
|
|
22
|
+
from pulse_client.exceptions import (
|
|
23
|
+
PulseAPIError,
|
|
24
|
+
PulseAuthError,
|
|
25
|
+
PulseNotFoundError,
|
|
26
|
+
PulseRateLimitError,
|
|
27
|
+
PulseValidationError,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
DEFAULT_TIMEOUT = 30.0
|
|
31
|
+
USER_AGENT = "pulse-client-python/2.5.8"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class PulseClient:
|
|
35
|
+
"""Synchronous HTTP client for the Pulse REST API.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
base_url: The Pulse server URL (e.g. ``http://localhost:9090``).
|
|
39
|
+
token: Optional JWT to attach as ``Authorization: Bearer <token>``
|
|
40
|
+
on every request. If omitted, call :meth:`auth.login` first.
|
|
41
|
+
timeout: Per-request timeout in seconds. Default 30.
|
|
42
|
+
verify: TLS verification (passed through to httpx). Set to ``False``
|
|
43
|
+
for self-signed certs in dev.
|
|
44
|
+
|
|
45
|
+
Example:
|
|
46
|
+
>>> from pulse_client import PulseClient
|
|
47
|
+
>>> with PulseClient("http://localhost:9090") as client:
|
|
48
|
+
... client.auth.login("alice", "secret")
|
|
49
|
+
... for pipeline in client.pipelines.list():
|
|
50
|
+
... print(pipeline["name"])
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
def __init__(
|
|
54
|
+
self,
|
|
55
|
+
base_url: str,
|
|
56
|
+
*,
|
|
57
|
+
token: str | None = None,
|
|
58
|
+
timeout: float = DEFAULT_TIMEOUT,
|
|
59
|
+
verify: bool | str = True,
|
|
60
|
+
) -> None:
|
|
61
|
+
self._base_url = base_url.rstrip("/")
|
|
62
|
+
self._token = token
|
|
63
|
+
self._http = httpx.Client(
|
|
64
|
+
base_url=self._base_url,
|
|
65
|
+
timeout=timeout,
|
|
66
|
+
verify=verify,
|
|
67
|
+
headers={"User-Agent": USER_AGENT},
|
|
68
|
+
)
|
|
69
|
+
# Resource accessors — each one shares the same transport.
|
|
70
|
+
self.auth = _AuthResource(self)
|
|
71
|
+
self.pipelines = _PipelinesResource(self)
|
|
72
|
+
self.agents = _AgentsResource(self)
|
|
73
|
+
self.templates = _TemplatesResource(self)
|
|
74
|
+
self.users = _UsersResource(self)
|
|
75
|
+
self.events = _EventsResource(self)
|
|
76
|
+
|
|
77
|
+
# ------------------------------------------------------------------
|
|
78
|
+
# Lifecycle
|
|
79
|
+
# ------------------------------------------------------------------
|
|
80
|
+
def __enter__(self) -> PulseClient:
|
|
81
|
+
return self
|
|
82
|
+
|
|
83
|
+
def __exit__(
|
|
84
|
+
self,
|
|
85
|
+
exc_type: type[BaseException] | None,
|
|
86
|
+
exc_val: BaseException | None,
|
|
87
|
+
exc_tb: TracebackType | None,
|
|
88
|
+
) -> None:
|
|
89
|
+
self.close()
|
|
90
|
+
|
|
91
|
+
def close(self) -> None:
|
|
92
|
+
"""Close the underlying HTTP connection pool."""
|
|
93
|
+
self._http.close()
|
|
94
|
+
|
|
95
|
+
# ------------------------------------------------------------------
|
|
96
|
+
# Public API: top-level endpoints
|
|
97
|
+
# ------------------------------------------------------------------
|
|
98
|
+
def version(self) -> dict[str, Any]:
|
|
99
|
+
"""Returns the Pulse server's build + version metadata.
|
|
100
|
+
|
|
101
|
+
This is a public endpoint — no JWT required.
|
|
102
|
+
"""
|
|
103
|
+
return cast(
|
|
104
|
+
"dict[str, Any]",
|
|
105
|
+
self._request("GET", "/api/pulse/version", authenticated=False),
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
@property
|
|
109
|
+
def token(self) -> str | None:
|
|
110
|
+
"""The currently-set bearer token, if any."""
|
|
111
|
+
return self._token
|
|
112
|
+
|
|
113
|
+
@token.setter
|
|
114
|
+
def token(self, value: str | None) -> None:
|
|
115
|
+
self._token = value
|
|
116
|
+
|
|
117
|
+
# ------------------------------------------------------------------
|
|
118
|
+
# Internal: request execution + error translation
|
|
119
|
+
# ------------------------------------------------------------------
|
|
120
|
+
def _request(
|
|
121
|
+
self,
|
|
122
|
+
method: str,
|
|
123
|
+
path: str,
|
|
124
|
+
*,
|
|
125
|
+
json: Any = None,
|
|
126
|
+
params: dict[str, Any] | None = None,
|
|
127
|
+
authenticated: bool = True,
|
|
128
|
+
) -> Any:
|
|
129
|
+
"""Issues an HTTP request and translates errors to typed exceptions.
|
|
130
|
+
|
|
131
|
+
Returns the parsed JSON body for 2xx responses, or ``None`` for
|
|
132
|
+
204 No Content.
|
|
133
|
+
"""
|
|
134
|
+
headers: dict[str, str] = {}
|
|
135
|
+
if authenticated:
|
|
136
|
+
if not self._token:
|
|
137
|
+
raise PulseAuthError(
|
|
138
|
+
status_code=401,
|
|
139
|
+
path=path,
|
|
140
|
+
body={"error": "No token set. Call client.auth.login() first or pass token=..."},
|
|
141
|
+
)
|
|
142
|
+
headers["Authorization"] = f"Bearer {self._token}"
|
|
143
|
+
|
|
144
|
+
response = self._http.request(
|
|
145
|
+
method,
|
|
146
|
+
path,
|
|
147
|
+
json=json,
|
|
148
|
+
params=params,
|
|
149
|
+
headers=headers,
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
if response.status_code == 204:
|
|
153
|
+
return None
|
|
154
|
+
|
|
155
|
+
if 200 <= response.status_code < 300:
|
|
156
|
+
if not response.content:
|
|
157
|
+
return None
|
|
158
|
+
try:
|
|
159
|
+
return response.json()
|
|
160
|
+
except ValueError:
|
|
161
|
+
return response.text
|
|
162
|
+
|
|
163
|
+
# Translate error → typed exception
|
|
164
|
+
self._raise_for_error(response, path)
|
|
165
|
+
# _raise_for_error always raises; this is for type-checker happiness
|
|
166
|
+
raise PulseAPIError(response.status_code, path)
|
|
167
|
+
|
|
168
|
+
@staticmethod
|
|
169
|
+
def _raise_for_error(response: httpx.Response, path: str) -> None:
|
|
170
|
+
body: dict[str, Any] | str | None
|
|
171
|
+
try:
|
|
172
|
+
body = response.json()
|
|
173
|
+
except ValueError:
|
|
174
|
+
body = response.text or None
|
|
175
|
+
|
|
176
|
+
if response.status_code == 401:
|
|
177
|
+
raise PulseAuthError(response.status_code, path, body)
|
|
178
|
+
if response.status_code == 404:
|
|
179
|
+
raise PulseNotFoundError(response.status_code, path, body)
|
|
180
|
+
if response.status_code == 400:
|
|
181
|
+
raise PulseValidationError(response.status_code, path, body)
|
|
182
|
+
if response.status_code == 429:
|
|
183
|
+
retry_after: int | None = None
|
|
184
|
+
if isinstance(body, dict):
|
|
185
|
+
value = body.get("retryAfterSeconds")
|
|
186
|
+
if isinstance(value, (int, float)):
|
|
187
|
+
retry_after = int(value)
|
|
188
|
+
if retry_after is None:
|
|
189
|
+
header = response.headers.get("Retry-After")
|
|
190
|
+
if header is not None:
|
|
191
|
+
try:
|
|
192
|
+
retry_after = int(header)
|
|
193
|
+
except ValueError:
|
|
194
|
+
retry_after = None
|
|
195
|
+
raise PulseRateLimitError(response.status_code, path, body, retry_after)
|
|
196
|
+
raise PulseAPIError(response.status_code, path, body)
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
# ----------------------------------------------------------------------
|
|
200
|
+
# Resource classes — one per OpenAPI tag.
|
|
201
|
+
# ----------------------------------------------------------------------
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
class _Resource:
|
|
205
|
+
"""Shared base — holds a back-reference to the parent client."""
|
|
206
|
+
|
|
207
|
+
def __init__(self, client: PulseClient) -> None:
|
|
208
|
+
self._client = client
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
class _AuthResource(_Resource):
|
|
212
|
+
"""``client.auth`` — authentication + session management."""
|
|
213
|
+
|
|
214
|
+
def login(self, username: str, password: str) -> dict[str, Any]:
|
|
215
|
+
"""POST /api/auth/login — exchanges credentials for a JWT.
|
|
216
|
+
|
|
217
|
+
On success, the returned token is cached on the parent client so
|
|
218
|
+
subsequent calls authenticate automatically. The full response
|
|
219
|
+
(including ``refreshToken`` and ``activeOrg``) is returned to the
|
|
220
|
+
caller for downstream use.
|
|
221
|
+
"""
|
|
222
|
+
response = cast(
|
|
223
|
+
"dict[str, Any]",
|
|
224
|
+
self._client._request(
|
|
225
|
+
"POST",
|
|
226
|
+
"/api/auth/login",
|
|
227
|
+
json={"username": username, "password": password},
|
|
228
|
+
authenticated=False,
|
|
229
|
+
),
|
|
230
|
+
)
|
|
231
|
+
token = response.get("token") if isinstance(response, dict) else None
|
|
232
|
+
if token:
|
|
233
|
+
self._client.token = token
|
|
234
|
+
return response
|
|
235
|
+
|
|
236
|
+
def refresh(self, refresh_token: str) -> dict[str, Any]:
|
|
237
|
+
"""POST /api/auth/refresh — exchanges a refresh token for a fresh JWT.
|
|
238
|
+
|
|
239
|
+
The new ``token`` is cached on the parent client.
|
|
240
|
+
"""
|
|
241
|
+
response = cast(
|
|
242
|
+
"dict[str, Any]",
|
|
243
|
+
self._client._request(
|
|
244
|
+
"POST",
|
|
245
|
+
"/api/auth/refresh",
|
|
246
|
+
json={"refreshToken": refresh_token},
|
|
247
|
+
authenticated=False,
|
|
248
|
+
),
|
|
249
|
+
)
|
|
250
|
+
token = response.get("token") if isinstance(response, dict) else None
|
|
251
|
+
if token:
|
|
252
|
+
self._client.token = token
|
|
253
|
+
return response
|
|
254
|
+
|
|
255
|
+
def organizations(self) -> list[dict[str, Any]]:
|
|
256
|
+
"""GET /api/auth/organizations — orgs the current user is a member of."""
|
|
257
|
+
result = self._client._request("GET", "/api/auth/organizations")
|
|
258
|
+
if isinstance(result, dict):
|
|
259
|
+
orgs = result.get("organizations", [])
|
|
260
|
+
if isinstance(orgs, list):
|
|
261
|
+
return cast("list[dict[str, Any]]", orgs)
|
|
262
|
+
return []
|
|
263
|
+
|
|
264
|
+
def switch_org(self, org_id: str) -> dict[str, Any]:
|
|
265
|
+
"""POST /api/auth/switch-org — switches the active org.
|
|
266
|
+
|
|
267
|
+
The new JWT (with updated ``orgId`` claim) is cached on the parent client.
|
|
268
|
+
"""
|
|
269
|
+
response = cast(
|
|
270
|
+
"dict[str, Any]",
|
|
271
|
+
self._client._request(
|
|
272
|
+
"POST",
|
|
273
|
+
"/api/auth/switch-org",
|
|
274
|
+
json={"orgId": org_id},
|
|
275
|
+
),
|
|
276
|
+
)
|
|
277
|
+
token = response.get("token") if isinstance(response, dict) else None
|
|
278
|
+
if token:
|
|
279
|
+
self._client.token = token
|
|
280
|
+
return response
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
class _PipelinesResource(_Resource):
|
|
284
|
+
"""``client.pipelines`` — create / list / inspect / delete pipelines."""
|
|
285
|
+
|
|
286
|
+
def list(self) -> list[dict[str, Any]]:
|
|
287
|
+
"""GET /api/pulse/pipelines — every pipeline in the current org."""
|
|
288
|
+
result = self._client._request("GET", "/api/pulse/pipelines")
|
|
289
|
+
if isinstance(result, dict):
|
|
290
|
+
pipelines = result.get("pipelines", [])
|
|
291
|
+
if isinstance(pipelines, list):
|
|
292
|
+
return cast("list[dict[str, Any]]", pipelines)
|
|
293
|
+
return []
|
|
294
|
+
|
|
295
|
+
def get(self, pipeline_id: str) -> dict[str, Any]:
|
|
296
|
+
"""GET /api/pulse/pipelines/{id} — one pipeline by id."""
|
|
297
|
+
return cast(
|
|
298
|
+
"dict[str, Any]",
|
|
299
|
+
self._client._request("GET", f"/api/pulse/pipelines/{pipeline_id}"),
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
def create(self, definition: dict[str, Any]) -> dict[str, Any]:
|
|
303
|
+
"""POST /api/pulse/pipelines — creates + deploys a new pipeline.
|
|
304
|
+
|
|
305
|
+
``definition`` must follow the CreatePipelineRequest schema
|
|
306
|
+
(see /openapi.yaml). At minimum: ``name`` + ``nodes``.
|
|
307
|
+
"""
|
|
308
|
+
return cast(
|
|
309
|
+
"dict[str, Any]",
|
|
310
|
+
self._client._request("POST", "/api/pulse/pipelines", json=definition),
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
def delete(self, pipeline_id: str) -> None:
|
|
314
|
+
"""DELETE /api/pulse/pipelines/{id} — tears down the pipeline."""
|
|
315
|
+
self._client._request("DELETE", f"/api/pulse/pipelines/{pipeline_id}")
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
class _AgentsResource(_Resource):
|
|
319
|
+
"""``client.agents`` — inspect deployed agents (read-only)."""
|
|
320
|
+
|
|
321
|
+
def list(self) -> list[dict[str, Any]]:
|
|
322
|
+
"""GET /api/pulse/agents — every deployed agent in the current org."""
|
|
323
|
+
result = self._client._request("GET", "/api/pulse/agents")
|
|
324
|
+
if isinstance(result, dict):
|
|
325
|
+
agents = result.get("agents", [])
|
|
326
|
+
if isinstance(agents, list):
|
|
327
|
+
return cast("list[dict[str, Any]]", agents)
|
|
328
|
+
return []
|
|
329
|
+
|
|
330
|
+
def get(self, agent_id: str) -> dict[str, Any]:
|
|
331
|
+
"""GET /api/pulse/agents/{id} — one agent by id."""
|
|
332
|
+
return cast(
|
|
333
|
+
"dict[str, Any]",
|
|
334
|
+
self._client._request("GET", f"/api/pulse/agents/{agent_id}"),
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
class _TemplatesResource(_Resource):
|
|
339
|
+
"""``client.templates`` — first-party pipeline template catalog."""
|
|
340
|
+
|
|
341
|
+
def list(self) -> list[dict[str, Any]]:
|
|
342
|
+
"""GET /api/pulse/templates — the 223+ first-party templates."""
|
|
343
|
+
result = self._client._request("GET", "/api/pulse/templates")
|
|
344
|
+
if isinstance(result, dict):
|
|
345
|
+
templates = result.get("templates", [])
|
|
346
|
+
if isinstance(templates, list):
|
|
347
|
+
return cast("list[dict[str, Any]]", templates)
|
|
348
|
+
return []
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
class _UsersResource(_Resource):
|
|
352
|
+
"""``client.users`` — user management (admin only)."""
|
|
353
|
+
|
|
354
|
+
def list(self) -> list[dict[str, Any]]:
|
|
355
|
+
"""GET /api/pulse/users — every user in the current org.
|
|
356
|
+
|
|
357
|
+
Requires the caller to have the ``USERS_LIST`` permission atom (Owner
|
|
358
|
+
and Platform Admin personas by default — see B-105).
|
|
359
|
+
"""
|
|
360
|
+
result = self._client._request("GET", "/api/pulse/users")
|
|
361
|
+
if isinstance(result, dict):
|
|
362
|
+
users = result.get("users", [])
|
|
363
|
+
if isinstance(users, list):
|
|
364
|
+
return cast("list[dict[str, Any]]", users)
|
|
365
|
+
return []
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
class _EventsResource(_Resource):
|
|
369
|
+
"""``client.events`` — live SSE stream of events flowing through the engine.
|
|
370
|
+
|
|
371
|
+
Usage:
|
|
372
|
+
|
|
373
|
+
>>> with PulseClient("http://localhost:9090", token=token) as client:
|
|
374
|
+
... for event in client.events.stream():
|
|
375
|
+
... print(event["type"], event.get("payload"))
|
|
376
|
+
|
|
377
|
+
The stream blocks the calling thread (synchronous generator). For an
|
|
378
|
+
async iterator using ``httpx.AsyncClient``, see ``pulse_client.async_events``
|
|
379
|
+
(planned for v3.0 alongside ``AsyncPulseClient``).
|
|
380
|
+
|
|
381
|
+
Cancellation: break out of the for-loop. The underlying HTTP connection
|
|
382
|
+
is closed by the generator's ``__exit__``.
|
|
383
|
+
"""
|
|
384
|
+
|
|
385
|
+
def stream(
|
|
386
|
+
self,
|
|
387
|
+
*,
|
|
388
|
+
timeout: float | None = None,
|
|
389
|
+
) -> Iterator[dict[str, Any]]:
|
|
390
|
+
"""Subscribes to ``GET /api/pulse/events/stream`` and yields events.
|
|
391
|
+
|
|
392
|
+
Args:
|
|
393
|
+
timeout: Per-read timeout in seconds. ``None`` disables (the
|
|
394
|
+
connection stays open until the server closes it or the
|
|
395
|
+
caller breaks out of the loop). Default: inherit the client
|
|
396
|
+
timeout (which itself defaults to 30s — likely too short
|
|
397
|
+
for long-running streams; override here).
|
|
398
|
+
|
|
399
|
+
Yields:
|
|
400
|
+
One dict per event, parsed from the SSE ``data: ...`` line.
|
|
401
|
+
Heartbeat lines, comments (``:keep-alive``), and SSE-control
|
|
402
|
+
fields (``event:``, ``id:``, ``retry:``) are silently
|
|
403
|
+
consumed but not yielded.
|
|
404
|
+
|
|
405
|
+
Raises:
|
|
406
|
+
PulseAuthError: If no token is set or the server rejects it.
|
|
407
|
+
PulseAPIError: If the server returns a non-2xx response.
|
|
408
|
+
"""
|
|
409
|
+
client = self._client
|
|
410
|
+
if not client._token:
|
|
411
|
+
raise PulseAuthError(
|
|
412
|
+
status_code=401,
|
|
413
|
+
path="/api/pulse/events/stream",
|
|
414
|
+
body={"error": "No token set for SSE stream"},
|
|
415
|
+
)
|
|
416
|
+
headers = {
|
|
417
|
+
"Authorization": f"Bearer {client._token}",
|
|
418
|
+
"Accept": "text/event-stream",
|
|
419
|
+
"Cache-Control": "no-cache",
|
|
420
|
+
}
|
|
421
|
+
with client._http.stream(
|
|
422
|
+
"GET",
|
|
423
|
+
"/api/pulse/events/stream",
|
|
424
|
+
headers=headers,
|
|
425
|
+
timeout=timeout if timeout is not None else client._http.timeout,
|
|
426
|
+
) as response:
|
|
427
|
+
if response.status_code >= 400:
|
|
428
|
+
response.read()
|
|
429
|
+
client._raise_for_error(response, "/api/pulse/events/stream")
|
|
430
|
+
return
|
|
431
|
+
|
|
432
|
+
# SSE parser — accumulate `data:` lines per event, dispatch on
|
|
433
|
+
# blank line. See https://html.spec.whatwg.org/multipage/server-sent-events.html
|
|
434
|
+
data_lines: list[str] = []
|
|
435
|
+
for raw_line in response.iter_lines():
|
|
436
|
+
if raw_line is None:
|
|
437
|
+
continue
|
|
438
|
+
if raw_line == "":
|
|
439
|
+
# Event boundary — assemble and yield
|
|
440
|
+
if data_lines:
|
|
441
|
+
payload = "\n".join(data_lines)
|
|
442
|
+
data_lines = []
|
|
443
|
+
try:
|
|
444
|
+
yield json.loads(payload)
|
|
445
|
+
except ValueError:
|
|
446
|
+
# Non-JSON event payload — surface as raw string
|
|
447
|
+
yield {"data": payload}
|
|
448
|
+
continue
|
|
449
|
+
if raw_line.startswith(":"):
|
|
450
|
+
continue # SSE comment / keep-alive
|
|
451
|
+
if raw_line.startswith("data:"):
|
|
452
|
+
data_lines.append(raw_line[5:].lstrip())
|
|
453
|
+
# Other SSE fields (`event:`, `id:`, `retry:`) are
|
|
454
|
+
# consumed but not surfaced — Pulse's server doesn't use
|
|
455
|
+
# them today. Add explicit dispatch when it does.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""Typed exception hierarchy for the Pulse client.
|
|
2
|
+
|
|
3
|
+
Every HTTP error from the server is translated into one of these. They all
|
|
4
|
+
inherit from :class:`PulseClientError` so callers can catch the entire
|
|
5
|
+
client-side family in one block.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class PulseClientError(Exception):
|
|
14
|
+
"""Base class for every exception raised by this library."""
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class PulseAPIError(PulseClientError):
|
|
18
|
+
"""A non-2xx response from the Pulse server.
|
|
19
|
+
|
|
20
|
+
Carries the status code, the parsed error body (if JSON), and the
|
|
21
|
+
request path so log lines + bug reports are actionable.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def __init__(
|
|
25
|
+
self,
|
|
26
|
+
status_code: int,
|
|
27
|
+
path: str,
|
|
28
|
+
body: dict[str, Any] | str | None = None,
|
|
29
|
+
) -> None:
|
|
30
|
+
self.status_code = status_code
|
|
31
|
+
self.path = path
|
|
32
|
+
self.body = body
|
|
33
|
+
message = self._format_message(status_code, path, body)
|
|
34
|
+
super().__init__(message)
|
|
35
|
+
|
|
36
|
+
@staticmethod
|
|
37
|
+
def _format_message(
|
|
38
|
+
status_code: int, path: str, body: dict[str, Any] | str | None
|
|
39
|
+
) -> str:
|
|
40
|
+
msg = f"HTTP {status_code} from {path}"
|
|
41
|
+
if isinstance(body, dict):
|
|
42
|
+
err = body.get("error") or body.get("errorMessage") or body.get("message")
|
|
43
|
+
if err:
|
|
44
|
+
msg += f" — {err}"
|
|
45
|
+
elif isinstance(body, str) and body:
|
|
46
|
+
msg += f" — {body[:200]}"
|
|
47
|
+
return msg
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class PulseAuthError(PulseAPIError):
|
|
51
|
+
"""The server returned 401 — invalid / expired / missing JWT."""
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class PulseNotFoundError(PulseAPIError):
|
|
55
|
+
"""The server returned 404 — the resource does not exist."""
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class PulseValidationError(PulseAPIError):
|
|
59
|
+
"""The server returned 400 — the request body is malformed."""
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class PulseRateLimitError(PulseAPIError):
|
|
63
|
+
"""The server returned 429 — per-user or per-IP rate limit hit.
|
|
64
|
+
|
|
65
|
+
Carries the ``retry_after_seconds`` value the server advises waiting
|
|
66
|
+
before retrying (parsed from the JSON body or the ``Retry-After`` header).
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
def __init__(
|
|
70
|
+
self,
|
|
71
|
+
status_code: int,
|
|
72
|
+
path: str,
|
|
73
|
+
body: dict[str, Any] | str | None,
|
|
74
|
+
retry_after_seconds: int | None,
|
|
75
|
+
) -> None:
|
|
76
|
+
super().__init__(status_code, path, body)
|
|
77
|
+
self.retry_after_seconds = retry_after_seconds
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: streamflow-pulse-client
|
|
3
|
+
Version: 2.5.8
|
|
4
|
+
Summary: Official Python client for StreamFlow Pulse — AI Agent Platform
|
|
5
|
+
Project-URL: Homepage, https://github.com/olsisoft/streamflow
|
|
6
|
+
Project-URL: Documentation, https://github.com/olsisoft/streamflow/blob/dev/pulse-py/README.md
|
|
7
|
+
Project-URL: Source, https://github.com/olsisoft/streamflow/tree/dev/pulse-py
|
|
8
|
+
Project-URL: Issues, https://github.com/olsisoft/streamflow/issues
|
|
9
|
+
Author-email: Njong Michael <mike.njo@gmail.com>
|
|
10
|
+
License: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: agents,ai,llm,mcp,pipelines,pulse,streamflow
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: httpx<1.0,>=0.27
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest-cov>=4.1; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest>=7.4; extra == 'dev'
|
|
29
|
+
Requires-Dist: respx>=0.21; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
31
|
+
Provides-Extra: test
|
|
32
|
+
Requires-Dist: pytest-cov>=4.1; extra == 'test'
|
|
33
|
+
Requires-Dist: pytest>=7.4; extra == 'test'
|
|
34
|
+
Requires-Dist: respx>=0.21; extra == 'test'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# streamflow-pulse-client — Python SDK for StreamFlow Pulse
|
|
38
|
+
|
|
39
|
+
Official Python client for the [Pulse](https://github.com/olsisoft/streamflow) AI Agent Platform.
|
|
40
|
+
|
|
41
|
+
**Distribution name** on PyPI is `streamflow-pulse-client`; **import statement** stays the natural `from pulse_client import ...` (same convention as `python-dateutil` → `import dateutil`).
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from pulse_client import PulseClient
|
|
45
|
+
|
|
46
|
+
with PulseClient("http://localhost:9090") as client:
|
|
47
|
+
client.auth.login("alice", "secret")
|
|
48
|
+
for pipeline in client.pipelines.list():
|
|
49
|
+
print(pipeline["name"])
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install streamflow-pulse-client
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Requires Python **3.10+**. Pure Python — only depends on `httpx`.
|
|
59
|
+
|
|
60
|
+
## Why pulse-client
|
|
61
|
+
|
|
62
|
+
- **Pythonic** — context-manager friendly, typed exceptions, attribute-style resource access (`client.pipelines.list()`).
|
|
63
|
+
- **Lightweight** — single dependency (`httpx`), <500 LoC, no generated bloat.
|
|
64
|
+
- **Spec-aligned** — every method corresponds 1:1 to an endpoint in the [Pulse OpenAPI 3.1 spec](../streamflow-pulse/src/main/resources/openapi/openapi.yaml). Drift is caught at PR time by the in-tree spec invariant tests (B-103).
|
|
65
|
+
- **Async-ready** — the sync client ships today; an `AsyncPulseClient` (same surface, `await` everywhere) will follow in v3.0.
|
|
66
|
+
|
|
67
|
+
## Quick start
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from pulse_client import PulseClient, PulseAuthError
|
|
71
|
+
|
|
72
|
+
client = PulseClient("http://localhost:9090")
|
|
73
|
+
|
|
74
|
+
# Authenticate — the returned JWT is cached on the client automatically
|
|
75
|
+
try:
|
|
76
|
+
response = client.auth.login("alice", "secret")
|
|
77
|
+
print(f"Logged in as {response['user']['username']}")
|
|
78
|
+
except PulseAuthError as e:
|
|
79
|
+
print(f"Login failed: {e}")
|
|
80
|
+
|
|
81
|
+
# List + inspect resources
|
|
82
|
+
for pipeline in client.pipelines.list():
|
|
83
|
+
print(pipeline["name"], pipeline["status"])
|
|
84
|
+
|
|
85
|
+
# Create a pipeline from a template
|
|
86
|
+
new_pipeline = client.pipelines.create({
|
|
87
|
+
"name": "my-fraud-detector",
|
|
88
|
+
"templateId": "fintech-fraud-detection-realtime",
|
|
89
|
+
"nodes": [
|
|
90
|
+
{"id": "source", "type": "source", "subType": "kafka-source"},
|
|
91
|
+
{"id": "agent", "type": "agent", "subType": "streaming"},
|
|
92
|
+
{"id": "sink", "type": "sink", "subType": "telegram"},
|
|
93
|
+
],
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
# Inspect deployed agents
|
|
97
|
+
for agent in client.agents.list():
|
|
98
|
+
print(f" {agent['name']} — {agent['engineType']} — {agent['status']}")
|
|
99
|
+
|
|
100
|
+
client.close()
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Supported surfaces (v2.5.8)
|
|
104
|
+
|
|
105
|
+
| Resource | Methods | Notes |
|
|
106
|
+
|---|---|---|
|
|
107
|
+
| `client.auth` | `login()`, `refresh()`, `organizations()`, `switch_org()` | Auto-caches JWT on the client after `login` / `refresh` / `switch_org`. |
|
|
108
|
+
| `client.pipelines` | `list()`, `get(id)`, `create(definition)`, `delete(id)` | `definition` follows the `CreatePipelineRequest` schema (see OpenAPI spec). |
|
|
109
|
+
| `client.agents` | `list()`, `get(id)` | Read-only — agents are owned by pipelines. |
|
|
110
|
+
| `client.templates` | `list()` | The 223+ first-party templates. |
|
|
111
|
+
| `client.users` | `list()` | Requires `USERS_LIST` permission (Owner / Platform Admin personas). |
|
|
112
|
+
| `client.version()` | top-level | Public — no JWT required. |
|
|
113
|
+
|
|
114
|
+
The full ~112-endpoint surface (admin, audit, backups, chat, workspace, etc.) is documented in the OpenAPI spec at `<pulse-server>/api-docs`. SDK methods for those land opportunistically as user-facing demand surfaces.
|
|
115
|
+
|
|
116
|
+
## Authentication
|
|
117
|
+
|
|
118
|
+
Three patterns, pick what fits:
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
# 1. Username + password (interactive / CLI tools)
|
|
122
|
+
client = PulseClient("http://localhost:9090")
|
|
123
|
+
client.auth.login("alice", "secret")
|
|
124
|
+
|
|
125
|
+
# 2. Pre-minted JWT (CI / service accounts)
|
|
126
|
+
client = PulseClient("http://localhost:9090", token="ey...")
|
|
127
|
+
|
|
128
|
+
# 3. JWT from environment (12-factor apps)
|
|
129
|
+
import os
|
|
130
|
+
client = PulseClient(os.environ["PULSE_URL"], token=os.environ["PULSE_TOKEN"])
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
For long-running daemons, store the `refreshToken` from `login()` and call `client.auth.refresh(refresh_token)` when the JWT nears expiry (default 1 h TTL).
|
|
134
|
+
|
|
135
|
+
## Error handling
|
|
136
|
+
|
|
137
|
+
Every server error becomes a typed exception you can catch precisely:
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from pulse_client import (
|
|
141
|
+
PulseClientError, # base — catches every client-side error
|
|
142
|
+
PulseAuthError, # 401 — invalid / missing / expired JWT
|
|
143
|
+
PulseNotFoundError, # 404
|
|
144
|
+
PulseValidationError, # 400 — malformed request
|
|
145
|
+
PulseRateLimitError, # 429 — carries .retry_after_seconds
|
|
146
|
+
PulseAPIError, # everything else (5xx, etc.)
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
try:
|
|
150
|
+
client.pipelines.get("nope")
|
|
151
|
+
except PulseNotFoundError:
|
|
152
|
+
print("Doesn't exist — fine")
|
|
153
|
+
except PulseRateLimitError as e:
|
|
154
|
+
print(f"Backing off {e.retry_after_seconds}s")
|
|
155
|
+
time.sleep(e.retry_after_seconds or 60)
|
|
156
|
+
except PulseClientError as e:
|
|
157
|
+
print(f"Something else went wrong: {e}")
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Every exception carries `.status_code`, `.path`, and `.body` so log lines + bug reports are actionable.
|
|
161
|
+
|
|
162
|
+
## Development
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
git clone https://github.com/olsisoft/streamflow.git
|
|
166
|
+
cd streamflow/pulse-py
|
|
167
|
+
|
|
168
|
+
# Install in editable mode with dev deps
|
|
169
|
+
pip install -e ".[dev]"
|
|
170
|
+
|
|
171
|
+
# Run tests
|
|
172
|
+
pytest
|
|
173
|
+
|
|
174
|
+
# Lint
|
|
175
|
+
ruff check src tests
|
|
176
|
+
mypy src
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
CI runs the same on every push touching `pulse-py/` — see `.github/workflows/pulse-py.yaml`.
|
|
180
|
+
|
|
181
|
+
## Roadmap
|
|
182
|
+
|
|
183
|
+
- **v2.5.x** — current sync API, 5 core resources (auth, pipelines, agents, templates, users), `version()`.
|
|
184
|
+
- **v2.6.x** — expanded resource coverage: backups, schedules, credentials, settings, approvals, chat.
|
|
185
|
+
- **v3.0** — `AsyncPulseClient` with `async def` everywhere; same surface; one library, two clients.
|
|
186
|
+
- **B-098 satellite** — once `olsisoft/pulse-py` exists as its own repo, this in-tree code lifts out wholesale. Pip-install will switch to the satellite; in-tree continues to mirror for one release cycle so the migration is non-breaking.
|
|
187
|
+
|
|
188
|
+
Track progress in [`docs/STREAMFLOW-BACKLOG.md`](../docs/STREAMFLOW-BACKLOG.md) under item **B-098**.
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
Apache 2.0 — same as the parent Pulse repository.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
pulse_client/__init__.py,sha256=MldO9V_GLIxq3sGIJ4KaqhbIZrhwvxNY8OzbS3sgeQE,940
|
|
2
|
+
pulse_client/client.py,sha256=l-OGK4Cz4ljrbY3gVv_xidBNIhnpacttC4Nuyq_YRJU,16740
|
|
3
|
+
pulse_client/exceptions.py,sha256=A3qaOQWvJGHiddJswozMo8a17058sghKSPwpkKqpdqg,2307
|
|
4
|
+
streamflow_pulse_client-2.5.8.dist-info/METADATA,sha256=1mN0vxqBwUqePGGR-HBOpw-t73jxUVJoxJBpY137Ab0,7418
|
|
5
|
+
streamflow_pulse_client-2.5.8.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
6
|
+
streamflow_pulse_client-2.5.8.dist-info/licenses/LICENSE,sha256=0k7EFAr1HPL4pMQ46Q5GXg8mIcHwxR1VrZZCNNcDKm8,11298
|
|
7
|
+
streamflow_pulse_client-2.5.8.dist-info/RECORD,,
|
|
@@ -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 describing the origin of the Work and
|
|
141
|
+
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 or network failure, or any and all other
|
|
162
|
+
commercial damages or losses), even if such Contributor has been
|
|
163
|
+
advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Support. While redistributing the Work or
|
|
166
|
+
Derivative Works thereof, You may choose to offer, and charge a
|
|
167
|
+
fee for, acceptance of support, warranty, indemnity, or other
|
|
168
|
+
liability obligations and/or rights consistent with this License.
|
|
169
|
+
However, in accepting such obligations, You may act only on Your
|
|
170
|
+
own behalf and on Your sole responsibility, not on behalf of any
|
|
171
|
+
other Contributor, and only if You agree to indemnify, defend,
|
|
172
|
+
and hold each Contributor harmless for any liability incurred by,
|
|
173
|
+
or claims asserted against, such Contributor by reason of your
|
|
174
|
+
accepting any such warranty or support.
|
|
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 2026 Njong Michael / StreamflowMesh
|
|
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.
|