llav-gate 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 (48) hide show
  1. llav_gate-0.1.0/.gitignore +6 -0
  2. llav_gate-0.1.0/CHANGELOG.md +29 -0
  3. llav_gate-0.1.0/EVIDENCE-FORMAT.md +207 -0
  4. llav_gate-0.1.0/LICENSE +201 -0
  5. llav_gate-0.1.0/LICENSE-AUDIT.md +221 -0
  6. llav_gate-0.1.0/NOTICE +54 -0
  7. llav_gate-0.1.0/PKG-INFO +252 -0
  8. llav_gate-0.1.0/README.md +224 -0
  9. llav_gate-0.1.0/RESULTS.md +80 -0
  10. llav_gate-0.1.0/SECURITY.md +38 -0
  11. llav_gate-0.1.0/data/tldr/LICENSE-tldr.md +32 -0
  12. llav_gate-0.1.0/data/tldr/SHA256SUMS +1 -0
  13. llav_gate-0.1.0/data/tldr/tldr-main.tar.gz +0 -0
  14. llav_gate-0.1.0/data/train_vocab_r3.json +692 -0
  15. llav_gate-0.1.0/llav_gate/__init__.py +0 -0
  16. llav_gate-0.1.0/llav_gate/cli.py +294 -0
  17. llav_gate-0.1.0/llav_gate/cli_util.py +26 -0
  18. llav_gate-0.1.0/llav_gate/demo.py +77 -0
  19. llav_gate-0.1.0/llav_gate/doctor.py +201 -0
  20. llav_gate-0.1.0/llav_gate/evidence.py +422 -0
  21. llav_gate-0.1.0/llav_gate/expand.py +930 -0
  22. llav_gate-0.1.0/llav_gate/facts.py +432 -0
  23. llav_gate-0.1.0/llav_gate/gate.py +203 -0
  24. llav_gate-0.1.0/llav_gate/gitfacts.py +312 -0
  25. llav_gate-0.1.0/llav_gate/hardened.py +199 -0
  26. llav_gate-0.1.0/llav_gate/hooks.py +132 -0
  27. llav_gate-0.1.0/llav_gate/inline.py +141 -0
  28. llav_gate-0.1.0/llav_gate/judge.py +255 -0
  29. llav_gate-0.1.0/llav_gate/judge_torch.py +248 -0
  30. llav_gate-0.1.0/llav_gate/makefile.py +527 -0
  31. llav_gate-0.1.0/llav_gate/models.json +88 -0
  32. llav_gate-0.1.0/llav_gate/models.py +97 -0
  33. llav_gate-0.1.0/llav_gate/novelty.py +85 -0
  34. llav_gate-0.1.0/llav_gate/pilot.py +133 -0
  35. llav_gate-0.1.0/llav_gate/render.py +151 -0
  36. llav_gate-0.1.0/llav_gate/repo.py +153 -0
  37. llav_gate-0.1.0/llav_gate/resources.py +72 -0
  38. llav_gate-0.1.0/llav_gate/runners.py +1346 -0
  39. llav_gate-0.1.0/llav_gate/server.py +71 -0
  40. llav_gate-0.1.0/llav_gate/setup_models.py +177 -0
  41. llav_gate-0.1.0/llav_gate/shparse.py +981 -0
  42. llav_gate-0.1.0/pyproject.toml +55 -0
  43. llav_gate-0.1.0/tests/fake_judge.py +11 -0
  44. llav_gate-0.1.0/tests/run_tests.py +12 -0
  45. llav_gate-0.1.0/tests/test_expand.py +114 -0
  46. llav_gate-0.1.0/tests/test_facts.py +47 -0
  47. llav_gate-0.1.0/tests/test_gitfacts.py +41 -0
  48. llav_gate-0.1.0/tests/test_release.py +250 -0
@@ -0,0 +1,6 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .venv/
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ First public release.
6
+
7
+ - **Command expansion:** shell parsing plus static resolution of task runners, aliases, git aliases, inline code and
8
+ decoded payloads. Every effective command keeps its provenance, and code that cannot be seen is marked hidden.
9
+ - **Local evidence:** excerpts from the man pages on your machine and from the bundled tldr pages, plus read-only facts
10
+ about the files a command touches: git status from the index, archive members that would overwrite files, files
11
+ that look like credentials.
12
+ - **llav 4B:** one model, one download, in the folder llavRAG uses (installed in either order, the base is fetched
13
+ once). llav-gate adds two small coding-agent adapters (r3, l4r2) from the same repository, kept in memory on the
14
+ one model and switched per call. There is no model to choose. The
15
+ combination rule and thresholds are frozen and evaluated as one system (RESULTS.md).
16
+ - **Hooks start the judge only where it fits:** on Apple silicon or an NVIDIA GPU with 12 GB or more, with 11 GB of
17
+ memory free; never on the CPU in the background. Otherwise they show one line saying why and let commands through.
18
+ The background judge exits after 15 minutes idle.
19
+ - **Interfaces:**
20
+ - commands: `doctor`, `setup` (sha256-pinned download, or `--from` a local copy), `demo`, `check`, `expand`,
21
+ `serve`, `pilot`;
22
+ - hooks: `install-hook` and `hook` for Claude Code and Codex.
23
+ - **Result:** on a sealed exam (160 command pairs), 19 confident misses vs 29 for a strong baseline approval model
24
+ (149 pairs used for the pass bar). AUROC 0.732 vs 0.682, +0.049 [+0.006, +0.091].
25
+ - **Not improved / known gaps:**
26
+ - no better separation than the baseline on unseen tools;
27
+ - machine-state cases near chance;
28
+ - `.envrc` / direnv not read;
29
+ - asks often.
@@ -0,0 +1,207 @@
1
+ # llav-gate: evidence block formats (shared by the gate and the training rows of its judges)
2
+
3
+ Status: **v2.2** (2026-12-01).
4
+ - v1 introduced the local docs block.
5
+ - v2 added the **Local file facts** block (section 4) and fixed its place in the state.
6
+ - v2.1 shows the home directory as `~`, adds credential-content suffixes on file lines and handles `@file` arguments.
7
+ - v2.2 adds the git repository lines.
8
+
9
+ Any change gets a new version number here before it is used in a training build. The reference implementation is
10
+ `llav_gate/evidence.py` (`Evidence.build`, `fit_block`, `render_tmpl`, `rank_examples`) and `llav_gate/render.py`
11
+ (state assembly).
12
+
13
+ ## 0. Where the blocks go in the state
14
+
15
+ The judge input stays the G-mode state the 4B already knows. The gate appends up to three blocks in this fixed order, each
16
+ separated by one blank line, after everything else in the state:
17
+
18
+ ```
19
+ <base state: working directory / task / previous step / workspace state / proposed command>
20
+
21
+ Files this command runs: <- L1 definitions (only if L1 resolved a runner, script, alias, ...)
22
+ --- <file> (<what>) ---
23
+ <excerpt>
24
+
25
+ Resolved commands (static expansion of the proposed command; nothing was run): <- L1 (only if something was expanded or noted)
26
+ 1. <command> [<provenance>]
27
+ ...
28
+
29
+ Local file facts (read from this machine; the command was not run): <- L2b (v2; only if at least one fact line exists)
30
+ - <path>: <fact>
31
+ ...
32
+
33
+ Local docs (from this machine, reference only): <- L2 (only if at least one tool line exists)
34
+ [tldr <page>] <description>
35
+ - <example description>: `<example command>`
36
+ [man <page>(<section>)] <NAME description>
37
+ - `<option header>`: <first sentence>
38
+ [none <tool>] no local documentation found
39
+ ```
40
+
41
+ The question text is unchanged (for example "Is this action destructive?"). Blocks never contain instructions.
42
+
43
+ ## 1. Local docs block (Layer 2), exact rules
44
+
45
+ Header line, verbatim: `Local docs (from this machine, reference only):`
46
+
47
+ Then one or more tool blocks. A tool block is a first line in square brackets plus 0-3 dash lines.
48
+
49
+ **tldr block**
50
+ - First line: `[tldr <page-name>] <description>`.
51
+ - `<page-name>` is the tldr file stem that was used: `rsync`, `git-push`, `docker-compose-down`, `vagrant-destroy`.
52
+ Lookup order for a command with tool T, subcommand S, sub-subcommand S2: `T-S-S2`, then `T-S`, then `T`.
53
+ Platform order: `common`, then the host platform (`osx` on macOS, `linux` on Linux), then the other platforms.
54
+ Serving-side lookup extensions (v1, 01:10; the block syntax is unchanged and training rows are not affected):
55
+ `python -m M` tries `python-m-M` then `python`; a script run by an interpreter (`php artisan`) tries
56
+ `<interpreter>-<script>` (`php-artisan`) first; a tool name with a script suffix (`kafka-topics.sh`) also tries the
57
+ name without the suffix.
58
+ - `<description>` = the page's `> ` lines joined with single spaces, dropping lines that start with
59
+ `More information` or `See also`. Clip to 220 characters (clip = collapse whitespace; if longer, cut and end with `…`).
60
+ - Example lines (at most 3): `- <example description>: `<command>``
61
+ - `<example description>` = the tldr `- ` line without its trailing `:`, clipped to 160.
62
+ - `<command>` = the tldr template rendered with `render_tmpl`: `{{[-a|--archive]}}` becomes `-a|--archive`,
63
+ any other `{{x}}` becomes `x` (braces removed, content kept). Clipped to 160. Wrapped in single backticks.
64
+ - Selection (`rank_examples`): score each example by the IDF-weighted overlap between the command's tokens and the
65
+ example's tokens (tokens = subcommand words lower-cased, long flags `--x` without `=value`, short flags split one
66
+ letter each `-xkzf` -> `-x -k -z -f`, `key=` for `key=value` arguments). Keep the top 3 with score > 0 in score order
67
+ (page order breaks ties). If no example overlaps, use the first 2 examples of the page in page order.
68
+ - A page with a description but no usable examples gives just the first line.
69
+
70
+ **man block** (installed man pages only; formatted with `MANWIDTH=100 man -P cat <page>`, backspaces stripped)
71
+ - First line: `[man <page>(<section>)] <NAME description>` (the text after the dash in the NAME section, clipped to 160).
72
+ Page lookup: `T-S` then `T`.
73
+ - Option lines (at most 3): `- `<option header>`: <first sentence of the option text>` (header clipped to 60, sentence to 160),
74
+ one for each flag of the command, in command order, that is NOT already covered by a tldr example line shown above.
75
+ - Shown when there is no tldr page, or when it adds at least one option line.
76
+
77
+ **none line**: `[none <tool>] no local documentation found` when neither source has anything for that tool (at most 2 per block).
78
+
79
+ **Which tools**: tools of the effective command set (after L1 expansion), deduplicated by (tool, subcommand). A runner
80
+ invocation that L1 resolved (`make clean`, `npm test`) gets no docs line: its expanded commands do. At most 3 tools, the
81
+ tool rarest in the r3 training vocabulary first (unfamiliar tools are where docs help).
82
+
83
+ **Length**: the whole block including the header is at most 1,200 characters. If longer, drop the last dash line of the
84
+ longest block, repeatedly, then whole blocks from the end.
85
+
86
+ ### Example (serving, fresh-3 dev item; dev exclusion applied)
87
+
88
+ ```
89
+ Local docs (from this machine, reference only):
90
+ [tldr docker-compose-down] Stop and remove containers, networks, images, and volumes created by `docker compose up`.
91
+ - Remove containers for services not defined in the Compose file: `docker compose down --remove-orphans -v|--volumes`
92
+ - Stop and remove all containers and networks: `docker compose down`
93
+ - Stop and remove containers, networks, and all images used by services: `docker compose down --rmi all`
94
+ ```
95
+ ```
96
+ Local docs (from this machine, reference only):
97
+ [tldr tar] Archiving utility. Often combined with a compression method, such as `gzip` or `bzip2`.
98
+ - E[x]tract a (compressed) archive [f]ile into the target directory: `tar xf path/to/source.tar.ext -C|--directory path/to/directory`
99
+ [man tar(1)] manipulate tape archives
100
+ - `-x`: Extract to disk from the archive.
101
+ ```
102
+
103
+ ## 2. Notes for Layer-4 training rows
104
+
105
+ - Use the identical header, bracket tags, dash-line syntax, clipping and the 1,200-character cap. Put the block last in the
106
+ state, after one blank line.
107
+ - Training rows carry tldr blocks only (no man text in training rows, licence). The man block shares the syntax so the
108
+ model reads it the same way at serving time.
109
+ - The example the command was filled from: include it in about half of the docs rows and leave it out in the other half
110
+ (then rank the remaining examples with the rule above), so the model learns to use neighbouring examples, not only an
111
+ exact match. At serving time an exact template match is rare.
112
+ - About 10% of docs rows should be `[none <tool>] no local documentation found` rows (labels from effects as always; keep
113
+ the 1:1 dangerous:harmless balance per tool), so the "no docs" line carries no label bias.
114
+ - Dev evaluation of the gate uses the same template exclusion as `tmpl_exclusion.py`: any tldr example whose template
115
+ pattern matches a C3 / C3-ext / C3-fresh / fresh-3 command is never shown as evidence. The gate's list covers every page
116
+ it can serve (all platforms): `data/tldr_excluded_dev.json` (1,018 examples; your common/linux list of 652 is a
117
+ subset except for linux pages that the Mac index replaces with the osx page of the same name).
118
+ - tldr snapshot: identical file to yours, `data/tldr/tldr-main.tar.gz`, sha256 dc37e500…d37a (CC BY 4.0, attribution in NOTICE).
119
+
120
+ ## 3. L1 blocks (for task-runner / hidden-effect rows)
121
+
122
+ **Files this command runs** (same as the C3 / C3-fresh request format):
123
+ ```
124
+ Files this command runs:
125
+ --- <display path> (<what was used>) ---
126
+ <excerpt>
127
+ ```
128
+ `<what was used>` names the resolved entries: `(scripts)`, `(targets clean, build)`, `(recipes test-reset)`,
129
+ `(task db:fresh)`, `(alias gpm)`, `(session refresh)`. Excerpts are the relevant entries only (package.json -> the
130
+ `scripts` object; Makefile -> used variable assignments + the rules built, recipe lines tab-indented), max 3,500 characters
131
+ per file.
132
+
133
+ **Resolved commands**:
134
+ ```
135
+ Resolved commands (static expansion of the proposed command; nothing was run):
136
+ 1. rm -rf test/__snapshots__ [npm script "pretest", package.json:5]
137
+ 2. node test/run.js [npm script "test", package.json:6]
138
+ Notes:
139
+ - self-clobbering redirect: `> config/allowlist.txt` truncates config/allowlist.txt before the pipeline reads it (...)
140
+ - $BUILD_DIR is not set in this environment, so it expands to an empty string
141
+ ```
142
+ - One line per effective command that came from expansion (depth >= 1), in execution order, max 12 lines, each clipped to
143
+ 200 characters; provenance in square brackets = innermost source (`via, file:line`).
144
+ - `Notes:` lists structural findings (self-clobbering or self-feeding redirects, unset variables, `${X:?}` aborts,
145
+ decoded payloads run by a shell, unresolved parts as `unresolved: <reason>`). Max 6 notes.
146
+ - The block is shown only when something was expanded or noted. Max 1,500 characters.
147
+ - Training rows with a runner (Makefile / package.json / justfile / Taskfile / tox / nox / pre-commit / hooks): include the
148
+ Resolved commands block in about half of the "runner file shown" rows, so the model sees both forms.
149
+
150
+ ## 4. Local file facts block (v2)
151
+
152
+ Reference implementation: `llav_gate/facts.py` (`facts(units, repo)`), computed on the PRE-state, before anything runs.
153
+ It is read-only. Git status is read from `.git/index` (stat + blob sha1); git is never run.
154
+
155
+ Header, verbatim: `Local file facts (read from this machine; the command was not run):`
156
+
157
+ Then at most 10 lines, each starting with `- `. The whole block is at most 1,000 characters.
158
+
159
+ **Paths that get a line:**
160
+ - every path-like argument of the effective commands. That means:
161
+ - not an option, except the value of `--opt=PATH`;
162
+ - for `key=value` arguments, the value is used (`dd of=x`);
163
+ - not a URL, not a `host:path` or `user@host:path` spec, not `-`.
164
+ - every redirect target (`>`, `>>`, `<`, `&>`).
165
+ - A path that does not exist gets a line only if it is a redirect target.
166
+ - Paths are shown relative to the working directory, or as `~/...`. Directories get a trailing `/`. The working directory
167
+ itself is `./` and the home directory `~/`. The absolute home path never appears in any gate block: rendered commands
168
+ in "Resolved commands" also show `~` (v2.1).
169
+ - `@file` arguments (upload-a-file convention) refer to `file` when `@file` itself does not exist (v2.1).
170
+
171
+ **Line forms** (fixed wording; the optional parts in brackets appear only when known):
172
+
173
+ | case | line |
174
+ |---|---|
175
+ | file | `- <path>: existing file, <size>[, committed in git (recoverable)` / `, has uncommitted changes in git` / `, not tracked by git (no copy in git)][; contains a private key` / `; kubeconfig with credentials` / `; contains <N> secret-looking setting(s) (names: A, B, C; values not shown)]` |
176
+ | directory | `- <path>/: existing directory, <N> files[, <T> tracked by git (<M> with uncommitted changes), <U> untracked` / `, not tracked by git (no copy in git)]` |
177
+ | new redirect target | `- <path>: does not exist yet (new file)` |
178
+ | archive (tar/tgz/tbz/txz/zip, by magic bytes) | `- <path>: archive, <N> files; <K> of them already exist(s) here with different content: a, b, c, d[; <J> already exist here unchanged]`, or `...; none of them exist here yet` |
179
+ | SQLite file | `- <path>: SQLite database, <size>` |
180
+ | device / FIFO / socket (v2.1) | `- <path>: device file (not read)` / `named pipe (not read)` / `socket (not read)` |
181
+ | glob argument | `- <glob>: matches <N> entries here (<F> files), e.g. a, b, c, d` |
182
+ | two existing file args | `- <last file> has the same content as <other file>` / `has different content from` |
183
+ | two directory args that share files | `- files in <last dir>/ that are not in <first dir>/: <N> (a, b, c, d)` |
184
+ | git repo (v2.2; when the effective commands contain a git command) | `- git repo <root>/: on branch <b>[, <A> commit(s) ahead of and <B> behind <remote>/<b>][, <S> stash entr(y/ies)][, HEAD reflog has <R> entries]` (detached: `detached at <sha8>`) |
185
+ | git working tree (v2.2) | `- git working tree: <M> tracked file(s) with uncommitted changes (a, b, c[, ...]); <U> untracked file(s) (a, b, c[, ...])` (either part omitted when 0) |
186
+ | git branch (v2.2, local branches, at most 12) | `- git branch <b>: <N> commit(s) that no other branch or remote-tracking ref contains` (only when N > 0) |
187
+
188
+ - Sizes: `<n> B`, `<x.y> KB`, `<x.y> MB`, `<x.y> GB`.
189
+ - Archive members are checked under the command's working directory and under every directory argument of the same
190
+ command. "here" means one of those places.
191
+ - Lists show at most 4 names (git working-tree lists: 3).
192
+ - Git lines come first in the block. They are read from `.git` (refs, packed-refs, loose and packed objects with deltas,
193
+ logs/HEAD, logs/refs/stash, config upstreams). Git is never run, and commit walks stop at 5,000 commits (if a walk is
194
+ incomplete, its line is omitted).
195
+ - No tool-specific knowledge is used: which argument is a source or a target is left to the judge. A twin with
196
+ `--keep-old-files` or `-n` gets the same facts, so the model must read the flags (or the docs block).
197
+
198
+ **For Layer-4 rows:**
199
+ - Render the block on the fixture's pre-state. The simplest way: `llav_gate.facts.facts(units, RepoView.real(cwd))` on the
200
+ sandbox base before the run. Units come from `llav_gate.expand.Expander(repo).expand(cmd, cwd).units`, so the real
201
+ `.git/index` gives the git parts.
202
+ - Include it in about half of the rows. This matters most where files really exist:
203
+ - the placeholder fills that point at tracked, untracked or modified files;
204
+ - archives whose members overlap existing files;
205
+ - two-directory mirrors.
206
+ - Keep it label-blind: same wording for dangerous and harmless twins, and no line that states an outcome.
207
+ - It goes after "Resolved commands" (if present) and before "Local docs" (if present).
@@ -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 reasonable and customary use in describing the
141
+ origin of the Work and 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 [yyyy] [name of copyright owner]
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.