@shuind/dsh-codex-harness 0.1.13 → 0.1.15
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 +22 -1
- package/lib/index.js +19 -4
- package/lib/types/index.d.ts +4 -0
- package/lib/types/index.js +18 -1
- package/package.json +1 -1
- package/presets/codex/agent.cordis.yml +2 -0
package/README.md
CHANGED
|
@@ -11,10 +11,31 @@
|
|
|
11
11
|
- **远程搜索与压缩**:OpenAI Responses 请求默认优先使用 hosted `web_search` 和 `/responses/compact`;失败时回退到 DSH 的本地实现。
|
|
12
12
|
- **上下文容量**:在 Web 中设置 `1K`–`1000K` tokens,设置值作用于下一次请求。
|
|
13
13
|
|
|
14
|
+
## 可选协作提示词(私货)
|
|
15
|
+
|
|
16
|
+
这段提示词默认关闭,不会注入系统提示词。需要时,在自定义 `agent.cordis.yml` 中开启:
|
|
17
|
+
|
|
18
|
+
```yaml
|
|
19
|
+
- id: codex-tools
|
|
20
|
+
name: '@shuind/dsh-codex-harness'
|
|
21
|
+
config:
|
|
22
|
+
collaborationPrompt: true
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
开启后,Codex preset 会在系统提示词中注入以下协作要求:
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
Ask, align, and clarify whenever uncertainty, assumptions, tradeoffs, or decisions could materially affect the outcome.
|
|
29
|
+
Understand the user's full picture, align it with your own, and leave no hidden assumptions or gaps.
|
|
30
|
+
Keep only the essential logic and core actions. There's no need to explain or test what was removed or why something wasn't done.
|
|
31
|
+
Convey enough valuable information with as few words as possible. Stay focused on the end goal.
|
|
32
|
+
Solve problems by thinking from first principles and at a higher level.
|
|
33
|
+
Make things as effortless as possible for the user.
|
|
34
|
+
```
|
|
14
35
|
## 安装
|
|
15
36
|
|
|
16
37
|
```sh
|
|
17
|
-
dsh plugin --profile web add @shuind/dsh-codex-harness@0.1.
|
|
38
|
+
dsh plugin --profile web add @shuind/dsh-codex-harness@0.1.15
|
|
18
39
|
```
|
|
19
40
|
|
|
20
41
|
重启 Web,创建新会话,在模式菜单中选择 **Codex 模式**。
|
package/lib/index.js
CHANGED
|
@@ -726,7 +726,8 @@ const Config = z.object({
|
|
|
726
726
|
writeYieldTimeMs: z.number().step(1).min(0).default(250),
|
|
727
727
|
maxOutputBytes: z.number().step(1).min(1).default(64e3),
|
|
728
728
|
hostedWebSearch: z.boolean().default(true),
|
|
729
|
-
remoteCompact: z.boolean().default(true)
|
|
729
|
+
remoteCompact: z.boolean().default(true),
|
|
730
|
+
collaborationPrompt: z.boolean().default(false)
|
|
730
731
|
});
|
|
731
732
|
const LLM_PI_AI_SETTINGS = settingsNamespace("llm-pi-ai");
|
|
732
733
|
/** Live Codex-only request controls shared by the Web controls and agent layer. */
|
|
@@ -879,6 +880,19 @@ const CODEX_BASE_PROMPT = String.raw`You are Codex, based on {{model}}. You are
|
|
|
879
880
|
- Do not dump large files into the conversation; refer to their paths.
|
|
880
881
|
- Use plain text with short sections only when they improve scanability.
|
|
881
882
|
`;
|
|
883
|
+
const CODEX_COLLABORATION_PROMPT = String.raw`## Collaboration
|
|
884
|
+
|
|
885
|
+
- Ask, align, and clarify whenever uncertainty, assumptions, tradeoffs, or decisions could materially affect the outcome.
|
|
886
|
+
- Understand the user's full picture, align it with your own, and leave no hidden assumptions or gaps.
|
|
887
|
+
- Keep only the essential logic and core actions. There's no need to explain or test what was removed or why something wasn't done.
|
|
888
|
+
- Convey enough valuable information with as few words as possible. Stay focused on the end goal.
|
|
889
|
+
- Solve problems by thinking from first principles and at a higher level.
|
|
890
|
+
- Make things as effortless as possible for the user.
|
|
891
|
+
`;
|
|
892
|
+
/** Build the Codex system prompt with optional, user-enabled collaboration guidance. */
|
|
893
|
+
function buildCodexSystemPrompt(config = {}) {
|
|
894
|
+
return config.collaborationPrompt === true ? `${CODEX_BASE_PROMPT}\n\n${CODEX_COLLABORATION_PROMPT}` : CODEX_BASE_PROMPT;
|
|
895
|
+
}
|
|
882
896
|
const EXEC_COMMAND_DESCRIPTION = "Runs a command in a PTY, returning output or a session ID for ongoing interaction.";
|
|
883
897
|
const WRITE_STDIN_DESCRIPTION = "Writes characters to an existing unified exec session and returns recent output.";
|
|
884
898
|
const APPLY_PATCH_DESCRIPTION = "The `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.";
|
|
@@ -1248,7 +1262,8 @@ function apply(ctx, config = {}) {
|
|
|
1248
1262
|
writeYieldTimeMs: config.writeYieldTimeMs ?? 250,
|
|
1249
1263
|
maxOutputBytes: config.maxOutputBytes ?? 64e3,
|
|
1250
1264
|
hostedWebSearch: config.hostedWebSearch ?? true,
|
|
1251
|
-
remoteCompact: config.remoteCompact ?? true
|
|
1265
|
+
remoteCompact: config.remoteCompact ?? true,
|
|
1266
|
+
collaborationPrompt: config.collaborationPrompt ?? false
|
|
1252
1267
|
};
|
|
1253
1268
|
if (ctx.fs.sandboxMode !== void 0 && ctx.get("sandboxPolicy") === void 0) throw new Error("codex: a sandboxing filesystem requires ctx.sandboxPolicy");
|
|
1254
1269
|
watchConfiguredGptModels(ctx);
|
|
@@ -1268,7 +1283,7 @@ function apply(ctx, config = {}) {
|
|
|
1268
1283
|
ctx.systemPrompt.section({
|
|
1269
1284
|
name: "codex:base",
|
|
1270
1285
|
order: 10,
|
|
1271
|
-
text:
|
|
1286
|
+
text: buildCodexSystemPrompt(resolved)
|
|
1272
1287
|
});
|
|
1273
1288
|
registerExecTools(ctx, resolved);
|
|
1274
1289
|
registerPatchTool(ctx);
|
|
@@ -1281,4 +1296,4 @@ var types_default = {
|
|
|
1281
1296
|
apply
|
|
1282
1297
|
};
|
|
1283
1298
|
//#endregion
|
|
1284
|
-
export { CODEX_SETTINGS_NAMESPACE, CODEX_SETTINGS_SCHEMA, Config, apply, applyCodexRequestSettings, types_default as default, enrichCodexModel, inject, name };
|
|
1299
|
+
export { CODEX_SETTINGS_NAMESPACE, CODEX_SETTINGS_SCHEMA, Config, apply, applyCodexRequestSettings, buildCodexSystemPrompt, types_default as default, enrichCodexModel, inject, name };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export interface Config {
|
|
|
26
26
|
hostedWebSearch?: boolean;
|
|
27
27
|
/** Use the provider's /responses/compact endpoint before local compaction. */
|
|
28
28
|
remoteCompact?: boolean;
|
|
29
|
+
/** Inject the optional collaboration guidance into the model system prompt. */
|
|
30
|
+
collaborationPrompt?: boolean;
|
|
29
31
|
}
|
|
30
32
|
/** Runtime configuration schema for the Codex tool bridge. */
|
|
31
33
|
export declare const Config: z<Config>;
|
|
@@ -48,6 +50,8 @@ export interface CodexModelProfile {
|
|
|
48
50
|
export declare function enrichCodexModel(model: CodexModelProfile): CodexModelProfile;
|
|
49
51
|
/** Apply the live Codex controls to one agent request without leaking them to other routes. */
|
|
50
52
|
export declare function applyCodexRequestSettings(request: LlmCallConfig, settings: CodexSettings): LlmCallConfig;
|
|
53
|
+
/** Build the Codex system prompt with optional, user-enabled collaboration guidance. */
|
|
54
|
+
export declare function buildCodexSystemPrompt(config?: Pick<Config, 'collaborationPrompt'>): string;
|
|
51
55
|
/** Mount the Codex prompt/tool layer inside one fixed agent preset. */
|
|
52
56
|
export declare function apply(ctx: Context, config?: Config): void;
|
|
53
57
|
declare const _default: {
|
package/lib/types/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export const Config = z.object({
|
|
|
16
16
|
maxOutputBytes: z.number().step(1).min(1).default(64_000),
|
|
17
17
|
hostedWebSearch: z.boolean().default(true),
|
|
18
18
|
remoteCompact: z.boolean().default(true),
|
|
19
|
+
collaborationPrompt: z.boolean().default(false),
|
|
19
20
|
});
|
|
20
21
|
const LLM_PI_AI_SETTINGS = settingsNamespace('llm-pi-ai');
|
|
21
22
|
/** Live Codex-only request controls shared by the Web controls and agent layer. */
|
|
@@ -175,6 +176,21 @@ const CODEX_BASE_PROMPT = String.raw `You are Codex, based on {{model}}. You are
|
|
|
175
176
|
- Do not dump large files into the conversation; refer to their paths.
|
|
176
177
|
- Use plain text with short sections only when they improve scanability.
|
|
177
178
|
`;
|
|
179
|
+
const CODEX_COLLABORATION_PROMPT = String.raw `## Collaboration
|
|
180
|
+
|
|
181
|
+
- Ask, align, and clarify whenever uncertainty, assumptions, tradeoffs, or decisions could materially affect the outcome.
|
|
182
|
+
- Understand the user's full picture, align it with your own, and leave no hidden assumptions or gaps.
|
|
183
|
+
- Keep only the essential logic and core actions. There's no need to explain or test what was removed or why something wasn't done.
|
|
184
|
+
- Convey enough valuable information with as few words as possible. Stay focused on the end goal.
|
|
185
|
+
- Solve problems by thinking from first principles and at a higher level.
|
|
186
|
+
- Make things as effortless as possible for the user.
|
|
187
|
+
`;
|
|
188
|
+
/** Build the Codex system prompt with optional, user-enabled collaboration guidance. */
|
|
189
|
+
export function buildCodexSystemPrompt(config = {}) {
|
|
190
|
+
return config.collaborationPrompt === true
|
|
191
|
+
? `${CODEX_BASE_PROMPT}\n\n${CODEX_COLLABORATION_PROMPT}`
|
|
192
|
+
: CODEX_BASE_PROMPT;
|
|
193
|
+
}
|
|
178
194
|
const EXEC_COMMAND_DESCRIPTION = 'Runs a command in a PTY, returning output or a session ID for ongoing interaction.';
|
|
179
195
|
const WRITE_STDIN_DESCRIPTION = 'Writes characters to an existing unified exec session and returns recent output.';
|
|
180
196
|
const APPLY_PATCH_DESCRIPTION = 'The `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.';
|
|
@@ -434,6 +450,7 @@ export function apply(ctx, config = {}) {
|
|
|
434
450
|
maxOutputBytes: config.maxOutputBytes ?? 64_000,
|
|
435
451
|
hostedWebSearch: config.hostedWebSearch ?? true,
|
|
436
452
|
remoteCompact: config.remoteCompact ?? true,
|
|
453
|
+
collaborationPrompt: config.collaborationPrompt ?? false,
|
|
437
454
|
};
|
|
438
455
|
if (ctx.fs.sandboxMode !== undefined && ctx.get('sandboxPolicy') === undefined) {
|
|
439
456
|
throw new Error('codex: a sandboxing filesystem requires ctx.sandboxPolicy');
|
|
@@ -467,7 +484,7 @@ export function apply(ctx, config = {}) {
|
|
|
467
484
|
return next();
|
|
468
485
|
}));
|
|
469
486
|
}
|
|
470
|
-
ctx.systemPrompt.section({ name: 'codex:base', order: 10, text:
|
|
487
|
+
ctx.systemPrompt.section({ name: 'codex:base', order: 10, text: buildCodexSystemPrompt(resolved) });
|
|
471
488
|
registerExecTools(ctx, resolved);
|
|
472
489
|
registerPatchTool(ctx);
|
|
473
490
|
registerPlanTool(ctx);
|
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.15",
|
|
4
4
|
"description": "A minimal Codex harness 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",
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
# and the four Codex core tool names; execution remains delegated to dsh.
|
|
18
18
|
- id: codex-tools
|
|
19
19
|
name: '@shuind/dsh-codex-harness'
|
|
20
|
+
config:
|
|
21
|
+
collaborationPrompt: false
|
|
20
22
|
|
|
21
23
|
# The generic DSH pi-ai adapter still owns the user's configured provider,
|
|
22
24
|
# endpoint, API key, and model. Codex's remote-first transport wrapper is
|