@aiwayds/dsh-opentui 0.16.1 → 0.17.2

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.
@@ -989,10 +989,283 @@ var init_host_probe = __esm(() => {
989
989
  init_mux_frame();
990
990
  });
991
991
 
992
+ // src/client/append-system.ts
993
+ import { chmodSync as chmodSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync as unlinkSync2, writeFileSync as writeFileSync2 } from "fs";
994
+ import { homedir } from "os";
995
+ import { join as join3 } from "path";
996
+ function defaultDshHome() {
997
+ return process.env.DSH_HOME || join3(homedir(), ".dsh");
998
+ }
999
+ function appendSystemPath(home = defaultDshHome()) {
1000
+ return join3(home, "APPEND_SYSTEM.md");
1001
+ }
1002
+ function appendSystemPresetBlock() {
1003
+ return `${APPEND_SYSTEM_MARKER} \u2014 managed block (client-owned; the client appends it once and never rewrites other lines).
1004
+ ${APPEND_SYSTEM_MARKER} persona suffix = $DSH_HOME/APPEND_SYSTEM.md, evaluated by the host at boot (!!js guarded read; empty file => empty section => dropped).
1005
+ - insert:
1006
+ - id: ${APPEND_SYSTEM_ROW_ID}
1007
+ name: '@deepseek-ai/dsh-agent-preset'
1008
+ config:
1009
+ id: ${APPEND_SYSTEM_PRESET_ID}
1010
+ name: Standard + Append
1011
+ description: The shipped standard preset plus the user's APPEND_SYSTEM.md appended to the system prompt.
1012
+ order: 5
1013
+ plugins:
1014
+ - id: persona
1015
+ name: '@deepseek-ai/dsh-persona'
1016
+ config:
1017
+ prefix: You are a coding agent powered by the {{model}} model.
1018
+ suffix: !!js "${APPEND_SYSTEM_SUFFIX_EXPR}"
1019
+ - id: agent-instructions
1020
+ name: '@deepseek-ai/dsh-agent-instructions'
1021
+ config:
1022
+ maxBytes: 65536
1023
+ - id: time-context
1024
+ name: '@deepseek-ai/dsh-time-context'
1025
+ - id: tool-bash
1026
+ name: '@deepseek-ai/dsh-tool-bash'
1027
+ disabled: !!js process.platform === 'win32'
1028
+ - id: tool-pwsh
1029
+ name: '@deepseek-ai/dsh-tool-pwsh'
1030
+ disabled: !!js process.platform !== 'win32'
1031
+ - id: tool-fs
1032
+ name: '@deepseek-ai/dsh-tool-fs'
1033
+ config:
1034
+ # Set false to drop the apply_patch tool beside edit.
1035
+ applyPatch: false
1036
+ - id: tool-fs-search
1037
+ name: '@deepseek-ai/dsh-tool-fs-search'
1038
+ config:
1039
+ sampleOverCapGlobResults: false
1040
+ - id: tool-jobs
1041
+ name: '@deepseek-ai/dsh-tool-jobs'
1042
+ - id: tool-schedule
1043
+ name: '@deepseek-ai/dsh-tool-schedule'
1044
+ - id: skill-filesystem
1045
+ name: '@deepseek-ai/dsh-skill-filesystem'
1046
+ config:
1047
+ customSkillDirs:
1048
+ - !!js process.getBuiltinModule('node:path').join(process.getBuiltinModule('node:path').dirname(process.getBuiltinModule('node:module').createRequire(baseUrl).resolve('@deepseek-ai/dsh-agent-preset/package.json')), 'skills')
1049
+ - id: tool-skill
1050
+ name: '@deepseek-ai/dsh-tool-skill'
1051
+ - id: command-goal
1052
+ name: '@deepseek-ai/dsh-command-goal'
1053
+ - id: tool-goal
1054
+ name: '@deepseek-ai/dsh-tool-goal'
1055
+ - id: planning
1056
+ name: cordis:group
1057
+ group: true
1058
+ isolate:
1059
+ planMode: true
1060
+ config:
1061
+ - id: plan-mode
1062
+ name: '@deepseek-ai/dsh-plan-mode'
1063
+ config:
1064
+ section: |
1065
+ You are in plan mode. Stay in plan mode until the user approves your plan through exit_plan_mode or switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement \u2014 including an answer confirming something you asked \u2014 approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
1066
+
1067
+ Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
1068
+
1069
+ The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
1070
+
1071
+ Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
1072
+
1073
+ Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
1074
+
1075
+ When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
1076
+ - id: compaction
1077
+ name: cordis:group
1078
+ group: true
1079
+ isolate:
1080
+ compaction: true
1081
+ toolResultPruner: true
1082
+ config:
1083
+ - id: compaction-basic
1084
+ name: '@deepseek-ai/dsh-compaction-basic'
1085
+ - id: command-compact
1086
+ name: '@deepseek-ai/dsh-command-compact'
1087
+ - id: tool-result-pruner
1088
+ name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
1089
+ config:
1090
+ thresholdChars: 8192
1091
+ headChars: 4096
1092
+ tailChars: 1024
1093
+ - id: delegation
1094
+ name: cordis:group
1095
+ group: true
1096
+ isolate:
1097
+ workflowEngine: true
1098
+ config:
1099
+ - id: tool-subagent-control
1100
+ name: '@deepseek-ai/dsh-tool-subagent-control'
1101
+ config:
1102
+ interrupt: false
1103
+ - id: tool-subagent
1104
+ name: '@deepseek-ai/dsh-tool-subagent'
1105
+ config:
1106
+ provider: spawn
1107
+ toolName: subagent
1108
+ modelSelection: true
1109
+ modelDiscovery: true
1110
+ - id: tool-subagent-fork
1111
+ name: '@deepseek-ai/dsh-tool-subagent'
1112
+ config:
1113
+ provider: fork
1114
+ toolName: subagent_fork
1115
+ - id: workflow-ptc
1116
+ name: '@deepseek-ai/dsh-workflow-ptc'
1117
+ config:
1118
+ provider: spawn
1119
+ - id: tool-workflow
1120
+ name: '@deepseek-ai/dsh-tool-workflow'
1121
+ - id: tool-ask-user
1122
+ name: '@deepseek-ai/dsh-tool-ask-user'
1123
+ - id: tool-todo
1124
+ name: '@deepseek-ai/dsh-tool-todo'
1125
+ config:
1126
+ allowParallelInProgress: true
1127
+ - id: tool-web
1128
+ name: '@deepseek-ai/dsh-tool-web'
1129
+ config:
1130
+ fetch: true
1131
+ searchTimeoutMs: 60000
1132
+ - id: present
1133
+ name: '@deepseek-ai/dsh-tool-present'
1134
+ - id: tool-office
1135
+ name: '@deepseek-ai/dsh-tool-office'
1136
+ - id: tool-plugin-manager
1137
+ name: '@deepseek-ai/dsh-plugin-manager/tools'
1138
+ disabled: !!js "!ctx.get('profileContext')"
1139
+ - id: tool-plugin-market
1140
+ name: '@deepseek-ai/dsh-plugin-market/tools'
1141
+ disabled: true
1142
+ `;
1143
+ }
1144
+ function writeAtomically(path, content, mode) {
1145
+ mkdirSync2(join3(path, ".."), { recursive: true });
1146
+ const tmp = `${path}.${process.pid}.tmp`;
1147
+ try {
1148
+ writeFileSync2(tmp, content, { mode });
1149
+ renameSync2(tmp, path);
1150
+ } catch (error) {
1151
+ try {
1152
+ unlinkSync2(tmp);
1153
+ } catch {}
1154
+ throw error;
1155
+ }
1156
+ }
1157
+ function ensureAppendSystemFile(path = appendSystemPath()) {
1158
+ try {
1159
+ readFileSync2(path, "utf8");
1160
+ return "kept";
1161
+ } catch {
1162
+ writeAtomically(path, APPEND_SYSTEM_TEMPLATE, 420);
1163
+ try {
1164
+ chmodSync2(path, 420);
1165
+ } catch {}
1166
+ return "seeded";
1167
+ }
1168
+ }
1169
+ function profilePatchPath(home, profile) {
1170
+ return join3(home, "profiles", profile, "cordis.patch.yml");
1171
+ }
1172
+ function managedSpan(lines) {
1173
+ const start = lines.findIndex((line) => line.startsWith(APPEND_SYSTEM_MARKER));
1174
+ if (start < 0)
1175
+ return;
1176
+ let end = lines.length;
1177
+ let seenOwnInsert = false;
1178
+ for (let i = start + 1;i < lines.length; i++) {
1179
+ if (/^- /.test(lines[i])) {
1180
+ if (!seenOwnInsert) {
1181
+ seenOwnInsert = true;
1182
+ continue;
1183
+ }
1184
+ end = i;
1185
+ break;
1186
+ }
1187
+ }
1188
+ return [start, end];
1189
+ }
1190
+ function provisionAppendSystem(home, profile) {
1191
+ let preText;
1192
+ try {
1193
+ preText = readFileSync2(profilePatchPath(home, profile), "utf8");
1194
+ } catch {
1195
+ preText = undefined;
1196
+ }
1197
+ const patch = syncAppendSystemPreset(home, profile);
1198
+ if (preText !== undefined && managedSpan(preText.split(`
1199
+ `)) !== undefined) {
1200
+ return { patch, file: "kept" };
1201
+ }
1202
+ return { patch, file: ensureAppendSystemFile(appendSystemPath(home)) };
1203
+ }
1204
+ function syncAppendSystemPreset(home, profile) {
1205
+ const path = profilePatchPath(home, profile);
1206
+ let before;
1207
+ try {
1208
+ before = readFileSync2(path, "utf8");
1209
+ } catch {
1210
+ return { status: "skipped", detail: `no profile patch at ${path}` };
1211
+ }
1212
+ const lines = before.split(`
1213
+ `);
1214
+ const span = managedSpan(lines);
1215
+ const outside = (needle) => {
1216
+ for (let i = 0;i < lines.length; i++) {
1217
+ if (span !== undefined && i >= span[0] && i < span[1])
1218
+ continue;
1219
+ if (lines[i].includes(needle))
1220
+ return `line ${i + 1}: ${lines[i].trim()}`;
1221
+ }
1222
+ return;
1223
+ };
1224
+ for (const needle of [APPEND_SYSTEM_PRESET_ID, APPEND_SYSTEM_ROW_ID]) {
1225
+ const hit = outside(needle);
1226
+ if (hit !== undefined) {
1227
+ return { status: "collision", detail: `${needle} already declared (${hit})` };
1228
+ }
1229
+ }
1230
+ if (span !== undefined)
1231
+ return { status: "present" };
1232
+ const separator = before.length === 0 || before.endsWith(`
1233
+
1234
+ `) ? "" : before.endsWith(`
1235
+ `) ? `
1236
+ ` : `
1237
+
1238
+ `;
1239
+ const next = `${before}${separator}${appendSystemPresetBlock()}`;
1240
+ writeAtomically(path, next, 384);
1241
+ return { status: "added" };
1242
+ }
1243
+ var APPEND_SYSTEM_PRESET_ID = "opentui-append-system", APPEND_SYSTEM_ROW_ID, APPEND_SYSTEM_MARKER = "# dsh-opentui:append-system", APPEND_SYSTEM_TEMPLATE = `# APPEND_SYSTEM.md \u2014 standing system-prompt additions
1244
+
1245
+ The content of this file is appended to the system prompt of every main
1246
+ session the dsh-opentui client creates (ported from dsh-tui-pi).
1247
+
1248
+ The file is user-owned: the client seeds it once and never rewrites it.
1249
+ Edits apply to sessions created after the next client start; clearing or
1250
+ deleting this file switches the append off (it is not re-seeded).
1251
+
1252
+ ## Vocabulary
1253
+
1254
+ - "subagent" means the registered subagents only; never invent or use
1255
+ unregistered subagents.
1256
+
1257
+ ## Additions
1258
+
1259
+ Write your persistent instructions below this line.
1260
+ `, APPEND_SYSTEM_SUFFIX_EXPR = `((req, path) => { try { const text = req('node:fs').readFileSync(path.join(process.env.DSH_HOME || ((process.env.HOME || '') + '/.dsh'), 'APPEND_SYSTEM.md'), 'utf8'); return text.length > 65536 ? text.slice(0, 65536) + String.fromCharCode(10) + '[append-system: truncated at 64KiB]' : text } catch { return '' } })(process.getBuiltinModule('node:module').createRequire(baseUrl), process.getBuiltinModule('node:path'))`;
1261
+ var init_append_system = __esm(() => {
1262
+ APPEND_SYSTEM_ROW_ID = `preset-${APPEND_SYSTEM_PRESET_ID}`;
1263
+ });
1264
+
992
1265
  // src/client/cookie-mint.ts
993
1266
  import { createHash, createHmac } from "crypto";
994
- import { readFileSync as readFileSync2, statSync as statSync2 } from "fs";
995
- import { join as join3 } from "path";
1267
+ import { readFileSync as readFileSync3, statSync as statSync2 } from "fs";
1268
+ import { join as join4 } from "path";
996
1269
  function ownerCookieName(authority) {
997
1270
  return "dsh-auth-" + base64url(createHash("sha256").update(authority).digest());
998
1271
  }
@@ -1010,14 +1283,14 @@ function mintOwnerCookie(options) {
1010
1283
  return `${ownerCookieName(authority)}=v1.${body}.${signature}`;
1011
1284
  }
1012
1285
  function readGrantSecret(home) {
1013
- const path = join3(home, ".credentials.yaml");
1286
+ const path = join4(home, ".credentials.yaml");
1014
1287
  const deadline = Date.now() + RETRY_WINDOW_MS;
1015
1288
  let sawFile = false;
1016
1289
  while (true) {
1017
1290
  let file = "";
1018
1291
  try {
1019
1292
  assertOwnerOnly(path);
1020
- file = readFileSync2(path, "utf8");
1293
+ file = readFileSync3(path, "utf8");
1021
1294
  sawFile = true;
1022
1295
  } catch (error) {
1023
1296
  if (error instanceof CredentialsFileInsecureError)
@@ -1245,7 +1518,7 @@ __export(exports_lifecycle, {
1245
1518
  MintUnavailableError: () => MintUnavailableError,
1246
1519
  ProfileMissingError: () => ProfileMissingError,
1247
1520
  __internals: () => __internals,
1248
- defaultDshHome: () => defaultDshHome,
1521
+ defaultDshHome: () => defaultDshHome2,
1249
1522
  ensureHost: () => ensureHost,
1250
1523
  isListening: () => isListening,
1251
1524
  pidAlive: () => pidAlive,
@@ -1253,10 +1526,10 @@ __export(exports_lifecycle, {
1253
1526
  resolveIdleExitSec: () => resolveIdleExitSec
1254
1527
  });
1255
1528
  import { spawn as spawn2 } from "child_process";
1256
- import { existsSync as existsSync3, linkSync, mkdirSync as mkdirSync2, readFileSync as readFileSync3, renameSync as renameSync2, rmSync, writeFileSync as writeFileSync2 } from "fs";
1257
- import { homedir } from "os";
1529
+ import { existsSync as existsSync3, linkSync, mkdirSync as mkdirSync3, readFileSync as readFileSync4, renameSync as renameSync3, rmSync, writeFileSync as writeFileSync3 } from "fs";
1530
+ import { homedir as homedir2 } from "os";
1258
1531
  import { connect as netConnect, Server } from "net";
1259
- import { join as join4 } from "path";
1532
+ import { join as join5 } from "path";
1260
1533
  function resolveIdleExitMs(explicitSec) {
1261
1534
  if (explicitSec !== undefined && Number.isFinite(explicitSec)) {
1262
1535
  return Math.max(0, Math.round(explicitSec * 1000));
@@ -1284,11 +1557,11 @@ ${lines.slice(-ERROR_TAIL_LINES).join(`
1284
1557
  function registryKey(dshHome, profile) {
1285
1558
  return `${dshHome}\x00${profile}`;
1286
1559
  }
1287
- function defaultDshHome() {
1288
- return process.env.DSH_HOME || join4(homedir(), ".dsh");
1560
+ function defaultDshHome2() {
1561
+ return process.env.DSH_HOME || join5(homedir2(), ".dsh");
1289
1562
  }
1290
1563
  function lockPathFor(dshHome, profile) {
1291
- return join4(dshHome, `opentui-host.${profile}.json`);
1564
+ return join5(dshHome, `opentui-host.${profile}.json`);
1292
1565
  }
1293
1566
  function pidAlive(pid) {
1294
1567
  try {
@@ -1341,7 +1614,7 @@ function getFreePort() {
1341
1614
  }
1342
1615
  function readLock(dshHome, profile) {
1343
1616
  try {
1344
- const raw = JSON.parse(readFileSync3(lockPathFor(dshHome, profile), "utf8"));
1617
+ const raw = JSON.parse(readFileSync4(lockPathFor(dshHome, profile), "utf8"));
1345
1618
  if (typeof raw.pid !== "number" || typeof raw.port !== "number")
1346
1619
  return null;
1347
1620
  return {
@@ -1357,7 +1630,7 @@ function readLock(dshHome, profile) {
1357
1630
  }
1358
1631
  }
1359
1632
  function writeLock(dshHome, profile, host) {
1360
- mkdirSync2(dshHome, { recursive: true });
1633
+ mkdirSync3(dshHome, { recursive: true });
1361
1634
  const path = lockPathFor(dshHome, profile);
1362
1635
  const payload = {
1363
1636
  pid: host.pid,
@@ -1367,9 +1640,9 @@ function writeLock(dshHome, profile, host) {
1367
1640
  profile
1368
1641
  };
1369
1642
  const tmp = `${path}.tmp`;
1370
- writeFileSync2(tmp, JSON.stringify(payload, null, 2) + `
1643
+ writeFileSync3(tmp, JSON.stringify(payload, null, 2) + `
1371
1644
  `);
1372
- renameSync2(tmp, path);
1645
+ renameSync3(tmp, path);
1373
1646
  }
1374
1647
  function clearOurLock(host) {
1375
1648
  if (!host.lockOwned)
@@ -1380,7 +1653,7 @@ function clearOurLock(host) {
1380
1653
  }
1381
1654
  }
1382
1655
  function claimBootLock(dshHome, profile) {
1383
- mkdirSync2(dshHome, { recursive: true });
1656
+ mkdirSync3(dshHome, { recursive: true });
1384
1657
  const path = lockPathFor(dshHome, profile);
1385
1658
  const payload = {
1386
1659
  pid: process.pid,
@@ -1391,7 +1664,7 @@ function claimBootLock(dshHome, profile) {
1391
1664
  booting: true
1392
1665
  };
1393
1666
  const tmp = `${path}.claim-${process.pid}-${Date.now()}`;
1394
- writeFileSync2(tmp, JSON.stringify(payload, null, 2) + `
1667
+ writeFileSync3(tmp, JSON.stringify(payload, null, 2) + `
1395
1668
  `);
1396
1669
  try {
1397
1670
  linkSync(tmp, path);
@@ -1407,7 +1680,7 @@ function claimBootLock(dshHome, profile) {
1407
1680
  function removeBootClaim(dshHome, profile, claim) {
1408
1681
  const path = lockPathFor(dshHome, profile);
1409
1682
  try {
1410
- const raw = JSON.parse(readFileSync3(path, "utf8"));
1683
+ const raw = JSON.parse(readFileSync4(path, "utf8"));
1411
1684
  if (raw.booting !== true || raw.pid !== claim.pid)
1412
1685
  return false;
1413
1686
  if (claim.startedAt !== undefined && raw.startedAt !== claim.startedAt)
@@ -1421,7 +1694,7 @@ function removeBootClaim(dshHome, profile, claim) {
1421
1694
  function removeStaleLock(dshHome, profile, stale) {
1422
1695
  const path = lockPathFor(dshHome, profile);
1423
1696
  try {
1424
- const raw = JSON.parse(readFileSync3(path, "utf8"));
1697
+ const raw = JSON.parse(readFileSync4(path, "utf8"));
1425
1698
  if (raw.booting === true || raw.pid !== stale.pid || raw.port !== stale.port)
1426
1699
  return false;
1427
1700
  } catch {
@@ -1432,7 +1705,7 @@ function removeStaleLock(dshHome, profile, stale) {
1432
1705
  }
1433
1706
  function bootClaimIntact(dshHome, profile, startedAt) {
1434
1707
  try {
1435
- const raw = JSON.parse(readFileSync3(lockPathFor(dshHome, profile), "utf8"));
1708
+ const raw = JSON.parse(readFileSync4(lockPathFor(dshHome, profile), "utf8"));
1436
1709
  return raw.booting === true && raw.pid === process.pid && raw.startedAt === startedAt;
1437
1710
  } catch {
1438
1711
  return false;
@@ -1674,7 +1947,7 @@ function adoptHost(lock, o) {
1674
1947
  }
1675
1948
  function resolveOptions(opts) {
1676
1949
  const profile = opts.profile ?? DEFAULT_PROFILE;
1677
- const dshHome = opts.dshHome ?? defaultDshHome();
1950
+ const dshHome = opts.dshHome ?? defaultDshHome2();
1678
1951
  const idleExitSec = resolveIdleExitSec(opts.idleExitSec);
1679
1952
  return {
1680
1953
  profile,
@@ -1722,7 +1995,7 @@ async function bootHost(o) {
1722
1995
  removeStaleLock(o.dshHome, o.profile, lock);
1723
1996
  const lockPath = lockPathFor(o.dshHome, o.profile);
1724
1997
  if (!existsSync3(lockPath)) {
1725
- const profileDir = join4(o.dshHome, "profiles", o.profile);
1998
+ const profileDir = join5(o.dshHome, "profiles", o.profile);
1726
1999
  if (!existsSync3(profileDir))
1727
2000
  throw new ProfileMissingError(o.profile, profileDir);
1728
2001
  const claimed = claimBootLock(o.dshHome, o.profile);
@@ -1735,7 +2008,15 @@ async function bootHost(o) {
1735
2008
  }
1736
2009
  await sleep(BOOT_JOIN_POLL_MS);
1737
2010
  }
1738
- const profileDir = join4(o.dshHome, "profiles", o.profile);
2011
+ const profileDir = join5(o.dshHome, "profiles", o.profile);
2012
+ try {
2013
+ const provision = provisionAppendSystem(o.dshHome, o.profile);
2014
+ if (provision.patch.status === "collision" || provision.patch.status === "skipped") {
2015
+ console.error(`[lifecycle] append-system preset not provisioned (${provision.patch.status}): ${provision.patch.detail}`);
2016
+ }
2017
+ } catch (error) {
2018
+ console.error("[lifecycle] append-system sync failed (booting without the preset):", error);
2019
+ }
1739
2020
  const port = await getFreePort();
1740
2021
  const child = o.spawnDsh(["--profile", o.profile, "--no-open", "--port", String(port)], {
1741
2022
  cwd: profileDir,
@@ -1918,6 +2199,7 @@ async function ensureHost(opts = {}) {
1918
2199
  var DEFAULT_PROFILE = "opentui", DEFAULT_IDLE_EXIT_MS = 5000, DEFAULT_IDLE_EXIT_SEC, ENV_IDLE_EXIT_MS = "DSH_OPENTUI_HOST_IDLE_MS", DEFAULT_READINESS_TIMEOUT_MS = 30000, DEFAULT_STALE_PROBE_MS = 8000, BOOT_JOIN_MARGIN_MS = 20000, BOOT_JOIN_POLL_MS = 200, RESPAWN_WINDOW_MS = 15000, MAX_RAPID_RESPAWNS = 3, LISTEN_PROBE_TIMEOUT_MS = 750, LISTEN_POLL_MS = 200, ADOPT_PROBE_TIMEOUT_MS = 2000, SERVE_PROBE_POLL_MS = 250, SERVE_PROBE_BUDGET_MS = 20000, ERROR_TAIL_LINES = 12, KILL_GRACE_MS = 5000, KILL_ESCALATE_MS = 2000, OUTPUT_TAIL_CAP = 8000, URL_LINE, HostLifecycleError, HostBootTimeoutError, HostDiedError, HostNotServingError, HostSpawnError, HostRespawnLoopError, HostBootSupersededError, ProfileMissingError, MintUnavailableError, registry, pendingBoots, respawnHistory, sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)), realMintPromise = null, RETRYABLE_MINT_ERRORS, MINT_RETRY_BUDGET_MS = 15000, MINT_RETRY_INTERVAL_MS = 250, FFI_FLAG = "--experimental-ffi", __internals;
1919
2200
  var init_lifecycle = __esm(() => {
1920
2201
  init_host_probe();
2202
+ init_append_system();
1921
2203
  DEFAULT_IDLE_EXIT_SEC = DEFAULT_IDLE_EXIT_MS / 1000;
1922
2204
  URL_LINE = /dsh web: (https?:\/\/\S+)/;
1923
2205
  HostLifecycleError = class HostLifecycleError extends Error {
@@ -5648,23 +5930,23 @@ class WaterfallAnswerer {
5648
5930
 
5649
5931
  // src/client/remote-local-fs.ts
5650
5932
  import {
5651
- chmodSync as chmodSync2,
5933
+ chmodSync as chmodSync3,
5652
5934
  closeSync,
5653
5935
  existsSync as existsSync4,
5654
5936
  openSync,
5655
- readFileSync as readFileSync4,
5937
+ readFileSync as readFileSync5,
5656
5938
  readdirSync,
5657
5939
  readSync,
5658
- renameSync as renameSync3,
5940
+ renameSync as renameSync4,
5659
5941
  statSync as statSync3,
5660
- unlinkSync as unlinkSync2,
5661
- writeFileSync as writeFileSync3
5942
+ unlinkSync as unlinkSync3,
5943
+ writeFileSync as writeFileSync4
5662
5944
  } from "fs";
5663
- import { homedir as homedir2 } from "os";
5664
- import { basename, dirname, join as join5 } from "path";
5945
+ import { homedir as homedir3 } from "os";
5946
+ import { basename, dirname, join as join6 } from "path";
5665
5947
  import * as nodeZlib from "zlib";
5666
5948
  function resolveDshHome(explicit) {
5667
- return explicit ?? (process.env.DSH_HOME || join5(homedir2(), ".dsh"));
5949
+ return explicit ?? (process.env.DSH_HOME || join6(homedir3(), ".dsh"));
5668
5950
  }
5669
5951
  function stripQuotes(value) {
5670
5952
  if (value.length >= 2) {
@@ -5755,15 +6037,15 @@ function listAgentFiles(explicitHome) {
5755
6037
  const broken = [];
5756
6038
  try {
5757
6039
  const home = resolveDshHome(explicitHome);
5758
- const dir = join5(home, "agents");
6040
+ const dir = join6(home, "agents");
5759
6041
  if (!existsSync4(dir))
5760
6042
  return [];
5761
6043
  for (const entry of readdirSync(dir, { withFileTypes: true })) {
5762
6044
  if (!entry.isFile() || !entry.name.endsWith(".md"))
5763
6045
  continue;
5764
- const full = join5(dir, entry.name);
6046
+ const full = join6(dir, entry.name);
5765
6047
  try {
5766
- const result = parseAgentMarkdown(readFileSync4(full, "utf8"), full);
6048
+ const result = parseAgentMarkdown(readFileSync5(full, "utf8"), full);
5767
6049
  if (result.ok)
5768
6050
  agents.push(result.agent);
5769
6051
  else
@@ -5786,7 +6068,7 @@ function listAgentFiles(explicitHome) {
5786
6068
  function updateAgentFrontmatter(path, updates) {
5787
6069
  let text;
5788
6070
  try {
5789
- text = readFileSync4(path, "utf8");
6071
+ text = readFileSync5(path, "utf8");
5790
6072
  } catch (e) {
5791
6073
  return `cannot read ${path}: ${String(e instanceof Error ? e.message : e)}`;
5792
6074
  }
@@ -5839,7 +6121,7 @@ function updateAgentFrontmatter(path, updates) {
5839
6121
  if (!changed)
5840
6122
  return;
5841
6123
  try {
5842
- writeFileSync3(path, lines.join(eol));
6124
+ writeFileSync4(path, lines.join(eol));
5843
6125
  return;
5844
6126
  } catch (e) {
5845
6127
  return String(e instanceof Error ? e.message : e);
@@ -5847,7 +6129,7 @@ function updateAgentFrontmatter(path, updates) {
5847
6129
  }
5848
6130
  function setAgentField(name, field, value, explicitHome) {
5849
6131
  const home = resolveDshHome(explicitHome);
5850
- const file = join5(home, "agents", `${name}.md`);
6132
+ const file = join6(home, "agents", `${name}.md`);
5851
6133
  if (field === "deep") {
5852
6134
  if (value !== null && !/^\d+$/.test(value)) {
5853
6135
  return `expected a non-negative integer, got "${value}"`;
@@ -5875,7 +6157,7 @@ function repairScanSessions(explicitHome) {
5875
6157
  const out = [];
5876
6158
  try {
5877
6159
  const home = resolveDshHome(explicitHome);
5878
- const root = join5(home, "sessions");
6160
+ const root = join6(home, "sessions");
5879
6161
  if (!existsSync4(root))
5880
6162
  return ["no sessions directory"];
5881
6163
  let total = 0;
@@ -5908,7 +6190,7 @@ function scanBrokenSessionLogs(explicitHome) {
5908
6190
  const broken = [];
5909
6191
  try {
5910
6192
  const home = resolveDshHome(explicitHome);
5911
- const root = join5(home, "sessions");
6193
+ const root = join6(home, "sessions");
5912
6194
  if (!existsSync4(root))
5913
6195
  return broken;
5914
6196
  visitSessionLogs(root, 0, (full, name) => {
@@ -5936,7 +6218,7 @@ function visitSessionLogs(dir, depth, onLog) {
5936
6218
  return;
5937
6219
  }
5938
6220
  for (const entry of entries) {
5939
- const full = join5(dir, entry.name);
6221
+ const full = join6(dir, entry.name);
5940
6222
  if (entry.isDirectory()) {
5941
6223
  visitSessionLogs(full, depth + 1, onLog);
5942
6224
  continue;
@@ -6002,7 +6284,7 @@ function probeZstdFrame(path) {
6002
6284
  if (verify === undefined)
6003
6285
  return { broken: false };
6004
6286
  try {
6005
- verify(readFileSync4(path));
6287
+ verify(readFileSync5(path));
6006
6288
  return { broken: false };
6007
6289
  } catch {
6008
6290
  return { broken: true, reason: `truncated or corrupt zstd frame${notRepairable}` };
@@ -6048,14 +6330,14 @@ function sleepSync2(ms) {
6048
6330
  }
6049
6331
  function repairSessionLogTail(path, options = {}) {
6050
6332
  const delayFn = options.delayFn ?? sleepSync2;
6051
- const writeFn = options.writeFn ?? writeFileSync3;
6052
- const renameFn = options.renameFn ?? renameSync3;
6333
+ const writeFn = options.writeFn ?? writeFileSync4;
6334
+ const renameFn = options.renameFn ?? renameSync4;
6053
6335
  if (!path.endsWith(".jsonl")) {
6054
6336
  return { kind: "failed", detail: "not a plain jsonl log \u2014 client-side repair only truncates invalid jsonl tails" };
6055
6337
  }
6056
6338
  let text;
6057
6339
  try {
6058
- text = readFileSync4(path, "utf8");
6340
+ text = readFileSync5(path, "utf8");
6059
6341
  } catch (e) {
6060
6342
  return { kind: "failed", detail: `cannot read ${basename(path)}: ${String(e instanceof Error ? e.message : e)}` };
6061
6343
  }
@@ -6098,11 +6380,11 @@ function repairSessionLogTail(path, options = {}) {
6098
6380
  return { kind: "failed", detail: `cannot write the repaired copy: ${String(e instanceof Error ? e.message : e)}` };
6099
6381
  }
6100
6382
  try {
6101
- if (readFileSync4(tmpPath, "utf8") !== repaired)
6383
+ if (readFileSync5(tmpPath, "utf8") !== repaired)
6102
6384
  throw new Error("repaired copy content mismatch");
6103
6385
  } catch (e) {
6104
6386
  try {
6105
- unlinkSync2(tmpPath);
6387
+ unlinkSync3(tmpPath);
6106
6388
  } catch {}
6107
6389
  return {
6108
6390
  kind: "failed",
@@ -6118,7 +6400,7 @@ function repairSessionLogTail(path, options = {}) {
6118
6400
  renameFn(path, backupPath);
6119
6401
  } catch (e) {
6120
6402
  try {
6121
- unlinkSync2(tmpPath);
6403
+ unlinkSync3(tmpPath);
6122
6404
  } catch {}
6123
6405
  return { kind: "failed", detail: `cannot back up the original: ${String(e instanceof Error ? e.message : e)}` };
6124
6406
  }
@@ -6126,7 +6408,7 @@ function repairSessionLogTail(path, options = {}) {
6126
6408
  renameFn(tmpPath, path);
6127
6409
  } catch (e) {
6128
6410
  try {
6129
- unlinkSync2(tmpPath);
6411
+ unlinkSync3(tmpPath);
6130
6412
  } catch {}
6131
6413
  let restored = false;
6132
6414
  try {
@@ -6139,7 +6421,7 @@ function repairSessionLogTail(path, options = {}) {
6139
6421
  };
6140
6422
  }
6141
6423
  try {
6142
- chmodSync2(path, 384);
6424
+ chmodSync3(path, 384);
6143
6425
  } catch {}
6144
6426
  return { kind: "repaired", backupPath };
6145
6427
  }
@@ -6150,10 +6432,10 @@ var init_remote_local_fs = __esm(() => {
6150
6432
  });
6151
6433
 
6152
6434
  // src/client/remote-agent-profiles.ts
6153
- import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync5, renameSync as renameSync4, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "fs";
6154
- import { dirname as dirname2, join as join6, resolve } from "path";
6435
+ import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync6, renameSync as renameSync5, rmSync as rmSync2, writeFileSync as writeFileSync5 } from "fs";
6436
+ import { dirname as dirname2, join as join7, resolve } from "path";
6155
6437
  function modelProfilesPath(home) {
6156
- return join6(home, "model-profiles.json");
6438
+ return join7(home, "model-profiles.json");
6157
6439
  }
6158
6440
  function narrowEntry(value) {
6159
6441
  if (value === null || typeof value !== "object" || Array.isArray(value))
@@ -6194,7 +6476,7 @@ function seedModelProfilesDoc() {
6194
6476
  function readModelProfilesDoc(home) {
6195
6477
  let raw;
6196
6478
  try {
6197
- raw = JSON.parse(readFileSync5(modelProfilesPath(home), "utf8"));
6479
+ raw = JSON.parse(readFileSync6(modelProfilesPath(home), "utf8"));
6198
6480
  } catch {
6199
6481
  return seedModelProfilesDoc();
6200
6482
  }
@@ -6237,10 +6519,10 @@ function parsePinText(text) {
6237
6519
  function readNearestProfilePin(startDir) {
6238
6520
  let current = resolve(startDir);
6239
6521
  while (true) {
6240
- const candidate = join6(current, PROFILE_PIN_FILE);
6522
+ const candidate = join7(current, PROFILE_PIN_FILE);
6241
6523
  try {
6242
6524
  if (existsSync5(candidate)) {
6243
- const name = parsePinText(readFileSync5(candidate, "utf8"));
6525
+ const name = parsePinText(readFileSync6(candidate, "utf8"));
6244
6526
  if (name !== undefined)
6245
6527
  return name;
6246
6528
  }
@@ -6305,7 +6587,7 @@ function saveProfileAgentOverrides(home, profileName, agentName, edit) {
6305
6587
  profiles: DEFAULT_PROFILE_NAMES.map((name) => ({ name, agents: {} }))
6306
6588
  };
6307
6589
  try {
6308
- const parsed = JSON.parse(readFileSync5(path, "utf8"));
6590
+ const parsed = JSON.parse(readFileSync6(path, "utf8"));
6309
6591
  if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
6310
6592
  const candidate = parsed;
6311
6593
  if (candidate.version === MODEL_PROFILES_VERSION && Array.isArray(candidate.profiles))
@@ -6343,11 +6625,11 @@ function saveProfileAgentOverrides(home, profileName, agentName, edit) {
6343
6625
  profiles[index] = profile;
6344
6626
  const body = JSON.stringify(raw);
6345
6627
  const dir = dirname2(path);
6346
- const tmp = join6(dir, `.model-profiles.json.tmp-${process.pid}`);
6628
+ const tmp = join7(dir, `.model-profiles.json.tmp-${process.pid}`);
6347
6629
  try {
6348
- mkdirSync3(dir, { recursive: true });
6349
- writeFileSync4(tmp, body);
6350
- renameSync4(tmp, path);
6630
+ mkdirSync4(dir, { recursive: true });
6631
+ writeFileSync5(tmp, body);
6632
+ renameSync5(tmp, path);
6351
6633
  return;
6352
6634
  } catch (e) {
6353
6635
  try {
@@ -6549,7 +6831,13 @@ async function askBtw(options) {
6549
6831
  let sessionId = options.previousSessionId ?? "";
6550
6832
  if (!sessionId) {
6551
6833
  const requested = randomUUID2();
6552
- const value = await options.rpc("session/create", { request: { cwd: options.cwd, sessionId: requested } });
6834
+ const value = await options.rpc("session/create", {
6835
+ request: {
6836
+ cwd: options.cwd,
6837
+ sessionId: requested,
6838
+ ...options.agentPreset !== undefined ? { agentPreset: options.agentPreset } : {}
6839
+ }
6840
+ });
6553
6841
  sessionId = typeof value.sessionId === "string" ? value.sessionId : requested;
6554
6842
  if (options.stagedModel) {
6555
6843
  try {
@@ -7508,8 +7796,8 @@ var init_remote_subagents = __esm(() => {
7508
7796
 
7509
7797
  // src/client/remote-restart.ts
7510
7798
  import { spawn as spawn3 } from "child_process";
7511
- import { existsSync as existsSync6, readFileSync as readFileSync6, renameSync as renameSync5, rmSync as rmSync3, unlinkSync as unlinkSync3, writeFileSync as writeFileSync5 } from "fs";
7512
- import { join as join7 } from "path";
7799
+ import { existsSync as existsSync6, readFileSync as readFileSync7, renameSync as renameSync6, rmSync as rmSync3, unlinkSync as unlinkSync4, writeFileSync as writeFileSync6 } from "fs";
7800
+ import { join as join8 } from "path";
7513
7801
  function defaultSpawnDsh2(argv, options) {
7514
7802
  const child = spawn3("dsh", argv, {
7515
7803
  cwd: options.cwd,
@@ -7524,7 +7812,7 @@ function defaultSpawnDsh2(argv, options) {
7524
7812
  return child;
7525
7813
  }
7526
7814
  function writeRestartedLock(home, profile, host) {
7527
- const path = join7(home, `opentui-host.${profile}.json`);
7815
+ const path = join8(home, `opentui-host.${profile}.json`);
7528
7816
  const payload = {
7529
7817
  pid: host.pid,
7530
7818
  port: host.port,
@@ -7533,17 +7821,17 @@ function writeRestartedLock(home, profile, host) {
7533
7821
  profile
7534
7822
  };
7535
7823
  const tmp = `${path}.tmp`;
7536
- writeFileSync5(tmp, JSON.stringify(payload, null, 2) + `
7824
+ writeFileSync6(tmp, JSON.stringify(payload, null, 2) + `
7537
7825
  `);
7538
- renameSync5(tmp, path);
7826
+ renameSync6(tmp, path);
7539
7827
  }
7540
7828
  async function restartSamePortHost(options = {}) {
7541
7829
  const profile = options.profile ?? "opentui";
7542
7830
  const home = resolveDshHome(options.dshHome);
7543
- const lockPath = join7(home, `opentui-host.${profile}.json`);
7831
+ const lockPath = join8(home, `opentui-host.${profile}.json`);
7544
7832
  let lock;
7545
7833
  try {
7546
- const raw = JSON.parse(readFileSync6(lockPath, "utf8"));
7834
+ const raw = JSON.parse(readFileSync7(lockPath, "utf8"));
7547
7835
  if (typeof raw.pid === "number" && typeof raw.port === "number") {
7548
7836
  lock = { pid: raw.pid, port: raw.port, ...raw.booting === true ? { booting: true } : {} };
7549
7837
  }
@@ -7579,12 +7867,12 @@ async function restartSamePortHost(options = {}) {
7579
7867
  await sleep2(POLL_MS);
7580
7868
  }
7581
7869
  try {
7582
- const current = JSON.parse(readFileSync6(lockPath, "utf8"));
7870
+ const current = JSON.parse(readFileSync7(lockPath, "utf8"));
7583
7871
  if (current.booting !== true && current.pid === pid && current.port === port)
7584
7872
  rmSync3(lockPath, { force: true });
7585
7873
  } catch {
7586
7874
  try {
7587
- unlinkSync3(lockPath);
7875
+ unlinkSync4(lockPath);
7588
7876
  } catch {}
7589
7877
  }
7590
7878
  const quietDeadline = deadline(KILL_GRACE_MS2 + KILL_ESCALATE_MS2 + LISTEN_RELEASE_GRACE_MS);
@@ -7593,7 +7881,7 @@ async function restartSamePortHost(options = {}) {
7593
7881
  if (await isListening(port)) {
7594
7882
  throw new HostRestartError("port-held", `port ${port} is still held after the old host died \u2014 refusing to spawn into EADDRINUSE`);
7595
7883
  }
7596
- const profileDir = join7(home, "profiles", profile);
7884
+ const profileDir = join8(home, "profiles", profile);
7597
7885
  if (!existsSync6(profileDir)) {
7598
7886
  throw new HostRestartError("profile-missing", `profile '${profile}' is not provisioned (${profileDir} missing)`);
7599
7887
  }
@@ -7663,7 +7951,7 @@ __export(exports_remote_host_session, {
7663
7951
  openRemoteStream: () => openRemoteStream
7664
7952
  });
7665
7953
  import { randomUUID as randomUUID4 } from "crypto";
7666
- import { existsSync as existsSync7, mkdirSync as mkdirSync4, readFileSync as readFileSync7, renameSync as renameSync6, rmSync as rmSync4, writeFileSync as writeFileSync6 } from "fs";
7954
+ import { existsSync as existsSync7, mkdirSync as mkdirSync5, readFileSync as readFileSync8, renameSync as renameSync7, rmSync as rmSync4, writeFileSync as writeFileSync7 } from "fs";
7667
7955
  import { join as joinPath } from "path";
7668
7956
  import WS3 from "ws";
7669
7957
  function trace(message) {
@@ -7709,6 +7997,8 @@ class RemoteHostSession {
7709
7997
  #sessionId;
7710
7998
  #resumeId;
7711
7999
  #presetId;
8000
+ #appendPresetChecked = false;
8001
+ #appendPresetAvailable = false;
7712
8002
  #cb;
7713
8003
  #askProvider;
7714
8004
  #resolveTurn;
@@ -8122,6 +8412,23 @@ class RemoteHostSession {
8122
8412
  return [];
8123
8413
  }
8124
8414
  }
8415
+ async#appendPresetRosterCheck() {
8416
+ if (this.#appendPresetChecked)
8417
+ return this.#appendPresetAvailable;
8418
+ let roster;
8419
+ try {
8420
+ roster = await this.#rpc("agentPresets/list");
8421
+ } catch {
8422
+ return false;
8423
+ }
8424
+ this.#appendPresetChecked = true;
8425
+ const presets = Array.isArray(roster.presets) ? roster.presets : [];
8426
+ this.#appendPresetAvailable = presets.some((p) => {
8427
+ const row = typeof p === "object" && p !== null ? p : {};
8428
+ return String(row.id ?? "") === APPEND_SYSTEM_PRESET_ID && !(typeof row.broken === "string" && row.broken);
8429
+ });
8430
+ return this.#appendPresetAvailable;
8431
+ }
8125
8432
  async readPreset(presetId) {
8126
8433
  try {
8127
8434
  const doc = await this.#rpc("agentPresets/read", { agentPreset: presetId });
@@ -8162,8 +8469,10 @@ class RemoteHostSession {
8162
8469
  if (this.#presetId !== undefined)
8163
8470
  return this.#presetId;
8164
8471
  if (proj.agentPreset !== undefined && proj.agentPreset !== this.#presetId) {
8165
- this.#presetId = proj.agentPreset;
8166
- this.#probeExecutionMode();
8472
+ if (!(this.#presetId === undefined && proj.agentPreset === APPEND_SYSTEM_PRESET_ID)) {
8473
+ this.#presetId = proj.agentPreset;
8474
+ this.#probeExecutionMode();
8475
+ }
8167
8476
  }
8168
8477
  return proj.agentPreset;
8169
8478
  } catch {
@@ -8272,7 +8581,7 @@ class RemoteHostSession {
8272
8581
  }
8273
8582
  keybindingsLoad() {
8274
8583
  try {
8275
- return JSON.parse(readFileSync7(this.configPath("keybindings.json"), "utf8"));
8584
+ return JSON.parse(readFileSync8(this.configPath("keybindings.json"), "utf8"));
8276
8585
  } catch {
8277
8586
  return {};
8278
8587
  }
@@ -8285,14 +8594,14 @@ class RemoteHostSession {
8285
8594
  configLoad() {
8286
8595
  let base = {};
8287
8596
  try {
8288
- base = JSON.parse(readFileSync7(this.configPath(), "utf8"));
8597
+ base = JSON.parse(readFileSync8(this.configPath(), "utf8"));
8289
8598
  } catch {}
8290
8599
  const merged = mergeConfig(base, this.#overlayCache ?? {}, process.env);
8291
8600
  return { ...base, ...merged };
8292
8601
  }
8293
8602
  configRaw() {
8294
8603
  try {
8295
- return JSON.parse(readFileSync7(this.configPath(), "utf8"));
8604
+ return JSON.parse(readFileSync8(this.configPath(), "utf8"));
8296
8605
  } catch {
8297
8606
  return {};
8298
8607
  }
@@ -8326,13 +8635,13 @@ class RemoteHostSession {
8326
8635
  const merged = { ...this.#readProfileConfig(), ...rest };
8327
8636
  const profileDir = joinPath(this.#dshHome, "profiles", this.#profile);
8328
8637
  if (!existsSync7(profileDir))
8329
- mkdirSync4(profileDir, { recursive: true });
8638
+ mkdirSync5(profileDir, { recursive: true });
8330
8639
  const path = this.configPath();
8331
8640
  const tmp = `${path}.${process.pid}.tmp`;
8332
8641
  try {
8333
- writeFileSync6(tmp, JSON.stringify(merged, null, 2) + `
8642
+ writeFileSync7(tmp, JSON.stringify(merged, null, 2) + `
8334
8643
  `);
8335
- renameSync6(tmp, path);
8644
+ renameSync7(tmp, path);
8336
8645
  } catch (error) {
8337
8646
  try {
8338
8647
  rmSync4(tmp, { force: true });
@@ -8347,7 +8656,7 @@ class RemoteHostSession {
8347
8656
  }
8348
8657
  #readProfileConfig() {
8349
8658
  try {
8350
- return JSON.parse(readFileSync7(this.configPath(), "utf8"));
8659
+ return JSON.parse(readFileSync8(this.configPath(), "utf8"));
8351
8660
  } catch {
8352
8661
  return {};
8353
8662
  }
@@ -8612,6 +8921,7 @@ class RemoteHostSession {
8612
8921
  try {
8613
8922
  await this.start();
8614
8923
  const staged = this.#pendingModel ?? await this.currentModelSelection();
8924
+ const btwPreset = this.#presetId ?? (await this.#appendPresetRosterCheck() ? APPEND_SYSTEM_PRESET_ID : undefined);
8615
8925
  const result = await askBtw({
8616
8926
  rpc: (method, args) => this.#rpc(method, args),
8617
8927
  socketFactory: this.#socketFactory,
@@ -8620,7 +8930,8 @@ class RemoteHostSession {
8620
8930
  snapshot,
8621
8931
  ...onDelta ? { onDelta } : {},
8622
8932
  ...this.#btwSessionId !== undefined ? { previousSessionId: this.#btwSessionId } : {},
8623
- ...staged !== undefined ? { stagedModel: staged } : {}
8933
+ ...staged !== undefined ? { stagedModel: staged } : {},
8934
+ ...btwPreset !== undefined ? { agentPreset: btwPreset } : {}
8624
8935
  });
8625
8936
  this.#btwSessionId = result.sessionId;
8626
8937
  return result.answer;
@@ -8815,11 +9126,14 @@ class RemoteHostSession {
8815
9126
  await this.#attachFollow(false);
8816
9127
  return this.#sessionId;
8817
9128
  }
9129
+ const resumed = this.#resumeId !== undefined;
8818
9130
  const requestedId = this.#resumeId ?? randomUUID4();
8819
9131
  this.#resumeId = undefined;
8820
9132
  const request = { cwd: this.#cwd, sessionId: requestedId };
8821
9133
  if (this.#presetId !== undefined)
8822
9134
  request.agentPreset = this.#presetId;
9135
+ else if (!resumed && await this.#appendPresetRosterCheck())
9136
+ request.agentPreset = APPEND_SYSTEM_PRESET_ID;
8823
9137
  let value;
8824
9138
  try {
8825
9139
  value = await this.#rpc("session/create", { request });
@@ -8830,8 +9144,9 @@ class RemoteHostSession {
8830
9144
  throw error;
8831
9145
  }
8832
9146
  this.#sessionId = typeof value.sessionId === "string" ? value.sessionId : requestedId;
8833
- if (typeof value.agentPreset === "string" && value.agentPreset)
9147
+ if (typeof value.agentPreset === "string" && value.agentPreset && !(this.#presetId === undefined && value.agentPreset === APPEND_SYSTEM_PRESET_ID)) {
8834
9148
  this.#presetId = value.agentPreset;
9149
+ }
8835
9150
  if (this.#pendingModel !== undefined && this.#sessionId !== undefined) {
8836
9151
  const staged = this.#pendingModel;
8837
9152
  this.#pendingModel = undefined;
@@ -8845,7 +9160,9 @@ class RemoteHostSession {
8845
9160
  }
8846
9161
  const opening = await this.#attachFollow(false);
8847
9162
  if (opening.header.agentPreset && opening.header.agentPreset !== this.#presetId) {
8848
- this.#presetId = opening.header.agentPreset;
9163
+ if (!(this.#presetId === undefined && opening.header.agentPreset === APPEND_SYSTEM_PRESET_ID)) {
9164
+ this.#presetId = opening.header.agentPreset;
9165
+ }
8849
9166
  this.#probeExecutionMode();
8850
9167
  }
8851
9168
  return this.#sessionId;
@@ -9179,6 +9496,7 @@ class RemoteHostSession {
9179
9496
  return;
9180
9497
  if (this.#follow?.attached)
9181
9498
  return;
9499
+ this.#appendPresetChecked = false;
9182
9500
  this.#reattachInFlight = true;
9183
9501
  if (this.#awaiting)
9184
9502
  this.#setReconnecting(true);
@@ -9329,6 +9647,7 @@ var init_remote_host_session = __esm(() => {
9329
9647
  init_remote_follow();
9330
9648
  init_remote_session_ops();
9331
9649
  init_token_estimate();
9650
+ init_append_system();
9332
9651
  init_remote_stream();
9333
9652
  init_transport();
9334
9653
  init_remote_local_fs();
@@ -32444,6 +32763,9 @@ var init_config = __esm(() => {
32444
32763
  }),
32445
32764
  permissions: optional2(Literals(["prompt", "autoaccept"])).annotate({
32446
32765
  description: "Prompt for permission requests or accept them automatically"
32766
+ }),
32767
+ activity_panel_height: optional2(Literals(["1", "5", "7", "10", "all"])).annotate({
32768
+ description: "Activity panel height gear (U4): lines per think and tool block; 'all' grows the blocks freely while the whole frame never exceeds 2/3 of the terminal rows"
32447
32769
  })
32448
32770
  })).annotate({
32449
32771
  description: "Session transcript presentation settings"
@@ -33249,9 +33571,9 @@ var init_theme3 = __esm(() => {
33249
33571
  });
33250
33572
 
33251
33573
  // ../i18n/src/registry.ts
33252
- import { existsSync as existsSync8, readdirSync as readdirSync2, readFileSync as readFileSync8 } from "fs";
33253
- import { homedir as homedir3 } from "os";
33254
- import { dirname as dirname3, join as join8 } from "path";
33574
+ import { existsSync as existsSync8, readdirSync as readdirSync2, readFileSync as readFileSync9 } from "fs";
33575
+ import { homedir as homedir4 } from "os";
33576
+ import { dirname as dirname3, join as join9 } from "path";
33255
33577
  function validateLocaleFile(raw) {
33256
33578
  if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
33257
33579
  return { ok: false, errors: [{ key: "(file)", reason: "not a flat JSON object" }] };
@@ -33295,21 +33617,21 @@ function mergeTables(bundled, override) {
33295
33617
  return { ...bundled, ...override };
33296
33618
  }
33297
33619
  function userLocalesDir(dshHome) {
33298
- const home = dshHome ?? process.env.DSH_HOME ?? join8(homedir3(), ".dsh");
33299
- return join8(home, "locales");
33620
+ const home = dshHome ?? process.env.DSH_HOME ?? join9(homedir4(), ".dsh");
33621
+ return join9(home, "locales");
33300
33622
  }
33301
33623
  function bundledLocalesDir() {
33302
33624
  let dir = dirname3(new URL(import.meta.url).pathname);
33303
33625
  for (let up = 0;up < 6; up++) {
33304
- const candidate = join8(dir, "locales");
33305
- if (existsSync8(join8(candidate, `${DEFAULT_LANGUAGE}.json`)))
33626
+ const candidate = join9(dir, "locales");
33627
+ if (existsSync8(join9(candidate, `${DEFAULT_LANGUAGE}.json`)))
33306
33628
  return candidate;
33307
33629
  const parent = dirname3(dir);
33308
33630
  if (parent === dir)
33309
33631
  break;
33310
33632
  dir = parent;
33311
33633
  }
33312
- return join8(dirname3(new URL(import.meta.url).pathname), "..", "locales");
33634
+ return join9(dirname3(new URL(import.meta.url).pathname), "..", "locales");
33313
33635
  }
33314
33636
  function loadLocales(options) {
33315
33637
  const bundledDir = options?.bundledDir ?? bundledLocalesDir();
@@ -33320,7 +33642,7 @@ function loadLocales(options) {
33320
33642
  if (!entry.endsWith(".json"))
33321
33643
  continue;
33322
33644
  const id = entry.slice(0, -".json".length);
33323
- const result = parseLocaleFile(readFileSync8(join8(bundledDir, entry), "utf8"));
33645
+ const result = parseLocaleFile(readFileSync9(join9(bundledDir, entry), "utf8"));
33324
33646
  if (!result.ok) {
33325
33647
  warnings.push(`[i18n] bundled locale file rejected, skipping '${entry}': ${formatErrors(result.errors)}`);
33326
33648
  continue;
@@ -33336,7 +33658,7 @@ function loadLocales(options) {
33336
33658
  if (!entry.endsWith(".json"))
33337
33659
  continue;
33338
33660
  const id = entry.slice(0, -".json".length);
33339
- const result = parseLocaleFile(readFileSync8(join8(userDir, entry), "utf8"));
33661
+ const result = parseLocaleFile(readFileSync9(join9(userDir, entry), "utf8"));
33340
33662
  if (!result.ok) {
33341
33663
  warnings.push(`[i18n] user locale file rejected, skipping '${entry}': ${formatErrors(result.errors)}`);
33342
33664
  continue;
@@ -40753,7 +41075,7 @@ var init_string_width = __esm(() => {
40753
41075
  });
40754
41076
 
40755
41077
  // ../tui-base/src/routes/session/composer-context.tsx
40756
- import { homedir as homedir4 } from "os";
41078
+ import { homedir as homedir5 } from "os";
40757
41079
  function truncateLeft(text, limit) {
40758
41080
  if (limit <= 0)
40759
41081
  return "";
@@ -40846,7 +41168,7 @@ function ComposerContext(props) {
40846
41168
  }
40847
41169
  function safeHome() {
40848
41170
  try {
40849
- return homedir4();
41171
+ return homedir5();
40850
41172
  } catch {
40851
41173
  return;
40852
41174
  }
@@ -47007,6 +47329,50 @@ function dockLineCap(terminalRows) {
47007
47329
  return 2;
47008
47330
  return DOCK_WIDGET_MAX_LINES;
47009
47331
  }
47332
+ function activityPanelHeightFromConfig(value) {
47333
+ return typeof value === "string" && ACTIVITY_PANEL_GEARS.includes(value) ? value : undefined;
47334
+ }
47335
+ function applyActivityPanelConfig(config) {
47336
+ try {
47337
+ const session = config?.session;
47338
+ const stored = typeof session === "object" && session !== null ? session.activity_panel_height : undefined;
47339
+ if (stored === undefined || stored === null)
47340
+ return;
47341
+ const gear = activityPanelHeightFromConfig(stored);
47342
+ if (gear !== undefined)
47343
+ setActivityPanelGear(gear);
47344
+ } catch {}
47345
+ }
47346
+ function activityPanelCapSpec(gear, terminalRows) {
47347
+ if (gear === undefined)
47348
+ return {
47349
+ maxLines: dockLineCap(terminalRows)
47350
+ };
47351
+ if (terminalRows !== undefined && terminalRows <= COMPOSER_COMPACT_TERMINAL_ROWS) {
47352
+ return {
47353
+ maxLines: dockLineCap(terminalRows)
47354
+ };
47355
+ }
47356
+ if (gear === "all") {
47357
+ if (terminalRows === undefined)
47358
+ return {
47359
+ maxLines: PANEL_UNBOUNDED_LINES
47360
+ };
47361
+ return {
47362
+ maxLines: PANEL_UNBOUNDED_LINES,
47363
+ totalMaxLines: Math.max(1, Math.floor(terminalRows * 2 / 3) - 2)
47364
+ };
47365
+ }
47366
+ const cap = Number(gear);
47367
+ if (terminalRows === undefined)
47368
+ return {
47369
+ maxLines: cap
47370
+ };
47371
+ const halfBudget = Math.floor(Math.max(1, Math.floor(terminalRows * 2 / 3) - 2) / 2);
47372
+ return {
47373
+ maxLines: Math.min(cap, halfBudget)
47374
+ };
47375
+ }
47010
47376
  function skinNoticeFadeProgress(elapsedMs, ttlMs) {
47011
47377
  return Math.max(0, Math.min(1, (elapsedMs - (ttlMs - SKIN_NOTICE_FADE_MS)) / SKIN_NOTICE_FADE_MS));
47012
47378
  }
@@ -47275,6 +47641,15 @@ function dockBlocks(rows, options = {}) {
47275
47641
  fadeOutAt: row.status !== "running" ? skinStopAt(row) : undefined
47276
47642
  });
47277
47643
  }
47644
+ const totalCap = options.totalMaxLines !== undefined ? Math.max(1, Math.floor(options.totalMaxLines)) : undefined;
47645
+ if (totalCap !== undefined) {
47646
+ while (think.length + toolLines.length > totalCap && think.length + toolLines.length > 0) {
47647
+ const longer = think.length >= toolLines.length ? think : toolLines;
47648
+ if (longer.length === 0)
47649
+ break;
47650
+ longer.shift();
47651
+ }
47652
+ }
47278
47653
  return {
47279
47654
  think,
47280
47655
  tool: toolLines,
@@ -47501,9 +47876,13 @@ function WidgetsDock(props) {
47501
47876
  createEffect(() => activityFrameLatch.push(turnActive()));
47502
47877
  onCleanup(activityFrameLatch.dispose);
47503
47878
  const frame = () => activityFrameMode(dimensions().height);
47504
- const lineCap = () => dockLineCap(dimensions().height);
47879
+ const capSpec = () => activityPanelCapSpec(activityPanelGear(), dimensions().height);
47880
+ const lineCap = () => capSpec().maxLines;
47505
47881
  const frameBlocks = () => activityBlocks(props.rows, {
47506
- maxLines: lineCap()
47882
+ maxLines: lineCap(),
47883
+ ...capSpec().totalMaxLines !== undefined ? {
47884
+ totalMaxLines: capSpec().totalMaxLines
47885
+ } : {}
47507
47886
  });
47508
47887
  const frameHeight = () => 2 + frameBlocks().think.length + frameBlocks().tool.length;
47509
47888
  const accentFg = (accent) => dockAccentColor(theme, accent);
@@ -47558,6 +47937,9 @@ function WidgetsDock(props) {
47558
47937
  },
47559
47938
  get maxLines() {
47560
47939
  return lineCap();
47940
+ },
47941
+ get totalMaxLines() {
47942
+ return capSpec().totalMaxLines;
47561
47943
  }
47562
47944
  });
47563
47945
  },
@@ -47623,6 +48005,12 @@ function WidgetsDock(props) {
47623
48005
  })();
47624
48006
  }
47625
48007
  function FlatDock(props) {
48008
+ const dockOptions = () => ({
48009
+ maxLines: props.maxLines,
48010
+ ...props.totalMaxLines !== undefined ? {
48011
+ totalMaxLines: props.totalMaxLines
48012
+ } : {}
48013
+ });
47626
48014
  return (() => {
47627
48015
  var _el$6 = createElement("box");
47628
48016
  setProp(_el$6, "flexShrink", 0);
@@ -47631,15 +48019,11 @@ function FlatDock(props) {
47631
48019
  setProp(_el$6, "paddingLeft", 3);
47632
48020
  insert(_el$6, createComponent2(For, {
47633
48021
  get each() {
47634
- return dockLines(props.rows, {
47635
- maxLines: props.maxLines
47636
- });
48022
+ return dockLines(props.rows, dockOptions());
47637
48023
  },
47638
48024
  children: (line) => dockLineNode(line, props.width, props.skinCtx, props.fgFor, props.accentFg)
47639
48025
  }));
47640
- effect((_$p) => setProp(_el$6, "height", dockLines(props.rows, {
47641
- maxLines: props.maxLines
47642
- }).length, _$p));
48026
+ effect((_$p) => setProp(_el$6, "height", dockLines(props.rows, dockOptions()).length, _$p));
47643
48027
  return _el$6;
47644
48028
  })();
47645
48029
  }
@@ -47679,7 +48063,7 @@ function dockLineNode(line, width, ctx, fgFor, accentFg) {
47679
48063
  return _el$8;
47680
48064
  })();
47681
48065
  }
47682
- var SKIN_FADE_IN_MS = 400, SKIN_NOTICE_FADE_MS = 500, SKIN_PULSE_MS = 1200, SKIN_PULSE_CYCLES = 3, SKIN_PULSE_DIM = 0.45, SKIN_FAINT_MIX = 0.78, LINE_FIRST_SEEN_MAX = 512, lineFirstSeen, dockSpin, setDockSpin, TODO_MAX_ROWS = 5, TABLE_SEP = " \u2502 ", TODO_TOOL_NAMES, ACTIVITY_FRAME_BORDER_FALLBACK = "#7aa2f7", ACTIVITY_FRAME_MIN_CONTRAST = 6, ACTIVITY_BLUE_STEPS, BLUE_HUE_MIN = 190, BLUE_HUE_MAX = 250, BLUE_MIN_SATURATION = 0.25, AUTO_POLE_LIGHT = "#ffffff", AUTO_POLE_DARK = "#000000", DOCK_ACCENT_STEPS, DOCK_ACCENT_HUES, DOCK_ACCENT_FALLBACK, ACTIVITY_FRAME_DEFER_MS = 60, activityFrameLatch;
48066
+ var SKIN_FADE_IN_MS = 400, SKIN_NOTICE_FADE_MS = 500, SKIN_PULSE_MS = 1200, SKIN_PULSE_CYCLES = 3, SKIN_PULSE_DIM = 0.45, SKIN_FAINT_MIX = 0.78, ACTIVITY_PANEL_GEARS, PANEL_UNBOUNDED_LINES = 1e6, activityPanelGear, setActivityPanelGear, LINE_FIRST_SEEN_MAX = 512, lineFirstSeen, dockSpin, setDockSpin, TODO_MAX_ROWS = 5, TABLE_SEP = " \u2502 ", TODO_TOOL_NAMES, ACTIVITY_FRAME_BORDER_FALLBACK = "#7aa2f7", ACTIVITY_FRAME_MIN_CONTRAST = 6, ACTIVITY_BLUE_STEPS, BLUE_HUE_MIN = 190, BLUE_HUE_MAX = 250, BLUE_MIN_SATURATION = 0.25, AUTO_POLE_LIGHT = "#ffffff", AUTO_POLE_DARK = "#000000", DOCK_ACCENT_STEPS, DOCK_ACCENT_HUES, DOCK_ACCENT_FALLBACK, ACTIVITY_FRAME_DEFER_MS = 60, activityFrameLatch;
47683
48067
  var init_widgets_dock = __esm(() => {
47684
48068
  init_index_bun();
47685
48069
  init_index_bun();
@@ -47699,6 +48083,8 @@ var init_widgets_dock = __esm(() => {
47699
48083
  init_semantic();
47700
48084
  init_dock_visibility();
47701
48085
  init_powerline();
48086
+ ACTIVITY_PANEL_GEARS = ["1", "5", "7", "10", "all"];
48087
+ [activityPanelGear, setActivityPanelGear] = createSignal(undefined);
47702
48088
  lineFirstSeen = new Map;
47703
48089
  [dockSpin, setDockSpin] = createSignal(0);
47704
48090
  TODO_TOOL_NAMES = new Set(["todowrite", "todo_write"]);
@@ -50159,14 +50545,14 @@ var init_login = __esm(() => {
50159
50545
  });
50160
50546
 
50161
50547
  // ../tui-base/src/routes/session/export.ts
50162
- import { homedir as homedir5 } from "os";
50548
+ import { homedir as homedir6 } from "os";
50163
50549
  import { resolve as resolve5 } from "path";
50164
50550
  function exportTargetPath(sessionId, arg) {
50165
50551
  const trimmed = arg?.trim();
50166
50552
  if (trimmed)
50167
50553
  return resolve5(trimmed);
50168
50554
  const id8 = sessionId.slice(0, 8).replace(/[^A-Za-z0-9._-]/g, "-");
50169
- return resolve5(homedir5(), "Downloads", `dsh-session-${id8}.jsonl`);
50555
+ return resolve5(homedir6(), "Downloads", `dsh-session-${id8}.jsonl`);
50170
50556
  }
50171
50557
  function journalToJSONL(entries) {
50172
50558
  if (entries.length === 0)
@@ -51292,14 +51678,14 @@ var init_slash_usage = __esm(() => {
51292
51678
  });
51293
51679
 
51294
51680
  // ../tui-base/src/routes/session/skills-source.ts
51295
- import { existsSync as existsSync9, readdirSync as readdirSync3, readFileSync as readFileSync9, statSync as statSync4 } from "fs";
51296
- import { homedir as homedir6 } from "os";
51297
- import { dirname as dirname5, join as join9, resolve as resolve6 } from "path";
51681
+ import { existsSync as existsSync9, readdirSync as readdirSync3, readFileSync as readFileSync10, statSync as statSync4 } from "fs";
51682
+ import { homedir as homedir7 } from "os";
51683
+ import { dirname as dirname5, join as join10, resolve as resolve6 } from "path";
51298
51684
  import { TextAttributes as TextAttributes8 } from "@opentui/core";
51299
51685
  function findProjectRoot(cwd) {
51300
51686
  let dir = resolve6(cwd);
51301
51687
  for (let depth = 0;depth < 64; depth++) {
51302
- if (existsSync9(join9(dir, ".git")))
51688
+ if (existsSync9(join10(dir, ".git")))
51303
51689
  return dir;
51304
51690
  const parent = dirname5(dir);
51305
51691
  if (parent === dir)
@@ -51314,7 +51700,7 @@ function resolveAgentsHome(explicit) {
51314
51700
  const env = process.env.DSH_AGENTS_HOME;
51315
51701
  if (typeof env === "string" && env.trim() !== "")
51316
51702
  return resolve6(env);
51317
- return resolve6(join9(homedir6(), ".agents"));
51703
+ return resolve6(join10(homedir7(), ".agents"));
51318
51704
  }
51319
51705
  function agentsHomeEnvWarning(env, configValue) {
51320
51706
  const value = typeof env === "string" ? env : process.env.DSH_AGENTS_HOME;
@@ -51333,18 +51719,18 @@ function agentsHomeEnvWarning(env, configValue) {
51333
51719
  function skillRoots(options) {
51334
51720
  const roots = [];
51335
51721
  const projectRoot = findProjectRoot(options.cwd);
51336
- roots.push({ path: join9(projectRoot, ".dsh", "skills"), rank: 100, skipSystem: false });
51337
- roots.push({ path: join9(projectRoot, ".agents", "skills"), rank: 200, skipSystem: false });
51722
+ roots.push({ path: join10(projectRoot, ".dsh", "skills"), rank: 100, skipSystem: false });
51723
+ roots.push({ path: join10(projectRoot, ".agents", "skills"), rank: 200, skipSystem: false });
51338
51724
  for (const dir of options.customSkillDirs ?? []) {
51339
51725
  if (typeof dir === "string" && dir.trim() !== "") {
51340
51726
  roots.push({ path: resolve6(dir), rank: 300, skipSystem: false });
51341
51727
  }
51342
51728
  }
51343
51729
  if (options.dshHome !== undefined) {
51344
- roots.push({ path: join9(options.dshHome, "skills"), rank: 400, skipSystem: true });
51730
+ roots.push({ path: join10(options.dshHome, "skills"), rank: 400, skipSystem: true });
51345
51731
  }
51346
51732
  const agentsHome = resolveAgentsHome(options.agentsHome);
51347
- roots.push({ path: join9(agentsHome, "skills"), rank: 500, skipSystem: false });
51733
+ roots.push({ path: join10(agentsHome, "skills"), rank: 500, skipSystem: false });
51348
51734
  const seen = new Set;
51349
51735
  const deduped = [];
51350
51736
  for (const root of roots.sort((a, b) => a.rank - b.rank)) {
@@ -51408,7 +51794,7 @@ function oneLine(value) {
51408
51794
  function readSkillFile(path) {
51409
51795
  let raw;
51410
51796
  try {
51411
- raw = readFileSync9(path, "utf8");
51797
+ raw = readFileSync10(path, "utf8");
51412
51798
  } catch {
51413
51799
  return;
51414
51800
  }
@@ -51445,7 +51831,7 @@ function discoverSkills(options) {
51445
51831
  let isFile = entry.isFile();
51446
51832
  if (entry.isSymbolicLink()) {
51447
51833
  try {
51448
- const target = statSync4(join9(root.path, entry.name));
51834
+ const target = statSync4(join10(root.path, entry.name));
51449
51835
  isDirectory = target.isDirectory();
51450
51836
  isFile = target.isFile();
51451
51837
  } catch {
@@ -51454,9 +51840,9 @@ function discoverSkills(options) {
51454
51840
  }
51455
51841
  let file;
51456
51842
  if (isDirectory)
51457
- file = join9(root.path, entry.name, "SKILL.md");
51843
+ file = join10(root.path, entry.name, "SKILL.md");
51458
51844
  else if (isFile && entry.name.endsWith(".md"))
51459
- file = join9(root.path, entry.name);
51845
+ file = join10(root.path, entry.name);
51460
51846
  if (file === undefined)
51461
51847
  continue;
51462
51848
  const row = readSkillFile(file);
@@ -51835,14 +52221,14 @@ var init_slash_palette = __esm(() => {
51835
52221
  // ../tui-base/src/routes/session/skills-manage.ts
51836
52222
  import { existsSync as existsSync10 } from "fs";
51837
52223
  import { lstat, mkdir as mkdir3, readFile as readFile3, readdir, realpath, symlink, unlink } from "fs/promises";
51838
- import { join as join10, sep } from "path";
52224
+ import { join as join11, sep } from "path";
51839
52225
  function skillSymlinkPaths(publicDir, curatedDir, name) {
51840
- const srcMd = join10(publicDir, `${name}.md`);
52226
+ const srcMd = join11(publicDir, `${name}.md`);
51841
52227
  if (existsSync10(srcMd))
51842
- return { src: srcMd, dest: join10(curatedDir, `${name}.md`) };
51843
- const srcBundle = join10(publicDir, name);
52228
+ return { src: srcMd, dest: join11(curatedDir, `${name}.md`) };
52229
+ const srcBundle = join11(publicDir, name);
51844
52230
  if (existsSync10(srcBundle))
51845
- return { src: srcBundle, dest: join10(curatedDir, name) };
52231
+ return { src: srcBundle, dest: join11(curatedDir, name) };
51846
52232
  return;
51847
52233
  }
51848
52234
  async function installSkillSymlink(src, dest) {
@@ -51906,8 +52292,8 @@ async function applyOneSkillChange(name, targetState, publicDir, curatedDir) {
51906
52292
  }
51907
52293
  }
51908
52294
  try {
51909
- const destMd = join10(curatedDir, `${name}.md`);
51910
- const destBundle = join10(curatedDir, name);
52295
+ const destMd = join11(curatedDir, `${name}.md`);
52296
+ const destBundle = join11(curatedDir, name);
51911
52297
  const mdStat = await lstat(destMd).catch(() => {
51912
52298
  return;
51913
52299
  });
@@ -51998,14 +52384,14 @@ async function scanAvailableSkills(publicDir, curatedDir) {
51998
52384
  if (name.endsWith(".md")) {
51999
52385
  skillNames.add(name.slice(0, -3));
52000
52386
  } else if (!name.startsWith(".")) {
52001
- if (existsSync10(join10(publicDir, name, "SKILL.md")))
52387
+ if (existsSync10(join11(publicDir, name, "SKILL.md")))
52002
52388
  skillNames.add(name);
52003
52389
  }
52004
52390
  }
52005
52391
  const rows = [];
52006
52392
  for (const name of skillNames) {
52007
- const installed = existsSync10(join10(curatedDir, `${name}.md`)) || existsSync10(join10(curatedDir, name));
52008
- const description = await readSkillDescription(existsSync10(join10(publicDir, name, "SKILL.md")) ? join10(publicDir, name, "SKILL.md") : join10(publicDir, `${name}.md`));
52393
+ const installed = existsSync10(join11(curatedDir, `${name}.md`)) || existsSync10(join11(curatedDir, name));
52394
+ const description = await readSkillDescription(existsSync10(join11(publicDir, name, "SKILL.md")) ? join11(publicDir, name, "SKILL.md") : join11(publicDir, `${name}.md`));
52009
52395
  rows.push({ name, description, installed });
52010
52396
  }
52011
52397
  rows.sort((a, b) => a.name.localeCompare(b.name));
@@ -55907,6 +56293,18 @@ function buildLocalItems(input) {
55907
56293
  via: "config",
55908
56294
  key: "cacheHitMode"
55909
56295
  }
56296
+ }, {
56297
+ ...base,
56298
+ id: "activityPanelHeight",
56299
+ label: t("settings.row.activityPanelHeight"),
56300
+ value: activityPanelHeightFromConfig(merged.session?.activity_panel_height) ?? "default",
56301
+ source: "config.json \xB7 session.activity_panel_height",
56302
+ kind: "enum",
56303
+ options: ["default", "1", "5", "7", "10", "all"],
56304
+ write: {
56305
+ via: "config",
56306
+ key: "session.activity_panel_height"
56307
+ }
55910
56308
  }, {
55911
56309
  ...base,
55912
56310
  id: "retentionDays",
@@ -56116,7 +56514,7 @@ function presetEnumFromSchema(schema) {
56116
56514
  return [];
56117
56515
  return Object.keys(presets.dict);
56118
56516
  }
56119
- function planLocalWrite(item, raw, hints) {
56517
+ function planLocalWrite(item, raw, hints, session) {
56120
56518
  if (item.write?.via !== "config")
56121
56519
  return {
56122
56520
  ok: false,
@@ -56144,6 +56542,28 @@ function planLocalWrite(item, raw, hints) {
56144
56542
  applied: on
56145
56543
  };
56146
56544
  }
56545
+ if (key === "session.activity_panel_height") {
56546
+ const text = String(raw);
56547
+ const gear = text === "" || text === "default" ? undefined : activityPanelHeightFromConfig(text);
56548
+ if (text !== "" && text !== "default" && gear === undefined) {
56549
+ return {
56550
+ ok: false,
56551
+ error: t("settings.error.invalidGear", {
56552
+ value: text
56553
+ })
56554
+ };
56555
+ }
56556
+ return {
56557
+ ok: true,
56558
+ patch: {
56559
+ session: {
56560
+ ...session ?? {},
56561
+ activity_panel_height: gear
56562
+ }
56563
+ },
56564
+ applied: gear
56565
+ };
56566
+ }
56147
56567
  if (item.kind === "toggle") {
56148
56568
  const on = typeof raw === "boolean" ? raw : raw === "on" || raw === "true";
56149
56569
  return {
@@ -56444,6 +56864,9 @@ function applySettingsLive(item, applied, hints, themes) {
56444
56864
  case "lang":
56445
56865
  setHintsLocale(String(applied));
56446
56866
  break;
56867
+ case "session.activity_panel_height":
56868
+ setActivityPanelGear(applied === undefined ? undefined : activityPanelHeightFromConfig(applied));
56869
+ break;
56447
56870
  case "theme":
56448
56871
  themes?.set(String(applied), {
56449
56872
  persist: false
@@ -56474,6 +56897,7 @@ var init_settings_panel = __esm(() => {
56474
56897
  init_string_width();
56475
56898
  init_motion();
56476
56899
  init_hints_line();
56900
+ init_widgets_dock();
56477
56901
  HOST_SETTINGS_WHITELIST = [{
56478
56902
  id: "subagent.maxActiveSubagents",
56479
56903
  ns: "subagent",
@@ -56502,7 +56926,7 @@ var init_settings_panel = __esm(() => {
56502
56926
  kind: "toggle"
56503
56927
  }];
56504
56928
  HIDDEN_NAMESPACES = new Set([...HOST_SETTINGS_WHITELIST.map((spec) => spec.ns), "dsh-tui"]);
56505
- LOCAL_SETTING_IDS = ["theme", "themeMode", "workspaceThemeMode", "motion", ...FOOTER_HINT_IDS.map((id) => `footerHints.${id}`), "lang", "cacheHitMode", "retentionDays", "maxRounds", "maxRoundsGrace"];
56929
+ LOCAL_SETTING_IDS = ["theme", "themeMode", "workspaceThemeMode", "motion", ...FOOTER_HINT_IDS.map((id) => `footerHints.${id}`), "lang", "cacheHitMode", "activityPanelHeight", "retentionDays", "maxRounds", "maxRoundsGrace"];
56506
56930
  [bridgeOpen4, setBridgeOpen4] = createSignal(undefined);
56507
56931
  [panelOpen5, setPanelOpen5] = createSignal(false);
56508
56932
  settingsPanelOpen = panelOpen5;
@@ -59206,7 +59630,7 @@ var init_subagents_viewer = __esm(() => {
59206
59630
  import { TextAttributes as TextAttributes12 } from "@opentui/core";
59207
59631
  function resolveVersion() {
59208
59632
  try {
59209
- return "0.16.1";
59633
+ return "0.17.2";
59210
59634
  } catch {
59211
59635
  return "dev";
59212
59636
  }
@@ -59469,7 +59893,12 @@ async function writeSetting(row, value, deps) {
59469
59893
  error: t("settings.error.localNotWritable")
59470
59894
  };
59471
59895
  const hints = footerHintsFromConfig(deps.merged.footerHints) ?? DEFAULT_FOOTER_HINTS;
59472
- const plan = planLocalWrite(row, value, hints);
59896
+ const profileSession = deps.profile?.session;
59897
+ const mergedSession = deps.merged.session;
59898
+ const sessionSlice = typeof profileSession === "object" && profileSession !== null ? profileSession : typeof mergedSession === "object" && mergedSession !== null ? {
59899
+ ...mergedSession
59900
+ } : undefined;
59901
+ const plan = planLocalWrite(row, value, hints, sessionSlice);
59473
59902
  if (!plan.ok)
59474
59903
  return {
59475
59904
  ok: false,
@@ -59751,6 +60180,9 @@ function SettingsModalBody(props) {
59751
60180
  themes: props.themes
59752
60181
  } : {},
59753
60182
  merged: merged(),
60183
+ ...profile() !== undefined ? {
60184
+ profile: profile()
60185
+ } : {},
59754
60186
  ...document() !== undefined ? {
59755
60187
  document: document()
59756
60188
  } : {},
@@ -61664,7 +62096,7 @@ var init_session_seam_adapter = __esm(() => {
61664
62096
  });
61665
62097
 
61666
62098
  // ../tui-base/examples/v2-entry.tsx
61667
- import { join as join11 } from "path";
62099
+ import { join as join12 } from "path";
61668
62100
  async function loadShell() {
61669
62101
  const [shared, lifecycle, transport, rhs, adapter, git] = await Promise.all([
61670
62102
  Promise.resolve().then(() => (init_boot_shared(), exports_boot_shared)),
@@ -62335,8 +62767,8 @@ async function bootClientV2(options = {}) {
62335
62767
  agentsHome: agentsHomeForSkills
62336
62768
  });
62337
62769
  const skillsManagerRoots = {
62338
- source: join11(agentsHomeForSkills, "skills"),
62339
- curated: join11(host.dshHome, "skills")
62770
+ source: join12(agentsHomeForSkills, "skills"),
62771
+ curated: join12(host.dshHome, "skills")
62340
62772
  };
62341
62773
  const envTheme = process.env[shared.ENV_THEME];
62342
62774
  const workspaceConfig = seam.workspaceConfig();
@@ -62363,6 +62795,7 @@ async function bootClientV2(options = {}) {
62363
62795
  const themeModeLock = shared.themeModeFromConfig(session);
62364
62796
  setMotionTier(resolveMotionPreference(process.env[shared.ENV_MOTION], shared.motionFromConfig(session)));
62365
62797
  applyHintsConfig(seam.configLoad?.());
62798
+ applyActivityPanelConfig(seam.configLoad?.());
62366
62799
  applyI18nConfig(seam.configLoad?.());
62367
62800
  let shutdownPromise = null;
62368
62801
  const shutdown = () => {
@@ -62474,6 +62907,7 @@ var init_v2_entry = __esm(() => {
62474
62907
  init_lastrequest_dock();
62475
62908
  init_notices_dock();
62476
62909
  init_hints_line();
62910
+ init_widgets_dock();
62477
62911
  init_src();
62478
62912
  init_i18n();
62479
62913
  init_search_overlay();