dsh-oauth-login 0.2.9 → 0.2.10

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/README.en.md CHANGED
@@ -9,7 +9,7 @@
9
9
  Open **Settings → Plugins → Add plugin** and enter this in “Package name or address”:
10
10
 
11
11
  ```text
12
- dsh-oauth-login@0.2.9
12
+ dsh-oauth-login@0.2.10
13
13
  ```
14
14
 
15
15
  The desktop plugin manager owns the Desktop profile and bundled package manager. This release includes built `lib/`; normal use needs no clone, build, or DSHX installation. Follow the app if it asks you to reload or reopen after installation.
@@ -17,7 +17,7 @@ The desktop plugin manager owns the Desktop profile and bundled package manager.
17
17
  ### Web CLI
18
18
 
19
19
  ```sh
20
- dsh plugin --profile web add dsh-oauth-login@0.2.9
20
+ dsh plugin --profile web add dsh-oauth-login@0.2.10
21
21
  ```
22
22
 
23
23
  This official CLI command writes only the `web` profile; it cannot modify the Desktop App profile. Follow the installer's activation result and reopen the original launcher only when a restart is required.
@@ -47,7 +47,7 @@ That `github:` command works because this package declares `dsh.bundle.patch` an
47
47
  If `dsh` is not on PATH:
48
48
 
49
49
  ```sh
50
- npx @deepseek-ai/dsh plugin --profile web add dsh-oauth-login@0.2.9
50
+ npx @deepseek-ai/dsh plugin --profile web add dsh-oauth-login@0.2.10
51
51
  ```
52
52
 
53
53
  Use `file:` only when you are editing a local clone (development/local testing; do not drop the prefix):
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  打开 **设置 → 插件 → 添加插件**,在“包名或地址”中输入:
10
10
 
11
11
  ```text
12
- dsh-oauth-login@0.2.9
12
+ dsh-oauth-login@0.2.10
13
13
  ```
14
14
 
15
15
  桌面端插件管理器负责 Desktop profile 和内置包管理器。本发布已包含编译好的 `lib/`;普通使用不需要 clone、构建或安装 DSHX。若应用提示刷新或重新打开,请按提示完成。
@@ -17,7 +17,7 @@ dsh-oauth-login@0.2.9
17
17
  ### Web CLI
18
18
 
19
19
  ```sh
20
- dsh plugin --profile web add dsh-oauth-login@0.2.9
20
+ dsh plugin --profile web add dsh-oauth-login@0.2.10
21
21
  ```
22
22
 
23
23
  这条官方 CLI 命令只写入 `web` profile,不能修改 Desktop App 的 profile。按安装器的生效结果继续;只有提示需要重启时才用原启动方式重新打开 Host。
@@ -47,7 +47,7 @@ dsh plugin --profile web add dsh-oauth-login@0.2.9
47
47
  没有 `dsh` 时:
48
48
 
49
49
  ```sh
50
- npx @deepseek-ai/dsh plugin --profile web add dsh-oauth-login@0.2.9
50
+ npx @deepseek-ai/dsh plugin --profile web add dsh-oauth-login@0.2.10
51
51
  ```
52
52
 
53
53
  本机改源码时再用 `file:`(开发/本地测试;不要写成裸的 `./`):
@@ -1,7 +1,10 @@
1
1
  import { Context } from "@deepseek-ai/cordis";
2
2
  //#region src/invariant.d.ts
3
3
  declare const name = "pi-login-invariant";
4
- declare const inject: string[];
4
+ /** Record one OAuth invariant failure without the removed `ctx.invariants` service. */
5
+ declare function recordOAuthInvariant(message: string, ctx?: Context): void;
6
+ /** Report `message` when `condition` is false. A passing check stays silent. */
7
+ declare function checkOAuthInvariant(condition: boolean, message: string, ctx?: Context): void;
5
8
  declare const apply: (ctx: Context) => Promise<() => void>;
6
9
  //#endregion
7
- export { apply, inject, name };
10
+ export { apply, checkOAuthInvariant, name, recordOAuthInvariant };
package/lib/invariant.js CHANGED
@@ -1,8 +1,28 @@
1
1
  //#region src/invariant.ts
2
2
  const PACKAGE_NAME = "dsh-oauth-login";
3
3
  const name = "pi-login-invariant";
4
- const inject = ["invariants"];
5
- const install = () => {};
6
- const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
4
+ function invariantLogger(ctx) {
5
+ if (ctx === void 0 || !("logger" in ctx)) return void 0;
6
+ const logger = ctx.logger;
7
+ return typeof logger?.warn === "function" ? logger : void 0;
8
+ }
9
+ /** Record one OAuth invariant failure without the removed `ctx.invariants` service. */
10
+ function recordOAuthInvariant(message, ctx) {
11
+ const line = `[${PACKAGE_NAME}] ${message}`;
12
+ const logger = invariantLogger(ctx);
13
+ if (logger?.warn !== void 0) {
14
+ logger.warn(line);
15
+ return;
16
+ }
17
+ console.warn(line);
18
+ }
19
+ /** Report `message` when `condition` is false. A passing check stays silent. */
20
+ function checkOAuthInvariant(condition, message, ctx) {
21
+ if (!condition) recordOAuthInvariant(message, ctx);
22
+ }
23
+ const apply = (ctx) => {
24
+ checkOAuthInvariant(ctx !== void 0, "oauth invariant context is missing", ctx);
25
+ return Promise.resolve(() => {});
26
+ };
7
27
  //#endregion
8
- export { apply, inject, name };
28
+ export { apply, checkOAuthInvariant, name, recordOAuthInvariant };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-oauth-login",
3
3
  "description": "DSH-owned subscription login powered by Pi AI adapters: OAuth plus official Plan API keys, with an independent credential store.",
4
- "version": "0.2.9",
4
+ "version": "0.2.10",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org/"
@@ -25,7 +25,8 @@
25
25
  "openrouter"
26
26
  ],
27
27
  "engines": {
28
- "node": ">=22.19.0"
28
+ "node": ">=22.19.0",
29
+ "dsh": ">=0.2.0-rc.2 <0.2.2"
29
30
  },
30
31
  "type": "module",
31
32
  "main": "lib/index.js",
@@ -90,17 +91,16 @@
90
91
  },
91
92
  "peerDependencies": {
92
93
  "@deepseek-ai/cordis": "^4.0.2",
93
- "@deepseek-ai/dsh": ">=0.2.0-rc.2 <0.2.1",
94
+ "@deepseek-ai/dsh": ">=0.2.0-rc.2 <0.2.2",
94
95
  "@deepseek-ai/dsh-atomic-write": "*",
95
96
  "@deepseek-ai/dsh-attachment": "*",
96
- "@deepseek-ai/dsh-client-connection": ">=0.2.0-rc.2 <0.2.1",
97
+ "@deepseek-ai/dsh-client-connection": ">=0.2.0-rc.2 <0.2.2",
97
98
  "@deepseek-ai/dsh-home-paths": "*",
98
99
  "@deepseek-ai/dsh-host-webserver": "*",
99
- "@deepseek-ai/dsh-invariants": "*",
100
100
  "@deepseek-ai/dsh-llm": "*",
101
101
  "@deepseek-ai/dsh-llm-pi-ai": "*",
102
102
  "@deepseek-ai/schemastery": "^3.18.2",
103
- "@earendil-works/pi-ai": "^0.87.1",
103
+ "@earendil-works/pi-ai": "^1.1.0",
104
104
  "react": "^18.2.0"
105
105
  },
106
106
  "peerDependenciesMeta": {
@@ -128,9 +128,6 @@
128
128
  "@deepseek-ai/dsh-host-webserver": {
129
129
  "optional": true
130
130
  },
131
- "@deepseek-ai/dsh-invariants": {
132
- "optional": true
133
- },
134
131
  "@deepseek-ai/dsh-llm": {
135
132
  "optional": true
136
133
  },
@@ -146,32 +143,31 @@
146
143
  },
147
144
  "devDependencies": {
148
145
  "@deepseek-ai/cordis": "4.0.4",
149
- "@deepseek-ai/dsh-api-session-controller": "0.2.0-rc.2",
150
- "@deepseek-ai/dsh-atomic-write": "0.2.0-rc.2",
151
- "@deepseek-ai/dsh-attachment": "0.2.0-rc.2",
152
- "@deepseek-ai/dsh-authorization": "0.2.0-rc.2",
153
- "@deepseek-ai/dsh-brand": "0.2.0-rc.2",
154
- "@deepseek-ai/dsh-client-connection": "0.2.0-rc.2",
155
- "@deepseek-ai/dsh-client-locale": "0.2.0-rc.2",
156
- "@deepseek-ai/dsh-client-ui-conversation": "0.2.0-rc.2",
157
- "@deepseek-ai/dsh-client-ui-model-selection": "0.2.0-rc.2",
158
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
159
- "@deepseek-ai/dsh-client-ui-session": "0.2.0-rc.2",
160
- "@deepseek-ai/dsh-client-ui-settings": "0.2.0-rc.2",
161
- "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
162
- "@deepseek-ai/dsh-credentials": "0.2.0-rc.2",
163
- "@deepseek-ai/dsh-fs": "0.2.0-rc.2",
164
- "@deepseek-ai/dsh-home-paths": "0.2.0-rc.2",
165
- "@deepseek-ai/dsh-host-webserver": "0.2.0-rc.2",
166
- "@deepseek-ai/dsh-invariants": "0.2.0-rc.2",
167
- "@deepseek-ai/dsh-launch-environment": "0.2.0-rc.2",
168
- "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
169
- "@deepseek-ai/dsh-llm-pi-ai": "0.2.0-rc.2",
170
- "@deepseek-ai/dsh-settings": "0.2.0-rc.2",
171
- "@deepseek-ai/dsh-timeout": "0.2.0-rc.2",
172
- "@deepseek-ai/dsh-util-values": "0.2.0-rc.2",
146
+ "@deepseek-ai/dsh-api-session-controller": "0.2.1-rc.5",
147
+ "@deepseek-ai/dsh-atomic-write": "0.2.1-rc.5",
148
+ "@deepseek-ai/dsh-attachment": "0.2.1-rc.5",
149
+ "@deepseek-ai/dsh-authorization": "0.2.1-rc.5",
150
+ "@deepseek-ai/dsh-brand": "0.2.1-rc.5",
151
+ "@deepseek-ai/dsh-client-connection": "0.2.1-rc.5",
152
+ "@deepseek-ai/dsh-client-locale": "0.2.1-rc.5",
153
+ "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.5",
154
+ "@deepseek-ai/dsh-client-ui-model-selection": "0.2.1-rc.5",
155
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.5",
156
+ "@deepseek-ai/dsh-client-ui-session": "0.2.1-rc.5",
157
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.5",
158
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.5",
159
+ "@deepseek-ai/dsh-credentials": "0.2.1-rc.5",
160
+ "@deepseek-ai/dsh-fs": "0.2.1-rc.5",
161
+ "@deepseek-ai/dsh-home-paths": "0.2.1-rc.5",
162
+ "@deepseek-ai/dsh-host-webserver": "0.2.1-rc.5",
163
+ "@deepseek-ai/dsh-launch-environment": "0.2.1-rc.5",
164
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.5",
165
+ "@deepseek-ai/dsh-llm-pi-ai": "0.2.1-rc.5",
166
+ "@deepseek-ai/dsh-settings": "0.2.1-rc.5",
167
+ "@deepseek-ai/dsh-timeout": "0.2.1-rc.5",
168
+ "@deepseek-ai/dsh-util-values": "0.2.1-rc.5",
173
169
  "@deepseek-ai/schemastery": "3.18.4",
174
- "@earendil-works/pi-ai": "0.87.1",
170
+ "@earendil-works/pi-ai": "^1.1.0",
175
171
  "@types/node": "^22.20.0",
176
172
  "@types/react": "~18.3.1",
177
173
  "@types/semver": "7.7.1",
@@ -5,6 +5,7 @@ import type { AuthEvent, AuthPrompt } from '@earendil-works/pi-ai'
5
5
  import type { Context } from '@deepseek-ai/cordis'
6
6
  import type {} from '@deepseek-ai/dsh-client-connection'
7
7
  import type {} from '@deepseek-ai/dsh-host-webserver'
8
+
8
9
  import { loginPiProviderSession, piLoginStatus } from './auth.ts'
9
10
  import { PI_LOGIN_PROVIDERS, requirePiLoginProvider } from './catalog.ts'
10
11
  import type { PiLoginProvider } from './catalog.ts'
package/src/invariant.ts CHANGED
@@ -1,12 +1,36 @@
1
1
  import type { Context } from '@deepseek-ai/cordis'
2
- import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
3
2
 
4
3
  const PACKAGE_NAME = 'dsh-oauth-login'
5
4
 
6
5
  export const name = 'pi-login-invariant'
7
- export const inject = ['invariants']
8
6
 
9
- const install: InvariantInstaller = () => {}
7
+ interface InvariantLogger {
8
+ warn?: (message: string) => void
9
+ }
10
10
 
11
- export const apply = (ctx: Context): Promise<() => void> =>
12
- Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
11
+ function invariantLogger(ctx?: Context): InvariantLogger | undefined {
12
+ if (ctx === undefined || !('logger' in ctx)) return undefined
13
+ const logger = (ctx as Context & { logger?: InvariantLogger }).logger
14
+ return typeof logger?.warn === 'function' ? logger : undefined
15
+ }
16
+
17
+ /** Record one OAuth invariant failure without the removed `ctx.invariants` service. */
18
+ export function recordOAuthInvariant(message: string, ctx?: Context): void {
19
+ const line = `[${PACKAGE_NAME}] ${message}`
20
+ const logger = invariantLogger(ctx)
21
+ if (logger?.warn !== undefined) {
22
+ logger.warn(line)
23
+ return
24
+ }
25
+ console.warn(line)
26
+ }
27
+
28
+ /** Report `message` when `condition` is false. A passing check stays silent. */
29
+ export function checkOAuthInvariant(condition: boolean, message: string, ctx?: Context): void {
30
+ if (!condition) recordOAuthInvariant(message, ctx)
31
+ }
32
+
33
+ export const apply = (ctx: Context): Promise<() => void> => {
34
+ checkOAuthInvariant(ctx !== undefined, 'oauth invariant context is missing', ctx)
35
+ return Promise.resolve(() => {})
36
+ }