s-accountpoolkit 0.0.1__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.
- accountpoolkit/__init__.py +209 -0
- accountpoolkit/cli.py +501 -0
- accountpoolkit/compat.py +253 -0
- accountpoolkit/egress.py +825 -0
- accountpoolkit/io.py +621 -0
- accountpoolkit/model.py +584 -0
- accountpoolkit/providers.py +572 -0
- accountpoolkit/ratelimit.py +502 -0
- accountpoolkit/rotation.py +523 -0
- accountpoolkit/selector.py +574 -0
- accountpoolkit/service.py +889 -0
- accountpoolkit/store.py +441 -0
- s_accountpoolkit-0.0.1.dist-info/METADATA +68 -0
- s_accountpoolkit-0.0.1.dist-info/RECORD +16 -0
- s_accountpoolkit-0.0.1.dist-info/WHEEL +4 -0
- s_accountpoolkit-0.0.1.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"""accountpoolkit — зрелый пул аккаунтов/сессий поверх librarykit.
|
|
2
|
+
|
|
3
|
+
Доменный слой над librarykit-примитивами (SessionStore/SessionPool/RateLimiter/
|
|
4
|
+
RotatingAuth/antibot): статус-машина аккаунта, quota/подписки, rate-limit +
|
|
5
|
+
circuit-breaker, OAuth-ротация с single-flight (DCL) lock, egress-пул с настоящим
|
|
6
|
+
quarantine, import/export, headless AccountService-фасад + CLI. НЕ переписывает
|
|
7
|
+
librarykit — оборачивает его. Провайдер-специфика (gemini/codex/…) подключается
|
|
8
|
+
через Protocol-плагины, ядро её не знает.
|
|
9
|
+
|
|
10
|
+
dist-имя ``s-accountpoolkit`` · import-имя ``accountpoolkit`` (как s-librarykit →
|
|
11
|
+
librarykit). Публичная поверхность собирается здесь по мере наполнения срезов.
|
|
12
|
+
"""
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
from accountpoolkit import compat
|
|
16
|
+
from accountpoolkit.egress import (
|
|
17
|
+
DEFAULT_FAILURE_THRESHOLD,
|
|
18
|
+
DEFAULT_HEALTH_INTERVAL,
|
|
19
|
+
DEFAULT_HEALTH_TIMEOUT,
|
|
20
|
+
DEFAULT_HEALTH_URL,
|
|
21
|
+
EgressPool,
|
|
22
|
+
EgressStrategy,
|
|
23
|
+
HealthChecker,
|
|
24
|
+
LeastConnStrategy,
|
|
25
|
+
PowerOfTwoStrategy,
|
|
26
|
+
PriorityStrategy,
|
|
27
|
+
Proxy,
|
|
28
|
+
ProxyEntry,
|
|
29
|
+
ProxyState,
|
|
30
|
+
RoundRobinStrategy,
|
|
31
|
+
WeightedStrategy,
|
|
32
|
+
)
|
|
33
|
+
from accountpoolkit.io import (
|
|
34
|
+
CURRENT_FORMAT,
|
|
35
|
+
FORMAT_V1,
|
|
36
|
+
AccountRecord,
|
|
37
|
+
CodexAuthReader,
|
|
38
|
+
ForeignStoreReader,
|
|
39
|
+
FormatMigrator,
|
|
40
|
+
ImportError,
|
|
41
|
+
ImportReport,
|
|
42
|
+
ProtobufReader,
|
|
43
|
+
SqliteReader,
|
|
44
|
+
export,
|
|
45
|
+
import_,
|
|
46
|
+
)
|
|
47
|
+
from accountpoolkit.model import (
|
|
48
|
+
Account,
|
|
49
|
+
AccountState,
|
|
50
|
+
CircuitBreaker,
|
|
51
|
+
ClaimsQuota,
|
|
52
|
+
DeviceProfile,
|
|
53
|
+
DualWindowQuota,
|
|
54
|
+
HeaderQuota,
|
|
55
|
+
ModelWindow,
|
|
56
|
+
ProxyBinding,
|
|
57
|
+
QuotaData,
|
|
58
|
+
SubscriptionTier,
|
|
59
|
+
TokenMeta,
|
|
60
|
+
)
|
|
61
|
+
from accountpoolkit.providers import (
|
|
62
|
+
PROVIDER_ENTRY_POINT_GROUP,
|
|
63
|
+
AccountProvider,
|
|
64
|
+
GeminiProvider,
|
|
65
|
+
NullProvider,
|
|
66
|
+
ProviderRegistry,
|
|
67
|
+
)
|
|
68
|
+
from accountpoolkit.ratelimit import (
|
|
69
|
+
LimitReason,
|
|
70
|
+
LimitSignal,
|
|
71
|
+
RateLimitTracker,
|
|
72
|
+
ResponseLike,
|
|
73
|
+
)
|
|
74
|
+
from accountpoolkit.rotation import (
|
|
75
|
+
DEFAULT_AHEAD_SECONDS,
|
|
76
|
+
DEFAULT_GRACE_SECONDS,
|
|
77
|
+
DEFAULT_SKEW_SECONDS,
|
|
78
|
+
InvalidGrantError,
|
|
79
|
+
OAuthClient,
|
|
80
|
+
OAuthClientMismatch,
|
|
81
|
+
ProactiveRefreshScheduler,
|
|
82
|
+
RefreshError,
|
|
83
|
+
RefreshExhausted,
|
|
84
|
+
RefreshManager,
|
|
85
|
+
RefreshResult,
|
|
86
|
+
RefreshTransportError,
|
|
87
|
+
)
|
|
88
|
+
from accountpoolkit.selector import (
|
|
89
|
+
DEFAULT_PRIORITY_BAND,
|
|
90
|
+
SLOW_START_SECONDS,
|
|
91
|
+
AccountChoice,
|
|
92
|
+
AccountPool,
|
|
93
|
+
EgressResolver,
|
|
94
|
+
)
|
|
95
|
+
from accountpoolkit.service import (
|
|
96
|
+
PROVENANCE_META_KEY,
|
|
97
|
+
SECRET_ALLOW_LIST,
|
|
98
|
+
AccountService,
|
|
99
|
+
AccountView,
|
|
100
|
+
Provenance,
|
|
101
|
+
correlation_id,
|
|
102
|
+
redact,
|
|
103
|
+
with_correlation_id,
|
|
104
|
+
)
|
|
105
|
+
from accountpoolkit.store import (
|
|
106
|
+
APK_META_KEY,
|
|
107
|
+
CREDS_STATE_KEY,
|
|
108
|
+
LOCK_FILENAME,
|
|
109
|
+
AccountStore,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
# compat (срез 9) — namespace-модуль back-compat фасада gemini-balancer: символы
|
|
113
|
+
# под `compat.*` (дублируют librarykit-примитивы, нужны лишь gemini-shim). cli
|
|
114
|
+
# (срез 9) НЕ реэкспортируем в корень — он тянет typer/clikit ([cli]-экстра);
|
|
115
|
+
# точка входа `accountpoolkit.cli:app` (project.scripts).
|
|
116
|
+
|
|
117
|
+
__version__ = "0.0.1"
|
|
118
|
+
|
|
119
|
+
__all__ = [
|
|
120
|
+
"__version__",
|
|
121
|
+
# model (срез 1)
|
|
122
|
+
"Account",
|
|
123
|
+
"AccountState",
|
|
124
|
+
"SubscriptionTier",
|
|
125
|
+
"QuotaData",
|
|
126
|
+
"DualWindowQuota",
|
|
127
|
+
"HeaderQuota",
|
|
128
|
+
"ClaimsQuota",
|
|
129
|
+
"ModelWindow",
|
|
130
|
+
"TokenMeta",
|
|
131
|
+
"ProxyBinding",
|
|
132
|
+
"DeviceProfile",
|
|
133
|
+
"CircuitBreaker",
|
|
134
|
+
# store (срез 1)
|
|
135
|
+
"AccountStore",
|
|
136
|
+
"APK_META_KEY",
|
|
137
|
+
"CREDS_STATE_KEY",
|
|
138
|
+
"LOCK_FILENAME",
|
|
139
|
+
# ratelimit (срез 2)
|
|
140
|
+
"RateLimitTracker",
|
|
141
|
+
"LimitReason",
|
|
142
|
+
"LimitSignal",
|
|
143
|
+
"ResponseLike",
|
|
144
|
+
# selector (срез 3)
|
|
145
|
+
"AccountPool",
|
|
146
|
+
"AccountChoice",
|
|
147
|
+
"EgressResolver",
|
|
148
|
+
"DEFAULT_PRIORITY_BAND",
|
|
149
|
+
"SLOW_START_SECONDS",
|
|
150
|
+
# egress (срез 5)
|
|
151
|
+
"EgressPool",
|
|
152
|
+
"Proxy",
|
|
153
|
+
"ProxyEntry",
|
|
154
|
+
"ProxyState",
|
|
155
|
+
"EgressStrategy",
|
|
156
|
+
"RoundRobinStrategy",
|
|
157
|
+
"WeightedStrategy",
|
|
158
|
+
"LeastConnStrategy",
|
|
159
|
+
"PriorityStrategy",
|
|
160
|
+
"PowerOfTwoStrategy",
|
|
161
|
+
"HealthChecker",
|
|
162
|
+
"DEFAULT_HEALTH_URL",
|
|
163
|
+
"DEFAULT_HEALTH_TIMEOUT",
|
|
164
|
+
"DEFAULT_HEALTH_INTERVAL",
|
|
165
|
+
"DEFAULT_FAILURE_THRESHOLD",
|
|
166
|
+
# rotation (срез 4)
|
|
167
|
+
"RefreshManager",
|
|
168
|
+
"ProactiveRefreshScheduler",
|
|
169
|
+
"OAuthClient",
|
|
170
|
+
"RefreshResult",
|
|
171
|
+
"RefreshError",
|
|
172
|
+
"InvalidGrantError",
|
|
173
|
+
"OAuthClientMismatch",
|
|
174
|
+
"RefreshTransportError",
|
|
175
|
+
"RefreshExhausted",
|
|
176
|
+
"DEFAULT_SKEW_SECONDS",
|
|
177
|
+
"DEFAULT_GRACE_SECONDS",
|
|
178
|
+
"DEFAULT_AHEAD_SECONDS",
|
|
179
|
+
# providers (срез 6)
|
|
180
|
+
"AccountProvider",
|
|
181
|
+
"ProviderRegistry",
|
|
182
|
+
"NullProvider",
|
|
183
|
+
"GeminiProvider",
|
|
184
|
+
"PROVIDER_ENTRY_POINT_GROUP",
|
|
185
|
+
# io (срез 7)
|
|
186
|
+
"export",
|
|
187
|
+
"import_",
|
|
188
|
+
"AccountRecord",
|
|
189
|
+
"ImportReport",
|
|
190
|
+
"ImportError",
|
|
191
|
+
"FormatMigrator",
|
|
192
|
+
"ForeignStoreReader",
|
|
193
|
+
"SqliteReader",
|
|
194
|
+
"CodexAuthReader",
|
|
195
|
+
"ProtobufReader",
|
|
196
|
+
"FORMAT_V1",
|
|
197
|
+
"CURRENT_FORMAT",
|
|
198
|
+
# service (срез 8)
|
|
199
|
+
"AccountService",
|
|
200
|
+
"AccountView",
|
|
201
|
+
"Provenance",
|
|
202
|
+
"PROVENANCE_META_KEY",
|
|
203
|
+
"SECRET_ALLOW_LIST",
|
|
204
|
+
"correlation_id",
|
|
205
|
+
"with_correlation_id",
|
|
206
|
+
"redact",
|
|
207
|
+
# compat (срез 9) — namespace-модуль back-compat фасада gemini
|
|
208
|
+
"compat",
|
|
209
|
+
]
|