@aiwayds/dsh-opentui 0.26.3 → 0.27.0

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,126 @@ 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.27.0] - 2026-11-23
9
+
10
+ ### Added
11
+
12
+ - **Ctrl+C now copies the selected text in the input box.** With a selection,
13
+ `ctrl+c` writes it to the system clipboard instead of clearing the line; with
14
+ no selection it still clears a non-empty input, and on an empty input it
15
+ still quits as before. The action is exposed as the `input.copy` config
16
+ binding and is bound to `ctrl+c` on every platform plus `super+c`/`cmd+c`
17
+ where the terminal forwards it (no loss where it does not). Paste, selection
18
+ and the existing readline shortcuts are unchanged, and `ctrl+y` / `cmd+z`
19
+ are not touched.
20
+ - **The activity panel is tabbed.** A `[1 main] 2 todo` tab bar splits the
21
+ panel into the existing combined view (main) and a todo-only detail view;
22
+ click the tab text with the mouse to switch. The active tab is bracketed,
23
+ and the tabs work in both the framed and compact layouts while keeping the
24
+ panel's existing width behavior. (`alt+1` / `alt+2` are bound to the same
25
+ two actions but were not confirmed in a real terminal for this release, so
26
+ they are not advertised here yet.)
27
+ - **Bare `/permission` opens a preset picker.** With no argument the command
28
+ opens a dialog (arrow keys + Enter) over the permission presets instead of
29
+ printing the catalog; the chosen value goes through the same validation,
30
+ risk confirmation and face-switch path as `/permission <preset>`. When no
31
+ session is bound yet (before the first message, after `/new`, or after a
32
+ `/resume` that produced no turn) it now shows a friendly "send a message
33
+ first" hint instead of `no active session`. The picker marks the configured
34
+ default preset but never presents it as the live session value — the host
35
+ stays authoritative and its actual preset is not read back.
36
+ - **Panels show focus with heavy vs. thin borders.** The activity panel
37
+ (including its tab bar), the composer, the last-request dock and the
38
+ notices dock draw a heavy, accented border and title when active, and a
39
+ single, muted-but-visible border when inactive — never invisible. The
40
+ active panel follows the last interaction (a mouse click on a panel, or
41
+ typing in the composer) and defaults to the composer; popups are always
42
+ active and never dimmed. When the activity dock hides, focus returns to the
43
+ composer.
44
+ - **A subagent brief line sits above the agent list.** It reads
45
+ `subagent *N <sec>s` and shows only the number of currently running
46
+ children, never a total. Timing is per batch: it starts at the first
47
+ child's launch, children started mid-batch join the same clock, and a batch
48
+ opened after all children finish restarts from zero. When a todo brief is
49
+ also present the two share one line (`todo 2/4 178s · subagent *3 12s`).
50
+ Both the framed and compact layouts show it, using ASCII labels only so the
51
+ text survives modal popups.
52
+ - **`DSH_OPENTUI_KEY_TRACE=<file>` opts in to an input-state trace.** When the
53
+ variable is set, key and input events are written to that file to help
54
+ diagnose stray input left in the composer; tracing is off by default and
55
+ nothing is written otherwise.
56
+
57
+ ### Changed
58
+
59
+ - **Think rows no longer fade out.** A finished think/tool row used to linger
60
+ and tween to transparent for a moment after the turn ended; the activity
61
+ panel now holds the finished rows for about two seconds and then disappears
62
+ immediately, with no fading middle frame.
63
+ - **Slash-command output is shown in the info color.** The output of a slash
64
+ command is printed as plain text in the theme's info color instead of being
65
+ parsed as Markdown, so `#` and `*` in the output appear literally. Tool
66
+ execution rows, subagent status rows and relayed notices keep their existing
67
+ colors.
68
+ - **`/settings` host-side values now use the host's live configuration.**
69
+ Settings take effect immediately without a restart, persist across launcher
70
+ restarts (including `session-log-deepseek.enabled`), and display the real
71
+ host values instead of a static default; conflicts are reported the way the
72
+ host reports them. Permission-scope hints now appear in the picker header
73
+ and the settings row.
74
+ - **The approval card's `a` and `s` verdicts have explicit meanings.** `a`
75
+ means "do not ask again for this tool in this session" and `s` means "allow
76
+ all write operations in this session"; both still require an escalation
77
+ confirmation. The verdict buttons are shortened to fit on one line with a
78
+ plain-language legend in the card body and a matching hint in settings.
79
+ - **zh-CN activity tab labels are ASCII** (`main` / `todo`) rather than CJK,
80
+ because wide characters get dropped behind modal popups.
81
+
82
+ ### Fixed
83
+
84
+ - **Subagent progress no longer freezes.** The bridge forwards live progress
85
+ frames (round count and `lastLine`) from running children, folds reasoning
86
+ deltas into `lastLine`, and clears each child's progress residue when it
87
+ settles, so the tail/running view updates during the turn instead of staying
88
+ at the last value until a turn boundary.
89
+ - **Sending a message right after `/new` works again.** `/new` now closes the
90
+ old session before opening the new one; previously it opened the new session
91
+ while the old was still open and the next message failed. The seam also
92
+ recovers from that failed state.
93
+ - **Finished subagent rows no longer linger.** A child's own `turn/end` now
94
+ settles its row immediately instead of waiting for the parent's journal
95
+ `subagent-settled` notice, which left completed children shown as running for
96
+ 12–21 seconds and could make the brief count look higher than the real
97
+ concurrency (the pool limit of 3 was never exceeded). A late parent
98
+ `agent-end` no longer re-settles or revives a row, re-reading the journal
99
+ keeps the terminal state authoritative, and a child re-awakened by its parent
100
+ reappears with a fresh run.
101
+
102
+ ## [0.26.4] - 2026-11-23
103
+
104
+ ### Changed
105
+
106
+ - **`/goals` is renamed to `/goal`** to match the host/web command name. There
107
+ is no runtime alias: typing the old `/goals` now yields `unknown command`.
108
+ The seven operations (status, create, edit, pause, resume, complete, clear),
109
+ the bare-command read-only status, and the write-confirmation flow are
110
+ unchanged; saved usage counts carry over once through the renamed-command
111
+ migration.
112
+ - **The inproc profile pins the host subagent `maxDepth` to 1.** Depth is
113
+ absolute (lead 0, direct child 1): direct children are allowed, grandchildren
114
+ (depth 2) are rejected, closing the depth-≥2 delegation-gate silent-pass
115
+ window and surviving host default drift. `0` is never used — it would refuse
116
+ every delegation. The pin is the initial default of a volatile setting, so a
117
+ runtime change by the host is still possible.
118
+
119
+ ## [0.26.3] - 2026-11-22
120
+
121
+ ### Changed
122
+
123
+ - Full-access delegation now inherits the parent's approval policy across live
124
+ and resumed children (parent policy events, bind/reconcile re-sync and child
125
+ turn-start re-pin), so returning to `ask` no longer leaves a child on `never`
126
+ and silently bypasses the write-approval gate.
127
+
8
128
  ## [0.25.0] - 2026-11-22
9
129
 
10
130
  ### Added
package/README.md CHANGED
@@ -245,7 +245,7 @@ card — **Enter** allows once, **Esc** declines (fail-closed); read-only tools
245
245
  such as read_file pass straight through. `esc` ×2 + confirm stops a running
246
246
  turn. Ctrl+C twice quits. Commands (see `/help` inside the TUI for the full
247
247
  list): `/help` `/model [provider/id]` `/model discover` `/btw` `/plugins`
248
- `/goals` `/login` `/logout` `/account` `/settings` `/agents` `/skills`
248
+ `/goal` `/login` `/logout` `/account` `/settings` `/agents` `/skills`
249
249
  `/search` `/history` `/subagents` `/session` `/export` `/think` `/preset`
250
250
  `/theme` `/language` `/motion` `/hints` `/hotkeys` `/stop` `/resume` `/new`
251
251
  `/clear` `/flush` `/quit`.
@@ -299,7 +299,7 @@ Command faces backed by real host data (0.24–0.25):
299
299
  - **`/plugins`** — a plugin-manager panel with list + detail and install /
300
300
  uninstall / enable / disable behind a confirmation modal; install progress
301
301
  is polled with a bounded wait and can be cancelled.
302
- - **`/goals`** — goal data with 7 operations: status, create, edit, pause,
302
+ - **`/goal`** — goal data with 7 operations: status, create, edit, pause,
303
303
  resume, complete, clear; writes confirm first.
304
304
  - **`/model discover`** — query the current provider for its model list. The
305
305
  positive path is environment-dependent and was NOT RUN in the scratch gate
@@ -417,7 +417,7 @@ verify70 gate went green; 28 methods were hand-wired and `@manual` reached 0.
417
417
  tables plus a generic dispatch arm (ADR-0012) and a per-id allowlist take the
418
418
  wired set to 58/257 while `check-capcontract` stays green at 22/22 assertions.
419
419
  New command faces ride real host data — `/btw` side sessions, a `/plugins`
420
- manager panel with confirm-gated writes and bounded install progress, `/goals`
420
+ manager panel with confirm-gated writes and bounded install progress, `/goal`
421
421
  with 7 operations, `/model discover`, separate `/login` and `/account` domains,
422
422
  and real `/search`, `/history` and `/subagents` data. The legacy podman
423
423
  `e2e/scenarios/` container layer was retired (ADR-0013), verify70 closed at
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@aiwayds/dsh-opentui-bridge",
3
3
  "version": "0.1.0",
4
- "sha256": "1401f93e4e33ff6fd2c416de9ece67b945b05df0fdaa4411c34db2111e6341f5"
4
+ "sha256": "a393165a7ba402d107cb6b29e70978c85b49978e37aef45b8474eab9792772de"
5
5
  }
@@ -398,6 +398,14 @@ class SessionPermissionSummary {
398
398
  }
399
399
  }
400
400
 
401
+ // ../bridge/src/approval-gate.ts
402
+ var WRITE_TOOL_POLICY = Object.freeze({
403
+ bash: "ask",
404
+ write: "ask",
405
+ edit: "ask",
406
+ apply_patch: "ask"
407
+ });
408
+
401
409
  // ../bridge/src/ask-registry.ts
402
410
  var DEFAULT_RECORD_LIMIT = 256;
403
411
  var DEFAULT_MAX_ASK_WAIT_MS = 3600000;
@@ -631,6 +639,9 @@ class AskRegistry {
631
639
  if (params.behavior === "always" && entry.request.escalation !== true) {
632
640
  return { ok: false, code: ASK_ERROR_CODES.INVALID_RESPONSE, message: 'behavior:"always" needs a granted escalation' };
633
641
  }
642
+ if (params.behavior === "session" && entry.request.escalation !== true) {
643
+ return { ok: false, code: ASK_ERROR_CODES.INVALID_RESPONSE, message: 'behavior:"session" needs a granted escalation' };
644
+ }
634
645
  let outcome;
635
646
  switch (params.verdict) {
636
647
  case "allowed-once":
@@ -648,6 +659,26 @@ class AskRegistry {
648
659
  if (params.behavior === "always") {
649
660
  this.#summary.grant(sessionId, entry.request.toolName ?? params.eventId);
650
661
  }
662
+ if (params.behavior === "session") {
663
+ const sourceSession = redactIdentifier(sessionId) ?? sessionId;
664
+ const sourceTurn = redactIdentifier(entry.turnId) ?? entry.turnId;
665
+ for (const tool of Object.keys(WRITE_TOOL_POLICY)) {
666
+ this.#summary.grant(sessionId, tool);
667
+ this.#writeJournal({
668
+ eventId: entry.request.eventId,
669
+ kind: ASK_JOURNAL_KINDS.RESPONDED,
670
+ askKind: entry.request.kind,
671
+ sessionId: sourceSession,
672
+ turnId: sourceTurn,
673
+ toolName: tool,
674
+ verdict: "allowed-once",
675
+ outcome: "approved",
676
+ behavior: "always",
677
+ source: "answer",
678
+ at: this.#now()
679
+ });
680
+ }
681
+ }
651
682
  const settlement = this.#settle(entry, outcome, {
652
683
  ...params.verdict !== undefined ? { verdict: params.verdict } : {},
653
684
  ...params.behavior !== undefined ? { behavior: params.behavior } : {},
@@ -950,6 +981,13 @@ class SubagentIndex {
950
981
  if (typeof lastSeq === "number")
951
982
  row.lastSeq = lastSeq;
952
983
  }
984
+ noteRunning(childId) {
985
+ if (typeof childId !== "string" || childId === "")
986
+ return;
987
+ const row = this.rows.get(childId);
988
+ if (row !== undefined)
989
+ row.status = "running";
990
+ }
953
991
  has(childId) {
954
992
  return this.rows.has(childId);
955
993
  }
@@ -975,6 +1013,60 @@ function getSubagentIndex(ctx) {
975
1013
  }
976
1014
  return index;
977
1015
  }
1016
+
1017
+ // ../bridge/src/settings-adapter.ts
1018
+ var NS_FIELDS = ["ns", "revision", "schema", "value", "base", "user", "applies", "secrets"];
1019
+ function isObject(v) {
1020
+ return v !== null && typeof v === "object" && !Array.isArray(v);
1021
+ }
1022
+ function projectNamespace(raw) {
1023
+ if (!isObject(raw))
1024
+ return {};
1025
+ const out = {};
1026
+ for (const key of NS_FIELDS) {
1027
+ if (key === "secrets") {
1028
+ const secrets = raw.secrets;
1029
+ if (Array.isArray(secrets)) {
1030
+ out.secrets = secrets.filter(isObject).map((s) => ({ path: s.path, set: s.set }));
1031
+ }
1032
+ continue;
1033
+ }
1034
+ if (key in raw)
1035
+ out[key] = raw[key];
1036
+ }
1037
+ return out;
1038
+ }
1039
+ function extractNamespaces(result) {
1040
+ if (Array.isArray(result))
1041
+ return result;
1042
+ if (isObject(result) && Array.isArray(result.namespaces))
1043
+ return result.namespaces;
1044
+ return [];
1045
+ }
1046
+ function adaptSettingsForms(settings) {
1047
+ if (!isObject(settings))
1048
+ return;
1049
+ const host = settings;
1050
+ return {
1051
+ describe: async () => {
1052
+ if (typeof host.describe !== "function") {
1053
+ throw new Error("HOST_UNAVAILABLE: settings.describe is not available on the inproc host");
1054
+ }
1055
+ const result = await host.describe({ redactSecrets: true });
1056
+ return {
1057
+ writable: typeof host.writable === "boolean" ? host.writable : false,
1058
+ hasDocument: true,
1059
+ namespaces: extractNamespaces(result).map(projectNamespace)
1060
+ };
1061
+ },
1062
+ mutate: async (ns, ops, expectedRevision) => {
1063
+ if (typeof host.mutate !== "function") {
1064
+ throw new Error("HOST_UNAVAILABLE: settings.mutate is not available on the inproc host");
1065
+ }
1066
+ return host.mutate(ns, ops, expectedRevision);
1067
+ }
1068
+ };
1069
+ }
978
1070
  // ../../ledger/ledger.json
979
1071
  var ledger_default = {
980
1072
  attribution: "Derived from deepseek-ai/deepseek-harness (MIT, Copyright (c) 2026 DeepSeek)",
@@ -7395,7 +7487,7 @@ function createCapHostInvoke(ctx, generic = createProductionGenericConfig(ctx))
7395
7487
  }
7396
7488
  }
7397
7489
  if (methodId.startsWith("@deepseek-ai/dsh-api-settings-controller#settings/")) {
7398
- const settingsSvc = resolveSettingsController(ctx);
7490
+ const settingsSvc = resolveSettingsSurface(ctx);
7399
7491
  if (settingsSvc === undefined) {
7400
7492
  throw new Error(`NOT_WIRED: settingsController unavailable for ${methodId}`);
7401
7493
  }
@@ -7535,6 +7627,17 @@ var CAP_SETTINGS_WIRE_METHODS = {
7535
7627
  "settings.describe": "@deepseek-ai/dsh-api-settings-controller#settings/describe",
7536
7628
  "settings.mutate": "@deepseek-ai/dsh-api-settings-controller#settings/mutate"
7537
7629
  };
7630
+ function classifySettingsFrameCode(err) {
7631
+ const candidate = err !== null && typeof err === "object" ? err : undefined;
7632
+ const code = typeof candidate?.code === "string" ? candidate.code : "";
7633
+ const name = typeof candidate?.name === "string" ? candidate.name : "";
7634
+ if (code === "SETTINGS_CONFLICT" || name === "SettingsConflictError")
7635
+ return "settings/conflict";
7636
+ const message = err instanceof Error ? err.message : typeof err === "string" ? err : "";
7637
+ if (message.startsWith("NOT_WIRED") || message.includes("unavailable"))
7638
+ return "UNSUPPORTED";
7639
+ return "INTERNAL";
7640
+ }
7538
7641
  var CAP_ACCOUNT_WIRE_METHODS = {
7539
7642
  "account.getState": "@deepseek-ai/dsh-deepseek-account#account/getState",
7540
7643
  "account.hasRunningAccountTasks": "@deepseek-ai/dsh-deepseek-account#account/hasRunningAccountTasks",
@@ -7699,6 +7802,20 @@ function resolveSettingsController(ctx) {
7699
7802
  }
7700
7803
  return svc !== undefined && typeof svc === "object" ? svc : undefined;
7701
7804
  }
7805
+ function resolveSettingsSurface(ctx) {
7806
+ const controller = resolveSettingsController(ctx);
7807
+ if (controller !== undefined)
7808
+ return controller;
7809
+ let forms;
7810
+ try {
7811
+ forms = typeof ctx.get === "function" ? ctx.get("settings") : undefined;
7812
+ if (forms === undefined)
7813
+ forms = ctx.settings;
7814
+ } catch {
7815
+ forms = undefined;
7816
+ }
7817
+ return adaptSettingsForms(forms);
7818
+ }
7702
7819
  function isAccountClientMeta(v) {
7703
7820
  if (v === null || typeof v !== "object")
7704
7821
  return false;
@@ -7795,6 +7912,14 @@ function terminalFromReason(reason) {
7795
7912
  return { kind: "error", code: "FORKED", message: "turn closed by fork" };
7796
7913
  return { kind: "end" };
7797
7914
  }
7915
+ function childSettleOutcome(reason) {
7916
+ const kind = reason !== null && typeof reason === "object" ? reason.kind : reason;
7917
+ if (kind === "error" || kind === "blocked")
7918
+ return "failed";
7919
+ if (kind === "aborted" || kind === "interrupted" || kind === "forked")
7920
+ return "aborted";
7921
+ return "completed";
7922
+ }
7798
7923
  function parseRequest(raw) {
7799
7924
  let value;
7800
7925
  try {
@@ -7826,6 +7951,10 @@ function resolveAskDeadlineMs(raw, maxAskWaitMs = DEFAULT_MAX_ASK_WAIT_MS, warn
7826
7951
  }
7827
7952
  return raw;
7828
7953
  }
7954
+ var agentProgressResidues = new WeakMap;
7955
+ function probeAgentProgressResidue(ctx) {
7956
+ return agentProgressResidues.get(ctx)?.();
7957
+ }
7829
7958
  function apply(ctx, config) {
7830
7959
  const logger = ctx.logger;
7831
7960
  if (process.env[STDIO_SWITCH] !== "1") {
@@ -8235,6 +8364,122 @@ function apply(ctx, config) {
8235
8364
  function emitEvent(type, payload) {
8236
8365
  writeFrame({ type, payload });
8237
8366
  }
8367
+ const PROGRESS_THROTTLE_MS = 400;
8368
+ const childProgress = new Map;
8369
+ const progressPending = new Map;
8370
+ const progressTimers = new Map;
8371
+ const progressSentFp = new Map;
8372
+ agentProgressResidues.set(ctx, () => ({
8373
+ childProgress: childProgress.size,
8374
+ progressSentFp: progressSentFp.size
8375
+ }));
8376
+ function flushProgress(childId) {
8377
+ const snap = progressPending.get(childId);
8378
+ if (snap === undefined)
8379
+ return;
8380
+ const fp = `${snap.rounds}|${snap.lastLine}|${snap.elapsedSec}`;
8381
+ if (progressSentFp.get(childId) === fp)
8382
+ return;
8383
+ progressSentFp.set(childId, fp);
8384
+ emitEvent("agent.progress", {
8385
+ turnId: snap.turnId,
8386
+ sessionId: snap.sessionId,
8387
+ childId: snap.childId,
8388
+ rounds: snap.rounds,
8389
+ lastLine: snap.lastLine,
8390
+ elapsedSec: snap.elapsedSec
8391
+ });
8392
+ }
8393
+ function flushProgressNow(childId) {
8394
+ const timer = progressTimers.get(childId);
8395
+ if (timer !== undefined) {
8396
+ clearTimeout(timer);
8397
+ progressTimers.delete(childId);
8398
+ }
8399
+ flushProgress(childId);
8400
+ progressPending.delete(childId);
8401
+ }
8402
+ function clearChildProgress(childId) {
8403
+ childProgress.delete(childId);
8404
+ progressSentFp.delete(childId);
8405
+ }
8406
+ function flushAllProgress() {
8407
+ for (const childId of [...progressTimers.keys()])
8408
+ flushProgressNow(childId);
8409
+ for (const childId of [...progressPending.keys()])
8410
+ flushProgressNow(childId);
8411
+ }
8412
+ function clearProgressState() {
8413
+ for (const timer of progressTimers.values())
8414
+ clearTimeout(timer);
8415
+ progressTimers.clear();
8416
+ progressPending.clear();
8417
+ progressSentFp.clear();
8418
+ childProgress.clear();
8419
+ }
8420
+ function noteChildProgress(childId, roundsDelta, textDelta, lastLineOverride) {
8421
+ if (binding === undefined || childId === "" || childId === binding.sessionId)
8422
+ return;
8423
+ const row = getSubagentIndex(ctx).get(childId);
8424
+ if (row === undefined || row.parentSessionId !== binding.sessionId || row.status === "settled")
8425
+ return;
8426
+ const now = Date.now();
8427
+ let st = childProgress.get(childId);
8428
+ if (st === undefined) {
8429
+ st = { rounds: 0, lastLine: "", startedAt: row.startedAt, anchor: now };
8430
+ childProgress.set(childId, st);
8431
+ }
8432
+ st.rounds = Math.max(0, st.rounds + roundsDelta);
8433
+ if (lastLineOverride !== undefined && lastLineOverride !== "") {
8434
+ st.lastLine = lastLineOverride;
8435
+ } else if (textDelta !== "") {
8436
+ const combined = st.lastLine + textDelta;
8437
+ st.lastLine = combined.length > 240 ? combined.slice(-240) : combined;
8438
+ }
8439
+ const start = st.startedAt > 0 ? st.startedAt : st.anchor;
8440
+ const snapshot = {
8441
+ childId,
8442
+ sessionId: binding.sessionId,
8443
+ turnId: inFlightTurnId ?? "",
8444
+ rounds: st.rounds,
8445
+ lastLine: st.lastLine,
8446
+ elapsedSec: Math.max(0, Math.round((now - start) / 1000 * 10) / 10)
8447
+ };
8448
+ const prev = progressPending.get(childId);
8449
+ progressPending.set(childId, prev === undefined ? snapshot : { ...snapshot, rounds: Math.max(prev.rounds, snapshot.rounds) });
8450
+ if (progressTimers.has(childId))
8451
+ return;
8452
+ flushProgress(childId);
8453
+ const timer = setTimeout(() => {
8454
+ progressTimers.delete(childId);
8455
+ flushProgress(childId);
8456
+ progressPending.delete(childId);
8457
+ }, PROGRESS_THROTTLE_MS);
8458
+ progressTimers.set(childId, timer);
8459
+ }
8460
+ function assistantMessageLastLine(data) {
8461
+ const message = data.message !== null && typeof data.message === "object" ? data.message : undefined;
8462
+ const content = message?.content ?? data.content ?? message?.text ?? data.text;
8463
+ let text = "";
8464
+ if (typeof content === "string")
8465
+ text = content;
8466
+ else if (Array.isArray(content)) {
8467
+ const parts = [];
8468
+ for (const block of content) {
8469
+ if (block !== null && typeof block === "object") {
8470
+ const b = block;
8471
+ if (typeof b.text === "string")
8472
+ parts.push(b.text);
8473
+ }
8474
+ }
8475
+ text = parts.join("");
8476
+ }
8477
+ if (text === "")
8478
+ return "";
8479
+ const last = text.split(`
8480
+ `).pop() ?? "";
8481
+ return last.slice(0, 80);
8482
+ }
8238
8483
  const pendingAnswerers = new Map;
8239
8484
  function settleAnswerer(eventId, settlement) {
8240
8485
  const pending = pendingAnswerers.get(eventId);
@@ -8510,6 +8755,7 @@ function apply(ctx, config) {
8510
8755
  if (row !== undefined && row.parentSessionId === binding.sessionId) {
8511
8756
  const childId = sessionId;
8512
8757
  const parentId = binding.sessionId;
8758
+ index.noteRunning(sessionId);
8513
8759
  queueMicrotask(() => syncChildApprovalPolicy(childId, parentId));
8514
8760
  }
8515
8761
  }
@@ -8566,6 +8812,7 @@ function apply(ctx, config) {
8566
8812
  seq: typeof data.seq === "number" ? data.seq : -1
8567
8813
  });
8568
8814
  } else {
8815
+ flushAllProgress();
8569
8816
  emitEvent("agent.settle", {
8570
8817
  turnId,
8571
8818
  sessionId: boundId,
@@ -8576,10 +8823,29 @@ function apply(ctx, config) {
8576
8823
  }
8577
8824
  return;
8578
8825
  }
8826
+ if (type === "assistant/message" && binding !== undefined && sessionId !== binding.sessionId) {
8827
+ noteChildProgress(sessionId, 1, "", assistantMessageLastLine(data));
8828
+ }
8579
8829
  if (type === "turn/end") {
8580
8830
  const index = getSubagentIndex(ctx);
8581
- if (index.has(sessionId)) {
8831
+ const row = index.get(sessionId);
8832
+ if (row !== undefined) {
8833
+ const boundId = binding?.sessionId;
8834
+ const shouldSettle = row.status === "running" && boundId !== undefined && row.parentSessionId === boundId;
8835
+ flushProgressNow(sessionId);
8582
8836
  index.noteSettled(sessionId, typeof data.seq === "number" ? data.seq : undefined);
8837
+ clearChildProgress(sessionId);
8838
+ if (shouldSettle) {
8839
+ const turnId = state !== undefined && !state.ended ? state.turnId : inFlightTurnId ?? "";
8840
+ emitEvent("agent.settle", {
8841
+ turnId,
8842
+ sessionId: boundId,
8843
+ childId: sessionId,
8844
+ runId: `catalog:${sessionId}`,
8845
+ seq: 0,
8846
+ outcome: childSettleOutcome(data.reason)
8847
+ });
8848
+ }
8583
8849
  }
8584
8850
  }
8585
8851
  if (state === undefined || state.ended)
@@ -8640,14 +8906,21 @@ function apply(ctx, config) {
8640
8906
  }
8641
8907
  }
8642
8908
  function onAssistantStream(payload) {
8909
+ const p = payload;
8910
+ const agent = p?.agent;
8911
+ const agentId = idString(agent?.id);
8912
+ const frame = p?.frame !== null && typeof p?.frame === "object" ? p.frame : {};
8913
+ if (frame.type === "chunk" && binding !== undefined && agentId !== "" && agentId !== binding.sessionId) {
8914
+ const chunk = frame.chunk !== null && typeof frame.chunk === "object" ? frame.chunk : {};
8915
+ if ((chunk.type === "text-delta" || chunk.type === "reasoning-delta") && typeof chunk.text === "string" && chunk.text !== "") {
8916
+ noteChildProgress(agentId, 0, chunk.text);
8917
+ }
8918
+ }
8643
8919
  const state = activeTurn;
8644
8920
  if (state === undefined || state.ended)
8645
8921
  return;
8646
- const p = payload;
8647
- const agent = p?.agent;
8648
- if (idString(agent?.id) !== state.sessionId)
8922
+ if (agentId !== state.sessionId)
8649
8923
  return;
8650
- const frame = p?.frame !== null && typeof p?.frame === "object" ? p.frame : {};
8651
8924
  if (frame.type === "start") {
8652
8925
  if (typeof frame.turn === "number")
8653
8926
  state.numericTurn = frame.turn;
@@ -8822,6 +9095,7 @@ function apply(ctx, config) {
8822
9095
  } catch {}
8823
9096
  unsubSessionEvent = undefined;
8824
9097
  unsubStream = undefined;
9098
+ clearProgressState();
8825
9099
  if (activeTurn !== undefined && activeTurn.batchTimer !== undefined) {
8826
9100
  clearTimeout(activeTurn.batchTimer);
8827
9101
  }
@@ -9510,8 +9784,7 @@ function apply(ctx, config) {
9510
9784
  replyOk(req.id, result);
9511
9785
  } catch (err) {
9512
9786
  const message = err instanceof Error ? err.message : String(err);
9513
- const code = message.includes("settings/conflict") || /conflict/i.test(message) ? "settings/conflict" : message.startsWith("NOT_WIRED") || message.includes("unavailable") ? "UNSUPPORTED" : "INTERNAL";
9514
- replyError(req.id, code, message);
9787
+ replyError(req.id, classifySettingsFrameCode(err), message);
9515
9788
  }
9516
9789
  return;
9517
9790
  }
@@ -9685,6 +9958,7 @@ export {
9685
9958
  askPluginRecordType,
9686
9959
  askRegistry,
9687
9960
  classifyPushErrorCode,
9961
+ classifySettingsFrameCode,
9688
9962
  createAccountWatchRelay,
9689
9963
  createAskRegistry,
9690
9964
  createCapHostInvoke,
@@ -9695,6 +9969,7 @@ export {
9695
9969
  inject,
9696
9970
  isAskErrorCode,
9697
9971
  name,
9972
+ probeAgentProgressResidue,
9698
9973
  probeOwnedAbortRelease,
9699
9974
  projectAccountScalarResult,
9700
9975
  projectAccountViewForFrame,