deepcode-ai 1.1.6 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3517,8 +3517,11 @@ Caminho: ${selectedPath}`;
3517
3517
  if (error instanceof BudgetExceededError) {
3518
3518
  throw error;
3519
3519
  }
3520
- session.metadata.planError = error instanceof Error ? error.message : String(error);
3521
- this.eventBus.emit("app:warn", { message: `Task planning failed: ${session.metadata.planError}. Continuing without structured plan.` });
3520
+ session.metadata.planError = formatErrorChain(error);
3521
+ this.eventBus.emit("app:warn", {
3522
+ message: formatPlanningFailureWarning(error),
3523
+ context: { error: session.metadata.planError }
3524
+ });
3522
3525
  }
3523
3526
  }
3524
3527
  let finalText = "";
@@ -4284,6 +4287,45 @@ ${assistantText}` : assistantText;
4284
4287
  }
4285
4288
  }
4286
4289
  };
4290
+ function formatPlanningFailureWarning(error) {
4291
+ if (error instanceof ProviderError) {
4292
+ const provider = formatProviderName(error.provider);
4293
+ const status = typeof error.statusCode === "number" ? ` (${error.statusCode})` : "";
4294
+ if (error.statusCode === 429) {
4295
+ return `Task planning skipped: ${provider} rate limit hit${status}. Continuing without structured plan.`;
4296
+ }
4297
+ if (error.statusCode && error.statusCode >= 500) {
4298
+ return `Task planning skipped: ${provider} returned a temporary service error${status}. Continuing without structured plan.`;
4299
+ }
4300
+ return `Task planning failed: ${compactPlanningError(error.message)}. Continuing without structured plan.`;
4301
+ }
4302
+ const detail = error instanceof Error ? error.message : String(error);
4303
+ return `Task planning failed: ${compactPlanningError(detail)}. Continuing without structured plan.`;
4304
+ }
4305
+ function compactPlanningError(message) {
4306
+ const firstLine2 = message.replace(/\s+/g, " ").trim();
4307
+ return firstLine2.length > 240 ? `${firstLine2.slice(0, 237)}...` : firstLine2;
4308
+ }
4309
+ function formatProviderName(provider) {
4310
+ switch (provider) {
4311
+ case "openrouter":
4312
+ return "OpenRouter";
4313
+ case "openai":
4314
+ return "OpenAI";
4315
+ case "anthropic":
4316
+ return "Anthropic";
4317
+ case "deepseek":
4318
+ return "DeepSeek";
4319
+ case "groq":
4320
+ return "Groq";
4321
+ case "ollama":
4322
+ return "Ollama";
4323
+ case "opencode":
4324
+ return "OpenCode";
4325
+ default:
4326
+ return provider;
4327
+ }
4328
+ }
4287
4329
  function truncateForMetadata(value, maxLength = 2e3) {
4288
4330
  return value.length > maxLength ? `${value.slice(0, maxLength)}...` : value;
4289
4331
  }
@@ -4438,6 +4480,9 @@ var McpManager = class {
4438
4480
  }
4439
4481
  return tools;
4440
4482
  }
4483
+ get connectedCount() {
4484
+ return this.clients.length;
4485
+ }
4441
4486
  stop() {
4442
4487
  for (const { client } of this.clients) {
4443
4488
  try {
@@ -7608,8 +7653,8 @@ import path32 from "path";
7608
7653
  import { jsx, jsxs } from "react/jsx-runtime";
7609
7654
  import fs6 from "fs";
7610
7655
  import path112 from "path";
7611
- import { isValidElement, useCallback as useCallback22, useEffect as useEffect24, useMemo as useMemo15, useRef as useRef16, useState as useState25 } from "react";
7612
- import { Box as Box38, Text as Text44, useInput as useInput4, useStdin as useStdin3 } from "ink";
7656
+ import { isValidElement, useCallback as useCallback22, useEffect as useEffect25, useMemo as useMemo15, useRef as useRef16, useState as useState26 } from "react";
7657
+ import { Box as Box38, Text as Text45, useInput as useInput4, useStdin as useStdin3 } from "ink";
7613
7658
  import os4 from "os";
7614
7659
  import path62 from "path";
7615
7660
  import fs from "fs";
@@ -9529,8 +9574,8 @@ import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
9529
9574
  import { Box as Box22, Text as Text25 } from "ink";
9530
9575
  import { jsxs as jsxs21 } from "react/jsx-runtime";
9531
9576
  import { jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
9532
- import { Box as Box31, Text as Text37, useIsScreenReaderEnabled as useIsScreenReaderEnabled3 } from "ink";
9533
- import { useCallback as useCallback16, useState as useState20 } from "react";
9577
+ import { Box as Box31, Text as Text38, useIsScreenReaderEnabled as useIsScreenReaderEnabled3 } from "ink";
9578
+ import { useCallback as useCallback16, useState as useState21 } from "react";
9534
9579
  import { useRef as useRef7 } from "react";
9535
9580
  import { Box as Box24, Text as Text26 } from "ink";
9536
9581
  import { useEffect as useEffect13, useState as useState11 } from "react";
@@ -9563,45 +9608,50 @@ import { Box as Box26, Text as Text29 } from "ink";
9563
9608
  import chalk2 from "chalk";
9564
9609
  import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
9565
9610
  import { Fragment as Fragment7, jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
9566
- import { Box as Box28, Text as Text34 } from "ink";
9611
+ import { Box as Box28, Text as Text35 } from "ink";
9567
9612
  import { Text as Text31 } from "ink";
9568
9613
  import { Fragment as Fragment8, jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
9569
9614
  import { Text as Text32 } from "ink";
9570
9615
  import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
9571
9616
  import { Text as Text33 } from "ink";
9572
9617
  import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
9618
+ import { Text as Text34 } from "ink";
9619
+ import { jsxs as jsxs31 } from "react/jsx-runtime";
9620
+ import { useState as useState19, useEffect as useEffect222 } from "react";
9621
+ import { execFile as execFile22 } from "child_process";
9622
+ import os42 from "os";
9573
9623
  import {
9574
9624
  createContext as createContext8,
9575
9625
  useCallback as useCallback15,
9576
9626
  useContext as useContext9,
9577
- useState as useState19
9627
+ useState as useState20
9578
9628
  } from "react";
9579
9629
  import { jsx as jsx36 } from "react/jsx-runtime";
9580
- import { jsx as jsx37, jsxs as jsxs31 } from "react/jsx-runtime";
9630
+ import { jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
9581
9631
  import { useRef as useRef12 } from "react";
9582
- import { Box as Box29, Text as Text35 } from "ink";
9583
- import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
9584
- import { Box as Box30, Text as Text36 } from "ink";
9585
- import { jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
9586
- import { jsx as jsx40, jsxs as jsxs34 } from "react/jsx-runtime";
9587
- import { Box as Box32, Text as Text38 } from "ink";
9588
- import { jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
9632
+ import { Box as Box29, Text as Text36 } from "ink";
9633
+ import { jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
9634
+ import { Box as Box30, Text as Text37 } from "ink";
9635
+ import { jsx as jsx39, jsxs as jsxs34 } from "react/jsx-runtime";
9636
+ import { jsx as jsx40, jsxs as jsxs35 } from "react/jsx-runtime";
9637
+ import { Box as Box32, Text as Text39 } from "ink";
9638
+ import { jsx as jsx41, jsxs as jsxs36 } from "react/jsx-runtime";
9589
9639
  import { useCallback as useCallback17, useMemo as useMemo10, useRef as useRef13 } from "react";
9590
- import { Box as Box33, Text as Text39 } from "ink";
9591
- import { jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
9592
- import { useCallback as useCallback18, useMemo as useMemo11, useState as useState21 } from "react";
9593
- import { Box as Box34, Text as Text40, useInput as useInput2 } from "ink";
9594
- import { Fragment as Fragment9, jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
9595
- import { useCallback as useCallback19, useMemo as useMemo12, useState as useState222 } from "react";
9596
- import { Box as Box35, Text as Text41 } from "ink";
9597
- import { jsx as jsx44, jsxs as jsxs38 } from "react/jsx-runtime";
9598
- import { useCallback as useCallback20, useEffect as useEffect222, useMemo as useMemo13, useRef as useRef14, useState as useState23 } from "react";
9599
- import { Box as Box36, Text as Text42 } from "ink";
9600
- import { jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
9601
- import { useCallback as useCallback21, useEffect as useEffect23, useMemo as useMemo14, useRef as useRef15, useState as useState24 } from "react";
9602
- import { Box as Box37, Text as Text43, useInput as useInput3 } from "ink";
9603
- import { jsx as jsx46, jsxs as jsxs40 } from "react/jsx-runtime";
9604
- import { jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
9640
+ import { Box as Box33, Text as Text40 } from "ink";
9641
+ import { jsx as jsx42, jsxs as jsxs37 } from "react/jsx-runtime";
9642
+ import { useCallback as useCallback18, useMemo as useMemo11, useState as useState222 } from "react";
9643
+ import { Box as Box34, Text as Text41, useInput as useInput2 } from "ink";
9644
+ import { Fragment as Fragment9, jsx as jsx43, jsxs as jsxs38 } from "react/jsx-runtime";
9645
+ import { useCallback as useCallback19, useMemo as useMemo12, useState as useState23 } from "react";
9646
+ import { Box as Box35, Text as Text42 } from "ink";
9647
+ import { jsx as jsx44, jsxs as jsxs39 } from "react/jsx-runtime";
9648
+ import { useCallback as useCallback20, useEffect as useEffect23, useMemo as useMemo13, useRef as useRef14, useState as useState24 } from "react";
9649
+ import { Box as Box36, Text as Text43 } from "ink";
9650
+ import { jsx as jsx45, jsxs as jsxs40 } from "react/jsx-runtime";
9651
+ import { useCallback as useCallback21, useEffect as useEffect24, useMemo as useMemo14, useRef as useRef15, useState as useState25 } from "react";
9652
+ import { Box as Box37, Text as Text44, useInput as useInput3 } from "ink";
9653
+ import { jsx as jsx46, jsxs as jsxs41 } from "react/jsx-runtime";
9654
+ import { jsx as jsx47, jsxs as jsxs42 } from "react/jsx-runtime";
9605
9655
  import { jsx as jsx48 } from "react/jsx-runtime";
9606
9656
  async function createRuntime(options) {
9607
9657
  const worktree = path9.resolve(options.cwd);
@@ -24906,12 +24956,9 @@ var parseSlashCommand = (query, commands) => {
24906
24956
  let pathIndex = 0;
24907
24957
  const canonicalPath = [];
24908
24958
  for (const part of commandPath) {
24909
- let foundCommand = currentCommands.find((cmd) => cmd.name === part);
24910
- if (!foundCommand) {
24911
- foundCommand = currentCommands.find(
24912
- (cmd) => cmd.altNames?.includes(part)
24913
- );
24914
- }
24959
+ const foundCommand = currentCommands.find(
24960
+ (cmd) => cmd.name === part || cmd.altNames?.includes(part)
24961
+ );
24915
24962
  if (foundCommand) {
24916
24963
  commandToExecute = foundCommand;
24917
24964
  canonicalPath.push(foundCommand.name);
@@ -26836,10 +26883,35 @@ function BackgroundTasksPill() {
26836
26883
  return null;
26837
26884
  }
26838
26885
  function MCPHealthPill() {
26839
- return null;
26886
+ const { mcpConnected, mcpTotal } = useUIState();
26887
+ if (mcpTotal === 0) return null;
26888
+ const color = mcpConnected === mcpTotal ? theme.status.success : theme.status.warning;
26889
+ return /* @__PURE__ */ jsxs31(Text34, { color, children: [
26890
+ " MCP ",
26891
+ mcpConnected,
26892
+ "/",
26893
+ mcpTotal
26894
+ ] });
26840
26895
  }
26841
26896
  function useStatusLine() {
26842
- return { lines: [] };
26897
+ const config = useConfig();
26898
+ const cwd = config.getWorkingDir();
26899
+ const [line, setLine] = useState19(null);
26900
+ useEffect222(() => {
26901
+ let cancelled = false;
26902
+ execFile22("git", ["branch", "--show-current"], { cwd }, (err, stdout) => {
26903
+ if (cancelled) return;
26904
+ const branch = err ? null : stdout.trim();
26905
+ if (!branch) return;
26906
+ const home = os42.homedir();
26907
+ const displayCwd = cwd.startsWith(home) ? `~${cwd.slice(home.length)}` : cwd;
26908
+ setLine(`${displayCwd} [${branch}]`);
26909
+ });
26910
+ return () => {
26911
+ cancelled = true;
26912
+ };
26913
+ }, [cwd]);
26914
+ return { lines: line ? [line] : [] };
26843
26915
  }
26844
26916
  function useConfigInitMessage(_isConfigInitialized) {
26845
26917
  return null;
@@ -26849,8 +26921,8 @@ var VimModeProvider = ({
26849
26921
  children,
26850
26922
  initialVimEnabled = false
26851
26923
  }) => {
26852
- const [vimEnabled, setVimEnabled] = useState19(initialVimEnabled);
26853
- const [vimMode, setVimMode] = useState19(
26924
+ const [vimEnabled, setVimEnabled] = useState20(initialVimEnabled);
26925
+ const [vimMode, setVimMode] = useState20(
26854
26926
  initialVimEnabled ? "NORMAL" : "INSERT"
26855
26927
  );
26856
26928
  const toggleVimEnabled = useCallback15(async () => {
@@ -26891,16 +26963,16 @@ var Footer = () => {
26891
26963
  const debugMode = config.getDebugMode();
26892
26964
  const contextWindowSize = config.getContentGeneratorConfig()?.contextWindowSize;
26893
26965
  const suppressHint = statusLineLines.length > 0;
26894
- const leftBottomContent = uiState.ctrlCPressedOnce ? /* @__PURE__ */ jsx37(Text34, { color: theme.status.warning, children: t("Press Ctrl+C again to exit.") }) : uiState.ctrlDPressedOnce ? /* @__PURE__ */ jsx37(Text34, { color: theme.status.warning, children: t("Press Ctrl+D again to exit.") }) : uiState.showEscapePrompt ? /* @__PURE__ */ jsx37(Text34, { color: theme.text.secondary, children: t("Press Esc again to clear.") }) : uiState.rewindEscPending ? /* @__PURE__ */ jsx37(Text34, { color: theme.text.secondary, children: t("Press Esc again to rewind conversation.") }) : vimEnabled && vimMode === "INSERT" ? /* @__PURE__ */ jsx37(Text34, { color: theme.text.secondary, children: "-- INSERT --" }) : uiState.shellModeActive ? /* @__PURE__ */ jsx37(ShellModeIndicator, {}) : configInitMessage ? /* @__PURE__ */ jsxs31(Text34, { color: theme.text.secondary, children: [
26966
+ const leftBottomContent = uiState.ctrlCPressedOnce ? /* @__PURE__ */ jsx37(Text35, { color: theme.status.warning, children: t("Press Ctrl+C again to exit.") }) : uiState.ctrlDPressedOnce ? /* @__PURE__ */ jsx37(Text35, { color: theme.status.warning, children: t("Press Ctrl+D again to exit.") }) : uiState.showEscapePrompt ? /* @__PURE__ */ jsx37(Text35, { color: theme.text.secondary, children: t("Press Esc again to clear.") }) : uiState.rewindEscPending ? /* @__PURE__ */ jsx37(Text35, { color: theme.text.secondary, children: t("Press Esc again to rewind conversation.") }) : vimEnabled && vimMode === "INSERT" ? /* @__PURE__ */ jsx37(Text35, { color: theme.text.secondary, children: "-- INSERT --" }) : uiState.shellModeActive ? /* @__PURE__ */ jsx37(ShellModeIndicator, {}) : configInitMessage ? /* @__PURE__ */ jsxs32(Text35, { color: theme.text.secondary, children: [
26895
26967
  /* @__PURE__ */ jsx37(GeminiSpinner, {}),
26896
26968
  " ",
26897
26969
  configInitMessage
26898
- ] }) : showAutoAcceptIndicator !== void 0 && showAutoAcceptIndicator !== "default" ? /* @__PURE__ */ jsx37(AutoAcceptIndicator, { approvalMode: showAutoAcceptIndicator }) : suppressHint ? null : /* @__PURE__ */ jsx37(Text34, { color: theme.text.secondary, children: t("? for shortcuts") });
26970
+ ] }) : showAutoAcceptIndicator !== void 0 && showAutoAcceptIndicator !== "default" ? /* @__PURE__ */ jsx37(AutoAcceptIndicator, { approvalMode: showAutoAcceptIndicator }) : suppressHint ? null : /* @__PURE__ */ jsx37(Text35, { color: theme.text.secondary, children: t("? for shortcuts") });
26899
26971
  const rightItems = [];
26900
26972
  if (sandboxInfo) {
26901
26973
  rightItems.push({
26902
26974
  key: "sandbox",
26903
- node: /* @__PURE__ */ jsxs31(Text34, { color: theme.status.success, children: [
26975
+ node: /* @__PURE__ */ jsxs32(Text35, { color: theme.status.success, children: [
26904
26976
  "\u{1F512} ",
26905
26977
  sandboxInfo
26906
26978
  ] })
@@ -26909,13 +26981,13 @@ var Footer = () => {
26909
26981
  if (debugMode) {
26910
26982
  rightItems.push({
26911
26983
  key: "debug",
26912
- node: /* @__PURE__ */ jsx37(Text34, { color: theme.status.warning, children: "Debug Mode" })
26984
+ node: /* @__PURE__ */ jsx37(Text35, { color: theme.status.warning, children: "Debug Mode" })
26913
26985
  });
26914
26986
  }
26915
26987
  if (promptTokenCount > 0 && contextWindowSize) {
26916
26988
  rightItems.push({
26917
26989
  key: "context",
26918
- node: /* @__PURE__ */ jsx37(Text34, { color: theme.text.accent, children: /* @__PURE__ */ jsx37(
26990
+ node: /* @__PURE__ */ jsx37(Text35, { color: theme.text.accent, children: /* @__PURE__ */ jsx37(
26919
26991
  ContextUsageDisplay,
26920
26992
  {
26921
26993
  promptTokenCount,
@@ -26925,7 +26997,7 @@ var Footer = () => {
26925
26997
  ) })
26926
26998
  });
26927
26999
  }
26928
- return /* @__PURE__ */ jsxs31(
27000
+ return /* @__PURE__ */ jsxs32(
26929
27001
  Box28,
26930
27002
  {
26931
27003
  flexDirection: isNarrow ? "column" : "row",
@@ -26934,16 +27006,16 @@ var Footer = () => {
26934
27006
  paddingX: 2,
26935
27007
  gap: isNarrow ? 0 : 1,
26936
27008
  children: [
26937
- /* @__PURE__ */ jsxs31(Box28, { flexDirection: "column", flexShrink: isNarrow ? 0 : 1, children: [
26938
- statusLineLines.length > 0 && !uiState.ctrlCPressedOnce && !uiState.ctrlDPressedOnce && statusLineLines.map((line, i) => /* @__PURE__ */ jsx37(Text34, { dimColor: true, wrap: "truncate", children: line }, `status-line-${i}`)),
26939
- /* @__PURE__ */ jsxs31(Box28, { flexDirection: "row", flexShrink: 1, children: [
26940
- /* @__PURE__ */ jsx37(Text34, { wrap: "truncate", children: leftBottomContent }),
27009
+ /* @__PURE__ */ jsxs32(Box28, { flexDirection: "column", flexShrink: isNarrow ? 0 : 1, children: [
27010
+ statusLineLines.length > 0 && !uiState.ctrlCPressedOnce && !uiState.ctrlDPressedOnce && statusLineLines.map((line, i) => /* @__PURE__ */ jsx37(Text35, { dimColor: true, wrap: "truncate", children: line }, `status-line-${i}`)),
27011
+ /* @__PURE__ */ jsxs32(Box28, { flexDirection: "row", flexShrink: 1, children: [
27012
+ /* @__PURE__ */ jsx37(Text35, { wrap: "truncate", children: leftBottomContent }),
26941
27013
  /* @__PURE__ */ jsx37(BackgroundTasksPill, {}),
26942
27014
  /* @__PURE__ */ jsx37(MCPHealthPill, {})
26943
27015
  ] })
26944
27016
  ] }),
26945
- /* @__PURE__ */ jsx37(Box28, { flexShrink: 0, gap: 1, alignItems: "flex-start", children: rightItems.map(({ key, node }, index) => /* @__PURE__ */ jsxs31(Box28, { alignItems: "center", children: [
26946
- index > 0 && /* @__PURE__ */ jsx37(Text34, { color: theme.text.secondary, children: " | " }),
27017
+ /* @__PURE__ */ jsx37(Box28, { flexShrink: 0, gap: 1, alignItems: "flex-start", children: rightItems.map(({ key, node }, index) => /* @__PURE__ */ jsxs32(Box28, { alignItems: "center", children: [
27018
+ index > 0 && /* @__PURE__ */ jsx37(Text35, { color: theme.text.secondary, children: " | " }),
26947
27019
  node
26948
27020
  ] }, key)) })
26949
27021
  ]
@@ -26966,17 +27038,17 @@ var QueuedMessageDisplay = ({
26966
27038
  wasEmptyRef.current = false;
26967
27039
  }
26968
27040
  const showHint = hintSeenCountRef.current <= NUM_TIMES_QUEUE_HINT_SHOWN;
26969
- return /* @__PURE__ */ jsxs32(Box29, { flexDirection: "column", marginTop: 1, children: [
27041
+ return /* @__PURE__ */ jsxs33(Box29, { flexDirection: "column", marginTop: 1, children: [
26970
27042
  messageQueue.slice(0, MAX_DISPLAYED_QUEUED_MESSAGES).map((message, index) => {
26971
27043
  const preview = message.replace(/\s+/g, " ");
26972
- return /* @__PURE__ */ jsx38(Box29, { paddingLeft: 2, width: "100%", children: /* @__PURE__ */ jsx38(Text35, { dimColor: true, wrap: "truncate", children: preview }) }, index);
27044
+ return /* @__PURE__ */ jsx38(Box29, { paddingLeft: 2, width: "100%", children: /* @__PURE__ */ jsx38(Text36, { dimColor: true, wrap: "truncate", children: preview }) }, index);
26973
27045
  }),
26974
- messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */ jsx38(Box29, { paddingLeft: 2, children: /* @__PURE__ */ jsxs32(Text35, { dimColor: true, children: [
27046
+ messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */ jsx38(Box29, { paddingLeft: 2, children: /* @__PURE__ */ jsxs33(Text36, { dimColor: true, children: [
26975
27047
  "... (+",
26976
27048
  messageQueue.length - MAX_DISPLAYED_QUEUED_MESSAGES,
26977
27049
  " more)"
26978
27050
  ] }) }),
26979
- showHint && /* @__PURE__ */ jsx38(Box29, { paddingLeft: 2, children: /* @__PURE__ */ jsx38(Text35, { dimColor: true, italic: true, children: t("Press \u2191 to edit queued messages") }) })
27051
+ showHint && /* @__PURE__ */ jsx38(Box29, { paddingLeft: 2, children: /* @__PURE__ */ jsx38(Text36, { dimColor: true, italic: true, children: t("Press \u2191 to edit queued messages") }) })
26980
27052
  ] });
26981
27053
  };
26982
27054
  var getNewlineKey = () => process.platform === "win32" ? "ctrl+enter" : "ctrl+j";
@@ -27004,8 +27076,8 @@ var getShortcuts = () => [
27004
27076
  { key: getExternalEditorKey(), description: t("for external editor") },
27005
27077
  { key: "ctrl+o", description: t("to toggle compact mode") }
27006
27078
  ];
27007
- var ShortcutItem = ({ shortcut }) => /* @__PURE__ */ jsxs33(Text36, { color: theme.text.secondary, children: [
27008
- /* @__PURE__ */ jsx39(Text36, { color: theme.text.accent, children: shortcut.key }),
27079
+ var ShortcutItem = ({ shortcut }) => /* @__PURE__ */ jsxs34(Text37, { color: theme.text.secondary, children: [
27080
+ /* @__PURE__ */ jsx39(Text37, { color: theme.text.accent, children: shortcut.key }),
27009
27081
  " ",
27010
27082
  shortcut.description
27011
27083
  ] });
@@ -27089,11 +27161,11 @@ var Composer = () => {
27089
27161
  }
27090
27162
  }
27091
27163
  }
27092
- const [showShortcuts, setShowShortcuts] = useState20(false);
27164
+ const [showShortcuts, setShowShortcuts] = useState21(false);
27093
27165
  const handleToggleShortcuts = useCallback16(() => {
27094
27166
  setShowShortcuts((prev) => !prev);
27095
27167
  }, []);
27096
- const [showSuggestions, setShowSuggestions] = useState20(false);
27168
+ const [showSuggestions, setShowSuggestions] = useState21(false);
27097
27169
  const handleSuggestionsVisibilityChange = useCallback16(
27098
27170
  (visible) => {
27099
27171
  setShowSuggestions(visible);
@@ -27101,7 +27173,7 @@ var Composer = () => {
27101
27173
  },
27102
27174
  [uiActions]
27103
27175
  );
27104
- return /* @__PURE__ */ jsxs34(Box31, { flexDirection: "column", marginTop: 1, children: [
27176
+ return /* @__PURE__ */ jsxs35(Box31, { flexDirection: "column", marginTop: 1, children: [
27105
27177
  !uiState.embeddedShellFocused && !suppressBottomLoadingIndicator && /* @__PURE__ */ jsx40(
27106
27178
  LoadingIndicator,
27107
27179
  {
@@ -27114,7 +27186,7 @@ var Composer = () => {
27114
27186
  isReceivingContent
27115
27187
  }
27116
27188
  ),
27117
- !uiState.embeddedShellFocused && suppressBottomLoadingIndicator && /* @__PURE__ */ jsx40(Box31, { paddingLeft: 2, children: /* @__PURE__ */ jsxs34(Text37, { color: theme.text.secondary, children: [
27189
+ !uiState.embeddedShellFocused && suppressBottomLoadingIndicator && /* @__PURE__ */ jsx40(Box31, { paddingLeft: 2, children: /* @__PURE__ */ jsxs35(Text38, { color: theme.text.secondary, children: [
27118
27190
  "(",
27119
27191
  t("Esc to cancel"),
27120
27192
  ")"
@@ -27408,10 +27480,11 @@ var providerCommand = {
27408
27480
  }
27409
27481
  session.setProvider(parsed.data);
27410
27482
  const state = session.getState();
27483
+ const targetLabel = state.model ? `${state.provider}/${state.model}` : `${state.provider}/(model unset)`;
27411
27484
  return {
27412
27485
  type: "message",
27413
27486
  messageType: "info",
27414
- content: `Provider set to ${state.provider}${state.model ? `/${state.model}` : ""}.`
27487
+ content: `Session provider set: ${targetLabel}. Test connection did not run. Use /model to choose a model if unset.`
27415
27488
  };
27416
27489
  }
27417
27490
  };
@@ -27434,7 +27507,7 @@ var modelCommand = {
27434
27507
  return {
27435
27508
  type: "message",
27436
27509
  messageType: "info",
27437
- content: `Model set to ${state.model ?? "(unset)"}.`
27510
+ content: `Session model set: ${state.provider}/${state.model ?? "(unset)"}.`
27438
27511
  };
27439
27512
  }
27440
27513
  };
@@ -27473,7 +27546,7 @@ Usage: /mode <build|plan>`
27473
27546
  return {
27474
27547
  type: "message",
27475
27548
  messageType: "info",
27476
- content: `Mode set to ${target}.`
27549
+ content: `Mode set: ${target.toUpperCase()}.`
27477
27550
  };
27478
27551
  }
27479
27552
  };
@@ -27521,10 +27594,10 @@ var CommandDialog = ({
27521
27594
  title,
27522
27595
  lines,
27523
27596
  footerText = "Press Esc or Enter to close."
27524
- }) => /* @__PURE__ */ jsx41(Box32, { marginLeft: 2, marginRight: 2, marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsxs35(Box32, { borderStyle: "round", borderColor: theme.border.default, padding: 1, flexDirection: "column", children: [
27525
- /* @__PURE__ */ jsx41(Text38, { bold: true, color: theme.text.accent, children: title }),
27526
- /* @__PURE__ */ jsx41(Box32, { marginTop: 1, flexDirection: "column", children: lines.map((line, index) => /* @__PURE__ */ jsx41(Text38, { color: theme.text.primary, children: line }, index)) }),
27527
- /* @__PURE__ */ jsx41(Box32, { marginTop: 1, children: /* @__PURE__ */ jsx41(Text38, { color: theme.text.secondary, children: footerText }) })
27597
+ }) => /* @__PURE__ */ jsx41(Box32, { marginLeft: 2, marginRight: 2, marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsxs36(Box32, { borderStyle: "round", borderColor: theme.border.default, padding: 1, flexDirection: "column", children: [
27598
+ /* @__PURE__ */ jsx41(Text39, { bold: true, color: theme.text.accent, children: title }),
27599
+ /* @__PURE__ */ jsx41(Box32, { marginTop: 1, flexDirection: "column", children: lines.map((line, index) => /* @__PURE__ */ jsx41(Text39, { color: theme.text.primary, children: line }, index)) }),
27600
+ /* @__PURE__ */ jsx41(Box32, { marginTop: 1, children: /* @__PURE__ */ jsx41(Text39, { color: theme.text.secondary, children: footerText }) })
27528
27601
  ] }) });
27529
27602
  var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
27530
27603
  const originalTheme = useRef13(themeManager.getActiveTheme().name);
@@ -27561,7 +27634,7 @@ var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
27561
27634
  },
27562
27635
  [onPreview]
27563
27636
  );
27564
- return /* @__PURE__ */ jsxs36(
27637
+ return /* @__PURE__ */ jsxs37(
27565
27638
  Box33,
27566
27639
  {
27567
27640
  flexDirection: "column",
@@ -27571,7 +27644,7 @@ var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
27571
27644
  marginLeft: 2,
27572
27645
  marginRight: 2,
27573
27646
  children: [
27574
- /* @__PURE__ */ jsx42(Text39, { bold: true, color: theme.text.accent, children: "Select theme" }),
27647
+ /* @__PURE__ */ jsx42(Text40, { bold: true, color: theme.text.accent, children: "Select theme" }),
27575
27648
  /* @__PURE__ */ jsx42(
27576
27649
  RadioButtonSelect,
27577
27650
  {
@@ -27582,7 +27655,7 @@ var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
27582
27655
  isFocused: true
27583
27656
  }
27584
27657
  ),
27585
- /* @__PURE__ */ jsx42(Text39, { color: theme.text.secondary, children: "\u2191\u2193 navigate \xB7 Enter apply \xB7 Esc cancel" })
27658
+ /* @__PURE__ */ jsx42(Text40, { color: theme.text.secondary, children: "\u2191\u2193 navigate \xB7 Enter apply \xB7 Esc cancel" })
27586
27659
  ]
27587
27660
  }
27588
27661
  );
@@ -27614,16 +27687,17 @@ var ProviderDialog = ({
27614
27687
  hasApiKey,
27615
27688
  getProviderKeyHint,
27616
27689
  onSelectProvider,
27690
+ onSetDefaultProvider,
27617
27691
  onSaveApiKey,
27618
27692
  onTestProvider,
27619
27693
  onClose
27620
27694
  }) => {
27621
- const [phase, setPhase] = useState21("providers");
27622
- const [selectedProvider, setSelectedProvider] = useState21(currentProvider);
27623
- const [apiKeyInput, setApiKeyInput] = useState21("");
27624
- const [isBusy, setIsBusy] = useState21(false);
27625
- const [status, setStatus] = useState21(null);
27626
- const [testLatencyMs, setTestLatencyMs] = useState21(void 0);
27695
+ const [phase, setPhase] = useState222("providers");
27696
+ const [selectedProvider, setSelectedProvider] = useState222(currentProvider);
27697
+ const [apiKeyInput, setApiKeyInput] = useState222("");
27698
+ const [isBusy, setIsBusy] = useState222(false);
27699
+ const [status, setStatus] = useState222(null);
27700
+ const [testLatencyMs, setTestLatencyMs] = useState222(void 0);
27627
27701
  const isLocal = CREDENTIAL_FREE_PROVIDERS.has(selectedProvider);
27628
27702
  const keyIsSet = hasApiKey(selectedProvider);
27629
27703
  const keyHint = getProviderKeyHint(selectedProvider);
@@ -27641,12 +27715,24 @@ var ProviderDialog = ({
27641
27715
  );
27642
27716
  const actionItems = useMemo11(
27643
27717
  () => [
27718
+ {
27719
+ key: "use",
27720
+ value: "use",
27721
+ icon: "\u25CF",
27722
+ label: selectedProvider === currentProvider ? "Current session provider" : "Use provider for this session"
27723
+ },
27644
27724
  {
27645
27725
  key: "editKey",
27646
27726
  value: "editKey",
27647
27727
  icon: "\u270E",
27648
27728
  label: isLocal ? "Edit API key (optional)" : "Edit API key"
27649
27729
  },
27730
+ {
27731
+ key: "setDefault",
27732
+ value: "setDefault",
27733
+ icon: "\u25C6",
27734
+ label: "Set as default in config"
27735
+ },
27650
27736
  {
27651
27737
  key: "test",
27652
27738
  value: "test",
@@ -27668,7 +27754,7 @@ var ProviderDialog = ({
27668
27754
  label: "Close"
27669
27755
  }
27670
27756
  ],
27671
- [canTest, isLocal]
27757
+ [canTest, currentProvider, isLocal, selectedProvider]
27672
27758
  );
27673
27759
  const selectProvider = useCallback18(
27674
27760
  (provider) => {
@@ -27714,16 +27800,33 @@ var ProviderDialog = ({
27714
27800
  void runTest();
27715
27801
  return;
27716
27802
  }
27803
+ if (action === "use") {
27804
+ onSelectProvider(selectedProvider);
27805
+ onClose();
27806
+ return;
27807
+ }
27808
+ if (action === "setDefault") {
27809
+ setIsBusy(true);
27810
+ setStatus({ text: `Saving ${selectedProvider} as default\u2026`, ok: true });
27811
+ void onSetDefaultProvider(selectedProvider).then(() => {
27812
+ setStatus({ text: `Saved ${selectedProvider} as config default.`, ok: true });
27813
+ onClose();
27814
+ }).catch((err) => {
27815
+ setStatus({ text: err instanceof Error ? err.message : String(err), ok: false });
27816
+ }).finally(() => {
27817
+ setIsBusy(false);
27818
+ });
27819
+ return;
27820
+ }
27717
27821
  if (action === "back") {
27718
27822
  setStatus(null);
27719
27823
  setTestLatencyMs(void 0);
27720
27824
  setPhase("providers");
27721
27825
  return;
27722
27826
  }
27723
- onSelectProvider(selectedProvider);
27724
27827
  onClose();
27725
27828
  },
27726
- [isBusy, onClose, onSelectProvider, runTest, selectedProvider]
27829
+ [isBusy, onClose, onSelectProvider, onSetDefaultProvider, runTest, selectedProvider]
27727
27830
  );
27728
27831
  const saveApiKey = useCallback18(async () => {
27729
27832
  const normalized2 = apiKeyInput.trim();
@@ -27782,7 +27885,7 @@ var ProviderDialog = ({
27782
27885
  );
27783
27886
  const statusColor2 = status ? status.ok ? status.text.startsWith("\u2713") ? theme.status.success : theme.text.secondary : theme.status.error : void 0;
27784
27887
  const footer = phase === "apiKey" ? "Enter save Ctrl+U clear Esc cancel" : phase === "providers" ? "\u2191\u2193 navigate Enter select Esc close" : "\u2191\u2193 navigate Enter confirm Esc back";
27785
- return /* @__PURE__ */ jsxs37(
27888
+ return /* @__PURE__ */ jsxs38(
27786
27889
  Box34,
27787
27890
  {
27788
27891
  flexDirection: "column",
@@ -27794,13 +27897,13 @@ var ProviderDialog = ({
27794
27897
  marginRight: 2,
27795
27898
  minWidth: 44,
27796
27899
  children: [
27797
- /* @__PURE__ */ jsxs37(Box34, { marginBottom: 1, gap: 1, children: [
27798
- /* @__PURE__ */ jsx43(Text40, { bold: true, color: theme.text.accent, children: "Providers" }),
27799
- phase !== "providers" && /* @__PURE__ */ jsxs37(Fragment9, { children: [
27800
- /* @__PURE__ */ jsx43(Text40, { color: theme.text.secondary, children: "\u203A" }),
27801
- /* @__PURE__ */ jsx43(Text40, { bold: true, color: theme.text.primary, children: selectedProvider })
27900
+ /* @__PURE__ */ jsxs38(Box34, { marginBottom: 1, gap: 1, children: [
27901
+ /* @__PURE__ */ jsx43(Text41, { bold: true, color: theme.text.accent, children: "Providers" }),
27902
+ phase !== "providers" && /* @__PURE__ */ jsxs38(Fragment9, { children: [
27903
+ /* @__PURE__ */ jsx43(Text41, { color: theme.text.secondary, children: "\u203A" }),
27904
+ /* @__PURE__ */ jsx43(Text41, { bold: true, color: theme.text.primary, children: selectedProvider })
27802
27905
  ] }),
27803
- phase === "providers" && currentModel && /* @__PURE__ */ jsxs37(Text40, { color: theme.text.secondary, children: [
27906
+ phase === "providers" && currentModel && /* @__PURE__ */ jsxs38(Text41, { color: theme.text.secondary, children: [
27804
27907
  " (",
27805
27908
  currentModel,
27806
27909
  ")"
@@ -27816,19 +27919,23 @@ var ProviderDialog = ({
27816
27919
  maxItemsToShow: 8,
27817
27920
  renderItem: (item, { titleColor }) => {
27818
27921
  const { icon, color, label } = getStatusMark(item.provider, item.keyIsSet);
27819
- return /* @__PURE__ */ jsxs37(Box34, { gap: 1, children: [
27820
- /* @__PURE__ */ jsx43(Text40, { color, children: icon }),
27821
- /* @__PURE__ */ jsx43(Text40, { color: titleColor, bold: item.isCurrent, children: item.provider.padEnd(12) }),
27822
- /* @__PURE__ */ jsx43(Text40, { color, dimColor: !item.keyIsSet && !item.isLocal, children: label }),
27823
- item.isCurrent && /* @__PURE__ */ jsx43(Text40, { color: theme.text.accent, children: "\u25B6" })
27922
+ return /* @__PURE__ */ jsxs38(Box34, { gap: 1, children: [
27923
+ /* @__PURE__ */ jsx43(Text41, { color, children: icon }),
27924
+ /* @__PURE__ */ jsx43(Text41, { color: titleColor, bold: item.isCurrent, children: item.provider.padEnd(12) }),
27925
+ /* @__PURE__ */ jsx43(Text41, { color, dimColor: !item.keyIsSet && !item.isLocal, children: label }),
27926
+ item.isCurrent && /* @__PURE__ */ jsx43(Text41, { color: theme.text.accent, children: "\u25B6" })
27824
27927
  ] });
27825
27928
  }
27826
27929
  }
27827
27930
  ),
27828
- phase === "actions" && /* @__PURE__ */ jsxs37(Fragment9, { children: [
27829
- /* @__PURE__ */ jsxs37(Box34, { marginBottom: 1, gap: 1, children: [
27830
- /* @__PURE__ */ jsx43(Text40, { color: theme.ui.comment, children: "key" }),
27831
- isLocal ? /* @__PURE__ */ jsx43(Text40, { color: theme.text.accent, children: "no key required" }) : keyHint ? /* @__PURE__ */ jsx43(Text40, { color: theme.text.secondary, children: keyHint }) : /* @__PURE__ */ jsx43(Text40, { color: theme.ui.comment, dimColor: true, children: "not configured" })
27931
+ phase === "actions" && /* @__PURE__ */ jsxs38(Fragment9, { children: [
27932
+ /* @__PURE__ */ jsxs38(Box34, { marginBottom: 1, gap: 1, children: [
27933
+ /* @__PURE__ */ jsx43(Text41, { color: theme.ui.comment, children: "session" }),
27934
+ /* @__PURE__ */ jsx43(Text41, { color: selectedProvider === currentProvider ? theme.text.accent : theme.text.secondary, children: selectedProvider === currentProvider ? "active" : `still using ${currentProvider}` })
27935
+ ] }),
27936
+ /* @__PURE__ */ jsxs38(Box34, { marginBottom: 1, gap: 1, children: [
27937
+ /* @__PURE__ */ jsx43(Text41, { color: theme.ui.comment, children: "key" }),
27938
+ isLocal ? /* @__PURE__ */ jsx43(Text41, { color: theme.text.accent, children: "no key required" }) : keyHint ? /* @__PURE__ */ jsx43(Text41, { color: theme.text.secondary, children: keyHint }) : /* @__PURE__ */ jsx43(Text41, { color: theme.ui.comment, dimColor: true, children: "not configured" })
27832
27939
  ] }),
27833
27940
  /* @__PURE__ */ jsx43(
27834
27941
  BaseSelectionList,
@@ -27837,11 +27944,11 @@ var ProviderDialog = ({
27837
27944
  onSelect: selectAction,
27838
27945
  isFocused: !isBusy,
27839
27946
  showNumbers: false,
27840
- maxItemsToShow: 4,
27841
- renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs37(Box34, { gap: 1, children: [
27842
- /* @__PURE__ */ jsx43(Text40, { color: titleColor, children: item.icon }),
27843
- /* @__PURE__ */ jsx43(Text40, { color: titleColor, children: item.label }),
27844
- item.hint && /* @__PURE__ */ jsxs37(Text40, { color: theme.ui.comment, dimColor: true, children: [
27947
+ maxItemsToShow: 6,
27948
+ renderItem: (item, { titleColor }) => /* @__PURE__ */ jsxs38(Box34, { gap: 1, children: [
27949
+ /* @__PURE__ */ jsx43(Text41, { color: titleColor, children: item.icon }),
27950
+ /* @__PURE__ */ jsx43(Text41, { color: titleColor, children: item.label }),
27951
+ item.hint && /* @__PURE__ */ jsxs38(Text41, { color: theme.ui.comment, dimColor: true, children: [
27845
27952
  "(",
27846
27953
  item.hint,
27847
27954
  ")"
@@ -27850,23 +27957,23 @@ var ProviderDialog = ({
27850
27957
  }
27851
27958
  )
27852
27959
  ] }),
27853
- phase === "apiKey" && /* @__PURE__ */ jsxs37(Box34, { flexDirection: "column", gap: 1, marginBottom: 1, children: [
27854
- /* @__PURE__ */ jsxs37(Box34, { gap: 1, children: [
27855
- /* @__PURE__ */ jsx43(Text40, { color: theme.ui.comment, children: "current" }),
27856
- isLocal ? /* @__PURE__ */ jsx43(Text40, { color: theme.text.accent, children: "no key required" }) : keyHint ? /* @__PURE__ */ jsx43(Text40, { color: theme.text.secondary, children: keyHint }) : /* @__PURE__ */ jsx43(Text40, { color: theme.ui.comment, dimColor: true, children: "not set" })
27960
+ phase === "apiKey" && /* @__PURE__ */ jsxs38(Box34, { flexDirection: "column", gap: 1, marginBottom: 1, children: [
27961
+ /* @__PURE__ */ jsxs38(Box34, { gap: 1, children: [
27962
+ /* @__PURE__ */ jsx43(Text41, { color: theme.ui.comment, children: "current" }),
27963
+ isLocal ? /* @__PURE__ */ jsx43(Text41, { color: theme.text.accent, children: "no key required" }) : keyHint ? /* @__PURE__ */ jsx43(Text41, { color: theme.text.secondary, children: keyHint }) : /* @__PURE__ */ jsx43(Text41, { color: theme.ui.comment, dimColor: true, children: "not set" })
27857
27964
  ] }),
27858
- /* @__PURE__ */ jsxs37(Box34, { gap: 1, children: [
27859
- /* @__PURE__ */ jsx43(Text40, { color: theme.ui.comment, children: "new key" }),
27860
- /* @__PURE__ */ jsx43(Box34, { borderStyle: "single", borderColor: theme.border.focused, paddingX: 1, children: /* @__PURE__ */ jsx43(Text40, { color: theme.text.accent, children: apiKeyInput.length > 0 ? maskApiKeyInput(apiKeyInput.length) : /* @__PURE__ */ jsx43(Text40, { color: theme.ui.comment, dimColor: true, children: "paste or type\u2026" }) }) })
27965
+ /* @__PURE__ */ jsxs38(Box34, { gap: 1, children: [
27966
+ /* @__PURE__ */ jsx43(Text41, { color: theme.ui.comment, children: "new key" }),
27967
+ /* @__PURE__ */ jsx43(Box34, { borderStyle: "single", borderColor: theme.border.focused, paddingX: 1, children: /* @__PURE__ */ jsx43(Text41, { color: theme.text.accent, children: apiKeyInput.length > 0 ? maskApiKeyInput(apiKeyInput.length) : /* @__PURE__ */ jsx43(Text41, { color: theme.ui.comment, dimColor: true, children: "paste or type\u2026" }) }) })
27861
27968
  ] })
27862
27969
  ] }),
27863
- status && /* @__PURE__ */ jsx43(Box34, { marginTop: 1, children: /* @__PURE__ */ jsx43(Text40, { color: statusColor2, children: status.text }) }),
27864
- phase === "actions" && testLatencyMs !== void 0 && /* @__PURE__ */ jsxs37(Box34, { marginTop: 0, gap: 1, children: [
27865
- /* @__PURE__ */ jsxs37(Text40, { color: getLatencyColor(testLatencyMs), bold: true, children: [
27970
+ status && /* @__PURE__ */ jsx43(Box34, { marginTop: 1, children: /* @__PURE__ */ jsx43(Text41, { color: statusColor2, children: status.text }) }),
27971
+ phase === "actions" && testLatencyMs !== void 0 && /* @__PURE__ */ jsxs38(Box34, { marginTop: 0, gap: 1, children: [
27972
+ /* @__PURE__ */ jsxs38(Text41, { color: getLatencyColor(testLatencyMs), bold: true, children: [
27866
27973
  testLatencyMs,
27867
27974
  "ms"
27868
27975
  ] }),
27869
- /* @__PURE__ */ jsx43(Text40, { color: theme.text.secondary, children: testLatencyMs < 300 ? "excellent" : testLatencyMs < 800 ? "good" : "slow" })
27976
+ /* @__PURE__ */ jsx43(Text41, { color: theme.text.secondary, children: testLatencyMs < 300 ? "excellent" : testLatencyMs < 800 ? "good" : "slow" })
27870
27977
  ] }),
27871
27978
  /* @__PURE__ */ jsx43(
27872
27979
  Box34,
@@ -27878,7 +27985,10 @@ var ProviderDialog = ({
27878
27985
  borderLeft: false,
27879
27986
  borderRight: false,
27880
27987
  borderColor: theme.ui.comment,
27881
- children: /* @__PURE__ */ jsx43(Text40, { color: theme.ui.comment, dimColor: true, children: footer })
27988
+ children: /* @__PURE__ */ jsxs38(Text41, { color: theme.ui.comment, dimColor: true, children: [
27989
+ footer,
27990
+ phase === "actions" && " Test does not change the session."
27991
+ ] })
27882
27992
  }
27883
27993
  )
27884
27994
  ]
@@ -27904,7 +28014,7 @@ var PermissionsDialog = ({
27904
28014
  onSave,
27905
28015
  onClose
27906
28016
  }) => {
27907
- const [modes, setModes] = useState222(current);
28017
+ const [modes, setModes] = useState23(current);
27908
28018
  const dirty = useMemo12(
27909
28019
  () => PERMISSION_KEYS.some((key) => modes[key] !== current[key]),
27910
28020
  [modes, current]
@@ -27943,7 +28053,7 @@ var PermissionsDialog = ({
27943
28053
  [onClose]
27944
28054
  );
27945
28055
  useKeypress(handleEscape, { isActive: true });
27946
- return /* @__PURE__ */ jsxs38(
28056
+ return /* @__PURE__ */ jsxs39(
27947
28057
  Box35,
27948
28058
  {
27949
28059
  flexDirection: "column",
@@ -27953,9 +28063,9 @@ var PermissionsDialog = ({
27953
28063
  marginLeft: 2,
27954
28064
  marginRight: 2,
27955
28065
  children: [
27956
- /* @__PURE__ */ jsx44(Text41, { bold: true, color: theme.text.accent, children: "Permission policy" }),
28066
+ /* @__PURE__ */ jsx44(Text42, { bold: true, color: theme.text.accent, children: "Permission policy" }),
27957
28067
  /* @__PURE__ */ jsx44(RadioButtonSelect, { items, onSelect: handleSelect, isFocused: true, showNumbers: false }),
27958
- /* @__PURE__ */ jsx44(Text41, { color: theme.text.secondary, children: "\u2191\u2193 navigate \xB7 Enter cycles allow/ask/deny \xB7 Esc cancel" })
28068
+ /* @__PURE__ */ jsx44(Text42, { color: theme.text.secondary, children: "\u2191\u2193 navigate \xB7 Enter cycles allow/ask/deny \xB7 Esc cancel" })
27959
28069
  ]
27960
28070
  }
27961
28071
  );
@@ -27970,9 +28080,9 @@ var AuthDialog = ({
27970
28080
  onPersistToken,
27971
28081
  onClose
27972
28082
  }) => {
27973
- const [phase, setPhase] = useState23("menu");
27974
- const [deviceCode, setDeviceCode] = useState23(null);
27975
- const [message, setMessage] = useState23("");
28083
+ const [phase, setPhase] = useState24("menu");
28084
+ const [deviceCode, setDeviceCode] = useState24(null);
28085
+ const [message, setMessage] = useState24("");
27976
28086
  const abortRef = useRef14(null);
27977
28087
  const items = useMemo13(
27978
28088
  () => [
@@ -28048,7 +28158,7 @@ var AuthDialog = ({
28048
28158
  },
28049
28159
  [clearToken, onClose, startLogin]
28050
28160
  );
28051
- useEffect222(() => () => {
28161
+ useEffect23(() => () => {
28052
28162
  abortRef.current?.abort();
28053
28163
  }, []);
28054
28164
  const handleEscape = useCallback20(
@@ -28063,7 +28173,7 @@ var AuthDialog = ({
28063
28173
  [onClose, phase]
28064
28174
  );
28065
28175
  useKeypress(handleEscape, { isActive: true });
28066
- return /* @__PURE__ */ jsxs39(
28176
+ return /* @__PURE__ */ jsxs40(
28067
28177
  Box36,
28068
28178
  {
28069
28179
  flexDirection: "column",
@@ -28073,32 +28183,32 @@ var AuthDialog = ({
28073
28183
  marginLeft: 2,
28074
28184
  marginRight: 2,
28075
28185
  children: [
28076
- /* @__PURE__ */ jsx45(Text42, { bold: true, color: theme.text.accent, children: "GitHub authentication" }),
28077
- /* @__PURE__ */ jsx45(Text42, { color: theme.text.secondary, children: statusSummary }),
28186
+ /* @__PURE__ */ jsx45(Text43, { bold: true, color: theme.text.accent, children: "GitHub authentication" }),
28187
+ /* @__PURE__ */ jsx45(Text43, { color: theme.text.secondary, children: statusSummary }),
28078
28188
  phase === "menu" && /* @__PURE__ */ jsx45(RadioButtonSelect, { items, onSelect: handleSelect, isFocused: true, showNumbers: false }),
28079
- deviceCode && phase === "running" && /* @__PURE__ */ jsxs39(Box36, { flexDirection: "column", marginTop: 1, children: [
28080
- /* @__PURE__ */ jsxs39(Text42, { children: [
28189
+ deviceCode && phase === "running" && /* @__PURE__ */ jsxs40(Box36, { flexDirection: "column", marginTop: 1, children: [
28190
+ /* @__PURE__ */ jsxs40(Text43, { children: [
28081
28191
  "Open: ",
28082
- /* @__PURE__ */ jsx45(Text42, { color: theme.text.accent, children: deviceCode.verificationUri })
28192
+ /* @__PURE__ */ jsx45(Text43, { color: theme.text.accent, children: deviceCode.verificationUri })
28083
28193
  ] }),
28084
- /* @__PURE__ */ jsxs39(Text42, { children: [
28194
+ /* @__PURE__ */ jsxs40(Text43, { children: [
28085
28195
  "Code: ",
28086
- /* @__PURE__ */ jsx45(Text42, { bold: true, color: theme.text.accent, children: deviceCode.userCode })
28196
+ /* @__PURE__ */ jsx45(Text43, { bold: true, color: theme.text.accent, children: deviceCode.userCode })
28087
28197
  ] }),
28088
- /* @__PURE__ */ jsxs39(Text42, { color: theme.text.secondary, children: [
28198
+ /* @__PURE__ */ jsxs40(Text43, { color: theme.text.secondary, children: [
28089
28199
  "Expires in ",
28090
28200
  Math.round(deviceCode.expiresIn / 60),
28091
28201
  " minutes."
28092
28202
  ] })
28093
28203
  ] }),
28094
28204
  message && /* @__PURE__ */ jsx45(
28095
- Text42,
28205
+ Text43,
28096
28206
  {
28097
28207
  color: phase === "error" ? theme.status.error : phase === "done" ? theme.status.success : theme.text.secondary,
28098
28208
  children: message
28099
28209
  }
28100
28210
  ),
28101
- /* @__PURE__ */ jsx45(Text42, { color: theme.text.secondary, children: phase === "running" ? "Esc cancel login" : phase === "menu" ? "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc close" : "Esc close" })
28211
+ /* @__PURE__ */ jsx45(Text43, { color: theme.text.secondary, children: phase === "running" ? "Esc cancel login" : phase === "menu" ? "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc close" : "Esc close" })
28102
28212
  ]
28103
28213
  }
28104
28214
  );
@@ -28144,13 +28254,13 @@ var ModelDialog = ({
28144
28254
  onSelectModel,
28145
28255
  onClose
28146
28256
  }) => {
28147
- const [loadState, setLoadState] = useState24("loading");
28148
- const [models, setModels] = useState24([]);
28149
- const [errorMsg, setErrorMsg] = useState24("");
28150
- const [search, setSearch] = useState24("");
28151
- const [activeSelIndex, setActiveSelIndex] = useState24(0);
28257
+ const [loadState, setLoadState] = useState25("loading");
28258
+ const [models, setModels] = useState25([]);
28259
+ const [errorMsg, setErrorMsg] = useState25("");
28260
+ const [search, setSearch] = useState25("");
28261
+ const [activeSelIndex, setActiveSelIndex] = useState25(0);
28152
28262
  const abortRef = useRef15(null);
28153
- useEffect23(() => {
28263
+ useEffect24(() => {
28154
28264
  const ctrl = new AbortController();
28155
28265
  abortRef.current = ctrl;
28156
28266
  onFetchModels(currentProvider, ctrl.signal).then((fetched) => {
@@ -28170,7 +28280,7 @@ var ModelDialog = ({
28170
28280
  );
28171
28281
  const selectableCount = rows.filter((r) => r.kind === "item").length;
28172
28282
  const clampedIndex = Math.min(activeSelIndex, Math.max(0, selectableCount - 1));
28173
- useEffect23(() => {
28283
+ useEffect24(() => {
28174
28284
  setActiveSelIndex(0);
28175
28285
  }, [search]);
28176
28286
  const activeRowPos = useMemo14(
@@ -28225,7 +28335,7 @@ var ModelDialog = ({
28225
28335
  }, { isActive: true });
28226
28336
  const canScrollUp = scrollTop > 0;
28227
28337
  const canScrollDown = scrollTop + MAX_VISIBLE < rows.length;
28228
- return /* @__PURE__ */ jsxs40(
28338
+ return /* @__PURE__ */ jsxs41(
28229
28339
  Box37,
28230
28340
  {
28231
28341
  flexDirection: "column",
@@ -28237,11 +28347,15 @@ var ModelDialog = ({
28237
28347
  marginRight: 1,
28238
28348
  minWidth: 58,
28239
28349
  children: [
28240
- /* @__PURE__ */ jsxs40(Box37, { justifyContent: "space-between", marginBottom: 1, children: [
28241
- /* @__PURE__ */ jsx46(Text43, { bold: true, color: theme.text.primary, children: "Select model" }),
28242
- /* @__PURE__ */ jsx46(Text43, { color: theme.ui.comment, dimColor: true, children: "esc" })
28350
+ /* @__PURE__ */ jsxs41(Box37, { justifyContent: "space-between", marginBottom: 1, children: [
28351
+ /* @__PURE__ */ jsxs41(Box37, { gap: 1, children: [
28352
+ /* @__PURE__ */ jsx46(Text44, { bold: true, color: theme.text.primary, children: "Select model" }),
28353
+ /* @__PURE__ */ jsx46(Text44, { color: theme.text.secondary, children: "for" }),
28354
+ /* @__PURE__ */ jsx46(Text44, { color: theme.text.accent, children: currentProvider })
28355
+ ] }),
28356
+ /* @__PURE__ */ jsx46(Text44, { color: theme.ui.comment, dimColor: true, children: "esc" })
28243
28357
  ] }),
28244
- /* @__PURE__ */ jsxs40(
28358
+ /* @__PURE__ */ jsxs41(
28245
28359
  Box37,
28246
28360
  {
28247
28361
  borderStyle: "single",
@@ -28249,57 +28363,57 @@ var ModelDialog = ({
28249
28363
  paddingX: 1,
28250
28364
  marginBottom: 1,
28251
28365
  children: [
28252
- /* @__PURE__ */ jsx46(Text43, { color: theme.ui.comment, children: "\u2315 " }),
28253
- search ? /* @__PURE__ */ jsxs40(Text43, { color: theme.text.primary, children: [
28366
+ /* @__PURE__ */ jsx46(Text44, { color: theme.ui.comment, children: "\u2315 " }),
28367
+ search ? /* @__PURE__ */ jsxs41(Text44, { color: theme.text.primary, children: [
28254
28368
  search,
28255
- /* @__PURE__ */ jsx46(Text43, { color: theme.text.accent, children: "\u258C" })
28256
- ] }) : /* @__PURE__ */ jsxs40(Text43, { color: theme.ui.comment, dimColor: true, children: [
28369
+ /* @__PURE__ */ jsx46(Text44, { color: theme.text.accent, children: "\u258C" })
28370
+ ] }) : /* @__PURE__ */ jsxs41(Text44, { color: theme.ui.comment, dimColor: true, children: [
28257
28371
  "Search",
28258
- /* @__PURE__ */ jsx46(Text43, { color: theme.text.accent, children: "\u258C" })
28372
+ /* @__PURE__ */ jsx46(Text44, { color: theme.text.accent, children: "\u258C" })
28259
28373
  ] })
28260
28374
  ]
28261
28375
  }
28262
28376
  ),
28263
- loadState === "loading" && /* @__PURE__ */ jsx46(Box37, { marginY: 1, children: /* @__PURE__ */ jsx46(Text43, { color: theme.text.secondary, children: "Loading models\u2026" }) }),
28264
- loadState === "error" && /* @__PURE__ */ jsxs40(Box37, { flexDirection: "column", marginY: 1, children: [
28265
- /* @__PURE__ */ jsx46(Text43, { color: theme.status.error, children: "\u2717 Could not load models" }),
28266
- /* @__PURE__ */ jsx46(Text43, { color: theme.ui.comment, dimColor: true, children: errorMsg })
28377
+ loadState === "loading" && /* @__PURE__ */ jsx46(Box37, { marginY: 1, children: /* @__PURE__ */ jsx46(Text44, { color: theme.text.secondary, children: "Loading models\u2026" }) }),
28378
+ loadState === "error" && /* @__PURE__ */ jsxs41(Box37, { flexDirection: "column", marginY: 1, children: [
28379
+ /* @__PURE__ */ jsx46(Text44, { color: theme.status.error, children: "\u2717 Could not load models" }),
28380
+ /* @__PURE__ */ jsx46(Text44, { color: theme.ui.comment, dimColor: true, children: errorMsg })
28267
28381
  ] }),
28268
- loadState === "ready" && selectableCount === 0 && /* @__PURE__ */ jsx46(Box37, { marginY: 1, children: /* @__PURE__ */ jsxs40(Text43, { color: theme.ui.comment, dimColor: true, children: [
28382
+ loadState === "ready" && selectableCount === 0 && /* @__PURE__ */ jsx46(Box37, { marginY: 1, children: /* @__PURE__ */ jsxs41(Text44, { color: theme.ui.comment, dimColor: true, children: [
28269
28383
  'No models match "',
28270
28384
  search,
28271
28385
  '"'
28272
28386
  ] }) }),
28273
- loadState === "ready" && selectableCount > 0 && /* @__PURE__ */ jsxs40(Box37, { flexDirection: "column", children: [
28274
- canScrollUp && /* @__PURE__ */ jsx46(Text43, { color: theme.ui.comment, dimColor: true, children: " \u2191" }),
28387
+ loadState === "ready" && selectableCount > 0 && /* @__PURE__ */ jsxs41(Box37, { flexDirection: "column", children: [
28388
+ canScrollUp && /* @__PURE__ */ jsx46(Text44, { color: theme.ui.comment, dimColor: true, children: " \u2191" }),
28275
28389
  visibleRows.map((row, i) => {
28276
28390
  if (row.kind === "header") {
28277
- return /* @__PURE__ */ jsx46(Box37, { marginTop: i === 0 ? 0 : 1, children: /* @__PURE__ */ jsx46(Text43, { color: theme.text.accent, bold: true, children: row.label }) }, `h${i}`);
28391
+ return /* @__PURE__ */ jsx46(Box37, { marginTop: i === 0 ? 0 : 1, children: /* @__PURE__ */ jsx46(Text44, { color: theme.text.accent, bold: true, children: row.label }) }, `h${i}`);
28278
28392
  }
28279
28393
  const { model, selIndex } = row;
28280
28394
  const isActive = selIndex === clampedIndex;
28281
28395
  const isCurrent = model.id === currentModel;
28282
28396
  const free = isFree(model);
28283
28397
  const group = providerGroup(model);
28284
- return /* @__PURE__ */ jsxs40(Box37, { gap: 1, children: [
28285
- /* @__PURE__ */ jsx46(Text43, { color: isActive ? theme.text.accent : theme.ui.comment, children: isCurrent ? "\u25CF" : isActive ? "\u203A" : " " }),
28286
- /* @__PURE__ */ jsxs40(Box37, { flexGrow: 1, gap: 1, children: [
28398
+ return /* @__PURE__ */ jsxs41(Box37, { gap: 1, children: [
28399
+ /* @__PURE__ */ jsx46(Text44, { color: isActive ? theme.text.accent : theme.ui.comment, children: isCurrent ? "\u25CF" : isActive ? "\u203A" : " " }),
28400
+ /* @__PURE__ */ jsxs41(Box37, { flexGrow: 1, gap: 1, children: [
28287
28401
  /* @__PURE__ */ jsx46(
28288
- Text43,
28402
+ Text44,
28289
28403
  {
28290
28404
  color: isActive ? theme.text.primary : theme.text.secondary,
28291
28405
  bold: isActive,
28292
28406
  children: model.name
28293
28407
  }
28294
28408
  ),
28295
- /* @__PURE__ */ jsx46(Text43, { color: theme.text.accent, dimColor: true, children: group })
28409
+ /* @__PURE__ */ jsx46(Text44, { color: theme.text.accent, dimColor: true, children: group })
28296
28410
  ] }),
28297
- free && /* @__PURE__ */ jsx46(Text43, { color: theme.status.success, dimColor: !isActive, children: "Free" })
28411
+ free && /* @__PURE__ */ jsx46(Text44, { color: theme.status.success, dimColor: !isActive, children: "Free" })
28298
28412
  ] }, model.id);
28299
28413
  }),
28300
- canScrollDown && /* @__PURE__ */ jsx46(Text43, { color: theme.ui.comment, dimColor: true, children: " \u2193" })
28414
+ canScrollDown && /* @__PURE__ */ jsx46(Text44, { color: theme.ui.comment, dimColor: true, children: " \u2193" })
28301
28415
  ] }),
28302
- loadState === "ready" && /* @__PURE__ */ jsx46(Box37, { marginTop: 1, children: /* @__PURE__ */ jsxs40(Text43, { color: theme.ui.comment, dimColor: true, children: [
28416
+ loadState === "ready" && /* @__PURE__ */ jsx46(Box37, { marginTop: 1, children: /* @__PURE__ */ jsxs41(Text44, { color: theme.ui.comment, dimColor: true, children: [
28303
28417
  selectableCount,
28304
28418
  " model",
28305
28419
  selectableCount !== 1 ? "s" : "",
@@ -28315,7 +28429,7 @@ var ModelDialog = ({
28315
28429
  borderLeft: false,
28316
28430
  borderRight: false,
28317
28431
  borderColor: theme.ui.comment,
28318
- children: /* @__PURE__ */ jsx46(Text43, { color: theme.ui.comment, dimColor: true, children: "\u2191\u2193 navigate type to search Enter select Esc close" })
28432
+ children: /* @__PURE__ */ jsx46(Text44, { color: theme.ui.comment, dimColor: true, children: "\u2191\u2193 navigate type to search Enter use for session Esc close" })
28319
28433
  }
28320
28434
  )
28321
28435
  ]
@@ -28453,49 +28567,52 @@ function resolveSlashInvocation(rawInput, commands) {
28453
28567
  var AppContainer = ({ cwd, config, provider, model }) => {
28454
28568
  const historyManager = useHistory();
28455
28569
  const addHistoryItem = historyManager.addItem;
28456
- const [initError, setInitError] = useState25(null);
28457
- const [isInitializing, setIsInitializing] = useState25(true);
28458
- const [isRunning, setIsRunning] = useState25(false);
28459
- const [pendingAssistantText, setPendingAssistantText] = useState25("");
28460
- const [approvalQueue, setApprovalQueue] = useState25([]);
28461
- const [providerLabel, setProviderLabel] = useState25("(unconfigured)");
28462
- const [currentModel, setCurrentModel] = useState25("(unconfigured)");
28463
- const [agentMode, setAgentMode] = useState25("build");
28464
- const [streamingState, setStreamingState] = useState25(
28570
+ const [initError, setInitError] = useState26(null);
28571
+ const [isInitializing, setIsInitializing] = useState26(true);
28572
+ const [isRunning, setIsRunning] = useState26(false);
28573
+ const [pendingAssistantText, setPendingAssistantText] = useState26("");
28574
+ const [approvalQueue, setApprovalQueue] = useState26([]);
28575
+ const [providerLabel, setProviderLabel] = useState26("(unconfigured)");
28576
+ const [targetSource, setTargetSource] = useState26("config");
28577
+ const [currentModel, setCurrentModel] = useState26("(unconfigured)");
28578
+ const [agentMode, setAgentMode] = useState26("build");
28579
+ const [streamingState, setStreamingState] = useState26(
28465
28580
  "idle"
28466
28581
  /* Idle */
28467
28582
  );
28468
- const [compactMode, setCompactMode] = useState25(false);
28469
- const [shellModeActive, setShellModeActive] = useState25(false);
28470
- const [showEscapePrompt, setShowEscapePrompt] = useState25(false);
28471
- const [messageQueue, setMessageQueue] = useState25([]);
28472
- const [historyRemountKey, setHistoryRemountKey] = useState25(0);
28473
- const [pendingItem, setPendingItem] = useState25(null);
28474
- const [isFeedbackDialogOpen, setIsFeedbackDialogOpen] = useState25(false);
28475
- const [lastPromptTokenCount, setLastPromptTokenCount] = useState25(0);
28476
- const [lastOutputTokenCount, setLastOutputTokenCount] = useState25(0);
28477
- const [elapsedTime, setElapsedTime] = useState25(0);
28478
- const [isReceivingContent, setIsReceivingContent] = useState25(false);
28479
- const [iterationInfo, setIterationInfo] = useState25(null);
28480
- const [liveToolCalls, setLiveToolCalls] = useState25([]);
28481
- const [taskPlan, setTaskPlan] = useState25(null);
28482
- const [taskStreams, setTaskStreams] = useState25({});
28483
- const [recentSlashCommandsState, setRecentSlashCommandsState] = useState25(/* @__PURE__ */ new Map());
28484
- const [activeDialog, setActiveDialog] = useState25(null);
28485
- const [themeName, setThemeName] = useState25("(unknown)");
28486
- const [permissionSummary, setPermissionSummary] = useState25("(unknown)");
28487
- const [authSummary, setAuthSummary] = useState25("(unknown)");
28488
- const [permissionModes, setPermissionModes] = useState25({
28583
+ const [compactMode, setCompactMode] = useState26(false);
28584
+ const [shellModeActive, setShellModeActive] = useState26(false);
28585
+ const [showEscapePrompt, setShowEscapePrompt] = useState26(false);
28586
+ const [messageQueue, setMessageQueue] = useState26([]);
28587
+ const [historyRemountKey, setHistoryRemountKey] = useState26(0);
28588
+ const [pendingItem, setPendingItem] = useState26(null);
28589
+ const [isFeedbackDialogOpen, setIsFeedbackDialogOpen] = useState26(false);
28590
+ const [lastPromptTokenCount, setLastPromptTokenCount] = useState26(0);
28591
+ const [lastOutputTokenCount, setLastOutputTokenCount] = useState26(0);
28592
+ const [elapsedTime, setElapsedTime] = useState26(0);
28593
+ const [isReceivingContent, setIsReceivingContent] = useState26(false);
28594
+ const [iterationInfo, setIterationInfo] = useState26(null);
28595
+ const [liveToolCalls, setLiveToolCalls] = useState26([]);
28596
+ const [taskPlan, setTaskPlan] = useState26(null);
28597
+ const [taskStreams, setTaskStreams] = useState26({});
28598
+ const [recentSlashCommandsState, setRecentSlashCommandsState] = useState26(/* @__PURE__ */ new Map());
28599
+ const [activeDialog, setActiveDialog] = useState26(null);
28600
+ const [themeName, setThemeName] = useState26("(unknown)");
28601
+ const [permissionSummary, setPermissionSummary] = useState26("(unknown)");
28602
+ const [authSummary, setAuthSummary] = useState26("(unknown)");
28603
+ const [permissionModes, setPermissionModes] = useState26({
28489
28604
  read: "allow",
28490
28605
  write: "ask",
28491
28606
  gitLocal: "allow",
28492
28607
  shell: "ask",
28493
28608
  dangerous: "ask"
28494
28609
  });
28495
- const [providerConfigVersion, setProviderConfigVersion] = useState25(0);
28496
- const [, setThemeVersion] = useState25(0);
28497
- const [, setDrainTick] = useState25(0);
28498
- const [pendingCommandConfirmation, setPendingCommandConfirmation] = useState25(null);
28610
+ const [providerConfigVersion, setProviderConfigVersion] = useState26(0);
28611
+ const [, setThemeVersion] = useState26(0);
28612
+ const [mcpConnected, setMcpConnected] = useState26(0);
28613
+ const [mcpTotal, setMcpTotal] = useState26(0);
28614
+ const [, setDrainTick] = useState26(0);
28615
+ const [pendingCommandConfirmation, setPendingCommandConfirmation] = useState26(null);
28499
28616
  const runtimeRef = useRef16(null);
28500
28617
  const sessionRef = useRef16(null);
28501
28618
  const configAdapterRef = useRef16(null);
@@ -28605,11 +28722,21 @@ var AppContainer = ({ cwd, config, provider, model }) => {
28605
28722
  const session = sessionRef.current;
28606
28723
  if (!runtime || !session) return;
28607
28724
  session.provider = provider2;
28608
- session.model = resolveConfiguredModelForProvider(runtime.config, provider2) ?? session.model;
28725
+ session.model = resolveConfiguredModelForProvider(runtime.config, provider2);
28609
28726
  runtime.sessions.save(session);
28727
+ setTargetSource("session");
28610
28728
  setCurrentModel(session.model ?? "(unconfigured)");
28611
28729
  setProviderLabel(formatProviderLabel(session.provider, session.model));
28612
- }, []);
28730
+ if (!session.model) {
28731
+ historyManager.addItem(
28732
+ {
28733
+ type: "warning",
28734
+ text: `Provider changed to ${provider2}, but no model is configured. Run /model or set defaultModels.${provider2}.`
28735
+ },
28736
+ Date.now()
28737
+ );
28738
+ }
28739
+ }, [historyManager]);
28613
28740
  const setSessionModel = useCallback22((model2) => {
28614
28741
  const runtime = runtimeRef.current;
28615
28742
  const session = sessionRef.current;
@@ -28617,6 +28744,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
28617
28744
  const normalized2 = model2.trim();
28618
28745
  session.model = normalized2.length > 0 ? normalized2 : void 0;
28619
28746
  runtime.sessions.save(session);
28747
+ setTargetSource("session");
28620
28748
  setCurrentModel(session.model ?? "(unconfigured)");
28621
28749
  setProviderLabel(formatProviderLabel(session.provider, session.model));
28622
28750
  }, []);
@@ -28665,10 +28793,10 @@ var AppContainer = ({ cwd, config, provider, model }) => {
28665
28793
  }),
28666
28794
  [configAdapter, historyManager, pendingItem, sessionCommandServices]
28667
28795
  );
28668
- useEffect24(() => {
28796
+ useEffect25(() => {
28669
28797
  messageQueueRef.current = messageQueue;
28670
28798
  }, [messageQueue]);
28671
- useEffect24(() => {
28799
+ useEffect25(() => {
28672
28800
  if (approvalQueue.length > 0) {
28673
28801
  setStreamingState(
28674
28802
  "waiting_for_confirmation"
@@ -28688,7 +28816,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
28688
28816
  /* Idle */
28689
28817
  );
28690
28818
  }, [approvalQueue.length, isRunning]);
28691
- useEffect24(() => {
28819
+ useEffect25(() => {
28692
28820
  if (!isRunning) {
28693
28821
  runStartedAtRef.current = null;
28694
28822
  setElapsedTime(0);
@@ -28704,7 +28832,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
28704
28832
  }, 250);
28705
28833
  return () => clearInterval(interval);
28706
28834
  }, [isRunning]);
28707
- useEffect24(() => {
28835
+ useEffect25(() => {
28708
28836
  let mounted = true;
28709
28837
  const initialize = async () => {
28710
28838
  try {
@@ -28734,8 +28862,11 @@ var AppContainer = ({ cwd, config, provider, model }) => {
28734
28862
  });
28735
28863
  setAuthSummary(formatAuthSummary(runtime.config.github));
28736
28864
  setAgentMode(runtime.config.agentMode);
28865
+ setTargetSource(provider || model ? "cli" : "config");
28737
28866
  setCurrentModel(session.model ?? "(unconfigured)");
28738
28867
  setProviderLabel(formatProviderLabel(session.provider, session.model));
28868
+ setMcpConnected(runtime.mcp.connectedCount);
28869
+ setMcpTotal(runtime.config.mcpServers.length);
28739
28870
  const unsubscribers = [];
28740
28871
  unsubscribers.push(
28741
28872
  runtime.events.on("approval:request", (request) => {
@@ -29334,6 +29465,48 @@ var AppContainer = ({ cwd, config, provider, model }) => {
29334
29465
  },
29335
29466
  [historyManager, persistConfig]
29336
29467
  );
29468
+ const handleSetDefaultProvider = useCallback22(
29469
+ async (provider2) => {
29470
+ const runtime = runtimeRef.current;
29471
+ const session = sessionRef.current;
29472
+ const previousDefaultProvider = runtime?.config.defaultProvider;
29473
+ const configuredModel = runtime ? previousDefaultProvider === provider2 ? resolveConfiguredModelForProvider(runtime.config, provider2) : runtime.config.defaultModels?.[provider2] : void 0;
29474
+ await persistConfig((cfg) => ({
29475
+ ...cfg,
29476
+ defaultProvider: provider2,
29477
+ defaultModel: cfg.defaultProvider === provider2 ? cfg.defaultModel : void 0
29478
+ }));
29479
+ if (runtime) {
29480
+ runtime.config.defaultProvider = provider2;
29481
+ if (previousDefaultProvider !== provider2) {
29482
+ runtime.config.defaultModel = void 0;
29483
+ }
29484
+ }
29485
+ if (session) {
29486
+ session.provider = provider2;
29487
+ session.model = configuredModel;
29488
+ runtime?.sessions.save(session);
29489
+ setProviderLabel(formatProviderLabel(session.provider, session.model));
29490
+ setCurrentModel(session.model ?? "(unconfigured)");
29491
+ }
29492
+ setTargetSource("config");
29493
+ setProviderConfigVersion((version) => version + 1);
29494
+ historyManager.addItem(
29495
+ { type: "info", text: `Default provider saved: ${provider2}.` },
29496
+ Date.now()
29497
+ );
29498
+ if (!configuredModel) {
29499
+ historyManager.addItem(
29500
+ {
29501
+ type: "warning",
29502
+ text: `Default provider ${provider2} has no configured model. Run /model or set defaultModels.${provider2}.`
29503
+ },
29504
+ Date.now()
29505
+ );
29506
+ }
29507
+ },
29508
+ [historyManager, persistConfig]
29509
+ );
29337
29510
  const handleTestProvider = useCallback22(
29338
29511
  async (provider2) => {
29339
29512
  const runtime = runtimeRef.current;
@@ -29399,7 +29572,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
29399
29572
  );
29400
29573
  const closeDialog = useCallback22(() => setActiveDialog(null), []);
29401
29574
  const previewTheme = useCallback22(() => setThemeVersion((version) => version + 1), []);
29402
- useEffect24(() => {
29575
+ useEffect25(() => {
29403
29576
  if (drainingQueueRef.current || isRunning || isInitializing || Boolean(initError) || approvalQueue.length > 0 || messageQueue.length === 0) {
29404
29577
  return;
29405
29578
  }
@@ -29500,6 +29673,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
29500
29673
  () => buildDialogModel(activeDialog, {
29501
29674
  cwd,
29502
29675
  providerLabel,
29676
+ targetSource,
29503
29677
  currentModel,
29504
29678
  agentMode,
29505
29679
  compactMode,
@@ -29517,6 +29691,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
29517
29691
  authSummary,
29518
29692
  permissionSummary,
29519
29693
  providerLabel,
29694
+ targetSource,
29520
29695
  slashCommands,
29521
29696
  themeName
29522
29697
  ]
@@ -29575,8 +29750,9 @@ var AppContainer = ({ cwd, config, provider, model }) => {
29575
29750
  isProviderDialogOpen: activeDialog === "provider",
29576
29751
  isPermissionsDialogOpen: activeDialog === "permissions",
29577
29752
  isFeedbackDialogOpen,
29578
- showAutoAcceptIndicator: "default"
29579
- /* DEFAULT */
29753
+ showAutoAcceptIndicator: "default",
29754
+ mcpConnected,
29755
+ mcpTotal
29580
29756
  }),
29581
29757
  [
29582
29758
  approvalQueue.length,
@@ -29598,6 +29774,8 @@ var AppContainer = ({ cwd, config, provider, model }) => {
29598
29774
  lastOutputTokenCount,
29599
29775
  lastPromptTokenCount,
29600
29776
  mainAreaWidth,
29777
+ mcpConnected,
29778
+ mcpTotal,
29601
29779
  messageQueue,
29602
29780
  pendingCommandConfirmation,
29603
29781
  pendingGeminiHistoryItems,
@@ -29613,30 +29791,37 @@ var AppContainer = ({ cwd, config, provider, model }) => {
29613
29791
  userMessages
29614
29792
  ]
29615
29793
  );
29616
- return /* @__PURE__ */ jsx47(CompactModeProvider, { value: { compactMode }, children: /* @__PURE__ */ jsx47(ConfigContext.Provider, { value: configAdapter, children: /* @__PURE__ */ jsx47(SettingsContext.Provider, { value: loadedSettings, children: /* @__PURE__ */ jsx47(StreamingContext.Provider, { value: streamingState, children: /* @__PURE__ */ jsx47(VimModeProvider, { initialVimEnabled: loadedSettings.merged.general?.vimMode ?? false, children: /* @__PURE__ */ jsx47(KeypressProvider, { kittyProtocolEnabled: false, config: configAdapter, children: /* @__PURE__ */ jsx47(ShellFocusContext.Provider, { value: true, children: /* @__PURE__ */ jsx47(AgentViewProvider, { children: /* @__PURE__ */ jsx47(BackgroundTaskViewProvider, { children: /* @__PURE__ */ jsx47(UIStateContext.Provider, { value: uiState, children: /* @__PURE__ */ jsx47(UIActionsContext.Provider, { value: uiActions, children: /* @__PURE__ */ jsxs41(Box38, { flexDirection: "column", flexGrow: 1, children: [
29617
- /* @__PURE__ */ jsxs41(Box38, { marginLeft: 2, marginRight: 2, marginTop: 1, marginBottom: 1, children: [
29618
- /* @__PURE__ */ jsx47(Text44, { bold: true, color: theme.text.accent, children: "DeepCode" }),
29619
- /* @__PURE__ */ jsxs41(Text44, { color: theme.text.secondary, children: [
29620
- " ",
29621
- providerLabel
29622
- ] }),
29623
- /* @__PURE__ */ jsxs41(Text44, { color: theme.text.secondary, children: [
29624
- " [",
29625
- agentMode,
29626
- "]"
29794
+ return /* @__PURE__ */ jsx47(CompactModeProvider, { value: { compactMode }, children: /* @__PURE__ */ jsx47(ConfigContext.Provider, { value: configAdapter, children: /* @__PURE__ */ jsx47(SettingsContext.Provider, { value: loadedSettings, children: /* @__PURE__ */ jsx47(StreamingContext.Provider, { value: streamingState, children: /* @__PURE__ */ jsx47(VimModeProvider, { initialVimEnabled: loadedSettings.merged.general?.vimMode ?? false, children: /* @__PURE__ */ jsx47(KeypressProvider, { kittyProtocolEnabled: false, config: configAdapter, children: /* @__PURE__ */ jsx47(ShellFocusContext.Provider, { value: true, children: /* @__PURE__ */ jsx47(AgentViewProvider, { children: /* @__PURE__ */ jsx47(BackgroundTaskViewProvider, { children: /* @__PURE__ */ jsx47(UIStateContext.Provider, { value: uiState, children: /* @__PURE__ */ jsx47(UIActionsContext.Provider, { value: uiActions, children: /* @__PURE__ */ jsxs42(Box38, { flexDirection: "column", flexGrow: 1, children: [
29795
+ /* @__PURE__ */ jsxs42(Box38, { marginLeft: 2, marginRight: 2, marginTop: 1, marginBottom: 1, children: [
29796
+ /* @__PURE__ */ jsx47(Text45, { bold: true, color: theme.text.accent, children: "DeepCode" }),
29797
+ /* @__PURE__ */ jsx47(Text45, { color: theme.text.secondary, children: " Target: " }),
29798
+ /* @__PURE__ */ jsx47(Text45, { color: theme.text.primary, children: providerLabel }),
29799
+ /* @__PURE__ */ jsxs42(Text45, { color: theme.text.secondary, children: [
29800
+ " (",
29801
+ targetSource,
29802
+ ")"
29627
29803
  ] }),
29628
- /* @__PURE__ */ jsxs41(Text44, { color: theme.text.secondary, children: [
29804
+ /* @__PURE__ */ jsx47(Text45, { color: theme.text.secondary, children: " Mode: " }),
29805
+ /* @__PURE__ */ jsx47(
29806
+ Text45,
29807
+ {
29808
+ bold: true,
29809
+ color: agentMode === "build" ? theme.status.success : theme.status.warning,
29810
+ children: agentMode.toUpperCase()
29811
+ }
29812
+ ),
29813
+ /* @__PURE__ */ jsxs42(Text45, { color: theme.text.secondary, children: [
29629
29814
  " ",
29630
29815
  streamingState === "responding" ? "running" : streamingState === "waiting_for_confirmation" ? "waiting-approval" : "idle"
29631
29816
  ] }),
29632
- iterationInfo && /* @__PURE__ */ jsxs41(Text44, { color: theme.text.secondary, children: [
29817
+ iterationInfo && /* @__PURE__ */ jsxs42(Text45, { color: theme.text.secondary, children: [
29633
29818
  " ",
29634
29819
  "iter ",
29635
29820
  iterationInfo.round,
29636
29821
  "/",
29637
29822
  iterationInfo.max
29638
29823
  ] }),
29639
- lastPromptTokenCount > 0 && /* @__PURE__ */ jsxs41(Text44, { color: theme.text.secondary, children: [
29824
+ lastPromptTokenCount > 0 && /* @__PURE__ */ jsxs42(Text45, { color: theme.text.secondary, children: [
29640
29825
  " ",
29641
29826
  "\u2191",
29642
29827
  formatTokenCount(lastPromptTokenCount),
@@ -29644,7 +29829,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
29644
29829
  formatTokenCount(lastOutputTokenCount)
29645
29830
  ] })
29646
29831
  ] }),
29647
- initError ? /* @__PURE__ */ jsx47(Box38, { marginLeft: 2, marginRight: 2, children: /* @__PURE__ */ jsxs41(Text44, { color: theme.status.error, children: [
29832
+ initError ? /* @__PURE__ */ jsx47(Box38, { marginLeft: 2, marginRight: 2, children: /* @__PURE__ */ jsxs42(Text45, { color: theme.status.error, children: [
29648
29833
  "Failed to initialize runtime: ",
29649
29834
  initError
29650
29835
  ] }) }) : /* @__PURE__ */ jsx47(
@@ -29672,6 +29857,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
29672
29857
  hasApiKey: providerHasApiKey,
29673
29858
  getProviderKeyHint,
29674
29859
  onSelectProvider: setSessionProvider,
29860
+ onSetDefaultProvider: handleSetDefaultProvider,
29675
29861
  onSaveApiKey: handleSaveProviderApiKey,
29676
29862
  onTestProvider: handleTestProvider,
29677
29863
  onClose: closeDialog
@@ -29732,7 +29918,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
29732
29918
  ] }) }) }) }) }) }) }) }) }) }) }) });
29733
29919
  };
29734
29920
  function formatProviderLabel(provider, model) {
29735
- return model ? `${provider}/${model}` : provider;
29921
+ return model ? `${provider}/${model}` : `${provider}/(model unset)`;
29736
29922
  }
29737
29923
  function formatNumber(value) {
29738
29924
  if (!Number.isFinite(value)) return String(value);
@@ -29806,7 +29992,7 @@ function buildDialogModel(dialog, options) {
29806
29992
  title: "Settings",
29807
29993
  lines: [
29808
29994
  `Working directory: ${options.cwd}`,
29809
- `Provider/Model: ${options.providerLabel}`,
29995
+ `Provider/Model: ${options.providerLabel} (${options.targetSource})`,
29810
29996
  `Mode: ${options.agentMode}`,
29811
29997
  `Compact mode: ${options.compactMode ? "on" : "off"}`,
29812
29998
  `Theme: ${options.themeName}`
@@ -29830,22 +30016,22 @@ function formatAuthSummary(config) {
29830
30016
  var ApprovalPrompt = ({ request }) => {
29831
30017
  if (!request) return null;
29832
30018
  const operationLabel = formatApprovalOperationLabel(request);
29833
- return /* @__PURE__ */ jsxs41(Box38, { flexDirection: "column", marginTop: 1, children: [
29834
- /* @__PURE__ */ jsxs41(Text44, { color: theme.status.warning, children: [
30019
+ return /* @__PURE__ */ jsxs42(Box38, { flexDirection: "column", marginTop: 1, children: [
30020
+ /* @__PURE__ */ jsxs42(Text45, { color: theme.status.warning, children: [
29835
30021
  "\u26A0 Allow ",
29836
30022
  operationLabel,
29837
30023
  "?"
29838
30024
  ] }),
29839
- request.path && /* @__PURE__ */ jsxs41(Text44, { color: theme.text.secondary, children: [
30025
+ request.path && /* @__PURE__ */ jsxs42(Text45, { color: theme.text.secondary, children: [
29840
30026
  " ",
29841
30027
  request.path
29842
30028
  ] }),
29843
- request.preview?.command && /* @__PURE__ */ jsxs41(Text44, { color: theme.text.secondary, children: [
30029
+ request.preview?.command && /* @__PURE__ */ jsxs42(Text45, { color: theme.text.secondary, children: [
29844
30030
  " $ ",
29845
30031
  request.preview.command,
29846
30032
  request.preview.args?.length ? ` ${request.preview.args.join(" ")}` : ""
29847
30033
  ] }),
29848
- /* @__PURE__ */ jsx47(Text44, { color: theme.text.secondary, children: " [\u21B5/y] once [s] session [a] always [n] deny" })
30034
+ /* @__PURE__ */ jsx47(Text45, { color: theme.text.secondary, children: " [\u21B5/y] once [s] session [a] always [n] deny" })
29849
30035
  ] });
29850
30036
  };
29851
30037
  function formatApprovalOperationLabel(request) {