dsh-agy 0.2.2 → 0.2.4

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 (33) hide show
  1. package/README.md +41 -4
  2. package/lib/{session-KoIh3xdB.mjs → accounts-DbTTxX_z.mjs} +1125 -546
  3. package/lib/accounts-DbTTxX_z.mjs.map +1 -0
  4. package/lib/{models-1rf_Wfo2.mjs → catalog-iuikPZIb.mjs} +29 -81
  5. package/lib/catalog-iuikPZIb.mjs.map +1 -0
  6. package/lib/cli/index.d.mts.map +1 -1
  7. package/lib/cli/index.mjs +149 -12
  8. package/lib/cli/index.mjs.map +1 -1
  9. package/lib/{exchange-DBRzR2M-.mjs → exchange-BvrLu2E4.mjs} +8 -5
  10. package/lib/exchange-BvrLu2E4.mjs.map +1 -0
  11. package/lib/{import-C4CRBTbi.mjs → import-DSvpbB0T.mjs} +30 -8
  12. package/lib/import-DSvpbB0T.mjs.map +1 -0
  13. package/lib/index.d.mts.map +1 -1
  14. package/lib/index.mjs +6 -1
  15. package/lib/index.mjs.map +1 -1
  16. package/lib/models-DRWVi33p.mjs +136 -0
  17. package/lib/models-DRWVi33p.mjs.map +1 -0
  18. package/lib/{plugin-common-CQoDUeqE.mjs → plugin-common-D7lc-W6b.mjs} +79 -11
  19. package/lib/plugin-common-D7lc-W6b.mjs.map +1 -0
  20. package/lib/proxy-DQPIwUov.mjs +269 -0
  21. package/lib/proxy-DQPIwUov.mjs.map +1 -0
  22. package/lib/{translate-BQuSQW35.mjs → translate-COjBTH4-.mjs} +27 -6
  23. package/lib/translate-COjBTH4-.mjs.map +1 -0
  24. package/lib/web/plugin.d.mts.map +1 -1
  25. package/lib/web/plugin.mjs +202 -8
  26. package/lib/web/plugin.mjs.map +1 -1
  27. package/package.json +4 -1
  28. package/lib/exchange-DBRzR2M-.mjs.map +0 -1
  29. package/lib/import-C4CRBTbi.mjs.map +0 -1
  30. package/lib/models-1rf_Wfo2.mjs.map +0 -1
  31. package/lib/plugin-common-CQoDUeqE.mjs.map +0 -1
  32. package/lib/session-KoIh3xdB.mjs.map +0 -1
  33. package/lib/translate-BQuSQW35.mjs.map +0 -1
package/README.md CHANGED
@@ -15,8 +15,9 @@ fingerprinting, and both CLI and web management.
15
15
  paste-URL mode and a remote paste-credential blob channel.
16
16
  - **Two management surfaces**: web and CLI, either one works, core features are
17
17
  the same.
18
- - **Multi-account pool**: encrypted account store, automatic rotation on rate
19
- limits, per-account cooldown with tiered backoff, per-account device
18
+ - **Multi-account pool**: encrypted account store, usage-aware account
19
+ selection (family-scoped quotas, OMP-aligned ranking), automatic rotation on
20
+ rate limits, per-account cooldown to the real reset time, per-account device
20
21
  fingerprints.
21
22
  - **Quota dashboard**: only active when DSH Web is running; append `/agy` to
22
23
  your dsh web address: login, account management, per-model quota bars, model
@@ -63,6 +64,7 @@ npm install -g dsh-agy
63
64
  dsh-agy login # interactive OAuth (browser, --headless paste, or --blob)
64
65
  dsh-agy status # list accounts + quota summary
65
66
  dsh-agy verify # refresh + health check
67
+ dsh-agy health # batch health check (optionally on an interval)
66
68
  dsh-agy import <file> # import agy auth.json or credential blob (--blob)
67
69
  dsh-agy logout # remove account
68
70
  ```
@@ -76,8 +78,27 @@ dsh-agy logout # remove account
76
78
  | `dsh-agy import <files...>` | `--blob` — the pasted value is a credential blob<br>`--email <email>` — set the account email (skips userinfo verification)<br>`--overwrite` — replace an existing account with the same email | Import agy auth.json files or credential blobs (multiple files / multi-line paste = batch import) |
77
79
  | `dsh-agy export` | `--index <n>` — export one account by index (default: all)<br>`--out <dir>` — write one `dsh-agy-<index>.blob` per account (default: print to stdout, one blob per line) | Export account credentials as paste blobs |
78
80
  | `dsh-agy verify` | `--index <n>` — verify one account by index (default: all) | Refresh + health check |
81
+ | `dsh-agy health` | `--index <n...>` — check only these accounts (default: all enabled)<br>`--interval <ms>` — repeat on an interval instead of once | Batch health check (refresh + userinfo), re-enables accounts whose credentials are live again |
79
82
  | `dsh-agy logout` | `--index <n>` — account index (default: active)<br>`--email <email>` — account email | Remove an account |
80
83
 
84
+ ### Per-account proxy
85
+
86
+ Each account can have its own proxy; credentials are encrypted at rest and displayed masked as `protocol//host:port`.
87
+
88
+ ```sh
89
+ dsh-agy login --proxy socks5://user:pass@host:1080
90
+ dsh-agy import --proxy <url> file.json
91
+ dsh-agy proxy set --index 0 --proxy <url> # set / update
92
+ dsh-agy proxy clear --index 0 # clear (fall back to env)
93
+ dsh-agy proxy test --index 0 # TCP 2s fast-fail probe
94
+ dsh-agy proxy list # masked list
95
+ dsh-agy status # shows proxy column (masked host:port)
96
+ ```
97
+
98
+ Fallback: with no per-account proxy, requests use `EnvHttpProxyAgent` (`HTTP_PROXY`/`HTTPS_PROXY` with `NO_PROXY` honored). Per-account proxies ignore `NO_PROXY`, are fail-closed (unreachable proxy skips the account without cooldown and clears affinity), and loopback targets (`localhost`/`127.0.0.1`/`::1`) are always forced direct.
99
+
100
+ Web dashboard (`/agy`): each account card shows an inline Proxy row `[input] [Save][Clear][Test]` with masked `host:port`; writes via `POST /agy/api/proxy`, probes via `POST /agy/api/proxy/test`.
101
+
81
102
  ### Path C: Local Development & Link
82
103
 
83
104
  ```sh
@@ -114,18 +135,34 @@ valid until it expires or you revoke it in your Google account security settings
114
135
 
115
136
  ### Rotation mechanics
116
137
 
138
+ Usage-aware selection: when several accounts are available, requests rank them
139
+ by the requested model's backend counter family (`gemini-*` → Google,
140
+ `claude-*` → Anthropic, `gpt-*` → OpenAI): accounts whose quota is about to
141
+ reset with headroom left are used first ("use it or lose it"), near-exhausted
142
+ families are avoided, and exhausted families block the account until the real
143
+ reset time.
144
+
117
145
  429 (Too Many Requests) responses:
118
146
 
119
147
  | Category | Behavior |
120
148
  |---|---|
121
149
  | `soft_rate_limit` (Retry-After < 3s) | immediate retry on the same account, no cooldown |
122
- | `rate_limited` | 5-minute cooldown + switch to the next account (same account when single) |
123
- | `quota_exhausted` ("quota reached", "individual quota", RESOURCE_EXHAUSTED…) | 24-hour cooldown — no further calls to that account for the day |
150
+ | `rate_limited` | cooldown until the server-reported reset time (capped 30min, 5min fallback) + switch to the next account (same account when single) |
151
+ | `quota_exhausted` ("quota reached", "individual quota", RESOURCE_EXHAUSTED…) | cooldown until the server-reported reset time (capped 24h) — no further calls to that account until then |
124
152
  | `unknown` | exponential backoff |
125
153
 
126
154
  401/403 → account revoked (marked for re-authentication). Success resets the failure
127
155
  counter.
128
156
 
157
+ ### Risk controls (environment switches)
158
+
159
+ | Env | Effect |
160
+ |---|---|
161
+ | `DSH_AGY_DISABLE=1` | Kill switch: the plugin registers nothing (provider + `/agy` routes) and the CLI refuses to run. |
162
+ | `DSH_AGY_FINGERPRINT_MODE=stable` | One fixed client identity per account — no per-request header randomization, no fingerprint regeneration (OMP-style fixed-client posture). Default `dynamic` keeps per-request randomization. |
163
+ | `DSH_AGY_HEALTH_INTERVAL_MS=<ms>` | Background batch health probe inside the harness (refresh + userinfo on the configured interval); off by default. |
164
+ | `AGY_CLIENT_ID` / `AGY_CLIENT_SECRET` | BYO OAuth app escape hatch: override the embedded public Antigravity client credentials. |
165
+
129
166
  ### About cache hits: why not 99% like DeepSeek V4?
130
167
 
131
168
  Bottom line: the cache hit strategy is decided by the model provider's cache