agentmandate 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. agentmandate-0.1.0/.github/workflows/ci.yml +162 -0
  2. agentmandate-0.1.0/.github/workflows/release.yml +55 -0
  3. agentmandate-0.1.0/.gitignore +9 -0
  4. agentmandate-0.1.0/CHANGELOG.md +45 -0
  5. agentmandate-0.1.0/CONTRIBUTING.md +51 -0
  6. agentmandate-0.1.0/DESIGN.md +126 -0
  7. agentmandate-0.1.0/LICENSE +202 -0
  8. agentmandate-0.1.0/PKG-INFO +246 -0
  9. agentmandate-0.1.0/README.md +212 -0
  10. agentmandate-0.1.0/RELEASING.md +46 -0
  11. agentmandate-0.1.0/SECURITY.md +40 -0
  12. agentmandate-0.1.0/STABILITY.md +38 -0
  13. agentmandate-0.1.0/agentmandate/__init__.py +51 -0
  14. agentmandate-0.1.0/agentmandate/cli.py +173 -0
  15. agentmandate-0.1.0/agentmandate/diff.py +189 -0
  16. agentmandate-0.1.0/agentmandate/lint.py +149 -0
  17. agentmandate-0.1.0/agentmandate/manifest.py +297 -0
  18. agentmandate-0.1.0/agentmandate/py.typed +0 -0
  19. agentmandate-0.1.0/agentmandate/reach.py +324 -0
  20. agentmandate-0.1.0/agentmandate/scan.py +205 -0
  21. agentmandate-0.1.0/agentmandate/verify.py +212 -0
  22. agentmandate-0.1.0/docs/manifest.md +170 -0
  23. agentmandate-0.1.0/examples/dispute-resolver-sod.yaml +35 -0
  24. agentmandate-0.1.0/examples/dispute-resolver-v2.yaml +36 -0
  25. agentmandate-0.1.0/examples/dispute-resolver.yaml +32 -0
  26. agentmandate-0.1.0/examples/mcp-tools.json +10 -0
  27. agentmandate-0.1.0/examples/observed-calls.jsonl +4 -0
  28. agentmandate-0.1.0/pyproject.toml +83 -0
  29. agentmandate-0.1.0/tests/test_cli.py +168 -0
  30. agentmandate-0.1.0/tests/test_diff.py +159 -0
  31. agentmandate-0.1.0/tests/test_lint.py +129 -0
  32. agentmandate-0.1.0/tests/test_manifest.py +184 -0
  33. agentmandate-0.1.0/tests/test_reach.py +228 -0
  34. agentmandate-0.1.0/tests/test_scan.py +118 -0
  35. agentmandate-0.1.0/tests/test_verify.py +143 -0
@@ -0,0 +1,162 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: ci-${{ github.workflow }}-${{ github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ test:
18
+ name: Python ${{ matrix.python-version }}
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ python-version:
24
+ - "3.10"
25
+ - "3.11"
26
+ - "3.12"
27
+ - "3.13"
28
+ - "3.14"
29
+
30
+ steps:
31
+ - uses: actions/checkout@v7
32
+ - uses: actions/setup-python@v7
33
+ with:
34
+ python-version: ${{ matrix.python-version }}
35
+ cache: pip
36
+ - name: Install
37
+ run: python -m pip install -e ".[dev]"
38
+ - name: Test
39
+ run: python -m pytest -q
40
+
41
+ lint:
42
+ name: Lint
43
+ runs-on: ubuntu-latest
44
+ steps:
45
+ - uses: actions/checkout@v7
46
+ - uses: actions/setup-python@v7
47
+ with:
48
+ python-version: "3.12"
49
+ cache: pip
50
+ - name: Install
51
+ run: python -m pip install -e ".[dev]"
52
+ - name: Lint
53
+ run: ruff check .
54
+
55
+ coverage:
56
+ name: Coverage
57
+ runs-on: ubuntu-latest
58
+ steps:
59
+ - uses: actions/checkout@v7
60
+ - uses: actions/setup-python@v7
61
+ with:
62
+ python-version: "3.12"
63
+ cache: pip
64
+ - name: Install
65
+ run: python -m pip install -e ".[dev]"
66
+ - name: Enforce statement coverage
67
+ run: >-
68
+ python -m pytest -q
69
+ --cov=agentmandate
70
+ --cov-report=term-missing
71
+ --cov-fail-under=90
72
+
73
+ no-dependency-install:
74
+ name: Core has no runtime dependency
75
+ runs-on: ubuntu-latest
76
+ steps:
77
+ - uses: actions/checkout@v7
78
+ - uses: actions/setup-python@v7
79
+ with:
80
+ python-version: "3.12"
81
+ cache: pip
82
+ - name: Install without extras
83
+ run: python -m pip install .
84
+ # A JSON manifest must work with nothing else installed. The YAML reader
85
+ # is an extra, and the error when it is missing has to name the fix.
86
+ - name: Analyse a JSON manifest with no extras present
87
+ run: |
88
+ cd "${RUNNER_TEMP}"
89
+ cat > m.json <<'JSON'
90
+ {"agent": "a", "limits": {"total": {"amount": 10, "currency": "GBP"}},
91
+ "tools": [{"name": "seed", "effect": "read", "produces": "case",
92
+ "unbounded": true},
93
+ {"name": "pay", "effect": "irreversible", "requires": ["case"],
94
+ "value_arg": "amount", "scope_key": "case",
95
+ "requires_approval": true,
96
+ "ceiling": {"amount": 10, "currency": "GBP"}}]}
97
+ JSON
98
+ mandate reach m.json && exit 1
99
+ echo "reach correctly exited non-zero on a reachable breach"
100
+
101
+ package:
102
+ name: Package
103
+ runs-on: ubuntu-latest
104
+ steps:
105
+ - uses: actions/checkout@v7
106
+ - uses: actions/setup-python@v7
107
+ with:
108
+ python-version: "3.12"
109
+ cache: pip
110
+ - name: Install build tools
111
+ run: python -m pip install build twine
112
+ - name: Build distributions
113
+ run: python -m build
114
+ - name: Check distribution metadata
115
+ run: python -m twine check dist/*
116
+ - name: Install wheel
117
+ run: python -m pip install --force-reinstall "dist/$(ls dist | grep '\.whl$')[yaml]"
118
+ - name: Smoke-test installed package
119
+ run: |
120
+ export PACKAGE_VERSION
121
+ PACKAGE_VERSION="$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")"
122
+ cd "${RUNNER_TEMP}"
123
+ python -c "import importlib.metadata as m, os; import agentmandate; assert m.version('agentmandate') == os.environ['PACKAGE_VERSION']"
124
+ mandate --help
125
+
126
+ gate:
127
+ name: CI gate
128
+ runs-on: ubuntu-latest
129
+ needs:
130
+ - test
131
+ - lint
132
+ - coverage
133
+ - no-dependency-install
134
+ - package
135
+ # Runs even when a needed job fails, so the gate reports a real failure
136
+ # instead of being skipped and leaving the required check pending forever.
137
+ if: always()
138
+ steps:
139
+ - name: Require every upstream job to succeed
140
+ env:
141
+ TEST_RESULT: ${{ needs.test.result }}
142
+ LINT_RESULT: ${{ needs.lint.result }}
143
+ COVERAGE_RESULT: ${{ needs.coverage.result }}
144
+ NODEPS_RESULT: ${{ needs.no-dependency-install.result }}
145
+ PACKAGE_RESULT: ${{ needs.package.result }}
146
+ run: |
147
+ echo "test: ${TEST_RESULT}"
148
+ echo "lint: ${LINT_RESULT}"
149
+ echo "coverage: ${COVERAGE_RESULT}"
150
+ echo "no-deps: ${NODEPS_RESULT}"
151
+ echo "package: ${PACKAGE_RESULT}"
152
+ for result in \
153
+ "${TEST_RESULT}" \
154
+ "${LINT_RESULT}" \
155
+ "${COVERAGE_RESULT}" \
156
+ "${NODEPS_RESULT}" \
157
+ "${PACKAGE_RESULT}"; do
158
+ if [ "${result}" != "success" ]; then
159
+ echo "::error::a required job did not succeed"
160
+ exit 1
161
+ fi
162
+ done
@@ -0,0 +1,55 @@
1
+ name: Release
2
+
3
+ on:
4
+ release:
5
+ types:
6
+ - published
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ name: Build distributions
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v7
17
+ with:
18
+ ref: ${{ github.event.release.tag_name }}
19
+ - uses: actions/setup-python@v7
20
+ with:
21
+ python-version: "3.12"
22
+ cache: pip
23
+ - name: Verify release tag
24
+ env:
25
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
26
+ run: |
27
+ PACKAGE_VERSION="$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")"
28
+ test "${RELEASE_TAG}" = "v${PACKAGE_VERSION}"
29
+ - name: Install build tools
30
+ run: python -m pip install build twine
31
+ - name: Build distributions
32
+ run: python -m build
33
+ - name: Check distribution metadata
34
+ run: python -m twine check dist/*
35
+ - uses: actions/upload-artifact@v7
36
+ with:
37
+ name: python-package-distributions
38
+ path: dist/
39
+
40
+ publish:
41
+ name: Publish to PyPI
42
+ needs: build
43
+ runs-on: ubuntu-latest
44
+ environment:
45
+ name: pypi
46
+ url: https://pypi.org/p/agentmandate
47
+ permissions:
48
+ id-token: write
49
+ steps:
50
+ - uses: actions/download-artifact@v8
51
+ with:
52
+ name: python-package-distributions
53
+ path: dist/
54
+ - name: Publish distributions
55
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,9 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ *.egg-info/
5
+ .pytest_cache/
6
+ .coverage
7
+ .ruff_cache/
8
+ build/
9
+ dist/
@@ -0,0 +1,45 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
5
+ [semantic versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## Unreleased
8
+
9
+ ## 0.1.0 - 2026-07-28
10
+
11
+ First release.
12
+
13
+ ### Added
14
+
15
+ - `mandate reach`, a bounded breadth-first search over the authority graph that
16
+ reports a legal call sequence breaching a declared limit, as a counterexample
17
+ rather than a score.
18
+ - `mandate diff`, a comparison of the effective authority of two manifests,
19
+ classified widening, narrowing, or neutral, exiting non-zero on widening.
20
+ - `mandate lint`, single-manifest control checks covering separation of duties,
21
+ ungated irreversible effects, service-account principals, ceilings scoped to
22
+ something the tool does not require, and mixed currencies.
23
+ - `mandate verify`, replay of recorded tool calls against the manifest,
24
+ reporting undeclared tools, exceeded ceilings, missing approvals, wrong
25
+ principals, and run totals.
26
+ - A manifest schema carrying the three facts an ordinary tool schema omits:
27
+ effect class, the value-bearing argument, and the scope a ceiling is measured
28
+ against.
29
+ - Worked examples for a payment-dispute agent, including the release pair where
30
+ adding one read-only tool takes extractable value from 500 to 2000 GBP.
31
+ - `--json` on every analysis command, and exit codes suitable for a CI gate.
32
+ - `mandate scan`, which derives a manifest skeleton from an MCP `tools/list`
33
+ catalogue. Effects are guessed from the tool name and default to
34
+ `irreversible`, and every guess carries a `REVIEW` marker, because a tool
35
+ schema cannot supply reversibility, the value argument, or the scope a
36
+ ceiling is measured against.
37
+ - A second breach class in `reach`: an irreversible effect reachable with no
38
+ approval is now reported with the call sequence that reaches it, rather than
39
+ only as a name in the authority summary.
40
+ - `mandate diff --record`, a markdown change record for a change advisory
41
+ board, with the authority section derived rather than asserted.
42
+ - A `currency_mismatch` violation in `verify`, so a call spending one currency
43
+ against a ceiling declared in another is reported rather than silently summed.
44
+ - Status badges, an exit-code table, and the pull-request workflow snippet for
45
+ gating on an authority diff against the default branch.
@@ -0,0 +1,51 @@
1
+ # Contributing
2
+
3
+ AgentMandate uses a pull-request-only workflow for `main`.
4
+
5
+ 1. Create a branch from the latest `main`:
6
+
7
+ ```bash
8
+ git switch main
9
+ git pull --ff-only
10
+ git switch -c feature/short-description
11
+ ```
12
+
13
+ 2. Keep the change focused and add tests for behavioural changes.
14
+
15
+ 3. Run the local quality gate:
16
+
17
+ ```bash
18
+ python -m pytest -q
19
+ python -m pytest -q --cov=agentmandate --cov-fail-under=90
20
+ ruff check .
21
+ ```
22
+
23
+ 4. Push the branch and open a pull request:
24
+
25
+ ```bash
26
+ git push -u origin feature/short-description
27
+ ```
28
+
29
+ Direct pushes, force pushes, and deletion of `main` are blocked. Merge only
30
+ after CI passes and all review conversations are resolved.
31
+
32
+ Maintainers should follow [RELEASING.md](RELEASING.md) when publishing a
33
+ version.
34
+
35
+ ## Useful first contributions
36
+
37
+ The authority model is the part that most needs contact with real systems.
38
+ Good first contributions include:
39
+
40
+ - a manifest for a tool graph this models badly, with a note on what it gets
41
+ wrong. A graph the model cannot express is more useful than a new rule
42
+ - an extractor that derives a manifest from an MCP server or a framework's
43
+ tool registry, so manifests stop being hand-authored
44
+ - a lint rule that maps to a named control, with the control cited
45
+ - a counterexample the search should find and does not
46
+
47
+ Open an issue before a large extractor. Describe the source of truth it reads,
48
+ what it can and cannot infer, and what a human still has to annotate.
49
+
50
+ Do not include customer prompts, model outputs, credentials, real account
51
+ identifiers, or trace identifiers in an issue or a fixture.
@@ -0,0 +1,126 @@
1
+ # Design
2
+
3
+ ## The problem this exists for
4
+
5
+ An agent's authority is not written down in one place. It is spread across tool
6
+ schemas, framework configuration, the IAM roles the tools run under, and a
7
+ prompt that asks nicely. Nobody can answer "what can this agent do" by reading
8
+ any single one of those, and nobody can answer "what changed" by reading a pull
9
+ request, because reachability composes and text does not.
10
+
11
+ Existing agent scanners check one tool at a time. That finds the tool with no
12
+ approval gate, which is worth finding. It cannot find the case where every tool
13
+ passes and a sequence of them does not, because that defect does not live in
14
+ any one tool.
15
+
16
+ ## The authority model
17
+
18
+ A mandate is a set of tools over a set of scopes.
19
+
20
+ A **scope** is a type of resource the agent can hold a binding to, such as
21
+ `case` or `ledger`. Scopes are types, not instances: the analysis reasons about
22
+ "a case", never about case 4471.
23
+
24
+ A **tool** may require bindings to act, may produce a binding, may spend value,
25
+ and carries an effect class and a principal.
26
+
27
+ The three fields that make compound analysis possible, and that an ordinary
28
+ tool schema does not carry:
29
+
30
+ | Field | Why it is needed |
31
+ |---|---|
32
+ | `effect` | read, write, or irreversible. Reversibility is what decides where a gate belongs, and it cannot be inferred from a name |
33
+ | `value_arg` | which argument spends money. Without it there is nothing to accumulate |
34
+ | `scope_key` | what a ceiling is measured against. A ceiling with no scope is not a bound |
35
+
36
+ Full preconditions and postconditions would be more expressive. They would also
37
+ not get written, and an unwritten annotation buys nothing. This is the smallest
38
+ set that supports the analysis.
39
+
40
+ ### `unbounded` is the whole game
41
+
42
+ A per-scope ceiling is only a bound when the scope itself is bounded. A tool
43
+ marked `unbounded` can be called repeatedly to mint fresh bindings, so a
44
+ £500-per-case ceiling becomes £500 times as many cases as the agent cares to
45
+ open.
46
+
47
+ That is the defect the package exists to find, and it is invisible tool by
48
+ tool. Both halves look correct in isolation. Only the composition is wrong.
49
+
50
+ ## The search
51
+
52
+ Breadth-first over states, where a state is the bindings held and the value
53
+ already spent per (tool, scope, binding).
54
+
55
+ Breadth-first rather than depth-first for one reason: the shortest
56
+ counterexample is the most useful one. A four-call sequence gets fixed and a
57
+ forty-call sequence gets argued about.
58
+
59
+ States are canonicalised so the walk memoises, and a transition that changes
60
+ nothing is not enqueued. Without that, any manifest with a read-only tool
61
+ produces an infinite frontier.
62
+
63
+ The search is bounded by `limits.depth`. Results are a lower bound: no breach at
64
+ depth 8 is not proof that none exists at depth 20, and the report says so when
65
+ it truncated. Claiming otherwise would require a completeness argument this
66
+ model does not support.
67
+
68
+ ## Why effective authority, not declared policy
69
+
70
+ `diff` compares what two manifests *permit*, computed by running the search over
71
+ both, rather than comparing their text. The two come apart routinely, which is
72
+ the entire argument for the command:
73
+
74
+ - Adding a read-only tool changes no permission and can make a money ceiling
75
+ unenforceable. This is the shipped example.
76
+ - Renaming a tool changes every line of the config diff and no authority.
77
+ - Relaxing one enum in a schema is one character and can open a scope.
78
+
79
+ Effective authority is summarised as reachable tools, effect-on-scope pairs,
80
+ ungated irreversible effects, service-principal tools, maximum extractable
81
+ value, and reachable breach kinds. A gain in any of those is widening.
82
+
83
+ ## Why `verify` ships in the first version
84
+
85
+ A declaration nobody checks is a wish. The implementation drifts from the
86
+ manifest the moment somebody ships a connector change, and every finding this
87
+ tool produces is worthless if the manifest stopped describing the agent six
88
+ weeks ago.
89
+
90
+ `verify` replays recorded calls and reports what the mandate does not permit.
91
+ It is the cheapest available answer to "why should I believe your manifest",
92
+ and without it the rest would be a YAML linter with opinions.
93
+
94
+ ## Deliberate overlap
95
+
96
+ `lint` covers ground that AgentWard, AgentShield, and AgentGuard already cover.
97
+ That is on purpose. A tool that reported only compound findings would need one
98
+ of those running alongside it to be usable at all, and the first thing anyone
99
+ does with a new analysis tool is run it on its own.
100
+
101
+ The overlap is the floor. The contribution is `reach` and the diff built on it.
102
+
103
+ ## What was left out, and why
104
+
105
+ **Data-flow reachability.** Finding that a read tool feeds an exfiltration path
106
+ needs taint labels on arguments and returns. The manifest does not carry them,
107
+ and inventing them would mean asking for annotations nobody would write. Left
108
+ out rather than approximated, because a taint analysis with guessed labels
109
+ produces confident false positives, which is worse than no analysis.
110
+
111
+ **Enforcement.** No proxy, no runtime interception. That is a large maintenance
112
+ surface, it is well covered by others, and mixing analysis with enforcement
113
+ makes both harder to reason about.
114
+
115
+ **Model behaviour.** Whether an agent *would* take a path is a different
116
+ question from whether it *may*. This measures permission. The behavioural
117
+ question needs the agent in the loop and belongs in a testing tool.
118
+
119
+ **Inferring the fields that matter.** `mandate scan` reads an MCP catalogue and
120
+ writes the skeleton, which removes the typing. It cannot remove the thinking,
121
+ because the three fields the model needs are exactly the ones a tool schema
122
+ omits. It guesses conservatively, defaults anything that is not clearly a read
123
+ to `irreversible`, and marks every guess `REVIEW`. Extract then annotate, never
124
+ extract and trust. Inferring reversibility from a description with a model was
125
+ considered and rejected: a confident wrong answer about whether an action can be
126
+ undone is worse than no answer.
@@ -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.