@aiwayds/dsh-opentui 0.13.0 → 0.14.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,28 @@ 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.14.0] - 2026-11-14
9
+
10
+ ### Added
11
+
12
+ - **`/export` writes the session journal to JSONL.** The new slash command exports the active session's journal via the production sessionJournal seam (`session/page` pagination) to a JSONL file — default `~/Downloads/dsh-session-<id8>.jsonl`, an explicit `[path]` argument overrides it. The completion line reports the record count and absolute path and labels the output as the host journal format (no cross-client replay claim); no session or no face degrades to a notice instead of a crash.
13
+ - **Ask free-text answers.** Every ask question gains a `Type something.` sentinel row: selecting it switches to an inline input (Enter submits, Esc returns to the picker without declining the batch), the submission rides `Answer.custom` with strict option/custom mutual exclusion, and a `✎` marker tracks the typed answer through the review gate. Multi-question batches settle custom answers through the same review flow as picks.
14
+
15
+ ### Fixed
16
+
17
+ - **Skills uninstall no longer follows links outside the managed root.** Uninstall resolves the link's realpath and refuses targets outside the skills source root (batch rows fold as `external target (not ours)`); dangling or looping dead links stay removable, and untestable errno states (EACCES/EIO) fail safe by refusing, mirroring the install-side discipline.
18
+ - **Blank `agentsHome` is visible instead of silent.** A set-but-empty `DSH_AGENTS_HOME` or an empty `agentsHome` config key boots with a notice explaining the client falls back to `~/.agents` while the host resolves the empty value to the cwd, naming the fix for each leg (and both); the resolution itself stays defensive on the client.
19
+ - **Ask scenario navigation is row-aware.** The `60-ask-user` e2e scenario walks the picker by the highlighted row instead of a fixed step count, so the sentinel row's wrap shift can no longer flip which option a blind arrow press toggles.
20
+
21
+ ## [0.13.1] - 2026-11-14
22
+
23
+ ### Fixed
24
+
25
+ - **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`.
26
+ - **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.
27
+ - **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.
28
+ - **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.
29
+
8
30
  ## [0.13.0] - 2026-11-14
9
31
 
10
32
  ### Added
@@ -5631,6 +5631,9 @@ class WaterfallAnswerer {
5631
5631
  return {
5632
5632
  answers: questions.map((q) => {
5633
5633
  const pick = picks.find((p) => p.questionId === q.id);
5634
+ if (pick?.custom !== undefined && pick.custom !== "") {
5635
+ return { id: q.id, selected: [], custom: pick.custom };
5636
+ }
5634
5637
  const answer = pick ? { id: q.id, selected: pick.selections?.length ? [...pick.selections] : [pick.selected] } : { id: q.id, selected: [], custom: "declined" };
5635
5638
  return answer;
5636
5639
  })
@@ -6467,19 +6470,19 @@ async function readImageAttachment(path) {
6467
6470
  function imagePromptPart(file) {
6468
6471
  return { type: "image", mediaType: file.mediaType, data: file.data, ...file.name ? { name: file.name } : {} };
6469
6472
  }
6470
- function attachmentIdsOfPromptContent(content) {
6471
- const ids = [];
6473
+ function attachmentRefsOfPromptContent(content) {
6474
+ const refs = [];
6472
6475
  if (!Array.isArray(content))
6473
- return ids;
6476
+ return refs;
6474
6477
  for (const block of content) {
6475
6478
  const typed = block;
6476
6479
  if (typed?.type !== "image" || typeof typed.attachment !== "object" || typed.attachment === null)
6477
6480
  continue;
6478
- const attachmentId = typed.attachment.attachmentId;
6479
- if (typeof attachmentId === "string" && attachmentId)
6480
- ids.push(attachmentId);
6481
+ const ref = typed.attachment;
6482
+ if (typeof ref.attachmentId === "string" && ref.attachmentId)
6483
+ refs.push(ref);
6481
6484
  }
6482
- return ids;
6485
+ return refs;
6483
6486
  }
6484
6487
  async function fetchHostFile(baseUrl, cookieHeader, path) {
6485
6488
  const url = `${baseUrl.replace(/\/$/, "")}/api/file?path=${encodeURIComponent(path)}`;
@@ -6495,8 +6498,8 @@ async function fetchHostFile(baseUrl, cookieHeader, path) {
6495
6498
  throw new HostFileError(`GET /api/file ${path}: HTTP ${response.status}`);
6496
6499
  return new Uint8Array(await response.arrayBuffer());
6497
6500
  }
6498
- async function readSessionAttachment(rpc, sessionId, attachmentId) {
6499
- const value = await rpc("session/attachment", { request: { sessionId, attachmentId } });
6501
+ async function readSessionAttachment(rpc, sessionId, attachment) {
6502
+ const value = await rpc("session/attachment", { request: { sessionId, attachment } });
6500
6503
  const ref = typeof value.attachment === "object" && value.attachment !== null ? value.attachment : {};
6501
6504
  return {
6502
6505
  data: typeof value.data === "string" ? value.data : "",
@@ -6749,19 +6752,26 @@ class SubagentRoundPolicy {
6749
6752
  });
6750
6753
  if (spinAction === "force-stop-early") {
6751
6754
  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) {
6755
+ const reportEarlyStop = (stopped) => {
6756
+ if (!stopped)
6757
+ return;
6759
6758
  try {
6760
6759
  this.#options.onHardStop?.({ childId, round: count, cap: caps.cap, grace: caps.grace, early: true });
6761
6760
  } catch {}
6762
6761
  try {
6763
6762
  this.#options.onSpinStop?.(childId, count);
6764
6763
  } catch {}
6764
+ };
6765
+ let stoppedEarly = false;
6766
+ try {
6767
+ stoppedEarly = this.#options.forceStop(childId);
6768
+ } catch {
6769
+ stoppedEarly = false;
6770
+ }
6771
+ if (stoppedEarly instanceof Promise) {
6772
+ stoppedEarly.then(reportEarlyStop, () => {});
6773
+ } else {
6774
+ reportEarlyStop(stoppedEarly);
6765
6775
  }
6766
6776
  return;
6767
6777
  }
@@ -6813,19 +6823,26 @@ class SubagentRoundPolicy {
6813
6823
  return;
6814
6824
  }
6815
6825
  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) {
6826
+ const reportStop = (stopped) => {
6827
+ if (!stopped)
6828
+ return;
6823
6829
  try {
6824
6830
  this.#options.onHardStop?.({ childId, round: count, cap: caps.cap, grace: caps.grace });
6825
6831
  } catch {}
6826
6832
  try {
6827
6833
  this.#options.onForceStop?.(childId, count);
6828
6834
  } catch {}
6835
+ };
6836
+ let stopped = false;
6837
+ try {
6838
+ stopped = this.#options.forceStop(childId);
6839
+ } catch {
6840
+ stopped = false;
6841
+ }
6842
+ if (stopped instanceof Promise) {
6843
+ stopped.then(reportStop, () => {});
6844
+ } else {
6845
+ reportStop(stopped);
6829
6846
  }
6830
6847
  }
6831
6848
  #resolveCaps(childId, label) {
@@ -7015,10 +7032,14 @@ class RemoteSubagentPanel {
7015
7032
  },
7016
7033
  forceStop: (id) => {
7017
7034
  if (!this.#children.has(id))
7035
+ return Promise.resolve(false);
7036
+ return this.interrupt(id).then(() => {
7037
+ this.#settle(id, "cancelled");
7038
+ return true;
7039
+ }).catch((error) => {
7040
+ console.error("[remote-subagents] force-stop failed:", describeError(error));
7018
7041
  return false;
7019
- this.interrupt(id).catch(() => {});
7020
- this.#settle(id, "cancelled");
7021
- return true;
7042
+ });
7022
7043
  },
7023
7044
  onHardStop: (record) => this.#options.onHardStop?.(record),
7024
7045
  onWrapUp: (id, round) => {
@@ -7196,11 +7217,23 @@ class RemoteSubagentPanel {
7196
7217
  const parent = this.#options.parentId();
7197
7218
  if (parent === undefined)
7198
7219
  throw new Error("no live parent session");
7199
- await this.#options.rpc("subagents/interruptByParent", {
7200
- childSessionId: id,
7201
- parentSessionId: parent,
7202
- mode: "continuable"
7203
- });
7220
+ try {
7221
+ await this.#options.rpc("subagents/interruptByParent", {
7222
+ childSessionId: id,
7223
+ parentSessionId: parent,
7224
+ mode: "continuable"
7225
+ });
7226
+ return;
7227
+ } catch (dedicatedError) {
7228
+ const dedicated = describeError(dedicatedError);
7229
+ try {
7230
+ await this.#options.rpc("session/cancel", { sessionId: id });
7231
+ console.warn(`[remote-subagents] interruptByParent failed (${dedicated}) \u2014 stopped the child via session/cancel`);
7232
+ return;
7233
+ } catch (fallbackError) {
7234
+ throw new Error(`interrupt failed \u2014 interruptByParent: ${dedicated}; session/cancel fallback: ${describeError(fallbackError)}`);
7235
+ }
7236
+ }
7204
7237
  }
7205
7238
  stop() {
7206
7239
  this.#stopped = true;
@@ -7390,6 +7423,11 @@ class RemoteSubagentPanel {
7390
7423
  }
7391
7424
  }
7392
7425
  }
7426
+ function describeError(error) {
7427
+ if (error instanceof RemoteRpcError)
7428
+ return `${error.code}: ${error.message}`;
7429
+ return String(error instanceof Error ? error.message : error);
7430
+ }
7393
7431
  function lastContentLine(text) {
7394
7432
  if (text === undefined)
7395
7433
  return;
@@ -8565,22 +8603,27 @@ class RemoteHostSession {
8565
8603
  fetchHostFile(path) {
8566
8604
  return fetchHostFile(this.#baseUrl, this.#cookieHeader, path);
8567
8605
  }
8568
- lastAttachmentIds() {
8606
+ #attachmentRefsOfLastPrompt() {
8569
8607
  for (let i = this.#journal.length - 1;i >= 0; i--) {
8570
8608
  const entry = this.#journal[i];
8571
8609
  if (entry.type !== "user/message")
8572
8610
  continue;
8573
- const ids = attachmentIdsOfPromptContent(entry.data.content ?? entry.data.message?.content);
8574
- if (ids.length > 0)
8575
- return ids;
8611
+ const refs = attachmentRefsOfPromptContent(entry.data.content ?? entry.data.message?.content);
8612
+ if (refs.length > 0)
8613
+ return refs;
8576
8614
  }
8577
8615
  return [];
8578
8616
  }
8617
+ lastAttachmentIds() {
8618
+ return this.#attachmentRefsOfLastPrompt().map((ref) => ref.attachmentId);
8619
+ }
8579
8620
  readSessionAttachment(attachmentId) {
8580
8621
  const sessionId = this.#sessionId;
8581
8622
  if (sessionId === undefined)
8582
8623
  throw new Error("no live session to read attachments from");
8583
- return readSessionAttachment((method, args) => this.#rpc(method, args), sessionId, attachmentId);
8624
+ const known = this.#attachmentRefsOfLastPrompt().find((ref) => ref.attachmentId === attachmentId);
8625
+ const attachment = known ?? { attachmentId, mediaType: "", bytes: 0, width: 0, height: 0 };
8626
+ return readSessionAttachment((method, args) => this.#rpc(method, args), sessionId, attachment);
8584
8627
  }
8585
8628
  gitBranch(cwd = this.#cwd) {
8586
8629
  return probeGitBranch(cwd);
@@ -48859,7 +48902,15 @@ class TurnOverlayController {
48859
48902
  const head = this.#asks[0];
48860
48903
  if (!head)
48861
48904
  return;
48862
- return { id: head.id, questions: head.questions, index: head.index, picks: head.picks, phase: head.phase };
48905
+ return {
48906
+ id: head.id,
48907
+ questions: head.questions,
48908
+ index: head.index,
48909
+ picks: head.picks,
48910
+ phase: head.phase,
48911
+ customs: [...head.customs],
48912
+ customDraft: head.customDraft
48913
+ };
48863
48914
  }
48864
48915
  get currentQuestion() {
48865
48916
  const head = this.#asks[0];
@@ -48875,6 +48926,10 @@ class TurnOverlayController {
48875
48926
  index: 0,
48876
48927
  picks: questions.map(() => []),
48877
48928
  phase: "questions",
48929
+ customs: questions.map(() => {
48930
+ return;
48931
+ }),
48932
+ customDraft: null,
48878
48933
  resolve
48879
48934
  });
48880
48935
  this.#changed();
@@ -48885,6 +48940,9 @@ class TurnOverlayController {
48885
48940
  const question = head?.questions[head.index];
48886
48941
  if (!head || !question || head.phase === "review")
48887
48942
  return;
48943
+ if (head.customDraft !== null)
48944
+ return;
48945
+ head.customs[head.index] = undefined;
48888
48946
  if (question.multiSelect === true) {
48889
48947
  const current = head.picks[head.index] ?? [];
48890
48948
  head.picks[head.index] = current.includes(option) ? current.filter((label) => label !== option) : [...current, option];
@@ -48917,6 +48975,56 @@ class TurnOverlayController {
48917
48975
  this.#changed();
48918
48976
  }
48919
48977
  }
48978
+ beginCustom() {
48979
+ const head = this.#asks[0];
48980
+ if (!head || head.phase === "review")
48981
+ return false;
48982
+ head.customDraft = head.customs[head.index] ?? "";
48983
+ this.#changed();
48984
+ return true;
48985
+ }
48986
+ patchCustom(text) {
48987
+ const head = this.#asks[0];
48988
+ if (!head || head.customDraft === null)
48989
+ return;
48990
+ head.customDraft = text;
48991
+ this.#changed();
48992
+ }
48993
+ commitCustom() {
48994
+ const head = this.#asks[0];
48995
+ const question = head?.questions[head.index];
48996
+ if (!head || !question || head.customDraft === null)
48997
+ return;
48998
+ const text = head.customDraft.trim();
48999
+ head.customDraft = null;
49000
+ if (text === "") {
49001
+ this.#changed();
49002
+ return;
49003
+ }
49004
+ head.customs[head.index] = text;
49005
+ head.picks[head.index] = [];
49006
+ if (question.multiSelect !== true && head.questions.length === 1) {
49007
+ this.#asks.shift();
49008
+ head.resolve(this.#envelope(head));
49009
+ this.#changed();
49010
+ return;
49011
+ }
49012
+ if (this.#allAnswered(head)) {
49013
+ head.phase = "review";
49014
+ } else {
49015
+ const next = head.questions.findIndex((_, qi) => qi > head.index && (head.picks[qi]?.length ?? 0) === 0 && !head.customs[qi]);
49016
+ if (next >= 0)
49017
+ head.index = next;
49018
+ }
49019
+ this.#changed();
49020
+ }
49021
+ cancelCustomEdit() {
49022
+ const head = this.#asks[0];
49023
+ if (!head || head.customDraft === null)
49024
+ return;
49025
+ head.customDraft = null;
49026
+ this.#changed();
49027
+ }
48920
49028
  enterReview() {
48921
49029
  const head = this.#asks[0];
48922
49030
  if (!head || head.phase === "review")
@@ -48945,10 +49053,14 @@ class TurnOverlayController {
48945
49053
  this.#changed();
48946
49054
  }
48947
49055
  #allAnswered(head) {
48948
- return head.picks.every((pick) => pick.length > 0);
49056
+ return head.questions.every((_, qi) => (head.picks[qi]?.length ?? 0) > 0 || head.customs[qi] !== undefined && head.customs[qi] !== "");
48949
49057
  }
48950
49058
  #envelope(head) {
48951
49059
  return head.questions.map((question, qi) => {
49060
+ const custom = head.customs[qi];
49061
+ if (custom !== undefined && custom !== "") {
49062
+ return { questionId: question.id, selected: "", custom };
49063
+ }
48952
49064
  const picks = head.picks[qi] ?? [];
48953
49065
  return {
48954
49066
  questionId: question.id,
@@ -49165,13 +49277,16 @@ function ReminderBadge() {
49165
49277
  return _el$;
49166
49278
  })();
49167
49279
  }
49168
- function askTabStrip(questions, picks, index) {
49280
+ function askTabStrip(questions, picks, index, customs) {
49169
49281
  return questions.map((_, qi) => {
49170
- const answered = (picks[qi]?.length ?? 0) > 0;
49282
+ const answered = (picks[qi]?.length ?? 0) > 0 || customs?.[qi] !== undefined && customs[qi] !== "";
49171
49283
  const label = `${qi + 1}${answered ? "\u2713" : ""}`;
49172
49284
  return qi === index ? `[${label}]` : label;
49173
49285
  }).join(" \xB7 ");
49174
49286
  }
49287
+ function askSentinelTitle(custom) {
49288
+ return custom ? `\u270E ${custom}` : ASK_SENTINEL_LABEL;
49289
+ }
49175
49290
  function askProgressTitle(questions, index) {
49176
49291
  if (questions.length < 2)
49177
49292
  return "Question";
@@ -49195,21 +49310,39 @@ function AskPicker(props) {
49195
49310
  };
49196
49311
  return createComponent2(Show, {
49197
49312
  get when() {
49198
- return ask()?.phase === "review";
49313
+ return memo2(() => ask() !== undefined)() && ask()?.customDraft !== null;
49199
49314
  },
49200
49315
  get fallback() {
49201
- return createComponent2(AskQuestionsView, {
49202
- ask,
49203
- get controller() {
49204
- return props.controller;
49316
+ return createComponent2(Show, {
49317
+ get when() {
49318
+ return ask()?.phase === "review";
49205
49319
  },
49206
- get onDecline() {
49207
- return props.onDecline;
49320
+ get fallback() {
49321
+ return createComponent2(AskQuestionsView, {
49322
+ ask,
49323
+ get controller() {
49324
+ return props.controller;
49325
+ },
49326
+ get onDecline() {
49327
+ return props.onDecline;
49328
+ }
49329
+ });
49330
+ },
49331
+ get children() {
49332
+ return createComponent2(AskReviewView, {
49333
+ ask,
49334
+ get controller() {
49335
+ return props.controller;
49336
+ },
49337
+ get onDecline() {
49338
+ return props.onDecline;
49339
+ }
49340
+ });
49208
49341
  }
49209
49342
  });
49210
49343
  },
49211
49344
  get children() {
49212
- return createComponent2(AskReviewView, {
49345
+ return createComponent2(AskCustomInputView, {
49213
49346
  ask,
49214
49347
  get controller() {
49215
49348
  return props.controller;
@@ -49221,6 +49354,27 @@ function AskPicker(props) {
49221
49354
  }
49222
49355
  });
49223
49356
  }
49357
+ function askQuestionRows(question, picks, custom, review) {
49358
+ const multi = question.multiSelect === true;
49359
+ const rows = question.options.map((option) => ({
49360
+ title: multi ? picks.includes(option) ? `[x] ${option}` : `[ ] ${option}` : option,
49361
+ value: option
49362
+ }));
49363
+ rows.push({
49364
+ title: askSentinelTitle(custom),
49365
+ value: {
49366
+ kind: "custom"
49367
+ }
49368
+ });
49369
+ if (review)
49370
+ rows.push({
49371
+ title: "\u23CE Review answers",
49372
+ value: {
49373
+ kind: "review"
49374
+ }
49375
+ });
49376
+ return rows;
49377
+ }
49224
49378
  function AskQuestionsView(props) {
49225
49379
  const batch = () => props.ask();
49226
49380
  const question = () => {
@@ -49232,23 +49386,12 @@ function AskQuestionsView(props) {
49232
49386
  const b = batch();
49233
49387
  return b?.picks[b.index] ?? [];
49234
49388
  };
49389
+ const bIndex = () => batch()?.index ?? 0;
49235
49390
  const options = () => {
49236
49391
  const q = question();
49237
- const p = picked();
49238
49392
  if (!q)
49239
49393
  return [];
49240
- const rows = q.options.map((option) => ({
49241
- title: multi() ? p.includes(option) ? `[x] ${option}` : `[ ] ${option}` : option,
49242
- value: option
49243
- }));
49244
- if (askNeedsReview(batch()?.questions ?? []))
49245
- rows.push({
49246
- title: "\u23CE Review answers",
49247
- value: {
49248
- kind: "review"
49249
- }
49250
- });
49251
- return rows;
49394
+ return askQuestionRows(q, picked(), batch()?.customs[bIndex()], askNeedsReview(batch()?.questions ?? []));
49252
49395
  };
49253
49396
  const description = () => {
49254
49397
  const b = batch();
@@ -49256,7 +49399,7 @@ function AskQuestionsView(props) {
49256
49399
  return;
49257
49400
  const parts = [];
49258
49401
  if (b.questions.length >= 2)
49259
- parts.push(askTabStrip(b.questions, b.picks, b.index));
49402
+ parts.push(askTabStrip(b.questions, b.picks, b.index, b.customs));
49260
49403
  if (multi())
49261
49404
  parts.push("space: toggle");
49262
49405
  return parts.join(" \xB7 ") || undefined;
@@ -49330,6 +49473,8 @@ function AskQuestionsView(props) {
49330
49473
  onSelect: (option) => {
49331
49474
  if (typeof option.value === "string")
49332
49475
  props.controller.toggle(option.value);
49476
+ else if (option.value.kind === "custom")
49477
+ props.controller.beginCustom();
49333
49478
  else
49334
49479
  props.controller.enterReview();
49335
49480
  },
@@ -49338,14 +49483,87 @@ function AskQuestionsView(props) {
49338
49483
  }
49339
49484
  });
49340
49485
  }
49486
+ function AskCustomInputView(props) {
49487
+ const theme = useThemeOptional();
49488
+ const cursorStyle = useCursorStyle();
49489
+ Keymap2.createLayer(() => ({
49490
+ mode: "modal",
49491
+ commands: [{
49492
+ id: "ask.custom_cancel",
49493
+ title: "Back to options",
49494
+ group: "Dialog",
49495
+ bind: "escape",
49496
+ run: () => props.controller.cancelCustomEdit()
49497
+ }]
49498
+ }));
49499
+ return createComponent2(DialogLayout, {
49500
+ get header() {
49501
+ return (() => {
49502
+ var _el$5 = createElement("box"), _el$6 = createElement("text");
49503
+ insertNode(_el$5, _el$6);
49504
+ setProp(_el$5, "paddingLeft", DIALOG_LIST_INSET - 1);
49505
+ setProp(_el$5, "paddingRight", DIALOG_LIST_INSET - 1);
49506
+ insert(_el$5, createComponent2(DialogHeader, {
49507
+ get titleView() {
49508
+ return (() => {
49509
+ var _el$7 = createElement("box");
49510
+ setProp(_el$7, "flexDirection", "row");
49511
+ insert(_el$7, createComponent2(ReminderBadge, {}), null);
49512
+ insert(_el$7, createComponent2(AskTitleText, {
49513
+ title: "Your answer"
49514
+ }), null);
49515
+ return _el$7;
49516
+ })();
49517
+ },
49518
+ title: "Your answer"
49519
+ }), _el$6);
49520
+ setProp(_el$6, "wrapMode", "word");
49521
+ insert(_el$6, () => props.ask()?.questions[props.ask()?.index ?? 0]?.prompt);
49522
+ effect((_$p) => setProp(_el$6, "fg", theme?.text.muted, _$p));
49523
+ return _el$5;
49524
+ })();
49525
+ },
49526
+ get children() {
49527
+ var _el$4 = createElement("input");
49528
+ use((r) => {
49529
+ setTimeout(() => {
49530
+ if (!r.isDestroyed)
49531
+ r.focus();
49532
+ }, 1);
49533
+ }, _el$4);
49534
+ setProp(_el$4, "flexGrow", 1);
49535
+ setProp(_el$4, "placeholder", "Type something.");
49536
+ setProp(_el$4, "onInput", (text) => props.controller.patchCustom(text));
49537
+ setProp(_el$4, "onSubmit", () => props.controller.commitCustom());
49538
+ effect((_p$) => {
49539
+ var _v$ = props.ask()?.customDraft ?? "", _v$2 = theme?.text.muted, _v$3 = theme?.background.formfield.focused, _v$4 = theme?.text.formfield.focused, _v$5 = theme?.text.formfield.focused, _v$6 = cursorStyle();
49540
+ _v$ !== _p$.e && (_p$.e = setProp(_el$4, "value", _v$, _p$.e));
49541
+ _v$2 !== _p$.t && (_p$.t = setProp(_el$4, "placeholderColor", _v$2, _p$.t));
49542
+ _v$3 !== _p$.a && (_p$.a = setProp(_el$4, "focusedBackgroundColor", _v$3, _p$.a));
49543
+ _v$4 !== _p$.o && (_p$.o = setProp(_el$4, "focusedTextColor", _v$4, _p$.o));
49544
+ _v$5 !== _p$.i && (_p$.i = setProp(_el$4, "cursorColor", _v$5, _p$.i));
49545
+ _v$6 !== _p$.n && (_p$.n = setProp(_el$4, "cursorStyle", _v$6, _p$.n));
49546
+ return _p$;
49547
+ }, {
49548
+ e: undefined,
49549
+ t: undefined,
49550
+ a: undefined,
49551
+ o: undefined,
49552
+ i: undefined,
49553
+ n: undefined
49554
+ });
49555
+ return _el$4;
49556
+ }
49557
+ });
49558
+ }
49341
49559
  function AskTitleText(props) {
49342
49560
  const theme = useThemeOptional();
49343
49561
  return (() => {
49344
- var _el$4 = createElement("text");
49345
- setProp(_el$4, "wrapMode", "none");
49346
- insert(_el$4, () => props.title);
49347
- effect((_$p) => setProp(_el$4, "fg", warningColor(theme), _$p));
49348
- return _el$4;
49562
+ var _el$8 = createElement("text");
49563
+ setProp(_el$8, "wrapMode", "none");
49564
+ insert(_el$8, () => props.title);
49565
+ effect((_$p) => setProp(_el$8, "fg", warningColor(theme), _$p));
49566
+ return _el$8;
49349
49567
  })();
49350
49568
  }
49351
49569
  function AskReviewView(props) {
@@ -49355,8 +49573,10 @@ function AskReviewView(props) {
49355
49573
  return [];
49356
49574
  const rows = b.questions.map((question, qi) => {
49357
49575
  const picks = b.picks[qi] ?? [];
49576
+ const custom = b.customs[qi];
49577
+ const answer = custom ? `\u270E ${custom}` : picks.length > 0 ? picks.join(", ") : "\u2014";
49358
49578
  return {
49359
- title: `${truncate70(question.prompt)} ${picks.length > 0 ? picks.join(", ") : "\u2014"}`,
49579
+ title: `${truncate70(question.prompt)} ${answer}`,
49360
49580
  value: {
49361
49581
  kind: "question",
49362
49582
  qi
@@ -49374,13 +49594,13 @@ function AskReviewView(props) {
49374
49594
  return createComponent2(DialogSelect, {
49375
49595
  get titleView() {
49376
49596
  return (() => {
49377
- var _el$5 = createElement("box");
49378
- setProp(_el$5, "flexDirection", "row");
49379
- insert(_el$5, createComponent2(ReminderBadge, {}), null);
49380
- insert(_el$5, createComponent2(AskTitleText, {
49597
+ var _el$9 = createElement("box");
49598
+ setProp(_el$9, "flexDirection", "row");
49599
+ insert(_el$9, createComponent2(ReminderBadge, {}), null);
49600
+ insert(_el$9, createComponent2(AskTitleText, {
49381
49601
  title: "Review answers"
49382
49602
  }), null);
49383
- return _el$5;
49603
+ return _el$9;
49384
49604
  })();
49385
49605
  },
49386
49606
  title: "Review answers",
@@ -49477,6 +49697,7 @@ function TurnOverlayHost(props) {
49477
49697
  function registerTurnOverlays(seam, controller) {
49478
49698
  seam.registerAskProvider((questions) => controller.answer(questions));
49479
49699
  }
49700
+ var ASK_SENTINEL_LABEL = "Type something.";
49480
49701
  var init_turn_overlays = __esm(() => {
49481
49702
  init_index_bun();
49482
49703
  init_index_bun();
@@ -49486,11 +49707,14 @@ var init_turn_overlays = __esm(() => {
49486
49707
  init_index_bun();
49487
49708
  init_index_bun();
49488
49709
  init_index_bun();
49710
+ init_index_bun();
49489
49711
  init_server();
49490
49712
  init_index_bun();
49491
49713
  init_dialog_confirm();
49492
49714
  init_dialog_select();
49493
49715
  init_dialog();
49716
+ init_keymap();
49717
+ init_config();
49494
49718
  init_theme3();
49495
49719
  init_motion();
49496
49720
  init_semantic();
@@ -49667,7 +49891,28 @@ var init_login = __esm(() => {
49667
49891
  ];
49668
49892
  });
49669
49893
 
49894
+ // ../tui-base/src/routes/session/export.ts
49895
+ import { homedir as homedir4 } from "os";
49896
+ import { resolve as resolve5 } from "path";
49897
+ function exportTargetPath(sessionId, arg) {
49898
+ const trimmed = arg?.trim();
49899
+ if (trimmed)
49900
+ return resolve5(trimmed);
49901
+ const id8 = sessionId.slice(0, 8).replace(/[^A-Za-z0-9._-]/g, "-");
49902
+ return resolve5(homedir4(), "Downloads", `dsh-session-${id8}.jsonl`);
49903
+ }
49904
+ function journalToJSONL(entries) {
49905
+ if (entries.length === 0)
49906
+ return "";
49907
+ return entries.map((entry) => JSON.stringify(entry)).join(`
49908
+ `) + `
49909
+ `;
49910
+ }
49911
+ var init_export = () => {};
49912
+
49670
49913
  // ../tui-base/src/routes/session/commands.ts
49914
+ import { mkdir as mkdir2, writeFile as writeFile2 } from "fs/promises";
49915
+ import { dirname as dirname3 } from "path";
49671
49916
  function persistHints(seam) {
49672
49917
  try {
49673
49918
  seam.configSave?.({ footerHints: footerHints(), hintsLocale: hintsLocale() });
@@ -50241,6 +50486,30 @@ function coreCommands() {
50241
50486
  ctx.openHistory();
50242
50487
  }
50243
50488
  },
50489
+ {
50490
+ name: "/export",
50491
+ description: "export the session journal to JSONL ([path], default ~/Downloads)",
50492
+ async run(ctx, argText) {
50493
+ const sessionId = ctx.seam.currentSessionId();
50494
+ if (!sessionId) {
50495
+ ctx.say("/export: no active session to export");
50496
+ return;
50497
+ }
50498
+ if (!ctx.seam.sessionJournal) {
50499
+ ctx.say("/export: the journal read face is not mounted in this entry");
50500
+ return;
50501
+ }
50502
+ try {
50503
+ const entries = await ctx.seam.sessionJournal(sessionId);
50504
+ const target = exportTargetPath(sessionId, argText);
50505
+ await mkdir2(dirname3(target), { recursive: true });
50506
+ await writeFile2(target, journalToJSONL(entries));
50507
+ ctx.say(`exported ${entries.length} journal records (host journal format) \u2192 ${target}`);
50508
+ } catch (error) {
50509
+ ctx.say(`/export failed \u2014 ${seamFailureReason(error)}`);
50510
+ }
50511
+ }
50512
+ },
50244
50513
  {
50245
50514
  name: "/subagents",
50246
50515
  description: "view live subagent transcripts (list, steer, stop)",
@@ -50497,6 +50766,7 @@ var init_commands = __esm(() => {
50497
50766
  init_login();
50498
50767
  init_hints_line();
50499
50768
  init_motion();
50769
+ init_export();
50500
50770
  });
50501
50771
 
50502
50772
  // ../tui-base/src/routes/session/slash-complete.ts
@@ -50702,28 +50972,42 @@ var init_slash_usage = __esm(() => {
50702
50972
 
50703
50973
  // ../tui-base/src/routes/session/skills-source.ts
50704
50974
  import { existsSync as existsSync8, readdirSync as readdirSync2, readFileSync as readFileSync8, statSync as statSync4 } from "fs";
50705
- import { homedir as homedir4 } from "os";
50706
- import { dirname as dirname3, join as join8, resolve as resolve5 } from "path";
50975
+ import { homedir as homedir5 } from "os";
50976
+ import { dirname as dirname4, join as join8, resolve as resolve6 } from "path";
50707
50977
  import { TextAttributes as TextAttributes8 } from "@opentui/core";
50708
50978
  function findProjectRoot(cwd) {
50709
- let dir = resolve5(cwd);
50979
+ let dir = resolve6(cwd);
50710
50980
  for (let depth = 0;depth < 64; depth++) {
50711
50981
  if (existsSync8(join8(dir, ".git")))
50712
50982
  return dir;
50713
- const parent = dirname3(dir);
50983
+ const parent = dirname4(dir);
50714
50984
  if (parent === dir)
50715
50985
  break;
50716
50986
  dir = parent;
50717
50987
  }
50718
- return resolve5(cwd);
50988
+ return resolve6(cwd);
50719
50989
  }
50720
50990
  function resolveAgentsHome(explicit) {
50721
50991
  if (typeof explicit === "string" && explicit.trim() !== "")
50722
- return resolve5(explicit);
50992
+ return resolve6(explicit);
50723
50993
  const env = process.env.DSH_AGENTS_HOME;
50724
50994
  if (typeof env === "string" && env.trim() !== "")
50725
- return resolve5(env);
50726
- return resolve5(join8(homedir4(), ".agents"));
50995
+ return resolve6(env);
50996
+ return resolve6(join8(homedir5(), ".agents"));
50997
+ }
50998
+ function agentsHomeEnvWarning(env, configValue) {
50999
+ const value = typeof env === "string" ? env : process.env.DSH_AGENTS_HOME;
51000
+ const envBlank = typeof value === "string" && value.trim() === "";
51001
+ const configBlank = typeof configValue === "string" && configValue.trim() === "";
51002
+ if (!envBlank && !configBlank)
51003
+ return;
51004
+ if (envBlank && configBlank) {
51005
+ return "DSH_AGENTS_HOME and the config agentsHome are both set but empty: this client " + "falls back to ~/.agents, but the host skill provider resolves each empty string " + "to its cwd \u2014 unset the variable AND remove the empty agentsHome key from the " + "config to keep both skill surfaces on the same root.";
51006
+ }
51007
+ if (configBlank) {
51008
+ return "The config agentsHome is set but empty: this client falls back to ~/.agents, but " + "the host skill provider resolves it to its cwd \u2014 remove the empty agentsHome key " + "from the config (or set a real path) to keep both skill surfaces on the same root.";
51009
+ }
51010
+ return "DSH_AGENTS_HOME is set but empty: this client falls back to ~/.agents, but the " + "host skill provider resolves it to its cwd \u2014 unset the variable to keep both " + "skill surfaces on the same root.";
50727
51011
  }
50728
51012
  function skillRoots(options) {
50729
51013
  const roots = [];
@@ -50732,7 +51016,7 @@ function skillRoots(options) {
50732
51016
  roots.push({ path: join8(projectRoot, ".agents", "skills"), rank: 200, skipSystem: false });
50733
51017
  for (const dir of options.customSkillDirs ?? []) {
50734
51018
  if (typeof dir === "string" && dir.trim() !== "") {
50735
- roots.push({ path: resolve5(dir), rank: 300, skipSystem: false });
51019
+ roots.push({ path: resolve6(dir), rank: 300, skipSystem: false });
50736
51020
  }
50737
51021
  }
50738
51022
  if (options.dshHome !== undefined) {
@@ -50743,7 +51027,7 @@ function skillRoots(options) {
50743
51027
  const seen = new Set;
50744
51028
  const deduped = [];
50745
51029
  for (const root of roots.sort((a, b) => a.rank - b.rank)) {
50746
- const key = resolve5(root.path);
51030
+ const key = resolve6(root.path);
50747
51031
  if (seen.has(key))
50748
51032
  continue;
50749
51033
  seen.add(key);
@@ -51224,8 +51508,8 @@ var init_slash_palette = __esm(() => {
51224
51508
 
51225
51509
  // ../tui-base/src/routes/session/skills-manage.ts
51226
51510
  import { existsSync as existsSync9 } from "fs";
51227
- import { lstat, mkdir as mkdir2, readFile as readFile3, readdir, realpath, symlink, unlink } from "fs/promises";
51228
- import { join as join9 } from "path";
51511
+ import { lstat, mkdir as mkdir3, readFile as readFile3, readdir, realpath, symlink, unlink } from "fs/promises";
51512
+ import { join as join9, sep } from "path";
51229
51513
  function skillSymlinkPaths(publicDir, curatedDir, name) {
51230
51514
  const srcMd = join9(publicDir, `${name}.md`);
51231
51515
  if (existsSync9(srcMd))
@@ -51265,6 +51549,24 @@ async function installSkillSymlink(src, dest) {
51265
51549
  return;
51266
51550
  throw new Error(`already installed from a different source: "${dest}" points to "${destReal}", expected "${srcReal}"`);
51267
51551
  }
51552
+ async function isOwnedSkillLink(dest, publicDir) {
51553
+ let destReal;
51554
+ try {
51555
+ destReal = await realpath(dest);
51556
+ } catch (error) {
51557
+ const code = error.code;
51558
+ if (code !== "ENOENT" && code !== "ELOOP" && code !== "ENOTDIR")
51559
+ return false;
51560
+ }
51561
+ if (destReal === undefined)
51562
+ return true;
51563
+ const publicReal = await realpath(publicDir).catch(() => {
51564
+ return;
51565
+ });
51566
+ if (publicReal === undefined)
51567
+ return false;
51568
+ return destReal === publicReal || destReal.startsWith(publicReal + sep);
51569
+ }
51268
51570
  async function applyOneSkillChange(name, targetState, publicDir, curatedDir) {
51269
51571
  if (targetState) {
51270
51572
  const paths = skillSymlinkPaths(publicDir, curatedDir, name);
@@ -51286,6 +51588,8 @@ async function applyOneSkillChange(name, targetState, publicDir, curatedDir) {
51286
51588
  if (mdStat !== undefined) {
51287
51589
  if (!mdStat.isSymbolicLink())
51288
51590
  throw new Error(`refusing to remove "${destMd}": not a symlink`);
51591
+ if (!await isOwnedSkillLink(destMd, publicDir))
51592
+ throw new Error(`refusing to remove "${destMd}": symlink target is outside the managed source root`);
51289
51593
  await unlink(destMd);
51290
51594
  return;
51291
51595
  }
@@ -51295,6 +51599,8 @@ async function applyOneSkillChange(name, targetState, publicDir, curatedDir) {
51295
51599
  if (bundleStat !== undefined) {
51296
51600
  if (!bundleStat.isSymbolicLink())
51297
51601
  throw new Error(`refusing to remove "${destBundle}": not a symlink`);
51602
+ if (!await isOwnedSkillLink(destBundle, publicDir))
51603
+ throw new Error(`refusing to remove "${destBundle}": symlink target is outside the managed source root`);
51298
51604
  await unlink(destBundle);
51299
51605
  }
51300
51606
  return;
@@ -51305,6 +51611,8 @@ async function applyOneSkillChange(name, targetState, publicDir, curatedDir) {
51305
51611
  function skillApplyShortReason(error) {
51306
51612
  if (error.includes("not a symlink"))
51307
51613
  return "protected (not a symlink)";
51614
+ if (error.includes("outside the managed source root"))
51615
+ return "external target (not ours)";
51308
51616
  if (error.includes("different source"))
51309
51617
  return "installed from a different source";
51310
51618
  if (error.includes("skill not found") || error.includes("source vanished"))
@@ -51380,7 +51688,7 @@ function skillStateText(row, pendingState) {
51380
51688
  }
51381
51689
  async function ensureCuratedDir(curatedDir) {
51382
51690
  try {
51383
- await mkdir2(curatedDir, { recursive: true });
51691
+ await mkdir3(curatedDir, { recursive: true });
51384
51692
  } catch {}
51385
51693
  }
51386
51694
  var SKILL_SUMMARY_MAX_ITEMS = 3, DESCRIPTION_MAX2 = 90;
@@ -58282,7 +58590,7 @@ var init_subagents_viewer = __esm(() => {
58282
58590
  import { TextAttributes as TextAttributes12 } from "@opentui/core";
58283
58591
  function resolveVersion() {
58284
58592
  try {
58285
- return "0.13.0";
58593
+ return "0.14.0";
58286
58594
  } catch {
58287
58595
  return "dev";
58288
58596
  }
@@ -60743,6 +61051,10 @@ function V2SessionPage(props) {
60743
61051
  showNotice(pendingMigrationNotice);
60744
61052
  pendingMigrationNotice = undefined;
60745
61053
  }
61054
+ if (pendingAgentsHomeNotice) {
61055
+ showNotice(pendingAgentsHomeNotice);
61056
+ pendingAgentsHomeNotice = undefined;
61057
+ }
60746
61058
  const timer = setInterval(() => setNow(new Date), 1000);
60747
61059
  onCleanup(() => clearInterval(timer));
60748
61060
  });
@@ -61296,7 +61608,9 @@ async function bootClientV2(options = {}) {
61296
61608
  initialSessionId = autoResume?.id;
61297
61609
  resumeNotice = autoResume?.line;
61298
61610
  }
61299
- const agentsHomeForSkills = resolveAgentsHome(seam.configLoad().agentsHome);
61611
+ const agentsHomeConfig = seam.configLoad().agentsHome;
61612
+ const agentsHomeForSkills = resolveAgentsHome(agentsHomeConfig);
61613
+ pendingAgentsHomeNotice = agentsHomeEnvWarning(undefined, agentsHomeConfig);
61300
61614
  const skillRows = discoverSkills({
61301
61615
  cwd: workspace,
61302
61616
  dshHome: host.dshHome,
@@ -61424,7 +61738,7 @@ function ErrorBoundaryDiagnostics(props) {
61424
61738
  }
61425
61739
  });
61426
61740
  }
61427
- var SHELL, overlays, pendingMigrationNotice, themeModePatchKey = "themeMode";
61741
+ var SHELL, overlays, pendingMigrationNotice, pendingAgentsHomeNotice, themeModePatchKey = "themeMode";
61428
61742
  var init_v2_entry = __esm(() => {
61429
61743
  init_server();
61430
61744
  init_index_bun();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiwayds/dsh-opentui",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "bin": {