@shuind/dsh-codex-harness 0.2.21 → 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 +185 -0
- package/README.md +38 -50
- package/RELEASE.md +61 -0
- package/assets/codex.svg +5 -0
- package/cordis.patch.yml +181 -6
- package/docs/preset-library.md +33 -23
- package/docs/tool-policy-benchmark.json +310 -0
- package/docs/tool-policy.md +148 -0
- package/lib/client.js +4774 -2416
- package/lib/compact-command.js +416 -0
- package/lib/compaction.js +141 -12
- package/lib/hybrid-executor.js +1196 -0
- package/lib/index.js +3658 -2334
- package/lib/preferences.js +117 -0
- package/lib/tool-policy.js +2422 -0
- package/lib/typert.js +86 -79
- package/lib/types/client/activity.d.ts +33 -9
- package/lib/types/client/activity.js +4 -3
- package/lib/types/client/desktop.d.ts +67 -0
- package/lib/types/client/desktop.js +229 -0
- package/lib/types/client/index.d.ts +207 -110
- package/lib/types/client/index.js +99 -492
- package/lib/types/client/policy-drafts.d.ts +25 -0
- package/lib/types/client/policy-drafts.js +47 -0
- 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 +38 -10
- package/lib/types/client/preset-manager.js +235 -185
- package/lib/types/client/preset-requests.d.ts +12 -0
- package/lib/types/client/preset-requests.js +101 -0
- package/lib/types/client/tool-policy.d.ts +33 -0
- package/lib/types/client/tool-policy.js +336 -0
- 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} +13 -7
- package/lib/types/{settings.d.ts → contracts/settings.d.ts} +11 -4
- package/lib/types/{settings.js → contracts/settings.js} +22 -6
- package/lib/types/contracts/tool-policy-contract.d.ts +63 -0
- package/lib/types/contracts/tool-policy-contract.js +33 -0
- package/lib/types/contracts/ui-contracts.d.ts +92 -0
- package/lib/types/contracts/ui-contracts.js +83 -0
- package/lib/types/entries/client.d.ts +10 -0
- package/lib/types/entries/client.js +10 -0
- 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} +15 -3
- package/lib/types/{compaction.js → entries/compaction.js} +47 -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/entries/preferences.d.ts +11 -0
- package/lib/types/entries/preferences.js +16 -0
- 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/policy/tool-capabilities.d.ts +33 -0
- package/lib/types/policy/tool-capabilities.js +46 -0
- package/lib/types/{activity.d.ts → presets/activity.d.ts} +3 -5
- package/lib/types/{activity.js → presets/activity.js} +51 -27
- package/lib/types/presets/desktop-preset.d.ts +22 -0
- package/lib/types/presets/desktop-preset.js +43 -0
- package/lib/types/presets/preset-editor.d.ts +47 -0
- package/lib/types/presets/preset-editor.js +81 -0
- package/lib/types/presets/preset-prompt-catalog.d.ts +23 -0
- package/lib/types/presets/preset-prompt-catalog.js +215 -0
- package/lib/types/presets/preset-tool-catalog.d.ts +5 -0
- package/lib/types/presets/preset-tool-catalog.js +58 -0
- 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/en.json +6 -0
- package/locale/hybrid-executor/en.json +6 -0
- package/locale/hybrid-executor/zh.json +6 -0
- package/locale/tool-policy/en.json +6 -0
- package/locale/tool-policy/zh.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +297 -299
- 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 +186 -0
- package/scripts/build-preset.mjs +19 -0
- package/scripts/clean-build.mjs +11 -0
- package/src/client/activity.ts +83 -0
- package/src/client/desktop.tsx +276 -0
- package/src/client/index.tsx +391 -0
- package/src/client/policy-drafts.ts +56 -0
- package/src/client/policy-locale.ts +362 -0
- package/src/client/preset-manager.tsx +376 -0
- package/src/client/preset-requests.ts +113 -0
- package/src/client/tool-policy.tsx +402 -0
- package/src/contracts/preset-editor-schema.ts +110 -0
- package/src/contracts/prompt.ts +66 -0
- package/src/contracts/settings.ts +103 -0
- package/src/contracts/tool-policy-contract.ts +93 -0
- package/src/contracts/ui-contracts.ts +173 -0
- package/src/entries/client.tsx +14 -0
- package/src/entries/compact-command.ts +256 -0
- package/src/entries/compaction.ts +218 -0
- package/src/entries/hybrid-executor.ts +76 -0
- package/src/entries/index.ts +298 -0
- package/src/entries/preferences.ts +17 -0
- 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/policy/tool-capabilities.ts +88 -0
- package/src/presets/activity.ts +146 -0
- package/src/presets/desktop-preset.ts +60 -0
- package/src/presets/preset-editor.ts +101 -0
- package/src/presets/preset-prompt-catalog.ts +221 -0
- package/src/presets/preset-tool-catalog.ts +58 -0
- 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/tools/patch.ts +328 -0
- package/tsconfig.json +29 -0
- package/tsdown.config.ts +110 -0
- package/lib/installer.js +0 -237
- 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 -42
- package/lib/types/client/preset-copy.js +0 -81
- 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 -46
- package/lib/types/exec.js +0 -365
- package/lib/types/index.d.ts +0 -95
- package/lib/types/index.js +0 -738
- package/lib/types/installer.d.ts +0 -27
- package/lib/types/installer.js +0 -146
- 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 -30
- package/lib/types/preset-editor-remote.js +0 -37
- package/lib/types/preset-editor.d.ts +0 -69
- package/lib/types/preset-editor.js +0 -557
- package/lib/types/preset-templates.d.ts +0 -36
- package/lib/types/preset-templates.js +0 -12
- package/lib/types/prompt-sections.d.ts +0 -15
- package/lib/types/prompt-sections.js +0 -23
- package/lib/types/remote.d.ts +0 -40
- package/lib/types/remote.js +0 -683
- package/lib/types/typert.host.d.ts +0 -47
- package/lib/types/typert.host.js +0 -99
- package/presets/codex-collaboration/preset.yml +0 -3
- /package/lib/types/{prompt.d.ts → contracts/prompt.d.ts} +0 -0
package/lib/types/installer.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/** Install the user-visible Codex agent preset supplied by this bundle. */
|
|
2
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
-
/** Bundle plugin name for the preset installer. */
|
|
4
|
-
export declare const name = "codex-preset-installer";
|
|
5
|
-
export declare const inject: string[];
|
|
6
|
-
/**
|
|
7
|
-
* Install or upgrade the single shipped Codex preset.
|
|
8
|
-
*
|
|
9
|
-
* The directory is committed with a staging rename so a failed copy cannot
|
|
10
|
-
* leave a half-written preset that hides the mode from the roster. A known
|
|
11
|
-
* shipped copy upgrades in place; any changed or unknown copy is preserved.
|
|
12
|
-
*
|
|
13
|
-
* @param targetDir - destination preset directory.
|
|
14
|
-
* @param sourceDir - directory containing the packaged preset files.
|
|
15
|
-
*/
|
|
16
|
-
export declare function installCodexPreset(targetDir?: string, sourceDir?: string): void;
|
|
17
|
-
/** Remove an unmodified copy of the retired second Codex mode. */
|
|
18
|
-
export declare function retireLegacyCodexPreset(targetDir?: string, managedSignatures?: ReadonlySet<string>): void;
|
|
19
|
-
/** Install the preset during profile boot without changing the host tool catalog. */
|
|
20
|
-
export declare function apply(ctx: Context): void;
|
|
21
|
-
declare const _default: {
|
|
22
|
-
name: string;
|
|
23
|
-
inject: string[];
|
|
24
|
-
apply: typeof apply;
|
|
25
|
-
};
|
|
26
|
-
export default _default;
|
|
27
|
-
//# sourceMappingURL=installer.d.ts.map
|
package/lib/types/installer.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/** Install the user-visible Codex agent preset supplied by this bundle. */
|
|
2
|
-
import { createHash, randomUUID } from 'node:crypto';
|
|
3
|
-
import { copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, writeFileSync, } from 'node:fs';
|
|
4
|
-
import { homedir } from 'node:os';
|
|
5
|
-
import { dirname, join, resolve } from 'node:path';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { CODEX_SETTINGS_ENTRY, CODEX_SETTINGS_NAMESPACE, CODEX_SETTINGS_SCHEMA, } from "./settings.js";
|
|
8
|
-
const PRESET_FILES = ['agent.cordis.yml', 'preset.yml'];
|
|
9
|
-
const MANAGED_SIGNATURE_FILE = '.dsh-codex-harness-managed';
|
|
10
|
-
const BUNDLED_PRESET_ID = 'codex-collaboration';
|
|
11
|
-
const LEGACY_PRESET_ID = 'codex';
|
|
12
|
-
const SOURCE_PRESET_DIR = fileURLToPath(new URL('../presets/codex-collaboration/', import.meta.url));
|
|
13
|
-
// Exact signatures of every previously shipped preset. Unknown directories
|
|
14
|
-
// remain user-owned; known copies can be migrated without erasing edits.
|
|
15
|
-
const LEGACY_PRESET_SIGNATURES = new Set([
|
|
16
|
-
'2f6222b6c9fed417d0f8fbfef9b221f0c9088c63347466219309c1c2ca2426bb',
|
|
17
|
-
'40ae944220ca57daae93d1483d6cb6264e6847ed77ee84f38171c34c36f0598e',
|
|
18
|
-
'c6a594797f7044c44c09254635b8381f20533cd26a4661239529dc44ec423d0c',
|
|
19
|
-
'2c373798b9cadbda5fb377dab0d43ac5637263546a5a4fc1740752658fdec658',
|
|
20
|
-
'a4062b59ad0e512e1b1b7e80ae56d8cde4efdaa5ba958364a17653ba1ff3c2ed',
|
|
21
|
-
'16016e7f68ee61354de232151be5b6ad0cda1785183ca0c72f9d0946b6a1d6cd',
|
|
22
|
-
'7f72b1bea9b30074788f05d20b841a797a5b29bb945dd1fb0597c8d03eb2b9b9',
|
|
23
|
-
'6a6c8dc2e7a7dbc1ac30ce608a53c238f19066a786f951f9a295ada86e56ed9e',
|
|
24
|
-
]);
|
|
25
|
-
const BUNDLED_PRESET_SIGNATURES = new Set([
|
|
26
|
-
'2a7ef181266e69275d25091adc74dd619af7c7d3577573887aaaecd2663e13c8',
|
|
27
|
-
'd1de30f5c13049621b1c1ae3fb22d35b031797a4762638265822b0ff62749854',
|
|
28
|
-
'b50e1d616f9b4188a33c0da0fe355478b7b75b615f3792c094e2b67995622cf4',
|
|
29
|
-
'6132523d92893f6ae9214b30105e9cc1ba64854df6ca8a84213069eb6c38d286',
|
|
30
|
-
'7957bc5e9b0f2fa0b74d2d8bae0d4ee153a2ba7bb430f5a848e700386cc7ce3f',
|
|
31
|
-
]);
|
|
32
|
-
function dshHomePath(...segments) {
|
|
33
|
-
const configured = process.env.DSH_HOME?.trim();
|
|
34
|
-
const expanded = configured === undefined || configured.length === 0
|
|
35
|
-
? join(homedir(), '.dsh')
|
|
36
|
-
: configured === '~'
|
|
37
|
-
? homedir()
|
|
38
|
-
: configured.startsWith('~/') || configured.startsWith('~\\')
|
|
39
|
-
? join(homedir(), configured.slice(2))
|
|
40
|
-
: configured;
|
|
41
|
-
return join(resolve(expanded), ...segments);
|
|
42
|
-
}
|
|
43
|
-
/** Bundle plugin name for the preset installer. */
|
|
44
|
-
export const name = 'codex-preset-installer';
|
|
45
|
-
export const inject = ['settings'];
|
|
46
|
-
function presetSignature(directory) {
|
|
47
|
-
if (PRESET_FILES.some(file => !existsSync(join(directory, file))))
|
|
48
|
-
return undefined;
|
|
49
|
-
const hash = createHash('sha256');
|
|
50
|
-
hash.update(readFileSync(join(directory, PRESET_FILES[0])));
|
|
51
|
-
hash.update(Buffer.from([0]));
|
|
52
|
-
hash.update(readFileSync(join(directory, PRESET_FILES[1])));
|
|
53
|
-
return hash.digest('hex');
|
|
54
|
-
}
|
|
55
|
-
function stagePreset(targetDir, sourceDir, presetId) {
|
|
56
|
-
const parentDir = dirname(targetDir);
|
|
57
|
-
mkdirSync(parentDir, { recursive: true });
|
|
58
|
-
const stagingDir = mkdtempSync(join(parentDir, `.${presetId}-`));
|
|
59
|
-
try {
|
|
60
|
-
for (const file of PRESET_FILES)
|
|
61
|
-
copyFileSync(join(sourceDir, file), join(stagingDir, file));
|
|
62
|
-
const signature = presetSignature(stagingDir);
|
|
63
|
-
if (signature === undefined)
|
|
64
|
-
throw new Error(`incomplete bundled preset: ${sourceDir}`);
|
|
65
|
-
writeFileSync(join(stagingDir, MANAGED_SIGNATURE_FILE), `${signature}\n`);
|
|
66
|
-
return stagingDir;
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
rmSync(stagingDir, { recursive: true, force: true });
|
|
70
|
-
throw error;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function installPreset(targetDir, sourceDir, presetId) {
|
|
74
|
-
const stagingDir = stagePreset(targetDir, sourceDir, presetId);
|
|
75
|
-
try {
|
|
76
|
-
renameSync(stagingDir, targetDir);
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
if (!existsSync(targetDir))
|
|
80
|
-
throw error;
|
|
81
|
-
rmSync(stagingDir, { recursive: true, force: true });
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
function replacePreset(targetDir, sourceDir, presetId) {
|
|
85
|
-
const stagingDir = stagePreset(targetDir, sourceDir, presetId);
|
|
86
|
-
const backupDir = join(dirname(targetDir), `.${presetId}-backup-${randomUUID()}`);
|
|
87
|
-
renameSync(targetDir, backupDir);
|
|
88
|
-
try {
|
|
89
|
-
renameSync(stagingDir, targetDir);
|
|
90
|
-
rmSync(backupDir, { recursive: true, force: true });
|
|
91
|
-
}
|
|
92
|
-
catch (error) {
|
|
93
|
-
if (existsSync(stagingDir))
|
|
94
|
-
rmSync(stagingDir, { recursive: true, force: true });
|
|
95
|
-
if (!existsSync(targetDir))
|
|
96
|
-
renameSync(backupDir, targetDir);
|
|
97
|
-
throw error;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function hasMatchingManagedMarker(targetDir, signature) {
|
|
101
|
-
const marker = join(targetDir, MANAGED_SIGNATURE_FILE);
|
|
102
|
-
return existsSync(marker) && readFileSync(marker, 'utf8').trim() === signature;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Install or upgrade the single shipped Codex preset.
|
|
106
|
-
*
|
|
107
|
-
* The directory is committed with a staging rename so a failed copy cannot
|
|
108
|
-
* leave a half-written preset that hides the mode from the roster. A known
|
|
109
|
-
* shipped copy upgrades in place; any changed or unknown copy is preserved.
|
|
110
|
-
*
|
|
111
|
-
* @param targetDir - destination preset directory.
|
|
112
|
-
* @param sourceDir - directory containing the packaged preset files.
|
|
113
|
-
*/
|
|
114
|
-
export function installCodexPreset(targetDir = dshHomePath('.agent-presets', BUNDLED_PRESET_ID), sourceDir = SOURCE_PRESET_DIR) {
|
|
115
|
-
if (!existsSync(targetDir)) {
|
|
116
|
-
installPreset(targetDir, sourceDir, BUNDLED_PRESET_ID);
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
const signature = presetSignature(targetDir);
|
|
120
|
-
if (signature !== undefined
|
|
121
|
-
&& (BUNDLED_PRESET_SIGNATURES.has(signature) || hasMatchingManagedMarker(targetDir, signature))) {
|
|
122
|
-
replacePreset(targetDir, sourceDir, BUNDLED_PRESET_ID);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
/** Remove an unmodified copy of the retired second Codex mode. */
|
|
126
|
-
export function retireLegacyCodexPreset(targetDir = dshHomePath('.agent-presets', LEGACY_PRESET_ID), managedSignatures = LEGACY_PRESET_SIGNATURES) {
|
|
127
|
-
if (!existsSync(targetDir))
|
|
128
|
-
return;
|
|
129
|
-
const signature = presetSignature(targetDir);
|
|
130
|
-
if (signature !== undefined && managedSignatures.has(signature)) {
|
|
131
|
-
rmSync(targetDir, { recursive: true, force: true });
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
/** Install the preset during profile boot without changing the host tool catalog. */
|
|
135
|
-
export function apply(ctx) {
|
|
136
|
-
try {
|
|
137
|
-
ctx.settings.register(CODEX_SETTINGS_NAMESPACE, CODEX_SETTINGS_SCHEMA, { base: CODEX_SETTINGS_ENTRY });
|
|
138
|
-
installCodexPreset();
|
|
139
|
-
retireLegacyCodexPreset();
|
|
140
|
-
}
|
|
141
|
-
catch (error) {
|
|
142
|
-
ctx.logger.warn(`dsh-codex: could not reconcile the Codex preset: ${String(error)}`);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
export default { name, inject, apply };
|
|
146
|
-
//# sourceMappingURL=installer.js.map
|
package/lib/types/invariant.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Package-owned invariant companion for `@shuind/dsh-codex-harness`.
|
|
3
|
-
* @module @shuind/dsh-codex-harness/invariant
|
|
4
|
-
*/
|
|
5
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
6
|
-
/** Codex companion plugin name. */
|
|
7
|
-
export declare const name = "codex-invariant";
|
|
8
|
-
/** Service required before the companion can reserve package ownership. */
|
|
9
|
-
export declare const inject: string[];
|
|
10
|
-
/**
|
|
11
|
-
* Register this package's invariant companion.
|
|
12
|
-
* @param ctx - Cordis context carrying the invariant service.
|
|
13
|
-
* @returns the installed registration's disposer after setup succeeds.
|
|
14
|
-
*/
|
|
15
|
-
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
16
|
-
//# sourceMappingURL=invariant.d.ts.map
|
package/lib/types/invariant.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Package-owned invariant companion for `@shuind/dsh-codex-harness`.
|
|
3
|
-
* @module @shuind/dsh-codex-harness/invariant
|
|
4
|
-
*/
|
|
5
|
-
const PACKAGE_NAME = '@shuind/dsh-codex-harness';
|
|
6
|
-
/** Codex companion plugin name. */
|
|
7
|
-
export const name = 'codex-invariant';
|
|
8
|
-
/** Service required before the companion can reserve package ownership. */
|
|
9
|
-
export const inject = ['invariants'];
|
|
10
|
-
/**
|
|
11
|
-
* Codex has no independent lifecycle stream: its model-visible state is owned
|
|
12
|
-
* by the tool registry and session projection services it consumes.
|
|
13
|
-
*/
|
|
14
|
-
const install = () => { };
|
|
15
|
-
/**
|
|
16
|
-
* Register this package's invariant companion.
|
|
17
|
-
* @param ctx - Cordis context carrying the invariant service.
|
|
18
|
-
* @returns the installed registration's disposer after setup succeeds.
|
|
19
|
-
*/
|
|
20
|
-
export const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
21
|
-
/* jscpd:ignore-end */
|
|
22
|
-
//# sourceMappingURL=invariant.js.map
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/** Client-safe, versioned preset authoring contract. No filesystem or runtime imports. */
|
|
2
|
-
export interface PresetFields {
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
systemPrompt: string;
|
|
6
|
-
inheritPrompt: boolean;
|
|
7
|
-
}
|
|
8
|
-
export interface PresetPromptSection {
|
|
9
|
-
id: string;
|
|
10
|
-
label: string;
|
|
11
|
-
text: string;
|
|
12
|
-
editable: boolean;
|
|
13
|
-
/** Excluded by a complete Persona; shown for inspection, never saved as an active section. */
|
|
14
|
-
suppressed?: boolean;
|
|
15
|
-
}
|
|
16
|
-
/** Codex capabilities stored with a preset. Activity status stays global. */
|
|
17
|
-
export interface CodexPresetOptions {
|
|
18
|
-
promptEnabled: boolean;
|
|
19
|
-
terminalToolsEnabled: boolean;
|
|
20
|
-
patchToolEnabled: boolean;
|
|
21
|
-
planToolEnabled: boolean;
|
|
22
|
-
hostedWebSearchEnabled: boolean;
|
|
23
|
-
remoteCompactionEnabled: boolean;
|
|
24
|
-
}
|
|
25
|
-
export interface PresetEditorDocument extends PresetFields {
|
|
26
|
-
id: string;
|
|
27
|
-
revision: string;
|
|
28
|
-
editable: boolean;
|
|
29
|
-
codex: boolean;
|
|
30
|
-
codexOptions: CodexPresetOptions;
|
|
31
|
-
composition: string;
|
|
32
|
-
promptSections: PresetPromptSection[];
|
|
33
|
-
}
|
|
34
|
-
export interface PresetEditorInput extends PresetFields {
|
|
35
|
-
id: string;
|
|
36
|
-
revision?: string;
|
|
37
|
-
composition?: string;
|
|
38
|
-
enableCodex?: boolean;
|
|
39
|
-
promptSections?: PresetPromptSection[];
|
|
40
|
-
codexOptions?: Partial<CodexPresetOptions>;
|
|
41
|
-
}
|
|
42
|
-
export interface PresetCreateInput extends PresetFields {
|
|
43
|
-
sourceId: string;
|
|
44
|
-
enableCodex?: boolean;
|
|
45
|
-
promptSections?: PresetPromptSection[];
|
|
46
|
-
composition?: string;
|
|
47
|
-
codexOptions?: Partial<CodexPresetOptions>;
|
|
48
|
-
}
|
|
49
|
-
export interface PresetCatalogRow {
|
|
50
|
-
id: string;
|
|
51
|
-
name: string;
|
|
52
|
-
description: string;
|
|
53
|
-
editable: boolean;
|
|
54
|
-
isDefault: boolean;
|
|
55
|
-
codex?: boolean;
|
|
56
|
-
}
|
|
57
|
-
export interface PresetCatalog {
|
|
58
|
-
presets: PresetCatalogRow[];
|
|
59
|
-
authorable: boolean;
|
|
60
|
-
excludedCount: number;
|
|
61
|
-
}
|
|
62
|
-
/** A portable instruction card, deliberately not executable YAML or a tool bundle. */
|
|
63
|
-
export interface PromptCard extends PresetFields {
|
|
64
|
-
format: 'codex-harness/prompt-card';
|
|
65
|
-
version: 1;
|
|
66
|
-
}
|
|
67
|
-
export declare function parsePromptCard(text: string): PromptCard;
|
|
68
|
-
export declare function exportPromptCard(fields: PresetFields): string;
|
|
69
|
-
//# sourceMappingURL=preset-contract.d.ts.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export function parsePromptCard(text) {
|
|
2
|
-
if (text.length > 1_100_000)
|
|
3
|
-
throw new Error('invalid-prompt-card');
|
|
4
|
-
const value = JSON.parse(text);
|
|
5
|
-
if (!value || typeof value !== 'object')
|
|
6
|
-
throw new Error('invalid-prompt-card');
|
|
7
|
-
const card = value;
|
|
8
|
-
if (card.format !== 'codex-harness/prompt-card' || card.version !== 1
|
|
9
|
-
|| typeof card.name !== 'string' || !card.name.trim() || card.name.length > 200
|
|
10
|
-
|| typeof card.description !== 'string' || card.description.length > 4000
|
|
11
|
-
|| typeof card.systemPrompt !== 'string' || card.systemPrompt.length > 1_000_000
|
|
12
|
-
|| typeof card.inheritPrompt !== 'boolean')
|
|
13
|
-
throw new Error('invalid-prompt-card');
|
|
14
|
-
return { format: card.format, version: 1, name: card.name, description: card.description,
|
|
15
|
-
systemPrompt: card.systemPrompt, inheritPrompt: card.inheritPrompt };
|
|
16
|
-
}
|
|
17
|
-
export function exportPromptCard(fields) {
|
|
18
|
-
return JSON.stringify({ format: 'codex-harness/prompt-card', version: 1,
|
|
19
|
-
name: fields.name, description: fields.description, systemPrompt: fields.systemPrompt,
|
|
20
|
-
inheritPrompt: fields.inheritPrompt }, null, 2);
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=preset-contract.js.map
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
declare const _default: {
|
|
3
|
-
package: string;
|
|
4
|
-
descriptors: {
|
|
5
|
-
id: string;
|
|
6
|
-
service: string;
|
|
7
|
-
namespace: string;
|
|
8
|
-
method: string;
|
|
9
|
-
invocation: {
|
|
10
|
-
kind: "direct";
|
|
11
|
-
};
|
|
12
|
-
parameters: {
|
|
13
|
-
name: string;
|
|
14
|
-
wire: string;
|
|
15
|
-
source: "json";
|
|
16
|
-
codec: {
|
|
17
|
-
mode: "strict";
|
|
18
|
-
typeSymbol: string;
|
|
19
|
-
schema: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
20
|
-
};
|
|
21
|
-
}[];
|
|
22
|
-
result: {
|
|
23
|
-
mode: "strict";
|
|
24
|
-
typeSymbol: string;
|
|
25
|
-
schema: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
26
|
-
};
|
|
27
|
-
}[];
|
|
28
|
-
};
|
|
29
|
-
export default _default;
|
|
30
|
-
//# sourceMappingURL=preset-editor-remote.d.ts.map
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
const promptSections = z.array(z.object({ id: z.string(), label: z.string(), text: z.string().max(1_000_000), editable: z.boolean(), suppressed: z.boolean().optional() })).max(200);
|
|
3
|
-
const fields = {
|
|
4
|
-
name: z.string().max(200), description: z.string().max(4000),
|
|
5
|
-
systemPrompt: z.string().max(1_000_000), inheritPrompt: z.boolean(),
|
|
6
|
-
};
|
|
7
|
-
const codexOptions = z.object({
|
|
8
|
-
promptEnabled: z.boolean(), terminalToolsEnabled: z.boolean(), patchToolEnabled: z.boolean(),
|
|
9
|
-
planToolEnabled: z.boolean(), hostedWebSearchEnabled: z.boolean(), remoteCompactionEnabled: z.boolean(),
|
|
10
|
-
});
|
|
11
|
-
const codexOptionsPatch = codexOptions.partial();
|
|
12
|
-
const document = z.object({ ...fields, id: z.string(), revision: z.string(), editable: z.boolean(), codex: z.boolean(), codexOptions, promptSections, composition: z.string() });
|
|
13
|
-
const catalog = z.object({
|
|
14
|
-
presets: z.array(z.object({ id: z.string(), name: z.string(), description: z.string(),
|
|
15
|
-
editable: z.boolean(), isDefault: z.boolean() })),
|
|
16
|
-
authorable: z.boolean(), excludedCount: z.number(),
|
|
17
|
-
});
|
|
18
|
-
function descriptor(method, parameter, input, output) {
|
|
19
|
-
const id = `@shuind/dsh-codex-harness#codexPresetEditor/${method}`;
|
|
20
|
-
return {
|
|
21
|
-
id, service: 'codexPresetEditor', namespace: 'codexPresetEditor', method,
|
|
22
|
-
invocation: { kind: 'direct' },
|
|
23
|
-
parameters: parameter ? [{ name: parameter, wire: parameter, source: 'json',
|
|
24
|
-
codec: { mode: 'strict', typeSymbol: `${id}:${parameter}`, schema: input } }] : [],
|
|
25
|
-
result: { mode: 'strict', typeSymbol: `${id}:result`, schema: output },
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
export default {
|
|
29
|
-
package: '@shuind/dsh-codex-harness',
|
|
30
|
-
descriptors: [
|
|
31
|
-
descriptor('catalog', undefined, z.unknown(), catalog),
|
|
32
|
-
descriptor('read', 'id', z.string(), document),
|
|
33
|
-
descriptor('update', 'rawInput', z.object({ ...fields, id: z.string(), revision: z.string().optional(), composition: z.string().max(1_000_000).optional(), enableCodex: z.boolean().optional(), promptSections: promptSections.optional(), codexOptions: codexOptionsPatch.optional() }), document),
|
|
34
|
-
descriptor('create', 'rawInput', z.object({ ...fields, sourceId: z.string(), enableCodex: z.boolean().optional(), composition: z.string().max(1_000_000).optional(), promptSections: promptSections.optional(), codexOptions: codexOptionsPatch.optional() }), document),
|
|
35
|
-
],
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=preset-editor-remote.js.map
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
-
import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
3
|
-
import type { CodexSettings } from './settings.ts';
|
|
4
|
-
import type { CodexPresetOptions, PresetCatalog, PresetCreateInput, PresetEditorInput, PresetEditorDocument, PresetPromptSection } from './preset-contract.ts';
|
|
5
|
-
export type { PresetEditorInput, PresetEditorDocument } from './preset-contract.ts';
|
|
6
|
-
export declare const DEFAULT_CODEX_PRESET_OPTIONS: CodexPresetOptions;
|
|
7
|
-
export interface ResolvedPresetForEditor {
|
|
8
|
-
id: string;
|
|
9
|
-
trust: 'system' | 'user';
|
|
10
|
-
path: string;
|
|
11
|
-
broken?: string;
|
|
12
|
-
name?: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface AgentPresetsForEditor {
|
|
16
|
-
list?(): Promise<ResolvedPresetForEditor[]>;
|
|
17
|
-
readonly defaultId?: string;
|
|
18
|
-
readonly authorable?: boolean;
|
|
19
|
-
resolve(id: string): Promise<ResolvedPresetForEditor>;
|
|
20
|
-
readDocument(id: string): Promise<{
|
|
21
|
-
content: string;
|
|
22
|
-
name?: string;
|
|
23
|
-
description?: string;
|
|
24
|
-
}>;
|
|
25
|
-
remoteExportList(): Promise<{
|
|
26
|
-
presets: Array<{
|
|
27
|
-
id: string;
|
|
28
|
-
name?: string;
|
|
29
|
-
description?: string;
|
|
30
|
-
trust: 'system' | 'user';
|
|
31
|
-
isDefault: boolean;
|
|
32
|
-
broken?: string;
|
|
33
|
-
}>;
|
|
34
|
-
authorable: boolean;
|
|
35
|
-
}>;
|
|
36
|
-
copy(from: string, id: string, name?: string): Promise<void>;
|
|
37
|
-
remove(id: string): Promise<void>;
|
|
38
|
-
readonly roots?: readonly {
|
|
39
|
-
path: string;
|
|
40
|
-
trust: 'system' | 'user';
|
|
41
|
-
}[];
|
|
42
|
-
}
|
|
43
|
-
export declare function readPromptSections(content: string, shared?: Partial<CodexSettings>): PresetPromptSection[];
|
|
44
|
-
/** Patch the contributing fields, not a disconnected secondary prompt. */
|
|
45
|
-
export declare function patchPromptSections(content: string, sections: PresetPromptSection[]): string;
|
|
46
|
-
export declare function readCodexPresetOptions(content: string): CodexPresetOptions;
|
|
47
|
-
export declare function supportsCodex(content: string): boolean;
|
|
48
|
-
/** Structural validation only: executable tags stay inert until DSH mounts a selected preset. */
|
|
49
|
-
export declare function validateComposition(content: string): void;
|
|
50
|
-
export declare function enhanceComposition(content: string): string;
|
|
51
|
-
export declare function readPresetSystemPrompt(content: string): string;
|
|
52
|
-
export declare function patchPresetComposition(content: string, prompt: string, inherit?: boolean): string;
|
|
53
|
-
/** Store user-facing Codex capability switches in the Harness row. */
|
|
54
|
-
export declare function patchCodexPresetOptions(content: string, options: Partial<CodexPresetOptions>): string;
|
|
55
|
-
export declare function patchPresetMetadata(content: string, name: string, description: string): string;
|
|
56
|
-
export declare class CodexPresetEditor extends TypertRemoteService {
|
|
57
|
-
static inject: string[];
|
|
58
|
-
private readonly agentPresets;
|
|
59
|
-
private sharedSettings?;
|
|
60
|
-
private indexed?;
|
|
61
|
-
constructor(ctx: Context, _config?: undefined);
|
|
62
|
-
catalog(): Promise<PresetCatalog>;
|
|
63
|
-
read(id: string): Promise<PresetEditorDocument>;
|
|
64
|
-
create(rawInput: PresetCreateInput): Promise<PresetEditorDocument>;
|
|
65
|
-
update(rawInput: PresetEditorInput): Promise<PresetEditorDocument>;
|
|
66
|
-
private preset;
|
|
67
|
-
}
|
|
68
|
-
export default CodexPresetEditor;
|
|
69
|
-
//# sourceMappingURL=preset-editor.d.ts.map
|