z4j-core 1.0.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.
Files changed (61) hide show
  1. z4j_core-1.0.0/.github/CODEOWNERS +2 -0
  2. z4j_core-1.0.0/.github/ISSUE_TEMPLATE/bug_report.yml +88 -0
  3. z4j_core-1.0.0/.github/ISSUE_TEMPLATE/config.yml +8 -0
  4. z4j_core-1.0.0/.github/ISSUE_TEMPLATE/feature_request.yml +41 -0
  5. z4j_core-1.0.0/.github/dependabot.yml +35 -0
  6. z4j_core-1.0.0/.github/workflows/ci.yml +133 -0
  7. z4j_core-1.0.0/.github/workflows/release.yml +68 -0
  8. z4j_core-1.0.0/.gitignore +22 -0
  9. z4j_core-1.0.0/.importlinter +42 -0
  10. z4j_core-1.0.0/CHANGELOG.md +37 -0
  11. z4j_core-1.0.0/LICENSE +201 -0
  12. z4j_core-1.0.0/PKG-INFO +111 -0
  13. z4j_core-1.0.0/README.md +83 -0
  14. z4j_core-1.0.0/SECURITY.md +36 -0
  15. z4j_core-1.0.0/pyproject.toml +48 -0
  16. z4j_core-1.0.0/src/z4j_core/__init__.py +22 -0
  17. z4j_core-1.0.0/src/z4j_core/errors.py +231 -0
  18. z4j_core-1.0.0/src/z4j_core/models/__init__.py +56 -0
  19. z4j_core-1.0.0/src/z4j_core/models/_base.py +43 -0
  20. z4j_core-1.0.0/src/z4j_core/models/agent.py +108 -0
  21. z4j_core-1.0.0/src/z4j_core/models/audit.py +61 -0
  22. z4j_core-1.0.0/src/z4j_core/models/command.py +128 -0
  23. z4j_core-1.0.0/src/z4j_core/models/config.py +135 -0
  24. z4j_core-1.0.0/src/z4j_core/models/delta.py +34 -0
  25. z4j_core-1.0.0/src/z4j_core/models/event.py +95 -0
  26. z4j_core-1.0.0/src/z4j_core/models/project.py +68 -0
  27. z4j_core-1.0.0/src/z4j_core/models/queue.py +53 -0
  28. z4j_core-1.0.0/src/z4j_core/models/schedule.py +99 -0
  29. z4j_core-1.0.0/src/z4j_core/models/task.py +175 -0
  30. z4j_core-1.0.0/src/z4j_core/models/user.py +92 -0
  31. z4j_core-1.0.0/src/z4j_core/models/worker.py +71 -0
  32. z4j_core-1.0.0/src/z4j_core/policy/__init__.py +33 -0
  33. z4j_core-1.0.0/src/z4j_core/policy/engine.py +237 -0
  34. z4j_core-1.0.0/src/z4j_core/protocols/__init__.py +36 -0
  35. z4j_core-1.0.0/src/z4j_core/protocols/framework.py +133 -0
  36. z4j_core-1.0.0/src/z4j_core/protocols/queue_engine.py +301 -0
  37. z4j_core-1.0.0/src/z4j_core/protocols/scheduler.py +131 -0
  38. z4j_core-1.0.0/src/z4j_core/py.typed +0 -0
  39. z4j_core-1.0.0/src/z4j_core/redaction/__init__.py +32 -0
  40. z4j_core-1.0.0/src/z4j_core/redaction/engine.py +269 -0
  41. z4j_core-1.0.0/src/z4j_core/redaction/markers.py +37 -0
  42. z4j_core-1.0.0/src/z4j_core/redaction/patterns.py +150 -0
  43. z4j_core-1.0.0/src/z4j_core/transport/__init__.py +71 -0
  44. z4j_core-1.0.0/src/z4j_core/transport/frames.py +455 -0
  45. z4j_core-1.0.0/src/z4j_core/transport/framing.py +157 -0
  46. z4j_core-1.0.0/src/z4j_core/transport/hmac.py +275 -0
  47. z4j_core-1.0.0/src/z4j_core/transport/replay.py +157 -0
  48. z4j_core-1.0.0/src/z4j_core/transport/versioning.py +73 -0
  49. z4j_core-1.0.0/src/z4j_core/version.py +64 -0
  50. z4j_core-1.0.0/tests/__init__.py +0 -0
  51. z4j_core-1.0.0/tests/unit/__init__.py +0 -0
  52. z4j_core-1.0.0/tests/unit/conftest.py +161 -0
  53. z4j_core-1.0.0/tests/unit/test_core_purity.py +99 -0
  54. z4j_core-1.0.0/tests/unit/test_derive_project_secret.py +88 -0
  55. z4j_core-1.0.0/tests/unit/test_errors.py +126 -0
  56. z4j_core-1.0.0/tests/unit/test_frames.py +216 -0
  57. z4j_core-1.0.0/tests/unit/test_hmac.py +160 -0
  58. z4j_core-1.0.0/tests/unit/test_models.py +196 -0
  59. z4j_core-1.0.0/tests/unit/test_policy.py +295 -0
  60. z4j_core-1.0.0/tests/unit/test_redaction.py +255 -0
  61. z4j_core-1.0.0/tests/unit/test_redaction_batch3.py +154 -0
@@ -0,0 +1,2 @@
1
+ # All changes default to the project maintainer.
2
+ * @z4jdev
@@ -0,0 +1,88 @@
1
+ name: Bug report
2
+ description: Report a problem with z4j-core
3
+ title: "[bug] "
4
+ labels: ["bug", "triage"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for reporting a bug in `z4j-core`.
10
+
11
+ **Security bugs do NOT belong here.** If you believe you've found
12
+ a security issue (especially in `transport`, `redaction`, or
13
+ `policy`), please email `security@z4j.com` — see
14
+ [SECURITY.md](../blob/main/SECURITY.md).
15
+
16
+ - type: input
17
+ id: z4j-core-version
18
+ attributes:
19
+ label: z4j-core version
20
+ description: Output of `pip show z4j-core | grep -E 'Name|Version'`
21
+ placeholder: z4j-core 1.0.0
22
+ validations:
23
+ required: true
24
+
25
+ - type: input
26
+ id: python-version
27
+ attributes:
28
+ label: Python version
29
+ placeholder: 3.14.4
30
+ validations:
31
+ required: true
32
+
33
+ - type: input
34
+ id: pydantic-version
35
+ attributes:
36
+ label: Pydantic version
37
+ placeholder: pydantic 2.9.2
38
+ validations:
39
+ required: true
40
+
41
+ - type: dropdown
42
+ id: module
43
+ attributes:
44
+ label: Affected module
45
+ options:
46
+ - z4j_core.models
47
+ - z4j_core.protocols
48
+ - z4j_core.transport (wire protocol / HMAC)
49
+ - z4j_core.redaction
50
+ - z4j_core.policy
51
+ - z4j_core.errors
52
+ - Unsure / multiple
53
+ validations:
54
+ required: true
55
+
56
+ - type: textarea
57
+ id: repro
58
+ attributes:
59
+ label: Minimal reproduction
60
+ description: A standalone script is ideal.
61
+ validations:
62
+ required: true
63
+
64
+ - type: textarea
65
+ id: expected
66
+ attributes:
67
+ label: Expected behavior
68
+ validations:
69
+ required: true
70
+
71
+ - type: textarea
72
+ id: actual
73
+ attributes:
74
+ label: Actual behavior
75
+ description: Include the full traceback if applicable.
76
+ render: shell
77
+ validations:
78
+ required: true
79
+
80
+ - type: checkboxes
81
+ id: terms
82
+ attributes:
83
+ label: Confirmation
84
+ options:
85
+ - label: I searched existing issues and this is not a duplicate
86
+ required: true
87
+ - label: This is NOT a security issue (those go to security@z4j.com)
88
+ required: true
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Security vulnerability
4
+ url: mailto:security@z4j.com
5
+ about: Report a security issue privately (especially transport / redaction / policy)
6
+ - name: Question or discussion
7
+ url: https://github.com/z4jdev/z4j/discussions
8
+ about: General questions about z4j go to the project-wide Discussions
@@ -0,0 +1,41 @@
1
+ name: Feature request
2
+ description: Suggest a capability for z4j-core
3
+ title: "[feature] "
4
+ labels: ["enhancement", "triage"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for suggesting a feature for `z4j-core`.
10
+
11
+ **Before filing:** `z4j-core` is deliberately framework-free and
12
+ engine-free. Requests to add framework or engine-specific code
13
+ here will be redirected to the relevant adapter package
14
+ (`z4j-django`, `z4j-celery`, etc.). If your idea needs framework
15
+ support, please file it on the adapter repo instead.
16
+
17
+ Protocol or wire-format additions are welcome but require design
18
+ discussion — please start with a brief problem statement rather
19
+ than a patch.
20
+
21
+ - type: textarea
22
+ id: problem
23
+ attributes:
24
+ label: Problem
25
+ description: What are you trying to do that z4j-core does not currently support?
26
+ validations:
27
+ required: true
28
+
29
+ - type: textarea
30
+ id: proposed
31
+ attributes:
32
+ label: Proposed solution
33
+ validations:
34
+ required: false
35
+
36
+ - type: textarea
37
+ id: alternatives
38
+ attributes:
39
+ label: Alternatives considered
40
+ validations:
41
+ required: false
@@ -0,0 +1,35 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: uv
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ day: monday
8
+ time: "04:00"
9
+ timezone: UTC
10
+ open-pull-requests-limit: 5
11
+ labels:
12
+ - dependencies
13
+ - python
14
+ commit-message:
15
+ prefix: chore
16
+ include: scope
17
+ groups:
18
+ minor-and-patch:
19
+ update-types:
20
+ - minor
21
+ - patch
22
+
23
+ - package-ecosystem: github-actions
24
+ directory: /
25
+ schedule:
26
+ interval: weekly
27
+ day: monday
28
+ time: "04:00"
29
+ timezone: UTC
30
+ open-pull-requests-limit: 3
31
+ labels:
32
+ - dependencies
33
+ - ci
34
+ commit-message:
35
+ prefix: ci
@@ -0,0 +1,133 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ concurrency:
10
+ group: ci-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ env:
17
+ UV_VERSION: "0.5.11"
18
+ FORCE_COLOR: "1"
19
+ PIP_DISABLE_PIP_VERSION_CHECK: "1"
20
+
21
+ jobs:
22
+ lint:
23
+ name: Lint and format
24
+ runs-on: ubuntu-24.04
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+
28
+ - name: Set up Python
29
+ uses: actions/setup-python@v5
30
+ with:
31
+ python-version: "3.14"
32
+
33
+ - name: Install uv
34
+ uses: astral-sh/setup-uv@v4
35
+ with:
36
+ version: ${{ env.UV_VERSION }}
37
+ enable-cache: true
38
+
39
+ - name: Sync dependencies
40
+ run: uv sync --all-extras --dev
41
+
42
+ - name: Ruff check
43
+ run: uv run ruff check .
44
+
45
+ - name: Ruff format check
46
+ run: uv run ruff format --check .
47
+
48
+ - name: Mypy
49
+ run: uv run mypy src
50
+
51
+ core-purity:
52
+ name: Core purity (import-linter)
53
+ runs-on: ubuntu-24.04
54
+ needs: [lint]
55
+ steps:
56
+ - uses: actions/checkout@v4
57
+
58
+ - name: Set up Python
59
+ uses: actions/setup-python@v5
60
+ with:
61
+ python-version: "3.14"
62
+
63
+ - name: Install uv
64
+ uses: astral-sh/setup-uv@v4
65
+ with:
66
+ version: ${{ env.UV_VERSION }}
67
+ enable-cache: true
68
+
69
+ - name: Sync dependencies
70
+ run: uv sync --all-extras --dev
71
+
72
+ - name: Run import-linter
73
+ run: uv run lint-imports
74
+
75
+ test:
76
+ name: Tests (Python ${{ matrix.python-version }})
77
+ runs-on: ubuntu-24.04
78
+ needs: [lint]
79
+ strategy:
80
+ fail-fast: false
81
+ matrix:
82
+ python-version: ["3.13", "3.14"]
83
+ steps:
84
+ - uses: actions/checkout@v4
85
+
86
+ - name: Set up Python
87
+ uses: actions/setup-python@v5
88
+ with:
89
+ python-version: ${{ matrix.python-version }}
90
+
91
+ - name: Install uv
92
+ uses: astral-sh/setup-uv@v4
93
+ with:
94
+ version: ${{ env.UV_VERSION }}
95
+ enable-cache: true
96
+
97
+ - name: Sync dependencies
98
+ run: uv sync --all-extras --dev
99
+
100
+ - name: Run tests
101
+ run: uv run pytest -xvs tests/
102
+
103
+ build:
104
+ name: Build wheel + sdist
105
+ runs-on: ubuntu-24.04
106
+ needs: [test, core-purity]
107
+ steps:
108
+ - uses: actions/checkout@v4
109
+
110
+ - name: Set up Python
111
+ uses: actions/setup-python@v5
112
+ with:
113
+ python-version: "3.14"
114
+
115
+ - name: Install uv
116
+ uses: astral-sh/setup-uv@v4
117
+ with:
118
+ version: ${{ env.UV_VERSION }}
119
+
120
+ - name: Build
121
+ run: uv build
122
+
123
+ - name: Validate metadata
124
+ run: |
125
+ uv tool install twine
126
+ uv tool run twine check dist/*
127
+
128
+ - name: Upload artefacts
129
+ uses: actions/upload-artifact@v4
130
+ with:
131
+ name: dist
132
+ path: dist/
133
+ retention-days: 7
@@ -0,0 +1,68 @@
1
+ name: Release
2
+
3
+ # Manual-publish phase: this workflow builds the package and attaches
4
+ # the wheel + sdist to a GitHub Release. It does NOT upload to PyPI.
5
+ # PyPI uploads are hand-picked from a local staging folder via twine,
6
+ # under the maintainer's direct control. See docs/RELEASE.md.
7
+
8
+ on:
9
+ push:
10
+ tags:
11
+ - "v*.*.*"
12
+
13
+ permissions:
14
+ contents: write
15
+ id-token: read
16
+
17
+ env:
18
+ UV_VERSION: "0.5.11"
19
+
20
+ jobs:
21
+ build-and-release:
22
+ name: Build and attach to GitHub Release
23
+ runs-on: ubuntu-24.04
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+
27
+ - name: Verify tag matches pyproject version
28
+ run: |
29
+ TAG_VERSION="${GITHUB_REF_NAME#v}"
30
+ PKG_VERSION=$(grep -E '^version = ' pyproject.toml | head -1 | sed -E 's/version = "(.*)"/\1/')
31
+ if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
32
+ echo "::error::Tag $GITHUB_REF_NAME does not match pyproject version $PKG_VERSION"
33
+ exit 1
34
+ fi
35
+
36
+ - name: Set up Python
37
+ uses: actions/setup-python@v5
38
+ with:
39
+ python-version: "3.14"
40
+
41
+ - name: Install uv
42
+ uses: astral-sh/setup-uv@v4
43
+ with:
44
+ version: ${{ env.UV_VERSION }}
45
+
46
+ - name: Sync dependencies
47
+ run: uv sync --all-extras --dev
48
+
49
+ - name: Run tests
50
+ run: uv run pytest -xvs tests/
51
+
52
+ - name: Run import-linter
53
+ run: uv run lint-imports
54
+
55
+ - name: Build wheel + sdist
56
+ run: uv build
57
+
58
+ - name: Validate metadata
59
+ run: |
60
+ uv tool install twine
61
+ uv tool run twine check dist/*
62
+
63
+ - name: Create GitHub Release with artefacts
64
+ uses: softprops/action-gh-release@v2
65
+ with:
66
+ files: dist/*
67
+ generate_release_notes: true
68
+ fail_on_unmatched_files: true
@@ -0,0 +1,22 @@
1
+ # Build output
2
+ dist/
3
+ build/
4
+ *.egg-info/
5
+
6
+ # Python caches
7
+ __pycache__/
8
+ *.pyc
9
+ .pytest_cache/
10
+ .mypy_cache/
11
+ .ruff_cache/
12
+ .hypothesis/
13
+
14
+ # Virtualenvs
15
+ .venv/
16
+ venv/
17
+
18
+ # IDE / editor
19
+ .vscode/
20
+ .idea/
21
+ *.swp
22
+ .DS_Store
@@ -0,0 +1,42 @@
1
+ # import-linter configuration for z4j-core
2
+ #
3
+ # Enforces the "core knows nothing" principle: z4j_core may import
4
+ # only Pydantic, typing_extensions, and the standard library. Any
5
+ # framework, engine, transport, or ORM import fails the build.
6
+ #
7
+ # Run with: uv run lint-imports
8
+
9
+ [importlinter]
10
+ root_packages =
11
+ z4j_core
12
+ include_external_packages = True
13
+
14
+ [importlinter:contract:core-purity]
15
+ name = z4j_core must not import framework or engine code
16
+ type = forbidden
17
+ source_modules =
18
+ z4j_core
19
+ forbidden_modules =
20
+ django
21
+ flask
22
+ fastapi
23
+ starlette
24
+ celery
25
+ kombu
26
+ rq
27
+ dramatiq
28
+ huey
29
+ arq
30
+ taskiq
31
+ redis
32
+ amqp
33
+ pika
34
+ sqlalchemy
35
+ alembic
36
+ asyncpg
37
+ psycopg
38
+ psycopg2
39
+ httpx
40
+ requests
41
+ aiohttp
42
+ websockets
@@ -0,0 +1,37 @@
1
+ # Changelog
2
+
3
+ All notable changes to `z4j-core` are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [1.0.0] - 2026-04
11
+
12
+ ### Added
13
+
14
+ - First public release.
15
+ - Pydantic v2 domain models under `z4j_core.models`: `Project`, `Agent`, `Task`, `Queue`, `Worker`, `Schedule`, `Command`, `CommandResult`, `Event`, `AuditEntry`, `User`, `Config`, `Delta`.
16
+ - The three adapter Protocols under `z4j_core.protocols`: `QueueEngineAdapter` (15 methods), `FrameworkAdapter`, `SchedulerAdapter` (7 methods).
17
+ - Exception hierarchy rooted at `Z4JError` in `z4j_core.errors`.
18
+ - Recursive secret-redaction engine under `z4j_core.redaction` with default patterns and per-field overrides.
19
+ - Wire-protocol primitives under `z4j_core.transport`: frame shapes, `PROTOCOL_VERSION = "2"`, HMAC v2 sign/verify helpers.
20
+ - Permission engine under `z4j_core.policy` (`can(user, action, project)`).
21
+ - `PROTOCOL_VERSION` constant for runtime compatibility checks between brain and agents.
22
+ - 271 unit tests.
23
+ - `py.typed` marker (PEP 561) — full static-type coverage.
24
+
25
+ ### Guarantees
26
+
27
+ - No runtime dependencies beyond Pydantic and `typing-extensions`.
28
+ - No imports of Django, Celery, Flask, FastAPI, Redis, SQLAlchemy, RQ, Dramatiq, websockets, httpx, or any other framework/engine/transport library. This is enforced by `import-linter` in CI.
29
+
30
+ ## Links
31
+
32
+ - Repository: <https://github.com/z4jdev/z4j-core>
33
+ - Issues: <https://github.com/z4jdev/z4j-core/issues>
34
+ - PyPI: <https://pypi.org/project/z4j-core/>
35
+
36
+ [Unreleased]: https://github.com/z4jdev/z4j-core/compare/v1.0.0...HEAD
37
+ [1.0.0]: https://github.com/z4jdev/z4j-core/releases/tag/v1.0.0
z4j_core-1.0.0/LICENSE ADDED
@@ -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 failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 z4j contributors
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.