subs-pool 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 (63) hide show
  1. subs_pool-0.1.0/.github/workflows/build.yml +42 -0
  2. subs_pool-0.1.0/.github/workflows/publish.yml +71 -0
  3. subs_pool-0.1.0/.gitignore +15 -0
  4. subs_pool-0.1.0/ANATOMY.md +61 -0
  5. subs_pool-0.1.0/CLI_CONTRACT.md +72 -0
  6. subs_pool-0.1.0/CONTRACT.md +57 -0
  7. subs_pool-0.1.0/LICENSE +201 -0
  8. subs_pool-0.1.0/NOTICE +34 -0
  9. subs_pool-0.1.0/PKG-INFO +142 -0
  10. subs_pool-0.1.0/README.md +121 -0
  11. subs_pool-0.1.0/pyproject.toml +43 -0
  12. subs_pool-0.1.0/src/subs_pool/__init__.py +3 -0
  13. subs_pool-0.1.0/src/subs_pool/__main__.py +4 -0
  14. subs_pool-0.1.0/src/subs_pool/agent_cli.py +69 -0
  15. subs_pool-0.1.0/src/subs_pool/cli.py +77 -0
  16. subs_pool-0.1.0/src/subs_pool/cli_client.py +365 -0
  17. subs_pool-0.1.0/src/subs_pool/home.py +41 -0
  18. subs_pool-0.1.0/src/subs_pool/modules/__init__.py +1 -0
  19. subs_pool-0.1.0/src/subs_pool/modules/codex/CLI_CONTRACT.md +44 -0
  20. subs_pool-0.1.0/src/subs_pool/modules/codex/CONTRACT.md +52 -0
  21. subs_pool-0.1.0/src/subs_pool/modules/codex/__init__.py +1 -0
  22. subs_pool-0.1.0/src/subs_pool/modules/codex/accounts.py +289 -0
  23. subs_pool-0.1.0/src/subs_pool/modules/codex/auth_codex.py +428 -0
  24. subs_pool-0.1.0/src/subs_pool/modules/codex/chain.py +187 -0
  25. subs_pool-0.1.0/src/subs_pool/modules/codex/cli.py +371 -0
  26. subs_pool-0.1.0/src/subs_pool/modules/codex/device_login.py +273 -0
  27. subs_pool-0.1.0/src/subs_pool/modules/codex/errors.py +28 -0
  28. subs_pool-0.1.0/src/subs_pool/modules/codex/hashing.py +96 -0
  29. subs_pool-0.1.0/src/subs_pool/modules/codex/home.py +37 -0
  30. subs_pool-0.1.0/src/subs_pool/modules/codex/quota.py +524 -0
  31. subs_pool-0.1.0/src/subs_pool/modules/codex/quota_refresh.py +607 -0
  32. subs_pool-0.1.0/src/subs_pool/modules/codex/quota_store.py +656 -0
  33. subs_pool-0.1.0/src/subs_pool/modules/codex/routing.py +128 -0
  34. subs_pool-0.1.0/src/subs_pool/modules/codex/server.py +536 -0
  35. subs_pool-0.1.0/src/subs_pool/modules/codex/sse.py +124 -0
  36. subs_pool-0.1.0/src/subs_pool/modules/codex/tui.py +1143 -0
  37. subs_pool-0.1.0/src/subs_pool/modules/codex/tui_adapter.py +97 -0
  38. subs_pool-0.1.0/src/subs_pool/modules/codex/upstream.py +198 -0
  39. subs_pool-0.1.0/src/subs_pool/output.py +22 -0
  40. subs_pool-0.1.0/src/subs_pool/registry.py +53 -0
  41. subs_pool-0.1.0/src/subs_pool/tui.py +21 -0
  42. subs_pool-0.1.0/tests/conftest.py +14 -0
  43. subs_pool-0.1.0/tests/fakes.py +189 -0
  44. subs_pool-0.1.0/tests/test_accounts.py +123 -0
  45. subs_pool-0.1.0/tests/test_auth_codex.py +125 -0
  46. subs_pool-0.1.0/tests/test_chain.py +266 -0
  47. subs_pool-0.1.0/tests/test_cli.py +87 -0
  48. subs_pool-0.1.0/tests/test_cli_client.py +393 -0
  49. subs_pool-0.1.0/tests/test_core_cli.py +37 -0
  50. subs_pool-0.1.0/tests/test_distribution.py +18 -0
  51. subs_pool-0.1.0/tests/test_hashing.py +66 -0
  52. subs_pool-0.1.0/tests/test_home.py +24 -0
  53. subs_pool-0.1.0/tests/test_http_upstream.py +281 -0
  54. subs_pool-0.1.0/tests/test_login.py +183 -0
  55. subs_pool-0.1.0/tests/test_quota.py +623 -0
  56. subs_pool-0.1.0/tests/test_routing.py +126 -0
  57. subs_pool-0.1.0/tests/test_sdk.py +176 -0
  58. subs_pool-0.1.0/tests/test_server.py +1043 -0
  59. subs_pool-0.1.0/tests/test_sse.py +92 -0
  60. subs_pool-0.1.0/tests/test_subscription_vertical_slice.py +780 -0
  61. subs_pool-0.1.0/tests/test_tui.py +216 -0
  62. subs_pool-0.1.0/tests/test_workflow_contract.py +42 -0
  63. subs_pool-0.1.0/tools/validate_distribution.py +119 -0
@@ -0,0 +1,42 @@
1
+ name: Build
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
16
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
17
+ with:
18
+ python-version: "3.11"
19
+ - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
20
+ - name: Test source
21
+ run: |
22
+ uv venv .venv
23
+ uv pip install --python .venv/bin/python -e ".[test]"
24
+ .venv/bin/python -m pytest
25
+ - name: Build wheel and sdist
26
+ run: uv build
27
+ - name: Validate distribution contents
28
+ run: .venv/bin/python tools/validate_distribution.py dist/*
29
+ - name: Smoke-test built wheel
30
+ run: |
31
+ wheel_path="$(find dist -maxdepth 1 -name '*.whl' -print -quit)"
32
+ test -n "$wheel_path"
33
+ uv venv .artifact-venv
34
+ uv pip install --python .artifact-venv/bin/python "$wheel_path"
35
+ .artifact-venv/bin/python -c "import subs_pool; from importlib.metadata import version; assert subs_pool.__version__ == version('subs-pool')"
36
+ .artifact-venv/bin/subspool --version
37
+ .artifact-venv/bin/subspool-cli --version
38
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
39
+ with:
40
+ name: subs-pool-distributions
41
+ path: dist/*
42
+ if-no-files-found: error
@@ -0,0 +1,71 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: read
12
+ steps:
13
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
14
+ with:
15
+ ref: ${{ github.event.release.tag_name }}
16
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
17
+ with:
18
+ python-version: "3.11"
19
+ - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
20
+ - name: Check release tag matches package version
21
+ run: |
22
+ python - <<'PY'
23
+ import os
24
+ from pathlib import Path
25
+ import sys
26
+
27
+ sys.path.insert(0, "src")
28
+ from subs_pool import __version__ as version
29
+ tag = os.environ["GITHUB_REF_NAME"]
30
+ normalized = tag[1:] if tag.startswith("v") else tag
31
+ if normalized != version:
32
+ raise SystemExit(f"release tag {tag!r} does not match package version {version!r}")
33
+ PY
34
+ - name: Test source
35
+ run: |
36
+ uv venv .venv
37
+ uv pip install --python .venv/bin/python -e ".[test]"
38
+ .venv/bin/python -m pytest
39
+ - name: Build wheel and sdist
40
+ run: uv build
41
+ - name: Validate distribution contents
42
+ run: .venv/bin/python tools/validate_distribution.py dist/*
43
+ - name: Check distribution metadata
44
+ run: .venv/bin/python -m twine check dist/*
45
+ - name: Smoke-test built wheel
46
+ run: |
47
+ wheel_path="$(find dist -maxdepth 1 -name '*.whl' -print -quit)"
48
+ test -n "$wheel_path"
49
+ uv venv .artifact-venv
50
+ uv pip install --python .artifact-venv/bin/python "$wheel_path"
51
+ .artifact-venv/bin/python -c "import subs_pool"
52
+ .artifact-venv/bin/subspool --version
53
+ .artifact-venv/bin/subspool-cli --version
54
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
55
+ with:
56
+ name: subs-pool-distributions
57
+ path: dist/*
58
+ if-no-files-found: error
59
+
60
+ publish:
61
+ needs: build
62
+ runs-on: ubuntu-latest
63
+ permissions:
64
+ contents: read
65
+ id-token: write
66
+ steps:
67
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
68
+ with:
69
+ name: subs-pool-distributions
70
+ path: dist
71
+ - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
@@ -0,0 +1,15 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ *.egg-info/
5
+ .pytest_cache/
6
+ dist/
7
+ build/
8
+ .coverage
9
+
10
+ # Task-local reports are not package sources.
11
+ IMPLEMENTATION_REPORT.md
12
+ REPORT_AUTH.md
13
+ PROGRESS.md
14
+ PROGRESS_AUTH.md
15
+ artifacts/
@@ -0,0 +1,61 @@
1
+ ---
2
+ related_files:
3
+ - README.md
4
+ - CONTRACT.md
5
+ - CLI_CONTRACT.md
6
+ - pyproject.toml
7
+ - .github/workflows/build.yml
8
+ - .github/workflows/publish.yml
9
+ - src/subs_pool/cli.py
10
+ - src/subs_pool/agent_cli.py
11
+ - src/subs_pool/registry.py
12
+ - src/subs_pool/tui.py
13
+ - src/subs_pool/modules/codex/tui.py
14
+ - src/subs_pool/modules/codex/accounts.py
15
+ - src/subs_pool/modules/codex/quota.py
16
+ - src/subs_pool/modules/codex/quota_store.py
17
+ - src/subs_pool/modules/codex/quota_refresh.py
18
+ - src/subs_pool/modules/codex/routing.py
19
+ - src/subs_pool/modules/codex/server.py
20
+ maintenance: Keep this map repo-relative and factual.
21
+ ---
22
+
23
+ # subs-pool anatomy
24
+
25
+ The package has one explicit built-in module, Codex. There is no entry-point
26
+ discovery, provider framework, downloaded code, daemon, or generic inference
27
+ router.
28
+
29
+ The generic shell consists of `cli.py` (human `subspool` dispatch),
30
+ `agent_cli.py` (machine-only `subspool-cli` JSON envelopes), `registry.py`
31
+ (the static Codex mapping), `home.py` (the `SUBS_POOL_HOME` root), and `tui.py`
32
+ (Textual lifecycle and presentation). Codex local status, quota, and account
33
+ actions are owned by `modules/codex/tui.py` and run through its in-process
34
+ adapter; `cli_client.py` remains for the cancellable human device-login stream
35
+ and injected frontend tests.
36
+
37
+ The Codex module owns account configuration, auth and device login, WHAM
38
+ parsing, the versioned sidecar and refresh coordinator, strict quota-gated
39
+ routing, affinity, Responses/SSE behavior, and the foreground proxy.
40
+ `quota_store.py` is the only persisted quota authority. `quota_refresh.py`
41
+ coordinates one pool-wide bounded refresh across processes.
42
+
43
+ The selected Codex root is either explicit `CODEX_POOL_HOME` or
44
+ `<SUBS_POOL_HOME>/codex`, with `~/.subs-pool` as the generic default. Its
45
+ direct layout is:
46
+
47
+ ```text
48
+ <codex-root>/pool.json
49
+ <codex-root>/quota-v1.json
50
+ <codex-root>/state.lock
51
+ <codex-root>/quota-v1.refresh.lock
52
+ <codex-root>/auth/...
53
+ ```
54
+
55
+ The old `codex_pool` import package and `codex-pool` console alias are not
56
+ built. Provider wire identity strings containing `codex-pool` remain in the
57
+ Codex upstream adapter where baseline protocol tests require them.
58
+
59
+ `build.yml` runs tests, builds wheel/sdist, smoke-tests both installed
60
+ commands, and uploads artifacts only. `publish.yml` is the release publisher
61
+ tuple with `id-token: write` and deliberately no GitHub job environment.
@@ -0,0 +1,72 @@
1
+ # CLI contract
2
+
3
+ The installed commands are exactly `subspool` and `subspool-cli`.
4
+
5
+ Human commands:
6
+
7
+ ```text
8
+ subspool # open Codex TUI
9
+ subspool --help
10
+ subspool --version
11
+ subspool modules [list]
12
+ subspool codex account import ID --path AUTH.json [--weight N]
13
+ subspool codex account list
14
+ subspool codex account login ID --device
15
+ subspool codex account enable ID
16
+ subspool codex account disable ID
17
+ subspool codex account weight ID N
18
+ subspool codex status
19
+ subspool codex quota
20
+ subspool codex serve [--listen 127.0.0.1:8765] [--api-key KEY]
21
+ ```
22
+
23
+ The account import operation references an existing auth file; it does not
24
+ copy credentials. Device login remains human-only. There are no logout,
25
+ remove, service, provider-discovery, or plugin commands. `--listen` remains
26
+ the baseline loopback grammar and remote binds are rejected.
27
+
28
+ The Agent command is machine-only. It never invokes the TUI or a prompt:
29
+
30
+ ```text
31
+ subspool-cli [--help|--version]
32
+ subspool-cli modules [list]
33
+ subspool-cli codex account list
34
+ subspool-cli codex account import ID --path AUTH.json [--weight N]
35
+ subspool-cli codex account enable|disable ID
36
+ subspool-cli codex account weight ID N
37
+ subspool-cli codex status
38
+ subspool-cli codex quota
39
+ ```
40
+
41
+ Agent `codex account login`, `codex serve`, `tui`, unsupported commands, and
42
+ bad syntax return a structured error. Every ordinary completion is one UTF-8
43
+ JSON object and newline:
44
+
45
+ ```json
46
+ {"schema_version":1,"command":"codex.quota","ok":true,"data":{},"error":null}
47
+ ```
48
+
49
+ Failures use `ok:false` and an error object with `code`, `message`, and
50
+ `details`. Exit codes are `0` success, `2` syntax/unsupported, `3`
51
+ quota/auth/network unavailable or incomplete, `4` local state/configuration,
52
+ `5` unexpected internal failure, and `130` handled interruption. A successful
53
+ quota check may report exhausted accounts with exit `0`; a failed required
54
+ refresh exits `3` and includes the readable partial shared snapshot.
55
+
56
+ `account list` is metadata-only: it reports account ID, enabled/weight, local
57
+ auth presence/state, never quota percentages or a quota
58
+ derived ready flag. `codex quota` always requests a current pool-wide refresh
59
+ and returns module, resolved root, generated time, committed revision,
60
+ refresh outcome, account rows, current quota, explicitly historical
61
+ `last_success`, freshness/age, eligibility, and exclusion reason.
62
+
63
+ The TUI enters `CHECKING` before current values are shown. `u` forces a shared
64
+ refresh, `r` reloads metadata and performs the same refresh, and a one-second
65
+ inspection loop observes shared state and requests the 30-second background
66
+ target. Historical samples are labeled stale/last-success and are never
67
+ rendered as current green values.
68
+
69
+ Account references are any non-empty path-safe string: `/`, `\`, `.`, and `..`
70
+ are rejected, with no additional ASCII or length restriction. Agent parsing
71
+ consumes the complete token list; unknown, duplicate, or trailing options are
72
+ syntax errors and all help paths are state-free JSON responses.
@@ -0,0 +1,57 @@
1
+ # subs-pool contract
2
+
3
+ Version 0.1.0 ships one static built-in module: `codex`. The generic core owns
4
+ package identity, the two executable entrypoints, root dispatch, the static
5
+ registry, the JSON envelope, and the TUI lifecycle. It does not interpret
6
+ credentials, quota, provider protocols, routing, affinity, or Responses
7
+ conversation state.
8
+
9
+ `subspool` is the human interface: no arguments opens the Codex TUI;
10
+ `subspool codex ...` runs human Codex operations. `subspool-cli` is the Agent
11
+ interface: every ordinary completion writes exactly one JSON object and never
12
+ prompts, launches a browser, or opens the TUI.
13
+
14
+ Codex owns account/auth state, WHAM parsing, quota freshness, the sidecar,
15
+ refresh coordination, routing, chain/session affinity, upstream wire
16
+ behavior, and the foreground local Responses server. The Codex server keeps
17
+ the baseline hash/chain/session/no-replay/commit behavior. Quota is a gate
18
+ before upstream dispatch, not a retry or failover mechanism.
19
+
20
+ The root precedence is:
21
+
22
+ ```text
23
+ generic_root = explicit SUBS_POOL_HOME, otherwise ~/.subs-pool
24
+ codex_root = explicit CODEX_POOL_HOME, otherwise generic_root/codex
25
+ ```
26
+
27
+ Both variables are path selections, not migration controls. Leading `~` is
28
+ expanded and relative values are resolved absolutely. Empty values are
29
+ configuration errors. No legacy root is scanned, copied, merged, or used as a
30
+ fallback. The existing Codex root keeps `pool.json` at its direct root.
31
+
32
+ ```text
33
+ <codex_root>/pool.json
34
+ <codex_root>/quota-v1.json
35
+ <codex_root>/state.lock
36
+ <codex_root>/quota-v1.refresh.lock
37
+ ```
38
+
39
+ `quota-v1.json` is separate, versioned, compact, atomic, and token-free. A
40
+ missing file means unchecked. Invalid or unsupported sidecars are preserved and
41
+ reported as state errors. Only a fresh successful sample for the current
42
+ account epoch, enabled/authenticated account, and non-exhausted known quota is
43
+ eligible. Unknown values, failed/checking states, and stale successes are not
44
+ current capacity.
45
+
46
+ Refreshes use the existing `filelock` dependency. The refresh lock elects one
47
+ pool-wide owner; the state lock is short and is never held during network
48
+ work. Account work is bounded and at most two requests run in one wave. TUI,
49
+ Agent CLI, human quota, and the foreground proxy use the same coordinator.
50
+
51
+ The proxy remains foreground-only, loopback-only, and defaults to
52
+ `--listen 127.0.0.1:8765`. It performs startup/periodic/JIT quota checks but
53
+ does not install a service or restart a generation on failure.
54
+
55
+ No provider/plugin discovery, service bootstrap, database, persistent
56
+ affinity, billing/history collector, logout/remove lifecycle, or extra account
57
+ provider is part of this release.
@@ -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.
subs_pool-0.1.0/NOTICE ADDED
@@ -0,0 +1,34 @@
1
+ subs-pool
2
+ Copyright 2026 the subs-pool contributors
3
+
4
+ This product includes software adapted from the LingTai kernel
5
+ (`src/lingtai/auth/codex.py` and
6
+ `src/lingtai/llm/openai/codex_quota.py`) and the LingTai TUI
7
+ (`internal/tui/oauth.go`), licensed under the Apache License, Version 2.0.
8
+ The adapted files live at `src/subs_pool/modules/codex/auth_codex.py`,
9
+ `src/subs_pool/modules/codex/quota.py`, and
10
+ `src/subs_pool/modules/codex/device_login.py`; each carries its own header
11
+ pointing back here.
12
+
13
+ `src/subs_pool/modules/codex/upstream.py`'s Codex cache-affinity request metadata (the
14
+ underscored `session_id`/`thread_id` header names and the
15
+ `x-codex-turn-metadata` JSON shape) reproduces wire-protocol facts read from
16
+ the same LingTai kernel's `src/lingtai/llm/openai/adapter.py`
17
+ (`_cache_affinity_headers` / `_codex_metadata_headers`). No source code from
18
+ that file was copied; only the documented field names/shapes needed to speak
19
+ the same upstream wire protocol were reimplemented independently, with
20
+ the Codex module's own honest legacy `codex-pool` client identity (never
21
+ LingTai's or the official Codex CLI's). That protocol identity is intentionally
22
+ retained during the Python distribution rename to preserve verified behavior.
23
+
24
+ Licensed under the Apache License, Version 2.0 (the "License");
25
+ you may not use this file except in compliance with the License.
26
+ You may obtain a copy of the License at
27
+
28
+ http://www.apache.org/licenses/LICENSE-2.0
29
+
30
+ Unless required by applicable law or agreed to in writing, software
31
+ distributed under the License is distributed on an "AS IS" BASIS,
32
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33
+ See the License for the specific language governing permissions and
34
+ limitations under the License.