@shuind/dsh-codex-harness 0.2.17 → 0.2.19
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/docs/preset-library.md +1 -1
- package/lib/index.js +19 -10
- package/lib/types/preset-editor.js +17 -6
- package/package.json +4 -1
package/docs/preset-library.md
CHANGED
|
@@ -12,7 +12,7 @@ DSH Core 源码说明和 Web 说明是 Web 宿主注册的提示词段,不是
|
|
|
12
12
|
|
|
13
13
|
Plan 模式插件的提示词(例如 `planning / plan-mode · section`)不进入预设提示词编辑器;复制和保存保留原有 Plan 配置。
|
|
14
14
|
|
|
15
|
-
没有额外的预设数据库。编辑器通过宿主的预设复制和安全写入服务保存名称、说明及 Codex 配置。加入 Codex 会保留原预设的身份和插件,并在副本内部挂载 Harness。`presetPrompt` 保存该预设的 Codex 工作指令,`presetSections` 保存其 Persona 和宿主说明覆盖。旧的全局 Codex 提示词在首次读取时作为迁移默认值,保存后的预设和副本独立持有各段文字。普通预设直接修改原有提示词字段,宿主说明由轻量的 `prompt-sections` 插件覆盖,不需要打开 Codex 工具。只有选择加入 Codex 时,才会解除 Persona
|
|
15
|
+
没有额外的预设数据库。编辑器通过宿主的预设复制和安全写入服务保存名称、说明及 Codex 配置。加入 Codex 会保留原预设的身份和插件,并在副本内部挂载 Harness。`presetPrompt` 保存该预设的 Codex 工作指令,`presetSections` 保存其 Persona 和宿主说明覆盖。旧的全局 Codex 提示词在首次读取时作为迁移默认值,保存后的预设和副本独立持有各段文字。普通预设直接修改原有提示词字段,宿主说明由轻量的 `prompt-sections` 插件覆盖,不需要打开 Codex 工具。只有选择加入 Codex 时,才会解除 Persona 屏蔽追加提示词的限制;如果源预设原本没有宿主说明,副本会保留这一状态,身份文本本身不变。
|
|
16
16
|
|
|
17
17
|
保存使用版本检查、文件锁和原子替换。失败会回滚,保存前的内容放在该目录下的 `.codex-editor-backup.json`。第三方插件的运行冲突仍需在新会话验证。
|
|
18
18
|
|
package/lib/index.js
CHANGED
|
@@ -1526,20 +1526,20 @@ function readPromptSections(content, shared = {}) {
|
|
|
1526
1526
|
const persona = sections.find((section) => section.label === "Persona");
|
|
1527
1527
|
const personaOverride = !overrides?.has("persona") && codex ? shared.persona : void 0;
|
|
1528
1528
|
if (persona && typeof personaOverride === "string" && personaOverride !== DEFAULT_CODEX_PERSONA) persona.text = personaOverride;
|
|
1529
|
-
const
|
|
1530
|
-
if (hasHostSections) sections.splice(persona ? 1 : 0, 0, {
|
|
1529
|
+
const hostSections = !fields.some((field) => field.label.startsWith("Persona") && field.row.get("complete") === true) && !suppressesHostSections(content) ? [...overrides?.get("harnessSourcePrompt") === "" ? [] : [{
|
|
1531
1530
|
id: "harness:source",
|
|
1532
1531
|
label: "DSH Core 源码说明",
|
|
1533
1532
|
text: String(overrides?.get("harnessSourcePrompt") ?? (codex ? shared.harnessSourcePrompt : void 0) ?? DEFAULT_DSH_CORE_SOURCE_PROMPT),
|
|
1534
1533
|
editable: true
|
|
1535
|
-
}, {
|
|
1534
|
+
}], ...overrides?.get("webSurfacePrompt") === "" ? [] : [{
|
|
1536
1535
|
id: "app:web-surface",
|
|
1537
1536
|
label: "DSH Core Web 说明",
|
|
1538
1537
|
text: String(overrides?.get("webSurfacePrompt") ?? (codex ? shared.webSurfacePrompt : void 0) ?? DEFAULT_DSH_CORE_WEB_PROMPT),
|
|
1539
1538
|
editable: true
|
|
1540
|
-
}
|
|
1539
|
+
}]] : [];
|
|
1540
|
+
if (hostSections.length) sections.splice(persona ? 1 : 0, 0, ...hostSections);
|
|
1541
1541
|
if (codex) {
|
|
1542
|
-
const index = persona ?
|
|
1542
|
+
const index = persona ? hostSections.length + 1 : hostSections.length;
|
|
1543
1543
|
sections.splice(index, 0, {
|
|
1544
1544
|
id: "codex:base",
|
|
1545
1545
|
label: "Codex 操作提示词",
|
|
@@ -1646,18 +1646,27 @@ function enhanceComposition(content) {
|
|
|
1646
1646
|
const doc = yaml(content);
|
|
1647
1647
|
if (!isSeq(doc.contents)) throw new Error("invalid-preset-yaml");
|
|
1648
1648
|
if (doc.contents.items.some((row) => isMap(row) && row.get("name") === "@shuind/dsh-codex-harness")) throw new Error("ambiguous-harness-row");
|
|
1649
|
+
let wasCompletePersona = false;
|
|
1649
1650
|
for (const row of doc.contents.items) {
|
|
1650
1651
|
if (!isMap(row) || row.get("name") !== "@deepseek-ai/dsh-persona") continue;
|
|
1651
1652
|
const persona = row.get("config", true);
|
|
1652
|
-
if (isMap(persona) && persona.get("complete") === true)
|
|
1653
|
+
if (isMap(persona) && persona.get("complete") === true) {
|
|
1654
|
+
wasCompletePersona = true;
|
|
1655
|
+
persona.set("complete", false);
|
|
1656
|
+
}
|
|
1653
1657
|
}
|
|
1658
|
+
const config = {
|
|
1659
|
+
globalEnhancements: false,
|
|
1660
|
+
codexCore: true
|
|
1661
|
+
};
|
|
1662
|
+
if (wasCompletePersona) config.presetSections = {
|
|
1663
|
+
harnessSourcePrompt: "",
|
|
1664
|
+
webSurfacePrompt: ""
|
|
1665
|
+
};
|
|
1654
1666
|
doc.add(doc.createNode({
|
|
1655
1667
|
id: `codex-harness-${randomUUID().slice(0, 8)}`,
|
|
1656
1668
|
name: "@shuind/dsh-codex-harness",
|
|
1657
|
-
config
|
|
1658
|
-
globalEnhancements: false,
|
|
1659
|
-
codexCore: true
|
|
1660
|
-
}
|
|
1669
|
+
config
|
|
1661
1670
|
}));
|
|
1662
1671
|
return doc.toString({ lineWidth: 0 });
|
|
1663
1672
|
}
|
|
@@ -148,11 +148,16 @@ export function readPromptSections(content, shared = {}) {
|
|
|
148
148
|
// These are host prompt sections, not Codex capability toggles. The Web
|
|
149
149
|
// host registers them for non-complete agents unless the composition
|
|
150
150
|
// explicitly shadows them (Story's clean-slate plugin does exactly that).
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
const hostSections = !complete && !suppressesHostSections(content)
|
|
152
|
+
? [
|
|
153
|
+
...(overrides?.get('harnessSourcePrompt') === '' ? [] : [{ id: 'harness:source', label: 'DSH Core 源码说明', text: String(overrides?.get('harnessSourcePrompt') ?? (codex ? shared.harnessSourcePrompt : undefined) ?? DEFAULT_DSH_CORE_SOURCE_PROMPT), editable: true }]),
|
|
154
|
+
...(overrides?.get('webSurfacePrompt') === '' ? [] : [{ id: 'app:web-surface', label: 'DSH Core Web 说明', text: String(overrides?.get('webSurfacePrompt') ?? (codex ? shared.webSurfacePrompt : undefined) ?? DEFAULT_DSH_CORE_WEB_PROMPT), editable: true }]),
|
|
155
|
+
]
|
|
156
|
+
: [];
|
|
157
|
+
if (hostSections.length)
|
|
158
|
+
sections.splice(persona ? 1 : 0, 0, ...hostSections);
|
|
154
159
|
if (codex) {
|
|
155
|
-
const index = persona ?
|
|
160
|
+
const index = persona ? hostSections.length + 1 : hostSections.length;
|
|
156
161
|
sections.splice(index, 0, { id: 'codex:base', label: 'Codex 操作提示词', text: explicitPrompt(content) ?? shared.systemPrompt ?? DEFAULT_CODEX_SYSTEM_PROMPT, editable: true });
|
|
157
162
|
}
|
|
158
163
|
return sections;
|
|
@@ -282,15 +287,21 @@ export function enhanceComposition(content) {
|
|
|
282
287
|
throw new Error('ambiguous-harness-row');
|
|
283
288
|
// A complete persona suppresses all contributed sections, including Codex's.
|
|
284
289
|
// Keep its identity text while allowing the enhanced copy to compose prompts.
|
|
290
|
+
let wasCompletePersona = false;
|
|
285
291
|
for (const row of doc.contents.items) {
|
|
286
292
|
if (!isMap(row) || row.get('name') !== '@deepseek-ai/dsh-persona')
|
|
287
293
|
continue;
|
|
288
294
|
const persona = row.get('config', true);
|
|
289
|
-
if (isMap(persona) && persona.get('complete') === true)
|
|
295
|
+
if (isMap(persona) && persona.get('complete') === true) {
|
|
296
|
+
wasCompletePersona = true;
|
|
290
297
|
persona.set('complete', false);
|
|
298
|
+
}
|
|
291
299
|
}
|
|
300
|
+
const config = { globalEnhancements: false, codexCore: true };
|
|
301
|
+
if (wasCompletePersona)
|
|
302
|
+
config.presetSections = { harnessSourcePrompt: '', webSurfacePrompt: '' };
|
|
292
303
|
doc.add(doc.createNode({ id: `codex-harness-${randomUUID().slice(0, 8)}`,
|
|
293
|
-
name: '@shuind/dsh-codex-harness', config
|
|
304
|
+
name: '@shuind/dsh-codex-harness', config }));
|
|
294
305
|
return doc.toString({ lineWidth: 0 });
|
|
295
306
|
}
|
|
296
307
|
export function readPresetSystemPrompt(content) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shuind/dsh-codex-harness",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.19",
|
|
4
4
|
"packageManager": "pnpm@9.15.9",
|
|
5
5
|
"description": "Codex coding preset with customizable prompts and tools for DSH.",
|
|
6
6
|
"type": "module",
|
|
@@ -81,6 +81,9 @@
|
|
|
81
81
|
},
|
|
82
82
|
"license": "MIT",
|
|
83
83
|
"dsh": {
|
|
84
|
+
"engines": {
|
|
85
|
+
"dsh": ">=0.1.5-rc.2"
|
|
86
|
+
},
|
|
84
87
|
"bundle": {
|
|
85
88
|
"patch": "./cordis.patch.yml"
|
|
86
89
|
},
|