dsh-codex-share 0.4.2 → 0.5.0
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 +3 -3
- package/dist/index.mjs +40 -47
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A DeepSeek Harness LLM adapter that uses the same ChatGPT subscription login as
|
|
|
4
4
|
|
|
5
5
|
## Requirements
|
|
6
6
|
|
|
7
|
-
- DeepSeek Harness `0.2.
|
|
7
|
+
- DeepSeek Harness `0.2.1-alpha.2` (earlier releases are no longer supported), with Node.js `^22.19.0 || >=24`.
|
|
8
8
|
- Codex CLI signed in with a ChatGPT account and configured for **file credential storage**. Run `codex login` and check `codex login status`. Codex must be able to read and update `$CODEX_HOME/auth.json` (default `~/.codex/auth.json`).
|
|
9
9
|
- The harness process must run as the same OS user, or have read access to that same credential file. A keyring-only Codex login is not supported.
|
|
10
10
|
|
|
@@ -24,7 +24,7 @@ For development from this checkout, from its directory:
|
|
|
24
24
|
dsh plugin --profile web add .
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
Restart the profile after installation or update. The bundle mounts one provider route, `openai-codex-local`, with the model catalog supplied by pi-ai 0
|
|
27
|
+
Restart the profile after installation or update. The bundle mounts one provider route, `openai-codex-local`, with the model catalog supplied by pi-ai 1.0, including GPT-6 Astra, Sol, and Luna, and GPT-6.1 Sol (`gpt-6.1-sol`). GPT-6.1 Luna is not listed in the current OpenAI or Codex catalogs; use `gpt-6-luna` for Luna. This route replaces the plugin's earlier `openai-codex` route, which collides with pi-ai's configurable provider directory; update any saved model selection to `openai-codex-local`. The plugin appears in **Settings → Plugins → Plugin list**. Open **Settings → Models** and use **Edit model IDs** in the OpenAI Codex row to add subscription model IDs (one per line). The IDs are saved as `additionalModelIds` on the `llm-codex-share` entry in the profile's `cordis.patch.yml` and take effect without a restart. The installed catalog remains available; clearing the additional IDs restores it. For example, enter a model ID that your account can use but the catalog does not list yet. An unrecognized ID can be listed, but requests to it will fail if the Codex endpoint rejects it. Select a listed model in the model picker or agent preset. For a local Codex home outside the default location, set the absolute `CODEX_HOME` path in the environment that launches the harness. Direct Cordis composition can configure `codexHome` on the `dsh-codex-share` plugin instead.
|
|
28
28
|
|
|
29
29
|
The plugin intentionally does not refresh a stale token. When Codex writes a replacement, the next harness request reads it. When Codex's current access token has expired, harness calls fail until Codex refreshes its own login. An API-key-only Codex login is rejected; this route never falls back to `OPENAI_API_KEY`.
|
|
30
30
|
|
|
@@ -32,7 +32,7 @@ The plugin intentionally does not refresh a stale token. When Codex writes a rep
|
|
|
32
32
|
|
|
33
33
|
When `GLM_API_KEY` is non-empty in the Harness launch environment, this plugin also adds **GLM Coding Plan (global)** to the model picker under the `glm-coding-global` provider route. It uses pi-ai's installed Z.AI model catalog and the global Coding Plan endpoint, `https://api.z.ai/api/coding/paas/v4` (not the China endpoint or the standard pay-as-you-go API).
|
|
34
34
|
|
|
35
|
-
Export your Coding Plan key before launching the Harness, or set it in a Harness launch `.env` file, and restart the profile. No manual model/provider configuration is needed. With no key, or an empty/whitespace-only key, the GLM route is omitted. `ZAI_API_KEY` does not enable this route. GLM requests use only `GLM_API_KEY` and do not require a Codex login; Codex requests continue to use the local Codex credential file. The key is not written to plugin settings. Available models follow the installed pi-ai catalog;
|
|
35
|
+
Export your Coding Plan key before launching the Harness, or set it in a Harness launch `.env` file, and restart the profile. No manual model/provider configuration is needed. With no key, or an empty/whitespace-only key, the GLM route is omitted. `ZAI_API_KEY` does not enable this route. GLM requests use only `GLM_API_KEY` and do not require a Codex login; Codex requests continue to use the local Codex credential file. The key is not written to plugin settings. Available models follow the installed pi-ai catalog, plus **GLM-5.3 Flash X** (`glm-5.3-flashx`) when upstream does not yet list it. Flash X inherits Flash's 1M context, 128K maximum output, image input, and reasoning capabilities; its cost estimate is left at zero until upstream supplies model-specific pricing (this does not imply free usage). [Z.AI's documentation](https://docs.z.ai/guides/vlm/glm-5.3-flash) currently says FlashX is not yet available on the Coding Plan; it is listed for forward compatibility, but requests may be rejected until your plan supports it.
|
|
36
36
|
|
|
37
37
|
## Development
|
|
38
38
|
|
package/dist/index.mjs
CHANGED
|
@@ -55,6 +55,27 @@ const Config = z.object({
|
|
|
55
55
|
function validateModelIds(ids) {
|
|
56
56
|
if (new Set(ids).size !== ids.length || ids.some((id) => id.trim() !== id)) throw new TypeError("Additional Codex model IDs must be unique, non-empty, and trimmed");
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Re-route an upstream provider under a Harness route with its own catalog.
|
|
60
|
+
* Only the wire streams are delegated: pi-ai 1.x `Models` prefers
|
|
61
|
+
* `getAllModels()` and may refresh the catalog, which would bypass the
|
|
62
|
+
* route-stamped models, so those upstream members are deliberately dropped.
|
|
63
|
+
*/
|
|
64
|
+
function routeProvider(base, id, name, apiKeyLabel, models) {
|
|
65
|
+
return {
|
|
66
|
+
id,
|
|
67
|
+
name,
|
|
68
|
+
...base.baseUrl === void 0 ? {} : { baseUrl: base.baseUrl },
|
|
69
|
+
...base.headers === void 0 ? {} : { headers: base.headers },
|
|
70
|
+
auth: { apiKey: envApiKeyAuth(apiKeyLabel, []) },
|
|
71
|
+
getModels: () => models.map((model) => ({
|
|
72
|
+
...model,
|
|
73
|
+
provider: id
|
|
74
|
+
})),
|
|
75
|
+
stream: (model, context, options) => base.stream(model, context, options),
|
|
76
|
+
streamSimple: (model, context, options) => base.streamSimple(model, context, options)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
58
79
|
/** Register the Codex subscription model catalog and stream adapter. */
|
|
59
80
|
function apply(ctx, config = Config({})) {
|
|
60
81
|
validateModelIds(config.additionalModelIds.get());
|
|
@@ -67,33 +88,6 @@ function apply(ctx, config = Config({})) {
|
|
|
67
88
|
let profiles;
|
|
68
89
|
const upstream = openaiCodexProvider();
|
|
69
90
|
const catalog = [...upstream.getModels()];
|
|
70
|
-
if (!catalog.some((model) => model.id === "gpt-6.1-sol")) {
|
|
71
|
-
const sol = catalog.find((model) => model.id === "gpt-6-sol");
|
|
72
|
-
if (sol === void 0) throw new TypeError("The Codex catalog must include GPT-6 Sol");
|
|
73
|
-
catalog.push({
|
|
74
|
-
...sol,
|
|
75
|
-
id: "gpt-6.1-sol",
|
|
76
|
-
name: "GPT-6.1 Sol",
|
|
77
|
-
thinkingLevelMap: {
|
|
78
|
-
...sol.thinkingLevelMap,
|
|
79
|
-
off: null,
|
|
80
|
-
minimal: null
|
|
81
|
-
},
|
|
82
|
-
cost: {
|
|
83
|
-
input: 2,
|
|
84
|
-
output: 10,
|
|
85
|
-
cacheRead: .1,
|
|
86
|
-
cacheWrite: 2.5,
|
|
87
|
-
tiers: [{
|
|
88
|
-
inputTokensAbove: 272e3,
|
|
89
|
-
input: 4,
|
|
90
|
-
output: 15,
|
|
91
|
-
cacheRead: .2,
|
|
92
|
-
cacheWrite: 5
|
|
93
|
-
}]
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
91
|
const profileBase = {
|
|
98
92
|
provider: PROVIDER,
|
|
99
93
|
displayName: "OpenAI Codex (local login)",
|
|
@@ -115,20 +109,27 @@ function apply(ctx, config = Config({})) {
|
|
|
115
109
|
};
|
|
116
110
|
const glmKey = launchEnvironmentOf(ctx).get("GLM_API_KEY")?.value;
|
|
117
111
|
const glmUpstream = glmKey?.trim() ? zaiProvider() : void 0;
|
|
112
|
+
const glmCatalog = glmUpstream ? [...glmUpstream.getModels()] : [];
|
|
113
|
+
if (glmUpstream && !glmCatalog.some((model) => model.id === "glm-5.3-flashx")) {
|
|
114
|
+
const flash = glmCatalog.find((model) => model.id === "glm-5.3-flash");
|
|
115
|
+
if (flash === void 0) throw new TypeError("The Z.AI catalog must include GLM-5.3-Flash");
|
|
116
|
+
glmCatalog.push({
|
|
117
|
+
...flash,
|
|
118
|
+
id: "glm-5.3-flashx",
|
|
119
|
+
name: "GLM-5.3 Flash X",
|
|
120
|
+
cost: {
|
|
121
|
+
input: 0,
|
|
122
|
+
output: 0,
|
|
123
|
+
cacheRead: 0,
|
|
124
|
+
cacheWrite: 0
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
118
128
|
const glmProfile = glmUpstream && {
|
|
119
129
|
...profileBase,
|
|
120
130
|
provider: "glm-coding-global",
|
|
121
131
|
displayName: "GLM Coding Plan (global)",
|
|
122
|
-
piProvider:
|
|
123
|
-
...glmUpstream,
|
|
124
|
-
id: "glm-coding-global",
|
|
125
|
-
name: "GLM Coding Plan (global)",
|
|
126
|
-
auth: { apiKey: envApiKeyAuth("GLM Coding Plan API key", []) },
|
|
127
|
-
getModels: () => [...glmUpstream.getModels()].map((model) => ({
|
|
128
|
-
...model,
|
|
129
|
-
provider: "glm-coding-global"
|
|
130
|
-
}))
|
|
131
|
-
}
|
|
132
|
+
piProvider: routeProvider(glmUpstream, "glm-coding-global", "GLM Coding Plan (global)", "GLM Coding Plan API key", glmCatalog)
|
|
132
133
|
};
|
|
133
134
|
const resolveProfiles = () => {
|
|
134
135
|
const configured = config.additionalModelIds.get();
|
|
@@ -141,16 +142,8 @@ function apply(ctx, config = Config({})) {
|
|
|
141
142
|
id,
|
|
142
143
|
name: id
|
|
143
144
|
};
|
|
144
|
-
})]
|
|
145
|
-
|
|
146
|
-
provider: PROVIDER
|
|
147
|
-
}));
|
|
148
|
-
const provider = {
|
|
149
|
-
...upstream,
|
|
150
|
-
id: PROVIDER,
|
|
151
|
-
auth: { apiKey: envApiKeyAuth("Codex CLI login", []) },
|
|
152
|
-
getModels: () => models
|
|
153
|
-
};
|
|
145
|
+
})];
|
|
146
|
+
const provider = routeProvider(upstream, PROVIDER, upstream.name, "Codex CLI login", models);
|
|
154
147
|
profiles = new Map([[PROVIDER, {
|
|
155
148
|
...profileBase,
|
|
156
149
|
piProvider: provider
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-codex-share",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Use the local Codex CLI ChatGPT subscription login as a DeepSeek Harness LLM provider",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,22 +26,22 @@
|
|
|
26
26
|
"node": "^22.19.0 || >=24.0.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@deepseek-ai/cordis": "~4.0.
|
|
30
|
-
"@deepseek-ai/dsh-attachment": "0.2.
|
|
31
|
-
"@deepseek-ai/dsh-fs": "0.2.
|
|
32
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
33
|
-
"@deepseek-ai/dsh-llm-pi-ai": "0.2.
|
|
34
|
-
"@deepseek-ai/schemastery": "
|
|
29
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.1",
|
|
30
|
+
"@deepseek-ai/dsh-attachment": "0.2.1-alpha.2",
|
|
31
|
+
"@deepseek-ai/dsh-fs": "0.2.1-alpha.2",
|
|
32
|
+
"@deepseek-ai/dsh-llm": "0.2.1-alpha.2",
|
|
33
|
+
"@deepseek-ai/dsh-llm-pi-ai": "0.2.1-alpha.2",
|
|
34
|
+
"@deepseek-ai/schemastery": "~3.18.5-alpha.1"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@deepseek-ai/cordis": "~4.0.
|
|
38
|
-
"@deepseek-ai/dsh-attachment": "0.2.
|
|
39
|
-
"@deepseek-ai/dsh-credentials": "0.2.
|
|
40
|
-
"@deepseek-ai/dsh-launch-environment": "0.2.
|
|
41
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
42
|
-
"@deepseek-ai/dsh-llm-pi-ai": "0.2.
|
|
43
|
-
"@deepseek-ai/schemastery": "
|
|
44
|
-
"@earendil-works/pi-ai": "
|
|
37
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.1",
|
|
38
|
+
"@deepseek-ai/dsh-attachment": "0.2.1-alpha.2",
|
|
39
|
+
"@deepseek-ai/dsh-credentials": "0.2.1-alpha.2",
|
|
40
|
+
"@deepseek-ai/dsh-launch-environment": "0.2.1-alpha.2",
|
|
41
|
+
"@deepseek-ai/dsh-llm": "0.2.1-alpha.2",
|
|
42
|
+
"@deepseek-ai/dsh-llm-pi-ai": "0.2.1-alpha.2",
|
|
43
|
+
"@deepseek-ai/schemastery": "~3.18.5-alpha.1",
|
|
44
|
+
"@earendil-works/pi-ai": "^1.0.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@deepseek-ai/cordis": "link:../../deepseek-harness/vendor/cordis",
|