Skip to content

Commit f8ad26f

Browse files
committed
Release v1.0.0 major refactor
1 parent 9f2bb61 commit f8ad26f

46 files changed

Lines changed: 3636 additions & 2555 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-macos.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,14 @@ jobs:
118118
with:
119119
tag_name: ${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.ref_name }}
120120
body: |
121+
大重构更新。
122+
121123
Updates:
122-
- Fix compact summary duplication.
123-
- Improve manual and automatic compact prompts.
124-
- Improve auto compact detection during running assistant turns.
124+
- Refactor the backend proxy architecture around the FastAPI proxy entry.
125+
- Unify frontend and backend transcript/context contracts.
126+
- Split proxy storage, SSE, session id, and item registry responsibilities into dedicated modules.
127+
- Expand frontend contract and backend proxy core tests for the rebuilt protocol paths.
128+
- Update packaging so shared modules are included in release installers.
125129
files: |
126130
release-artifacts/*.dmg
127131
release-artifacts/*.zip

CODEX_PROXY_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ codex `
2424

2525
## Local Services
2626

27-
- `backend/proxy_server.py`: Codex-compatible Responses proxy, port `8787`.
27+
- `backend/proxy_fastapi.py`: Codex-compatible Responses proxy, port `8787`.
2828
- `backend/web_server.py`: HashCode backend, port `8765`.
2929
- Vite dev server: React frontend, port `5174`.
3030
- `electron/context-window.cjs`: Electron shell and local service supervisor.

GITHUB_RELEASE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Codex Context Proxy v0.3.0
1+
# Codex Context Proxy v1.0.0
22

33
A visual, editable context layer for Codex. Let AI edit AI's context with surgical precision, giving you more control and freedom over what Codex sees.
44

@@ -23,7 +23,7 @@ A visual, editable context layer for Codex. Let AI edit AI's context with surgic
2323
Download and run:
2424

2525
```text
26-
Codex Context Proxy Setup 0.3.0.exe
26+
Codex Context Proxy Setup 1.0.0.exe
2727
```
2828

2929
After installation, open a new terminal and enable the proxy:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ context window
9797
Download and run the Windows installer:
9898

9999
```text
100-
Codex Context Proxy Setup 0.3.0.exe
100+
Codex Context Proxy Setup 1.0.0.exe
101101
```
102102

103103
After installation, open a new terminal and enable the proxy:
@@ -188,7 +188,7 @@ npm run dist:win
188188
The installer is generated at:
189189

190190
```text
191-
release/Codex Context Proxy Setup 0.3.0.exe
191+
release/Codex Context Proxy Setup 1.0.0.exe
192192
```
193193

194194
## Notes

README.zh-CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ context window
9797
下载并运行 Windows 安装包:
9898

9999
```text
100-
Codex Context Proxy Setup 0.3.0.exe
100+
Codex Context Proxy Setup 1.0.0.exe
101101
```
102102

103103
安装完成后,重新打开一个终端,然后启用代理:
@@ -188,7 +188,7 @@ npm run dist:win
188188
安装包会生成在:
189189

190190
```text
191-
release/Codex Context Proxy Setup 0.3.0.exe
191+
release/Codex Context Proxy Setup 1.0.0.exe
192192
```
193193

194194
## 说明

RELEASE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ npm run dist:win
1717
生成的安装包在:
1818

1919
```text
20-
release/Codex Context Proxy Setup 0.3.0.exe
20+
release/Codex Context Proxy Setup 1.0.0.exe
2121
```
2222

23-
安装包会带上 Electron 前端、React 构建产物、`backend/web_server.py``backend/proxy_server.py` 以及打包后的 Python exe。用户不需要自己安装 Node 或 Python。
23+
安装包会带上 Electron 前端、React 构建产物、`backend/web_server.py``backend/proxy_fastapi.py` 以及打包后的 Python exe。用户不需要自己安装 Node 或 Python。
2424

2525
## 用户怎么用
2626

27-
用户安装 `Codex Context Proxy Setup 0.3.0.exe` 后,安装器会自动安装 `codex ctx proxy ...` 控制命令,但不会默认打开代理。
27+
用户安装 `Codex Context Proxy Setup 1.0.0.exe` 后,安装器会自动安装 `codex ctx proxy ...` 控制命令,但不会默认打开代理。
2828

2929
安装完成后,重新打开一个终端,然后使用:
3030

@@ -103,7 +103,7 @@ codex ctx desktop status
103103
把下面这个文件上传到 GitHub Releases、网盘或下载页即可:
104104

105105
```text
106-
release/Codex Context Proxy Setup 0.3.0.exe
106+
release/Codex Context Proxy Setup 1.0.0.exe
107107
```
108108

109109
旧的 `hashcode Setup ...exe` 是历史产物,不要发布。

agent_runtime/core/canonical_types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
JsonObject: TypeAlias = dict[str, JsonValue]
1414

1515
PromptBlockKind: TypeAlias = Literal["system", "developer", "memory", "summary"]
16+
# agent_runtime is a lightweight agent adapter layer. Its transcript role is not
17+
# the lossless proxy TranscriptNode.role contract from backend/transcript_codec.py.
1618
TranscriptRole: TypeAlias = Literal["user", "assistant"]
1719
CanonicalItemType: TypeAlias = Literal["message", "tool_call", "tool_result"]
1820
CanonicalStatus: TypeAlias = Literal[

agent_runtime/core/transcript_contract.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
from __future__ import annotations
22

3+
"""Lightweight agent_runtime transcript contract.
4+
5+
This module is intentionally scoped to adapter-friendly chat history for
6+
agent_runtime/simple_agent. It is not the proxy core transcript contract; the
7+
lossless proxy transcript lives in backend/transcript_codec.py as TranscriptNode
8+
and preserves provider roles/items such as system, developer, context,
9+
subagent, and compaction.
10+
"""
11+
312
from dataclasses import dataclass, field
413
from typing import Literal, TypeAlias
514

@@ -39,7 +48,7 @@ class TranscriptBlock:
3948

4049
@dataclass(slots=True)
4150
class TranscriptRecord:
42-
"""Product transcript record. Roles are intentionally limited."""
51+
"""agent_runtime chat record. Roles are intentionally limited."""
4352

4453
role: TranscriptRole
4554
text: str

backend/codex_input_cursor.py

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,35 @@
1515

1616

1717
DYNAMIC_FINGERPRINT_KEYS = frozenset({"id"})
18+
_DYNAMIC_ID_ITEM_TYPES = frozenset(
19+
{
20+
"message",
21+
"agent_message",
22+
"reasoning",
23+
"function_call",
24+
"function_call_output",
25+
"custom_tool_call",
26+
"custom_tool_call_output",
27+
"local_shell_call",
28+
"local_shell_call_output",
29+
"tool_search_call",
30+
"tool_search_output",
31+
"web_search_call",
32+
"image_generation_call",
33+
"compaction",
34+
"context_compaction",
35+
}
36+
)
37+
_DYNAMIC_ID_CONTENT_PART_TYPES = frozenset(
38+
{
39+
"input_text",
40+
"output_text",
41+
"text",
42+
"input_image",
43+
"reasoning_text",
44+
"summary_text",
45+
}
46+
)
1847

1948

2049
def canonical_provider_item_for_request(item: Any) -> Any:
@@ -149,18 +178,19 @@ def __iter__(self):
149178

150179

151180
def normalize_provider_item(value: Any) -> Any:
152-
"""Return a stable semantic projection used for provider item hashing.
181+
"""Return a request-safe deep normalization of provider values.
153182
154-
Only exact ``id`` keys are removed. Semantic identifiers such as
155-
``call_id`` or ``file_id`` are preserved, as are opaque reasoning fields
156-
such as ``encrypted_content``.
183+
This function deliberately preserves nested ``id`` keys. Tool schemas can
184+
contain semantic fields named ``id`` (for example
185+
``parameters.properties.id``), and deleting them corrupts the request body.
186+
Dynamic response item ids are ignored only by ``_pick`` at known item
187+
boundaries and by the fingerprint-only normalization below.
157188
"""
158189

159190
if isinstance(value, Mapping):
160191
return {
161192
key: normalize_provider_item(child)
162193
for key, child in value.items()
163-
if key not in DYNAMIC_FINGERPRINT_KEYS
164194
}
165195
if isinstance(value, list):
166196
return [normalize_provider_item(child) for child in value]
@@ -183,20 +213,26 @@ def fingerprint_provider_item(item: Any) -> str:
183213

184214

185215
def semantic_provider_item_for_fingerprint(value: Any) -> Any:
216+
return _semantic_provider_item_for_fingerprint(value, depth=0)
217+
218+
219+
def _semantic_provider_item_for_fingerprint(value: Any, *, depth: int) -> Any:
186220
if isinstance(value, Mapping):
187221
item_type = str(value.get("type") or "").strip()
188-
ignored_keys = {"id"}
222+
ignored_keys: set[str] = set()
223+
if depth == 0 or item_type in _DYNAMIC_ID_ITEM_TYPES | _DYNAMIC_ID_CONTENT_PART_TYPES:
224+
ignored_keys.add("id")
189225
if item_type == "message":
190226
ignored_keys.add("phase")
191227
return {
192-
key: semantic_provider_item_for_fingerprint(child)
228+
key: _semantic_provider_item_for_fingerprint(child, depth=depth + 1)
193229
for key, child in value.items()
194230
if key not in ignored_keys
195231
}
196232
if isinstance(value, list):
197-
return [semantic_provider_item_for_fingerprint(child) for child in value]
233+
return [_semantic_provider_item_for_fingerprint(child, depth=depth + 1) for child in value]
198234
if isinstance(value, tuple):
199-
return [semantic_provider_item_for_fingerprint(child) for child in value]
235+
return [_semantic_provider_item_for_fingerprint(child, depth=depth + 1) for child in value]
200236
return value
201237

202238

0 commit comments

Comments
 (0)