@google/gemini-cli 0.70.0 → 0.71.0-preview.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/bundle/{chunk-V4HIE5G5.js → chunk-3XHFESDF.js} +1 -1
  2. package/bundle/{chunk-YOEWNBDC.js → chunk-532N7TZB.js} +2 -2
  3. package/bundle/{chunk-BOIBJEIO.js → chunk-5SC43MXU.js} +3 -3
  4. package/bundle/{chunk-AMHNNZY2.js → chunk-6E6XAAYL.js} +7 -7
  5. package/bundle/{chunk-6IKD2NB3.js → chunk-7UJSGYFD.js} +1 -1
  6. package/bundle/{chunk-GFBMTAPD.js → chunk-7YXHVH7Y.js} +2 -2
  7. package/bundle/{chunk-VHXUWMGE.js → chunk-AJZTZFAS.js} +2 -2
  8. package/bundle/{chunk-SPAMAY26.js → chunk-AQXZKJST.js} +1 -1
  9. package/bundle/{chunk-37D3S3FZ.js → chunk-BTH7KEMH.js} +842 -368
  10. package/bundle/{chunk-FXAACYC3.js → chunk-DCBU7GEJ.js} +1 -1
  11. package/bundle/{chunk-CB37EK5Y.js → chunk-DPAMHBTE.js} +3 -3
  12. package/bundle/{chunk-RFQXG324.js → chunk-EERY2AEY.js} +1 -1
  13. package/bundle/{chunk-QYKA4YD7.js → chunk-FUOK6VUJ.js} +3 -3
  14. package/bundle/{chunk-FHK4RNCX.js → chunk-IBD2PLWE.js} +7 -7
  15. package/bundle/{chunk-LMBUPWFC.js → chunk-JJNQ5PWH.js} +842 -368
  16. package/bundle/{chunk-4BWP3TDK.js → chunk-KSDBDSBI.js} +1 -1
  17. package/bundle/{chunk-CMKRWIX6.js → chunk-LGRO4U3O.js} +7 -7
  18. package/bundle/{chunk-KV6XIC2Z.js → chunk-NATMLC5X.js} +1 -1
  19. package/bundle/{chunk-3VGGGCOZ.js → chunk-NMOD2T37.js} +2 -2
  20. package/bundle/{chunk-WRWAVEME.js → chunk-NQGCTXGR.js} +1 -1
  21. package/bundle/{chunk-G6SC5BOV.js → chunk-QGOT25K4.js} +1 -1
  22. package/bundle/{chunk-JLKRLYZG.js → chunk-QQNZHLIF.js} +2 -2
  23. package/bundle/{chunk-5VFAWK3F.js → chunk-UTK4LRWO.js} +1 -1
  24. package/bundle/{chunk-7JS2T75Z.js → chunk-VIXTMKUM.js} +1 -1
  25. package/bundle/{chunk-EG2BSKPF.js → chunk-W7J7YSH2.js} +1 -1
  26. package/bundle/{chunk-LMNAB62M.js → chunk-Y6WF3A3Q.js} +2 -2
  27. package/bundle/{chunk-UF44X63P.js → chunk-YQO7IBVQ.js} +751 -320
  28. package/bundle/{cleanup-BMYAIPAL.js → cleanup-4WL7SSTL.js} +2 -2
  29. package/bundle/{cleanup-CWOSCK57.js → cleanup-62ECCOLP.js} +2 -2
  30. package/bundle/{cleanup-JTPRPYIQ.js → cleanup-JWSUGSQB.js} +2 -2
  31. package/bundle/{core-XZECNCR2.js → core-6V72TKM3.js} +31 -1
  32. package/bundle/{core-HYVGBZPP.js → core-NP64K3HR.js} +31 -1
  33. package/bundle/{devtoolsService-WNJOZ7ZT.js → devtoolsService-3G6P4EBB.js} +2 -2
  34. package/bundle/{devtoolsService-ER22TM2Y.js → devtoolsService-DWVXCWJ7.js} +2 -2
  35. package/bundle/{devtoolsService-O5VD5YWD.js → devtoolsService-XMEVE7R4.js} +2 -2
  36. package/bundle/{dist-75NDR3EX.js → dist-AAGC2327.js} +31 -1
  37. package/bundle/docs/changelogs/index.md +23 -0
  38. package/bundle/docs/changelogs/latest.md +112 -98
  39. package/bundle/docs/changelogs/preview.md +82 -115
  40. package/bundle/{formatError-M4GLDFGE.js → formatError-7YP6B7ZW.js} +2 -2
  41. package/bundle/{formatError-QOZLAZ32.js → formatError-P6NGVTF2.js} +2 -2
  42. package/bundle/{formatError-FYLLVZDF.js → formatError-QS36O76I.js} +2 -2
  43. package/bundle/{gemini-PG2FEK5D.js → gemini-3VVVLE4J.js} +15 -15
  44. package/bundle/{gemini-FRSP6LA3.js → gemini-AC4RONBV.js} +15 -15
  45. package/bundle/{gemini-AYDYW6NZ.js → gemini-TY6A5Q5C.js} +15 -15
  46. package/bundle/gemini.js +8 -8
  47. package/bundle/{interactiveCli-BYWR7IEK.js → interactiveCli-AO75ICTD.js} +157 -32
  48. package/bundle/{interactiveCli-6TVFB4R5.js → interactiveCli-BHEEEW2H.js} +157 -32
  49. package/bundle/{interactiveCli-76LAQB3B.js → interactiveCli-XULKUHW4.js} +157 -32
  50. package/bundle/{liteRtServerManager-GIRVSE6M.js → liteRtServerManager-7VEEHSC6.js} +4 -4
  51. package/bundle/{liteRtServerManager-KZ62KJW3.js → liteRtServerManager-DRZ6V4ZL.js} +4 -4
  52. package/bundle/{liteRtServerManager-BYJWS5BO.js → liteRtServerManager-GFU4D3JF.js} +4 -4
  53. package/bundle/{oauth2-provider-SFFQQ6OE.js → oauth2-provider-S7DQJKA5.js} +1 -1
  54. package/bundle/{oauth2-provider-ZBFFAIQE.js → oauth2-provider-XYK3N74K.js} +1 -1
  55. package/bundle/{oauth2-provider-SRH6I6G7.js → oauth2-provider-YZI5V6PH.js} +1 -1
  56. package/bundle/{start-PLK5XHJC.js → start-EMZSUYV6.js} +6 -6
  57. package/bundle/{start-Q66LTS3Y.js → start-JGS6ZUFX.js} +6 -6
  58. package/bundle/{start-OLEVDFQS.js → start-QQTZCWPJ.js} +6 -6
  59. package/package.json +1 -1
@@ -149,10 +149,10 @@ import {
149
149
  useUIState,
150
150
  useVimMode,
151
151
  validateAuthMethod
152
- } from "./chunk-CMKRWIX6.js";
152
+ } from "./chunk-6E6XAAYL.js";
153
153
  import {
154
154
  require_source
155
- } from "./chunk-6IKD2NB3.js";
155
+ } from "./chunk-NATMLC5X.js";
156
156
  import {
157
157
  appEvents
158
158
  } from "./chunk-5PS3AYFU.js";
@@ -226,25 +226,25 @@ import {
226
226
  widestLineFromStyledChars,
227
227
  wordBreakStyledChars,
228
228
  wrapStyledChars
229
- } from "./chunk-GFBMTAPD.js";
229
+ } from "./chunk-7YXHVH7Y.js";
230
230
  import {
231
231
  handleAutoUpdate,
232
232
  isDevelopment,
233
233
  relaunchApp,
234
234
  require_semver,
235
235
  setUpdateHandler
236
- } from "./chunk-JLKRLYZG.js";
236
+ } from "./chunk-QQNZHLIF.js";
237
237
  import {
238
238
  isTodoList,
239
239
  mapCoreStatusToDisplayStatus,
240
240
  require_react
241
- } from "./chunk-4BWP3TDK.js";
241
+ } from "./chunk-KSDBDSBI.js";
242
242
  import {
243
243
  registerCleanup,
244
244
  removeCleanup,
245
245
  runExitCleanup,
246
246
  setupTtyCheck
247
- } from "./chunk-WRWAVEME.js";
247
+ } from "./chunk-W7J7YSH2.js";
248
248
  import {
249
249
  ACTIVATE_SKILL_TOOL_NAME,
250
250
  AGENT_TOOL_NAME,
@@ -368,8 +368,10 @@ import {
368
368
  getPackageJson,
369
369
  getPlanModeExitMessage,
370
370
  getResponseText,
371
+ getShellConfiguration,
371
372
  getVersion,
372
373
  hasRedirection,
374
+ hasRedirectionAsync,
373
375
  hasSummary,
374
376
  hasValidEditorCommand,
375
377
  homedir,
@@ -381,11 +383,15 @@ import {
381
383
  isBackgroundExecutionData,
382
384
  isBinary,
383
385
  isBinaryAvailable,
386
+ isDefaultHasRedirection,
387
+ isDefaultIsInteractiveGeminiCommand,
384
388
  isEditorAvailable,
385
389
  isFileDiff,
386
390
  isGrepResult,
387
391
  isHeadlessMode,
388
392
  isInteractiveGeminiCommand,
393
+ isInteractiveGeminiCommandAsync,
394
+ isKnownInteractiveGeminiCommandSync,
389
395
  isListResult,
390
396
  isNodeError,
391
397
  isOverageEligibleModel,
@@ -441,7 +447,7 @@ import {
441
447
  validatePlanContent,
442
448
  validatePlanPath,
443
449
  writeToStdout
444
- } from "./chunk-37D3S3FZ.js";
450
+ } from "./chunk-BTH7KEMH.js";
445
451
  import "./chunk-W2AJR23G.js";
446
452
  import "./chunk-N7J54YNL.js";
447
453
  import "./chunk-L6PII3GR.js";
@@ -12622,9 +12628,7 @@ ${deceptiveUrlWarnings.map(
12622
12628
  } else if (confirmationDetails.type === "exec") {
12623
12629
  const executionProps = confirmationDetails;
12624
12630
  const commandsToDisplay = executionProps.commands && executionProps.commands.length > 0 ? executionProps.commands : [executionProps.command];
12625
- const containsRedirection = commandsToDisplay.some(
12626
- (cmd) => hasRedirection(cmd)
12627
- );
12631
+ const containsRedirection = typeof executionProps.hasRedirection === "boolean" ? executionProps.hasRedirection : commandsToDisplay.some((cmd) => hasRedirection(cmd));
12628
12632
  const isAutoEdit = config.getApprovalMode() === "yolo" /* YOLO */ || config.getApprovalMode() === "autoEdit" /* AUTO_EDIT */;
12629
12633
  if (containsRedirection && !isAutoEdit) {
12630
12634
  extraInfoLines = 1;
@@ -12851,9 +12855,7 @@ Ensure you trust all modifications made to build files before approving executio
12851
12855
  const executionProps = confirmationDetails;
12852
12856
  const isShell = isShellTool(toolName);
12853
12857
  const commandsToDisplay = executionProps.commands && executionProps.commands.length > 1 ? executionProps.commands : [executionProps.command];
12854
- const containsRedirection = commandsToDisplay.some(
12855
- (cmd) => hasRedirection(cmd)
12856
- );
12858
+ const containsRedirection = typeof executionProps.hasRedirection === "boolean" ? executionProps.hasRedirection : commandsToDisplay.some((cmd) => hasRedirection(cmd));
12857
12859
  const isAutoEdit = config.getApprovalMode() === "yolo" /* YOLO */ || config.getApprovalMode() === "autoEdit" /* AUTO_EDIT */;
12858
12860
  let warnings = null;
12859
12861
  if (containsRedirection && !isAutoEdit) {
@@ -25022,7 +25024,9 @@ var useExecutionLifecycle = (addItemToHistory, setPendingHistoryItem, onExec, on
25022
25024
  { type: "user_shell", text: rawQuery },
25023
25025
  userMessageTimestamp
25024
25026
  );
25025
- if (isInteractiveGeminiCommand(rawQuery)) {
25027
+ const useAsyncPowerShellGeminiCheck = typeof isDefaultIsInteractiveGeminiCommand === "function" && isDefaultIsInteractiveGeminiCommand(isInteractiveGeminiCommand) && typeof isInteractiveGeminiCommandAsync === "function" && typeof isKnownInteractiveGeminiCommandSync === "function" && typeof getShellConfiguration === "function" && getShellConfiguration().shell === "powershell";
25028
+ const syncInteractiveGeminiCheck = useAsyncPowerShellGeminiCheck ? isKnownInteractiveGeminiCommandSync(rawQuery) : isInteractiveGeminiCommand(rawQuery);
25029
+ if (syncInteractiveGeminiCheck === true) {
25026
25030
  addItemToHistory(
25027
25031
  { type: "error", text: INTERACTIVE_GEMINI_SHELL_ERROR },
25028
25032
  userMessageTimestamp
@@ -25034,6 +25038,22 @@ var useExecutionLifecycle = (addItemToHistory, setPendingHistoryItem, onExec, on
25034
25038
  let commandToExecute = rawQuery;
25035
25039
  let pwdFilePath;
25036
25040
  const executeCommand = async () => {
25041
+ if (syncInteractiveGeminiCheck === void 0 && await isInteractiveGeminiCommandAsync(
25042
+ rawQuery,
25043
+ void 0,
25044
+ abortSignal
25045
+ )) {
25046
+ addItemToHistory(
25047
+ { type: "error", text: INTERACTIVE_GEMINI_SHELL_ERROR },
25048
+ userMessageTimestamp
25049
+ );
25050
+ return;
25051
+ }
25052
+ if (abortSignal.aborted) {
25053
+ setPendingHistoryItem(null);
25054
+ setShellInputFocused(false);
25055
+ return;
25056
+ }
25037
25057
  let cumulativeStdout = "";
25038
25058
  let isBinaryStream = false;
25039
25059
  let binaryBytesReceived = 0;
@@ -27741,8 +27761,48 @@ var import_react101 = __toESM(require_react(), 1);
27741
27761
 
27742
27762
  // packages/cli/src/ui/hooks/useTurnActivityMonitor.ts
27743
27763
  var import_react100 = __toESM(require_react(), 1);
27764
+ var EMPTY_REDIRECTION_MAP = /* @__PURE__ */ new Map();
27765
+ function redirectionCacheReducer(state, action) {
27766
+ switch (action.type) {
27767
+ case "set": {
27768
+ if (state.get(action.command) === action.hasRedirection) {
27769
+ return state;
27770
+ }
27771
+ const next = new Map(state);
27772
+ next.set(action.command, action.hasRedirection);
27773
+ return next;
27774
+ }
27775
+ case "reset":
27776
+ return state.size === 0 ? state : EMPTY_REDIRECTION_MAP;
27777
+ default:
27778
+ return state;
27779
+ }
27780
+ }
27781
+ function shouldUseAsyncPowerShellRedirection() {
27782
+ return typeof isDefaultHasRedirection === "function" && isDefaultHasRedirection(hasRedirection) && typeof hasRedirectionAsync === "function" && typeof getShellConfiguration === "function" && getShellConfiguration().shell === "powershell";
27783
+ }
27784
+ function extractShellCommand(tc) {
27785
+ const rawCommand = tc.request.args?.["command"];
27786
+ return typeof rawCommand === "string" ? rawCommand : "";
27787
+ }
27744
27788
  var useTurnActivityMonitor = (streamingState, activePtyId, pendingToolCalls = []) => {
27745
27789
  const [operationStartTime, setOperationStartTime] = (0, import_react100.useState)(0);
27790
+ const [resolvedRedirections, dispatchRedirection] = (0, import_react100.useReducer)(
27791
+ redirectionCacheReducer,
27792
+ EMPTY_REDIRECTION_MAP
27793
+ );
27794
+ const inFlightCommandsRef = (0, import_react100.useRef)(/* @__PURE__ */ new Set());
27795
+ const turnEpochRef = (0, import_react100.useRef)(0);
27796
+ const turnAbortControllerRef = (0, import_react100.useRef)(null);
27797
+ const isMountedRef = (0, import_react100.useRef)(true);
27798
+ (0, import_react100.useEffect)(() => {
27799
+ isMountedRef.current = true;
27800
+ return () => {
27801
+ isMountedRef.current = false;
27802
+ turnAbortControllerRef.current?.abort();
27803
+ turnAbortControllerRef.current = null;
27804
+ };
27805
+ }, []);
27746
27806
  const prevPtyIdRef = (0, import_react100.useRef)(void 0);
27747
27807
  const prevStreamingStateRef = (0, import_react100.useRef)(void 0);
27748
27808
  (0, import_react100.useEffect)(() => {
@@ -27757,17 +27817,69 @@ var useTurnActivityMonitor = (streamingState, activePtyId, pendingToolCalls = []
27757
27817
  prevPtyIdRef.current = activePtyId;
27758
27818
  prevStreamingStateRef.current = streamingState;
27759
27819
  }, [streamingState, activePtyId]);
27760
- const isRedirectionActive = (0, import_react100.useMemo)(
27761
- () => (
27762
- // Check active tool calls for run_shell_command
27763
- pendingToolCalls.some((tc) => {
27764
- if (tc.request.name !== "run_shell_command") return false;
27765
- const command = tc.request.args?.command || "";
27820
+ (0, import_react100.useEffect)(() => {
27821
+ if (streamingState === "idle" /* Idle */ && pendingToolCalls.length === 0) {
27822
+ turnEpochRef.current += 1;
27823
+ turnAbortControllerRef.current?.abort();
27824
+ turnAbortControllerRef.current = null;
27825
+ inFlightCommandsRef.current.clear();
27826
+ dispatchRedirection({ type: "reset" });
27827
+ return;
27828
+ }
27829
+ if (!shouldUseAsyncPowerShellRedirection()) {
27830
+ return;
27831
+ }
27832
+ if (!turnAbortControllerRef.current || turnAbortControllerRef.current.signal.aborted) {
27833
+ turnAbortControllerRef.current = new AbortController();
27834
+ }
27835
+ const turnSignal = turnAbortControllerRef.current.signal;
27836
+ const epoch = turnEpochRef.current;
27837
+ for (const tc of pendingToolCalls) {
27838
+ if (tc.request.name !== "run_shell_command") {
27839
+ continue;
27840
+ }
27841
+ if (tc.confirmationDetails?.type === "exec" && typeof tc.confirmationDetails.hasRedirection === "boolean") {
27842
+ continue;
27843
+ }
27844
+ const command = extractShellCommand(tc);
27845
+ if (!command || !/[><]/.test(command) || resolvedRedirections.has(command) || inFlightCommandsRef.current.has(command)) {
27846
+ continue;
27847
+ }
27848
+ inFlightCommandsRef.current.add(command);
27849
+ void hasRedirectionAsync(command, void 0, turnSignal).then((redirected) => {
27850
+ inFlightCommandsRef.current.delete(command);
27851
+ if (isMountedRef.current && turnEpochRef.current === epoch && !turnSignal.aborted) {
27852
+ dispatchRedirection({
27853
+ type: "set",
27854
+ command,
27855
+ hasRedirection: redirected
27856
+ });
27857
+ }
27858
+ }).catch(() => {
27859
+ inFlightCommandsRef.current.delete(command);
27860
+ });
27861
+ }
27862
+ }, [streamingState, pendingToolCalls, resolvedRedirections]);
27863
+ const isRedirectionActive = (0, import_react100.useMemo)(() => {
27864
+ const useAsyncPowerShell = shouldUseAsyncPowerShellRedirection();
27865
+ return pendingToolCalls.some((tc) => {
27866
+ if (tc.request.name !== "run_shell_command") return false;
27867
+ if (tc.confirmationDetails?.type === "exec" && typeof tc.confirmationDetails.hasRedirection === "boolean") {
27868
+ return tc.confirmationDetails.hasRedirection;
27869
+ }
27870
+ const command = extractShellCommand(tc);
27871
+ if (!command) {
27872
+ return false;
27873
+ }
27874
+ if (!useAsyncPowerShell) {
27766
27875
  return hasRedirection(command);
27767
- })
27768
- ),
27769
- [pendingToolCalls]
27770
- );
27876
+ }
27877
+ if (!/[><]/.test(command)) {
27878
+ return false;
27879
+ }
27880
+ return resolvedRedirections.get(command) ?? false;
27881
+ });
27882
+ }, [pendingToolCalls, resolvedRedirections]);
27771
27883
  return {
27772
27884
  operationStartTime,
27773
27885
  isRedirectionActive
@@ -27859,7 +27971,8 @@ var useAgentStream = ({
27859
27971
  isClientInitiated: t.isClientInitiated ?? false,
27860
27972
  prompt_id: ""
27861
27973
  },
27862
- status: t.status
27974
+ status: t.status,
27975
+ confirmationDetails: t.confirmationDetails
27863
27976
  })),
27864
27977
  [trackedTools]
27865
27978
  );
@@ -29835,16 +29948,28 @@ var useGeminiStream = (geminiClient, history, addItem, config, settings, onDebug
29835
29948
  (call) => call.status === "awaiting_approval" && !call.request.forcedAsk
29836
29949
  );
29837
29950
  if (newApprovalMode === "autoEdit" /* AUTO_EDIT */) {
29838
- awaitingApprovalCalls = awaitingApprovalCalls.filter((call) => {
29951
+ const filteredCalls = [];
29952
+ for (const call of awaitingApprovalCalls) {
29839
29953
  if (EDIT_TOOL_NAMES.has(call.request.name)) {
29840
- return true;
29954
+ filteredCalls.push(call);
29955
+ continue;
29841
29956
  }
29842
29957
  if (call.request.name === SHELL_TOOL_NAME) {
29843
- const command = call.request.args.command;
29844
- return command && hasRedirection(command);
29958
+ if (call.confirmationDetails?.type === "exec" && typeof call.confirmationDetails.hasRedirection === "boolean") {
29959
+ if (call.confirmationDetails.hasRedirection) {
29960
+ filteredCalls.push(call);
29961
+ }
29962
+ continue;
29963
+ }
29964
+ const rawCommand = call.request.args["command"];
29965
+ const command = typeof rawCommand === "string" ? rawCommand : void 0;
29966
+ const redirected = command ? typeof isDefaultHasRedirection === "function" && isDefaultHasRedirection(hasRedirection) && typeof hasRedirectionAsync === "function" ? await hasRedirectionAsync(command) : hasRedirection(command) : false;
29967
+ if (redirected) {
29968
+ filteredCalls.push(call);
29969
+ }
29845
29970
  }
29846
- return false;
29847
- });
29971
+ }
29972
+ awaitingApprovalCalls = filteredCalls;
29848
29973
  }
29849
29974
  for (const call of awaitingApprovalCalls) {
29850
29975
  if (call.correlationId) {
@@ -35266,7 +35391,7 @@ ${queuedText}` : queuedText;
35266
35391
  if (keyMatchers["app.showErrorDetails" /* SHOW_ERROR_DETAILS */](key)) {
35267
35392
  if (settings.merged.general.devtools) {
35268
35393
  void (async () => {
35269
- const { toggleDevToolsPanel } = await import("./devtoolsService-WNJOZ7ZT.js");
35394
+ const { toggleDevToolsPanel } = await import("./devtoolsService-3G6P4EBB.js");
35270
35395
  await toggleDevToolsPanel(
35271
35396
  config,
35272
35397
  showErrorDetails,
@@ -149,10 +149,10 @@ import {
149
149
  useUIState,
150
150
  useVimMode,
151
151
  validateAuthMethod
152
- } from "./chunk-FHK4RNCX.js";
152
+ } from "./chunk-IBD2PLWE.js";
153
153
  import {
154
154
  require_source
155
- } from "./chunk-7JS2T75Z.js";
155
+ } from "./chunk-VIXTMKUM.js";
156
156
  import {
157
157
  appEvents
158
158
  } from "./chunk-5PS3AYFU.js";
@@ -226,25 +226,25 @@ import {
226
226
  widestLineFromStyledChars,
227
227
  wordBreakStyledChars,
228
228
  wrapStyledChars
229
- } from "./chunk-LMNAB62M.js";
229
+ } from "./chunk-Y6WF3A3Q.js";
230
230
  import {
231
231
  handleAutoUpdate,
232
232
  isDevelopment,
233
233
  relaunchApp,
234
234
  require_semver,
235
235
  setUpdateHandler
236
- } from "./chunk-3VGGGCOZ.js";
236
+ } from "./chunk-NMOD2T37.js";
237
237
  import {
238
238
  isTodoList,
239
239
  mapCoreStatusToDisplayStatus,
240
240
  require_react
241
- } from "./chunk-5VFAWK3F.js";
241
+ } from "./chunk-UTK4LRWO.js";
242
242
  import {
243
243
  registerCleanup,
244
244
  removeCleanup,
245
245
  runExitCleanup,
246
246
  setupTtyCheck
247
- } from "./chunk-V4HIE5G5.js";
247
+ } from "./chunk-3XHFESDF.js";
248
248
  import {
249
249
  ACTIVATE_SKILL_TOOL_NAME,
250
250
  AGENT_TOOL_NAME,
@@ -387,8 +387,10 @@ import {
387
387
  getPackageJson,
388
388
  getPlanModeExitMessage,
389
389
  getResponseText,
390
+ getShellConfiguration,
390
391
  getVersion,
391
392
  hasRedirection,
393
+ hasRedirectionAsync,
392
394
  hasSummary,
393
395
  hasValidEditorCommand,
394
396
  homedir,
@@ -400,11 +402,15 @@ import {
400
402
  isBackgroundExecutionData,
401
403
  isBinary,
402
404
  isBinaryAvailable,
405
+ isDefaultHasRedirection,
406
+ isDefaultIsInteractiveGeminiCommand,
403
407
  isEditorAvailable,
404
408
  isFileDiff,
405
409
  isGrepResult,
406
410
  isHeadlessMode,
407
411
  isInteractiveGeminiCommand,
412
+ isInteractiveGeminiCommandAsync,
413
+ isKnownInteractiveGeminiCommandSync,
408
414
  isListResult,
409
415
  isNodeError,
410
416
  isOverageEligibleModel,
@@ -460,7 +466,7 @@ import {
460
466
  validatePlanContent,
461
467
  validatePlanPath,
462
468
  writeToStdout
463
- } from "./chunk-UF44X63P.js";
469
+ } from "./chunk-YQO7IBVQ.js";
464
470
  import "./chunk-W2AJR23G.js";
465
471
  import "./chunk-N7J54YNL.js";
466
472
  import "./chunk-L6PII3GR.js";
@@ -12641,9 +12647,7 @@ ${deceptiveUrlWarnings.map(
12641
12647
  } else if (confirmationDetails.type === "exec") {
12642
12648
  const executionProps = confirmationDetails;
12643
12649
  const commandsToDisplay = executionProps.commands && executionProps.commands.length > 0 ? executionProps.commands : [executionProps.command];
12644
- const containsRedirection = commandsToDisplay.some(
12645
- (cmd) => hasRedirection(cmd)
12646
- );
12650
+ const containsRedirection = typeof executionProps.hasRedirection === "boolean" ? executionProps.hasRedirection : commandsToDisplay.some((cmd) => hasRedirection(cmd));
12647
12651
  const isAutoEdit = config.getApprovalMode() === ApprovalMode.YOLO || config.getApprovalMode() === ApprovalMode.AUTO_EDIT;
12648
12652
  if (containsRedirection && !isAutoEdit) {
12649
12653
  extraInfoLines = 1;
@@ -12870,9 +12874,7 @@ Ensure you trust all modifications made to build files before approving executio
12870
12874
  const executionProps = confirmationDetails;
12871
12875
  const isShell = isShellTool(toolName);
12872
12876
  const commandsToDisplay = executionProps.commands && executionProps.commands.length > 1 ? executionProps.commands : [executionProps.command];
12873
- const containsRedirection = commandsToDisplay.some(
12874
- (cmd) => hasRedirection(cmd)
12875
- );
12877
+ const containsRedirection = typeof executionProps.hasRedirection === "boolean" ? executionProps.hasRedirection : commandsToDisplay.some((cmd) => hasRedirection(cmd));
12876
12878
  const isAutoEdit = config.getApprovalMode() === ApprovalMode.YOLO || config.getApprovalMode() === ApprovalMode.AUTO_EDIT;
12877
12879
  let warnings = null;
12878
12880
  if (containsRedirection && !isAutoEdit) {
@@ -25041,7 +25043,9 @@ var useExecutionLifecycle = (addItemToHistory, setPendingHistoryItem, onExec, on
25041
25043
  { type: "user_shell", text: rawQuery },
25042
25044
  userMessageTimestamp
25043
25045
  );
25044
- if (isInteractiveGeminiCommand(rawQuery)) {
25046
+ const useAsyncPowerShellGeminiCheck = typeof isDefaultIsInteractiveGeminiCommand === "function" && isDefaultIsInteractiveGeminiCommand(isInteractiveGeminiCommand) && typeof isInteractiveGeminiCommandAsync === "function" && typeof isKnownInteractiveGeminiCommandSync === "function" && typeof getShellConfiguration === "function" && getShellConfiguration().shell === "powershell";
25047
+ const syncInteractiveGeminiCheck = useAsyncPowerShellGeminiCheck ? isKnownInteractiveGeminiCommandSync(rawQuery) : isInteractiveGeminiCommand(rawQuery);
25048
+ if (syncInteractiveGeminiCheck === true) {
25045
25049
  addItemToHistory(
25046
25050
  { type: "error", text: INTERACTIVE_GEMINI_SHELL_ERROR },
25047
25051
  userMessageTimestamp
@@ -25053,6 +25057,22 @@ var useExecutionLifecycle = (addItemToHistory, setPendingHistoryItem, onExec, on
25053
25057
  let commandToExecute = rawQuery;
25054
25058
  let pwdFilePath;
25055
25059
  const executeCommand = async () => {
25060
+ if (syncInteractiveGeminiCheck === void 0 && await isInteractiveGeminiCommandAsync(
25061
+ rawQuery,
25062
+ void 0,
25063
+ abortSignal
25064
+ )) {
25065
+ addItemToHistory(
25066
+ { type: "error", text: INTERACTIVE_GEMINI_SHELL_ERROR },
25067
+ userMessageTimestamp
25068
+ );
25069
+ return;
25070
+ }
25071
+ if (abortSignal.aborted) {
25072
+ setPendingHistoryItem(null);
25073
+ setShellInputFocused(false);
25074
+ return;
25075
+ }
25056
25076
  let cumulativeStdout = "";
25057
25077
  let isBinaryStream = false;
25058
25078
  let binaryBytesReceived = 0;
@@ -27760,8 +27780,48 @@ var import_react101 = __toESM(require_react(), 1);
27760
27780
 
27761
27781
  // packages/cli/src/ui/hooks/useTurnActivityMonitor.ts
27762
27782
  var import_react100 = __toESM(require_react(), 1);
27783
+ var EMPTY_REDIRECTION_MAP = /* @__PURE__ */ new Map();
27784
+ function redirectionCacheReducer(state, action) {
27785
+ switch (action.type) {
27786
+ case "set": {
27787
+ if (state.get(action.command) === action.hasRedirection) {
27788
+ return state;
27789
+ }
27790
+ const next = new Map(state);
27791
+ next.set(action.command, action.hasRedirection);
27792
+ return next;
27793
+ }
27794
+ case "reset":
27795
+ return state.size === 0 ? state : EMPTY_REDIRECTION_MAP;
27796
+ default:
27797
+ return state;
27798
+ }
27799
+ }
27800
+ function shouldUseAsyncPowerShellRedirection() {
27801
+ return typeof isDefaultHasRedirection === "function" && isDefaultHasRedirection(hasRedirection) && typeof hasRedirectionAsync === "function" && typeof getShellConfiguration === "function" && getShellConfiguration().shell === "powershell";
27802
+ }
27803
+ function extractShellCommand(tc) {
27804
+ const rawCommand = tc.request.args?.["command"];
27805
+ return typeof rawCommand === "string" ? rawCommand : "";
27806
+ }
27763
27807
  var useTurnActivityMonitor = (streamingState, activePtyId, pendingToolCalls = []) => {
27764
27808
  const [operationStartTime, setOperationStartTime] = (0, import_react100.useState)(0);
27809
+ const [resolvedRedirections, dispatchRedirection] = (0, import_react100.useReducer)(
27810
+ redirectionCacheReducer,
27811
+ EMPTY_REDIRECTION_MAP
27812
+ );
27813
+ const inFlightCommandsRef = (0, import_react100.useRef)(/* @__PURE__ */ new Set());
27814
+ const turnEpochRef = (0, import_react100.useRef)(0);
27815
+ const turnAbortControllerRef = (0, import_react100.useRef)(null);
27816
+ const isMountedRef = (0, import_react100.useRef)(true);
27817
+ (0, import_react100.useEffect)(() => {
27818
+ isMountedRef.current = true;
27819
+ return () => {
27820
+ isMountedRef.current = false;
27821
+ turnAbortControllerRef.current?.abort();
27822
+ turnAbortControllerRef.current = null;
27823
+ };
27824
+ }, []);
27765
27825
  const prevPtyIdRef = (0, import_react100.useRef)(void 0);
27766
27826
  const prevStreamingStateRef = (0, import_react100.useRef)(void 0);
27767
27827
  (0, import_react100.useEffect)(() => {
@@ -27776,17 +27836,69 @@ var useTurnActivityMonitor = (streamingState, activePtyId, pendingToolCalls = []
27776
27836
  prevPtyIdRef.current = activePtyId;
27777
27837
  prevStreamingStateRef.current = streamingState;
27778
27838
  }, [streamingState, activePtyId]);
27779
- const isRedirectionActive = (0, import_react100.useMemo)(
27780
- () => (
27781
- // Check active tool calls for run_shell_command
27782
- pendingToolCalls.some((tc) => {
27783
- if (tc.request.name !== "run_shell_command") return false;
27784
- const command = tc.request.args?.command || "";
27839
+ (0, import_react100.useEffect)(() => {
27840
+ if (streamingState === "idle" /* Idle */ && pendingToolCalls.length === 0) {
27841
+ turnEpochRef.current += 1;
27842
+ turnAbortControllerRef.current?.abort();
27843
+ turnAbortControllerRef.current = null;
27844
+ inFlightCommandsRef.current.clear();
27845
+ dispatchRedirection({ type: "reset" });
27846
+ return;
27847
+ }
27848
+ if (!shouldUseAsyncPowerShellRedirection()) {
27849
+ return;
27850
+ }
27851
+ if (!turnAbortControllerRef.current || turnAbortControllerRef.current.signal.aborted) {
27852
+ turnAbortControllerRef.current = new AbortController();
27853
+ }
27854
+ const turnSignal = turnAbortControllerRef.current.signal;
27855
+ const epoch = turnEpochRef.current;
27856
+ for (const tc of pendingToolCalls) {
27857
+ if (tc.request.name !== "run_shell_command") {
27858
+ continue;
27859
+ }
27860
+ if (tc.confirmationDetails?.type === "exec" && typeof tc.confirmationDetails.hasRedirection === "boolean") {
27861
+ continue;
27862
+ }
27863
+ const command = extractShellCommand(tc);
27864
+ if (!command || !/[><]/.test(command) || resolvedRedirections.has(command) || inFlightCommandsRef.current.has(command)) {
27865
+ continue;
27866
+ }
27867
+ inFlightCommandsRef.current.add(command);
27868
+ void hasRedirectionAsync(command, void 0, turnSignal).then((redirected) => {
27869
+ inFlightCommandsRef.current.delete(command);
27870
+ if (isMountedRef.current && turnEpochRef.current === epoch && !turnSignal.aborted) {
27871
+ dispatchRedirection({
27872
+ type: "set",
27873
+ command,
27874
+ hasRedirection: redirected
27875
+ });
27876
+ }
27877
+ }).catch(() => {
27878
+ inFlightCommandsRef.current.delete(command);
27879
+ });
27880
+ }
27881
+ }, [streamingState, pendingToolCalls, resolvedRedirections]);
27882
+ const isRedirectionActive = (0, import_react100.useMemo)(() => {
27883
+ const useAsyncPowerShell = shouldUseAsyncPowerShellRedirection();
27884
+ return pendingToolCalls.some((tc) => {
27885
+ if (tc.request.name !== "run_shell_command") return false;
27886
+ if (tc.confirmationDetails?.type === "exec" && typeof tc.confirmationDetails.hasRedirection === "boolean") {
27887
+ return tc.confirmationDetails.hasRedirection;
27888
+ }
27889
+ const command = extractShellCommand(tc);
27890
+ if (!command) {
27891
+ return false;
27892
+ }
27893
+ if (!useAsyncPowerShell) {
27785
27894
  return hasRedirection(command);
27786
- })
27787
- ),
27788
- [pendingToolCalls]
27789
- );
27895
+ }
27896
+ if (!/[><]/.test(command)) {
27897
+ return false;
27898
+ }
27899
+ return resolvedRedirections.get(command) ?? false;
27900
+ });
27901
+ }, [pendingToolCalls, resolvedRedirections]);
27790
27902
  return {
27791
27903
  operationStartTime,
27792
27904
  isRedirectionActive
@@ -27878,7 +27990,8 @@ var useAgentStream = ({
27878
27990
  isClientInitiated: t.isClientInitiated ?? false,
27879
27991
  prompt_id: ""
27880
27992
  },
27881
- status: t.status
27993
+ status: t.status,
27994
+ confirmationDetails: t.confirmationDetails
27882
27995
  })),
27883
27996
  [trackedTools]
27884
27997
  );
@@ -29854,16 +29967,28 @@ var useGeminiStream = (geminiClient, history, addItem, config, settings, onDebug
29854
29967
  (call) => call.status === "awaiting_approval" && !call.request.forcedAsk
29855
29968
  );
29856
29969
  if (newApprovalMode === ApprovalMode.AUTO_EDIT) {
29857
- awaitingApprovalCalls = awaitingApprovalCalls.filter((call) => {
29970
+ const filteredCalls = [];
29971
+ for (const call of awaitingApprovalCalls) {
29858
29972
  if (EDIT_TOOL_NAMES.has(call.request.name)) {
29859
- return true;
29973
+ filteredCalls.push(call);
29974
+ continue;
29860
29975
  }
29861
29976
  if (call.request.name === SHELL_TOOL_NAME) {
29862
- const command = call.request.args.command;
29863
- return command && hasRedirection(command);
29977
+ if (call.confirmationDetails?.type === "exec" && typeof call.confirmationDetails.hasRedirection === "boolean") {
29978
+ if (call.confirmationDetails.hasRedirection) {
29979
+ filteredCalls.push(call);
29980
+ }
29981
+ continue;
29982
+ }
29983
+ const rawCommand = call.request.args["command"];
29984
+ const command = typeof rawCommand === "string" ? rawCommand : void 0;
29985
+ const redirected = command ? typeof isDefaultHasRedirection === "function" && isDefaultHasRedirection(hasRedirection) && typeof hasRedirectionAsync === "function" ? await hasRedirectionAsync(command) : hasRedirection(command) : false;
29986
+ if (redirected) {
29987
+ filteredCalls.push(call);
29988
+ }
29864
29989
  }
29865
- return false;
29866
- });
29990
+ }
29991
+ awaitingApprovalCalls = filteredCalls;
29867
29992
  }
29868
29993
  for (const call of awaitingApprovalCalls) {
29869
29994
  if (call.correlationId) {
@@ -35285,7 +35410,7 @@ ${queuedText}` : queuedText;
35285
35410
  if (keyMatchers["app.showErrorDetails" /* SHOW_ERROR_DETAILS */](key)) {
35286
35411
  if (settings.merged.general.devtools) {
35287
35412
  void (async () => {
35288
- const { toggleDevToolsPanel } = await import("./devtoolsService-ER22TM2Y.js");
35413
+ const { toggleDevToolsPanel } = await import("./devtoolsService-DWVXCWJ7.js");
35289
35414
  await toggleDevToolsPanel(
35290
35415
  config,
35291
35416
  showErrorDetails,
@@ -3,11 +3,11 @@ import {
3
3
  DEFAULT_PORT,
4
4
  getBinaryPath,
5
5
  isServerRunning
6
- } from "./chunk-GFBMTAPD.js";
7
- import "./chunk-4BWP3TDK.js";
6
+ } from "./chunk-7YXHVH7Y.js";
7
+ import "./chunk-KSDBDSBI.js";
8
8
  import {
9
9
  debugLogger
10
- } from "./chunk-37D3S3FZ.js";
10
+ } from "./chunk-BTH7KEMH.js";
11
11
  import "./chunk-W2AJR23G.js";
12
12
  import "./chunk-N7J54YNL.js";
13
13
  import "./chunk-L6PII3GR.js";
@@ -41,7 +41,7 @@ var LiteRtServerManager = class {
41
41
  `[LiteRtServerManager] Auto-starting LiteRT server on port ${port}...`
42
42
  );
43
43
  try {
44
- const { startServer } = await import("./start-OLEVDFQS.js");
44
+ const { startServer } = await import("./start-JGS6ZUFX.js");
45
45
  const started = await startServer(binaryPath, port);
46
46
  if (started) {
47
47
  debugLogger.log(`[LiteRtServerManager] Server started on port ${port}`);
@@ -3,11 +3,11 @@ import {
3
3
  DEFAULT_PORT,
4
4
  getBinaryPath,
5
5
  isServerRunning
6
- } from "./chunk-LMNAB62M.js";
7
- import "./chunk-5VFAWK3F.js";
6
+ } from "./chunk-Y6WF3A3Q.js";
7
+ import "./chunk-UTK4LRWO.js";
8
8
  import {
9
9
  debugLogger
10
- } from "./chunk-UF44X63P.js";
10
+ } from "./chunk-YQO7IBVQ.js";
11
11
  import "./chunk-W2AJR23G.js";
12
12
  import "./chunk-N7J54YNL.js";
13
13
  import "./chunk-L6PII3GR.js";
@@ -41,7 +41,7 @@ var LiteRtServerManager = class {
41
41
  `[LiteRtServerManager] Auto-starting LiteRT server on port ${port}...`
42
42
  );
43
43
  try {
44
- const { startServer } = await import("./start-Q66LTS3Y.js");
44
+ const { startServer } = await import("./start-QQTZCWPJ.js");
45
45
  const started = await startServer(binaryPath, port);
46
46
  if (started) {
47
47
  debugLogger.log(`[LiteRtServerManager] Server started on port ${port}`);