@shuind/dsh-codex-harness 0.1.26 → 0.1.27
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 +2 -2
- package/lib/client.js +110 -7
- package/lib/types/client/index.js +69 -7
- package/package.json +3 -6
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
- **后台任务**:`exec_command` 支持 `run_in_background: true`,立即返回 DSH `job_id`;使用 `job_output` 读取输出、`job_kill` 停止任务。任务完成时,忙碌中的 agent 会在下一步收到 inbox 注入;空闲 agent 默认保持安静,等下一次唤醒时再处理完成消息。
|
|
10
10
|
- **GPT 能力补全**:为 GPT 系列模型补充图片输入和思考强度选项;不会覆盖用户已有的显式配置。
|
|
11
11
|
- **Fast**:仅在 Codex preset 的模型选择菜单中显示,开启后向 Responses 请求发送 `service_tier: "priority"`。
|
|
12
|
-
- **旧版 Web 兼容**:在未提供新版模型设置/上下文设置 slot 的 DSH Web 中,Fast 和上下文容量会自动回退到旧版 composer slot
|
|
12
|
+
- **旧版 Web 兼容**:在未提供新版模型设置/上下文设置 slot 的 DSH Web 中,Fast 和上下文容量会自动回退到旧版 composer inline slot;上下文容量使用紧凑按钮和弹层,不占用整行;client 注入不依赖纯类型 slot 包。
|
|
13
13
|
- **Responses 原生 apply_patch**:在 GPT Responses 请求的插件传输边界,把普通 JSON function tool 改写为 `type: "custom"` + OpenAI `lark` grammar;下一轮历史同步改写为 `custom_tool_call`。如果中转站拒绝 custom tool,则自动回退到普通 function tool,不改变 DSH 工具执行器。
|
|
14
14
|
- **远程搜索与压缩**:OpenAI Responses 请求默认优先使用 hosted `web_search` 和 `/responses/compact`;失败时回退到 DSH 的本地实现。
|
|
15
15
|
- **远程压缩用量**:`/responses/compact` 返回标准 `usage` 时,插件会把 `input_tokens`、缓存读写和 `output_tokens` 原样拆分为 DSH 的用量字段;不再把远程压缩伪造成 `0`。中转站缺失或返回不一致的 usage 时,插件不会编造数字。
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
## 安装
|
|
21
21
|
|
|
22
22
|
```sh
|
|
23
|
-
dsh plugin --profile web add @shuind/dsh-codex-harness@0.1.
|
|
23
|
+
dsh plugin --profile web add @shuind/dsh-codex-harness@0.1.27
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
重启 Web,创建新会话,在模式菜单中选择 **Codex 模式**。
|
package/lib/client.js
CHANGED
|
@@ -77,7 +77,7 @@ window.__ModuleLoader__.load({
|
|
|
77
77
|
const ACTIVITY_SLOT = "conversation.chat.status";
|
|
78
78
|
const ACTIVITY_FALLBACK_SLOT = "conversation.composer.dock";
|
|
79
79
|
const FAST_FALLBACK_SLOT = "conversation.input.right";
|
|
80
|
-
const CONTEXT_FALLBACK_SLOT = "conversation.input.
|
|
80
|
+
const CONTEXT_FALLBACK_SLOT = "conversation.input.right";
|
|
81
81
|
const DEFAULT_CONTEXT_WINDOW = 262144;
|
|
82
82
|
const en = {
|
|
83
83
|
fast: "Fast mode",
|
|
@@ -117,6 +117,9 @@ window.__ModuleLoader__.load({
|
|
|
117
117
|
"aria-pressed": fast,
|
|
118
118
|
"aria-label": fast ? t("fastOn") : t("fastOff"),
|
|
119
119
|
title: fast ? t("fastOn") : t("fastOff"),
|
|
120
|
+
onMouseDown: (event) => {
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
},
|
|
120
123
|
onClick: () => {
|
|
121
124
|
setSetting("fast", !fast);
|
|
122
125
|
},
|
|
@@ -171,9 +174,9 @@ window.__ModuleLoader__.load({
|
|
|
171
174
|
alignItems: "center",
|
|
172
175
|
gap: 5,
|
|
173
176
|
height: 28,
|
|
174
|
-
border:
|
|
177
|
+
border: 0,
|
|
175
178
|
borderRadius: 7,
|
|
176
|
-
padding: "0
|
|
179
|
+
padding: "0 6px",
|
|
177
180
|
color: fast ? "var(--dsw-static-blue-500)" : "var(--dsw-alias-label-secondary)",
|
|
178
181
|
background: fast ? "var(--dsw-alias-interactive-bg-selected)" : "transparent",
|
|
179
182
|
cursor: snapshot.writable === false ? "default" : "pointer",
|
|
@@ -312,10 +315,110 @@ window.__ModuleLoader__.load({
|
|
|
312
315
|
const pressure = useProjection("contextPressure");
|
|
313
316
|
return pressure?.contextWindow !== void 0 && pressure.contextWindow > 0 ? pressure.contextWindow : DEFAULT_CONTEXT_WINDOW;
|
|
314
317
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
318
|
+
/** Compact trigger used when the host has no ContextMeter settings child slot. */
|
|
319
|
+
function LegacyContextSizeControl({ sessionId, useSessions, useProjection, useSettings, setSetting, unsetSetting, t }) {
|
|
320
|
+
const agentPreset = useSessions((state) => state.byId[sessionId]?.agentPreset);
|
|
321
|
+
const contextWindow = contextWindowFromProjection(useProjection);
|
|
322
|
+
const snapshot = useSettings((state) => state);
|
|
323
|
+
const configured = snapshot.value?.contextWindow;
|
|
324
|
+
const valueK = Math.min(CODEX_CONTEXT_MAX / CODEX_CONTEXT_UNIT, Math.max(1, Math.round((configured ?? contextWindow) / CODEX_CONTEXT_UNIT)));
|
|
325
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
326
|
+
const rootRef = (0, react.useRef)(null);
|
|
327
|
+
(0, react.useEffect)(() => {
|
|
328
|
+
if (!open) return void 0;
|
|
329
|
+
const onPointerDown = (event) => {
|
|
330
|
+
if (event.target instanceof Node && rootRef.current?.contains(event.target) === true) return;
|
|
331
|
+
setOpen(false);
|
|
332
|
+
};
|
|
333
|
+
const onKeyDown = (event) => {
|
|
334
|
+
if (event.key === "Escape") setOpen(false);
|
|
335
|
+
};
|
|
336
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
337
|
+
document.addEventListener("keydown", onKeyDown);
|
|
338
|
+
return () => {
|
|
339
|
+
document.removeEventListener("pointerdown", onPointerDown);
|
|
340
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
341
|
+
};
|
|
342
|
+
}, [open]);
|
|
343
|
+
if (!isCodexPresetId(agentPreset)) return null;
|
|
344
|
+
return (0, react_jsx_runtime.jsxs)("span", {
|
|
345
|
+
ref: rootRef,
|
|
346
|
+
style: {
|
|
347
|
+
position: "relative",
|
|
348
|
+
display: "inline-flex",
|
|
349
|
+
alignItems: "center"
|
|
350
|
+
},
|
|
351
|
+
children: [(0, react_jsx_runtime.jsxs)("button", {
|
|
352
|
+
type: "button",
|
|
353
|
+
"aria-label": `${t("contextSize")}: ${valueK}K`,
|
|
354
|
+
"aria-haspopup": "dialog",
|
|
355
|
+
"aria-expanded": open,
|
|
356
|
+
disabled: snapshot.writable === false,
|
|
357
|
+
title: t("contextSize"),
|
|
358
|
+
onMouseDown: (event) => {
|
|
359
|
+
event.preventDefault();
|
|
360
|
+
},
|
|
361
|
+
onClick: () => {
|
|
362
|
+
setOpen((value) => !value);
|
|
363
|
+
},
|
|
364
|
+
style: {
|
|
365
|
+
boxSizing: "border-box",
|
|
366
|
+
display: "inline-flex",
|
|
367
|
+
alignItems: "center",
|
|
368
|
+
gap: 3,
|
|
369
|
+
height: 28,
|
|
370
|
+
border: 0,
|
|
371
|
+
borderRadius: 7,
|
|
372
|
+
padding: "0 6px",
|
|
373
|
+
color: configured === void 0 ? "var(--dsw-alias-label-secondary)" : "var(--dsw-static-blue-500)",
|
|
374
|
+
background: open ? "var(--dsw-alias-interactive-bg-hover)" : "transparent",
|
|
375
|
+
cursor: snapshot.writable === false ? "default" : "pointer",
|
|
376
|
+
font: "inherit",
|
|
377
|
+
fontSize: 12,
|
|
378
|
+
lineHeight: "20px",
|
|
379
|
+
fontWeight: configured === void 0 ? 400 : 600,
|
|
380
|
+
whiteSpace: "nowrap"
|
|
381
|
+
},
|
|
382
|
+
children: [(0, react_jsx_runtime.jsxs)("span", { children: [valueK, "K"] }), (0, react_jsx_runtime.jsx)("svg", {
|
|
383
|
+
viewBox: "0 0 12 12",
|
|
384
|
+
width: "12",
|
|
385
|
+
height: "12",
|
|
386
|
+
"aria-hidden": true,
|
|
387
|
+
children: (0, react_jsx_runtime.jsx)("path", {
|
|
388
|
+
d: "M3 4.5 6 7.5 9 4.5",
|
|
389
|
+
fill: "none",
|
|
390
|
+
stroke: "currentColor",
|
|
391
|
+
strokeWidth: "1.25",
|
|
392
|
+
strokeLinecap: "round",
|
|
393
|
+
strokeLinejoin: "round"
|
|
394
|
+
})
|
|
395
|
+
})]
|
|
396
|
+
}), open && (0, react_jsx_runtime.jsx)("div", {
|
|
397
|
+
role: "dialog",
|
|
398
|
+
"aria-label": t("contextSize"),
|
|
399
|
+
style: {
|
|
400
|
+
position: "absolute",
|
|
401
|
+
right: 0,
|
|
402
|
+
bottom: "calc(100% + 8px)",
|
|
403
|
+
zIndex: 20,
|
|
404
|
+
boxSizing: "border-box",
|
|
405
|
+
width: 300,
|
|
406
|
+
maxWidth: "calc(100vw - 24px)",
|
|
407
|
+
padding: "10px 12px 12px",
|
|
408
|
+
border: "1px solid var(--dsw-alias-border-l2)",
|
|
409
|
+
borderRadius: 10,
|
|
410
|
+
color: "var(--dsw-alias-label-primary)",
|
|
411
|
+
background: "var(--dsw-alias-bg-base)",
|
|
412
|
+
boxShadow: "var(--dsw-shadow-lv2)"
|
|
413
|
+
},
|
|
414
|
+
children: (0, react_jsx_runtime.jsx)(ContextSizeControl, {
|
|
415
|
+
contextWindow,
|
|
416
|
+
useSettings,
|
|
417
|
+
setSetting,
|
|
418
|
+
unsetSetting,
|
|
419
|
+
t
|
|
420
|
+
})
|
|
421
|
+
})]
|
|
319
422
|
});
|
|
320
423
|
}
|
|
321
424
|
function elapsedSeconds(startedAt, now) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/** Browser controls for the Codex request settings mounted by the Host plugin. */
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { CODEX_CONTEXT_MAX, CODEX_CONTEXT_UNIT, isCodexPresetId } from "../context.js";
|
|
5
5
|
import { modelActivity, sameModelActivity } from "./activity.js";
|
|
6
6
|
const NS = 'codex';
|
|
@@ -12,7 +12,7 @@ const CONTEXT_SETTINGS_SLOT = 'conversation.input.context.settings';
|
|
|
12
12
|
const ACTIVITY_SLOT = 'conversation.chat.status';
|
|
13
13
|
const ACTIVITY_FALLBACK_SLOT = 'conversation.composer.dock';
|
|
14
14
|
const FAST_FALLBACK_SLOT = 'conversation.input.right';
|
|
15
|
-
const CONTEXT_FALLBACK_SLOT = 'conversation.input.
|
|
15
|
+
const CONTEXT_FALLBACK_SLOT = 'conversation.input.right';
|
|
16
16
|
const DEFAULT_CONTEXT_WINDOW = 262_144;
|
|
17
17
|
const en = {
|
|
18
18
|
fast: 'Fast mode',
|
|
@@ -46,7 +46,7 @@ function FastModeButton({ sessionId, useSessions, useSettings, setSetting, t })
|
|
|
46
46
|
const fast = snapshot.value?.fast ?? false;
|
|
47
47
|
if (!isCodexPresetId(agentPreset))
|
|
48
48
|
return null;
|
|
49
|
-
return (_jsxs("button", { type: "button", role: "menuitemcheckbox", disabled: snapshot.writable === false, "aria-pressed": fast, "aria-label": fast ? t('fastOn') : t('fastOff'), title: fast ? t('fastOn') : t('fastOff'), onClick: () => { void setSetting('fast', !fast); }, style: {
|
|
49
|
+
return (_jsxs("button", { type: "button", role: "menuitemcheckbox", disabled: snapshot.writable === false, "aria-pressed": fast, "aria-label": fast ? t('fastOn') : t('fastOff'), title: fast ? t('fastOn') : t('fastOff'), onMouseDown: event => { event.preventDefault(); }, onClick: () => { void setSetting('fast', !fast); }, style: {
|
|
50
50
|
boxSizing: 'border-box',
|
|
51
51
|
display: 'flex',
|
|
52
52
|
alignItems: 'center',
|
|
@@ -80,9 +80,9 @@ function FastModeFallback(props) {
|
|
|
80
80
|
alignItems: 'center',
|
|
81
81
|
gap: 5,
|
|
82
82
|
height: 28,
|
|
83
|
-
border:
|
|
83
|
+
border: 0,
|
|
84
84
|
borderRadius: 7,
|
|
85
|
-
padding: '0
|
|
85
|
+
padding: '0 6px',
|
|
86
86
|
color: fast ? 'var(--dsw-static-blue-500)' : 'var(--dsw-alias-label-secondary)',
|
|
87
87
|
background: fast ? 'var(--dsw-alias-interactive-bg-selected)' : 'transparent',
|
|
88
88
|
cursor: snapshot.writable === false ? 'default' : 'pointer',
|
|
@@ -134,8 +134,70 @@ function contextWindowFromProjection(useProjection) {
|
|
|
134
134
|
? pressure.contextWindow
|
|
135
135
|
: DEFAULT_CONTEXT_WINDOW;
|
|
136
136
|
}
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
/** Compact trigger used when the host has no ContextMeter settings child slot. */
|
|
138
|
+
function LegacyContextSizeControl({ sessionId, useSessions, useProjection, useSettings, setSetting, unsetSetting, t }) {
|
|
139
|
+
const agentPreset = useSessions(state => state.byId[sessionId]?.agentPreset);
|
|
140
|
+
const contextWindow = contextWindowFromProjection(useProjection);
|
|
141
|
+
const snapshot = useSettings(state => state);
|
|
142
|
+
const configured = snapshot.value?.contextWindow;
|
|
143
|
+
const valueK = Math.min(CODEX_CONTEXT_MAX / CODEX_CONTEXT_UNIT, Math.max(1, Math.round((configured ?? contextWindow) / CODEX_CONTEXT_UNIT)));
|
|
144
|
+
const [open, setOpen] = useState(false);
|
|
145
|
+
const rootRef = useRef(null);
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
if (!open)
|
|
148
|
+
return undefined;
|
|
149
|
+
const onPointerDown = (event) => {
|
|
150
|
+
if (event.target instanceof Node && rootRef.current?.contains(event.target) === true)
|
|
151
|
+
return;
|
|
152
|
+
setOpen(false);
|
|
153
|
+
};
|
|
154
|
+
const onKeyDown = (event) => {
|
|
155
|
+
if (event.key === 'Escape')
|
|
156
|
+
setOpen(false);
|
|
157
|
+
};
|
|
158
|
+
document.addEventListener('pointerdown', onPointerDown);
|
|
159
|
+
document.addEventListener('keydown', onKeyDown);
|
|
160
|
+
return () => {
|
|
161
|
+
document.removeEventListener('pointerdown', onPointerDown);
|
|
162
|
+
document.removeEventListener('keydown', onKeyDown);
|
|
163
|
+
};
|
|
164
|
+
}, [open]);
|
|
165
|
+
if (!isCodexPresetId(agentPreset))
|
|
166
|
+
return null;
|
|
167
|
+
return (_jsxs("span", { ref: rootRef, style: { position: 'relative', display: 'inline-flex', alignItems: 'center' }, children: [_jsxs("button", { type: "button", "aria-label": `${t('contextSize')}: ${valueK}K`, "aria-haspopup": "dialog", "aria-expanded": open, disabled: snapshot.writable === false, title: t('contextSize'), onMouseDown: event => { event.preventDefault(); }, onClick: () => { setOpen(value => !value); }, style: {
|
|
168
|
+
boxSizing: 'border-box',
|
|
169
|
+
display: 'inline-flex',
|
|
170
|
+
alignItems: 'center',
|
|
171
|
+
gap: 3,
|
|
172
|
+
height: 28,
|
|
173
|
+
border: 0,
|
|
174
|
+
borderRadius: 7,
|
|
175
|
+
padding: '0 6px',
|
|
176
|
+
color: configured === undefined
|
|
177
|
+
? 'var(--dsw-alias-label-secondary)'
|
|
178
|
+
: 'var(--dsw-static-blue-500)',
|
|
179
|
+
background: open ? 'var(--dsw-alias-interactive-bg-hover)' : 'transparent',
|
|
180
|
+
cursor: snapshot.writable === false ? 'default' : 'pointer',
|
|
181
|
+
font: 'inherit',
|
|
182
|
+
fontSize: 12,
|
|
183
|
+
lineHeight: '20px',
|
|
184
|
+
fontWeight: configured === undefined ? 400 : 600,
|
|
185
|
+
whiteSpace: 'nowrap',
|
|
186
|
+
}, children: [_jsxs("span", { children: [valueK, "K"] }), _jsx("svg", { viewBox: "0 0 12 12", width: "12", height: "12", "aria-hidden": true, children: _jsx("path", { d: "M3 4.5 6 7.5 9 4.5", fill: "none", stroke: "currentColor", strokeWidth: "1.25", strokeLinecap: "round", strokeLinejoin: "round" }) })] }), open && (_jsx("div", { role: "dialog", "aria-label": t('contextSize'), style: {
|
|
187
|
+
position: 'absolute',
|
|
188
|
+
right: 0,
|
|
189
|
+
bottom: 'calc(100% + 8px)',
|
|
190
|
+
zIndex: 20,
|
|
191
|
+
boxSizing: 'border-box',
|
|
192
|
+
width: 300,
|
|
193
|
+
maxWidth: 'calc(100vw - 24px)',
|
|
194
|
+
padding: '10px 12px 12px',
|
|
195
|
+
border: '1px solid var(--dsw-alias-border-l2)',
|
|
196
|
+
borderRadius: 10,
|
|
197
|
+
color: 'var(--dsw-alias-label-primary)',
|
|
198
|
+
background: 'var(--dsw-alias-bg-base)',
|
|
199
|
+
boxShadow: 'var(--dsw-shadow-lv2)',
|
|
200
|
+
}, children: _jsx(ContextSizeControl, { contextWindow: contextWindow, useSettings: useSettings, setSetting: setSetting, unsetSetting: unsetSetting, t: t }) }))] }));
|
|
139
201
|
}
|
|
140
202
|
function elapsedSeconds(startedAt, now) {
|
|
141
203
|
return Math.max(0, Math.floor((now - startedAt) / 1_000));
|
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.27",
|
|
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",
|
|
@@ -94,7 +94,6 @@
|
|
|
94
94
|
"@deepseek-ai/dsh-client-ui-slots": ">=0.1.0-rc.8",
|
|
95
95
|
"@deepseek-ai/dsh-compaction": ">=0.1.1-rc.2",
|
|
96
96
|
"@deepseek-ai/dsh-compaction-basic": ">=0.1.1-rc.2",
|
|
97
|
-
"@deepseek-ai/dsh-compaction-tool-result-pruner": ">=0.1.1-rc.2",
|
|
98
97
|
"@deepseek-ai/dsh-credentials": ">=0.1.0-rc.8",
|
|
99
98
|
"@deepseek-ai/dsh-fs": ">=0.0.1-rc.1",
|
|
100
99
|
"@deepseek-ai/dsh-invariants": ">=0.0.1-rc.1",
|
|
@@ -142,9 +141,6 @@
|
|
|
142
141
|
"@deepseek-ai/dsh-compaction-basic": {
|
|
143
142
|
"optional": true
|
|
144
143
|
},
|
|
145
|
-
"@deepseek-ai/dsh-compaction-tool-result-pruner": {
|
|
146
|
-
"optional": true
|
|
147
|
-
},
|
|
148
144
|
"@deepseek-ai/dsh-credentials": {
|
|
149
145
|
"optional": true
|
|
150
146
|
},
|
|
@@ -202,6 +198,8 @@
|
|
|
202
198
|
},
|
|
203
199
|
"devDependencies": {
|
|
204
200
|
"@deepseek-ai/cordis": "4.0.1",
|
|
201
|
+
"@deepseek-ai/cordis-plugin-include": "1.0.6",
|
|
202
|
+
"@deepseek-ai/cordis-plugin-loader": "1.0.2",
|
|
205
203
|
"@deepseek-ai/dsh-agent": "0.1.0-rc.6",
|
|
206
204
|
"@deepseek-ai/dsh-client-locale": "0.1.0-rc.8",
|
|
207
205
|
"@deepseek-ai/dsh-client-runtime": "0.1.0-rc.8",
|
|
@@ -210,7 +208,6 @@
|
|
|
210
208
|
"@deepseek-ai/dsh-client-ui-slots": "0.1.0-rc.8",
|
|
211
209
|
"@deepseek-ai/dsh-compaction": "0.1.1-rc.2",
|
|
212
210
|
"@deepseek-ai/dsh-compaction-basic": "0.1.1-rc.2",
|
|
213
|
-
"@deepseek-ai/dsh-compaction-tool-result-pruner": "0.1.1-rc.2",
|
|
214
211
|
"@deepseek-ai/dsh-credentials": "0.1.0-rc.8",
|
|
215
212
|
"@deepseek-ai/dsh-fs": "0.1.0-rc.6",
|
|
216
213
|
"@deepseek-ai/dsh-invariants": "0.1.0-rc.6",
|