@cofy-x/dsh-console 0.1.0-alpha.0 → 0.1.0-alpha.2

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.
@@ -61,7 +61,7 @@ import {
61
61
  unescapePath,
62
62
  writeToStderr,
63
63
  writeToStdout
64
- } from "./chunk-YNJGTXFJ.js";
64
+ } from "./chunk-N3EQS35J.js";
65
65
 
66
66
  // src/dsh/index.ts
67
67
  import { randomUUID as randomUUID3 } from "node:crypto";
@@ -251,7 +251,7 @@ var SETTINGS_SCHEMA = {
251
251
  category: "General",
252
252
  requiresRestart: false,
253
253
  default: false,
254
- description: "Enable debug logging of keystrokes to the console.",
254
+ description: "Log raw terminal input and parsed keys locally for diagnostics. Prompt, paste, and shell content may be included; credential dialogs are always redacted.",
255
255
  showInDialog: true
256
256
  }
257
257
  }
@@ -2319,12 +2319,12 @@ function computeTerminalTitle({
2319
2319
 
2320
2320
  // src/ui/app-container.tsx
2321
2321
  import {
2322
- useMemo as useMemo33,
2323
- useState as useState51,
2322
+ useMemo as useMemo34,
2323
+ useState as useState53,
2324
2324
  useCallback as useCallback45,
2325
- useEffect as useEffect52,
2326
- useRef as useRef28,
2327
- useLayoutEffect as useLayoutEffect2,
2325
+ useEffect as useEffect54,
2326
+ useRef as useRef30,
2327
+ useLayoutEffect as useLayoutEffect3,
2328
2328
  useSyncExternalStore as useSyncExternalStore5
2329
2329
  } from "react";
2330
2330
  import { measureElement as measureElement3, useApp } from "ink";
@@ -4810,7 +4810,7 @@ var ToolStatusIndicator = ({
4810
4810
  name: name2
4811
4811
  }) => {
4812
4812
  const isShell = isShellTool(name2);
4813
- const statusColor = isShell ? theme.ui.symbol : theme.status.warning;
4813
+ const statusColor2 = isShell ? theme.ui.symbol : theme.status.warning;
4814
4814
  return /* @__PURE__ */ jsxs16(Box16, { minWidth: STATUS_INDICATOR_WIDTH, children: [
4815
4815
  status === "Pending" /* Pending */ && /* @__PURE__ */ jsx21(Text17, { color: theme.status.success, children: TOOL_STATUS.PENDING }),
4816
4816
  status === "Executing" /* Executing */ && /* @__PURE__ */ jsx21(
@@ -4821,7 +4821,7 @@ var ToolStatusIndicator = ({
4821
4821
  }
4822
4822
  ),
4823
4823
  status === "Success" /* Success */ && /* @__PURE__ */ jsx21(Text17, { color: theme.status.success, "aria-label": "Success:", children: TOOL_STATUS.SUCCESS }),
4824
- status === "Canceled" /* Canceled */ && /* @__PURE__ */ jsx21(Text17, { color: statusColor, "aria-label": "Canceled:", bold: true, children: TOOL_STATUS.CANCELED }),
4824
+ status === "Canceled" /* Canceled */ && /* @__PURE__ */ jsx21(Text17, { color: statusColor2, "aria-label": "Canceled:", bold: true, children: TOOL_STATUS.CANCELED }),
4825
4825
  status === "Error" /* Error */ && /* @__PURE__ */ jsx21(Text17, { color: theme.status.error, "aria-label": "Error:", bold: true, children: TOOL_STATUS.ERROR })
4826
4826
  ] });
4827
4827
  };
@@ -4919,6 +4919,45 @@ var useFocus = () => {
4919
4919
  return isFocused;
4920
4920
  };
4921
4921
 
4922
+ // src/terminal/key-debug-metadata.ts
4923
+ function keyDebugMetadata(key) {
4924
+ if (key.name === "paste") {
4925
+ return {
4926
+ kind: "paste",
4927
+ length: Array.from(key.sequence).length
4928
+ };
4929
+ }
4930
+ if (key.insertable) {
4931
+ return {
4932
+ kind: "text-input",
4933
+ length: Array.from(key.sequence).length
4934
+ };
4935
+ }
4936
+ return {
4937
+ kind: "key",
4938
+ name: key.name || "unknown",
4939
+ ctrl: key.ctrl,
4940
+ cmd: key.cmd,
4941
+ alt: key.alt,
4942
+ shift: key.shift
4943
+ };
4944
+ }
4945
+
4946
+ // src/ui/hooks/input/use-sensitive-input-protection.ts
4947
+ import { useLayoutEffect } from "react";
4948
+ var sensitiveInputDepth = 0;
4949
+ function isSensitiveInputActive() {
4950
+ return sensitiveInputDepth > 0;
4951
+ }
4952
+ function useSensitiveInputProtection() {
4953
+ useLayoutEffect(() => {
4954
+ sensitiveInputDepth += 1;
4955
+ return () => {
4956
+ sensitiveInputDepth = Math.max(0, sensitiveInputDepth - 1);
4957
+ };
4958
+ }, []);
4959
+ }
4960
+
4922
4961
  // src/ui/contexts/keypress-context.tsx
4923
4962
  import { jsx as jsx22 } from "react/jsx-runtime";
4924
4963
  var BACKSLASH_ENTER_TIMEOUT = 5;
@@ -5378,8 +5417,18 @@ function KeypressProvider({
5378
5417
  [subscribers]
5379
5418
  );
5380
5419
  const broadcast = useCallback5(
5381
- (key) => subscribers.forEach((handler) => handler(key)),
5382
- [subscribers]
5420
+ (key) => {
5421
+ if (debugKeystrokeLogging) {
5422
+ debugLogger.log(
5423
+ "[DEBUG] Keystroke:",
5424
+ JSON.stringify(
5425
+ isSensitiveInputActive() ? keyDebugMetadata(key) : key
5426
+ )
5427
+ );
5428
+ }
5429
+ subscribers.forEach((handler) => handler(key));
5430
+ },
5431
+ [debugKeystrokeLogging, subscribers]
5383
5432
  );
5384
5433
  useEffect8(() => {
5385
5434
  const wasRaw = stdin.isRaw;
@@ -5395,12 +5444,14 @@ function KeypressProvider({
5395
5444
  processor = bufferPaste(processor);
5396
5445
  let dataListener = createDataListener(processor);
5397
5446
  if (debugKeystrokeLogging) {
5398
- const old = dataListener;
5447
+ const forward = dataListener;
5399
5448
  dataListener = (data) => {
5400
5449
  if (data.length > 0) {
5401
- debugLogger.log(`[DEBUG] Raw StdIn: ${JSON.stringify(data)}`);
5450
+ debugLogger.log(
5451
+ isSensitiveInputActive() ? `[DEBUG] Raw StdIn: [REDACTED sensitive input, length=${Array.from(data).length}]` : `[DEBUG] Raw StdIn: ${JSON.stringify(data)}`
5452
+ );
5402
5453
  }
5403
- old(data);
5454
+ forward(data);
5404
5455
  };
5405
5456
  }
5406
5457
  stdin.on("data", dataListener);
@@ -5410,7 +5461,13 @@ function KeypressProvider({
5410
5461
  setRawMode(false);
5411
5462
  }
5412
5463
  };
5413
- }, [stdin, setRawMode, config, debugKeystrokeLogging, broadcast]);
5464
+ }, [
5465
+ stdin,
5466
+ setRawMode,
5467
+ config,
5468
+ debugKeystrokeLogging,
5469
+ broadcast
5470
+ ]);
5414
5471
  return /* @__PURE__ */ jsx22(KeypressContext.Provider, { value: { subscribe, unsubscribe }, children });
5415
5472
  }
5416
5473
 
@@ -5982,7 +6039,7 @@ import { Box as Box25 } from "ink";
5982
6039
  import { Box as Box21, Text as Text20 } from "ink";
5983
6040
 
5984
6041
  // src/generated/git-commit.ts
5985
- var GIT_COMMIT_INFO = "f72bd12";
6042
+ var GIT_COMMIT_INFO = "31b5700";
5986
6043
 
5987
6044
  // src/ui/components/dialogs/about-box.tsx
5988
6045
  import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
@@ -7240,7 +7297,7 @@ var AppHeader = ({ version }) => {
7240
7297
  import {
7241
7298
  useState as useState13,
7242
7299
  useRef as useRef6,
7243
- useLayoutEffect,
7300
+ useLayoutEffect as useLayoutEffect2,
7244
7301
  forwardRef,
7245
7302
  useImperativeHandle,
7246
7303
  useEffect as useEffect16,
@@ -7343,7 +7400,7 @@ function VirtualizedList(props, ref) {
7343
7400
  return newHeights;
7344
7401
  });
7345
7402
  }, [data, estimatedItemHeight]);
7346
- useLayoutEffect(() => {
7403
+ useLayoutEffect2(() => {
7347
7404
  if (containerRef.current) {
7348
7405
  const height = Math.round(measureElement(containerRef.current).height);
7349
7406
  if (containerHeight !== height) {
@@ -7393,7 +7450,7 @@ function VirtualizedList(props, ref) {
7393
7450
  const prevTotalHeight = useRef6(totalHeight);
7394
7451
  const prevScrollTop = useRef6(scrollTop);
7395
7452
  const prevContainerHeight = useRef6(scrollableContainerHeight);
7396
- useLayoutEffect(() => {
7453
+ useLayoutEffect2(() => {
7397
7454
  const contentPreviouslyFit = prevTotalHeight.current <= prevContainerHeight.current;
7398
7455
  const wasScrolledToBottomPixels = prevScrollTop.current >= prevTotalHeight.current - prevContainerHeight.current - 1;
7399
7456
  const wasAtBottom = contentPreviouslyFit || wasScrolledToBottomPixels;
@@ -7430,7 +7487,7 @@ function VirtualizedList(props, ref) {
7430
7487
  offsets,
7431
7488
  isStickingToBottom
7432
7489
  ]);
7433
- useLayoutEffect(() => {
7490
+ useLayoutEffect2(() => {
7434
7491
  if (isInitialScrollSet.current || offsets.length <= 1 || totalHeight <= 0 || containerHeight <= 0) {
7435
7492
  return;
7436
7493
  }
@@ -11316,7 +11373,7 @@ function generatePastedTextId(content, lineCount, pastedContent) {
11316
11373
  let id = base;
11317
11374
  let suffix = 2;
11318
11375
  while (pastedContent[id]) {
11319
- id = base.replace("]", ` #${suffix}]`);
11376
+ id = `${base.slice(0, -1)} #${suffix}]`;
11320
11377
  suffix++;
11321
11378
  }
11322
11379
  return id;
@@ -16598,10 +16655,10 @@ var InputPrompt = ({
16598
16655
  onSuggestionsVisibilityChange(shouldShowSuggestions);
16599
16656
  }
16600
16657
  }, [shouldShowSuggestions, onSuggestionsVisibilityChange]);
16601
- let statusColor;
16658
+ let statusColor2;
16602
16659
  let statusText = "";
16603
16660
  if (shellModeActive) {
16604
- statusColor = theme.ui.symbol;
16661
+ statusColor2 = theme.ui.symbol;
16605
16662
  statusText = "Shell mode";
16606
16663
  }
16607
16664
  const suggestionsNode = shouldShowSuggestions ? /* @__PURE__ */ jsx64(Box50, { paddingRight: 2, children: /* @__PURE__ */ jsx64(
@@ -16617,7 +16674,7 @@ var InputPrompt = ({
16617
16674
  expandedIndex: expandedSuggestionIndex
16618
16675
  }
16619
16676
  ) }) : null;
16620
- const borderColor = isShellFocused && !isEmbeddedShellFocused ? statusColor ?? theme.border.focused : theme.border.default;
16677
+ const borderColor = isShellFocused && !isEmbeddedShellFocused ? statusColor2 ?? theme.border.focused : theme.border.default;
16621
16678
  return /* @__PURE__ */ jsxs48(Fragment12, { children: [
16622
16679
  suggestionsPosition === "above" && suggestionsNode,
16623
16680
  useLineFallback ? /* @__PURE__ */ jsx64(
@@ -16657,7 +16714,7 @@ var InputPrompt = ({
16657
16714
  /* @__PURE__ */ jsxs48(
16658
16715
  Text44,
16659
16716
  {
16660
- color: statusColor ?? theme.text.accent,
16717
+ color: statusColor2 ?? theme.text.accent,
16661
16718
  "aria-label": statusText || void 0,
16662
16719
  children: [
16663
16720
  shellModeActive ? reverseSearchActive ? /* @__PURE__ */ jsxs48(
@@ -16848,7 +16905,7 @@ var MemoryUsageDisplay = () => {
16848
16905
  import { Text as Text47 } from "ink";
16849
16906
  import { useEffect as useEffect35, useState as useState32 } from "react";
16850
16907
  import { FixedDeque } from "mnemonist";
16851
- import { jsxs as jsxs51 } from "react/jsx-runtime";
16908
+ import { jsx as jsx67, jsxs as jsxs51 } from "react/jsx-runtime";
16852
16909
  var MIN_TIME_FROM_ACTION_TO_BE_IDLE = 500;
16853
16910
  var ACTION_TIMESTAMP_CAPACITY = 2048;
16854
16911
  var FRAME_TIMESTAMP_CAPACITY = 2048;
@@ -16945,7 +17002,7 @@ var profiler = {
16945
17002
  };
16946
17003
  }
16947
17004
  };
16948
- var DebugProfiler = () => {
17005
+ var DebugProfiler = ({ compact = false }) => {
16949
17006
  const { showDebugProfiler, constrainHeight } = useUIState();
16950
17007
  const [forceRefresh, setForceRefresh] = useState32(0);
16951
17008
  useEffect35(() => {
@@ -16998,7 +17055,17 @@ var DebugProfiler = () => {
16998
17055
  if (!showDebugProfiler) {
16999
17056
  return null;
17000
17057
  }
17001
- return /* @__PURE__ */ jsxs51(Text47, { color: theme.status.warning, children: [
17058
+ if (compact) {
17059
+ return /* @__PURE__ */ jsxs51(Text47, { color: theme.status.warning, wrap: "truncate-end", children: [
17060
+ "R:",
17061
+ profiler.numFrames,
17062
+ " I:",
17063
+ /* @__PURE__ */ jsx67(Text47, { color: theme.status.error, children: profiler.totalIdleFrames }),
17064
+ " F:",
17065
+ /* @__PURE__ */ jsx67(Text47, { color: theme.status.error, children: profiler.totalFlickerFrames })
17066
+ ] }, forceRefresh);
17067
+ }
17068
+ return /* @__PURE__ */ jsxs51(Text47, { color: theme.status.warning, wrap: "truncate-end", children: [
17002
17069
  "Renders: ",
17003
17070
  profiler.numFrames,
17004
17071
  " (total),",
@@ -17017,7 +17084,7 @@ var DebugProfiler = () => {
17017
17084
  };
17018
17085
 
17019
17086
  // src/ui/components/layout/footer.tsx
17020
- import { jsx as jsx67, jsxs as jsxs52 } from "react/jsx-runtime";
17087
+ import { jsx as jsx68, jsxs as jsxs52 } from "react/jsx-runtime";
17021
17088
  var isDevelopment = process.env["NODE_ENV"] === "development";
17022
17089
  var Footer = () => {
17023
17090
  const uiState = useUIState();
@@ -17056,55 +17123,55 @@ var Footer = () => {
17056
17123
  return /* @__PURE__ */ jsxs52(
17057
17124
  Box53,
17058
17125
  {
17126
+ justifyContent,
17059
17127
  width: terminalWidth,
17060
- flexDirection: "column",
17128
+ flexDirection: "row",
17129
+ alignItems: "center",
17130
+ paddingX: 1,
17061
17131
  children: [
17062
- /* @__PURE__ */ jsxs52(
17132
+ (displayVimMode || !hideCWD) && /* @__PURE__ */ jsxs52(Box53, { children: [
17133
+ displayVimMode && /* @__PURE__ */ jsxs52(Text48, { color: theme.text.secondary, children: [
17134
+ "[",
17135
+ displayVimMode,
17136
+ "] "
17137
+ ] }),
17138
+ !hideCWD && (nightly ? /* @__PURE__ */ jsxs52(ThemedGradient, { children: [
17139
+ displayPath,
17140
+ branchName && /* @__PURE__ */ jsxs52(Text48, { children: [
17141
+ " (",
17142
+ branchName,
17143
+ "*)"
17144
+ ] })
17145
+ ] }) : /* @__PURE__ */ jsxs52(Text48, { color: theme.text.link, children: [
17146
+ displayPath,
17147
+ branchName && /* @__PURE__ */ jsxs52(Text48, { color: theme.text.secondary, children: [
17148
+ " (",
17149
+ branchName,
17150
+ "*)"
17151
+ ] })
17152
+ ] })),
17153
+ debugMode && /* @__PURE__ */ jsx68(Text48, { color: theme.status.error, children: " " + (debugMessage || "--debug") })
17154
+ ] }),
17155
+ showRenderDiagnostics && /* @__PURE__ */ jsx68(
17063
17156
  Box53,
17064
17157
  {
17065
- justifyContent,
17066
- width: terminalWidth,
17067
- flexDirection: "row",
17068
- alignItems: "center",
17069
- paddingX: 1,
17070
- children: [
17071
- (displayVimMode || !hideCWD) && /* @__PURE__ */ jsxs52(Box53, { children: [
17072
- displayVimMode && /* @__PURE__ */ jsxs52(Text48, { color: theme.text.secondary, children: [
17073
- "[",
17074
- displayVimMode,
17075
- "] "
17076
- ] }),
17077
- !hideCWD && (nightly ? /* @__PURE__ */ jsxs52(ThemedGradient, { children: [
17078
- displayPath,
17079
- branchName && /* @__PURE__ */ jsxs52(Text48, { children: [
17080
- " (",
17081
- branchName,
17082
- "*)"
17083
- ] })
17084
- ] }) : /* @__PURE__ */ jsxs52(Text48, { color: theme.text.link, children: [
17085
- displayPath,
17086
- branchName && /* @__PURE__ */ jsxs52(Text48, { color: theme.text.secondary, children: [
17087
- " (",
17088
- branchName,
17089
- "*)"
17090
- ] })
17091
- ] })),
17092
- debugMode && /* @__PURE__ */ jsx67(Text48, { color: theme.status.error, children: " " + (debugMessage || "--debug") })
17093
- ] }),
17094
- !hideModelInfo && /* @__PURE__ */ jsxs52(Box53, { alignItems: "center", justifyContent: "flex-end", children: [
17095
- /* @__PURE__ */ jsxs52(Box53, { alignItems: "center", children: [
17096
- /* @__PURE__ */ jsx67(Text48, { color: theme.text.accent, children: model }),
17097
- showMemoryUsage && /* @__PURE__ */ jsx67(MemoryUsageDisplay, {})
17098
- ] }),
17099
- /* @__PURE__ */ jsx67(Box53, { alignItems: "center", children: !showErrorDetails && errorCount > 0 && /* @__PURE__ */ jsxs52(Box53, { paddingLeft: 1, flexDirection: "row", children: [
17100
- /* @__PURE__ */ jsx67(Text48, { color: theme.ui.comment, children: "| " }),
17101
- /* @__PURE__ */ jsx67(ConsoleSummaryDisplay, { errorCount })
17102
- ] }) })
17103
- ] })
17104
- ]
17158
+ flexGrow: 1,
17159
+ flexShrink: 1,
17160
+ justifyContent: "center",
17161
+ marginX: terminalWidth >= 120 ? 1 : 0,
17162
+ children: /* @__PURE__ */ jsx68(DebugProfiler, { compact: terminalWidth < 120 })
17105
17163
  }
17106
17164
  ),
17107
- showRenderDiagnostics && /* @__PURE__ */ jsx67(Box53, { width: terminalWidth, justifyContent: "center", children: /* @__PURE__ */ jsx67(DebugProfiler, {}) })
17165
+ !hideModelInfo && /* @__PURE__ */ jsxs52(Box53, { alignItems: "center", justifyContent: "flex-end", children: [
17166
+ /* @__PURE__ */ jsxs52(Box53, { alignItems: "center", justifyContent: "flex-end", children: [
17167
+ /* @__PURE__ */ jsx68(Text48, { color: theme.text.accent, children: model }),
17168
+ showMemoryUsage && /* @__PURE__ */ jsx68(MemoryUsageDisplay, {})
17169
+ ] }),
17170
+ /* @__PURE__ */ jsx68(Box53, { alignItems: "center", children: !showErrorDetails && errorCount > 0 && /* @__PURE__ */ jsxs52(Box53, { paddingLeft: 1, flexDirection: "row", children: [
17171
+ /* @__PURE__ */ jsx68(Text48, { color: theme.ui.comment, children: "| " }),
17172
+ /* @__PURE__ */ jsx68(ConsoleSummaryDisplay, { errorCount })
17173
+ ] }) })
17174
+ ] })
17108
17175
  ]
17109
17176
  }
17110
17177
  );
@@ -17112,7 +17179,7 @@ var Footer = () => {
17112
17179
 
17113
17180
  // src/ui/components/indicators/queued-message-display.tsx
17114
17181
  import { Box as Box54, Text as Text49 } from "ink";
17115
- import { jsx as jsx68, jsxs as jsxs53 } from "react/jsx-runtime";
17182
+ import { jsx as jsx69, jsxs as jsxs53 } from "react/jsx-runtime";
17116
17183
  var MAX_DISPLAYED_QUEUED_MESSAGES = 3;
17117
17184
  var QueuedMessageDisplay = ({
17118
17185
  messageQueue
@@ -17121,12 +17188,12 @@ var QueuedMessageDisplay = ({
17121
17188
  return null;
17122
17189
  }
17123
17190
  return /* @__PURE__ */ jsxs53(Box54, { flexDirection: "column", marginTop: 1, children: [
17124
- /* @__PURE__ */ jsx68(Box54, { paddingLeft: 2, children: /* @__PURE__ */ jsx68(Text49, { dimColor: true, children: "Queued (press \u2191 to edit):" }) }),
17191
+ /* @__PURE__ */ jsx69(Box54, { paddingLeft: 2, children: /* @__PURE__ */ jsx69(Text49, { dimColor: true, children: "Queued (press \u2191 to edit):" }) }),
17125
17192
  messageQueue.slice(0, MAX_DISPLAYED_QUEUED_MESSAGES).map((message, index) => {
17126
17193
  const preview2 = message.replace(/\s+/g, " ");
17127
- return /* @__PURE__ */ jsx68(Box54, { paddingLeft: 4, width: "100%", children: /* @__PURE__ */ jsx68(Text49, { dimColor: true, wrap: "truncate", children: preview2 }) }, index);
17194
+ return /* @__PURE__ */ jsx69(Box54, { paddingLeft: 4, width: "100%", children: /* @__PURE__ */ jsx69(Text49, { dimColor: true, wrap: "truncate", children: preview2 }) }, index);
17128
17195
  }),
17129
- messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */ jsx68(Box54, { paddingLeft: 4, children: /* @__PURE__ */ jsxs53(Text49, { dimColor: true, children: [
17196
+ messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */ jsx69(Box54, { paddingLeft: 4, children: /* @__PURE__ */ jsxs53(Text49, { dimColor: true, children: [
17130
17197
  "... (+",
17131
17198
  messageQueue.length - MAX_DISPLAYED_QUEUED_MESSAGES,
17132
17199
  " more)"
@@ -17136,19 +17203,19 @@ var QueuedMessageDisplay = ({
17136
17203
 
17137
17204
  // src/ui/components/help/command-init-display.tsx
17138
17205
  import { Box as Box55, Text as Text50 } from "ink";
17139
- import { jsx as jsx69, jsxs as jsxs54 } from "react/jsx-runtime";
17206
+ import { jsx as jsx70, jsxs as jsxs54 } from "react/jsx-runtime";
17140
17207
  var CommandInitDisplay = ({
17141
17208
  message = "Loading commands..."
17142
- }) => /* @__PURE__ */ jsx69(Box55, { marginTop: 1, children: /* @__PURE__ */ jsxs54(Text50, { children: [
17143
- /* @__PURE__ */ jsx69(AgentSpinner, {}),
17209
+ }) => /* @__PURE__ */ jsx70(Box55, { marginTop: 1, children: /* @__PURE__ */ jsxs54(Text50, { children: [
17210
+ /* @__PURE__ */ jsx70(AgentSpinner, {}),
17144
17211
  " ",
17145
- /* @__PURE__ */ jsx69(Text50, { color: theme.text.primary, children: message })
17212
+ /* @__PURE__ */ jsx70(Text50, { color: theme.text.primary, children: message })
17146
17213
  ] }) });
17147
17214
 
17148
17215
  // src/ui/components/messages/todo.tsx
17149
17216
  import { Box as Box56, Text as Text51 } from "ink";
17150
17217
  import { useMemo as useMemo21 } from "react";
17151
- import { jsx as jsx70, jsxs as jsxs55 } from "react/jsx-runtime";
17218
+ import { jsx as jsx71, jsxs as jsxs55 } from "react/jsx-runtime";
17152
17219
  var TodoTitleDisplay = ({ todos }) => {
17153
17220
  const score = useMemo21(() => {
17154
17221
  let total = 0;
@@ -17164,7 +17231,7 @@ var TodoTitleDisplay = ({ todos }) => {
17164
17231
  return `${completed}/${total} completed`;
17165
17232
  }, [todos]);
17166
17233
  return /* @__PURE__ */ jsxs55(Box56, { flexDirection: "row", columnGap: 2, height: 1, children: [
17167
- /* @__PURE__ */ jsx70(Text51, { color: theme.text.primary, bold: true, "aria-label": "Todo list", children: "Todo" }),
17234
+ /* @__PURE__ */ jsx71(Text51, { color: theme.text.primary, bold: true, "aria-label": "Todo list", children: "Todo" }),
17168
17235
  /* @__PURE__ */ jsxs55(Text51, { color: theme.text.secondary, children: [
17169
17236
  score,
17170
17237
  " (ctrl+t to toggle)"
@@ -17174,14 +17241,14 @@ var TodoTitleDisplay = ({ todos }) => {
17174
17241
  var TodoStatusDisplay = ({ status }) => {
17175
17242
  switch (status) {
17176
17243
  case "completed":
17177
- return /* @__PURE__ */ jsx70(Text51, { color: theme.status.success, "aria-label": "Completed", children: "\u2713" });
17244
+ return /* @__PURE__ */ jsx71(Text51, { color: theme.status.success, "aria-label": "Completed", children: "\u2713" });
17178
17245
  case "in_progress":
17179
- return /* @__PURE__ */ jsx70(Text51, { color: theme.text.accent, "aria-label": "In Progress", children: "\xBB" });
17246
+ return /* @__PURE__ */ jsx71(Text51, { color: theme.text.accent, "aria-label": "In Progress", children: "\xBB" });
17180
17247
  case "pending":
17181
- return /* @__PURE__ */ jsx70(Text51, { color: theme.text.secondary, "aria-label": "Pending", children: "\u2610" });
17248
+ return /* @__PURE__ */ jsx71(Text51, { color: theme.text.secondary, "aria-label": "Pending", children: "\u2610" });
17182
17249
  case "cancelled":
17183
17250
  default:
17184
- return /* @__PURE__ */ jsx70(Text51, { color: theme.status.error, "aria-label": "Cancelled", children: "\u2717" });
17251
+ return /* @__PURE__ */ jsx71(Text51, { color: theme.status.error, "aria-label": "Cancelled", children: "\u2717" });
17185
17252
  }
17186
17253
  };
17187
17254
  var TodoItemDisplay = ({ todo, wrap, role: ariaRole }) => {
@@ -17198,8 +17265,8 @@ var TodoItemDisplay = ({ todo, wrap, role: ariaRole }) => {
17198
17265
  })();
17199
17266
  const strikethrough = todo.status === "cancelled";
17200
17267
  return /* @__PURE__ */ jsxs55(Box56, { flexDirection: "row", columnGap: 1, "aria-role": ariaRole, children: [
17201
- /* @__PURE__ */ jsx70(TodoStatusDisplay, { status: todo.status }),
17202
- /* @__PURE__ */ jsx70(Box56, { flexShrink: 1, children: /* @__PURE__ */ jsx70(Text51, { color: textColor, wrap, strikethrough, children: todo.description }) })
17268
+ /* @__PURE__ */ jsx71(TodoStatusDisplay, { status: todo.status }),
17269
+ /* @__PURE__ */ jsx71(Box56, { flexShrink: 1, children: /* @__PURE__ */ jsx71(Text51, { color: textColor, wrap, strikethrough, children: todo.description }) })
17203
17270
  ] });
17204
17271
  };
17205
17272
  var TodoTray = () => {
@@ -17220,7 +17287,7 @@ var TodoTray = () => {
17220
17287
  if (todos === null || !todos.todos || todos.todos.length === 0 || !uiState.showFullTodos && !hasActiveTodos) {
17221
17288
  return null;
17222
17289
  }
17223
- return /* @__PURE__ */ jsx70(
17290
+ return /* @__PURE__ */ jsx71(
17224
17291
  Box56,
17225
17292
  {
17226
17293
  borderStyle: "single",
@@ -17231,46 +17298,46 @@ var TodoTray = () => {
17231
17298
  paddingLeft: 1,
17232
17299
  paddingRight: 1,
17233
17300
  children: uiState.showFullTodos ? /* @__PURE__ */ jsxs55(Box56, { flexDirection: "column", rowGap: 1, children: [
17234
- /* @__PURE__ */ jsx70(TodoTitleDisplay, { todos }),
17235
- /* @__PURE__ */ jsx70(TodoListDisplay, { todos })
17301
+ /* @__PURE__ */ jsx71(TodoTitleDisplay, { todos }),
17302
+ /* @__PURE__ */ jsx71(TodoListDisplay, { todos })
17236
17303
  ] }) : /* @__PURE__ */ jsxs55(Box56, { flexDirection: "row", columnGap: 1, height: 1, children: [
17237
- /* @__PURE__ */ jsx70(Box56, { flexShrink: 0, flexGrow: 0, children: /* @__PURE__ */ jsx70(TodoTitleDisplay, { todos }) }),
17238
- inProgress && /* @__PURE__ */ jsx70(Box56, { flexShrink: 1, flexGrow: 1, children: /* @__PURE__ */ jsx70(TodoItemDisplay, { todo: inProgress, wrap: "truncate" }) })
17304
+ /* @__PURE__ */ jsx71(Box56, { flexShrink: 0, flexGrow: 0, children: /* @__PURE__ */ jsx71(TodoTitleDisplay, { todos }) }),
17305
+ inProgress && /* @__PURE__ */ jsx71(Box56, { flexShrink: 1, flexGrow: 1, children: /* @__PURE__ */ jsx71(TodoItemDisplay, { todo: inProgress, wrap: "truncate" }) })
17239
17306
  ] })
17240
17307
  }
17241
17308
  );
17242
17309
  };
17243
- var TodoListDisplay = ({ todos }) => /* @__PURE__ */ jsx70(Box56, { flexDirection: "column", "aria-role": "list", children: todos.todos.map((todo, index) => /* @__PURE__ */ jsx70(TodoItemDisplay, { todo, role: "listitem" }, index)) });
17310
+ var TodoListDisplay = ({ todos }) => /* @__PURE__ */ jsx71(Box56, { flexDirection: "column", "aria-role": "list", children: todos.todos.map((todo, index) => /* @__PURE__ */ jsx71(TodoItemDisplay, { todo, role: "listitem" }, index)) });
17244
17311
 
17245
17312
  // src/ui/components/layout/status-display.tsx
17246
17313
  import { Text as Text52 } from "ink";
17247
- import { jsx as jsx71 } from "react/jsx-runtime";
17314
+ import { jsx as jsx72 } from "react/jsx-runtime";
17248
17315
  var StatusDisplay = () => {
17249
17316
  const uiState = useUIState();
17250
17317
  if (process.env["DSH_CONSOLE_SYSTEM_MD"]) {
17251
- return /* @__PURE__ */ jsx71(Text52, { color: theme.status.error, children: "|\u2310\u25A0_\u25A0|" });
17318
+ return /* @__PURE__ */ jsx72(Text52, { color: theme.status.error, children: "|\u2310\u25A0_\u25A0|" });
17252
17319
  }
17253
17320
  if (uiState.ctrlCPressedOnce) {
17254
- return /* @__PURE__ */ jsx71(Text52, { color: theme.status.warning, children: "Press Ctrl+C again to exit." });
17321
+ return /* @__PURE__ */ jsx72(Text52, { color: theme.status.warning, children: "Press Ctrl+C again to exit." });
17255
17322
  }
17256
17323
  if (uiState.warningMessage) {
17257
- return /* @__PURE__ */ jsx71(Text52, { color: theme.status.warning, children: uiState.warningMessage });
17324
+ return /* @__PURE__ */ jsx72(Text52, { color: theme.status.warning, children: uiState.warningMessage });
17258
17325
  }
17259
17326
  if (uiState.ctrlDPressedOnce) {
17260
- return /* @__PURE__ */ jsx71(Text52, { color: theme.status.warning, children: "Press Ctrl+D again to exit." });
17327
+ return /* @__PURE__ */ jsx72(Text52, { color: theme.status.warning, children: "Press Ctrl+D again to exit." });
17261
17328
  }
17262
17329
  if (uiState.showEscapePrompt) {
17263
17330
  if (uiState.buffer.text.length === 0) return null;
17264
- return /* @__PURE__ */ jsx71(Text52, { color: theme.text.secondary, children: "Press Esc again to clear prompt." });
17331
+ return /* @__PURE__ */ jsx72(Text52, { color: theme.text.secondary, children: "Press Esc again to clear prompt." });
17265
17332
  }
17266
17333
  if (uiState.queueErrorMessage) {
17267
- return /* @__PURE__ */ jsx71(Text52, { color: theme.status.error, children: uiState.queueErrorMessage });
17334
+ return /* @__PURE__ */ jsx72(Text52, { color: theme.status.error, children: uiState.queueErrorMessage });
17268
17335
  }
17269
17336
  return null;
17270
17337
  };
17271
17338
 
17272
17339
  // src/ui/components/input/composer.tsx
17273
- import { jsx as jsx72, jsxs as jsxs56 } from "react/jsx-runtime";
17340
+ import { jsx as jsx73, jsxs as jsxs56 } from "react/jsx-runtime";
17274
17341
  var Composer = ({ isFocused = true }) => {
17275
17342
  const config = useConfig();
17276
17343
  const settings = useSettings();
@@ -17292,16 +17359,16 @@ var Composer = ({ isFocused = true }) => {
17292
17359
  flexGrow: 0,
17293
17360
  flexShrink: 0,
17294
17361
  children: [
17295
- !uiState.embeddedShellFocused && /* @__PURE__ */ jsx72(
17362
+ !uiState.embeddedShellFocused && /* @__PURE__ */ jsx73(
17296
17363
  LoadingIndicator,
17297
17364
  {
17298
17365
  currentLoadingPhrase: config.getAccessibility()?.enableLoadingPhrases === false ? void 0 : uiState.currentLoadingPhrase,
17299
17366
  elapsedTime: uiState.elapsedTime
17300
17367
  }
17301
17368
  ),
17302
- !uiState.slashCommands && /* @__PURE__ */ jsx72(CommandInitDisplay, {}),
17303
- /* @__PURE__ */ jsx72(QueuedMessageDisplay, { messageQueue: uiState.messageQueue }),
17304
- /* @__PURE__ */ jsx72(TodoTray, {}),
17369
+ !uiState.slashCommands && /* @__PURE__ */ jsx73(CommandInitDisplay, {}),
17370
+ /* @__PURE__ */ jsx73(QueuedMessageDisplay, { messageQueue: uiState.messageQueue }),
17371
+ /* @__PURE__ */ jsx73(TodoTray, {}),
17305
17372
  /* @__PURE__ */ jsxs56(
17306
17373
  Box57,
17307
17374
  {
@@ -17311,16 +17378,16 @@ var Composer = ({ isFocused = true }) => {
17311
17378
  flexDirection: isNarrow ? "column" : "row",
17312
17379
  alignItems: isNarrow ? "flex-start" : "center",
17313
17380
  children: [
17314
- /* @__PURE__ */ jsx72(Box57, { marginRight: 1, children: /* @__PURE__ */ jsx72(StatusDisplay, {}) }),
17381
+ /* @__PURE__ */ jsx73(Box57, { marginRight: 1, children: /* @__PURE__ */ jsx73(StatusDisplay, {}) }),
17315
17382
  /* @__PURE__ */ jsxs56(Box57, { paddingTop: isNarrow ? 1 : 0, children: [
17316
- uiState.shellModeActive && /* @__PURE__ */ jsx72(ShellModeIndicator, {}),
17317
- !uiState.renderMarkdown && /* @__PURE__ */ jsx72(RawMarkdownIndicator, {})
17383
+ uiState.shellModeActive && /* @__PURE__ */ jsx73(ShellModeIndicator, {}),
17384
+ !uiState.renderMarkdown && /* @__PURE__ */ jsx73(RawMarkdownIndicator, {})
17318
17385
  ] })
17319
17386
  ]
17320
17387
  }
17321
17388
  ),
17322
- uiState.showErrorDetails && /* @__PURE__ */ jsx72(OverflowProvider, { children: /* @__PURE__ */ jsxs56(Box57, { flexDirection: "column", children: [
17323
- /* @__PURE__ */ jsx72(
17389
+ uiState.showErrorDetails && /* @__PURE__ */ jsx73(OverflowProvider, { children: /* @__PURE__ */ jsxs56(Box57, { flexDirection: "column", children: [
17390
+ /* @__PURE__ */ jsx73(
17324
17391
  DetailedMessagesDisplay,
17325
17392
  {
17326
17393
  messages: uiState.filteredConsoleMessages,
@@ -17329,9 +17396,9 @@ var Composer = ({ isFocused = true }) => {
17329
17396
  hasFocus: uiState.showErrorDetails
17330
17397
  }
17331
17398
  ),
17332
- /* @__PURE__ */ jsx72(ShowMoreLines, { constrainHeight: uiState.constrainHeight })
17399
+ /* @__PURE__ */ jsx73(ShowMoreLines, { constrainHeight: uiState.constrainHeight })
17333
17400
  ] }) }),
17334
- uiState.isInputActive && /* @__PURE__ */ jsx72(
17401
+ uiState.isInputActive && /* @__PURE__ */ jsx73(
17335
17402
  InputPrompt,
17336
17403
  {
17337
17404
  buffer: uiState.buffer,
@@ -17358,7 +17425,7 @@ var Composer = ({ isFocused = true }) => {
17358
17425
  onSuggestionsVisibilityChange: setSuggestionsVisible
17359
17426
  }
17360
17427
  ),
17361
- !settings.merged.ui.hideFooter && !isScreenReaderEnabled && /* @__PURE__ */ jsx72(Footer, {})
17428
+ !settings.merged.ui.hideFooter && !isScreenReaderEnabled && /* @__PURE__ */ jsx73(Footer, {})
17362
17429
  ]
17363
17430
  }
17364
17431
  );
@@ -17366,12 +17433,12 @@ var Composer = ({ isFocused = true }) => {
17366
17433
 
17367
17434
  // src/ui/components/dialogs/exit-warning.tsx
17368
17435
  import { Box as Box58, Text as Text53 } from "ink";
17369
- import { Fragment as Fragment13, jsx as jsx73, jsxs as jsxs57 } from "react/jsx-runtime";
17436
+ import { Fragment as Fragment13, jsx as jsx74, jsxs as jsxs57 } from "react/jsx-runtime";
17370
17437
  var ExitWarning = () => {
17371
17438
  const uiState = useUIState();
17372
17439
  return /* @__PURE__ */ jsxs57(Fragment13, { children: [
17373
- uiState.dialogsVisible && uiState.ctrlCPressedOnce && /* @__PURE__ */ jsx73(Box58, { marginTop: 1, children: /* @__PURE__ */ jsx73(Text53, { color: theme.status.warning, children: "Press Ctrl+C again to exit." }) }),
17374
- uiState.dialogsVisible && uiState.ctrlDPressedOnce && /* @__PURE__ */ jsx73(Box58, { marginTop: 1, children: /* @__PURE__ */ jsx73(Text53, { color: theme.status.warning, children: "Press Ctrl+D again to exit." }) })
17440
+ uiState.dialogsVisible && uiState.ctrlCPressedOnce && /* @__PURE__ */ jsx74(Box58, { marginTop: 1, children: /* @__PURE__ */ jsx74(Text53, { color: theme.status.warning, children: "Press Ctrl+C again to exit." }) }),
17441
+ uiState.dialogsVisible && uiState.ctrlDPressedOnce && /* @__PURE__ */ jsx74(Box58, { marginTop: 1, children: /* @__PURE__ */ jsx74(Text53, { color: theme.status.warning, children: "Press Ctrl+D again to exit." }) })
17375
17442
  ] });
17376
17443
  };
17377
17444
 
@@ -17400,7 +17467,7 @@ import {
17400
17467
  useMemo as useMemo22,
17401
17468
  useSyncExternalStore
17402
17469
  } from "react";
17403
- import { jsx as jsx74 } from "react/jsx-runtime";
17470
+ import { jsx as jsx75 } from "react/jsx-runtime";
17404
17471
  var ApprovalContext = createContext12(
17405
17472
  void 0
17406
17473
  );
@@ -17411,7 +17478,7 @@ var ApprovalRuntimeProvider = ({ runtime, children }) => {
17411
17478
  runtime.getSnapshot
17412
17479
  );
17413
17480
  const value = useMemo22(() => ({ runtime, snapshot }), [runtime, snapshot]);
17414
- return /* @__PURE__ */ jsx74(ApprovalContext.Provider, { value, children });
17481
+ return /* @__PURE__ */ jsx75(ApprovalContext.Provider, { value, children });
17415
17482
  };
17416
17483
  function useApprovalRuntime() {
17417
17484
  const value = useContext13(ApprovalContext);
@@ -17430,7 +17497,7 @@ import {
17430
17497
  useMemo as useMemo23,
17431
17498
  useSyncExternalStore as useSyncExternalStore2
17432
17499
  } from "react";
17433
- import { jsx as jsx75 } from "react/jsx-runtime";
17500
+ import { jsx as jsx76 } from "react/jsx-runtime";
17434
17501
  var UserQuestionContext = createContext13(void 0);
17435
17502
  var UserQuestionRuntimeProvider = ({ runtime, children }) => {
17436
17503
  const snapshot = useSyncExternalStore2(
@@ -17439,7 +17506,7 @@ var UserQuestionRuntimeProvider = ({ runtime, children }) => {
17439
17506
  runtime.getSnapshot
17440
17507
  );
17441
17508
  const value = useMemo23(() => ({ runtime, snapshot }), [runtime, snapshot]);
17442
- return /* @__PURE__ */ jsx75(UserQuestionContext.Provider, { value, children });
17509
+ return /* @__PURE__ */ jsx76(UserQuestionContext.Provider, { value, children });
17443
17510
  };
17444
17511
  function useUserQuestionRuntime() {
17445
17512
  const value = useContext14(UserQuestionContext);
@@ -17457,7 +17524,7 @@ import { Box as Box60, Text as Text55 } from "ink";
17457
17524
  // src/ui/components/messages/tool-confirmation-message.tsx
17458
17525
  import { Box as Box59, Text as Text54 } from "ink";
17459
17526
  import { useMemo as useMemo24 } from "react";
17460
- import { jsx as jsx76, jsxs as jsxs58 } from "react/jsx-runtime";
17527
+ import { jsx as jsx77, jsxs as jsxs58 } from "react/jsx-runtime";
17461
17528
  var ToolConfirmationMessage = ({ request, respond, isFocused }) => {
17462
17529
  useKeypress(
17463
17530
  (key) => {
@@ -17479,13 +17546,13 @@ var ToolConfirmationMessage = ({ request, respond, isFocused }) => {
17479
17546
  []
17480
17547
  );
17481
17548
  return /* @__PURE__ */ jsxs58(Box59, { flexDirection: "column", paddingBottom: 1, children: [
17482
- request.reason !== void 0 && /* @__PURE__ */ jsx76(Box59, { marginBottom: 1, children: /* @__PURE__ */ jsx76(Text54, { color: theme.text.secondary, children: request.reason }) }),
17483
- /* @__PURE__ */ jsx76(Box59, { marginBottom: 1, children: /* @__PURE__ */ jsxs58(Text54, { color: theme.text.primary, children: [
17549
+ request.reason !== void 0 && /* @__PURE__ */ jsx77(Box59, { marginBottom: 1, children: /* @__PURE__ */ jsx77(Text54, { color: theme.text.secondary, children: request.reason }) }),
17550
+ /* @__PURE__ */ jsx77(Box59, { marginBottom: 1, children: /* @__PURE__ */ jsxs58(Text54, { color: theme.text.primary, children: [
17484
17551
  "Allow ",
17485
- /* @__PURE__ */ jsx76(Text54, { bold: true, children: request.toolName }),
17552
+ /* @__PURE__ */ jsx77(Text54, { bold: true, children: request.toolName }),
17486
17553
  " to continue?"
17487
17554
  ] }) }),
17488
- /* @__PURE__ */ jsx76(
17555
+ /* @__PURE__ */ jsx77(
17489
17556
  RadioButtonSelect,
17490
17557
  {
17491
17558
  items: options,
@@ -17493,12 +17560,12 @@ var ToolConfirmationMessage = ({ request, respond, isFocused }) => {
17493
17560
  isFocused
17494
17561
  }
17495
17562
  ),
17496
- /* @__PURE__ */ jsx76(Text54, { color: theme.text.secondary, children: "Esc cancels this request" })
17563
+ /* @__PURE__ */ jsx77(Text54, { color: theme.text.secondary, children: "Esc cancels this request" })
17497
17564
  ] });
17498
17565
  };
17499
17566
 
17500
17567
  // src/ui/components/dialogs/tool-confirmation-queue.tsx
17501
- import { jsx as jsx77, jsxs as jsxs59 } from "react/jsx-runtime";
17568
+ import { jsx as jsx78, jsxs as jsxs59 } from "react/jsx-runtime";
17502
17569
  var ToolConfirmationQueue = ({ request, index, total, terminalWidth, respond }) => /* @__PURE__ */ jsxs59(
17503
17570
  Box60,
17504
17571
  {
@@ -17510,7 +17577,7 @@ var ToolConfirmationQueue = ({ request, index, total, terminalWidth, respond })
17510
17577
  flexShrink: 0,
17511
17578
  children: [
17512
17579
  /* @__PURE__ */ jsxs59(Box60, { marginBottom: 1, justifyContent: "space-between", children: [
17513
- /* @__PURE__ */ jsx77(Text55, { color: theme.status.warning, bold: true, children: "Action Required" }),
17580
+ /* @__PURE__ */ jsx78(Text55, { color: theme.status.warning, bold: true, children: "Action Required" }),
17514
17581
  /* @__PURE__ */ jsxs59(Text55, { color: theme.text.secondary, children: [
17515
17582
  index,
17516
17583
  " of ",
@@ -17518,13 +17585,13 @@ var ToolConfirmationQueue = ({ request, index, total, terminalWidth, respond })
17518
17585
  ] })
17519
17586
  ] }),
17520
17587
  /* @__PURE__ */ jsxs59(Box60, { marginBottom: 1, flexDirection: "column", children: [
17521
- /* @__PURE__ */ jsx77(Text55, { color: theme.text.primary, bold: true, children: request.toolName }),
17588
+ /* @__PURE__ */ jsx78(Text55, { color: theme.text.primary, bold: true, children: request.toolName }),
17522
17589
  request.callId !== void 0 && /* @__PURE__ */ jsxs59(Text55, { color: theme.text.secondary, children: [
17523
17590
  "Call ",
17524
17591
  request.callId
17525
17592
  ] })
17526
17593
  ] }),
17527
- /* @__PURE__ */ jsx77(
17594
+ /* @__PURE__ */ jsx78(
17528
17595
  ToolConfirmationMessage,
17529
17596
  {
17530
17597
  request,
@@ -17553,7 +17620,7 @@ import { Box as Box62, Text as Text57, useStdout as useStdout3 } from "ink";
17553
17620
  // src/ui/components/layout/tab-header.tsx
17554
17621
  import React15 from "react";
17555
17622
  import { Text as Text56, Box as Box61 } from "ink";
17556
- import { jsx as jsx78, jsxs as jsxs60 } from "react/jsx-runtime";
17623
+ import { jsx as jsx79, jsxs as jsxs60 } from "react/jsx-runtime";
17557
17624
  function TabHeader({
17558
17625
  tabs,
17559
17626
  currentIndex,
@@ -17574,14 +17641,14 @@ function TabHeader({
17574
17641
  return isCompleted ? "\u2713" : "\u25A1";
17575
17642
  };
17576
17643
  return /* @__PURE__ */ jsxs60(Box61, { flexDirection: "row", marginBottom: 1, children: [
17577
- showArrows && /* @__PURE__ */ jsx78(Text56, { color: theme.text.secondary, children: "\u2190 " }),
17644
+ showArrows && /* @__PURE__ */ jsx79(Text56, { color: theme.text.secondary, children: "\u2190 " }),
17578
17645
  tabs.map((tab, i) => /* @__PURE__ */ jsxs60(React15.Fragment, { children: [
17579
- i > 0 && /* @__PURE__ */ jsx78(Text56, { color: theme.text.secondary, children: " \u2502 " }),
17646
+ i > 0 && /* @__PURE__ */ jsx79(Text56, { color: theme.text.secondary, children: " \u2502 " }),
17580
17647
  showStatusIcons && /* @__PURE__ */ jsxs60(Text56, { color: theme.text.secondary, children: [
17581
17648
  getStatusIcon(tab, i),
17582
17649
  " "
17583
17650
  ] }),
17584
- /* @__PURE__ */ jsx78(
17651
+ /* @__PURE__ */ jsx79(
17585
17652
  Text56,
17586
17653
  {
17587
17654
  color: i === currentIndex ? theme.text.accent : theme.text.secondary,
@@ -17590,12 +17657,12 @@ function TabHeader({
17590
17657
  }
17591
17658
  )
17592
17659
  ] }, tab.key)),
17593
- showArrows && /* @__PURE__ */ jsx78(Text56, { color: theme.text.secondary, children: " \u2192" })
17660
+ showArrows && /* @__PURE__ */ jsx79(Text56, { color: theme.text.secondary, children: " \u2192" })
17594
17661
  ] });
17595
17662
  }
17596
17663
 
17597
17664
  // src/ui/components/dialogs/ask-user-dialog.tsx
17598
- import { jsx as jsx79, jsxs as jsxs61 } from "react/jsx-runtime";
17665
+ import { jsx as jsx80, jsxs as jsxs61 } from "react/jsx-runtime";
17599
17666
  var initialState2 = {
17600
17667
  currentQuestionIndex: 0,
17601
17668
  answers: {},
@@ -17718,19 +17785,19 @@ var ReviewView = ({
17718
17785
  borderColor: theme.border.default,
17719
17786
  children: [
17720
17787
  progressHeader,
17721
- /* @__PURE__ */ jsx79(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsx79(Text57, { bold: true, color: theme.text.primary, children: "Review your answers:" }) }),
17722
- hasUnanswered && /* @__PURE__ */ jsx79(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsxs61(Text57, { color: theme.status.warning, children: [
17788
+ /* @__PURE__ */ jsx80(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsx80(Text57, { bold: true, color: theme.text.primary, children: "Review your answers:" }) }),
17789
+ hasUnanswered && /* @__PURE__ */ jsx80(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsxs61(Text57, { color: theme.status.warning, children: [
17723
17790
  "\u26A0 You have ",
17724
17791
  unansweredCount,
17725
17792
  " unanswered question",
17726
17793
  unansweredCount > 1 ? "s" : ""
17727
17794
  ] }) }),
17728
17795
  questions.map((q, i) => /* @__PURE__ */ jsxs61(Box62, { marginBottom: 0, children: [
17729
- /* @__PURE__ */ jsx79(Text57, { color: theme.text.secondary, children: q.header }),
17730
- /* @__PURE__ */ jsx79(Text57, { color: theme.text.secondary, children: " \u2192 " }),
17731
- /* @__PURE__ */ jsx79(Text57, { color: answers[i] ? theme.text.primary : theme.status.warning, children: (answers[i] ? formatAnswerForReview(q, answers[i]) : void 0) || "(not answered)" })
17796
+ /* @__PURE__ */ jsx80(Text57, { color: theme.text.secondary, children: q.header }),
17797
+ /* @__PURE__ */ jsx80(Text57, { color: theme.text.secondary, children: " \u2192 " }),
17798
+ /* @__PURE__ */ jsx80(Text57, { color: answers[i] ? theme.text.primary : theme.status.warning, children: (answers[i] ? formatAnswerForReview(q, answers[i]) : void 0) || "(not answered)" })
17732
17799
  ] }, i)),
17733
- /* @__PURE__ */ jsx79(Box62, { marginTop: 1, children: /* @__PURE__ */ jsx79(Text57, { color: theme.text.secondary, children: "Enter to submit \xB7 Tab/Shift+Tab to edit answers \xB7 Esc to cancel" }) })
17800
+ /* @__PURE__ */ jsx80(Box62, { marginTop: 1, children: /* @__PURE__ */ jsx80(Text57, { color: theme.text.secondary, children: "Enter to submit \xB7 Tab/Shift+Tab to edit answers \xB7 Esc to cancel" }) })
17734
17801
  ]
17735
17802
  }
17736
17803
  );
@@ -17804,11 +17871,11 @@ var TextQuestionView = ({
17804
17871
  borderColor: theme.border.default,
17805
17872
  children: [
17806
17873
  progressHeader,
17807
- /* @__PURE__ */ jsx79(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsx79(Text57, { bold: true, color: theme.text.primary, children: question.question }) }),
17808
- question.detail && /* @__PURE__ */ jsx79(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsx79(Text57, { color: theme.text.secondary, children: question.detail }) }),
17874
+ /* @__PURE__ */ jsx80(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsx80(Text57, { bold: true, color: theme.text.primary, children: question.question }) }),
17875
+ question.detail && /* @__PURE__ */ jsx80(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsx80(Text57, { color: theme.text.secondary, children: question.detail }) }),
17809
17876
  /* @__PURE__ */ jsxs61(Box62, { flexDirection: "row", marginBottom: 1, children: [
17810
- /* @__PURE__ */ jsx79(Text57, { color: theme.text.accent, children: "> " }),
17811
- /* @__PURE__ */ jsx79(
17877
+ /* @__PURE__ */ jsx80(Text57, { color: theme.text.accent, children: "> " }),
17878
+ /* @__PURE__ */ jsx80(
17812
17879
  TextInput,
17813
17880
  {
17814
17881
  buffer,
@@ -18112,13 +18179,13 @@ var ChoiceQuestionView = ({
18112
18179
  borderColor: theme.border.default,
18113
18180
  children: [
18114
18181
  progressHeader,
18115
- /* @__PURE__ */ jsx79(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsx79(Text57, { bold: true, color: theme.text.primary, children: question.question }) }),
18116
- question.detail && /* @__PURE__ */ jsx79(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsx79(Text57, { color: theme.text.secondary, children: question.detail }) }),
18182
+ /* @__PURE__ */ jsx80(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsx80(Text57, { bold: true, color: theme.text.primary, children: question.question }) }),
18183
+ question.detail && /* @__PURE__ */ jsx80(Box62, { marginBottom: 1, children: /* @__PURE__ */ jsx80(Text57, { color: theme.text.secondary, children: question.detail }) }),
18117
18184
  question.multiSelect && /* @__PURE__ */ jsxs61(Text57, { color: theme.text.secondary, italic: true, children: [
18118
18185
  " ",
18119
18186
  "(Select all that apply)"
18120
18187
  ] }),
18121
- /* @__PURE__ */ jsx79(
18188
+ /* @__PURE__ */ jsx80(
18122
18189
  BaseSelectionList,
18123
18190
  {
18124
18191
  items: selectionItems,
@@ -18143,8 +18210,8 @@ var ChoiceQuestionView = ({
18143
18210
  ]
18144
18211
  }
18145
18212
  ),
18146
- /* @__PURE__ */ jsx79(Text57, { color: theme.text.primary, children: " " }),
18147
- /* @__PURE__ */ jsx79(
18213
+ /* @__PURE__ */ jsx80(Text57, { color: theme.text.primary, children: " " }),
18214
+ /* @__PURE__ */ jsx80(
18148
18215
  TextInput,
18149
18216
  {
18150
18217
  buffer: customBuffer,
@@ -18153,7 +18220,7 @@ var ChoiceQuestionView = ({
18153
18220
  onSubmit: () => handleSelect(optionItem)
18154
18221
  }
18155
18222
  ),
18156
- isChecked && !question.multiSelect && /* @__PURE__ */ jsx79(Text57, { color: theme.status.success, children: " \u2713" })
18223
+ isChecked && !question.multiSelect && /* @__PURE__ */ jsx80(Text57, { color: theme.status.success, children: " \u2713" })
18157
18224
  ] });
18158
18225
  }
18159
18226
  const labelColor = isChecked && !question.multiSelect ? theme.status.success : context.isSelected ? context.titleColor : theme.text.primary;
@@ -18174,7 +18241,7 @@ var ChoiceQuestionView = ({
18174
18241
  " ",
18175
18242
  optionItem.label
18176
18243
  ] }),
18177
- isChecked && !question.multiSelect && /* @__PURE__ */ jsx79(Text57, { color: theme.status.success, children: " \u2713" })
18244
+ isChecked && !question.multiSelect && /* @__PURE__ */ jsx80(Text57, { color: theme.status.success, children: " \u2713" })
18178
18245
  ] }),
18179
18246
  optionItem.description && /* @__PURE__ */ jsxs61(Text57, { color: theme.text.secondary, wrap: "wrap", children: [
18180
18247
  " ",
@@ -18356,7 +18423,7 @@ var AskUserDialog = ({
18356
18423
  }
18357
18424
  return questionTabs;
18358
18425
  }, [questions]);
18359
- const progressHeader = questions.length > 1 ? /* @__PURE__ */ jsx79(
18426
+ const progressHeader = questions.length > 1 ? /* @__PURE__ */ jsx80(
18360
18427
  TabHeader,
18361
18428
  {
18362
18429
  tabs,
@@ -18365,7 +18432,7 @@ var AskUserDialog = ({
18365
18432
  }
18366
18433
  ) : null;
18367
18434
  if (isOnReviewTab) {
18368
- return /* @__PURE__ */ jsx79(
18435
+ return /* @__PURE__ */ jsx80(
18369
18436
  ReviewView,
18370
18437
  {
18371
18438
  questions,
@@ -18376,9 +18443,9 @@ var AskUserDialog = ({
18376
18443
  );
18377
18444
  }
18378
18445
  if (!currentQuestion) return null;
18379
- const keyboardHints = /* @__PURE__ */ jsx79(Box62, { marginTop: 1, children: /* @__PURE__ */ jsx79(Text57, { color: theme.text.secondary, children: currentQuestion.type === "text" || isEditingCustomOption ? questions.length > 1 ? "Enter to submit \xB7 Tab/Shift+Tab to switch questions \xB7 Esc to cancel" : "Enter to submit \xB7 Esc to cancel" : questions.length > 1 ? "Enter to select \xB7 \u2190/\u2192 to switch questions \xB7 Esc to cancel" : "Enter to select \xB7 \u2191/\u2193 to navigate \xB7 Esc to cancel" }) });
18446
+ const keyboardHints = /* @__PURE__ */ jsx80(Box62, { marginTop: 1, children: /* @__PURE__ */ jsx80(Text57, { color: theme.text.secondary, children: currentQuestion.type === "text" || isEditingCustomOption ? questions.length > 1 ? "Enter to submit \xB7 Tab/Shift+Tab to switch questions \xB7 Esc to cancel" : "Enter to submit \xB7 Esc to cancel" : questions.length > 1 ? "Enter to select \xB7 \u2190/\u2192 to switch questions \xB7 Esc to cancel" : "Enter to select \xB7 \u2191/\u2193 to navigate \xB7 Esc to cancel" }) });
18380
18447
  if (currentQuestion.type === "text") {
18381
- return /* @__PURE__ */ jsx79(
18448
+ return /* @__PURE__ */ jsx80(
18382
18449
  TextQuestionView,
18383
18450
  {
18384
18451
  question: currentQuestion,
@@ -18393,7 +18460,7 @@ var AskUserDialog = ({
18393
18460
  currentQuestionIndex
18394
18461
  );
18395
18462
  }
18396
- return /* @__PURE__ */ jsx79(
18463
+ return /* @__PURE__ */ jsx80(
18397
18464
  ChoiceQuestionView,
18398
18465
  {
18399
18466
  question: effectiveQuestion,
@@ -18410,7 +18477,7 @@ var AskUserDialog = ({
18410
18477
  };
18411
18478
 
18412
18479
  // src/ui/components/dialogs/user-question-queue.tsx
18413
- import { jsx as jsx80 } from "react/jsx-runtime";
18480
+ import { jsx as jsx81 } from "react/jsx-runtime";
18414
18481
  var UserQuestionQueue = () => {
18415
18482
  const { runtime, snapshot } = useUserQuestionRuntime();
18416
18483
  const request = snapshot.pending[0];
@@ -18433,7 +18500,7 @@ var UserQuestionQueue = () => {
18433
18500
  [request]
18434
18501
  );
18435
18502
  if (request === void 0) return null;
18436
- return /* @__PURE__ */ jsx80(
18503
+ return /* @__PURE__ */ jsx81(
18437
18504
  AskUserDialog,
18438
18505
  {
18439
18506
  questions: [...questions],
@@ -18456,7 +18523,7 @@ var UserQuestionQueue = () => {
18456
18523
  };
18457
18524
 
18458
18525
  // src/ui/components/layout/screen-reader-app-layout.tsx
18459
- import { jsx as jsx81, jsxs as jsxs62 } from "react/jsx-runtime";
18526
+ import { jsx as jsx82, jsxs as jsxs62 } from "react/jsx-runtime";
18460
18527
  var ScreenReaderAppLayout = () => {
18461
18528
  const uiState = useUIState();
18462
18529
  const { rootUiRef, terminalHeight } = uiState;
@@ -18473,10 +18540,10 @@ var ScreenReaderAppLayout = () => {
18473
18540
  height: "100%",
18474
18541
  ref: uiState.rootUiRef,
18475
18542
  children: [
18476
- /* @__PURE__ */ jsx81(Notifications, {}),
18477
- /* @__PURE__ */ jsx81(Footer, {}),
18478
- /* @__PURE__ */ jsx81(Box63, { flexGrow: 1, overflow: "hidden", children: /* @__PURE__ */ jsx81(MainContent, {}) }),
18479
- pendingApproval !== void 0 ? /* @__PURE__ */ jsx81(
18543
+ /* @__PURE__ */ jsx82(Notifications, {}),
18544
+ /* @__PURE__ */ jsx82(Footer, {}),
18545
+ /* @__PURE__ */ jsx82(Box63, { flexGrow: 1, overflow: "hidden", children: /* @__PURE__ */ jsx82(MainContent, {}) }),
18546
+ pendingApproval !== void 0 ? /* @__PURE__ */ jsx82(
18480
18547
  ToolConfirmationQueue,
18481
18548
  {
18482
18549
  request: pendingApproval,
@@ -18485,13 +18552,13 @@ var ScreenReaderAppLayout = () => {
18485
18552
  terminalWidth: uiState.terminalWidth,
18486
18553
  respond: (response) => approvalRuntime.respond(pendingApproval.id, response)
18487
18554
  }
18488
- ) : pendingUserQuestion !== void 0 ? /* @__PURE__ */ jsx81(UserQuestionQueue, {}) : uiState.dialogsVisible ? /* @__PURE__ */ jsx81(
18555
+ ) : pendingUserQuestion !== void 0 ? /* @__PURE__ */ jsx82(UserQuestionQueue, {}) : uiState.dialogsVisible ? /* @__PURE__ */ jsx82(
18489
18556
  DialogManager,
18490
18557
  {
18491
18558
  terminalWidth: uiState.terminalWidth
18492
18559
  }
18493
- ) : /* @__PURE__ */ jsx81(Composer, {}),
18494
- /* @__PURE__ */ jsx81(ExitWarning, {})
18560
+ ) : /* @__PURE__ */ jsx82(Composer, {}),
18561
+ /* @__PURE__ */ jsx82(ExitWarning, {})
18495
18562
  ]
18496
18563
  }
18497
18564
  );
@@ -18502,17 +18569,17 @@ import { Box as Box65 } from "ink";
18502
18569
 
18503
18570
  // src/ui/components/dialogs/copy-mode-warning.tsx
18504
18571
  import { Box as Box64, Text as Text58 } from "ink";
18505
- import { jsx as jsx82 } from "react/jsx-runtime";
18572
+ import { jsx as jsx83 } from "react/jsx-runtime";
18506
18573
  var CopyModeWarning = () => {
18507
18574
  const { copyModeEnabled } = useUIState();
18508
18575
  if (!copyModeEnabled) {
18509
18576
  return null;
18510
18577
  }
18511
- return /* @__PURE__ */ jsx82(Box64, { children: /* @__PURE__ */ jsx82(Text58, { color: theme.status.warning, children: "In Copy Mode. Press any key to exit." }) });
18578
+ return /* @__PURE__ */ jsx83(Box64, { children: /* @__PURE__ */ jsx83(Text58, { color: theme.status.warning, children: "In Copy Mode. Press any key to exit." }) });
18512
18579
  };
18513
18580
 
18514
18581
  // src/ui/components/layout/default-app-layout.tsx
18515
- import { Fragment as Fragment14, jsx as jsx83, jsxs as jsxs63 } from "react/jsx-runtime";
18582
+ import { Fragment as Fragment14, jsx as jsx84, jsxs as jsxs63 } from "react/jsx-runtime";
18516
18583
  var DefaultAppLayout = () => {
18517
18584
  const uiState = useUIState();
18518
18585
  const isAlternateBuffer = useAlternateBuffer();
@@ -18534,7 +18601,7 @@ var DefaultAppLayout = () => {
18534
18601
  overflow: "hidden",
18535
18602
  ref: uiState.rootUiRef,
18536
18603
  children: [
18537
- /* @__PURE__ */ jsx83(MainContent, {}),
18604
+ /* @__PURE__ */ jsx84(MainContent, {}),
18538
18605
  /* @__PURE__ */ jsxs63(
18539
18606
  Box65,
18540
18607
  {
@@ -18544,10 +18611,10 @@ var DefaultAppLayout = () => {
18544
18611
  flexGrow: 0,
18545
18612
  width: uiState.terminalWidth,
18546
18613
  children: [
18547
- /* @__PURE__ */ jsx83(Notifications, {}),
18548
- /* @__PURE__ */ jsx83(CopyModeWarning, {}),
18614
+ /* @__PURE__ */ jsx84(Notifications, {}),
18615
+ /* @__PURE__ */ jsx84(CopyModeWarning, {}),
18549
18616
  pendingApproval !== void 0 ? /* @__PURE__ */ jsxs63(Fragment14, { children: [
18550
- /* @__PURE__ */ jsx83(
18617
+ /* @__PURE__ */ jsx84(
18551
18618
  ToolConfirmationQueue,
18552
18619
  {
18553
18620
  request: pendingApproval,
@@ -18557,14 +18624,14 @@ var DefaultAppLayout = () => {
18557
18624
  respond: (response) => approvalRuntime.respond(pendingApproval.id, response)
18558
18625
  }
18559
18626
  ),
18560
- /* @__PURE__ */ jsx83(Composer, { isFocused: false })
18561
- ] }) : pendingUserQuestion !== void 0 ? /* @__PURE__ */ jsx83(UserQuestionQueue, {}) : uiState.customDialog ? uiState.customDialog : uiState.dialogsVisible ? /* @__PURE__ */ jsx83(
18627
+ /* @__PURE__ */ jsx84(Composer, { isFocused: false })
18628
+ ] }) : pendingUserQuestion !== void 0 ? /* @__PURE__ */ jsx84(UserQuestionQueue, {}) : uiState.customDialog ? uiState.customDialog : uiState.dialogsVisible ? /* @__PURE__ */ jsx84(
18562
18629
  DialogManager,
18563
18630
  {
18564
18631
  terminalWidth: uiState.terminalWidth
18565
18632
  }
18566
- ) : /* @__PURE__ */ jsx83(Composer, { isFocused: true }),
18567
- /* @__PURE__ */ jsx83(ExitWarning, {})
18633
+ ) : /* @__PURE__ */ jsx84(Composer, { isFocused: true }),
18634
+ /* @__PURE__ */ jsx84(ExitWarning, {})
18568
18635
  ]
18569
18636
  }
18570
18637
  )
@@ -18575,7 +18642,7 @@ var DefaultAppLayout = () => {
18575
18642
 
18576
18643
  // src/ui/components/indicators/alternate-buffer-quitting-display.tsx
18577
18644
  import { Box as Box66, Text as Text59 } from "ink";
18578
- import { jsx as jsx84, jsxs as jsxs64 } from "react/jsx-runtime";
18645
+ import { jsx as jsx85, jsxs as jsxs64 } from "react/jsx-runtime";
18579
18646
  var AlternateBufferQuittingDisplay = () => {
18580
18647
  const { version } = useAppContext();
18581
18648
  const uiState = useUIState();
@@ -18589,8 +18656,8 @@ var AlternateBufferQuittingDisplay = () => {
18589
18656
  flexGrow: 0,
18590
18657
  width: uiState.terminalWidth,
18591
18658
  children: [
18592
- /* @__PURE__ */ jsx84(AppHeader, { version }, "app-header"),
18593
- uiState.history.map((h) => /* @__PURE__ */ jsx84(
18659
+ /* @__PURE__ */ jsx85(AppHeader, { version }, "app-header"),
18660
+ uiState.history.map((h) => /* @__PURE__ */ jsx85(
18594
18661
  HistoryItemDisplay,
18595
18662
  {
18596
18663
  terminalWidth: uiState.mainAreaWidth,
@@ -18602,7 +18669,7 @@ var AlternateBufferQuittingDisplay = () => {
18602
18669
  },
18603
18670
  h.id
18604
18671
  )),
18605
- uiState.pendingHistoryItems.map((item, i) => /* @__PURE__ */ jsx84(
18672
+ uiState.pendingHistoryItems.map((item, i) => /* @__PURE__ */ jsx85(
18606
18673
  HistoryItemDisplay,
18607
18674
  {
18608
18675
  availableTerminalHeight: void 0,
@@ -18616,30 +18683,30 @@ var AlternateBufferQuittingDisplay = () => {
18616
18683
  i
18617
18684
  )),
18618
18685
  pendingApproval !== void 0 && /* @__PURE__ */ jsxs64(Box66, { flexDirection: "column", marginTop: 1, marginBottom: 1, children: [
18619
- /* @__PURE__ */ jsx84(Text59, { color: theme.status.warning, bold: true, children: "Action Required (was prompted):" }),
18620
- /* @__PURE__ */ jsx84(Text59, { color: theme.text.primary, children: pendingApproval.toolName }),
18621
- pendingApproval.reason !== void 0 && /* @__PURE__ */ jsx84(Text59, { color: theme.text.secondary, children: pendingApproval.reason })
18686
+ /* @__PURE__ */ jsx85(Text59, { color: theme.status.warning, bold: true, children: "Action Required (was prompted):" }),
18687
+ /* @__PURE__ */ jsx85(Text59, { color: theme.text.primary, children: pendingApproval.toolName }),
18688
+ pendingApproval.reason !== void 0 && /* @__PURE__ */ jsx85(Text59, { color: theme.text.secondary, children: pendingApproval.reason })
18622
18689
  ] }),
18623
- /* @__PURE__ */ jsx84(QuittingDisplay, {})
18690
+ /* @__PURE__ */ jsx85(QuittingDisplay, {})
18624
18691
  ]
18625
18692
  }
18626
18693
  );
18627
18694
  };
18628
18695
 
18629
18696
  // src/ui/app.tsx
18630
- import { jsx as jsx85 } from "react/jsx-runtime";
18697
+ import { jsx as jsx86 } from "react/jsx-runtime";
18631
18698
  var App = () => {
18632
18699
  const uiState = useUIState();
18633
18700
  const isAlternateBuffer = useAlternateBuffer();
18634
18701
  const isScreenReaderEnabled = useIsScreenReaderEnabled5();
18635
18702
  if (uiState.quittingMessages) {
18636
18703
  if (isAlternateBuffer) {
18637
- return /* @__PURE__ */ jsx85(StreamingContext.Provider, { value: uiState.streamingState, children: /* @__PURE__ */ jsx85(AlternateBufferQuittingDisplay, {}) });
18704
+ return /* @__PURE__ */ jsx86(StreamingContext.Provider, { value: uiState.streamingState, children: /* @__PURE__ */ jsx86(AlternateBufferQuittingDisplay, {}) });
18638
18705
  } else {
18639
- return /* @__PURE__ */ jsx85(QuittingDisplay, {});
18706
+ return /* @__PURE__ */ jsx86(QuittingDisplay, {});
18640
18707
  }
18641
18708
  }
18642
- return /* @__PURE__ */ jsx85(StreamingContext.Provider, { value: uiState.streamingState, children: isScreenReaderEnabled ? /* @__PURE__ */ jsx85(ScreenReaderAppLayout, {}) : /* @__PURE__ */ jsx85(DefaultAppLayout, {}) });
18709
+ return /* @__PURE__ */ jsx86(StreamingContext.Provider, { value: uiState.streamingState, children: isScreenReaderEnabled ? /* @__PURE__ */ jsx86(ScreenReaderAppLayout, {}) : /* @__PURE__ */ jsx86(DefaultAppLayout, {}) });
18643
18710
  };
18644
18711
 
18645
18712
  // src/ui/app-container.tsx
@@ -18705,7 +18772,7 @@ function useHistory() {
18705
18772
  }
18706
18773
 
18707
18774
  // src/ui/hooks/commands/use-slash-command-processor.ts
18708
- import { useCallback as useCallback35, useMemo as useMemo32, useEffect as useEffect41, useRef as useRef19, useState as useState39 } from "react";
18775
+ import { useCallback as useCallback35, useMemo as useMemo33, useEffect as useEffect43, useRef as useRef21, useState as useState41 } from "react";
18709
18776
 
18710
18777
  // src/services/command-service.ts
18711
18778
  var CommandService = class _CommandService {
@@ -19132,26 +19199,222 @@ var terminalSetupCommand = {
19132
19199
  import React16 from "react";
19133
19200
 
19134
19201
  // src/ui/components/dialogs/model-dialog.tsx
19135
- import { useCallback as useCallback32, useEffect as useEffect38, useMemo as useMemo28, useState as useState35 } from "react";
19202
+ import { useCallback as useCallback32, useEffect as useEffect39, useMemo as useMemo28, useRef as useRef19, useState as useState36 } from "react";
19203
+ import { Box as Box68, Text as Text61 } from "ink";
19204
+
19205
+ // src/ui/components/dialogs/provider-setup-dialog.tsx
19206
+ import { useEffect as useEffect38, useRef as useRef18, useState as useState35 } from "react";
19136
19207
  import { Box as Box67, Text as Text60 } from "ink";
19137
- import { Fragment as Fragment15, jsx as jsx86, jsxs as jsxs65 } from "react/jsx-runtime";
19208
+ import { jsx as jsx87, jsxs as jsxs65 } from "react/jsx-runtime";
19209
+ function ProviderSetupDialog({
19210
+ runtime,
19211
+ provider,
19212
+ reason = "model",
19213
+ onCancel,
19214
+ onConfigured
19215
+ }) {
19216
+ useSensitiveInputProtection();
19217
+ const [view, setView] = useState35();
19218
+ const [secret, setSecret] = useState35("");
19219
+ const [saving, setSaving] = useState35(false);
19220
+ const [error, setError] = useState35();
19221
+ const mountedRef = useRef18(true);
19222
+ const saveControllerRef = useRef18(void 0);
19223
+ useEffect38(() => {
19224
+ mountedRef.current = true;
19225
+ const controller = new AbortController();
19226
+ void runtime.describeProvider(provider, controller.signal).then(setView).catch((cause) => {
19227
+ if (!controller.signal.aborted) {
19228
+ setError(cause instanceof Error ? cause.message : String(cause));
19229
+ }
19230
+ });
19231
+ return () => {
19232
+ mountedRef.current = false;
19233
+ controller.abort();
19234
+ saveControllerRef.current?.abort();
19235
+ };
19236
+ }, [provider, runtime]);
19237
+ const submit = async () => {
19238
+ if (saving || !view?.writable) return;
19239
+ const value = secret;
19240
+ const controller = new AbortController();
19241
+ saveControllerRef.current?.abort();
19242
+ saveControllerRef.current = controller;
19243
+ setSecret("");
19244
+ setSaving(true);
19245
+ setError(void 0);
19246
+ try {
19247
+ const configured = await runtime.configure(
19248
+ provider,
19249
+ value,
19250
+ controller.signal
19251
+ );
19252
+ if (!mountedRef.current || controller.signal.aborted) return;
19253
+ onConfigured(configured);
19254
+ } catch (cause) {
19255
+ if (!mountedRef.current || controller.signal.aborted || cause instanceof Error && cause.name === "AbortError") {
19256
+ return;
19257
+ }
19258
+ setError(
19259
+ cause instanceof Error ? cause.message : "Unable to save this credential."
19260
+ );
19261
+ } finally {
19262
+ if (saveControllerRef.current === controller) {
19263
+ saveControllerRef.current = void 0;
19264
+ }
19265
+ if (mountedRef.current) setSaving(false);
19266
+ }
19267
+ };
19268
+ useKeypress(
19269
+ (key) => {
19270
+ if (key.name === "escape") {
19271
+ saveControllerRef.current?.abort();
19272
+ setSecret("");
19273
+ onCancel();
19274
+ return;
19275
+ }
19276
+ if (key.ctrl && key.name === "c") {
19277
+ if (saving || secret.length === 0) {
19278
+ saveControllerRef.current?.abort();
19279
+ setSecret("");
19280
+ onCancel();
19281
+ } else {
19282
+ setSecret("");
19283
+ }
19284
+ return;
19285
+ }
19286
+ if (saving) return;
19287
+ if (key.ctrl && key.name === "u") {
19288
+ setSecret("");
19289
+ return;
19290
+ }
19291
+ if (key.name === "return" || key.name === "enter") {
19292
+ void submit();
19293
+ return;
19294
+ }
19295
+ if (key.name === "backspace" || key.name === "delete" || key.ctrl && key.name === "h") {
19296
+ setSecret((current) => current.slice(0, -1));
19297
+ return;
19298
+ }
19299
+ if (!key.ctrl && !key.cmd && key.sequence && key.sequence >= " ") {
19300
+ setSecret((current) => current + key.sequence);
19301
+ }
19302
+ },
19303
+ { isActive: true }
19304
+ );
19305
+ const label = view?.displayName ?? provider;
19306
+ const credential = view?.credentialLabel ?? "provider credential";
19307
+ const fieldLabel = credential.endsWith("_API_KEY") ? "API key" : "Credential";
19308
+ const canWrite = view?.writable === true;
19309
+ const isReadOnly = view !== void 0 && view.status !== "unsupported" && view.status !== "error" && !view.writable;
19310
+ return /* @__PURE__ */ jsxs65(
19311
+ Box67,
19312
+ {
19313
+ borderStyle: "round",
19314
+ borderColor: theme.border.default,
19315
+ flexDirection: "column",
19316
+ paddingX: 1,
19317
+ paddingY: 1,
19318
+ width: "100%",
19319
+ children: [
19320
+ /* @__PURE__ */ jsxs65(Box67, { justifyContent: "space-between", children: [
19321
+ /* @__PURE__ */ jsxs65(Text60, { bold: true, color: theme.text.accent, children: [
19322
+ "Configure ",
19323
+ label
19324
+ ] }),
19325
+ /* @__PURE__ */ jsxs65(Text60, { color: theme.text.secondary, children: [
19326
+ /* @__PURE__ */ jsx87(Text60, { bold: true, color: theme.text.primary, children: "Esc" }),
19327
+ " ",
19328
+ reason === "first-run" ? "Cancel" : "Close"
19329
+ ] })
19330
+ ] }),
19331
+ /* @__PURE__ */ jsxs65(Box67, { marginTop: 1, flexDirection: "column", children: [
19332
+ /* @__PURE__ */ jsx87(Text60, { color: theme.text.primary, children: reason === "first-run" ? `Enter your ${label} API key to continue.` : `Enter a replacement credential for ${label}.` }),
19333
+ /* @__PURE__ */ jsxs65(Text60, { color: theme.text.secondary, children: [
19334
+ "Alternatively, set ",
19335
+ credential,
19336
+ " before starting DSH Console."
19337
+ ] })
19338
+ ] }),
19339
+ !view && !error && /* @__PURE__ */ jsx87(Box67, { marginTop: 1, children: /* @__PURE__ */ jsx87(Text60, { color: theme.text.secondary, children: "Checking provider setup..." }) }),
19340
+ view?.status === "configured" && /* @__PURE__ */ jsx87(Box67, { marginTop: 1, children: /* @__PURE__ */ jsxs65(Text60, { color: theme.status.success, children: [
19341
+ "Configured from ",
19342
+ view.source ?? "DSH credential storage",
19343
+ "."
19344
+ ] }) }),
19345
+ (view?.status === "unsupported" || view?.status === "error") && view.message && /* @__PURE__ */ jsx87(Box67, { marginTop: 1, children: /* @__PURE__ */ jsx87(Text60, { color: theme.status.warning, children: view.message }) }),
19346
+ isReadOnly && /* @__PURE__ */ jsx87(Box67, { marginTop: 1, children: /* @__PURE__ */ jsxs65(Text60, { color: theme.status.warning, children: [
19347
+ credential,
19348
+ " is supplied by a read-only source. Change that source and restart DSH Console."
19349
+ ] }) }),
19350
+ canWrite && /* @__PURE__ */ jsxs65(Box67, { marginTop: 1, flexDirection: "column", children: [
19351
+ /* @__PURE__ */ jsx87(Text60, { bold: true, color: theme.text.primary, children: fieldLabel }),
19352
+ /* @__PURE__ */ jsx87(
19353
+ Box67,
19354
+ {
19355
+ borderStyle: "single",
19356
+ borderColor: saving ? theme.border.default : theme.text.accent,
19357
+ paddingX: 1,
19358
+ children: /* @__PURE__ */ jsx87(Text60, { color: theme.text.primary, children: secret.length === 0 ? /* @__PURE__ */ jsxs65(Text60, { color: theme.text.secondary, children: [
19359
+ "Paste your ",
19360
+ label,
19361
+ " API key"
19362
+ ] }) : `${"*".repeat(Math.min(secret.length, 64))}${secret.length > 64 ? "..." : ""}` })
19363
+ }
19364
+ )
19365
+ ] }),
19366
+ error && /* @__PURE__ */ jsx87(Box67, { marginTop: 1, children: /* @__PURE__ */ jsx87(Text60, { color: theme.status.error, children: error }) }),
19367
+ canWrite ? /* @__PURE__ */ jsxs65(Box67, { marginTop: 1, flexDirection: "column", children: [
19368
+ /* @__PURE__ */ jsx87(Text60, { color: theme.text.secondary, children: "Stored through the configured DSH credential service. Never added to prompts, sessions, history, or logs." }),
19369
+ /* @__PURE__ */ jsxs65(Box67, { marginTop: 1, children: [
19370
+ /* @__PURE__ */ jsx87(Text60, { bold: true, color: theme.text.accent, children: "Enter" }),
19371
+ /* @__PURE__ */ jsx87(Text60, { color: theme.text.primary, children: " Save and continue" }),
19372
+ /* @__PURE__ */ jsx87(Text60, { color: theme.text.secondary, children: " " }),
19373
+ /* @__PURE__ */ jsx87(Text60, { bold: true, color: theme.text.primary, children: "Esc" }),
19374
+ /* @__PURE__ */ jsxs65(Text60, { color: theme.text.secondary, children: [
19375
+ " ",
19376
+ reason === "first-run" ? "Cancel" : "Close"
19377
+ ] }),
19378
+ /* @__PURE__ */ jsx87(Text60, { color: theme.text.secondary, children: " " }),
19379
+ /* @__PURE__ */ jsx87(Text60, { bold: true, color: theme.text.primary, children: "Ctrl+C" }),
19380
+ /* @__PURE__ */ jsxs65(Text60, { color: theme.text.secondary, children: [
19381
+ " ",
19382
+ secret.length > 0 ? "Clear" : "Cancel"
19383
+ ] })
19384
+ ] })
19385
+ ] }) : /* @__PURE__ */ jsxs65(Box67, { marginTop: 1, children: [
19386
+ /* @__PURE__ */ jsx87(Text60, { bold: true, color: theme.text.primary, children: "Esc" }),
19387
+ /* @__PURE__ */ jsx87(Text60, { color: theme.text.secondary, children: " Close" })
19388
+ ] }),
19389
+ saving && /* @__PURE__ */ jsx87(Text60, { bold: true, color: theme.text.accent, children: "Saving credential..." })
19390
+ ]
19391
+ }
19392
+ );
19393
+ }
19394
+
19395
+ // src/ui/components/dialogs/model-dialog.tsx
19396
+ import { Fragment as Fragment15, jsx as jsx88, jsxs as jsxs66 } from "react/jsx-runtime";
19138
19397
  function capabilityLabel(model) {
19139
19398
  return model.inputModalities.includes("image") ? "Text + Vision" : "Text";
19140
19399
  }
19141
19400
  function ModelDialog({
19142
19401
  runtime,
19143
19402
  onClose,
19144
- onSwitched
19403
+ onSwitched,
19404
+ providerSetupRuntime
19145
19405
  }) {
19146
- const [models, setModels] = useState35([]);
19147
- const [highlighted, setHighlighted] = useState35(
19406
+ const [models, setModels] = useState36([]);
19407
+ const [highlighted, setHighlighted] = useState36(
19148
19408
  runtime.getSnapshot().current
19149
19409
  );
19150
- const [pending, setPending] = useState35();
19151
- const [loading, setLoading] = useState35(true);
19152
- const [switching, setSwitching] = useState35(false);
19153
- const [error, setError] = useState35();
19154
- useEffect38(() => {
19410
+ const [pending, setPending] = useState36();
19411
+ const [loading, setLoading] = useState36(true);
19412
+ const [switching, setSwitching] = useState36(false);
19413
+ const [checkingProvider, setCheckingProvider] = useState36(false);
19414
+ const [error, setError] = useState36();
19415
+ const [setupSelection, setSetupSelection] = useState36();
19416
+ const providerCheckRef = useRef19(void 0);
19417
+ useEffect39(() => {
19155
19418
  const controller = new AbortController();
19156
19419
  void runtime.listModels(controller.signal).then((listed) => {
19157
19420
  const sorted = [...listed].sort(
@@ -19173,6 +19436,10 @@ function ModelDialog({
19173
19436
  });
19174
19437
  return () => controller.abort();
19175
19438
  }, [runtime]);
19439
+ useEffect39(
19440
+ () => () => providerCheckRef.current?.abort(),
19441
+ []
19442
+ );
19176
19443
  const current = runtime.getSnapshot().current;
19177
19444
  const initialIndex = Math.max(
19178
19445
  0,
@@ -19204,7 +19471,7 @@ function ModelDialog({
19204
19471
  },
19205
19472
  [onSwitched, runtime]
19206
19473
  );
19207
- const selectModel = useCallback32(
19474
+ const finishSelection = useCallback32(
19208
19475
  (selection) => {
19209
19476
  if (selection.provider === current.provider && selection.model === current.model) {
19210
19477
  onClose();
@@ -19218,16 +19485,75 @@ function ModelDialog({
19218
19485
  },
19219
19486
  [current.model, current.provider, onClose, runtime, switchModel]
19220
19487
  );
19488
+ const selectModel = useCallback32(
19489
+ async (selection) => {
19490
+ if (providerSetupRuntime) {
19491
+ providerCheckRef.current?.abort();
19492
+ const controller = new AbortController();
19493
+ providerCheckRef.current = controller;
19494
+ setCheckingProvider(true);
19495
+ setError(void 0);
19496
+ try {
19497
+ const setup = await providerSetupRuntime.describeProvider(
19498
+ selection.provider,
19499
+ controller.signal
19500
+ );
19501
+ if (setup.status === "missing") {
19502
+ if (!setup.writable) {
19503
+ setError(
19504
+ `${setup.credentialLabel ?? "The credential"} is supplied by a read-only source and is not configured.`
19505
+ );
19506
+ return;
19507
+ }
19508
+ setSetupSelection(selection);
19509
+ return;
19510
+ }
19511
+ } catch (cause) {
19512
+ if (controller.signal.aborted || cause instanceof Error && cause.name === "AbortError") {
19513
+ return;
19514
+ }
19515
+ setError(cause instanceof Error ? cause.message : String(cause));
19516
+ return;
19517
+ } finally {
19518
+ if (providerCheckRef.current === controller) {
19519
+ providerCheckRef.current = void 0;
19520
+ setCheckingProvider(false);
19521
+ }
19522
+ }
19523
+ }
19524
+ finishSelection(selection);
19525
+ },
19526
+ [finishSelection, providerSetupRuntime]
19527
+ );
19221
19528
  useKeypress(
19222
19529
  (key) => {
19223
19530
  if (key.name !== "escape" || switching) return;
19531
+ if (checkingProvider) {
19532
+ providerCheckRef.current?.abort();
19533
+ return;
19534
+ }
19224
19535
  if (pending) setPending(void 0);
19225
19536
  else onClose();
19226
19537
  },
19227
- { isActive: true }
19538
+ { isActive: setupSelection === void 0 }
19228
19539
  );
19229
- return /* @__PURE__ */ jsxs65(
19230
- Box67,
19540
+ if (setupSelection) {
19541
+ return /* @__PURE__ */ jsx88(
19542
+ ProviderSetupDialog,
19543
+ {
19544
+ runtime: providerSetupRuntime,
19545
+ provider: setupSelection.provider,
19546
+ onCancel: () => setSetupSelection(void 0),
19547
+ onConfigured: () => {
19548
+ const selection = setupSelection;
19549
+ setSetupSelection(void 0);
19550
+ finishSelection(selection);
19551
+ }
19552
+ }
19553
+ );
19554
+ }
19555
+ return /* @__PURE__ */ jsxs66(
19556
+ Box68,
19231
19557
  {
19232
19558
  borderStyle: "round",
19233
19559
  borderColor: theme.border.default,
@@ -19236,47 +19562,47 @@ function ModelDialog({
19236
19562
  paddingY: 1,
19237
19563
  width: "100%",
19238
19564
  children: [
19239
- /* @__PURE__ */ jsxs65(Box67, { justifyContent: "space-between", children: [
19240
- /* @__PURE__ */ jsx86(Text60, { bold: true, color: theme.text.primary, children: "Select DSH Model" }),
19241
- /* @__PURE__ */ jsx86(Text60, { color: theme.text.secondary, children: "Esc to close" })
19565
+ /* @__PURE__ */ jsxs66(Box68, { justifyContent: "space-between", children: [
19566
+ /* @__PURE__ */ jsx88(Text61, { bold: true, color: theme.text.primary, children: "Select DSH Model" }),
19567
+ /* @__PURE__ */ jsx88(Text61, { color: theme.text.secondary, children: "Esc to close" })
19242
19568
  ] }),
19243
- error && /* @__PURE__ */ jsx86(Box67, { marginTop: 1, children: /* @__PURE__ */ jsx86(Text60, { color: theme.status.error, children: error }) }),
19244
- loading ? /* @__PURE__ */ jsx86(Box67, { marginTop: 1, children: /* @__PURE__ */ jsx86(Text60, { color: theme.text.secondary, children: "Loading models..." }) }) : models.length === 0 ? /* @__PURE__ */ jsx86(Box67, { marginTop: 1, children: /* @__PURE__ */ jsx86(Text60, { color: theme.status.warning, children: "No DSH models are available." }) }) : /* @__PURE__ */ jsxs65(Box67, { flexDirection: "row", marginTop: 1, children: [
19245
- /* @__PURE__ */ jsx86(Box67, { width: "55%", paddingRight: 2, flexDirection: "column", children: /* @__PURE__ */ jsx86(
19569
+ error && /* @__PURE__ */ jsx88(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx88(Text61, { color: theme.status.error, children: error }) }),
19570
+ loading ? /* @__PURE__ */ jsx88(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx88(Text61, { color: theme.text.secondary, children: "Loading models..." }) }) : models.length === 0 ? /* @__PURE__ */ jsx88(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx88(Text61, { color: theme.status.warning, children: "No DSH models are available." }) }) : /* @__PURE__ */ jsxs66(Box68, { flexDirection: "row", marginTop: 1, children: [
19571
+ /* @__PURE__ */ jsx88(Box68, { width: "55%", paddingRight: 2, flexDirection: "column", children: /* @__PURE__ */ jsx88(
19246
19572
  RadioButtonSelect,
19247
19573
  {
19248
19574
  items,
19249
19575
  initialIndex,
19250
19576
  onHighlight: setHighlighted,
19251
- onSelect: selectModel,
19252
- isFocused: !pending && !switching,
19577
+ onSelect: (selection) => void selectModel(selection),
19578
+ isFocused: !pending && !switching && !checkingProvider,
19253
19579
  showScrollArrows: true,
19254
19580
  maxItemsToShow: 12,
19255
19581
  renderItem: (item, { titleColor }) => {
19256
19582
  const model = item.value;
19257
19583
  const isCurrent = model.provider === current.provider && model.model === current.model;
19258
- return /* @__PURE__ */ jsxs65(Text60, { color: titleColor, wrap: "truncate", children: [
19584
+ return /* @__PURE__ */ jsxs66(Text61, { color: titleColor, wrap: "truncate", children: [
19259
19585
  model.name,
19260
19586
  " ",
19261
- /* @__PURE__ */ jsx86(Text60, { color: theme.text.secondary, children: model.provider }),
19262
- model.inputModalities.includes("image") && /* @__PURE__ */ jsx86(Text60, { color: theme.status.success, children: " Vision" }),
19263
- isCurrent && /* @__PURE__ */ jsx86(Text60, { color: theme.text.accent, children: " Current" })
19587
+ /* @__PURE__ */ jsx88(Text61, { color: theme.text.secondary, children: model.provider }),
19588
+ model.inputModalities.includes("image") && /* @__PURE__ */ jsx88(Text61, { color: theme.status.success, children: " Vision" }),
19589
+ isCurrent && /* @__PURE__ */ jsx88(Text61, { color: theme.text.accent, children: " Current" })
19264
19590
  ] });
19265
19591
  }
19266
19592
  },
19267
19593
  items.map((item) => item.key).join("|")
19268
19594
  ) }),
19269
- /* @__PURE__ */ jsx86(Box67, { width: "45%", paddingLeft: 2, flexDirection: "column", children: pending ? /* @__PURE__ */ jsxs65(Fragment15, { children: [
19270
- /* @__PURE__ */ jsx86(Text60, { bold: true, color: theme.status.warning, children: "Start a new Session?" }),
19271
- /* @__PURE__ */ jsxs65(Box67, { marginTop: 1, flexDirection: "column", children: [
19272
- /* @__PURE__ */ jsxs65(Text60, { children: [
19595
+ /* @__PURE__ */ jsx88(Box68, { width: "45%", paddingLeft: 2, flexDirection: "column", children: pending ? /* @__PURE__ */ jsxs66(Fragment15, { children: [
19596
+ /* @__PURE__ */ jsx88(Text61, { bold: true, color: theme.status.warning, children: "Start a new Session?" }),
19597
+ /* @__PURE__ */ jsxs66(Box68, { marginTop: 1, flexDirection: "column", children: [
19598
+ /* @__PURE__ */ jsxs66(Text61, { children: [
19273
19599
  "Changing to ",
19274
19600
  pending.name,
19275
19601
  " creates a new DSH Agent and Session."
19276
19602
  ] }),
19277
- /* @__PURE__ */ jsx86(Text60, { color: theme.text.secondary, children: "The existing transcript remains visible but is not sent to the new model." })
19603
+ /* @__PURE__ */ jsx88(Text61, { color: theme.text.secondary, children: "The existing transcript remains visible but is not sent to the new model." })
19278
19604
  ] }),
19279
- /* @__PURE__ */ jsx86(Box67, { marginTop: 1, children: /* @__PURE__ */ jsx86(
19605
+ /* @__PURE__ */ jsx88(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx88(
19280
19606
  RadioButtonSelect,
19281
19607
  {
19282
19608
  items: [
@@ -19291,110 +19617,304 @@ function ModelDialog({
19291
19617
  showNumbers: false
19292
19618
  }
19293
19619
  ) })
19294
- ] }) : /* @__PURE__ */ jsxs65(Fragment15, { children: [
19295
- /* @__PURE__ */ jsx86(Text60, { bold: true, color: theme.text.primary, children: highlighted.name }),
19296
- /* @__PURE__ */ jsxs65(Box67, { marginTop: 1, flexDirection: "column", children: [
19297
- /* @__PURE__ */ jsx86(Text60, { color: theme.text.secondary, children: "Provider" }),
19298
- /* @__PURE__ */ jsx86(Text60, { children: highlighted.provider }),
19299
- /* @__PURE__ */ jsx86(Text60, { color: theme.text.secondary, children: "Model ID" }),
19300
- /* @__PURE__ */ jsx86(Text60, { wrap: "wrap", children: highlighted.model }),
19301
- /* @__PURE__ */ jsx86(Text60, { color: theme.text.secondary, children: "Input" }),
19302
- /* @__PURE__ */ jsx86(Text60, { color: highlighted.inputModalities.includes("image") ? theme.status.success : theme.text.primary, children: capabilityLabel(highlighted) })
19620
+ ] }) : /* @__PURE__ */ jsxs66(Fragment15, { children: [
19621
+ /* @__PURE__ */ jsx88(Text61, { bold: true, color: theme.text.primary, children: highlighted.name }),
19622
+ /* @__PURE__ */ jsxs66(Box68, { marginTop: 1, flexDirection: "column", children: [
19623
+ /* @__PURE__ */ jsx88(Text61, { color: theme.text.secondary, children: "Provider" }),
19624
+ /* @__PURE__ */ jsx88(Text61, { children: highlighted.provider }),
19625
+ /* @__PURE__ */ jsx88(Text61, { color: theme.text.secondary, children: "Model ID" }),
19626
+ /* @__PURE__ */ jsx88(Text61, { wrap: "wrap", children: highlighted.model }),
19627
+ /* @__PURE__ */ jsx88(Text61, { color: theme.text.secondary, children: "Input" }),
19628
+ /* @__PURE__ */ jsx88(Text61, { color: highlighted.inputModalities.includes("image") ? theme.status.success : theme.text.primary, children: capabilityLabel(highlighted) })
19303
19629
  ] }),
19304
- switching && /* @__PURE__ */ jsx86(Box67, { marginTop: 1, children: /* @__PURE__ */ jsx86(Text60, { color: theme.text.accent, children: "Creating new Agent..." }) })
19630
+ switching && /* @__PURE__ */ jsx88(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx88(Text61, { color: theme.text.accent, children: "Creating new Agent..." }) }),
19631
+ checkingProvider && /* @__PURE__ */ jsx88(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx88(Text61, { color: theme.text.accent, children: "Checking provider setup..." }) })
19305
19632
  ] }) })
19306
19633
  ] }),
19307
- /* @__PURE__ */ jsx86(Box67, { marginTop: 1, children: /* @__PURE__ */ jsx86(Text60, { color: theme.text.secondary, children: "Use \u2191/\u2193 to navigate and Enter to select." }) })
19634
+ /* @__PURE__ */ jsx88(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx88(Text61, { color: theme.text.secondary, children: "Use \u2191/\u2193 to navigate and Enter to select." }) })
19308
19635
  ]
19309
19636
  }
19310
19637
  );
19311
19638
  }
19312
19639
 
19313
19640
  // src/ui/commands/model-command.ts
19314
- function modalities(values) {
19315
- return values.join(", ");
19316
- }
19317
19641
  var modelCommand = {
19318
19642
  name: "model",
19319
- description: "Show or configure the DSH model route",
19643
+ description: "Open the DSH model selector",
19320
19644
  kind: "built-in" /* BUILT_IN */,
19321
19645
  autoExecute: true,
19322
- action: async (context, args) => {
19646
+ action: (context, args) => {
19647
+ if (args.trim()) {
19648
+ return {
19649
+ type: "message",
19650
+ messageType: "error",
19651
+ content: "Usage: /model"
19652
+ };
19653
+ }
19323
19654
  const runtime = context.services.modelSelection;
19324
19655
  if (!runtime) {
19325
19656
  return { type: "message", messageType: "error", content: "DSH model selection is unavailable." };
19326
19657
  }
19327
- const words = args.trim().split(/\s+/).filter(Boolean);
19328
- if (words.length === 0) {
19329
- return {
19330
- type: "custom_dialog",
19331
- component: React16.createElement(ModelDialog, {
19332
- runtime,
19333
- onClose: context.ui.removeComponent,
19334
- onSwitched: (selection) => {
19335
- context.ui.addItem({
19336
- type: "info" /* INFO */,
19337
- text: `Started a new Agent with ${modelSelectionLabel(selection)}.`
19338
- });
19339
- context.ui.removeComponent();
19340
- }
19341
- })
19342
- };
19658
+ return {
19659
+ type: "custom_dialog",
19660
+ component: React16.createElement(ModelDialog, {
19661
+ runtime,
19662
+ providerSetupRuntime: context.services.providerSetup,
19663
+ onClose: context.ui.removeComponent,
19664
+ onSwitched: (selection) => {
19665
+ context.ui.addItem({
19666
+ type: "info" /* INFO */,
19667
+ text: `Started a new Agent with ${modelSelectionLabel(selection)}.`
19668
+ });
19669
+ context.ui.removeComponent();
19670
+ }
19671
+ })
19672
+ };
19673
+ }
19674
+ };
19675
+
19676
+ // src/ui/commands/provider-command.ts
19677
+ import React17 from "react";
19678
+
19679
+ // src/ui/components/dialogs/provider-dialog.tsx
19680
+ import { useEffect as useEffect40, useMemo as useMemo29, useState as useState37 } from "react";
19681
+ import { Box as Box69, Text as Text62 } from "ink";
19682
+ import { Fragment as Fragment16, jsx as jsx89, jsxs as jsxs67 } from "react/jsx-runtime";
19683
+ function statusLabel(status) {
19684
+ switch (status) {
19685
+ case "configured":
19686
+ return "Configured";
19687
+ case "missing":
19688
+ return "Setup required";
19689
+ case "unsupported":
19690
+ return "Unavailable";
19691
+ case "error":
19692
+ return "Error";
19693
+ default: {
19694
+ const unhandled = status;
19695
+ return unhandled;
19696
+ }
19697
+ }
19698
+ }
19699
+ function statusColor(status) {
19700
+ switch (status) {
19701
+ case "configured":
19702
+ return theme.status.success;
19703
+ case "missing":
19704
+ case "unsupported":
19705
+ return theme.status.warning;
19706
+ case "error":
19707
+ return theme.status.error;
19708
+ default: {
19709
+ const unhandled = status;
19710
+ return unhandled;
19343
19711
  }
19344
- if (words[0] === "list" && words.length === 1) {
19345
- const models = await runtime.listModels();
19712
+ }
19713
+ }
19714
+ function matchesProvider(view, query) {
19715
+ const normalized = query.toLocaleLowerCase();
19716
+ return view.provider.toLocaleLowerCase() === normalized || view.displayName.toLocaleLowerCase() === normalized;
19717
+ }
19718
+ function ProviderDialog({
19719
+ runtime,
19720
+ initialProvider,
19721
+ onClose
19722
+ }) {
19723
+ const [providers, setProviders] = useState37([]);
19724
+ const [highlighted, setHighlighted] = useState37();
19725
+ const [editing, setEditing] = useState37();
19726
+ const [loading, setLoading] = useState37(true);
19727
+ const [error, setError] = useState37();
19728
+ useEffect40(() => {
19729
+ const controller = new AbortController();
19730
+ void runtime.listProviders(controller.signal).then((available) => {
19731
+ if (controller.signal.aborted) return;
19732
+ setProviders(available);
19733
+ const requested = initialProvider ? available.find(
19734
+ (provider) => matchesProvider(provider, initialProvider)
19735
+ ) : void 0;
19736
+ setHighlighted(requested ?? available[0]);
19737
+ if (initialProvider && !requested) {
19738
+ setError(`Unknown DSH provider: ${initialProvider}`);
19739
+ }
19740
+ }).catch((cause) => {
19741
+ if (!controller.signal.aborted) {
19742
+ setError(
19743
+ cause instanceof Error ? cause.message : "Unable to load DSH providers."
19744
+ );
19745
+ }
19746
+ }).finally(() => {
19747
+ if (!controller.signal.aborted) setLoading(false);
19748
+ });
19749
+ return () => controller.abort();
19750
+ }, [initialProvider, runtime]);
19751
+ useKeypress(
19752
+ (key) => {
19753
+ if (key.name === "escape") onClose();
19754
+ },
19755
+ { isActive: editing === void 0 }
19756
+ );
19757
+ const items = useMemo29(
19758
+ () => providers.map((provider) => ({
19759
+ key: provider.provider,
19760
+ label: provider.displayName,
19761
+ value: provider
19762
+ })),
19763
+ [providers]
19764
+ );
19765
+ const initialIndex = Math.max(
19766
+ 0,
19767
+ providers.findIndex(
19768
+ (provider) => provider.provider === highlighted?.provider
19769
+ )
19770
+ );
19771
+ const currentProvider = runtime.getSnapshot().current.provider;
19772
+ if (editing) {
19773
+ return /* @__PURE__ */ jsx89(
19774
+ ProviderSetupDialog,
19775
+ {
19776
+ runtime,
19777
+ provider: editing.provider,
19778
+ onCancel: () => setEditing(void 0),
19779
+ onConfigured: (configured) => {
19780
+ setProviders(
19781
+ (current) => current.map(
19782
+ (provider) => provider.provider === configured.provider ? configured : provider
19783
+ )
19784
+ );
19785
+ setHighlighted(configured);
19786
+ setEditing(void 0);
19787
+ }
19788
+ }
19789
+ );
19790
+ }
19791
+ return /* @__PURE__ */ jsxs67(
19792
+ Box69,
19793
+ {
19794
+ borderStyle: "round",
19795
+ borderColor: theme.border.default,
19796
+ flexDirection: "column",
19797
+ paddingX: 1,
19798
+ paddingY: 1,
19799
+ width: "100%",
19800
+ children: [
19801
+ /* @__PURE__ */ jsxs67(Box69, { justifyContent: "space-between", children: [
19802
+ /* @__PURE__ */ jsx89(Text62, { bold: true, color: theme.text.accent, children: "DSH Providers" }),
19803
+ /* @__PURE__ */ jsxs67(Text62, { color: theme.text.secondary, children: [
19804
+ /* @__PURE__ */ jsx89(Text62, { bold: true, color: theme.text.primary, children: "Esc" }),
19805
+ " Close"
19806
+ ] })
19807
+ ] }),
19808
+ error && /* @__PURE__ */ jsx89(Box69, { marginTop: 1, children: /* @__PURE__ */ jsx89(Text62, { color: theme.status.error, children: error }) }),
19809
+ loading && /* @__PURE__ */ jsx89(Box69, { marginTop: 1, children: /* @__PURE__ */ jsx89(Text62, { color: theme.text.secondary, children: "Loading providers..." }) }),
19810
+ !loading && providers.length === 0 && /* @__PURE__ */ jsx89(Box69, { marginTop: 1, children: /* @__PURE__ */ jsx89(Text62, { color: theme.status.warning, children: "No DSH-managed providers are available." }) }),
19811
+ providers.length > 0 && highlighted && /* @__PURE__ */ jsxs67(Box69, { marginTop: 1, children: [
19812
+ /* @__PURE__ */ jsx89(Box69, { width: "55%", paddingRight: 2, children: /* @__PURE__ */ jsx89(
19813
+ RadioButtonSelect,
19814
+ {
19815
+ items,
19816
+ initialIndex,
19817
+ onHighlight: setHighlighted,
19818
+ onSelect: (provider) => {
19819
+ if (provider.writable && provider.status !== "unsupported") {
19820
+ setEditing(provider);
19821
+ }
19822
+ },
19823
+ showScrollArrows: true,
19824
+ maxItemsToShow: 12,
19825
+ renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs67(Text62, { color: titleColor, wrap: "truncate", children: [
19826
+ item.value.displayName,
19827
+ " ",
19828
+ /* @__PURE__ */ jsx89(Text62, { color: statusColor(item.value.status), children: statusLabel(item.value.status) }),
19829
+ item.value.provider === currentProvider && /* @__PURE__ */ jsx89(Text62, { color: theme.text.accent, children: " Current" })
19830
+ ] })
19831
+ }
19832
+ ) }),
19833
+ /* @__PURE__ */ jsxs67(Box69, { width: "45%", paddingLeft: 2, flexDirection: "column", children: [
19834
+ /* @__PURE__ */ jsx89(Text62, { bold: true, color: theme.text.primary, children: highlighted.displayName }),
19835
+ /* @__PURE__ */ jsxs67(Box69, { marginTop: 1, flexDirection: "column", children: [
19836
+ /* @__PURE__ */ jsx89(Text62, { color: theme.text.secondary, children: "Provider" }),
19837
+ /* @__PURE__ */ jsx89(Text62, { children: highlighted.provider }),
19838
+ /* @__PURE__ */ jsx89(Text62, { color: theme.text.secondary, children: "Status" }),
19839
+ /* @__PURE__ */ jsx89(Text62, { color: statusColor(highlighted.status), children: statusLabel(highlighted.status) }),
19840
+ highlighted.credentialLabel && /* @__PURE__ */ jsxs67(Fragment16, { children: [
19841
+ /* @__PURE__ */ jsx89(Text62, { color: theme.text.secondary, children: "Credential" }),
19842
+ /* @__PURE__ */ jsx89(Text62, { children: highlighted.credentialLabel })
19843
+ ] }),
19844
+ highlighted.source && /* @__PURE__ */ jsxs67(Fragment16, { children: [
19845
+ /* @__PURE__ */ jsx89(Text62, { color: theme.text.secondary, children: "Source" }),
19846
+ /* @__PURE__ */ jsx89(Text62, { children: highlighted.source })
19847
+ ] }),
19848
+ highlighted.message && /* @__PURE__ */ jsx89(Box69, { marginTop: 1, children: /* @__PURE__ */ jsx89(Text62, { color: theme.status.warning, children: highlighted.message }) }),
19849
+ !highlighted.writable && highlighted.status !== "unsupported" && highlighted.status !== "error" && /* @__PURE__ */ jsx89(Box69, { marginTop: 1, children: /* @__PURE__ */ jsx89(Text62, { color: theme.status.warning, children: "This credential comes from a read-only source. Update it outside DSH Console." }) })
19850
+ ] })
19851
+ ] })
19852
+ ] }),
19853
+ providers.length > 0 && highlighted && /* @__PURE__ */ jsx89(Box69, { marginTop: 1, children: highlighted.writable && highlighted.status !== "unsupported" ? /* @__PURE__ */ jsxs67(Fragment16, { children: [
19854
+ /* @__PURE__ */ jsx89(Text62, { bold: true, color: theme.text.accent, children: "Enter" }),
19855
+ /* @__PURE__ */ jsxs67(Text62, { color: theme.text.primary, children: [
19856
+ " ",
19857
+ highlighted.status === "configured" ? "Replace credential" : "Configure provider"
19858
+ ] }),
19859
+ /* @__PURE__ */ jsxs67(Text62, { color: theme.text.secondary, children: [
19860
+ " ",
19861
+ "Use \u2191/\u2193 to navigate"
19862
+ ] })
19863
+ ] }) : /* @__PURE__ */ jsx89(Text62, { color: theme.text.secondary, children: "Use \u2191/\u2193 to inspect providers. This credential cannot be changed here." }) })
19864
+ ]
19865
+ }
19866
+ );
19867
+ }
19868
+
19869
+ // src/ui/commands/provider-command.ts
19870
+ var providerCommand = {
19871
+ name: "provider",
19872
+ description: "View or update DSH provider credentials",
19873
+ inputHint: "[provider]",
19874
+ kind: "built-in" /* BUILT_IN */,
19875
+ autoExecute: true,
19876
+ action: (context, args) => {
19877
+ const runtime = context.services.providerSetup;
19878
+ if (!runtime) {
19346
19879
  return {
19347
19880
  type: "message",
19348
- messageType: "info",
19349
- content: models.map((model) => `${modelSelectionLabel(model)} [${modalities(model.inputModalities)}]`).join("\n")
19881
+ messageType: "error",
19882
+ content: "DSH provider setup is unavailable."
19350
19883
  };
19351
19884
  }
19352
- if (words[0] === "set" && words.length === 3) {
19353
- const current = runtime.getSnapshot().current;
19354
- if (current.provider === words[1] && current.model === words[2]) {
19355
- return {
19356
- type: "message",
19357
- messageType: "info",
19358
- content: `Already using ${modelSelectionLabel(current)}.`
19359
- };
19360
- }
19361
- if (runtime.hasConversation() && context.overwriteConfirmed !== true) {
19362
- return {
19363
- type: "confirm_action",
19364
- prompt: "Changing model starts a new Agent and Session. Continue?",
19365
- originalInvocation: { raw: context.invocation?.raw ?? `/model ${args}` }
19366
- };
19367
- }
19368
- const selected = await runtime.setModel(words[1], words[2]);
19885
+ const words = args.trim().split(/\s+/).filter(Boolean);
19886
+ if (words.length > 1) {
19369
19887
  return {
19370
19888
  type: "message",
19371
- messageType: "info",
19372
- content: `Started a new Agent with ${modelSelectionLabel(selected)}.`
19889
+ messageType: "error",
19890
+ content: "Usage: /provider [provider]"
19373
19891
  };
19374
19892
  }
19375
19893
  return {
19376
- type: "message",
19377
- messageType: "error",
19378
- content: "Usage: /model | /model list | /model set <provider> <model>"
19894
+ type: "custom_dialog",
19895
+ component: React17.createElement(ProviderDialog, {
19896
+ runtime,
19897
+ initialProvider: words[0],
19898
+ onClose: context.ui.removeComponent
19899
+ })
19379
19900
  };
19380
19901
  },
19381
19902
  completion: async (context, partialArg) => {
19382
- const runtime = context.services.modelSelection;
19903
+ const runtime = context.services.providerSetup;
19383
19904
  if (!runtime) return [];
19384
- const prefix = partialArg.trimStart();
19385
- if (!prefix.startsWith("set")) return ["list", "set "];
19386
- const models = await runtime.listModels();
19387
- return models.map((model) => `set ${model.provider} ${model.model}`).filter((candidate) => candidate.startsWith(prefix));
19905
+ const providers = await runtime.listProviders();
19906
+ const prefix = partialArg.trimStart().toLocaleLowerCase();
19907
+ return providers.map((provider) => provider.provider).filter((provider) => provider.toLocaleLowerCase().startsWith(prefix));
19388
19908
  }
19389
19909
  };
19390
19910
 
19391
19911
  // src/ui/commands/session-commands.ts
19392
- import React17 from "react";
19912
+ import React18 from "react";
19393
19913
 
19394
19914
  // src/ui/components/dialogs/session-dialog.tsx
19395
- import { useCallback as useCallback33, useEffect as useEffect39, useMemo as useMemo29, useRef as useRef18, useState as useState36 } from "react";
19396
- import { Box as Box68, Text as Text61 } from "ink";
19397
- import { Fragment as Fragment16, jsx as jsx87, jsxs as jsxs66 } from "react/jsx-runtime";
19915
+ import { useCallback as useCallback33, useEffect as useEffect41, useMemo as useMemo30, useRef as useRef20, useState as useState38 } from "react";
19916
+ import { Box as Box70, Text as Text63 } from "ink";
19917
+ import { Fragment as Fragment17, jsx as jsx90, jsxs as jsxs68 } from "react/jsx-runtime";
19398
19918
  function shortId(id) {
19399
19919
  const start2 = id.startsWith("dsh-console-") ? "dsh-console-".length : 0;
19400
19920
  return id.slice(start2, start2 + 12);
@@ -19403,14 +19923,14 @@ function sessionLabel(session) {
19403
19923
  return session.title ?? `Session ${shortId(session.id)}`;
19404
19924
  }
19405
19925
  function SessionDialog({ runtime, onClose }) {
19406
- const [sessions, setSessions] = useState36([]);
19407
- const [highlighted, setHighlighted] = useState36();
19408
- const [pending, setPending] = useState36();
19409
- const [loading, setLoading] = useState36(true);
19410
- const [switching, setSwitching] = useState36(false);
19411
- const [error, setError] = useState36();
19412
- const switchingRef = useRef18(false);
19413
- useEffect39(() => {
19926
+ const [sessions, setSessions] = useState38([]);
19927
+ const [highlighted, setHighlighted] = useState38();
19928
+ const [pending, setPending] = useState38();
19929
+ const [loading, setLoading] = useState38(true);
19930
+ const [switching, setSwitching] = useState38(false);
19931
+ const [error, setError] = useState38();
19932
+ const switchingRef = useRef20(false);
19933
+ useEffect41(() => {
19414
19934
  const controller = new AbortController();
19415
19935
  void runtime.listSessions(controller.signal).then((listed) => {
19416
19936
  setSessions(listed);
@@ -19422,7 +19942,7 @@ function SessionDialog({ runtime, onClose }) {
19422
19942
  });
19423
19943
  return () => controller.abort();
19424
19944
  }, [runtime]);
19425
- const items = useMemo29(() => sessions.map((session) => ({
19945
+ const items = useMemo30(() => sessions.map((session) => ({
19426
19946
  key: session.id,
19427
19947
  value: session,
19428
19948
  label: sessionLabel(session)
@@ -19461,14 +19981,14 @@ function SessionDialog({ runtime, onClose }) {
19461
19981
  if (pending) setPending(void 0);
19462
19982
  else onClose();
19463
19983
  }, { isActive: true });
19464
- return /* @__PURE__ */ jsxs66(Box68, { borderStyle: "round", borderColor: theme.border.default, flexDirection: "column", paddingX: 1, paddingY: 1, width: "100%", children: [
19465
- /* @__PURE__ */ jsxs66(Box68, { justifyContent: "space-between", children: [
19466
- /* @__PURE__ */ jsx87(Text61, { bold: true, color: theme.text.primary, children: "DSH Sessions" }),
19467
- /* @__PURE__ */ jsx87(Text61, { color: theme.text.secondary, children: "Esc to close" })
19984
+ return /* @__PURE__ */ jsxs68(Box70, { borderStyle: "round", borderColor: theme.border.default, flexDirection: "column", paddingX: 1, paddingY: 1, width: "100%", children: [
19985
+ /* @__PURE__ */ jsxs68(Box70, { justifyContent: "space-between", children: [
19986
+ /* @__PURE__ */ jsx90(Text63, { bold: true, color: theme.text.primary, children: "DSH Sessions" }),
19987
+ /* @__PURE__ */ jsx90(Text63, { color: theme.text.secondary, children: "Esc to close" })
19468
19988
  ] }),
19469
- error && /* @__PURE__ */ jsx87(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx87(Text61, { color: theme.status.error, children: error }) }),
19470
- loading ? /* @__PURE__ */ jsx87(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx87(Text61, { color: theme.text.secondary, children: "Loading Sessions..." }) }) : sessions.length === 0 ? /* @__PURE__ */ jsx87(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx87(Text61, { color: theme.text.secondary, children: "No resumable Sessions." }) }) : /* @__PURE__ */ jsxs66(Box68, { flexDirection: "row", marginTop: 1, children: [
19471
- /* @__PURE__ */ jsx87(Box68, { width: "55%", paddingRight: 2, flexDirection: "column", children: /* @__PURE__ */ jsx87(
19989
+ error && /* @__PURE__ */ jsx90(Box70, { marginTop: 1, children: /* @__PURE__ */ jsx90(Text63, { color: theme.status.error, children: error }) }),
19990
+ loading ? /* @__PURE__ */ jsx90(Box70, { marginTop: 1, children: /* @__PURE__ */ jsx90(Text63, { color: theme.text.secondary, children: "Loading Sessions..." }) }) : sessions.length === 0 ? /* @__PURE__ */ jsx90(Box70, { marginTop: 1, children: /* @__PURE__ */ jsx90(Text63, { color: theme.text.secondary, children: "No resumable Sessions." }) }) : /* @__PURE__ */ jsxs68(Box70, { flexDirection: "row", marginTop: 1, children: [
19991
+ /* @__PURE__ */ jsx90(Box70, { width: "55%", paddingRight: 2, flexDirection: "column", children: /* @__PURE__ */ jsx90(
19472
19992
  RadioButtonSelect,
19473
19993
  {
19474
19994
  items,
@@ -19478,20 +19998,20 @@ function SessionDialog({ runtime, onClose }) {
19478
19998
  isFocused: !pending && !switching,
19479
19999
  showScrollArrows: true,
19480
20000
  maxItemsToShow: 12,
19481
- renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs66(Text61, { color: titleColor, wrap: "truncate", children: [
20001
+ renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs68(Text63, { color: titleColor, wrap: "truncate", children: [
19482
20002
  sessionLabel(item.value),
19483
- item.value.current && /* @__PURE__ */ jsx87(Text61, { color: theme.text.accent, children: " Current" }),
19484
- !item.value.current && !item.value.resumable && /* @__PURE__ */ jsx87(Text61, { color: theme.status.warning, children: " Not resumable" })
20003
+ item.value.current && /* @__PURE__ */ jsx90(Text63, { color: theme.text.accent, children: " Current" }),
20004
+ !item.value.current && !item.value.resumable && /* @__PURE__ */ jsx90(Text63, { color: theme.status.warning, children: " Not resumable" })
19485
20005
  ] })
19486
20006
  }
19487
20007
  ) }),
19488
- /* @__PURE__ */ jsx87(Box68, { width: "45%", paddingLeft: 2, flexDirection: "column", children: pending ? /* @__PURE__ */ jsxs66(Fragment16, { children: [
19489
- /* @__PURE__ */ jsx87(Text61, { bold: true, color: theme.status.warning, children: "Resume this Session?" }),
19490
- /* @__PURE__ */ jsxs66(Box68, { marginTop: 1, flexDirection: "column", children: [
19491
- /* @__PURE__ */ jsx87(Text61, { children: sessionLabel(pending) }),
19492
- /* @__PURE__ */ jsx87(Text61, { color: theme.text.secondary, children: "The current transcript will be replaced." })
20008
+ /* @__PURE__ */ jsx90(Box70, { width: "45%", paddingLeft: 2, flexDirection: "column", children: pending ? /* @__PURE__ */ jsxs68(Fragment17, { children: [
20009
+ /* @__PURE__ */ jsx90(Text63, { bold: true, color: theme.status.warning, children: "Resume this Session?" }),
20010
+ /* @__PURE__ */ jsxs68(Box70, { marginTop: 1, flexDirection: "column", children: [
20011
+ /* @__PURE__ */ jsx90(Text63, { children: sessionLabel(pending) }),
20012
+ /* @__PURE__ */ jsx90(Text63, { color: theme.text.secondary, children: "The current transcript will be replaced." })
19493
20013
  ] }),
19494
- /* @__PURE__ */ jsx87(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx87(
20014
+ /* @__PURE__ */ jsx90(Box70, { marginTop: 1, children: /* @__PURE__ */ jsx90(
19495
20015
  RadioButtonSelect,
19496
20016
  {
19497
20017
  items: [
@@ -19503,21 +20023,21 @@ function SessionDialog({ runtime, onClose }) {
19503
20023
  showNumbers: false
19504
20024
  }
19505
20025
  ) })
19506
- ] }) : highlighted ? /* @__PURE__ */ jsxs66(Fragment16, { children: [
19507
- /* @__PURE__ */ jsx87(Text61, { bold: true, children: sessionLabel(highlighted) }),
19508
- /* @__PURE__ */ jsxs66(Box68, { marginTop: 1, flexDirection: "column", children: [
19509
- /* @__PURE__ */ jsx87(Text61, { color: theme.text.secondary, children: "Created" }),
19510
- /* @__PURE__ */ jsx87(Text61, { children: new Date(highlighted.createdAt).toLocaleString() }),
19511
- !highlighted.resumable && highlighted.resumeUnavailableReason && /* @__PURE__ */ jsxs66(Fragment16, { children: [
19512
- /* @__PURE__ */ jsx87(Text61, { color: theme.text.secondary, children: "Resume status" }),
19513
- /* @__PURE__ */ jsx87(Text61, { color: theme.status.warning, children: highlighted.resumeUnavailableReason })
20026
+ ] }) : highlighted ? /* @__PURE__ */ jsxs68(Fragment17, { children: [
20027
+ /* @__PURE__ */ jsx90(Text63, { bold: true, children: sessionLabel(highlighted) }),
20028
+ /* @__PURE__ */ jsxs68(Box70, { marginTop: 1, flexDirection: "column", children: [
20029
+ /* @__PURE__ */ jsx90(Text63, { color: theme.text.secondary, children: "Created" }),
20030
+ /* @__PURE__ */ jsx90(Text63, { children: new Date(highlighted.createdAt).toLocaleString() }),
20031
+ !highlighted.resumable && highlighted.resumeUnavailableReason && /* @__PURE__ */ jsxs68(Fragment17, { children: [
20032
+ /* @__PURE__ */ jsx90(Text63, { color: theme.text.secondary, children: "Resume status" }),
20033
+ /* @__PURE__ */ jsx90(Text63, { color: theme.status.warning, children: highlighted.resumeUnavailableReason })
19514
20034
  ] }),
19515
- /* @__PURE__ */ jsx87(Text61, { color: theme.text.secondary, children: "Session ID" }),
19516
- /* @__PURE__ */ jsx87(Text61, { wrap: "wrap", children: highlighted.id })
20035
+ /* @__PURE__ */ jsx90(Text63, { color: theme.text.secondary, children: "Session ID" }),
20036
+ /* @__PURE__ */ jsx90(Text63, { wrap: "wrap", children: highlighted.id })
19517
20037
  ] })
19518
20038
  ] }) : null })
19519
20039
  ] }),
19520
- /* @__PURE__ */ jsx87(Box68, { marginTop: 1, children: /* @__PURE__ */ jsx87(Text61, { color: theme.text.secondary, children: "Use \u2191/\u2193 to navigate and Enter to resume." }) })
20040
+ /* @__PURE__ */ jsx90(Box70, { marginTop: 1, children: /* @__PURE__ */ jsx90(Text63, { color: theme.text.secondary, children: "Use \u2191/\u2193 to navigate and Enter to resume." }) })
19521
20041
  ] });
19522
20042
  }
19523
20043
 
@@ -19530,7 +20050,7 @@ function openDialog(context) {
19530
20050
  if (!runtime) return unavailable();
19531
20051
  return {
19532
20052
  type: "custom_dialog",
19533
- component: React17.createElement(SessionDialog, {
20053
+ component: React18.createElement(SessionDialog, {
19534
20054
  runtime,
19535
20055
  onClose: context.ui.removeComponent
19536
20056
  })
@@ -19605,15 +20125,15 @@ var statsCommand = {
19605
20125
  };
19606
20126
 
19607
20127
  // src/ui/commands/tools-command.ts
19608
- import React18 from "react";
20128
+ import React19 from "react";
19609
20129
 
19610
20130
  // src/ui/components/dialogs/tools-dialog.tsx
19611
- import { useEffect as useEffect40, useMemo as useMemo30, useState as useState37, useSyncExternalStore as useSyncExternalStore3 } from "react";
19612
- import { Box as Box70, Text as Text63 } from "ink";
20131
+ import { useEffect as useEffect42, useMemo as useMemo31, useState as useState39, useSyncExternalStore as useSyncExternalStore3 } from "react";
20132
+ import { Box as Box72, Text as Text65 } from "ink";
19613
20133
 
19614
20134
  // src/ui/components/shared/descriptive-radio-button-select.tsx
19615
- import { Text as Text62, Box as Box69 } from "ink";
19616
- import { jsx as jsx88, jsxs as jsxs67 } from "react/jsx-runtime";
20135
+ import { Text as Text64, Box as Box71 } from "ink";
20136
+ import { jsx as jsx91, jsxs as jsxs69 } from "react/jsx-runtime";
19617
20137
  function DescriptiveRadioButtonSelect({
19618
20138
  items,
19619
20139
  initialIndex = 0,
@@ -19624,7 +20144,7 @@ function DescriptiveRadioButtonSelect({
19624
20144
  showScrollArrows = false,
19625
20145
  maxItemsToShow = 10
19626
20146
  }) {
19627
- return /* @__PURE__ */ jsx88(
20147
+ return /* @__PURE__ */ jsx91(
19628
20148
  BaseSelectionList,
19629
20149
  {
19630
20150
  items,
@@ -19635,16 +20155,16 @@ function DescriptiveRadioButtonSelect({
19635
20155
  showNumbers,
19636
20156
  showScrollArrows,
19637
20157
  maxItemsToShow,
19638
- renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs67(Box69, { flexDirection: "column", children: [
19639
- /* @__PURE__ */ jsx88(Text62, { color: titleColor, children: item.title }),
19640
- item.description && /* @__PURE__ */ jsx88(Text62, { color: theme.text.secondary, children: item.description })
20158
+ renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs69(Box71, { flexDirection: "column", children: [
20159
+ /* @__PURE__ */ jsx91(Text64, { color: titleColor, children: item.title }),
20160
+ item.description && /* @__PURE__ */ jsx91(Text64, { color: theme.text.secondary, children: item.description })
19641
20161
  ] }, item.key)
19642
20162
  }
19643
20163
  );
19644
20164
  }
19645
20165
 
19646
20166
  // src/ui/components/dialogs/tools-dialog.tsx
19647
- import { Fragment as Fragment17, jsx as jsx89, jsxs as jsxs68 } from "react/jsx-runtime";
20167
+ import { Fragment as Fragment18, jsx as jsx92, jsxs as jsxs70 } from "react/jsx-runtime";
19648
20168
  function summary(description) {
19649
20169
  const line = description.replace(/\s+/g, " ").trim();
19650
20170
  return line.length > 90 ? `${line.slice(0, 89)}...` : line;
@@ -19655,9 +20175,9 @@ function ToolsDialog({ runtime, onClose }) {
19655
20175
  runtime.getSnapshot,
19656
20176
  runtime.getSnapshot
19657
20177
  );
19658
- const [selectedName, setSelectedName] = useState37(snapshot.tools[0]?.name);
20178
+ const [selectedName, setSelectedName] = useState39(snapshot.tools[0]?.name);
19659
20179
  const selected = snapshot.tools.find((tool) => tool.name === selectedName) ?? snapshot.tools[0];
19660
- useEffect40(() => {
20180
+ useEffect42(() => {
19661
20181
  if (selected?.name !== selectedName) setSelectedName(selected?.name);
19662
20182
  }, [selected?.name, selectedName]);
19663
20183
  useKeypress(
@@ -19666,7 +20186,7 @@ function ToolsDialog({ runtime, onClose }) {
19666
20186
  },
19667
20187
  { isActive: true }
19668
20188
  );
19669
- const items = useMemo30(
20189
+ const items = useMemo31(
19670
20190
  () => snapshot.tools.map((tool) => ({
19671
20191
  key: tool.name,
19672
20192
  value: tool.name,
@@ -19675,8 +20195,8 @@ function ToolsDialog({ runtime, onClose }) {
19675
20195
  })),
19676
20196
  [snapshot.tools]
19677
20197
  );
19678
- return /* @__PURE__ */ jsxs68(
19679
- Box70,
20198
+ return /* @__PURE__ */ jsxs70(
20199
+ Box72,
19680
20200
  {
19681
20201
  borderStyle: "round",
19682
20202
  borderColor: theme.border.default,
@@ -19685,16 +20205,16 @@ function ToolsDialog({ runtime, onClose }) {
19685
20205
  paddingY: 1,
19686
20206
  width: "100%",
19687
20207
  children: [
19688
- /* @__PURE__ */ jsxs68(Box70, { justifyContent: "space-between", children: [
19689
- /* @__PURE__ */ jsxs68(Text63, { bold: true, color: theme.text.primary, children: [
20208
+ /* @__PURE__ */ jsxs70(Box72, { justifyContent: "space-between", children: [
20209
+ /* @__PURE__ */ jsxs70(Text65, { bold: true, color: theme.text.primary, children: [
19690
20210
  "DSH Tools (",
19691
20211
  snapshot.tools.length,
19692
20212
  ")"
19693
20213
  ] }),
19694
- /* @__PURE__ */ jsx89(Text63, { color: theme.text.secondary, children: "Esc to close" })
20214
+ /* @__PURE__ */ jsx92(Text65, { color: theme.text.secondary, children: "Esc to close" })
19695
20215
  ] }),
19696
- snapshot.tools.length === 0 ? /* @__PURE__ */ jsx89(Box70, { marginTop: 1, children: /* @__PURE__ */ jsx89(Text63, { color: theme.text.secondary, children: "No tools are visible to the current Agent." }) }) : /* @__PURE__ */ jsxs68(Box70, { flexDirection: "row", marginTop: 1, children: [
19697
- /* @__PURE__ */ jsx89(Box70, { width: "55%", paddingRight: 2, flexDirection: "column", children: /* @__PURE__ */ jsx89(
20216
+ snapshot.tools.length === 0 ? /* @__PURE__ */ jsx92(Box72, { marginTop: 1, children: /* @__PURE__ */ jsx92(Text65, { color: theme.text.secondary, children: "No tools are visible to the current Agent." }) }) : /* @__PURE__ */ jsxs70(Box72, { flexDirection: "row", marginTop: 1, children: [
20217
+ /* @__PURE__ */ jsx92(Box72, { width: "55%", paddingRight: 2, flexDirection: "column", children: /* @__PURE__ */ jsx92(
19698
20218
  DescriptiveRadioButtonSelect,
19699
20219
  {
19700
20220
  items,
@@ -19705,26 +20225,26 @@ function ToolsDialog({ runtime, onClose }) {
19705
20225
  maxItemsToShow: 10
19706
20226
  }
19707
20227
  ) }),
19708
- /* @__PURE__ */ jsx89(Box70, { width: "45%", paddingLeft: 2, flexDirection: "column", children: selected && /* @__PURE__ */ jsxs68(Fragment17, { children: [
19709
- /* @__PURE__ */ jsx89(Text63, { bold: true, color: theme.text.accent, children: selected.name }),
19710
- /* @__PURE__ */ jsx89(Box70, { marginTop: 1, children: /* @__PURE__ */ jsx89(Text63, { wrap: "wrap", children: selected.description }) }),
19711
- /* @__PURE__ */ jsxs68(Box70, { marginTop: 1, flexDirection: "column", children: [
19712
- /* @__PURE__ */ jsx89(Text63, { bold: true, color: theme.text.primary, children: "Parameters" }),
19713
- selected.parameters.length === 0 ? /* @__PURE__ */ jsx89(Text63, { color: theme.text.secondary, children: "None" }) : selected.parameters.map((parameter) => /* @__PURE__ */ jsxs68(Box70, { flexDirection: "column", children: [
19714
- /* @__PURE__ */ jsxs68(Text63, { color: theme.text.link, children: [
20228
+ /* @__PURE__ */ jsx92(Box72, { width: "45%", paddingLeft: 2, flexDirection: "column", children: selected && /* @__PURE__ */ jsxs70(Fragment18, { children: [
20229
+ /* @__PURE__ */ jsx92(Text65, { bold: true, color: theme.text.accent, children: selected.name }),
20230
+ /* @__PURE__ */ jsx92(Box72, { marginTop: 1, children: /* @__PURE__ */ jsx92(Text65, { wrap: "wrap", children: selected.description }) }),
20231
+ /* @__PURE__ */ jsxs70(Box72, { marginTop: 1, flexDirection: "column", children: [
20232
+ /* @__PURE__ */ jsx92(Text65, { bold: true, color: theme.text.primary, children: "Parameters" }),
20233
+ selected.parameters.length === 0 ? /* @__PURE__ */ jsx92(Text65, { color: theme.text.secondary, children: "None" }) : selected.parameters.map((parameter) => /* @__PURE__ */ jsxs70(Box72, { flexDirection: "column", children: [
20234
+ /* @__PURE__ */ jsxs70(Text65, { color: theme.text.link, children: [
19715
20235
  parameter.name,
19716
20236
  " ",
19717
- /* @__PURE__ */ jsxs68(Text63, { color: theme.text.secondary, children: [
20237
+ /* @__PURE__ */ jsxs70(Text65, { color: theme.text.secondary, children: [
19718
20238
  parameter.type,
19719
20239
  parameter.required ? " required" : " optional"
19720
20240
  ] })
19721
20241
  ] }),
19722
- parameter.description && /* @__PURE__ */ jsx89(Text63, { color: theme.text.secondary, children: parameter.description })
20242
+ parameter.description && /* @__PURE__ */ jsx92(Text65, { color: theme.text.secondary, children: parameter.description })
19723
20243
  ] }, parameter.name))
19724
20244
  ] })
19725
20245
  ] }) })
19726
20246
  ] }),
19727
- snapshot.tools.length > 0 && /* @__PURE__ */ jsx89(Box70, { marginTop: 1, children: /* @__PURE__ */ jsx89(Text63, { color: theme.text.secondary, children: "Use Up/Down to inspect the current Agent's tool catalog." }) })
20247
+ snapshot.tools.length > 0 && /* @__PURE__ */ jsx92(Box72, { marginTop: 1, children: /* @__PURE__ */ jsx92(Text65, { color: theme.text.secondary, children: "Use Up/Down to inspect the current Agent's tool catalog." }) })
19728
20248
  ]
19729
20249
  }
19730
20250
  );
@@ -19754,7 +20274,7 @@ var toolsCommand = {
19754
20274
  }
19755
20275
  return {
19756
20276
  type: "custom_dialog",
19757
- component: React18.createElement(ToolsDialog, {
20277
+ component: React19.createElement(ToolsDialog, {
19758
20278
  runtime,
19759
20279
  onClose: context.ui.removeComponent
19760
20280
  })
@@ -19763,12 +20283,12 @@ var toolsCommand = {
19763
20283
  };
19764
20284
 
19765
20285
  // src/ui/commands/permission-command.ts
19766
- import React19 from "react";
20286
+ import React20 from "react";
19767
20287
 
19768
20288
  // src/ui/components/dialogs/permission-dialog.tsx
19769
- import { useCallback as useCallback34, useMemo as useMemo31, useState as useState38, useSyncExternalStore as useSyncExternalStore4 } from "react";
19770
- import { Box as Box71, Text as Text64 } from "ink";
19771
- import { Fragment as Fragment18, jsx as jsx90, jsxs as jsxs69 } from "react/jsx-runtime";
20289
+ import { useCallback as useCallback34, useMemo as useMemo32, useState as useState40, useSyncExternalStore as useSyncExternalStore4 } from "react";
20290
+ import { Box as Box73, Text as Text66 } from "ink";
20291
+ import { Fragment as Fragment19, jsx as jsx93, jsxs as jsxs71 } from "react/jsx-runtime";
19772
20292
  function PermissionDialog({
19773
20293
  runtime,
19774
20294
  onClose,
@@ -19779,11 +20299,11 @@ function PermissionDialog({
19779
20299
  runtime.getSnapshot,
19780
20300
  runtime.getSnapshot
19781
20301
  );
19782
- const [highlighted, setHighlighted] = useState38();
19783
- const [pending, setPending] = useState38();
19784
- const [error, setError] = useState38();
20302
+ const [highlighted, setHighlighted] = useState40();
20303
+ const [pending, setPending] = useState40();
20304
+ const [error, setError] = useState40();
19785
20305
  const selected = highlighted ?? snapshot.options.find((option) => option.value === snapshot.currentValue) ?? snapshot.options[0];
19786
- const items = useMemo31(
20306
+ const items = useMemo32(
19787
20307
  () => snapshot.options.map((option) => ({
19788
20308
  key: option.value,
19789
20309
  value: option,
@@ -19830,8 +20350,8 @@ function PermissionDialog({
19830
20350
  },
19831
20351
  { isActive: true }
19832
20352
  );
19833
- return /* @__PURE__ */ jsxs69(
19834
- Box71,
20353
+ return /* @__PURE__ */ jsxs71(
20354
+ Box73,
19835
20355
  {
19836
20356
  borderStyle: "round",
19837
20357
  borderColor: theme.border.default,
@@ -19840,13 +20360,13 @@ function PermissionDialog({
19840
20360
  paddingY: 1,
19841
20361
  width: "100%",
19842
20362
  children: [
19843
- /* @__PURE__ */ jsxs69(Box71, { justifyContent: "space-between", children: [
19844
- /* @__PURE__ */ jsx90(Text64, { bold: true, color: theme.text.primary, children: "Select DSH Permission" }),
19845
- /* @__PURE__ */ jsx90(Text64, { color: theme.text.secondary, children: "Esc to close" })
20363
+ /* @__PURE__ */ jsxs71(Box73, { justifyContent: "space-between", children: [
20364
+ /* @__PURE__ */ jsx93(Text66, { bold: true, color: theme.text.primary, children: "Select DSH Permission" }),
20365
+ /* @__PURE__ */ jsx93(Text66, { color: theme.text.secondary, children: "Esc to close" })
19846
20366
  ] }),
19847
- error && /* @__PURE__ */ jsx90(Box71, { marginTop: 1, children: /* @__PURE__ */ jsx90(Text64, { color: theme.status.error, children: error }) }),
19848
- !snapshot.available ? /* @__PURE__ */ jsx90(Box71, { marginTop: 1, children: /* @__PURE__ */ jsx90(Text64, { color: theme.status.warning, children: "DSH permission presets are unavailable." }) }) : snapshot.options.length === 0 ? /* @__PURE__ */ jsx90(Box71, { marginTop: 1, children: /* @__PURE__ */ jsx90(Text64, { color: theme.status.warning, children: "No permission presets are available." }) }) : /* @__PURE__ */ jsxs69(Box71, { flexDirection: "row", marginTop: 1, children: [
19849
- /* @__PURE__ */ jsx90(Box71, { width: "50%", paddingRight: 2, flexDirection: "column", children: /* @__PURE__ */ jsx90(
20367
+ error && /* @__PURE__ */ jsx93(Box73, { marginTop: 1, children: /* @__PURE__ */ jsx93(Text66, { color: theme.status.error, children: error }) }),
20368
+ !snapshot.available ? /* @__PURE__ */ jsx93(Box73, { marginTop: 1, children: /* @__PURE__ */ jsx93(Text66, { color: theme.status.warning, children: "DSH permission presets are unavailable." }) }) : snapshot.options.length === 0 ? /* @__PURE__ */ jsx93(Box73, { marginTop: 1, children: /* @__PURE__ */ jsx93(Text66, { color: theme.status.warning, children: "No permission presets are available." }) }) : /* @__PURE__ */ jsxs71(Box73, { flexDirection: "row", marginTop: 1, children: [
20369
+ /* @__PURE__ */ jsx93(Box73, { width: "50%", paddingRight: 2, flexDirection: "column", children: /* @__PURE__ */ jsx93(
19850
20370
  RadioButtonSelect,
19851
20371
  {
19852
20372
  items,
@@ -19855,17 +20375,17 @@ function PermissionDialog({
19855
20375
  onSelect: selectPermission,
19856
20376
  isFocused: !pending && !snapshot.busy,
19857
20377
  showNumbers: false,
19858
- renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs69(Text64, { color: titleColor, wrap: "truncate", children: [
20378
+ renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs71(Text66, { color: titleColor, wrap: "truncate", children: [
19859
20379
  item.value.name,
19860
- item.value.value === snapshot.currentValue && /* @__PURE__ */ jsx90(Text64, { color: theme.text.accent, children: " Current" })
20380
+ item.value.value === snapshot.currentValue && /* @__PURE__ */ jsx93(Text66, { color: theme.text.accent, children: " Current" })
19861
20381
  ] })
19862
20382
  },
19863
20383
  items.map((item) => item.key).join("|")
19864
20384
  ) }),
19865
- /* @__PURE__ */ jsx90(Box71, { width: "50%", paddingLeft: 2, flexDirection: "column", children: pending ? /* @__PURE__ */ jsxs69(Fragment18, { children: [
19866
- /* @__PURE__ */ jsx90(Text64, { bold: true, color: theme.status.warning, children: "Enable Full access?" }),
19867
- /* @__PURE__ */ jsx90(Box71, { marginTop: 1, children: /* @__PURE__ */ jsx90(Text64, { children: "This allows commands to run without workspace sandbox restrictions or approval prompts." }) }),
19868
- /* @__PURE__ */ jsx90(Box71, { marginTop: 1, children: /* @__PURE__ */ jsx90(
20385
+ /* @__PURE__ */ jsx93(Box73, { width: "50%", paddingLeft: 2, flexDirection: "column", children: pending ? /* @__PURE__ */ jsxs71(Fragment19, { children: [
20386
+ /* @__PURE__ */ jsx93(Text66, { bold: true, color: theme.status.warning, children: "Enable Full access?" }),
20387
+ /* @__PURE__ */ jsx93(Box73, { marginTop: 1, children: /* @__PURE__ */ jsx93(Text66, { children: "This allows commands to run without workspace sandbox restrictions or approval prompts." }) }),
20388
+ /* @__PURE__ */ jsx93(Box73, { marginTop: 1, children: /* @__PURE__ */ jsx93(
19869
20389
  RadioButtonSelect,
19870
20390
  {
19871
20391
  items: [
@@ -19880,14 +20400,14 @@ function PermissionDialog({
19880
20400
  showNumbers: false
19881
20401
  }
19882
20402
  ) })
19883
- ] }) : selected ? /* @__PURE__ */ jsxs69(Fragment18, { children: [
19884
- /* @__PURE__ */ jsx90(Text64, { bold: true, color: theme.text.primary, children: selected.name }),
19885
- /* @__PURE__ */ jsx90(Text64, { color: theme.text.secondary, children: selected.value }),
19886
- /* @__PURE__ */ jsx90(Box71, { marginTop: 1, children: /* @__PURE__ */ jsx90(Text64, { children: selected.description ?? "No description is available for this preset." }) }),
19887
- snapshot.busy && /* @__PURE__ */ jsx90(Box71, { marginTop: 1, children: /* @__PURE__ */ jsx90(Text64, { color: theme.text.accent, children: "Applying permission..." }) })
20403
+ ] }) : selected ? /* @__PURE__ */ jsxs71(Fragment19, { children: [
20404
+ /* @__PURE__ */ jsx93(Text66, { bold: true, color: theme.text.primary, children: selected.name }),
20405
+ /* @__PURE__ */ jsx93(Text66, { color: theme.text.secondary, children: selected.value }),
20406
+ /* @__PURE__ */ jsx93(Box73, { marginTop: 1, children: /* @__PURE__ */ jsx93(Text66, { children: selected.description ?? "No description is available for this preset." }) }),
20407
+ snapshot.busy && /* @__PURE__ */ jsx93(Box73, { marginTop: 1, children: /* @__PURE__ */ jsx93(Text66, { color: theme.text.accent, children: "Applying permission..." }) })
19888
20408
  ] }) : null })
19889
20409
  ] }),
19890
- /* @__PURE__ */ jsx90(Box71, { marginTop: 1, children: /* @__PURE__ */ jsx90(Text64, { color: theme.text.secondary, children: "Changes apply to the current DSH Session immediately. No restart required." }) })
20410
+ /* @__PURE__ */ jsx93(Box73, { marginTop: 1, children: /* @__PURE__ */ jsx93(Text66, { color: theme.text.secondary, children: "Changes apply to the current DSH Session immediately. No restart required." }) })
19891
20411
  ]
19892
20412
  }
19893
20413
  );
@@ -19915,7 +20435,7 @@ var permissionCommand = {
19915
20435
  if (value === "") {
19916
20436
  return {
19917
20437
  type: "custom_dialog",
19918
- component: React19.createElement(PermissionDialog, {
20438
+ component: React20.createElement(PermissionDialog, {
19919
20439
  runtime,
19920
20440
  onClose: context.ui.removeComponent,
19921
20441
  onSwitched: (selection) => {
@@ -20005,6 +20525,7 @@ var BuiltinCommandLoader = class {
20005
20525
  vimCommand,
20006
20526
  terminalSetupCommand,
20007
20527
  modelCommand,
20528
+ providerCommand,
20008
20529
  permissionCommand,
20009
20530
  newCommand,
20010
20531
  sessionsCommand,
@@ -20087,21 +20608,22 @@ var DshCommandLoader = class {
20087
20608
  };
20088
20609
 
20089
20610
  // src/ui/hooks/commands/use-slash-command-processor.ts
20090
- var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic, toggleVimEnabled, setIsProcessing, actions, setCustomDialog, modelSelection, permissionSelection, sessionManagement, toolCatalog, dshCommands, enableProfiler = false) => {
20611
+ var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic, toggleVimEnabled, setIsProcessing, actions, setCustomDialog, modelSelection, permissionSelection, sessionManagement, toolCatalog, dshCommands, enableProfiler = false, providerSetup) => {
20091
20612
  const session = useSessionStats();
20092
- const [commands, setCommands] = useState39(
20613
+ const [commands, setCommands] = useState41(
20093
20614
  void 0
20094
20615
  );
20095
- const [reloadTrigger, setReloadTrigger] = useState39(0);
20096
- const commandAbortRef = useRef19(void 0);
20616
+ const [reloadTrigger, setReloadTrigger] = useState41(0);
20617
+ const commandAbortRef = useRef21(void 0);
20097
20618
  const reloadCommands = useCallback35(() => {
20098
20619
  setReloadTrigger((v) => v + 1);
20099
20620
  }, []);
20100
- const [confirmationRequest, setConfirmationRequest] = useState39(null);
20101
- const commandContext = useMemo32(
20621
+ const [confirmationRequest, setConfirmationRequest] = useState41(null);
20622
+ const commandContext = useMemo33(
20102
20623
  () => ({
20103
20624
  services: {
20104
20625
  modelSelection,
20626
+ providerSetup,
20105
20627
  permissionSelection,
20106
20628
  sessionManagement,
20107
20629
  toolCatalog
@@ -20129,6 +20651,7 @@ var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic,
20129
20651
  }),
20130
20652
  [
20131
20653
  modelSelection,
20654
+ providerSetup,
20132
20655
  permissionSelection,
20133
20656
  sessionManagement,
20134
20657
  toolCatalog,
@@ -20142,7 +20665,7 @@ var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic,
20142
20665
  setCustomDialog
20143
20666
  ]
20144
20667
  );
20145
- useEffect41(() => {
20668
+ useEffect43(() => {
20146
20669
  const controller = new AbortController();
20147
20670
  (async () => {
20148
20671
  const loaders = [
@@ -20156,11 +20679,11 @@ var useSlashCommandProcessor = (addItem, clearItems, loadHistory, refreshStatic,
20156
20679
  controller.abort();
20157
20680
  };
20158
20681
  }, [dshCommands, enableProfiler, reloadTrigger]);
20159
- useEffect41(
20682
+ useEffect43(
20160
20683
  () => dshCommands?.subscribe(reloadCommands),
20161
20684
  [dshCommands, reloadCommands]
20162
20685
  );
20163
- useEffect41(
20686
+ useEffect43(
20164
20687
  () => () => commandAbortRef.current?.abort(),
20165
20688
  []
20166
20689
  );
@@ -20329,9 +20852,9 @@ import * as fs13 from "node:fs";
20329
20852
  import { basename as basename2, join as join6 } from "node:path";
20330
20853
 
20331
20854
  // src/ui/hooks/commands/use-settings-command.ts
20332
- import { useState as useState40, useCallback as useCallback36 } from "react";
20855
+ import { useState as useState42, useCallback as useCallback36 } from "react";
20333
20856
  function useSettingsCommand() {
20334
- const [isSettingsDialogOpen, setIsSettingsDialogOpen] = useState40(false);
20857
+ const [isSettingsDialogOpen, setIsSettingsDialogOpen] = useState42(false);
20335
20858
  const openSettingsDialog = useCallback36(() => {
20336
20859
  setIsSettingsDialogOpen(true);
20337
20860
  }, []);
@@ -20346,10 +20869,10 @@ function useSettingsCommand() {
20346
20869
  }
20347
20870
 
20348
20871
  // src/ui/hooks/commands/use-theme-command.ts
20349
- import { useState as useState41, useCallback as useCallback37 } from "react";
20872
+ import { useState as useState43, useCallback as useCallback37 } from "react";
20350
20873
  import process6 from "node:process";
20351
20874
  var useThemeCommand = (loadedSettings, setThemeError, addItem, initialThemeError) => {
20352
- const [isThemeDialogOpen, setIsThemeDialogOpen] = useState41(!!initialThemeError);
20875
+ const [isThemeDialogOpen, setIsThemeDialogOpen] = useState43(!!initialThemeError);
20353
20876
  const openThemeDialog = useCallback37(() => {
20354
20877
  if (process6.env["NO_COLOR"]) {
20355
20878
  addItem(
@@ -20420,7 +20943,7 @@ var useThemeCommand = (loadedSettings, setThemeError, addItem, initialThemeError
20420
20943
  };
20421
20944
 
20422
20945
  // src/ui/hooks/input/use-vim.ts
20423
- import { useCallback as useCallback38, useReducer as useReducer5, useEffect as useEffect42, useRef as useRef20 } from "react";
20946
+ import { useCallback as useCallback38, useReducer as useReducer5, useEffect as useEffect44, useRef as useRef22 } from "react";
20424
20947
  var DIGIT_MULTIPLIER = 10;
20425
20948
  var DEFAULT_COUNT = 1;
20426
20949
  var DIGIT_1_TO_9 = /^[1-9]$/;
@@ -20485,8 +21008,8 @@ var vimReducer = (state, action) => {
20485
21008
  function useVim(buffer, onSubmit) {
20486
21009
  const { vimEnabled, vimMode, setVimMode } = useVimMode();
20487
21010
  const [state, dispatch] = useReducer5(vimReducer, initialVimState);
20488
- const lastEscapeTimestampRef = useRef20(0);
20489
- useEffect42(() => {
21011
+ const lastEscapeTimestampRef = useRef22(0);
21012
+ useEffect44(() => {
20490
21013
  dispatch({ type: "SET_MODE", mode: vimMode });
20491
21014
  }, [vimMode]);
20492
21015
  const updateMode = useCallback38(
@@ -20985,12 +21508,12 @@ function useVim(buffer, onSubmit) {
20985
21508
  }
20986
21509
 
20987
21510
  // src/ui/hooks/session/use-git-branch-name.ts
20988
- import { useState as useState42, useEffect as useEffect43, useCallback as useCallback39 } from "react";
21511
+ import { useState as useState44, useEffect as useEffect45, useCallback as useCallback39 } from "react";
20989
21512
  import fs10 from "node:fs";
20990
21513
  import fsPromises2 from "node:fs/promises";
20991
21514
  import path12 from "node:path";
20992
21515
  function useGitBranchName(cwd) {
20993
- const [branchName, setBranchName] = useState42(void 0);
21516
+ const [branchName, setBranchName] = useState44(void 0);
20994
21517
  const fetchBranchName = useCallback39(async () => {
20995
21518
  try {
20996
21519
  const { stdout } = await spawnAsync(
@@ -21013,7 +21536,7 @@ function useGitBranchName(cwd) {
21013
21536
  setBranchName(void 0);
21014
21537
  }
21015
21538
  }, [cwd, setBranchName]);
21016
- useEffect43(() => {
21539
+ useEffect45(() => {
21017
21540
  fetchBranchName();
21018
21541
  const gitLogsHeadPath = path12.join(cwd, ".git", "logs", "HEAD");
21019
21542
  let watcher;
@@ -21040,7 +21563,7 @@ function useGitBranchName(cwd) {
21040
21563
  }
21041
21564
 
21042
21565
  // src/ui/hooks/settings/use-editor-settings.ts
21043
- import { useState as useState43, useCallback as useCallback40 } from "react";
21566
+ import { useState as useState45, useCallback as useCallback40 } from "react";
21044
21567
 
21045
21568
  // src/config/setting-paths.ts
21046
21569
  var SettingPaths = {
@@ -21051,7 +21574,7 @@ var SettingPaths = {
21051
21574
 
21052
21575
  // src/ui/hooks/settings/use-editor-settings.ts
21053
21576
  var useEditorSettings = (loadedSettings, setEditorError, addItem) => {
21054
- const [isEditorDialogOpen, setIsEditorDialogOpen] = useState43(false);
21577
+ const [isEditorDialogOpen, setIsEditorDialogOpen] = useState45(false);
21055
21578
  const openEditorDialog = useCallback40(() => {
21056
21579
  setIsEditorDialogOpen(true);
21057
21580
  }, []);
@@ -21093,12 +21616,12 @@ var useEditorSettings = (loadedSettings, setEditorError, addItem) => {
21093
21616
  };
21094
21617
 
21095
21618
  // src/ui/hooks/terminal/use-memory-monitor.ts
21096
- import { useEffect as useEffect44 } from "react";
21619
+ import { useEffect as useEffect46 } from "react";
21097
21620
  import process7 from "node:process";
21098
21621
  var MEMORY_WARNING_THRESHOLD = 7 * 1024 * 1024 * 1024;
21099
21622
  var MEMORY_CHECK_INTERVAL = 60 * 1e3;
21100
21623
  var useMemoryMonitor = ({ addItem }) => {
21101
- useEffect44(() => {
21624
+ useEffect46(() => {
21102
21625
  const intervalId = setInterval(() => {
21103
21626
  const usage = process7.memoryUsage().rss;
21104
21627
  if (usage > MEMORY_WARNING_THRESHOLD) {
@@ -21119,9 +21642,9 @@ var useMemoryMonitor = ({ addItem }) => {
21119
21642
  // src/ui/hooks/visual/use-console-messages.ts
21120
21643
  import {
21121
21644
  useCallback as useCallback41,
21122
- useEffect as useEffect45,
21645
+ useEffect as useEffect47,
21123
21646
  useReducer as useReducer6,
21124
- useRef as useRef21,
21647
+ useRef as useRef23,
21125
21648
  useTransition
21126
21649
  } from "react";
21127
21650
  function consoleMessagesReducer(state, action) {
@@ -21149,8 +21672,8 @@ function consoleMessagesReducer(state, action) {
21149
21672
  }
21150
21673
  function useConsoleMessages() {
21151
21674
  const [consoleMessages, dispatch] = useReducer6(consoleMessagesReducer, []);
21152
- const messageQueueRef = useRef21([]);
21153
- const timeoutRef = useRef21(null);
21675
+ const messageQueueRef = useRef23([]);
21676
+ const timeoutRef = useRef23(null);
21154
21677
  const [, startTransition] = useTransition();
21155
21678
  const processQueue = useCallback41(() => {
21156
21679
  if (messageQueueRef.current.length > 0) {
@@ -21171,7 +21694,7 @@ function useConsoleMessages() {
21171
21694
  },
21172
21695
  [processQueue]
21173
21696
  );
21174
- useEffect45(() => {
21697
+ useEffect47(() => {
21175
21698
  const handleConsoleLog = (payload) => {
21176
21699
  handleNewMessage({
21177
21700
  type: payload.type,
@@ -21200,7 +21723,7 @@ function useConsoleMessages() {
21200
21723
  dispatch({ type: "CLEAR" });
21201
21724
  });
21202
21725
  }, []);
21203
- useEffect45(
21726
+ useEffect47(
21204
21727
  () => () => {
21205
21728
  if (timeoutRef.current) {
21206
21729
  clearTimeout(timeoutRef.current);
@@ -21212,13 +21735,13 @@ function useConsoleMessages() {
21212
21735
  }
21213
21736
 
21214
21737
  // src/ui/hooks/visual/use-timer.ts
21215
- import { useState as useState44, useEffect as useEffect46, useRef as useRef22 } from "react";
21738
+ import { useState as useState46, useEffect as useEffect48, useRef as useRef24 } from "react";
21216
21739
  var useTimer = (isActive, resetKey) => {
21217
- const [elapsedTime, setElapsedTime] = useState44(0);
21218
- const timerRef = useRef22(null);
21219
- const prevResetKeyRef = useRef22(resetKey);
21220
- const prevIsActiveRef = useRef22(isActive);
21221
- useEffect46(() => {
21740
+ const [elapsedTime, setElapsedTime] = useState46(0);
21741
+ const timerRef = useRef24(null);
21742
+ const prevResetKeyRef = useRef24(resetKey);
21743
+ const prevIsActiveRef = useRef24(isActive);
21744
+ useEffect48(() => {
21222
21745
  let shouldResetTime = false;
21223
21746
  if (prevResetKeyRef.current !== resetKey) {
21224
21747
  shouldResetTime = true;
@@ -21255,7 +21778,7 @@ var useTimer = (isActive, resetKey) => {
21255
21778
  };
21256
21779
 
21257
21780
  // src/ui/hooks/visual/use-phrase-cycler.ts
21258
- import { useState as useState45, useEffect as useEffect47, useRef as useRef23 } from "react";
21781
+ import { useState as useState47, useEffect as useEffect49, useRef as useRef25 } from "react";
21259
21782
 
21260
21783
  // src/ui/components/indicators/loading-phrases.ts
21261
21784
  var WITTY_LOADING_PHRASES = [
@@ -21398,12 +21921,12 @@ var PHRASE_CHANGE_INTERVAL_MS = 15e3;
21398
21921
  var INTERACTIVE_SHELL_WAITING_PHRASE = "Interactive shell awaiting input... press tab to focus shell";
21399
21922
  var usePhraseCycler = (isActive, shouldShowFocusHint, customPhrases) => {
21400
21923
  const loadingPhrases = customPhrases && customPhrases.length > 0 ? customPhrases : WITTY_LOADING_PHRASES;
21401
- const [currentLoadingPhrase, setCurrentLoadingPhrase] = useState45(
21924
+ const [currentLoadingPhrase, setCurrentLoadingPhrase] = useState47(
21402
21925
  loadingPhrases[0]
21403
21926
  );
21404
- const phraseIntervalRef = useRef23(null);
21405
- const hasShownFirstRequestTipRef = useRef23(false);
21406
- useEffect47(() => {
21927
+ const phraseIntervalRef = useRef25(null);
21928
+ const hasShownFirstRequestTipRef = useRef25(false);
21929
+ useEffect49(() => {
21407
21930
  if (phraseIntervalRef.current) {
21408
21931
  clearInterval(phraseIntervalRef.current);
21409
21932
  phraseIntervalRef.current = null;
@@ -21448,13 +21971,13 @@ var usePhraseCycler = (isActive, shouldShowFocusHint, customPhrases) => {
21448
21971
  };
21449
21972
 
21450
21973
  // src/ui/hooks/visual/use-loading-indicator.ts
21451
- import { useState as useState46, useEffect as useEffect48, useRef as useRef24 } from "react";
21974
+ import { useState as useState48, useEffect as useEffect50, useRef as useRef26 } from "react";
21452
21975
  var useLoadingIndicator = ({
21453
21976
  streamingState,
21454
21977
  shouldShowFocusHint,
21455
21978
  customWittyPhrases
21456
21979
  }) => {
21457
- const [timerResetKey, setTimerResetKey] = useState46(0);
21980
+ const [timerResetKey, setTimerResetKey] = useState48(0);
21458
21981
  const isTimerActive = streamingState === "responding" /* Responding */;
21459
21982
  const elapsedTimeFromTimer = useTimer(isTimerActive, timerResetKey);
21460
21983
  const isPhraseCyclingActive = streamingState === "responding" /* Responding */;
@@ -21463,8 +21986,8 @@ var useLoadingIndicator = ({
21463
21986
  shouldShowFocusHint,
21464
21987
  customWittyPhrases
21465
21988
  );
21466
- const prevStreamingStateRef = useRef24(null);
21467
- useEffect48(() => {
21989
+ const prevStreamingStateRef = useRef26(null);
21990
+ useEffect50(() => {
21468
21991
  if (streamingState === "idle" /* Idle */ && prevStreamingStateRef.current === "responding" /* Responding */) {
21469
21992
  setTimerResetKey((prevKey) => prevKey + 1);
21470
21993
  }
@@ -21477,12 +22000,12 @@ var useLoadingIndicator = ({
21477
22000
  };
21478
22001
 
21479
22002
  // src/ui/hooks/session/use-message-queue.ts
21480
- import { useCallback as useCallback42, useEffect as useEffect49, useState as useState47 } from "react";
22003
+ import { useCallback as useCallback42, useEffect as useEffect51, useState as useState49 } from "react";
21481
22004
  function useMessageQueue({
21482
22005
  streamingState,
21483
22006
  submitQuery
21484
22007
  }) {
21485
- const [messageQueue, setMessageQueue] = useState47([]);
22008
+ const [messageQueue, setMessageQueue] = useState49([]);
21486
22009
  const addMessage = useCallback42((message) => {
21487
22010
  const trimmedMessage = message.trim();
21488
22011
  if (trimmedMessage.length > 0) {
@@ -21504,7 +22027,7 @@ function useMessageQueue({
21504
22027
  setMessageQueue([]);
21505
22028
  return allMessages;
21506
22029
  }, [messageQueue]);
21507
- useEffect49(() => {
22030
+ useEffect51(() => {
21508
22031
  if (streamingState === "idle" /* Idle */ && messageQueue.length > 0) {
21509
22032
  const combinedMessage = messageQueue.join("\n\n");
21510
22033
  setMessageQueue([]);
@@ -21521,15 +22044,15 @@ function useMessageQueue({
21521
22044
  }
21522
22045
 
21523
22046
  // src/ui/hooks/input/use-input-history-store.ts
21524
- import { useCallback as useCallback43, useRef as useRef25, useState as useState48 } from "react";
22047
+ import { useCallback as useCallback43, useRef as useRef27, useState as useState50 } from "react";
21525
22048
  function deduplicateConsecutive(messages) {
21526
22049
  return messages.filter(
21527
22050
  (message, index) => index === 0 || message !== messages[index - 1]
21528
22051
  );
21529
22052
  }
21530
22053
  function useInputHistoryStore() {
21531
- const [inputHistory, setInputHistory] = useState48([]);
21532
- const initializationStarted = useRef25(false);
22054
+ const [inputHistory, setInputHistory] = useState50([]);
22055
+ const initializationStarted = useRef27(false);
21533
22056
  const initializeFromHistory = useCallback43(
21534
22057
  async (history) => {
21535
22058
  if (initializationStarted.current) return;
@@ -21651,12 +22174,12 @@ var PromptHistoryStore = class {
21651
22174
  };
21652
22175
 
21653
22176
  // src/ui/hooks/ai/use-turn-activity-monitor.ts
21654
- import { useState as useState49, useEffect as useEffect50, useRef as useRef26 } from "react";
22177
+ import { useState as useState51, useEffect as useEffect52, useRef as useRef28 } from "react";
21655
22178
  var useTurnActivityMonitor = (streamingState, activePtyId) => {
21656
- const [operationStartTime, setOperationStartTime] = useState49(0);
21657
- const prevPtyIdRef = useRef26(void 0);
21658
- const prevStreamingStateRef = useRef26(void 0);
21659
- useEffect50(() => {
22179
+ const [operationStartTime, setOperationStartTime] = useState51(0);
22180
+ const prevPtyIdRef = useRef28(void 0);
22181
+ const prevStreamingStateRef = useRef28(void 0);
22182
+ useEffect52(() => {
21660
22183
  const isNowResponding = streamingState === "responding" /* Responding */;
21661
22184
  const wasResponding = prevStreamingStateRef.current === "responding" /* Responding */;
21662
22185
  const ptyChanged = activePtyId !== prevPtyIdRef.current;
@@ -21715,7 +22238,7 @@ var useShellInactivityStatus = ({
21715
22238
  };
21716
22239
 
21717
22240
  // src/ui/hooks/input/use-local-shell-command.ts
21718
- import { useCallback as useCallback44, useEffect as useEffect51, useRef as useRef27, useState as useState50 } from "react";
22241
+ import { useCallback as useCallback44, useEffect as useEffect53, useRef as useRef29, useState as useState52 } from "react";
21719
22242
  import crypto2 from "node:crypto";
21720
22243
  import fs12 from "node:fs";
21721
22244
  import os4 from "node:os";
@@ -21732,13 +22255,13 @@ function useLocalShellCommand({
21732
22255
  terminalWidth,
21733
22256
  terminalHeight
21734
22257
  }) {
21735
- const controllerRef = useRef27(void 0);
21736
- const mountedRef = useRef27(true);
21737
- const [isExecuting, setIsExecuting] = useState50(false);
21738
- const [activePtyId, setActivePtyId] = useState50(void 0);
21739
- const [lastOutputTime, setLastOutputTime] = useState50(0);
22258
+ const controllerRef = useRef29(void 0);
22259
+ const mountedRef = useRef29(true);
22260
+ const [isExecuting, setIsExecuting] = useState52(false);
22261
+ const [activePtyId, setActivePtyId] = useState52(void 0);
22262
+ const [lastOutputTime, setLastOutputTime] = useState52(0);
21740
22263
  const cancel = useCallback44(() => controllerRef.current?.abort(), []);
21741
- useEffect51(() => {
22264
+ useEffect53(() => {
21742
22265
  mountedRef.current = true;
21743
22266
  return () => {
21744
22267
  mountedRef.current = false;
@@ -21942,9 +22465,12 @@ ${output}`;
21942
22465
  }
21943
22466
 
21944
22467
  // src/ui/app-container.tsx
21945
- import { jsx as jsx91 } from "react/jsx-runtime";
22468
+ import { jsx as jsx94 } from "react/jsx-runtime";
21946
22469
  var SHELL_WIDTH_FRACTION = 0.89;
21947
22470
  var SHELL_HEIGHT_PADDING = 10;
22471
+ var noopExternalStoreSubscribe = () => () => {
22472
+ };
22473
+ var emptyProviderSetupSnapshot = () => void 0;
21948
22474
  var AppContainer = (props) => {
21949
22475
  const {
21950
22476
  config,
@@ -21953,6 +22479,7 @@ var AppContainer = (props) => {
21953
22479
  promptCompletionRuntime,
21954
22480
  promptInputRuntime,
21955
22481
  modelSelectionRuntime,
22482
+ providerSetupRuntime,
21956
22483
  sessionManagementRuntime,
21957
22484
  approvalRuntime,
21958
22485
  userQuestionRuntime,
@@ -21978,18 +22505,18 @@ var AppContainer = (props) => {
21978
22505
  userQuestionRuntime.getSnapshot
21979
22506
  );
21980
22507
  const pendingUserQuestion = userQuestionSnapshot.pending[0];
21981
- const conversationHistoryIds = useRef28(/* @__PURE__ */ new Map());
21982
- const conversationHistoryTexts = useRef28(/* @__PURE__ */ new Map());
22508
+ const conversationHistoryIds = useRef30(/* @__PURE__ */ new Map());
22509
+ const conversationHistoryTexts = useRef30(/* @__PURE__ */ new Map());
21983
22510
  const conversationSessionId = conversationRuntime.getSessionStats().sessionId;
21984
- const [projectedSessionId, setProjectedSessionId] = useState51(
22511
+ const [projectedSessionId, setProjectedSessionId] = useState53(
21985
22512
  conversationSessionId
21986
22513
  );
21987
- const promptInputAbortRef = useRef28(void 0);
21988
- const [promptInputPreparing, setPromptInputPreparing] = useState51(false);
22514
+ const promptInputAbortRef = useRef30(void 0);
22515
+ const [promptInputPreparing, setPromptInputPreparing] = useState53(false);
21989
22516
  const addConversationHistoryItem = historyManager.addItem;
21990
22517
  const updateConversationHistoryItem = historyManager.updateItem;
21991
22518
  const clearConversationHistory = historyManager.clearItems;
21992
- useEffect52(() => {
22519
+ useEffect54(() => {
21993
22520
  if (projectedSessionId !== conversationSessionId) {
21994
22521
  conversationHistoryIds.current.clear();
21995
22522
  conversationHistoryTexts.current.clear();
@@ -22074,42 +22601,48 @@ var AppContainer = (props) => {
22074
22601
  useMemoryMonitor(historyManager);
22075
22602
  const settings = useSettings();
22076
22603
  const isAlternateBuffer = useAlternateBuffer();
22077
- const [debugMessage, setDebugMessage] = useState51("");
22078
- const [quittingMessages, setQuittingMessages] = useState51(null);
22079
- const [themeError, setThemeError] = useState51(
22604
+ const [debugMessage, setDebugMessage] = useState53("");
22605
+ const [quittingMessages, setQuittingMessages] = useState53(null);
22606
+ const [themeError, setThemeError] = useState53(
22080
22607
  initializationResult.themeError
22081
22608
  );
22082
- const [isProcessing, setIsProcessing] = useState51(false);
22083
- const [embeddedShellFocused, setEmbeddedShellFocused] = useState51(false);
22609
+ const [isProcessing, setIsProcessing] = useState53(false);
22610
+ const [embeddedShellFocused, setEmbeddedShellFocused] = useState53(false);
22084
22611
  const enableProfiler = config.getDebugMode() || process8.env["NODE_ENV"] === "development";
22085
- const [showDebugProfiler, setShowDebugProfiler] = useState51(enableProfiler);
22086
- const [customDialog, setCustomDialog] = useState51(
22612
+ const [showDebugProfiler, setShowDebugProfiler] = useState53(enableProfiler);
22613
+ const [customDialog, setCustomDialog] = useState53(
22087
22614
  null
22088
22615
  );
22089
- const [copyModeEnabled, setCopyModeEnabled] = useState51(false);
22090
- const [pendingRestorePrompt, setPendingRestorePrompt] = useState51(false);
22091
- const [shellModeActive, setShellModeActive] = useState51(false);
22092
- const [pendingShellHistoryItem, setPendingShellHistoryItem] = useState51(null);
22093
- const [historyRemountKey, setHistoryRemountKey] = useState51(0);
22094
- const [settingsNonce, setSettingsNonce] = useState51(0);
22095
- const [queueErrorMessage, setQueueErrorMessage] = useState51(
22616
+ const [copyModeEnabled, setCopyModeEnabled] = useState53(false);
22617
+ const [pendingRestorePrompt, setPendingRestorePrompt] = useState53(false);
22618
+ const [shellModeActive, setShellModeActive] = useState53(false);
22619
+ const [pendingShellHistoryItem, setPendingShellHistoryItem] = useState53(null);
22620
+ const [historyRemountKey, setHistoryRemountKey] = useState53(0);
22621
+ const [settingsNonce, setSettingsNonce] = useState53(0);
22622
+ const [queueErrorMessage, setQueueErrorMessage] = useState53(
22096
22623
  null
22097
22624
  );
22098
22625
  const toggleDebugProfiler = useCallback45(
22099
22626
  () => setShowDebugProfiler((visible) => !visible),
22100
22627
  []
22101
22628
  );
22102
- const [modelSelectionSnapshot, setModelSelectionSnapshot] = useState51(
22629
+ const [modelSelectionSnapshot, setModelSelectionSnapshot] = useState53(
22103
22630
  () => modelSelectionRuntime?.getSnapshot()
22104
22631
  );
22105
- useEffect52(
22632
+ useEffect54(
22106
22633
  () => modelSelectionRuntime?.subscribe(
22107
22634
  () => setModelSelectionSnapshot(modelSelectionRuntime.getSnapshot())
22108
22635
  ),
22109
22636
  [modelSelectionRuntime]
22110
22637
  );
22111
22638
  const currentModel = modelSelectionSnapshot ? modelSelectionLabel(modelSelectionSnapshot.current) : "DSH default";
22112
- const promptHistory = useMemo33(
22639
+ const providerSetupSnapshot = useSyncExternalStore5(
22640
+ providerSetupRuntime?.subscribe ?? noopExternalStoreSubscribe,
22641
+ providerSetupRuntime?.getSnapshot ?? emptyProviderSetupSnapshot,
22642
+ providerSetupRuntime?.getSnapshot ?? emptyProviderSetupSnapshot
22643
+ );
22644
+ const [providerSetupDismissed, setProviderSetupDismissed] = useState53(false);
22645
+ const promptHistory = useMemo34(
22113
22646
  () => new PromptHistoryStore(
22114
22647
  join6(config.storage.getProjectTempDir(), "prompt_history.json")
22115
22648
  ),
@@ -22122,11 +22655,11 @@ var AppContainer = (props) => {
22122
22655
  const app = useApp();
22123
22656
  const { stats: sessionStats } = useSessionStats();
22124
22657
  const branchName = useGitBranchName(config.getTargetDir());
22125
- const mainControlsRef = useRef28(null);
22126
- const rootUiRef = useRef28(null);
22127
- const lastTitleRef = useRef28(null);
22658
+ const mainControlsRef = useRef30(null);
22659
+ const rootUiRef = useRef30(null);
22660
+ const lastTitleRef = useRef30(null);
22128
22661
  const staticExtraHeight = 3;
22129
- useEffect52(() => {
22662
+ useEffect54(() => {
22130
22663
  void (async () => {
22131
22664
  startupProfiler.flush();
22132
22665
  })();
@@ -22134,7 +22667,7 @@ var AppContainer = (props) => {
22134
22667
  disableMouseEvents();
22135
22668
  });
22136
22669
  }, [config]);
22137
- useEffect52(() => {
22670
+ useEffect54(() => {
22138
22671
  const handleSettingsChanged = () => {
22139
22672
  setSettingsNonce((prev) => prev + 1);
22140
22673
  };
@@ -22145,7 +22678,7 @@ var AppContainer = (props) => {
22145
22678
  }, []);
22146
22679
  const { consoleMessages, clearConsoleMessages: clearConsoleMessagesState } = useConsoleMessages();
22147
22680
  const mainAreaWidth = calculateMainAreaWidth(terminalWidth, settings);
22148
- const { inputWidth, suggestionsWidth } = useMemo33(() => {
22681
+ const { inputWidth, suggestionsWidth } = useMemo34(() => {
22149
22682
  const { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 } = calculatePromptWidths(mainAreaWidth);
22150
22683
  return { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 };
22151
22684
  }, [mainAreaWidth]);
@@ -22170,7 +22703,7 @@ var AppContainer = (props) => {
22170
22703
  shellModeActive,
22171
22704
  getPreferredEditor
22172
22705
  });
22173
- useEffect52(() => {
22706
+ useEffect54(() => {
22174
22707
  initializeFromHistory(promptHistory);
22175
22708
  }, [initializeFromHistory, promptHistory]);
22176
22709
  const refreshStatic = useCallback45(() => {
@@ -22189,7 +22722,7 @@ var AppContainer = (props) => {
22189
22722
  terminalCapabilityManager.enableSupportedModes();
22190
22723
  refreshStatic();
22191
22724
  }, [refreshStatic, isAlternateBuffer, app, config]);
22192
- useEffect52(() => {
22725
+ useEffect54(() => {
22193
22726
  coreEvents.on(CoreEvent.ExternalEditorClosed, handleEditorClose);
22194
22727
  return () => {
22195
22728
  coreEvents.off(CoreEvent.ExternalEditorClosed, handleEditorClose);
@@ -22207,7 +22740,7 @@ var AppContainer = (props) => {
22207
22740
  historyManager.addItem,
22208
22741
  initializationResult.themeError
22209
22742
  );
22210
- const [editorError, setEditorError] = useState51(null);
22743
+ const [editorError, setEditorError] = useState53(null);
22211
22744
  const {
22212
22745
  isEditorDialogOpen,
22213
22746
  openEditorDialog,
@@ -22216,7 +22749,7 @@ var AppContainer = (props) => {
22216
22749
  } = useEditorSettings(settings, setEditorError, historyManager.addItem);
22217
22750
  const { isSettingsDialogOpen, openSettingsDialog, closeSettingsDialog } = useSettingsCommand();
22218
22751
  const { toggleVimEnabled } = useVimMode();
22219
- const slashCommandActions = useMemo33(
22752
+ const slashCommandActions = useMemo34(
22220
22753
  () => ({
22221
22754
  openThemeDialog,
22222
22755
  openEditorDialog,
@@ -22260,13 +22793,14 @@ var AppContainer = (props) => {
22260
22793
  sessionManagementRuntime,
22261
22794
  toolCatalogRuntime,
22262
22795
  commandRuntime,
22263
- enableProfiler
22796
+ enableProfiler,
22797
+ providerSetupRuntime
22264
22798
  );
22265
- const cancelHandlerRef = useRef28(
22799
+ const cancelHandlerRef = useRef30(
22266
22800
  () => {
22267
22801
  }
22268
22802
  );
22269
- useEffect52(() => {
22803
+ useEffect54(() => {
22270
22804
  if (pendingRestorePrompt) {
22271
22805
  const lastHistoryUserMsg = historyManager.history.findLast(
22272
22806
  (h) => h.type === "user"
@@ -22279,7 +22813,7 @@ var AppContainer = (props) => {
22279
22813
  }
22280
22814
  }, [pendingRestorePrompt, inputHistory, historyManager.history]);
22281
22815
  const initError = initializationResult.initError;
22282
- const todos = useMemo33(
22816
+ const todos = useMemo34(
22283
22817
  () => ({
22284
22818
  todos: conversationSnapshot.todos.map((todo) => ({
22285
22819
  description: todo.content,
@@ -22363,14 +22897,14 @@ var AppContainer = (props) => {
22363
22897
  promptInputAbortRef.current?.abort();
22364
22898
  conversationRuntime.cancel();
22365
22899
  }, [cancelCommand, cancelLocalShell, conversationRuntime]);
22366
- useEffect52(
22900
+ useEffect54(
22367
22901
  () => () => {
22368
22902
  promptInputAbortRef.current?.abort();
22369
22903
  },
22370
22904
  []
22371
22905
  );
22372
- const lastOutputTimeRef = useRef28(0);
22373
- useEffect52(() => {
22906
+ const lastOutputTimeRef = useRef30(0);
22907
+ useEffect54(() => {
22374
22908
  lastOutputTimeRef.current = lastOutputTime;
22375
22909
  }, [lastOutputTime]);
22376
22910
  const { shouldShowFocusHint, inactivityStatus } = useShellInactivityStatus({
@@ -22421,6 +22955,11 @@ ${queuedText}` : queuedText;
22421
22955
  return;
22422
22956
  }
22423
22957
  const isSlash = isSlashCommand(submittedValue.trim());
22958
+ if (!isSlash && providerSetupSnapshot?.current.status === "missing") {
22959
+ buffer.setText(submittedValue);
22960
+ setProviderSetupDismissed(false);
22961
+ return;
22962
+ }
22424
22963
  const isIdle = streamingState === "idle" /* Idle */;
22425
22964
  if (isSlash || isIdle) {
22426
22965
  void submitQuery(submittedValue);
@@ -22437,6 +22976,8 @@ ${queuedText}` : queuedText;
22437
22976
  addInput,
22438
22977
  executeLocalShell,
22439
22978
  promptHistory,
22979
+ providerSetupSnapshot,
22980
+ buffer,
22440
22981
  shellModeActive,
22441
22982
  submitQuery,
22442
22983
  streamingState
@@ -22449,8 +22990,8 @@ ${queuedText}` : queuedText;
22449
22990
  }, [historyManager, clearConsoleMessagesState, refreshStatic]);
22450
22991
  const { handleInput: vimHandleInput } = useVim(buffer, handleFinalSubmit);
22451
22992
  const isInputActive = !initError && !isProcessing && pendingApproval === void 0 && pendingUserQuestion === void 0 && !!slashCommands && (streamingState === "idle" /* Idle */ || streamingState === "responding" /* Responding */);
22452
- const [controlsHeight, setControlsHeight] = useState51(0);
22453
- useLayoutEffect2(() => {
22993
+ const [controlsHeight, setControlsHeight] = useState53(0);
22994
+ useLayoutEffect3(() => {
22454
22995
  if (mainControlsRef.current) {
22455
22996
  const fullFooterMeasurement = measureElement3(mainControlsRef.current);
22456
22997
  if (fullFooterMeasurement.height > 0 && fullFooterMeasurement.height !== controlsHeight) {
@@ -22473,12 +23014,45 @@ ${queuedText}` : queuedText;
22473
23014
  sanitizationConfig: config.sanitizationConfig
22474
23015
  });
22475
23016
  const isFocused = useFocus();
22476
- const initialPrompt = useMemo33(
23017
+ const initialPrompt = useMemo34(
22477
23018
  () => props.initialPrompt ?? config.getQuestion(),
22478
23019
  [config, props.initialPrompt]
22479
23020
  );
22480
- const initialPromptSubmitted = useRef28(false);
22481
- useEffect52(() => {
23021
+ const initialPromptSubmitted = useRef30(false);
23022
+ const providerSetupRequired = providerSetupSnapshot?.current.status === "missing";
23023
+ useEffect54(() => {
23024
+ if (!providerSetupRuntime || !providerSetupRequired || providerSetupDismissed || customDialog) {
23025
+ return;
23026
+ }
23027
+ setCustomDialog(
23028
+ /* @__PURE__ */ jsx94(
23029
+ ProviderSetupDialog,
23030
+ {
23031
+ runtime: providerSetupRuntime,
23032
+ provider: providerSetupSnapshot.current.provider,
23033
+ reason: "first-run",
23034
+ onConfigured: () => setCustomDialog(null),
23035
+ onCancel: () => {
23036
+ setProviderSetupDismissed(true);
23037
+ if (initialPrompt && !initialPromptSubmitted.current) {
23038
+ initialPromptSubmitted.current = true;
23039
+ buffer.setText(initialPrompt);
23040
+ }
23041
+ setCustomDialog(null);
23042
+ }
23043
+ }
23044
+ )
23045
+ );
23046
+ }, [
23047
+ buffer,
23048
+ customDialog,
23049
+ initialPrompt,
23050
+ providerSetupDismissed,
23051
+ providerSetupRequired,
23052
+ providerSetupRuntime,
23053
+ providerSetupSnapshot
23054
+ ]);
23055
+ useEffect54(() => {
22482
23056
  if (activePtyId) {
22483
23057
  try {
22484
23058
  ShellExecutionService.resizePty(
@@ -22496,8 +23070,8 @@ ${queuedText}` : queuedText;
22496
23070
  }
22497
23071
  }
22498
23072
  }, [terminalWidth, availableTerminalHeight, activePtyId]);
22499
- useEffect52(() => {
22500
- if (initialPrompt && !initialPromptSubmitted.current && !isThemeDialogOpen && !isEditorDialogOpen && conversationRuntime) {
23073
+ useEffect54(() => {
23074
+ if (initialPrompt && !initialPromptSubmitted.current && !isThemeDialogOpen && !isEditorDialogOpen && !providerSetupRequired && !customDialog && conversationRuntime) {
22501
23075
  handleFinalSubmit(initialPrompt);
22502
23076
  initialPromptSubmitted.current = true;
22503
23077
  }
@@ -22506,21 +23080,23 @@ ${queuedText}` : queuedText;
22506
23080
  handleFinalSubmit,
22507
23081
  isThemeDialogOpen,
22508
23082
  isEditorDialogOpen,
23083
+ providerSetupRequired,
23084
+ customDialog,
22509
23085
  conversationRuntime
22510
23086
  ]);
22511
- const [showErrorDetails, setShowErrorDetails] = useState51(false);
22512
- const [showFullTodos, setShowFullTodos] = useState51(false);
22513
- const [renderMarkdown, setRenderMarkdown] = useState51(true);
22514
- const [ctrlCPressCount, setCtrlCPressCount] = useState51(0);
22515
- const ctrlCTimerRef = useRef28(null);
22516
- const [ctrlDPressCount, setCtrlDPressCount] = useState51(0);
22517
- const ctrlDTimerRef = useRef28(null);
22518
- const [constrainHeight, setConstrainHeight] = useState51(true);
22519
- const [showEscapePrompt, setShowEscapePrompt] = useState51(false);
22520
- const [warningMessage, setWarningMessage] = useState51(null);
22521
- const isInitialMount = useRef28(true);
22522
- const warningTimeoutRef = useRef28(null);
22523
- const tabFocusTimeoutRef = useRef28(null);
23087
+ const [showErrorDetails, setShowErrorDetails] = useState53(false);
23088
+ const [showFullTodos, setShowFullTodos] = useState53(false);
23089
+ const [renderMarkdown, setRenderMarkdown] = useState53(true);
23090
+ const [ctrlCPressCount, setCtrlCPressCount] = useState53(0);
23091
+ const ctrlCTimerRef = useRef30(null);
23092
+ const [ctrlDPressCount, setCtrlDPressCount] = useState53(0);
23093
+ const ctrlDTimerRef = useRef30(null);
23094
+ const [constrainHeight, setConstrainHeight] = useState53(true);
23095
+ const [showEscapePrompt, setShowEscapePrompt] = useState53(false);
23096
+ const [warningMessage, setWarningMessage] = useState53(null);
23097
+ const isInitialMount = useRef30(true);
23098
+ const warningTimeoutRef = useRef30(null);
23099
+ const tabFocusTimeoutRef = useRef30(null);
22524
23100
  const handleWarning = useCallback45((message) => {
22525
23101
  setWarningMessage(message);
22526
23102
  if (warningTimeoutRef.current) {
@@ -22530,7 +23106,7 @@ ${queuedText}` : queuedText;
22530
23106
  setWarningMessage(null);
22531
23107
  }, WARNING_PROMPT_DURATION_MS);
22532
23108
  }, []);
22533
- useEffect52(() => {
23109
+ useEffect54(() => {
22534
23110
  const handleSelectionWarning = () => {
22535
23111
  handleWarning("Press Ctrl-S to enter selection mode to copy text.");
22536
23112
  };
@@ -22550,7 +23126,7 @@ ${queuedText}` : queuedText;
22550
23126
  }
22551
23127
  };
22552
23128
  }, [handleWarning]);
22553
- useEffect52(() => {
23129
+ useEffect54(() => {
22554
23130
  if (queueErrorMessage) {
22555
23131
  const timer = setTimeout(() => {
22556
23132
  setQueueErrorMessage(null);
@@ -22559,7 +23135,7 @@ ${queuedText}` : queuedText;
22559
23135
  }
22560
23136
  return void 0;
22561
23137
  }, [queueErrorMessage, setQueueErrorMessage]);
22562
- useEffect52(() => {
23138
+ useEffect54(() => {
22563
23139
  if (isInitialMount.current) {
22564
23140
  isInitialMount.current = false;
22565
23141
  return;
@@ -22571,7 +23147,7 @@ ${queuedText}` : queuedText;
22571
23147
  clearTimeout(handler);
22572
23148
  };
22573
23149
  }, [terminalWidth, refreshStatic]);
22574
- useEffect52(() => {
23150
+ useEffect54(() => {
22575
23151
  const openDebugConsole = () => {
22576
23152
  setShowErrorDetails(true);
22577
23153
  setConstrainHeight(false);
@@ -22581,7 +23157,7 @@ ${queuedText}` : queuedText;
22581
23157
  appEvents.off("open-debug-console" /* OpenDebugConsole */, openDebugConsole);
22582
23158
  };
22583
23159
  }, [config]);
22584
- useEffect52(() => {
23160
+ useEffect54(() => {
22585
23161
  if (ctrlCTimerRef.current) {
22586
23162
  clearTimeout(ctrlCTimerRef.current);
22587
23163
  ctrlCTimerRef.current = null;
@@ -22595,7 +23171,7 @@ ${queuedText}` : queuedText;
22595
23171
  }, WARNING_PROMPT_DURATION_MS);
22596
23172
  }
22597
23173
  }, [ctrlCPressCount, config, setCtrlCPressCount, handleSlashCommand]);
22598
- useEffect52(() => {
23174
+ useEffect54(() => {
22599
23175
  if (ctrlDTimerRef.current) {
22600
23176
  clearTimeout(ctrlDTimerRef.current);
22601
23177
  ctrlCTimerRef.current = null;
@@ -22624,9 +23200,6 @@ ${queuedText}` : queuedText;
22624
23200
  enableMouseEvents();
22625
23201
  return;
22626
23202
  }
22627
- if (settings.merged.general.debugKeystrokeLogging) {
22628
- debugLogger.log("[DEBUG] Keystroke:", JSON.stringify(key));
22629
- }
22630
23203
  if (isAlternateBuffer && keyMatchers["app.toggleCopyMode" /* TOGGLE_COPY_MODE */](key)) {
22631
23204
  setCopyModeEnabled(true);
22632
23205
  disableMouseEvents();
@@ -22641,6 +23214,9 @@ ${queuedText}` : queuedText;
22641
23214
  userQuestionRuntime.cancel(pendingUserQuestion.id);
22642
23215
  return;
22643
23216
  }
23217
+ if (customDialog) {
23218
+ return;
23219
+ }
22644
23220
  if (conversationRuntime) {
22645
23221
  if (promptInputPreparing || localShellExecuting || isProcessing || conversationSnapshot.busy) {
22646
23222
  cancelOngoingRequest();
@@ -22718,9 +23294,9 @@ ${queuedText}` : queuedText;
22718
23294
  approvalRuntime,
22719
23295
  pendingUserQuestion,
22720
23296
  userQuestionRuntime,
23297
+ customDialog,
22721
23298
  activePtyId,
22722
23299
  embeddedShellFocused,
22723
- settings.merged.general.debugKeystrokeLogging,
22724
23300
  refreshStatic,
22725
23301
  setCopyModeEnabled,
22726
23302
  copyModeEnabled,
@@ -22729,7 +23305,7 @@ ${queuedText}` : queuedText;
22729
23305
  ]
22730
23306
  );
22731
23307
  useKeypress(handleGlobalKeypress, { isActive: true });
22732
- useEffect52(() => {
23308
+ useEffect54(() => {
22733
23309
  if (settings.merged.ui.hideWindowTitle) return;
22734
23310
  const paddedTitle = computeTerminalTitle({
22735
23311
  streamingState,
@@ -22753,7 +23329,7 @@ ${queuedText}` : queuedText;
22753
23329
  config,
22754
23330
  stdout
22755
23331
  ]);
22756
- useEffect52(() => {
23332
+ useEffect54(() => {
22757
23333
  const handleUserFeedback = (payload) => {
22758
23334
  let type;
22759
23335
  switch (payload.severity) {
@@ -22791,23 +23367,23 @@ ${queuedText}` : queuedText;
22791
23367
  coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
22792
23368
  };
22793
23369
  }, [historyManager]);
22794
- const filteredConsoleMessages = useMemo33(() => {
23370
+ const filteredConsoleMessages = useMemo34(() => {
22795
23371
  if (config.getDebugMode()) {
22796
23372
  return consoleMessages;
22797
23373
  }
22798
23374
  return consoleMessages.filter((msg) => msg.type !== "debug");
22799
23375
  }, [consoleMessages, config]);
22800
- const errorCount = useMemo33(
23376
+ const errorCount = useMemo34(
22801
23377
  () => filteredConsoleMessages.filter((msg) => msg.type === "error").reduce((total, msg) => total + msg.count, 0),
22802
23378
  [filteredConsoleMessages]
22803
23379
  );
22804
23380
  const nightly = props.version.includes("nightly");
22805
23381
  const dialogsVisible = pendingUserQuestion !== void 0 || !!confirmationRequest || !!customDialog || isThemeDialogOpen || isSettingsDialogOpen || isEditorDialogOpen;
22806
- const pendingHistoryItems = useMemo33(
23382
+ const pendingHistoryItems = useMemo34(
22807
23383
  () => pendingShellHistoryItem ? [pendingShellHistoryItem] : [],
22808
23384
  [pendingShellHistoryItem]
22809
23385
  );
22810
- const uiState = useMemo33(
23386
+ const uiState = useMemo34(
22811
23387
  () => ({
22812
23388
  history: historyManager.history,
22813
23389
  isThemeDialogOpen,
@@ -22929,7 +23505,7 @@ ${queuedText}` : queuedText;
22929
23505
  settingsNonce
22930
23506
  ]
22931
23507
  );
22932
- const uiActions = useMemo33(
23508
+ const uiActions = useMemo34(
22933
23509
  () => ({
22934
23510
  handleThemeSelect,
22935
23511
  closeThemeDialog,
@@ -22971,22 +23547,22 @@ ${queuedText}` : queuedText;
22971
23547
  setEmbeddedShellFocused
22972
23548
  ]
22973
23549
  );
22974
- return /* @__PURE__ */ jsx91(UIStateContext.Provider, { value: uiState, children: /* @__PURE__ */ jsx91(UIActionsContext.Provider, { value: uiActions, children: /* @__PURE__ */ jsx91(ConfigContext.Provider, { value: config, children: /* @__PURE__ */ jsx91(
23550
+ return /* @__PURE__ */ jsx94(UIStateContext.Provider, { value: uiState, children: /* @__PURE__ */ jsx94(UIActionsContext.Provider, { value: uiActions, children: /* @__PURE__ */ jsx94(ConfigContext.Provider, { value: config, children: /* @__PURE__ */ jsx94(
22975
23551
  AppContext.Provider,
22976
23552
  {
22977
23553
  value: {
22978
23554
  version: props.version,
22979
23555
  startupWarnings: props.startupWarnings || []
22980
23556
  },
22981
- children: /* @__PURE__ */ jsx91(ApprovalRuntimeProvider, { runtime: approvalRuntime, children: /* @__PURE__ */ jsx91(UserQuestionRuntimeProvider, { runtime: userQuestionRuntime, children: /* @__PURE__ */ jsx91(ShellFocusContext.Provider, { value: isFocused, children: /* @__PURE__ */ jsx91(App, {}) }) }) })
23557
+ children: /* @__PURE__ */ jsx94(ApprovalRuntimeProvider, { runtime: approvalRuntime, children: /* @__PURE__ */ jsx94(UserQuestionRuntimeProvider, { runtime: userQuestionRuntime, children: /* @__PURE__ */ jsx94(ShellFocusContext.Provider, { value: isFocused, children: /* @__PURE__ */ jsx94(App, {}) }) }) })
22982
23558
  }
22983
23559
  ) }) }) });
22984
23560
  };
22985
23561
 
22986
23562
  // src/ui/root.tsx
22987
- import React20 from "react";
23563
+ import React21 from "react";
22988
23564
  import { render } from "ink";
22989
- import { jsx as jsx92 } from "react/jsx-runtime";
23565
+ import { jsx as jsx95 } from "react/jsx-runtime";
22990
23566
  var SLOW_RENDER_MS = 200;
22991
23567
  function validateDnsResolutionOrder(order) {
22992
23568
  const defaultValue = "ipv4first";
@@ -23018,7 +23594,7 @@ ${reason.stack}` : ""}`;
23018
23594
  }
23019
23595
  });
23020
23596
  }
23021
- async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), initializationResult, conversationRuntime, approvalRuntime, userQuestionRuntime, commandRuntime, permissionSelectionRuntime, toolCatalogRuntime, promptCompletionRuntime, promptInputRuntime, modelSelectionRuntime, sessionManagementRuntime, initialPrompt) {
23597
+ async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), initializationResult, conversationRuntime, approvalRuntime, userQuestionRuntime, commandRuntime, permissionSelectionRuntime, toolCatalogRuntime, promptCompletionRuntime, promptInputRuntime, modelSelectionRuntime, sessionManagementRuntime, initialPrompt, providerSetupRuntime) {
23022
23598
  const useAlternateBuffer2 = shouldEnterAlternateScreen(
23023
23599
  isAlternateBufferEnabled(settings),
23024
23600
  config.getScreenReader()
@@ -23034,17 +23610,17 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
23034
23610
  const version = await getVersion();
23035
23611
  const AppWrapper = () => {
23036
23612
  useKittyKeyboardProtocol();
23037
- return /* @__PURE__ */ jsx92(SettingsContext.Provider, { value: settings, children: /* @__PURE__ */ jsx92(
23613
+ return /* @__PURE__ */ jsx95(SettingsContext.Provider, { value: settings, children: /* @__PURE__ */ jsx95(
23038
23614
  KeypressProvider,
23039
23615
  {
23040
23616
  config,
23041
23617
  debugKeystrokeLogging: settings.merged.general.debugKeystrokeLogging,
23042
- children: /* @__PURE__ */ jsx92(
23618
+ children: /* @__PURE__ */ jsx95(
23043
23619
  MouseProvider,
23044
23620
  {
23045
23621
  mouseEventsEnabled,
23046
23622
  debugKeystrokeLogging: settings.merged.general.debugKeystrokeLogging,
23047
- children: /* @__PURE__ */ jsx92(ScrollProvider, { children: /* @__PURE__ */ jsx92(SessionStatsProvider, { conversationRuntime, children: /* @__PURE__ */ jsx92(VimModeProvider, { settings, children: /* @__PURE__ */ jsx92(
23623
+ children: /* @__PURE__ */ jsx95(ScrollProvider, { children: /* @__PURE__ */ jsx95(SessionStatsProvider, { conversationRuntime, children: /* @__PURE__ */ jsx95(VimModeProvider, { settings, children: /* @__PURE__ */ jsx95(
23048
23624
  AppContainer,
23049
23625
  {
23050
23626
  config,
@@ -23055,6 +23631,7 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
23055
23631
  promptCompletionRuntime,
23056
23632
  promptInputRuntime,
23057
23633
  modelSelectionRuntime,
23634
+ providerSetupRuntime,
23058
23635
  sessionManagementRuntime,
23059
23636
  approvalRuntime,
23060
23637
  userQuestionRuntime,
@@ -23071,7 +23648,7 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
23071
23648
  };
23072
23649
  const { stdout: inkStdout, stderr: inkStderr } = createWorkingStdio();
23073
23650
  const instance = render(
23074
- process.env["DEBUG"] ? /* @__PURE__ */ jsx92(React20.StrictMode, { children: /* @__PURE__ */ jsx92(AppWrapper, {}) }) : /* @__PURE__ */ jsx92(AppWrapper, {}),
23651
+ process.env["DEBUG"] ? /* @__PURE__ */ jsx95(React21.StrictMode, { children: /* @__PURE__ */ jsx95(AppWrapper, {}) }) : /* @__PURE__ */ jsx95(AppWrapper, {}),
23075
23652
  {
23076
23653
  stdout: inkStdout,
23077
23654
  stderr: inkStderr,
@@ -23176,7 +23753,8 @@ async function main(options) {
23176
23753
  options.promptInputRuntime,
23177
23754
  options.modelSelectionRuntime,
23178
23755
  options.sessionManagementRuntime,
23179
- options.initialPrompt
23756
+ options.initialPrompt,
23757
+ options.providerSetupRuntime
23180
23758
  );
23181
23759
  }
23182
23760
  }
@@ -24233,7 +24811,8 @@ var DshModelSelectionRuntime = class _DshModelSelectionRuntime {
24233
24811
  } catch (rollbackError) {
24234
24812
  throw new AggregateError(
24235
24813
  [cause, rollbackError],
24236
- "Unable to activate the selected model or restore the previous default."
24814
+ "Unable to activate the selected model or restore the previous default.",
24815
+ { cause: rollbackError }
24237
24816
  );
24238
24817
  }
24239
24818
  throw cause;
@@ -24244,13 +24823,11 @@ var DshModelSelectionRuntime = class _DshModelSelectionRuntime {
24244
24823
  }
24245
24824
  async assertCurrentSupportsImages(signal) {
24246
24825
  if (this.snapshot.current.inputModalities.includes("image")) return;
24247
- const models = await this.listModels(signal);
24248
- const replacement = models.find(
24249
- (candidate) => candidate.provider === this.snapshot.current.provider && candidate.inputModalities.includes("image")
24250
- );
24826
+ signal?.throwIfAborted();
24251
24827
  const current = modelSelectionLabel(this.snapshot.current);
24252
- const suggestion = replacement ? ` Run /model set ${replacement.provider} ${replacement.model} to start a new Agent.` : " Select an image-capable model with /model list.";
24253
- throw new Error(`Current model ${current} does not support image input.${suggestion}`);
24828
+ throw new Error(
24829
+ `Current model ${current} does not support image input. Run /model and select an image-capable model to start a new Agent.`
24830
+ );
24254
24831
  }
24255
24832
  adoptCurrent(selection) {
24256
24833
  this.snapshot = { ...this.snapshot, current: selection };
@@ -24855,6 +25432,175 @@ var DshPermissionSelectionRuntime = class {
24855
25432
  }
24856
25433
  };
24857
25434
 
25435
+ // src/dsh/provider-setup-runtime.ts
25436
+ import { credentialRef } from "@deepseek-ai/dsh-credentials";
25437
+ var DEEPSEEK_SETTINGS_NAMESPACE = "llm-deepseek";
25438
+ var DEFAULT_DEEPSEEK_CREDENTIAL = "DEEPSEEK_API_KEY";
25439
+ function throwIfAborted2(signal) {
25440
+ if (signal?.aborted) {
25441
+ throw new DOMException("The operation was aborted.", "AbortError");
25442
+ }
25443
+ }
25444
+ function valueAtPath(value, path16) {
25445
+ let current = value;
25446
+ for (const segment of path16) {
25447
+ if (typeof current !== "object" || current === null) return void 0;
25448
+ current = current[segment];
25449
+ }
25450
+ return current;
25451
+ }
25452
+ var DshProviderSetupRuntime = class _DshProviderSetupRuntime {
25453
+ constructor(credentials, settings, llm, currentProvider, current) {
25454
+ this.credentials = credentials;
25455
+ this.settings = settings;
25456
+ this.llm = llm;
25457
+ this.currentProvider = currentProvider;
25458
+ this.snapshot = { current };
25459
+ }
25460
+ listeners = /* @__PURE__ */ new Set();
25461
+ snapshot;
25462
+ static async create(credentials, settings, llm, currentProvider) {
25463
+ const provider = currentProvider();
25464
+ const runtime = new _DshProviderSetupRuntime(
25465
+ credentials,
25466
+ settings,
25467
+ llm,
25468
+ currentProvider,
25469
+ {
25470
+ provider,
25471
+ displayName: provider,
25472
+ status: "unsupported",
25473
+ writable: false
25474
+ }
25475
+ );
25476
+ await runtime.refreshCurrent();
25477
+ return runtime;
25478
+ }
25479
+ getSnapshot = () => this.snapshot;
25480
+ subscribe = (listener) => {
25481
+ this.listeners.add(listener);
25482
+ return () => this.listeners.delete(listener);
25483
+ };
25484
+ async listProviders(signal) {
25485
+ throwIfAborted2(signal);
25486
+ return Promise.all(
25487
+ this.llm.listConfigurableProviders().map(async (entry) => {
25488
+ try {
25489
+ return await this.describeProvider(entry.provider, signal);
25490
+ } catch (error) {
25491
+ if (signal?.aborted) throw error;
25492
+ return {
25493
+ provider: entry.provider,
25494
+ displayName: entry.displayName,
25495
+ status: "error",
25496
+ writable: false,
25497
+ message: error instanceof Error ? error.message : "Provider configuration could not be inspected."
25498
+ };
25499
+ }
25500
+ })
25501
+ );
25502
+ }
25503
+ async describeProvider(provider, signal) {
25504
+ throwIfAborted2(signal);
25505
+ const entry = this.llm.listConfigurableProviders().find((candidate) => candidate.provider === provider);
25506
+ if (!entry) {
25507
+ return {
25508
+ provider,
25509
+ displayName: provider,
25510
+ status: "unsupported",
25511
+ writable: false,
25512
+ message: "This provider does not expose DSH-managed setup."
25513
+ };
25514
+ }
25515
+ const credentialName = this.credentialName(entry);
25516
+ if (!credentialName) {
25517
+ return {
25518
+ provider,
25519
+ displayName: entry.displayName,
25520
+ status: "unsupported",
25521
+ writable: false,
25522
+ message: "This provider uses a setup flow that is not available in DSH Console yet."
25523
+ };
25524
+ }
25525
+ const info = await this.credentials.describe(credentialRef(credentialName));
25526
+ throwIfAborted2(signal);
25527
+ return {
25528
+ provider,
25529
+ displayName: entry.displayName,
25530
+ status: info.configured ? "configured" : "missing",
25531
+ credentialLabel: credentialName,
25532
+ ...info.source === void 0 ? {} : { source: info.source },
25533
+ writable: info.writable
25534
+ };
25535
+ }
25536
+ async configure(provider, value, signal) {
25537
+ const normalized = value.trim();
25538
+ if (normalized.length === 0) throw new Error("API key cannot be empty.");
25539
+ if (normalized.length > 16384) throw new Error("API key is too long.");
25540
+ throwIfAborted2(signal);
25541
+ const before = await this.describeProvider(provider, signal);
25542
+ if (!before.credentialLabel || before.status === "unsupported") {
25543
+ throw new Error(
25544
+ before.message ?? "This provider cannot be configured here."
25545
+ );
25546
+ }
25547
+ if (!before.writable) {
25548
+ throw new Error(
25549
+ `${before.credentialLabel} is supplied by a read-only source and cannot be changed here.`
25550
+ );
25551
+ }
25552
+ try {
25553
+ await this.credentials.set(
25554
+ credentialRef(before.credentialLabel),
25555
+ normalized
25556
+ );
25557
+ } catch {
25558
+ throw new Error(
25559
+ `Unable to save ${before.credentialLabel} through the DSH credentials service.`
25560
+ );
25561
+ }
25562
+ const configured = await this.describeProvider(provider);
25563
+ if (provider === this.currentProvider()) this.publish(configured);
25564
+ throwIfAborted2(signal);
25565
+ return configured;
25566
+ }
25567
+ async refreshCurrent(signal) {
25568
+ const provider = this.currentProvider();
25569
+ try {
25570
+ this.publish(await this.describeProvider(provider, signal));
25571
+ } catch (error) {
25572
+ if (signal?.aborted) throw error;
25573
+ this.publish({
25574
+ provider,
25575
+ displayName: provider,
25576
+ status: "error",
25577
+ writable: false,
25578
+ message: error instanceof Error ? error.message : "Provider configuration failed."
25579
+ });
25580
+ }
25581
+ }
25582
+ credentialName(entry) {
25583
+ if (String(entry.settingsNs) !== DEEPSEEK_SETTINGS_NAMESPACE) {
25584
+ return void 0;
25585
+ }
25586
+ const descriptor = this.settings.describe({ redactSecrets: true }).find(
25587
+ (candidate) => String(candidate.ns) === String(entry.settingsNs)
25588
+ );
25589
+ const profile = valueAtPath(descriptor?.value, entry.settingsPath);
25590
+ if (typeof profile === "object" && profile !== null) {
25591
+ const configured = profile["apiKeyEnv"];
25592
+ if (typeof configured === "string" && configured.length > 0) {
25593
+ return configured;
25594
+ }
25595
+ }
25596
+ return DEFAULT_DEEPSEEK_CREDENTIAL;
25597
+ }
25598
+ publish(current) {
25599
+ this.snapshot = { current };
25600
+ for (const listener of this.listeners) listener();
25601
+ }
25602
+ };
25603
+
24858
25604
  // src/dsh/index.ts
24859
25605
  var name = "dsh-console-runner";
24860
25606
  var inject = [
@@ -24868,7 +25614,9 @@ var inject = [
24868
25614
  "approval",
24869
25615
  "userQuestions",
24870
25616
  "commands",
24871
- "sessionProjections"
25617
+ "sessionProjections",
25618
+ "credentials",
25619
+ "settings"
24872
25620
  ];
24873
25621
  var Config2 = z2.object({
24874
25622
  prompt: z2.string(),
@@ -24893,6 +25641,8 @@ async function start(ctx, config) {
24893
25641
  const commands = ctx.get("commands");
24894
25642
  const sessionProjections = ctx.get("sessionProjections");
24895
25643
  const appExit = ctx.get("appExit");
25644
+ const credentials = ctx.get("credentials");
25645
+ const settings = ctx.get("settings");
24896
25646
  if (!attachments)
24897
25647
  throw new Error("dsh-console requires the DSH attachment service");
24898
25648
  if (!sessionQuery)
@@ -24905,6 +25655,10 @@ async function start(ctx, config) {
24905
25655
  throw new Error("dsh-console requires the DSH commands service");
24906
25656
  if (!sessionProjections)
24907
25657
  throw new Error("dsh-console requires the DSH Session projection service");
25658
+ if (!credentials)
25659
+ throw new Error("dsh-console requires the DSH credentials service");
25660
+ if (!settings)
25661
+ throw new Error("dsh-console requires the DSH settings service");
24908
25662
  if (!agents || !defaultModel || !sessions || !tools || !llm || !appExit)
24909
25663
  return;
24910
25664
  const selection = defaultModel.currentSelection();
@@ -24981,6 +25735,12 @@ async function start(ctx, config) {
24981
25735
  }
24982
25736
  };
24983
25737
  let active = await createActiveConversation(selection);
25738
+ const providerSetupRuntime = await DshProviderSetupRuntime.create(
25739
+ credentials,
25740
+ settings,
25741
+ llm,
25742
+ () => activeSelection.provider
25743
+ );
24984
25744
  const approvalRuntime = new DshApprovalRuntime(
24985
25745
  (listener) => ctx.on("approval/request", listener),
24986
25746
  (agent) => agent === active.handle.agent
@@ -25039,6 +25799,7 @@ async function start(ctx, config) {
25039
25799
  previous.offProjector();
25040
25800
  active = next;
25041
25801
  activeSelection = selected;
25802
+ await providerSetupRuntime.refreshCurrent();
25042
25803
  commandRuntime.activeAgentChanged();
25043
25804
  permissionSelectionRuntime.activeAgentChanged();
25044
25805
  toolCatalogRuntime.activeAgentChanged();
@@ -25175,6 +25936,7 @@ async function start(ctx, config) {
25175
25936
  promptCompletionRuntime,
25176
25937
  promptInputRuntime,
25177
25938
  modelSelectionRuntime,
25939
+ providerSetupRuntime,
25178
25940
  sessionManagementRuntime,
25179
25941
  approvalRuntime,
25180
25942
  userQuestionRuntime,