@qwen-code/qwen-code 0.13.1-preview.0 → 0.13.1

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 (2) hide show
  1. package/cli.js +1027 -470
  2. package/package.json +2 -2
package/cli.js CHANGED
@@ -146729,18 +146729,22 @@ var init_openaiLogger = __esm({
146729
146729
  /**
146730
146730
  * Creates a new OpenAI logger
146731
146731
  * @param customLogDir Optional custom log directory path (supports relative paths, absolute paths, and ~ expansion)
146732
+ * @param cwd Optional working directory for resolving relative paths. Defaults to process.cwd().
146733
+ * In ACP mode, process.cwd() may be '/' (filesystem root), so callers should
146734
+ * pass the project working directory from Config.getWorkingDir().
146732
146735
  */
146733
- constructor(customLogDir) {
146736
+ constructor(customLogDir, cwd6) {
146737
+ const baseCwd = cwd6 || process.cwd();
146734
146738
  if (customLogDir) {
146735
146739
  let resolvedPath = customLogDir;
146736
146740
  if (customLogDir === "~" || customLogDir.startsWith("~/")) {
146737
146741
  resolvedPath = path15.join(os6.homedir(), customLogDir.slice(1));
146738
146742
  } else if (!path15.isAbsolute(customLogDir)) {
146739
- resolvedPath = path15.resolve(process.cwd(), customLogDir);
146743
+ resolvedPath = path15.resolve(baseCwd, customLogDir);
146740
146744
  }
146741
146745
  this.logDir = path15.normalize(resolvedPath);
146742
146746
  } else {
146743
- this.logDir = path15.join(process.cwd(), "logs", "openai");
146747
+ this.logDir = path15.join(baseCwd, "logs", "openai");
146744
146748
  }
146745
146749
  }
146746
146750
  /**
@@ -146861,7 +146865,7 @@ var init_loggingContentGenerator = __esm({
146861
146865
  this.config = config2;
146862
146866
  this.modalities = generatorConfig.modalities;
146863
146867
  if (generatorConfig.enableOpenAILogging) {
146864
- this.openaiLogger = new OpenAILogger(generatorConfig.openAILoggingDir);
146868
+ this.openaiLogger = new OpenAILogger(generatorConfig.openAILoggingDir, config2.getWorkingDir());
146865
146869
  this.schemaCompliance = generatorConfig.schemaCompliance;
146866
146870
  }
146867
146871
  }
@@ -171291,7 +171295,7 @@ __export(geminiContentGenerator_exports, {
171291
171295
  createGeminiContentGenerator: () => createGeminiContentGenerator
171292
171296
  });
171293
171297
  function createGeminiContentGenerator(config2, gcConfig) {
171294
- const version2 = "0.13.1-preview.0";
171298
+ const version2 = "0.13.1";
171295
171299
  const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
171296
171300
  const baseHeaders = {
171297
171301
  "User-Agent": userAgent2
@@ -177385,6 +177389,75 @@ var init_rule_parser = __esm({
177385
177389
  }
177386
177390
  });
177387
177391
 
177392
+ // packages/core/dist/src/core/permission-helpers.js
177393
+ import * as path25 from "node:path";
177394
+ function buildPermissionCheckContext(toolName, toolParams, targetDir) {
177395
+ const command2 = "command" in toolParams ? String(toolParams["command"]) : void 0;
177396
+ let filePath = typeof toolParams["file_path"] === "string" ? toolParams["file_path"] : void 0;
177397
+ if (filePath === void 0 && typeof toolParams["path"] === "string") {
177398
+ filePath = path25.isAbsolute(toolParams["path"]) ? toolParams["path"] : path25.resolve(targetDir, toolParams["path"]);
177399
+ }
177400
+ let domain2;
177401
+ if (typeof toolParams["url"] === "string") {
177402
+ try {
177403
+ domain2 = new URL(toolParams["url"]).hostname;
177404
+ } catch {
177405
+ }
177406
+ }
177407
+ const specifier = typeof toolParams["skill"] === "string" ? toolParams["skill"] : typeof toolParams["subagent_type"] === "string" ? toolParams["subagent_type"] : void 0;
177408
+ return { toolName, command: command2, filePath, domain: domain2, specifier };
177409
+ }
177410
+ async function evaluatePermissionRules(pm, defaultPermission, pmCtx) {
177411
+ let finalPermission = defaultPermission;
177412
+ let pmForcedAsk = false;
177413
+ if (pm && defaultPermission !== "deny") {
177414
+ if (pm.hasRelevantRules(pmCtx)) {
177415
+ const pmDecision = await pm.evaluate(pmCtx);
177416
+ if (pmDecision !== "default") {
177417
+ finalPermission = pmDecision;
177418
+ if (pmDecision === "ask" && pm.hasMatchingAskRule(pmCtx)) {
177419
+ pmForcedAsk = true;
177420
+ }
177421
+ }
177422
+ }
177423
+ }
177424
+ return { finalPermission, pmForcedAsk };
177425
+ }
177426
+ function injectPermissionRulesIfMissing(confirmationDetails, pmCtx) {
177427
+ if ((confirmationDetails.type === "exec" || confirmationDetails.type === "mcp" || confirmationDetails.type === "info") && !confirmationDetails.permissionRules) {
177428
+ confirmationDetails.permissionRules = buildPermissionRules(pmCtx);
177429
+ }
177430
+ }
177431
+ async function persistPermissionOutcome(outcome, confirmationDetails, persistFn, pm, payload) {
177432
+ if (outcome !== ToolConfirmationOutcome.ProceedAlwaysProject && outcome !== ToolConfirmationOutcome.ProceedAlwaysUser) {
177433
+ return;
177434
+ }
177435
+ const scope = outcome === ToolConfirmationOutcome.ProceedAlwaysProject ? "project" : "user";
177436
+ const detailsRules = confirmationDetails?.["permissionRules"];
177437
+ const payloadRules = payload?.permissionRules;
177438
+ const rules = payloadRules ?? detailsRules ?? [];
177439
+ if (rules.length > 0) {
177440
+ for (const rule of rules) {
177441
+ if (persistFn) {
177442
+ await persistFn(scope, "allow", rule);
177443
+ }
177444
+ pm?.addPersistentRule(rule, "allow");
177445
+ }
177446
+ }
177447
+ }
177448
+ var init_permission_helpers = __esm({
177449
+ "packages/core/dist/src/core/permission-helpers.js"() {
177450
+ "use strict";
177451
+ init_esbuild_shims();
177452
+ init_tools();
177453
+ init_rule_parser();
177454
+ __name(buildPermissionCheckContext, "buildPermissionCheckContext");
177455
+ __name(evaluatePermissionRules, "evaluatePermissionRules");
177456
+ __name(injectPermissionRulesIfMissing, "injectPermissionRulesIfMissing");
177457
+ __name(persistPermissionOutcome, "persistPermissionOutcome");
177458
+ }
177459
+ });
177460
+
177388
177461
  // packages/core/dist/src/utils/editor.js
177389
177462
  import { execSync as execSync3, spawn, spawnSync } from "node:child_process";
177390
177463
  function isValidEditorType(editor) {
@@ -177554,22 +177627,22 @@ var init_editor = __esm({
177554
177627
 
177555
177628
  // packages/core/dist/src/tools/modifiable-tool.js
177556
177629
  import os12 from "node:os";
177557
- import path25 from "node:path";
177630
+ import path26 from "node:path";
177558
177631
  import fs29 from "node:fs";
177559
177632
  function isModifiableDeclarativeTool(tool) {
177560
177633
  return "getModifyContext" in tool;
177561
177634
  }
177562
177635
  function createTempFilesForModify(currentContent, proposedContent, file_path) {
177563
177636
  const tempDir = os12.tmpdir();
177564
- const diffDir = path25.join(tempDir, "qwen-code-tool-modify-diffs");
177637
+ const diffDir = path26.join(tempDir, "qwen-code-tool-modify-diffs");
177565
177638
  if (!fs29.existsSync(diffDir)) {
177566
177639
  fs29.mkdirSync(diffDir, { recursive: true });
177567
177640
  }
177568
- const ext2 = path25.extname(file_path);
177569
- const fileName = path25.basename(file_path, ext2);
177641
+ const ext2 = path26.extname(file_path);
177642
+ const fileName = path26.basename(file_path, ext2);
177570
177643
  const timestamp = Date.now();
177571
- const tempOldPath = path25.join(diffDir, `qwen-code-modify-${fileName}-old-${timestamp}${ext2}`);
177572
- const tempNewPath = path25.join(diffDir, `qwen-code-modify-${fileName}-new-${timestamp}${ext2}`);
177644
+ const tempOldPath = path26.join(diffDir, `qwen-code-modify-${fileName}-old-${timestamp}${ext2}`);
177645
+ const tempNewPath = path26.join(diffDir, `qwen-code-modify-${fileName}-new-${timestamp}${ext2}`);
177573
177646
  fs29.writeFileSync(tempOldPath, currentContent, "utf8");
177574
177647
  fs29.writeFileSync(tempNewPath, proposedContent, "utf8");
177575
177648
  return { oldPath: tempOldPath, newPath: tempNewPath };
@@ -177592,7 +177665,7 @@ function getUpdatedParams(tmpOldPath, tempNewPath, originalParams, modifyContext
177592
177665
  newContent = "";
177593
177666
  }
177594
177667
  const updatedParams = modifyContext.createUpdatedParams(oldContent, newContent, originalParams);
177595
- const updatedDiff = createPatch(path25.basename(modifyContext.getFilePath(originalParams)), oldContent, newContent, "Current", "Proposed", DEFAULT_DIFF_OPTIONS);
177668
+ const updatedDiff = createPatch(path26.basename(modifyContext.getFilePath(originalParams)), oldContent, newContent, "Current", "Proposed", DEFAULT_DIFF_OPTIONS);
177596
177669
  return { updatedParams, updatedDiff };
177597
177670
  }
177598
177671
  function deleteTempFiles(oldPath, newPath) {
@@ -178888,7 +178961,7 @@ function detectCommandSubstitution(command2) {
178888
178961
  }
178889
178962
  return false;
178890
178963
  }
178891
- function checkCommandPermissions(command2, config2, sessionAllowlist) {
178964
+ async function checkCommandPermissions(command2, config2, sessionAllowlist) {
178892
178965
  if (detectCommandSubstitution(command2)) {
178893
178966
  return {
178894
178967
  allAllowed: false,
@@ -178912,7 +178985,7 @@ function checkCommandPermissions(command2, config2, sessionAllowlist) {
178912
178985
  if (isSessionAllowed)
178913
178986
  continue;
178914
178987
  }
178915
- const decision = pm.isCommandAllowed(cmd);
178988
+ const decision = await pm.isCommandAllowed(cmd);
178916
178989
  if (decision === "deny") {
178917
178990
  return {
178918
178991
  allAllowed: false,
@@ -179080,8 +179153,8 @@ function isCommandAvailable(command2) {
179080
179153
  const { path: path134, error: error40 } = resolveCommandPath(command2);
179081
179154
  return { available: path134 !== null, error: error40 };
179082
179155
  }
179083
- function isCommandAllowed(command2, config2) {
179084
- const { allAllowed, blockReason } = checkCommandPermissions(command2, config2);
179156
+ async function isCommandAllowed(command2, config2) {
179157
+ const { allAllowed, blockReason } = await checkCommandPermissions(command2, config2);
179085
179158
  if (allAllowed) {
179086
179159
  return { allowed: true };
179087
179160
  }
@@ -186748,12 +186821,12 @@ ${JSON.stringify(symbolNames, null, 2)}`);
186748
186821
  });
186749
186822
 
186750
186823
  // packages/core/dist/src/utils/shellAstParser.js
186751
- import path26 from "node:path";
186824
+ import path27 from "node:path";
186752
186825
  import { fileURLToPath as fileURLToPath3 } from "node:url";
186753
186826
  function resolveWasmPath(filename) {
186754
- const inSrcUtils = __filename_.includes(path26.join("src", "utils"));
186827
+ const inSrcUtils = __filename_.includes(path27.join("src", "utils"));
186755
186828
  const levelsUp = !inSrcUtils ? 0 : __filename_.endsWith(".ts") ? 2 : 3;
186756
- return path26.join(__dirname_, ...Array(levelsUp).fill(".."), "vendor", "tree-sitter", filename);
186829
+ return path27.join(__dirname_, ...Array(levelsUp).fill(".."), "vendor", "tree-sitter", filename);
186757
186830
  }
186758
186831
  async function initParser() {
186759
186832
  if (parserInstance)
@@ -187059,7 +187132,7 @@ var init_shellAstParser = __esm({
187059
187132
  init_esbuild_shims();
187060
187133
  import_web_tree_sitter = __toESM(require_tree_sitter(), 1);
187061
187134
  __filename_ = fileURLToPath3(import.meta.url);
187062
- __dirname_ = path26.dirname(__filename_);
187135
+ __dirname_ = path27.dirname(__filename_);
187063
187136
  READ_ONLY_ROOT_COMMANDS2 = /* @__PURE__ */ new Set([
187064
187137
  "awk",
187065
187138
  "basename",
@@ -187584,7 +187657,7 @@ var init_shellAstParser = __esm({
187584
187657
 
187585
187658
  // packages/core/dist/src/tools/shell.js
187586
187659
  import fs30 from "node:fs";
187587
- import path27 from "node:path";
187660
+ import path28 from "node:path";
187588
187661
  import os15, { EOL } from "node:os";
187589
187662
  import crypto8 from "node:crypto";
187590
187663
  function getShellToolDescription() {
@@ -187717,19 +187790,30 @@ var init_shell = __esm({
187717
187790
  */
187718
187791
  async getConfirmationDetails(_abortSignal) {
187719
187792
  const command2 = stripShellWrapper(this.params.command);
187793
+ const pm = this.config.getPermissionManager?.();
187720
187794
  const subCommands = splitCommands(command2);
187721
- const nonReadOnlySubCommands = [];
187795
+ const confirmableSubCommands = [];
187722
187796
  for (const sub of subCommands) {
187797
+ let isReadOnly = false;
187723
187798
  try {
187724
- const isReadOnly = await isShellCommandReadOnlyAST(sub);
187725
- if (!isReadOnly) {
187726
- nonReadOnlySubCommands.push(sub);
187727
- }
187799
+ isReadOnly = await isShellCommandReadOnlyAST(sub);
187728
187800
  } catch {
187729
- nonReadOnlySubCommands.push(sub);
187730
187801
  }
187802
+ if (isReadOnly) {
187803
+ continue;
187804
+ }
187805
+ if (pm) {
187806
+ try {
187807
+ if (await pm.isCommandAllowed(sub) === "allow") {
187808
+ continue;
187809
+ }
187810
+ } catch (e4) {
187811
+ debugLogger28.warn("PermissionManager command check failed:", e4);
187812
+ }
187813
+ }
187814
+ confirmableSubCommands.push(sub);
187731
187815
  }
187732
- const effectiveSubCommands = nonReadOnlySubCommands.length > 0 ? nonReadOnlySubCommands : subCommands;
187816
+ const effectiveSubCommands = confirmableSubCommands.length > 0 ? confirmableSubCommands : subCommands;
187733
187817
  const rootCommands = [
187734
187818
  ...new Set(effectiveSubCommands.map((c4) => getCommandRoot(c4)).filter((c4) => !!c4))
187735
187819
  ];
@@ -187771,7 +187855,7 @@ var init_shell = __esm({
187771
187855
  }
187772
187856
  const isWindows9 = os15.platform() === "win32";
187773
187857
  const tempFileName = `shell_pgrep_${crypto8.randomBytes(6).toString("hex")}.tmp`;
187774
- const tempFilePath = path27.join(os15.tmpdir(), tempFileName);
187858
+ const tempFilePath = path28.join(os15.tmpdir(), tempFileName);
187775
187859
  try {
187776
187860
  const processedCommand = this.addCoAuthorToGitCommit(strippedCommand);
187777
187861
  const shouldRunInBackground = this.params.is_background;
@@ -188028,11 +188112,11 @@ Co-authored-by: ${gitCoAuthorSettings.name} <${gitCoAuthorSettings.email}>`;
188028
188112
  }
188029
188113
  }
188030
188114
  if (params.directory) {
188031
- if (!path27.isAbsolute(params.directory)) {
188115
+ if (!path28.isAbsolute(params.directory)) {
188032
188116
  return "Directory must be an absolute path.";
188033
188117
  }
188034
188118
  const userSkillsDirs = this.config.storage.getUserSkillsDirs();
188035
- const resolvedDirectoryPath = path27.resolve(params.directory);
188119
+ const resolvedDirectoryPath = path28.resolve(params.directory);
188036
188120
  const isWithinUserSkills = isSubpaths(userSkillsDirs, resolvedDirectoryPath);
188037
188121
  if (isWithinUserSkills) {
188038
188122
  return `Explicitly running shell commands from within the user skills directory is not allowed. Please use absolute paths for command parameter instead.`;
@@ -188053,7 +188137,6 @@ Co-authored-by: ${gitCoAuthorSettings.name} <${gitCoAuthorSettings.email}>`;
188053
188137
  });
188054
188138
 
188055
188139
  // packages/core/dist/src/core/coreToolScheduler.js
188056
- import * as path28 from "node:path";
188057
188140
  function createFunctionResponsePart(callId, toolName, output, mediaParts) {
188058
188141
  const functionResponse = {
188059
188142
  id: callId,
@@ -188133,7 +188216,7 @@ var init_coreToolScheduler = __esm({
188133
188216
  init_types6();
188134
188217
  init_src2();
188135
188218
  init_tool_names();
188136
- init_rule_parser();
188219
+ init_permission_helpers();
188137
188220
  init_generateContentResponseUtilities();
188138
188221
  init_modifiable_tool();
188139
188222
  init_lib();
@@ -188424,20 +188507,22 @@ var init_coreToolScheduler = __esm({
188424
188507
  throw new Error("Cannot schedule new tool calls while other tool calls are actively running (executing or awaiting approval).");
188425
188508
  }
188426
188509
  const requestsToProcess = Array.isArray(request4) ? request4 : [request4];
188427
- const newToolCalls = requestsToProcess.map((reqInfo) => {
188510
+ const newToolCalls = [];
188511
+ for (const reqInfo of requestsToProcess) {
188428
188512
  const pm = this.config.getPermissionManager?.();
188429
- if (pm && !pm.isToolEnabled(reqInfo.name)) {
188513
+ if (pm && !await pm.isToolEnabled(reqInfo.name)) {
188430
188514
  const matchingRule = pm.findMatchingDenyRule({
188431
188515
  toolName: reqInfo.name
188432
188516
  });
188433
188517
  const ruleInfo = matchingRule ? ` Matching deny rule: "${matchingRule}".` : "";
188434
188518
  const permissionErrorMessage = `Qwen Code requires permission to use "${reqInfo.name}", but that permission was declined.${ruleInfo}`;
188435
- return {
188519
+ newToolCalls.push({
188436
188520
  status: "error",
188437
188521
  request: reqInfo,
188438
188522
  response: createErrorResponse(reqInfo, new Error(permissionErrorMessage), ToolErrorType.EXECUTION_DENIED),
188439
188523
  durationMs: 0
188440
- };
188524
+ });
188525
+ continue;
188441
188526
  }
188442
188527
  if (!pm) {
188443
188528
  const excludeTools = this.config.getPermissionsDeny?.() ?? void 0;
@@ -188446,54 +188531,58 @@ var init_coreToolScheduler = __esm({
188446
188531
  const excludedMatch = excludeTools.find((excludedTool) => excludedTool.toLowerCase().trim() === normalizedToolName);
188447
188532
  if (excludedMatch) {
188448
188533
  const permissionErrorMessage = `Qwen Code requires permission to use ${excludedMatch}, but that permission was declined.`;
188449
- return {
188534
+ newToolCalls.push({
188450
188535
  status: "error",
188451
188536
  request: reqInfo,
188452
188537
  response: createErrorResponse(reqInfo, new Error(permissionErrorMessage), ToolErrorType.EXECUTION_DENIED),
188453
188538
  durationMs: 0
188454
- };
188539
+ });
188540
+ continue;
188455
188541
  }
188456
188542
  }
188457
188543
  }
188458
188544
  const toolInstance = this.toolRegistry.getTool(reqInfo.name);
188459
188545
  if (!toolInstance) {
188460
188546
  const errorMessage = this.getToolNotFoundMessage(reqInfo.name);
188461
- return {
188547
+ newToolCalls.push({
188462
188548
  status: "error",
188463
188549
  request: reqInfo,
188464
188550
  response: createErrorResponse(reqInfo, new Error(errorMessage), ToolErrorType.TOOL_NOT_REGISTERED),
188465
188551
  durationMs: 0
188466
- };
188552
+ });
188553
+ continue;
188467
188554
  }
188468
188555
  const invocationOrError = this.buildInvocation(toolInstance, reqInfo.args);
188469
188556
  if (invocationOrError instanceof Error) {
188470
188557
  const error40 = reqInfo.wasOutputTruncated ? new Error(`${invocationOrError.message} ${TRUNCATION_PARAM_GUIDANCE}`) : invocationOrError;
188471
- return {
188558
+ newToolCalls.push({
188472
188559
  status: "error",
188473
188560
  request: reqInfo,
188474
188561
  tool: toolInstance,
188475
188562
  response: createErrorResponse(reqInfo, error40, ToolErrorType.INVALID_TOOL_PARAMS),
188476
188563
  durationMs: 0
188477
- };
188564
+ });
188565
+ continue;
188478
188566
  }
188479
188567
  if (reqInfo.wasOutputTruncated && toolInstance.kind === Kind.Edit) {
188480
188568
  const truncationError = new Error(TRUNCATION_EDIT_REJECTION);
188481
- return {
188569
+ newToolCalls.push({
188482
188570
  status: "error",
188483
188571
  request: reqInfo,
188484
188572
  tool: toolInstance,
188485
188573
  response: createErrorResponse(reqInfo, truncationError, ToolErrorType.OUTPUT_TRUNCATED),
188486
188574
  durationMs: 0
188487
- };
188575
+ });
188576
+ continue;
188488
188577
  }
188489
- return {
188578
+ newToolCalls.push({
188490
188579
  status: "validating",
188491
188580
  request: reqInfo,
188492
188581
  tool: toolInstance,
188493
188582
  invocation: invocationOrError,
188494
188583
  startTime: Date.now()
188495
- };
188496
- });
188584
+ });
188585
+ }
188497
188586
  this.toolCalls = this.toolCalls.concat(newToolCalls);
188498
188587
  this.notifyToolCallsUpdate();
188499
188588
  for (const toolCall of newToolCalls) {
@@ -188508,40 +188597,9 @@ var init_coreToolScheduler = __esm({
188508
188597
  }
188509
188598
  const defaultPermission = await invocation.getDefaultPermission();
188510
188599
  const pm = this.config.getPermissionManager?.();
188511
- let finalPermission = defaultPermission;
188512
- let pmForcedAsk = false;
188513
188600
  const toolParams = invocation.params;
188514
- const shellCommand = "command" in toolParams ? String(toolParams["command"]) : void 0;
188515
- let invocationFilePath = typeof toolParams["file_path"] === "string" ? toolParams["file_path"] : void 0;
188516
- if (invocationFilePath === void 0 && typeof toolParams["path"] === "string") {
188517
- invocationFilePath = path28.isAbsolute(toolParams["path"]) ? toolParams["path"] : path28.resolve(this.config.getTargetDir(), toolParams["path"]);
188518
- }
188519
- let invocationDomain;
188520
- if (typeof toolParams["url"] === "string") {
188521
- try {
188522
- invocationDomain = new URL(toolParams["url"]).hostname;
188523
- } catch {
188524
- }
188525
- }
188526
- const literalSpecifier = typeof toolParams["skill"] === "string" ? toolParams["skill"] : typeof toolParams["subagent_type"] === "string" ? toolParams["subagent_type"] : void 0;
188527
- const pmCtx = {
188528
- toolName: reqInfo.name,
188529
- command: shellCommand,
188530
- filePath: invocationFilePath,
188531
- domain: invocationDomain,
188532
- specifier: literalSpecifier
188533
- };
188534
- if (pm && defaultPermission !== "deny") {
188535
- if (pm.hasRelevantRules(pmCtx)) {
188536
- const pmDecision = pm.evaluate(pmCtx);
188537
- if (pmDecision !== "default") {
188538
- finalPermission = pmDecision;
188539
- if (pmDecision === "ask") {
188540
- pmForcedAsk = true;
188541
- }
188542
- }
188543
- }
188544
- }
188601
+ const pmCtx = buildPermissionCheckContext(reqInfo.name, toolParams, this.config.getTargetDir?.() ?? "");
188602
+ const { finalPermission, pmForcedAsk } = await evaluatePermissionRules(pm, defaultPermission, pmCtx);
188545
188603
  const approvalMode = this.config.getApprovalMode();
188546
188604
  const isPlanMode = approvalMode === ApprovalMode.PLAN;
188547
188605
  const isExitPlanModeTool = reqInfo.name === "exit_plan_mode";
@@ -188576,9 +188634,7 @@ var init_coreToolScheduler = __esm({
188576
188634
  });
188577
188635
  } else {
188578
188636
  const confirmationDetails = await invocation.getConfirmationDetails(signal);
188579
- if ((confirmationDetails.type === "exec" || confirmationDetails.type === "mcp" || confirmationDetails.type === "info") && !confirmationDetails.permissionRules) {
188580
- confirmationDetails.permissionRules = buildPermissionRules(pmCtx);
188581
- }
188637
+ injectPermissionRulesIfMissing(confirmationDetails, pmCtx);
188582
188638
  if (approvalMode === ApprovalMode.AUTO_EDIT && (confirmationDetails.type === "edit" || confirmationDetails.type === "info")) {
188583
188639
  this.setToolCallOutcome(reqInfo.callId, ToolConfirmationOutcome.ProceedAlways);
188584
188640
  this.setStatusInternal(reqInfo.callId, "scheduled");
@@ -188592,6 +188648,9 @@ var init_coreToolScheduler = __esm({
188592
188648
  }
188593
188649
  if (confirmationDetails.type === "edit" && confirmationDetails.ideConfirmation) {
188594
188650
  confirmationDetails.ideConfirmation.then((resolution) => {
188651
+ const still = this.toolCalls.find((c4) => c4.request.callId === reqInfo.callId && c4.status === "awaiting_approval");
188652
+ if (!still)
188653
+ return;
188595
188654
  if (resolution.status === "accepted") {
188596
188655
  this.handleConfirmationResponse(reqInfo.callId, confirmationDetails.onConfirm, ToolConfirmationOutcome.ProceedOnce, signal);
188597
188656
  } else {
@@ -188653,25 +188712,11 @@ var init_coreToolScheduler = __esm({
188653
188712
  }
188654
188713
  async handleConfirmationResponse(callId, originalOnConfirm, outcome, signal, payload) {
188655
188714
  const toolCall = this.toolCalls.find((c4) => c4.request.callId === callId && c4.status === "awaiting_approval");
188715
+ if (!toolCall)
188716
+ return;
188656
188717
  await originalOnConfirm(outcome, payload);
188657
188718
  if (outcome === ToolConfirmationOutcome.ProceedAlways || outcome === ToolConfirmationOutcome.ProceedAlwaysProject || outcome === ToolConfirmationOutcome.ProceedAlwaysUser) {
188658
- if (outcome === ToolConfirmationOutcome.ProceedAlwaysProject || outcome === ToolConfirmationOutcome.ProceedAlwaysUser) {
188659
- const scope = outcome === ToolConfirmationOutcome.ProceedAlwaysProject ? "project" : "user";
188660
- const details = toolCall?.confirmationDetails;
188661
- const detailsRules = details?.["permissionRules"];
188662
- const payloadRules = payload?.permissionRules;
188663
- const rules = payloadRules ?? detailsRules ?? [];
188664
- const persistFn = this.config.getOnPersistPermissionRule?.();
188665
- const pm = this.config.getPermissionManager?.();
188666
- if (rules.length > 0) {
188667
- for (const rule of rules) {
188668
- if (persistFn) {
188669
- await persistFn(scope, "allow", rule);
188670
- }
188671
- pm?.addPersistentRule(rule, "allow");
188672
- }
188673
- }
188674
- }
188719
+ await persistPermissionOutcome(outcome, toolCall.confirmationDetails, this.config.getOnPersistPermissionRule?.(), this.config.getPermissionManager?.(), payload);
188675
188720
  await this.autoApproveCompatiblePendingTools(signal, callId);
188676
188721
  }
188677
188722
  this.setToolCallOutcome(callId, outcome);
@@ -188933,34 +188978,9 @@ ${failureHookResult.additionalContext}`;
188933
188978
  for (const pendingTool of pendingTools) {
188934
188979
  try {
188935
188980
  const defaultPermission = await pendingTool.invocation.getDefaultPermission();
188936
- let finalPermission = defaultPermission;
188937
- const pm = this.config.getPermissionManager?.();
188938
- if (pm && defaultPermission !== "deny") {
188939
- const params = pendingTool.invocation.params;
188940
- const shellCommand = "command" in params ? String(params["command"]) : void 0;
188941
- const filePath = typeof params["file_path"] === "string" ? params["file_path"] : void 0;
188942
- let domain2;
188943
- if (typeof params["url"] === "string") {
188944
- try {
188945
- domain2 = new URL(params["url"]).hostname;
188946
- } catch {
188947
- }
188948
- }
188949
- const literalSpecifier = typeof params["skill"] === "string" ? params["skill"] : typeof params["subagent_type"] === "string" ? params["subagent_type"] : void 0;
188950
- const pmCtx = {
188951
- toolName: pendingTool.request.name,
188952
- command: shellCommand,
188953
- filePath,
188954
- domain: domain2,
188955
- specifier: literalSpecifier
188956
- };
188957
- if (pm.hasRelevantRules(pmCtx)) {
188958
- const pmDecision = pm.evaluate(pmCtx);
188959
- if (pmDecision !== "default") {
188960
- finalPermission = pmDecision;
188961
- }
188962
- }
188963
- }
188981
+ const toolParams = pendingTool.invocation.params;
188982
+ const pmCtx = buildPermissionCheckContext(pendingTool.request.name, toolParams, this.config.getTargetDir?.() ?? "");
188983
+ const { finalPermission } = await evaluatePermissionRules(this.config.getPermissionManager?.(), defaultPermission, pmCtx);
188964
188984
  if (finalPermission === "allow") {
188965
188985
  this.setToolCallOutcome(pendingTool.request.callId, ToolConfirmationOutcome.ProceedAlways);
188966
188986
  this.setStatusInternal(pendingTool.request.callId, "scheduled");
@@ -228865,8 +228885,9 @@ var init_edit = __esm({
228865
228885
  }
228866
228886
  const fileName = path39.basename(this.params.file_path);
228867
228887
  const fileDiff = createPatch(fileName, editData.currentContent ?? "", editData.newContent, "Current", "Proposed", DEFAULT_DIFF_OPTIONS);
228888
+ const approvalMode = this.config.getApprovalMode();
228868
228889
  const ideClient = await IdeClient.getInstance();
228869
- const ideConfirmation = this.config.getIdeMode() && ideClient.isDiffingEnabled() ? ideClient.openDiff(this.params.file_path, editData.newContent) : void 0;
228890
+ const ideConfirmation = this.config.getIdeMode() && ideClient.isDiffingEnabled() && approvalMode !== ApprovalMode.AUTO_EDIT && approvalMode !== ApprovalMode.YOLO ? ideClient.openDiff(this.params.file_path, editData.newContent) : void 0;
228870
228891
  const confirmationDetails = {
228871
228892
  type: "edit",
228872
228893
  title: `Confirm Edit: ${shortenPath(makeRelative(this.params.file_path, this.config.getTargetDir()))}`,
@@ -229372,10 +229393,11 @@ var init_glob2 = __esm({
229372
229393
  follow: false,
229373
229394
  signal
229374
229395
  });
229375
- const relativePaths = entries.map((p2) => path40.relative(searchDir, p2.fullpath()));
229396
+ const projectRoot = this.config.getTargetDir();
229397
+ const relativePaths = entries.map((p2) => path40.relative(projectRoot, p2.fullpath()));
229376
229398
  const { filteredPaths } = this.fileService.filterFilesWithReport(relativePaths, this.getFileFilteringOptions());
229377
229399
  const normalizePathForComparison = /* @__PURE__ */ __name((p2) => process.platform === "win32" || process.platform === "darwin" ? p2.toLowerCase() : p2, "normalizePathForComparison");
229378
- const filteredAbsolutePaths = new Set(filteredPaths.map((p2) => normalizePathForComparison(path40.resolve(searchDir, p2))));
229400
+ const filteredAbsolutePaths = new Set(filteredPaths.map((p2) => normalizePathForComparison(path40.resolve(projectRoot, p2))));
229379
229401
  return entries.filter((entry) => filteredAbsolutePaths.has(normalizePathForComparison(entry.fullpath())));
229380
229402
  }
229381
229403
  async execute(signal) {
@@ -229564,7 +229586,7 @@ var init_grep2 = __esm({
229564
229586
  searchDirs.push(...workspaceDirs);
229565
229587
  searchLocationDescription = workspaceDirs.length > 1 ? `across ${workspaceDirs.length} workspace directories` : `in the workspace directory`;
229566
229588
  }
229567
- const rawMatches = [];
229589
+ let rawMatches = [];
229568
229590
  for (const searchDir of searchDirs) {
229569
229591
  const matches = await this.performGrepSearch({
229570
229592
  pattern: this.params.pattern,
@@ -229581,6 +229603,16 @@ var init_grep2 = __esm({
229581
229603
  }
229582
229604
  rawMatches.push(...matches);
229583
229605
  }
229606
+ if (searchDirs.length > 1) {
229607
+ const seen = /* @__PURE__ */ new Set();
229608
+ rawMatches = rawMatches.filter((match2) => {
229609
+ const key = `${match2.filePath}:${match2.lineNumber}`;
229610
+ if (seen.has(key))
229611
+ return false;
229612
+ seen.add(key);
229613
+ return true;
229614
+ });
229615
+ }
229584
229616
  const filterDescription = this.params.glob ? ` (filter: "${this.params.glob}")` : "";
229585
229617
  if (rawMatches.length === 0) {
229586
229618
  const noMatchMsg = `No matches found for pattern "${this.params.pattern}" ${searchLocationDescription}${filterDescription}.`;
@@ -230401,7 +230433,23 @@ var init_ripGrep = __esm({
230401
230433
  const noMatchMsg = `No matches found for pattern "${this.params.pattern}" ${searchLocationDescription}${filterDescription}.`;
230402
230434
  return { llmContent: noMatchMsg, returnDisplay: `No matches found` };
230403
230435
  }
230404
- const allLines = rawOutput.split("\n").filter((line) => line.trim());
230436
+ let allLines = rawOutput.split("\n").filter((line) => line.trim());
230437
+ if (searchPaths.length > 1) {
230438
+ const seen = /* @__PURE__ */ new Set();
230439
+ allLines = allLines.filter((line) => {
230440
+ const firstColon = line.indexOf(":");
230441
+ if (firstColon !== -1) {
230442
+ const secondColon = line.indexOf(":", firstColon + 1);
230443
+ if (secondColon !== -1) {
230444
+ const key = line.substring(0, secondColon);
230445
+ if (seen.has(key))
230446
+ return false;
230447
+ seen.add(key);
230448
+ }
230449
+ }
230450
+ return true;
230451
+ });
230452
+ }
230405
230453
  const totalMatches = allLines.length;
230406
230454
  const matchTerm = totalMatches === 1 ? "match" : "matches";
230407
230455
  const header = `Found ${totalMatches} ${matchTerm} for pattern "${this.params.pattern}" ${searchLocationDescription}${filterDescription}:
@@ -241448,8 +241496,9 @@ var init_write_file = __esm({
241448
241496
  "Proposed",
241449
241497
  DEFAULT_DIFF_OPTIONS
241450
241498
  );
241499
+ const approvalMode = this.config.getApprovalMode();
241451
241500
  const ideClient = await IdeClient.getInstance();
241452
- const ideConfirmation = this.config.getIdeMode() && ideClient.isDiffingEnabled() ? ideClient.openDiff(this.params.file_path, this.params.content) : void 0;
241501
+ const ideConfirmation = this.config.getIdeMode() && ideClient.isDiffingEnabled() && approvalMode !== ApprovalMode.AUTO_EDIT && approvalMode !== ApprovalMode.YOLO ? ideClient.openDiff(this.params.file_path, this.params.content) : void 0;
241453
241502
  const confirmationDetails = {
241454
241503
  type: "edit",
241455
241504
  title: `Confirm Write: ${shortenPath(relativePath)}`,
@@ -246286,6 +246335,8 @@ var init_permission_manager = __esm({
246286
246335
  init_esbuild_shims();
246287
246336
  init_rule_parser();
246288
246337
  init_shell_semantics();
246338
+ init_shellAstParser();
246339
+ init_shell_utils();
246289
246340
  DECISION_PRIORITY = {
246290
246341
  deny: 3,
246291
246342
  ask: 2,
@@ -246345,15 +246396,19 @@ var init_permission_manager = __esm({
246345
246396
  * @param ctx - The context containing the tool name and optional command.
246346
246397
  * @returns A PermissionDecision indicating how to handle this tool call.
246347
246398
  */
246348
- evaluate(ctx) {
246349
- const { command: command2 } = ctx;
246399
+ async evaluate(ctx) {
246400
+ const { command: command2, toolName } = ctx;
246350
246401
  if (command2 !== void 0) {
246351
246402
  const subCommands = splitCompoundCommand(command2);
246352
246403
  if (subCommands.length > 1) {
246353
246404
  return this.evaluateCompoundCommand(ctx, subCommands);
246354
246405
  }
246355
246406
  }
246356
- return this.evaluateSingle(ctx);
246407
+ const decision = this.evaluateSingle(ctx);
246408
+ if (decision === "default" && toolName === "run_shell_command" && command2 !== void 0) {
246409
+ return this.resolveDefaultPermission(command2);
246410
+ }
246411
+ return decision;
246357
246412
  }
246358
246413
  /**
246359
246414
  * Evaluate a single (non-compound) context against all rules.
@@ -246445,18 +246500,23 @@ var init_permission_manager = __esm({
246445
246500
  * Evaluate a compound command by splitting it into sub-commands,
246446
246501
  * evaluating each independently, and returning the most restrictive result.
246447
246502
  *
246448
- * Restriction order: deny > ask > default > allow
246503
+ * Restriction order: deny > ask > allow
246449
246504
  *
246450
- * Example: with rules `allow: [safe-cmd *, one-cmd *]`
246451
- * - "safe-cmd && one-cmd" → both allow → allow
246452
- * - "safe-cmd && two-cmd" → allow + default default
246453
- * - "safe-cmd && evil-cmd" (deny: [evil-cmd]) allow + deny deny
246505
+ * When a sub-command returns 'default' (no rule matches), it is resolved to
246506
+ * the actual default permission using AST analysis:
246507
+ * - Command substitution detected'deny'
246508
+ * - Read-only command (cd, ls, git status, etc.)'allow'
246509
+ * - Otherwise → 'ask'
246510
+ *
246511
+ * Example: with rules `allow: [git checkout *]`
246512
+ * - "cd /path && git checkout -b feature" → allow (cd) + allow (rule) → allow
246513
+ * - "rm /path && git checkout -b feature" → ask (rm) + allow (rule) → ask
246514
+ * - "evil-cmd && git checkout" (deny: [evil-cmd]) → deny + allow → deny
246454
246515
  */
246455
- evaluateCompoundCommand(ctx, subCommands) {
246516
+ async evaluateCompoundCommand(ctx, subCommands) {
246456
246517
  const PRIORITY = {
246457
246518
  deny: 3,
246458
246519
  ask: 2,
246459
- default: 1,
246460
246520
  allow: 0
246461
246521
  };
246462
246522
  let mostRestrictive = "allow";
@@ -246465,7 +246525,8 @@ var init_permission_manager = __esm({
246465
246525
  ...ctx,
246466
246526
  command: subCmd
246467
246527
  };
246468
- const decision = this.evaluateSingle(subCtx);
246528
+ const rawDecision = this.evaluateSingle(subCtx);
246529
+ const decision = rawDecision === "default" ? await this.resolveDefaultPermission(subCmd) : rawDecision;
246469
246530
  if (PRIORITY[decision] > PRIORITY[mostRestrictive]) {
246470
246531
  mostRestrictive = decision;
246471
246532
  }
@@ -246475,6 +246536,26 @@ var init_permission_manager = __esm({
246475
246536
  }
246476
246537
  return mostRestrictive;
246477
246538
  }
246539
+ /**
246540
+ * Resolve 'default' permission to actual permission using AST analysis.
246541
+ * This mirrors the logic in ShellToolInvocation.getDefaultPermission().
246542
+ *
246543
+ * @param command - The shell command to analyze.
246544
+ * @returns 'deny' for command substitution, 'allow' for read-only, 'ask' otherwise.
246545
+ */
246546
+ async resolveDefaultPermission(command2) {
246547
+ if (detectCommandSubstitution(command2)) {
246548
+ return "deny";
246549
+ }
246550
+ try {
246551
+ const isReadOnly = await isShellCommandReadOnlyAST(command2);
246552
+ if (isReadOnly) {
246553
+ return "allow";
246554
+ }
246555
+ } catch {
246556
+ }
246557
+ return "ask";
246558
+ }
246478
246559
  // ---------------------------------------------------------------------------
246479
246560
  // Registry-level helper
246480
246561
  // ---------------------------------------------------------------------------
@@ -246486,14 +246567,14 @@ var init_permission_manager = __esm({
246486
246567
  * `"Bash(rm -rf *)"` do NOT remove the tool from the registry – they only
246487
246568
  * deny specific invocations at runtime.
246488
246569
  */
246489
- isToolEnabled(toolName) {
246570
+ async isToolEnabled(toolName) {
246490
246571
  const canonicalName = resolveToolName(toolName);
246491
246572
  if (this.coreToolsAllowList !== null && this.coreToolsAllowList.size > 0) {
246492
246573
  if (!this.coreToolsAllowList.has(canonicalName)) {
246493
246574
  return false;
246494
246575
  }
246495
246576
  }
246496
- const decision = this.evaluate({ toolName: canonicalName });
246577
+ const decision = await this.evaluate({ toolName: canonicalName });
246497
246578
  return decision !== "deny";
246498
246579
  }
246499
246580
  /**
@@ -246535,7 +246616,7 @@ var init_permission_manager = __esm({
246535
246616
  * @param command - The shell command to evaluate.
246536
246617
  * @returns The PermissionDecision for this command.
246537
246618
  */
246538
- isCommandAllowed(command2) {
246619
+ async isCommandAllowed(command2) {
246539
246620
  return this.evaluate({
246540
246621
  toolName: "run_shell_command",
246541
246622
  command: command2
@@ -246567,6 +246648,12 @@ var init_permission_manager = __esm({
246567
246648
  */
246568
246649
  hasRelevantRules(ctx) {
246569
246650
  const { toolName, command: command2, filePath, domain: domain2, specifier } = ctx;
246651
+ if (ctx.toolName === "run_shell_command" && command2 !== void 0) {
246652
+ const subCommands = splitCompoundCommand(command2);
246653
+ if (subCommands.length > 1) {
246654
+ return subCommands.some((subCmd) => this.hasRelevantRules({ ...ctx, command: subCmd }));
246655
+ }
246656
+ }
246570
246657
  const pathCtx = this.config.getProjectRoot && this.config.getCwd ? {
246571
246658
  projectRoot: this.config.getProjectRoot(),
246572
246659
  cwd: this.config.getCwd()
@@ -246608,6 +246695,56 @@ var init_permission_manager = __esm({
246608
246695
  }
246609
246696
  return false;
246610
246697
  }
246698
+ /**
246699
+ * Returns true when the invocation is matched by an explicit `ask` rule.
246700
+ *
246701
+ * This is intentionally narrower than `evaluate(ctx) === 'ask'`. Shell
246702
+ * commands can resolve to `ask` simply because they are non-read-only and no
246703
+ * explicit allow/deny rule matched. That fallback should still allow users to
246704
+ * create new allow rules, so callers must only hide "Always allow" when a
246705
+ * real ask rule matched.
246706
+ */
246707
+ hasMatchingAskRule(ctx) {
246708
+ const { toolName, command: command2, filePath, domain: domain2, specifier } = ctx;
246709
+ if (ctx.toolName === "run_shell_command" && command2 !== void 0) {
246710
+ const subCommands = splitCompoundCommand(command2);
246711
+ if (subCommands.length > 1) {
246712
+ return subCommands.some((subCmd) => this.hasMatchingAskRule({ ...ctx, command: subCmd }));
246713
+ }
246714
+ }
246715
+ const pathCtx = this.config.getProjectRoot && this.config.getCwd ? {
246716
+ projectRoot: this.config.getProjectRoot(),
246717
+ cwd: this.config.getCwd()
246718
+ } : void 0;
246719
+ const matchArgs = [
246720
+ toolName,
246721
+ command2,
246722
+ filePath,
246723
+ domain2,
246724
+ pathCtx,
246725
+ specifier
246726
+ ];
246727
+ const askRules = [...this.sessionRules.ask, ...this.persistentRules.ask];
246728
+ if (askRules.some((rule) => matchesRule(rule, ...matchArgs))) {
246729
+ return true;
246730
+ }
246731
+ if (ctx.toolName === "run_shell_command" && ctx.command !== void 0) {
246732
+ const cwd6 = pathCtx?.cwd ?? process.cwd();
246733
+ const ops = extractShellOperations(ctx.command, cwd6);
246734
+ return ops.some((op) => {
246735
+ const opMatchArgs = [
246736
+ op.virtualTool,
246737
+ void 0,
246738
+ op.filePath,
246739
+ op.domain,
246740
+ pathCtx,
246741
+ void 0
246742
+ ];
246743
+ return askRules.some((rule) => matchesRule(rule, ...opMatchArgs));
246744
+ });
246745
+ }
246746
+ return false;
246747
+ }
246611
246748
  // ---------------------------------------------------------------------------
246612
246749
  // Session rule management
246613
246750
  // ---------------------------------------------------------------------------
@@ -270588,14 +270725,14 @@ var init_config3 = __esm({
270588
270725
  }
270589
270726
  async createToolRegistry(sendSdkMcpMessage, options2) {
270590
270727
  const registry2 = new ToolRegistry(this, this.eventEmitter, sendSdkMcpMessage);
270591
- const registerCoreTool = /* @__PURE__ */ __name((ToolClass, ...args2) => {
270728
+ const registerCoreTool = /* @__PURE__ */ __name(async (ToolClass, ...args2) => {
270592
270729
  const toolName = ToolClass?.Name;
270593
270730
  const className = ToolClass?.name ?? "UnknownTool";
270594
270731
  if (!toolName) {
270595
270732
  this.debugLogger.warn(`Skipping tool registration: ${className} is missing static Name property. Tools must define a static Name property to be registered.`);
270596
270733
  return;
270597
270734
  }
270598
- const pmEnabled = this.permissionManager ? this.permissionManager.isToolEnabled(toolName) : true;
270735
+ const pmEnabled = this.permissionManager ? await this.permissionManager.isToolEnabled(toolName) : true;
270599
270736
  if (pmEnabled) {
270600
270737
  try {
270601
270738
  registry2.registerTool(new ToolClass(...args2));
@@ -270605,10 +270742,10 @@ var init_config3 = __esm({
270605
270742
  }
270606
270743
  }
270607
270744
  }, "registerCoreTool");
270608
- registerCoreTool(AgentTool, this);
270609
- registerCoreTool(SkillTool, this);
270610
- registerCoreTool(LSTool, this);
270611
- registerCoreTool(ReadFileTool, this);
270745
+ await registerCoreTool(AgentTool, this);
270746
+ await registerCoreTool(SkillTool, this);
270747
+ await registerCoreTool(LSTool, this);
270748
+ await registerCoreTool(ReadFileTool, this);
270612
270749
  if (this.getUseRipgrep()) {
270613
270750
  let useRipgrep = false;
270614
270751
  let errorString = void 0;
@@ -270618,28 +270755,28 @@ var init_config3 = __esm({
270618
270755
  errorString = getErrorMessage(error40);
270619
270756
  }
270620
270757
  if (useRipgrep) {
270621
- registerCoreTool(RipGrepTool, this);
270758
+ await registerCoreTool(RipGrepTool, this);
270622
270759
  } else {
270623
270760
  logRipgrepFallback(this, new RipgrepFallbackEvent(this.getUseRipgrep(), this.getUseBuiltinRipgrep(), errorString || "ripgrep is not available"));
270624
- registerCoreTool(GrepTool, this);
270761
+ await registerCoreTool(GrepTool, this);
270625
270762
  }
270626
270763
  } else {
270627
- registerCoreTool(GrepTool, this);
270764
+ await registerCoreTool(GrepTool, this);
270628
270765
  }
270629
- registerCoreTool(GlobTool, this);
270630
- registerCoreTool(EditTool, this);
270631
- registerCoreTool(WriteFileTool, this);
270632
- registerCoreTool(ShellTool, this);
270633
- registerCoreTool(MemoryTool);
270634
- registerCoreTool(TodoWriteTool, this);
270635
- registerCoreTool(AskUserQuestionTool, this);
270636
- !this.sdkMode && registerCoreTool(ExitPlanModeTool, this);
270637
- registerCoreTool(WebFetchTool, this);
270766
+ await registerCoreTool(GlobTool, this);
270767
+ await registerCoreTool(EditTool, this);
270768
+ await registerCoreTool(WriteFileTool, this);
270769
+ await registerCoreTool(ShellTool, this);
270770
+ await registerCoreTool(MemoryTool);
270771
+ await registerCoreTool(TodoWriteTool, this);
270772
+ await registerCoreTool(AskUserQuestionTool, this);
270773
+ !this.sdkMode && await registerCoreTool(ExitPlanModeTool, this);
270774
+ await registerCoreTool(WebFetchTool, this);
270638
270775
  if (this.getWebSearchConfig()) {
270639
- registerCoreTool(WebSearchTool, this);
270776
+ await registerCoreTool(WebSearchTool, this);
270640
270777
  }
270641
270778
  if (this.isLspEnabled() && this.getLspClient()) {
270642
- registerCoreTool(LspTool, this);
270779
+ await registerCoreTool(LspTool, this);
270643
270780
  }
270644
270781
  if (!options2?.skipDiscovery) {
270645
270782
  await registry2.discoverAllTools();
@@ -280688,6 +280825,7 @@ var init_src2 = __esm({
280688
280825
  init_client2();
280689
280826
  init_contentGenerator();
280690
280827
  init_coreToolScheduler();
280828
+ init_permission_helpers();
280691
280829
  init_geminiChat();
280692
280830
  init_geminiRequest();
280693
280831
  init_logger();
@@ -281080,6 +281218,7 @@ __export(dist_exports, {
281080
281218
  applyReplacement: () => applyReplacement,
281081
281219
  buildApiHistoryFromConversation: () => buildApiHistoryFromConversation,
281082
281220
  buildHumanReadableRuleLabel: () => buildHumanReadableRuleLabel,
281221
+ buildPermissionCheckContext: () => buildPermissionCheckContext,
281083
281222
  buildPermissionRules: () => buildPermissionRules,
281084
281223
  buildSkillLlmContent: () => buildSkillLlmContent,
281085
281224
  canUseRipgrep: () => canUseRipgrep,
@@ -281129,6 +281268,7 @@ __export(dist_exports, {
281129
281268
  envLayer: () => envLayer,
281130
281269
  escapePath: () => escapePath,
281131
281270
  escapeShellArg: () => escapeShellArg,
281271
+ evaluatePermissionRules: () => evaluatePermissionRules,
281132
281272
  execCommand: () => execCommand,
281133
281273
  executeToolCall: () => executeToolCall,
281134
281274
  exists: () => exists,
@@ -281140,6 +281280,7 @@ __export(dist_exports, {
281140
281280
  findGitRoot: () => findGitRoot,
281141
281281
  findReleaseAsset: () => findReleaseAsset,
281142
281282
  fireNotificationHook: () => fireNotificationHook,
281283
+ firePermissionRequestHook: () => firePermissionRequestHook,
281143
281284
  flatMapTextParts: () => flatMapTextParts,
281144
281285
  formatMemoryUsage: () => formatMemoryUsage,
281145
281286
  generateCodeChallenge: () => generateCodeChallenge,
@@ -281207,6 +281348,7 @@ __export(dist_exports, {
281207
281348
  hydrateString: () => hydrateString,
281208
281349
  ideContextStore: () => ideContextStore,
281209
281350
  initializeTelemetry: () => initializeTelemetry,
281351
+ injectPermissionRulesIfMissing: () => injectPermissionRulesIfMissing,
281210
281352
  invokeMcpPrompt: () => invokeMcpPrompt,
281211
281353
  isAbortError: () => isAbortError,
281212
281354
  isApiError: () => isApiError,
@@ -281311,6 +281453,7 @@ __export(dist_exports, {
281311
281453
  partListUnionToString: () => partListUnionToString,
281312
281454
  partToString: () => partToString,
281313
281455
  performVariableReplacement: () => performVariableReplacement,
281456
+ persistPermissionOutcome: () => persistPermissionOutcome,
281314
281457
  populateMcpServerCommand: () => populateMcpServerCommand,
281315
281458
  processSingleFileContent: () => processSingleFileContent,
281316
281459
  promptForSetting: () => promptForSetting,
@@ -406701,7 +406844,7 @@ __name(getPackageJson, "getPackageJson");
406701
406844
  // packages/cli/src/utils/version.ts
406702
406845
  async function getCliVersion() {
406703
406846
  const pkgJson = await getPackageJson();
406704
- return "0.13.1-preview.0";
406847
+ return "0.13.1";
406705
406848
  }
406706
406849
  __name(getCliVersion, "getCliVersion");
406707
406850
 
@@ -411064,7 +411207,7 @@ function isDebugMode(argv) {
411064
411207
  );
411065
411208
  }
411066
411209
  __name(isDebugMode, "isDebugMode");
411067
- async function loadCliConfig(settings, argv, cwd6 = process.cwd(), overrideExtensions, loadedSettings) {
411210
+ async function loadCliConfig(settings, argv, cwd6 = process.cwd(), overrideExtensions) {
411068
411211
  const debugMode = isDebugMode(argv);
411069
411212
  Storage.setRuntimeBaseDir(settings.advanced?.runtimeOutputDir, cwd6);
411070
411213
  const ideMode = settings.ide?.enabled ?? false;
@@ -411283,14 +411426,15 @@ async function loadCliConfig(settings, argv, cwd6 = process.cwd(), overrideExten
411283
411426
  deny: mergedDeny.length > 0 ? mergedDeny : void 0
411284
411427
  },
411285
411428
  // Permission rule persistence callback (writes to settings files).
411286
- onPersistPermissionRule: loadedSettings ? async (scope, ruleType, rule) => {
411429
+ onPersistPermissionRule: /* @__PURE__ */ __name(async (scope, ruleType, rule) => {
411430
+ const currentSettings = loadSettings(cwd6);
411287
411431
  const settingScope = scope === "project" ? "Workspace" /* Workspace */ : "User" /* User */;
411288
411432
  const key = `permissions.${ruleType}`;
411289
- const currentRules = loadedSettings.forScope(settingScope).settings.permissions?.[ruleType] ?? [];
411433
+ const currentRules = currentSettings.forScope(settingScope).settings.permissions?.[ruleType] ?? [];
411290
411434
  if (!currentRules.includes(rule)) {
411291
- loadedSettings.setValue(settingScope, key, [...currentRules, rule]);
411435
+ currentSettings.setValue(settingScope, key, [...currentRules, rule]);
411292
411436
  }
411293
- } : void 0,
411437
+ }, "onPersistPermissionRule"),
411294
411438
  toolDiscoveryCommand: settings.tools?.discoveryCommand,
411295
411439
  toolCallCommand: settings.tools?.callCommand,
411296
411440
  mcpServerCommand: settings.mcp?.serverCommand,
@@ -414324,7 +414468,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
414324
414468
 
414325
414469
  // packages/cli/src/generated/git-commit.ts
414326
414470
  init_esbuild_shims();
414327
- var GIT_COMMIT_INFO = "9246216a8";
414471
+ var GIT_COMMIT_INFO = "cb271b3c9";
414328
414472
 
414329
414473
  // packages/cli/src/utils/systemInfo.ts
414330
414474
  async function getNpmVersion() {
@@ -422129,9 +422273,9 @@ var ShellProcessor = class {
422129
422273
  for (const injection of resolvedInjections) {
422130
422274
  const command2 = injection.resolvedCommand;
422131
422275
  if (!command2) continue;
422132
- const { allAllowed, disallowedCommands, blockReason, isHardDenial } = checkCommandPermissions(command2, config2, sessionShellAllowlist);
422276
+ const { allAllowed, disallowedCommands, blockReason, isHardDenial } = await checkCommandPermissions(command2, config2, sessionShellAllowlist);
422133
422277
  const pm = config2.getPermissionManager?.();
422134
- const isAllowedBySettings = pm ? pm.isCommandAllowed(command2) === "allow" : false;
422278
+ const isAllowedBySettings = pm ? await pm.isCommandAllowed(command2) === "allow" : false;
422135
422279
  if (!allAllowed) {
422136
422280
  if (isHardDenial) {
422137
422281
  throw new Error(
@@ -448679,6 +448823,7 @@ var ToolConfirmationMessage = /* @__PURE__ */ __name(({
448679
448823
  };
448680
448824
  }, [config2]);
448681
448825
  const handleConfirm = /* @__PURE__ */ __name(async (outcome) => {
448826
+ onConfirm(outcome);
448682
448827
  if (confirmationDetails.type === "edit") {
448683
448828
  if (config2.getIdeMode() && isDiffingEnabled) {
448684
448829
  const cliOutcome = outcome === ToolConfirmationOutcome.Cancel ? "rejected" : "accepted";
@@ -448688,7 +448833,6 @@ var ToolConfirmationMessage = /* @__PURE__ */ __name(({
448688
448833
  );
448689
448834
  }
448690
448835
  }
448691
- onConfirm(outcome);
448692
448836
  }, "handleConfirm");
448693
448837
  const isTrustedFolder = config2.isTrustedFolder();
448694
448838
  useKeypress(
@@ -454454,6 +454598,18 @@ __name(ApiKeyInput, "ApiKeyInput");
454454
454598
  init_esbuild_shims();
454455
454599
  var import_react84 = __toESM(require_react(), 1);
454456
454600
  init_dist4();
454601
+
454602
+ // packages/cli/src/constants/alibabaStandardApiKey.ts
454603
+ init_esbuild_shims();
454604
+ var DASHSCOPE_STANDARD_API_KEY_ENV_KEY = "DASHSCOPE_API_KEY";
454605
+ var ALIBABA_STANDARD_API_KEY_ENDPOINTS = {
454606
+ "cn-beijing": "https://dashscope.aliyuncs.com/compatible-mode/v1",
454607
+ "sg-singapore": "https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
454608
+ "us-virginia": "https://dashscope-us.aliyuncs.com/compatible-mode/v1",
454609
+ "cn-hongkong": "https://cn-hongkong.dashscope.aliyuncs.com/compatible-mode/v1"
454610
+ };
454611
+
454612
+ // packages/cli/src/ui/contexts/UIActionsContext.tsx
454457
454613
  var UIActionsContext = (0, import_react84.createContext)(null);
454458
454614
  var useUIActions = /* @__PURE__ */ __name(() => {
454459
454615
  const context2 = (0, import_react84.useContext)(UIActionsContext);
@@ -454473,11 +454629,19 @@ function parseDefaultAuthType(defaultAuthType) {
454473
454629
  return null;
454474
454630
  }
454475
454631
  __name(parseDefaultAuthType, "parseDefaultAuthType");
454632
+ var ALIBABA_STANDARD_MODEL_IDS_PLACEHOLDER = "qwen3.5-plus,glm-5,kimi-k2.5";
454633
+ var ALIBABA_STANDARD_API_DOCUMENTATION_URLS = {
454634
+ "cn-beijing": "https://bailian.console.aliyun.com/cn-beijing?tab=api#/api",
454635
+ "sg-singapore": "https://modelstudio.console.alibabacloud.com/ap-southeast-1?tab=api#/api/?type=model&url=2712195",
454636
+ "us-virginia": "https://modelstudio.console.alibabacloud.com/us-east-1?tab=api#/api/?type=model&url=2712195",
454637
+ "cn-hongkong": "https://modelstudio.console.alibabacloud.com/cn-hongkong?tab=api#/api/?type=model&url=2712195"
454638
+ };
454476
454639
  function AuthDialog() {
454477
454640
  const { pendingAuthType, authError } = useUIState();
454478
454641
  const {
454479
454642
  handleAuthSelect: onAuthSelect,
454480
454643
  handleCodingPlanSubmit,
454644
+ handleAlibabaStandardSubmit,
454481
454645
  onAuthError
454482
454646
  } = useUIActions();
454483
454647
  const config2 = useConfig();
@@ -454487,6 +454651,13 @@ function AuthDialog() {
454487
454651
  const [region, setRegion] = (0, import_react85.useState)(
454488
454652
  "china" /* CHINA */
454489
454653
  );
454654
+ const [alibabaStandardRegionIndex, setAlibabaStandardRegionIndex] = (0, import_react85.useState)(0);
454655
+ const [apiKeyTypeIndex, setApiKeyTypeIndex] = (0, import_react85.useState)(0);
454656
+ const [alibabaStandardRegion, setAlibabaStandardRegion] = (0, import_react85.useState)("cn-beijing");
454657
+ const [alibabaStandardApiKey, setAlibabaStandardApiKey] = (0, import_react85.useState)("");
454658
+ const [alibabaStandardApiKeyError, setAlibabaStandardApiKeyError] = (0, import_react85.useState)(null);
454659
+ const [alibabaStandardModelId, setAlibabaStandardModelId] = (0, import_react85.useState)("");
454660
+ const [alibabaStandardModelIdError, setAlibabaStandardModelIdError] = (0, import_react85.useState)(null);
454490
454661
  const mainItems = [
454491
454662
  {
454492
454663
  key: AuthType2.QWEN_OAUTH,
@@ -454544,6 +454715,66 @@ function AuthDialog() {
454544
454715
  value: "global" /* GLOBAL */
454545
454716
  }
454546
454717
  ];
454718
+ const alibabaStandardRegionItems = [
454719
+ {
454720
+ key: "cn-beijing",
454721
+ title: t4("China (Beijing)"),
454722
+ label: t4("China (Beijing)"),
454723
+ description: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(Text3, { color: theme.text.secondary, children: [
454724
+ "Endpoint: ",
454725
+ ALIBABA_STANDARD_API_KEY_ENDPOINTS["cn-beijing"]
454726
+ ] }),
454727
+ value: "cn-beijing"
454728
+ },
454729
+ {
454730
+ key: "sg-singapore",
454731
+ title: t4("Singapore"),
454732
+ label: t4("Singapore"),
454733
+ description: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(Text3, { color: theme.text.secondary, children: [
454734
+ "Endpoint: ",
454735
+ ALIBABA_STANDARD_API_KEY_ENDPOINTS["sg-singapore"]
454736
+ ] }),
454737
+ value: "sg-singapore"
454738
+ },
454739
+ {
454740
+ key: "us-virginia",
454741
+ title: t4("US (Virginia)"),
454742
+ label: t4("US (Virginia)"),
454743
+ description: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(Text3, { color: theme.text.secondary, children: [
454744
+ "Endpoint: ",
454745
+ ALIBABA_STANDARD_API_KEY_ENDPOINTS["us-virginia"]
454746
+ ] }),
454747
+ value: "us-virginia"
454748
+ },
454749
+ {
454750
+ key: "cn-hongkong",
454751
+ title: t4("China (Hong Kong)"),
454752
+ label: t4("China (Hong Kong)"),
454753
+ description: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(Text3, { color: theme.text.secondary, children: [
454754
+ "Endpoint: ",
454755
+ ALIBABA_STANDARD_API_KEY_ENDPOINTS["cn-hongkong"]
454756
+ ] }),
454757
+ value: "cn-hongkong"
454758
+ }
454759
+ ];
454760
+ const apiKeyTypeItems = [
454761
+ {
454762
+ key: "ALIBABA_STANDARD_API_KEY",
454763
+ title: t4("Alibaba Cloud ModelStudio Standard API Key"),
454764
+ label: t4("Alibaba Cloud ModelStudio Standard API Key"),
454765
+ description: t4("Quick setup for Model Studio (China/International)"),
454766
+ value: "ALIBABA_STANDARD_API_KEY"
454767
+ },
454768
+ {
454769
+ key: "CUSTOM_API_KEY",
454770
+ title: t4("Custom API Key"),
454771
+ label: t4("Custom API Key"),
454772
+ description: t4(
454773
+ "For other OpenAI / Anthropic / Gemini-compatible providers"
454774
+ ),
454775
+ value: "CUSTOM_API_KEY"
454776
+ }
454777
+ ];
454547
454778
  const contentGenConfig = config2.getContentGeneratorConfig();
454548
454779
  const isCurrentlyCodingPlan = isCodingPlanConfig(
454549
454780
  contentGenConfig?.baseUrl,
@@ -454551,8 +454782,9 @@ function AuthDialog() {
454551
454782
  ) !== false;
454552
454783
  const authTypeToMainOption = /* @__PURE__ */ __name((authType) => {
454553
454784
  if (authType === AuthType2.QWEN_OAUTH) return AuthType2.QWEN_OAUTH;
454554
- if (authType === AuthType2.USE_OPENAI && isCurrentlyCodingPlan)
454785
+ if (authType === AuthType2.USE_OPENAI && isCurrentlyCodingPlan) {
454555
454786
  return "CODING_PLAN";
454787
+ }
454556
454788
  return "API_KEY";
454557
454789
  }, "authTypeToMainOption");
454558
454790
  const initialAuthIndex = Math.max(
@@ -454582,17 +454814,36 @@ function AuthDialog() {
454582
454814
  return;
454583
454815
  }
454584
454816
  if (value === "API_KEY") {
454585
- setViewLevel("custom-info");
454817
+ setViewLevel("api-key-type-select");
454586
454818
  return;
454587
454819
  }
454588
454820
  await onAuthSelect(value);
454589
454821
  }, "handleMainSelect");
454822
+ const handleApiKeyTypeSelect = /* @__PURE__ */ __name(async (value) => {
454823
+ setErrorMessage(null);
454824
+ onAuthError(null);
454825
+ if (value === "ALIBABA_STANDARD_API_KEY") {
454826
+ setAlibabaStandardModelIdError(null);
454827
+ setAlibabaStandardApiKeyError(null);
454828
+ setViewLevel("alibaba-standard-region-select");
454829
+ return;
454830
+ }
454831
+ setViewLevel("custom-info");
454832
+ }, "handleApiKeyTypeSelect");
454590
454833
  const handleRegionSelect = /* @__PURE__ */ __name(async (selectedRegion) => {
454591
454834
  setErrorMessage(null);
454592
454835
  onAuthError(null);
454593
454836
  setRegion(selectedRegion);
454594
454837
  setViewLevel("api-key-input");
454595
454838
  }, "handleRegionSelect");
454839
+ const handleAlibabaStandardRegionSelect = /* @__PURE__ */ __name(async (selectedRegion) => {
454840
+ setErrorMessage(null);
454841
+ onAuthError(null);
454842
+ setAlibabaStandardApiKeyError(null);
454843
+ setAlibabaStandardModelIdError(null);
454844
+ setAlibabaStandardRegion(selectedRegion);
454845
+ setViewLevel("alibaba-standard-api-key-input");
454846
+ }, "handleAlibabaStandardRegionSelect");
454596
454847
  const handleApiKeyInputSubmit = /* @__PURE__ */ __name(async (apiKey) => {
454597
454848
  setErrorMessage(null);
454598
454849
  if (!apiKey.trim()) {
@@ -454601,13 +454852,54 @@ function AuthDialog() {
454601
454852
  }
454602
454853
  await handleCodingPlanSubmit(apiKey, region);
454603
454854
  }, "handleApiKeyInputSubmit");
454855
+ const handleAlibabaStandardApiKeySubmit = /* @__PURE__ */ __name(() => {
454856
+ const trimmedKey = alibabaStandardApiKey.trim();
454857
+ if (!trimmedKey) {
454858
+ setAlibabaStandardApiKeyError(t4("API key cannot be empty."));
454859
+ return;
454860
+ }
454861
+ setAlibabaStandardApiKeyError(null);
454862
+ if (!alibabaStandardModelId.trim()) {
454863
+ setAlibabaStandardModelId(ALIBABA_STANDARD_MODEL_IDS_PLACEHOLDER);
454864
+ }
454865
+ setViewLevel("alibaba-standard-model-id-input");
454866
+ }, "handleAlibabaStandardApiKeySubmit");
454867
+ const handleAlibabaStandardModelSubmit = /* @__PURE__ */ __name(() => {
454868
+ const trimmedApiKey = alibabaStandardApiKey.trim();
454869
+ const trimmedModelIds = alibabaStandardModelId.trim();
454870
+ if (!trimmedApiKey) {
454871
+ setAlibabaStandardApiKeyError(t4("API key cannot be empty."));
454872
+ setViewLevel("alibaba-standard-api-key-input");
454873
+ return;
454874
+ }
454875
+ if (!trimmedModelIds) {
454876
+ setAlibabaStandardModelIdError(t4("Model IDs cannot be empty."));
454877
+ return;
454878
+ }
454879
+ setAlibabaStandardModelIdError(null);
454880
+ void handleAlibabaStandardSubmit(
454881
+ trimmedApiKey,
454882
+ alibabaStandardRegion,
454883
+ trimmedModelIds
454884
+ );
454885
+ }, "handleAlibabaStandardModelSubmit");
454604
454886
  const handleGoBack = /* @__PURE__ */ __name(() => {
454605
454887
  setErrorMessage(null);
454606
454888
  onAuthError(null);
454607
- if (viewLevel === "region-select" || viewLevel === "custom-info") {
454889
+ if (viewLevel === "region-select") {
454608
454890
  setViewLevel("main");
454609
454891
  } else if (viewLevel === "api-key-input") {
454610
454892
  setViewLevel("region-select");
454893
+ } else if (viewLevel === "api-key-type-select") {
454894
+ setViewLevel("main");
454895
+ } else if (viewLevel === "custom-info") {
454896
+ setViewLevel("api-key-type-select");
454897
+ } else if (viewLevel === "alibaba-standard-region-select") {
454898
+ setViewLevel("api-key-type-select");
454899
+ } else if (viewLevel === "alibaba-standard-api-key-input") {
454900
+ setViewLevel("alibaba-standard-region-select");
454901
+ } else if (viewLevel === "alibaba-standard-model-id-input") {
454902
+ setViewLevel("alibaba-standard-api-key-input");
454611
454903
  }
454612
454904
  }, "handleGoBack");
454613
454905
  useKeypress(
@@ -454621,6 +454913,10 @@ function AuthDialog() {
454621
454913
  handleGoBack();
454622
454914
  return;
454623
454915
  }
454916
+ if (viewLevel === "api-key-type-select" || viewLevel === "alibaba-standard-region-select" || viewLevel === "alibaba-standard-api-key-input" || viewLevel === "alibaba-standard-model-id-input") {
454917
+ handleGoBack();
454918
+ return;
454919
+ }
454624
454920
  if (errorMessage) {
454625
454921
  return;
454626
454922
  }
@@ -454671,6 +454967,97 @@ function AuthDialog() {
454671
454967
  region
454672
454968
  }
454673
454969
  ) }), "renderApiKeyInputView");
454970
+ const renderApiKeyTypeSelectView = /* @__PURE__ */ __name(() => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [
454971
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
454972
+ DescriptiveRadioButtonSelect,
454973
+ {
454974
+ items: apiKeyTypeItems,
454975
+ initialIndex: apiKeyTypeIndex,
454976
+ onSelect: handleApiKeyTypeSelect,
454977
+ onHighlight: (value) => {
454978
+ const index = apiKeyTypeItems.findIndex(
454979
+ (item) => item.value === value
454980
+ );
454981
+ setApiKeyTypeIndex(index);
454982
+ },
454983
+ itemGap: 1
454984
+ }
454985
+ ) }),
454986
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { color: theme?.text?.secondary, children: t4("Enter to select, \u2191\u2193 to navigate, Esc to go back") }) })
454987
+ ] }), "renderApiKeyTypeSelectView");
454988
+ const renderAlibabaStandardRegionSelectView = /* @__PURE__ */ __name(() => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [
454989
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
454990
+ DescriptiveRadioButtonSelect,
454991
+ {
454992
+ items: alibabaStandardRegionItems,
454993
+ initialIndex: alibabaStandardRegionIndex,
454994
+ onSelect: handleAlibabaStandardRegionSelect,
454995
+ onHighlight: (value) => {
454996
+ const index = alibabaStandardRegionItems.findIndex(
454997
+ (item) => item.value === value
454998
+ );
454999
+ setAlibabaStandardRegionIndex(index);
455000
+ },
455001
+ itemGap: 1
455002
+ }
455003
+ ) }),
455004
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { color: theme?.text?.secondary, children: t4("Enter to select, \u2191\u2193 to navigate, Esc to go back") }) })
455005
+ ] }), "renderAlibabaStandardRegionSelectView");
455006
+ const renderAlibabaStandardApiKeyInputView = /* @__PURE__ */ __name(() => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(Box_default, { marginTop: 1, flexDirection: "column", children: [
455007
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(Text3, { color: theme.text.secondary, children: [
455008
+ "Endpoint: ",
455009
+ ALIBABA_STANDARD_API_KEY_ENDPOINTS[alibabaStandardRegion]
455010
+ ] }) }),
455011
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(Text3, { color: theme.text.secondary, children: [
455012
+ t4("Documentation"),
455013
+ ":"
455014
+ ] }) }),
455015
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 0, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
455016
+ dist_default6,
455017
+ {
455018
+ url: ALIBABA_STANDARD_API_DOCUMENTATION_URLS[alibabaStandardRegion],
455019
+ fallback: false,
455020
+ children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { color: theme.text.link, children: ALIBABA_STANDARD_API_DOCUMENTATION_URLS[alibabaStandardRegion] })
455021
+ }
455022
+ ) }),
455023
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
455024
+ TextInput,
455025
+ {
455026
+ value: alibabaStandardApiKey,
455027
+ onChange: (value) => {
455028
+ setAlibabaStandardApiKey(value);
455029
+ if (alibabaStandardApiKeyError) {
455030
+ setAlibabaStandardApiKeyError(null);
455031
+ }
455032
+ },
455033
+ onSubmit: handleAlibabaStandardApiKeySubmit,
455034
+ placeholder: "sk-..."
455035
+ }
455036
+ ) }),
455037
+ alibabaStandardApiKeyError && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { color: theme.status.error, children: alibabaStandardApiKeyError }) }),
455038
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { color: theme.text.secondary, children: t4("Enter to submit, Esc to go back") }) })
455039
+ ] }), "renderAlibabaStandardApiKeyInputView");
455040
+ const renderAlibabaStandardModelIdInputView = /* @__PURE__ */ __name(() => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(Box_default, { marginTop: 1, flexDirection: "column", children: [
455041
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { color: theme.text.secondary, children: t4(
455042
+ "You can enter multiple model IDs, separated by commas. Examples: qwen3.5-plus,glm-5,kimi-k2.5"
455043
+ ) }) }),
455044
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
455045
+ TextInput,
455046
+ {
455047
+ value: alibabaStandardModelId,
455048
+ onChange: (value) => {
455049
+ setAlibabaStandardModelId(value);
455050
+ if (alibabaStandardModelIdError) {
455051
+ setAlibabaStandardModelIdError(null);
455052
+ }
455053
+ },
455054
+ onSubmit: handleAlibabaStandardModelSubmit,
455055
+ placeholder: ALIBABA_STANDARD_MODEL_IDS_PLACEHOLDER
455056
+ }
455057
+ ) }),
455058
+ alibabaStandardModelIdError && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { color: theme.status.error, children: alibabaStandardModelIdError }) }),
455059
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { color: theme.text.secondary, children: t4("Enter to submit, Esc to go back") }) })
455060
+ ] }), "renderAlibabaStandardModelIdInputView");
454674
455061
  const renderCustomInfoView = /* @__PURE__ */ __name(() => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [
454675
455062
  /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { color: theme.text.primary, children: t4("You can configure your API key and models in settings.json") }) }),
454676
455063
  /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { children: t4("Refer to the documentation for setup instructions") }) }),
@@ -454685,8 +455072,18 @@ function AuthDialog() {
454685
455072
  return t4("Select Region for Coding Plan");
454686
455073
  case "api-key-input":
454687
455074
  return t4("Enter Coding Plan API Key");
455075
+ case "api-key-type-select":
455076
+ return t4("Select API Key Type");
454688
455077
  case "custom-info":
454689
455078
  return t4("Custom Configuration");
455079
+ case "alibaba-standard-region-select":
455080
+ return t4(
455081
+ "Select Region for Alibaba Cloud ModelStudio Standard API Key"
455082
+ );
455083
+ case "alibaba-standard-api-key-input":
455084
+ return t4("Enter Alibaba Cloud ModelStudio Standard API Key");
455085
+ case "alibaba-standard-model-id-input":
455086
+ return t4("Enter Model IDs");
454690
455087
  default:
454691
455088
  return t4("Select Authentication Method");
454692
455089
  }
@@ -454704,6 +455101,10 @@ function AuthDialog() {
454704
455101
  viewLevel === "main" && renderMainView(),
454705
455102
  viewLevel === "region-select" && renderRegionSelectView(),
454706
455103
  viewLevel === "api-key-input" && renderApiKeyInputView(),
455104
+ viewLevel === "api-key-type-select" && renderApiKeyTypeSelectView(),
455105
+ viewLevel === "alibaba-standard-region-select" && renderAlibabaStandardRegionSelectView(),
455106
+ viewLevel === "alibaba-standard-api-key-input" && renderAlibabaStandardApiKeyInputView(),
455107
+ viewLevel === "alibaba-standard-model-id-input" && renderAlibabaStandardModelIdInputView(),
454707
455108
  viewLevel === "custom-info" && renderCustomInfoView(),
454708
455109
  (authError || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Text3, { color: theme.status.error, children: authError || errorMessage }) }),
454709
455110
  viewLevel === "main" && /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [
@@ -461698,14 +462099,6 @@ function useCommandCompletion(buffer, dirs, cwd6, slashCommands, commandContext,
461698
462099
  const cursorCol = buffer.cursor[1];
461699
462100
  const { completionMode, query, completionStart, completionEnd } = (0, import_react114.useMemo)(() => {
461700
462101
  const currentLine = buffer.lines[cursorRow] || "";
461701
- if (cursorRow === 0 && isSlashCommand(currentLine.trim())) {
461702
- return {
461703
- completionMode: "SLASH" /* SLASH */,
461704
- query: currentLine,
461705
- completionStart: 0,
461706
- completionEnd: currentLine.length
461707
- };
461708
- }
461709
462102
  const codePoints = toCodePoints(currentLine);
461710
462103
  for (let i4 = cursorCol - 1; i4 >= 0; i4--) {
461711
462104
  const char = codePoints[i4];
@@ -461741,6 +462134,14 @@ function useCommandCompletion(buffer, dirs, cwd6, slashCommands, commandContext,
461741
462134
  };
461742
462135
  }
461743
462136
  }
462137
+ if (cursorRow === 0 && isSlashCommand(currentLine.trim())) {
462138
+ return {
462139
+ completionMode: "SLASH" /* SLASH */,
462140
+ query: currentLine,
462141
+ completionStart: 0,
462142
+ completionEnd: currentLine.length
462143
+ };
462144
+ }
461744
462145
  return {
461745
462146
  completionMode: "IDLE" /* IDLE */,
461746
462147
  query: null,
@@ -465302,6 +465703,98 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config2, addItem, onAuthC
465302
465703
  },
465303
465704
  [settings, config2, handleAuthFailure, addItem, onAuthChange]
465304
465705
  );
465706
+ const handleAlibabaStandardSubmit = (0, import_react132.useCallback)(
465707
+ async (apiKey, region, modelIdsInput) => {
465708
+ try {
465709
+ setIsAuthenticating(true);
465710
+ setAuthError(null);
465711
+ const trimmedApiKey = apiKey.trim();
465712
+ const modelIds = modelIdsInput.split(",").map((id) => id.trim()).filter(
465713
+ (id, index, array2) => id.length > 0 && array2.indexOf(id) === index
465714
+ );
465715
+ if (!trimmedApiKey) {
465716
+ throw new Error(t4("API key cannot be empty."));
465717
+ }
465718
+ if (modelIds.length === 0) {
465719
+ throw new Error(t4("Model IDs cannot be empty."));
465720
+ }
465721
+ const baseUrl = ALIBABA_STANDARD_API_KEY_ENDPOINTS[region];
465722
+ const persistScope = getPersistScopeForModelSelection(settings);
465723
+ const settingsFile = settings.forScope(persistScope);
465724
+ backupSettingsFile(settingsFile.path);
465725
+ settings.setValue(
465726
+ persistScope,
465727
+ `env.${DASHSCOPE_STANDARD_API_KEY_ENV_KEY}`,
465728
+ trimmedApiKey
465729
+ );
465730
+ process.env[DASHSCOPE_STANDARD_API_KEY_ENV_KEY] = trimmedApiKey;
465731
+ const newConfigs = modelIds.map((modelId) => ({
465732
+ id: modelId,
465733
+ name: `[ModelStudio Standard] ${modelId}`,
465734
+ baseUrl,
465735
+ envKey: DASHSCOPE_STANDARD_API_KEY_ENV_KEY
465736
+ }));
465737
+ const existingConfigs = settings.merged.modelProviders?.[AuthType2.USE_OPENAI] || [];
465738
+ const nonAlibabaStandardConfigs = existingConfigs.filter(
465739
+ (existing) => !(existing.envKey === DASHSCOPE_STANDARD_API_KEY_ENV_KEY && typeof existing.baseUrl === "string" && Object.values(ALIBABA_STANDARD_API_KEY_ENDPOINTS).includes(
465740
+ existing.baseUrl
465741
+ ))
465742
+ );
465743
+ const updatedConfigs = [...newConfigs, ...nonAlibabaStandardConfigs];
465744
+ settings.setValue(
465745
+ persistScope,
465746
+ `modelProviders.${AuthType2.USE_OPENAI}`,
465747
+ updatedConfigs
465748
+ );
465749
+ settings.setValue(
465750
+ persistScope,
465751
+ "security.auth.selectedType",
465752
+ AuthType2.USE_OPENAI
465753
+ );
465754
+ settings.setValue(persistScope, "model.name", modelIds[0]);
465755
+ const updatedModelProviders = {
465756
+ ...settings.merged.modelProviders,
465757
+ [AuthType2.USE_OPENAI]: updatedConfigs
465758
+ };
465759
+ config2.reloadModelProvidersConfig(updatedModelProviders);
465760
+ await config2.refreshAuth(AuthType2.USE_OPENAI);
465761
+ setAuthError(null);
465762
+ setAuthState("authenticated" /* Authenticated */);
465763
+ setPendingAuthType(void 0);
465764
+ setIsAuthDialogOpen(false);
465765
+ setIsAuthenticating(false);
465766
+ onAuthChange?.();
465767
+ addItem(
465768
+ {
465769
+ type: "info" /* INFO */,
465770
+ text: t4(
465771
+ "Alibaba Cloud ModelStudio Standard API Key successfully entered. Settings updated with env.DASHSCOPE_API_KEY and {{modelCount}} model(s).",
465772
+ { modelCount: String(modelIds.length) }
465773
+ )
465774
+ },
465775
+ Date.now()
465776
+ );
465777
+ addItem(
465778
+ {
465779
+ type: "info" /* INFO */,
465780
+ text: t4(
465781
+ "You can use /model to see new ModelStudio Standard models and switch between them."
465782
+ )
465783
+ },
465784
+ Date.now()
465785
+ );
465786
+ const authEvent = new AuthEvent(
465787
+ AuthType2.USE_OPENAI,
465788
+ "manual",
465789
+ "success"
465790
+ );
465791
+ logAuth(config2, authEvent);
465792
+ } catch (error40) {
465793
+ handleAuthFailure(error40);
465794
+ }
465795
+ },
465796
+ [settings, config2, handleAuthFailure, addItem, onAuthChange]
465797
+ );
465305
465798
  (0, import_react132.useEffect)(() => {
465306
465799
  const defaultAuthType = process.env["QWEN_DEFAULT_AUTH_TYPE"];
465307
465800
  if (defaultAuthType && ![
@@ -465339,6 +465832,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config2, addItem, onAuthC
465339
465832
  qwenAuthState,
465340
465833
  handleAuthSelect,
465341
465834
  handleCodingPlanSubmit,
465835
+ handleAlibabaStandardSubmit,
465342
465836
  openAuthDialog,
465343
465837
  cancelAuthentication
465344
465838
  };
@@ -473415,6 +473909,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
473415
473909
  qwenAuthState,
473416
473910
  handleAuthSelect,
473417
473911
  handleCodingPlanSubmit,
473912
+ handleAlibabaStandardSubmit,
473418
473913
  openAuthDialog,
473419
473914
  cancelAuthentication
473420
473915
  } = useAuthCommand(settings, config2, historyManager.addItem, refreshStatic);
@@ -474384,6 +474879,7 @@ ${migrationResult.failedFiles.map((f5) => ` \u2022 ${f5.file}: ${f5.error}`).jo
474384
474879
  onAuthError,
474385
474880
  cancelAuthentication,
474386
474881
  handleCodingPlanSubmit,
474882
+ handleAlibabaStandardSubmit,
474387
474883
  handleEditorSelect,
474388
474884
  exitEditorDialog,
474389
474885
  closeSettingsDialog,
@@ -474441,6 +474937,7 @@ ${migrationResult.failedFiles.map((f5) => ` \u2022 ${f5.file}: ${f5.error}`).jo
474441
474937
  onAuthError,
474442
474938
  cancelAuthentication,
474443
474939
  handleCodingPlanSubmit,
474940
+ handleAlibabaStandardSubmit,
474444
474941
  handleEditorSelect,
474445
474942
  exitEditorDialog,
474446
474943
  closeSettingsDialog,
@@ -477190,7 +477687,10 @@ __name(parseAcpModelOption, "parseAcpModelOption");
477190
477687
  init_esbuild_shims();
477191
477688
  init_dist4();
477192
477689
  init_zod();
477193
- var debugLogger146 = createDebugLogger("ACP_SUBAGENT_TRACKER");
477690
+
477691
+ // packages/cli/src/acp-integration/session/permissionUtils.ts
477692
+ init_esbuild_shims();
477693
+ init_dist4();
477194
477694
  var basicPermissionOptions = [
477195
477695
  {
477196
477696
  optionId: ToolConfirmationOutcome.ProceedOnce,
@@ -477203,6 +477703,165 @@ var basicPermissionOptions = [
477203
477703
  kind: "reject_once"
477204
477704
  }
477205
477705
  ];
477706
+ function supportsHideAlwaysAllow(confirmation) {
477707
+ return confirmation.type !== "ask_user_question";
477708
+ }
477709
+ __name(supportsHideAlwaysAllow, "supportsHideAlwaysAllow");
477710
+ function filterAlwaysAllowOptions(confirmation, options2, forceHideAlwaysAllow = false) {
477711
+ const hideAlwaysAllow = forceHideAlwaysAllow || supportsHideAlwaysAllow(confirmation) && confirmation.hideAlwaysAllow === true;
477712
+ return hideAlwaysAllow ? options2.filter((option2) => option2.kind !== "allow_always") : options2;
477713
+ }
477714
+ __name(filterAlwaysAllowOptions, "filterAlwaysAllowOptions");
477715
+ function formatExecPermissionScopeLabel(confirmation) {
477716
+ const permissionRules = confirmation.permissionRules ?? [];
477717
+ const bashRules = permissionRules.map((rule) => {
477718
+ const match2 = /^Bash\((.*)\)$/.exec(rule.trim());
477719
+ return match2?.[1]?.trim() || void 0;
477720
+ }).filter((rule) => Boolean(rule));
477721
+ const uniqueRules = [...new Set(bashRules)];
477722
+ if (uniqueRules.length === 1) {
477723
+ return uniqueRules[0];
477724
+ }
477725
+ if (uniqueRules.length > 1) {
477726
+ return uniqueRules.join(", ");
477727
+ }
477728
+ return confirmation.rootCommand;
477729
+ }
477730
+ __name(formatExecPermissionScopeLabel, "formatExecPermissionScopeLabel");
477731
+ function buildPermissionRequestContent(confirmation) {
477732
+ const content = [];
477733
+ if (confirmation.type === "edit") {
477734
+ content.push({
477735
+ type: "diff",
477736
+ path: confirmation.filePath ?? confirmation.fileName,
477737
+ oldText: confirmation.originalContent ?? "",
477738
+ newText: confirmation.newContent
477739
+ });
477740
+ }
477741
+ if (confirmation.type === "plan") {
477742
+ content.push({
477743
+ type: "content",
477744
+ content: {
477745
+ type: "text",
477746
+ text: confirmation.plan
477747
+ }
477748
+ });
477749
+ }
477750
+ return content;
477751
+ }
477752
+ __name(buildPermissionRequestContent, "buildPermissionRequestContent");
477753
+ function toPermissionOptions(confirmation, forceHideAlwaysAllow = false) {
477754
+ switch (confirmation.type) {
477755
+ case "edit":
477756
+ return filterAlwaysAllowOptions(
477757
+ confirmation,
477758
+ [
477759
+ {
477760
+ optionId: ToolConfirmationOutcome.ProceedAlways,
477761
+ name: "Allow All Edits",
477762
+ kind: "allow_always"
477763
+ },
477764
+ ...basicPermissionOptions
477765
+ ],
477766
+ forceHideAlwaysAllow
477767
+ );
477768
+ case "exec": {
477769
+ const label = formatExecPermissionScopeLabel(confirmation);
477770
+ return filterAlwaysAllowOptions(
477771
+ confirmation,
477772
+ [
477773
+ {
477774
+ optionId: ToolConfirmationOutcome.ProceedAlwaysProject,
477775
+ name: `Always Allow in project: ${label}`,
477776
+ kind: "allow_always"
477777
+ },
477778
+ {
477779
+ optionId: ToolConfirmationOutcome.ProceedAlwaysUser,
477780
+ name: `Always Allow for user: ${label}`,
477781
+ kind: "allow_always"
477782
+ },
477783
+ ...basicPermissionOptions
477784
+ ],
477785
+ forceHideAlwaysAllow
477786
+ );
477787
+ }
477788
+ case "mcp":
477789
+ return filterAlwaysAllowOptions(
477790
+ confirmation,
477791
+ [
477792
+ {
477793
+ optionId: ToolConfirmationOutcome.ProceedAlwaysProject,
477794
+ name: `Always Allow in project: ${confirmation.toolName}`,
477795
+ kind: "allow_always"
477796
+ },
477797
+ {
477798
+ optionId: ToolConfirmationOutcome.ProceedAlwaysUser,
477799
+ name: `Always Allow for user: ${confirmation.toolName}`,
477800
+ kind: "allow_always"
477801
+ },
477802
+ ...basicPermissionOptions
477803
+ ],
477804
+ forceHideAlwaysAllow
477805
+ );
477806
+ case "info":
477807
+ return filterAlwaysAllowOptions(
477808
+ confirmation,
477809
+ [
477810
+ {
477811
+ optionId: ToolConfirmationOutcome.ProceedAlwaysProject,
477812
+ name: "Always Allow in project",
477813
+ kind: "allow_always"
477814
+ },
477815
+ {
477816
+ optionId: ToolConfirmationOutcome.ProceedAlwaysUser,
477817
+ name: "Always Allow for user",
477818
+ kind: "allow_always"
477819
+ },
477820
+ ...basicPermissionOptions
477821
+ ],
477822
+ forceHideAlwaysAllow
477823
+ );
477824
+ case "plan":
477825
+ return [
477826
+ {
477827
+ optionId: ToolConfirmationOutcome.ProceedAlways,
477828
+ name: "Yes, and auto-accept edits",
477829
+ kind: "allow_always"
477830
+ },
477831
+ {
477832
+ optionId: ToolConfirmationOutcome.ProceedOnce,
477833
+ name: "Yes, and manually approve edits",
477834
+ kind: "allow_once"
477835
+ },
477836
+ {
477837
+ optionId: ToolConfirmationOutcome.Cancel,
477838
+ name: "No, keep planning (esc)",
477839
+ kind: "reject_once"
477840
+ }
477841
+ ];
477842
+ case "ask_user_question":
477843
+ return [
477844
+ {
477845
+ optionId: ToolConfirmationOutcome.ProceedOnce,
477846
+ name: "Submit",
477847
+ kind: "allow_once"
477848
+ },
477849
+ {
477850
+ optionId: ToolConfirmationOutcome.Cancel,
477851
+ name: "Cancel",
477852
+ kind: "reject_once"
477853
+ }
477854
+ ];
477855
+ default: {
477856
+ const unreachable = confirmation;
477857
+ throw new Error(`Unexpected: ${unreachable}`);
477858
+ }
477859
+ }
477860
+ }
477861
+ __name(toPermissionOptions, "toPermissionOptions");
477862
+
477863
+ // packages/cli/src/acp-integration/session/SubAgentTracker.ts
477864
+ var debugLogger146 = createDebugLogger("ACP_SUBAGENT_TRACKER");
477206
477865
  var SubAgentTracker = class {
477207
477866
  constructor(ctx, client, parentToolCallId, subagentType) {
477208
477867
  this.ctx = ctx;
@@ -477314,16 +477973,6 @@ var SubAgentTracker = class {
477314
477973
  const event = args2[0];
477315
477974
  if (abortSignal.aborted) return;
477316
477975
  const state = this.toolStates.get(event.callId);
477317
- const content = [];
477318
- if (event.confirmationDetails.type === "edit") {
477319
- const editDetails = event.confirmationDetails;
477320
- content.push({
477321
- type: "diff",
477322
- path: editDetails.filePath || editDetails.fileName,
477323
- oldText: editDetails.originalContent ?? "",
477324
- newText: editDetails.newContent
477325
- });
477326
- }
477327
477976
  const fullConfirmationDetails = {
477328
477977
  ...event.confirmationDetails,
477329
477978
  onConfirm: /* @__PURE__ */ __name(async () => {
@@ -477332,12 +477981,12 @@ var SubAgentTracker = class {
477332
477981
  const { title, locations, kind: kind2 } = this.toolCallEmitter.resolveToolMetadata(event.name, state?.args);
477333
477982
  const params = {
477334
477983
  sessionId: this.ctx.sessionId,
477335
- options: this.toPermissionOptions(fullConfirmationDetails),
477984
+ options: toPermissionOptions(fullConfirmationDetails),
477336
477985
  toolCall: {
477337
477986
  toolCallId: event.callId,
477338
477987
  status: "pending",
477339
477988
  title,
477340
- content,
477989
+ content: buildPermissionRequestContent(fullConfirmationDetails),
477341
477990
  locations,
477342
477991
  kind: kind2,
477343
477992
  rawInput: state?.args
@@ -477346,7 +477995,9 @@ var SubAgentTracker = class {
477346
477995
  try {
477347
477996
  const output = await this.client.requestPermission(params);
477348
477997
  const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
477349
- await event.respond(outcome);
477998
+ await event.respond(outcome, {
477999
+ answers: "answers" in output ? output.answers : void 0
478000
+ });
477350
478001
  } catch (error40) {
477351
478002
  debugLogger146.error(
477352
478003
  `Permission request failed for subagent tool ${event.name}:`,
@@ -477386,83 +478037,6 @@ var SubAgentTracker = class {
477386
478037
  );
477387
478038
  };
477388
478039
  }
477389
- /**
477390
- * Converts confirmation details to permission options for the client.
477391
- */
477392
- toPermissionOptions(confirmation) {
477393
- const hideAlwaysAllow = "hideAlwaysAllow" in confirmation && confirmation.hideAlwaysAllow;
477394
- switch (confirmation.type) {
477395
- case "edit":
477396
- return [
477397
- {
477398
- optionId: ToolConfirmationOutcome.ProceedAlways,
477399
- name: "Allow All Edits",
477400
- kind: "allow_always"
477401
- },
477402
- ...basicPermissionOptions
477403
- ];
477404
- case "exec":
477405
- return [
477406
- ...hideAlwaysAllow ? [] : [
477407
- {
477408
- optionId: ToolConfirmationOutcome.ProceedAlwaysProject,
477409
- name: `Always Allow in project: ${confirmation.rootCommand ?? "command"}`,
477410
- kind: "allow_always"
477411
- },
477412
- {
477413
- optionId: ToolConfirmationOutcome.ProceedAlwaysUser,
477414
- name: `Always Allow for user: ${confirmation.rootCommand ?? "command"}`,
477415
- kind: "allow_always"
477416
- }
477417
- ],
477418
- ...basicPermissionOptions
477419
- ];
477420
- case "mcp":
477421
- return [
477422
- ...hideAlwaysAllow ? [] : [
477423
- {
477424
- optionId: ToolConfirmationOutcome.ProceedAlwaysProject,
477425
- name: `Always Allow in project: ${confirmation.toolName ?? "tool"}`,
477426
- kind: "allow_always"
477427
- },
477428
- {
477429
- optionId: ToolConfirmationOutcome.ProceedAlwaysUser,
477430
- name: `Always Allow for user: ${confirmation.toolName ?? "tool"}`,
477431
- kind: "allow_always"
477432
- }
477433
- ],
477434
- ...basicPermissionOptions
477435
- ];
477436
- case "info":
477437
- return [
477438
- ...hideAlwaysAllow ? [] : [
477439
- {
477440
- optionId: ToolConfirmationOutcome.ProceedAlwaysProject,
477441
- name: "Always Allow in project",
477442
- kind: "allow_always"
477443
- },
477444
- {
477445
- optionId: ToolConfirmationOutcome.ProceedAlwaysUser,
477446
- name: "Always Allow for user",
477447
- kind: "allow_always"
477448
- }
477449
- ],
477450
- ...basicPermissionOptions
477451
- ];
477452
- case "plan":
477453
- return [
477454
- {
477455
- optionId: ToolConfirmationOutcome.ProceedAlways,
477456
- name: "Always Allow Plans",
477457
- kind: "allow_always"
477458
- },
477459
- ...basicPermissionOptions
477460
- ];
477461
- default: {
477462
- return [...basicPermissionOptions];
477463
- }
477464
- }
477465
- }
477466
478040
  };
477467
478041
 
477468
478042
  // packages/cli/src/acp-integration/session/Session.ts
@@ -477760,9 +478334,21 @@ var Session3 = class {
477760
478334
  };
477761
478335
  await this.sendUpdate(update2);
477762
478336
  }
478337
+ async resolveIdeDiffForOutcome(confirmationDetails, outcome) {
478338
+ if (confirmationDetails.type !== "edit" || !confirmationDetails.ideConfirmation) {
478339
+ return;
478340
+ }
478341
+ const { IdeClient: IdeClient2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports));
478342
+ const ideClient = await IdeClient2.getInstance();
478343
+ const cliOutcome = outcome === ToolConfirmationOutcome.Cancel ? "rejected" : "accepted";
478344
+ await ideClient.resolveDiffFromCli(
478345
+ confirmationDetails.filePath,
478346
+ cliOutcome
478347
+ );
478348
+ }
477763
478349
  async runTool(abortSignal, promptId, fc) {
477764
478350
  const callId = fc.id ?? `${fc.name}-${Date.now()}`;
477765
- const args2 = fc.args ?? {};
478351
+ let args2 = fc.args ?? {};
477766
478352
  const startTime = Date.now();
477767
478353
  const errorResponse = /* @__PURE__ */ __name((error40) => {
477768
478354
  const durationMs = Date.now() - startTime;
@@ -477788,16 +478374,39 @@ var Session3 = class {
477788
478374
  }
477789
478375
  ];
477790
478376
  }, "errorResponse");
478377
+ const earlyErrorResponse = /* @__PURE__ */ __name(async (error40, toolName = fc.name ?? "unknown_tool") => {
478378
+ if (toolName !== TodoWriteTool.Name) {
478379
+ await this.toolCallEmitter.emitError(callId, toolName, error40);
478380
+ }
478381
+ const errorParts = errorResponse(error40);
478382
+ this.config.getChatRecordingService()?.recordToolResult(errorParts, {
478383
+ callId,
478384
+ status: "error",
478385
+ resultDisplay: void 0,
478386
+ error: error40,
478387
+ errorType: void 0
478388
+ });
478389
+ return errorParts;
478390
+ }, "earlyErrorResponse");
477791
478391
  if (!fc.name) {
477792
- return errorResponse(new Error("Missing function name"));
478392
+ return earlyErrorResponse(new Error("Missing function name"));
477793
478393
  }
477794
478394
  const toolRegistry = this.config.getToolRegistry();
477795
478395
  const tool = toolRegistry.getTool(fc.name);
477796
478396
  if (!tool) {
477797
- return errorResponse(
478397
+ return earlyErrorResponse(
477798
478398
  new Error(`Tool "${fc.name}" not found in registry.`)
477799
478399
  );
477800
478400
  }
478401
+ const pm = this.config.getPermissionManager?.();
478402
+ if (pm && !await pm.isToolEnabled(fc.name)) {
478403
+ return earlyErrorResponse(
478404
+ new Error(
478405
+ `Qwen Code requires permission to use "${fc.name}", but that permission was declined.`
478406
+ ),
478407
+ fc.name
478408
+ );
478409
+ }
477801
478410
  const isTodoWriteTool = tool.name === TodoWriteTool.Name;
477802
478411
  const isAgentTool = tool.name === AgentTool.Name;
477803
478412
  const isExitPlanModeTool = tool.name === ExitPlanModeTool.Name;
@@ -477821,85 +478430,147 @@ var Session3 = class {
477821
478430
  }
477822
478431
  const isAskUserQuestionTool = fc.name === ToolNames.ASK_USER_QUESTION;
477823
478432
  const defaultPermission = this.config.getApprovalMode() !== ApprovalMode.YOLO || isAskUserQuestionTool ? await invocation.getDefaultPermission() : "allow";
477824
- const needsConfirmation = defaultPermission === "ask";
477825
- const isPlanMode = this.config.getApprovalMode() === ApprovalMode.PLAN;
478433
+ const toolParams = invocation.params;
478434
+ const pmCtx = buildPermissionCheckContext(
478435
+ fc.name,
478436
+ toolParams,
478437
+ this.config.getTargetDir?.() ?? ""
478438
+ );
478439
+ const { finalPermission, pmForcedAsk } = await evaluatePermissionRules(
478440
+ pm,
478441
+ defaultPermission,
478442
+ pmCtx
478443
+ );
478444
+ const needsConfirmation = finalPermission === "ask";
478445
+ const approvalMode = this.config.getApprovalMode();
478446
+ const isPlanMode = approvalMode === ApprovalMode.PLAN;
477826
478447
  if (isPlanMode && !isExitPlanModeTool && !isAskUserQuestionTool && needsConfirmation) {
477827
- return errorResponse(
478448
+ return earlyErrorResponse(
477828
478449
  new Error(
477829
478450
  `Plan mode is active. The tool "${fc.name}" cannot be executed because it modifies the system. Please use the exit_plan_mode tool to present your plan and exit plan mode before making changes.`
477830
- )
478451
+ ),
478452
+ fc.name
477831
478453
  );
477832
478454
  }
477833
- if (defaultPermission === "deny") {
477834
- return errorResponse(
478455
+ if (finalPermission === "deny") {
478456
+ return earlyErrorResponse(
477835
478457
  new Error(
477836
- `Tool "${fc.name}" is denied: command substitution is not allowed for security reasons.`
477837
- )
478458
+ defaultPermission === "deny" ? `Tool "${fc.name}" is denied: command substitution is not allowed for security reasons.` : `Tool "${fc.name}" is denied by permission rules.`
478459
+ ),
478460
+ fc.name
477838
478461
  );
477839
478462
  }
478463
+ let didRequestPermission = false;
477840
478464
  if (needsConfirmation) {
477841
478465
  const confirmationDetails = await invocation.getConfirmationDetails(abortSignal);
477842
- const content = [];
477843
- if (confirmationDetails.type === "edit") {
477844
- content.push({
477845
- type: "diff",
477846
- path: confirmationDetails.filePath || confirmationDetails.fileName,
477847
- oldText: confirmationDetails.originalContent,
477848
- newText: confirmationDetails.newContent
477849
- });
477850
- }
477851
- if (confirmationDetails.type === "plan") {
477852
- content.push({
477853
- type: "content",
477854
- content: {
477855
- type: "text",
477856
- text: confirmationDetails.plan
478466
+ injectPermissionRulesIfMissing(confirmationDetails, pmCtx);
478467
+ const messageBus = this.config.getMessageBus?.();
478468
+ const hooksEnabled = this.config.getEnableHooks?.() ?? false;
478469
+ let hookHandled = false;
478470
+ if (hooksEnabled && messageBus) {
478471
+ const hookResult = await firePermissionRequestHook(
478472
+ messageBus,
478473
+ fc.name,
478474
+ args2,
478475
+ String(approvalMode)
478476
+ );
478477
+ if (hookResult.hasDecision) {
478478
+ hookHandled = true;
478479
+ if (hookResult.shouldAllow) {
478480
+ if (hookResult.updatedInput) {
478481
+ args2 = hookResult.updatedInput;
478482
+ invocation.params = hookResult.updatedInput;
478483
+ }
478484
+ await this.resolveIdeDiffForOutcome(
478485
+ confirmationDetails,
478486
+ ToolConfirmationOutcome.ProceedOnce
478487
+ );
478488
+ await confirmationDetails.onConfirm(
478489
+ ToolConfirmationOutcome.ProceedOnce
478490
+ );
478491
+ } else {
478492
+ return earlyErrorResponse(
478493
+ new Error(
478494
+ hookResult.denyMessage || `Permission denied by hook for "${fc.name}"`
478495
+ ),
478496
+ fc.name
478497
+ );
477857
478498
  }
477858
- });
477859
- }
477860
- const mappedKind = this.toolCallEmitter.mapToolKind(tool.kind, fc.name);
477861
- const params = {
477862
- sessionId: this.sessionId,
477863
- options: toPermissionOptions(confirmationDetails),
477864
- toolCall: {
477865
- toolCallId: callId,
477866
- status: "pending",
477867
- title: invocation.getDescription(),
477868
- content,
477869
- locations: invocation.toolLocations(),
477870
- kind: mappedKind,
477871
- rawInput: args2
477872
478499
  }
477873
- };
477874
- const output = await this.client.requestPermission(
477875
- params
477876
- );
477877
- const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
477878
- await confirmationDetails.onConfirm(outcome, {
477879
- answers: output.answers
477880
- });
477881
- if (isExitPlanModeTool && outcome !== ToolConfirmationOutcome.Cancel) {
477882
- await this.sendCurrentModeUpdateNotification(outcome);
477883
478500
  }
477884
- switch (outcome) {
477885
- case ToolConfirmationOutcome.Cancel:
477886
- return errorResponse(
477887
- new Error(`Tool "${fc.name}" was canceled by the user.`)
478501
+ if (approvalMode === ApprovalMode.AUTO_EDIT && (confirmationDetails.type === "edit" || confirmationDetails.type === "info")) {
478502
+ } else if (!hookHandled) {
478503
+ didRequestPermission = true;
478504
+ const content = buildPermissionRequestContent(confirmationDetails);
478505
+ const mappedKind = this.toolCallEmitter.mapToolKind(
478506
+ tool.kind,
478507
+ fc.name
478508
+ );
478509
+ if (hooksEnabled && messageBus) {
478510
+ void fireNotificationHook(
478511
+ messageBus,
478512
+ `Qwen Code needs your permission to use ${fc.name}`,
478513
+ NotificationType.PermissionPrompt,
478514
+ "Permission needed"
477888
478515
  );
477889
- case ToolConfirmationOutcome.ProceedOnce:
477890
- case ToolConfirmationOutcome.ProceedAlways:
477891
- case ToolConfirmationOutcome.ProceedAlwaysProject:
477892
- case ToolConfirmationOutcome.ProceedAlwaysUser:
477893
- case ToolConfirmationOutcome.ProceedAlwaysServer:
477894
- case ToolConfirmationOutcome.ProceedAlwaysTool:
477895
- case ToolConfirmationOutcome.ModifyWithEditor:
477896
- break;
477897
- default: {
477898
- const resultOutcome = outcome;
477899
- throw new Error(`Unexpected: ${resultOutcome}`);
478516
+ }
478517
+ const params = {
478518
+ sessionId: this.sessionId,
478519
+ options: toPermissionOptions(confirmationDetails, pmForcedAsk),
478520
+ toolCall: {
478521
+ toolCallId: callId,
478522
+ status: "pending",
478523
+ title: invocation.getDescription(),
478524
+ content,
478525
+ locations: invocation.toolLocations(),
478526
+ kind: mappedKind,
478527
+ rawInput: args2
478528
+ }
478529
+ };
478530
+ const output = await this.client.requestPermission(
478531
+ params
478532
+ );
478533
+ const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
478534
+ await this.resolveIdeDiffForOutcome(confirmationDetails, outcome);
478535
+ await confirmationDetails.onConfirm(outcome, {
478536
+ answers: output.answers
478537
+ });
478538
+ if (outcome === ToolConfirmationOutcome.ProceedAlways || outcome === ToolConfirmationOutcome.ProceedAlwaysProject || outcome === ToolConfirmationOutcome.ProceedAlwaysUser) {
478539
+ await persistPermissionOutcome(
478540
+ outcome,
478541
+ confirmationDetails,
478542
+ this.config.getOnPersistPermissionRule?.(),
478543
+ this.config.getPermissionManager?.(),
478544
+ { answers: output.answers }
478545
+ );
478546
+ }
478547
+ if (isExitPlanModeTool && outcome !== ToolConfirmationOutcome.Cancel) {
478548
+ await this.sendCurrentModeUpdateNotification(outcome);
478549
+ }
478550
+ if (confirmationDetails.type === "edit" && outcome === ToolConfirmationOutcome.ProceedAlways) {
478551
+ await this.sendCurrentModeUpdateNotification(outcome);
478552
+ }
478553
+ switch (outcome) {
478554
+ case ToolConfirmationOutcome.Cancel:
478555
+ return errorResponse(
478556
+ new Error(`Tool "${fc.name}" was canceled by the user.`)
478557
+ );
478558
+ case ToolConfirmationOutcome.ProceedOnce:
478559
+ case ToolConfirmationOutcome.ProceedAlways:
478560
+ case ToolConfirmationOutcome.ProceedAlwaysProject:
478561
+ case ToolConfirmationOutcome.ProceedAlwaysUser:
478562
+ case ToolConfirmationOutcome.ProceedAlwaysServer:
478563
+ case ToolConfirmationOutcome.ProceedAlwaysTool:
478564
+ case ToolConfirmationOutcome.ModifyWithEditor:
478565
+ break;
478566
+ default: {
478567
+ const resultOutcome = outcome;
478568
+ throw new Error(`Unexpected: ${resultOutcome}`);
478569
+ }
477900
478570
  }
477901
478571
  }
477902
- } else if (!isTodoWriteTool) {
478572
+ }
478573
+ if (!didRequestPermission && !isTodoWriteTool) {
477903
478574
  const startParams = {
477904
478575
  callId,
477905
478576
  toolName: fc.name,
@@ -478147,109 +478818,6 @@ ${contextPart.text}`
478147
478818
  }
478148
478819
  }
478149
478820
  };
478150
- var basicPermissionOptions2 = [
478151
- {
478152
- optionId: ToolConfirmationOutcome.ProceedOnce,
478153
- name: "Allow",
478154
- kind: "allow_once"
478155
- },
478156
- {
478157
- optionId: ToolConfirmationOutcome.Cancel,
478158
- name: "Reject",
478159
- kind: "reject_once"
478160
- }
478161
- ];
478162
- function toPermissionOptions(confirmation) {
478163
- switch (confirmation.type) {
478164
- case "edit":
478165
- return [
478166
- {
478167
- optionId: ToolConfirmationOutcome.ProceedAlways,
478168
- name: "Allow All Edits",
478169
- kind: "allow_always"
478170
- },
478171
- ...basicPermissionOptions2
478172
- ];
478173
- case "exec":
478174
- return [
478175
- {
478176
- optionId: ToolConfirmationOutcome.ProceedAlwaysProject,
478177
- name: `Always Allow in project: ${confirmation.rootCommand}`,
478178
- kind: "allow_always"
478179
- },
478180
- {
478181
- optionId: ToolConfirmationOutcome.ProceedAlwaysUser,
478182
- name: `Always Allow for user: ${confirmation.rootCommand}`,
478183
- kind: "allow_always"
478184
- },
478185
- ...basicPermissionOptions2
478186
- ];
478187
- case "mcp":
478188
- return [
478189
- {
478190
- optionId: ToolConfirmationOutcome.ProceedAlwaysProject,
478191
- name: `Always Allow in project: ${confirmation.toolName}`,
478192
- kind: "allow_always"
478193
- },
478194
- {
478195
- optionId: ToolConfirmationOutcome.ProceedAlwaysUser,
478196
- name: `Always Allow for user: ${confirmation.toolName}`,
478197
- kind: "allow_always"
478198
- },
478199
- ...basicPermissionOptions2
478200
- ];
478201
- case "info":
478202
- return [
478203
- {
478204
- optionId: ToolConfirmationOutcome.ProceedAlwaysProject,
478205
- name: `Always Allow in project`,
478206
- kind: "allow_always"
478207
- },
478208
- {
478209
- optionId: ToolConfirmationOutcome.ProceedAlwaysUser,
478210
- name: `Always Allow for user`,
478211
- kind: "allow_always"
478212
- },
478213
- ...basicPermissionOptions2
478214
- ];
478215
- case "plan":
478216
- return [
478217
- {
478218
- optionId: ToolConfirmationOutcome.ProceedAlways,
478219
- name: `Yes, and auto-accept edits`,
478220
- kind: "allow_always"
478221
- },
478222
- {
478223
- optionId: ToolConfirmationOutcome.ProceedOnce,
478224
- name: `Yes, and manually approve edits`,
478225
- kind: "allow_once"
478226
- },
478227
- {
478228
- optionId: ToolConfirmationOutcome.Cancel,
478229
- name: `No, keep planning (esc)`,
478230
- kind: "reject_once"
478231
- }
478232
- ];
478233
- case "ask_user_question":
478234
- return [
478235
- {
478236
- optionId: ToolConfirmationOutcome.ProceedOnce,
478237
- name: "Submit",
478238
- kind: "allow_once"
478239
- },
478240
- {
478241
- optionId: ToolConfirmationOutcome.Cancel,
478242
- name: "Cancel",
478243
- kind: "reject_once"
478244
- }
478245
- ];
478246
- default: {
478247
- const unreachable = confirmation;
478248
- throw new Error(`Unexpected: ${unreachable}`);
478249
- }
478250
- }
478251
- }
478252
- __name(toPermissionOptions, "toPermissionOptions");
478253
478821
 
478254
478822
  // packages/cli/src/acp-integration/runtimeOutputDirContext.ts
478255
478823
  init_esbuild_shims();
@@ -478319,7 +478887,7 @@ var QwenAgent = class {
478319
478887
  async initialize(args2) {
478320
478888
  this.clientCapabilities = args2.clientCapabilities;
478321
478889
  const authMethods = buildAuthMethods();
478322
- const version2 = "0.13.1-preview.0";
478890
+ const version2 = "0.13.1";
478323
478891
  return {
478324
478892
  protocolVersion: PROTOCOL_VERSION,
478325
478893
  agentInfo: {
@@ -478395,27 +478963,16 @@ var QwenAgent = class {
478395
478963
  return sessionService.sessionExists(params.sessionId);
478396
478964
  }
478397
478965
  );
478398
- if (!exists3) {
478399
- throw RequestError.invalidParams(
478400
- void 0,
478401
- `Session not found for id: ${params.sessionId}`
478402
- );
478403
- }
478404
478966
  const config2 = await this.newSessionConfig(
478405
478967
  params.cwd,
478406
478968
  params.mcpServers,
478407
- params.sessionId
478969
+ params.sessionId,
478970
+ exists3
478408
478971
  );
478409
478972
  await this.ensureAuthenticated(config2);
478410
478973
  this.setupFileSystem(config2);
478411
478974
  const sessionData = config2.getResumedSessionData();
478412
- if (!sessionData) {
478413
- throw RequestError.internalError(
478414
- void 0,
478415
- `Failed to load session data for id: ${params.sessionId}`
478416
- );
478417
- }
478418
- await this.createAndStoreSession(config2, sessionData.conversation);
478975
+ await this.createAndStoreSession(config2, sessionData?.conversation);
478419
478976
  const modesData = this.buildModesData(config2);
478420
478977
  const availableModels = this.buildAvailableModels(config2);
478421
478978
  const configOptions = this.buildConfigOptions(config2);
@@ -478517,7 +479074,8 @@ var QwenAgent = class {
478517
479074
  throw RequestError.methodNotFound(method);
478518
479075
  }
478519
479076
  // --- private helpers ---
478520
- async newSessionConfig(cwd6, mcpServers, sessionId) {
479077
+ async newSessionConfig(cwd6, mcpServers, sessionId, resume) {
479078
+ this.settings = loadSettings(cwd6);
478521
479079
  const mergedMcpServers = { ...this.settings.merged.mcpServers };
478522
479080
  for (const server of mcpServers) {
478523
479081
  const stdioServer = toStdioServer(server);
@@ -478536,10 +479094,10 @@ var QwenAgent = class {
478536
479094
  const settings = { ...this.settings.merged, mcpServers: mergedMcpServers };
478537
479095
  const argvForSession = {
478538
479096
  ...this.argv,
478539
- resume: sessionId,
479097
+ ...resume ? { resume: sessionId } : { sessionId },
478540
479098
  continue: false
478541
479099
  };
478542
- const config2 = await loadCliConfig(settings, argvForSession, cwd6);
479100
+ const config2 = await loadCliConfig(settings, argvForSession, cwd6, []);
478543
479101
  await config2.initialize();
478544
479102
  return config2;
478545
479103
  }
@@ -478904,8 +479462,7 @@ ${finalArgs[promptIndex + 1]}`;
478904
479462
  settings.merged,
478905
479463
  argv,
478906
479464
  process.cwd(),
478907
- argv.extensions,
478908
- settings
479465
+ argv.extensions
478909
479466
  );
478910
479467
  registerCleanup(() => config2.shutdown());
478911
479468
  const wasRaw = process.stdin.isRaw;