@shuind/dsh-codex-harness 0.2.32-dsh-v0.2.2-rc.1 → 0.3.0
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/CHANGELOG.md +64 -0
- package/README.md +37 -59
- package/RELEASE.md +1 -1
- package/cordis.patch.yml +42 -11
- package/docs/preset-library.md +6 -12
- package/docs/tool-policy-benchmark.json +89 -89
- package/docs/tool-policy.md +11 -7
- package/lib/client.js +3780 -2950
- package/lib/compact-command.js +416 -0
- package/lib/compaction.js +129 -15
- package/lib/hybrid-executor.js +1196 -0
- package/lib/index.js +3554 -2841
- package/lib/preferences.js +17 -11
- package/lib/tool-policy.js +1930 -1743
- package/lib/typert.js +49 -89
- package/lib/types/client/activity.js +4 -3
- package/lib/types/client/desktop.d.ts +26 -2
- package/lib/types/client/desktop.js +143 -35
- package/lib/types/client/index.d.ts +136 -129
- package/lib/types/client/index.js +92 -466
- package/lib/types/client/policy-drafts.d.ts +1 -1
- package/lib/types/client/policy-locale.d.ts +260 -0
- package/lib/types/client/policy-locale.js +357 -0
- package/lib/types/client/preset-manager.d.ts +33 -15
- package/lib/types/client/preset-manager.js +220 -215
- package/lib/types/client/preset-requests.d.ts +2 -2
- package/lib/types/client/tool-policy.d.ts +6 -93
- package/lib/types/client/tool-policy.js +85 -143
- package/lib/types/contracts/preset-editor-schema.d.ts +78 -0
- package/lib/types/contracts/preset-editor-schema.js +95 -0
- package/lib/types/{prompt.js → contracts/prompt.js} +9 -5
- package/lib/types/{settings.d.ts → contracts/settings.d.ts} +8 -1
- package/lib/types/{settings.js → contracts/settings.js} +19 -3
- package/lib/types/{tool-policy-contract.d.ts → contracts/tool-policy-contract.d.ts} +9 -6
- package/lib/types/{tool-policy-contract.js → contracts/tool-policy-contract.js} +9 -2
- package/lib/types/contracts/ui-contracts.d.ts +92 -0
- package/lib/types/contracts/ui-contracts.js +83 -0
- package/lib/types/{client/entry.d.ts → entries/client.d.ts} +2 -2
- package/lib/types/{client/entry.js → entries/client.js} +2 -4
- package/lib/types/{compact-command.d.ts → entries/compact-command.d.ts} +2 -0
- package/lib/types/entries/compact-command.js +176 -0
- package/lib/types/{compaction.d.ts → entries/compaction.d.ts} +12 -0
- package/lib/types/{compaction.js → entries/compaction.js} +43 -11
- package/lib/types/entries/hybrid-executor.d.ts +19 -0
- package/lib/types/entries/hybrid-executor.js +57 -0
- package/lib/types/entries/index.d.ts +66 -0
- package/lib/types/entries/index.js +192 -0
- package/lib/types/{preferences.d.ts → entries/preferences.d.ts} +1 -1
- package/lib/types/{preferences.js → entries/preferences.js} +1 -1
- package/lib/types/entries/tool-policy.d.ts +97 -0
- package/lib/types/entries/tool-policy.js +158 -0
- package/lib/types/entries/typert.host.d.ts +23 -0
- package/lib/types/entries/typert.host.js +24 -0
- package/lib/types/hybrid/codex-hybrid-executor.d.ts +44 -0
- package/lib/types/hybrid/codex-hybrid-executor.js +257 -0
- package/lib/types/hybrid/hybrid-sdk.d.ts +13 -0
- package/lib/types/hybrid/hybrid-sdk.js +196 -0
- package/lib/types/hybrid/program-calls.d.ts +28 -0
- package/lib/types/hybrid/program-calls.js +193 -0
- package/lib/types/hybrid/subcall-scheduler.d.ts +90 -0
- package/lib/types/hybrid/subcall-scheduler.js +343 -0
- package/lib/types/policy/deferred-tools.d.ts +42 -0
- package/lib/types/policy/deferred-tools.js +264 -0
- package/lib/types/policy/overlay-installer.d.ts +12 -0
- package/lib/types/policy/overlay-installer.js +179 -0
- package/lib/types/policy/rule-resolver.d.ts +94 -0
- package/lib/types/policy/rule-resolver.js +114 -0
- package/lib/types/{tool-capabilities.d.ts → policy/tool-capabilities.d.ts} +3 -2
- package/lib/types/{tool-capabilities.js → policy/tool-capabilities.js} +6 -2
- package/lib/types/{activity.d.ts → presets/activity.d.ts} +2 -4
- package/lib/types/{activity.js → presets/activity.js} +2 -14
- package/lib/types/{desktop-preset.d.ts → presets/desktop-preset.d.ts} +3 -1
- package/lib/types/{desktop-preset.js → presets/desktop-preset.js} +6 -2
- package/lib/types/presets/preset-editor.d.ts +47 -0
- package/lib/types/presets/preset-editor.js +81 -0
- package/lib/types/{preset-prompt-catalog.d.ts → presets/preset-prompt-catalog.d.ts} +3 -1
- package/lib/types/{preset-prompt-catalog.js → presets/preset-prompt-catalog.js} +27 -4
- package/lib/types/{preset-tool-catalog.d.ts → presets/preset-tool-catalog.d.ts} +1 -1
- package/lib/types/{preset-tool-catalog.js → presets/preset-tool-catalog.js} +11 -4
- package/lib/types/presets/runtime-enhancements.d.ts +45 -0
- package/lib/types/presets/runtime-enhancements.js +349 -0
- package/lib/types/presets/small-window-compaction.d.ts +15 -0
- package/lib/types/presets/small-window-compaction.js +121 -0
- package/lib/types/responses/compact-checkpoint.d.ts +27 -0
- package/lib/types/responses/compact-checkpoint.js +257 -0
- package/lib/types/responses/fetch-transport.d.ts +16 -0
- package/lib/types/responses/fetch-transport.js +257 -0
- package/lib/types/responses/remote-compact.d.ts +13 -0
- package/lib/types/responses/remote-compact.js +319 -0
- package/lib/types/responses/sse-diagnostics.d.ts +9 -0
- package/lib/types/responses/sse-diagnostics.js +157 -0
- package/lib/types/responses/wire-rewrite.d.ts +35 -0
- package/lib/types/responses/wire-rewrite.js +237 -0
- package/lib/types/tools/exec-output.d.ts +58 -0
- package/lib/types/tools/exec-output.js +173 -0
- package/lib/types/tools/exec-plan-tools.d.ts +37 -0
- package/lib/types/tools/exec-plan-tools.js +265 -0
- package/lib/types/tools/exec-runner.d.ts +21 -0
- package/lib/types/tools/exec-runner.js +385 -0
- package/lib/types/tools/patch-tool.d.ts +16 -0
- package/lib/types/tools/patch-tool.js +258 -0
- package/lib/types/{patch.d.ts → tools/patch.d.ts} +1 -1
- package/lib/types/{patch.js → tools/patch.js} +96 -21
- package/locale/hybrid-executor/en.json +6 -0
- package/locale/hybrid-executor/zh.json +6 -0
- package/package.json +211 -289
- package/presets/{codex-collaboration → codex-hybrid}/agent.cordis.yml +45 -48
- package/presets/codex-hybrid/preset.yml +3 -0
- package/scripts/benchmark-tool-policy.mjs +3 -3
- package/scripts/build-preset.mjs +5 -5
- package/src/client/activity.ts +4 -3
- package/src/client/desktop.tsx +165 -51
- package/src/client/index.tsx +128 -709
- package/src/client/policy-drafts.ts +1 -1
- package/src/client/policy-locale.ts +362 -0
- package/src/client/preset-manager.tsx +331 -236
- package/src/client/preset-requests.ts +2 -2
- package/src/client/tool-policy.tsx +225 -203
- package/src/contracts/preset-editor-schema.ts +110 -0
- package/src/{prompt.ts → contracts/prompt.ts} +9 -5
- package/src/{settings.ts → contracts/settings.ts} +27 -3
- package/src/{tool-policy-contract.ts → contracts/tool-policy-contract.ts} +24 -7
- package/src/contracts/ui-contracts.ts +173 -0
- package/src/{client/entry.tsx → entries/client.tsx} +2 -4
- package/src/entries/compact-command.ts +256 -0
- package/src/{compaction.ts → entries/compaction.ts} +47 -19
- package/src/entries/hybrid-executor.ts +76 -0
- package/src/entries/index.ts +298 -0
- package/src/{preferences.ts → entries/preferences.ts} +1 -1
- package/src/entries/tool-policy.ts +162 -0
- package/src/entries/typert.host.ts +29 -0
- package/src/hybrid/codex-hybrid-executor.ts +310 -0
- package/src/hybrid/hybrid-sdk.ts +217 -0
- package/src/hybrid/program-calls.ts +202 -0
- package/src/hybrid/subcall-scheduler.ts +446 -0
- package/src/policy/deferred-tools.ts +331 -0
- package/src/policy/overlay-installer.ts +191 -0
- package/src/policy/rule-resolver.ts +128 -0
- package/src/{tool-capabilities.ts → policy/tool-capabilities.ts} +16 -4
- package/src/{activity.ts → presets/activity.ts} +4 -16
- package/src/{desktop-preset.ts → presets/desktop-preset.ts} +7 -2
- package/src/presets/preset-editor.ts +101 -0
- package/src/{preset-prompt-catalog.ts → presets/preset-prompt-catalog.ts} +35 -5
- package/src/{preset-tool-catalog.ts → presets/preset-tool-catalog.ts} +12 -5
- package/src/presets/runtime-enhancements.ts +415 -0
- package/src/presets/small-window-compaction.ts +166 -0
- package/src/responses/compact-checkpoint.ts +264 -0
- package/src/responses/fetch-transport.ts +290 -0
- package/src/responses/remote-compact.ts +393 -0
- package/src/responses/sse-diagnostics.ts +156 -0
- package/src/responses/wire-rewrite.ts +261 -0
- package/src/tools/exec-output.ts +211 -0
- package/src/tools/exec-plan-tools.ts +307 -0
- package/src/tools/exec-runner.ts +445 -0
- package/src/tools/patch-tool.ts +331 -0
- package/src/{patch.ts → tools/patch.ts} +90 -20
- package/tsdown.config.ts +8 -8
- package/lib/installer.js +0 -281
- package/lib/invariant.js +0 -23
- package/lib/types/activity-types.d.ts +0 -6
- package/lib/types/activity-types.js +0 -3
- package/lib/types/client/preset-copy.d.ts +0 -43
- package/lib/types/client/preset-copy.js +0 -83
- package/lib/types/client/session.d.ts +0 -6
- package/lib/types/client/session.js +0 -9
- package/lib/types/compact-command.js +0 -79
- package/lib/types/context.d.ts +0 -8
- package/lib/types/context.js +0 -14
- package/lib/types/exec.d.ts +0 -50
- package/lib/types/exec.js +0 -491
- package/lib/types/host-settings.d.ts +0 -4
- package/lib/types/host-settings.js +0 -13
- package/lib/types/index.d.ts +0 -113
- package/lib/types/index.js +0 -851
- package/lib/types/installer.d.ts +0 -27
- package/lib/types/installer.js +0 -155
- package/lib/types/invariant.d.ts +0 -16
- package/lib/types/invariant.js +0 -22
- package/lib/types/preset-contract.d.ts +0 -69
- package/lib/types/preset-contract.js +0 -22
- package/lib/types/preset-editor-remote.d.ts +0 -32
- package/lib/types/preset-editor-remote.js +0 -41
- package/lib/types/preset-editor.d.ts +0 -74
- package/lib/types/preset-editor.js +0 -587
- package/lib/types/preset-prompt-catalog-schema.d.ts +0 -16
- package/lib/types/preset-prompt-catalog-schema.js +0 -11
- package/lib/types/preset-prompt-contract.d.ts +0 -22
- package/lib/types/preset-prompt-contract.js +0 -3
- package/lib/types/preset-tool-catalog-schema.d.ts +0 -38
- package/lib/types/preset-tool-catalog-schema.js +0 -28
- package/lib/types/prompt-sections.d.ts +0 -15
- package/lib/types/prompt-sections.js +0 -29
- package/lib/types/remote.d.ts +0 -40
- package/lib/types/remote.js +0 -698
- package/lib/types/tool-policy.d.ts +0 -171
- package/lib/types/tool-policy.js +0 -367
- package/lib/types/typert.host.d.ts +0 -47
- package/lib/types/typert.host.js +0 -109
- package/presets/codex-collaboration/preset.yml +0 -3
- package/src/activity-types.ts +0 -7
- package/src/client/preset-copy.ts +0 -83
- package/src/client/session.ts +0 -11
- package/src/compact-command.ts +0 -112
- package/src/context.ts +0 -15
- package/src/exec.ts +0 -570
- package/src/host-settings.ts +0 -17
- package/src/index.ts +0 -1097
- package/src/installer.ts +0 -172
- package/src/invariant.ts +0 -34
- package/src/preset-contract.ts +0 -85
- package/src/preset-editor-remote.ts +0 -41
- package/src/preset-editor.ts +0 -502
- package/src/preset-prompt-catalog-schema.ts +0 -10
- package/src/preset-prompt-contract.ts +0 -21
- package/src/preset-tool-catalog-schema.ts +0 -28
- package/src/prompt-sections.ts +0 -33
- package/src/remote.ts +0 -748
- package/src/tool-policy.ts +0 -388
- package/src/typert.host.ts +0 -119
- /package/lib/types/{prompt.d.ts → contracts/prompt.d.ts} +0 -0
package/lib/preferences.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Service } from "@deepseek-ai/cordis";
|
|
2
2
|
import z from "@deepseek-ai/schemastery";
|
|
3
|
-
//#region lib/types/
|
|
3
|
+
//#region lib/types/contracts/ui-contracts.js
|
|
4
4
|
const CODEX_CONTEXT_MAX = 1e6;
|
|
5
5
|
//#endregion
|
|
6
|
-
//#region lib/types/prompt.js
|
|
6
|
+
//#region lib/types/contracts/prompt.js
|
|
7
7
|
/** Default plugin-owned Codex operating prompt. */
|
|
8
8
|
const DEFAULT_CODEX_SYSTEM_PROMPT = String.raw`## General
|
|
9
9
|
|
|
@@ -12,8 +12,9 @@ const DEFAULT_CODEX_SYSTEM_PROMPT = String.raw`## General
|
|
|
12
12
|
## Editing constraints
|
|
13
13
|
|
|
14
14
|
- 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.
|
|
15
|
+
- Prefer apply_patch (or dedicated file tools when present) over shell heredocs or redirection for file edits; do not re-read a file immediately after apply_patch succeeds unless checking external changes.
|
|
15
16
|
- Add succinct code comments that explain non-obvious code. Do not add comments that merely narrate assignments or control flow.
|
|
16
|
-
- 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.
|
|
17
|
+
- You may be in a dirty git worktree. Never revert existing changes you did not make unless the user explicitly requests it, never amend commits unless asked, and avoid interactive git commands such as git rebase -i or git add -p. If unrelated files are changed, leave them alone.
|
|
17
18
|
|
|
18
19
|
## Planning
|
|
19
20
|
|
|
@@ -28,23 +29,26 @@ const DEFAULT_CODEX_SYSTEM_PROMPT = String.raw`## General
|
|
|
28
29
|
|
|
29
30
|
## Task execution
|
|
30
31
|
|
|
31
|
-
-
|
|
32
|
+
- Parallelize independent read, search, and check calls. Do not sleep-poll background jobs or subagents; they wake on completion.
|
|
33
|
+
- When delegating parallel edits, assign disjoint write scopes. Record key paths and facts as you go since older large tool outputs may be pruned.
|
|
34
|
+
- Never claim unrun checks passed, and keep the user informed with concise progress updates.
|
|
32
35
|
|
|
33
36
|
## Presenting your work
|
|
34
37
|
|
|
35
|
-
- Be concise, direct, friendly, and actionable.
|
|
38
|
+
- Be concise, direct, friendly, and actionable, and lead with the result.
|
|
36
39
|
- For substantial work, explain what changed and why, then briefly note how the work was verified and what comes next.
|
|
40
|
+
- For code reviews, lead with concrete findings ordered by severity with file and line references before any brief summary, or state explicitly if no issues were found.
|
|
37
41
|
- Do not dump large files into the conversation; refer to their paths.
|
|
38
42
|
- Use plain text with short sections only when they improve scanability.
|
|
39
43
|
|
|
40
44
|
## Working principles
|
|
41
45
|
|
|
42
|
-
- Actively establish the user's current context rather than relying on stale assumptions
|
|
46
|
+
- Actively establish the user's current context from the repository rather than relying on stale assumptions. Execute tasks directly through implementation and verification using the clearest, most effective path; ask the user only when a user-owned choice or external/destructive action cannot be resolved by inspection.
|
|
43
47
|
- 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.
|
|
44
48
|
- Solve problems by thinking from first principles and at a higher level.
|
|
45
49
|
`;
|
|
46
50
|
/** Default deployment Persona template used by the Codex preset. */
|
|
47
|
-
const DEFAULT_CODEX_PERSONA = String.raw`You are Codex, a coding agent based on the {{model}} model
|
|
51
|
+
const DEFAULT_CODEX_PERSONA = String.raw`You are Codex, a coding agent based on the {{model}} model.`;
|
|
48
52
|
/** Default DSH Core source-checkout guidance template. */
|
|
49
53
|
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. If the supplied path is inside app.asar, treat it as a packaged runtime rather than a source checkout. Discover the installed packageDir via Inspect and read its README and package.json exports; do not assume src or individual lib/types filenames exist. Use Host file-read tools for app.asar; native shell search and glob cannot traverse it.`;
|
|
50
54
|
/** Default DSH Web runtime guidance template. */
|
|
@@ -59,12 +63,13 @@ const DEFAULT_DSH_CORE_WEB_PROMPT = [
|
|
|
59
63
|
"Do not start a replacement server unless the user asks; if one is needed, use a managed background job and verify its exact URL."
|
|
60
64
|
].join(" ");
|
|
61
65
|
//#endregion
|
|
62
|
-
//#region lib/types/settings.js
|
|
63
|
-
/** Shared host-side Codex settings contract. */
|
|
66
|
+
//#region lib/types/contracts/settings.js
|
|
67
|
+
/** Shared host-side Codex settings contract, Host reader, and GPT route matcher. */
|
|
64
68
|
/** Default settings exposed even before a Codex session is opened. */
|
|
65
69
|
const CODEX_SETTINGS_ENTRY = {
|
|
66
70
|
fast: false,
|
|
67
71
|
fastModeControlEnabled: true,
|
|
72
|
+
contextWindowControlEnabled: true,
|
|
68
73
|
persona: DEFAULT_CODEX_PERSONA,
|
|
69
74
|
harnessSourcePrompt: DEFAULT_DSH_CORE_SOURCE_PROMPT,
|
|
70
75
|
webSurfacePrompt: DEFAULT_DSH_CORE_WEB_PROMPT,
|
|
@@ -78,12 +83,13 @@ const CODEX_SETTINGS_ENTRY = {
|
|
|
78
83
|
activityIndicatorEnabled: true
|
|
79
84
|
};
|
|
80
85
|
//#endregion
|
|
81
|
-
//#region lib/types/preferences.js
|
|
86
|
+
//#region lib/types/entries/preferences.js
|
|
82
87
|
/** Profile-backed live preferences on DSH 0.2; legacy hosts keep settings.yaml. */
|
|
83
88
|
const Config = z.object({
|
|
84
89
|
fast: z.boolean().default(false),
|
|
85
90
|
fastModeControlEnabled: z.boolean().default(true),
|
|
86
|
-
|
|
91
|
+
contextWindowControlEnabled: z.boolean().default(true),
|
|
92
|
+
contextWindow: z.number().step(1).min(1).max(CODEX_CONTEXT_MAX).hidden(),
|
|
87
93
|
persona: z.string().default(DEFAULT_CODEX_PERSONA),
|
|
88
94
|
harnessSourcePrompt: z.string().default(DEFAULT_DSH_CORE_SOURCE_PROMPT),
|
|
89
95
|
webSurfacePrompt: z.string().default(DEFAULT_DSH_CORE_WEB_PROMPT),
|