@aiwayds/dsh-opentui 0.9.8 → 0.9.9

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
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.9.9] - 2026-11-12
9
+
10
+ ### Added
11
+
12
+ - **The composer top border is the context bar** — it embeds a `steer · directory · git branch` title (segments joined by ` · `, no dash runs of our own; the directory is left-clipped when the terminal is tight and a failed branch probe silently degrades to directory-only). While a turn is steering, the `steer` segment gains a braille spinner whose rotation frames advance on the shared animation tick.
13
+
8
14
  ## [0.9.8] - 2026-11-12
9
15
 
10
16
  ### Fixed
@@ -6277,22 +6277,6 @@ var init_remote_attachments = __esm(() => {
6277
6277
 
6278
6278
  // src/client/remote-btw.ts
6279
6279
  import { randomUUID as randomUUID2 } from "crypto";
6280
- import { appendFileSync } from "fs";
6281
- function btwTrace(message) {
6282
- const line = `[btw ${new Date().toISOString().slice(11, 23)}] ${message}
6283
- `;
6284
- if (process.env.DSH_OPENTUI_DEBUG)
6285
- process.stderr.write(line);
6286
- const path = process.env.DSH_OPENTUI_TRACE_FILE;
6287
- if (!path)
6288
- return;
6289
- try {
6290
- appendFileSync(path, line);
6291
- } catch {}
6292
- }
6293
- function btwOutPreview(out) {
6294
- return `out len=${out.length} head=${JSON.stringify(out.slice(0, 40))} tail=${JSON.stringify(out.slice(-40))}`;
6295
- }
6296
6280
  async function askBtw(options) {
6297
6281
  const timeoutMs = options.timeoutMs ?? 120000;
6298
6282
  let sessionId = options.previousSessionId ?? "";
@@ -6313,10 +6297,6 @@ async function askBtw(options) {
6313
6297
  let pump;
6314
6298
  let timer;
6315
6299
  let promptFailure;
6316
- let deltas = 0;
6317
- let turnEnds = 0;
6318
- let streamEnds = 0;
6319
- let streamFails = 0;
6320
6300
  const settle = (errorText) => {
6321
6301
  if (settled)
6322
6302
  return;
@@ -6329,13 +6309,11 @@ async function askBtw(options) {
6329
6309
  }).catch(() => {});
6330
6310
  };
6331
6311
  const answer = await new Promise((resolve) => {
6332
- const finish = (errorText, why) => {
6333
- if (!settled)
6334
- btwTrace(`settle why=${why} err=${errorText !== undefined} deltas=${deltas} turnEnds=${turnEnds} streamEnds=${streamEnds} streamFails=${streamFails} ${btwOutPreview(out)}${deltas === 0 && errorText === undefined ? " EARLY-EMPTY-SETTLE" : ""}`);
6312
+ const finish = (errorText) => {
6335
6313
  settle(errorText);
6336
6314
  resolve(errorText !== undefined ? errorText : out.trim());
6337
6315
  };
6338
- timer = setTimeout(() => finish(undefined, "timeout"), timeoutMs);
6316
+ timer = setTimeout(() => finish(undefined), timeoutMs);
6339
6317
  timer.unref?.();
6340
6318
  pump = openRemoteStream(options.socketFactory, "session/follow", { request: { address: { kind: "session", sessionId }, assistantStream: true } }, {
6341
6319
  onItem: (value) => {
@@ -6347,7 +6325,6 @@ async function askBtw(options) {
6347
6325
  const chunk = typeof streamFrame.chunk === "object" && streamFrame.chunk !== null ? streamFrame.chunk : {};
6348
6326
  if (chunk.type === "text-delta" && typeof chunk.text === "string" && chunk.text) {
6349
6327
  out += chunk.text;
6350
- deltas += 1;
6351
6328
  try {
6352
6329
  options.onDelta?.(out);
6353
6330
  } catch {}
@@ -6360,26 +6337,16 @@ async function askBtw(options) {
6360
6337
  return;
6361
6338
  const data = typeof event.data === "object" && event.data !== null ? event.data : {};
6362
6339
  const reason = typeof data.reason === "object" && data.reason !== null ? data.reason : {};
6363
- turnEnds += 1;
6364
- btwTrace(`recv turn/end #${turnEnds} reason=${JSON.stringify(reason.kind ?? null)} out=${out.length}`);
6365
6340
  if (reason.kind === "error") {
6366
6341
  const err = typeof reason.error === "object" && reason.error !== null ? reason.error : {};
6367
- finish(`error: ${String(err.message ?? "unknown").slice(0, 200)}`, "turn-end-error");
6342
+ finish(`error: ${String(err.message ?? "unknown").slice(0, 200)}`);
6368
6343
  return;
6369
6344
  }
6370
- finish(undefined, "turn-end");
6345
+ finish(undefined);
6371
6346
  }
6372
6347
  },
6373
- onEnd: () => {
6374
- streamEnds += 1;
6375
- btwTrace(`recv stream-end #${streamEnds} out=${out.length}`);
6376
- finish(undefined, "stream-end");
6377
- },
6378
- onFailed: (error) => {
6379
- streamFails += 1;
6380
- btwTrace(`recv stream-failed #${streamFails} ${btwOutPreview(out)} err=${String(error?.message ?? error)}`);
6381
- finish(undefined, "stream-failed");
6382
- }
6348
+ onEnd: () => finish(undefined),
6349
+ onFailed: () => finish(undefined)
6383
6350
  });
6384
6351
  const snap = options.snapshot.length > 0 ? `Recent conversation context (for reference only):
6385
6352
  ${options.snapshot.join(`
@@ -6395,7 +6362,7 @@ ${options.snapshot.join(`
6395
6362
  }
6396
6363
  }).then(() => {}, (error) => {
6397
6364
  promptFailure = { error };
6398
- finish(undefined, "prompt-rejected");
6365
+ finish(undefined);
6399
6366
  });
6400
6367
  });
6401
6368
  if (promptFailure !== undefined) {
@@ -39986,7 +39953,7 @@ function SessionComposer(props) {
39986
39953
  footerRows: FOOTER_HEIGHT,
39987
39954
  paletteRows: props.slashHeight?.() ?? 0,
39988
39955
  terminalRows: dimensions().height
39989
- }).height, _v$2 = composerBorderSides(dimensions().height), _v$3 = border().borderStyle, _v$4 = border().borderColor, _v$5 = busy() && dimensions().height > COMPOSER_COMPACT_TERMINAL_ROWS ? STEER_TITLE : undefined, _v$6 = busyColor(), _v$7 = color.background(), _v$8 = maxLines(), _v$9 = props.placeholder ?? "Type a message (enter send, alt+enter newline)", _v$0 = color.placeholder(), _v$1 = color.unfocusedText(), _v$10 = color.text(), _v$11 = busy() ? busyColor() : color.text(), _v$12 = cursor();
39956
+ }).height, _v$2 = composerBorderSides(dimensions().height), _v$3 = border().borderStyle, _v$4 = border().borderColor, _v$5 = dimensions().height > COMPOSER_COMPACT_TERMINAL_ROWS ? props.frameTitle?.() || (busy() ? STEER_TITLE : undefined) : undefined, _v$6 = border().borderColor, _v$7 = color.background(), _v$8 = maxLines(), _v$9 = props.placeholder ?? "Type a message (enter send, alt+enter newline)", _v$0 = color.placeholder(), _v$1 = color.unfocusedText(), _v$10 = color.text(), _v$11 = busy() ? busyColor() : color.text(), _v$12 = cursor();
39990
39957
  _v$ !== _p$.e && (_p$.e = setProp(_el$, "height", _v$, _p$.e));
39991
39958
  _v$2 !== _p$.t && (_p$.t = setProp(_el$, "border", _v$2, _p$.t));
39992
39959
  _v$3 !== _p$.a && (_p$.a = setProp(_el$, "borderStyle", _v$3, _p$.a));
@@ -40042,6 +40009,72 @@ var init_session_composer = __esm(() => {
40042
40009
  PALETTE_NAV_KEYS = new Set(["pageup", "pagedown", "home", "end"]);
40043
40010
  });
40044
40011
 
40012
+ // ../tui-base/src/component/spinner-frames.ts
40013
+ var SPINNER_FRAMES;
40014
+ var init_spinner_frames = __esm(() => {
40015
+ SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
40016
+ });
40017
+
40018
+ // ../tui-base/src/skin/motion.ts
40019
+ function resolveAutoTier(env = {}) {
40020
+ if (env.tmux || env.sshConnection || env.sshTty)
40021
+ return "reduced";
40022
+ if (env.truecolorConfirmed !== true)
40023
+ return "reduced";
40024
+ return "full";
40025
+ }
40026
+ function resolveEffectiveTier(user, auto) {
40027
+ return user ?? auto;
40028
+ }
40029
+ function confirmTerminalCapabilities(capabilities) {
40030
+ autoTier = resolveAutoTier({
40031
+ tmux: process.env.TMUX,
40032
+ sshConnection: process.env.SSH_CONNECTION,
40033
+ sshTty: process.env.SSH_TTY,
40034
+ truecolorConfirmed: capabilities ? capabilities.rgb : undefined
40035
+ });
40036
+ }
40037
+ function refreshAutoTier() {
40038
+ confirmTerminalCapabilities(null);
40039
+ }
40040
+ function getMotionTier() {
40041
+ return resolveEffectiveTier(userTier, autoTier);
40042
+ }
40043
+ function getMotionPreference() {
40044
+ return userTier;
40045
+ }
40046
+ function setMotionTier(tier) {
40047
+ userTier = tier === "full" || tier === "reduced" || tier === "off" ? tier : undefined;
40048
+ }
40049
+ function resolveMotionPreference(env, stored) {
40050
+ const pickTier = (raw) => {
40051
+ const value = raw?.trim().toLowerCase();
40052
+ return value === "full" || value === "reduced" || value === "off" ? value : undefined;
40053
+ };
40054
+ return pickTier(env) ?? pickTier(stored);
40055
+ }
40056
+ function setMotionBusy(value) {
40057
+ busy = value;
40058
+ }
40059
+ function motionFrameRate() {
40060
+ const tier = getMotionTier();
40061
+ if (tier === "off")
40062
+ return;
40063
+ if (tier === "reduced")
40064
+ return STREAM_FPS;
40065
+ return busy ? STREAM_FPS : IDLE_FPS;
40066
+ }
40067
+ function motionDecorationsEnabled() {
40068
+ return getMotionTier() === "full";
40069
+ }
40070
+ function motionAnimationRunning() {
40071
+ return getMotionTier() !== "off";
40072
+ }
40073
+ var STREAM_FPS = 12.5, IDLE_FPS = 24, ROLL_MS = 300, userTier = undefined, autoTier = "reduced", busy = false;
40074
+ var init_motion = __esm(() => {
40075
+ refreshAutoTier();
40076
+ });
40077
+
40045
40078
  // ../tui-base/src/util/path-format.ts
40046
40079
  import path3 from "path";
40047
40080
  function abbreviateHome(input, home) {
@@ -40100,9 +40133,40 @@ function composerContextLabel(input) {
40100
40133
  const branch = (input.branch ?? "").trim();
40101
40134
  return truncateLeft(branch ? `${dir} \xB7 ${branch}` : dir, input.maxColumns);
40102
40135
  }
40136
+ function spinnerFrame(index) {
40137
+ const count = SPINNER_FRAMES.length;
40138
+ return SPINNER_FRAMES[(index % count + count) % count];
40139
+ }
40140
+ function composerFrameTitle(input) {
40141
+ const interior = Math.max(0, input.cols - FRAME_EDGE_CELLS);
40142
+ if (interior <= 0)
40143
+ return "";
40144
+ const dir = composerContextLabel({
40145
+ cwd: input.cwd,
40146
+ home: input.home,
40147
+ maxColumns: Number.MAX_SAFE_INTEGER
40148
+ });
40149
+ if (!dir)
40150
+ return "";
40151
+ const branch = (input.branch ?? "").trim();
40152
+ const frame = input.frame ?? "";
40153
+ const steerSeg = input.steer ? frame ? `${frame} ${STEER_TEXT}` : STEER_TEXT : "";
40154
+ const segments = [steerSeg, dir, branch].filter((s) => s !== "");
40155
+ if (segments.length === 0)
40156
+ return "";
40157
+ const render = (segs) => FRAME_HEAD + segs.join(FRAME_SEP) + FRAME_TAIL;
40158
+ if (stringWidth(render(segments)) <= interior)
40159
+ return render(segments);
40160
+ const fixed = stringWidth(FRAME_HEAD) + (steerSeg ? stringWidth(steerSeg + FRAME_SEP) : 0) + (branch ? stringWidth(FRAME_SEP + branch) : 0) + stringWidth(FRAME_TAIL);
40161
+ const dirBudget = interior - fixed;
40162
+ if (dir && dirBudget >= 1) {
40163
+ return render([steerSeg, truncateLeft(dir, dirBudget), branch].filter((s) => s !== ""));
40164
+ }
40165
+ const lone = truncateLeft(dir, interior - stringWidth(FRAME_HEAD) - stringWidth(FRAME_TAIL));
40166
+ return lone ? FRAME_HEAD + lone + FRAME_TAIL : "";
40167
+ }
40103
40168
  function ComposerContext(props) {
40104
40169
  const dimensions = useTerminalSize();
40105
- const theme = useThemeOptional();
40106
40170
  const [branch, setBranch] = createSignal("");
40107
40171
  let seq = 0;
40108
40172
  createEffect(on(() => [props.cwd(), props.revision?.() ?? 0], ([cwd]) => {
@@ -40120,46 +40184,17 @@ function ComposerContext(props) {
40120
40184
  setBranch("");
40121
40185
  });
40122
40186
  }));
40123
- const label = () => composerContextLabel({
40187
+ const [spin, setSpin] = createSignal(0);
40188
+ onAnimationTick(() => props.steer?.() ? motionFrameRate() : undefined, () => setSpin((s) => (s + 1) % SPINNER_FRAMES.length));
40189
+ props.attachTitle?.(() => composerFrameTitle({
40190
+ steer: props.steer?.() ?? false,
40191
+ frame: props.steer?.() ? spinnerFrame(spin()) : undefined,
40124
40192
  cwd: props.cwd(),
40125
40193
  branch: branch(),
40126
40194
  home: safeHome(),
40127
- maxColumns: Math.max(1, dimensions().width - 1)
40128
- });
40129
- return createComponent2(Show, {
40130
- get when() {
40131
- return label().length > 0;
40132
- },
40133
- get children() {
40134
- var _el$ = createElement("box"), _el$2 = createElement("box"), _el$3 = createElement("box"), _el$4 = createElement("text");
40135
- insertNode(_el$, _el$2);
40136
- insertNode(_el$, _el$3);
40137
- setProp(_el$, "flexShrink", 0);
40138
- setProp(_el$, "flexDirection", "column");
40139
- setProp(_el$, "width", "100%");
40140
- setProp(_el$2, "flexShrink", 0);
40141
- setProp(_el$2, "height", 1);
40142
- setProp(_el$2, "width", "100%");
40143
- setProp(_el$2, "border", ["top"]);
40144
- insertNode(_el$3, _el$4);
40145
- setProp(_el$3, "flexShrink", 0);
40146
- setProp(_el$3, "height", 1);
40147
- setProp(_el$3, "width", "100%");
40148
- setProp(_el$3, "paddingLeft", 1);
40149
- setProp(_el$4, "wrapMode", "none");
40150
- insert(_el$4, label);
40151
- effect((_p$) => {
40152
- var _v$ = theme?.border.base ?? "#7aa2f7", _v$2 = theme?.text.muted ?? "#565f89";
40153
- _v$ !== _p$.e && (_p$.e = setProp(_el$2, "borderColor", _v$, _p$.e));
40154
- _v$2 !== _p$.t && (_p$.t = setProp(_el$4, "fg", _v$2, _p$.t));
40155
- return _p$;
40156
- }, {
40157
- e: undefined,
40158
- t: undefined
40159
- });
40160
- return _el$;
40161
- }
40162
- });
40195
+ cols: dimensions().width
40196
+ }));
40197
+ return;
40163
40198
  }
40164
40199
  function safeHome() {
40165
40200
  try {
@@ -40168,16 +40203,13 @@ function safeHome() {
40168
40203
  return;
40169
40204
  }
40170
40205
  }
40206
+ var FRAME_HEAD = " ", FRAME_TAIL = " ", FRAME_SEP = " \xB7 ", STEER_TEXT = "steer", FRAME_EDGE_CELLS = 4;
40171
40207
  var init_composer_context = __esm(() => {
40172
- init_index_bun();
40173
- init_index_bun();
40174
- init_index_bun();
40175
- init_index_bun();
40176
- init_index_bun();
40177
- init_index_bun();
40178
40208
  init_server();
40209
+ init_index_bun();
40179
40210
  init_terminal_size();
40180
- init_theme3();
40211
+ init_spinner_frames();
40212
+ init_motion();
40181
40213
  init_path_format();
40182
40214
  init_string_width();
40183
40215
  });
@@ -43801,12 +43833,6 @@ var init_tool_summarize = __esm(() => {
43801
43833
  init_string_width();
43802
43834
  });
43803
43835
 
43804
- // ../tui-base/src/component/spinner-frames.ts
43805
- var SPINNER_FRAMES;
43806
- var init_spinner_frames = __esm(() => {
43807
- SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
43808
- });
43809
-
43810
43836
  // ../tui-base/src/component/spinner-renderable.ts
43811
43837
  import {
43812
43838
  parseColor as parseColor2,
@@ -45087,66 +45113,6 @@ var init_dock_visibility = __esm(() => {
45087
45113
  DOCK_LINE_RETENTION_MS = DOCK_LINGER_MS + DOCK_FADE_OUT_MS;
45088
45114
  });
45089
45115
 
45090
- // ../tui-base/src/skin/motion.ts
45091
- function resolveAutoTier(env = {}) {
45092
- if (env.tmux || env.sshConnection || env.sshTty)
45093
- return "reduced";
45094
- if (env.truecolorConfirmed !== true)
45095
- return "reduced";
45096
- return "full";
45097
- }
45098
- function resolveEffectiveTier(user, auto) {
45099
- return user ?? auto;
45100
- }
45101
- function confirmTerminalCapabilities(capabilities) {
45102
- autoTier = resolveAutoTier({
45103
- tmux: process.env.TMUX,
45104
- sshConnection: process.env.SSH_CONNECTION,
45105
- sshTty: process.env.SSH_TTY,
45106
- truecolorConfirmed: capabilities ? capabilities.rgb : undefined
45107
- });
45108
- }
45109
- function refreshAutoTier() {
45110
- confirmTerminalCapabilities(null);
45111
- }
45112
- function getMotionTier() {
45113
- return resolveEffectiveTier(userTier, autoTier);
45114
- }
45115
- function getMotionPreference() {
45116
- return userTier;
45117
- }
45118
- function setMotionTier(tier) {
45119
- userTier = tier === "full" || tier === "reduced" || tier === "off" ? tier : undefined;
45120
- }
45121
- function resolveMotionPreference(env, stored) {
45122
- const pickTier = (raw) => {
45123
- const value = raw?.trim().toLowerCase();
45124
- return value === "full" || value === "reduced" || value === "off" ? value : undefined;
45125
- };
45126
- return pickTier(env) ?? pickTier(stored);
45127
- }
45128
- function setMotionBusy(value) {
45129
- busy = value;
45130
- }
45131
- function motionFrameRate() {
45132
- const tier = getMotionTier();
45133
- if (tier === "off")
45134
- return;
45135
- if (tier === "reduced")
45136
- return STREAM_FPS;
45137
- return busy ? STREAM_FPS : IDLE_FPS;
45138
- }
45139
- function motionDecorationsEnabled() {
45140
- return getMotionTier() === "full";
45141
- }
45142
- function motionAnimationRunning() {
45143
- return getMotionTier() !== "off";
45144
- }
45145
- var STREAM_FPS = 12.5, IDLE_FPS = 24, ROLL_MS = 300, userTier = undefined, autoTier = "reduced", busy = false;
45146
- var init_motion = __esm(() => {
45147
- refreshAutoTier();
45148
- });
45149
-
45150
45116
  // ../tui-base/src/routes/session/seam-rows.ts
45151
45117
  function toStoredRow(stored, index) {
45152
45118
  const kind = stored.kind === "user" || stored.kind === "tool" ? stored.kind : "assistant";
@@ -53926,10 +53892,7 @@ function BtwPanel(props) {
53926
53892
  get fallback() {
53927
53893
  return (() => {
53928
53894
  var _el$0 = createElement("text");
53929
- insert(_el$0, (() => {
53930
- var _c$2 = memo2(() => run().answer === "");
53931
- return () => _c$2() ? "(empty answer)" : run().answer;
53932
- })());
53895
+ insert(_el$0, () => run().answer);
53933
53896
  return _el$0;
53934
53897
  })();
53935
53898
  },
@@ -54771,6 +54734,7 @@ function V2SessionPage(props) {
54771
54734
  const [remoteInfo, setRemoteInfo] = createSignal();
54772
54735
  const [now, setNow] = createSignal(new Date);
54773
54736
  const [contextRevision, setContextRevision] = createSignal(0);
54737
+ let contextFrameTitle;
54774
54738
  const [presetLabel, setPresetLabel] = createSignal();
54775
54739
  const [skillRows, setSkillRows] = createSignal(props.skills ?? []);
54776
54740
  const slashCommands = createMemo(() => withSkillCommands(coreCommands(), skillRows()));
@@ -55158,12 +55122,17 @@ function V2SessionPage(props) {
55158
55122
  createComponent2(ComposerContext, {
55159
55123
  cwd: () => props.workspace,
55160
55124
  probeBranch: props.probeBranch,
55161
- revision: () => contextRevision()
55125
+ revision: () => contextRevision(),
55126
+ steer: () => composerBusy(),
55127
+ attachTitle: (get) => {
55128
+ contextFrameTitle = get;
55129
+ }
55162
55130
  }),
55163
55131
  createComponent2(SessionComposer, {
55164
55132
  seam,
55165
55133
  send,
55166
55134
  footerHint: false,
55135
+ frameTitle: () => contextFrameTitle?.() ?? "",
55167
55136
  onBusyChange: setComposerBusy,
55168
55137
  ref: (r) => composerRef = r,
55169
55138
  chooseDelivery: (text) => openDeliveryChoice(dialog, text),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiwayds/dsh-opentui",
3
- "version": "0.9.8",
3
+ "version": "0.9.9",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "bin": {