@aiwayds/dsh-opentui 0.30.0 → 0.30.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.30.2] - 2026-11-27
11
+
12
+ ### Fixed
13
+
14
+ - Plugin-registered commands were missing from the slash palette on first
15
+ open: host command rows now apply while the palette is open, plugin command
16
+ listing ensures a host session first, and host command names are normalized
17
+ to slash form (#25).
18
+
19
+ ## [0.30.1] - 2026-11-27
20
+
21
+ ### Fixed
22
+
23
+ - Subagent transcript viewer stayed empty for background agents: live
24
+ `agent.transcript` frames with an empty parent `turnId` were rejected by the
25
+ client; the seam now accepts them and dedupes by childId/runId/turnId/seq so
26
+ per-turn seq resets no longer drop rows (#23).
27
+ - Activity panel subagent rows hard-capped the latest-line preview at 32
28
+ display columns; the preview now uses the remaining row width, normalizes
29
+ streamed multiline text, and omits dangling separators for empty tails (#24).
30
+
10
31
  ## [0.30.0] - 2026-11-27
11
32
 
12
33
  ### Added
@@ -38483,6 +38483,19 @@ function widthTail(text, maxWidth) {
38483
38483
  }
38484
38484
  return out;
38485
38485
  }
38486
+ function normalizedLastLine(text) {
38487
+ if (text === undefined)
38488
+ return "";
38489
+ const lines = text.replace(/\r\n?/g, `
38490
+ `).split(`
38491
+ `);
38492
+ for (let i = lines.length - 1;i >= 0; i--) {
38493
+ const line = lines[i].trim();
38494
+ if (line !== "")
38495
+ return line.replace(/\s+/gu, " ");
38496
+ }
38497
+ return "";
38498
+ }
38486
38499
  function secsFrom(startedAt, elapsedSec, now) {
38487
38500
  if (startedAt !== undefined)
38488
38501
  return `${((now - startedAt) / 1000).toFixed(1)}s`;
@@ -38549,13 +38562,18 @@ function thinkLinesFor(row, now, spin, thinkLines) {
38549
38562
  fadeOutAt: row.streaming === true ? undefined : skinStopAt(row)
38550
38563
  }));
38551
38564
  }
38552
- function agentLine(agent, position, count, parentIndex, now = Date.now()) {
38565
+ function agentLine(agent, position, count, innerWidth, parentIndex, now = Date.now()) {
38553
38566
  const branch = position === count - 1 ? "\u2514\u2500 " : "\u251C\u2500 ";
38554
38567
  const indent = parentIndex === undefined ? "" : " ".repeat(stringWidth(`${TODO_STATUS_GLYPHS.in_progress} ${parentIndex} `));
38555
38568
  const elapsed = secsFrom(agent.startedAt, agent.elapsedSec, now);
38556
- const tail = widthTail(agent.lastLine ?? "", 32);
38557
38569
  const namePrefix = subagentNamePrefix(agent.name, agent.label);
38558
- const content = `${agent.label} \xB7 ${elapsed} \xB7 round ${agent.rounds} \xB7 ${tail}`;
38570
+ const prefix = `${indent}${branch}${namePrefix}`;
38571
+ const labelPart = `${agent.label} \xB7 ${elapsed} \xB7 round ${agent.rounds}`;
38572
+ const head = `${prefix}${labelPart}`;
38573
+ const lastLine = normalizedLastLine(agent.lastLine);
38574
+ const tailBudget = lastLine === "" ? 0 : innerWidth - stringWidth(head) - stringWidth(" \xB7 ");
38575
+ const tail = tailBudget <= 0 ? "" : widthTail(lastLine, tailBudget);
38576
+ const content = tail.trim() === "" ? labelPart : `${labelPart} \xB7 ${tail}`;
38559
38577
  return {
38560
38578
  kind: "agent",
38561
38579
  index: parentIndex,
@@ -38599,7 +38617,7 @@ function buildMergedDock(data, options) {
38599
38617
  const brief = combineBriefText(todoBriefLine(data.todos, now, data.todoStartedAt), options.subagentBrief ?? "");
38600
38618
  if (brief !== "")
38601
38619
  upperLines.push({ kind: "todo", segments: [{ text: brief, tone: "running" }] });
38602
- lowerRaw = agents.map((agent, i) => agentLine(agent, i, agents.length, undefined, now));
38620
+ lowerRaw = agents.map((agent, i) => agentLine(agent, i, agents.length, options.innerWidth, undefined, now));
38603
38621
  } else if (scene === "B") {
38604
38622
  upperLines = thinkAtGear;
38605
38623
  lowerRaw = [];
@@ -44623,18 +44641,20 @@ function seamFailureReason(error) {
44623
44641
  function mergeHostCommands(local, host, deps) {
44624
44642
  const localNames = new Set(local.map((command) => command.name.toLowerCase()));
44625
44643
  const hostRows = host.slice(0, HOST_COMMAND_CAP).map((row) => {
44626
- const rawName = row.name;
44644
+ const name = row.name.startsWith("/") ? row.name : `/${row.name}`;
44645
+ const duplicate = localNames.has(name.toLowerCase());
44627
44646
  return {
44628
- name: localNames.has(rawName.toLowerCase()) ? deps.t("command.hostSource", { name: rawName }) : rawName,
44647
+ name,
44648
+ ...duplicate ? { displayName: deps.t("command.hostSource", { name }) } : {},
44629
44649
  description: row.description,
44630
44650
  source: "host",
44631
44651
  run: async (ctx, argText) => {
44632
- const line = argText ? `${rawName} ${argText}` : rawName;
44652
+ const line = argText ? `${name} ${argText}` : name;
44633
44653
  try {
44634
44654
  const result = await ctx.seam?.hostCommands?.execute(line);
44635
- ctx.say(result === undefined ? deps.t("command.hostExecuteFailed", { name: rawName }) : result.text ?? deps.t("command.hostExecuted", { name: rawName }));
44655
+ ctx.say(result === undefined ? deps.t("command.hostExecuteFailed", { name }) : result.text ?? deps.t("command.hostExecuted", { name }));
44636
44656
  } catch {
44637
- ctx.say(deps.t("command.hostExecuteFailed", { name: rawName }));
44657
+ ctx.say(deps.t("command.hostExecuteFailed", { name }));
44638
44658
  }
44639
44659
  }
44640
44660
  };
@@ -46544,6 +46564,10 @@ class SlashPaletteController {
46544
46564
  this.#selected[1](edge === "home" ? 0 : count - 1);
46545
46565
  this.#follow(count);
46546
46566
  }
46567
+ resetSelection() {
46568
+ this.#selected[1](0);
46569
+ this.#offset[1](0);
46570
+ }
46547
46571
  current(commands) {
46548
46572
  return this.filtered(commands)[this.#selected[0]() - this.#offset[0]()];
46549
46573
  }
@@ -46607,7 +46631,7 @@ function SlashPalette(props) {
46607
46631
  insertNode(_el$3, _el$5);
46608
46632
  setProp(_el$3, "flexShrink", 0);
46609
46633
  setProp(_el$3, "wrapMode", "none");
46610
- insert(_el$3, () => command.name, _el$4);
46634
+ insert(_el$3, () => command.displayName ?? command.name, _el$4);
46611
46635
  insert(_el$5, () => command.description);
46612
46636
  effect((_p$) => {
46613
46637
  var _v$3 = active() ? row().backgroundColor : undefined, _v$4 = active() ? row().textColor : color.base(), _v$5 = paletteRowAttributes(command, active()), _v$6 = {
@@ -55675,7 +55699,7 @@ var init_subagents_viewer = __esm(() => {
55675
55699
  import { TextAttributes as TextAttributes12 } from "@opentui/core";
55676
55700
  function resolveVersion() {
55677
55701
  try {
55678
- return "0.30.0";
55702
+ return "0.30.2";
55679
55703
  } catch {
55680
55704
  return "dev";
55681
55705
  }
@@ -62104,9 +62128,17 @@ var init_bridge_session_seam = __esm(() => {
62104
62128
  return this.#hostCommandsOpsRef;
62105
62129
  }
62106
62130
  async#hostCommandsList() {
62107
- const agentId = this.currentSessionId() ?? this.stagedSessionId();
62108
- if (agentId === undefined || agentId === "")
62109
- return [];
62131
+ let agentId = this.currentSessionId() ?? this.stagedSessionId();
62132
+ if (agentId === undefined || agentId === "") {
62133
+ try {
62134
+ agentId = await this.#ensureSession();
62135
+ } catch (err) {
62136
+ this.#degradeOnce("hostCommands.list", `ensure session failed: ${err instanceof Error ? err.message : String(err)}`);
62137
+ return [];
62138
+ }
62139
+ if (agentId === undefined || agentId === "")
62140
+ return [];
62141
+ }
62110
62142
  const now = this.#confirmClock.now();
62111
62143
  const cached = this.#hostCommandsCache.get(agentId);
62112
62144
  if (cached && now - cached.fetchedAt < HOST_COMMANDS_TTL_MS)
@@ -62129,10 +62161,18 @@ var init_bridge_session_seam = __esm(() => {
62129
62161
  return request;
62130
62162
  }
62131
62163
  async#hostCommandsExecute(line) {
62132
- const agentId = this.currentSessionId() ?? this.stagedSessionId();
62164
+ let agentId = this.currentSessionId() ?? this.stagedSessionId();
62133
62165
  if (agentId === undefined || agentId === "") {
62134
- this.#degradeOnce("hostCommands.execute", "execute without an active session");
62135
- return;
62166
+ try {
62167
+ agentId = await this.#ensureSession();
62168
+ } catch (err) {
62169
+ this.#degradeOnce("hostCommands.execute", `ensure session failed: ${err instanceof Error ? err.message : String(err)}`);
62170
+ return;
62171
+ }
62172
+ if (agentId === undefined || agentId === "") {
62173
+ this.#degradeOnce("hostCommands.execute", "execute without an active session");
62174
+ return;
62175
+ }
62136
62176
  }
62137
62177
  try {
62138
62178
  const result = await this.#hostCommandsOps().commandsExecute(agentId, line);
@@ -62340,6 +62380,7 @@ var init_bridge_session_seam = __esm(() => {
62340
62380
  #appliedReplayKeys = new Set;
62341
62381
  #recoveryState = "idle";
62342
62382
  #pendingOpen;
62383
+ #ensureSessionInFlight;
62343
62384
  #inFlightTurnId;
62344
62385
  #sideSessionInFlight = false;
62345
62386
  #lastSideSessionId;
@@ -63397,10 +63438,10 @@ var init_bridge_session_seam = __esm(() => {
63397
63438
  const frameSession = typeof payload.sessionId === "string" ? payload.sessionId : "";
63398
63439
  const childId = typeof payload.childId === "string" ? payload.childId : "";
63399
63440
  const turnId = typeof payload.turnId === "string" ? payload.turnId : "";
63400
- const runId = typeof payload.runId === "string" && payload.runId !== "" ? payload.runId : turnId;
63441
+ const runId = typeof payload.runId === "string" ? payload.runId : "";
63401
63442
  const seq = typeof payload.seq === "number" && Number.isFinite(payload.seq) ? payload.seq : -1;
63402
63443
  const rows = payload.rows;
63403
- if (childId === "" || turnId === "" || seq < 0 || !Array.isArray(rows))
63444
+ if (childId === "" || runId === "" && turnId === "" || seq < 0 || !Array.isArray(rows))
63404
63445
  return;
63405
63446
  if (this.#subagentTranscriptSettled.has(childId))
63406
63447
  return;
@@ -63413,8 +63454,8 @@ var init_bridge_session_seam = __esm(() => {
63413
63454
  } else if (frameSession !== "" && frameSession !== this.#subagentSessionId)
63414
63455
  return;
63415
63456
  let run = this.#subagentTranscriptRuns.get(childId);
63416
- if (run === undefined || run.runId !== runId) {
63417
- run = { runId, seen: new Set };
63457
+ if (run === undefined || run.runId !== runId || run.turnId !== turnId) {
63458
+ run = { runId, turnId, seen: new Set };
63418
63459
  this.#subagentTranscriptRuns.set(childId, run);
63419
63460
  }
63420
63461
  if (run.seen.has(seq))
@@ -63707,16 +63748,11 @@ var init_bridge_session_seam = __esm(() => {
63707
63748
  this.#cancelAsksForTurn(endedTurnId);
63708
63749
  done?.();
63709
63750
  }
63710
- async turn(userText, cb) {
63711
- if (this.#inFlightGeneration !== 0) {
63712
- throw new BridgeProtocolError("TURN_REENTRANT", "turn() called while another turn is in flight; await the first turn()", { activeTurnId: this.#inFlightTurnId });
63713
- }
63714
- const gen = ++this.#turnGeneration;
63715
- this.#inFlightGeneration = gen;
63716
- this.#deadInFlight = undefined;
63717
- this.#inFlightPartial = "";
63718
- let sendFailed;
63719
- try {
63751
+ #ensureSession() {
63752
+ const inFlight = this.#ensureSessionInFlight;
63753
+ if (inFlight !== undefined)
63754
+ return inFlight;
63755
+ const task = (async () => {
63720
63756
  if (this.#pendingOpen === undefined && !this.#sessionAttached) {
63721
63757
  this.#pendingOpen = { mode: "new" };
63722
63758
  }
@@ -63738,23 +63774,40 @@ var init_bridge_session_seam = __esm(() => {
63738
63774
  throw new BridgeProtocolError("DISPOSED", "bridge seam is disposed");
63739
63775
  }
63740
63776
  const params = pending.mode === "resume" ? { mode: "resume", id: pending.id, ...this.#sessionAttached ? { replace: true } : {} } : { mode: "new" };
63741
- try {
63742
- const opened = asRecord14(await this.#transport.request("session.open", params));
63743
- if (typeof opened.sessionId === "string") {
63744
- this.#currentSessionId = opened.sessionId;
63745
- this.#resetHostCommands();
63746
- }
63747
- if (this.#lastAppliedSessionId !== this.#currentSessionId) {
63748
- this.#lastAppliedSessionId = this.#currentSessionId;
63749
- this.#lastAppliedSeq = undefined;
63750
- this.#appliedReplayKeys.clear();
63751
- this.#resetModelRoute();
63752
- }
63753
- this.#sessionAttached = true;
63754
- } catch (err) {
63755
- throw err;
63777
+ const opened = asRecord14(await this.#transport.request("session.open", params));
63778
+ if (typeof opened.sessionId === "string") {
63779
+ this.#currentSessionId = opened.sessionId;
63780
+ this.#resetHostCommands();
63756
63781
  }
63782
+ if (this.#lastAppliedSessionId !== this.#currentSessionId) {
63783
+ this.#lastAppliedSessionId = this.#currentSessionId;
63784
+ this.#lastAppliedSeq = undefined;
63785
+ this.#appliedReplayKeys.clear();
63786
+ this.#resetModelRoute();
63787
+ }
63788
+ this.#sessionAttached = true;
63757
63789
  }
63790
+ return this.#currentSessionId;
63791
+ })();
63792
+ this.#ensureSessionInFlight = task;
63793
+ const clear = () => {
63794
+ if (this.#ensureSessionInFlight === task)
63795
+ this.#ensureSessionInFlight = undefined;
63796
+ };
63797
+ task.then(clear, clear);
63798
+ return task;
63799
+ }
63800
+ async turn(userText, cb) {
63801
+ if (this.#inFlightGeneration !== 0) {
63802
+ throw new BridgeProtocolError("TURN_REENTRANT", "turn() called while another turn is in flight; await the first turn()", { activeTurnId: this.#inFlightTurnId });
63803
+ }
63804
+ const gen = ++this.#turnGeneration;
63805
+ this.#inFlightGeneration = gen;
63806
+ this.#deadInFlight = undefined;
63807
+ this.#inFlightPartial = "";
63808
+ let sendFailed;
63809
+ try {
63810
+ await this.#ensureSession();
63758
63811
  this.#activeCallbacks = cb;
63759
63812
  const done = new Promise((resolve) => {
63760
63813
  this.#turnDone = resolve;
@@ -65025,22 +65078,17 @@ function V2SessionPageBody(props) {
65025
65078
  clearRecoveryUi: () => recovery.clearRecoveryState()
65026
65079
  }));
65027
65080
  let paletteWasOpen = false;
65028
- let pendingHostRows;
65029
65081
  const applyHostRows = (rows) => {
65030
- pendingHostRows = undefined;
65031
65082
  setHostRows(rows);
65032
65083
  setHostRowsRevision((n) => n + 1);
65084
+ if (slash.controller.open)
65085
+ slash.controller.resetSelection();
65033
65086
  };
65034
65087
  const pullHostRows = () => {
65035
65088
  const face = seam.hostCommands;
65036
65089
  if (!face?.available())
65037
65090
  return;
65038
- face.list().then((rows) => {
65039
- if (slash.controller.open)
65040
- pendingHostRows = rows;
65041
- else
65042
- applyHostRows(rows);
65043
- }).catch(() => {});
65091
+ face.list().then((rows) => applyHostRows(rows)).catch(() => {});
65044
65092
  };
65045
65093
  const slashSync = (buffer) => {
65046
65094
  const wasOpen = paletteWasOpen;
@@ -65049,8 +65097,6 @@ function V2SessionPageBody(props) {
65049
65097
  if (open && !wasOpen) {
65050
65098
  seam.hostCommands?.refresh();
65051
65099
  pullHostRows();
65052
- } else if (!open && pendingHostRows !== undefined) {
65053
- applyHostRows(pendingHostRows);
65054
65100
  }
65055
65101
  paletteWasOpen = open;
65056
65102
  };
@@ -65904,5 +65950,5 @@ if (import.meta.main) {
65904
65950
  main();
65905
65951
  }
65906
65952
 
65907
- //# debugId=C42A38938DADC27A64756E2164756E21
65953
+ //# debugId=BF6CBB1CD4EC280664756E2164756E21
65908
65954
  //# sourceMappingURL=index.js.map