@shuind/dsh-codex-harness 0.1.38 → 0.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
- **远程搜索与压缩**:OpenAI Responses 请求默认优先使用 hosted `web_search` 和 `/responses/compact`;失败时回退到 DSH 的本地实现。
|
|
16
16
|
- **远程压缩用量**:`/responses/compact` 返回标准 `usage` 时,插件会把 `input_tokens`、缓存读写和 `output_tokens` 原样拆分为 DSH 的用量字段;不再把远程压缩伪造成 `0`。中转站缺失或返回不一致的 usage 时,插件不会编造数字。
|
|
17
17
|
- **上下文容量**:在 Web 中设置 `1K`–`1000K` tokens,设置值作用于下一次请求。
|
|
18
|
-
- **自动压缩阈值**:Codex preset
|
|
18
|
+
- **自动压缩阈值**:Codex preset 的自动压缩会读取最新请求持久化的有效上下文容量,并在 `95%` pressure threshold 触发;例如设置 `400K` 时阈值是 `380K`,不会错误地按适配器默认 `262,144` 在约 `210K` 提前触发。
|
|
19
19
|
- **活动状态**:Codex 请求模型、接收模型回复或进行上下文压缩时,在 `Deep diving...` 右侧显示对应阶段和耗时,让长时间 Deep Diving 不再像卡住。
|
|
20
20
|
|
|
21
21
|
## 安装
|
|
22
22
|
|
|
23
23
|
```sh
|
|
24
|
-
dsh plugin --profile web add @shuind/dsh-codex-harness@0.1.
|
|
24
|
+
dsh plugin --profile web add @shuind/dsh-codex-harness@0.1.40
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
重启 Web,创建新会话,在模式菜单中选择 **Codex 模式**。
|
package/lib/index.js
CHANGED
|
@@ -1230,12 +1230,24 @@ function installCodexContextProjection(ctx, current) {
|
|
|
1230
1230
|
const sync = (session, contextWindow = current().contextWindow) => {
|
|
1231
1231
|
syncCodexContextWindow(session, contextWindow);
|
|
1232
1232
|
};
|
|
1233
|
+
const pending = /* @__PURE__ */ new WeakSet();
|
|
1234
|
+
const syncAfterPublication = (session) => {
|
|
1235
|
+
if (pending.has(session)) return;
|
|
1236
|
+
pending.add(session);
|
|
1237
|
+
queueMicrotask(() => {
|
|
1238
|
+
try {
|
|
1239
|
+
sync(session);
|
|
1240
|
+
} finally {
|
|
1241
|
+
pending.delete(session);
|
|
1242
|
+
}
|
|
1243
|
+
});
|
|
1244
|
+
};
|
|
1233
1245
|
const syncAll = (contextWindow = current().contextWindow) => {
|
|
1234
1246
|
const sessions = ctx.get("sessions");
|
|
1235
1247
|
for (const session of sessions?.list?.() ?? []) sync(session, contextWindow);
|
|
1236
1248
|
};
|
|
1237
1249
|
ctx.on("session/event", (session, event) => {
|
|
1238
|
-
if (event.type === "request/header" || event.type === "request/context")
|
|
1250
|
+
if (event.type === "request/header" || event.type === "request/context") syncAfterPublication(session);
|
|
1239
1251
|
});
|
|
1240
1252
|
ctx.on("session/created", (session) => {
|
|
1241
1253
|
sync(session);
|
package/lib/types/index.js
CHANGED
|
@@ -168,14 +168,29 @@ function installCodexContextProjection(ctx, current) {
|
|
|
168
168
|
const sync = (session, contextWindow = current().contextWindow) => {
|
|
169
169
|
syncCodexContextWindow(session, contextWindow);
|
|
170
170
|
};
|
|
171
|
+
const pending = new WeakSet();
|
|
172
|
+
const syncAfterPublication = (session) => {
|
|
173
|
+
if (pending.has(session))
|
|
174
|
+
return;
|
|
175
|
+
pending.add(session);
|
|
176
|
+
queueMicrotask(() => {
|
|
177
|
+
try {
|
|
178
|
+
sync(session);
|
|
179
|
+
}
|
|
180
|
+
finally {
|
|
181
|
+
pending.delete(session);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
};
|
|
171
185
|
const syncAll = (contextWindow = current().contextWindow) => {
|
|
172
186
|
const sessions = ctx.get('sessions');
|
|
173
187
|
for (const session of sessions?.list?.() ?? [])
|
|
174
188
|
sync(session, contextWindow);
|
|
175
189
|
};
|
|
176
190
|
ctx.on('session/event', (session, event) => {
|
|
191
|
+
// Session.append() rejects nested appends until every observer returns.
|
|
177
192
|
if (event.type === 'request/header' || event.type === 'request/context')
|
|
178
|
-
|
|
193
|
+
syncAfterPublication(session);
|
|
179
194
|
});
|
|
180
195
|
// Restored sessions may already contain their request/header seed, so no
|
|
181
196
|
// session/event is emitted for the initial capacity. Catch them at the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shuind/dsh-codex-harness",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.40",
|
|
4
4
|
"description": "A Codex harness with a streamlined system prompt for GPT models that do not fit DSH's native interface, while remaining compatible with the DSH plugin ecosystem.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|