dsh-agy 0.2.11 → 0.3.0

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 (46) hide show
  1. package/README.md +67 -11
  2. package/cordis.patch.yml +4 -2
  3. package/lib/{accounts-C0Oj3tQA.mjs → accounts-CkaHhb5H.mjs} +1155 -646
  4. package/lib/accounts-CkaHhb5H.mjs.map +1 -0
  5. package/lib/{catalog-bfGIyoba.mjs → catalog-BgdDVJEB.mjs} +17 -2
  6. package/lib/{catalog-bfGIyoba.mjs.map → catalog-BgdDVJEB.mjs.map} +1 -1
  7. package/lib/cli/index.d.mts +10 -1
  8. package/lib/cli/index.d.mts.map +1 -1
  9. package/lib/cli/index.mjs +21 -8
  10. package/lib/cli/index.mjs.map +1 -1
  11. package/lib/client.js +2168 -14
  12. package/lib/{constants-BFKYjOmh.mjs → constants-Db4tmyfb.mjs} +79 -14
  13. package/lib/constants-Db4tmyfb.mjs.map +1 -0
  14. package/lib/{exchange-dQm2mjJ5.mjs → exchange-yZPIZumk.mjs} +27 -12
  15. package/lib/exchange-yZPIZumk.mjs.map +1 -0
  16. package/lib/identity-Ci8EGc1F.mjs +96 -0
  17. package/lib/identity-Ci8EGc1F.mjs.map +1 -0
  18. package/lib/{import-D7R0GpRr.mjs → import-BaFULQnH.mjs} +11 -7
  19. package/lib/import-BaFULQnH.mjs.map +1 -0
  20. package/lib/index.mjs +2 -2
  21. package/lib/{models-ClGTQBLY.mjs → models-BGuwl50d.mjs} +35 -22
  22. package/lib/models-BGuwl50d.mjs.map +1 -0
  23. package/lib/plugin-common-B1MG00JT.mjs +1313 -0
  24. package/lib/plugin-common-B1MG00JT.mjs.map +1 -0
  25. package/lib/{proxy-DLvX8yxv.mjs → proxy-DfaL73mL.mjs} +52 -3
  26. package/lib/proxy-DfaL73mL.mjs.map +1 -0
  27. package/lib/quota-summary-5CypVffd.mjs +127 -0
  28. package/lib/quota-summary-5CypVffd.mjs.map +1 -0
  29. package/lib/{translate-pdeVGFpT.mjs → translate-BQu8HLvB.mjs} +57 -26
  30. package/lib/translate-BQu8HLvB.mjs.map +1 -0
  31. package/lib/web/plugin.d.mts +1 -0
  32. package/lib/web/plugin.d.mts.map +1 -1
  33. package/lib/web/plugin.mjs +651 -1701
  34. package/lib/web/plugin.mjs.map +1 -1
  35. package/package.json +17 -4
  36. package/lib/accounts-C0Oj3tQA.mjs.map +0 -1
  37. package/lib/constants-BFKYjOmh.mjs.map +0 -1
  38. package/lib/exchange-dQm2mjJ5.mjs.map +0 -1
  39. package/lib/identity-DsftHTJC.mjs +0 -35
  40. package/lib/identity-DsftHTJC.mjs.map +0 -1
  41. package/lib/import-D7R0GpRr.mjs.map +0 -1
  42. package/lib/models-ClGTQBLY.mjs.map +0 -1
  43. package/lib/plugin-common-DtF_PyxH.mjs +0 -254
  44. package/lib/plugin-common-DtF_PyxH.mjs.map +0 -1
  45. package/lib/proxy-DLvX8yxv.mjs.map +0 -1
  46. package/lib/translate-pdeVGFpT.mjs.map +0 -1
package/README.md CHANGED
@@ -19,18 +19,28 @@ fingerprinting, and both CLI and web management.
19
19
  selection (family-scoped quotas, OMP-aligned ranking), automatic rotation on
20
20
  rate limits, per-account cooldown to the real reset time, per-account device
21
21
  fingerprints.
22
- - **Quota dashboard**: only active when DSH Web is running; append `/agy` to
23
- your dsh web address: login, account management, per-model quota bars, model
24
- testing, credential export/import, fingerprint management.
22
+ - **Inline Settings UI**: an Antigravity section inside DSH Settings with four
23
+ tabs — accounts (login, activation, per-model quota bars, test calls,
24
+ fingerprint and proxy management), models (per-model visibility), usage
25
+ (cumulative token and request statistics), and credentials (import/export).
26
+ No separate page: the surface only exists where DSH Settings does.
27
+ - **Model visibility toggles**: hide individual models from the DSH model
28
+ selector. Blacklist semantics — only models you switch off are hidden, so
29
+ models the server adds later stay visible.
30
+ - **Usage statistics**: input / output / cache-read / cache-write tokens,
31
+ request counts, failures, rate limits, rotations, latency and
32
+ time-to-first-token, aggregated by account and by model. Includes calls that
33
+ never pass through DSH (CLI, verification, test calls), which no
34
+ session-based statistic can see.
25
35
  - **CLI**: `dsh-agy login|status|import|verify|logout` works standalone, with or
26
36
  without a harness.
27
37
 
28
38
  ## Screenshots
29
39
 
30
- The `/agy` dashboard inside DSH Web — account cards, per-model quota bars, and
40
+ The Antigravity section inside DSH Settings — accounts, per-model quota, and
31
41
  one-shot model tests:
32
42
 
33
- ![dsh-agy dashboard](https://raw.githubusercontent.com/chaos-03x/dsh-agy/main/assets/screenshot_en.png)
43
+ ![dsh-agy settings](https://raw.githubusercontent.com/chaos-03x/dsh-agy/main/assets/screenshot_en.png)
34
44
 
35
45
  ## Quickstart
36
46
 
@@ -46,11 +56,12 @@ dsh plugin --profile web add dsh-agy
46
56
  # 2. Launch DSH Web
47
57
  dsh web
48
58
 
49
- # 3. Open dashboard at http://127.0.0.1:3080/agy
50
- # Click "Login with Google", complete OAuth authorization, and start using the agy provider
59
+ # 3. Open Settings → Antigravity, then click "登录" (Login) in that section
60
+ # Complete OAuth authorization, and start using the agy provider
51
61
  ```
52
62
 
53
- Open **Settings → Plugins → Antigravity → Open Antigravity dashboard**; the button opens `/agy` in a new tab.
63
+ The section lives in **Settings → Antigravity** (top-level, alongside General
64
+ and Models). There is no separate dashboard page: the old `/agy` URL is gone.
54
65
 
55
66
  ### Path B: Headless / Terminal Only (Standalone CLI)
56
67
 
@@ -99,7 +110,9 @@ dsh-agy status # shows proxy column (masked host:po
99
110
 
100
111
  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.
101
112
 
102
- 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`.
113
+ Settings → Antigravity → account detail shows a Proxy row `[input] [Save][Clear][Test]` with the masked `host:port`; writes and probes go over the management RPC (`account.proxy` / `account.proxyTest`). Save requires a non-empty value — clearing an existing proxy is the explicit `Clear` action, never an accidental empty Save. `Test` probes whatever is in the box, so an UNSAVED proxy can be checked before it is written; it reports reachable/unreachable in the notice line, and is disabled (with the reason on its tooltip) when there is nothing to probe.
114
+
115
+ The toolbar's `Refresh` reloads the account list and usage ledger, and additionally re-measures the 5h/weekly quota windows past their 10-minute TTL cache — that forced probe reports how many accounts it refreshed, so a click is never silent. Automatic reloads respect the TTL and spend no upstream call.
103
116
 
104
117
  ### Path C: Local Development & Link
105
118
 
@@ -122,7 +135,7 @@ npm uninstall -g dsh-agy
122
135
 
123
136
  # 3. Optional: delete local account data (accounts + master key + fingerprint override)
124
137
  dsh-agy logout # remove accounts first (or skip)
125
- rm -f ~/.dsh/agy-accounts.json
138
+ rm -f ~/.dsh/agy-accounts.json ~/.dsh/agy-stats.json ~/.dsh/agy-models.json
126
139
  # remove only the AGY_MASTER_KEY line from ~/.dsh/.credentials.yaml — keep other keys!
127
140
  rm -f ~/.dsh/agy-fingerprint-data.json # only if you created an override
128
141
 
@@ -135,6 +148,42 @@ valid until it expires or you revoke it in your Google account security settings
135
148
 
136
149
  ## Other things you may care about
137
150
 
151
+ ### Thinking budget (reasoning effort)
152
+
153
+ A thinking budget is a hidden parameter in the API that controls how hard the
154
+ model thinks. Upstream gives a few of its values names, and those names are what
155
+ you see as reasoning effort (`high` / `medium` / `low`) in the model picker. A
156
+ budget replaces the `high` / `medium` / `low` value that would otherwise be sent,
157
+ rather than stacking with it.
158
+
159
+ With that in mind, here is what a custom budget can do:
160
+
161
+ - **Make a low tier think more** — put a larger value on the `Low` row.
162
+ - **Make a high tier think less** (faster, cheaper) — put a smaller value on the
163
+ `High` row.
164
+ - **Maximum thinking** — just select `High`; no value needed.
165
+ - **Back to that tier's default** — clear the row.
166
+
167
+ The model adapts how long it thinks to the difficulty of the question, within the
168
+ budget. This table shows what Gemini 3.8 Flash actually spent (in tokens) under
169
+ different budgets, on questions of different difficulty:
170
+
171
+ | Setting | Easy | Medium | Hard |
172
+ |---|---|---|---|
173
+ | Default | ~135 | ~1,100 | ~48,700 |
174
+ | Low | ~50 | 0 | ~9,000 |
175
+ | Medium | ~150 | ~870 | ~60,400 |
176
+ | High | ~165 | ~1,855 | ~63,400 |
177
+ | Entered 65535 | ~185 | ~2,130 | ~62,900 |
178
+
179
+ Entering the maximum (65535) is identical to selecting High on the hard question,
180
+ but raises thinking on the easy and medium ones by about 10–15%. The value alone
181
+ decides the effect — the same number entered on any row sends the same request.
182
+
183
+ Note: the hard question is a combinatorial derivation (derive a tiling recurrence
184
+ and compute term 40), the medium one a number-theory proof (prove n⁴+4 is always
185
+ composite), and the easy one a two-digit multiplication.
186
+
138
187
  ### Rotation mechanics
139
188
 
140
189
  Usage-aware selection: when several accounts are available, requests rank them
@@ -160,7 +209,7 @@ counter.
160
209
 
161
210
  | Env | Effect |
162
211
  |---|---|
163
- | `DSH_AGY_DISABLE=1` | Kill switch: the plugin registers nothing (provider + `/agy` routes) and the CLI refuses to run. |
212
+ | `DSH_AGY_DISABLE=1` | Kill switch: the plugin registers nothing (provider + Settings section + OAuth callback) and the CLI refuses to run. |
164
213
  | `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. |
165
214
  | `DSH_AGY_HEALTH_INTERVAL_MS=<ms>` | Background batch health probe inside the harness (refresh + userinfo on the configured interval); off by default. |
166
215
  | `AGY_CLIENT_ID` / `AGY_CLIENT_SECRET` | BYO OAuth app escape hatch: override the embedded public Antigravity client credentials. |
@@ -199,6 +248,13 @@ the context grows, bounded by the model's context window.
199
248
  in `~/.dsh/.credentials.yaml` (`AGY_MASTER_KEY`, 0600). `$DSH_HOME` relocates both.
200
249
  - Fingerprint pools (version strings, SDK clients) are user-overridable via
201
250
  `~/.dsh/agy-fingerprint-data.json` — no code release needed to keep them current.
251
+ - Model visibility: `~/.dsh/agy-models.json` (0600) — the hidden-model blacklist.
252
+ Holds only the models you switched off, so re-enabling one removes its entry.
253
+ - Usage statistics: `~/.dsh/agy-stats.json` (0600) — cumulative counters plus a
254
+ rolling 30-day window. Counts are merged under a file lock, so several
255
+ processes (Desktop, a web-profile server, the CLI) record concurrently without
256
+ losing each other's data. It stores account emails but never tokens, proxies,
257
+ or project ids.
202
258
 
203
259
  ## ⚠️ Disclaimer
204
260
 
package/cordis.patch.yml CHANGED
@@ -2,8 +2,10 @@
2
2
 
3
3
  # Install with: dsh plugin --profile <name> add dsh-agy
4
4
  # The loader inserts these rows; the main plugin registers the agy LLM adapter
5
- # routes, the web entry registers the /agy UI once ctx.webServer activates
6
- # (it stays pending in profiles without a web server).
5
+ # and the web entry registers the management RPC (`/api/agy`) plus the OAuth
6
+ # callback once ctx.webServer activates (it stays pending in profiles without a
7
+ # web server). The management UI itself is the browser half (`dsh-agy/client`),
8
+ # an inline Settings section — there is no standalone dashboard route.
7
9
 
8
10
  - insert:
9
11
  - id: dsh-agy