@shuind/dsh-codex-harness 0.1.19 → 0.1.20
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 +3 -3
- package/lib/index.js +18 -13
- package/lib/types/index.d.ts +4 -1
- package/lib/types/index.js +16 -12
- package/package.json +2 -2
- package/presets/codex/agent.cordis.yml +1 -0
- package/presets/codex/preset.yml +3 -3
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @shuind/dsh-codex-harness
|
|
2
2
|
|
|
3
|
-
在 DSH 中提供 Codex preset
|
|
3
|
+
在 DSH 中提供 Codex preset:使用精简版 Codex 系统提示词与工具契约,支持图片输入、可选思考强度、Fast 优先级请求、OpenAI Responses 网页搜索与远程压缩,以及在 Web 设置上下文容量;旨在给来源于 Codex 的 token 提供适配 harness,并兼容 DSH 生态。
|
|
4
4
|
|
|
5
5
|
## 功能
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- **精简 Codex coding-agent 提示词**:使用精简版系统提示词;身份、模型和工作目录由 `dsh-persona` 提供,避免重复的 Harness 身份说明,同时保留必要的工具契约和编码工作流。
|
|
8
8
|
- **Codex 工具**:`exec_command`、`write_stdin`、`apply_patch`、`update_plan`。
|
|
9
9
|
- **GPT 能力补全**:为 GPT 系列模型补充图片输入和思考强度选项;不会覆盖用户已有的显式配置。
|
|
10
10
|
- **Fast**:仅在 Codex preset 的模型选择菜单中显示,开启后向 Responses 请求发送 `service_tier: "priority"`。
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
## 安装
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
|
-
dsh plugin --profile web add @shuind/dsh-codex-harness@0.1.
|
|
18
|
+
dsh plugin --profile web add @shuind/dsh-codex-harness@0.1.20
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
重启 Web,创建新会话,在模式菜单中选择 **Codex 模式**。
|
package/lib/index.js
CHANGED
|
@@ -949,9 +949,7 @@ function applyCodexRequestSettings(request, settings) {
|
|
|
949
949
|
...settings.fast ? { serviceTier: "priority" } : {}
|
|
950
950
|
};
|
|
951
951
|
}
|
|
952
|
-
const CODEX_BASE_PROMPT = String.raw
|
|
953
|
-
|
|
954
|
-
## General
|
|
952
|
+
const CODEX_BASE_PROMPT = String.raw`## General
|
|
955
953
|
|
|
956
954
|
- When searching for text or files, prefer using rg or rg --files respectively because rg is much faster than alternatives like grep. If rg is not available, use the next best alternative.
|
|
957
955
|
|
|
@@ -959,7 +957,6 @@ const CODEX_BASE_PROMPT = String.raw`You are Codex, based on {{model}}. You are
|
|
|
959
957
|
|
|
960
958
|
- Default to ASCII when editing or creating files. Only introduce non-ASCII or other Unicode characters when there is a clear justification and the file already uses them.
|
|
961
959
|
- Add succinct code comments that explain non-obvious code. Do not add comments that merely narrate assignments or control flow.
|
|
962
|
-
- Use apply_patch for single-file edits when practical. The apply_patch tool accepts its freeform patch language; do not wrap that patch in JSON.
|
|
963
960
|
- You may be in a dirty git worktree. Never revert existing changes you did not make unless the user explicitly requests it. If unrelated files are changed, leave them alone.
|
|
964
961
|
|
|
965
962
|
## Planning
|
|
@@ -970,16 +967,10 @@ const CODEX_BASE_PROMPT = String.raw`You are Codex, based on {{model}}. You are
|
|
|
970
967
|
## dsh session
|
|
971
968
|
|
|
972
969
|
- The user and you share one workspace. Inspect the repository and every applicable AGENTS.md before editing.
|
|
973
|
-
- This session's preset was selected when the session was created and stays fixed for its lifetime. Do not attempt to switch the preset or replace its tool catalog while the session is running.
|
|
974
|
-
- dsh provides the execution, filesystem, session, policy, and Skills capabilities behind these tools. Use those extension points as supplied; do not invent a second harness or bypass the filesystem service for file edits.
|
|
975
|
-
- The core Codex tool names, arguments, and result formats are fixed: use exec_command for terminal work, write_stdin for an existing interactive command, apply_patch for file changes, and update_plan for multi-step tasks.
|
|
976
970
|
|
|
977
971
|
## Task execution
|
|
978
972
|
|
|
979
973
|
- Keep the user informed with concise progress updates and lead with the result.
|
|
980
|
-
- Prefer existing functions and extension points over new machinery.
|
|
981
|
-
- Do not claim that a command, edit, or test succeeded unless it actually succeeded.
|
|
982
|
-
- Use the exact tool names and argument formats supplied by this session; do not invent replacement editing tools.
|
|
983
974
|
|
|
984
975
|
## Presenting your work
|
|
985
976
|
|
|
@@ -996,13 +987,26 @@ const CODEX_COLLABORATION_PROMPT = String.raw`## Collaboration
|
|
|
996
987
|
- Solve problems by thinking from first principles and at a higher level.
|
|
997
988
|
- Make things as effortless as possible for the user.
|
|
998
989
|
`;
|
|
999
|
-
/**
|
|
990
|
+
/** Put the agent persona first and omit the generic Harness identity opener. */
|
|
991
|
+
function normalizeCodexPromptAssembly(assembly) {
|
|
992
|
+
const sections = assembly.sections.filter((section) => section.name !== "harness:identity");
|
|
993
|
+
const persona = sections.find((section) => section.name === "deployment:persona");
|
|
994
|
+
if (persona === void 0) return {
|
|
995
|
+
...assembly,
|
|
996
|
+
sections
|
|
997
|
+
};
|
|
998
|
+
return {
|
|
999
|
+
...assembly,
|
|
1000
|
+
sections: [persona, ...sections.filter((section) => section.name !== "deployment:persona")]
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
/** Build the Codex operating prompt with optional, user-enabled collaboration guidance. */
|
|
1000
1004
|
function buildCodexSystemPrompt(config = {}) {
|
|
1001
1005
|
return config.collaborationPrompt === true ? `${CODEX_BASE_PROMPT}\n\n${CODEX_COLLABORATION_PROMPT}` : CODEX_BASE_PROMPT;
|
|
1002
1006
|
}
|
|
1003
1007
|
const EXEC_COMMAND_DESCRIPTION = "Runs a command in a PTY, returning output or a session ID for ongoing interaction.";
|
|
1004
1008
|
const WRITE_STDIN_DESCRIPTION = "Writes characters to an existing unified exec session and returns recent output.";
|
|
1005
|
-
const APPLY_PATCH_DESCRIPTION = "
|
|
1009
|
+
const APPLY_PATCH_DESCRIPTION = "Edits files using a patch.";
|
|
1006
1010
|
const UPDATE_PLAN_DESCRIPTION = "Updates the task plan.\nProvide an optional explanation and a list of plan items, each with a step and status.\nAt most one step can be in_progress at a time.";
|
|
1007
1011
|
const PLAN_STATUSES = [
|
|
1008
1012
|
"pending",
|
|
@@ -1388,6 +1392,7 @@ function apply(ctx, config = {}) {
|
|
|
1388
1392
|
if ((resolved.hostedWebSearch || resolved.remoteCompact) && options.purpose === void 0 && isGptModel(options.model)) return hostedWebSearchStream(next);
|
|
1389
1393
|
return next();
|
|
1390
1394
|
}));
|
|
1395
|
+
ctx.on("system-prompt/assemble", async (_assembly, _context, next) => normalizeCodexPromptAssembly(await next()));
|
|
1391
1396
|
ctx.systemPrompt.section({
|
|
1392
1397
|
name: "codex:base",
|
|
1393
1398
|
order: 10,
|
|
@@ -1404,4 +1409,4 @@ var types_default = {
|
|
|
1404
1409
|
apply
|
|
1405
1410
|
};
|
|
1406
1411
|
//#endregion
|
|
1407
|
-
export { CODEX_SETTINGS_NAMESPACE, CODEX_SETTINGS_SCHEMA, Config, apply, applyCodexRequestSettings, buildCodexSystemPrompt, types_default as default, enrichCodexModel, inject, name };
|
|
1412
|
+
export { CODEX_SETTINGS_NAMESPACE, CODEX_SETTINGS_SCHEMA, Config, apply, applyCodexRequestSettings, buildCodexSystemPrompt, types_default as default, enrichCodexModel, inject, name, normalizeCodexPromptAssembly };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { Context } from '@deepseek-ai/cordis';
|
|
3
3
|
import z from '@deepseek-ai/schemastery';
|
|
4
4
|
import type { LlmCallConfig } from '@deepseek-ai/dsh-llm';
|
|
5
|
+
import type { PromptAssembly } from '@deepseek-ai/dsh-system-prompt';
|
|
5
6
|
declare module '@deepseek-ai/dsh-llm' {
|
|
6
7
|
interface LlmCallConfig {
|
|
7
8
|
/** Codex request context capacity override, in tokens. */
|
|
@@ -50,7 +51,9 @@ export interface CodexModelProfile {
|
|
|
50
51
|
export declare function enrichCodexModel(model: CodexModelProfile): CodexModelProfile;
|
|
51
52
|
/** Apply the live Codex controls to one agent request without leaking them to other routes. */
|
|
52
53
|
export declare function applyCodexRequestSettings(request: LlmCallConfig, settings: CodexSettings): LlmCallConfig;
|
|
53
|
-
/**
|
|
54
|
+
/** Put the agent persona first and omit the generic Harness identity opener. */
|
|
55
|
+
export declare function normalizeCodexPromptAssembly(assembly: PromptAssembly): PromptAssembly;
|
|
56
|
+
/** Build the Codex operating prompt with optional, user-enabled collaboration guidance. */
|
|
54
57
|
export declare function buildCodexSystemPrompt(config?: Pick<Config, 'collaborationPrompt'>): string;
|
|
55
58
|
/** Mount the Codex prompt/tool layer inside one fixed agent preset. */
|
|
56
59
|
export declare function apply(ctx: Context, config?: Config): void;
|
package/lib/types/index.js
CHANGED
|
@@ -138,9 +138,8 @@ export function applyCodexRequestSettings(request, settings) {
|
|
|
138
138
|
...settings.fast ? { serviceTier: 'priority' } : {},
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
## General
|
|
141
|
+
// The shipped persona owns the single Codex identity line, model, and working directory.
|
|
142
|
+
const CODEX_BASE_PROMPT = String.raw `## General
|
|
144
143
|
|
|
145
144
|
- When searching for text or files, prefer using rg or rg --files respectively because rg is much faster than alternatives like grep. If rg is not available, use the next best alternative.
|
|
146
145
|
|
|
@@ -148,7 +147,6 @@ const CODEX_BASE_PROMPT = String.raw `You are Codex, based on {{model}}. You are
|
|
|
148
147
|
|
|
149
148
|
- Default to ASCII when editing or creating files. Only introduce non-ASCII or other Unicode characters when there is a clear justification and the file already uses them.
|
|
150
149
|
- Add succinct code comments that explain non-obvious code. Do not add comments that merely narrate assignments or control flow.
|
|
151
|
-
- Use apply_patch for single-file edits when practical. The apply_patch tool accepts its freeform patch language; do not wrap that patch in JSON.
|
|
152
150
|
- You may be in a dirty git worktree. Never revert existing changes you did not make unless the user explicitly requests it. If unrelated files are changed, leave them alone.
|
|
153
151
|
|
|
154
152
|
## Planning
|
|
@@ -159,16 +157,10 @@ const CODEX_BASE_PROMPT = String.raw `You are Codex, based on {{model}}. You are
|
|
|
159
157
|
## dsh session
|
|
160
158
|
|
|
161
159
|
- The user and you share one workspace. Inspect the repository and every applicable AGENTS.md before editing.
|
|
162
|
-
- This session's preset was selected when the session was created and stays fixed for its lifetime. Do not attempt to switch the preset or replace its tool catalog while the session is running.
|
|
163
|
-
- dsh provides the execution, filesystem, session, policy, and Skills capabilities behind these tools. Use those extension points as supplied; do not invent a second harness or bypass the filesystem service for file edits.
|
|
164
|
-
- The core Codex tool names, arguments, and result formats are fixed: use exec_command for terminal work, write_stdin for an existing interactive command, apply_patch for file changes, and update_plan for multi-step tasks.
|
|
165
160
|
|
|
166
161
|
## Task execution
|
|
167
162
|
|
|
168
163
|
- Keep the user informed with concise progress updates and lead with the result.
|
|
169
|
-
- Prefer existing functions and extension points over new machinery.
|
|
170
|
-
- Do not claim that a command, edit, or test succeeded unless it actually succeeded.
|
|
171
|
-
- Use the exact tool names and argument formats supplied by this session; do not invent replacement editing tools.
|
|
172
164
|
|
|
173
165
|
## Presenting your work
|
|
174
166
|
|
|
@@ -185,7 +177,18 @@ const CODEX_COLLABORATION_PROMPT = String.raw `## Collaboration
|
|
|
185
177
|
- Solve problems by thinking from first principles and at a higher level.
|
|
186
178
|
- Make things as effortless as possible for the user.
|
|
187
179
|
`;
|
|
188
|
-
/**
|
|
180
|
+
/** Put the agent persona first and omit the generic Harness identity opener. */
|
|
181
|
+
export function normalizeCodexPromptAssembly(assembly) {
|
|
182
|
+
const sections = assembly.sections.filter(section => section.name !== 'harness:identity');
|
|
183
|
+
const persona = sections.find(section => section.name === 'deployment:persona');
|
|
184
|
+
if (persona === undefined)
|
|
185
|
+
return { ...assembly, sections };
|
|
186
|
+
return {
|
|
187
|
+
...assembly,
|
|
188
|
+
sections: [persona, ...sections.filter(section => section.name !== 'deployment:persona')],
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/** Build the Codex operating prompt with optional, user-enabled collaboration guidance. */
|
|
189
192
|
export function buildCodexSystemPrompt(config = {}) {
|
|
190
193
|
return config.collaborationPrompt === true
|
|
191
194
|
? `${CODEX_BASE_PROMPT}\n\n${CODEX_COLLABORATION_PROMPT}`
|
|
@@ -193,7 +196,7 @@ export function buildCodexSystemPrompt(config = {}) {
|
|
|
193
196
|
}
|
|
194
197
|
const EXEC_COMMAND_DESCRIPTION = 'Runs a command in a PTY, returning output or a session ID for ongoing interaction.';
|
|
195
198
|
const WRITE_STDIN_DESCRIPTION = 'Writes characters to an existing unified exec session and returns recent output.';
|
|
196
|
-
const APPLY_PATCH_DESCRIPTION = '
|
|
199
|
+
const APPLY_PATCH_DESCRIPTION = 'Edits files using a patch.';
|
|
197
200
|
const UPDATE_PLAN_DESCRIPTION = 'Updates the task plan.\nProvide an optional explanation and a list of plan items, each with a step and status.\nAt most one step can be in_progress at a time.';
|
|
198
201
|
const PLAN_STATUSES = ['pending', 'in_progress', 'completed'];
|
|
199
202
|
function sessionCwd(exec) {
|
|
@@ -485,6 +488,7 @@ export function apply(ctx, config = {}) {
|
|
|
485
488
|
return next();
|
|
486
489
|
}));
|
|
487
490
|
}
|
|
491
|
+
ctx.on('system-prompt/assemble', async (_assembly, _context, next) => normalizeCodexPromptAssembly(await next()));
|
|
488
492
|
ctx.systemPrompt.section({ name: 'codex:base', order: 10, text: buildCodexSystemPrompt(resolved) });
|
|
489
493
|
registerExecTools(ctx, resolved);
|
|
490
494
|
registerPatchTool(ctx);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shuind/dsh-codex-harness",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "A
|
|
3
|
+
"version": "0.1.20",
|
|
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",
|
|
7
7
|
"types": "lib/types/index.d.ts",
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
- id: persona
|
|
5
5
|
name: '@deepseek-ai/dsh-persona'
|
|
6
6
|
config:
|
|
7
|
+
# Keep identity, model, cwd, and runtime context in one persona section.
|
|
7
8
|
text: >-
|
|
8
9
|
You are Codex, a coding agent based on the {{model}} model. Your working directory is {{cwd}}.
|
|
9
10
|
includeRuntimeContext: true
|
package/presets/codex/preset.yml
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
name: Codex 模式
|
|
2
|
-
description:
|
|
3
|
-
order: 5
|
|
1
|
+
name: Codex 模式
|
|
2
|
+
description: 使用精简版 Codex 提示词、exec_command、write_stdin、apply_patch 和 update_plan,并保留 dsh 的 Skills 与可插拔运行时。
|
|
3
|
+
order: 5
|