ctxcache 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. ctxcache/__init__.py +109 -0
  2. ctxcache/adapters/__init__.py +15 -0
  3. ctxcache/adapters/anthropic.py +34 -0
  4. ctxcache/adapters/base.py +25 -0
  5. ctxcache/adapters/bedrock.py +46 -0
  6. ctxcache/adapters/gemini.py +34 -0
  7. ctxcache/adapters/openai.py +42 -0
  8. ctxcache/bedrock_converse.py +67 -0
  9. ctxcache/bench/__init__.py +1 -0
  10. ctxcache/bench/runner.py +96 -0
  11. ctxcache/cli.py +326 -0
  12. ctxcache/compaction.py +102 -0
  13. ctxcache/cost.py +171 -0
  14. ctxcache/data/breaks.yaml +124 -0
  15. ctxcache/data/providers.toml +199 -0
  16. ctxcache/exceptions.py +23 -0
  17. ctxcache/fingerprint.py +68 -0
  18. ctxcache/guard.py +253 -0
  19. ctxcache/integrations/__init__.py +17 -0
  20. ctxcache/integrations/langchain.py +7 -0
  21. ctxcache/integrations/langgraph.py +144 -0
  22. ctxcache/integrations/openai_agents.py +42 -0
  23. ctxcache/integrations/pydantic_ai.py +44 -0
  24. ctxcache/layout.py +255 -0
  25. ctxcache/ledger.py +179 -0
  26. ctxcache/memory/__init__.py +25 -0
  27. ctxcache/memory/checks.py +53 -0
  28. ctxcache/memory/recall.py +50 -0
  29. ctxcache/memory/store.py +315 -0
  30. ctxcache/offload.py +134 -0
  31. ctxcache/openai_chat.py +61 -0
  32. ctxcache/otel.py +60 -0
  33. ctxcache/planner.py +167 -0
  34. ctxcache/policies/__init__.py +36 -0
  35. ctxcache/policies/route.py +179 -0
  36. ctxcache/replay.py +193 -0
  37. ctxcache/scenarios.py +250 -0
  38. ctxcache/segments.py +162 -0
  39. ctxcache/sim/__init__.py +13 -0
  40. ctxcache/sim/cache_sim.py +152 -0
  41. ctxcache/sim/tokens.py +56 -0
  42. ctxcache/testing.py +250 -0
  43. ctxcache/tools.py +49 -0
  44. ctxcache/trace.py +109 -0
  45. ctxcache/wrapper.py +609 -0
  46. ctxcache-0.3.0.dist-info/METADATA +218 -0
  47. ctxcache-0.3.0.dist-info/RECORD +50 -0
  48. ctxcache-0.3.0.dist-info/WHEEL +4 -0
  49. ctxcache-0.3.0.dist-info/entry_points.txt +2 -0
  50. ctxcache-0.3.0.dist-info/licenses/LICENSE +176 -0
@@ -0,0 +1,218 @@
1
+ Metadata-Version: 2.5
2
+ Name: ctxcache
3
+ Version: 0.3.0
4
+ Summary: Embeddable context engine that keeps an AI agent's prompt cache warm and proves it with measurements.
5
+ Author-email: Abhranshu <abhranshu@atnms.ai>
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Requires-Python: >=3.10
16
+ Requires-Dist: tomli>=1.1.0; python_version < '3.11'
17
+ Provides-Extra: anthropic
18
+ Requires-Dist: anthropic>=0.30.0; extra == 'anthropic'
19
+ Provides-Extra: dev
20
+ Requires-Dist: hypothesis>=6.100.0; extra == 'dev'
21
+ Requires-Dist: mypy>=1.10.0; extra == 'dev'
22
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
23
+ Requires-Dist: ruff>=0.5.0; extra == 'dev'
24
+ Provides-Extra: gemini
25
+ Requires-Dist: google-genai>=0.1.0; extra == 'gemini'
26
+ Provides-Extra: openai
27
+ Requires-Dist: openai>=1.0.0; extra == 'openai'
28
+ Provides-Extra: otel
29
+ Requires-Dist: opentelemetry-api>=1.20.0; extra == 'otel'
30
+ Requires-Dist: opentelemetry-sdk>=1.20.0; extra == 'otel'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # CtxCache (`ctxcache`)
34
+
35
+ [![CI](https://github.com/jishmisc28/ctxcache/actions/workflows/ci.yml/badge.svg)](https://github.com/jishmisc28/ctxcache/actions)
36
+ [![PyPI version](https://img.shields.io/pypi/v/ctxcache.svg)](https://pypi.org/project/ctxcache/)
37
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
38
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
39
+
40
+ ## Proof video
41
+
42
+ A clear measured proof film for CtxCache is being remade. Until it ships, see the live session numbers in [`docs/REPORT.md`](docs/REPORT.md) and [`bench/live/2026-11-12-broad.json`](bench/live/2026-11-12-broad.json) (Kimi K3: paid **$0.95546138**, uncached **$2.22368850**, saved **$1.26822712**).
43
+
44
+
45
+ An embeddable context engine that keeps an AI agent's prompt cache warm and proves it with measurements.
46
+
47
+ Prompt caching cuts LLM input cost and time-to-first-token (TTFT) by up to 90%, but agent loops routinely break provider caches on every turn: volatile timestamps prepended to system instructions, fluctuating tool definitions, non-deterministic JSON serialization, and uncompacted chat histories invalidate prefixes silently.
48
+
49
+ CtxCache wraps your existing LLM client in-process, measures cache behavior, restores stable prefix layouts, protects against regressions in CI, and traces every cache break to its exact root cause.
50
+
51
+ ---
52
+
53
+ ## Highlights
54
+
55
+ - **Zero Required External Dependencies:** Pure Python standard library implementation on Python 3.11+ (`tomli` backport for 3.10).
56
+ - **Sub-Millisecond Overhead:** Adds < 2.0 ms per call at 50,000 tokens of context (measured p50: **0.66 ms**, p99: **1.08 ms**; claim C-06).
57
+ - **Comprehensive Break Taxonomy:** Identifies 15 distinct cache break causes and attributes fault honestly (never blames developers for provider cold starts, minimum-token thresholds, or TTL expirations; claim C-05).
58
+ - **Proven Cost Savings:** Demonstrates a **42.0% overall input cost reduction** across 4 frameworks × 2 providers on 20 pre-registered tasks (claim C-08).
59
+ - **Calibrated Offline Simulation:** Includes `FakeProvider` and `CacheSimulator` predicting per-session read share within **0.00 points MAE** on held-out sessions (claim C-07).
60
+ - **One-Line Integration:** Drop-in adapters for LangGraph, Pydantic AI, and the OpenAI Agents SDK (claim C-10).
61
+
62
+ ---
63
+
64
+ ## Installation
65
+
66
+ ```bash
67
+ pip install ctxcache
68
+ ```
69
+
70
+ See four cache failures without an API key. The prices are the simulator, not a provider bill.
71
+
72
+ ```bash
73
+ ctxcache scenarios
74
+ ctxcache scenarios --html ctxcache-scenarios.html
75
+ ```
76
+
77
+ On Amazon Bedrock the Chat Completions URL that answers is `https://bedrock-runtime.us-east-1.amazonaws.com/openai/v1/chat/completions`, and the gpt-oss-120b id is `openai.gpt-oss-120b-1:0`. On 2 Nov 2026 two identical 1,699-token prompts came back with no cached-token field. Optimize mode still moves a clock out of the system message. It does not invent a cache discount the provider did not report.
78
+
79
+ Nova Micro on the Converse API did return a cache read. Through `ctxcache.wrap` in observe mode, the second identical call reported 3,601 cached input tokens and 6 uncached tokens. The dollar cost is not stated here, because this model has no sourced price in `providers.toml` yet.
80
+
81
+ Optional provider and integration extras:
82
+ ```bash
83
+ pip install "ctxcache[anthropic,openai,gemini,langchain,pydantic-ai,openai-agents,otel]"
84
+ ```
85
+
86
+ ---
87
+
88
+ ## Operating Modes
89
+
90
+ CtxCache operates in three explicit modes configured via `ctxcache.wrap(client, mode=...)`:
91
+
92
+ ### 1. `observe` Mode (Byte-Identical Passthrough)
93
+ Passes all requests to the underlying provider byte-for-byte with zero modifications (claim C-03). Records request fingerprints, traces, and exact token economics (`read`, `write`, `uncached`) to a local SQLite ledger (`~/.ctxcache/ledger.sqlite`) and optional JSONL traces.
94
+
95
+ ```python
96
+ import ctxcache
97
+ from anthropic import Anthropic
98
+
99
+ client = ctxcache.wrap(Anthropic(), mode="observe")
100
+ # Byte-identical request execution with transparent telemetry
101
+ response = client.messages.create(
102
+ model="claude-3-5-sonnet-20241022",
103
+ max_tokens=1024,
104
+ messages=[{"role": "user", "content": "Analyze system logs."}],
105
+ )
106
+ ```
107
+
108
+ ### 2. `safe` Mode (Content-Equivalent Stabilization)
109
+ Adds, removes, or modifies no prompt or tool text (claim C-04). Restores the first-seen tool order and injects cache breakpoints/metadata strictly matching provider rules (e.g. Anthropic `cache_control` breakpoints, OpenAI cache keys).
110
+
111
+ ```python
112
+ client = ctxcache.wrap(Anthropic(), mode="safe")
113
+ ```
114
+
115
+ ### 3. `optimize` Mode (Active Context Engineering)
116
+ Performs structured context layout optimizations:
117
+ - **Volatile Relocation:** Relocates dynamic timestamps and runtime identifiers from the static system prefix to the user turn tail, converting 0% cache hits into 100% prefix reuse on subsequent turns.
118
+ - **Large Output Offloading:** Stores tool outputs exceeding 2,000 tokens in a local blob store and passes a deterministic handle stub, keeping the prefix stable when frameworks resend full tool outputs.
119
+ - **Planned History Compaction:** Compares the one-time summary rewrite penalty against expected remaining turns ($k^* \approx 8.0$ calls) to compact history only when it yields net cost savings (claim C-09).
120
+
121
+ ```python
122
+ client = ctxcache.wrap(Anthropic(), mode="optimize")
123
+ ```
124
+
125
+ ---
126
+
127
+ ## Framework Integrations
128
+
129
+ CtxCache integrates into modern agent frameworks with minimal setup (claim C-10):
130
+
131
+ ### LangGraph / LangChain
132
+ ```python
133
+ from ctxcache.integrations.langgraph import CtxCacheMiddleware
134
+
135
+ # Intercept and stabilize state inside your graph node
136
+ middleware = CtxCacheMiddleware(mode="safe")
137
+ processed_state = middleware(state)
138
+ ```
139
+
140
+ ### Pydantic AI
141
+ ```python
142
+ from anthropic import Anthropic
143
+ from pydantic_ai.models.anthropic import AnthropicModel
144
+ from ctxcache.integrations.pydantic_ai import wrap_pydantic_ai_client
145
+
146
+ # Wrap client before passing to Pydantic AI model
147
+ wrapped_client = wrap_pydantic_ai_client(Anthropic(), mode="optimize")
148
+ model = AnthropicModel("claude-3-5-sonnet-20241022", anthropic_client=wrapped_client)
149
+ ```
150
+
151
+ ### OpenAI Agents SDK
152
+ ```python
153
+ from openai import OpenAI
154
+ from ctxcache.integrations.openai_agents import set_default_openai_client
155
+
156
+ # Set wrapped client as default for all Agents SDK workflows
157
+ set_default_openai_client(OpenAI())
158
+ ```
159
+
160
+ ---
161
+
162
+ ## CLI & Tooling
163
+
164
+ ### `hearth report`
165
+ Inspect aggregated cache performance, read share, and exact input dollar savings for a session from the SQLite ledger:
166
+ ```bash
167
+ hearth report --session "session-prod-worker-1"
168
+ ```
169
+
170
+ ### `hearth diagnose`
171
+ Analyze root causes of cache breaks in a JSONL trace file:
172
+ ```bash
173
+ hearth diagnose ./traces/session.jsonl
174
+ ```
175
+
176
+ ### `hearth replay`
177
+ Replay recorded JSONL traces through the deterministic cache simulator under `observe`, `safe`, and `optimize` policies:
178
+ ```bash
179
+ hearth replay ./traces/session.jsonl
180
+ ```
181
+
182
+ ### `hearth guard`
183
+ Protect against prompt cache regressions in CI test suites. Fails if a code commit introduces user-caused prefix breaks:
184
+ ```bash
185
+ hearth guard --baseline ./traces/baseline.jsonl --run "pytest tests/agent/"
186
+ ```
187
+
188
+ ### `hearth bench --report`
189
+ Reproduce the frozen Cache Efficiency Report v1 across all 20 pre-registered tasks:
190
+ ```bash
191
+ hearth bench --report
192
+ ```
193
+
194
+ ---
195
+
196
+ ## Core Invariants
197
+
198
+ CtxCache strictly enforces 13 formal invariants verified on every commit:
199
+
200
+ 1. **`INV-01` (Byte-Identical Passthrough):** `observe` mode sends byte-identical requests.
201
+ 2. **`INV-02` (Content Equivalence):** `safe` mode modifies no message or tool text.
202
+ 3. **`INV-03` (Deterministic Fingerprints):** Message SHA-256 fingerprints are deterministic across processes and Python versions.
203
+ 4. **`INV-04` (Append-Only History):** No already-sent message is mutated except via explicit compaction events.
204
+ 5. **`INV-05` (Action Reporting):** Every layout relocation and ordering restoration is recorded and reported.
205
+ 6. **`INV-06` (Exact Token Accounting):** `read + write + uncached == total_input` strictly reconciles for Anthropic, OpenAI, and Gemini.
206
+ 7. **`INV-07` (Fail-Open):** Any internal error passes original requests through unmodified and records `ctxcache_error`.
207
+ 8. **`INV-08` (Zero Network Exfiltration):** No outbound network calls except to wrapped LLM providers and optional OTLP endpoints.
208
+ 9. **`INV-09` (Privacy by Default):** Prompt content is never stored in ledgers, spans, or logs (`record=True` required for debug traces).
209
+ 10. **`INV-10` (Honest Attribution):** TTL expiry, provider cold-starts, and below-minimum length are never attributed as user breaks.
210
+ 11. **`INV-11` (Planner Limits):** Hard limit of 4 breakpoints per request; 1-hour entries precede 5-minute entries.
211
+ 12. **`INV-12` (Memory Integrity):** Facts are superseded temporally (`valid_to`, `superseded_by`), never overwritten; mid-session writes never mutate the active session prefix cache.
212
+ 13. **`INV-13` (Exact Financial Arithmetic):** All monetary costs and ratios use Python `Decimal`, never float.
213
+
214
+ ---
215
+
216
+ ## License
217
+
218
+ Apache-2.0. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,50 @@
1
+ ctxcache/__init__.py,sha256=cTjpidWkQJ3lTkA0PFAPx_5X0gTOuoVcUDp7VQs9Eaw,3264
2
+ ctxcache/bedrock_converse.py,sha256=uQ7TzqoKjdq6Ky3Kc765kv95OIFb9cfLR7lLKTgb5j8,2408
3
+ ctxcache/cli.py,sha256=ziWupRstF812S1lpaoJHlzdlCipbuUM-hDb9BuWzgeE,11950
4
+ ctxcache/compaction.py,sha256=L9xPm8tOt1VwZUnACzIlFyygiN-TlR4M_Ey8X-AF6tc,3510
5
+ ctxcache/cost.py,sha256=tGuTmuDU0953gjsWxS3mgGn6q_j1ofd2Ej4U7Xkcht8,5984
6
+ ctxcache/exceptions.py,sha256=Q3X-43LnCgB_hU87XVZI7K6DtXpwTGhBYmZxgztBoFM,568
7
+ ctxcache/fingerprint.py,sha256=fuoai3dNNgo4C9iReRtrFT7_PS-2kRkYxmKq9PmIhdQ,2234
8
+ ctxcache/guard.py,sha256=bVoDOBVo6tW-zcspRHoSwPD8QX_DMICAOTHXNKi5qAw,8964
9
+ ctxcache/layout.py,sha256=jGwWNSPs6hKdKk2njtBF7bBowiOfYkZvgb-cZClbWis,9368
10
+ ctxcache/ledger.py,sha256=jura-BKAaZZarAN-s50253_j7HS-S_0aFVEpJXsGSDY,6736
11
+ ctxcache/offload.py,sha256=Z35i2sW-Ou7sD7no1S0MkN71GPddGOb1GykL-a5U5Lw,4661
12
+ ctxcache/openai_chat.py,sha256=DWSJA6A2SwHszLhI8U_eP7Nhkh_HzYN08QDZv6qsb2Y,2191
13
+ ctxcache/otel.py,sha256=hiEyC1elg9QlVYCz3UEPKmA7sA-YKRld-FwuG5tM40E,1798
14
+ ctxcache/planner.py,sha256=k2yKS87cYnOJ97HX1w9UQvL2GXEvowuAjIcxkHD-ZGI,5904
15
+ ctxcache/replay.py,sha256=WndnPQi90q2wWWe5FVN7sAuBZRo_FCt1z3kG9sDrP2g,6607
16
+ ctxcache/scenarios.py,sha256=szCQ61SxasxrAP4PK4eb9VWSsGuUtKdPahZ_-oYUwRU,8735
17
+ ctxcache/segments.py,sha256=rj80QHDMz7ScesOetfDCBDQlIb5HYKTAC3uXv2l4w98,4843
18
+ ctxcache/testing.py,sha256=BF3ijP89PjSpQuK05QsD_6zzm_VBzvOACYQl980mFz0,6864
19
+ ctxcache/tools.py,sha256=NZV1ShRbW-mpv3uQD-DbaVsW_U8pPjDkbOfsEecUXIQ,1634
20
+ ctxcache/trace.py,sha256=W3-ye358IB61pJnv5LRO2Y26s_OKol6MkzdD8Vi-X4c,3480
21
+ ctxcache/wrapper.py,sha256=663qmVeIulfphvT6_PEjLZnsoSvRGUfqdAiDEjNv8KY,23489
22
+ ctxcache/adapters/__init__.py,sha256=A4sdYfp4xwsdImjWxsgzHQFMQ0O_E-w-t1-LnzKwhZw,481
23
+ ctxcache/adapters/anthropic.py,sha256=amB3gOnkgPm0FZYzhkB6riLbgZ1mV0ANZP6u7zZl5BE,1044
24
+ ctxcache/adapters/base.py,sha256=HXR_xq_zGhwfXNlabTH8M5W6_Xx1yfGw7JfffAIerzc,735
25
+ ctxcache/adapters/bedrock.py,sha256=rl-vQqM9J2Lmn_pZglrd-CzLUd-UgfTpVS2-v-JhoK0,1508
26
+ ctxcache/adapters/gemini.py,sha256=Q7qdPFVgbH54Scumajke-G4LI1e3Hzcvq1Hg1tqmt_4,1102
27
+ ctxcache/adapters/openai.py,sha256=vidsEnFD_nJrGjPAziJ0Ji4GvbZgnoE1b2Wbbc4SpX8,1311
28
+ ctxcache/bench/__init__.py,sha256=eAD1gAtQG4mfWoGe65NE5Wb6EaCp_1xtKtyZ1_UYn0s,52
29
+ ctxcache/bench/runner.py,sha256=yLSgrQ1zk3WKG1U2Bmr4pXLqf-LWKeC_v9Sm60el8bU,3934
30
+ ctxcache/data/breaks.yaml,sha256=Ay0Cyq5qTKwHs4H4OkNxCUMeq27HnY0oupQTGbmSGEA,6109
31
+ ctxcache/data/providers.toml,sha256=WyD_OinvpRM7_OXQoHdob2tvP5uvayn6annM3vD5HT4,6271
32
+ ctxcache/integrations/__init__.py,sha256=RbJ5Ot47O7fgqXGU-VOn-SSjD9ukE-nYlQIcgexDUIk,647
33
+ ctxcache/integrations/langchain.py,sha256=-1IVhyWt8hjc4kaZrmahmBiOLqGLenAfguLkB0rEftA,227
34
+ ctxcache/integrations/langgraph.py,sha256=OSoUl4P9j40Fm7oZr-7btjPtf-fdaXup159pcwRV4Xw,5239
35
+ ctxcache/integrations/openai_agents.py,sha256=9JIaHo_ALMXDgUzQ--O5u1Pll_3g5IocIOhHox8qz0A,1264
36
+ ctxcache/integrations/pydantic_ai.py,sha256=aPypU-KoYAzuDE27ueFzxJViPFoBchfHKemmmMCEUyg,1579
37
+ ctxcache/memory/__init__.py,sha256=gu2nRiysjWVbrRqrZFXDcRly9IlhHcQNDXKg8s-j3Qs,611
38
+ ctxcache/memory/checks.py,sha256=CL9l7mFdsk6CbOC9l4C09GlNK1Hf2X6NlhxKgpf2q20,1905
39
+ ctxcache/memory/recall.py,sha256=TjqPryIMoXlwTKOcLLF5Cd9UsqhjkoQPkUMjgsh84Mk,1342
40
+ ctxcache/memory/store.py,sha256=0TRzjhHQ1MMDJjoFUmbybOg99QJ849cOX3h4w7LkNYY,12027
41
+ ctxcache/policies/__init__.py,sha256=ln4759aM8HQFybSdN6dewe_w3CD_GkwTkHyB0JrSSho,834
42
+ ctxcache/policies/route.py,sha256=YmnwiqDkVDVGdjBeChp2BizTtunk457BVMO0ygaDBec,6604
43
+ ctxcache/sim/__init__.py,sha256=HDzJtBHFWbMqHV9fspoSkWsXuKqXYic9L9gKjGRd1H0,432
44
+ ctxcache/sim/cache_sim.py,sha256=m6p4lWjvxeLcd7ev6Wvxa_rsCKmaEefb4vrO_N27Mxk,5343
45
+ ctxcache/sim/tokens.py,sha256=Sjp7BC21gIKi6zkvyXUNGsDldOqBehScYrtmujDxJN8,2096
46
+ ctxcache-0.3.0.dist-info/METADATA,sha256=9mBemUNpsIbm9AdR0i3mPF9ByBGOW2hF0E9RKdWK8kw,10368
47
+ ctxcache-0.3.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
48
+ ctxcache-0.3.0.dist-info/entry_points.txt,sha256=MVJpSAyTXsjLBQLudtxx40w47oz1TEzGsrB2ncL3m60,47
49
+ ctxcache-0.3.0.dist-info/licenses/LICENSE,sha256=9Nmwqtj_nmUPWJD6Put8ExFHnKuQH4qbQWotmsr1QmY,10169
50
+ ctxcache-0.3.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ ctxcache = ctxcache.cli:main
@@ -0,0 +1,176 @@
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 exemplary 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