@shuind/dsh-codex-harness 0.2.16 → 0.2.17
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/docs/preset-library.md +20 -18
- package/lib/client.js +300 -177
- package/lib/index.js +252 -8
- package/lib/typert.js +117 -0
- package/lib/types/client/index.d.ts +28 -2
- package/lib/types/client/index.js +32 -62
- package/lib/types/client/preset-copy.d.ts +12 -0
- package/lib/types/client/preset-copy.js +24 -0
- package/lib/types/client/preset-manager.js +70 -9
- package/lib/types/client/preset-requests.d.ts +4 -0
- package/lib/types/client/preset-requests.js +19 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +3 -1
- package/lib/types/preset-contract.d.ts +11 -0
- package/lib/types/preset-editor-remote.js +4 -3
- package/lib/types/preset-editor.d.ts +12 -1
- package/lib/types/preset-editor.js +221 -7
- package/lib/types/prompt-sections.d.ts +15 -0
- package/lib/types/prompt-sections.js +23 -0
- package/lib/types/typert.host.d.ts +47 -0
- package/lib/types/typert.host.js +99 -0
- package/package.json +296 -285
package/lib/index.js
CHANGED
|
@@ -1430,6 +1430,180 @@ function explicitPrompt(content) {
|
|
|
1430
1430
|
if (!isScalar(node) || typeof node.value !== "string" || node.tag) throw new Error("unsupported-prompt-expression");
|
|
1431
1431
|
return node.value;
|
|
1432
1432
|
}
|
|
1433
|
+
const SECTION_PLUGIN = "@shuind/dsh-codex-harness/prompt-sections";
|
|
1434
|
+
function promptFile(node) {
|
|
1435
|
+
if (!node.tag || typeof node.value !== "string") return void 0;
|
|
1436
|
+
return node.value.match(/^process\.getBuiltinModule\(['"]node:fs['"]\)\.readFileSync\(new URL\(['"]([^'"]+)['"],\s*baseUrl\),\s*['"]utf8['"]\)$/)?.[1];
|
|
1437
|
+
}
|
|
1438
|
+
/** Read the actual literal prompt fields, including nested groups, without evaluating YAML tags. */
|
|
1439
|
+
function promptFields(doc) {
|
|
1440
|
+
const fields = [];
|
|
1441
|
+
function visit(sequence, parents = []) {
|
|
1442
|
+
if (!isSeq(sequence)) return;
|
|
1443
|
+
for (const row of sequence.items) {
|
|
1444
|
+
if (!isMap(row) || row.get("disabled") === true) continue;
|
|
1445
|
+
const path = [...parents, String(row.get("id"))];
|
|
1446
|
+
const config = row.get("config", true);
|
|
1447
|
+
if (isSeq(config)) {
|
|
1448
|
+
visit(config, path);
|
|
1449
|
+
continue;
|
|
1450
|
+
}
|
|
1451
|
+
if (!isMap(config)) continue;
|
|
1452
|
+
const plugin = String(row.get("name"));
|
|
1453
|
+
if (plugin === "@deepseek-ai/dsh-plan-mode") continue;
|
|
1454
|
+
const keys = plugin === "@deepseek-ai/dsh-persona" ? [
|
|
1455
|
+
"prefix",
|
|
1456
|
+
"text",
|
|
1457
|
+
"suffix"
|
|
1458
|
+
] : plugin === "@shuind/dsh-codex-harness" || plugin === SECTION_PLUGIN ? [] : [
|
|
1459
|
+
"prefix",
|
|
1460
|
+
"suffix",
|
|
1461
|
+
"text",
|
|
1462
|
+
"section",
|
|
1463
|
+
"prompt",
|
|
1464
|
+
"systemPrompt",
|
|
1465
|
+
"instructions"
|
|
1466
|
+
];
|
|
1467
|
+
for (const key of keys) {
|
|
1468
|
+
const node = config.get(key, true);
|
|
1469
|
+
if (!isScalar(node)) continue;
|
|
1470
|
+
fields.push({
|
|
1471
|
+
id: JSON.stringify([...path, key]),
|
|
1472
|
+
label: plugin === "@deepseek-ai/dsh-persona" ? key === "suffix" ? "Persona · suffix" : "Persona" : `${path.join(" / ")} · ${key}`,
|
|
1473
|
+
node,
|
|
1474
|
+
row: config,
|
|
1475
|
+
key
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
visit(doc.contents);
|
|
1481
|
+
return fields;
|
|
1482
|
+
}
|
|
1483
|
+
function sectionConfig(content) {
|
|
1484
|
+
if (supportsCodex(content)) {
|
|
1485
|
+
const value = harnessConfig(content).config.get("presetSections", true);
|
|
1486
|
+
return isMap(value) ? value : void 0;
|
|
1487
|
+
}
|
|
1488
|
+
const doc = yaml(content);
|
|
1489
|
+
if (!isSeq(doc.contents)) return void 0;
|
|
1490
|
+
const row = doc.contents.items.find((row) => isMap(row) && row.get("name") === SECTION_PLUGIN);
|
|
1491
|
+
const config = isMap(row) ? row.get("config", true) : void 0;
|
|
1492
|
+
return isMap(config) ? config : void 0;
|
|
1493
|
+
}
|
|
1494
|
+
/** Some presets intentionally shadow host prompt sections with empty entries. */
|
|
1495
|
+
function suppressesHostSections(content) {
|
|
1496
|
+
const doc = yaml(content);
|
|
1497
|
+
let suppressed = false;
|
|
1498
|
+
function visit(sequence) {
|
|
1499
|
+
if (!isSeq(sequence)) return;
|
|
1500
|
+
for (const row of sequence.items) {
|
|
1501
|
+
if (!isMap(row)) continue;
|
|
1502
|
+
const id = String(row.get("id") ?? "");
|
|
1503
|
+
const plugin = String(row.get("name") ?? "");
|
|
1504
|
+
if (id === "story-prompt-clean-slate" || plugin === "./tools/prompt/clean-slate.mjs" || /(?:^|[\\/])clean-slate\.mjs$/u.test(plugin)) {
|
|
1505
|
+
suppressed = true;
|
|
1506
|
+
return;
|
|
1507
|
+
}
|
|
1508
|
+
const config = row.get("config", true);
|
|
1509
|
+
if (isSeq(config)) visit(config);
|
|
1510
|
+
if (suppressed) return;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
visit(doc.contents);
|
|
1514
|
+
return suppressed;
|
|
1515
|
+
}
|
|
1516
|
+
function readPromptSections(content, shared = {}) {
|
|
1517
|
+
const codex = supportsCodex(content);
|
|
1518
|
+
const overrides = sectionConfig(content);
|
|
1519
|
+
const fields = promptFields(yaml(content));
|
|
1520
|
+
const sections = fields.map(({ id, label, node }) => ({
|
|
1521
|
+
id,
|
|
1522
|
+
label,
|
|
1523
|
+
text: String(node.value ?? ""),
|
|
1524
|
+
editable: !node.tag && typeof node.value === "string"
|
|
1525
|
+
}));
|
|
1526
|
+
const persona = sections.find((section) => section.label === "Persona");
|
|
1527
|
+
const personaOverride = !overrides?.has("persona") && codex ? shared.persona : void 0;
|
|
1528
|
+
if (persona && typeof personaOverride === "string" && personaOverride !== DEFAULT_CODEX_PERSONA) persona.text = personaOverride;
|
|
1529
|
+
const hasHostSections = !fields.some((field) => field.label.startsWith("Persona") && field.row.get("complete") === true) && !suppressesHostSections(content);
|
|
1530
|
+
if (hasHostSections) sections.splice(persona ? 1 : 0, 0, {
|
|
1531
|
+
id: "harness:source",
|
|
1532
|
+
label: "DSH Core 源码说明",
|
|
1533
|
+
text: String(overrides?.get("harnessSourcePrompt") ?? (codex ? shared.harnessSourcePrompt : void 0) ?? DEFAULT_DSH_CORE_SOURCE_PROMPT),
|
|
1534
|
+
editable: true
|
|
1535
|
+
}, {
|
|
1536
|
+
id: "app:web-surface",
|
|
1537
|
+
label: "DSH Core Web 说明",
|
|
1538
|
+
text: String(overrides?.get("webSurfacePrompt") ?? (codex ? shared.webSurfacePrompt : void 0) ?? DEFAULT_DSH_CORE_WEB_PROMPT),
|
|
1539
|
+
editable: true
|
|
1540
|
+
});
|
|
1541
|
+
if (codex) {
|
|
1542
|
+
const index = persona ? hasHostSections ? 3 : 1 : hasHostSections ? 2 : 0;
|
|
1543
|
+
sections.splice(index, 0, {
|
|
1544
|
+
id: "codex:base",
|
|
1545
|
+
label: "Codex 操作提示词",
|
|
1546
|
+
text: explicitPrompt(content) ?? shared.systemPrompt ?? DEFAULT_CODEX_SYSTEM_PROMPT,
|
|
1547
|
+
editable: true
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
1550
|
+
return sections;
|
|
1551
|
+
}
|
|
1552
|
+
/** Patch the contributing fields, not a disconnected secondary prompt. */
|
|
1553
|
+
function patchPromptSections(content, sections) {
|
|
1554
|
+
const doc = yaml(content);
|
|
1555
|
+
const fields = promptFields(doc);
|
|
1556
|
+
const known = new Map(readPromptSections(content).map((section) => [section.id, section]));
|
|
1557
|
+
const overrides = {};
|
|
1558
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1559
|
+
for (const section of sections) {
|
|
1560
|
+
const field = fields.find((field) => field.id === section.id);
|
|
1561
|
+
if (seen.has(section.id) || !known.get(section.id)?.editable && !(field && promptFile(field.node)) || typeof section.text !== "string" || section.text.length > 1e6) throw new Error("invalid-prompt-section");
|
|
1562
|
+
seen.add(section.id);
|
|
1563
|
+
if (field) {
|
|
1564
|
+
const node = new Scalar(section.text);
|
|
1565
|
+
node.type = Scalar.BLOCK_LITERAL;
|
|
1566
|
+
field.row.set(field.key, node);
|
|
1567
|
+
continue;
|
|
1568
|
+
}
|
|
1569
|
+
if (!supportsCodex(content) && known.get(section.id)?.text === section.text) continue;
|
|
1570
|
+
if (section.id === "harness:source") overrides.harnessSourcePrompt = section.text;
|
|
1571
|
+
if (section.id === "app:web-surface") overrides.webSurfacePrompt = section.text;
|
|
1572
|
+
}
|
|
1573
|
+
const personaFields = fields.filter((field) => known.get(field.id)?.label.startsWith("Persona"));
|
|
1574
|
+
if (supportsCodex(content) && personaFields.length) overrides.persona = personaFields.map((field) => sections.find((section) => section.id === field.id)?.text ?? String(field.node.value)).join("\n\n");
|
|
1575
|
+
let result = doc.toString({ lineWidth: 0 });
|
|
1576
|
+
if (supportsCodex(result)) {
|
|
1577
|
+
const { doc: next, config } = harnessConfig(result);
|
|
1578
|
+
const previous = config.get("presetSections", true);
|
|
1579
|
+
const merged = isMap(previous) ? previous : new YAMLMap();
|
|
1580
|
+
for (const [key, value] of Object.entries(overrides)) merged.set(key, value);
|
|
1581
|
+
config.set("presetSections", merged);
|
|
1582
|
+
result = next.toString({ lineWidth: 0 });
|
|
1583
|
+
const operating = sections.find((section) => section.id === "codex:base");
|
|
1584
|
+
if (operating) result = patchPresetComposition(result, operating.text);
|
|
1585
|
+
} else if (Object.keys(overrides).length) {
|
|
1586
|
+
const next = yaml(result);
|
|
1587
|
+
if (!isSeq(next.contents)) throw new Error("invalid-preset-yaml");
|
|
1588
|
+
let row = next.contents.items.find((row) => isMap(row) && row.get("name") === SECTION_PLUGIN);
|
|
1589
|
+
if (!isMap(row)) {
|
|
1590
|
+
const created = new YAMLMap();
|
|
1591
|
+
created.set("id", `prompt-sections-${randomUUID().slice(0, 8)}`);
|
|
1592
|
+
created.set("name", SECTION_PLUGIN);
|
|
1593
|
+
next.add(created);
|
|
1594
|
+
row = created;
|
|
1595
|
+
}
|
|
1596
|
+
const map = row;
|
|
1597
|
+
let config = map.get("config", true);
|
|
1598
|
+
if (!isMap(config)) {
|
|
1599
|
+
config = new YAMLMap();
|
|
1600
|
+
map.set("config", config);
|
|
1601
|
+
}
|
|
1602
|
+
for (const [key, value] of Object.entries(overrides)) config.set(key, value);
|
|
1603
|
+
result = next.toString({ lineWidth: 0 });
|
|
1604
|
+
}
|
|
1605
|
+
return result;
|
|
1606
|
+
}
|
|
1433
1607
|
function readCodexPresetOptions(content) {
|
|
1434
1608
|
try {
|
|
1435
1609
|
const { config } = harnessConfig(content);
|
|
@@ -1562,13 +1736,32 @@ async function assertWithinRoot(path, roots) {
|
|
|
1562
1736
|
throw new Error("preset-outside-user-root");
|
|
1563
1737
|
}
|
|
1564
1738
|
var CodexPresetEditor = class extends TypertRemoteService {
|
|
1565
|
-
static inject = ["agentPresets"];
|
|
1739
|
+
static inject = ["agentPresets", "settings"];
|
|
1566
1740
|
agentPresets;
|
|
1741
|
+
sharedSettings;
|
|
1742
|
+
indexed;
|
|
1567
1743
|
constructor(ctx, _config) {
|
|
1568
1744
|
super(ctx, "codexPresetEditor");
|
|
1569
1745
|
this.agentPresets = ctx.get("agentPresets");
|
|
1746
|
+
const settings = ctx.get("settings");
|
|
1747
|
+
this.sharedSettings = () => settings?.get("codex") ?? {};
|
|
1570
1748
|
}
|
|
1571
1749
|
async catalog() {
|
|
1750
|
+
if (this.agentPresets.list) {
|
|
1751
|
+
const rows = await this.agentPresets.list();
|
|
1752
|
+
this.indexed = new Map(rows.map((row) => [row.id, row]));
|
|
1753
|
+
return {
|
|
1754
|
+
presets: rows.filter((row) => row.broken === void 0).map((row) => ({
|
|
1755
|
+
id: row.id,
|
|
1756
|
+
name: row.name || row.id,
|
|
1757
|
+
description: row.description ?? "",
|
|
1758
|
+
editable: row.trust === "user",
|
|
1759
|
+
isDefault: row.id === this.agentPresets.defaultId
|
|
1760
|
+
})),
|
|
1761
|
+
authorable: this.agentPresets.authorable ?? false,
|
|
1762
|
+
excludedCount: rows.filter((row) => row.broken !== void 0).length
|
|
1763
|
+
};
|
|
1764
|
+
}
|
|
1572
1765
|
const roster = await this.agentPresets.remoteExportList();
|
|
1573
1766
|
const presets = roster.presets.filter((row) => row.broken === void 0).map((row) => ({
|
|
1574
1767
|
id: row.id,
|
|
@@ -1584,24 +1777,41 @@ var CodexPresetEditor = class extends TypertRemoteService {
|
|
|
1584
1777
|
};
|
|
1585
1778
|
}
|
|
1586
1779
|
async read(id) {
|
|
1587
|
-
const preset = await this.preset(id);
|
|
1588
|
-
|
|
1589
|
-
const metadata = await optionalFile(resolve(dirname(preset.path), "preset.yml"));
|
|
1780
|
+
const preset = this.indexed?.get(id) ?? await this.preset(id);
|
|
1781
|
+
if (preset.broken !== void 0) throw new Error("invalid-preset");
|
|
1782
|
+
const [composition, metadata] = await Promise.all([readFile(preset.path, "utf8"), optionalFile(resolve(dirname(preset.path), "preset.yml"))]);
|
|
1590
1783
|
const meta = metadata ? yaml(metadata) : void 0;
|
|
1591
1784
|
validateComposition(composition);
|
|
1592
1785
|
const codex = supportsCodex(composition);
|
|
1593
1786
|
const prompt = codex ? explicitPrompt(composition) : void 0;
|
|
1787
|
+
const shared = this.sharedSettings?.() ?? {};
|
|
1788
|
+
const promptSections = readPromptSections(composition, shared);
|
|
1789
|
+
for (const field of promptFields(yaml(composition))) {
|
|
1790
|
+
const reference = promptFile(field.node);
|
|
1791
|
+
if (!reference) continue;
|
|
1792
|
+
const section = promptSections.find((section) => section.id === field.id);
|
|
1793
|
+
try {
|
|
1794
|
+
const root = await realpath(dirname(preset.path));
|
|
1795
|
+
const target = await realpath(resolve(root, reference));
|
|
1796
|
+
const rel = relative(root, target);
|
|
1797
|
+
if (isAbsolute(rel) || rel === ".." || rel.startsWith("../") || rel.startsWith("..\\")) continue;
|
|
1798
|
+
if ((await stat(target)).size > 1e6) continue;
|
|
1799
|
+
section.text = await readFile(target, "utf8");
|
|
1800
|
+
section.editable = true;
|
|
1801
|
+
} catch {}
|
|
1802
|
+
}
|
|
1594
1803
|
return {
|
|
1595
1804
|
id,
|
|
1596
1805
|
name: String(meta?.get("name") ?? id),
|
|
1597
1806
|
description: String(meta?.get("description") ?? ""),
|
|
1598
|
-
systemPrompt: prompt ?? DEFAULT_CODEX_SYSTEM_PROMPT,
|
|
1807
|
+
systemPrompt: prompt ?? shared.systemPrompt ?? DEFAULT_CODEX_SYSTEM_PROMPT,
|
|
1599
1808
|
inheritPrompt: prompt === void 0,
|
|
1600
1809
|
revision: revision(composition, metadata),
|
|
1601
1810
|
editable: preset.trust === "user",
|
|
1602
1811
|
codex,
|
|
1603
1812
|
codexOptions: readCodexPresetOptions(composition),
|
|
1604
|
-
composition
|
|
1813
|
+
composition,
|
|
1814
|
+
promptSections
|
|
1605
1815
|
};
|
|
1606
1816
|
}
|
|
1607
1817
|
async create(rawInput) {
|
|
@@ -1648,6 +1858,7 @@ var CodexPresetEditor = class extends TypertRemoteService {
|
|
|
1648
1858
|
nextComposition = patchPresetComposition(nextComposition, input.systemPrompt, input.inheritPrompt);
|
|
1649
1859
|
if (input.codexOptions !== void 0) nextComposition = patchCodexPresetOptions(nextComposition, input.codexOptions);
|
|
1650
1860
|
}
|
|
1861
|
+
if (input.promptSections) nextComposition = patchPromptSections(nextComposition, input.promptSections);
|
|
1651
1862
|
validateComposition(nextComposition);
|
|
1652
1863
|
const nextMetadata = patchPresetMetadata(oldMetadata ?? "", input.name, input.description);
|
|
1653
1864
|
const compositionMode = await mode(composition);
|
|
@@ -1668,7 +1879,9 @@ var CodexPresetEditor = class extends TypertRemoteService {
|
|
|
1668
1879
|
mode: metadataMode,
|
|
1669
1880
|
dirMode: 448
|
|
1670
1881
|
});
|
|
1671
|
-
|
|
1882
|
+
const result = await this.agentPresets.resolve(input.id);
|
|
1883
|
+
if (result.broken !== void 0) throw new Error("invalid-preset-after-save");
|
|
1884
|
+
this.indexed?.set(input.id, result);
|
|
1672
1885
|
return await this.read(input.id);
|
|
1673
1886
|
} catch (error) {
|
|
1674
1887
|
await writeFileAtomic(composition, oldComposition, {
|
|
@@ -1690,6 +1903,8 @@ var CodexPresetEditor = class extends TypertRemoteService {
|
|
|
1690
1903
|
if (!PRESET_ID.test(id)) throw new Error("invalid-preset-id");
|
|
1691
1904
|
const preset = await this.agentPresets.resolve(id);
|
|
1692
1905
|
if (preset.broken !== void 0) throw new Error("invalid-preset");
|
|
1906
|
+
this.indexed ??= /* @__PURE__ */ new Map();
|
|
1907
|
+
this.indexed.set(id, preset);
|
|
1693
1908
|
return preset;
|
|
1694
1909
|
}
|
|
1695
1910
|
};
|
|
@@ -1715,6 +1930,34 @@ for (const method of [
|
|
|
1715
1930
|
"create"
|
|
1716
1931
|
]) markRemoteMethod(method);
|
|
1717
1932
|
//#endregion
|
|
1933
|
+
//#region lib/types/prompt-sections.js
|
|
1934
|
+
const Config$1 = z.object({
|
|
1935
|
+
persona: z.string(),
|
|
1936
|
+
harnessSourcePrompt: z.string(),
|
|
1937
|
+
webSurfacePrompt: z.string()
|
|
1938
|
+
});
|
|
1939
|
+
/** Override only existing sections; dynamic runtime context and tool guidance remain host-owned. */
|
|
1940
|
+
function applyPromptSections(assembly, config) {
|
|
1941
|
+
const variables = { ...assembly.variables };
|
|
1942
|
+
variables.sourceRoot ??= assembly.sections.find((s) => s.name === "harness:source")?.text.match(/^The DeepSeek Harness implementation checkout is at (.+?)\. The checkout location/u)?.[1];
|
|
1943
|
+
variables.webUrl ??= assembly.sections.find((s) => s.name === "app:web-surface")?.text.match(/^You are interacting with the user through the DeepSeek Harness Web GUI at (.+?)\. When/u)?.[1];
|
|
1944
|
+
const values = {
|
|
1945
|
+
"deployment:persona": config.persona,
|
|
1946
|
+
"harness:source": config.harnessSourcePrompt,
|
|
1947
|
+
"app:web-surface": config.webSurfacePrompt
|
|
1948
|
+
};
|
|
1949
|
+
return {
|
|
1950
|
+
...assembly,
|
|
1951
|
+
sections: assembly.sections.map((section) => {
|
|
1952
|
+
const text = values[section.name];
|
|
1953
|
+
return text === void 0 ? section : {
|
|
1954
|
+
...section,
|
|
1955
|
+
text: text.replace(/\{\{([\w.-]+)\}\}/g, (whole, key) => variables[key] ?? whole)
|
|
1956
|
+
};
|
|
1957
|
+
})
|
|
1958
|
+
};
|
|
1959
|
+
}
|
|
1960
|
+
//#endregion
|
|
1718
1961
|
//#region lib/types/index.js
|
|
1719
1962
|
/** Codex-compatible prompt overlay and core tools for a dsh agent preset. */
|
|
1720
1963
|
const name = "codex";
|
|
@@ -1753,6 +1996,7 @@ const Config = z.object({
|
|
|
1753
1996
|
remoteCompact: z.boolean().default(true),
|
|
1754
1997
|
systemPrompt: z.string().default(DEFAULT_CODEX_SYSTEM_PROMPT),
|
|
1755
1998
|
presetPrompt: z.string(),
|
|
1999
|
+
presetSections: Config$1,
|
|
1756
2000
|
promptEnabled: z.boolean(),
|
|
1757
2001
|
terminalToolsEnabled: z.boolean(),
|
|
1758
2002
|
patchToolEnabled: z.boolean(),
|
|
@@ -2498,7 +2742,7 @@ function apply(ctx, config = {}) {
|
|
|
2498
2742
|
}));
|
|
2499
2743
|
}
|
|
2500
2744
|
if (resolved.codexCore) {
|
|
2501
|
-
ctx.on("system-prompt/assemble", async (_assembly, _context, next) => applyCodexCapabilitySettings(await next(), codexSettings.current()));
|
|
2745
|
+
ctx.on("system-prompt/assemble", async (_assembly, _context, next) => applyPromptSections(applyCodexCapabilitySettings(await next(), codexSettings.current()), config.presetSections ?? {}));
|
|
2502
2746
|
ctx.systemPrompt.section({
|
|
2503
2747
|
name: "codex:base",
|
|
2504
2748
|
order: 10,
|
package/lib/typert.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region lib/types/typert.host.js
|
|
3
|
+
const PACKAGE = "@shuind/dsh-codex-harness";
|
|
4
|
+
const SERVICE = "codexPresetEditor";
|
|
5
|
+
const promptSections = z.array(z.object({
|
|
6
|
+
id: z.string(),
|
|
7
|
+
label: z.string(),
|
|
8
|
+
text: z.string().max(1e6),
|
|
9
|
+
editable: z.boolean(),
|
|
10
|
+
suppressed: z.boolean().optional()
|
|
11
|
+
})).max(200);
|
|
12
|
+
const fields = {
|
|
13
|
+
name: z.string().max(200),
|
|
14
|
+
description: z.string().max(4e3),
|
|
15
|
+
systemPrompt: z.string().max(1e6),
|
|
16
|
+
inheritPrompt: z.boolean()
|
|
17
|
+
};
|
|
18
|
+
const codexOptions = z.object({
|
|
19
|
+
promptEnabled: z.boolean(),
|
|
20
|
+
terminalToolsEnabled: z.boolean(),
|
|
21
|
+
patchToolEnabled: z.boolean(),
|
|
22
|
+
planToolEnabled: z.boolean(),
|
|
23
|
+
hostedWebSearchEnabled: z.boolean(),
|
|
24
|
+
remoteCompactionEnabled: z.boolean()
|
|
25
|
+
});
|
|
26
|
+
const document = z.object({
|
|
27
|
+
...fields,
|
|
28
|
+
id: z.string(),
|
|
29
|
+
revision: z.string(),
|
|
30
|
+
editable: z.boolean(),
|
|
31
|
+
codex: z.boolean(),
|
|
32
|
+
codexOptions,
|
|
33
|
+
promptSections,
|
|
34
|
+
composition: z.string()
|
|
35
|
+
});
|
|
36
|
+
const catalog = z.object({
|
|
37
|
+
presets: z.array(z.object({
|
|
38
|
+
id: z.string(),
|
|
39
|
+
name: z.string(),
|
|
40
|
+
description: z.string(),
|
|
41
|
+
editable: z.boolean(),
|
|
42
|
+
isDefault: z.boolean()
|
|
43
|
+
})),
|
|
44
|
+
authorable: z.boolean(),
|
|
45
|
+
excludedCount: z.number()
|
|
46
|
+
});
|
|
47
|
+
const codexOptionsPatch = codexOptions.partial();
|
|
48
|
+
function descriptor(method, parameter, input, output) {
|
|
49
|
+
const id = `${PACKAGE}#${SERVICE}/${method}`;
|
|
50
|
+
return {
|
|
51
|
+
id,
|
|
52
|
+
service: SERVICE,
|
|
53
|
+
namespace: SERVICE,
|
|
54
|
+
method,
|
|
55
|
+
invocation: { kind: "direct" },
|
|
56
|
+
parameters: parameter === void 0 ? [] : [{
|
|
57
|
+
name: parameter,
|
|
58
|
+
wire: parameter,
|
|
59
|
+
source: "json",
|
|
60
|
+
codec: {
|
|
61
|
+
mode: "strict",
|
|
62
|
+
typeSymbol: `${id}:${parameter}`,
|
|
63
|
+
schema: input
|
|
64
|
+
}
|
|
65
|
+
}],
|
|
66
|
+
result: {
|
|
67
|
+
mode: "strict",
|
|
68
|
+
typeSymbol: `${id}:result`,
|
|
69
|
+
schema: output
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const updateInput = z.object({
|
|
74
|
+
...fields,
|
|
75
|
+
id: z.string(),
|
|
76
|
+
revision: z.string().optional(),
|
|
77
|
+
composition: z.string().max(1e6).optional(),
|
|
78
|
+
enableCodex: z.boolean().optional(),
|
|
79
|
+
promptSections: promptSections.optional(),
|
|
80
|
+
codexOptions: codexOptionsPatch.optional()
|
|
81
|
+
});
|
|
82
|
+
const createInput = z.object({
|
|
83
|
+
...fields,
|
|
84
|
+
sourceId: z.string(),
|
|
85
|
+
enableCodex: z.boolean().optional(),
|
|
86
|
+
composition: z.string().max(1e6).optional(),
|
|
87
|
+
promptSections: promptSections.optional(),
|
|
88
|
+
codexOptions: codexOptionsPatch.optional()
|
|
89
|
+
});
|
|
90
|
+
/** Host-side Remote contract consumed by the browser's preset editor. */
|
|
91
|
+
const TYPERT = {
|
|
92
|
+
package: PACKAGE,
|
|
93
|
+
face: "host",
|
|
94
|
+
schemas: [],
|
|
95
|
+
invocations: [
|
|
96
|
+
descriptor("catalog", void 0, z.unknown(), catalog),
|
|
97
|
+
descriptor("read", "id", z.string(), document),
|
|
98
|
+
descriptor("update", "rawInput", updateInput, document),
|
|
99
|
+
descriptor("create", "rawInput", createInput, document)
|
|
100
|
+
],
|
|
101
|
+
model: {
|
|
102
|
+
services: [{
|
|
103
|
+
description: "Author and inspect DSH agent presets with Codex capabilities.",
|
|
104
|
+
summary: "Codex preset editor.",
|
|
105
|
+
tags: [],
|
|
106
|
+
jsDoc: "",
|
|
107
|
+
key: SERVICE,
|
|
108
|
+
exportName: "CodexPresetEditor",
|
|
109
|
+
members: [],
|
|
110
|
+
types: []
|
|
111
|
+
}],
|
|
112
|
+
events: [],
|
|
113
|
+
objects: []
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
//#endregion
|
|
117
|
+
export { TYPERT, TYPERT as default };
|
|
@@ -33,7 +33,7 @@ declare const en: {
|
|
|
33
33
|
readonly contextSizeDescription: "Next request capacity in K tokens.";
|
|
34
34
|
readonly contextRestore: "Restore model default";
|
|
35
35
|
readonly promptCardTitle: "Codex Harness";
|
|
36
|
-
readonly promptCardDescription: "Edit presets and
|
|
36
|
+
readonly promptCardDescription: "Edit presets, Codex capabilities, and the operating prompt. Activity status is global.";
|
|
37
37
|
readonly otherCapabilitiesLabel: "Global capabilities";
|
|
38
38
|
readonly capabilityPrompt: "Codex operating prompt";
|
|
39
39
|
readonly capabilityPromptHint: "Inject the editable instructions and persona-first prompt layout.";
|
|
@@ -53,13 +53,39 @@ declare const en: {
|
|
|
53
53
|
readonly capabilityCompactionHint: "Prefer the provider Responses compact endpoint before local compaction.";
|
|
54
54
|
readonly capabilityActivity: "Activity indicator";
|
|
55
55
|
readonly capabilityActivityHint: "Show request, reply, and compaction status beside the conversation.";
|
|
56
|
+
readonly promptCustomizationLabel: "Prompt customization";
|
|
57
|
+
readonly personaLabel: "Persona";
|
|
58
|
+
readonly personaHint: "Deployment identity and role. Supports {{model}} and {{cwd}}.";
|
|
59
|
+
readonly sourcePromptLabel: "DSH Core source instructions";
|
|
60
|
+
readonly sourcePromptHint: "Guidance about the DSH checkout and working directory. Supports {{sourceRoot}}.";
|
|
61
|
+
readonly webPromptLabel: "DSH Core Web instructions";
|
|
62
|
+
readonly webPromptHint: "Guidance about this Web GUI, HMR, builds, and verification. Supports {{webUrl}}.";
|
|
63
|
+
readonly promptRestoreAll: "Restore all prompt defaults";
|
|
56
64
|
readonly promptLabel: "Codex operating prompt";
|
|
65
|
+
readonly promptHint: "This is the Codex operating prompt. Persona and DSH Core instructions are edited separately above.";
|
|
66
|
+
readonly promptUnsaved: "Unsaved";
|
|
67
|
+
readonly promptDiscard: "Discard";
|
|
68
|
+
readonly promptSave: "Save";
|
|
69
|
+
readonly promptSaving: "Saving...";
|
|
70
|
+
readonly promptSaveFailed: "Could not save the prompt.";
|
|
57
71
|
readonly promptExpand: "Expand settings";
|
|
58
72
|
readonly promptCollapse: "Collapse settings";
|
|
59
73
|
readonly promptReadOnly: "This settings document is read-only.";
|
|
60
74
|
readonly activityCompacting: "Compacting context...";
|
|
61
75
|
readonly activityRequestingModel: "Requesting model...";
|
|
62
76
|
readonly activityModelReply: "Model replying...";
|
|
77
|
+
readonly peConnectionError: "Could not connect to the local service. Retry loading; if the connection still fails, reconnect the page.";
|
|
78
|
+
readonly peReadError: "Could not read this preset. Retry loading or refresh the preset list.";
|
|
79
|
+
readonly peRetryRead: "Retry loading";
|
|
80
|
+
readonly peReconnect: "Reconnect page";
|
|
81
|
+
readonly peSystemPrompt: "System prompt sections";
|
|
82
|
+
readonly peSectionsHint: "These templates contribute to this preset’s system prompt before the tools. Runtime variables, workspace instructions and plugin-provided guidance are assembled when the conversation runs.";
|
|
83
|
+
readonly peDynamicPrompt: "This field is an expression; it is preserved without executing it in the editor.";
|
|
84
|
+
readonly peDshSourcePrompt: "Tells the agent where the DSH source checkout is and keeps it separate from the current workspace. It is used when inspecting or extending DSH itself.";
|
|
85
|
+
readonly peDshWebPrompt: "Tells the agent which Web page it is talking through, what “this page” means, and when Web changes need a rebuild or refresh.";
|
|
86
|
+
readonly peSuppressed: "Not used";
|
|
87
|
+
readonly peCompletePersona: "This preset uses Persona as its entire system prompt, so this section is excluded.";
|
|
88
|
+
readonly peLoading: "Reading preset…";
|
|
63
89
|
readonly peTitle: "Preset editor";
|
|
64
90
|
readonly peHierarchy: "Codex mode and other presets are peers. Choose one to edit, or make an editable copy of a built-in preset first.";
|
|
65
91
|
readonly peSelect: "Preset";
|
|
@@ -114,7 +140,7 @@ interface InputSettingsControlInjected {
|
|
|
114
140
|
unsetSetting: (field: string) => Promise<void>;
|
|
115
141
|
presetManager: PresetManagerActions;
|
|
116
142
|
}
|
|
117
|
-
/**
|
|
143
|
+
/** One editor per preset; only display preferences are global. */
|
|
118
144
|
export declare function PromptSettingsCard(props: PropsRuntime<'settings.plugin.item'> & InjectFace<InputSettingsControlInjected> & PropsLocale<'codex'>): import("react").JSX.Element | null;
|
|
119
145
|
type LegacyOverlayProps = PropsRuntime<typeof LEGACY_OVERLAY_SLOT> & InjectFace<InputSettingsControlInjected> & PropsLocale<'codex'>;
|
|
120
146
|
type ActivityProps = Pick<LegacyOverlayProps, 'sessionId' | 'useSession' | 'useSessions' | 'useProjection' | 'useSettings' | 't'>;
|
|
@@ -24,7 +24,7 @@ const en = {
|
|
|
24
24
|
contextSizeDescription: 'Next request capacity in K tokens.',
|
|
25
25
|
contextRestore: 'Restore model default',
|
|
26
26
|
promptCardTitle: 'Codex Harness',
|
|
27
|
-
promptCardDescription: 'Edit presets and
|
|
27
|
+
promptCardDescription: 'Edit presets, Codex capabilities, and the operating prompt. Activity status is global.',
|
|
28
28
|
otherCapabilitiesLabel: 'Global capabilities',
|
|
29
29
|
capabilityPrompt: 'Codex operating prompt',
|
|
30
30
|
capabilityPromptHint: 'Inject the editable instructions and persona-first prompt layout.',
|
|
@@ -44,7 +44,21 @@ const en = {
|
|
|
44
44
|
capabilityCompactionHint: 'Prefer the provider Responses compact endpoint before local compaction.',
|
|
45
45
|
capabilityActivity: 'Activity indicator',
|
|
46
46
|
capabilityActivityHint: 'Show request, reply, and compaction status beside the conversation.',
|
|
47
|
+
promptCustomizationLabel: 'Prompt customization',
|
|
48
|
+
personaLabel: 'Persona',
|
|
49
|
+
personaHint: 'Deployment identity and role. Supports {{model}} and {{cwd}}.',
|
|
50
|
+
sourcePromptLabel: 'DSH Core source instructions',
|
|
51
|
+
sourcePromptHint: 'Guidance about the DSH checkout and working directory. Supports {{sourceRoot}}.',
|
|
52
|
+
webPromptLabel: 'DSH Core Web instructions',
|
|
53
|
+
webPromptHint: 'Guidance about this Web GUI, HMR, builds, and verification. Supports {{webUrl}}.',
|
|
54
|
+
promptRestoreAll: 'Restore all prompt defaults',
|
|
47
55
|
promptLabel: 'Codex operating prompt',
|
|
56
|
+
promptHint: 'This is the Codex operating prompt. Persona and DSH Core instructions are edited separately above.',
|
|
57
|
+
promptUnsaved: 'Unsaved',
|
|
58
|
+
promptDiscard: 'Discard',
|
|
59
|
+
promptSave: 'Save',
|
|
60
|
+
promptSaving: 'Saving...',
|
|
61
|
+
promptSaveFailed: 'Could not save the prompt.',
|
|
48
62
|
promptExpand: 'Expand settings',
|
|
49
63
|
promptCollapse: 'Collapse settings',
|
|
50
64
|
promptReadOnly: 'This settings document is read-only.',
|
|
@@ -63,7 +77,7 @@ const zh = {
|
|
|
63
77
|
contextSizeDescription: '\u8bbe\u7f6e\u4e0b\u6b21\u8bf7\u6c42\u7684\u4e0a\u4e0b\u6587\u5bb9\u91cf\uff0c\u5355\u4f4d\u4e3a K tokens\u3002',
|
|
64
78
|
contextRestore: '\u6062\u590d\u6a21\u578b\u9ed8\u8ba4\u503c',
|
|
65
79
|
promptCardTitle: 'Codex Harness',
|
|
66
|
-
promptCardDescription: '\u7f16\u8f91\u9884\u8bbe\
|
|
80
|
+
promptCardDescription: '\u7f16\u8f91\u9884\u8bbe\u3001Codex \u80fd\u529b\u548c\u64cd\u4f5c\u63d0\u793a\u8bcd\uff0c\u6d3b\u52a8\u72b6\u6001\u662f\u5168\u5c40\u8bbe\u7f6e\u3002',
|
|
67
81
|
otherCapabilitiesLabel: '\u5168\u5c40\u80fd\u529b',
|
|
68
82
|
capabilityPrompt: 'Codex \u64cd\u4f5c\u63d0\u793a\u8bcd',
|
|
69
83
|
capabilityPromptHint: '\u6ce8\u5165\u53ef\u7f16\u8f91\u6307\u4ee4\uff0c\u5e76\u5c06 Persona \u653e\u5728\u63d0\u793a\u8bcd\u9996\u4f4d\u3002',
|
|
@@ -83,7 +97,21 @@ const zh = {
|
|
|
83
97
|
capabilityCompactionHint: '\u4f18\u5148\u8c03\u7528\u63d0\u4f9b\u5546\u7684 Responses compact \u7aef\u70b9\uff0c\u5931\u8d25\u65f6\u56de\u9000\u672c\u5730\u538b\u7f29\u3002',
|
|
84
98
|
capabilityActivity: '\u6d3b\u52a8\u72b6\u6001',
|
|
85
99
|
capabilityActivityHint: '\u5728\u5bf9\u8bdd\u65c1\u663e\u793a\u8bf7\u6c42\u3001\u56de\u590d\u548c\u538b\u7f29\u72b6\u6001\u3002',
|
|
100
|
+
promptCustomizationLabel: '\u63d0\u793a\u8bcd\u5b9a\u5236',
|
|
101
|
+
personaLabel: 'Persona',
|
|
102
|
+
personaHint: '\u5b9a\u4e49 Agent \u7684\u8eab\u4efd\u4e0e\u89d2\u8272,\u652f\u6301 {{model}} \u548c {{cwd}}。',
|
|
103
|
+
sourcePromptLabel: 'DSH Core \u6e90\u7801\u8bf4\u660e',
|
|
104
|
+
sourcePromptHint: '\u8bf4\u660e DSH \u6e90\u7801\u68c0\u51fa\u76ee\u5f55\u4e0e\u5de5\u4f5c\u76ee\u5f55,\u652f\u6301 {{sourceRoot}}。',
|
|
105
|
+
webPromptLabel: 'DSH Core Web \u8bf4\u660e',
|
|
106
|
+
webPromptHint: '\u8bf4\u660e Web GUI、HMR、\u6784\u5efa\u4e0e\u9a8c\u8bc1,\u652f\u6301 {{webUrl}}。',
|
|
107
|
+
promptRestoreAll: '\u6062\u590d\u6240\u6709\u63d0\u793a\u8bcd\u9ed8\u8ba4\u503c',
|
|
86
108
|
promptLabel: 'Codex \u64cd\u4f5c\u63d0\u793a\u8bcd',
|
|
109
|
+
promptHint: '\u8fd9\u662f Codex \u64cd\u4f5c\u63d0\u793a\u8bcd。Persona \u548c DSH Core \u8bf4\u660e\u5728\u4e0a\u65b9\u5206\u522b\u7f16\u8f91。',
|
|
110
|
+
promptUnsaved: '\u672a\u4fdd\u5b58',
|
|
111
|
+
promptDiscard: '\u653e\u5f03',
|
|
112
|
+
promptSave: '\u4fdd\u5b58',
|
|
113
|
+
promptSaving: '\u4fdd\u5b58\u4e2d...',
|
|
114
|
+
promptSaveFailed: '\u63d0\u793a\u8bcd\u4fdd\u5b58\u5931\u8d25。',
|
|
87
115
|
promptExpand: '\u5c55\u5f00\u8bbe\u7f6e',
|
|
88
116
|
promptCollapse: '\u6536\u8d77\u8bbe\u7f6e',
|
|
89
117
|
promptReadOnly: '\u5f53\u524d\u8bbe\u7f6e\u6587\u4ef6\u4e3a\u53ea\u8bfb\u3002',
|
|
@@ -100,72 +128,14 @@ function CapabilityToggle({ field, label, hint, enabled, disabled, setSetting, }
|
|
|
100
128
|
cursor: disabled ? 'default' : 'pointer',
|
|
101
129
|
}, 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)' } })] }));
|
|
102
130
|
}
|
|
103
|
-
/**
|
|
104
|
-
function CapabilityGroup({ id, label, children, accent }) {
|
|
105
|
-
const [open, setOpen] = useState(false);
|
|
106
|
-
const panelId = `${id}-panel`;
|
|
107
|
-
return (_jsxs("section", { style: {
|
|
108
|
-
display: 'grid',
|
|
109
|
-
gap: open ? 4 : 0,
|
|
110
|
-
}, children: [_jsxs("button", { type: "button", "aria-expanded": open, "aria-controls": panelId, onClick: () => { setOpen(!open); }, style: {
|
|
111
|
-
display: 'flex',
|
|
112
|
-
alignItems: 'center',
|
|
113
|
-
gap: 7,
|
|
114
|
-
width: '100%',
|
|
115
|
-
padding: 0,
|
|
116
|
-
border: 0,
|
|
117
|
-
background: 'none',
|
|
118
|
-
color: 'var(--dsw-alias-label-secondary)',
|
|
119
|
-
font: 'inherit',
|
|
120
|
-
textAlign: 'left',
|
|
121
|
-
cursor: 'pointer',
|
|
122
|
-
}, children: [_jsx("span", { "aria-hidden": "true", style: {
|
|
123
|
-
width: 6,
|
|
124
|
-
height: 6,
|
|
125
|
-
flex: '0 0 auto',
|
|
126
|
-
borderRadius: 999,
|
|
127
|
-
background: accent,
|
|
128
|
-
} }), _jsx("strong", { style: {
|
|
129
|
-
color: 'var(--dsw-alias-label-secondary)',
|
|
130
|
-
fontSize: 14,
|
|
131
|
-
fontWeight: 600,
|
|
132
|
-
letterSpacing: '0.01em',
|
|
133
|
-
}, children: label }), _jsx("span", { "aria-hidden": "true", style: { color: 'var(--dsw-alias-label-tertiary)', fontSize: 16 }, children: open ? '-' : '+' })] }), open && (_jsx("div", { id: panelId, style: {
|
|
134
|
-
display: 'grid',
|
|
135
|
-
marginLeft: 5,
|
|
136
|
-
paddingLeft: 12,
|
|
137
|
-
}, children: children }))] }));
|
|
138
|
-
}
|
|
139
|
-
/** Preset editor and global activity control contributed to Settings > Plugins. */
|
|
131
|
+
/** One editor per preset; only display preferences are global. */
|
|
140
132
|
export function PromptSettingsCard(props) {
|
|
141
133
|
const { useSettings, setSetting, presetManager, t } = props;
|
|
142
134
|
const snapshot = useSettings(state => state);
|
|
143
|
-
const otherCapabilities = [
|
|
144
|
-
{ field: 'activityIndicatorEnabled', label: 'capabilityActivity', hint: 'capabilityActivityHint' },
|
|
145
|
-
];
|
|
146
135
|
const [open, setOpen] = useState(false);
|
|
147
136
|
if (snapshot.status === 'unavailable')
|
|
148
137
|
return null;
|
|
149
|
-
|
|
150
|
-
return (_jsxs("li", { style: {
|
|
151
|
-
listStyle: 'none',
|
|
152
|
-
border: '1px solid var(--dsw-alias-border-l2)',
|
|
153
|
-
borderRadius: 12,
|
|
154
|
-
background: open ? 'var(--dsw-alias-bg-layer-2)' : 'var(--dsw-alias-bg-layer-3)',
|
|
155
|
-
overflow: 'hidden',
|
|
156
|
-
}, children: [_jsxs("button", { type: "button", "aria-expanded": open, "aria-label": `${t(open ? 'promptCollapse' : 'promptExpand')}: ${t('promptCardTitle')}`, onClick: () => { setOpen(!open); }, style: {
|
|
157
|
-
width: '100%',
|
|
158
|
-
border: 0,
|
|
159
|
-
background: 'none',
|
|
160
|
-
color: 'inherit',
|
|
161
|
-
padding: '14px 16px',
|
|
162
|
-
display: 'flex',
|
|
163
|
-
alignItems: 'center',
|
|
164
|
-
gap: 12,
|
|
165
|
-
textAlign: 'left',
|
|
166
|
-
cursor: 'pointer',
|
|
167
|
-
font: 'inherit',
|
|
168
|
-
}, children: [_jsxs("span", { style: { flex: 1, minWidth: 0, display: 'flex', flexDirection: 'column', gap: 4 }, children: [_jsx("strong", { style: { fontSize: 15, lineHeight: 1.4 }, children: t('promptCardTitle') }), _jsx("span", { style: { color: 'var(--dsw-alias-label-tertiary)', fontSize: 13, lineHeight: 1.5 }, children: t('promptCardDescription') })] }), _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: [_jsx(PresetManagerCard, { presetManager: presetManager, t: t }), _jsxs("details", { style: { marginTop: 22, borderTop: '1px solid var(--dsw-alias-border-l2)', paddingTop: 14 }, children: [_jsx("summary", { style: { cursor: 'pointer', fontWeight: 600, marginBottom: 14 }, children: t('pmGlobalSettings') }), !snapshot.writable && (_jsx("p", { style: { margin: '0 0 10px', color: 'var(--dsw-alias-label-tertiary)', fontSize: 12 }, children: t('promptReadOnly') })), _jsx(CapabilityGroup, { id: "global-capabilities", label: t('otherCapabilitiesLabel'), accent: "var(--dsw-alias-label-tertiary)", children: otherCapabilities.map(renderCapability) })] })] }))] }));
|
|
138
|
+
return _jsxs("li", { style: { listStyle: 'none', border: '1px solid var(--dsw-alias-border-l2)', borderRadius: 12, overflow: 'hidden' }, children: [_jsxs("button", { type: "button", "aria-expanded": open, onClick: () => setOpen(!open), style: { width: '100%', padding: 16, textAlign: 'left', border: 0, background: 'none', color: 'inherit', cursor: 'pointer' }, children: [_jsx("strong", { children: t('promptCardTitle') }), _jsx("span", { style: { float: 'right' }, children: open ? '−' : '+' }), _jsx("p", { style: { marginBottom: 0 }, children: t('promptCardDescription') })] }), open && _jsxs("div", { style: { padding: 16, borderTop: '1px solid var(--dsw-alias-border-l2)' }, children: [_jsx(PresetManagerCard, { presetManager: presetManager, t: t }), _jsxs("details", { style: { marginTop: 22, borderTop: '1px solid var(--dsw-alias-border-l2)', paddingTop: 14 }, children: [_jsx("summary", { style: { cursor: 'pointer', fontWeight: 600 }, children: t('pmGlobalSettings') }), _jsx(CapabilityToggle, { field: "activityIndicatorEnabled", label: t('capabilityActivity'), hint: t('capabilityActivityHint'), enabled: snapshot.value?.activityIndicatorEnabled ?? true, disabled: !snapshot.writable, setSetting: setSetting })] })] })] });
|
|
169
139
|
}
|
|
170
140
|
/** The legacy composer seat is a compact inline row, not a menu panel. */
|
|
171
141
|
function FastModeFallback(props) {
|