dsh-gpt-adapter 0.0.0-stage → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 lxjmaster
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,126 @@
1
- # Temporary Holding Version
1
+ # DSH GPT Adapter
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![DSH plugin](https://img.shields.io/badge/DeepSeek%20Harness-plugin-2563eb)](https://github.com/deepseek-ai/deepseek-harness)
4
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
5
+
6
+ English | [Simplified Chinese](README.zh-CN.md)
7
+
8
+ A third-party DeepSeek Harness (DSH) plugin for GPT models and existing Codex environments.
9
+ Install one plugin to reuse local Codex instructions, skills, enabled plugin resources, and MCP server configurations without moving or rewriting Codex files.
10
+
11
+ ## Features
12
+
13
+ - Discover upstream models with `GET /models` and retain stale entries until explicit cleanup.
14
+ - Provide the GPT reasoning preset `low / medium / high / xhigh / max / ultra` through the native Models page and conversation menu.
15
+ - Offer independent Standard and Fast speed choices. Fast sends `service_tier: "priority"`; Ultrafast requires an explicit upstream declaration or override.
16
+ - Preserve optional function arguments on GPT Responses requests by setting missing `strict` values to `false`.
17
+ - Read Codex instruction files and refresh them at the next model step without repeating unchanged baselines.
18
+ - Register Codex local skills and enabled plugin skills with their original resource paths.
19
+ - Mount enabled Codex MCP servers through the official DSH MCP client and reconcile changed connections automatically.
20
+
21
+ Reasoning and speed presets are requests to the configured gateway, not guarantees of upstream support. User overrides, explicit upstream capability metadata, and external catalogs take precedence over presets.
22
+
23
+ ## Compatibility and installation
24
+
25
+ The native integration targets DSH `0.2.2-rc.1`, Cordis `4.1.0`, and the pinned adapter source hash. The development dependency uses Pi AI `1.3.0`. Installed third-party package files are never edited. The package has not been published to npm.
26
+
27
+ Requires Node.js `>=24.9.0` and pnpm.
28
+
29
+ ```sh
30
+ git clone https://github.com/lxjmaster/dsh-gpt-adapter.git
31
+ cd dsh-gpt-adapter
32
+ pnpm install --frozen-lockfile
33
+ mkdir -p artifacts
34
+ pnpm pack --pack-destination artifacts
35
+ dsh plugin --profile web add ./artifacts/dsh-gpt-adapter-0.2.2.tgz
36
+ ```
37
+
38
+ `pnpm pack` runs the production build. Restart the DSH host after upgrading the installed package.
39
+
40
+ ## Automated releases
41
+
42
+ The `Release` workflow runs on pushes to `main` and manual dispatches. For a formal `X.Y.Z` version, it runs the test suite, creates `vX.Y.Z`, creates the matching GitHub Release, and publishes the package to npm. Prerelease versions are skipped, and existing tags or npm versions are reused safely.
43
+
44
+ Add an npm access token as the repository secret `NPM_TOKEN` before the first release.
45
+ Configure GPT connections as usual under **Settings → Models**. The plugin extends the existing native settings and conversation controls.
46
+
47
+ ## Codex environment reuse
48
+
49
+ Codex compatibility is enabled by default. The root is the plugin's `codexHome` override, then `CODEX_HOME`, then `~/.codex`.
50
+
51
+ | Resource | Behavior |
52
+ | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
53
+ | `config.toml` | Read user configuration in place, then trusted project `.codex/config.toml` layers from repository root to cwd; connection secrets stay in memory |
54
+ | Global instructions | First nonempty `AGENTS.override.md`, otherwise `AGENTS.md` |
55
+ | Project instructions | Repository root to current DSH working directory; first nonempty override, base file, or configured fallback per directory |
56
+ | DSH/shared global instructions | Retained from `~/.dsh/AGENTS.md` and `~/.agents/AGENTS.md` (or their configured environment roots) |
57
+ | Local overlays | Existing `AGENTS.local.md` and `CLAUDE.local.md` remain applicable |
58
+ | Codex skills | Discover `skills/` and `skills/.system/`; bodies load on demand |
59
+ | Shared/project skills | Retain native discovery and include `.agents/skills` at every directory from cwd to repository root; nearer project skills take precedence |
60
+ | Skill enablement | Honor ordered `skills.config` name/path selectors and `skills.bundled.enabled` |
61
+ | Enabled plugins | Read declared skill roots and inline or file-referenced `mcpServers`; disabled plugins stay disabled |
62
+
63
+ The compatibility layer reads project instructions through DSH's filesystem, selects candidates using Codex precedence, and replaces native messages only for covered scopes. Additional nested instruction updates remain applicable. It does not import Codex's built-in system prompt. Configured fallback filenames such as `CLAUDE.md` are used only when supplied in Codex configuration. Instructions are recorded as ordinary user context with a bounded byte budget, including an explicit zero budget; they do not override system, developer, or direct user instructions. Existing conversation history is retained when the plugin is removed.
64
+
65
+ Plugin resources are resolved from the configured local marketplace, or the newest locally cached version in the matching marketplace. Nothing is downloaded automatically. Plugin skills use `<plugin>-<skill>` names to fit DSH's skill-name format and avoid cross-plugin collisions. Original skill paths and relative resources remain intact.
66
+
67
+ ## MCP compatibility
68
+
69
+ The plugin automatically starts enabled MCP commands and connects configured HTTP endpoints for each Agent session. It imports `mcp_servers` and the MCP resources declared by enabled plugins. Trusted project overrides apply within that Agent's scope; concurrent sessions do not share imported tool registrations. Untrusted project configuration is skipped.
70
+
71
+ Supported configuration includes:
72
+
73
+ - stdio `command`, `args`, `cwd`, `env`, and `env_vars`;
74
+ - Streamable HTTP `url`, `http_headers`, `env_http_headers`, and `bearer_token_env_var`;
75
+ - `enabled`, startup/tool timeouts, `enabled_tools`, and `disabled_tools`;
76
+ - plugin-root substitutions in plugin server declarations.
77
+
78
+ Global server names are retained where DSH permits them. Plugin servers use a plugin prefix. Unchanged connections are preserved. Changed or removed connections are disposed before replacement. Invalid configuration retains the last working snapshot, including individually invalid server entries. With automatic refresh enabled, failed startup retries with exponential backoff for up to ten attempts; a manual refresh resets that budget. The default two-second refresh detects configuration and plugin-resource changes; native skill watchers detect skill file changes.
79
+
80
+ Credentials are not copied into DSH settings, plugin caches, or this repository. Status responses contain only resource names, states, and sanitized reason codes. Missing environment variables must exist in the DSH host environment to be inherited.
81
+
82
+ This is environment compatibility, not a replacement Codex runtime. Codex OAuth/keychain sessions, Codex App IPC services, hooks, app components, permission policies, and proprietary commands are not automatically reproduced. Standard MCPs using configured headers/environment can be reused; servers requiring unavailable runtime authentication or services report a connection failure. Plugin hooks/apps/commands are reported as unsupported rather than executed. DSH retains its own approval and sandbox behavior.
83
+
84
+ Inspect status through the authenticated host method `gptModels/codexStatus`; use `gptModels/refreshCodex` to request a configuration refresh. Resource states are `loading`, `loaded`, `disabled`, `unsupported`, or `failed`. A loaded MCP entry means its initial connection and tool discovery completed; subsequent reconnection is managed by DSH.
85
+
86
+ ## Optional controls
87
+
88
+ No per-server reconfiguration is needed. The existing `gpt-adapter` plugin settings also expose:
89
+
90
+ ```yaml
91
+ codexCompatibility:
92
+ enabled: true
93
+ # codexHome: /path/to/existing/codex-home
94
+ importInstructions: true
95
+ importSkills: true
96
+ importMcpServers: true
97
+ importPluginResources: true
98
+ watch: true
99
+ pollIntervalMs: 2000
100
+ mcpAllowlist: []
101
+ ```
102
+
103
+ An empty `mcpAllowlist` imports all enabled declared servers. A nonempty list filters by the original server key. Disabling or removing the plugin withdraws its runtime registrations and leaves Codex files untouched. Native DSH model configuration and other plugins remain in place.
104
+
105
+ ## GPT model controls and storage
106
+
107
+ Capability precedence is user override, explicit upstream metadata, external catalog, then preset. Catalog requests never receive the provider API key. Model-list responses may omit capability metadata. Reasoning is sent as `reasoning.effort` for Responses and `reasoning_effort` for Chat Completions; the selected protocol is preserved.
108
+
109
+ Preset reasoning fields are projected into the native UI rather than persisted into native model configuration. Disabling GPT adaptation restores the native model values and schema. Speed selections are persisted per session. Synchronization failures retain the previous snapshot; absent models remain stale until explicit cleanup.
110
+
111
+ GPT model snapshots and speed selections are stored under `$DSH_HOME/storages/gpt-adapter`. Codex source files and imported MCP credentials are not copied there. The DSH host owns normal session transcripts and logs.
112
+
113
+ ## Development
114
+
115
+ ```sh
116
+ pnpm install --frozen-lockfile
117
+ pnpm check
118
+ pnpm test
119
+ pnpm build
120
+ ```
121
+
122
+ Tests use temporary directories, synthetic credentials, simulated upstream streams, and a real local fixture MCP process. They do not establish real-account support, upstream reasoning quality, external MCP authentication, or Codex App runtime availability.
123
+
124
+ ## License
125
+
126
+ [MIT](LICENSE). See [third-party notices](THIRD_PARTY_NOTICES.md) for reused DeepSeek Harness assets. This project is independently maintained and is not affiliated with DeepSeek or OpenAI.
@@ -0,0 +1,126 @@
1
+ # DSH GPT Adapter
2
+
3
+ [![DSH 插件](https://img.shields.io/badge/DeepSeek%20Harness-plugin-2563eb)](https://github.com/deepseek-ai/deepseek-harness)
4
+ [![MIT 许可证](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
5
+
6
+ [英文版](README.md) | 简体中文
7
+
8
+ 面向 DeepSeek Harness(DSH)的第三方 GPT 模型与 Codex 环境兼容插件。
9
+ 安装一个插件,即可直接读取原有 Codex 指令、技能、已启用插件资源及 MCP 服务器配置,无需移动或改写 Codex 文件。
10
+
11
+ ## 功能
12
+
13
+ - 通过 `GET /models` 发现上游模型;失效模型保留到用户主动清理。
14
+ - 在原生模型设置页和对话菜单中提供 `low / medium / high / xhigh / max / ultra` 六档思考预设。
15
+ - 提供独立的 Standard 和 Fast 速度选择。Fast 发送 `service_tier: "priority"`;Ultrafast 由上游明确声明或用户覆盖提供。
16
+ - 为 GPT Responses 函数工具补齐缺失的 `strict: false`,保留可选参数。
17
+ - 读取 Codex 指令,在下一模型步骤更新;内容不变时不重复注入。
18
+ - 挂载 Codex 本地技能和已启用插件技能,保持原始资源路径。
19
+ - 通过 DSH 官方 MCP 客户端挂载 Codex 已启用服务器,并自动对账连接变化。
20
+
21
+ 思考和速度预设代表发往网关的请求,不保证所有上游都支持。用户覆盖、上游明确的能力元数据和外部能力目录优先于预设。
22
+
23
+ ## 兼容性与安装
24
+
25
+ 原生集成面向 DSH `0.2.2-rc.1`、Cordis `4.1.0`,并校验适配器源码指纹。开发依赖固定 Pi AI `1.3.0`。插件不会修改已安装的第三方包文件,目前未发布到 npm。
26
+
27
+ 需要 Node.js `>=24.9.0` 和 pnpm。
28
+
29
+ ```sh
30
+ git clone https://github.com/lxjmaster/dsh-gpt-adapter.git
31
+ cd dsh-gpt-adapter
32
+ pnpm install --frozen-lockfile
33
+ mkdir -p artifacts
34
+ pnpm pack --pack-destination artifacts
35
+ dsh plugin --profile web add ./artifacts/dsh-gpt-adapter-0.2.2.tgz
36
+ ```
37
+
38
+ `pnpm pack` 会自动执行生产构建。升级安装包后重启 DSH 宿主。
39
+
40
+ ## 自动发布
41
+
42
+ `Release` 工作流会在推送到 `main` 或手动运行时执行。版本号为正式的 `X.Y.Z` 时,工作流会运行测试、创建 `vX.Y.Z` 标签、创建对应的 GitHub Release,并将包发布到 npm。预发布版本会跳过;已有标签或 npm 版本会安全复用。
43
+
44
+ 首次发布前,请在仓库 Secrets 中添加 npm 访问令牌 `NPM_TOKEN`。
45
+ 在「设置 → 模型」中照常配置 GPT 连接;插件扩展现有原生设置与对话控件。
46
+
47
+ ## 复用 Codex 环境
48
+
49
+ 默认启用 Codex 兼容。目录优先级为插件的 `codexHome` 覆盖、`CODEX_HOME` 环境变量、`~/.codex`。
50
+
51
+ | 资源 | 行为 |
52
+ | ------------------ | --------------------------------------------------------------------------------------------------- |
53
+ | `config.toml` | 原地读取用户配置,再从仓库根到当前目录叠加受信任项目的 `.codex/config.toml`;连接凭证只保存在内存中 |
54
+ | 全局指令 | 优先读取非空 `AGENTS.override.md`,否则读取 `AGENTS.md` |
55
+ | 项目指令 | 从仓库根到 DSH 当前工作目录,逐级选择首个非空的覆盖文件、基础文件或已配置后备文件 |
56
+ | DSH 与共享全局指令 | 保留 `~/.dsh/AGENTS.md` 与 `~/.agents/AGENTS.md`,也支持对应环境变量指定的目录 |
57
+ | 本地覆盖文件 | 保留 `AGENTS.local.md` 与 `CLAUDE.local.md` |
58
+ | Codex 技能 | 发现 `skills/` 和 `skills/.system/`,正文按需加载 |
59
+ | 共享与项目技能 | 保留原生发现机制,并补齐当前目录到仓库根每一级 `.agents/skills`;更近的项目技能优先 |
60
+ | 技能开关 | 遵循有序的 `skills.config` 名称/路径选择器,以及 `skills.bundled.enabled` |
61
+ | 已启用插件 | 读取声明的技能目录和内联或文件引用形式的 `mcpServers`;禁用插件不加载 |
62
+
63
+ 兼容层通过 DSH 文件系统读取项目指令,按 Codex 优先级选择候选文件,只替换已覆盖作用域内的原生指令消息;额外发现的子目录指令更新仍然保留。它不会导入 Codex 内置系统提示词。`CLAUDE.md` 等后备文件仅在 Codex 配置明确声明时使用。指令以有字节预算的普通用户上下文写入会话,明确配置的零预算也会生效;指令不覆盖系统、开发者或用户直接指令。移除插件不会删除已有会话历史。
64
+
65
+ 插件资源优先来自已配置的本地市场目录,否则使用匹配市场中最新的本地缓存版本,不会自动下载。插件技能使用 `<插件名>-<技能名>`,以符合 DSH 命名格式并避免跨插件冲突。技能原始路径和相对资源引用保持不变。
66
+
67
+ ## MCP 兼容
68
+
69
+ 插件会为每个会话代理(Agent)自动启动已启用的 MCP 命令并连接已配置的 HTTP 端点。导入来源包括 `mcp_servers` 和已启用插件声明的 MCP 资源。受信任项目的覆盖配置只在该会话代理的作用域内生效,并行会话不会共用导入工具的注册;未受信任项目的配置会跳过。
70
+
71
+ 支持的配置包括:
72
+
73
+ - 标准输入输出连接的 `command`、`args`、`cwd`、`env`、`env_vars`;
74
+ - 流式 HTTP 连接的 `url`、`http_headers`、`env_http_headers`、`bearer_token_env_var`;
75
+ - `enabled`、启动/工具超时、`enabled_tools`、`disabled_tools`;
76
+ - 插件服务器声明中的插件根目录变量替换。
77
+
78
+ 全局服务器名称在 DSH 允许时原样保留,插件服务器增加插件名前缀。未变化的连接继续复用;变更或删除的连接先卸载再替换。配置损坏时保留上一份有效快照,单个服务器配置无效时也会保留其可用连接。开启自动刷新时,启动失败会按指数退避间隔重试,最多尝试十次;手动刷新会重置次数。默认每两秒检查配置与插件资源变化,技能文件变化由原生监视器处理。
79
+
80
+ 凭证不会复制到 DSH 设置、插件缓存或本仓库。状态接口只返回资源名、状态和经过脱敏的原因代码。需要继承的环境变量必须存在于 DSH 宿主环境中。
81
+
82
+ 本插件提供环境兼容,不会重新实现 Codex 运行时。Codex 的 OAuth/钥匙串会话、App 专属进程通信服务、Hooks、应用组件、权限策略和专用命令不会自动重现。使用配置中的请求头或环境变量认证的标准 MCP 可以复用;依赖缺失认证或运行时服务的服务器会报告连接失败。插件的 Hooks、应用和命令明确标为不支持,不会自动执行。审批和沙箱仍由 DSH 自身管理。
83
+
84
+ 通过已认证的宿主方法 `gptModels/codexStatus` 查看状态,使用 `gptModels/refreshCodex` 请求刷新。资源状态为 `loading`(加载中)、`loaded`(已加载)、`disabled`(已禁用)、`unsupported`(不支持)或 `failed`(失败)。MCP 的已加载状态表示首次连接和工具发现已完成,后续重连由 DSH 管理。
85
+
86
+ ## 可选控制项
87
+
88
+ 无需逐个服务器重复配置。现有 `gpt-adapter` 插件设置还提供以下控制项:
89
+
90
+ ```yaml
91
+ codexCompatibility:
92
+ enabled: true
93
+ # codexHome: /path/to/existing/codex-home
94
+ importInstructions: true
95
+ importSkills: true
96
+ importMcpServers: true
97
+ importPluginResources: true
98
+ watch: true
99
+ pollIntervalMs: 2000
100
+ mcpAllowlist: []
101
+ ```
102
+
103
+ 空 `mcpAllowlist` 表示导入所有已启用的声明服务器;非空列表按原始服务器名筛选。禁用或移除插件会撤销它拥有的运行时注册,不改动 Codex 文件。原生 DSH 模型配置与其他插件保留。
104
+
105
+ ## GPT 模型控制与存储
106
+
107
+ 能力优先级为用户覆盖、上游明确元数据、外部能力目录、预设。能力目录请求不携带提供商 API 密钥;模型列表可以不包含能力元数据。Responses 使用 `reasoning.effort`,Chat Completions 使用 `reasoning_effort`,保留用户选定的协议。
108
+
109
+ 思考预设只投影到原生界面,不写入原生模型配置。关闭 GPT 自动适配后恢复原生值和参数结构。速度选择按会话持久化。同步失败保留旧快照,失效模型保留到主动清理。
110
+
111
+ GPT 模型快照与速度选择保存在 `$DSH_HOME/storages/gpt-adapter`。Codex 源文件和导入的 MCP 凭证不会复制到该位置。正常会话记录和日志由 DSH 宿主管理。
112
+
113
+ ## 开发
114
+
115
+ ```sh
116
+ pnpm install --frozen-lockfile
117
+ pnpm check
118
+ pnpm test
119
+ pnpm build
120
+ ```
121
+
122
+ 测试使用临时目录、合成凭证、模拟上游流,以及真实的本地测试 MCP 进程;不证明真实账户能力、上游思考质量、外部 MCP 认证或 Codex App 运行时可用性。
123
+
124
+ ## 许可证
125
+
126
+ 采用 [MIT 许可证](LICENSE)。复用的 DeepSeek Harness 资源见[第三方声明](THIRD_PARTY_NOTICES.md)。本项目独立维护,与 DeepSeek、OpenAI 无隶属关系。
@@ -0,0 +1,33 @@
1
+ # Third-party notices
2
+
3
+ The plugin uses the native adapter, model menu, and Models settings components
4
+ from the pinned `@deepseek-ai/dsh-llm-pi-ai`,
5
+ `@deepseek-ai/dsh-client-ui-model-selection`, and
6
+ `@deepseek-ai/dsh-client-ui-settings-models`, and `@deepseek-ai/dsh-mcp-client` version `0.2.2-rc.1` packages.
7
+ Original project: https://github.com/deepseek-ai/deepseek-harness
8
+
9
+ The build records native source hashes and reads native Models CSS class names.
10
+ The runtime extends the native adapter and injects controls into existing UI
11
+ slots. MCP tool filtering uses the pinned client’s public tool-name encoding. Installed third-party package files are never modified.
12
+
13
+ ## DeepSeek Harness — MIT License
14
+
15
+ Copyright (c) 2026 DeepSeek
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ of this software and associated documentation files (the "Software"), to deal
19
+ in the Software without restriction, including without limitation the rights
20
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ copies of the Software, and to permit persons to whom the Software is
22
+ furnished to do so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in all
25
+ copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ SOFTWARE.
@@ -0,0 +1,8 @@
1
+ # Extend the existing native adapter and UI; preserve official profile entries.
2
+ - insert:
3
+ - id: gpt-adapter
4
+ name: dsh-gpt-adapter
5
+ config:
6
+ routes: {}
7
+ codexCompatibility:
8
+ enabled: true
@@ -0,0 +1,10 @@
1
+ import type { ModelCapabilities, PreparedGptRequest, RequestSelection, SyncSnapshot } from './types.js';
2
+ /** Host-facing bridge kept small so it can be implemented against DSH's adapter seam. */
3
+ export type GptCapabilityProvider = {
4
+ currentSnapshot(): SyncSnapshot | undefined;
5
+ resolveCapabilities(modelId: string): ModelCapabilities | undefined;
6
+ };
7
+ export type GptRequestBridge = {
8
+ prepare(selection: RequestSelection): PreparedGptRequest;
9
+ };
10
+ export declare function createRequestBridge(provider: GptCapabilityProvider): GptRequestBridge;
@@ -0,0 +1,14 @@
1
+ import type { ModelCapabilities, ModelOverride, ReasoningChoice, ServiceTier, ServiceTierChoice, UpstreamModel } from './types.js';
2
+ /**
3
+ * Baseline catalog for known GPT families. This data is deliberately separate
4
+ * from `/models`: the upstream list identifies models but does not guarantee
5
+ * complete reasoning or service-tier metadata.
6
+ */
7
+ export declare const GPT_REASONING_LEVELS: readonly ["low", "medium", "high", "xhigh", "max", "ultra"];
8
+ export declare function isGptModel(model: UpstreamModel): boolean;
9
+ export declare function resolveCapabilities(model: UpstreamModel, revision: string, override?: ModelOverride): ModelCapabilities;
10
+ export declare function mergeCapabilities(capabilities: ModelCapabilities, override: ModelOverride | undefined, revision: string): ModelCapabilities;
11
+ export declare function capabilityForSelection(capabilities: ModelCapabilities, reasoningId: string | null | undefined, serviceTier: ServiceTier | undefined): {
12
+ reasoning?: ReasoningChoice;
13
+ serviceTier: ServiceTierChoice;
14
+ };
@@ -0,0 +1,15 @@
1
+ import type { ConnectionHandle, SessionId } from '@deepseek-ai/dsh-client-connection/client';
2
+ declare module '@deepseek-ai/dsh-client-ui-slots' {
3
+ interface SlotMap {
4
+ 'conversation.input.left': {
5
+ kind: 'list';
6
+ scope: 'session';
7
+ };
8
+ }
9
+ interface SessionStandardProps {
10
+ sessionId: SessionId;
11
+ }
12
+ }
13
+ export type ClientContext = import('@deepseek-ai/cordis').Context & {
14
+ connection: ConnectionHandle;
15
+ };
@@ -0,0 +1,3 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ export declare const inject: string[];
3
+ export declare function apply(ctx: Context): void;
@@ -0,0 +1,67 @@
1
+ export type JsonObject = Record<string, any>;
2
+ export type CompatibilityItem = {
3
+ name: string;
4
+ kind: 'config' | 'plugin' | 'mcp' | 'instructions' | 'skills';
5
+ state: 'loading' | 'loaded' | 'disabled' | 'unsupported' | 'failed';
6
+ reason?: string;
7
+ };
8
+ export type CodexMcpConfig = {
9
+ serverName: string;
10
+ source: string;
11
+ transport: 'stdio' | 'streamable-http';
12
+ command?: string;
13
+ args?: string[];
14
+ cwd?: string;
15
+ env?: Record<string, string>;
16
+ url?: string;
17
+ headers?: Record<string, string>;
18
+ startupTimeoutMs: number;
19
+ toolCallTimeoutMs: number;
20
+ enabledTools?: string[];
21
+ disabledTools: string[];
22
+ };
23
+ export type SkillRoot = {
24
+ path: string;
25
+ plugin?: string;
26
+ pluginId?: string;
27
+ };
28
+ export type CodexSnapshot = {
29
+ config: JsonObject;
30
+ mcp: CodexMcpConfig[];
31
+ skillRoots: SkillRoot[];
32
+ items: CompatibilityItem[];
33
+ };
34
+ export declare const object: (v: unknown) => JsonObject;
35
+ export declare const strings: (v: unknown) => string[];
36
+ export declare function resolveCodexHome(configured?: string): string;
37
+ export declare function optionalText(path: string): Promise<string | undefined>;
38
+ /** Minimal execution-world filesystem used by project readers. */
39
+ export type ProjectFileSystem = {
40
+ resolve(path: string, options?: {
41
+ signal?: AbortSignal;
42
+ }): Promise<any>;
43
+ stat(target: any, signal?: AbortSignal): Promise<unknown>;
44
+ readText(target: any, signal?: AbortSignal): Promise<string>;
45
+ };
46
+ export declare function projectText(path: string, fs?: ProjectFileSystem, signal?: AbortSignal): Promise<string | undefined>;
47
+ /** Repository root to cwd; without a repository only cwd participates. */
48
+ export declare function projectDirectories(cwd: string, fs?: ProjectFileSystem, signal?: AbortSignal): Promise<string[]>;
49
+ export declare function readCodexConfig(home: string, cwd?: string, fs?: ProjectFileSystem, signal?: AbortSignal): Promise<JsonObject>;
50
+ export declare function normalizeCodexMcp(name: string, value: unknown, source: string, base: string, environment?: NodeJS.ProcessEnv): CodexMcpConfig | undefined;
51
+ export declare function discoverCodexSnapshot(home: string, options: {
52
+ importPluginResources: boolean;
53
+ mcpAllowlist: string[];
54
+ }, context?: {
55
+ cwd?: string;
56
+ fs?: ProjectFileSystem;
57
+ signal?: AbortSignal;
58
+ previous?: CodexSnapshot;
59
+ }): Promise<CodexSnapshot>;
60
+ export declare function skillEnabled(config: JsonObject, skill: {
61
+ name: string;
62
+ path?: string;
63
+ }, plugin?: string): boolean;
64
+ export declare function skillEnabledWithFs(config: JsonObject, skill: {
65
+ name: string;
66
+ path?: string;
67
+ }, plugin: string | undefined, fs: ProjectFileSystem, signal?: AbortSignal): Promise<boolean>;
@@ -0,0 +1,9 @@
1
+ import { type JsonObject, type ProjectFileSystem } from './codex-config.js';
2
+ export type CodexInstructionFile = {
3
+ path: string;
4
+ content: string;
5
+ };
6
+ export declare function loadCodexInstructions(home: string, cwd: string, config: JsonObject, dshHome?: string, agentsHome?: string, fs?: ProjectFileSystem, signal?: AbortSignal): Promise<CodexInstructionFile[]>;
7
+ export declare function renderCodexInstructions(files: CodexInstructionFile[], maxBytes?: number): string;
8
+ /** A logged user-message baseline, never an unlogged mutation of LLM requests. */
9
+ export declare function installCodexInstructions(ctx: any, home: string): void;
@@ -0,0 +1,24 @@
1
+ import { type CompatibilityItem } from './codex-config.js';
2
+ export type CodexCompatibilityConfig = {
3
+ enabled: boolean;
4
+ codexHome?: string;
5
+ importInstructions: boolean;
6
+ importSkills: boolean;
7
+ importMcpServers: boolean;
8
+ importPluginResources: boolean;
9
+ watch: boolean;
10
+ pollIntervalMs: number;
11
+ mcpAllowlist: string[];
12
+ };
13
+ export type CodexCompatibilityRuntime = {
14
+ status(): {
15
+ enabled: boolean;
16
+ refreshing: boolean;
17
+ items: CompatibilityItem[];
18
+ };
19
+ refresh(): Promise<void>;
20
+ dispose(): Promise<void>;
21
+ };
22
+ export declare function installCodexCompatibility(ctx: any, config: CodexCompatibilityConfig): CodexCompatibilityRuntime;
23
+ export { discoverCodexSnapshot, normalizeCodexMcp, readCodexConfig, resolveCodexHome, } from './codex-config.js';
24
+ export { loadCodexInstructions, renderCodexInstructions, } from './codex-instructions.js';
@@ -0,0 +1,111 @@
1
+ import { Service, type Context } from '@deepseek-ai/cordis';
2
+ import z from '@deepseek-ai/schemastery';
3
+ import { bindTypertRemote } from '@deepseek-ai/dsh-typert-protocol';
4
+ import type { SessionId } from '@deepseek-ai/dsh-client-connection/client';
5
+ import { type CodexCompatibilityConfig, type CodexCompatibilityRuntime } from './codex.js';
6
+ import type { ModelCapabilities, ServiceTier } from './types.js';
7
+ type RouteOptions = {
8
+ enabled: boolean;
9
+ refreshIntervalMs: number;
10
+ capabilityCatalogUrl?: string;
11
+ overridesJSON: string;
12
+ };
13
+ export type PluginConfig = {
14
+ routes: Record<string, RouteOptions>;
15
+ codexCompatibility?: Partial<CodexCompatibilityConfig>;
16
+ };
17
+ export declare const name = "gpt-adapter";
18
+ export declare const inject: string[];
19
+ export declare const Config: z<PluginConfig, {
20
+ routes: {
21
+ get(): PluginConfig['routes'];
22
+ };
23
+ codexCompatibility: CodexCompatibilityConfig;
24
+ }>;
25
+ type BaseModelInfo = {
26
+ provider: string;
27
+ id: string;
28
+ name: string;
29
+ reasoning?: unknown;
30
+ [key: string]: unknown;
31
+ };
32
+ type NativeRequest = {
33
+ reasoningEffort?: string;
34
+ sessionId?: string;
35
+ };
36
+ export type NativeExtension = {
37
+ model: BaseModelInfo;
38
+ preserveReasoning?: boolean;
39
+ prepare(options: NativeRequest): {
40
+ payload: Record<string, unknown>;
41
+ observe(event: unknown): void;
42
+ };
43
+ };
44
+ declare module '@deepseek-ai/cordis' {
45
+ interface Context {
46
+ gptModels: GptModels;
47
+ }
48
+ }
49
+ /** Source-mode Remote markers are consumed by the existing authenticated Gateway. */
50
+ export declare class GptModels extends Service {
51
+ private readonly options;
52
+ private readonly settingsNs;
53
+ codex?: CodexCompatibilityRuntime;
54
+ readonly typertRemote: ReturnType<typeof bindTypertRemote>;
55
+ private readonly runners;
56
+ private readonly snapshots;
57
+ private readonly speeds;
58
+ private readonly results;
59
+ private readonly store;
60
+ private readonly nativeDescribe;
61
+ private closed;
62
+ private speedWrites;
63
+ constructor(ctx: Context, options: PluginConfig, settingsNs: string);
64
+ initialize(): Promise<void>;
65
+ private configuredProfiles;
66
+ private routeOptions;
67
+ enabledProviders(): string[];
68
+ private startRunner;
69
+ private profile;
70
+ private routeConfig;
71
+ private publish;
72
+ codexStatus(): {
73
+ enabled: boolean;
74
+ refreshing: boolean;
75
+ items: import("./codex-config.js").CompatibilityItem[];
76
+ };
77
+ refreshCodex(): Promise<void>;
78
+ status(provider: string): {
79
+ enabled: boolean;
80
+ status: import("./runtime.js").SyncStatus;
81
+ models: {
82
+ id: string;
83
+ stale: boolean;
84
+ }[];
85
+ capabilities: {
86
+ [x: string]: ModelCapabilities;
87
+ };
88
+ options: RouteOptions;
89
+ };
90
+ configure(provider: string, enabled: boolean): Promise<void>;
91
+ updateOptions(provider: string, refreshIntervalMs: number, capabilityCatalogUrl: string, overridesJSON: string): Promise<void>;
92
+ refresh(provider: string): Promise<void>;
93
+ removeStale(provider: string): Promise<void>;
94
+ setSpeed(sessionId: SessionId, provider: string, modelId: string, tier: ServiceTier): Promise<void>;
95
+ speed(sessionId: SessionId, provider: string, modelId: string): {
96
+ selected: ServiceTier;
97
+ last: {
98
+ requested: string;
99
+ actual?: string;
100
+ } | null;
101
+ };
102
+ /** The same effective capability supplies the native settings page and requests. */
103
+ capability(provider: string, modelId: string, displayName?: string, profileOverride?: {
104
+ api?: string;
105
+ reasoning?: string;
106
+ }): ModelCapabilities | undefined;
107
+ /** Capture request controls for the version-checked native runtime extension. */
108
+ capture(provider: string, modelId: string, base: BaseModelInfo): NativeExtension | undefined;
109
+ }
110
+ export declare function apply(ctx: Context, config: ReturnType<typeof Config>): Promise<void>;
111
+ export {};
@@ -0,0 +1,6 @@
1
+ export * from './types.js';
2
+ export * from './capabilities.js';
3
+ export * from './sync.js';
4
+ export * from './bridge.js';
5
+ export * from './runtime.js';
6
+ export * from './storage.js';
@@ -0,0 +1,18 @@
1
+ import type { NativeExtension } from './host.js';
2
+ type Snapshot = {
3
+ profiles: Map<string, Record<string, any>>;
4
+ models: {
5
+ stream(model: any, context: any, options: any): any;
6
+ [key: string]: any;
7
+ };
8
+ };
9
+ type NativeAdapter = {
10
+ current(): Snapshot;
11
+ modelInfo(snapshot: Snapshot, provider: string, model: string): any;
12
+ streamWithSnapshot(options: any, snapshot: Snapshot): AsyncIterable<any>;
13
+ prepareCall(provider: string, model: string, signal?: AbortSignal): Promise<any>;
14
+ stream(options: any): AsyncIterable<any>;
15
+ };
16
+ /** Install a disposable extension without replacing the host's plugin entries. */
17
+ export declare function installNativeAdapterBridge(prototype: NativeAdapter, capture: (provider: string, model: string, base: any) => NativeExtension | undefined): () => void;
18
+ export {};
@@ -0,0 +1,27 @@
1
+ import { type FetchLike } from './sync.js';
2
+ import type { SyncConfig, SyncSnapshot } from './types.js';
3
+ export type SyncStatus = {
4
+ state: 'idle' | 'refreshing' | 'ready' | 'error' | 'stopped';
5
+ error?: string;
6
+ fetchedAt?: string;
7
+ };
8
+ /** Owns exactly one route: single-flight refresh, bounded I/O, and disposal. */
9
+ export declare class ModelSynchronizer {
10
+ private readonly readConfig;
11
+ private readonly publish;
12
+ private readonly fetchImpl;
13
+ private snapshot;
14
+ private pending;
15
+ private timer;
16
+ private abort;
17
+ private stopped;
18
+ private started;
19
+ private status;
20
+ constructor(readConfig: () => Promise<SyncConfig>, publish: (snapshot: SyncSnapshot) => Promise<void>, fetchImpl?: FetchLike, initial?: SyncSnapshot);
21
+ current(): SyncSnapshot | undefined;
22
+ getStatus(): SyncStatus;
23
+ start(): void;
24
+ refresh(): Promise<SyncSnapshot>;
25
+ removeStale(ids: readonly string[]): Promise<SyncSnapshot>;
26
+ dispose(): void;
27
+ }