deepcode-ai 1.2.23 → 1.2.27

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
@@ -7863,7 +7863,7 @@ import os4 from "os";
7863
7863
  import path62 from "path";
7864
7864
  import fs12 from "fs";
7865
7865
  import path19 from "path";
7866
- import { isValidElement, useCallback as useCallback28, useEffect as useEffect31, useMemo as useMemo19, useRef as useRef21, useState as useState33 } from "react";
7866
+ import React41, { isValidElement, useCallback as useCallback28, useEffect as useEffect31, useMemo as useMemo19, useRef as useRef21, useState as useState33 } from "react";
7867
7867
  import { Box as Box52, Text as Text60, useInput as useInput6, useStdin as useStdin3 } from "ink";
7868
7868
  import os22 from "os";
7869
7869
  import path92 from "path";
@@ -11509,7 +11509,7 @@ function parseVersion(version) {
11509
11509
  if (!match) return null;
11510
11510
  return [Number(match[1]), Number(match[2]), Number(match[3])];
11511
11511
  }
11512
- var VERSION = "1.2.23".length > 0 ? "1.2.23" : "0.0.0-dev";
11512
+ var VERSION = "1.2.27".length > 0 ? "1.2.27" : "0.0.0-dev";
11513
11513
  async function updateCommand() {
11514
11514
  writeStdoutLine(`Current version: ${VERSION}`);
11515
11515
  const update = await checkForUpdate(VERSION, { force: true });
@@ -28726,7 +28726,9 @@ var AppHeader = ({
28726
28726
  cwd,
28727
28727
  providerLabel,
28728
28728
  mode,
28729
- iterationInfo
28729
+ iterationInfo,
28730
+ updateAvailable,
28731
+ sessionName
28730
28732
  }) => {
28731
28733
  const {
28732
28734
  streamingState,
@@ -28786,6 +28788,10 @@ var AppHeader = ({
28786
28788
  ] }),
28787
28789
  /* @__PURE__ */ jsxs45(Box41, { flexDirection: "row", children: [
28788
28790
  /* @__PURE__ */ jsx51(Text49, { color: theme.text.secondary, dimColor: true, children: displayDir }),
28791
+ sessionName && /* @__PURE__ */ jsxs45(Text49, { color: theme.text.accent, dimColor: true, children: [
28792
+ " ",
28793
+ sessionName
28794
+ ] }),
28789
28795
  branchName && /* @__PURE__ */ jsxs45(Text49, { color: theme.text.accent, dimColor: true, children: [
28790
28796
  " ",
28791
28797
  "(",
@@ -28799,6 +28805,14 @@ var AppHeader = ({
28799
28805
  " \u2193",
28800
28806
  fmt(totalOutputTokenCount)
28801
28807
  ] })
28808
+ ] }),
28809
+ updateAvailable && /* @__PURE__ */ jsxs45(Box41, { flexDirection: "row", gap: 1, children: [
28810
+ /* @__PURE__ */ jsx51(Text49, { color: theme.status.warning, children: "\u2B06" }),
28811
+ /* @__PURE__ */ jsxs45(Text49, { color: theme.text.secondary, dimColor: true, children: [
28812
+ "nova vers\xE3o dispon\xEDvel: ",
28813
+ updateAvailable,
28814
+ " \u2014 execute /update"
28815
+ ] })
28802
28816
  ] })
28803
28817
  ]
28804
28818
  }
@@ -30949,7 +30963,7 @@ function sessionLabel2(session) {
30949
30963
  const preview = typeof firstUser?.content === "string" ? firstUser.content.trim().slice(0, 60) : "";
30950
30964
  return name ?? (preview || "(sem mensagens)");
30951
30965
  }
30952
- var SessionsDialog = ({ cwd, onSelect, onClose }) => {
30966
+ var SessionsDialog = ({ cwd, currentSessionId, onSelect, onClose }) => {
30953
30967
  const [loadState, setLoadState] = useState32("loading");
30954
30968
  const [allSessions, setAllSessions] = useState32([]);
30955
30969
  const [search, setSearch] = useState32("");
@@ -31067,9 +31081,10 @@ var SessionsDialog = ({ cwd, onSelect, onClose }) => {
31067
31081
  const target = session.model ? `${session.provider}/${session.model}` : session.provider;
31068
31082
  const msgCount = session.messages.length;
31069
31083
  const preview = sessionLabel2(session);
31084
+ const isCurrent = session.id === currentSessionId;
31070
31085
  return /* @__PURE__ */ jsxs54(Box50, { flexDirection: "column", children: [
31071
31086
  /* @__PURE__ */ jsxs54(Box50, { gap: 1, children: [
31072
- /* @__PURE__ */ jsx60(Text58, { color: isActive ? theme.text.accent : theme.ui.comment, children: isActive ? "\u203A" : " " }),
31087
+ /* @__PURE__ */ jsx60(Text58, { color: isActive ? theme.text.accent : isCurrent ? theme.status.success : theme.ui.comment, children: isCurrent ? "\u25CF" : isActive ? "\u203A" : " " }),
31073
31088
  /* @__PURE__ */ jsx60(
31074
31089
  Text58,
31075
31090
  {
@@ -31403,6 +31418,13 @@ function formatModelCatalogSummary2(result) {
31403
31418
  return "model catalog unavailable";
31404
31419
  }
31405
31420
  var APPROVAL_ENTER_ARM_DELAY_MS = 350;
31421
+ var VimToggleRegistrar = ({ onRegister }) => {
31422
+ const { toggleVimEnabled } = useVimMode();
31423
+ React41.useEffect(() => {
31424
+ onRegister(toggleVimEnabled);
31425
+ }, [onRegister, toggleVimEnabled]);
31426
+ return null;
31427
+ };
31406
31428
  var AppContainer = ({ cwd, config, provider, model, resumeSessionId, startupWarnings = [] }) => {
31407
31429
  const historyManager = useHistory();
31408
31430
  const addHistoryItem = historyManager.addItem;
@@ -31446,6 +31468,11 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId, startupWarn
31446
31468
  dangerous: "ask"
31447
31469
  });
31448
31470
  const [sessionDisplayName, setSessionDisplayName] = useState33("");
31471
+ const [updateAvailable, setUpdateAvailable] = useState33(null);
31472
+ const vimToggleRef = useRef21(null);
31473
+ const registerVimToggle = React41.useCallback((fn) => {
31474
+ vimToggleRef.current = fn;
31475
+ }, []);
31449
31476
  const [providerConfigVersion, setProviderConfigVersion] = useState33(0);
31450
31477
  const [, setThemeVersion] = useState33(0);
31451
31478
  const [mcpConnected, setMcpConnected] = useState33(0);
@@ -31729,7 +31756,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId, startupWarn
31729
31756
  pendingItem,
31730
31757
  setPendingItem,
31731
31758
  loadHistory: historyManager.loadHistory,
31732
- toggleVimEnabled: async () => false,
31759
+ toggleVimEnabled: () => vimToggleRef.current?.() ?? Promise.resolve(false),
31733
31760
  reloadCommands: () => {
31734
31761
  },
31735
31762
  undo: handleUndo,
@@ -32032,19 +32059,13 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId, startupWarn
32032
32059
  if (!mounted || !update) return;
32033
32060
  const available = [];
32034
32061
  if (isNewer(VERSION, update.latest)) {
32035
- available.push(`latest v${update.latest}`);
32062
+ available.push(`v${update.latest}`);
32036
32063
  }
32037
32064
  if (update.stable && isNewer(VERSION, update.stable)) {
32038
- available.push(`stable v${update.stable}`);
32065
+ available.push(`v${update.stable} (stable)`);
32039
32066
  }
32040
32067
  if (available.length === 0) return;
32041
- addHistoryItem(
32042
- {
32043
- type: "info",
32044
- text: `Atualiza\xE7\xE3o dispon\xEDvel: ${available.join(", ")}. Execute /update para instru\xE7\xF5es.`
32045
- },
32046
- Date.now()
32047
- );
32068
+ setUpdateAvailable(available[0] ?? null);
32048
32069
  }).catch(() => {
32049
32070
  });
32050
32071
  } catch (error) {
@@ -32997,130 +33018,136 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId, startupWarn
32997
33018
  userMessages
32998
33019
  ]
32999
33020
  );
33000
- return /* @__PURE__ */ jsx62(AppContext.Provider, { value: appContextValue, children: /* @__PURE__ */ jsx62(CompactModeProvider, { value: { compactMode }, children: /* @__PURE__ */ jsx62(ConfigContext.Provider, { value: configAdapter, children: /* @__PURE__ */ jsx62(SettingsContext.Provider, { value: loadedSettings, children: /* @__PURE__ */ jsx62(StreamingContext.Provider, { value: streamingState, children: /* @__PURE__ */ jsx62(VimModeProvider, { initialVimEnabled: loadedSettings.merged.general?.vimMode ?? false, children: /* @__PURE__ */ jsx62(KeypressProvider, { kittyProtocolEnabled: false, config: configAdapter, children: /* @__PURE__ */ jsx62(ShellFocusContext.Provider, { value: true, children: /* @__PURE__ */ jsx62(AgentViewProvider, { children: /* @__PURE__ */ jsx62(BackgroundTaskViewProvider, { children: /* @__PURE__ */ jsx62(UIStateContext.Provider, { value: uiState, children: /* @__PURE__ */ jsx62(UIActionsContext.Provider, { value: uiActions, children: /* @__PURE__ */ jsxs56(Box52, { flexDirection: "column", flexGrow: 1, children: [
33001
- /* @__PURE__ */ jsx62(
33002
- AppHeader,
33003
- {
33004
- version: VERSION,
33005
- cwd,
33006
- providerLabel,
33007
- mode: agentMode,
33008
- iterationInfo
33009
- }
33010
- ),
33011
- initError ? /* @__PURE__ */ jsx62(Box52, { marginLeft: 2, marginRight: 2, children: /* @__PURE__ */ jsxs56(Text60, { color: theme.status.error, children: [
33012
- "Failed to initialize runtime: ",
33013
- initError
33014
- ] }) }) : /* @__PURE__ */ jsxs56(Box52, { flexDirection: "column", flexGrow: 1, children: [
33021
+ return /* @__PURE__ */ jsx62(AppContext.Provider, { value: appContextValue, children: /* @__PURE__ */ jsx62(CompactModeProvider, { value: { compactMode }, children: /* @__PURE__ */ jsx62(ConfigContext.Provider, { value: configAdapter, children: /* @__PURE__ */ jsx62(SettingsContext.Provider, { value: loadedSettings, children: /* @__PURE__ */ jsx62(StreamingContext.Provider, { value: streamingState, children: /* @__PURE__ */ jsxs56(VimModeProvider, { initialVimEnabled: loadedSettings.merged.general?.vimMode ?? false, children: [
33022
+ /* @__PURE__ */ jsx62(VimToggleRegistrar, { onRegister: registerVimToggle }),
33023
+ /* @__PURE__ */ jsx62(KeypressProvider, { kittyProtocolEnabled: false, config: configAdapter, children: /* @__PURE__ */ jsx62(ShellFocusContext.Provider, { value: true, children: /* @__PURE__ */ jsx62(AgentViewProvider, { children: /* @__PURE__ */ jsx62(BackgroundTaskViewProvider, { children: /* @__PURE__ */ jsx62(UIStateContext.Provider, { value: uiState, children: /* @__PURE__ */ jsx62(UIActionsContext.Provider, { value: uiActions, children: /* @__PURE__ */ jsxs56(Box52, { flexDirection: "column", flexGrow: 1, children: [
33015
33024
  /* @__PURE__ */ jsx62(
33016
- MainContent,
33025
+ AppHeader,
33017
33026
  {
33018
- history: historyManager.history,
33019
- historyRemountKey,
33020
- pendingAssistantText,
33021
- liveToolCalls,
33022
- terminalWidth,
33023
- mainAreaWidth,
33024
- isFocused: approvalQueue.length === 0
33027
+ version: VERSION,
33028
+ cwd,
33029
+ providerLabel,
33030
+ mode: agentMode,
33031
+ iterationInfo,
33032
+ updateAvailable,
33033
+ sessionName: sessionDisplayName || void 0
33025
33034
  }
33026
33035
  ),
33027
- /* @__PURE__ */ jsx62(ShowMoreLines, { constrainHeight })
33028
- ] }),
33029
- approvalQueue.length > 0 && /* @__PURE__ */ jsx62(Box52, { marginLeft: 2, marginRight: 2, marginTop: 1, children: /* @__PURE__ */ jsx62(ApprovalPrompt, { request: approvalQueue[0], queueLength: approvalQueue.length }) }),
33030
- dialogModel && /* @__PURE__ */ jsx62(CommandDialog, { title: dialogModel.title, lines: dialogModel.lines }),
33031
- activeDialog === "provider" && /* @__PURE__ */ jsx62(
33032
- ProviderDialog,
33033
- {
33034
- providers: listAvailableProviders(),
33035
- currentProvider: getSessionCommandState().provider,
33036
- currentModel: getSessionCommandState().model,
33037
- hasApiKey: providerHasApiKey,
33038
- getProviderKeyHint,
33039
- onSelectProvider: setSessionProvider,
33040
- onSetDefaultProvider: handleSetDefaultProvider,
33041
- onSaveApiKey: handleSaveProviderApiKey,
33042
- onTestProvider: handleTestProvider,
33043
- onClose: closeDialog
33044
- }
33045
- ),
33046
- activeDialog === "model" && /* @__PURE__ */ jsx62(
33047
- ModelDialog,
33048
- {
33049
- currentProvider: getSessionCommandState().provider,
33050
- currentModel: getSessionCommandState().model,
33051
- onFetchModels: handleFetchModels,
33052
- onSelectModel: handleSelectModel,
33053
- onClose: closeDialog
33054
- }
33055
- ),
33056
- activeDialog === "theme" && /* @__PURE__ */ jsx62(
33057
- ThemeDialog,
33058
- {
33059
- onSelect: handleSelectTheme,
33060
- onClose: closeDialog,
33061
- onPreview: previewTheme
33062
- }
33063
- ),
33064
- activeDialog === "permissions" && /* @__PURE__ */ jsx62(
33065
- PermissionsDialog,
33066
- {
33067
- current: permissionModes,
33068
- onSave: handleSavePermissions,
33069
- onClose: closeDialog
33070
- }
33071
- ),
33072
- activeDialog === "auth" && runtimeRef.current && /* @__PURE__ */ jsx62(
33073
- AuthDialog,
33074
- {
33075
- clientId: runtimeRef.current.config.github.oauthClientId,
33076
- scopes: runtimeRef.current.config.github.oauthScopes,
33077
- enterpriseUrl: runtimeRef.current.config.github.enterpriseUrl,
33078
- worktree: cwd,
33079
- statusSummary: authSummary,
33080
- hasToken: Boolean(runtimeRef.current.config.github.token),
33081
- onPersistToken: handlePersistToken,
33082
- onClose: closeDialog
33083
- }
33084
- ),
33085
- activeDialog === "feedback" && /* @__PURE__ */ jsx62(FeedbackDialog, { cwd, onClose: closeDialog }),
33086
- activeDialog === "sessions" && /* @__PURE__ */ jsx62(
33087
- SessionsDialog,
33088
- {
33089
- cwd,
33090
- onSelect: handleSelectSession,
33091
- onClose: closeDialog
33092
- }
33093
- ),
33094
- pendingCommandConfirmation && /* @__PURE__ */ jsx62(
33095
- CommandDialog,
33096
- {
33097
- title: "Confirm action",
33098
- lines: [
33099
- ...pendingCommandConfirmation.promptLines,
33100
- "",
33101
- `Command: ${pendingCommandConfirmation.rawInvocation}`
33102
- ],
33103
- footerText: "Press y or Enter to confirm. Press n or Esc to cancel."
33104
- }
33105
- ),
33106
- /* @__PURE__ */ jsx62(
33107
- SubagentsPanel,
33108
- {
33109
- subagents: Array.from(subagentMap.values()),
33110
- mainAreaWidth
33111
- }
33112
- ),
33113
- stickyTodos && /* @__PURE__ */ jsx62(
33114
- StickyTodoList,
33115
- {
33116
- todos: stickyTodos,
33117
- width: mainAreaWidth,
33118
- maxVisibleItems: stickyTodoMaxItems
33119
- }
33120
- ),
33121
- /* @__PURE__ */ jsx62(Notifications, {}),
33122
- /* @__PURE__ */ jsx62(Composer, {})
33123
- ] }) }) }) }) }) }) }) }) }) }) }) }) });
33036
+ initError ? /* @__PURE__ */ jsx62(Box52, { marginLeft: 2, marginRight: 2, children: /* @__PURE__ */ jsxs56(Text60, { color: theme.status.error, children: [
33037
+ "Failed to initialize runtime: ",
33038
+ initError
33039
+ ] }) }) : /* @__PURE__ */ jsxs56(Box52, { flexDirection: "column", flexGrow: 1, children: [
33040
+ /* @__PURE__ */ jsx62(
33041
+ MainContent,
33042
+ {
33043
+ history: historyManager.history,
33044
+ historyRemountKey,
33045
+ pendingAssistantText,
33046
+ liveToolCalls,
33047
+ terminalWidth,
33048
+ mainAreaWidth,
33049
+ isFocused: approvalQueue.length === 0
33050
+ }
33051
+ ),
33052
+ /* @__PURE__ */ jsx62(ShowMoreLines, { constrainHeight })
33053
+ ] }),
33054
+ approvalQueue.length > 0 && /* @__PURE__ */ jsx62(Box52, { marginLeft: 2, marginRight: 2, marginTop: 1, children: /* @__PURE__ */ jsx62(ApprovalPrompt, { request: approvalQueue[0], queueLength: approvalQueue.length }) }),
33055
+ dialogModel && /* @__PURE__ */ jsx62(CommandDialog, { title: dialogModel.title, lines: dialogModel.lines }),
33056
+ activeDialog === "provider" && /* @__PURE__ */ jsx62(
33057
+ ProviderDialog,
33058
+ {
33059
+ providers: listAvailableProviders(),
33060
+ currentProvider: getSessionCommandState().provider,
33061
+ currentModel: getSessionCommandState().model,
33062
+ hasApiKey: providerHasApiKey,
33063
+ getProviderKeyHint,
33064
+ onSelectProvider: setSessionProvider,
33065
+ onSetDefaultProvider: handleSetDefaultProvider,
33066
+ onSaveApiKey: handleSaveProviderApiKey,
33067
+ onTestProvider: handleTestProvider,
33068
+ onClose: closeDialog
33069
+ }
33070
+ ),
33071
+ activeDialog === "model" && /* @__PURE__ */ jsx62(
33072
+ ModelDialog,
33073
+ {
33074
+ currentProvider: getSessionCommandState().provider,
33075
+ currentModel: getSessionCommandState().model,
33076
+ onFetchModels: handleFetchModels,
33077
+ onSelectModel: handleSelectModel,
33078
+ onClose: closeDialog
33079
+ }
33080
+ ),
33081
+ activeDialog === "theme" && /* @__PURE__ */ jsx62(
33082
+ ThemeDialog,
33083
+ {
33084
+ onSelect: handleSelectTheme,
33085
+ onClose: closeDialog,
33086
+ onPreview: previewTheme
33087
+ }
33088
+ ),
33089
+ activeDialog === "permissions" && /* @__PURE__ */ jsx62(
33090
+ PermissionsDialog,
33091
+ {
33092
+ current: permissionModes,
33093
+ onSave: handleSavePermissions,
33094
+ onClose: closeDialog
33095
+ }
33096
+ ),
33097
+ activeDialog === "auth" && runtimeRef.current && /* @__PURE__ */ jsx62(
33098
+ AuthDialog,
33099
+ {
33100
+ clientId: runtimeRef.current.config.github.oauthClientId,
33101
+ scopes: runtimeRef.current.config.github.oauthScopes,
33102
+ enterpriseUrl: runtimeRef.current.config.github.enterpriseUrl,
33103
+ worktree: cwd,
33104
+ statusSummary: authSummary,
33105
+ hasToken: Boolean(runtimeRef.current.config.github.token),
33106
+ onPersistToken: handlePersistToken,
33107
+ onClose: closeDialog
33108
+ }
33109
+ ),
33110
+ activeDialog === "feedback" && /* @__PURE__ */ jsx62(FeedbackDialog, { cwd, onClose: closeDialog }),
33111
+ activeDialog === "sessions" && /* @__PURE__ */ jsx62(
33112
+ SessionsDialog,
33113
+ {
33114
+ cwd,
33115
+ currentSessionId: sessionRef.current?.id,
33116
+ onSelect: handleSelectSession,
33117
+ onClose: closeDialog
33118
+ }
33119
+ ),
33120
+ pendingCommandConfirmation && /* @__PURE__ */ jsx62(
33121
+ CommandDialog,
33122
+ {
33123
+ title: "Confirm action",
33124
+ lines: [
33125
+ ...pendingCommandConfirmation.promptLines,
33126
+ "",
33127
+ `Command: ${pendingCommandConfirmation.rawInvocation}`
33128
+ ],
33129
+ footerText: "Press y or Enter to confirm. Press n or Esc to cancel."
33130
+ }
33131
+ ),
33132
+ /* @__PURE__ */ jsx62(
33133
+ SubagentsPanel,
33134
+ {
33135
+ subagents: Array.from(subagentMap.values()),
33136
+ mainAreaWidth
33137
+ }
33138
+ ),
33139
+ stickyTodos && /* @__PURE__ */ jsx62(
33140
+ StickyTodoList,
33141
+ {
33142
+ todos: stickyTodos,
33143
+ width: mainAreaWidth,
33144
+ maxVisibleItems: stickyTodoMaxItems
33145
+ }
33146
+ ),
33147
+ /* @__PURE__ */ jsx62(Notifications, {}),
33148
+ /* @__PURE__ */ jsx62(Composer, {})
33149
+ ] }) }) }) }) }) }) })
33150
+ ] }) }) }) }) }) });
33124
33151
  };
33125
33152
  function formatProviderLabel(provider, model) {
33126
33153
  return model ? `${provider} \u203A ${model}` : `${provider} \u203A (model unset)`;