streamdouble 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 (68) hide show
  1. streamdouble-0.1.0/.gitattributes +9 -0
  2. streamdouble-0.1.0/.github/ISSUE_TEMPLATE/bug.yml +39 -0
  3. streamdouble-0.1.0/.github/ISSUE_TEMPLATE/config.yml +8 -0
  4. streamdouble-0.1.0/.github/ISSUE_TEMPLATE/protocol-difference.yml +47 -0
  5. streamdouble-0.1.0/.github/workflows/ci.yml +52 -0
  6. streamdouble-0.1.0/.github/workflows/release.yml +68 -0
  7. streamdouble-0.1.0/.gitignore +16 -0
  8. streamdouble-0.1.0/CLAUDE.md +97 -0
  9. streamdouble-0.1.0/CONTRIBUTING.md +104 -0
  10. streamdouble-0.1.0/LICENSE +202 -0
  11. streamdouble-0.1.0/PKG-INFO +354 -0
  12. streamdouble-0.1.0/PLAN.md +761 -0
  13. streamdouble-0.1.0/README.md +319 -0
  14. streamdouble-0.1.0/docs/demo.svg +39 -0
  15. streamdouble-0.1.0/docs/launch-drafts.md +154 -0
  16. streamdouble-0.1.0/docs/mulaw-gotchas.md +153 -0
  17. streamdouble-0.1.0/examples/echo_agent.py +281 -0
  18. streamdouble-0.1.0/fixtures/alias_bait_44k.wav +0 -0
  19. streamdouble-0.1.0/fixtures/long_8k.wav +0 -0
  20. streamdouble-0.1.0/fixtures/make_fixtures.py +243 -0
  21. streamdouble-0.1.0/fixtures/make_speech.py +164 -0
  22. streamdouble-0.1.0/fixtures/noisy_8k.wav +0 -0
  23. streamdouble-0.1.0/fixtures/partial_frame_8k.wav +0 -0
  24. streamdouble-0.1.0/fixtures/silence_8k.wav +0 -0
  25. streamdouble-0.1.0/fixtures/speech_16k.wav +0 -0
  26. streamdouble-0.1.0/fixtures/speech_44k_stereo.wav +0 -0
  27. streamdouble-0.1.0/fixtures/speech_8k.wav +0 -0
  28. streamdouble-0.1.0/fixtures/speech_8k_24bit.wav +0 -0
  29. streamdouble-0.1.0/fixtures/speech_8k_32bit.wav +0 -0
  30. streamdouble-0.1.0/fixtures/speech_8k_8bit.wav +0 -0
  31. streamdouble-0.1.0/fixtures/tone_440_8k.wav +0 -0
  32. streamdouble-0.1.0/pyproject.toml +82 -0
  33. streamdouble-0.1.0/scenarios/barge_in.yaml +31 -0
  34. streamdouble-0.1.0/scenarios/hangup.yaml +15 -0
  35. streamdouble-0.1.0/scenarios/no_input.yaml +15 -0
  36. streamdouble-0.1.0/skill/SKILL.md +173 -0
  37. streamdouble-0.1.0/src/streamdouble/__init__.py +14 -0
  38. streamdouble-0.1.0/src/streamdouble/audio.py +232 -0
  39. streamdouble-0.1.0/src/streamdouble/chaos.py +162 -0
  40. streamdouble-0.1.0/src/streamdouble/cli.py +485 -0
  41. streamdouble-0.1.0/src/streamdouble/g711.py +138 -0
  42. streamdouble-0.1.0/src/streamdouble/metrics.py +363 -0
  43. streamdouble-0.1.0/src/streamdouble/pacer.py +220 -0
  44. streamdouble-0.1.0/src/streamdouble/protocol.py +551 -0
  45. streamdouble-0.1.0/src/streamdouble/scenario.py +387 -0
  46. streamdouble-0.1.0/src/streamdouble/session.py +808 -0
  47. streamdouble-0.1.0/tests/conftest.py +86 -0
  48. streamdouble-0.1.0/tests/golden/frames.json +58 -0
  49. streamdouble-0.1.0/tests/test_audio.py +367 -0
  50. streamdouble-0.1.0/tests/test_chaos.py +178 -0
  51. streamdouble-0.1.0/tests/test_cli.py +524 -0
  52. streamdouble-0.1.0/tests/test_documented_commands.py +131 -0
  53. streamdouble-0.1.0/tests/test_g711.py +222 -0
  54. streamdouble-0.1.0/tests/test_golden.py +177 -0
  55. streamdouble-0.1.0/tests/test_integration_echo.py +149 -0
  56. streamdouble-0.1.0/tests/test_measurement_validity.py +221 -0
  57. streamdouble-0.1.0/tests/test_metrics.py +488 -0
  58. streamdouble-0.1.0/tests/test_pacer.py +326 -0
  59. streamdouble-0.1.0/tests/test_protocol.py +511 -0
  60. streamdouble-0.1.0/tests/test_review_gate_1.py +258 -0
  61. streamdouble-0.1.0/tests/test_review_gate_2.py +232 -0
  62. streamdouble-0.1.0/tests/test_review_gate_3.py +212 -0
  63. streamdouble-0.1.0/tests/test_review_gate_4.py +279 -0
  64. streamdouble-0.1.0/tests/test_scenario.py +284 -0
  65. streamdouble-0.1.0/tests/test_scenario_execution.py +318 -0
  66. streamdouble-0.1.0/tests/test_session.py +357 -0
  67. streamdouble-0.1.0/tests/test_signal_integrity.py +220 -0
  68. streamdouble-0.1.0/tools/make_demo.py +234 -0
@@ -0,0 +1,9 @@
1
+ # Normalise text to LF in the repository. CI runs the same test suite on
2
+ # Windows and Linux, and the golden-file test pins exact bytes, so line-ending
3
+ # drift between platforms would show up as a spurious failure.
4
+ * text=auto eol=lf
5
+
6
+ # Audio fixtures are binary and must never be touched. A single CRLF
7
+ # substitution inside a WAV corrupts the audio silently -- it still loads, it
8
+ # just sounds wrong, which is the hardest possible way to find this bug.
9
+ *.wav binary
@@ -0,0 +1,39 @@
1
+ name: Bug report
2
+ description: Something in streamdouble itself is wrong
3
+ labels: ["bug"]
4
+ body:
5
+ - type: textarea
6
+ id: what-happened
7
+ attributes:
8
+ label: What happened
9
+ validations:
10
+ required: true
11
+
12
+ - type: textarea
13
+ id: reproduce
14
+ attributes:
15
+ label: How to reproduce
16
+ description: >
17
+ The exact command, please. If it involves network impairment, include
18
+ `--chaos-seed` — impairments are seeded precisely so a failing run can be
19
+ replayed, and without the seed we are guessing.
20
+ render: shell
21
+ validations:
22
+ required: true
23
+
24
+ - type: textarea
25
+ id: output
26
+ attributes:
27
+ label: Output
28
+ description: >
29
+ `--json` output is ideal. It carries the pacing statistics, which say
30
+ whether the timing figures can be trusted at all.
31
+ render: shell
32
+
33
+ - type: input
34
+ id: environment
35
+ attributes:
36
+ label: OS and Python version
37
+ placeholder: "Windows 11, Python 3.12"
38
+ validations:
39
+ required: true
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Is my agent any good?
4
+ url: https://github.com/shaswat28/streamdouble#how-this-compares
5
+ about: >
6
+ streamdouble tests the transport seam, not what your agent says. For
7
+ conversation quality, personas or transcript scoring, the comparison table
8
+ points at tools that do that well.
@@ -0,0 +1,47 @@
1
+ name: Protocol difference
2
+ description: streamdouble behaves differently from real Twilio
3
+ labels: ["protocol"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ This is the most valuable report this project can receive.
9
+
10
+ streamdouble claims an agent cannot tell it from Twilio, and that claim
11
+ is only as good as our reading of a specification that does not cover
12
+ everything. Several behaviours are inferences, marked as such in the
13
+ code. If you have watched a real call do something we do not, we want to
14
+ know.
15
+
16
+ - type: textarea
17
+ id: real-behaviour
18
+ attributes:
19
+ label: What real Twilio does
20
+ description: >
21
+ A frame capture, a log line, a screenshot of Twilio's debugger —
22
+ anything showing the real behaviour beats a description, because what
23
+ the real thing does is the entire question. If you cannot share a
24
+ capture, describe what you saw and how you saw it; that is still useful.
25
+ validations:
26
+ required: true
27
+
28
+ - type: textarea
29
+ id: streamdouble-behaviour
30
+ attributes:
31
+ label: What streamdouble does instead
32
+ validations:
33
+ required: true
34
+
35
+ - type: textarea
36
+ id: impact
37
+ attributes:
38
+ label: What breaks because of the difference
39
+ description: >
40
+ For example "our agent hangs waiting for a mark" or "our VAD never
41
+ fires". This tells us whether the difference is cosmetic or load-bearing.
42
+
43
+ - type: input
44
+ id: version
45
+ attributes:
46
+ label: streamdouble version
47
+ placeholder: "0.1.0"
@@ -0,0 +1,52 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ test:
15
+ name: py${{ matrix.python }} on ${{ matrix.os }}
16
+ runs-on: ${{ matrix.os }}
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ # Windows and Linux both run the full matrix because the golden-file
21
+ # test pins exact bytes, and that claim is only worth anything if it
22
+ # holds across platforms. 3.13 matters specifically: audioop was
23
+ # removed there, so it is the run that proves the codec stands on its
24
+ # own rather than leaning on the stdlib reference.
25
+ os: [ubuntu-latest, windows-latest]
26
+ python: ["3.11", "3.12", "3.13"]
27
+
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+
31
+ - uses: actions/setup-python@v5
32
+ with:
33
+ python-version: ${{ matrix.python }}
34
+ cache: pip
35
+
36
+ - name: Install
37
+ run: python -m pip install --upgrade pip && python -m pip install -e ".[dev]"
38
+
39
+ - name: Lint
40
+ run: python -m ruff check .
41
+
42
+ - name: Test
43
+ run: python -m pytest -q
44
+
45
+ - name: Fixtures regenerate identically
46
+ # The golden file is only meaningful if the fixtures it pins are
47
+ # reproducible. Regenerating and diffing proves the generator is
48
+ # deterministic across platforms and numpy versions, rather than
49
+ # merely deterministic on the machine that first ran it.
50
+ run: |
51
+ python fixtures/make_fixtures.py
52
+ git diff --exit-code -- fixtures/
@@ -0,0 +1,68 @@
1
+ name: Release
2
+
3
+ # Deliberately manual. There is no push or tag trigger, so nothing publishes by
4
+ # accident while the project is still private: a release happens because someone
5
+ # went to the Actions tab and asked for one.
6
+ #
7
+ # `publish: false` is the default, so the ordinary run builds the artifacts,
8
+ # validates them, and installs the wheel into a clean environment without
9
+ # uploading anything. That is worth doing on its own -- it is the check that
10
+ # caught PyYAML being used but never declared, which passed every local test and
11
+ # failed on a machine that did not already have it.
12
+ on:
13
+ workflow_dispatch:
14
+ inputs:
15
+ publish:
16
+ description: "Actually upload to PyPI (leave false to build and verify only)"
17
+ type: boolean
18
+ default: false
19
+
20
+ jobs:
21
+ build:
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+
26
+ - uses: actions/setup-python@v5
27
+ with:
28
+ python-version: "3.12"
29
+
30
+ - name: Build
31
+ run: |
32
+ python -m pip install --upgrade pip build twine
33
+ python -m build
34
+
35
+ - name: Validate metadata
36
+ run: python -m twine check dist/*
37
+
38
+ - name: Install the wheel into a clean environment
39
+ # The point is what is *not* here: no dev extras, no editable install,
40
+ # nothing the repository checkout would otherwise provide. If a runtime
41
+ # dependency is undeclared, this is where it shows.
42
+ run: |
43
+ python -m venv /tmp/clean
44
+ /tmp/clean/bin/python -m pip install dist/*.whl
45
+ /tmp/clean/bin/streamdouble --version
46
+ /tmp/clean/bin/python -c "
47
+ from streamdouble import audio, chaos, metrics, protocol, scenario
48
+ print('imports ok')
49
+ print(len(audio.wav_to_ulaw_frames('fixtures/speech_8k.wav')), 'frames')
50
+ "
51
+
52
+ - uses: actions/upload-artifact@v4
53
+ with:
54
+ name: dist
55
+ path: dist/
56
+
57
+ - name: Publish to PyPI
58
+ if: ${{ inputs.publish }}
59
+ env:
60
+ TWINE_USERNAME: __token__
61
+ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
62
+ run: |
63
+ if [ -z "$TWINE_PASSWORD" ]; then
64
+ echo "PYPI_API_TOKEN is not set in this repository's secrets." >&2
65
+ echo "Add it under Settings > Secrets and variables > Actions." >&2
66
+ exit 1
67
+ fi
68
+ python -m twine upload dist/*
@@ -0,0 +1,16 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ venv/
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .coverage
11
+ htmlcov/
12
+ *.wav
13
+ !fixtures/*.wav
14
+ !tests/data/*.wav
15
+ .DS_Store
16
+ fixtures/speech/
@@ -0,0 +1,97 @@
1
+ # CLAUDE.md
2
+
3
+ Guidance for Claude Code when working in this repository.
4
+
5
+ ## The directory name is wrong
6
+
7
+ This folder is called `dialtone`, but the project is **`streamdouble`**. The
8
+ package was renamed on 2026-09-10 — `dialtone` turned out to be an active
9
+ package on PyPI. The folder kept its old name; nothing else did.
10
+
11
+ ## Read PLAN.md first
12
+
13
+ `PLAN.md` is the authority on what this project is, how it is built, and where
14
+ it currently stands. Its **Progress** section is written as a handover: what
15
+ exists, what each review gate found, what is owed, and what to do next. Start
16
+ there rather than inferring state from the code.
17
+
18
+ ## How work proceeds here
19
+
20
+ The project is built in phases, with a **mandatory review gate between each
21
+ one** (`/code-review high`, plus `/security-review` at gate 4). Gates are not
22
+ optional and are not to be skipped or deferred — every gate so far has found
23
+ real bugs, including two that were introduced by the previous gate's own fixes.
24
+
25
+ When a gate finds something, fix it *and* write a regression test that fails
26
+ against the old behaviour. `tests/test_review_gate_1.py` and
27
+ `tests/test_review_gate_2.py` follow that pattern.
28
+
29
+ ## What this project is unusually strict about
30
+
31
+ These are not stylistic preferences; each one exists because of a specific bug
32
+ that reached the repo.
33
+
34
+ - **Verify protocol details against the live Twilio docs, never from memory.**
35
+ The original plan's protocol table was wrong in three ways. Cite the source in
36
+ a docstring.
37
+ - **`None` is not zero.** An agent that never spoke has
38
+ `time_to_first_audio = None`. Rendering that as "0 ms" turns the worst outcome
39
+ into the best one on screen.
40
+ - **Measurement honesty over clean-looking numbers.** Pacing lateness is
41
+ reported alongside the latency it could have distorted. A latency tool that
42
+ reports wrong latency is worse than no tool, because people trust it.
43
+ - **Warnings are errors** (`filterwarnings = ["error"]`). Several real bugs
44
+ surfaced first as warnings. The few ignores are third-party and each is
45
+ annotated with why.
46
+ - **The golden file pins exact bytes.** Regenerate it (`UPDATE_GOLDEN=1`) only
47
+ deliberately, with a reason in the commit message. Nothing feeding it may
48
+ depend on `np.random` — NumPy does not guarantee `Generator` streams across
49
+ builds, machines or CPUs.
50
+ - **`protocol.py` and `audio.py` stay pure.** No network, no clock. If a bug
51
+ there needs a WebSocket to reproduce, the layering is wrong.
52
+ - **Time is `time.perf_counter`.** It must be monotonic — an NTP step mid-call
53
+ would otherwise produce a negative latency reported with a straight face —
54
+ *and* high resolution. `time.monotonic` looks right and is not: on Windows it
55
+ is `GetTickCount64` at 15.625 ms, coarser than the 20 ms frame being measured.
56
+ Gate 3 found it quantising every latency and turning the pacer's lateness
57
+ statistics into a readout of the clock.
58
+
59
+ ## Commands
60
+
61
+ ```bash
62
+ pip install -e ".[dev]"
63
+ pytest # the session tests use a real socket
64
+ ruff check .
65
+ python fixtures/make_fixtures.py # only if a fixture definition changed
66
+ ```
67
+
68
+ Run the example agent and call it:
69
+
70
+ ```bash
71
+ python examples/echo_agent.py --port 8000
72
+ streamdouble call ws://localhost:8000/media-stream --audio fixtures/speech_8k.wav --out reply.wav
73
+ ```
74
+
75
+ The echo agent takes query parameters to misbehave on purpose: `mode=silent`,
76
+ `delay_ms=`, `hangup_after=`, `garbage_after=`, `clear_after=`.
77
+
78
+ ## Testing against a real agent
79
+
80
+ The example agent is enough for most work, but it is *our* code, written from
81
+ the same reading of the Twilio docs as `protocol.py` -- a shared misreading
82
+ would leave every test green. Validating against an implementation we did not
83
+ write is what catches that, and it has already found things the example agent
84
+ structurally could not.
85
+
86
+ Point streamdouble at the agent's own `/media-stream`. Agents commonly
87
+ authenticate on `start.customParameters` rather than the URL, so
88
+ `--param key=...` is usually what is needed.
89
+
90
+ **Disable whatever the agent touches on hangup first** -- CRM pushes, webhooks,
91
+ billing, notifications. A simulated call is a real call to everything downstream
92
+ of the socket. The first time this was done for real, a completed test call
93
+ wrote records to a live CRM for a made-up phone number.
94
+
95
+ Two things a real agent taught us that the example agent could not, both in
96
+ PLAN.md: agents batch outbound audio into frames of roughly 8000 bytes rather
97
+ than 160, and mark echo is load-bearing for hangup.
@@ -0,0 +1,104 @@
1
+ # Contributing
2
+
3
+ The most valuable contribution to this project is **telling us where the
4
+ simulation is wrong.**
5
+
6
+ `streamdouble` claims that an agent cannot tell it from Twilio. That claim is
7
+ only as good as our reading of the protocol, and the Twilio documentation does
8
+ not cover everything — several behaviours here are inferences, marked as such in
9
+ the code. If you have watched a real Twilio call do something this tool does
10
+ not, that is the bug report we most want.
11
+
12
+ ## Reporting a protocol difference
13
+
14
+ Include what Twilio actually did. A frame capture, a log line, a screenshot of
15
+ Twilio's debugger — anything that shows real behaviour beats a description of
16
+ it, because the whole question is what the real thing does.
17
+
18
+ If you cannot share a capture, say what you observed and how you observed it.
19
+ "Our agent works on real calls but hangs against streamdouble" is a useful
20
+ report even without a capture; it tells us where to look.
21
+
22
+ Known inferences, each documented at the code that makes them:
23
+
24
+ - **Packet loss** is modelled as audio Twilio never received, so a lost frame is
25
+ never sent and `media.timestamp` jumps. Twilio might instead substitute
26
+ silence. See `chaos.py`.
27
+ - **Mark echo timing** is derived from a playback clock we maintain. Twilio's
28
+ real timing may differ under load. See `session.py`.
29
+ - **Frame size**: we always send 160 bytes. Twilio does too, as far as we know,
30
+ but this is not documented as a guarantee. See `audio.py`.
31
+
32
+ ## Working on the code
33
+
34
+ ```bash
35
+ pip install -e ".[dev]"
36
+ pytest
37
+ ruff check .
38
+ ```
39
+
40
+ The session tests start a real server on a real socket; they are slower than the
41
+ rest and that is deliberate — the lifecycle bugs worth catching do not exist
42
+ without one.
43
+
44
+ ### Things this project is strict about
45
+
46
+ Each of these exists because of a specific bug that reached the repository, and
47
+ each is written up in `PLAN.md` with the story attached.
48
+
49
+ - **Verify protocol details against the live Twilio docs, never from memory.**
50
+ The original plan's protocol table was wrong in three ways.
51
+ - **`None` is not zero.** An agent that never spoke has no latency measurement.
52
+ Rendering that as `0 ms` turns the worst outcome into the best one.
53
+ - **Measurement honesty over clean-looking numbers.** Pacing lateness is
54
+ reported alongside the latency it could have distorted. A latency tool that
55
+ reports wrong latency is worse than no tool, because people trust it.
56
+ - **Time is `time.perf_counter`.** `time.monotonic` is `GetTickCount64` on
57
+ Windows, at 15.6 ms — coarser than the frame being measured. This was found
58
+ quantising every number the tool produced.
59
+ - **Warnings are errors.** The few ignores are third-party and each is annotated
60
+ with why.
61
+ - **`protocol.py` and `audio.py` stay pure.** No network, no clock.
62
+
63
+ ### Tests
64
+
65
+ A fix needs a test that fails against the old behaviour. If the bug was in
66
+ timing or concurrency, prefer a test that reproduces the condition over one that
67
+ asserts on structure — `tests/test_review_gate_*.py` are written that way, and
68
+ each names the failure it prevents.
69
+
70
+ Property tests and mutation checks are welcome. There is a mutation-testing
71
+ habit in this repository rather than a tool: deliberately break something, and
72
+ confirm a test written for it fails. Several fixes here have been verified that
73
+ way, and one of them found that a fix had introduced a new bug.
74
+
75
+ ## Adding a scenario
76
+
77
+ Scenarios in `scenarios/` are examples as much as tests. Keep clips small, and
78
+ write the comments for someone who has not read the source.
79
+
80
+ If the scenario depends on the agent *understanding* the caller — barge-in,
81
+ anything answering a question — it needs real speech. Use
82
+ `python fixtures/make_speech.py`, which synthesises transcribable clips from the
83
+ OS's own TTS into the gitignored `fixtures/speech/`. The committed synthetic
84
+ fixtures are speech-like and no transcription service will turn them into words,
85
+ so a scenario driven by one fails for reasons that have nothing to do with the
86
+ agent under test.
87
+
88
+ ## What is out of scope
89
+
90
+ Stated to save you the work, not to be unwelcoming:
91
+
92
+ - LLM-as-judge or transcript scoring
93
+ - Multi-turn conversation simulation
94
+ - A web UI or dashboard
95
+ - Being a voice agent framework
96
+
97
+ The [comparison table](README.md#how-this-compares) says who does those well.
98
+ `streamdouble` does one thing, and the narrowness is the point.
99
+
100
+ ## Not affiliated with Twilio
101
+
102
+ This project is not affiliated with, endorsed by, or sponsored by Twilio. It
103
+ simulates the publicly documented Twilio Media Streams protocol. Please do not
104
+ contribute anything obtained under an NDA or from a private beta.
@@ -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 2026 Shaswat Sharma
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.