@aiwayds/dsh-opentui 0.26.0 → 0.26.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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@aiwayds/dsh-opentui-bridge",
3
3
  "version": "0.1.0",
4
- "sha256": "8e5f7cad7cf11054c4d462117b079f6ddf39b2750c12a2b6479fd583dacdba58"
4
+ "sha256": "bb8e8e439911492ee14d55e85aeb72964548f51c0b09da503a32cff23050e68b"
5
5
  }
@@ -169,6 +169,12 @@ function validateAskRequest(value) {
169
169
  const escalation = optionalBoolean(value.escalation, "escalation", code);
170
170
  if (typeof escalation === "object")
171
171
  return escalation;
172
+ const childSessionId = optionalString(value.childSessionId, "childSessionId", code);
173
+ if (typeof childSessionId === "object")
174
+ return childSessionId;
175
+ const parentSessionId = optionalString(value.parentSessionId, "parentSessionId", code);
176
+ if (typeof parentSessionId === "object")
177
+ return parentSessionId;
172
178
  let questions;
173
179
  if (value.questions !== undefined) {
174
180
  if (!Array.isArray(value.questions))
@@ -193,7 +199,9 @@ function validateAskRequest(value) {
193
199
  ...questions !== undefined ? { questions } : {},
194
200
  ...deadlineAt !== undefined ? { deadlineAt } : {},
195
201
  ...detachGraceMs !== undefined ? { detachGraceMs } : {},
196
- ...escalation !== undefined ? { escalation } : {}
202
+ ...escalation !== undefined ? { escalation } : {},
203
+ ...childSessionId !== undefined ? { childSessionId } : {},
204
+ ...parentSessionId !== undefined ? { parentSessionId } : {}
197
205
  }
198
206
  };
199
207
  }
@@ -392,6 +400,7 @@ class SessionPermissionSummary {
392
400
 
393
401
  // ../bridge/src/ask-registry.ts
394
402
  var DEFAULT_RECORD_LIMIT = 256;
403
+ var DEFAULT_MAX_ASK_WAIT_MS = 3600000;
395
404
  function remember(ids, id, limit) {
396
405
  ids.add(id);
397
406
  while (ids.size > limit) {
@@ -425,7 +434,7 @@ class AskRegistry {
425
434
  constructor(options = {}) {
426
435
  this.#askDeadlineMs = options.askDeadlineMs === undefined ? null : options.askDeadlineMs;
427
436
  this.#detachGraceMs = options.detachGraceMs ?? 30000;
428
- this.#maxAskWaitMs = options.maxAskWaitMs ?? 3600000;
437
+ this.#maxAskWaitMs = options.maxAskWaitMs ?? DEFAULT_MAX_ASK_WAIT_MS;
429
438
  this.#recordLimit = options.recordLimit ?? DEFAULT_RECORD_LIMIT;
430
439
  this.#now = options.now ?? Date.now;
431
440
  this.#sink = options.sink ?? (() => {});
@@ -7804,6 +7813,19 @@ function parseRequest(raw) {
7804
7813
  const params = obj.params !== null && typeof obj.params === "object" && !Array.isArray(obj.params) ? obj.params : {};
7805
7814
  return { id, method: obj.method, params };
7806
7815
  }
7816
+ function resolveAskDeadlineMs(raw, maxAskWaitMs = DEFAULT_MAX_ASK_WAIT_MS, warn = () => {}) {
7817
+ if (raw === undefined || raw === null)
7818
+ return null;
7819
+ if (typeof raw !== "number" || Number.isNaN(raw) || raw < 0) {
7820
+ warn("[dsh-opentui-bridge] invalid askDeadlineMs %s ignored (no per-ask deadline)", String(raw));
7821
+ return null;
7822
+ }
7823
+ if (raw > maxAskWaitMs) {
7824
+ warn("[dsh-opentui-bridge] askDeadlineMs %d exceeds maxAskWaitMs %d; clamped to hard cap", raw, maxAskWaitMs);
7825
+ return maxAskWaitMs;
7826
+ }
7827
+ return raw;
7828
+ }
7807
7829
  function apply(ctx, config) {
7808
7830
  const logger = ctx.logger;
7809
7831
  if (process.env[STDIO_SWITCH] !== "1") {
@@ -8258,7 +8280,10 @@ function apply(ctx, config) {
8258
8280
  logger.warn("[dsh-opentui-bridge] ask journal append failed (decision unchanged): %s", err);
8259
8281
  }
8260
8282
  }
8283
+ const askDeadlineMsRaw = config !== null && typeof config === "object" ? config.askDeadlineMs : undefined;
8284
+ const askDeadlineMs = resolveAskDeadlineMs(askDeadlineMsRaw, DEFAULT_MAX_ASK_WAIT_MS, (fmt, ...params) => logger.warn(fmt, ...params));
8261
8285
  const ask = new AskRegistry({
8286
+ askDeadlineMs,
8262
8287
  logger,
8263
8288
  journal: writeAskJournal,
8264
8289
  sink: (frame) => {
@@ -8375,6 +8400,48 @@ function apply(ctx, config) {
8375
8400
  logger.warn("[bridge:stat] turn=%s deltas=%d tokenFrames=%d textChars=%d reasonChars=%d", state.turnId, state.deltaCount, state.tokenFrameCount, state.textAcc.length, state.reasoningAcc.length);
8376
8401
  }
8377
8402
  }
8403
+ const repinnedChildren = new Set;
8404
+ function repinChildApprovalPolicy(childId, parentSessionId) {
8405
+ if (binding === undefined || parentSessionId !== binding.sessionId)
8406
+ return;
8407
+ if (repinnedChildren.has(childId))
8408
+ return;
8409
+ const get = ctx.get;
8410
+ if (typeof get !== "function")
8411
+ return;
8412
+ let sessions;
8413
+ let approval;
8414
+ try {
8415
+ sessions = get.call(ctx, "sessions");
8416
+ approval = get.call(ctx, "approval");
8417
+ } catch {
8418
+ return;
8419
+ }
8420
+ if (typeof sessions?.get !== "function")
8421
+ return;
8422
+ let childSession;
8423
+ try {
8424
+ childSession = sessions.get(childId);
8425
+ } catch {
8426
+ return;
8427
+ }
8428
+ if (childSession === undefined || typeof childSession.append !== "function")
8429
+ return;
8430
+ if (approval !== undefined && typeof approval.overrideOf === "function") {
8431
+ const current = approval.overrideOf(childSession);
8432
+ if (current !== undefined && current !== "never") {
8433
+ repinnedChildren.add(childId);
8434
+ return;
8435
+ }
8436
+ }
8437
+ try {
8438
+ childSession.append("approval/policy", { policy: "ask" });
8439
+ repinnedChildren.add(childId);
8440
+ logger.info("[dsh-opentui-bridge] child approval re-pinned to ask child=%s parent=%s (delegation never pin overridden)", childId, parentSessionId);
8441
+ } catch (err) {
8442
+ logger.warn("[dsh-opentui-bridge] child approval re-pin failed child=%s: %s", childId, String(err));
8443
+ }
8444
+ }
8378
8445
  function onSessionEvent(session, event) {
8379
8446
  const state = activeTurn;
8380
8447
  const s = session;
@@ -8390,13 +8457,16 @@ function apply(ctx, config) {
8390
8457
  if (!childId)
8391
8458
  return;
8392
8459
  getSubagentIndex(ctx).noteCatalog(childId, sessionId, typeof data.childCreatedAt === "number" ? data.childCreatedAt : undefined);
8460
+ repinChildApprovalPolicy(childId, sessionId);
8393
8461
  const turnId = state !== undefined && !state.ended ? state.turnId : inFlightTurnId ?? "";
8394
8462
  const label = typeof data.label === "string" && data.label !== "" ? data.label : typeof data.name === "string" ? data.name : "";
8463
+ const name = typeof data.name === "string" && data.name !== "" ? data.name : "";
8395
8464
  emitEvent("agent.spawn", {
8396
8465
  turnId,
8397
8466
  sessionId: boundId,
8398
8467
  childId,
8399
8468
  label,
8469
+ ...name !== "" ? { name } : {},
8400
8470
  runId: `catalog:${childId}`,
8401
8471
  seq: 0,
8402
8472
  ...typeof data.childCreatedAt === "number" ? { childCreatedAt: data.childCreatedAt } : {}
@@ -8529,10 +8599,18 @@ function apply(ctx, config) {
8529
8599
  return;
8530
8600
  if (state.sessionId !== binding.sessionId)
8531
8601
  return;
8532
- const agentSessionId = agent?.session?.id;
8533
- if (agentSessionId !== undefined && idString(agentSessionId) !== binding.sessionId)
8602
+ const rawSessionId = agent?.session?.id;
8603
+ if (rawSessionId === undefined)
8604
+ return { turn: state, sessionId: binding.sessionId };
8605
+ const agentSessionId = idString(rawSessionId);
8606
+ if (agentSessionId === binding.sessionId)
8607
+ return { turn: state, sessionId: binding.sessionId };
8608
+ const child = getSubagentIndex(ctx).get(agentSessionId);
8609
+ if (child === undefined || child.parentSessionId !== binding.sessionId || child.status === "settled") {
8610
+ logger.warn("[dsh-opentui-bridge] ask target rejected child session=%s parent=%s (unknown/foreign/settled) — fail-closed", agentSessionId, binding.sessionId);
8534
8611
  return;
8535
- return { turn: state, sessionId: binding.sessionId };
8612
+ }
8613
+ return { turn: state, sessionId: binding.sessionId, childSessionId: agentSessionId };
8536
8614
  }
8537
8615
  const FAIL_CLOSED_UNKNOWN_SESSION = "unknown";
8538
8616
  function failClosedAsk(kind, turnId, sessionId, reason) {
@@ -8566,7 +8644,8 @@ function apply(ctx, config) {
8566
8644
  ...toolName !== undefined ? { toolName } : {},
8567
8645
  ...callId !== undefined ? { callId } : {},
8568
8646
  ...reason !== undefined ? { reason } : {},
8569
- escalation: true
8647
+ escalation: true,
8648
+ ...target.childSessionId !== undefined ? { childSessionId: target.childSessionId, parentSessionId: target.sessionId } : {}
8570
8649
  });
8571
8650
  } catch (err) {
8572
8651
  logger.error("[dsh-opentui-bridge] ask.create(approval) failed: %s", err);
@@ -8615,7 +8694,8 @@ function apply(ctx, config) {
8615
8694
  sessionId: target.sessionId,
8616
8695
  kind: "questions",
8617
8696
  questions,
8618
- ...callId !== undefined ? { callId } : {}
8697
+ ...callId !== undefined ? { callId } : {},
8698
+ ...target.childSessionId !== undefined ? { childSessionId: target.childSessionId, parentSessionId: target.sessionId } : {}
8619
8699
  });
8620
8700
  } catch (err) {
8621
8701
  logger.error("[dsh-opentui-bridge] ask.create(questions) failed: %s", err);
@@ -9532,6 +9612,7 @@ export {
9532
9612
  projectAccountScalarResult,
9533
9613
  projectAccountViewForFrame,
9534
9614
  redactIdentifier,
9615
+ resolveAskDeadlineMs,
9535
9616
  sanitizeFrameForWire,
9536
9617
  summarizeAnswers,
9537
9618
  turnIdOf,
@@ -47683,6 +47683,11 @@ var init_subagent_markers = __esm(() => {
47683
47683
  subagentMarkerViews = subagentViews;
47684
47684
  });
47685
47685
 
47686
+ // ../tui-base/src/routes/session/subagent-name.ts
47687
+ function subagentNamePrefix(name, label) {
47688
+ return name !== undefined && name !== "" && name !== label ? `${name}: ` : "";
47689
+ }
47690
+
47686
47691
  // ../tui-base/src/routes/session/subagents-picker.tsx
47687
47692
  function SubagentsPicker(props) {
47688
47693
  const theme = useThemeOptional();
@@ -47847,7 +47852,8 @@ function pickerLineText(entries, selected, showAll) {
47847
47852
  }
47848
47853
  const glyph = subagentHardStopGlyph(entry);
47849
47854
  const suffix = subagentMarkerSuffix(entry);
47850
- const label = `${glyph ? `${glyph} ` : ""}${titlecase(entry.label)}`;
47855
+ const namePrefix = subagentNamePrefix(entry.name, entry.label);
47856
+ const label = `${glyph ? `${glyph} ` : ""}${namePrefix}${titlecase(entry.label)}`;
47851
47857
  const status = entry.status === "running" ? t("overlay.picker.statusRunning") : "";
47852
47858
  return t("overlay.picker.row", {
47853
47859
  label,
@@ -49369,13 +49375,15 @@ function agentLine(agent, position, count, parentIndex, now = Date.now()) {
49369
49375
  const indent = parentIndex === undefined ? "" : " ".repeat(stringWidth(`${TODO_STATUS_GLYPHS.in_progress} ${parentIndex} `));
49370
49376
  const elapsed = secsFrom(agent.startedAt, agent.elapsedSec, now);
49371
49377
  const tail = widthTail(agent.lastLine ?? "", 32);
49378
+ const namePrefix = subagentNamePrefix(agent.name, agent.label);
49372
49379
  const content = `${agent.label} \xB7 ${elapsed} \xB7 round ${agent.rounds} \xB7 ${tail}`;
49373
49380
  return {
49374
49381
  kind: "agent",
49375
49382
  index: parentIndex,
49376
49383
  segments: [
49377
49384
  { text: `${indent}${branch}`, tone: "muted" },
49378
- { text: content, tone: "running" }
49385
+ ...namePrefix !== "" ? [{ text: namePrefix, tone: "muted" }] : [],
49386
+ { text: content, tone: "running", accent: "agent" }
49379
49387
  ]
49380
49388
  };
49381
49389
  }
@@ -49723,7 +49731,8 @@ function todoTreeLines(todos) {
49723
49731
  done,
49724
49732
  total: todos.length
49725
49733
  }),
49726
- tone: "running"
49734
+ tone: "running",
49735
+ accent: "todo"
49727
49736
  }]
49728
49737
  }];
49729
49738
  todos.forEach((todo, i) => {
@@ -49733,7 +49742,8 @@ function todoTreeLines(todos) {
49733
49742
  kind: "todo",
49734
49743
  segments: [{
49735
49744
  text: `${branch}${glyph} ${todo.content}`,
49736
- tone: "running"
49745
+ tone: "running",
49746
+ accent: "todo"
49737
49747
  }]
49738
49748
  });
49739
49749
  });
@@ -49994,6 +50004,11 @@ function activityFrameBorderColor(theme) {
49994
50004
  }
49995
50005
  function dockAccentColor(theme, accent) {
49996
50006
  const background = theme?.background?.base;
50007
+ const validatedFallback = (bg) => {
50008
+ const fallback = DOCK_ACCENT_FALLBACK[accent];
50009
+ const darkSurface = relativeLuminance(bg) < 0.5;
50010
+ return boostUntilContrast(darkSurface ? fallback.dark : fallback.light, bg, DOCK_ACCENT_MIN_CONTRAST).color;
50011
+ };
49997
50012
  const hues = theme?.hue;
49998
50013
  for (const name of DOCK_ACCENT_HUES[accent]) {
49999
50014
  const ramp = hues?.[name];
@@ -50004,14 +50019,12 @@ function dockAccentColor(theme, accent) {
50004
50019
  continue;
50005
50020
  if (background === undefined)
50006
50021
  return candidates[0];
50007
- const preferred = candidates.find((value) => contrastRatio(value, background) >= 4.5);
50022
+ const preferred = candidates.find((value) => contrastRatio(value, background) >= DOCK_ACCENT_MIN_CONTRAST);
50008
50023
  if (preferred !== undefined)
50009
50024
  return preferred;
50010
- return candidates.reduce((a, b) => contrastRatio(b, background) > contrastRatio(a, background) ? b : a);
50025
+ return validatedFallback(background);
50011
50026
  }
50012
- const fallback = DOCK_ACCENT_FALLBACK[accent];
50013
- const darkSurface = background === undefined || relativeLuminance(background) < 0.5;
50014
- return darkSurface ? fallback.dark : fallback.light;
50027
+ return background === undefined ? DOCK_ACCENT_FALLBACK[accent].dark : validatedFallback(background);
50015
50028
  }
50016
50029
  function dockNeedsClock(rows) {
50017
50030
  if (untrack(() => dockLines(rows)).length > 0)
@@ -50441,7 +50454,7 @@ function dockLineNode(line, width, ctx, fgFor, accentFg) {
50441
50454
  return _el$8;
50442
50455
  })();
50443
50456
  }
50444
- 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, ACTIVITY_PANEL_ALL_LINES = 10, activityPanelGear, setActivityPanelGear, DOCK_HEIGHT_ANIM_MS = 200, dockHeightTween, setDockHeightTween, dockHeightSettled = undefined, dockFrameNow = 0, LINE_FIRST_SEEN_MAX = 512, lineFirstSeen, dockSpin, setDockSpin, mergedDockCursor, setMergedDockCursor, todoSetSignature = (todos) => todos.map((todo) => todo.content).sort().join("\x01"), todoSetFirstSeen, 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, COMPACT_TREE_MAX_LINES = 8;
50457
+ 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, ACTIVITY_PANEL_ALL_LINES = 10, activityPanelGear, setActivityPanelGear, DOCK_HEIGHT_ANIM_MS = 200, dockHeightTween, setDockHeightTween, dockHeightSettled = undefined, dockFrameNow = 0, LINE_FIRST_SEEN_MAX = 512, lineFirstSeen, dockSpin, setDockSpin, mergedDockCursor, setMergedDockCursor, todoSetSignature = (todos) => todos.map((todo) => todo.content).sort().join("\x01"), todoSetFirstSeen, 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_MIN_CONTRAST = 4.5, DOCK_ACCENT_FALLBACK, ACTIVITY_FRAME_DEFER_MS = 60, activityFrameLatch, COMPACT_TREE_MAX_LINES = 8;
50445
50458
  var init_widgets_dock = __esm(() => {
50446
50459
  init_index_bun();
50447
50460
  init_index_bun();
@@ -50475,11 +50488,15 @@ var init_widgets_dock = __esm(() => {
50475
50488
  ACTIVITY_BLUE_STEPS = [200, 100, 300, 400, 500, 600, 700];
50476
50489
  DOCK_ACCENT_STEPS = {
50477
50490
  think: [200, 300, 100, 400, 500, 600, 700, 800, 900],
50478
- tool: [300, 200, 100, 400, 500, 600, 700, 800, 900]
50491
+ tool: [300, 200, 100, 400, 500, 600, 700, 800, 900],
50492
+ todo: [200, 300, 100, 400, 500, 600, 700, 800, 900],
50493
+ agent: [300, 200, 100, 400, 500, 600, 700, 800, 900]
50479
50494
  };
50480
50495
  DOCK_ACCENT_HUES = {
50481
50496
  think: ["purple", "violet", "accent"],
50482
- tool: ["cyan", "teal", "interactive"]
50497
+ tool: ["cyan", "teal", "interactive"],
50498
+ todo: ["green"],
50499
+ agent: ["blue"]
50483
50500
  };
50484
50501
  DOCK_ACCENT_FALLBACK = {
50485
50502
  think: {
@@ -50489,6 +50506,14 @@ var init_widgets_dock = __esm(() => {
50489
50506
  tool: {
50490
50507
  dark: "#449da7",
50491
50508
  light: "#077786"
50509
+ },
50510
+ todo: {
50511
+ dark: "#7fd88f",
50512
+ light: "#187a3b"
50513
+ },
50514
+ agent: {
50515
+ dark: "#6b82fe",
50516
+ light: "#2b44b8"
50492
50517
  }
50493
50518
  };
50494
50519
  activityFrameLatch = createFrameLatch();
@@ -51794,7 +51819,7 @@ var init_hints_line = __esm(() => {
51794
51819
  },
51795
51820
  quit: {
51796
51821
  idle: "footer.hint.quit",
51797
- busy: "footer.hint.quit"
51822
+ busy: "footer.hint.quit.busy"
51798
51823
  },
51799
51824
  scroll: {
51800
51825
  idle: "footer.hint.scroll",
@@ -54385,6 +54410,10 @@ class TurnOverlayController {
54385
54410
  const asks = (this.#pendingAsks?.() ?? []).filter((ask) => ask.kind === "approval");
54386
54411
  if (asks.length === 0)
54387
54412
  return;
54413
+ const eventId = typeof args.eventId === "string" ? args.eventId : undefined;
54414
+ if (eventId !== undefined) {
54415
+ return asks.find((ask) => ask.eventId === eventId);
54416
+ }
54388
54417
  const callId = typeof args.callId === "string" ? args.callId : undefined;
54389
54418
  if (callId !== undefined) {
54390
54419
  const byCall = asks.filter((ask) => ask.callId === callId);
@@ -64227,7 +64256,8 @@ function viewerRows(views) {
64227
64256
  function viewerRowText(view, roundCap, elapsedText) {
64228
64257
  const glyph = view.status === "running" ? "\u280B" : view.status === "completed" ? "\u2713" : view.status === "failed" ? "\u2717" : view.status === "interrupted" ? "\u2298" : "\u2014";
64229
64258
  const stop = subagentHardStopGlyph(view);
64230
- const label = `${stop ? `${stop} ` : ""}${titlecase(view.label)}`;
64259
+ const namePrefix = subagentNamePrefix(view.name, view.label);
64260
+ const label = `${stop ? `${stop} ` : ""}${namePrefix}${titlecase(view.label)}`;
64231
64261
  const suffix = subagentMarkerSuffix(view);
64232
64262
  const cap = roundCap !== undefined && roundCap > 0 ? `/${roundCap}` : "";
64233
64263
  const elapsed = elapsedText !== undefined && elapsedText !== "" ? ` \xB7 ${elapsedText}` : "";
@@ -64361,10 +64391,10 @@ function SubagentsViewer(props) {
64361
64391
  const id = browsingId();
64362
64392
  if (id === undefined)
64363
64393
  return [];
64364
- const face = props.seam.subagentTranscript;
64365
- if (face === undefined)
64394
+ const seam = props.seam;
64395
+ if (seam.subagentTranscript === undefined)
64366
64396
  return [];
64367
- return face(id);
64397
+ return seam.subagentTranscript(id);
64368
64398
  });
64369
64399
  const window = createMemo(() => transcriptWindow(transcript().length, scrollOffset(), TRANSCRIPT_ROWS));
64370
64400
  function startTicking() {
@@ -64450,12 +64480,12 @@ function SubagentsViewer(props) {
64450
64480
  flash(t("panel.subagents.status.nothingToStop"));
64451
64481
  return;
64452
64482
  }
64453
- const face = props.seam.interruptChild;
64454
- if (face === undefined) {
64483
+ const seam = props.seam;
64484
+ if (seam.interruptChild === undefined) {
64455
64485
  flash(t("panel.subagents.status.stopUnavailable"));
64456
64486
  return;
64457
64487
  }
64458
- face(id).then(() => flash(t("panel.subagents.status.stopRequested", {
64488
+ seam.interruptChild(id).then(() => flash(t("panel.subagents.status.stopRequested", {
64459
64489
  name: titlecase(view.label)
64460
64490
  }))).catch((error) => {
64461
64491
  flash(t("panel.subagents.status.stopFailed", {
@@ -64778,7 +64808,7 @@ var init_subagents_viewer = __esm(() => {
64778
64808
  import { TextAttributes as TextAttributes12 } from "@opentui/core";
64779
64809
  function resolveVersion() {
64780
64810
  try {
64781
- return "0.26.0";
64811
+ return "0.26.1";
64782
64812
  } catch {
64783
64813
  return "dev";
64784
64814
  }
@@ -67916,7 +67946,7 @@ function parseAskRequest(value) {
67916
67946
  return;
67917
67947
  }
67918
67948
  const out = { eventId, sessionId, kind };
67919
- for (const key of ["toolName", "callId", "reason"]) {
67949
+ for (const key of ["toolName", "callId", "reason", "childSessionId", "parentSessionId"]) {
67920
67950
  const v = optionalStringField(row, key);
67921
67951
  if (v !== undefined)
67922
67952
  out[key] = v;
@@ -67965,7 +67995,8 @@ function parseAskRequest(value) {
67965
67995
  function approvalArgs(request) {
67966
67996
  return {
67967
67997
  ...request.callId !== undefined ? { callId: request.callId } : {},
67968
- ...request.reason !== undefined ? { reason: request.reason } : {}
67998
+ ...request.reason !== undefined ? { reason: request.reason } : {},
67999
+ ...request.parentSessionId !== undefined ? { eventId: request.eventId } : {}
67969
68000
  };
67970
68001
  }
67971
68002
  function approvalQuestion(request) {
@@ -68154,6 +68185,7 @@ function bridgeSettleChild(existing, outcome, startedAt, now) {
68154
68185
  return {
68155
68186
  id: existing.id,
68156
68187
  label: existing.label,
68188
+ ...existing.name !== undefined ? { name: existing.name } : {},
68157
68189
  ...existing.model !== undefined ? { model: existing.model } : {},
68158
68190
  status: bridgeSettledStatus(outcome),
68159
68191
  rounds: existing.rounds,
@@ -68166,6 +68198,7 @@ function bridgeSettleChild(existing, outcome, startedAt, now) {
68166
68198
  };
68167
68199
  }
68168
68200
  function bridgeFoldAgentRecord(children, runSeq, liveStarts, type, data, now, live) {
68201
+ const name = typeof data.name === "string" && data.name !== "" ? data.name : undefined;
68169
68202
  if (type === "user/message") {
68170
68203
  const source = asRecord11(data.source);
68171
68204
  if (source.kind !== BRIDGE_SUBAGENT_SETTLED)
@@ -68188,9 +68221,11 @@ function bridgeFoldAgentRecord(children, runSeq, liveStarts, type, data, now, li
68188
68221
  const existing = children.get(childId);
68189
68222
  if (existing !== undefined && existing.status !== "running") {
68190
68223
  runSeq.set(bridgeAgentRunKey(`${BRIDGE_CATALOG_RUN_PREFIX}${childId}`, 0), childId);
68224
+ const revivedName = name ?? existing.name;
68191
68225
  children.set(childId, {
68192
68226
  id: existing.id,
68193
68227
  label: label || existing.label,
68228
+ ...revivedName !== undefined ? { name: revivedName } : {},
68194
68229
  status: "running",
68195
68230
  rounds: 0,
68196
68231
  startedAt: childCreatedAt ?? now,
@@ -68205,6 +68240,7 @@ function bridgeFoldAgentRecord(children, runSeq, liveStarts, type, data, now, li
68205
68240
  label,
68206
68241
  runId: `${BRIDGE_CATALOG_RUN_PREFIX}${childId}`,
68207
68242
  seq: 0,
68243
+ ...name !== undefined ? { name } : {},
68208
68244
  ...childCreatedAt !== undefined ? { childCreatedAt } : {},
68209
68245
  viaCatalog: true
68210
68246
  }, now, live);
@@ -68223,12 +68259,14 @@ function bridgeFoldAgentRecord(children, runSeq, liveStarts, type, data, now, li
68223
68259
  if (existing !== undefined) {
68224
68260
  const newLabel = typeof data.label === "string" ? data.label : "";
68225
68261
  const labelChanged = newLabel !== "" && newLabel !== existing.label;
68262
+ const nameChanged = name !== undefined && name !== existing.name;
68226
68263
  const upgradeStart = live && existing.status === "running" && !liveStarts.has(childId);
68227
- if (!labelChanged && !upgradeStart)
68264
+ if (!labelChanged && !nameChanged && !upgradeStart)
68228
68265
  return false;
68229
68266
  children.set(childId, {
68230
68267
  ...existing,
68231
68268
  ...labelChanged ? { label: newLabel } : {},
68269
+ ...nameChanged ? { name } : {},
68232
68270
  ...upgradeStart ? { startedAt: childCreatedAt ?? now } : {}
68233
68271
  });
68234
68272
  if (upgradeStart)
@@ -68236,7 +68274,14 @@ function bridgeFoldAgentRecord(children, runSeq, liveStarts, type, data, now, li
68236
68274
  return true;
68237
68275
  }
68238
68276
  const label = typeof data.label === "string" && data.label ? data.label : `subagent ${childId.slice(0, 8)}`;
68239
- children.set(childId, { id: childId, label, status: "running", rounds: 0, startedAt: childCreatedAt ?? now });
68277
+ children.set(childId, {
68278
+ id: childId,
68279
+ label,
68280
+ status: "running",
68281
+ rounds: 0,
68282
+ startedAt: childCreatedAt ?? now,
68283
+ ...name !== undefined ? { name } : {}
68284
+ });
68240
68285
  if (live)
68241
68286
  liveStarts.add(childId);
68242
68287
  return true;
@@ -70179,6 +70224,12 @@ class BridgeSessionSeam {
70179
70224
  for (const eventId of [...this.#pendingAsks.keys()])
70180
70225
  this.#settlePendingAsk(eventId);
70181
70226
  }
70227
+ #mountAskOnParentTrajectory(request) {
70228
+ const parent = request.parentSessionId;
70229
+ if (parent === undefined || parent === request.sessionId)
70230
+ return request;
70231
+ return { ...request, sessionId: parent };
70232
+ }
70182
70233
  #onAskEvent(frame) {
70183
70234
  const payload = asRecord11(frame.payload);
70184
70235
  if (frame.type === "ask.request" || frame.type === "ask.pending")
@@ -70186,8 +70237,9 @@ class BridgeSessionSeam {
70186
70237
  switch (frame.type) {
70187
70238
  case "ask.request": {
70188
70239
  const request = parseAskRequest(frame.payload);
70189
- if (request !== undefined)
70190
- this.#enqueueAsk(request);
70240
+ if (request !== undefined) {
70241
+ this.#enqueueAsk(this.#mountAskOnParentTrajectory(request));
70242
+ }
70191
70243
  return true;
70192
70244
  }
70193
70245
  case "ask.cancel": {
@@ -72142,5 +72194,5 @@ export {
72142
72194
  themeNameFromConfig
72143
72195
  };
72144
72196
 
72145
- //# debugId=1280DDFA8B58FE3F64756E2164756E21
72197
+ //# debugId=A3B3AF093DA737C264756E2164756E21
72146
72198
  //# sourceMappingURL=index.js.map