@shuind/dsh-codex-harness 0.2.3 → 0.2.5
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/lib/client.js +267 -114
- package/lib/index.js +116 -13
- package/lib/installer.js +22 -1
- package/lib/types/client/index.d.ts +19 -9
- package/lib/types/client/index.js +110 -55
- package/lib/types/index.d.ts +7 -1
- package/lib/types/index.js +63 -10
- package/lib/types/prompt.d.ts +6 -0
- package/lib/types/prompt.js +16 -1
- package/lib/types/remote.d.ts +5 -0
- package/lib/types/remote.js +42 -0
- package/lib/types/settings.d.ts +6 -0
- package/lib/types/settings.js +7 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -526,6 +526,7 @@ async function runWriteStdin(ctx, args, exec, config) {
|
|
|
526
526
|
const SETTINGS_NAMESPACE = "llm-pi-ai";
|
|
527
527
|
const REMOTE_COMPACTION_OPEN = "<codex-remote-compaction>";
|
|
528
528
|
const REMOTE_COMPACTION_CLOSE = "</codex-remote-compaction>";
|
|
529
|
+
const CONTEXT_WINDOW_EXCEEDED_CODE = "CONTEXT_WINDOW_EXCEEDED";
|
|
529
530
|
const CODEX_ERROR_DIRECTORY = ["diagnostics", "openai-codex-errors"];
|
|
530
531
|
const HOSTED_REQUESTS = new AsyncLocalStorage();
|
|
531
532
|
let hostedPatchUsers = 0;
|
|
@@ -908,6 +909,38 @@ function hostedWebSearchStream(next, options = {}) {
|
|
|
908
909
|
}
|
|
909
910
|
})();
|
|
910
911
|
}
|
|
912
|
+
function contextTokens(usage) {
|
|
913
|
+
const fields = [
|
|
914
|
+
usage.inputTokens,
|
|
915
|
+
usage.outputTokens,
|
|
916
|
+
usage.cacheReadTokens ?? 0,
|
|
917
|
+
usage.cacheWriteTokens ?? 0
|
|
918
|
+
];
|
|
919
|
+
if (fields.some((value) => !Number.isSafeInteger(value) || value < 0)) return void 0;
|
|
920
|
+
const total = fields.reduce((sum, value) => sum + value, 0);
|
|
921
|
+
return Number.isSafeInteger(total) ? total : void 0;
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* Correct the usage-only overflow verdict emitted by pi-ai adapters that do
|
|
925
|
+
* not yet consume the request-scoped Codex capacity.
|
|
926
|
+
*/
|
|
927
|
+
function repairLegacyPiAiContextOverflow(stream, model, contextWindow) {
|
|
928
|
+
return (async function* () {
|
|
929
|
+
let usage;
|
|
930
|
+
for await (const chunk of stream) {
|
|
931
|
+
if (chunk.type === "usage") usage = chunk.usage;
|
|
932
|
+
const usedTokens = usage === void 0 ? void 0 : contextTokens(usage);
|
|
933
|
+
if (chunk.type === "finish" && chunk.reason.kind === "error" && chunk.reason.failure.code === CONTEXT_WINDOW_EXCEEDED_CODE && chunk.reason.failure.message === `pi-ai detected context overflow for model "${model}"` && typeof contextWindow === "number" && Number.isSafeInteger(contextWindow) && contextWindow > 0 && usage !== void 0 && usage.outputTokens > 0 && usedTokens !== void 0 && usedTokens <= contextWindow) {
|
|
934
|
+
yield {
|
|
935
|
+
...chunk,
|
|
936
|
+
reason: { kind: "stop" }
|
|
937
|
+
};
|
|
938
|
+
continue;
|
|
939
|
+
}
|
|
940
|
+
yield chunk;
|
|
941
|
+
}
|
|
942
|
+
})();
|
|
943
|
+
}
|
|
911
944
|
function textOf(message) {
|
|
912
945
|
return message.content.filter((block) => block.type === "text").map((block) => block.text).join("");
|
|
913
946
|
}
|
|
@@ -1173,10 +1206,25 @@ const DEFAULT_CODEX_SYSTEM_PROMPT = String.raw`## General
|
|
|
1173
1206
|
|
|
1174
1207
|
## Working principles
|
|
1175
1208
|
|
|
1176
|
-
-
|
|
1209
|
+
- Actively establish the user's current context rather than relying on stale assumptions or prior context. Before committing to an approach that could materially shape the outcome or direction of the work, state the intended path and align it with the user; clarify any material uncertainty first. Then pursue the user's goal through the clearest, most effective path.
|
|
1177
1210
|
- 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.
|
|
1178
1211
|
- Solve problems by thinking from first principles and at a higher level.
|
|
1179
1212
|
`;
|
|
1213
|
+
/** Default deployment Persona template used by the Codex preset. */
|
|
1214
|
+
const DEFAULT_CODEX_PERSONA = String.raw`You are Codex, a coding agent based on the {{model}} model. Your working directory is {{cwd}}.`;
|
|
1215
|
+
/** Default DSH Core source-checkout guidance template. */
|
|
1216
|
+
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.`;
|
|
1217
|
+
/** Default DSH Web runtime guidance template. */
|
|
1218
|
+
const DEFAULT_DSH_CORE_WEB_PROMPT = [
|
|
1219
|
+
"You are interacting with the user through the DeepSeek Harness Web GUI at {{webUrl}}.",
|
|
1220
|
+
"When the user refers to \"this page\", \"this GUI\", or \"this app\" without naming another target, they mean this GUI.",
|
|
1221
|
+
"The browser provides no implicit DOM, route, or screenshot context.",
|
|
1222
|
+
"The client-plugin HMR receiver is active, but client-plugin changes reload without a refresh only while `pnpm run dev:web` is also running from this same checkout to rebuild their bundles; verify that watcher before promising automatic updates.",
|
|
1223
|
+
"Every other change - the apps/web shell and plain packages - requires rebuilding the affected Web artifacts and verifying this existing URL after a page refresh.",
|
|
1224
|
+
"Starting another server does not update this GUI.",
|
|
1225
|
+
"The apps/web Vite entry builds the shell but is not a standalone application because only dsh web injects window.__DSH_BOOT__.",
|
|
1226
|
+
"Do not start a replacement server unless the user asks; if one is needed, use a managed background job and verify its exact URL."
|
|
1227
|
+
].join(" ");
|
|
1180
1228
|
/** Resolve the full plugin-owned prompt, preserving intentional empty overrides. */
|
|
1181
1229
|
function resolveCodexSystemPrompt(systemPrompt) {
|
|
1182
1230
|
return systemPrompt ?? DEFAULT_CODEX_SYSTEM_PROMPT;
|
|
@@ -1192,6 +1240,9 @@ const CODEX_SETTINGS_NAMESPACE = settingsNamespace("codex");
|
|
|
1192
1240
|
/** Default settings exposed even before a Codex session is opened. */
|
|
1193
1241
|
const CODEX_SETTINGS_ENTRY = {
|
|
1194
1242
|
fast: false,
|
|
1243
|
+
persona: DEFAULT_CODEX_PERSONA,
|
|
1244
|
+
harnessSourcePrompt: DEFAULT_DSH_CORE_SOURCE_PROMPT,
|
|
1245
|
+
webSurfacePrompt: DEFAULT_DSH_CORE_WEB_PROMPT,
|
|
1195
1246
|
systemPrompt: DEFAULT_CODEX_SYSTEM_PROMPT,
|
|
1196
1247
|
promptEnabled: true,
|
|
1197
1248
|
terminalToolsEnabled: true,
|
|
@@ -1204,6 +1255,9 @@ const CODEX_SETTINGS_ENTRY = {
|
|
|
1204
1255
|
const CODEX_SETTINGS_SCHEMA = z.object({
|
|
1205
1256
|
fast: z.boolean().default(false),
|
|
1206
1257
|
contextWindow: z.number().step(1).min(1).max(CODEX_CONTEXT_MAX),
|
|
1258
|
+
persona: z.string().default(DEFAULT_CODEX_PERSONA),
|
|
1259
|
+
harnessSourcePrompt: z.string().default(DEFAULT_DSH_CORE_SOURCE_PROMPT),
|
|
1260
|
+
webSurfacePrompt: z.string().default(DEFAULT_DSH_CORE_WEB_PROMPT),
|
|
1207
1261
|
systemPrompt: z.string().default(DEFAULT_CODEX_SYSTEM_PROMPT),
|
|
1208
1262
|
promptEnabled: z.boolean().default(true),
|
|
1209
1263
|
terminalToolsEnabled: z.boolean().default(true),
|
|
@@ -1237,7 +1291,10 @@ const Config = z.object({
|
|
|
1237
1291
|
maxOutputBytes: z.number().step(1).min(1).default(DEFAULT_MAX_OUTPUT_BYTES),
|
|
1238
1292
|
hostedWebSearch: z.boolean().default(true),
|
|
1239
1293
|
remoteCompact: z.boolean().default(true),
|
|
1240
|
-
systemPrompt: z.string().default(DEFAULT_CODEX_SYSTEM_PROMPT)
|
|
1294
|
+
systemPrompt: z.string().default(DEFAULT_CODEX_SYSTEM_PROMPT),
|
|
1295
|
+
persona: z.string().default(DEFAULT_CODEX_PERSONA),
|
|
1296
|
+
harnessSourcePrompt: z.string().default(DEFAULT_DSH_CORE_SOURCE_PROMPT),
|
|
1297
|
+
webSurfacePrompt: z.string().default(DEFAULT_DSH_CORE_WEB_PROMPT)
|
|
1241
1298
|
});
|
|
1242
1299
|
const LLM_PI_AI_SETTINGS = settingsNamespace("llm-pi-ai");
|
|
1243
1300
|
const GPT_REASONING_EFFORTS = {
|
|
@@ -1324,10 +1381,13 @@ function watchConfiguredGptModels(ctx) {
|
|
|
1324
1381
|
schedule();
|
|
1325
1382
|
}
|
|
1326
1383
|
/** Install the optional settings source used by requests and prompt assembly. */
|
|
1327
|
-
function installCodexSettings(ctx, systemPrompt) {
|
|
1384
|
+
function installCodexSettings(ctx, systemPrompt, persona, harnessSourcePrompt, webSurfacePrompt) {
|
|
1328
1385
|
const entry = {
|
|
1329
1386
|
...CODEX_SETTINGS_ENTRY,
|
|
1330
|
-
systemPrompt
|
|
1387
|
+
systemPrompt,
|
|
1388
|
+
persona,
|
|
1389
|
+
harnessSourcePrompt,
|
|
1390
|
+
webSurfacePrompt
|
|
1331
1391
|
};
|
|
1332
1392
|
const withDefaults = (value) => ({
|
|
1333
1393
|
...entry,
|
|
@@ -1427,6 +1487,45 @@ function normalizeCodexPromptAssembly(assembly) {
|
|
|
1427
1487
|
sections: [persona, ...sections.filter((section) => section.name !== "deployment:persona")]
|
|
1428
1488
|
};
|
|
1429
1489
|
}
|
|
1490
|
+
function sectionText(assembly, name) {
|
|
1491
|
+
return assembly.sections.find((candidate) => candidate.name === name)?.text;
|
|
1492
|
+
}
|
|
1493
|
+
function promptVariables(assembly) {
|
|
1494
|
+
const variables = { ...assembly.variables };
|
|
1495
|
+
if (variables.sourceRoot === void 0) {
|
|
1496
|
+
const match = sectionText(assembly, "harness:source")?.match(/^The DeepSeek Harness implementation checkout is at (.+?)\. The checkout location/u);
|
|
1497
|
+
if (match?.[1] !== void 0) variables.sourceRoot = match[1];
|
|
1498
|
+
}
|
|
1499
|
+
if (variables.webUrl === void 0) {
|
|
1500
|
+
const match = sectionText(assembly, "app:web-surface")?.match(/^You are interacting with the user through the DeepSeek Harness Web GUI at (.+?)\. When/u);
|
|
1501
|
+
if (match?.[1] !== void 0) variables.webUrl = match[1];
|
|
1502
|
+
}
|
|
1503
|
+
return variables;
|
|
1504
|
+
}
|
|
1505
|
+
function interpolateCodexPrompt(text, variables) {
|
|
1506
|
+
return text.replace(/\{\{([\w.-]+)\}\}/g, (whole, key) => variables[key] ?? whole);
|
|
1507
|
+
}
|
|
1508
|
+
/** Apply user-editable Persona and DSH Core runtime prompt templates. */
|
|
1509
|
+
function applyCodexPromptOverrides(assembly, settings) {
|
|
1510
|
+
const variables = promptVariables(assembly);
|
|
1511
|
+
const overrides = {
|
|
1512
|
+
"deployment:persona": settings.persona,
|
|
1513
|
+
"harness:source": settings.harnessSourcePrompt,
|
|
1514
|
+
"app:web-surface": settings.webSurfacePrompt
|
|
1515
|
+
};
|
|
1516
|
+
const sections = assembly.sections.map((section) => {
|
|
1517
|
+
const template = overrides[section.name];
|
|
1518
|
+
return template === void 0 ? section : {
|
|
1519
|
+
...section,
|
|
1520
|
+
text: interpolateCodexPrompt(template, variables)
|
|
1521
|
+
};
|
|
1522
|
+
});
|
|
1523
|
+
return {
|
|
1524
|
+
...assembly,
|
|
1525
|
+
sections,
|
|
1526
|
+
variables
|
|
1527
|
+
};
|
|
1528
|
+
}
|
|
1430
1529
|
const CODEX_TOOL_NAMES = {
|
|
1431
1530
|
terminalToolsEnabled: /* @__PURE__ */ new Set(["exec_command", "write_stdin"]),
|
|
1432
1531
|
patchToolEnabled: /* @__PURE__ */ new Set(["apply_patch"]),
|
|
@@ -1439,11 +1538,11 @@ function applyCodexCapabilitySettings(assembly, settings) {
|
|
|
1439
1538
|
if (settings[setting]) continue;
|
|
1440
1539
|
for (const name of names) disabled.add(name);
|
|
1441
1540
|
}
|
|
1442
|
-
const
|
|
1541
|
+
const withOverrides = applyCodexPromptOverrides(disabled.size === 0 ? assembly : {
|
|
1443
1542
|
...assembly,
|
|
1444
1543
|
tools: assembly.tools.filter((tool) => !disabled.has(tool.name))
|
|
1445
|
-
};
|
|
1446
|
-
return settings.promptEnabled ? normalizeCodexPromptAssembly(
|
|
1544
|
+
}, settings);
|
|
1545
|
+
return settings.promptEnabled ? normalizeCodexPromptAssembly(withOverrides) : withOverrides;
|
|
1447
1546
|
}
|
|
1448
1547
|
/** Build the complete plugin-owned prompt, preserving an intentional empty value. */
|
|
1449
1548
|
function buildCodexSystemPrompt(config = {}) {
|
|
@@ -1832,10 +1931,13 @@ function apply(ctx, config = {}) {
|
|
|
1832
1931
|
maxOutputBytes: config.maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES,
|
|
1833
1932
|
hostedWebSearch: config.hostedWebSearch ?? true,
|
|
1834
1933
|
remoteCompact: config.remoteCompact ?? true,
|
|
1835
|
-
systemPrompt: config.systemPrompt ?? DEFAULT_CODEX_SYSTEM_PROMPT
|
|
1934
|
+
systemPrompt: config.systemPrompt ?? DEFAULT_CODEX_SYSTEM_PROMPT,
|
|
1935
|
+
persona: config.persona ?? DEFAULT_CODEX_PERSONA,
|
|
1936
|
+
harnessSourcePrompt: config.harnessSourcePrompt ?? DEFAULT_DSH_CORE_SOURCE_PROMPT,
|
|
1937
|
+
webSurfacePrompt: config.webSurfacePrompt ?? DEFAULT_DSH_CORE_WEB_PROMPT
|
|
1836
1938
|
};
|
|
1837
1939
|
if (resolved.codexCore && ctx.fs.sandboxMode !== void 0 && ctx.get("sandboxPolicy") === void 0) throw new Error("codex: a sandboxing filesystem requires ctx.sandboxPolicy");
|
|
1838
|
-
const codexSettings = installCodexSettings(ctx, resolved.systemPrompt);
|
|
1940
|
+
const codexSettings = installCodexSettings(ctx, resolved.systemPrompt, resolved.persona, resolved.harnessSourcePrompt, resolved.webSurfacePrompt);
|
|
1839
1941
|
const execConfig = {
|
|
1840
1942
|
...resolved,
|
|
1841
1943
|
currentSettings: codexSettings.current
|
|
@@ -1853,15 +1955,16 @@ function apply(ctx, config = {}) {
|
|
|
1853
1955
|
}
|
|
1854
1956
|
ctx.on("llm/stream", ((options, next) => {
|
|
1855
1957
|
const settings = codexSettings.current();
|
|
1856
|
-
|
|
1958
|
+
const legacySafeNext = () => repairLegacyPiAiContextOverflow(next(), options.model, options.contextWindow);
|
|
1959
|
+
if (resolved.remoteCompact && settings.remoteCompactionEnabled && options.purpose === "compaction" && isGptModel(options.model)) return remoteCompactStream(ctx, options, legacySafeNext, {
|
|
1857
1960
|
hostedWebSearch: resolved.hostedWebSearch && settings.hostedWebSearchEnabled,
|
|
1858
1961
|
customApplyPatch: settings.patchToolEnabled
|
|
1859
1962
|
});
|
|
1860
|
-
if (options.purpose === void 0 && isGptModel(options.model)) return hostedWebSearchStream(next, {
|
|
1963
|
+
if (options.purpose === void 0 && isGptModel(options.model)) return repairLegacyPiAiContextOverflow(hostedWebSearchStream(next, {
|
|
1861
1964
|
serviceTier: options.serviceTier,
|
|
1862
1965
|
hostedWebSearch: resolved.hostedWebSearch && settings.hostedWebSearchEnabled,
|
|
1863
1966
|
customApplyPatch: settings.patchToolEnabled
|
|
1864
|
-
});
|
|
1967
|
+
}), options.model, options.contextWindow);
|
|
1865
1968
|
return next();
|
|
1866
1969
|
}));
|
|
1867
1970
|
}
|
|
@@ -1884,4 +1987,4 @@ var types_default = {
|
|
|
1884
1987
|
apply
|
|
1885
1988
|
};
|
|
1886
1989
|
//#endregion
|
|
1887
|
-
export { CODEX_SETTINGS_NAMESPACE, CODEX_SETTINGS_SCHEMA, Config, DEFAULT_CODEX_SYSTEM_PROMPT, apply, applyCodexCapabilitySettings, applyCodexRequestSettings, buildCodexSystemPrompt, types_default as default, enrichCodexModel, inject, name, normalizeCodexPromptAssembly, syncCodexContextWindow };
|
|
1990
|
+
export { CODEX_SETTINGS_NAMESPACE, CODEX_SETTINGS_SCHEMA, Config, DEFAULT_CODEX_PERSONA, DEFAULT_CODEX_SYSTEM_PROMPT, DEFAULT_DSH_CORE_SOURCE_PROMPT, DEFAULT_DSH_CORE_WEB_PROMPT, apply, applyCodexCapabilitySettings, applyCodexRequestSettings, buildCodexSystemPrompt, types_default as default, enrichCodexModel, inject, name, normalizeCodexPromptAssembly, syncCodexContextWindow };
|
package/lib/installer.js
CHANGED
|
@@ -42,10 +42,25 @@ const DEFAULT_CODEX_SYSTEM_PROMPT = String.raw`## General
|
|
|
42
42
|
|
|
43
43
|
## Working principles
|
|
44
44
|
|
|
45
|
-
-
|
|
45
|
+
- Actively establish the user's current context rather than relying on stale assumptions or prior context. Before committing to an approach that could materially shape the outcome or direction of the work, state the intended path and align it with the user; clarify any material uncertainty first. Then pursue the user's goal through the clearest, most effective path.
|
|
46
46
|
- 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.
|
|
47
47
|
- Solve problems by thinking from first principles and at a higher level.
|
|
48
48
|
`;
|
|
49
|
+
/** Default deployment Persona template used by the Codex preset. */
|
|
50
|
+
const DEFAULT_CODEX_PERSONA = String.raw`You are Codex, a coding agent based on the {{model}} model. Your working directory is {{cwd}}.`;
|
|
51
|
+
/** Default DSH Core source-checkout guidance template. */
|
|
52
|
+
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.`;
|
|
53
|
+
/** Default DSH Web runtime guidance template. */
|
|
54
|
+
const DEFAULT_DSH_CORE_WEB_PROMPT = [
|
|
55
|
+
"You are interacting with the user through the DeepSeek Harness Web GUI at {{webUrl}}.",
|
|
56
|
+
"When the user refers to \"this page\", \"this GUI\", or \"this app\" without naming another target, they mean this GUI.",
|
|
57
|
+
"The browser provides no implicit DOM, route, or screenshot context.",
|
|
58
|
+
"The client-plugin HMR receiver is active, but client-plugin changes reload without a refresh only while `pnpm run dev:web` is also running from this same checkout to rebuild their bundles; verify that watcher before promising automatic updates.",
|
|
59
|
+
"Every other change - the apps/web shell and plain packages - requires rebuilding the affected Web artifacts and verifying this existing URL after a page refresh.",
|
|
60
|
+
"Starting another server does not update this GUI.",
|
|
61
|
+
"The apps/web Vite entry builds the shell but is not a standalone application because only dsh web injects window.__DSH_BOOT__.",
|
|
62
|
+
"Do not start a replacement server unless the user asks; if one is needed, use a managed background job and verify its exact URL."
|
|
63
|
+
].join(" ");
|
|
49
64
|
//#endregion
|
|
50
65
|
//#region lib/types/settings.js
|
|
51
66
|
/** Shared host-side Codex settings contract. */
|
|
@@ -54,6 +69,9 @@ const CODEX_SETTINGS_NAMESPACE = settingsNamespace("codex");
|
|
|
54
69
|
/** Default settings exposed even before a Codex session is opened. */
|
|
55
70
|
const CODEX_SETTINGS_ENTRY = {
|
|
56
71
|
fast: false,
|
|
72
|
+
persona: DEFAULT_CODEX_PERSONA,
|
|
73
|
+
harnessSourcePrompt: DEFAULT_DSH_CORE_SOURCE_PROMPT,
|
|
74
|
+
webSurfacePrompt: DEFAULT_DSH_CORE_WEB_PROMPT,
|
|
57
75
|
systemPrompt: DEFAULT_CODEX_SYSTEM_PROMPT,
|
|
58
76
|
promptEnabled: true,
|
|
59
77
|
terminalToolsEnabled: true,
|
|
@@ -66,6 +84,9 @@ const CODEX_SETTINGS_ENTRY = {
|
|
|
66
84
|
const CODEX_SETTINGS_SCHEMA = z.object({
|
|
67
85
|
fast: z.boolean().default(false),
|
|
68
86
|
contextWindow: z.number().step(1).min(1).max(CODEX_CONTEXT_MAX),
|
|
87
|
+
persona: z.string().default(DEFAULT_CODEX_PERSONA),
|
|
88
|
+
harnessSourcePrompt: z.string().default(DEFAULT_DSH_CORE_SOURCE_PROMPT),
|
|
89
|
+
webSurfacePrompt: z.string().default(DEFAULT_DSH_CORE_WEB_PROMPT),
|
|
69
90
|
systemPrompt: z.string().default(DEFAULT_CODEX_SYSTEM_PROMPT),
|
|
70
91
|
promptEnabled: z.boolean().default(true),
|
|
71
92
|
terminalToolsEnabled: z.boolean().default(true),
|
|
@@ -8,6 +8,9 @@ declare const LEGACY_OVERLAY_SLOT: "conversation.input.overlay";
|
|
|
8
8
|
interface CodexSettings {
|
|
9
9
|
fast: boolean;
|
|
10
10
|
contextWindow?: number;
|
|
11
|
+
persona?: string;
|
|
12
|
+
harnessSourcePrompt?: string;
|
|
13
|
+
webSurfacePrompt?: string;
|
|
11
14
|
systemPrompt?: string;
|
|
12
15
|
promptEnabled: boolean;
|
|
13
16
|
terminalToolsEnabled: boolean;
|
|
@@ -29,25 +32,32 @@ declare const en: {
|
|
|
29
32
|
readonly contextRestore: "Restore model default";
|
|
30
33
|
readonly promptCardTitle: "Codex Harness";
|
|
31
34
|
readonly promptCardDescription: "Choose Codex capabilities and customize the operating prompt.";
|
|
32
|
-
readonly
|
|
35
|
+
readonly codexOnlyCapabilitiesLabel: "Codex mode only";
|
|
36
|
+
readonly otherCapabilitiesLabel: "Additional capabilities";
|
|
33
37
|
readonly capabilityPrompt: "Codex operating prompt";
|
|
34
|
-
readonly capabilityPromptHint: "Inject the editable instructions and persona-first prompt layout
|
|
38
|
+
readonly capabilityPromptHint: "Inject the editable instructions and persona-first prompt layout.";
|
|
35
39
|
readonly capabilityTerminal: "Terminal tools";
|
|
36
|
-
readonly capabilityTerminalHint: "Expose exec_command and write_stdin
|
|
40
|
+
readonly capabilityTerminalHint: "Expose exec_command and write_stdin.";
|
|
37
41
|
readonly capabilityPatch: "Patch tool";
|
|
38
|
-
readonly capabilityPatchHint: "Expose apply_patch
|
|
42
|
+
readonly capabilityPatchHint: "Expose apply_patch, using the native Responses grammar when supported.";
|
|
39
43
|
readonly capabilityPlan: "Plan tool";
|
|
40
|
-
readonly capabilityPlanHint: "Expose update_plan for implementation task tracking
|
|
44
|
+
readonly capabilityPlanHint: "Expose update_plan for implementation task tracking.";
|
|
41
45
|
readonly capabilityWebSearch: "Hosted web search";
|
|
42
46
|
readonly capabilityWebSearchHint: "Use the provider-native Responses web_search tool when available.";
|
|
43
47
|
readonly capabilityCompaction: "Remote compaction";
|
|
44
48
|
readonly capabilityCompactionHint: "Prefer the provider Responses compact endpoint before local compaction.";
|
|
45
49
|
readonly capabilityActivity: "Activity indicator";
|
|
46
50
|
readonly capabilityActivityHint: "Show request, reply, and compaction status beside the conversation.";
|
|
47
|
-
readonly
|
|
48
|
-
readonly
|
|
49
|
-
readonly
|
|
50
|
-
readonly
|
|
51
|
+
readonly promptCustomizationLabel: "Prompt customization";
|
|
52
|
+
readonly personaLabel: "Persona";
|
|
53
|
+
readonly personaHint: "Deployment identity and role. Supports {{model}} and {{cwd}}.";
|
|
54
|
+
readonly sourcePromptLabel: "DSH Core source instructions";
|
|
55
|
+
readonly sourcePromptHint: "Guidance about the DSH checkout and working directory. Supports {{sourceRoot}}.";
|
|
56
|
+
readonly webPromptLabel: "DSH Core Web instructions";
|
|
57
|
+
readonly webPromptHint: "Guidance about this Web GUI, HMR, builds, and verification. Supports {{webUrl}}.";
|
|
58
|
+
readonly promptRestoreAll: "Restore all prompt defaults";
|
|
59
|
+
readonly promptLabel: "Codex operating prompt";
|
|
60
|
+
readonly promptHint: "This is the Codex operating prompt. Persona and DSH Core instructions are edited separately above.";
|
|
51
61
|
readonly promptUnsaved: "Unsaved";
|
|
52
62
|
readonly promptDiscard: "Discard";
|
|
53
63
|
readonly promptSave: "Save";
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { useEffect, useLayoutEffect, useState } from 'react';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
import { CODEX_CONTEXT_MAX, CODEX_CONTEXT_UNIT } from "../context.js";
|
|
6
|
-
import { DEFAULT_CODEX_SYSTEM_PROMPT } from "../prompt.js";
|
|
6
|
+
import { DEFAULT_CODEX_PERSONA, DEFAULT_CODEX_SYSTEM_PROMPT, DEFAULT_DSH_CORE_SOURCE_PROMPT, DEFAULT_DSH_CORE_WEB_PROMPT, } from "../prompt.js";
|
|
7
7
|
import { modelActivity, sameModelActivity } from "./activity.js";
|
|
8
8
|
const NS = 'codex';
|
|
9
9
|
const SETTINGS_NAMESPACE = 'codex';
|
|
@@ -22,25 +22,32 @@ const en = {
|
|
|
22
22
|
contextRestore: 'Restore model default',
|
|
23
23
|
promptCardTitle: 'Codex Harness',
|
|
24
24
|
promptCardDescription: 'Choose Codex capabilities and customize the operating prompt.',
|
|
25
|
-
|
|
25
|
+
codexOnlyCapabilitiesLabel: 'Codex mode only',
|
|
26
|
+
otherCapabilitiesLabel: 'Additional capabilities',
|
|
26
27
|
capabilityPrompt: 'Codex operating prompt',
|
|
27
|
-
capabilityPromptHint: 'Inject the editable instructions and persona-first prompt layout
|
|
28
|
+
capabilityPromptHint: 'Inject the editable instructions and persona-first prompt layout.',
|
|
28
29
|
capabilityTerminal: 'Terminal tools',
|
|
29
|
-
capabilityTerminalHint: 'Expose exec_command and write_stdin
|
|
30
|
+
capabilityTerminalHint: 'Expose exec_command and write_stdin.',
|
|
30
31
|
capabilityPatch: 'Patch tool',
|
|
31
|
-
capabilityPatchHint: 'Expose apply_patch
|
|
32
|
+
capabilityPatchHint: 'Expose apply_patch, using the native Responses grammar when supported.',
|
|
32
33
|
capabilityPlan: 'Plan tool',
|
|
33
|
-
capabilityPlanHint: 'Expose update_plan for implementation task tracking
|
|
34
|
+
capabilityPlanHint: 'Expose update_plan for implementation task tracking.',
|
|
34
35
|
capabilityWebSearch: 'Hosted web search',
|
|
35
36
|
capabilityWebSearchHint: 'Use the provider-native Responses web_search tool when available.',
|
|
36
37
|
capabilityCompaction: 'Remote compaction',
|
|
37
38
|
capabilityCompactionHint: 'Prefer the provider Responses compact endpoint before local compaction.',
|
|
38
39
|
capabilityActivity: 'Activity indicator',
|
|
39
40
|
capabilityActivityHint: 'Show request, reply, and compaction status beside the conversation.',
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
promptCustomizationLabel: 'Prompt customization',
|
|
42
|
+
personaLabel: 'Persona',
|
|
43
|
+
personaHint: 'Deployment identity and role. Supports {{model}} and {{cwd}}.',
|
|
44
|
+
sourcePromptLabel: 'DSH Core source instructions',
|
|
45
|
+
sourcePromptHint: 'Guidance about the DSH checkout and working directory. Supports {{sourceRoot}}.',
|
|
46
|
+
webPromptLabel: 'DSH Core Web instructions',
|
|
47
|
+
webPromptHint: 'Guidance about this Web GUI, HMR, builds, and verification. Supports {{webUrl}}.',
|
|
48
|
+
promptRestoreAll: 'Restore all prompt defaults',
|
|
49
|
+
promptLabel: 'Codex operating prompt',
|
|
50
|
+
promptHint: 'This is the Codex operating prompt. Persona and DSH Core instructions are edited separately above.',
|
|
44
51
|
promptUnsaved: 'Unsaved',
|
|
45
52
|
promptDiscard: 'Discard',
|
|
46
53
|
promptSave: 'Save',
|
|
@@ -64,25 +71,32 @@ const zh = {
|
|
|
64
71
|
contextRestore: '\u6062\u590d\u6a21\u578b\u9ed8\u8ba4\u503c',
|
|
65
72
|
promptCardTitle: 'Codex Harness',
|
|
66
73
|
promptCardDescription: '\u9009\u62e9 Codex \u80fd\u529b\u5e76\u81ea\u5b9a\u4e49\u5b8c\u6574\u7684\u64cd\u4f5c\u63d0\u793a\u8bcd\u3002',
|
|
67
|
-
|
|
74
|
+
codexOnlyCapabilitiesLabel: '\u4ec5\u5728 Codex \u6a21\u5f0f\u4e0b',
|
|
75
|
+
otherCapabilitiesLabel: '\u5176\u4ed6\u80fd\u529b',
|
|
68
76
|
capabilityPrompt: 'Codex \u64cd\u4f5c\u63d0\u793a\u8bcd',
|
|
69
|
-
capabilityPromptHint: '\
|
|
77
|
+
capabilityPromptHint: '\u6ce8\u5165\u53ef\u7f16\u8f91\u6307\u4ee4\uff0c\u5e76\u5c06 Persona \u653e\u5728\u63d0\u793a\u8bcd\u9996\u4f4d\u3002',
|
|
70
78
|
capabilityTerminal: '\u7ec8\u7aef\u5de5\u5177',
|
|
71
|
-
capabilityTerminalHint: '\
|
|
79
|
+
capabilityTerminalHint: '\u63d0\u4f9b exec_command \u548c write_stdin\u3002',
|
|
72
80
|
capabilityPatch: '\u8865\u4e01\u5de5\u5177',
|
|
73
|
-
capabilityPatchHint: '\
|
|
81
|
+
capabilityPatchHint: '\u63d0\u4f9b apply_patch\uff0c\u5e76\u5728\u652f\u6301\u65f6\u4f7f\u7528 Responses \u539f\u751f\u8bed\u6cd5\u3002',
|
|
74
82
|
capabilityPlan: '\u8ba1\u5212\u5de5\u5177',
|
|
75
|
-
capabilityPlanHint: '\
|
|
83
|
+
capabilityPlanHint: '\u63d0\u4f9b update_plan\uff0c\u7528\u4e8e\u8ddf\u8e2a\u5b9e\u65bd\u4efb\u52a1\u3002',
|
|
76
84
|
capabilityWebSearch: '\u6258\u7ba1\u7f51\u7edc\u641c\u7d22',
|
|
77
85
|
capabilityWebSearchHint: '\u53ef\u7528\u65f6\u4f7f\u7528\u63d0\u4f9b\u5546\u539f\u751f\u7684 Responses web_search \u5de5\u5177\u3002',
|
|
78
86
|
capabilityCompaction: '\u8fdc\u7a0b\u4e0a\u4e0b\u6587\u538b\u7f29',
|
|
79
87
|
capabilityCompactionHint: '\u4f18\u5148\u8c03\u7528\u63d0\u4f9b\u5546\u7684 Responses compact \u7aef\u70b9\uff0c\u5931\u8d25\u65f6\u56de\u9000\u672c\u5730\u538b\u7f29\u3002',
|
|
80
88
|
capabilityActivity: '\u6d3b\u52a8\u72b6\u6001',
|
|
81
89
|
capabilityActivityHint: '\u5728\u5bf9\u8bdd\u65c1\u663e\u793a\u8bf7\u6c42\u3001\u56de\u590d\u548c\u538b\u7f29\u72b6\u6001\u3002',
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
90
|
+
promptCustomizationLabel: '\u63d0\u793a\u8bcd\u5b9a\u5236',
|
|
91
|
+
personaLabel: 'Persona',
|
|
92
|
+
personaHint: '\u5b9a\u4e49 Agent \u7684\u8eab\u4efd\u4e0e\u89d2\u8272\uff0c\u652f\u6301 {{model}} \u548c {{cwd}}\u3002',
|
|
93
|
+
sourcePromptLabel: 'DSH Core \u6e90\u7801\u8bf4\u660e',
|
|
94
|
+
sourcePromptHint: '\u8bf4\u660e DSH \u6e90\u7801\u68c0\u51fa\u76ee\u5f55\u4e0e\u5de5\u4f5c\u76ee\u5f55\uff0c\u652f\u6301 {{sourceRoot}}\u3002',
|
|
95
|
+
webPromptLabel: 'DSH Core Web \u8bf4\u660e',
|
|
96
|
+
webPromptHint: '\u8bf4\u660e Web GUI\u3001HMR\u3001\u6784\u5efa\u4e0e\u9a8c\u8bc1\uff0c\u652f\u6301 {{webUrl}}\u3002',
|
|
97
|
+
promptRestoreAll: '\u6062\u590d\u6240\u6709\u63d0\u793a\u8bcd\u9ed8\u8ba4\u503c',
|
|
98
|
+
promptLabel: 'Codex \u64cd\u4f5c\u63d0\u793a\u8bcd',
|
|
99
|
+
promptHint: '\u8fd9\u662f Codex \u64cd\u4f5c\u63d0\u793a\u8bcd\u3002Persona \u548c DSH Core \u8bf4\u660e\u5728\u4e0a\u65b9\u5206\u522b\u7f16\u8f91\u3002',
|
|
86
100
|
promptUnsaved: '\u672a\u4fdd\u5b58',
|
|
87
101
|
promptDiscard: '\u653e\u5f03',
|
|
88
102
|
promptSave: '\u4fdd\u5b58',
|
|
@@ -101,12 +115,6 @@ function promptFromLayer(layer) {
|
|
|
101
115
|
const value = layer['systemPrompt'];
|
|
102
116
|
return typeof value === 'string' ? value : undefined;
|
|
103
117
|
}
|
|
104
|
-
function hasPromptOverride(layer) {
|
|
105
|
-
return typeof layer === 'object'
|
|
106
|
-
&& layer !== null
|
|
107
|
-
&& !Array.isArray(layer)
|
|
108
|
-
&& Object.hasOwn(layer, 'systemPrompt');
|
|
109
|
-
}
|
|
110
118
|
function CapabilityToggle({ field, label, hint, enabled, disabled, setSetting, }) {
|
|
111
119
|
return (_jsxs("label", { style: {
|
|
112
120
|
display: 'flex',
|
|
@@ -116,35 +124,94 @@ function CapabilityToggle({ field, label, hint, enabled, disabled, setSetting, }
|
|
|
116
124
|
cursor: disabled ? 'default' : 'pointer',
|
|
117
125
|
}, children: [_jsxs("span", { style: { flex: 1, minWidth: 0, display: 'grid', gap: 2 }, children: [_jsx("strong", { style: { fontSize: 13, fontWeight: 500 }, children: label }), _jsx("span", { style: { color: 'var(--dsw-alias-label-tertiary)', fontSize: 12, lineHeight: 1.45 }, children: hint })] }), _jsx("input", { type: "checkbox", role: "switch", checked: enabled, disabled: disabled, "aria-label": label, onChange: event => { void setSetting(field, event.target.checked); }, style: { marginTop: 3, accentColor: 'var(--dsw-static-blue-500)' } })] }));
|
|
118
126
|
}
|
|
127
|
+
/** Visually separate capability scope while keeping the host's light settings style. */
|
|
128
|
+
function CapabilityGroup({ label, children, accent }) {
|
|
129
|
+
return (_jsxs("section", { style: {
|
|
130
|
+
display: 'grid',
|
|
131
|
+
gap: 4,
|
|
132
|
+
}, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 7, paddingLeft: 2 }, children: [_jsx("span", { "aria-hidden": "true", style: {
|
|
133
|
+
width: 6,
|
|
134
|
+
height: 6,
|
|
135
|
+
flex: '0 0 auto',
|
|
136
|
+
borderRadius: 999,
|
|
137
|
+
background: accent,
|
|
138
|
+
} }), _jsx("strong", { style: {
|
|
139
|
+
color: 'var(--dsw-alias-label-secondary)',
|
|
140
|
+
fontSize: 14,
|
|
141
|
+
fontWeight: 600,
|
|
142
|
+
letterSpacing: '0.01em',
|
|
143
|
+
}, children: label })] }), _jsx("div", { style: {
|
|
144
|
+
display: 'grid',
|
|
145
|
+
marginLeft: 5,
|
|
146
|
+
paddingLeft: 12,
|
|
147
|
+
}, children: children })] }));
|
|
148
|
+
}
|
|
149
|
+
function PromptEditor({ id, label, hint, value, writable, saving, minHeight, onChange, }) {
|
|
150
|
+
return (_jsxs("div", { style: { display: 'grid', gap: 5 }, children: [_jsx("label", { htmlFor: id, style: { fontSize: 13, fontWeight: 500 }, children: label }), _jsx("textarea", { id: id, value: value, disabled: !writable || saving, onChange: event => { onChange(event.target.value); }, spellCheck: false, style: {
|
|
151
|
+
boxSizing: 'border-box',
|
|
152
|
+
width: '100%',
|
|
153
|
+
minHeight,
|
|
154
|
+
resize: 'vertical',
|
|
155
|
+
padding: 10,
|
|
156
|
+
border: '1px solid var(--dsw-alias-border-l2)',
|
|
157
|
+
borderRadius: 8,
|
|
158
|
+
background: 'var(--dsw-alias-bg-layer-3)',
|
|
159
|
+
color: 'var(--dsw-alias-label-primary)',
|
|
160
|
+
font: 'inherit',
|
|
161
|
+
fontSize: 12,
|
|
162
|
+
lineHeight: 1.5,
|
|
163
|
+
} }), _jsx("span", { style: { color: 'var(--dsw-alias-label-tertiary)', fontSize: 11, lineHeight: 1.45 }, children: hint })] }));
|
|
164
|
+
}
|
|
119
165
|
/** Full-prompt editor contributed to Settings > Plugins. */
|
|
120
166
|
export function PromptSettingsCard(props) {
|
|
121
167
|
const { useSettings, setSetting, unsetSetting, t } = props;
|
|
122
168
|
const snapshot = useSettings(state => state);
|
|
169
|
+
const currentPersona = snapshot.value?.persona ?? DEFAULT_CODEX_PERSONA;
|
|
170
|
+
const currentSourcePrompt = snapshot.value?.harnessSourcePrompt ?? DEFAULT_DSH_CORE_SOURCE_PROMPT;
|
|
171
|
+
const currentWebPrompt = snapshot.value?.webSurfacePrompt ?? DEFAULT_DSH_CORE_WEB_PROMPT;
|
|
123
172
|
const current = snapshot.value?.systemPrompt ?? DEFAULT_CODEX_SYSTEM_PROMPT;
|
|
124
173
|
const inherited = promptFromLayer(snapshot.base) ?? DEFAULT_CODEX_SYSTEM_PROMPT;
|
|
125
|
-
const
|
|
126
|
-
const capabilities = [
|
|
174
|
+
const codexOnlyCapabilities = [
|
|
127
175
|
{ field: 'promptEnabled', label: 'capabilityPrompt', hint: 'capabilityPromptHint' },
|
|
128
176
|
{ field: 'terminalToolsEnabled', label: 'capabilityTerminal', hint: 'capabilityTerminalHint' },
|
|
129
177
|
{ field: 'patchToolEnabled', label: 'capabilityPatch', hint: 'capabilityPatchHint' },
|
|
130
178
|
{ field: 'planToolEnabled', label: 'capabilityPlan', hint: 'capabilityPlanHint' },
|
|
179
|
+
];
|
|
180
|
+
const otherCapabilities = [
|
|
131
181
|
{ field: 'hostedWebSearchEnabled', label: 'capabilityWebSearch', hint: 'capabilityWebSearchHint' },
|
|
132
182
|
{ field: 'remoteCompactionEnabled', label: 'capabilityCompaction', hint: 'capabilityCompactionHint' },
|
|
133
183
|
{ field: 'activityIndicatorEnabled', label: 'capabilityActivity', hint: 'capabilityActivityHint' },
|
|
134
184
|
];
|
|
135
185
|
const [open, setOpen] = useState(false);
|
|
186
|
+
const [personaDraft, setPersonaDraft] = useState(currentPersona);
|
|
187
|
+
const [sourcePromptDraft, setSourcePromptDraft] = useState(currentSourcePrompt);
|
|
188
|
+
const [webPromptDraft, setWebPromptDraft] = useState(currentWebPrompt);
|
|
136
189
|
const [draft, setDraft] = useState(current);
|
|
137
190
|
const [saving, setSaving] = useState(false);
|
|
138
191
|
const [failed, setFailed] = useState(false);
|
|
139
|
-
useEffect(() => {
|
|
192
|
+
useEffect(() => {
|
|
193
|
+
setPersonaDraft(currentPersona);
|
|
194
|
+
setSourcePromptDraft(currentSourcePrompt);
|
|
195
|
+
setWebPromptDraft(currentWebPrompt);
|
|
196
|
+
setDraft(current);
|
|
197
|
+
}, [current, currentPersona, currentSourcePrompt, currentWebPrompt]);
|
|
140
198
|
if (snapshot.status === 'unavailable')
|
|
141
199
|
return null;
|
|
142
|
-
const dirty =
|
|
200
|
+
const dirty = personaDraft !== currentPersona
|
|
201
|
+
|| sourcePromptDraft !== currentSourcePrompt
|
|
202
|
+
|| webPromptDraft !== currentWebPrompt
|
|
203
|
+
|| draft !== current;
|
|
204
|
+
const renderCapability = (capability) => (_jsx(CapabilityToggle, { field: capability.field, label: t(capability.label), hint: t(capability.hint), enabled: snapshot.value?.[capability.field] ?? true, disabled: !snapshot.writable || saving, setSetting: setSetting }, capability.field));
|
|
143
205
|
const save = async () => {
|
|
144
206
|
setSaving(true);
|
|
145
207
|
setFailed(false);
|
|
146
208
|
try {
|
|
147
|
-
await
|
|
209
|
+
await Promise.all([
|
|
210
|
+
setSetting('persona', personaDraft),
|
|
211
|
+
setSetting('harnessSourcePrompt', sourcePromptDraft),
|
|
212
|
+
setSetting('webSurfacePrompt', webPromptDraft),
|
|
213
|
+
setSetting('systemPrompt', draft),
|
|
214
|
+
]);
|
|
148
215
|
}
|
|
149
216
|
catch {
|
|
150
217
|
setFailed(true);
|
|
@@ -156,12 +223,21 @@ export function PromptSettingsCard(props) {
|
|
|
156
223
|
const reset = async () => {
|
|
157
224
|
setSaving(true);
|
|
158
225
|
setFailed(false);
|
|
226
|
+
setPersonaDraft(DEFAULT_CODEX_PERSONA);
|
|
227
|
+
setSourcePromptDraft(DEFAULT_DSH_CORE_SOURCE_PROMPT);
|
|
228
|
+
setWebPromptDraft(DEFAULT_DSH_CORE_WEB_PROMPT);
|
|
159
229
|
setDraft(inherited);
|
|
160
230
|
try {
|
|
161
231
|
await unsetSetting('systemPrompt');
|
|
232
|
+
await unsetSetting('persona');
|
|
233
|
+
await unsetSetting('harnessSourcePrompt');
|
|
234
|
+
await unsetSetting('webSurfacePrompt');
|
|
162
235
|
}
|
|
163
236
|
catch {
|
|
164
237
|
setFailed(true);
|
|
238
|
+
setPersonaDraft(currentPersona);
|
|
239
|
+
setSourcePromptDraft(currentSourcePrompt);
|
|
240
|
+
setWebPromptDraft(currentWebPrompt);
|
|
165
241
|
setDraft(current);
|
|
166
242
|
}
|
|
167
243
|
finally {
|
|
@@ -192,33 +268,12 @@ export function PromptSettingsCard(props) {
|
|
|
192
268
|
background: 'var(--dsw-alias-bg-module-platform)',
|
|
193
269
|
color: 'var(--dsw-alias-label-secondary)',
|
|
194
270
|
fontSize: 11,
|
|
195
|
-
}, children: t('promptUnsaved') })), _jsx("span", { "aria-hidden": "true", style: { color: 'var(--dsw-alias-label-tertiary)', fontSize: 16 }, children: open ? '-' : '+' })] }), open && (_jsxs("div", { style: { borderTop: '1px solid var(--dsw-alias-border-l2)', margin: '0 16px', padding: '12px 0' }, children: [!snapshot.writable && (_jsx("p", { style: { margin: '0 0 10px', color: 'var(--dsw-alias-label-tertiary)', fontSize: 12 }, children: t('promptReadOnly') })),
|
|
196
|
-
display: '
|
|
197
|
-
|
|
198
|
-
gap: 8,
|
|
199
|
-
marginBottom: 7,
|
|
271
|
+
}, children: t('promptUnsaved') })), _jsx("span", { "aria-hidden": "true", style: { color: 'var(--dsw-alias-label-tertiary)', fontSize: 16 }, children: open ? '-' : '+' })] }), open && (_jsxs("div", { style: { borderTop: '1px solid var(--dsw-alias-border-l2)', margin: '0 16px', padding: '12px 0' }, children: [!snapshot.writable && (_jsx("p", { style: { margin: '0 0 10px', color: 'var(--dsw-alias-label-tertiary)', fontSize: 12 }, children: t('promptReadOnly') })), _jsxs("div", { style: { display: 'grid', gap: 16, marginBottom: 14 }, children: [_jsx(CapabilityGroup, { label: t('codexOnlyCapabilitiesLabel'), accent: "var(--dsw-static-blue-500)", children: codexOnlyCapabilities.map(renderCapability) }), _jsx(CapabilityGroup, { label: t('otherCapabilitiesLabel'), accent: "var(--dsw-alias-label-tertiary)", children: otherCapabilities.map(renderCapability) })] }), _jsxs("div", { style: {
|
|
272
|
+
display: 'grid',
|
|
273
|
+
gap: 14,
|
|
200
274
|
paddingTop: 12,
|
|
201
275
|
borderTop: '1px solid var(--dsw-alias-border-l2)',
|
|
202
|
-
}, children: [
|
|
203
|
-
borderRadius: 999,
|
|
204
|
-
padding: '1px 8px',
|
|
205
|
-
background: 'var(--dsw-alias-bg-module-platform)',
|
|
206
|
-
color: 'var(--dsw-alias-label-secondary)',
|
|
207
|
-
fontSize: 11,
|
|
208
|
-
}, children: t('promptOverridden') }), _jsx("button", { type: "button", disabled: !snapshot.writable || saving, onClick: () => { void reset(); }, style: { border: 0, background: 'none', color: 'var(--dsw-alias-label-secondary)', font: 'inherit', fontSize: 12, cursor: 'pointer' }, children: t('promptReset') })] }))] }), _jsx("textarea", { id: "codex-system-prompt", value: draft, disabled: !snapshot.writable || saving, onChange: event => { setDraft(event.target.value); }, spellCheck: false, style: {
|
|
209
|
-
boxSizing: 'border-box',
|
|
210
|
-
width: '100%',
|
|
211
|
-
minHeight: 320,
|
|
212
|
-
resize: 'vertical',
|
|
213
|
-
padding: 12,
|
|
214
|
-
border: '1px solid var(--dsw-alias-border-l2)',
|
|
215
|
-
borderRadius: 8,
|
|
216
|
-
background: 'var(--dsw-alias-bg-layer-3)',
|
|
217
|
-
color: 'var(--dsw-alias-label-primary)',
|
|
218
|
-
fontFamily: 'ui-monospace, SFMono-Regular, Consolas, monospace',
|
|
219
|
-
fontSize: 12,
|
|
220
|
-
lineHeight: 1.55,
|
|
221
|
-
} }), _jsx("p", { style: { margin: '6px 0 12px', color: 'var(--dsw-alias-label-tertiary)', fontSize: 12, lineHeight: 1.5 }, children: t('promptHint') }), _jsxs("div", { style: {
|
|
276
|
+
}, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 8 }, children: [_jsx("strong", { style: { flex: 1, fontSize: 13 }, children: t('promptCustomizationLabel') }), _jsx("button", { type: "button", disabled: !snapshot.writable || saving || !dirty, onClick: () => { void reset(); }, style: { border: 0, padding: 0, background: 'none', color: 'var(--dsw-alias-label-secondary)', font: 'inherit', fontSize: 11, cursor: 'pointer' }, children: t('promptRestoreAll') })] }), _jsx(PromptEditor, { id: "codex-persona", label: t('personaLabel'), hint: t('personaHint'), value: personaDraft, writable: snapshot.writable, saving: saving, minHeight: 84, onChange: setPersonaDraft }), _jsx(PromptEditor, { id: "codex-harness-source-prompt", label: t('sourcePromptLabel'), hint: t('sourcePromptHint'), value: sourcePromptDraft, writable: snapshot.writable, saving: saving, minHeight: 100, onChange: setSourcePromptDraft }), _jsx(PromptEditor, { id: "codex-web-surface-prompt", label: t('webPromptLabel'), hint: t('webPromptHint'), value: webPromptDraft, writable: snapshot.writable, saving: saving, minHeight: 120, onChange: setWebPromptDraft }), _jsx(PromptEditor, { id: "codex-system-prompt", label: t('promptLabel'), hint: t('promptHint'), value: draft, writable: snapshot.writable, saving: saving, minHeight: 320, onChange: setDraft })] }), _jsxs("div", { style: {
|
|
222
277
|
display: 'flex',
|
|
223
278
|
justifyContent: 'flex-end',
|
|
224
279
|
alignItems: 'center',
|
package/lib/types/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { LlmCallConfig } from '@deepseek-ai/dsh-llm';
|
|
|
5
5
|
import type { Session } from '@deepseek-ai/dsh-session';
|
|
6
6
|
import type { PromptAssembly } from '@deepseek-ai/dsh-system-prompt';
|
|
7
7
|
import type { CodexSettings } from './settings.ts';
|
|
8
|
-
export { DEFAULT_CODEX_SYSTEM_PROMPT } from './prompt.ts';
|
|
8
|
+
export { DEFAULT_CODEX_PERSONA, DEFAULT_CODEX_SYSTEM_PROMPT, DEFAULT_DSH_CORE_SOURCE_PROMPT, DEFAULT_DSH_CORE_WEB_PROMPT, } from './prompt.ts';
|
|
9
9
|
export { CODEX_SETTINGS_NAMESPACE, CODEX_SETTINGS_SCHEMA } from './settings.ts';
|
|
10
10
|
export type { CodexSettings } from './settings.ts';
|
|
11
11
|
export declare const name = "codex";
|
|
@@ -30,6 +30,12 @@ export interface Config {
|
|
|
30
30
|
remoteCompact?: boolean;
|
|
31
31
|
/** Complete plugin-owned Codex operating prompt. */
|
|
32
32
|
systemPrompt?: string;
|
|
33
|
+
/** Deployment Persona template. */
|
|
34
|
+
persona?: string;
|
|
35
|
+
/** DSH Core source-checkout guidance template. */
|
|
36
|
+
harnessSourcePrompt?: string;
|
|
37
|
+
/** DSH Core Web GUI guidance template. */
|
|
38
|
+
webSurfacePrompt?: string;
|
|
33
39
|
}
|
|
34
40
|
/** Runtime configuration schema for the Codex tool bridge. */
|
|
35
41
|
export declare const Config: z<Config>;
|