dsh-codex-share 0.4.0 → 0.4.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 +8 -2
- package/dist/index.d.mts +3 -1
- package/dist/index.mjs +54 -6
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -24,10 +24,16 @@ 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.87, including GPT-6 Astra, Sol, and 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.
|
|
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.87, including GPT-6 Astra, Sol, and Luna, plus GPT-6.1 Sol (`gpt-6.1-sol`). GPT-6.1 Sol uses Codex’s default 272K context and supports low through max reasoning; its pricing follows [OpenAI’s model documentation](https://developers.openai.com/api/docs/models/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
|
|
|
31
|
+
## Optional GLM Coding Plan (global)
|
|
32
|
+
|
|
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
|
+
|
|
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; endpoint access depends on your plan.
|
|
36
|
+
|
|
31
37
|
## Development
|
|
32
38
|
|
|
33
39
|
```sh
|
|
@@ -38,4 +44,4 @@ pnpm build
|
|
|
38
44
|
pnpm pack
|
|
39
45
|
```
|
|
40
46
|
|
|
41
|
-
The development links in `package.json` and local overrides in `pnpm-workspace.yaml` point to the
|
|
47
|
+
The development links in `package.json` and local overrides in `pnpm-workspace.yaml` point to the `../../deepseek-harness` checkout. Replace those paths when developing elsewhere; consumers of the published package use the versioned runtime dependencies instead.
|
package/dist/index.d.mts
CHANGED
|
@@ -13,6 +13,8 @@ declare function readCodexAccessToken(codexHome?: string): Promise<string>;
|
|
|
13
13
|
//#region src/index.d.ts
|
|
14
14
|
/** Harness route for subscription-backed Codex models. */
|
|
15
15
|
declare const PROVIDER = "openai-codex-local";
|
|
16
|
+
/** Separate route to avoid colliding with the configurable pi-ai Z.AI provider. */
|
|
17
|
+
declare const GLM_PROVIDER = "glm-coding-global";
|
|
16
18
|
declare const name = "llm-codex-share";
|
|
17
19
|
declare const inject: string[];
|
|
18
20
|
/** Settings namespace: the Loader entry id this bundle's patch inserts. */
|
|
@@ -27,4 +29,4 @@ declare const Config: z<Partial<Record<keyof Config, unknown>>, Config>;
|
|
|
27
29
|
/** Register the Codex subscription model catalog and stream adapter. */
|
|
28
30
|
declare function apply(ctx: Context, config?: Config): void;
|
|
29
31
|
//#endregion
|
|
30
|
-
export { Config, PROVIDER, SETTINGS_NS, apply, codexAuthPath, inject, name, readCodexAccessToken };
|
|
32
|
+
export { Config, GLM_PROVIDER, PROVIDER, SETTINGS_NS, apply, codexAuthPath, inject, name, readCodexAccessToken };
|
package/dist/index.mjs
CHANGED
|
@@ -3,6 +3,8 @@ import { LlmError, resolveImageAttachmentAccess } from "@deepseek-ai/dsh-llm";
|
|
|
3
3
|
import { PiAiAdapter } from "@deepseek-ai/dsh-llm-pi-ai";
|
|
4
4
|
import { envApiKeyAuth } from "@earendil-works/pi-ai";
|
|
5
5
|
import { openaiCodexProvider } from "@earendil-works/pi-ai/providers/openai-codex";
|
|
6
|
+
import { zaiProvider } from "@earendil-works/pi-ai/providers/zai";
|
|
7
|
+
import { launchEnvironmentOf } from "@deepseek-ai/dsh-launch-environment";
|
|
6
8
|
import { readFile } from "node:fs/promises";
|
|
7
9
|
import { homedir } from "node:os";
|
|
8
10
|
import { isAbsolute, join } from "node:path";
|
|
@@ -40,6 +42,8 @@ async function readCodexAccessToken(codexHome) {
|
|
|
40
42
|
//#region src/index.ts
|
|
41
43
|
/** Harness route for subscription-backed Codex models. */
|
|
42
44
|
const PROVIDER = "openai-codex-local";
|
|
45
|
+
/** Separate route to avoid colliding with the configurable pi-ai Z.AI provider. */
|
|
46
|
+
const GLM_PROVIDER = "glm-coding-global";
|
|
43
47
|
const name = "llm-codex-share";
|
|
44
48
|
const inject = ["llm"];
|
|
45
49
|
/** Settings namespace: the Loader entry id this bundle's patch inserts. */
|
|
@@ -62,7 +66,34 @@ function apply(ctx, config = Config({})) {
|
|
|
62
66
|
let lastIds;
|
|
63
67
|
let profiles;
|
|
64
68
|
const upstream = openaiCodexProvider();
|
|
65
|
-
const catalog = upstream.getModels();
|
|
69
|
+
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
|
+
}
|
|
66
97
|
const profileBase = {
|
|
67
98
|
provider: PROVIDER,
|
|
68
99
|
displayName: "OpenAI Codex (local login)",
|
|
@@ -82,6 +113,23 @@ function apply(ctx, config = Config({})) {
|
|
|
82
113
|
jitterRatio: 0
|
|
83
114
|
}
|
|
84
115
|
};
|
|
116
|
+
const glmKey = launchEnvironmentOf(ctx).get("GLM_API_KEY")?.value;
|
|
117
|
+
const glmUpstream = glmKey?.trim() ? zaiProvider() : void 0;
|
|
118
|
+
const glmProfile = glmUpstream && {
|
|
119
|
+
...profileBase,
|
|
120
|
+
provider: "glm-coding-global",
|
|
121
|
+
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
|
+
};
|
|
85
133
|
const resolveProfiles = () => {
|
|
86
134
|
const configured = config.additionalModelIds.get();
|
|
87
135
|
if (configured === lastIds && profiles !== void 0) return profiles;
|
|
@@ -103,16 +151,16 @@ function apply(ctx, config = Config({})) {
|
|
|
103
151
|
auth: { apiKey: envApiKeyAuth("Codex CLI login", []) },
|
|
104
152
|
getModels: () => models
|
|
105
153
|
};
|
|
106
|
-
profiles =
|
|
154
|
+
profiles = new Map([[PROVIDER, {
|
|
107
155
|
...profileBase,
|
|
108
156
|
piProvider: provider
|
|
109
|
-
}]]);
|
|
157
|
+
}], ...glmProfile === void 0 ? [] : [[GLM_PROVIDER, glmProfile]]]);
|
|
110
158
|
lastIds = configured;
|
|
111
159
|
return profiles;
|
|
112
160
|
};
|
|
113
161
|
const adapter = new PiAiAdapter({
|
|
114
162
|
profiles: resolveProfiles,
|
|
115
|
-
resolveApiKey: async () => readCodexAccessToken(config.codexHome),
|
|
163
|
+
resolveApiKey: async (provider) => provider === "glm-coding-global" ? glmKey : readCodexAccessToken(config.codexHome),
|
|
116
164
|
resolveAttachments: () => ctx.get("attachments"),
|
|
117
165
|
resolveImageAccess: (attachments, ref) => resolveImageAttachmentAccess(attachments, (hostPath) => ctx.get("fs")?.processPathFromHostPath(hostPath), ref),
|
|
118
166
|
auth: {
|
|
@@ -138,7 +186,7 @@ function apply(ctx, config = Config({})) {
|
|
|
138
186
|
settingsNs: SETTINGS_NS,
|
|
139
187
|
settingsPath: []
|
|
140
188
|
}]);
|
|
141
|
-
ctx.llm.registerAdapter([PROVIDER], adapter);
|
|
189
|
+
ctx.llm.registerAdapter(glmProfile === void 0 ? [PROVIDER] : [PROVIDER, GLM_PROVIDER], adapter);
|
|
142
190
|
}
|
|
143
191
|
//#endregion
|
|
144
|
-
export { Config, PROVIDER, SETTINGS_NS, apply, codexAuthPath, inject, name, readCodexAccessToken };
|
|
192
|
+
export { Config, GLM_PROVIDER, PROVIDER, SETTINGS_NS, apply, codexAuthPath, inject, name, readCodexAccessToken };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-codex-share",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
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",
|
|
@@ -44,19 +44,19 @@
|
|
|
44
44
|
"@earendil-works/pi-ai": "~0.87.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@deepseek-ai/cordis": "link
|
|
48
|
-
"@deepseek-ai/dsh-api-remotes": "link
|
|
49
|
-
"@deepseek-ai/dsh-app-boot": "link
|
|
50
|
-
"@deepseek-ai/dsh-attachment": "link
|
|
51
|
-
"@deepseek-ai/dsh-client-ui-renderer": "link
|
|
52
|
-
"@deepseek-ai/dsh-client-ui-settings": "link
|
|
53
|
-
"@deepseek-ai/dsh-client-ui-settings-models": "link
|
|
54
|
-
"@deepseek-ai/dsh-client-ui-slots": "link
|
|
55
|
-
"@deepseek-ai/dsh-fs": "link
|
|
56
|
-
"@deepseek-ai/dsh-llm": "link
|
|
57
|
-
"@deepseek-ai/dsh-llm-pi-ai": "link
|
|
58
|
-
"@deepseek-ai/dsh-settings": "link
|
|
59
|
-
"@deepseek-ai/schemastery": "link
|
|
47
|
+
"@deepseek-ai/cordis": "link:../../deepseek-harness/vendor/cordis",
|
|
48
|
+
"@deepseek-ai/dsh-api-remotes": "link:../../deepseek-harness/packages/api/remotes",
|
|
49
|
+
"@deepseek-ai/dsh-app-boot": "link:../../deepseek-harness/packages/boot/app-boot",
|
|
50
|
+
"@deepseek-ai/dsh-attachment": "link:../../deepseek-harness/packages/attachment/attachment",
|
|
51
|
+
"@deepseek-ai/dsh-client-ui-renderer": "link:../../deepseek-harness/packages/client/ui-renderer",
|
|
52
|
+
"@deepseek-ai/dsh-client-ui-settings": "link:../../deepseek-harness/packages/client/ui-settings",
|
|
53
|
+
"@deepseek-ai/dsh-client-ui-settings-models": "link:../../deepseek-harness/packages/client/ui-settings-models",
|
|
54
|
+
"@deepseek-ai/dsh-client-ui-slots": "link:../../deepseek-harness/packages/client/ui-slots",
|
|
55
|
+
"@deepseek-ai/dsh-fs": "link:../../deepseek-harness/packages/fs/fs",
|
|
56
|
+
"@deepseek-ai/dsh-llm": "link:../../deepseek-harness/packages/llm/llm",
|
|
57
|
+
"@deepseek-ai/dsh-llm-pi-ai": "link:../../deepseek-harness/packages/llm/llm-pi-ai",
|
|
58
|
+
"@deepseek-ai/dsh-settings": "link:../../deepseek-harness/packages/settings/settings",
|
|
59
|
+
"@deepseek-ai/schemastery": "link:../../deepseek-harness/vendor/schemastery",
|
|
60
60
|
"@types/node": "^22.20.0",
|
|
61
61
|
"@types/react": "~18.3.31",
|
|
62
62
|
"react": "^18.3.1",
|