@shuind/dsh-codex-harness 0.3.2 → 0.3.3
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 +17 -0
- package/README.md +21 -41
- package/docs/preset-library.md +2 -2
- package/docs/tool-policy.md +1 -1
- package/lib/client.js +1826 -545
- package/lib/compact-command.js +7 -1
- package/lib/compaction.js +7 -1
- package/lib/hybrid-executor.js +23 -12
- package/lib/index.js +1229 -17
- package/lib/preferences.js +21 -2
- package/lib/tool-policy.js +11 -2
- package/lib/typert.js +42 -1
- package/lib/types/client/desktop.d.ts +20 -42
- package/lib/types/client/desktop.js +184 -127
- package/lib/types/client/index.d.ts +104 -39
- package/lib/types/client/index.js +97 -15
- package/lib/types/client/policy-drafts.d.ts +18 -0
- package/lib/types/client/policy-drafts.js +27 -0
- package/lib/types/client/policy-locale.d.ts +81 -32
- package/lib/types/client/policy-locale.js +197 -107
- package/lib/types/client/preset-manager.d.ts +25 -2
- package/lib/types/client/preset-manager.js +89 -5
- package/lib/types/client/preset-requests.d.ts +44 -1
- package/lib/types/client/preset-requests.js +150 -0
- package/lib/types/client/tool-policy.d.ts +6 -15
- package/lib/types/client/tool-policy.js +24 -39
- package/lib/types/contracts/preset-editor-schema.d.ts +35 -0
- package/lib/types/contracts/preset-editor-schema.js +39 -0
- package/lib/types/contracts/settings.d.ts +12 -0
- package/lib/types/contracts/settings.js +10 -1
- package/lib/types/contracts/ui-contracts.d.ts +48 -0
- package/lib/types/contracts/ui-contracts.js +58 -0
- package/lib/types/contracts/update.d.ts +73 -0
- package/lib/types/contracts/update.js +291 -0
- package/lib/types/entries/index.js +20 -2
- package/lib/types/entries/preferences.d.ts +2 -0
- package/lib/types/entries/preferences.js +9 -0
- package/lib/types/hybrid/hybrid-sdk.d.ts +1 -1
- package/lib/types/hybrid/hybrid-sdk.js +27 -13
- package/lib/types/presets/preset-editor.d.ts +13 -1
- package/lib/types/presets/preset-editor.js +24 -1
- package/lib/types/presets/pro-mode-store.d.ts +13 -0
- package/lib/types/presets/pro-mode-store.js +69 -0
- package/lib/types/responses/background-sse-codec.d.ts +23 -0
- package/lib/types/responses/background-sse-codec.js +230 -0
- package/lib/types/responses/background-stream.d.ts +28 -0
- package/lib/types/responses/background-stream.js +351 -0
- package/lib/types/responses/fetch-transport.js +24 -9
- package/lib/types/responses/wire-rewrite.d.ts +4 -0
- package/lib/types/responses/wire-rewrite.js +30 -4
- package/lib/types/tools/codex-subagent.d.ts +14 -0
- package/lib/types/tools/codex-subagent.js +269 -0
- package/lib/types/update/checker.d.ts +14 -0
- package/lib/types/update/checker.js +166 -0
- package/locale/en.json +1 -1
- package/locale/hybrid-executor/en.json +1 -1
- package/locale/hybrid-executor/zh.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +6 -2
- package/src/client/desktop.tsx +359 -160
- package/src/client/index.tsx +122 -22
- package/src/client/policy-drafts.ts +45 -0
- package/src/client/policy-locale.ts +198 -106
- package/src/client/preset-manager.tsx +125 -4
- package/src/client/preset-requests.ts +185 -1
- package/src/client/tool-policy.tsx +29 -63
- package/src/contracts/preset-editor-schema.ts +44 -0
- package/src/contracts/settings.ts +20 -1
- package/src/contracts/ui-contracts.ts +87 -0
- package/src/contracts/update.ts +307 -0
- package/src/entries/index.ts +25 -2
- package/src/entries/preferences.ts +9 -0
- package/src/hybrid/hybrid-sdk.ts +28 -12
- package/src/presets/preset-editor.ts +31 -3
- package/src/presets/pro-mode-store.ts +80 -0
- package/src/responses/background-sse-codec.ts +237 -0
- package/src/responses/background-stream.ts +371 -0
- package/src/responses/fetch-transport.ts +28 -9
- package/src/responses/wire-rewrite.ts +34 -3
- package/src/tools/codex-subagent.ts +290 -0
- package/src/update/checker.ts +193 -0
- package/tsdown.config.ts +4 -0
package/lib/preferences.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Service } from "@deepseek-ai/cordis";
|
|
|
2
2
|
import z from "@deepseek-ai/schemastery";
|
|
3
3
|
//#region lib/types/contracts/ui-contracts.js
|
|
4
4
|
const CODEX_CONTEXT_MAX = 1e6;
|
|
5
|
+
const CODEX_SUBAGENT_DEFAULT_PRESET = "codex-hybrid";
|
|
5
6
|
//#endregion
|
|
6
7
|
//#region lib/types/contracts/prompt.js
|
|
7
8
|
/** Default plugin-owned Codex operating prompt. */
|
|
@@ -69,6 +70,7 @@ const DEFAULT_DSH_CORE_WEB_PROMPT = [
|
|
|
69
70
|
const CODEX_SETTINGS_ENTRY = {
|
|
70
71
|
fast: false,
|
|
71
72
|
fastModeControlEnabled: true,
|
|
73
|
+
proModeControlEnabled: true,
|
|
72
74
|
contextWindowControlEnabled: true,
|
|
73
75
|
persona: DEFAULT_CODEX_PERSONA,
|
|
74
76
|
harnessSourcePrompt: DEFAULT_DSH_CORE_SOURCE_PROMPT,
|
|
@@ -80,7 +82,9 @@ const CODEX_SETTINGS_ENTRY = {
|
|
|
80
82
|
planToolEnabled: true,
|
|
81
83
|
hostedWebSearchEnabled: true,
|
|
82
84
|
remoteCompactionEnabled: true,
|
|
83
|
-
activityIndicatorEnabled: true
|
|
85
|
+
activityIndicatorEnabled: true,
|
|
86
|
+
codexSubagentEnabled: false,
|
|
87
|
+
codexSubagentPreset: CODEX_SUBAGENT_DEFAULT_PRESET
|
|
84
88
|
};
|
|
85
89
|
//#endregion
|
|
86
90
|
//#region lib/types/entries/preferences.js
|
|
@@ -88,6 +92,7 @@ const CODEX_SETTINGS_ENTRY = {
|
|
|
88
92
|
const Config = z.object({
|
|
89
93
|
fast: z.boolean().default(false),
|
|
90
94
|
fastModeControlEnabled: z.boolean().default(true),
|
|
95
|
+
proModeControlEnabled: z.boolean().default(true),
|
|
91
96
|
contextWindowControlEnabled: z.boolean().default(true),
|
|
92
97
|
contextWindow: z.number().step(1).min(1).max(CODEX_CONTEXT_MAX).hidden(),
|
|
93
98
|
persona: z.string().default(DEFAULT_CODEX_PERSONA),
|
|
@@ -100,18 +105,32 @@ const Config = z.object({
|
|
|
100
105
|
planToolEnabled: z.boolean().default(true).hidden(),
|
|
101
106
|
hostedWebSearchEnabled: z.boolean().default(true),
|
|
102
107
|
remoteCompactionEnabled: z.boolean().default(true),
|
|
103
|
-
activityIndicatorEnabled: z.boolean().default(true)
|
|
108
|
+
activityIndicatorEnabled: z.boolean().default(true),
|
|
109
|
+
codexSubagentEnabled: z.boolean().default(false),
|
|
110
|
+
codexSubagentModel: z.string(),
|
|
111
|
+
codexSubagentEffort: z.string(),
|
|
112
|
+
codexSubagentPreset: z.string().default(CODEX_SUBAGENT_DEFAULT_PRESET)
|
|
104
113
|
}).default(CODEX_SETTINGS_ENTRY).volatile();
|
|
105
114
|
var CodexPreferences = class extends Service {
|
|
106
115
|
value;
|
|
107
116
|
static Config = Config;
|
|
117
|
+
listeners = /* @__PURE__ */ new Set();
|
|
108
118
|
constructor(ctx, value) {
|
|
109
119
|
super(ctx, "codexPreferences");
|
|
110
120
|
this.value = value;
|
|
121
|
+
ctx.on?.("loader/volatile-update", () => {
|
|
122
|
+
for (const listener of [...this.listeners]) listener();
|
|
123
|
+
});
|
|
111
124
|
}
|
|
112
125
|
current() {
|
|
113
126
|
return this.value.get() ?? CODEX_SETTINGS_ENTRY;
|
|
114
127
|
}
|
|
128
|
+
subscribe(listener) {
|
|
129
|
+
this.listeners.add(listener);
|
|
130
|
+
return () => {
|
|
131
|
+
this.listeners.delete(listener);
|
|
132
|
+
};
|
|
133
|
+
}
|
|
115
134
|
};
|
|
116
135
|
//#endregion
|
|
117
136
|
export { Config, CodexPreferences as default };
|
package/lib/tool-policy.js
CHANGED
|
@@ -10,6 +10,7 @@ import { FsError } from "@deepseek-ai/dsh-fs";
|
|
|
10
10
|
import z from "@deepseek-ai/schemastery";
|
|
11
11
|
//#region lib/types/contracts/ui-contracts.js
|
|
12
12
|
const CODEX_CONTEXT_MAX = 1e6;
|
|
13
|
+
const CODEX_SUBAGENT_DEFAULT_PRESET = "codex-hybrid";
|
|
13
14
|
/** Client-safe current-preset prompt catalog; editable targets have reviewed native contracts. */
|
|
14
15
|
const PRESET_PROMPT_NAMES = [
|
|
15
16
|
"deployment:persona-prefix",
|
|
@@ -1309,6 +1310,7 @@ const CODEX_SETTINGS_NAMESPACE = "codex";
|
|
|
1309
1310
|
const CODEX_SETTINGS_ENTRY = {
|
|
1310
1311
|
fast: false,
|
|
1311
1312
|
fastModeControlEnabled: true,
|
|
1313
|
+
proModeControlEnabled: true,
|
|
1312
1314
|
contextWindowControlEnabled: true,
|
|
1313
1315
|
persona: DEFAULT_CODEX_PERSONA,
|
|
1314
1316
|
harnessSourcePrompt: DEFAULT_DSH_CORE_SOURCE_PROMPT,
|
|
@@ -1320,11 +1322,14 @@ const CODEX_SETTINGS_ENTRY = {
|
|
|
1320
1322
|
planToolEnabled: true,
|
|
1321
1323
|
hostedWebSearchEnabled: true,
|
|
1322
1324
|
remoteCompactionEnabled: true,
|
|
1323
|
-
activityIndicatorEnabled: true
|
|
1325
|
+
activityIndicatorEnabled: true,
|
|
1326
|
+
codexSubagentEnabled: false,
|
|
1327
|
+
codexSubagentPreset: CODEX_SUBAGENT_DEFAULT_PRESET
|
|
1324
1328
|
};
|
|
1325
1329
|
z.object({
|
|
1326
1330
|
fast: z.boolean().default(false),
|
|
1327
1331
|
fastModeControlEnabled: z.boolean().default(true),
|
|
1332
|
+
proModeControlEnabled: z.boolean().default(true),
|
|
1328
1333
|
contextWindowControlEnabled: z.boolean().default(true),
|
|
1329
1334
|
contextWindow: z.number().step(1).min(1).max(CODEX_CONTEXT_MAX).hidden(),
|
|
1330
1335
|
persona: z.string().default(DEFAULT_CODEX_PERSONA),
|
|
@@ -1337,7 +1342,11 @@ z.object({
|
|
|
1337
1342
|
planToolEnabled: z.boolean().default(true).hidden(),
|
|
1338
1343
|
hostedWebSearchEnabled: z.boolean().default(true),
|
|
1339
1344
|
remoteCompactionEnabled: z.boolean().default(true),
|
|
1340
|
-
activityIndicatorEnabled: z.boolean().default(true)
|
|
1345
|
+
activityIndicatorEnabled: z.boolean().default(true),
|
|
1346
|
+
codexSubagentEnabled: z.boolean().default(false),
|
|
1347
|
+
codexSubagentModel: z.string(),
|
|
1348
|
+
codexSubagentEffort: z.string(),
|
|
1349
|
+
codexSubagentPreset: z.string().default(CODEX_SUBAGENT_DEFAULT_PRESET)
|
|
1341
1350
|
});
|
|
1342
1351
|
/** Host-only reads: never expose the unredacted provider configuration to clients. */
|
|
1343
1352
|
function readHostSettings(ctx, namespace) {
|
package/lib/typert.js
CHANGED
|
@@ -4,6 +4,43 @@ import { z } from "zod";
|
|
|
4
4
|
const PRESET_EDITOR_PACKAGE = "@shuind/dsh-codex-harness";
|
|
5
5
|
const PRESET_EDITOR_SERVICE = "codexPresetEditor";
|
|
6
6
|
const presetIdSchema = z.string().min(1).max(256);
|
|
7
|
+
const proModeSessionIdSchema = z.string().min(1).max(256);
|
|
8
|
+
const proModeSetInputSchema = z.object({
|
|
9
|
+
sessionId: proModeSessionIdSchema,
|
|
10
|
+
enabled: z.boolean()
|
|
11
|
+
});
|
|
12
|
+
const proModeStateSchema = z.object({ enabled: z.boolean() });
|
|
13
|
+
const harnessUpdateResultSchema = z.discriminatedUnion("status", [
|
|
14
|
+
z.object({
|
|
15
|
+
status: z.literal("up-to-date"),
|
|
16
|
+
currentVersion: z.string(),
|
|
17
|
+
latestVersion: z.string()
|
|
18
|
+
}),
|
|
19
|
+
z.object({
|
|
20
|
+
status: z.literal("update-available"),
|
|
21
|
+
currentVersion: z.string(),
|
|
22
|
+
latestVersion: z.string(),
|
|
23
|
+
releaseUrl: z.string()
|
|
24
|
+
}),
|
|
25
|
+
z.object({
|
|
26
|
+
status: z.literal("unavailable"),
|
|
27
|
+
currentVersion: z.string(),
|
|
28
|
+
reason: z.enum([
|
|
29
|
+
"invalid-current-version",
|
|
30
|
+
"registry-unavailable",
|
|
31
|
+
"invalid-registry-response"
|
|
32
|
+
])
|
|
33
|
+
})
|
|
34
|
+
]);
|
|
35
|
+
const codexSubagentModelsSchema = z.object({
|
|
36
|
+
available: z.boolean(),
|
|
37
|
+
models: z.array(z.object({
|
|
38
|
+
id: z.string(),
|
|
39
|
+
name: z.string(),
|
|
40
|
+
efforts: z.array(z.string()),
|
|
41
|
+
defaultEffort: z.string().optional()
|
|
42
|
+
}))
|
|
43
|
+
});
|
|
7
44
|
const presetCatalogSchema = z.object({
|
|
8
45
|
presets: z.array(z.object({
|
|
9
46
|
id: z.string(),
|
|
@@ -93,7 +130,11 @@ function buildPresetEditorDescriptors() {
|
|
|
93
130
|
descriptor("catalog", void 0, z.unknown(), presetCatalogSchema),
|
|
94
131
|
descriptor("tools", "id", presetIdSchema, presetToolCatalogSchema),
|
|
95
132
|
descriptor("prompts", "id", presetIdSchema, presetPromptCatalogSchema),
|
|
96
|
-
descriptor("read", "id", presetIdSchema, presetDefinitionSchema)
|
|
133
|
+
descriptor("read", "id", presetIdSchema, presetDefinitionSchema),
|
|
134
|
+
descriptor("proModeGet", "sessionId", proModeSessionIdSchema, proModeStateSchema),
|
|
135
|
+
descriptor("proModeSet", "input", proModeSetInputSchema, proModeStateSchema),
|
|
136
|
+
descriptor("updateCheck", void 0, z.unknown(), harnessUpdateResultSchema),
|
|
137
|
+
descriptor("codexSubagentModels", void 0, z.unknown(), codexSubagentModelsSchema)
|
|
97
138
|
];
|
|
98
139
|
}
|
|
99
140
|
buildPresetEditorDescriptors();
|
|
@@ -1,58 +1,36 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
2
|
import type { InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
|
|
3
|
-
import type { CodexConnectScope,
|
|
3
|
+
import type { CodexConnectScope, CodexConnectSnapshot, InputSettingsControlInjected } from './index.tsx';
|
|
4
|
+
import { HarnessUpdateStore } from '../contracts/update.ts';
|
|
5
|
+
import type { HarnessUpdateSnapshot } from '../contracts/update.ts';
|
|
6
|
+
import { adaptConfigForm, bindCodexConnectScope, saveDesktopSettings } from './preset-requests.ts';
|
|
7
|
+
import type { DesktopConfigForm } from './preset-requests.ts';
|
|
4
8
|
import type { ToolPolicyBinding } from './tool-policy.tsx';
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
unset(field: string): Promise<boolean>;
|
|
8
|
-
mutate(ops: Array<{
|
|
9
|
-
op: 'set';
|
|
10
|
-
path: string[];
|
|
11
|
-
value: unknown;
|
|
12
|
-
} | {
|
|
13
|
-
op: 'unset';
|
|
14
|
-
path: string[];
|
|
15
|
-
}>, expectedRevision?: number | string): Promise<boolean>;
|
|
16
|
-
}
|
|
9
|
+
export { adaptConfigForm, bindCodexConnectScope, saveDesktopSettings };
|
|
10
|
+
export type { DesktopConfigForm };
|
|
17
11
|
interface DesktopSettingsActions extends InputSettingsControlInjected {
|
|
18
12
|
saveSettings(edits: Record<string, unknown>, expectedRevision?: number | string): Promise<void>;
|
|
19
13
|
toolPolicy?: ToolPolicyBinding;
|
|
14
|
+
updateStore?: HarnessUpdateStore;
|
|
20
15
|
}
|
|
21
|
-
interface MirrorNamespaceRow {
|
|
22
|
-
readonly ns: string;
|
|
23
|
-
readonly value?: unknown;
|
|
24
|
-
readonly base?: unknown;
|
|
25
|
-
}
|
|
26
|
-
interface ConfigMirror {
|
|
27
|
-
getSnapshot(): {
|
|
28
|
-
readonly status?: string;
|
|
29
|
-
readonly view?: {
|
|
30
|
-
readonly writable?: boolean;
|
|
31
|
-
readonly namespaces?: readonly MirrorNamespaceRow[];
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
subscribe(listener: () => void): () => void;
|
|
35
|
-
ensure?(): unknown;
|
|
36
|
-
}
|
|
37
|
-
interface DesktopSettingsContext {
|
|
38
|
-
configForms: {
|
|
39
|
-
get(entryId: string): DesktopConfigForm;
|
|
40
|
-
describe?(): ConfigMirror;
|
|
41
|
-
whileServed(namespaces: string[], register: () => () => void): () => void;
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
export declare function bindCodexConnectScope(configForms: DesktopSettingsContext['configForms']): CodexConnectScope;
|
|
45
|
-
export declare function adaptConfigForm(form: Pick<DesktopConfigForm, 'getSnapshot' | 'subscribe' | 'set' | 'unset'>): CodexScope;
|
|
46
|
-
export declare function saveDesktopSettings(form: Pick<DesktopConfigForm, 'mutate'>, edits: Record<string, unknown>, expectedRevision?: number | string): Promise<void>;
|
|
47
16
|
type DesktopSettingsProps = InjectFace<DesktopSettingsActions> & PropsLocale<'codex'>;
|
|
48
|
-
type SettingsPage = 'tools' | 'runtime';
|
|
17
|
+
type SettingsPage = 'tools' | 'runtime' | 'help';
|
|
49
18
|
/** There is intentionally no second editable form on a bundle detail page. */
|
|
50
19
|
export declare function DesktopSettingsCard({ t }: DesktopSettingsProps & {
|
|
51
20
|
view: 'summary' | 'page';
|
|
52
21
|
}): import("react").JSX.Element;
|
|
53
|
-
/**
|
|
54
|
-
export declare function RuntimeSettingsEditor({ active, ...props }: DesktopSettingsProps & {
|
|
22
|
+
/** Unified environment-wide settings: live subscription registrations, model requests, and display toggles. */
|
|
23
|
+
export declare function RuntimeSettingsEditor({ active, connectScope, connectSnapshot, onImageRegistrationChanged, ...props }: DesktopSettingsProps & {
|
|
24
|
+
active: boolean;
|
|
25
|
+
connectScope?: CodexConnectScope | undefined;
|
|
26
|
+
connectSnapshot?: CodexConnectSnapshot | undefined;
|
|
27
|
+
onImageRegistrationChanged?: (() => void) | undefined;
|
|
28
|
+
}): import("react").JSX.Element | null;
|
|
29
|
+
export declare function HelpGuideSection({ active, updateStore, updateSnapshot, t }: {
|
|
55
30
|
active: boolean;
|
|
31
|
+
updateStore?: HarnessUpdateStore | undefined;
|
|
32
|
+
updateSnapshot?: HarnessUpdateSnapshot | undefined;
|
|
33
|
+
t: PropsLocale<'codex'>['t'];
|
|
56
34
|
}): import("react").JSX.Element | null;
|
|
57
35
|
export declare function CodexSettingsTab(props: DesktopSettingsProps & {
|
|
58
36
|
initialPage?: SettingsPage;
|