delego 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,32 @@
1
+ <!-- Fork the repo and open this PR from a branch in your fork. See CONTRIBUTING.md. -->
2
+
3
+ ## What & why
4
+
5
+ <!-- What does this change do, and why? Link any issue. -->
6
+
7
+ ## AI assistance disclosure (required)
8
+
9
+ <!-- AI-assisted PRs are welcome but get stricter review. Be specific. -->
10
+
11
+ - [ ] No AI assistance.
12
+ - [ ] AI-assisted. Tool(s) and how used: ______
13
+ - [ ] AI-generated, human-reviewed. I have read every line and am accountable for it.
14
+
15
+ ## Checklist
16
+
17
+ - [ ] Forked the repo; this PR comes from a branch in my fork.
18
+ - [ ] `pytest` passes locally.
19
+ - [ ] `python examples/demo.py` still shows all eight scenarios + tamper detection.
20
+ - [ ] **Tests added/updated** for the behaviour changed (or explained why none are needed).
21
+ - [ ] Updated `README.md` and `CHANGELOG.md` for any behaviour change.
22
+ - [ ] I have **not weakened any design invariant** (see `CONTRIBUTING.md` / `ARCHITECTURE.md`):
23
+ no LLM in the authorization path; no credential custody; fail-closed; approvals
24
+ bound to fingerprint + intent and single-use; append-only signed audit chain;
25
+ fixed evaluation order.
26
+
27
+ ## Protocol / spec impact
28
+
29
+ - [ ] No normative/protocol behaviour changed.
30
+ - [ ] Normative behaviour changed — the [wire spec](https://github.com/Delego-Dev/specification)
31
+ and its CTK vectors are updated (or a linked spec PR does so), and
32
+ `__protocol_version__` stays ≤ the spec version.
@@ -0,0 +1,38 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ test:
13
+ name: test (py${{ matrix.python-version }})
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ python-version: ["3.10", "3.11", "3.12"]
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+
23
+ - name: Set up Python ${{ matrix.python-version }}
24
+ uses: actions/setup-python@v5
25
+ with:
26
+ python-version: ${{ matrix.python-version }}
27
+ cache: pip
28
+
29
+ - name: Install (editable, with dev extras)
30
+ run: |
31
+ python -m pip install --upgrade pip
32
+ pip install -e ".[dev]"
33
+
34
+ - name: Run the test suite
35
+ run: pytest
36
+
37
+ - name: Run the demo (the de facto spec)
38
+ run: python examples/demo.py
@@ -0,0 +1,49 @@
1
+ name: Release
2
+
3
+ # Publishes to PyPI when a GitHub Release is published, using PyPI Trusted
4
+ # Publishing (OIDC) — no API token is stored in the repo. One-time setup: add a
5
+ # trusted publisher on PyPI for project `delego`, repo `Delego-Dev/delego`,
6
+ # workflow `release.yml`, environment `pypi`. See CONTRIBUTING.md.
7
+
8
+ on:
9
+ release:
10
+ types: [published]
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ build:
17
+ name: Build sdist + wheel
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.12"
24
+ - name: Build
25
+ run: |
26
+ python -m pip install --upgrade pip build
27
+ python -m build
28
+ - name: Check metadata
29
+ run: |
30
+ python -m pip install twine
31
+ twine check dist/*
32
+ - uses: actions/upload-artifact@v4
33
+ with:
34
+ name: dist
35
+ path: dist/
36
+
37
+ publish:
38
+ name: Publish to PyPI
39
+ needs: build
40
+ runs-on: ubuntu-latest
41
+ environment: pypi
42
+ permissions:
43
+ id-token: write # required for trusted publishing (OIDC)
44
+ steps:
45
+ - uses: actions/download-artifact@v4
46
+ with:
47
+ name: dist
48
+ path: dist/
49
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,22 @@
1
+ # macOS
2
+ .DS_Store
3
+
4
+ # Python
5
+ __pycache__/
6
+ *.pyc
7
+ *.egg-info/
8
+ .pytest_cache/
9
+ build/
10
+ dist/
11
+ .venv/
12
+ venv/
13
+
14
+ # local delego state (keys, ledger, approvals) — never commit
15
+ .delego/
16
+ *.pem
17
+ *.pub
18
+ audit.log.jsonl
19
+ approvals.jsonl
20
+
21
+ # Claude Code local guidance (not part of the public repo)
22
+ CLAUDE.md
@@ -0,0 +1,90 @@
1
+ # Architecture
2
+
3
+ How delego is put together, and the invariants that define it. For the rules on
4
+ *contributing* changes (including the design invariants you must not break), see
5
+ [CONTRIBUTING.md](CONTRIBUTING.md). The wire protocol is specified separately at
6
+ [Delego-Dev/specification](https://github.com/Delego-Dev/specification), which
7
+ **leads** this reference (see [CONTRIBUTING.md](CONTRIBUTING.md)).
8
+
9
+ ## What delego is
10
+
11
+ delego is a **policy & audit firewall for agent actions**. It sits between an
12
+ agent and whatever credential broker holds the user's secrets, and answers the
13
+ question brokers don't: *is this specific action the thing the human actually
14
+ asked for?*
15
+
16
+ ```
17
+ agent ──propose──▶ delego ──if allowed──▶ credential broker ──▶ service
18
+ (LLM) (policy + (holds the secret, (bank, SaaS,
19
+ approval + injects it, forwards) API)
20
+ audit)
21
+ └── needs_approval ──▶ human (CLI)
22
+ ```
23
+
24
+ Credential brokering (the agent never holds the secret) is a crowded, converging
25
+ space. The harder problem delego targets is the **confused deputy**: the agent
26
+ holds a *valid* credential, a prompt injection redirects it, the scope *covers*
27
+ the action, so a broker happily injects the secret. The credential is the wrong
28
+ layer to catch this — it's valid. delego authorises the *action*,
29
+ deterministically, before any credential is used, and leaves tamper-evident proof
30
+ of why.
31
+
32
+ ## Design invariants
33
+
34
+ These are the reason the tool exists; a change that breaks one breaks the
35
+ product. They are enumerated, with the "do not violate" framing, in
36
+ [CONTRIBUTING.md](CONTRIBUTING.md):
37
+
38
+ 1. **No LLM in the authorization path** (`policy.py`, `engine.py`).
39
+ 2. **delego holds no credentials** and makes no upstream request itself.
40
+ 3. **Fail closed** — default `deny`; a matched-but-failed constraint is a deny.
41
+ 4. **Approvals are bound to the exact action fingerprint *and* intent, and are
42
+ single-use** (the confused-deputy guard in `engine.resolve`).
43
+ 5. **The audit ledger is append-only, hash-chained, and Ed25519-signed.**
44
+ 6. **Evaluation order is fixed:** forbidden → rules (first match wins) → default.
45
+
46
+ ## Evaluation order
47
+
48
+ `policy.evaluate` is the deterministic core:
49
+
50
+ 1. **`forbidden`** — hard blocks, always deny, checked first.
51
+ 2. **`rules`** — first matching rule decides (`allow` / `needs_approval`),
52
+ subject to its constraints. A matched rule whose constraints fail becomes a
53
+ deny (fail-closed).
54
+ 3. **`default`** — used when nothing matched (recommended: `deny`).
55
+
56
+ ## Repo map
57
+
58
+ - `delego/models.py` — `ProposedAction` (derives `intent_hash` from the
59
+ instruction, `fingerprint` from method+host+path+params) and `Decision`.
60
+ - `delego/policy.py` — the deterministic engine: load YAML, match rules, check
61
+ constraints (`amount`, `allow_list`, `rate_limit`). **No LLM here.**
62
+ - `delego/audit.py` — tamper-evident receipt chain; `ensure_keys`, `append`,
63
+ `verify`, `count_allows` (rate limiting reads the ledger).
64
+ - `delego/approval.py` — file-backed human approval queue
65
+ (pending/approved/denied/consumed).
66
+ - `delego/brokers.py` — `BrokerAdapter` protocol; `NullBroker` (default, holds no
67
+ creds, simulates execution) and `HTTPProxyBroker` (sketch, not wired).
68
+ - `delego/engine.py` — `Firewall.propose()` / `Firewall.resolve()`; the
69
+ confused-deputy guard lives in `resolve`.
70
+ - `delego/config.py` — `Paths.resolve` (home precedence), the `.gitignore`
71
+ written into the home, and `build_firewall()` (single wiring point for CLI +
72
+ MCP; loads the policy first so a missing/invalid policy fails closed).
73
+ - `delego/cli.py` — the `delego` CLI: init, home, policy, pending, approve, deny,
74
+ log, verify.
75
+ - `delego/mcp_server.py` — FastMCP server exposing `delego_propose_action`,
76
+ `delego_resolve_action`, `delego_audit_tail`, `delego_show_policy`.
77
+ - `examples/demo.py` — end-to-end walkthrough; the de facto behavioural spec.
78
+ - `tests/` — pytest suite (the demo scenarios + invariant guards).
79
+ - `policy.example.yaml` — a generic starter policy for an HTTP/JSON API.
80
+
81
+ ## Conventions
82
+
83
+ - Python ≥ 3.10. Core models use dataclasses (keep runtime deps light and
84
+ auditable — this is a security tool). Pydantic only at the MCP boundary.
85
+ - FastMCP tools: name `delego_<verb>`, always set `annotations`
86
+ (`readOnlyHint` / `destructiveHint` / `idempotentHint` / `openWorldHint`) and
87
+ document the JSON return shape in the docstring.
88
+ - Keep dependencies minimal and pinned-ish; justify any new one.
89
+ - `__protocol_version__` is the highest wire-protocol version this reference
90
+ implements; it MUST stay ≤ the spec's version.
@@ -0,0 +1,80 @@
1
+ # Changelog
2
+
3
+ All notable changes to delego are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project aims to
5
+ adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.2.0] — 2026-06-04
10
+
11
+ First public release on PyPI. (0.1.0 was the initial implementation and was never
12
+ published.) Implements wire-protocol **0.2.0**; see
13
+ [`__protocol_version__`](delego/__init__.py).
14
+
15
+ ### Security
16
+ - **Single-use approvals.** A human approval now releases its action exactly
17
+ once: `engine.resolve` consumes the approval before executing, so a replayed
18
+ `resolve` of an already-used approval is refused (`approved` → `consumed`).
19
+ Previously one approval could be resolved repeatedly, executing the same action
20
+ N times.
21
+ - **Approvals are bound to the instruction, not only the action fingerprint.**
22
+ `resolve` re-checks the approval's `intent_hash`, so the same action carried
23
+ under a different claimed instruction is denied.
24
+ - **Rate limits fail closed when unevaluable.** A `rate_limit` constraint with no
25
+ audit log to read now denies instead of silently passing.
26
+ - **`rate_limit` on `needs_approval` rules now counts.** Approved-then-executed
27
+ actions carry their originating rule on the execution receipt, so the
28
+ ledger-backed counter attributes them correctly (previously `rule=None`, making
29
+ the cap a no-op).
30
+ - **`verify()` is robust to structural tampering.** Removing a field from a
31
+ receipt, or corrupting a line, is now reported as a problem instead of crashing
32
+ verification.
33
+
34
+ ### Added
35
+ - Regression tests for the above: single-use approvals, intent-bound resolve,
36
+ fail-closed rate limit without an audit log, and crash-free `verify()` on a
37
+ removed field (`tests/test_guards.py`).
38
+ - `delego pending` now prints the originating instruction for each parked action,
39
+ so the human approver sees *what* they are authorising, not just the request.
40
+ - pytest regression suite encoding the eight demo scenarios plus invariant
41
+ guards, with an isolated-firewall fixture (`tests/`).
42
+ - GitHub Actions CI running the suite **and** the demo on Python 3.10–3.12
43
+ (`.github/workflows/ci.yml`).
44
+ - PyPI release workflow using Trusted Publishing (`.github/workflows/release.yml`).
45
+ - `delego/__init__.py` exporting the public API (`ProposedAction`, `Decision`,
46
+ `Firewall`, `Policy`, `AuditLog`, `Paths`, `build_firewall`, and the
47
+ `OUTCOME_*` constants).
48
+ - Project-scoped state for Claude Code: `Paths.resolve` precedence is now
49
+ `--home` → `DELEGO_HOME` → project-local `./.claude/.delego` (if present) →
50
+ `~/.delego`; added a `delego home` command and a `.gitignore` written into the
51
+ home so the signing key and ledger are never committed.
52
+ - Open-source scaffolding: `LICENSE` (Apache-2.0), `CONTRIBUTING.md`,
53
+ `SECURITY.md`, this changelog, and publishing metadata in `pyproject.toml`.
54
+
55
+ ### Changed
56
+ - Repository restructured to the standard Python layout (package under
57
+ `delego/`, project files and `examples/demo.py` at the repo root) so
58
+ `pip install -e .` and `python examples/demo.py` work as documented.
59
+ - Replaced the BFSI-flavoured example with a generic `api.example.com` example
60
+ across the policy, demo, tests, and docs.
61
+ - Retired the committed `CLAUDE.md`; durable design notes now live in
62
+ `ARCHITECTURE.md`. Added `delego.__protocol_version__` (the wire-protocol
63
+ version this reference implements, which must stay ≤ the spec's version) and a
64
+ spec-first / AI-assisted-contribution policy plus a PR template.
65
+
66
+ ## 0.1.0 — initial implementation (never released to PyPI)
67
+
68
+ ### Added
69
+ - Deterministic policy engine: forbidden → rules (first match wins) → default,
70
+ with `amount`, `allow_list`, and `rate_limit` constraints, all fail-closed.
71
+ - Intent hashing and action fingerprinting (`models.py`).
72
+ - Action-bound human approval queue and the confused-deputy guard
73
+ (`engine.resolve`).
74
+ - Append-only, hash-chained, Ed25519-signed audit ledger with `verify()`.
75
+ - The `delego` CLI (init / policy / pending / approve / deny / log / verify) and
76
+ a FastMCP server exposing propose / resolve / audit_tail / show_policy.
77
+ - `NullBroker` (default; holds no credentials) and an `HTTPProxyBroker` sketch.
78
+
79
+ [Unreleased]: https://github.com/Delego-Dev/delego/compare/v0.2.0...HEAD
80
+ [0.2.0]: https://github.com/Delego-Dev/delego/releases/tag/v0.2.0
@@ -0,0 +1,106 @@
1
+ # Contributing to delego
2
+
3
+ Thanks for your interest in delego — a policy & audit firewall for agent
4
+ actions. Please read [ARCHITECTURE.md](ARCHITECTURE.md) before making changes: it
5
+ documents the design and, above all, the **invariants that must not be broken**.
6
+
7
+ ## Design invariants (do not violate)
8
+
9
+ delego is a security tool; these properties are the reason it exists. A change
10
+ that breaks one breaks the product:
11
+
12
+ 1. **No LLM in the authorization path.** Authorisation is pure, inspectable
13
+ Python (`policy.py`, `engine.py`).
14
+ 2. **delego holds no credentials** and makes no upstream request itself —
15
+ execution is delegated through a `BrokerAdapter`.
16
+ 3. **Fail closed.** Default is `deny`; a matched rule whose constraints fail
17
+ becomes a deny, never a silent allow.
18
+ 4. **Approvals are bound to the exact action fingerprint** (the confused-deputy
19
+ guard in `engine.resolve`).
20
+ 5. **The audit ledger is append-only, hash-chained, and Ed25519-signed.**
21
+ 6. **Evaluation order is fixed:** forbidden → rules (first match wins) → default.
22
+
23
+ If a change seems to require breaking one of these, stop and open an issue first.
24
+
25
+ ## Development setup
26
+
27
+ Requires Python 3.10+.
28
+
29
+ ```bash
30
+ git clone https://github.com/Delego-Dev/delego
31
+ cd delego
32
+ python -m venv .venv && . .venv/bin/activate
33
+ pip install -e ".[dev]"
34
+ ```
35
+
36
+ ## Running the demo and tests
37
+
38
+ The demo is the de facto spec; the test suite encodes it as regression tests.
39
+
40
+ ```bash
41
+ python examples/demo.py # 8 scenarios + tamper detection
42
+ pytest # the regression suite
43
+ ```
44
+
45
+ CI runs both on Python 3.10, 3.11, and 3.12 (`.github/workflows/ci.yml`). Every
46
+ behaviour change must keep the demo green and add or adjust tests to match.
47
+
48
+ ## Pull requests
49
+
50
+ - **Fork the repository** and open the PR from a branch in your fork; direct
51
+ pushes are not accepted.
52
+ - Keep changes small and focused; explain the *why*.
53
+ - Re-run `python examples/demo.py` and `pytest` before submitting.
54
+ - Update `README.md`, `CHANGELOG.md`, and the tests alongside any behaviour change.
55
+ - Confirm you have not weakened any invariant above.
56
+ - Fill in the pull-request template completely, including the AI-assistance
57
+ disclosure (below).
58
+
59
+ ## Tests are required
60
+
61
+ Every behaviour or feature change MUST ship with tests that pin the new
62
+ behaviour — a regression test for a fix, a scenario/guard test for a feature
63
+ (`tests/test_scenarios.py`, `tests/test_guards.py`). A PR that changes behaviour
64
+ without tests will not be merged; if you believe a change genuinely needs none
65
+ (pure docs, comments), say so explicitly in the PR. CI runs the suite and the
66
+ demo on Python 3.10–3.12.
67
+
68
+ ## The spec leads this implementation
69
+
70
+ The wire protocol is defined in
71
+ [Delego-Dev/specification](https://github.com/Delego-Dev/specification), and the
72
+ spec **leads** this code: a normative behaviour is specified there first, then
73
+ implemented here. A change to authorization, the audit chain, fingerprinting, or
74
+ approval semantics should land in the spec (with regenerated CTK vectors) before
75
+ or alongside the implementation. This repo exposes `delego.__protocol_version__`
76
+ (the highest protocol version it implements); it MUST stay ≤ the spec's version,
77
+ which the spec repo's `conformance.py` enforces by replaying the CTK vectors
78
+ against this reference.
79
+
80
+ ## AI-assisted contributions
81
+
82
+ AI coding assistants are welcome tools, but AI-generated or AI-assisted
83
+ contributions to a security tool carry extra risk, so:
84
+
85
+ - **Disclose it.** The PR template has a required field for whether and how AI was
86
+ used. Be honest and specific.
87
+ - **Expect stricter review.** AI-assisted PRs — especially ones touching the
88
+ decision/audit core or an invariant — receive closer scrutiny and may take
89
+ longer to merge. Unreviewed, bulk-generated PRs will be closed.
90
+ - **You are accountable.** The human author is responsible for every line: that it
91
+ is correct, tested, and weakens no invariant or security property. "The model
92
+ wrote it" is not a defence.
93
+ - **Process is the same — fork, template, tests, green CI.** No fast path for AI
94
+ output.
95
+
96
+ ## Releasing (maintainers)
97
+
98
+ Releases publish to PyPI from GitHub Actions using **PyPI Trusted Publishing**
99
+ (OIDC — no API tokens are stored in the repo). One-time setup: on PyPI, add a
100
+ trusted publisher for project `delego` → repo `Delego-Dev/delego`, workflow
101
+ `release.yml`, environment `pypi`. Then for each release:
102
+
103
+ 1. Bump `version` in `pyproject.toml` and move the `CHANGELOG.md` entries from
104
+ *Unreleased* into the new version.
105
+ 2. Publish a GitHub Release with tag `vX.Y.Z`.
106
+ 3. `.github/workflows/release.yml` builds the sdist + wheel and publishes them.
delego-0.2.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.