@eddyskywalker/dsh-chatgpt-subscription 0.91.0 → 0.91.1
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/client.js.map +1 -1
- package/lib/codemode.js +23 -14
- package/lib/index.js +1 -1
- package/lib/types/compat.d.ts +1 -1
- package/lib/types/entries/codemode.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/codemode.js
CHANGED
|
@@ -3269,26 +3269,35 @@ function isRealPtcRuntimeInstance(runtime) {
|
|
|
3269
3269
|
}
|
|
3270
3270
|
return false;
|
|
3271
3271
|
}
|
|
3272
|
+
/** 安全读取可能是 Cordis Context 代理对象上的属性:未声明 inject 的服务属性优先走 `get()` 并吞掉反射异常。 */
|
|
3273
|
+
function safeReadProp(target, key) {
|
|
3274
|
+
if (typeof target !== "object" || target === null) return void 0;
|
|
3275
|
+
const record = target;
|
|
3276
|
+
if (typeof record["get"] === "function" && key !== "root" && key !== "ctx") try {
|
|
3277
|
+
const viaGet = record["get"].call(target, key);
|
|
3278
|
+
if (viaGet !== void 0) return viaGet;
|
|
3279
|
+
} catch {}
|
|
3280
|
+
try {
|
|
3281
|
+
return record[key];
|
|
3282
|
+
} catch {
|
|
3283
|
+
return;
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3272
3286
|
/** 从 Cordis ctx / loader 上尽量收集宿主运行根目录。 */
|
|
3273
3287
|
function contextBaseDirs(source, roots) {
|
|
3274
3288
|
if (typeof source !== "object" || source === null) return;
|
|
3275
|
-
const record = source;
|
|
3276
3289
|
const addDir = (value) => {
|
|
3277
3290
|
if (typeof value === "string" && value.trim().length > 0) roots.add(value.trim());
|
|
3278
3291
|
};
|
|
3279
|
-
addDir(
|
|
3280
|
-
const root =
|
|
3292
|
+
addDir(safeReadProp(source, "baseDir"));
|
|
3293
|
+
const root = safeReadProp(source, "root");
|
|
3281
3294
|
if (typeof root === "object" && root !== null && root !== source) {
|
|
3282
|
-
addDir(root
|
|
3283
|
-
const rootLoader = root
|
|
3284
|
-
if (typeof rootLoader === "object" && rootLoader !== null) addDir(rootLoader
|
|
3285
|
-
}
|
|
3286
|
-
const loader =
|
|
3287
|
-
if (typeof loader === "object" && loader !== null) addDir(loader
|
|
3288
|
-
if (typeof record["get"] === "function") try {
|
|
3289
|
-
const loaderService = record["get"].call(source, "loader");
|
|
3290
|
-
if (typeof loaderService === "object" && loaderService !== null) addDir(loaderService["baseDir"]);
|
|
3291
|
-
} catch {}
|
|
3295
|
+
addDir(safeReadProp(root, "baseDir"));
|
|
3296
|
+
const rootLoader = safeReadProp(root, "loader");
|
|
3297
|
+
if (typeof rootLoader === "object" && rootLoader !== null) addDir(safeReadProp(rootLoader, "baseDir"));
|
|
3298
|
+
}
|
|
3299
|
+
const loader = safeReadProp(source, "loader");
|
|
3300
|
+
if (typeof loader === "object" && loader !== null) addDir(safeReadProp(loader, "baseDir"));
|
|
3292
3301
|
}
|
|
3293
3302
|
/** 从给定根目录解析 `@deepseek-ai/dsh-ptc-runtime` 的真实入口 file:// URL(经过 realpathSync 归一化)。 */
|
|
3294
3303
|
function resolvePtcRuntimeModuleUrl(rootDir) {
|
|
@@ -3350,7 +3359,7 @@ async function resolveHostPtcRuntimeClasses(runtime, ctx, extraRoots) {
|
|
|
3350
3359
|
for (const dir of extraRoots) if (typeof dir === "string" && dir.trim().length > 0) roots.add(dir.trim());
|
|
3351
3360
|
}
|
|
3352
3361
|
contextBaseDirs(ctx, roots);
|
|
3353
|
-
contextBaseDirs(rawRuntime
|
|
3362
|
+
contextBaseDirs(safeReadProp(rawRuntime, "ctx"), roots);
|
|
3354
3363
|
for (const dir of candidatePackageRoots()) roots.add(dir);
|
|
3355
3364
|
const seenUrls = /* @__PURE__ */ new Set();
|
|
3356
3365
|
const tryModule = async (specifier) => {
|
package/lib/index.js
CHANGED
|
@@ -840,7 +840,7 @@ const ROUTE_PREFIX$5 = "/api/dsh-chatgpt-subscription";
|
|
|
840
840
|
* `test/responses-client.test.ts` asserts the two agree, so a release that
|
|
841
841
|
* forgets this constant fails the suite instead of shipping quietly.
|
|
842
842
|
*/
|
|
843
|
-
const PLUGIN_VERSION = "0.91.
|
|
843
|
+
const PLUGIN_VERSION = "0.91.1";
|
|
844
844
|
const CODEX_CHATGPT_PROVIDER_ID = "codex-chatgpt";
|
|
845
845
|
const CODEX_API_BASE = "https://chatgpt.com/backend-api/codex";
|
|
846
846
|
const CODEX_RESPONSES_URL = `${CODEX_API_BASE}/responses`;
|
package/lib/types/compat.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ export declare const ROUTE_PREFIX: "/api/dsh-chatgpt-subscription";
|
|
|
76
76
|
* `test/responses-client.test.ts` asserts the two agree, so a release that
|
|
77
77
|
* forgets this constant fails the suite instead of shipping quietly.
|
|
78
78
|
*/
|
|
79
|
-
export declare const PLUGIN_VERSION: "0.91.
|
|
79
|
+
export declare const PLUGIN_VERSION: "0.91.1";
|
|
80
80
|
export declare const CODEX_CHATGPT_PROVIDER_ID: "codex-chatgpt";
|
|
81
81
|
export { MINIMAX_CODE_PROVIDER_ID, MINIMAX_CODE_ROUTE_PREFIX } from './shared/minimax-code-contracts.ts';
|
|
82
82
|
export declare const CODEX_API_BASE: "https://chatgpt.com/backend-api/codex";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codemode.d.ts","sourceRoot":"","sources":["../../../src/entries/codemode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAmBH,OAAO,EAIL,KAAK,cAAc,EAEpB,MAAM,mCAAmC,CAAA;AAqB1C,kBAAkB;AAClB,eAAO,MAAM,IAAI,aAAa,CAAA;AAE9B,aAAa;AACb,eAAO,MAAM,MAAM,UAA4B,CAAA;AAK/C,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC,uDAAuD;IACvD,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,IAA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