@shuind/dsh-codex-connect 0.2.0 → 0.2.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/INSTALL.md +349 -349
- package/LICENSE +202 -202
- package/MIGRATION.md +101 -101
- package/NOTICE +26 -26
- package/README.md +2 -2
- package/VERSIONING.md +69 -69
- package/docs/design.md +61 -61
- package/docs/design.zh.md +39 -39
- package/docs/licenses/pi-ai-oauth.txt +21 -21
- package/docs/licenses/standalone-cli.txt +115 -115
- package/docs/preflight-activity.md +42 -42
- package/docs/preflight-activity.zh.md +42 -42
- package/docs/quota-tool.md +46 -46
- package/docs/reference.md +240 -240
- package/docs/reference.zh.md +240 -240
- package/docs/skills/codex-quota-awareness/SKILL.md +12 -12
- package/lib/bin.js +12 -12
- package/lib/client.js +17 -69
- package/lib/index.js +84 -13
- package/lib/{models-Brnw-PH4.js → models-DUIoH1lI.js} +15 -15
- package/lib/{openai-codex-responses-DfZMR6a9.js → openai-codex-responses-CzSuDkhU.js} +17 -17
- package/package.json +1 -1
package/NOTICE
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
dsh-codex-connect
|
|
2
|
-
Copyright 2026 Frank Song
|
|
3
|
-
|
|
4
|
-
This product includes software derived from Yan-Zero/dsh-codex:
|
|
5
|
-
https://github.com/Yan-Zero/dsh-codex
|
|
6
|
-
Copyright 2026 Yan-Zero
|
|
7
|
-
|
|
8
|
-
Modifications and additional work for Codex Connect are Copyright 2026
|
|
9
|
-
Frank Song. They include a distinct package identity, opt-in routing and
|
|
10
|
-
capabilities, secret-free diagnostics, provider-conflict guidance, migration
|
|
11
|
-
documentation, security hardening, live plugin configuration, and Alpha
|
|
12
|
-
release validation.
|
|
13
|
-
|
|
14
|
-
The upstream material and the Codex Connect modifications are distributed
|
|
15
|
-
under the Apache License, Version 2.0 included in LICENSE.
|
|
16
|
-
|
|
17
|
-
This product also includes OAuth login and refresh code from earendil-works/pi
|
|
18
|
-
(@earendil-works/pi-ai 0.84.4), under the MIT license reproduced in
|
|
19
|
-
docs/licenses/pi-ai-oauth.txt. JWT payload decoding, callback connection cleanup
|
|
20
|
-
and structured refresh rejection handling are modified.
|
|
21
|
-
|
|
22
|
-
The standalone CLI bundles selected code from host and provider dependencies so
|
|
23
|
-
it can run from an isolated DSH plugin-exec process without copying host peers.
|
|
24
|
-
The bundled third-party package attributions and license texts are in
|
|
25
|
-
docs/licenses/standalone-cli.txt. Runtime plugin imports continue to use the
|
|
26
|
-
host's packages rather than these standalone CLI copies.
|
|
1
|
+
dsh-codex-connect
|
|
2
|
+
Copyright 2026 Frank Song
|
|
3
|
+
|
|
4
|
+
This product includes software derived from Yan-Zero/dsh-codex:
|
|
5
|
+
https://github.com/Yan-Zero/dsh-codex
|
|
6
|
+
Copyright 2026 Yan-Zero
|
|
7
|
+
|
|
8
|
+
Modifications and additional work for Codex Connect are Copyright 2026
|
|
9
|
+
Frank Song. They include a distinct package identity, opt-in routing and
|
|
10
|
+
capabilities, secret-free diagnostics, provider-conflict guidance, migration
|
|
11
|
+
documentation, security hardening, live plugin configuration, and Alpha
|
|
12
|
+
release validation.
|
|
13
|
+
|
|
14
|
+
The upstream material and the Codex Connect modifications are distributed
|
|
15
|
+
under the Apache License, Version 2.0 included in LICENSE.
|
|
16
|
+
|
|
17
|
+
This product also includes OAuth login and refresh code from earendil-works/pi
|
|
18
|
+
(@earendil-works/pi-ai 0.84.4), under the MIT license reproduced in
|
|
19
|
+
docs/licenses/pi-ai-oauth.txt. JWT payload decoding, callback connection cleanup
|
|
20
|
+
and structured refresh rejection handling are modified.
|
|
21
|
+
|
|
22
|
+
The standalone CLI bundles selected code from host and provider dependencies so
|
|
23
|
+
it can run from an isolated DSH plugin-exec process without copying host peers.
|
|
24
|
+
The bundled third-party package attributions and license texts are in
|
|
25
|
+
docs/licenses/standalone-cli.txt. Runtime plugin imports continue to use the
|
|
26
|
+
host's packages rather than these standalone CLI copies.
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
> **互斥说明**:本包与原版 `dsh-codex-connect` 注册同一个 `openai-codex` 模型提供方(`id: llm-openai-codex`),**不能同时安装**。
|
|
8
8
|
|
|
9
|
-
当前版本 `0.2.
|
|
9
|
+
当前版本 `0.2.1` 适配 **DeepSeek Harness `0.2.2-rc.1`–`0.2.2-rc.5`**(`engines.dsh: >=0.2.2-rc.1 <=0.2.2-rc.5`,已在 `0.2.2-rc.5` 上完整验证)。
|
|
10
10
|
|
|
11
11
|
## 安装
|
|
12
12
|
|
|
@@ -46,7 +46,7 @@ dsh plugin --profile web add @shuind/dsh-codex-connect
|
|
|
46
46
|
- 输入框右侧可直接切换当前 Codex 对话的速度档位。
|
|
47
47
|
- **按需开启的可选能力(默认全部关闭)**:
|
|
48
48
|
- **Codex 联网搜索(`enableSearch`)**:开启后临时接管当前配置的全局联网搜索,其他模型也可直接调用;停用后自动恢复原路由。内置可折叠的 BrowseComp / FACTS Search V2 准确率参考与一键选用。
|
|
49
|
-
- **GPT Image 图片生成与编辑(`enableImageGeneration`)**:注册生图与修图工具,任何支持工具调用的模型(包括 DeepSeek
|
|
49
|
+
- **GPT Image 图片生成与编辑(`enableImageGeneration`)**:注册生图与修图工具,任何支持工具调用的模型(包括 DeepSeek)都可直接调用,无需切换聊天模型;实测 Codex 订阅端统一路由至 `GPT-Image-2.6 Sunburst`(默认发送与官方 Codex 一致的 `gpt-image-2`,并保留可选的自定义 `imageModelHint` 输入框)。
|
|
50
50
|
- **Codex 原生上下文压缩(`enableNativeCompaction`)**:使用 OpenAI 服务端原生压缩替代默认文本摘要(仅对 Codex 订阅会话生效,失败自动回退)。装有 `dsh-codex-harness` 时随其「运行偏好 → 优先使用远程压缩」自动同步,无需单独管理。
|
|
51
51
|
- **静默更新提醒与 CLI 工具**:
|
|
52
52
|
- 优先查询 npm(`@shuind/dsh-codex-connect`),查不到时回退 GitHub Releases;同时校验目标版本 `engines.dsh` 是否适配当前 DSH,不适配时明确提示且同一版本仅提醒一次。
|
package/VERSIONING.md
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
# Versioning policy
|
|
2
|
-
|
|
3
|
-
English | [中文](docs/VERSIONING.zh.md)
|
|
4
|
-
|
|
5
|
-
Codex Connect versions identify plugin releases independently of DeepSeek Harness. Show the plugin version and its verified DSH pairing together; do not infer one from the other.
|
|
6
|
-
|
|
7
|
-
## Release identity and phase
|
|
8
|
-
|
|
9
|
-
The current release series starts at `0.2.0-alpha.1` and continues as `0.2.0-alpha.N`. This maintainer-approved numbering cleanup replaces the longer `0.1.0-alpha.4.x` sequence for new releases. It simplifies the independent plugin version; it does not narrow DSH compatibility, require a host upgrade, or promote the plugin to Beta or stable. Published versions and tags keep their original names and contents. A DSH update does not reset the plugin counter.
|
|
10
|
-
|
|
11
|
-
The publishing workflow accepts `MAJOR.MINOR.PATCH-alpha.NUMBER[.NUMBER…]`, with nonnegative integer components and no leading zeroes. Build metadata is not a release counter: SemVer ignores `+build.n` when comparing versions, and the pinned npm publishing implementation removes it. Use a distinct, higher-precedence version for every new package. Never overwrite a published package or move its release tag to different content.
|
|
12
|
-
|
|
13
|
-
The plugin's public behavior includes configuration, tools, commands, and stored data. In the `0.y.z` development period, incompatible changes require explicit release notes and migration guidance; intentionally starting a new incompatible release line increments the plugin minor version. Routine iterations within the current Alpha line increment its prerelease counter. Copying a host's version is not a substitute for deciding the plugin's change scope.
|
|
14
|
-
|
|
15
|
-
Alpha, Beta, RC, and a non-prerelease version describe the plugin's readiness, not DSH's. Phase promotion is a separate maintainer decision backed by recorded verification, including real-account and upgrade acceptance where relevant. A stable DSH release does not make the plugin stable. The current workflow remains Alpha-only; Beta, RC, and stable publishing need a separately reviewed workflow/channel change.
|
|
16
|
-
|
|
17
|
-
## Compatibility evidence
|
|
18
|
-
|
|
19
|
-
| Information | Maintained in | Meaning |
|
|
20
|
-
|---|---|---|
|
|
21
|
-
| Plugin build version | `package.json.version` | Identity embedded in the build and CLI |
|
|
22
|
-
| Host dependency requirements | `compatibility.json` and dependency declarations | Intended supported runtime constraints, checked for consistency |
|
|
23
|
-
| Verified exact combinations | `verified-compatibility.json` | Evidence from checks of each explicit DSH/plugin pair |
|
|
24
|
-
| User-visible changes | GitHub Release notes and `update-highlights.json` | What changed between plugin releases |
|
|
25
|
-
|
|
26
|
-
Keep the compatibility catalog's `schemaVersion: 1`, `checkedAt`, `latestDshVersion`, and `pluginVersions[].{version,verifiedDshVersions}` fields at the existing URL. Preserve historical entries. An unlisted pair is unverified, not necessarily incompatible. Neither a target dependency nor a green test on a different pairing proves compatibility.
|
|
27
|
-
|
|
28
|
-
Record a new exact pair only after verification. A candidate's verification record does not prove npm publication. Before recommending it publicly, confirm both that the version exists on npm with its matching release tag and that the pair is recorded. The offline lint check verifies the recorded pair and bilingual agreement; it does not contact npm or certify publication.
|
|
29
|
-
|
|
30
|
-
Do not replace V1 in place with a version-keyed object or infer a range from a single successful version. Any future incompatible format needs a versioned endpoint and continued output for installed V1 clients.
|
|
31
|
-
|
|
32
|
-
## Channels and recommendations
|
|
33
|
-
|
|
34
|
-
- `alpha` is the moving channel written by the current release workflow.
|
|
35
|
-
- `latest` follows the newest published plugin release, by SemVer precedence, verified against the exact DSH version currently resolved by npm `latest`. That plugin release may be an Alpha or a stable version; the channel does not change its readiness designation. Promotion is a separate, explicitly authorized maintainer action. Publishing an Alpha does not authorize or perform it.
|
|
36
|
-
- Exact installation commands identify a plugin release; dist-tags do not guarantee compatibility.
|
|
37
|
-
- Keep the public README recommendation on a confirmed published pair while preparing a newer candidate. The recommendation may therefore differ from `package.json.version`.
|
|
38
|
-
|
|
39
|
-
This rule supersedes the former stable-only restriction after the first stable release, as decided in [#445](https://github.com/franksong2702/dsh-codex-connect/issues/445#issuecomment-6935776620). It changes channel policy, not the current npm tag, supported hosts or release workflow. If DSH `latest` advances without a verified published pairing, leave the plugin tag unchanged and report the default-install gap; do not infer compatibility or promote an unverified candidate. Existing users on other DSH versions still need a verified exact pairing. Follow [the promotion procedure](RELEASING.md#promoting-latest-short-lived-interactive-authentication) for fresh registry checks, isolated installation, authorization, readback and rollback.
|
|
40
|
-
|
|
41
|
-
The project newest version and the newest verified plugin for a user's existing DSH are different questions. More precise host-specific recommendations and generated installation sections are follow-up work; this policy does not claim the current update UI computes that choice from every historical record.
|
|
42
|
-
|
|
43
|
-
## Update highlights
|
|
44
|
-
|
|
45
|
-
Keep V1 highlight entries in increasing SemVer order, with unique versions and known capability kinds. Preserve the existing history. New documentation-only or maintenance releases may be omitted; existing empty `highlights` arrays remain valid. Release notes still describe fixes. Do not invent capabilities or require a contiguous counter sequence just to validate the catalog.
|
|
46
|
-
|
|
47
|
-
## Numbering migration to 0.2.0 Alpha
|
|
48
|
-
|
|
49
|
-
`0.2.0-alpha.1` sorts above every `0.1.0-alpha.4.x` release, including the last published `0.1.0-alpha.4.54`. Do not reset to `0.1.0-alpha.1`: it sorts below the historical series. The unshipped `0.1.0-alpha.4.55` candidate is replaced by this version and is not a published release.
|
|
50
|
-
|
|
51
|
-
The existing update checker compares both `alpha` and `latest` using SemVer, so it recognizes the new Alpha even while `latest` stays at `0.1.0-alpha.4.50`. It reports an update without installing it or upgrading DSH. Users can install the exact plugin version into their existing profile. Compatibility and highlight history keep their V1 formats; the four declared DSH targets remain `0.1.7-rc.1`, `0.1.7-rc.2`, `0.2.0-rc.1`, and `0.2.0-rc.2`. Exact verification still precedes a new catalog entry.
|
|
52
|
-
|
|
53
|
-
Publication uses the existing Alpha-only workflow, protected environment, `v0.2.0-alpha.1` tag, GitHub prerelease, and npm `alpha` channel. It does not promote `latest`. Any later phase change still requires separate review of the gates and publication/readback path. Keep host upgrades, schema changes, and numbering migration separately reviewable.
|
|
54
|
-
|
|
55
|
-
## Release checks
|
|
56
|
-
|
|
57
|
-
Follow [RELEASING.md](RELEASING.md) for the complete procedure. Run the frozen install and existing checks separately:
|
|
58
|
-
|
|
59
|
-
```sh
|
|
60
|
-
pnpm install --frozen-lockfile
|
|
61
|
-
pnpm run check
|
|
62
|
-
pnpm run test:browser
|
|
63
|
-
pnpm run check:dsh-matrix
|
|
64
|
-
npm pack --dry-run
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
`check` does not include the browser suite or isolated DSH installation. Regenerate the lockfile only when dependency changes require it; do not refresh the dependency tree for a documentation or localization release. Automated checks do not replace real OAuth acceptance. Merge, publish, and `latest` promotion remain distinct operations.
|
|
68
|
-
|
|
69
|
-
Normative references: [SemVer 2.0.0](https://semver.org/spec/v2.0.0.html) and the pinned [npm 11.6.4 publishing implementation](https://github.com/npm/cli/blob/v11.6.4/workspaces/libnpmpublish/lib/publish.js).
|
|
1
|
+
# Versioning policy
|
|
2
|
+
|
|
3
|
+
English | [中文](docs/VERSIONING.zh.md)
|
|
4
|
+
|
|
5
|
+
Codex Connect versions identify plugin releases independently of DeepSeek Harness. Show the plugin version and its verified DSH pairing together; do not infer one from the other.
|
|
6
|
+
|
|
7
|
+
## Release identity and phase
|
|
8
|
+
|
|
9
|
+
The current release series starts at `0.2.0-alpha.1` and continues as `0.2.0-alpha.N`. This maintainer-approved numbering cleanup replaces the longer `0.1.0-alpha.4.x` sequence for new releases. It simplifies the independent plugin version; it does not narrow DSH compatibility, require a host upgrade, or promote the plugin to Beta or stable. Published versions and tags keep their original names and contents. A DSH update does not reset the plugin counter.
|
|
10
|
+
|
|
11
|
+
The publishing workflow accepts `MAJOR.MINOR.PATCH-alpha.NUMBER[.NUMBER…]`, with nonnegative integer components and no leading zeroes. Build metadata is not a release counter: SemVer ignores `+build.n` when comparing versions, and the pinned npm publishing implementation removes it. Use a distinct, higher-precedence version for every new package. Never overwrite a published package or move its release tag to different content.
|
|
12
|
+
|
|
13
|
+
The plugin's public behavior includes configuration, tools, commands, and stored data. In the `0.y.z` development period, incompatible changes require explicit release notes and migration guidance; intentionally starting a new incompatible release line increments the plugin minor version. Routine iterations within the current Alpha line increment its prerelease counter. Copying a host's version is not a substitute for deciding the plugin's change scope.
|
|
14
|
+
|
|
15
|
+
Alpha, Beta, RC, and a non-prerelease version describe the plugin's readiness, not DSH's. Phase promotion is a separate maintainer decision backed by recorded verification, including real-account and upgrade acceptance where relevant. A stable DSH release does not make the plugin stable. The current workflow remains Alpha-only; Beta, RC, and stable publishing need a separately reviewed workflow/channel change.
|
|
16
|
+
|
|
17
|
+
## Compatibility evidence
|
|
18
|
+
|
|
19
|
+
| Information | Maintained in | Meaning |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| Plugin build version | `package.json.version` | Identity embedded in the build and CLI |
|
|
22
|
+
| Host dependency requirements | `compatibility.json` and dependency declarations | Intended supported runtime constraints, checked for consistency |
|
|
23
|
+
| Verified exact combinations | `verified-compatibility.json` | Evidence from checks of each explicit DSH/plugin pair |
|
|
24
|
+
| User-visible changes | GitHub Release notes and `update-highlights.json` | What changed between plugin releases |
|
|
25
|
+
|
|
26
|
+
Keep the compatibility catalog's `schemaVersion: 1`, `checkedAt`, `latestDshVersion`, and `pluginVersions[].{version,verifiedDshVersions}` fields at the existing URL. Preserve historical entries. An unlisted pair is unverified, not necessarily incompatible. Neither a target dependency nor a green test on a different pairing proves compatibility.
|
|
27
|
+
|
|
28
|
+
Record a new exact pair only after verification. A candidate's verification record does not prove npm publication. Before recommending it publicly, confirm both that the version exists on npm with its matching release tag and that the pair is recorded. The offline lint check verifies the recorded pair and bilingual agreement; it does not contact npm or certify publication.
|
|
29
|
+
|
|
30
|
+
Do not replace V1 in place with a version-keyed object or infer a range from a single successful version. Any future incompatible format needs a versioned endpoint and continued output for installed V1 clients.
|
|
31
|
+
|
|
32
|
+
## Channels and recommendations
|
|
33
|
+
|
|
34
|
+
- `alpha` is the moving channel written by the current release workflow.
|
|
35
|
+
- `latest` follows the newest published plugin release, by SemVer precedence, verified against the exact DSH version currently resolved by npm `latest`. That plugin release may be an Alpha or a stable version; the channel does not change its readiness designation. Promotion is a separate, explicitly authorized maintainer action. Publishing an Alpha does not authorize or perform it.
|
|
36
|
+
- Exact installation commands identify a plugin release; dist-tags do not guarantee compatibility.
|
|
37
|
+
- Keep the public README recommendation on a confirmed published pair while preparing a newer candidate. The recommendation may therefore differ from `package.json.version`.
|
|
38
|
+
|
|
39
|
+
This rule supersedes the former stable-only restriction after the first stable release, as decided in [#445](https://github.com/franksong2702/dsh-codex-connect/issues/445#issuecomment-6935776620). It changes channel policy, not the current npm tag, supported hosts or release workflow. If DSH `latest` advances without a verified published pairing, leave the plugin tag unchanged and report the default-install gap; do not infer compatibility or promote an unverified candidate. Existing users on other DSH versions still need a verified exact pairing. Follow [the promotion procedure](RELEASING.md#promoting-latest-short-lived-interactive-authentication) for fresh registry checks, isolated installation, authorization, readback and rollback.
|
|
40
|
+
|
|
41
|
+
The project newest version and the newest verified plugin for a user's existing DSH are different questions. More precise host-specific recommendations and generated installation sections are follow-up work; this policy does not claim the current update UI computes that choice from every historical record.
|
|
42
|
+
|
|
43
|
+
## Update highlights
|
|
44
|
+
|
|
45
|
+
Keep V1 highlight entries in increasing SemVer order, with unique versions and known capability kinds. Preserve the existing history. New documentation-only or maintenance releases may be omitted; existing empty `highlights` arrays remain valid. Release notes still describe fixes. Do not invent capabilities or require a contiguous counter sequence just to validate the catalog.
|
|
46
|
+
|
|
47
|
+
## Numbering migration to 0.2.0 Alpha
|
|
48
|
+
|
|
49
|
+
`0.2.0-alpha.1` sorts above every `0.1.0-alpha.4.x` release, including the last published `0.1.0-alpha.4.54`. Do not reset to `0.1.0-alpha.1`: it sorts below the historical series. The unshipped `0.1.0-alpha.4.55` candidate is replaced by this version and is not a published release.
|
|
50
|
+
|
|
51
|
+
The existing update checker compares both `alpha` and `latest` using SemVer, so it recognizes the new Alpha even while `latest` stays at `0.1.0-alpha.4.50`. It reports an update without installing it or upgrading DSH. Users can install the exact plugin version into their existing profile. Compatibility and highlight history keep their V1 formats; the four declared DSH targets remain `0.1.7-rc.1`, `0.1.7-rc.2`, `0.2.0-rc.1`, and `0.2.0-rc.2`. Exact verification still precedes a new catalog entry.
|
|
52
|
+
|
|
53
|
+
Publication uses the existing Alpha-only workflow, protected environment, `v0.2.0-alpha.1` tag, GitHub prerelease, and npm `alpha` channel. It does not promote `latest`. Any later phase change still requires separate review of the gates and publication/readback path. Keep host upgrades, schema changes, and numbering migration separately reviewable.
|
|
54
|
+
|
|
55
|
+
## Release checks
|
|
56
|
+
|
|
57
|
+
Follow [RELEASING.md](RELEASING.md) for the complete procedure. Run the frozen install and existing checks separately:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
pnpm install --frozen-lockfile
|
|
61
|
+
pnpm run check
|
|
62
|
+
pnpm run test:browser
|
|
63
|
+
pnpm run check:dsh-matrix
|
|
64
|
+
npm pack --dry-run
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`check` does not include the browser suite or isolated DSH installation. Regenerate the lockfile only when dependency changes require it; do not refresh the dependency tree for a documentation or localization release. Automated checks do not replace real OAuth acceptance. Merge, publish, and `latest` promotion remain distinct operations.
|
|
68
|
+
|
|
69
|
+
Normative references: [SemVer 2.0.0](https://semver.org/spec/v2.0.0.html) and the pinned [npm 11.6.4 publishing implementation](https://github.com/npm/cli/blob/v11.6.4/workspaces/libnpmpublish/lib/publish.js).
|
package/docs/design.md
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
# Codex Connect: Alpha design
|
|
2
|
-
|
|
3
|
-
## Ownership and composition
|
|
4
|
-
|
|
5
|
-
The package registers `openai-codex` through Harness's public `LlmRuntime` and `PiAiAdapter` surfaces. The main model path is not a one-shot subagent: it remains the normal Harness agent loop, preserving native tool approvals, permission policy, streaming, attachment resolution, reasoning replay, session persistence, compaction, and recovery.
|
|
6
|
-
|
|
7
|
-
The bundle patch inserts only `llm-openai-codex`. It never writes `agent-default-model` or `web.searchProvider`. `enableSearch` and `enableImageTool` are capability gates defaulting to `false`; the optional service injections are not registered while disabled.
|
|
8
|
-
|
|
9
|
-
The startup-only `enableQuotaTool` gate also defaults to `false`. When explicitly enabled, `codex_connect_quota` uses the Host tool runtime and the existing `OpenAICodexQuotaState`; it has no separate transport, account selector, refresh bypass or budget controller. The projection includes only common Codex window numbers and freshness, without upstream names/ids, balances or routing authority. Successful snapshots now retain their local fetch time across cache hits. See [quota observation](quota-tool.md).
|
|
10
|
-
|
|
11
|
-
The Host registers `llm-openai-codex` as the plugin-owned capability settings namespace. DSH's `llm-pi-ai` catalog owns the `openai-codex` configurable-provider directory entry, while Codex Connect registers the active adapter without redeclaring that entry. The browser binds the plugin namespace through Harness's settings-scope transport and renders account, quota, Save/Discard capability controls in the existing Plugin configuration card. Revision-fenced field writes preserve unrelated settings. Committed changes reconcile search and image registrations live. Default-model settings are never written.
|
|
12
|
-
|
|
13
|
-
Fast Mode remains per-session process-local state. Separate default-off profile settings seed newly started top-level and subagent sessions through `agent/created`; resume, setting edits, and repeated startup notifications do not change an existing session's Composer choice. The adapter adds `service_tier: 'priority'` only on Codex requests for an enabled session.
|
|
14
|
-
|
|
15
|
-
## Saved Task recovery
|
|
16
|
-
|
|
17
|
-
The plugin handles saved v1 and v2 Task state for verified Hosts. Authenticated owners can read grants, use Stop or manual takeover, disable delegation, and archive a v2 Task after its child cleanup and delivery are verified. Legacy files retain their existing format. Recovery fences stale process state and preserves request counters and saved receipts. Start, resume, upgrade, and delegation enablement are rejected, including when a stale client supplies a matching receipt.
|
|
18
|
-
|
|
19
|
-
Ordinary requests pass through with the Host's route. A related saved task requires verified ownership. Missing state recorded by a session marker, ambiguous ownership, or unresolved child cleanup can block dispatch. A manual takeover preserves the existing portable-history projection for the next ordinary Codex request.
|
|
20
|
-
|
|
21
|
-
The product and synthetic host checks use saved-state recovery. The Task model-selection tool, delegation tools, child launcher, provider request scopes, and live evidence capture have been removed. Historical Phase 1 and Phase 2 behavior is recorded in [the Phase 1 contract](experiments/adaptive-task-phase1.md) and [the Phase 2 design](experiments/adaptive-task-phase2-design.md).
|
|
22
|
-
|
|
23
|
-
## OAuth persistence
|
|
24
|
-
|
|
25
|
-
The plugin uses `$DSH_HOME/.openai-codex-auth.json`, separate from Codex CLI/Desktop state. Format version 2 stores at most 16 OAuth accounts and names exactly one active account. Existing version-1 documents remain readable and migrate on the first credential mutation; that migration first creates the owner-only `.openai-codex-auth.json.v1-backup` rollback copy. A pre-existing rollback copy must be owner-only and match the current version-1 document or migration stops before replacing the main document. Removing any account or signing out deletes the rollback copy so removed credentials do not persist there. Documents are limited to 512 KiB. POSIX reads reject group/world-accessible files, non-regular files are rejected, writes are atomic, and mutations use the Harness cross-process file lock. Callers receive cloned credentials.
|
|
26
|
-
|
|
27
|
-
Browser account routes expose deterministic plugin-derived keys, local display labels, masked email addresses when present in the OAuth token, and active state. They never expose the provider's account id or token fields. Activation and deletion are serialized with browser OAuth. Each model request captures its current account before auth resolution; a refresh updates only that captured account without changing the current selection. After OAuth resolution, quota, image-generation, and Auto-review requests resolve the account id stored with that exact access token, so a concurrent account switch cannot combine credentials from different accounts. Deleting the active account while another remains requires the caller to name the replacement; provider-global logout deletes every account. Browser-origin trust is a separate `$DSH_HOME/.openai-codex-trusted-origins.json` sidecar with `version: 1`, `mode: "allowlist"`, and exact normalized HTTP(S) origins; it never contains OAuth material and is changed only by the standalone CLI.
|
|
28
|
-
|
|
29
|
-
The settings routes and CLI reuse the existing OAuth path and route names for migration compatibility. Only an explicit login operation emits an authorization URL or code. Browser requests are accepted by default only from loopback; a remote request must use an exact effective HTTP(S) origin in the current sidecar, must not carry cross-site Fetch Metadata, and must match any supplied Origin exactly. The sidecar is re-read for every request, and unknown fields or modes fail closed. A login challenge accepts only credential-free HTTPS URLs and fails closed after 30 seconds or when the provider finishes without a URL; logout and disposal cancel pending waiters. Status responses are redacted. Doctor uses `lstat` metadata and never opens the document.
|
|
30
|
-
|
|
31
|
-
Browser account and update requests have a 45-second deadline covering response headers and JSON bodies. A timed-out account mutation is not retried automatically: while the account view is observed, the browser reads server state again because the mutation may already have committed. Failed state reads retry after five seconds, including when no account is stored. Plugin disposal aborts browser waits without logging out the server account.
|
|
32
|
-
|
|
33
|
-
## Backend request governance
|
|
34
|
-
|
|
35
|
-
The composition root supplies the Task recovery guards for adapter streaming and auxiliary requests. Ordinary requests use the existing backend governor and provider retry policy. Recovery preserves the counters stored by earlier releases and does not create Task dispatch scopes.
|
|
36
|
-
|
|
37
|
-
Authenticated runtime traffic to `https://chatgpt.com/backend-api/` passes through one plugin-owned request governor before network dispatch. The governor fail-closes on any other origin/path, composes caller and route deadlines, keeps the existing Codex-only proxy scope alive for the complete logical direct request or provider stream, assigns a fresh `x-client-request-id` to every HTTP attempt, and bounds one plugin instance to eight concurrent backend requests. Concurrency is counted per HTTP attempt, not during authentication; even parallel fetches within one logical operation share that limit. Requests queued behind that limit remain cancellable and within route deadlines. Cancelling unread/paused bodies, response-hook failures and scope disposal releases resources; scope disposal runs before other plugin teardown waits. URL/header inputs are snapshotted before queue waits and authenticated requests never automatically follow redirects. HTTP `429` or `503` responses with a valid `Retry-After` create a lane-local cooldown that is rechecked on admission, never occupies a network slot while waiting, and honors longer service delays using timer slices of at most 15 minutes; the governor does not invent an account-block verdict or replay a failed model turn. Route-specific protocol retries remain with their existing owners, such as pi-ai model retry semantics and native-compaction's bounded retry loop.
|
|
38
|
-
|
|
39
|
-
Direct plugin routes use the honest shared identity `originator: deepseek-harness` and `User-Agent: dsh-codex-connect`; Search, quota, image generation, Auto-review, and native compaction all use that policy. The pi-ai model route deliberately preserves pi-ai's provider identity rather than impersonating Codex CLI/Desktop, while still receiving the same attempt id, concurrency, proxy, cancellation, server-directed cooldown, and bounded HTTP diagnostic metadata. Native compaction travels through the provider fetch seam at runtime and therefore shares the model governor lane while retaining the direct-plugin identity on its own request. This split is explicit policy, not a claim about undocumented upstream risk controls.
|
|
40
|
-
|
|
41
|
-
Standalone capability/Auto-review probes reuse the same pure URL/header policy but keep their isolated one-shot dispatcher and deadline instead of depending on a running plugin governor. The proxy reachability probe is also a bootstrap exception because it tests the proxy primitive used by the governor itself. OAuth authorization/refresh and credential-free public image fetching are outside `backend-api` and keep their separate security boundaries. Browser calls to this plugin's own local HTTP routes are likewise not upstream backend traffic.
|
|
42
|
-
|
|
43
|
-
## Search and images
|
|
44
|
-
|
|
45
|
-
When `enableSearch: true`, the plugin registers its standalone search provider. It does not append a plugin-owned required-on-read Session event because an external package cannot guarantee that its `@deepseek-ai/dsh-session` module instance owns the Host persistence vocabulary; the standard web Tool call and result remain in the Session log. DSH `0.1.2-rc.1` does not expose the WebRuntime provider selection through its settings service, so the compatibility adapter verifies that release's runtime field, records the previous provider, and selects Codex only while the capability is active. Disable and disposal restore the recorded provider unless another owner has selected a newer route. An unsupported runtime fails activation instead of reporting a route change that did not occur. Search responses are mapped to Harness text and citation records.
|
|
46
|
-
|
|
47
|
-
When `enableImageTool: true`, `view_image` is registered only after tools, filesystem, and attachment services are available. Local files remain bounded by the Harness filesystem surface. Remote images allow only credential-free public HTTP(S): all DNS answers must be public unicast, each redirect is revalidated, and each socket is pinned to the validated address to close DNS-rebinding gaps. The tool also checks bounded bytes, accepted media signatures, and current-model image support before saving a Harness attachment.
|
|
48
|
-
|
|
49
|
-
Each remote-image redirect hop has one 30-second deadline covering DNS, connection, and body consumption. Cancellation settles the caller's wait immediately; an operating-system DNS lookup may still finish later, but its result cannot start a new HTTP request after cancellation or timeout.
|
|
50
|
-
|
|
51
|
-
Successful Codex image-generation Tool results also render in the independent completed-Turn tail. DSH groups Tool calls into a collapsed processing disclosure, so the keyed Tool card alone cannot make generated images visible with the answer. The tail reads only this Turn's settled Tool rows, including nested PTC calls and restored history, and uses the same validated result metadata, session-bound preview loader, Lightbox, and download controls as the Tool card. Failed, malformed, unrelated, or post-answer results do not enter the visible image row. The Tool card remains available in processing details.
|
|
52
|
-
|
|
53
|
-
Image preview recovery uses additive metadata/envelope version 3 only when original persistence completed but preview creation failed. It records exact originals with `previewStatus: unavailable` and no fabricated attachment. Host validation precedes original persistence, so preview failures cannot bypass the original image validation gate. Native and PTC history can admit these originals for the creating session or an authorized inherited prefix; arbitrary text cannot. The existing result card exposes original download and explicit editing without a new image request. Normal version 1/2 results are unchanged; cancellation still cleans unpublished originals. See [implementation and validation](agent-notes/image-preview-recovery.md).
|
|
54
|
-
|
|
55
|
-
## Conflicts and diagnostics
|
|
56
|
-
|
|
57
|
-
Before registration the plugin checks current provider ids. An existing `openai-codex` adapter produces a focused message naming the likely legacy-bundle or manual-provider cause. The boot-free CLI `doctor` reports package/runtime version, OAuth path metadata, capability defaults, and safe conflict guidance without returning auth content.
|
|
58
|
-
|
|
59
|
-
## Compatibility boundary
|
|
60
|
-
|
|
61
|
-
Alpha 4.27 pins Harness `0.1.2-rc.1` development dependencies and follows its pi-ai range `^0.84.2`. Supported Node.js remains `^22.19.0 || >=24.0.0`. The keyed `settings.plugin.item` integration remains, while client types come from their Session Controller, Settings, Store, and Renderer owners. The published compatibility record lists the exact Alpha 4.27 and DSH `0.1.2-rc.1` pair. Backend eligibility, quotas, models, service-side context capacity, and protocol details remain controlled upstream. Tests use temporary OAuth documents and mocked network responses; CI does not perform real authentication.
|
|
1
|
+
# Codex Connect: Alpha design
|
|
2
|
+
|
|
3
|
+
## Ownership and composition
|
|
4
|
+
|
|
5
|
+
The package registers `openai-codex` through Harness's public `LlmRuntime` and `PiAiAdapter` surfaces. The main model path is not a one-shot subagent: it remains the normal Harness agent loop, preserving native tool approvals, permission policy, streaming, attachment resolution, reasoning replay, session persistence, compaction, and recovery.
|
|
6
|
+
|
|
7
|
+
The bundle patch inserts only `llm-openai-codex`. It never writes `agent-default-model` or `web.searchProvider`. `enableSearch` and `enableImageTool` are capability gates defaulting to `false`; the optional service injections are not registered while disabled.
|
|
8
|
+
|
|
9
|
+
The startup-only `enableQuotaTool` gate also defaults to `false`. When explicitly enabled, `codex_connect_quota` uses the Host tool runtime and the existing `OpenAICodexQuotaState`; it has no separate transport, account selector, refresh bypass or budget controller. The projection includes only common Codex window numbers and freshness, without upstream names/ids, balances or routing authority. Successful snapshots now retain their local fetch time across cache hits. See [quota observation](quota-tool.md).
|
|
10
|
+
|
|
11
|
+
The Host registers `llm-openai-codex` as the plugin-owned capability settings namespace. DSH's `llm-pi-ai` catalog owns the `openai-codex` configurable-provider directory entry, while Codex Connect registers the active adapter without redeclaring that entry. The browser binds the plugin namespace through Harness's settings-scope transport and renders account, quota, Save/Discard capability controls in the existing Plugin configuration card. Revision-fenced field writes preserve unrelated settings. Committed changes reconcile search and image registrations live. Default-model settings are never written.
|
|
12
|
+
|
|
13
|
+
Fast Mode remains per-session process-local state. Separate default-off profile settings seed newly started top-level and subagent sessions through `agent/created`; resume, setting edits, and repeated startup notifications do not change an existing session's Composer choice. The adapter adds `service_tier: 'priority'` only on Codex requests for an enabled session.
|
|
14
|
+
|
|
15
|
+
## Saved Task recovery
|
|
16
|
+
|
|
17
|
+
The plugin handles saved v1 and v2 Task state for verified Hosts. Authenticated owners can read grants, use Stop or manual takeover, disable delegation, and archive a v2 Task after its child cleanup and delivery are verified. Legacy files retain their existing format. Recovery fences stale process state and preserves request counters and saved receipts. Start, resume, upgrade, and delegation enablement are rejected, including when a stale client supplies a matching receipt.
|
|
18
|
+
|
|
19
|
+
Ordinary requests pass through with the Host's route. A related saved task requires verified ownership. Missing state recorded by a session marker, ambiguous ownership, or unresolved child cleanup can block dispatch. A manual takeover preserves the existing portable-history projection for the next ordinary Codex request.
|
|
20
|
+
|
|
21
|
+
The product and synthetic host checks use saved-state recovery. The Task model-selection tool, delegation tools, child launcher, provider request scopes, and live evidence capture have been removed. Historical Phase 1 and Phase 2 behavior is recorded in [the Phase 1 contract](experiments/adaptive-task-phase1.md) and [the Phase 2 design](experiments/adaptive-task-phase2-design.md).
|
|
22
|
+
|
|
23
|
+
## OAuth persistence
|
|
24
|
+
|
|
25
|
+
The plugin uses `$DSH_HOME/.openai-codex-auth.json`, separate from Codex CLI/Desktop state. Format version 2 stores at most 16 OAuth accounts and names exactly one active account. Existing version-1 documents remain readable and migrate on the first credential mutation; that migration first creates the owner-only `.openai-codex-auth.json.v1-backup` rollback copy. A pre-existing rollback copy must be owner-only and match the current version-1 document or migration stops before replacing the main document. Removing any account or signing out deletes the rollback copy so removed credentials do not persist there. Documents are limited to 512 KiB. POSIX reads reject group/world-accessible files, non-regular files are rejected, writes are atomic, and mutations use the Harness cross-process file lock. Callers receive cloned credentials.
|
|
26
|
+
|
|
27
|
+
Browser account routes expose deterministic plugin-derived keys, local display labels, masked email addresses when present in the OAuth token, and active state. They never expose the provider's account id or token fields. Activation and deletion are serialized with browser OAuth. Each model request captures its current account before auth resolution; a refresh updates only that captured account without changing the current selection. After OAuth resolution, quota, image-generation, and Auto-review requests resolve the account id stored with that exact access token, so a concurrent account switch cannot combine credentials from different accounts. Deleting the active account while another remains requires the caller to name the replacement; provider-global logout deletes every account. Browser-origin trust is a separate `$DSH_HOME/.openai-codex-trusted-origins.json` sidecar with `version: 1`, `mode: "allowlist"`, and exact normalized HTTP(S) origins; it never contains OAuth material and is changed only by the standalone CLI.
|
|
28
|
+
|
|
29
|
+
The settings routes and CLI reuse the existing OAuth path and route names for migration compatibility. Only an explicit login operation emits an authorization URL or code. Browser requests are accepted by default only from loopback; a remote request must use an exact effective HTTP(S) origin in the current sidecar, must not carry cross-site Fetch Metadata, and must match any supplied Origin exactly. The sidecar is re-read for every request, and unknown fields or modes fail closed. A login challenge accepts only credential-free HTTPS URLs and fails closed after 30 seconds or when the provider finishes without a URL; logout and disposal cancel pending waiters. Status responses are redacted. Doctor uses `lstat` metadata and never opens the document.
|
|
30
|
+
|
|
31
|
+
Browser account and update requests have a 45-second deadline covering response headers and JSON bodies. A timed-out account mutation is not retried automatically: while the account view is observed, the browser reads server state again because the mutation may already have committed. Failed state reads retry after five seconds, including when no account is stored. Plugin disposal aborts browser waits without logging out the server account.
|
|
32
|
+
|
|
33
|
+
## Backend request governance
|
|
34
|
+
|
|
35
|
+
The composition root supplies the Task recovery guards for adapter streaming and auxiliary requests. Ordinary requests use the existing backend governor and provider retry policy. Recovery preserves the counters stored by earlier releases and does not create Task dispatch scopes.
|
|
36
|
+
|
|
37
|
+
Authenticated runtime traffic to `https://chatgpt.com/backend-api/` passes through one plugin-owned request governor before network dispatch. The governor fail-closes on any other origin/path, composes caller and route deadlines, keeps the existing Codex-only proxy scope alive for the complete logical direct request or provider stream, assigns a fresh `x-client-request-id` to every HTTP attempt, and bounds one plugin instance to eight concurrent backend requests. Concurrency is counted per HTTP attempt, not during authentication; even parallel fetches within one logical operation share that limit. Requests queued behind that limit remain cancellable and within route deadlines. Cancelling unread/paused bodies, response-hook failures and scope disposal releases resources; scope disposal runs before other plugin teardown waits. URL/header inputs are snapshotted before queue waits and authenticated requests never automatically follow redirects. HTTP `429` or `503` responses with a valid `Retry-After` create a lane-local cooldown that is rechecked on admission, never occupies a network slot while waiting, and honors longer service delays using timer slices of at most 15 minutes; the governor does not invent an account-block verdict or replay a failed model turn. Route-specific protocol retries remain with their existing owners, such as pi-ai model retry semantics and native-compaction's bounded retry loop.
|
|
38
|
+
|
|
39
|
+
Direct plugin routes use the honest shared identity `originator: deepseek-harness` and `User-Agent: dsh-codex-connect`; Search, quota, image generation, Auto-review, and native compaction all use that policy. The pi-ai model route deliberately preserves pi-ai's provider identity rather than impersonating Codex CLI/Desktop, while still receiving the same attempt id, concurrency, proxy, cancellation, server-directed cooldown, and bounded HTTP diagnostic metadata. Native compaction travels through the provider fetch seam at runtime and therefore shares the model governor lane while retaining the direct-plugin identity on its own request. This split is explicit policy, not a claim about undocumented upstream risk controls.
|
|
40
|
+
|
|
41
|
+
Standalone capability/Auto-review probes reuse the same pure URL/header policy but keep their isolated one-shot dispatcher and deadline instead of depending on a running plugin governor. The proxy reachability probe is also a bootstrap exception because it tests the proxy primitive used by the governor itself. OAuth authorization/refresh and credential-free public image fetching are outside `backend-api` and keep their separate security boundaries. Browser calls to this plugin's own local HTTP routes are likewise not upstream backend traffic.
|
|
42
|
+
|
|
43
|
+
## Search and images
|
|
44
|
+
|
|
45
|
+
When `enableSearch: true`, the plugin registers its standalone search provider. It does not append a plugin-owned required-on-read Session event because an external package cannot guarantee that its `@deepseek-ai/dsh-session` module instance owns the Host persistence vocabulary; the standard web Tool call and result remain in the Session log. DSH `0.1.2-rc.1` does not expose the WebRuntime provider selection through its settings service, so the compatibility adapter verifies that release's runtime field, records the previous provider, and selects Codex only while the capability is active. Disable and disposal restore the recorded provider unless another owner has selected a newer route. An unsupported runtime fails activation instead of reporting a route change that did not occur. Search responses are mapped to Harness text and citation records.
|
|
46
|
+
|
|
47
|
+
When `enableImageTool: true`, `view_image` is registered only after tools, filesystem, and attachment services are available. Local files remain bounded by the Harness filesystem surface. Remote images allow only credential-free public HTTP(S): all DNS answers must be public unicast, each redirect is revalidated, and each socket is pinned to the validated address to close DNS-rebinding gaps. The tool also checks bounded bytes, accepted media signatures, and current-model image support before saving a Harness attachment.
|
|
48
|
+
|
|
49
|
+
Each remote-image redirect hop has one 30-second deadline covering DNS, connection, and body consumption. Cancellation settles the caller's wait immediately; an operating-system DNS lookup may still finish later, but its result cannot start a new HTTP request after cancellation or timeout.
|
|
50
|
+
|
|
51
|
+
Successful Codex image-generation Tool results also render in the independent completed-Turn tail. DSH groups Tool calls into a collapsed processing disclosure, so the keyed Tool card alone cannot make generated images visible with the answer. The tail reads only this Turn's settled Tool rows, including nested PTC calls and restored history, and uses the same validated result metadata, session-bound preview loader, Lightbox, and download controls as the Tool card. Failed, malformed, unrelated, or post-answer results do not enter the visible image row. The Tool card remains available in processing details.
|
|
52
|
+
|
|
53
|
+
Image preview recovery uses additive metadata/envelope version 3 only when original persistence completed but preview creation failed. It records exact originals with `previewStatus: unavailable` and no fabricated attachment. Host validation precedes original persistence, so preview failures cannot bypass the original image validation gate. Native and PTC history can admit these originals for the creating session or an authorized inherited prefix; arbitrary text cannot. The existing result card exposes original download and explicit editing without a new image request. Normal version 1/2 results are unchanged; cancellation still cleans unpublished originals. See [implementation and validation](agent-notes/image-preview-recovery.md).
|
|
54
|
+
|
|
55
|
+
## Conflicts and diagnostics
|
|
56
|
+
|
|
57
|
+
Before registration the plugin checks current provider ids. An existing `openai-codex` adapter produces a focused message naming the likely legacy-bundle or manual-provider cause. The boot-free CLI `doctor` reports package/runtime version, OAuth path metadata, capability defaults, and safe conflict guidance without returning auth content.
|
|
58
|
+
|
|
59
|
+
## Compatibility boundary
|
|
60
|
+
|
|
61
|
+
Alpha 4.27 pins Harness `0.1.2-rc.1` development dependencies and follows its pi-ai range `^0.84.2`. Supported Node.js remains `^22.19.0 || >=24.0.0`. The keyed `settings.plugin.item` integration remains, while client types come from their Session Controller, Settings, Store, and Renderer owners. The published compatibility record lists the exact Alpha 4.27 and DSH `0.1.2-rc.1` pair. Backend eligibility, quotas, models, service-side context capacity, and protocol details remain controlled upstream. Tests use temporary OAuth documents and mocked network responses; CI does not perform real authentication.
|
package/docs/design.zh.md
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
# Codex Connect:Alpha 设计
|
|
2
|
-
|
|
3
|
-
## 所有权与组合
|
|
4
|
-
|
|
5
|
-
本包通过 Harness 公共 `LlmRuntime` 与 `PiAiAdapter` 注册 `openai-codex`。主模型路径不是一次性 subagent,而是标准 Harness agent loop,因此原生工具审批、权限策略、流式输出、附件解析、reasoning replay、会话持久化、压缩与恢复均保持有效。
|
|
6
|
-
|
|
7
|
-
bundle patch 只插入 `llm-openai-codex`,不会写入 `agent-default-model` 或 `web.searchProvider`。`enableSearch` 与 `enableImageTool` 默认均为 `false`;关闭时不会注册对应可选服务。
|
|
8
|
-
|
|
9
|
-
Host 将 `llm-openai-codex` 注册为插件自有的能力 settings namespace。DSH 的 `llm-pi-ai` catalog 持有 `openai-codex` 可配置 provider 目录条目,Codex Connect 只注册实际 adapter,不重复声明该条目。浏览器通过 Harness settings-scope transport 绑定插件 namespace,把账户、额度以及带保存/放弃的能力配置放在现有“插件配置”卡片中。带 revision 防护的逐字段写入不会覆盖无关设置;提交后会即时协调搜索与图片能力的注册状态。插件绝不写入默认模型设置。
|
|
10
|
-
|
|
11
|
-
## Task 开发冻结
|
|
12
|
-
|
|
13
|
-
普通模型适配器与后端请求管理器不直接导入 Task 策略;产品组装处显式接入旧任务的 provider 包装和请求前计数。此拆分保留旧任务权限、取消与恢复,不等于已删除全部实验运行时。见[拆分记录](agent-notes/core-transport-decoupling.md)。
|
|
14
|
-
|
|
15
|
-
维护范围现以[核心维护决定](maintenance-scope.md)为准:Task Phase 1/2 实现已经合并,但公开启动入口保持暂停,后续自动编排开发冻结。保留旧状态读取、经授权的停止与人工接管;历史候选验收计划不再是当前待办。
|
|
16
|
-
|
|
17
|
-
## OAuth 持久化
|
|
18
|
-
|
|
19
|
-
插件使用 `$DSH_HOME/.openai-codex-auth.json`,与 Codex CLI/Desktop 状态分离。格式 version 2 最多保存 16 个 OAuth 账户,并明确指定唯一当前账户。原 version 1 文件仍可读取,第一次修改凭据时才迁移;迁移前会先生成仅所有者可读的 `.openai-codex-auth.json.v1-backup` 回退副本。若该副本已存在,它必须仅所有者可读且与当前 version 1 文件一致,否则迁移会在替换主文件前停止。移除任一账户或执行退出登录时会删除该副本,避免已移除凭据继续留存。文档大小上限为 512 KiB。POSIX 上拒绝组/其他用户可读文件,也拒绝非普通文件;写入采用原子替换,所有修改使用 Harness 跨进程文件锁,返回给调用方的是凭据副本。
|
|
20
|
-
|
|
21
|
-
浏览器账户路由只返回插件派生的稳定键、本地显示名称、OAuth token 中存在邮箱时的脱敏地址以及当前账户状态,不返回 provider 原始 account id 或 token 字段。账户切换和删除与浏览器 OAuth 串行执行;每个模型请求会在解析授权前固定当前账户,令牌刷新只更新该账户,不会改变当前选择。OAuth 解析完成后,额度、图片生成和 Auto-review 请求会查找与该 access token 精确配套的 account id,因此并发切换账户不会混用两个账户的凭据。仍有其他账户时,删除当前账户必须由调用方明确指定接替账户;provider 级退出登录会删除全部账户。浏览器 origin 授权单独存放于 `$DSH_HOME/.openai-codex-trusted-origins.json`,格式为 `version: 1`、`mode: "allowlist"` 和规范化的精确 HTTP(S) origin;其中不含 OAuth 内容,且只能通过独立 CLI 修改。
|
|
22
|
-
|
|
23
|
-
为兼容迁移,设置页路由、OAuth 路径和 provider id 不改名。浏览器请求默认只允许 loopback;远程请求必须使用当前 sidecar 中的精确有效 HTTP(S) origin,不能带 cross-site Fetch Metadata,若带 Origin 还必须精确匹配。每次请求都会重新读取 sidecar;未知字段或错误 mode 会快速失败。登录挑战只接受不含凭据的 HTTPS 地址;30 秒内未得到地址、provider 已结束但没有地址、退出登录或插件卸载时,所有 waiter 都会被清理。只有显式登录会输出授权 URL 或代码;状态输出会脱敏。doctor 只用 `lstat` 检查元数据,不打开文件。
|
|
24
|
-
|
|
25
|
-
浏览器账户与更新请求具有 45 秒期限,覆盖响应头和 JSON 响应体。账户修改超时后不会自动重试写操作:只要账户视图仍在观察状态,浏览器就会重新读取服务端状态,因为修改可能已经提交。状态读取失败后每五秒重试,即使尚未保存账户也一样。插件卸载会取消浏览器等待,但不会退出服务端账户。
|
|
26
|
-
|
|
27
|
-
## 搜索与图片
|
|
28
|
-
|
|
29
|
-
仅当 `enableSearch: true` 时注册 Codex 独立搜索提供方和不含凭据的请求事件。DSH `0.1.2-rc.1` 没有通过 settings 服务开放 WebRuntime 的 provider 选择,因此兼容适配器会先核对该版本的运行时字段,记录此前的提供方,并仅在能力开启期间选择 Codex。关闭能力或卸载插件时会恢复此前的提供方;如果另一个 owner 已经选择了更新的路由,则不会覆盖它。不支持的运行时会让能力启用失败,不会谎报路由已经变化。仅当 `enableImageTool: true` 且 tools、filesystem、attachments 服务存在时注册 `view_image`。本地文件继续受 Harness 文件系统边界与大小限制;远程图片只允许不含凭据的公共 HTTP(S),所有 DNS 结果必须是公共单播地址,每次重定向都会重新验证,并把实际连接固定到已验证地址以关闭 DNS rebinding 缺口。
|
|
30
|
-
|
|
31
|
-
远程图片的每次重定向跳转共用一个 30 秒期限,覆盖 DNS、连接与响应体读取。取消会立即结束调用方等待;操作系统 DNS 查询可能稍后才完成,但其结果不能在取消或超时后启动新的 HTTP 请求。
|
|
32
|
-
|
|
33
|
-
图片预览恢复仅在原图保存成功、预览创建失败时使用新增的元数据及内容 envelope 版本 3。结果记录精确原图和 `previewStatus: unavailable`,不会伪造附件。原图落盘前先通过 Host 验证,避免预览失败绕过原图验证。原生及 PTC 历史可将这些原图用于创建会话或实际继承了该结果的 fork;任意文本不会授予权限。现有结果卡提供原图下载及显式编辑,无需重新发送生图请求。正常版本 1/2 结果不变,取消仍清理未发布的原图。详见[实施与验证记录](agent-notes/image-preview-recovery.md)。
|
|
34
|
-
|
|
35
|
-
## 冲突、诊断与兼容边界
|
|
36
|
-
|
|
37
|
-
注册前检查现有 provider id;发现 `openai-codex` 已被占用时,给出旧 bundle 或手动 provider 配置的定向迁移提示。boot-free CLI doctor 只报告包/运行时版本、OAuth 路径元数据、能力默认值和安全提示。
|
|
38
|
-
|
|
39
|
-
Alpha 4.27 固定使用 Harness `0.1.2-rc.1` 开发依赖,并跟随其 pi-ai 版本范围 `^0.84.2`。Node.js 支持范围仍为 `^22.19.0 || >=24.0.0`。keyed `settings.plugin.item` 集成保持不变,客户端类型继续从 Session Controller、Settings、Store 和 Renderer 的所属包导入。已发布兼容性记录列出 Alpha 4.27 与 DSH `0.1.2-rc.1` 的精确组合。资格、额度、模型、服务端上下文容量和后端协议仍由上游控制。测试仅使用临时 OAuth 文档和模拟网络响应,CI 不执行真实认证。
|
|
1
|
+
# Codex Connect:Alpha 设计
|
|
2
|
+
|
|
3
|
+
## 所有权与组合
|
|
4
|
+
|
|
5
|
+
本包通过 Harness 公共 `LlmRuntime` 与 `PiAiAdapter` 注册 `openai-codex`。主模型路径不是一次性 subagent,而是标准 Harness agent loop,因此原生工具审批、权限策略、流式输出、附件解析、reasoning replay、会话持久化、压缩与恢复均保持有效。
|
|
6
|
+
|
|
7
|
+
bundle patch 只插入 `llm-openai-codex`,不会写入 `agent-default-model` 或 `web.searchProvider`。`enableSearch` 与 `enableImageTool` 默认均为 `false`;关闭时不会注册对应可选服务。
|
|
8
|
+
|
|
9
|
+
Host 将 `llm-openai-codex` 注册为插件自有的能力 settings namespace。DSH 的 `llm-pi-ai` catalog 持有 `openai-codex` 可配置 provider 目录条目,Codex Connect 只注册实际 adapter,不重复声明该条目。浏览器通过 Harness settings-scope transport 绑定插件 namespace,把账户、额度以及带保存/放弃的能力配置放在现有“插件配置”卡片中。带 revision 防护的逐字段写入不会覆盖无关设置;提交后会即时协调搜索与图片能力的注册状态。插件绝不写入默认模型设置。
|
|
10
|
+
|
|
11
|
+
## Task 开发冻结
|
|
12
|
+
|
|
13
|
+
普通模型适配器与后端请求管理器不直接导入 Task 策略;产品组装处显式接入旧任务的 provider 包装和请求前计数。此拆分保留旧任务权限、取消与恢复,不等于已删除全部实验运行时。见[拆分记录](agent-notes/core-transport-decoupling.md)。
|
|
14
|
+
|
|
15
|
+
维护范围现以[核心维护决定](maintenance-scope.md)为准:Task Phase 1/2 实现已经合并,但公开启动入口保持暂停,后续自动编排开发冻结。保留旧状态读取、经授权的停止与人工接管;历史候选验收计划不再是当前待办。
|
|
16
|
+
|
|
17
|
+
## OAuth 持久化
|
|
18
|
+
|
|
19
|
+
插件使用 `$DSH_HOME/.openai-codex-auth.json`,与 Codex CLI/Desktop 状态分离。格式 version 2 最多保存 16 个 OAuth 账户,并明确指定唯一当前账户。原 version 1 文件仍可读取,第一次修改凭据时才迁移;迁移前会先生成仅所有者可读的 `.openai-codex-auth.json.v1-backup` 回退副本。若该副本已存在,它必须仅所有者可读且与当前 version 1 文件一致,否则迁移会在替换主文件前停止。移除任一账户或执行退出登录时会删除该副本,避免已移除凭据继续留存。文档大小上限为 512 KiB。POSIX 上拒绝组/其他用户可读文件,也拒绝非普通文件;写入采用原子替换,所有修改使用 Harness 跨进程文件锁,返回给调用方的是凭据副本。
|
|
20
|
+
|
|
21
|
+
浏览器账户路由只返回插件派生的稳定键、本地显示名称、OAuth token 中存在邮箱时的脱敏地址以及当前账户状态,不返回 provider 原始 account id 或 token 字段。账户切换和删除与浏览器 OAuth 串行执行;每个模型请求会在解析授权前固定当前账户,令牌刷新只更新该账户,不会改变当前选择。OAuth 解析完成后,额度、图片生成和 Auto-review 请求会查找与该 access token 精确配套的 account id,因此并发切换账户不会混用两个账户的凭据。仍有其他账户时,删除当前账户必须由调用方明确指定接替账户;provider 级退出登录会删除全部账户。浏览器 origin 授权单独存放于 `$DSH_HOME/.openai-codex-trusted-origins.json`,格式为 `version: 1`、`mode: "allowlist"` 和规范化的精确 HTTP(S) origin;其中不含 OAuth 内容,且只能通过独立 CLI 修改。
|
|
22
|
+
|
|
23
|
+
为兼容迁移,设置页路由、OAuth 路径和 provider id 不改名。浏览器请求默认只允许 loopback;远程请求必须使用当前 sidecar 中的精确有效 HTTP(S) origin,不能带 cross-site Fetch Metadata,若带 Origin 还必须精确匹配。每次请求都会重新读取 sidecar;未知字段或错误 mode 会快速失败。登录挑战只接受不含凭据的 HTTPS 地址;30 秒内未得到地址、provider 已结束但没有地址、退出登录或插件卸载时,所有 waiter 都会被清理。只有显式登录会输出授权 URL 或代码;状态输出会脱敏。doctor 只用 `lstat` 检查元数据,不打开文件。
|
|
24
|
+
|
|
25
|
+
浏览器账户与更新请求具有 45 秒期限,覆盖响应头和 JSON 响应体。账户修改超时后不会自动重试写操作:只要账户视图仍在观察状态,浏览器就会重新读取服务端状态,因为修改可能已经提交。状态读取失败后每五秒重试,即使尚未保存账户也一样。插件卸载会取消浏览器等待,但不会退出服务端账户。
|
|
26
|
+
|
|
27
|
+
## 搜索与图片
|
|
28
|
+
|
|
29
|
+
仅当 `enableSearch: true` 时注册 Codex 独立搜索提供方和不含凭据的请求事件。DSH `0.1.2-rc.1` 没有通过 settings 服务开放 WebRuntime 的 provider 选择,因此兼容适配器会先核对该版本的运行时字段,记录此前的提供方,并仅在能力开启期间选择 Codex。关闭能力或卸载插件时会恢复此前的提供方;如果另一个 owner 已经选择了更新的路由,则不会覆盖它。不支持的运行时会让能力启用失败,不会谎报路由已经变化。仅当 `enableImageTool: true` 且 tools、filesystem、attachments 服务存在时注册 `view_image`。本地文件继续受 Harness 文件系统边界与大小限制;远程图片只允许不含凭据的公共 HTTP(S),所有 DNS 结果必须是公共单播地址,每次重定向都会重新验证,并把实际连接固定到已验证地址以关闭 DNS rebinding 缺口。
|
|
30
|
+
|
|
31
|
+
远程图片的每次重定向跳转共用一个 30 秒期限,覆盖 DNS、连接与响应体读取。取消会立即结束调用方等待;操作系统 DNS 查询可能稍后才完成,但其结果不能在取消或超时后启动新的 HTTP 请求。
|
|
32
|
+
|
|
33
|
+
图片预览恢复仅在原图保存成功、预览创建失败时使用新增的元数据及内容 envelope 版本 3。结果记录精确原图和 `previewStatus: unavailable`,不会伪造附件。原图落盘前先通过 Host 验证,避免预览失败绕过原图验证。原生及 PTC 历史可将这些原图用于创建会话或实际继承了该结果的 fork;任意文本不会授予权限。现有结果卡提供原图下载及显式编辑,无需重新发送生图请求。正常版本 1/2 结果不变,取消仍清理未发布的原图。详见[实施与验证记录](agent-notes/image-preview-recovery.md)。
|
|
34
|
+
|
|
35
|
+
## 冲突、诊断与兼容边界
|
|
36
|
+
|
|
37
|
+
注册前检查现有 provider id;发现 `openai-codex` 已被占用时,给出旧 bundle 或手动 provider 配置的定向迁移提示。boot-free CLI doctor 只报告包/运行时版本、OAuth 路径元数据、能力默认值和安全提示。
|
|
38
|
+
|
|
39
|
+
Alpha 4.27 固定使用 Harness `0.1.2-rc.1` 开发依赖,并跟随其 pi-ai 版本范围 `^0.84.2`。Node.js 支持范围仍为 `^22.19.0 || >=24.0.0`。keyed `settings.plugin.item` 集成保持不变,客户端类型继续从 Session Controller、Settings、Store 和 Renderer 的所属包导入。已发布兼容性记录列出 Alpha 4.27 与 DSH `0.1.2-rc.1` 的精确组合。资格、额度、模型、服务端上下文容量和后端协议仍由上游控制。测试仅使用临时 OAuth 文档和模拟网络响应,CI 不执行真实认证。
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Mario Zechner
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Mario Zechner
|
|
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.
|