@shuind/dsh-codex-harness 0.2.4 → 0.2.6
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 +49 -49
- package/cordis.patch.yml +11 -11
- package/lib/client.js +378 -114
- package/lib/compaction.js +10 -1
- package/lib/index.js +184 -19
- package/lib/installer.js +24 -1
- package/lib/types/client/index.d.ts +26 -9
- package/lib/types/client/index.js +183 -56
- package/lib/types/compact-command.d.ts +13 -0
- package/lib/types/compact-command.js +79 -0
- package/lib/types/compaction.d.ts +6 -0
- package/lib/types/compaction.js +9 -0
- package/lib/types/index.d.ts +7 -1
- package/lib/types/index.js +81 -16
- package/lib/types/patch.js +15 -15
- package/lib/types/prompt.d.ts +6 -0
- package/lib/types/prompt.js +50 -35
- package/lib/types/settings.d.ts +8 -0
- package/lib/types/settings.js +9 -1
- package/package.json +260 -247
- package/presets/codex-collaboration/agent.cordis.yml +197 -197
- package/presets/codex-collaboration/preset.yml +3 -3
package/lib/client.js
CHANGED
|
@@ -49,10 +49,25 @@ window.__ModuleLoader__.load({
|
|
|
49
49
|
|
|
50
50
|
## Working principles
|
|
51
51
|
|
|
52
|
-
-
|
|
52
|
+
- Actively establish the user's current context rather than relying on stale assumptions or prior context. Before committing to an approach that could materially shape the outcome or direction of the work, state the intended path and align it with the user; clarify any material uncertainty first. Then pursue the user's goal through the clearest, most effective path.
|
|
53
53
|
- Keep only the essential logic and core actions. Don't explain or test what was removed or why something wasn't done, especially when writing documentation or communicating. Convey enough valuable information with as few words as possible.
|
|
54
54
|
- Solve problems by thinking from first principles and at a higher level.
|
|
55
55
|
`;
|
|
56
|
+
/** Default deployment Persona template used by the Codex preset. */
|
|
57
|
+
const DEFAULT_CODEX_PERSONA = String.raw`You are Codex, a coding agent based on the {{model}} model. Your working directory is {{cwd}}.`;
|
|
58
|
+
/** Default DSH Core source-checkout guidance template. */
|
|
59
|
+
const DEFAULT_DSH_CORE_SOURCE_PROMPT = String.raw`The DeepSeek Harness implementation checkout is at {{sourceRoot}}. The checkout location and current working directory are separate values and may differ; never infer the working directory from this path. Use pwd to determine the current working directory. Use this checkout only to inspect or extend DSH itself.`;
|
|
60
|
+
/** Default DSH Web runtime guidance template. */
|
|
61
|
+
const DEFAULT_DSH_CORE_WEB_PROMPT = [
|
|
62
|
+
"You are interacting with the user through the DeepSeek Harness Web GUI at {{webUrl}}.",
|
|
63
|
+
"When the user refers to \"this page\", \"this GUI\", or \"this app\" without naming another target, they mean this GUI.",
|
|
64
|
+
"The browser provides no implicit DOM, route, or screenshot context.",
|
|
65
|
+
"The client-plugin HMR receiver is active, but client-plugin changes reload without a refresh only while `pnpm run dev:web` is also running from this same checkout to rebuild their bundles; verify that watcher before promising automatic updates.",
|
|
66
|
+
"Every other change - the apps/web shell and plain packages - requires rebuilding the affected Web artifacts and verifying this existing URL after a page refresh.",
|
|
67
|
+
"Starting another server does not update this GUI.",
|
|
68
|
+
"The apps/web Vite entry builds the shell but is not a standalone application because only dsh web injects window.__DSH_BOOT__.",
|
|
69
|
+
"Do not start a replacement server unless the user asks; if one is needed, use a managed background job and verify its exact URL."
|
|
70
|
+
].join(" ");
|
|
56
71
|
//#endregion
|
|
57
72
|
//#region lib/types/client/activity.js
|
|
58
73
|
/** Client-only inference used while the host activity projection frame is in flight. */
|
|
@@ -122,25 +137,38 @@ window.__ModuleLoader__.load({
|
|
|
122
137
|
contextRestore: "Restore model default",
|
|
123
138
|
promptCardTitle: "Codex Harness",
|
|
124
139
|
promptCardDescription: "Choose Codex capabilities and customize the operating prompt.",
|
|
125
|
-
|
|
140
|
+
codexOnlyCapabilitiesLabel: "Codex mode only",
|
|
141
|
+
otherCapabilitiesLabel: "Additional capabilities",
|
|
126
142
|
capabilityPrompt: "Codex operating prompt",
|
|
127
|
-
capabilityPromptHint: "Inject the editable instructions and persona-first prompt layout
|
|
143
|
+
capabilityPromptHint: "Inject the editable instructions and persona-first prompt layout.",
|
|
144
|
+
capabilityFast: "Fast mode control",
|
|
145
|
+
capabilityFastHint: "Show the Fast mode switch beside the conversation composer.",
|
|
146
|
+
compactRemote: "Remote compaction",
|
|
147
|
+
compactRemoteHint: "Use the provider remote compaction endpoint first.",
|
|
148
|
+
compactLocal: "Local compaction",
|
|
149
|
+
compactLocalHint: "Use the DSH text-summary compaction engine directly.",
|
|
128
150
|
capabilityTerminal: "Terminal tools",
|
|
129
|
-
capabilityTerminalHint: "Expose exec_command and write_stdin
|
|
151
|
+
capabilityTerminalHint: "Expose exec_command and write_stdin.",
|
|
130
152
|
capabilityPatch: "Patch tool",
|
|
131
|
-
capabilityPatchHint: "Expose apply_patch
|
|
153
|
+
capabilityPatchHint: "Expose apply_patch, using the native Responses grammar when supported.",
|
|
132
154
|
capabilityPlan: "Plan tool",
|
|
133
|
-
capabilityPlanHint: "Expose update_plan for implementation task tracking
|
|
155
|
+
capabilityPlanHint: "Expose update_plan for implementation task tracking.",
|
|
134
156
|
capabilityWebSearch: "Hosted web search",
|
|
135
157
|
capabilityWebSearchHint: "Use the provider-native Responses web_search tool when available.",
|
|
136
158
|
capabilityCompaction: "Remote compaction",
|
|
137
159
|
capabilityCompactionHint: "Prefer the provider Responses compact endpoint before local compaction.",
|
|
138
160
|
capabilityActivity: "Activity indicator",
|
|
139
161
|
capabilityActivityHint: "Show request, reply, and compaction status beside the conversation.",
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
162
|
+
promptCustomizationLabel: "Prompt customization",
|
|
163
|
+
personaLabel: "Persona",
|
|
164
|
+
personaHint: "Deployment identity and role. Supports {{model}} and {{cwd}}.",
|
|
165
|
+
sourcePromptLabel: "DSH Core source instructions",
|
|
166
|
+
sourcePromptHint: "Guidance about the DSH checkout and working directory. Supports {{sourceRoot}}.",
|
|
167
|
+
webPromptLabel: "DSH Core Web instructions",
|
|
168
|
+
webPromptHint: "Guidance about this Web GUI, HMR, builds, and verification. Supports {{webUrl}}.",
|
|
169
|
+
promptRestoreAll: "Restore all prompt defaults",
|
|
170
|
+
promptLabel: "Codex operating prompt",
|
|
171
|
+
promptHint: "This is the Codex operating prompt. Persona and DSH Core instructions are edited separately above.",
|
|
144
172
|
promptUnsaved: "Unsaved",
|
|
145
173
|
promptDiscard: "Discard",
|
|
146
174
|
promptSave: "Save",
|
|
@@ -164,25 +192,38 @@ window.__ModuleLoader__.load({
|
|
|
164
192
|
contextRestore: "恢复模型默认值",
|
|
165
193
|
promptCardTitle: "Codex Harness",
|
|
166
194
|
promptCardDescription: "选择 Codex 能力并自定义完整的操作提示词。",
|
|
167
|
-
|
|
195
|
+
codexOnlyCapabilitiesLabel: "仅在 Codex 模式下",
|
|
196
|
+
otherCapabilitiesLabel: "其他能力",
|
|
168
197
|
capabilityPrompt: "Codex 操作提示词",
|
|
169
|
-
capabilityPromptHint: "
|
|
198
|
+
capabilityPromptHint: "注入可编辑指令,并将 Persona 放在提示词首位。",
|
|
199
|
+
capabilityFast: "显示 Fast 模式",
|
|
200
|
+
capabilityFastHint: "在对话输入区旁显示 Fast 开关。",
|
|
201
|
+
compactRemote: "远程压缩",
|
|
202
|
+
compactRemoteHint: "优先使用提供商的远程压缩端点。",
|
|
203
|
+
compactLocal: "本地压缩",
|
|
204
|
+
compactLocalHint: "直接使用 DSH 文本摘要压缩引擎。",
|
|
170
205
|
capabilityTerminal: "终端工具",
|
|
171
|
-
capabilityTerminalHint: "
|
|
206
|
+
capabilityTerminalHint: "提供 exec_command 和 write_stdin。",
|
|
172
207
|
capabilityPatch: "补丁工具",
|
|
173
|
-
capabilityPatchHint: "
|
|
208
|
+
capabilityPatchHint: "提供 apply_patch,并在支持时使用 Responses 原生语法。",
|
|
174
209
|
capabilityPlan: "计划工具",
|
|
175
|
-
capabilityPlanHint: "
|
|
210
|
+
capabilityPlanHint: "提供 update_plan,用于跟踪实施任务。",
|
|
176
211
|
capabilityWebSearch: "托管网络搜索",
|
|
177
212
|
capabilityWebSearchHint: "可用时使用提供商原生的 Responses web_search 工具。",
|
|
178
213
|
capabilityCompaction: "远程上下文压缩",
|
|
179
214
|
capabilityCompactionHint: "优先调用提供商的 Responses compact 端点,失败时回退本地压缩。",
|
|
180
215
|
capabilityActivity: "活动状态",
|
|
181
216
|
capabilityActivityHint: "在对话旁显示请求、回复和压缩状态。",
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
217
|
+
promptCustomizationLabel: "提示词定制",
|
|
218
|
+
personaLabel: "Persona",
|
|
219
|
+
personaHint: "定义 Agent 的身份与角色,支持 {{model}} 和 {{cwd}}。",
|
|
220
|
+
sourcePromptLabel: "DSH Core 源码说明",
|
|
221
|
+
sourcePromptHint: "说明 DSH 源码检出目录与工作目录,支持 {{sourceRoot}}。",
|
|
222
|
+
webPromptLabel: "DSH Core Web 说明",
|
|
223
|
+
webPromptHint: "说明 Web GUI、HMR、构建与验证,支持 {{webUrl}}。",
|
|
224
|
+
promptRestoreAll: "恢复所有提示词默认值",
|
|
225
|
+
promptLabel: "Codex 操作提示词",
|
|
226
|
+
promptHint: "这是 Codex 操作提示词。Persona 和 DSH Core 说明在上方分别编辑。",
|
|
186
227
|
promptUnsaved: "未保存",
|
|
187
228
|
promptDiscard: "放弃",
|
|
188
229
|
promptSave: "保存",
|
|
@@ -200,9 +241,6 @@ window.__ModuleLoader__.load({
|
|
|
200
241
|
const value = layer["systemPrompt"];
|
|
201
242
|
return typeof value === "string" ? value : void 0;
|
|
202
243
|
}
|
|
203
|
-
function hasPromptOverride(layer) {
|
|
204
|
-
return typeof layer === "object" && layer !== null && !Array.isArray(layer) && Object.hasOwn(layer, "systemPrompt");
|
|
205
|
-
}
|
|
206
244
|
function CapabilityToggle({ field, label, hint, enabled, disabled, setSetting }) {
|
|
207
245
|
return (0, react_jsx_runtime.jsxs)("label", {
|
|
208
246
|
style: {
|
|
@@ -249,14 +287,173 @@ window.__ModuleLoader__.load({
|
|
|
249
287
|
})]
|
|
250
288
|
});
|
|
251
289
|
}
|
|
290
|
+
/** Visually separate capability scope while keeping the host's light settings style. */
|
|
291
|
+
function CapabilityGroup({ id, label, children, accent }) {
|
|
292
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
293
|
+
const panelId = `${id}-panel`;
|
|
294
|
+
return (0, react_jsx_runtime.jsxs)("section", {
|
|
295
|
+
style: {
|
|
296
|
+
display: "grid",
|
|
297
|
+
gap: open ? 4 : 0
|
|
298
|
+
},
|
|
299
|
+
children: [(0, react_jsx_runtime.jsxs)("button", {
|
|
300
|
+
type: "button",
|
|
301
|
+
"aria-expanded": open,
|
|
302
|
+
"aria-controls": panelId,
|
|
303
|
+
onClick: () => {
|
|
304
|
+
setOpen(!open);
|
|
305
|
+
},
|
|
306
|
+
style: {
|
|
307
|
+
display: "flex",
|
|
308
|
+
alignItems: "center",
|
|
309
|
+
gap: 7,
|
|
310
|
+
width: "100%",
|
|
311
|
+
padding: 0,
|
|
312
|
+
border: 0,
|
|
313
|
+
background: "none",
|
|
314
|
+
color: "var(--dsw-alias-label-secondary)",
|
|
315
|
+
font: "inherit",
|
|
316
|
+
textAlign: "left",
|
|
317
|
+
cursor: "pointer"
|
|
318
|
+
},
|
|
319
|
+
children: [
|
|
320
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
321
|
+
"aria-hidden": "true",
|
|
322
|
+
style: {
|
|
323
|
+
width: 6,
|
|
324
|
+
height: 6,
|
|
325
|
+
flex: "0 0 auto",
|
|
326
|
+
borderRadius: 999,
|
|
327
|
+
background: accent
|
|
328
|
+
}
|
|
329
|
+
}),
|
|
330
|
+
(0, react_jsx_runtime.jsx)("strong", {
|
|
331
|
+
style: {
|
|
332
|
+
color: "var(--dsw-alias-label-secondary)",
|
|
333
|
+
fontSize: 14,
|
|
334
|
+
fontWeight: 600,
|
|
335
|
+
letterSpacing: "0.01em"
|
|
336
|
+
},
|
|
337
|
+
children: label
|
|
338
|
+
}),
|
|
339
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
340
|
+
"aria-hidden": "true",
|
|
341
|
+
style: {
|
|
342
|
+
color: "var(--dsw-alias-label-tertiary)",
|
|
343
|
+
fontSize: 16
|
|
344
|
+
},
|
|
345
|
+
children: open ? "-" : "+"
|
|
346
|
+
})
|
|
347
|
+
]
|
|
348
|
+
}), open && (0, react_jsx_runtime.jsx)("div", {
|
|
349
|
+
id: panelId,
|
|
350
|
+
style: {
|
|
351
|
+
display: "grid",
|
|
352
|
+
marginLeft: 5,
|
|
353
|
+
paddingLeft: 12
|
|
354
|
+
},
|
|
355
|
+
children
|
|
356
|
+
})]
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
function PromptEditor({ id, label, hint, value, writable, saving, minHeight, onChange }) {
|
|
360
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
361
|
+
const labelId = `${id}-label`;
|
|
362
|
+
const panelId = `${id}-panel`;
|
|
363
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
364
|
+
style: {
|
|
365
|
+
display: "grid",
|
|
366
|
+
gap: open ? 8 : 0
|
|
367
|
+
},
|
|
368
|
+
children: [(0, react_jsx_runtime.jsxs)("button", {
|
|
369
|
+
type: "button",
|
|
370
|
+
"aria-expanded": open,
|
|
371
|
+
"aria-controls": panelId,
|
|
372
|
+
onClick: () => {
|
|
373
|
+
setOpen(!open);
|
|
374
|
+
},
|
|
375
|
+
style: {
|
|
376
|
+
display: "flex",
|
|
377
|
+
alignItems: "center",
|
|
378
|
+
gap: 8,
|
|
379
|
+
width: "100%",
|
|
380
|
+
padding: 0,
|
|
381
|
+
border: 0,
|
|
382
|
+
background: "none",
|
|
383
|
+
color: "var(--dsw-alias-label-primary)",
|
|
384
|
+
font: "inherit",
|
|
385
|
+
fontSize: 13,
|
|
386
|
+
fontWeight: 500,
|
|
387
|
+
textAlign: "left",
|
|
388
|
+
cursor: "pointer"
|
|
389
|
+
},
|
|
390
|
+
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
391
|
+
id: labelId,
|
|
392
|
+
style: { flex: 1 },
|
|
393
|
+
children: label
|
|
394
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
395
|
+
"aria-hidden": "true",
|
|
396
|
+
style: {
|
|
397
|
+
color: "var(--dsw-alias-label-tertiary)",
|
|
398
|
+
fontSize: 16
|
|
399
|
+
},
|
|
400
|
+
children: open ? "-" : "+"
|
|
401
|
+
})]
|
|
402
|
+
}), open && (0, react_jsx_runtime.jsxs)("div", {
|
|
403
|
+
id: panelId,
|
|
404
|
+
style: {
|
|
405
|
+
display: "grid",
|
|
406
|
+
gap: 5
|
|
407
|
+
},
|
|
408
|
+
children: [(0, react_jsx_runtime.jsx)("textarea", {
|
|
409
|
+
id,
|
|
410
|
+
"aria-labelledby": labelId,
|
|
411
|
+
value,
|
|
412
|
+
disabled: !writable || saving,
|
|
413
|
+
onChange: (event) => {
|
|
414
|
+
onChange(event.target.value);
|
|
415
|
+
},
|
|
416
|
+
spellCheck: false,
|
|
417
|
+
style: {
|
|
418
|
+
boxSizing: "border-box",
|
|
419
|
+
width: "100%",
|
|
420
|
+
minHeight,
|
|
421
|
+
resize: "vertical",
|
|
422
|
+
padding: 10,
|
|
423
|
+
border: "1px solid var(--dsw-alias-border-l2)",
|
|
424
|
+
borderRadius: 8,
|
|
425
|
+
background: "var(--dsw-alias-bg-layer-3)",
|
|
426
|
+
color: "var(--dsw-alias-label-primary)",
|
|
427
|
+
font: "inherit",
|
|
428
|
+
fontSize: 12,
|
|
429
|
+
lineHeight: 1.5
|
|
430
|
+
}
|
|
431
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
432
|
+
style: {
|
|
433
|
+
color: "var(--dsw-alias-label-tertiary)",
|
|
434
|
+
fontSize: 11,
|
|
435
|
+
lineHeight: 1.45
|
|
436
|
+
},
|
|
437
|
+
children: hint
|
|
438
|
+
})]
|
|
439
|
+
})]
|
|
440
|
+
});
|
|
441
|
+
}
|
|
252
442
|
/** Full-prompt editor contributed to Settings > Plugins. */
|
|
253
443
|
function PromptSettingsCard(props) {
|
|
254
444
|
const { useSettings, setSetting, unsetSetting, t } = props;
|
|
255
445
|
const snapshot = useSettings((state) => state);
|
|
446
|
+
const currentPersona = snapshot.value?.persona ?? DEFAULT_CODEX_PERSONA;
|
|
447
|
+
const currentSourcePrompt = snapshot.value?.harnessSourcePrompt ?? DEFAULT_DSH_CORE_SOURCE_PROMPT;
|
|
448
|
+
const currentWebPrompt = snapshot.value?.webSurfacePrompt ?? DEFAULT_DSH_CORE_WEB_PROMPT;
|
|
256
449
|
const current = snapshot.value?.systemPrompt ?? DEFAULT_CODEX_SYSTEM_PROMPT;
|
|
257
450
|
const inherited = promptFromLayer(snapshot.base) ?? DEFAULT_CODEX_SYSTEM_PROMPT;
|
|
258
|
-
const
|
|
259
|
-
|
|
451
|
+
const codexOnlyCapabilities = [
|
|
452
|
+
{
|
|
453
|
+
field: "fastModeControlEnabled",
|
|
454
|
+
label: "capabilityFast",
|
|
455
|
+
hint: "capabilityFastHint"
|
|
456
|
+
},
|
|
260
457
|
{
|
|
261
458
|
field: "promptEnabled",
|
|
262
459
|
label: "capabilityPrompt",
|
|
@@ -276,7 +473,9 @@ window.__ModuleLoader__.load({
|
|
|
276
473
|
field: "planToolEnabled",
|
|
277
474
|
label: "capabilityPlan",
|
|
278
475
|
hint: "capabilityPlanHint"
|
|
279
|
-
}
|
|
476
|
+
}
|
|
477
|
+
];
|
|
478
|
+
const otherCapabilities = [
|
|
280
479
|
{
|
|
281
480
|
field: "hostedWebSearchEnabled",
|
|
282
481
|
label: "capabilityWebSearch",
|
|
@@ -294,19 +493,43 @@ window.__ModuleLoader__.load({
|
|
|
294
493
|
}
|
|
295
494
|
];
|
|
296
495
|
const [open, setOpen] = (0, react.useState)(false);
|
|
496
|
+
const [personaDraft, setPersonaDraft] = (0, react.useState)(currentPersona);
|
|
497
|
+
const [sourcePromptDraft, setSourcePromptDraft] = (0, react.useState)(currentSourcePrompt);
|
|
498
|
+
const [webPromptDraft, setWebPromptDraft] = (0, react.useState)(currentWebPrompt);
|
|
297
499
|
const [draft, setDraft] = (0, react.useState)(current);
|
|
298
500
|
const [saving, setSaving] = (0, react.useState)(false);
|
|
299
501
|
const [failed, setFailed] = (0, react.useState)(false);
|
|
300
502
|
(0, react.useEffect)(() => {
|
|
503
|
+
setPersonaDraft(currentPersona);
|
|
504
|
+
setSourcePromptDraft(currentSourcePrompt);
|
|
505
|
+
setWebPromptDraft(currentWebPrompt);
|
|
301
506
|
setDraft(current);
|
|
302
|
-
}, [
|
|
507
|
+
}, [
|
|
508
|
+
current,
|
|
509
|
+
currentPersona,
|
|
510
|
+
currentSourcePrompt,
|
|
511
|
+
currentWebPrompt
|
|
512
|
+
]);
|
|
303
513
|
if (snapshot.status === "unavailable") return null;
|
|
304
|
-
const dirty = draft !== current;
|
|
514
|
+
const dirty = personaDraft !== currentPersona || sourcePromptDraft !== currentSourcePrompt || webPromptDraft !== currentWebPrompt || draft !== current;
|
|
515
|
+
const renderCapability = (capability) => (0, react_jsx_runtime.jsx)(CapabilityToggle, {
|
|
516
|
+
field: capability.field,
|
|
517
|
+
label: t(capability.label),
|
|
518
|
+
hint: t(capability.hint),
|
|
519
|
+
enabled: snapshot.value?.[capability.field] ?? true,
|
|
520
|
+
disabled: !snapshot.writable || saving,
|
|
521
|
+
setSetting
|
|
522
|
+
}, capability.field);
|
|
305
523
|
const save = async () => {
|
|
306
524
|
setSaving(true);
|
|
307
525
|
setFailed(false);
|
|
308
526
|
try {
|
|
309
|
-
await
|
|
527
|
+
await Promise.all([
|
|
528
|
+
setSetting("persona", personaDraft),
|
|
529
|
+
setSetting("harnessSourcePrompt", sourcePromptDraft),
|
|
530
|
+
setSetting("webSurfacePrompt", webPromptDraft),
|
|
531
|
+
setSetting("systemPrompt", draft)
|
|
532
|
+
]);
|
|
310
533
|
} catch {
|
|
311
534
|
setFailed(true);
|
|
312
535
|
} finally {
|
|
@@ -316,11 +539,20 @@ window.__ModuleLoader__.load({
|
|
|
316
539
|
const reset = async () => {
|
|
317
540
|
setSaving(true);
|
|
318
541
|
setFailed(false);
|
|
542
|
+
setPersonaDraft(DEFAULT_CODEX_PERSONA);
|
|
543
|
+
setSourcePromptDraft(DEFAULT_DSH_CORE_SOURCE_PROMPT);
|
|
544
|
+
setWebPromptDraft(DEFAULT_DSH_CORE_WEB_PROMPT);
|
|
319
545
|
setDraft(inherited);
|
|
320
546
|
try {
|
|
321
547
|
await unsetSetting("systemPrompt");
|
|
548
|
+
await unsetSetting("persona");
|
|
549
|
+
await unsetSetting("harnessSourcePrompt");
|
|
550
|
+
await unsetSetting("webSurfacePrompt");
|
|
322
551
|
} catch {
|
|
323
552
|
setFailed(true);
|
|
553
|
+
setPersonaDraft(currentPersona);
|
|
554
|
+
setSourcePromptDraft(currentSourcePrompt);
|
|
555
|
+
setWebPromptDraft(currentWebPrompt);
|
|
324
556
|
setDraft(current);
|
|
325
557
|
} finally {
|
|
326
558
|
setSaving(false);
|
|
@@ -412,102 +644,103 @@ window.__ModuleLoader__.load({
|
|
|
412
644
|
},
|
|
413
645
|
children: t("promptReadOnly")
|
|
414
646
|
}),
|
|
415
|
-
(0, react_jsx_runtime.
|
|
416
|
-
style: {
|
|
417
|
-
display: "block",
|
|
418
|
-
marginBottom: 4,
|
|
419
|
-
fontSize: 13
|
|
420
|
-
},
|
|
421
|
-
children: t("capabilitiesLabel")
|
|
422
|
-
}),
|
|
423
|
-
(0, react_jsx_runtime.jsx)("div", {
|
|
647
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
424
648
|
style: {
|
|
425
649
|
display: "grid",
|
|
650
|
+
gap: 16,
|
|
426
651
|
marginBottom: 14
|
|
427
652
|
},
|
|
428
|
-
children:
|
|
429
|
-
|
|
430
|
-
label: t(
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
653
|
+
children: [(0, react_jsx_runtime.jsx)(CapabilityGroup, {
|
|
654
|
+
id: "codex-only-capabilities",
|
|
655
|
+
label: t("codexOnlyCapabilitiesLabel"),
|
|
656
|
+
accent: "var(--dsw-static-blue-500)",
|
|
657
|
+
children: codexOnlyCapabilities.map(renderCapability)
|
|
658
|
+
}), (0, react_jsx_runtime.jsx)(CapabilityGroup, {
|
|
659
|
+
id: "other-capabilities",
|
|
660
|
+
label: t("otherCapabilitiesLabel"),
|
|
661
|
+
accent: "var(--dsw-alias-label-tertiary)",
|
|
662
|
+
children: otherCapabilities.map(renderCapability)
|
|
663
|
+
})]
|
|
436
664
|
}),
|
|
437
665
|
(0, react_jsx_runtime.jsxs)("div", {
|
|
438
666
|
style: {
|
|
439
|
-
display: "
|
|
440
|
-
|
|
441
|
-
gap: 8,
|
|
442
|
-
marginBottom: 7,
|
|
667
|
+
display: "grid",
|
|
668
|
+
gap: 14,
|
|
443
669
|
paddingTop: 12,
|
|
444
670
|
borderTop: "1px solid var(--dsw-alias-border-l2)"
|
|
445
671
|
},
|
|
446
|
-
children: [
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
},
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
672
|
+
children: [
|
|
673
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
674
|
+
style: {
|
|
675
|
+
display: "flex",
|
|
676
|
+
alignItems: "center",
|
|
677
|
+
gap: 8
|
|
678
|
+
},
|
|
679
|
+
children: [(0, react_jsx_runtime.jsx)("strong", {
|
|
680
|
+
style: {
|
|
681
|
+
flex: 1,
|
|
682
|
+
fontSize: 13
|
|
683
|
+
},
|
|
684
|
+
children: t("promptCustomizationLabel")
|
|
685
|
+
}), (0, react_jsx_runtime.jsx)("button", {
|
|
686
|
+
type: "button",
|
|
687
|
+
disabled: !snapshot.writable || saving || !dirty,
|
|
688
|
+
onClick: () => {
|
|
689
|
+
reset();
|
|
690
|
+
},
|
|
691
|
+
style: {
|
|
692
|
+
border: 0,
|
|
693
|
+
padding: 0,
|
|
694
|
+
background: "none",
|
|
695
|
+
color: "var(--dsw-alias-label-secondary)",
|
|
696
|
+
font: "inherit",
|
|
697
|
+
fontSize: 11,
|
|
698
|
+
cursor: "pointer"
|
|
699
|
+
},
|
|
700
|
+
children: t("promptRestoreAll")
|
|
701
|
+
})]
|
|
702
|
+
}),
|
|
703
|
+
(0, react_jsx_runtime.jsx)(PromptEditor, {
|
|
704
|
+
id: "codex-persona",
|
|
705
|
+
label: t("personaLabel"),
|
|
706
|
+
hint: t("personaHint"),
|
|
707
|
+
value: personaDraft,
|
|
708
|
+
writable: snapshot.writable,
|
|
709
|
+
saving,
|
|
710
|
+
minHeight: 84,
|
|
711
|
+
onChange: setPersonaDraft
|
|
712
|
+
}),
|
|
713
|
+
(0, react_jsx_runtime.jsx)(PromptEditor, {
|
|
714
|
+
id: "codex-harness-source-prompt",
|
|
715
|
+
label: t("sourcePromptLabel"),
|
|
716
|
+
hint: t("sourcePromptHint"),
|
|
717
|
+
value: sourcePromptDraft,
|
|
718
|
+
writable: snapshot.writable,
|
|
719
|
+
saving,
|
|
720
|
+
minHeight: 100,
|
|
721
|
+
onChange: setSourcePromptDraft
|
|
722
|
+
}),
|
|
723
|
+
(0, react_jsx_runtime.jsx)(PromptEditor, {
|
|
724
|
+
id: "codex-web-surface-prompt",
|
|
725
|
+
label: t("webPromptLabel"),
|
|
726
|
+
hint: t("webPromptHint"),
|
|
727
|
+
value: webPromptDraft,
|
|
728
|
+
writable: snapshot.writable,
|
|
729
|
+
saving,
|
|
730
|
+
minHeight: 120,
|
|
731
|
+
onChange: setWebPromptDraft
|
|
732
|
+
}),
|
|
733
|
+
(0, react_jsx_runtime.jsx)(PromptEditor, {
|
|
734
|
+
id: "codex-system-prompt",
|
|
735
|
+
label: t("promptLabel"),
|
|
736
|
+
hint: t("promptHint"),
|
|
737
|
+
value: draft,
|
|
738
|
+
writable: snapshot.writable,
|
|
739
|
+
saving,
|
|
740
|
+
minHeight: 320,
|
|
741
|
+
onChange: setDraft
|
|
742
|
+
})
|
|
743
|
+
]
|
|
511
744
|
}),
|
|
512
745
|
(0, react_jsx_runtime.jsxs)("div", {
|
|
513
746
|
style: {
|
|
@@ -573,7 +806,9 @@ window.__ModuleLoader__.load({
|
|
|
573
806
|
function FastModeFallback(props) {
|
|
574
807
|
const { useSettings, setSetting, t } = props;
|
|
575
808
|
const snapshot = useSettings((state) => state);
|
|
809
|
+
const visible = snapshot.value?.fastModeControlEnabled ?? true;
|
|
576
810
|
const fast = snapshot.value?.fast ?? false;
|
|
811
|
+
if (!visible) return null;
|
|
577
812
|
return (0, react_jsx_runtime.jsxs)("button", {
|
|
578
813
|
type: "button",
|
|
579
814
|
role: "switch",
|
|
@@ -928,6 +1163,8 @@ window.__ModuleLoader__.load({
|
|
|
928
1163
|
}), document.body, "codex-activity")] });
|
|
929
1164
|
}
|
|
930
1165
|
const inject = [
|
|
1166
|
+
"commandUi",
|
|
1167
|
+
"sessions",
|
|
931
1168
|
"slots",
|
|
932
1169
|
"locale",
|
|
933
1170
|
"settingsScope"
|
|
@@ -938,6 +1175,33 @@ window.__ModuleLoader__.load({
|
|
|
938
1175
|
en,
|
|
939
1176
|
zh
|
|
940
1177
|
}), "codex client: dictionaries");
|
|
1178
|
+
const commandUi = ctx.get("commandUi");
|
|
1179
|
+
const sessions = ctx.get("sessions");
|
|
1180
|
+
const t = ctx.locale.bind(NS);
|
|
1181
|
+
const sessionFor = (session) => sessions.binding(session.sessionId)?.session;
|
|
1182
|
+
ctx.effect(() => commandUi.decorate({
|
|
1183
|
+
name: "compact",
|
|
1184
|
+
available: (session) => sessionFor(session) !== void 0,
|
|
1185
|
+
ui: {
|
|
1186
|
+
kind: "popupSelect",
|
|
1187
|
+
options: async () => [{
|
|
1188
|
+
id: "remote",
|
|
1189
|
+
label: t("compactRemote"),
|
|
1190
|
+
detail: t("compactRemoteHint")
|
|
1191
|
+
}, {
|
|
1192
|
+
id: "local",
|
|
1193
|
+
label: t("compactLocal"),
|
|
1194
|
+
detail: t("compactLocalHint")
|
|
1195
|
+
}],
|
|
1196
|
+
onSelect: async (option, session) => {
|
|
1197
|
+
const live = sessionFor(session);
|
|
1198
|
+
if (live === void 0) throw new Error("this session is not materialized yet");
|
|
1199
|
+
const result = await live.command(`/compact ${option.id}`);
|
|
1200
|
+
if (!result.ok) throw new Error(`compact mode switch failed: ${result.error.code}: ${result.error.message}`);
|
|
1201
|
+
if (!result.value.matched) throw new Error("the host offers no /compact command");
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
}), "codex client: /compact mode picker");
|
|
941
1205
|
const settings = ctx.settingsScope.bind({ namespace: SETTINGS_NAMESPACE });
|
|
942
1206
|
const injected = () => ({
|
|
943
1207
|
hooks: { settings },
|
package/lib/compaction.js
CHANGED
|
@@ -3,6 +3,15 @@ import BasicCompactionEngine from "@deepseek-ai/dsh-compaction-basic";
|
|
|
3
3
|
import { settingsNamespace } from "@deepseek-ai/dsh-settings";
|
|
4
4
|
//#region lib/types/compaction.js
|
|
5
5
|
/** Codex compaction backend that honors the latest durable request capacity. */
|
|
6
|
+
const COMPACTION_MODE = new AsyncLocalStorage();
|
|
7
|
+
/** Run one manual compaction with an explicit local/remote preference. */
|
|
8
|
+
function runCodexCompactionMode(mode, task) {
|
|
9
|
+
return COMPACTION_MODE.run(mode, task);
|
|
10
|
+
}
|
|
11
|
+
/** Read the explicit preference for the current compaction stream, if any. */
|
|
12
|
+
function codexCompactionMode() {
|
|
13
|
+
return COMPACTION_MODE.getStore();
|
|
14
|
+
}
|
|
6
15
|
const CODEX_SETTINGS_NAMESPACE = settingsNamespace("codex");
|
|
7
16
|
/** Codex context overrides apply only to GPT-compatible model routes. */
|
|
8
17
|
function isGptModel(model) {
|
|
@@ -83,4 +92,4 @@ var CodexCompactionEngine = class extends BasicCompactionEngine {
|
|
|
83
92
|
}
|
|
84
93
|
};
|
|
85
94
|
//#endregion
|
|
86
|
-
export { CodexCompactionEngine as default };
|
|
95
|
+
export { codexCompactionMode, CodexCompactionEngine as default, runCodexCompactionMode };
|