@tnnevol/dsh-codex-auth 0.1.2-rc.1.4 → 0.1.5-rc.2
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.md +19 -2
- package/compatibility.json +2 -1
- package/lib/{auth-DQlapSCa.js → auth-BQNZ__ZK.js} +15 -3
- package/lib/auth-paths.d.ts +2 -1
- package/lib/auth-paths.js +2 -1
- package/lib/auth.js +1 -1
- package/lib/client.js +2892 -2510
- package/lib/index.d.ts +14 -0
- package/lib/index.js +50 -7
- package/lib/style.css +1 -1
- package/package.json +51 -48
package/README.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @tnnevol/dsh-codex-auth
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
DSH 的 ChatGPT / Codex 登录、模型目录和账号用量插件。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
插件发布在 npm,要求 DSH `0.1.5-rc.2` 。安装命令:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
dsh plugin --profile web add @tnnevol/dsh-codex-auth@0.1.5-rc.2
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
装完重启 Web profile 即可。如果提示 `cannot resolve profile bundle`,重新跑一次上面的安装命令,别只在 `package.json` 里手动补 bundle。
|
|
14
|
+
|
|
15
|
+
## 功能
|
|
16
|
+
|
|
17
|
+
- 浏览器授权登录 ChatGPT / Codex,不需要选工作空间,也不用手填 Key
|
|
18
|
+
- 设置全局默认模型和思考强度,新建会话自动采用
|
|
19
|
+
- 对话输入区右侧显示当前 Codex 模型的用量状态,可展开看剩余额度和重置时间
|
|
20
|
+
- 读取并在模型选择器里展示 Codex 模型目录
|
|
21
|
+
|
|
22
|
+
更完整的说明见线上文档:<https://fnapps-doc.tnnevol.cn/plugins/dsh-codex-auth>
|
package/compatibility.json
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
"node": "^22.19.0 || >=24.0.0"
|
|
5
5
|
},
|
|
6
6
|
"dshPluginApi": {
|
|
7
|
-
"version": "0.1.
|
|
7
|
+
"version": "0.1.5-rc.2",
|
|
8
8
|
"packages": [
|
|
9
9
|
"@deepseek-ai/dsh-atomic-write",
|
|
10
10
|
"@deepseek-ai/dsh-attachment",
|
|
11
|
+
"@deepseek-ai/dsh-client-ui-session",
|
|
11
12
|
"@deepseek-ai/dsh-credentials",
|
|
12
13
|
"@deepseek-ai/dsh-home-paths",
|
|
13
14
|
"@deepseek-ai/dsh-host-webserver",
|
|
@@ -4,10 +4,22 @@ import { mkdir, readFile, rm, stat } from "node:fs/promises";
|
|
|
4
4
|
import { dirname, join, resolve } from "node:path";
|
|
5
5
|
import { withFileLock, writeFileAtomic } from "@deepseek-ai/dsh-atomic-write";
|
|
6
6
|
import { resolveDshHome } from "@deepseek-ai/dsh-home-paths";
|
|
7
|
-
//#region src/
|
|
8
|
-
/**
|
|
7
|
+
//#region src/contracts/provider.ts
|
|
8
|
+
/**
|
|
9
|
+
* Codex 供应商标识:host 与 client 共用的契约。
|
|
10
|
+
*
|
|
11
|
+
* 这个常量原先定义在 `host/store.ts`,那个文件 import 了 `node:fs/promises`
|
|
12
|
+
* 和 `dsh-atomic-write`,浏览器端不能引入。客户端的用量图标需要按选中模型的
|
|
13
|
+
* 供应商判断显隐,因此把常量挪到这里,两端引用同一个值,不在组件里再写一份
|
|
14
|
+
* 字面量——两处字符串漂移过一次就会静默不匹配。
|
|
15
|
+
*
|
|
16
|
+
* @module dsh-codex-auth/provider
|
|
17
|
+
*/
|
|
9
18
|
/** pi-ai provider id used by ChatGPT Codex OAuth. */
|
|
10
19
|
const CODEX_PROVIDER = "openai-codex";
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/host/store.ts
|
|
22
|
+
/** Owner-only persistent storage for the shared OpenAI Codex OAuth document. */
|
|
11
23
|
/** Kept compatible with dsh-codex-connect so a login can be reused. */
|
|
12
24
|
const CODEX_AUTH_FILENAME = ".openai-codex-auth.json";
|
|
13
25
|
const AUTH_FORMAT_VERSION = 1;
|
|
@@ -139,4 +151,4 @@ async function codexAuthStatus(store = new CodexCredentialStore()) {
|
|
|
139
151
|
} : { authenticated: false };
|
|
140
152
|
}
|
|
141
153
|
//#endregion
|
|
142
|
-
export {
|
|
154
|
+
export { CODEX_PROVIDER as a, CodexCredentialStore as i, loginCodex as n, logoutCodex as r, codexAuthStatus as t };
|
package/lib/auth-paths.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/** Browser-facing paths owned by the standalone Codex authentication plugin. */
|
|
3
3
|
declare const CODEX_AUTH_STATUS_PATH = "/plugins/dsh-codex-auth-plugin/auth/status";
|
|
4
4
|
declare const CODEX_AUTH_LOGIN_PATH = "/plugins/dsh-codex-auth-plugin/auth/login";
|
|
5
|
+
declare const CODEX_AUTH_CANCEL_PATH = "/plugins/dsh-codex-auth-plugin/auth/cancel";
|
|
5
6
|
declare const CODEX_AUTH_LOGOUT_PATH = "/plugins/dsh-codex-auth-plugin/auth/logout";
|
|
6
7
|
declare const CODEX_USAGE_PATH = "/plugins/dsh-codex-auth-plugin/auth/usage";
|
|
7
8
|
/** Same-origin endpoint for the DSH-wide Codex default model selection. */
|
|
@@ -9,4 +10,4 @@ declare const CODEX_GLOBAL_MODEL_PATH = "/plugins/dsh-codex-auth-plugin/auth/glo
|
|
|
9
10
|
/** Same-origin endpoint that refreshes the OpenAI Codex route's model catalog. */
|
|
10
11
|
declare const CODEX_MODEL_REFRESH_PATH = "/plugins/dsh-codex-auth-plugin/auth/refresh-models";
|
|
11
12
|
//#endregion
|
|
12
|
-
export { CODEX_AUTH_LOGIN_PATH, CODEX_AUTH_LOGOUT_PATH, CODEX_AUTH_STATUS_PATH, CODEX_GLOBAL_MODEL_PATH, CODEX_MODEL_REFRESH_PATH, CODEX_USAGE_PATH };
|
|
13
|
+
export { CODEX_AUTH_CANCEL_PATH, CODEX_AUTH_LOGIN_PATH, CODEX_AUTH_LOGOUT_PATH, CODEX_AUTH_STATUS_PATH, CODEX_GLOBAL_MODEL_PATH, CODEX_MODEL_REFRESH_PATH, CODEX_USAGE_PATH };
|
package/lib/auth-paths.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/** Browser-facing paths owned by the standalone Codex authentication plugin. */
|
|
3
3
|
const CODEX_AUTH_STATUS_PATH = "/plugins/dsh-codex-auth-plugin/auth/status";
|
|
4
4
|
const CODEX_AUTH_LOGIN_PATH = "/plugins/dsh-codex-auth-plugin/auth/login";
|
|
5
|
+
const CODEX_AUTH_CANCEL_PATH = "/plugins/dsh-codex-auth-plugin/auth/cancel";
|
|
5
6
|
const CODEX_AUTH_LOGOUT_PATH = "/plugins/dsh-codex-auth-plugin/auth/logout";
|
|
6
7
|
const CODEX_USAGE_PATH = "/plugins/dsh-codex-auth-plugin/auth/usage";
|
|
7
8
|
/** Same-origin endpoint for the DSH-wide Codex default model selection. */
|
|
@@ -9,4 +10,4 @@ const CODEX_GLOBAL_MODEL_PATH = "/plugins/dsh-codex-auth-plugin/auth/global-mode
|
|
|
9
10
|
/** Same-origin endpoint that refreshes the OpenAI Codex route's model catalog. */
|
|
10
11
|
const CODEX_MODEL_REFRESH_PATH = "/plugins/dsh-codex-auth-plugin/auth/refresh-models";
|
|
11
12
|
//#endregion
|
|
12
|
-
export { CODEX_AUTH_LOGIN_PATH, CODEX_AUTH_LOGOUT_PATH, CODEX_AUTH_STATUS_PATH, CODEX_GLOBAL_MODEL_PATH, CODEX_MODEL_REFRESH_PATH, CODEX_USAGE_PATH };
|
|
13
|
+
export { CODEX_AUTH_CANCEL_PATH, CODEX_AUTH_LOGIN_PATH, CODEX_AUTH_LOGOUT_PATH, CODEX_AUTH_STATUS_PATH, CODEX_GLOBAL_MODEL_PATH, CODEX_MODEL_REFRESH_PATH, CODEX_USAGE_PATH };
|
package/lib/auth.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as loginCodex, r as logoutCodex, t as codexAuthStatus } from "./auth-
|
|
1
|
+
import { n as loginCodex, r as logoutCodex, t as codexAuthStatus } from "./auth-BQNZ__ZK.js";
|
|
2
2
|
export { codexAuthStatus, loginCodex, logoutCodex };
|