@rdmind/rdmind 0.2.2-alpha.5 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli.js CHANGED
@@ -129147,17 +129147,17 @@ var init_tokenUsageReporter = __esm({
129147
129147
  requestId: item.requestId
129148
129148
  }
129149
129149
  );
129150
- } else {
129151
- if (this.queue.length % 10 === 0 || this.queue.length === 1) {
129150
+ } else if (this.queue.length === 1) {
129151
+ console.log(
129152
+ `[tokenUsageReporter] Token \u4F7F\u7528\u8BB0\u5F55\u4E0A\u62A5\u529F\u80FD\u5DF2\u542F\u7528\uFF08\u8FBE\u5230 ${BATCH_SIZE} \u6761\u6216 ${BATCH_INTERVAL_MS / 1e3} \u79D2\u540E\u4E0A\u62A5\uFF09`
129153
+ );
129154
+ }
129155
+ if (this.queue.length >= BATCH_SIZE) {
129156
+ if (isDebugEnabled()) {
129152
129157
  console.log(
129153
- `[tokenUsageReporter] \u5DF2\u6536\u96C6 ${this.queue.length} \u6761 Token \u4F7F\u7528\u8BB0\u5F55\uFF08\u8FBE\u5230 ${BATCH_SIZE} \u6761\u6216 ${BATCH_INTERVAL_MS / 1e3} \u79D2\u540E\u4E0A\u62A5\uFF09`
129158
+ `[tokenUsageReporter] \u961F\u5217\u8FBE\u5230\u6279\u91CF\u5927\u5C0F ${BATCH_SIZE}\uFF0C\u7ACB\u5373\u89E6\u53D1\u4E0A\u62A5`
129154
129159
  );
129155
129160
  }
129156
- }
129157
- if (this.queue.length >= BATCH_SIZE) {
129158
- console.log(
129159
- `[tokenUsageReporter] \u961F\u5217\u8FBE\u5230\u6279\u91CF\u5927\u5C0F ${BATCH_SIZE}\uFF0C\u7ACB\u5373\u89E6\u53D1\u4E0A\u62A5`
129160
- );
129161
129161
  debugLog(`\u961F\u5217\u8FBE\u5230\u6279\u91CF\u5927\u5C0F ${BATCH_SIZE}\uFF0C\u7ACB\u5373\u89E6\u53D1\u4E0A\u62A5`);
129162
129162
  this.flush();
129163
129163
  }
@@ -129237,9 +129237,11 @@ var init_tokenUsageReporter = __esm({
129237
129237
  const success = await this.reportToServer(rdmindSsoId, validItems);
129238
129238
  if (success) {
129239
129239
  this.lastFlushTime = Date.now();
129240
- console.log(
129241
- `[tokenUsageReporter] \u2705 \u6210\u529F\u4E0A\u62A5 ${validItems.length} \u6761 Token \u4F7F\u7528\u8BB0\u5F55`
129242
- );
129240
+ if (isDebugEnabled()) {
129241
+ console.log(
129242
+ `[tokenUsageReporter] \u2705 \u6210\u529F\u4E0A\u62A5 ${validItems.length} \u6761 Token \u4F7F\u7528\u8BB0\u5F55`
129243
+ );
129244
+ }
129243
129245
  debugLog(`\u2705 \u6210\u529F\u4E0A\u62A5 ${validItems.length} \u6761 Token \u4F7F\u7528\u8BB0\u5F55`);
129244
129246
  } else {
129245
129247
  const maxRetrySize = BATCH_SIZE * 2;
@@ -130575,30 +130577,6 @@ function isQwenQuotaExceededError(error2) {
130575
130577
  }
130576
130578
  return false;
130577
130579
  }
130578
- function isQwenThrottlingError(error2) {
130579
- const checkMessage = /* @__PURE__ */ __name((message) => {
130580
- const lowerMessage = message.toLowerCase();
130581
- return lowerMessage.includes("throttling") || lowerMessage.includes("requests throttling triggered") || lowerMessage.includes("rate limit") || lowerMessage.includes("too many requests");
130582
- }, "checkMessage");
130583
- const getStatusCode = /* @__PURE__ */ __name((error3) => {
130584
- if (error3 && typeof error3 === "object") {
130585
- const errorObj = error3;
130586
- return errorObj.status || errorObj.code;
130587
- }
130588
- return void 0;
130589
- }, "getStatusCode");
130590
- const statusCode = getStatusCode(error2);
130591
- if (typeof error2 === "string") {
130592
- return statusCode === 429 && checkMessage(error2) || error2.includes("throttling");
130593
- }
130594
- if (isStructuredError(error2)) {
130595
- return statusCode === 429 && checkMessage(error2.message);
130596
- }
130597
- if (isApiError(error2)) {
130598
- return error2.error.code === 429 && checkMessage(error2.error.message);
130599
- }
130600
- return false;
130601
- }
130602
130580
  var init_quotaErrorDetection = __esm({
130603
130581
  "packages/core/src/utils/quotaErrorDetection.ts"() {
130604
130582
  "use strict";
@@ -130608,7 +130586,6 @@ var init_quotaErrorDetection = __esm({
130608
130586
  __name(isProQuotaExceededError, "isProQuotaExceededError");
130609
130587
  __name(isGenericQuotaExceededError, "isGenericQuotaExceededError");
130610
130588
  __name(isQwenQuotaExceededError, "isQwenQuotaExceededError");
130611
- __name(isQwenThrottlingError, "isQwenThrottlingError");
130612
130589
  }
130613
130590
  });
130614
130591
 
@@ -133235,7 +133212,8 @@ var init_constants3 = __esm({
133235
133212
  "disableCacheControl",
133236
133213
  "schemaCompliance",
133237
133214
  "reasoning",
133238
- "customHeaders"
133215
+ "customHeaders",
133216
+ "extra_body"
133239
133217
  ];
133240
133218
  CREDENTIAL_FIELDS = [
133241
133219
  "model",
@@ -141607,9 +141585,11 @@ var init_default = __esm({
141607
141585
  });
141608
141586
  }
141609
141587
  buildRequest(request4, _userPromptId) {
141588
+ const extraBody = this.contentGeneratorConfig.extra_body;
141610
141589
  return {
141611
- ...request4
141590
+ ...request4,
141612
141591
  // Preserve all original parameters including sampling params
141592
+ ...extraBody ? extraBody : {}
141613
141593
  };
141614
141594
  }
141615
141595
  getDefaultGenerationConfig() {
@@ -141794,6 +141774,8 @@ var init_tokenLimits = __esm({
141794
141774
  // -------------------
141795
141775
  // Moonshot / Kimi
141796
141776
  // -------------------
141777
+ [/^kimi-k2\.5.*$/, LIMITS["256k"]],
141778
+ // Kimi-k2.5: 256K context
141797
141779
  [/^kimi-k2-0905$/, LIMITS["256k"]],
141798
141780
  // Kimi-k2-0905-preview: 256K context
141799
141781
  [/^kimi-k2-turbo.*$/, LIMITS["256k"]],
@@ -141927,6 +141909,7 @@ var init_dashscope = __esm({
141927
141909
  request4,
141928
141910
  request4.model
141929
141911
  );
141912
+ const extraBody = this.contentGeneratorConfig.extra_body;
141930
141913
  if (this.isVisionModel(request4.model)) {
141931
141914
  return {
141932
141915
  ...requestWithTokenLimits,
@@ -141934,7 +141917,8 @@ var init_dashscope = __esm({
141934
141917
  ...tools ? { tools } : {},
141935
141918
  ...this.buildMetadata(userPromptId) || {},
141936
141919
  /* @ts-expect-error dashscope exclusive */
141937
- vl_high_resolution_images: true
141920
+ vl_high_resolution_images: true,
141921
+ ...extraBody ? extraBody : {}
141938
141922
  };
141939
141923
  }
141940
141924
  return {
@@ -141942,7 +141926,8 @@ var init_dashscope = __esm({
141942
141926
  // Preserve all original parameters including sampling params and adjusted max_tokens
141943
141927
  messages,
141944
141928
  ...tools ? { tools } : {},
141945
- ...this.buildMetadata(userPromptId) || {}
141929
+ ...this.buildMetadata(userPromptId) || {},
141930
+ ...extraBody ? extraBody : {}
141946
141931
  };
141947
141932
  }
141948
141933
  buildMetadata(userPromptId) {
@@ -157377,7 +157362,7 @@ __export(geminiContentGenerator_exports2, {
157377
157362
  createGeminiContentGenerator: () => createGeminiContentGenerator
157378
157363
  });
157379
157364
  function createGeminiContentGenerator(config2, gcConfig) {
157380
- const version2 = "0.2.2-alpha.5";
157365
+ const version2 = "0.2.2";
157381
157366
  const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
157382
157367
  const baseHeaders = {
157383
157368
  "User-Agent": userAgent2
@@ -157597,17 +157582,8 @@ var init_contentGenerator = __esm({
157597
157582
 
157598
157583
  // packages/core/src/utils/retry.ts
157599
157584
  function defaultShouldRetry(error2) {
157600
- if (error2 && typeof error2.status === "number") {
157601
- const status = error2.status;
157602
- if (status === 429 || status >= 500 && status < 600) {
157603
- return true;
157604
- }
157605
- }
157606
- if (error2 instanceof Error && error2.message) {
157607
- if (error2.message.includes("429")) return true;
157608
- if (error2.message.match(/5\d{2}/)) return true;
157609
- }
157610
- return false;
157585
+ const status = getErrorStatus(error2);
157586
+ return status === 429 || status !== void 0 && status >= 500 && status < 600;
157611
157587
  }
157612
157588
  function delay(ms) {
157613
157589
  return new Promise((resolve30) => setTimeout(resolve30, ms));
@@ -157630,7 +157606,6 @@ async function retryWithBackoff(fn, options2) {
157630
157606
  };
157631
157607
  let attempt = 0;
157632
157608
  let currentDelay = initialDelayMs;
157633
- let consecutive429Count = 0;
157634
157609
  while (attempt < maxAttempts) {
157635
157610
  attempt++;
157636
157611
  try {
@@ -157650,26 +157625,16 @@ async function retryWithBackoff(fn, options2) {
157650
157625
  `Qwen API quota exceeded: Your Qwen API quota has been exhausted. Please wait for your quota to reset.`
157651
157626
  );
157652
157627
  }
157653
- if (errorStatus === 429) {
157654
- if (authType === "qwen-oauth" /* QWEN_OAUTH */ && isQwenThrottlingError(error2)) {
157655
- consecutive429Count = 0;
157656
- } else {
157657
- consecutive429Count++;
157658
- }
157659
- } else {
157660
- consecutive429Count = 0;
157661
- }
157662
- console.debug("consecutive429Count", consecutive429Count);
157663
157628
  if (attempt >= maxAttempts || !shouldRetryOnError(error2)) {
157664
157629
  throw error2;
157665
157630
  }
157666
- const { delayDurationMs, errorStatus: delayErrorStatus } = getDelayDurationAndStatus(error2);
157667
- if (delayDurationMs > 0) {
157631
+ const retryAfterMs = errorStatus === 429 ? getRetryAfterDelayMs(error2) : 0;
157632
+ if (retryAfterMs > 0) {
157668
157633
  console.warn(
157669
- `Attempt ${attempt} failed with status ${delayErrorStatus ?? "unknown"}. Retrying after explicit delay of ${delayDurationMs}ms...`,
157634
+ `Attempt ${attempt} failed with status ${errorStatus ?? "unknown"}. Retrying after explicit delay of ${retryAfterMs}ms...`,
157670
157635
  error2
157671
157636
  );
157672
- await delay(delayDurationMs);
157637
+ await delay(retryAfterMs);
157673
157638
  currentDelay = initialDelayMs;
157674
157639
  } else {
157675
157640
  logRetryAttempt(attempt, error2, errorStatus);
@@ -157683,18 +157648,12 @@ async function retryWithBackoff(fn, options2) {
157683
157648
  throw new Error("Retry attempts exhausted");
157684
157649
  }
157685
157650
  function getErrorStatus(error2) {
157686
- if (typeof error2 === "object" && error2 !== null) {
157687
- if ("status" in error2 && typeof error2.status === "number") {
157688
- return error2.status;
157689
- }
157690
- if ("response" in error2 && typeof error2.response === "object" && error2.response !== null) {
157691
- const response = error2.response;
157692
- if ("status" in response && typeof response.status === "number") {
157693
- return response.status;
157694
- }
157695
- }
157651
+ if (typeof error2 !== "object" || error2 === null) {
157652
+ return void 0;
157696
157653
  }
157697
- return void 0;
157654
+ const err = error2;
157655
+ const value = err.status ?? err.statusCode ?? err.response?.status ?? err.error?.code;
157656
+ return typeof value === "number" && value >= 100 && value <= 599 ? value : void 0;
157698
157657
  }
157699
157658
  function getRetryAfterDelayMs(error2) {
157700
157659
  if (typeof error2 === "object" && error2 !== null) {
@@ -157718,37 +157677,12 @@ function getRetryAfterDelayMs(error2) {
157718
157677
  }
157719
157678
  return 0;
157720
157679
  }
157721
- function getDelayDurationAndStatus(error2) {
157722
- const errorStatus = getErrorStatus(error2);
157723
- let delayDurationMs = 0;
157724
- if (errorStatus === 429) {
157725
- delayDurationMs = getRetryAfterDelayMs(error2);
157726
- }
157727
- return { delayDurationMs, errorStatus };
157728
- }
157729
157680
  function logRetryAttempt(attempt, error2, errorStatus) {
157730
- let message = `Attempt ${attempt} failed. Retrying with backoff...`;
157731
- if (errorStatus) {
157732
- message = `Attempt ${attempt} failed with status ${errorStatus}. Retrying with backoff...`;
157733
- }
157681
+ const message = errorStatus ? `Attempt ${attempt} failed with status ${errorStatus}. Retrying with backoff...` : `Attempt ${attempt} failed. Retrying with backoff...`;
157734
157682
  if (errorStatus === 429) {
157735
157683
  console.warn(message, error2);
157736
157684
  } else if (errorStatus && errorStatus >= 500 && errorStatus < 600) {
157737
157685
  console.error(message, error2);
157738
- } else if (error2 instanceof Error) {
157739
- if (error2.message.includes("429")) {
157740
- console.warn(
157741
- `Attempt ${attempt} failed with 429 error (no Retry-After header). Retrying with backoff...`,
157742
- error2
157743
- );
157744
- } else if (error2.message.match(/5\d{2}/)) {
157745
- console.error(
157746
- `Attempt ${attempt} failed with 5xx error. Retrying with backoff...`,
157747
- error2
157748
- );
157749
- } else {
157750
- console.warn(message, error2);
157751
- }
157752
157686
  } else {
157753
157687
  console.warn(message, error2);
157754
157688
  }
@@ -157761,8 +157695,8 @@ var init_retry = __esm({
157761
157695
  init_contentGenerator();
157762
157696
  init_quotaErrorDetection();
157763
157697
  DEFAULT_RETRY_OPTIONS = {
157764
- maxAttempts: 5,
157765
- initialDelayMs: 5e3,
157698
+ maxAttempts: 7,
157699
+ initialDelayMs: 1500,
157766
157700
  maxDelayMs: 3e4,
157767
157701
  // 30 seconds
157768
157702
  shouldRetryOnError: defaultShouldRetry
@@ -157772,7 +157706,6 @@ var init_retry = __esm({
157772
157706
  __name(retryWithBackoff, "retryWithBackoff");
157773
157707
  __name(getErrorStatus, "getErrorStatus");
157774
157708
  __name(getRetryAfterDelayMs, "getRetryAfterDelayMs");
157775
- __name(getDelayDurationAndStatus, "getDelayDurationAndStatus");
157776
157709
  __name(logRetryAttempt, "logRetryAttempt");
157777
157710
  }
157778
157711
  });
@@ -157972,7 +157905,7 @@ var init_baseLlmClient = __esm({
157972
157905
  init_errors();
157973
157906
  init_retry();
157974
157907
  init_generateContentResponseUtilities();
157975
- DEFAULT_MAX_ATTEMPTS = 5;
157908
+ DEFAULT_MAX_ATTEMPTS = 7;
157976
157909
  BaseLlmClient = class {
157977
157910
  constructor(contentGenerator, config2) {
157978
157911
  this.contentGenerator = contentGenerator;
@@ -158488,44 +158421,6 @@ var init_chatRecordingService = __esm({
158488
158421
  }
158489
158422
  });
158490
158423
 
158491
- // packages/core/src/fallback/handler.ts
158492
- async function handleFallback(config2, failedModel, authType, error2) {
158493
- if (authType === "qwen-oauth" /* QWEN_OAUTH */) {
158494
- return handleQwenOAuthError(error2);
158495
- }
158496
- return null;
158497
- }
158498
- async function handleQwenOAuthError(error2) {
158499
- if (!error2) {
158500
- return null;
158501
- }
158502
- const errorMessage = error2 instanceof Error ? error2.message.toLowerCase() : String(error2).toLowerCase();
158503
- const errorCode = error2?.status || error2?.code;
158504
- const isAuthError = errorCode === 401 || errorCode === 403 || errorMessage.includes("unauthorized") || errorMessage.includes("forbidden") || errorMessage.includes("invalid api key") || errorMessage.includes("authentication") || errorMessage.includes("access denied") || errorMessage.includes("token") && errorMessage.includes("expired");
158505
- const isRateLimitError = errorCode === 429 || errorMessage.includes("429") || errorMessage.includes("rate limit") || errorMessage.includes("too many requests");
158506
- if (isAuthError) {
158507
- console.warn("Qwen OAuth authentication error detected:", errorMessage);
158508
- console.log(
158509
- "Note: If this persists, you may need to re-authenticate with Qwen OAuth"
158510
- );
158511
- return null;
158512
- }
158513
- if (isRateLimitError) {
158514
- console.warn("Qwen API rate limit encountered:", errorMessage);
158515
- return null;
158516
- }
158517
- return null;
158518
- }
158519
- var init_handler = __esm({
158520
- "packages/core/src/fallback/handler.ts"() {
158521
- "use strict";
158522
- init_esbuild_shims();
158523
- init_contentGenerator();
158524
- __name(handleFallback, "handleFallback");
158525
- __name(handleQwenOAuthError, "handleQwenOAuthError");
158526
- }
158527
- });
158528
-
158529
158424
  // packages/core/src/core/geminiChat.ts
158530
158425
  function isValidResponse2(response) {
158531
158426
  if (response.usageMetadata) {
@@ -158615,7 +158510,6 @@ var init_geminiChat = __esm({
158615
158510
  init_loggers();
158616
158511
  init_chatRecordingService();
158617
158512
  init_types();
158618
- init_handler();
158619
158513
  init_uiTelemetry();
158620
158514
  StreamEventType = /* @__PURE__ */ ((StreamEventType2) => {
158621
158515
  StreamEventType2["CHUNK"] = "chunk";
@@ -158775,18 +158669,18 @@ var init_geminiChat = __esm({
158775
158669
  },
158776
158670
  prompt_id
158777
158671
  ), "apiCall");
158778
- const onPersistent429Callback = /* @__PURE__ */ __name(async (authType, error2) => await handleFallback(this.config, model, authType, error2), "onPersistent429Callback");
158779
158672
  const streamResponse2 = await retryWithBackoff(apiCall, {
158780
158673
  shouldRetryOnError: /* @__PURE__ */ __name((error2) => {
158781
- if (error2 instanceof ApiError && error2.message) {
158782
- if (error2.status === 400) return false;
158674
+ if (error2 instanceof Error) {
158783
158675
  if (isSchemaDepthError(error2.message)) return false;
158784
- if (error2.status === 429) return true;
158785
- if (error2.status >= 500 && error2.status < 600) return true;
158676
+ if (isInvalidArgumentError(error2.message)) return false;
158786
158677
  }
158678
+ const status = getErrorStatus(error2);
158679
+ if (status === 400) return false;
158680
+ if (status === 429) return true;
158681
+ if (status && status >= 500 && status < 600) return true;
158787
158682
  return false;
158788
158683
  }, "shouldRetryOnError"),
158789
- onPersistent429: onPersistent429Callback,
158790
158684
  authType: this.config.getContentGeneratorConfig()?.authType
158791
158685
  });
158792
158686
  return this.processStreamResponse(model, streamResponse2);
@@ -173378,12 +173272,11 @@ function isShellCommandReadOnly(command2) {
173378
173272
  }
173379
173273
  const segments = splitCommands(command2);
173380
173274
  for (const segment of segments) {
173381
- const isAllowed = evaluateShellSegment(segment);
173382
- if (!isAllowed) {
173275
+ if (!evaluateShellSegment(segment)) {
173383
173276
  return false;
173384
173277
  }
173385
173278
  }
173386
- return true;
173279
+ return segments.length > 0;
173387
173280
  }
173388
173281
  var import_shell_quote, READ_ONLY_ROOT_COMMANDS, BLOCKED_FIND_FLAGS, BLOCKED_FIND_PREFIXES, READ_ONLY_GIT_SUBCOMMANDS, BLOCKED_GIT_REMOTE_ACTIONS, BLOCKED_GIT_BRANCH_FLAGS, BLOCKED_SED_PREFIXES, AWK_SIDE_EFFECT_PATTERNS, SED_SIDE_EFFECT_PATTERNS, ENV_ASSIGNMENT_REGEX;
173389
173282
  var init_shellReadOnlyChecker = __esm({
@@ -173584,6 +173477,13 @@ function splitCommands(command2) {
173584
173477
  } else if (char === ";" || char === "&" || char === "|") {
173585
173478
  commands.push(currentCommand.trim());
173586
173479
  currentCommand = "";
173480
+ } else if (char === "\r" && nextChar === "\n") {
173481
+ commands.push(currentCommand.trim());
173482
+ currentCommand = "";
173483
+ i3++;
173484
+ } else if (char === "\n") {
173485
+ commands.push(currentCommand.trim());
173486
+ currentCommand = "";
173587
173487
  } else {
173588
173488
  currentCommand += char;
173589
173489
  }
@@ -174452,6 +174352,7 @@ var init_coreToolScheduler = __esm({
174452
174352
  "use strict";
174453
174353
  init_esbuild_shims();
174454
174354
  init_src2();
174355
+ init_tool_names();
174455
174356
  init_generateContentResponseUtilities();
174456
174357
  init_modifiable_tool();
174457
174358
  init_lib();
@@ -174676,15 +174577,21 @@ var init_coreToolScheduler = __esm({
174676
174577
  }
174677
174578
  }
174678
174579
  /**
174679
- * Generates a suggestion string for a tool name that was not found in the registry.
174680
- * Uses Levenshtein distance to suggest similar tool names for hallucinated or misspelled tools.
174681
- * Note: Excluded tools are handled separately before calling this method, so this only
174682
- * handles the case where a tool is truly not found (hallucinated or typo).
174683
- * @param unknownToolName The tool name that was not found.
174684
- * @param topN The number of suggestions to return. Defaults to 3.
174685
- * @returns A suggestion string like " Did you mean 'tool'?" or " Did you mean one of: 'tool1', 'tool2'?",
174686
- * or an empty string if no suggestions are found.
174580
+ * Generates error message for unknown tool. Returns early with skill-specific
174581
+ * message if the name matches a skill, otherwise uses Levenshtein suggestions.
174687
174582
  */
174583
+ getToolNotFoundMessage(unknownToolName, topN = 3) {
174584
+ const skillTool = this.toolRegistry.getTool(ToolNames.SKILL);
174585
+ if (skillTool instanceof SkillTool) {
174586
+ const availableSkillNames = skillTool.getAvailableSkillNames();
174587
+ if (availableSkillNames.includes(unknownToolName)) {
174588
+ return `"${unknownToolName}" is a skill name, not a tool name. To use this skill, invoke the "${ToolNames.SKILL}" tool with parameter: skill: "${unknownToolName}"`;
174589
+ }
174590
+ }
174591
+ const suggestion = this.getToolSuggestion(unknownToolName, topN);
174592
+ return `Tool "${unknownToolName}" not found in registry. Tools must use the exact names that are registered.${suggestion}`;
174593
+ }
174594
+ /** Suggests similar tool names using Levenshtein distance. */
174688
174595
  getToolSuggestion(unknownToolName, topN = 3) {
174689
174596
  const allToolNames = this.toolRegistry.getAllToolNames();
174690
174597
  const matches = allToolNames.map((toolName) => ({
@@ -174765,8 +174672,7 @@ var init_coreToolScheduler = __esm({
174765
174672
  }
174766
174673
  const toolInstance = this.toolRegistry.getTool(reqInfo.name);
174767
174674
  if (!toolInstance) {
174768
- const suggestion = this.getToolSuggestion(reqInfo.name);
174769
- const errorMessage = `Tool "${reqInfo.name}" not found in registry. Tools must use the exact names that are registered.${suggestion}`;
174675
+ const errorMessage = this.getToolNotFoundMessage(reqInfo.name);
174770
174676
  return {
174771
174677
  status: "error",
174772
174678
  request: reqInfo,
@@ -175862,12 +175768,14 @@ var init_subagent = __esm({
175862
175768
  const hadFunctionCallsFromHelper = resp.functionCalls && resp.functionCalls.length > 0;
175863
175769
  for (const p2 of parts) {
175864
175770
  const txt = p2.text;
175865
- if (txt) roundText += txt;
175771
+ const isThought = p2.thought ?? false;
175772
+ if (txt && !isThought) roundText += txt;
175866
175773
  if (txt)
175867
175774
  this.eventEmitter?.emit("stream_text" /* STREAM_TEXT */, {
175868
175775
  subagentId: this.subagentId,
175869
175776
  round: turnCounter,
175870
175777
  text: txt,
175778
+ thought: isThought,
175871
175779
  timestamp: Date.now()
175872
175780
  });
175873
175781
  if (!hadFunctionCallsFromHelper) {
@@ -182242,7 +182150,6 @@ var init_client2 = __esm({
182242
182150
  init_retry();
182243
182151
  init_ideContext();
182244
182152
  init_types7();
182245
- init_handler();
182246
182153
  MAX_TURNS = 100;
182247
182154
  GeminiClient = class {
182248
182155
  constructor(config2) {
@@ -182661,12 +182568,7 @@ var init_client2 = __esm({
182661
182568
  this.lastPromptId
182662
182569
  );
182663
182570
  }, "apiCall");
182664
- const onPersistent429Callback = /* @__PURE__ */ __name(async (authType, error2) => (
182665
- // Pass the captured model to the centralized handler.
182666
- await handleFallback(this.config, currentAttemptModel, authType, error2)
182667
- ), "onPersistent429Callback");
182668
182571
  const result = await retryWithBackoff(apiCall, {
182669
- onPersistent429: onPersistent429Callback,
182670
182572
  authType: this.config.getContentGeneratorConfig()?.authType
182671
182573
  });
182672
182574
  return result;
@@ -223531,7 +223433,7 @@ function createFsWatchInstance(path129, options2, listener, errHandler, emitRaw)
223531
223433
  }
223532
223434
  }
223533
223435
  var STR_DATA, STR_END, STR_CLOSE, EMPTY_FN, pl, isWindows2, isMacos, isLinux, isFreeBSD, isIBMi, EVENTS, EV, THROTTLE_MODE_WATCH, statMethods, KEY_LISTENERS, KEY_ERR, KEY_RAW, HANDLER_KEYS, binaryExtensions, isBinaryPath, foreach, addAndConvert, clearItem, delFromSet, isEmptySet, FsWatchInstances, fsWatchBroadcast, setFsWatchListener, FsWatchFileInstances, setFsWatchFileListener, NodeFsHandler;
223534
- var init_handler2 = __esm({
223436
+ var init_handler = __esm({
223535
223437
  "node_modules/chokidar/esm/handler.js"() {
223536
223438
  init_esbuild_shims();
223537
223439
  STR_DATA = "data";
@@ -224353,7 +224255,7 @@ var init_esm21 = __esm({
224353
224255
  "node_modules/chokidar/esm/index.js"() {
224354
224256
  init_esbuild_shims();
224355
224257
  init_esm20();
224356
- init_handler2();
224258
+ init_handler();
224357
224259
  SLASH = "/";
224358
224260
  SLASH_SLASH = "//";
224359
224261
  ONE_DOT = ".";
@@ -234495,7 +234397,9 @@ var init_storage2 = __esm({
234495
234397
  return storage.getExtensionsDir();
234496
234398
  }
234497
234399
  static async createTmpDir() {
234498
- return await fs60.promises.mkdtemp(path62.join(os24.tmpdir(), "rdmind-extension"));
234400
+ return await fs60.promises.mkdtemp(
234401
+ path62.join(os24.tmpdir(), "rdmind-extension")
234402
+ );
234499
234403
  }
234500
234404
  };
234501
234405
  }
@@ -236969,22 +236873,24 @@ async function convertClaudePluginPackage(extensionDir, pluginName) {
236969
236873
  const tmpDir = await ExtensionStorage.createTmpDir();
236970
236874
  try {
236971
236875
  await copyDirectory(pluginSource, tmpDir);
236972
- if (mergedConfig.commands) {
236973
- const commandsDestDir = path64.join(tmpDir, "commands");
236974
- await collectResources(
236975
- mergedConfig.commands,
236976
- pluginSource,
236977
- commandsDestDir
236978
- );
236979
- }
236980
- if (mergedConfig.skills) {
236981
- const skillsDestDir = path64.join(tmpDir, "skills");
236982
- await collectResources(mergedConfig.skills, pluginSource, skillsDestDir);
236876
+ const resourceConfigs = [
236877
+ { name: "commands", config: mergedConfig.commands },
236878
+ { name: "skills", config: mergedConfig.skills },
236879
+ { name: "agents", config: mergedConfig.agents }
236880
+ ];
236881
+ for (const { name: name3, config: config2 } of resourceConfigs) {
236882
+ const folderPath = path64.join(tmpDir, name3);
236883
+ const sourceFolderPath = path64.join(pluginSource, name3);
236884
+ if (config2) {
236885
+ if (fs62.existsSync(folderPath)) {
236886
+ fs62.rmSync(folderPath, { recursive: true, force: true });
236887
+ }
236888
+ await collectResources(config2, pluginSource, folderPath);
236889
+ } else if (!fs62.existsSync(sourceFolderPath) && fs62.existsSync(folderPath)) {
236890
+ fs62.rmSync(folderPath, { recursive: true, force: true });
236891
+ }
236983
236892
  }
236984
236893
  const agentsDestDir = path64.join(tmpDir, "agents");
236985
- if (mergedConfig.agents) {
236986
- await collectResources(mergedConfig.agents, pluginSource, agentsDestDir);
236987
- }
236988
236894
  await convertAgentFiles(agentsDestDir);
236989
236895
  const qwenConfig = convertClaudeToQwenConfig(mergedConfig);
236990
236896
  const qwenConfigPath = path64.join(tmpDir, "rdmind-extension.json");
@@ -237027,6 +236933,7 @@ async function collectResources(resourcePaths, pluginRoot, destDir) {
237027
236933
  );
237028
236934
  continue;
237029
236935
  }
236936
+ const finalDestDir = path64.join(destDir, dirName);
237030
236937
  const files = await glob("**/*", {
237031
236938
  cwd: resolvedPath,
237032
236939
  nodir: true,
@@ -237034,7 +236941,7 @@ async function collectResources(resourcePaths, pluginRoot, destDir) {
237034
236941
  });
237035
236942
  for (const file of files) {
237036
236943
  const srcFile = path64.join(resolvedPath, file);
237037
- const destFile = path64.join(destDir, file);
236944
+ const destFile = path64.join(finalDestDir, file);
237038
236945
  const destFileDir = path64.dirname(destFile);
237039
236946
  if (!fs62.existsSync(destFileDir)) {
237040
236947
  fs62.mkdirSync(destFileDir, { recursive: true });
@@ -247499,7 +247406,7 @@ var init_config3 = __esm({
247499
247406
  contentGeneratorConfigSources = {};
247500
247407
  contentGenerator;
247501
247408
  embeddingModel;
247502
- _modelsConfig;
247409
+ modelsConfig;
247503
247410
  modelProvidersConfig;
247504
247411
  sandbox;
247505
247412
  targetDir;
@@ -247683,7 +247590,7 @@ var init_config3 = __esm({
247683
247590
  if (params.contextFileName) {
247684
247591
  setGeminiMdFilename(params.contextFileName);
247685
247592
  }
247686
- this._modelsConfig = new ModelsConfig({
247593
+ this.modelsConfig = new ModelsConfig({
247687
247594
  initialAuthType: params.authType ?? params.generationConfig?.authType,
247688
247595
  modelProvidersConfig: this.modelProvidersConfig,
247689
247596
  generationConfig: {
@@ -247760,8 +247667,8 @@ var init_config3 = __esm({
247760
247667
  * Get the ModelsConfig instance for model-related operations.
247761
247668
  * External code (e.g., CLI) can use this to access model configuration.
247762
247669
  */
247763
- get modelsConfig() {
247764
- return this._modelsConfig;
247670
+ getModelsConfig() {
247671
+ return this.modelsConfig;
247765
247672
  }
247766
247673
  /**
247767
247674
  * Updates the credentials in the generation config.
@@ -247769,22 +247676,22 @@ var init_config3 = __esm({
247769
247676
  * Delegates to ModelsConfig.
247770
247677
  */
247771
247678
  updateCredentials(credentials, settingsGenerationConfig) {
247772
- this._modelsConfig.updateCredentials(credentials, settingsGenerationConfig);
247679
+ this.modelsConfig.updateCredentials(credentials, settingsGenerationConfig);
247773
247680
  }
247774
247681
  /**
247775
247682
  * Refresh authentication and rebuild ContentGenerator.
247776
247683
  */
247777
247684
  async refreshAuth(authMethod, isInitialAuth) {
247778
- const modelId = this._modelsConfig.getModel();
247779
- this._modelsConfig.syncAfterAuthRefresh(authMethod, modelId);
247780
- const requireCached = this._modelsConfig.consumeRequireCachedCredentialsFlag();
247685
+ const modelId = this.modelsConfig.getModel();
247686
+ this.modelsConfig.syncAfterAuthRefresh(authMethod, modelId);
247687
+ const requireCached = this.modelsConfig.consumeRequireCachedCredentialsFlag();
247781
247688
  const { config: config2, sources } = resolveContentGeneratorConfigWithSources(
247782
247689
  this,
247783
247690
  authMethod,
247784
- this._modelsConfig.getGenerationConfig(),
247785
- this._modelsConfig.getGenerationConfigSources(),
247691
+ this.modelsConfig.getGenerationConfig(),
247692
+ this.modelsConfig.getGenerationConfigSources(),
247786
247693
  {
247787
- strictModelProvider: this._modelsConfig.isStrictModelProviderSelection()
247694
+ strictModelProvider: this.modelsConfig.isStrictModelProviderSelection()
247788
247695
  }
247789
247696
  );
247790
247697
  const newContentGeneratorConfig = config2;
@@ -247852,20 +247759,20 @@ var init_config3 = __esm({
247852
247759
  return this.contentGeneratorConfig;
247853
247760
  }
247854
247761
  getContentGeneratorConfigSources() {
247855
- if (Object.keys(this.contentGeneratorConfigSources).length === 0 && this._modelsConfig) {
247856
- return this._modelsConfig.getGenerationConfigSources();
247762
+ if (Object.keys(this.contentGeneratorConfigSources).length === 0 && this.modelsConfig) {
247763
+ return this.modelsConfig.getGenerationConfigSources();
247857
247764
  }
247858
247765
  return this.contentGeneratorConfigSources;
247859
247766
  }
247860
247767
  getModel() {
247861
- return this.contentGeneratorConfig?.model || this._modelsConfig.getModel();
247768
+ return this.contentGeneratorConfig?.model || this.modelsConfig.getModel();
247862
247769
  }
247863
247770
  /**
247864
247771
  * Set model programmatically (e.g., VLM auto-switch, fallback).
247865
247772
  * Delegates to ModelsConfig.
247866
247773
  */
247867
247774
  async setModel(newModel, metadata) {
247868
- await this._modelsConfig.setModel(newModel, metadata);
247775
+ await this.modelsConfig.setModel(newModel, metadata);
247869
247776
  if (this.contentGeneratorConfig) {
247870
247777
  this.contentGeneratorConfig.model = newModel;
247871
247778
  }
@@ -247882,10 +247789,10 @@ var init_config3 = __esm({
247882
247789
  const { config: config2, sources } = resolveContentGeneratorConfigWithSources(
247883
247790
  this,
247884
247791
  authType,
247885
- this._modelsConfig.getGenerationConfig(),
247886
- this._modelsConfig.getGenerationConfigSources(),
247792
+ this.modelsConfig.getGenerationConfig(),
247793
+ this.modelsConfig.getGenerationConfigSources(),
247887
247794
  {
247888
- strictModelProvider: this._modelsConfig.isStrictModelProviderSelection()
247795
+ strictModelProvider: this.modelsConfig.isStrictModelProviderSelection()
247889
247796
  }
247890
247797
  );
247891
247798
  this.contentGeneratorConfig.model = config2.model;
@@ -247909,14 +247816,14 @@ var init_config3 = __esm({
247909
247816
  * Delegates to ModelsConfig.
247910
247817
  */
247911
247818
  getAvailableModels() {
247912
- return this._modelsConfig.getAvailableModels();
247819
+ return this.modelsConfig.getAvailableModels();
247913
247820
  }
247914
247821
  /**
247915
247822
  * Get available models for a specific authType.
247916
247823
  * Delegates to ModelsConfig.
247917
247824
  */
247918
247825
  getAvailableModelsForAuthType(authType) {
247919
- return this._modelsConfig.getAvailableModelsForAuthType(authType);
247826
+ return this.modelsConfig.getAvailableModelsForAuthType(authType);
247920
247827
  }
247921
247828
  /**
247922
247829
  * Switch authType+model via registry-backed selection.
@@ -247929,7 +247836,7 @@ var init_config3 = __esm({
247929
247836
  * @param metadata - Metadata for logging/tracking
247930
247837
  */
247931
247838
  async switchModel(authType, modelId, options2, metadata) {
247932
- await this._modelsConfig.switchModel(authType, modelId, options2, metadata);
247839
+ await this.modelsConfig.switchModel(authType, modelId, options2, metadata);
247933
247840
  }
247934
247841
  getMaxSessionTurns() {
247935
247842
  return this.maxSessionTurns;
@@ -254773,8 +254680,8 @@ var init_git_commit = __esm({
254773
254680
  "packages/core/src/generated/git-commit.ts"() {
254774
254681
  "use strict";
254775
254682
  init_esbuild_shims();
254776
- GIT_COMMIT_INFO = "74657a390";
254777
- CLI_VERSION = "0.2.2-alpha.5";
254683
+ GIT_COMMIT_INFO = "2ca4ee323";
254684
+ CLI_VERSION = "0.2.2";
254778
254685
  }
254779
254686
  });
254780
254687
 
@@ -255988,7 +255895,6 @@ __export(core_exports5, {
255988
255895
  isPrivateIp: () => isPrivateIp,
255989
255896
  isProQuotaExceededError: () => isProQuotaExceededError,
255990
255897
  isQwenQuotaExceededError: () => isQwenQuotaExceededError,
255991
- isQwenThrottlingError: () => isQwenThrottlingError,
255992
255898
  isSchemaDepthError: () => isSchemaDepthError,
255993
255899
  isSdkMcpServerConfig: () => isSdkMcpServerConfig,
255994
255900
  isStructuredError: () => isStructuredError,
@@ -304353,7 +304259,7 @@ var init_en3 = __esm({
304353
304259
  // ============================================================================
304354
304260
  // System Information Fields
304355
304261
  // ============================================================================
304356
- "RDMind": "RDMind",
304262
+ RDMind: "RDMind",
304357
304263
  Runtime: "Runtime",
304358
304264
  OS: "OS",
304359
304265
  Auth: "Auth",
@@ -305113,6 +305019,7 @@ var init_en3 = __esm({
305113
305019
  "RDMind now supports custom commands, sub-agents, skills and other features. Check the documentation for usage help.": "RDMind now supports custom commands, sub-agents, skills and other features. Check the documentation for usage help.",
305114
305020
  "Try asking RDMind to help you commit code.": "Try asking RDMind to help you commit code.",
305115
305021
  "RDMind can read REDoc. Please do not upload documents involving user privacy and core algorithms.": "RDMind can read REDoc. Please do not upload documents involving user privacy and core algorithms.",
305022
+ "If you find RDMind useful, feel free to recommend it to your colleagues~": "If you find RDMind useful, feel free to recommend it to your colleagues~",
305116
305023
  // ============================================================================
305117
305024
  // Exit Screen / Stats
305118
305025
  // ============================================================================
@@ -307148,7 +307055,7 @@ var init_zh = __esm({
307148
307055
  // ============================================================================
307149
307056
  // System Information Fields
307150
307057
  // ============================================================================
307151
- "RDMind": "RDMind",
307058
+ RDMind: "RDMind",
307152
307059
  Runtime: "\u8FD0\u884C\u73AF\u5883",
307153
307060
  OS: "\u64CD\u4F5C\u7CFB\u7EDF",
307154
307061
  Auth: "\u8BA4\u8BC1",
@@ -307908,6 +307815,7 @@ var init_zh = __esm({
307908
307815
  "RDMind now supports custom commands, sub-agents, skills and other features. Check the documentation for usage help.": "RDMind \u73B0\u5DF2\u652F\u6301\u81EA\u5B9A\u4E49\u547D\u4EE4\u3001\u5B50\u4EE3\u7406\u3001\u6280\u80FD\u7B49\u7279\u6027\uFF0C\u67E5\u9605\u6587\u6863\u83B7\u5F97\u4F7F\u7528\u5E2E\u52A9\u3002",
307909
307816
  "Try asking RDMind to help you commit code.": "\u8BD5\u8BD5\u8BA9 RDMind \u5E2E\u4F60\u63D0\u4EA4\u4EE3\u7801\u3002",
307910
307817
  "RDMind can read REDoc. Please do not upload documents involving user privacy and core algorithms.": "RDMind \u53EF\u4EE5\u8BFB\u61C2 REDoc\uFF0C\u6CE8\u610F\u4E0D\u8981\u4E0A\u4F20\u6D89\u53CA\u7528\u6237\u9690\u79C1\u548C\u6838\u5FC3\u7B97\u6CD5\u7684\u6587\u6863\u3002",
307818
+ "If you find RDMind useful, feel free to recommend it to your colleagues~": "\u5982\u679C\u89C9\u5F97 RDMind \u597D\u7528\uFF0C\u6B22\u8FCE\u5411\u540C\u4E8B\u63A8\u8350~",
307911
307819
  // ============================================================================
307912
307820
  // Exit Screen / Stats
307913
307821
  // ============================================================================
@@ -350646,7 +350554,7 @@ function findModelConfig(modelProviders, authType, modelId) {
350646
350554
  __name(findModelConfig, "findModelConfig");
350647
350555
  function hasApiKeyForAuth(authType, settings, config2) {
350648
350556
  const modelProviders = settings.modelProviders;
350649
- const modelId = config2?.modelsConfig.getModel() ?? settings.model?.name;
350557
+ const modelId = config2?.getModelsConfig().getModel() ?? settings.model?.name;
350650
350558
  const modelConfig = findModelConfig(modelProviders, authType, modelId);
350651
350559
  if (modelConfig?.envKey) {
350652
350560
  const hasKey2 = !!process.env[modelConfig.envKey];
@@ -350735,7 +350643,7 @@ function validateAuthMethod(authMethod, config2) {
350735
350643
  return apiKeyError;
350736
350644
  }
350737
350645
  const modelProviders = settings.merged.modelProviders;
350738
- const modelId = config2?.modelsConfig.getModel() ?? settings.merged.model?.name;
350646
+ const modelId = config2?.getModelsConfig().getModel() ?? settings.merged.model?.name;
350739
350647
  const modelConfig = findModelConfig(modelProviders, authMethod, modelId);
350740
350648
  if (modelConfig && !modelConfig.baseUrl) {
350741
350649
  return t4(
@@ -357236,7 +357144,7 @@ __name(getPackageJson, "getPackageJson");
357236
357144
  // packages/cli/src/utils/version.ts
357237
357145
  async function getCliVersion() {
357238
357146
  const pkgJson = await getPackageJson();
357239
- return "0.2.2-alpha.5";
357147
+ return "0.2.2";
357240
357148
  }
357241
357149
  __name(getCliVersion, "getCliVersion");
357242
357150
 
@@ -364527,126 +364435,11 @@ function validateTheme(settings) {
364527
364435
  }
364528
364436
  __name(validateTheme, "validateTheme");
364529
364437
 
364530
- // packages/cli/src/utils/languageUtils.ts
364531
- init_esbuild_shims();
364532
- init_core5();
364533
- import * as fs83 from "node:fs";
364534
- import * as path91 from "node:path";
364535
- var LLM_OUTPUT_LANGUAGE_RULE_FILENAME = "output-language.md";
364536
- var LLM_OUTPUT_LANGUAGE_MARKER_PREFIX = "rdmind:llm-output-language:";
364537
- var OUTPUT_LANGUAGE_AUTO = "auto";
364538
- function isAutoLanguage(value) {
364539
- return !value || value.toLowerCase() === OUTPUT_LANGUAGE_AUTO;
364540
- }
364541
- __name(isAutoLanguage, "isAutoLanguage");
364542
- function normalizeOutputLanguage(language) {
364543
- const lowered = language.toLowerCase();
364544
- const fullName = getLanguageNameFromLocale(lowered);
364545
- if (fullName !== "English" || lowered === "en") {
364546
- return fullName;
364547
- }
364548
- return language;
364549
- }
364550
- __name(normalizeOutputLanguage, "normalizeOutputLanguage");
364551
- function resolveOutputLanguage(value) {
364552
- if (isAutoLanguage(value)) {
364553
- const detectedLocale = detectSystemLanguage();
364554
- return getLanguageNameFromLocale(detectedLocale);
364555
- }
364556
- return normalizeOutputLanguage(value);
364557
- }
364558
- __name(resolveOutputLanguage, "resolveOutputLanguage");
364559
- function getOutputLanguageFilePath() {
364560
- return path91.join(
364561
- Storage.getGlobalQwenDir(),
364562
- LLM_OUTPUT_LANGUAGE_RULE_FILENAME
364563
- );
364564
- }
364565
- __name(getOutputLanguageFilePath, "getOutputLanguageFilePath");
364566
- function sanitizeForMarker(language) {
364567
- return language.replace(/[\r\n]/g, " ").replace(/--!?>/g, "").replace(/--/g, "");
364568
- }
364569
- __name(sanitizeForMarker, "sanitizeForMarker");
364570
- function generateOutputLanguageFileContent(language) {
364571
- const safeLanguage = sanitizeForMarker(language);
364572
- return `# Output language preference: ${language}
364573
- <!-- ${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX} ${safeLanguage} -->
364574
-
364575
- ## Goal
364576
- Prefer responding in **${language}** for normal assistant messages and explanations.
364577
-
364578
- ## Keep technical artifacts unchanged
364579
- Do **not** translate or rewrite:
364580
- - Code blocks, CLI commands, file paths, stack traces, logs, JSON keys, identifiers
364581
- - Exact quoted text from the user (keep quotes verbatim)
364582
-
364583
- ## When a conflict exists
364584
- If higher-priority instructions (system/developer) require a different behavior, follow them.
364585
-
364586
- ## Tool / system outputs
364587
- Raw tool/system outputs may contain fixed-format English. Preserve them verbatim, and if needed, add a short **${language}** explanation below.
364588
- `;
364589
- }
364590
- __name(generateOutputLanguageFileContent, "generateOutputLanguageFileContent");
364591
- function parseOutputLanguageFromContent(content) {
364592
- const markerRegex = new RegExp(
364593
- String.raw`<!--\s*${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX}\s*(.*?)\s*-->`,
364594
- "i"
364595
- );
364596
- const markerMatch = content.match(markerRegex);
364597
- if (markerMatch?.[1]?.trim()) {
364598
- return markerMatch[1].trim();
364599
- }
364600
- const headingMatch = content.match(
364601
- /^#.*?CRITICAL:\s*(.*?)\s+Output Language Rule\b/im
364602
- );
364603
- if (headingMatch?.[1]?.trim()) {
364604
- return headingMatch[1].trim();
364605
- }
364606
- return null;
364607
- }
364608
- __name(parseOutputLanguageFromContent, "parseOutputLanguageFromContent");
364609
- function readOutputLanguageFromFile() {
364610
- const filePath = getOutputLanguageFilePath();
364611
- if (!fs83.existsSync(filePath)) {
364612
- return null;
364613
- }
364614
- try {
364615
- const content = fs83.readFileSync(filePath, "utf-8");
364616
- return parseOutputLanguageFromContent(content);
364617
- } catch {
364618
- return null;
364619
- }
364620
- }
364621
- __name(readOutputLanguageFromFile, "readOutputLanguageFromFile");
364622
- function writeOutputLanguageFile(language) {
364623
- const filePath = getOutputLanguageFilePath();
364624
- const content = generateOutputLanguageFileContent(language);
364625
- const dir = path91.dirname(filePath);
364626
- fs83.mkdirSync(dir, { recursive: true });
364627
- fs83.writeFileSync(filePath, content, "utf-8");
364628
- }
364629
- __name(writeOutputLanguageFile, "writeOutputLanguageFile");
364630
- function updateOutputLanguageFile(settingValue) {
364631
- const resolved = resolveOutputLanguage(settingValue);
364632
- writeOutputLanguageFile(resolved);
364633
- }
364634
- __name(updateOutputLanguageFile, "updateOutputLanguageFile");
364635
- function initializeLlmOutputLanguage(outputLanguage) {
364636
- const resolved = resolveOutputLanguage(outputLanguage);
364637
- const currentFileLanguage = readOutputLanguageFromFile();
364638
- if (currentFileLanguage !== resolved) {
364639
- writeOutputLanguageFile(resolved);
364640
- }
364641
- }
364642
- __name(initializeLlmOutputLanguage, "initializeLlmOutputLanguage");
364643
-
364644
364438
  // packages/cli/src/core/initializer.ts
364645
364439
  async function initializeApp(config2, settings) {
364646
364440
  const languageSetting = process.env["RDMind_LANG"] || settings.merged.general?.language || "auto";
364647
364441
  await initializeI18n(languageSetting);
364648
- initializeLlmOutputLanguage(settings.merged.general?.outputLanguage);
364649
- const authType = config2.modelsConfig.getCurrentAuthType();
364442
+ const authType = config2.getModelsConfig().getCurrentAuthType();
364650
364443
  const authError = await performInitialAuth(config2, authType);
364651
364444
  if (authError) {
364652
364445
  settings.setValue(
@@ -364656,7 +364449,7 @@ async function initializeApp(config2, settings) {
364656
364449
  );
364657
364450
  }
364658
364451
  const themeError = validateTheme(settings);
364659
- const shouldOpenAuthDialog = !config2.modelsConfig.wasAuthTypeExplicitlyProvided() || !!authError;
364452
+ const shouldOpenAuthDialog = !config2.getModelsConfig().wasAuthTypeExplicitlyProvided() || !!authError;
364660
364453
  if (config2.getIdeMode()) {
364661
364454
  const ideClient = await IdeClient.getInstance();
364662
364455
  await ideClient.connect();
@@ -365051,7 +364844,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
365051
364844
 
365052
364845
  // packages/cli/src/generated/git-commit.ts
365053
364846
  init_esbuild_shims();
365054
- var GIT_COMMIT_INFO2 = "74657a390";
364847
+ var GIT_COMMIT_INFO2 = "2ca4ee323";
365055
364848
 
365056
364849
  // packages/cli/src/utils/systemInfo.ts
365057
364850
  async function getNpmVersion() {
@@ -365692,11 +365485,11 @@ var copyCommand = {
365692
365485
 
365693
365486
  // packages/cli/src/ui/commands/createCommand.ts
365694
365487
  init_esbuild_shims();
365695
- import * as fs84 from "fs";
365696
- import * as path92 from "path";
365488
+ import * as fs83 from "fs";
365489
+ import * as path91 from "path";
365697
365490
  import { fileURLToPath as fileURLToPath14 } from "url";
365698
365491
  var __filename6 = fileURLToPath14(import.meta.url);
365699
- var __dirname9 = path92.dirname(__filename6);
365492
+ var __dirname9 = path91.dirname(__filename6);
365700
365493
  function validateProjectName(name3) {
365701
365494
  return /^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z]$/.test(name3);
365702
365495
  }
@@ -365710,20 +365503,20 @@ function getIdlExamplePath() {
365710
365503
  // 1. npm 发布:
365711
365504
  // __dirname 就是 node_modules/@rdmind/rdmind/
365712
365505
  // 模板在 node_modules/@rdmind/rdmind/templates/
365713
- path92.join(__dirname9, "templates", "idl-template/wiki/example"),
365506
+ path91.join(__dirname9, "templates", "idl-template/wiki/example"),
365714
365507
  // 2. 开发环境:相对于工作区根目录的idl-template
365715
- path92.join(
365508
+ path91.join(
365716
365509
  __dirname9,
365717
365510
  "..",
365718
365511
  "packages/cli/templates/idl-template/wiki/example"
365719
365512
  )
365720
365513
  ];
365721
365514
  for (const templatePath of possiblePaths) {
365722
- if (fs84.existsSync(templatePath)) {
365515
+ if (fs83.existsSync(templatePath)) {
365723
365516
  return templatePath;
365724
365517
  }
365725
365518
  }
365726
- return path92.join(process.cwd(), "idl-template");
365519
+ return path91.join(process.cwd(), "idl-template");
365727
365520
  }
365728
365521
  __name(getIdlExamplePath, "getIdlExamplePath");
365729
365522
  function getTemplatePath() {
@@ -365731,16 +365524,16 @@ function getTemplatePath() {
365731
365524
  // 1. npm 安装
365732
365525
  // __dirname 就是 node_modules/@rdmind/rdmind/
365733
365526
  // 模板在 node_modules/@rdmind/rdmind/template/
365734
- path92.join(__dirname9, "template"),
365527
+ path91.join(__dirname9, "template"),
365735
365528
  // 2. 开发环境:
365736
- path92.join(__dirname9, "..", "packages/cli/template")
365529
+ path91.join(__dirname9, "..", "packages/cli/template")
365737
365530
  ];
365738
365531
  for (const templatePath of possiblePaths) {
365739
- if (fs84.existsSync(templatePath)) {
365532
+ if (fs83.existsSync(templatePath)) {
365740
365533
  return templatePath;
365741
365534
  }
365742
365535
  }
365743
- return path92.join(process.cwd(), "sns-demo");
365536
+ return path91.join(process.cwd(), "sns-demo");
365744
365537
  }
365745
365538
  __name(getTemplatePath, "getTemplatePath");
365746
365539
  function replaceIdlProjectNames(content, oldName, newName) {
@@ -365795,18 +365588,18 @@ function replaceProjectNames(content, oldName, newName, businessModule) {
365795
365588
  }
365796
365589
  __name(replaceProjectNames, "replaceProjectNames");
365797
365590
  async function copyAndReplaceFile(srcFile, destFile, oldName, newName, businessModule, isIdlProject = false) {
365798
- const destDir = path92.dirname(destFile);
365799
- if (!fs84.existsSync(destDir)) {
365800
- fs84.mkdirSync(destDir, { recursive: true });
365591
+ const destDir = path91.dirname(destFile);
365592
+ if (!fs83.existsSync(destDir)) {
365593
+ fs83.mkdirSync(destDir, { recursive: true });
365801
365594
  }
365802
- const content = fs84.readFileSync(srcFile, "utf8");
365595
+ const content = fs83.readFileSync(srcFile, "utf8");
365803
365596
  let newContent;
365804
365597
  if (isIdlProject) {
365805
365598
  newContent = replaceIdlProjectNames(content, oldName, newName);
365806
365599
  } else {
365807
365600
  newContent = replaceProjectNames(content, oldName, newName, businessModule);
365808
365601
  }
365809
- fs84.writeFileSync(destFile, newContent, "utf8");
365602
+ fs83.writeFileSync(destFile, newContent, "utf8");
365810
365603
  }
365811
365604
  __name(copyAndReplaceFile, "copyAndReplaceFile");
365812
365605
  function shouldSkipItem(itemName) {
@@ -365844,12 +365637,12 @@ function shouldSkipItem(itemName) {
365844
365637
  }
365845
365638
  __name(shouldSkipItem, "shouldSkipItem");
365846
365639
  async function copyAndReplaceDir(srcDir, destDir, oldName, newName, businessModule, isIdlProject = false) {
365847
- if (!fs84.existsSync(destDir)) {
365848
- fs84.mkdirSync(destDir, { recursive: true });
365640
+ if (!fs83.existsSync(destDir)) {
365641
+ fs83.mkdirSync(destDir, { recursive: true });
365849
365642
  }
365850
- const items = fs84.readdirSync(srcDir);
365643
+ const items = fs83.readdirSync(srcDir);
365851
365644
  for (const item of items) {
365852
- const srcPath = path92.join(srcDir, item);
365645
+ const srcPath = path91.join(srcDir, item);
365853
365646
  if (shouldSkipItem(item)) {
365854
365647
  continue;
365855
365648
  }
@@ -365860,7 +365653,7 @@ async function copyAndReplaceDir(srcDir, destDir, oldName, newName, businessModu
365860
365653
  const pathParts = newName.split("-");
365861
365654
  const currentDestPath = destDir;
365862
365655
  for (let i3 = 0; i3 < pathParts.length; i3++) {
365863
- const partPath = path92.join(
365656
+ const partPath = path91.join(
365864
365657
  currentDestPath,
365865
365658
  ...pathParts.slice(0, i3 + 1)
365866
365659
  );
@@ -365874,8 +365667,8 @@ async function copyAndReplaceDir(srcDir, destDir, oldName, newName, businessModu
365874
365667
  isIdlProject
365875
365668
  );
365876
365669
  } else {
365877
- if (!fs84.existsSync(partPath)) {
365878
- fs84.mkdirSync(partPath, { recursive: true });
365670
+ if (!fs83.existsSync(partPath)) {
365671
+ fs83.mkdirSync(partPath, { recursive: true });
365879
365672
  }
365880
365673
  }
365881
365674
  }
@@ -365889,7 +365682,7 @@ async function copyAndReplaceDir(srcDir, destDir, oldName, newName, businessModu
365889
365682
  const pathParts = packageDirName.split("-");
365890
365683
  const currentDestPath = destDir;
365891
365684
  for (let i3 = 0; i3 < pathParts.length; i3++) {
365892
- const partPath = path92.join(
365685
+ const partPath = path91.join(
365893
365686
  currentDestPath,
365894
365687
  ...pathParts.slice(0, i3 + 1)
365895
365688
  );
@@ -365903,8 +365696,8 @@ async function copyAndReplaceDir(srcDir, destDir, oldName, newName, businessModu
365903
365696
  isIdlProject
365904
365697
  );
365905
365698
  } else {
365906
- if (!fs84.existsSync(partPath)) {
365907
- fs84.mkdirSync(partPath, { recursive: true });
365699
+ if (!fs83.existsSync(partPath)) {
365700
+ fs83.mkdirSync(partPath, { recursive: true });
365908
365701
  }
365909
365702
  }
365910
365703
  }
@@ -365920,8 +365713,8 @@ async function copyAndReplaceDir(srcDir, destDir, oldName, newName, businessModu
365920
365713
  destItemName = item.replace(/sns-demo/g, newName);
365921
365714
  }
365922
365715
  }
365923
- const destPath = path92.join(destDir, destItemName);
365924
- const stats = fs84.statSync(srcPath);
365716
+ const destPath = path91.join(destDir, destItemName);
365717
+ const stats = fs83.statSync(srcPath);
365925
365718
  if (stats.isDirectory()) {
365926
365719
  await copyAndReplaceDir(
365927
365720
  srcPath,
@@ -365946,7 +365739,7 @@ async function copyAndReplaceDir(srcDir, destDir, oldName, newName, businessModu
365946
365739
  __name(copyAndReplaceDir, "copyAndReplaceDir");
365947
365740
  async function createJavaProject(context2, projectName, businessModule) {
365948
365741
  const templatePath = getTemplatePath();
365949
- if (!fs84.existsSync(templatePath)) {
365742
+ if (!fs83.existsSync(templatePath)) {
365950
365743
  context2.ui.addItem(
365951
365744
  {
365952
365745
  type: "error" /* ERROR */,
@@ -365957,8 +365750,8 @@ async function createJavaProject(context2, projectName, businessModule) {
365957
365750
  );
365958
365751
  return;
365959
365752
  }
365960
- const targetPath = path92.join(process.cwd(), projectName);
365961
- if (fs84.existsSync(targetPath)) {
365753
+ const targetPath = path91.join(process.cwd(), projectName);
365754
+ if (fs83.existsSync(targetPath)) {
365962
365755
  context2.ui.addItem(
365963
365756
  {
365964
365757
  type: "error" /* ERROR */,
@@ -366007,9 +365800,9 @@ ${projectName}/
366007
365800
  Date.now()
366008
365801
  );
366009
365802
  } catch (error2) {
366010
- if (fs84.existsSync(targetPath)) {
365803
+ if (fs83.existsSync(targetPath)) {
366011
365804
  try {
366012
- fs84.rmSync(targetPath, { recursive: true, force: true });
365805
+ fs83.rmSync(targetPath, { recursive: true, force: true });
366013
365806
  } catch (cleanupError) {
366014
365807
  console.warn(
366015
365808
  "Warning: Could not clean up failed project creation:",
@@ -366095,7 +365888,7 @@ var javaFlsCommand = {
366095
365888
  };
366096
365889
  async function createIdlProject(context2, projectName) {
366097
365890
  const templatePath = getIdlExamplePath();
366098
- if (!fs84.existsSync(templatePath)) {
365891
+ if (!fs83.existsSync(templatePath)) {
366099
365892
  context2.ui.addItem(
366100
365893
  {
366101
365894
  type: "error" /* ERROR */,
@@ -366107,8 +365900,8 @@ async function createIdlProject(context2, projectName) {
366107
365900
  return;
366108
365901
  }
366109
365902
  const projectDirectoryName = projectName;
366110
- const targetPath = path92.join(process.cwd(), projectDirectoryName);
366111
- if (fs84.existsSync(targetPath)) {
365903
+ const targetPath = path91.join(process.cwd(), projectDirectoryName);
365904
+ if (fs83.existsSync(targetPath)) {
366112
365905
  context2.ui.addItem(
366113
365906
  {
366114
365907
  type: "error" /* ERROR */,
@@ -366183,9 +365976,9 @@ ${projectDirectoryName}/
366183
365976
  Date.now()
366184
365977
  );
366185
365978
  } catch (error2) {
366186
- if (fs84.existsSync(targetPath)) {
365979
+ if (fs83.existsSync(targetPath)) {
366187
365980
  try {
366188
- fs84.rmSync(targetPath, { recursive: true, force: true });
365981
+ fs83.rmSync(targetPath, { recursive: true, force: true });
366189
365982
  } catch (cleanupError) {
366190
365983
  console.warn(
366191
365984
  "Warning: Could not clean up failed project creation:",
@@ -366377,8 +366170,8 @@ var docsCommand = {
366377
366170
  init_esbuild_shims();
366378
366171
  init_core5();
366379
366172
  import * as os34 from "node:os";
366380
- import * as path93 from "node:path";
366381
- import * as fs85 from "node:fs/promises";
366173
+ import * as path92 from "node:path";
366174
+ import * as fs84 from "node:fs/promises";
366382
366175
  function expandHomeDir(p2) {
366383
366176
  if (!p2) {
366384
366177
  return "";
@@ -366389,7 +366182,7 @@ function expandHomeDir(p2) {
366389
366182
  } else if (p2 === "~" || p2.startsWith("~/")) {
366390
366183
  expandedPath = os34.homedir() + p2.substring(1);
366391
366184
  }
366392
- return path93.normalize(expandedPath);
366185
+ return path92.normalize(expandedPath);
366393
366186
  }
366394
366187
  __name(expandHomeDir, "expandHomeDir");
366395
366188
  var directoryCommand = {
@@ -366694,25 +366487,25 @@ async function resolveCompletionPaths(partialPath, baseDir) {
366694
366487
  resolvedPath = baseDir;
366695
366488
  displayPrefix = "";
366696
366489
  } else if (partialPath.startsWith("~")) {
366697
- resolvedPath = path93.join(os34.homedir(), partialPath.slice(1));
366490
+ resolvedPath = path92.join(os34.homedir(), partialPath.slice(1));
366698
366491
  } else {
366699
- resolvedPath = path93.isAbsolute(partialPath) ? path93.resolve(partialPath || "/") : path93.resolve(baseDir, partialPath || ".");
366492
+ resolvedPath = path92.isAbsolute(partialPath) ? path92.resolve(partialPath || "/") : path92.resolve(baseDir, partialPath || ".");
366700
366493
  }
366701
366494
  let targetDir = resolvedPath;
366702
366495
  let filterPrefix = "";
366703
366496
  if (partialPath && !partialPath.endsWith("/") && !/^\.\/?$/.test(partialPath)) {
366704
- targetDir = path93.dirname(resolvedPath);
366705
- filterPrefix = path93.basename(resolvedPath);
366497
+ targetDir = path92.dirname(resolvedPath);
366498
+ filterPrefix = path92.basename(resolvedPath);
366706
366499
  }
366707
- const entries = await fs85.readdir(targetDir, { withFileTypes: true });
366500
+ const entries = await fs84.readdir(targetDir, { withFileTypes: true });
366708
366501
  return entries.filter((entry) => entry.isDirectory()).filter((entry) => !filterPrefix || entry.name.startsWith(filterPrefix)).map((entry) => {
366709
366502
  let completionPath;
366710
366503
  if (partialPath.endsWith("/")) {
366711
- completionPath = path93.posix.join(displayPrefix, entry.name) + "/";
366504
+ completionPath = path92.posix.join(displayPrefix, entry.name) + "/";
366712
366505
  } else {
366713
- const prefixDir = displayPrefix.includes("/") ? path93.posix.dirname(displayPrefix) : "";
366506
+ const prefixDir = displayPrefix.includes("/") ? path92.posix.dirname(displayPrefix) : "";
366714
366507
  if (prefixDir && prefixDir !== ".") {
366715
- completionPath = path93.posix.join(prefixDir, entry.name) + "/";
366508
+ completionPath = path92.posix.join(prefixDir, entry.name) + "/";
366716
366509
  } else {
366717
366510
  completionPath = entry.name + "/";
366718
366511
  if (displayPrefix && displayPrefix !== "." && !displayPrefix.includes("/")) {
@@ -367342,7 +367135,7 @@ var helpCommand = {
367342
367135
  init_esbuild_shims();
367343
367136
  init_core5();
367344
367137
  init_core5();
367345
- import path94 from "node:path";
367138
+ import path93 from "node:path";
367346
367139
  init_settings();
367347
367140
  function getIdeStatusMessage(ideClient) {
367348
367141
  const connection = ideClient.getConnectionStatus();
@@ -367373,13 +367166,13 @@ __name(getIdeStatusMessage, "getIdeStatusMessage");
367373
367166
  function formatFileList(openFiles) {
367374
367167
  const basenameCounts = /* @__PURE__ */ new Map();
367375
367168
  for (const file of openFiles) {
367376
- const basename26 = path94.basename(file.path);
367169
+ const basename26 = path93.basename(file.path);
367377
367170
  basenameCounts.set(basename26, (basenameCounts.get(basename26) || 0) + 1);
367378
367171
  }
367379
367172
  const fileList = openFiles.map((file) => {
367380
- const basename26 = path94.basename(file.path);
367173
+ const basename26 = path93.basename(file.path);
367381
367174
  const isDuplicate = (basenameCounts.get(basename26) || 0) > 1;
367382
- const parentDir = path94.basename(path94.dirname(file.path));
367175
+ const parentDir = path93.basename(path93.dirname(file.path));
367383
367176
  const displayName = isDuplicate ? `${basename26} (/${parentDir})` : basename26;
367384
367177
  return ` - ${displayName}${file.isActive ? " (active)" : ""}`;
367385
367178
  }).join("\n");
@@ -368371,8 +368164,8 @@ var importCommand = {
368371
368164
  // packages/cli/src/ui/commands/initCommand.ts
368372
368165
  init_esbuild_shims();
368373
368166
  init_core5();
368374
- import * as fs86 from "node:fs";
368375
- import * as path95 from "node:path";
368167
+ import * as fs85 from "node:fs";
368168
+ import * as path94 from "node:path";
368376
368169
  var import_react27 = __toESM(require_react(), 1);
368377
368170
  var initCommand = {
368378
368171
  name: "init",
@@ -368390,11 +368183,11 @@ var initCommand = {
368390
368183
  }
368391
368184
  const targetDir = context2.services.config.getTargetDir();
368392
368185
  const contextFileName = getCurrentGeminiMdFilename();
368393
- const contextFilePath = path95.join(targetDir, contextFileName);
368186
+ const contextFilePath = path94.join(targetDir, contextFileName);
368394
368187
  try {
368395
- if (fs86.existsSync(contextFilePath)) {
368188
+ if (fs85.existsSync(contextFilePath)) {
368396
368189
  try {
368397
- const existing = fs86.readFileSync(contextFilePath, "utf8");
368190
+ const existing = fs85.readFileSync(contextFilePath, "utf8");
368398
368191
  if (existing && existing.trim().length > 0) {
368399
368192
  if (!context2.overwriteConfirmed) {
368400
368193
  return {
@@ -368416,7 +368209,7 @@ var initCommand = {
368416
368209
  }
368417
368210
  }
368418
368211
  try {
368419
- fs86.writeFileSync(contextFilePath, "", "utf8");
368212
+ fs85.writeFileSync(contextFilePath, "", "utf8");
368420
368213
  context2.ui.addItem(
368421
368214
  {
368422
368215
  type: "info",
@@ -368483,6 +368276,122 @@ Write the complete content to the \`${contextFileName}\` file. The output must b
368483
368276
  init_esbuild_shims();
368484
368277
  init_settings();
368485
368278
  init_languages();
368279
+
368280
+ // packages/cli/src/utils/languageUtils.ts
368281
+ init_esbuild_shims();
368282
+ init_core5();
368283
+ import * as fs86 from "node:fs";
368284
+ import * as path95 from "node:path";
368285
+ var LLM_OUTPUT_LANGUAGE_RULE_FILENAME = "output-language.md";
368286
+ var LLM_OUTPUT_LANGUAGE_MARKER_PREFIX = "rdmind:llm-output-language:";
368287
+ var OUTPUT_LANGUAGE_AUTO = "auto";
368288
+ function isAutoLanguage(value) {
368289
+ return !value || value.toLowerCase() === OUTPUT_LANGUAGE_AUTO;
368290
+ }
368291
+ __name(isAutoLanguage, "isAutoLanguage");
368292
+ function normalizeOutputLanguage(language) {
368293
+ const lowered = language.toLowerCase();
368294
+ const fullName = getLanguageNameFromLocale(lowered);
368295
+ if (fullName !== "English" || lowered === "en") {
368296
+ return fullName;
368297
+ }
368298
+ return language;
368299
+ }
368300
+ __name(normalizeOutputLanguage, "normalizeOutputLanguage");
368301
+ function resolveOutputLanguage(value) {
368302
+ if (isAutoLanguage(value)) {
368303
+ const detectedLocale = detectSystemLanguage();
368304
+ return getLanguageNameFromLocale(detectedLocale);
368305
+ }
368306
+ return normalizeOutputLanguage(value);
368307
+ }
368308
+ __name(resolveOutputLanguage, "resolveOutputLanguage");
368309
+ function getOutputLanguageFilePath() {
368310
+ return path95.join(
368311
+ Storage.getGlobalQwenDir(),
368312
+ LLM_OUTPUT_LANGUAGE_RULE_FILENAME
368313
+ );
368314
+ }
368315
+ __name(getOutputLanguageFilePath, "getOutputLanguageFilePath");
368316
+ function sanitizeForMarker(language) {
368317
+ return language.replace(/[\r\n]/g, " ").replace(/--!?>/g, "").replace(/--/g, "");
368318
+ }
368319
+ __name(sanitizeForMarker, "sanitizeForMarker");
368320
+ function generateOutputLanguageFileContent(language) {
368321
+ const safeLanguage = sanitizeForMarker(language);
368322
+ return `# Output language preference: ${language}
368323
+ <!-- ${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX} ${safeLanguage} -->
368324
+
368325
+ ## Goal
368326
+ Prefer responding in **${language}** for normal assistant messages and explanations.
368327
+
368328
+ ## Keep technical artifacts unchanged
368329
+ Do **not** translate or rewrite:
368330
+ - Code blocks, CLI commands, file paths, stack traces, logs, JSON keys, identifiers
368331
+ - Exact quoted text from the user (keep quotes verbatim)
368332
+
368333
+ ## When a conflict exists
368334
+ If higher-priority instructions (system/developer) require a different behavior, follow them.
368335
+
368336
+ ## Tool / system outputs
368337
+ Raw tool/system outputs may contain fixed-format English. Preserve them verbatim, and if needed, add a short **${language}** explanation below.
368338
+ `;
368339
+ }
368340
+ __name(generateOutputLanguageFileContent, "generateOutputLanguageFileContent");
368341
+ function parseOutputLanguageFromContent(content) {
368342
+ const markerRegex = new RegExp(
368343
+ String.raw`<!--\s*${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX}\s*(.*?)\s*-->`,
368344
+ "i"
368345
+ );
368346
+ const markerMatch = content.match(markerRegex);
368347
+ if (markerMatch?.[1]?.trim()) {
368348
+ return markerMatch[1].trim();
368349
+ }
368350
+ const headingMatch = content.match(
368351
+ /^#.*?CRITICAL:\s*(.*?)\s+Output Language Rule\b/im
368352
+ );
368353
+ if (headingMatch?.[1]?.trim()) {
368354
+ return headingMatch[1].trim();
368355
+ }
368356
+ return null;
368357
+ }
368358
+ __name(parseOutputLanguageFromContent, "parseOutputLanguageFromContent");
368359
+ function readOutputLanguageFromFile() {
368360
+ const filePath = getOutputLanguageFilePath();
368361
+ if (!fs86.existsSync(filePath)) {
368362
+ return null;
368363
+ }
368364
+ try {
368365
+ const content = fs86.readFileSync(filePath, "utf-8");
368366
+ return parseOutputLanguageFromContent(content);
368367
+ } catch {
368368
+ return null;
368369
+ }
368370
+ }
368371
+ __name(readOutputLanguageFromFile, "readOutputLanguageFromFile");
368372
+ function writeOutputLanguageFile(language) {
368373
+ const filePath = getOutputLanguageFilePath();
368374
+ const content = generateOutputLanguageFileContent(language);
368375
+ const dir = path95.dirname(filePath);
368376
+ fs86.mkdirSync(dir, { recursive: true });
368377
+ fs86.writeFileSync(filePath, content, "utf-8");
368378
+ }
368379
+ __name(writeOutputLanguageFile, "writeOutputLanguageFile");
368380
+ function updateOutputLanguageFile(settingValue) {
368381
+ const resolved = resolveOutputLanguage(settingValue);
368382
+ writeOutputLanguageFile(resolved);
368383
+ }
368384
+ __name(updateOutputLanguageFile, "updateOutputLanguageFile");
368385
+ function initializeLlmOutputLanguage(outputLanguage) {
368386
+ const resolved = resolveOutputLanguage(outputLanguage);
368387
+ const currentFileLanguage = readOutputLanguageFromFile();
368388
+ if (currentFileLanguage !== resolved) {
368389
+ writeOutputLanguageFile(resolved);
368390
+ }
368391
+ }
368392
+ __name(initializeLlmOutputLanguage, "initializeLlmOutputLanguage");
368393
+
368394
+ // packages/cli/src/ui/commands/languageCommand.ts
368486
368395
  function getCurrentOutputLanguage(context2) {
368487
368396
  const settingValue = context2?.services?.settings?.merged?.general?.outputLanguage || OUTPUT_LANGUAGE_AUTO;
368488
368397
  const resolved = resolveOutputLanguage(settingValue);
@@ -401486,7 +401395,8 @@ var startupTips = [
401486
401395
  "You can switch permission mode quickly with Shift+Tab or /approval-mode.",
401487
401396
  "RDMind now supports custom commands, sub-agents, skills and other features. Check the documentation for usage help.",
401488
401397
  "Try asking RDMind to help you commit code.",
401489
- "RDMind can read REDoc. Please do not upload documents involving user privacy and core algorithms."
401398
+ "RDMind can read REDoc. Please do not upload documents involving user privacy and core algorithms.",
401399
+ "If you find RDMind useful, feel free to recommend it to your colleagues~"
401490
401400
  ];
401491
401401
  var Tips = /* @__PURE__ */ __name(() => {
401492
401402
  const selectedTip = (0, import_react69.useMemo)(() => {
@@ -404764,6 +404674,13 @@ var XHS_SSO_MODELS = [
404764
404674
  baseUrl: "https://runway.devops.xiaohongshu.com/openai/zhipu/paas/v4/",
404765
404675
  contextWindow: "200K",
404766
404676
  description: "\u667A\u8C31\u6700\u65B0\u65D7\u8230\u6A21\u578B\uFF0C\u9762\u5411 Agentic Coding \u573A\u666F\u5F3A\u5316"
404677
+ },
404678
+ {
404679
+ id: "kimi-k2.5",
404680
+ displayName: "kimi-k2.5",
404681
+ baseUrl: "https://runway.devops.xiaohongshu.com/openai/moonshot/v1",
404682
+ contextWindow: "256K",
404683
+ description: "\u5728 Agent\u3001\u4EE3\u7801\u3001\u89C6\u89C9\u7406\u89E3\u53CA\u4E00\u7CFB\u5217\u901A\u7528\u667A\u80FD\u4EFB\u52A1\u4E0A\u53D6\u5F97\u5F00\u6E90 SoTA \u8868\u73B0"
404767
404684
  }
404768
404685
  ];
404769
404686
 
@@ -418112,7 +418029,9 @@ var WebSocketClient = class {
418112
418029
  type: "server_heart_pong"
418113
418030
  });
418114
418031
  if (this.ws && this.ws.readyState === wrapper_default.OPEN) {
418115
- console.log(`[ws-send:server_heart_pong] ${serverHeartPong}`);
418032
+ if (this.options.debug) {
418033
+ console.debug(`[ws-send:server_heart_pong] ${serverHeartPong}`);
418034
+ }
418116
418035
  this.ws.send(serverHeartPong);
418117
418036
  }
418118
418037
  } catch (err) {
@@ -418265,7 +418184,9 @@ var WebSocketClient = class {
418265
418184
  if (!this.ws || this.ws.readyState !== wrapper_default.OPEN) return;
418266
418185
  try {
418267
418186
  const heartbeatMsg = JSON.stringify({ type: "client_heart_ping" });
418268
- console.log(`[ws-send:client_heart_ping] ${heartbeatMsg}`);
418187
+ if (this.options.debug) {
418188
+ console.debug(`[ws-send:client_heart_ping] ${heartbeatMsg}`);
418189
+ }
418269
418190
  this.ws.send(heartbeatMsg);
418270
418191
  this.armHeartbeatTimeout();
418271
418192
  } catch (err) {
@@ -418795,7 +418716,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
418795
418716
  setAuthState("updating" /* Updating */);
418796
418717
  }, [onAuthError, cancelAuthentication, setAuthState]);
418797
418718
  (0, import_react135.useEffect)(() => {
418798
- const currentAuthType = config2.modelsConfig.getCurrentAuthType();
418719
+ const currentAuthType = config2.getModelsConfig().getCurrentAuthType();
418799
418720
  if (settings.merged.security?.auth?.enforcedType && currentAuthType && settings.merged.security?.auth.enforcedType !== currentAuthType) {
418800
418721
  onAuthError(
418801
418722
  t4(
@@ -420771,7 +420692,7 @@ init_core5();
420771
420692
  init_settings();
420772
420693
  async function validateNonInteractiveAuth(useExternalAuth, nonInteractiveConfig, settings) {
420773
420694
  try {
420774
- const authType = nonInteractiveConfig.modelsConfig.getCurrentAuthType();
420695
+ const authType = nonInteractiveConfig.getModelsConfig().getCurrentAuthType();
420775
420696
  if (!authType) {
420776
420697
  throw new Error(
420777
420698
  "No auth type is selected. Please configure an auth type (e.g. via settings or `--auth-type`) before running in non-interactive mode."
@@ -421118,7 +421039,9 @@ var usageSchema = external_exports.object({
421118
421039
  var sessionUpdateMetaSchema = external_exports.object({
421119
421040
  usage: usageSchema.optional().nullable(),
421120
421041
  durationMs: external_exports.number().optional().nullable(),
421121
- toolName: external_exports.string().optional().nullable()
421042
+ toolName: external_exports.string().optional().nullable(),
421043
+ parentToolCallId: external_exports.string().optional().nullable(),
421044
+ subagentType: external_exports.string().optional().nullable()
421122
421045
  });
421123
421046
  var requestPermissionResponseSchema = external_exports.object({
421124
421047
  outcome: requestPermissionOutcomeSchema
@@ -421804,7 +421727,7 @@ var MessageEmitter = class extends BaseEmitter {
421804
421727
  /**
421805
421728
  * Emits usage metadata.
421806
421729
  */
421807
- async emitUsageMetadata(usageMetadata, text = "", durationMs) {
421730
+ async emitUsageMetadata(usageMetadata, text = "", durationMs, subagentMeta) {
421808
421731
  const usage2 = {
421809
421732
  promptTokens: usageMetadata.promptTokenCount,
421810
421733
  completionTokens: usageMetadata.candidatesTokenCount,
@@ -421812,7 +421735,7 @@ var MessageEmitter = class extends BaseEmitter {
421812
421735
  totalTokens: usageMetadata.totalTokenCount,
421813
421736
  cachedTokens: usageMetadata.cachedContentTokenCount
421814
421737
  };
421815
- const meta = typeof durationMs === "number" ? { usage: usage2, durationMs } : { usage: usage2 };
421738
+ const meta = typeof durationMs === "number" ? { usage: usage2, durationMs, ...subagentMeta } : { usage: usage2, ...subagentMeta };
421816
421739
  await this.sendUpdate({
421817
421740
  sessionUpdate: "agent_message_chunk",
421818
421741
  content: { type: "text", text },
@@ -421939,7 +421862,10 @@ var ToolCallEmitter = class extends BaseEmitter {
421939
421862
  locations,
421940
421863
  kind: kind2,
421941
421864
  rawInput: params.args ?? {},
421942
- _meta: { toolName: params.toolName }
421865
+ _meta: {
421866
+ toolName: params.toolName,
421867
+ ...params.subagentMeta
421868
+ }
421943
421869
  });
421944
421870
  return true;
421945
421871
  }
@@ -421981,7 +421907,10 @@ var ToolCallEmitter = class extends BaseEmitter {
421981
421907
  toolCallId: params.callId,
421982
421908
  status: params.success ? "completed" : "failed",
421983
421909
  content: contentArray,
421984
- _meta: { toolName: params.toolName }
421910
+ _meta: {
421911
+ toolName: params.toolName,
421912
+ ...params.subagentMeta
421913
+ }
421985
421914
  };
421986
421915
  if (params.resultDisplay !== void 0) {
421987
421916
  update2["rawOutput"] = params.resultDisplay;
@@ -421993,9 +421922,11 @@ var ToolCallEmitter = class extends BaseEmitter {
421993
421922
  * Use this for explicit error handling when not using emitResult.
421994
421923
  *
421995
421924
  * @param callId - The tool call ID
421925
+ * @param toolName - The tool name
421996
421926
  * @param error - The error that occurred
421927
+ * @param subagentMeta - Optional subagent metadata
421997
421928
  */
421998
- async emitError(callId, toolName, error2) {
421929
+ async emitError(callId, toolName, error2, subagentMeta) {
421999
421930
  await this.sendUpdate({
422000
421931
  sessionUpdate: "tool_call_update",
422001
421932
  toolCallId: callId,
@@ -422003,7 +421934,10 @@ var ToolCallEmitter = class extends BaseEmitter {
422003
421934
  content: [
422004
421935
  { type: "content", content: { type: "text", text: error2.message } }
422005
421936
  ],
422006
- _meta: { toolName }
421937
+ _meta: {
421938
+ toolName,
421939
+ ...subagentMeta
421940
+ }
422007
421941
  });
422008
421942
  }
422009
421943
  // ==================== Public Utilities ====================
@@ -422281,9 +422215,11 @@ var basicPermissionOptions = [
422281
422215
  }
422282
422216
  ];
422283
422217
  var SubAgentTracker = class {
422284
- constructor(ctx, client) {
422218
+ constructor(ctx, client, parentToolCallId, subagentType) {
422285
422219
  this.ctx = ctx;
422286
422220
  this.client = client;
422221
+ this.parentToolCallId = parentToolCallId;
422222
+ this.subagentType = subagentType;
422287
422223
  this.toolCallEmitter = new ToolCallEmitter(ctx);
422288
422224
  this.messageEmitter = new MessageEmitter(ctx);
422289
422225
  }
@@ -422293,6 +422229,15 @@ var SubAgentTracker = class {
422293
422229
  toolCallEmitter;
422294
422230
  messageEmitter;
422295
422231
  toolStates = /* @__PURE__ */ new Map();
422232
+ /**
422233
+ * Gets the subagent metadata to attach to all events.
422234
+ */
422235
+ getSubagentMeta() {
422236
+ return {
422237
+ parentToolCallId: this.parentToolCallId,
422238
+ subagentType: this.subagentType
422239
+ };
422240
+ }
422296
422241
  /**
422297
422242
  * Sets up event listeners for a sub-agent's tool events.
422298
422243
  *
@@ -422305,16 +422250,19 @@ var SubAgentTracker = class {
422305
422250
  const onToolResult = this.createToolResultHandler(abortSignal);
422306
422251
  const onApproval = this.createApprovalHandler(abortSignal);
422307
422252
  const onUsageMetadata = this.createUsageMetadataHandler(abortSignal);
422253
+ const onStreamText = this.createStreamTextHandler(abortSignal);
422308
422254
  eventEmitter.on("tool_call" /* TOOL_CALL */, onToolCall);
422309
422255
  eventEmitter.on("tool_result" /* TOOL_RESULT */, onToolResult);
422310
422256
  eventEmitter.on("tool_waiting_approval" /* TOOL_WAITING_APPROVAL */, onApproval);
422311
422257
  eventEmitter.on("usage_metadata" /* USAGE_METADATA */, onUsageMetadata);
422258
+ eventEmitter.on("stream_text" /* STREAM_TEXT */, onStreamText);
422312
422259
  return [
422313
422260
  () => {
422314
422261
  eventEmitter.off("tool_call" /* TOOL_CALL */, onToolCall);
422315
422262
  eventEmitter.off("tool_result" /* TOOL_RESULT */, onToolResult);
422316
422263
  eventEmitter.off("tool_waiting_approval" /* TOOL_WAITING_APPROVAL */, onApproval);
422317
422264
  eventEmitter.off("usage_metadata" /* USAGE_METADATA */, onUsageMetadata);
422265
+ eventEmitter.off("stream_text" /* STREAM_TEXT */, onStreamText);
422318
422266
  this.toolStates.clear();
422319
422267
  }
422320
422268
  ];
@@ -422344,7 +422292,8 @@ var SubAgentTracker = class {
422344
422292
  void this.toolCallEmitter.emitStart({
422345
422293
  toolName: event.name,
422346
422294
  callId: event.callId,
422347
- args: event.args
422295
+ args: event.args,
422296
+ subagentMeta: this.getSubagentMeta()
422348
422297
  });
422349
422298
  };
422350
422299
  }
@@ -422362,7 +422311,8 @@ var SubAgentTracker = class {
422362
422311
  success: event.success,
422363
422312
  message: event.responseParts ?? [],
422364
422313
  resultDisplay: event.resultDisplay,
422365
- args: state?.args
422314
+ args: state?.args,
422315
+ subagentMeta: this.getSubagentMeta()
422366
422316
  });
422367
422317
  this.toolStates.delete(event.callId);
422368
422318
  };
@@ -422424,7 +422374,27 @@ var SubAgentTracker = class {
422424
422374
  return (...args) => {
422425
422375
  const event = args[0];
422426
422376
  if (abortSignal.aborted) return;
422427
- this.messageEmitter.emitUsageMetadata(event.usage, "", event.durationMs);
422377
+ this.messageEmitter.emitUsageMetadata(
422378
+ event.usage,
422379
+ "",
422380
+ event.durationMs,
422381
+ this.getSubagentMeta()
422382
+ );
422383
+ };
422384
+ }
422385
+ /**
422386
+ * Creates a handler for stream text events.
422387
+ * Emits agent message or thought chunks for text content from subagent model responses.
422388
+ */
422389
+ createStreamTextHandler(abortSignal) {
422390
+ return (...args) => {
422391
+ const event = args[0];
422392
+ if (abortSignal.aborted) return;
422393
+ void this.messageEmitter.emitMessage(
422394
+ event.text,
422395
+ "assistant",
422396
+ event.thought ?? false
422397
+ );
422428
422398
  };
422429
422399
  }
422430
422400
  /**
@@ -422782,7 +422752,14 @@ var Session3 = class {
422782
422752
  const invocation = tool.build(args);
422783
422753
  if (isTaskTool && "eventEmitter" in invocation) {
422784
422754
  const taskEventEmitter = invocation.eventEmitter;
422785
- const subAgentTracker = new SubAgentTracker(this, this.client);
422755
+ const parentToolCallId = callId;
422756
+ const subagentType = args["subagent_type"] ?? "";
422757
+ const subAgentTracker = new SubAgentTracker(
422758
+ this,
422759
+ this.client,
422760
+ parentToolCallId,
422761
+ subagentType
422762
+ );
422786
422763
  subAgentCleanupFunctions = subAgentTracker.setup(
422787
422764
  taskEventEmitter,
422788
422765
  abortSignal
@@ -423334,7 +423311,7 @@ var GeminiAgent = class {
423334
423311
  name: APPROVAL_MODE_INFO[mode].name,
423335
423312
  description: APPROVAL_MODE_INFO[mode].description
423336
423313
  }));
423337
- const version2 = "0.2.2-alpha.5";
423314
+ const version2 = "0.2.2";
423338
423315
  return {
423339
423316
  protocolVersion: PROTOCOL_VERSION,
423340
423317
  agentInfo: {
@@ -423493,7 +423470,7 @@ var GeminiAgent = class {
423493
423470
  return session.setModel(params);
423494
423471
  }
423495
423472
  async ensureAuthenticated(config2) {
423496
- const selectedType = this.settings.merged.security?.auth?.selectedType;
423473
+ const selectedType = config2.getModelsConfig().getCurrentAuthType();
423497
423474
  if (!selectedType) {
423498
423475
  throw RequestError.authRequired(
423499
423476
  "Use RDMind CLI to authenticate first."
@@ -423711,7 +423688,7 @@ async function main() {
423711
423688
  );
423712
423689
  if (!settings.merged.security?.auth?.useExternal) {
423713
423690
  try {
423714
- const authType = partialConfig.modelsConfig.getCurrentAuthType();
423691
+ const authType = partialConfig.getModelsConfig().getCurrentAuthType();
423715
423692
  if (authType) {
423716
423693
  const err = validateAuthMethod(authType, partialConfig);
423717
423694
  if (err) {
@@ -423762,6 +423739,7 @@ ${finalArgs[promptIndex + 1]}`;
423762
423739
  }
423763
423740
  argv = { ...argv, resume: selectedSessionId };
423764
423741
  }
423742
+ initializeLlmOutputLanguage(settings.merged.general?.outputLanguage);
423765
423743
  {
423766
423744
  const config2 = await loadCliConfig(
423767
423745
  settings.merged,