@aiwayds/dsh-opentui 0.13.0 → 0.13.1

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,15 @@ 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.13.1] - 2026-11-14
9
+
10
+ ### Fixed
11
+
12
+ - **Remote force-stop is honest about its outcome.** When the dedicated `subagents/interruptByParent` route is missing from the host composition, the remote subagents panel falls back to the api-session-controller's `session/cancel` on the child's own session id; both legs failing throws the combined error. `forceStop` now resolves its outcome from the wire — the cancelled settle and the hard-stop markers only fold when the stop actually landed, and a failed stop leaves the child running and reports nothing was stopped (no false ⏻ marker). The subagent policy accepts async stops and fires markers only on a resolved `true`.
13
+ - **Attachment read-back uses the full admitted wire ref.** `session/attachment` read-back now extracts the full admitted image refs (attachmentId, mediaType, bytes, width, height) from the follow journal's prompt content and sends them verbatim, instead of an id-only ref the host's strict codec rejects; a ref missing from the journal degrades to a placeholder that surfaces as a typed rejection rather than a wire fault.
14
+ - **Remote live-smoke no longer kills its own runner.** The `finally` port sweep excludes the runner's own pid, so a same-port restart's lingering carrier socket can no longer group-signal the test runner before it prints its summary.
15
+ - **E2E scenarios realigned with the current UI.** The settings scenario drives the v1.2 sectioned `/settings` modal (section navigation, instant-save enum editor, exit confirmation); the commands overflow assertion computes the count from the command registry instead of pinning a literal; gate-dark 72 boots the TUI before probing `/agents` and expects the registered-command not-mounted reply rather than the pre-C3 `unknown command` row; e2e 62 capability-gates the hard-stop ladder on the `subagents/interruptByParent` route before running it.
16
+
8
17
  ## [0.13.0] - 2026-11-14
9
18
 
10
19
  ### Added
@@ -6467,19 +6467,19 @@ async function readImageAttachment(path) {
6467
6467
  function imagePromptPart(file) {
6468
6468
  return { type: "image", mediaType: file.mediaType, data: file.data, ...file.name ? { name: file.name } : {} };
6469
6469
  }
6470
- function attachmentIdsOfPromptContent(content) {
6471
- const ids = [];
6470
+ function attachmentRefsOfPromptContent(content) {
6471
+ const refs = [];
6472
6472
  if (!Array.isArray(content))
6473
- return ids;
6473
+ return refs;
6474
6474
  for (const block of content) {
6475
6475
  const typed = block;
6476
6476
  if (typed?.type !== "image" || typeof typed.attachment !== "object" || typed.attachment === null)
6477
6477
  continue;
6478
- const attachmentId = typed.attachment.attachmentId;
6479
- if (typeof attachmentId === "string" && attachmentId)
6480
- ids.push(attachmentId);
6478
+ const ref = typed.attachment;
6479
+ if (typeof ref.attachmentId === "string" && ref.attachmentId)
6480
+ refs.push(ref);
6481
6481
  }
6482
- return ids;
6482
+ return refs;
6483
6483
  }
6484
6484
  async function fetchHostFile(baseUrl, cookieHeader, path) {
6485
6485
  const url = `${baseUrl.replace(/\/$/, "")}/api/file?path=${encodeURIComponent(path)}`;
@@ -6495,8 +6495,8 @@ async function fetchHostFile(baseUrl, cookieHeader, path) {
6495
6495
  throw new HostFileError(`GET /api/file ${path}: HTTP ${response.status}`);
6496
6496
  return new Uint8Array(await response.arrayBuffer());
6497
6497
  }
6498
- async function readSessionAttachment(rpc, sessionId, attachmentId) {
6499
- const value = await rpc("session/attachment", { request: { sessionId, attachmentId } });
6498
+ async function readSessionAttachment(rpc, sessionId, attachment) {
6499
+ const value = await rpc("session/attachment", { request: { sessionId, attachment } });
6500
6500
  const ref = typeof value.attachment === "object" && value.attachment !== null ? value.attachment : {};
6501
6501
  return {
6502
6502
  data: typeof value.data === "string" ? value.data : "",
@@ -6749,19 +6749,26 @@ class SubagentRoundPolicy {
6749
6749
  });
6750
6750
  if (spinAction === "force-stop-early") {
6751
6751
  this.#hardStopped.add(childId);
6752
- let stoppedEarly = false;
6753
- try {
6754
- stoppedEarly = this.#options.forceStop(childId);
6755
- } catch {
6756
- stoppedEarly = false;
6757
- }
6758
- if (stoppedEarly) {
6752
+ const reportEarlyStop = (stopped) => {
6753
+ if (!stopped)
6754
+ return;
6759
6755
  try {
6760
6756
  this.#options.onHardStop?.({ childId, round: count, cap: caps.cap, grace: caps.grace, early: true });
6761
6757
  } catch {}
6762
6758
  try {
6763
6759
  this.#options.onSpinStop?.(childId, count);
6764
6760
  } catch {}
6761
+ };
6762
+ let stoppedEarly = false;
6763
+ try {
6764
+ stoppedEarly = this.#options.forceStop(childId);
6765
+ } catch {
6766
+ stoppedEarly = false;
6767
+ }
6768
+ if (stoppedEarly instanceof Promise) {
6769
+ stoppedEarly.then(reportEarlyStop, () => {});
6770
+ } else {
6771
+ reportEarlyStop(stoppedEarly);
6765
6772
  }
6766
6773
  return;
6767
6774
  }
@@ -6813,19 +6820,26 @@ class SubagentRoundPolicy {
6813
6820
  return;
6814
6821
  }
6815
6822
  this.#hardStopped.add(childId);
6816
- let stopped = false;
6817
- try {
6818
- stopped = this.#options.forceStop(childId);
6819
- } catch {
6820
- stopped = false;
6821
- }
6822
- if (stopped) {
6823
+ const reportStop = (stopped) => {
6824
+ if (!stopped)
6825
+ return;
6823
6826
  try {
6824
6827
  this.#options.onHardStop?.({ childId, round: count, cap: caps.cap, grace: caps.grace });
6825
6828
  } catch {}
6826
6829
  try {
6827
6830
  this.#options.onForceStop?.(childId, count);
6828
6831
  } catch {}
6832
+ };
6833
+ let stopped = false;
6834
+ try {
6835
+ stopped = this.#options.forceStop(childId);
6836
+ } catch {
6837
+ stopped = false;
6838
+ }
6839
+ if (stopped instanceof Promise) {
6840
+ stopped.then(reportStop, () => {});
6841
+ } else {
6842
+ reportStop(stopped);
6829
6843
  }
6830
6844
  }
6831
6845
  #resolveCaps(childId, label) {
@@ -7015,10 +7029,14 @@ class RemoteSubagentPanel {
7015
7029
  },
7016
7030
  forceStop: (id) => {
7017
7031
  if (!this.#children.has(id))
7032
+ return Promise.resolve(false);
7033
+ return this.interrupt(id).then(() => {
7034
+ this.#settle(id, "cancelled");
7035
+ return true;
7036
+ }).catch((error) => {
7037
+ console.error("[remote-subagents] force-stop failed:", describeError(error));
7018
7038
  return false;
7019
- this.interrupt(id).catch(() => {});
7020
- this.#settle(id, "cancelled");
7021
- return true;
7039
+ });
7022
7040
  },
7023
7041
  onHardStop: (record) => this.#options.onHardStop?.(record),
7024
7042
  onWrapUp: (id, round) => {
@@ -7196,11 +7214,23 @@ class RemoteSubagentPanel {
7196
7214
  const parent = this.#options.parentId();
7197
7215
  if (parent === undefined)
7198
7216
  throw new Error("no live parent session");
7199
- await this.#options.rpc("subagents/interruptByParent", {
7200
- childSessionId: id,
7201
- parentSessionId: parent,
7202
- mode: "continuable"
7203
- });
7217
+ try {
7218
+ await this.#options.rpc("subagents/interruptByParent", {
7219
+ childSessionId: id,
7220
+ parentSessionId: parent,
7221
+ mode: "continuable"
7222
+ });
7223
+ return;
7224
+ } catch (dedicatedError) {
7225
+ const dedicated = describeError(dedicatedError);
7226
+ try {
7227
+ await this.#options.rpc("session/cancel", { sessionId: id });
7228
+ console.warn(`[remote-subagents] interruptByParent failed (${dedicated}) \u2014 stopped the child via session/cancel`);
7229
+ return;
7230
+ } catch (fallbackError) {
7231
+ throw new Error(`interrupt failed \u2014 interruptByParent: ${dedicated}; session/cancel fallback: ${describeError(fallbackError)}`);
7232
+ }
7233
+ }
7204
7234
  }
7205
7235
  stop() {
7206
7236
  this.#stopped = true;
@@ -7390,6 +7420,11 @@ class RemoteSubagentPanel {
7390
7420
  }
7391
7421
  }
7392
7422
  }
7423
+ function describeError(error) {
7424
+ if (error instanceof RemoteRpcError)
7425
+ return `${error.code}: ${error.message}`;
7426
+ return String(error instanceof Error ? error.message : error);
7427
+ }
7393
7428
  function lastContentLine(text) {
7394
7429
  if (text === undefined)
7395
7430
  return;
@@ -8565,22 +8600,27 @@ class RemoteHostSession {
8565
8600
  fetchHostFile(path) {
8566
8601
  return fetchHostFile(this.#baseUrl, this.#cookieHeader, path);
8567
8602
  }
8568
- lastAttachmentIds() {
8603
+ #attachmentRefsOfLastPrompt() {
8569
8604
  for (let i = this.#journal.length - 1;i >= 0; i--) {
8570
8605
  const entry = this.#journal[i];
8571
8606
  if (entry.type !== "user/message")
8572
8607
  continue;
8573
- const ids = attachmentIdsOfPromptContent(entry.data.content ?? entry.data.message?.content);
8574
- if (ids.length > 0)
8575
- return ids;
8608
+ const refs = attachmentRefsOfPromptContent(entry.data.content ?? entry.data.message?.content);
8609
+ if (refs.length > 0)
8610
+ return refs;
8576
8611
  }
8577
8612
  return [];
8578
8613
  }
8614
+ lastAttachmentIds() {
8615
+ return this.#attachmentRefsOfLastPrompt().map((ref) => ref.attachmentId);
8616
+ }
8579
8617
  readSessionAttachment(attachmentId) {
8580
8618
  const sessionId = this.#sessionId;
8581
8619
  if (sessionId === undefined)
8582
8620
  throw new Error("no live session to read attachments from");
8583
- return readSessionAttachment((method, args) => this.#rpc(method, args), sessionId, attachmentId);
8621
+ const known = this.#attachmentRefsOfLastPrompt().find((ref) => ref.attachmentId === attachmentId);
8622
+ const attachment = known ?? { attachmentId, mediaType: "", bytes: 0, width: 0, height: 0 };
8623
+ return readSessionAttachment((method, args) => this.#rpc(method, args), sessionId, attachment);
8584
8624
  }
8585
8625
  gitBranch(cwd = this.#cwd) {
8586
8626
  return probeGitBranch(cwd);
@@ -58282,7 +58322,7 @@ var init_subagents_viewer = __esm(() => {
58282
58322
  import { TextAttributes as TextAttributes12 } from "@opentui/core";
58283
58323
  function resolveVersion() {
58284
58324
  try {
58285
- return "0.13.0";
58325
+ return "0.13.1";
58286
58326
  } catch {
58287
58327
  return "dev";
58288
58328
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiwayds/dsh-opentui",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "bin": {