dsh-oauth-login 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.
- package/INSTALL.md +59 -0
- package/INSTALL.zh.md +45 -0
- package/LICENSE +201 -0
- package/README.en.md +104 -0
- package/README.md +104 -0
- package/README.zh.md +3 -0
- package/SECURITY.md +33 -0
- package/cordis.patch.yml +5 -0
- package/docs/network-proxy.md +45 -0
- package/docs/openrouter-sync.md +84 -0
- package/docs/screenshots/01-providers-signed-out.png +0 -0
- package/docs/screenshots/03-copilot-signing-in.png +0 -0
- package/docs/screenshots/04-mixed-live-states.png +0 -0
- package/docs/screenshots/05-copilot-sign-in.gif +0 -0
- package/docs/screenshots/06-cli-status-store.png +0 -0
- package/lib/bin.d.ts +5 -0
- package/lib/bin.js +2132 -0
- package/lib/client.js +1915 -0
- package/lib/client.js.map +1 -0
- package/lib/index.d.ts +482 -0
- package/lib/index.js +3105 -0
- package/lib/invariant.d.ts +7 -0
- package/lib/invariant.js +8 -0
- package/package.json +180 -0
- package/src/adapter.ts +207 -0
- package/src/auth-routes.ts +654 -0
- package/src/auth.ts +76 -0
- package/src/bin.ts +185 -0
- package/src/catalog.ts +129 -0
- package/src/client/OpenRouterSyncStatus.tsx +66 -0
- package/src/client/PiLoginSettings.tsx +470 -0
- package/src/client/ProxySettings.tsx +123 -0
- package/src/client/SearchableModelSelect.tsx +595 -0
- package/src/client/draft-input.ts +12 -0
- package/src/client/index.tsx +71 -0
- package/src/client/locales.ts +176 -0
- package/src/client/login-input-copy.ts +34 -0
- package/src/client/login-window.ts +24 -0
- package/src/client/model-filter.ts +45 -0
- package/src/client/openrouter-store.ts +122 -0
- package/src/client/proxy-draft.ts +57 -0
- package/src/extra-models.ts +201 -0
- package/src/hosted-capture.ts +41 -0
- package/src/hosted-images.ts +154 -0
- package/src/http.ts +241 -0
- package/src/ids.ts +17 -0
- package/src/index.ts +183 -0
- package/src/invariant.ts +12 -0
- package/src/model-error-hint.ts +98 -0
- package/src/native-tools.ts +442 -0
- package/src/oauth-refresh.ts +49 -0
- package/src/openrouter-catalog.ts +245 -0
- package/src/openrouter-free.ts +76 -0
- package/src/openrouter-models.ts +155 -0
- package/src/openrouter-types.ts +40 -0
- package/src/plugin-config.ts +30 -0
- package/src/provider.ts +137 -0
- package/src/proxy-config.ts +61 -0
- package/src/proxy-store.ts +45 -0
- package/src/proxy-transport.ts +220 -0
- package/src/redact.ts +22 -0
- package/src/responses-tap.ts +97 -0
- package/src/session.ts +104 -0
- package/src/store.ts +234 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# OpenRouter model sync
|
|
2
|
+
|
|
3
|
+
## Request and scope
|
|
4
|
+
|
|
5
|
+
Use the normal DSH OAuth plugin to discover current OpenRouter models and make
|
|
6
|
+
free models easy to select. Preserve the existing two-level composer menu,
|
|
7
|
+
search, reasoning selection, GLM key-input fix and all other providers. Do not
|
|
8
|
+
change DSH core, credentials, existing conversations, or the selected model.
|
|
9
|
+
|
|
10
|
+
## Runtime contract
|
|
11
|
+
|
|
12
|
+
- After OpenRouter login: refresh the public Models API immediately.
|
|
13
|
+
- Startup: show the persisted catalog; refresh when older than 15 minutes.
|
|
14
|
+
- While signed in: one Host-owned timer refreshes every 15 minutes. Logout and
|
|
15
|
+
plugin disposal cancel the timer and in-flight refresh.
|
|
16
|
+
- Opening the menu reads cached metadata and asks for an async stale refresh.
|
|
17
|
+
- Manual refresh is coalesced across windows and has a 60-second cooldown.
|
|
18
|
+
- A network, empty-data or partial-response failure preserves the last-good
|
|
19
|
+
list and timestamp. Cache lives beside the plugin credential file in
|
|
20
|
+
.dsh-oauth-openrouter-models.json, with no tokens or keys.
|
|
21
|
+
- New models enter the actual pi-ai-backed DSH adapter, not only the menu.
|
|
22
|
+
- Full live catalogs replace obsolete builtin entries; missing current
|
|
23
|
+
selections are not silently changed to another model.
|
|
24
|
+
|
|
25
|
+
## Price and safety contract
|
|
26
|
+
|
|
27
|
+
The free badge uses official prices, including extra unit costs. Missing or
|
|
28
|
+
invalid prices and conditional pricing overrides are not labelled free.
|
|
29
|
+
The expiration_date field means endpoint deprecation, not a promotion deadline.
|
|
30
|
+
Unknown promotion deadlines are not invented.
|
|
31
|
+
|
|
32
|
+
Free requests pin the model ID, set all supported provider price caps to zero,
|
|
33
|
+
disable provider/model fallbacks, disable known paid OpenRouter plugins, and
|
|
34
|
+
reject hosted tools or file/audio processing. Ordinary DSH function tools stay
|
|
35
|
+
available. A model previously advertised as free keeps its zero-price guard
|
|
36
|
+
even after a restart or price change. A promotion ending never opts the user
|
|
37
|
+
into a paid call. Explicit paid model variants remain separate choices.
|
|
38
|
+
|
|
39
|
+
Platform-enforced account/organization plugins can override per-request
|
|
40
|
+
settings. DSH cannot override those policies: users must disable forced paid
|
|
41
|
+
plugins in OpenRouter before relying on free inference. The UI states this
|
|
42
|
+
limit; it does not promise that all account-level services are free.
|
|
43
|
+
|
|
44
|
+
Official contracts:
|
|
45
|
+
[Models API](https://openrouter.ai/docs/guides/overview/models),
|
|
46
|
+
[price caps](https://openrouter.ai/docs/guides/routing/provider-selection#max-price),
|
|
47
|
+
[plugins](https://openrouter.ai/docs/guides/features/plugins),
|
|
48
|
+
[free router](https://openrouter.ai/docs/guides/routing/routers/free-router).
|
|
49
|
+
|
|
50
|
+
## Native UI contract
|
|
51
|
+
|
|
52
|
+
Clarity-first, single-agent implementation. Keep the host's font, compact
|
|
53
|
+
menu density, theme tokens and two-level layout. No new font, imagery,
|
|
54
|
+
animation, dashboard or layout family. The visual cue is a small green
|
|
55
|
+
text badge, never color alone. A stale free badge becomes neutral and says
|
|
56
|
+
it is cached. Model names may truncate; price/safety state must not.
|
|
57
|
+
|
|
58
|
+
Show All / Free only (OpenRouter), tool capability, context size, last sync,
|
|
59
|
+
refresh feedback and a retry path. The OpenRouter settings card shares the
|
|
60
|
+
same client metadata store. A background update cannot steal keyboard focus
|
|
61
|
+
or change selection. Controls wrap at narrow widths; menu scrolling is
|
|
62
|
+
internal. No token/key values are needed for browser verification.
|
|
63
|
+
|
|
64
|
+
## OKF decision bindings
|
|
65
|
+
|
|
66
|
+
| Active concept | Decision | Target | Verification |
|
|
67
|
+
| --- | --- | --- | --- |
|
|
68
|
+
| request-integrity | Normal DSH only; no core or selection mutation | Adapter, menu, deployment | Route tests; exact Host/PID verification |
|
|
69
|
+
| accessibility-usability | Text badges, named controls, stable focus | Filters, refresh, model rows | Keyboard/focus and screen-state tests |
|
|
70
|
+
| responsive-interaction | Wrap status/filters; bounded, scrollable menu | Composer popover | Desktop and narrow screenshots/geometry |
|
|
71
|
+
| state-language | Distinguish cached, stale, refreshing, failed and signed out | Shared sync status | Failure/cooldown tests and visible state review |
|
|
72
|
+
| typography-system | Keep native type; wrap critical status; separate model ID | Model metadata rows | Long-label and mixed Chinese/English rendering |
|
|
73
|
+
|
|
74
|
+
Support: existing DSH theme/source, web-product/content-model branches,
|
|
75
|
+
visual-verification and quality-gates. A compact feature contract is used
|
|
76
|
+
instead of introducing a separate design system for this existing component.
|
|
77
|
+
|
|
78
|
+
## Acceptance
|
|
79
|
+
|
|
80
|
+
Unit checks cover parsing, free classification, cache restart, refresh
|
|
81
|
+
frequency/coalescing, logout races, real adapter resolution, and final outbound
|
|
82
|
+
payload guards. Rendered checks cover search/free filtering, manual refresh,
|
|
83
|
+
cached failure, focus, unchanged selection and narrow layout. dshx check,
|
|
84
|
+
artifact sync and running Host/UI evidence are separate delivery gates.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|