dsh-codex-share 0.4.3 → 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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/dist/index.mjs +24 -47
  3. 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.0-rc.2` (earlier releases are no longer supported), with Node.js `^22.19.0 || >=24`.
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.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.
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
 
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)",
@@ -135,16 +129,7 @@ function apply(ctx, config = Config({})) {
135
129
  ...profileBase,
136
130
  provider: "glm-coding-global",
137
131
  displayName: "GLM Coding Plan (global)",
138
- piProvider: {
139
- ...glmUpstream,
140
- id: "glm-coding-global",
141
- name: "GLM Coding Plan (global)",
142
- auth: { apiKey: envApiKeyAuth("GLM Coding Plan API key", []) },
143
- getModels: () => glmCatalog.map((model) => ({
144
- ...model,
145
- provider: "glm-coding-global"
146
- }))
147
- }
132
+ piProvider: routeProvider(glmUpstream, "glm-coding-global", "GLM Coding Plan (global)", "GLM Coding Plan API key", glmCatalog)
148
133
  };
149
134
  const resolveProfiles = () => {
150
135
  const configured = config.additionalModelIds.get();
@@ -157,16 +142,8 @@ function apply(ctx, config = Config({})) {
157
142
  id,
158
143
  name: id
159
144
  };
160
- })].map((model) => ({
161
- ...model,
162
- provider: PROVIDER
163
- }));
164
- const provider = {
165
- ...upstream,
166
- id: PROVIDER,
167
- auth: { apiKey: envApiKeyAuth("Codex CLI login", []) },
168
- getModels: () => models
169
- };
145
+ })];
146
+ const provider = routeProvider(upstream, PROVIDER, upstream.name, "Codex CLI login", models);
170
147
  profiles = new Map([[PROVIDER, {
171
148
  ...profileBase,
172
149
  piProvider: provider
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-codex-share",
3
- "version": "0.4.3",
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.4",
30
- "@deepseek-ai/dsh-attachment": "0.2.0-rc.2",
31
- "@deepseek-ai/dsh-fs": "0.2.0-rc.2",
32
- "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
33
- "@deepseek-ai/dsh-llm-pi-ai": "0.2.0-rc.2",
34
- "@deepseek-ai/schemastery": "^3.18.4"
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.4",
38
- "@deepseek-ai/dsh-attachment": "0.2.0-rc.2",
39
- "@deepseek-ai/dsh-credentials": "0.2.0-rc.2",
40
- "@deepseek-ai/dsh-launch-environment": "0.2.0-rc.2",
41
- "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
42
- "@deepseek-ai/dsh-llm-pi-ai": "0.2.0-rc.2",
43
- "@deepseek-ai/schemastery": "^3.18.4",
44
- "@earendil-works/pi-ai": "~0.87.1"
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",