@tnnevol/dsh-codex-auth 0.1.2-rc.1.2 → 0.1.2-rc.1.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/lib/{auth-DyHxRsSd.d.ts → auth-BnY8fFpi.d.ts} +1 -6
- package/lib/{auth-BdEwtK4R.js → auth-DQlapSCa.js} +5 -5
- package/lib/auth.d.ts +1 -1
- package/lib/auth.js +1 -1
- package/lib/client.js +8300 -8297
- package/lib/index.d.ts +2 -2
- package/lib/index.js +22 -7
- package/lib/style.css +1 -1
- package/package.json +2 -2
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { AuthInteraction, Credential, CredentialInfo, CredentialStore } from "@earendil-works/pi-ai";
|
|
2
2
|
//#region src/host/store.d.ts
|
|
3
|
-
/** pi-ai provider id used by ChatGPT Codex OAuth. */
|
|
4
|
-
declare const CODEX_PROVIDER = "openai-codex";
|
|
5
|
-
/** Kept compatible with dsh-codex-connect so a login can be reused. */
|
|
6
|
-
declare const CODEX_AUTH_FILENAME = ".openai-codex-auth.json";
|
|
7
|
-
declare function codexAuthPath(dshHome?: string): string;
|
|
8
3
|
/** File-backed CredentialStore that owns only the Codex OAuth route. */
|
|
9
4
|
declare class CodexCredentialStore implements CredentialStore {
|
|
10
5
|
readonly filename: string;
|
|
@@ -28,4 +23,4 @@ declare function logoutCodex(store?: CodexCredentialStore): Promise<void>;
|
|
|
28
23
|
/** Read login state without refreshing the token. */
|
|
29
24
|
declare function codexAuthStatus(store?: CodexCredentialStore): Promise<CodexAuthStatus>;
|
|
30
25
|
//#endregion
|
|
31
|
-
export {
|
|
26
|
+
export { CodexCredentialStore as a, logoutCodex as i, codexAuthStatus as n, loginCodex as r, CodexAuthStatus as t };
|
|
@@ -34,9 +34,9 @@ function parseDocument(text, filename) {
|
|
|
34
34
|
}
|
|
35
35
|
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error(`codex-auth: ${filename} must contain an object`);
|
|
36
36
|
const document = value;
|
|
37
|
-
if (document
|
|
37
|
+
if (document.version !== AUTH_FORMAT_VERSION) throw new Error(`codex-auth: ${filename} has unsupported auth format version ${String(document.version)}`);
|
|
38
38
|
if (Object.keys(document).some((key) => key !== "version" && key !== "credential")) throw new Error(`codex-auth: ${filename} contains an unknown top-level field`);
|
|
39
|
-
const raw = document
|
|
39
|
+
const raw = document.credential;
|
|
40
40
|
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) throw new Error(`codex-auth: ${filename} credential must be an object`);
|
|
41
41
|
const credential = raw;
|
|
42
42
|
if (Object.keys(credential).some((key) => ![
|
|
@@ -46,13 +46,13 @@ function parseDocument(text, filename) {
|
|
|
46
46
|
"expires",
|
|
47
47
|
"accountId"
|
|
48
48
|
].includes(key))) throw new Error(`codex-auth: ${filename} credential contains an unknown field`);
|
|
49
|
-
if (credential
|
|
49
|
+
if (credential.type !== "oauth") throw new Error(`codex-auth: ${filename} credential type must be oauth`);
|
|
50
50
|
for (const key of [
|
|
51
51
|
"access",
|
|
52
52
|
"refresh",
|
|
53
53
|
"accountId"
|
|
54
54
|
]) if (typeof credential[key] !== "string" || credential[key].length === 0) throw new Error(`codex-auth: ${filename} credential ${key} must be a non-empty string`);
|
|
55
|
-
if (typeof credential
|
|
55
|
+
if (typeof credential.expires !== "number" || !Number.isFinite(credential.expires) || credential.expires <= 0) throw new Error(`codex-auth: ${filename} credential expires must be a positive finite number`);
|
|
56
56
|
return {
|
|
57
57
|
version: AUTH_FORMAT_VERSION,
|
|
58
58
|
credential
|
|
@@ -139,4 +139,4 @@ async function codexAuthStatus(store = new CodexCredentialStore()) {
|
|
|
139
139
|
} : { authenticated: false };
|
|
140
140
|
}
|
|
141
141
|
//#endregion
|
|
142
|
-
export {
|
|
142
|
+
export { CodexCredentialStore as a, CODEX_PROVIDER as i, loginCodex as n, logoutCodex as r, codexAuthStatus as t };
|
package/lib/auth.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as logoutCodex, n as codexAuthStatus, r as loginCodex, t as CodexAuthStatus } from "./auth-
|
|
1
|
+
import { i as logoutCodex, n as codexAuthStatus, r as loginCodex, t as CodexAuthStatus } from "./auth-BnY8fFpi.js";
|
|
2
2
|
export { CodexAuthStatus, codexAuthStatus, loginCodex, logoutCodex };
|
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-DQlapSCa.js";
|
|
2
2
|
export { codexAuthStatus, loginCodex, logoutCodex };
|