@rdmind/rdmind 0.0.28-alpha.6 → 0.0.28-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.js +53 -69
  2. package/package.json +2 -2
package/cli.js CHANGED
@@ -184663,7 +184663,7 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
184663
184663
  };
184664
184664
  }
184665
184665
  async function createContentGenerator(config, gcConfig, sessionId2, isInitialAuth) {
184666
- const version2 = "0.0.28-alpha.6";
184666
+ const version2 = "0.0.28-alpha.8";
184667
184667
  const userAgent2 = `QwenCode/${version2} (${process.platform}; ${process.arch})`;
184668
184668
  const baseHeaders = {
184669
184669
  "User-Agent": userAgent2
@@ -184727,12 +184727,7 @@ async function createContentGenerator(config, gcConfig, sessionId2, isInitialAut
184727
184727
  );
184728
184728
  }
184729
184729
  const { createOpenAIContentGenerator: createOpenAIContentGenerator2 } = await Promise.resolve().then(() => (init_openaiContentGenerator2(), openaiContentGenerator_exports));
184730
- const xhsConfig = {
184731
- ...config,
184732
- baseUrl: config.baseUrl || "https://maas.devops.xiaohongshu.com/snsexperienceai-q3coder480ba35b-inst/v1",
184733
- model: config.model || "Qwen3-Coder-480B-A35B-Instruct"
184734
- };
184735
- return createOpenAIContentGenerator2(xhsConfig, gcConfig);
184730
+ return createOpenAIContentGenerator2(config, gcConfig);
184736
184731
  }
184737
184732
  throw new Error(
184738
184733
  `Error creating contentGenerator: Unsupported authType: ${config.authType}`
@@ -259070,7 +259065,7 @@ var init_git_commit = __esm({
259070
259065
  "use strict";
259071
259066
  init_esbuild_shims();
259072
259067
  GIT_COMMIT_INFO = "8e1bdaa6";
259073
- CLI_VERSION = "0.0.28-alpha.6";
259068
+ CLI_VERSION = "0.0.28-alpha.8";
259074
259069
  }
259075
259070
  });
259076
259071
 
@@ -301866,28 +301861,13 @@ var require_ansi_align = __commonJS({
301866
301861
  }
301867
301862
  });
301868
301863
 
301869
- // packages/cli/src/utils/l4SensitiveRepositories.ts
301870
- var L4_SENSITIVE_REPOSITORIES;
301871
- var init_l4SensitiveRepositories = __esm({
301872
- "packages/cli/src/utils/l4SensitiveRepositories.ts"() {
301873
- "use strict";
301874
- init_esbuild_shims();
301875
- L4_SENSITIVE_REPOSITORIES = [
301876
- // 可以在这里添加敏感仓库地址
301877
- // 例如:
301878
- // 'git@code.devops.xiaohongshu.com:sns/rdmind.git',
301879
- // 'git@code.devops.xiaohongshu.com:aikit/rdmind.git',
301880
- ];
301881
- }
301882
- });
301883
-
301884
301864
  // packages/cli/src/utils/l4RepositoryAutoSwitch.ts
301885
301865
  var l4RepositoryAutoSwitch_exports = {};
301886
301866
  __export(l4RepositoryAutoSwitch_exports, {
301887
301867
  autoSwitchToQSModel: () => autoSwitchToQSModel,
301888
301868
  isL4Repository: () => isL4Repository
301889
301869
  });
301890
- function isL4Repository(workspaceRoot) {
301870
+ async function isL4Repository(workspaceRoot) {
301891
301871
  try {
301892
301872
  if (!isGitRepository(workspaceRoot)) {
301893
301873
  return false;
@@ -301896,14 +301876,12 @@ function isL4Repository(workspaceRoot) {
301896
301876
  if (!remoteUrl) {
301897
301877
  return false;
301898
301878
  }
301899
- const isMatch = L4_SENSITIVE_REPOSITORIES.some(
301900
- (repo) => remoteUrl.includes(repo) || repo.includes(remoteUrl)
301901
- );
301879
+ const isL4 = await checkRepositoryRiskLevel(remoteUrl);
301902
301880
  if (process.env["DEBUG"] || process.env["RDMIND_DEBUG"]) {
301903
301881
  console.debug("[L4Repository] Git remote URL:", remoteUrl);
301904
- console.debug("[L4Repository] Is L4 repository:", isMatch);
301882
+ console.debug("[L4Repository] Is L4 repository:", isL4);
301905
301883
  }
301906
- return isMatch;
301884
+ return isL4;
301907
301885
  } catch (error) {
301908
301886
  if (process.env["DEBUG"] || process.env["RDMIND_DEBUG"]) {
301909
301887
  console.debug("[L4Repository] Error checking repository:", error);
@@ -301911,29 +301889,44 @@ function isL4Repository(workspaceRoot) {
301911
301889
  return false;
301912
301890
  }
301913
301891
  }
301892
+ async function checkRepositoryRiskLevel(gitRepoUrl) {
301893
+ const apiUrl = "http://pallas-t12.devops.sl.beta.xiaohongshu.com/pallas/rdmind/cli/repo-risk-level";
301894
+ try {
301895
+ const response = await fetch(`${apiUrl}?gitRepoUrl=${encodeURIComponent(gitRepoUrl)}`, {
301896
+ method: "GET",
301897
+ headers: {
301898
+ "Content-Type": "application/json"
301899
+ }
301900
+ });
301901
+ if (!response.ok) {
301902
+ throw new Error(`HTTP error! status: ${response.status}`);
301903
+ }
301904
+ const data = await response.json();
301905
+ if (data.success && data.code === 0) {
301906
+ return data.data === "l4";
301907
+ } else {
301908
+ throw new Error(`API error: ${data.msg || "Unknown error"}`);
301909
+ }
301910
+ } catch (error) {
301911
+ if (process.env["DEBUG"] || process.env["RDMIND_DEBUG"]) {
301912
+ console.debug("[L4Repository] API call failed:", error);
301913
+ }
301914
+ throw error;
301915
+ }
301916
+ }
301914
301917
  async function autoSwitchToQSModel(config, settings) {
301915
301918
  const currentAuthType = settings.merged.security?.auth?.selectedType;
301916
301919
  const targetModel = "qwen3-coder-480b-a35b-instruct";
301917
301920
  const targetBaseUrl = "https://maas.devops.xiaohongshu.com/v1";
301918
301921
  if (currentAuthType === "xhs-sso" /* XHS_SSO */) {
301919
- const apiKey = settings.merged.security?.auth?.apiKey;
301920
- if (!apiKey) {
301921
- const { fetchModelKey: fetchModelKey2 } = await Promise.resolve().then(() => (init_core2(), core_exports2));
301922
- const newApiKey = await fetchModelKey2(targetModel, config.getDebugMode());
301923
- await applyXhsSsoConfig(config, settings, {
301924
- apiKey: newApiKey,
301925
- baseUrl: targetBaseUrl,
301926
- model: targetModel,
301927
- refresh: true
301928
- });
301929
- } else {
301930
- await applyXhsSsoConfig(config, settings, {
301931
- apiKey,
301932
- baseUrl: targetBaseUrl,
301933
- model: targetModel,
301934
- refresh: true
301935
- });
301936
- }
301922
+ const { fetchModelKey: fetchModelKey2 } = await Promise.resolve().then(() => (init_core2(), core_exports2));
301923
+ const newApiKey = await fetchModelKey2(targetModel, config.getDebugMode());
301924
+ await applyXhsSsoConfig(config, settings, {
301925
+ apiKey: newApiKey,
301926
+ baseUrl: targetBaseUrl,
301927
+ model: targetModel,
301928
+ refresh: true
301929
+ });
301937
301930
  } else {
301938
301931
  const { fetchModelKey: fetchModelKey2 } = await Promise.resolve().then(() => (init_core2(), core_exports2));
301939
301932
  const apiKey = await fetchModelKey2(targetModel, config.getDebugMode());
@@ -301951,8 +301944,8 @@ var init_l4RepositoryAutoSwitch = __esm({
301951
301944
  init_esbuild_shims();
301952
301945
  init_core2();
301953
301946
  init_xhsSsoConfig();
301954
- init_l4SensitiveRepositories();
301955
301947
  __name(isL4Repository, "isL4Repository");
301948
+ __name(checkRepositoryRiskLevel, "checkRepositoryRiskLevel");
301956
301949
  __name(autoSwitchToQSModel, "autoSwitchToQSModel");
301957
301950
  }
301958
301951
  });
@@ -347367,7 +347360,7 @@ __name(getPackageJson, "getPackageJson");
347367
347360
  // packages/cli/src/utils/version.ts
347368
347361
  async function getCliVersion() {
347369
347362
  const pkgJson = await getPackageJson();
347370
- return "0.0.28-alpha.6";
347363
+ return "0.0.28-alpha.8";
347371
347364
  }
347372
347365
  __name(getCliVersion, "getCliVersion");
347373
347366
 
@@ -366243,7 +366236,7 @@ __name(getStartupWarnings, "getStartupWarnings");
366243
366236
  // packages/cli/src/utils/userStartupWarnings.ts
366244
366237
  init_esbuild_shims();
366245
366238
  init_core2();
366246
- init_l4SensitiveRepositories();
366239
+ init_l4RepositoryAutoSwitch();
366247
366240
  import fs102 from "node:fs/promises";
366248
366241
  import * as os47 from "node:os";
366249
366242
  import path114 from "node:path";
@@ -366300,16 +366293,7 @@ var l4RepositoryCheck = {
366300
366293
  id: "l4-repository",
366301
366294
  check: /* @__PURE__ */ __name(async (options2) => {
366302
366295
  try {
366303
- if (!isGitRepository(options2.workspaceRoot)) {
366304
- return null;
366305
- }
366306
- const remoteUrl = getGitRemoteUrl(options2.workspaceRoot);
366307
- if (!remoteUrl) {
366308
- return null;
366309
- }
366310
- const isL4Repo = L4_SENSITIVE_REPOSITORIES.some(
366311
- (repo) => remoteUrl.includes(repo) || repo.includes(remoteUrl)
366312
- );
366296
+ const isL4Repo = await isL4Repository(options2.workspaceRoot);
366313
366297
  if (isL4Repo) {
366314
366298
  return "L4\u7B49\u7EA7\u4ED3\u5E93\uFF0C\u4E3A\u60A8\u5207\u6362\u5230QS\u5E73\u53F0\u6A21\u578B";
366315
366299
  }
@@ -368631,9 +368615,9 @@ ${finalArgs[promptIndex + 1]}`;
368631
368615
  })
368632
368616
  ];
368633
368617
  const { isL4Repository: isL4Repository2, autoSwitchToQSModel: autoSwitchToQSModel2 } = await Promise.resolve().then(() => (init_l4RepositoryAutoSwitch(), l4RepositoryAutoSwitch_exports));
368634
- const isL4Repo = isL4Repository2(process.cwd());
368635
- if (isL4Repo) {
368636
- try {
368618
+ try {
368619
+ const isL4Repo = await isL4Repository2(process.cwd());
368620
+ if (isL4Repo) {
368637
368621
  if (config.getDebugMode()) {
368638
368622
  console.debug(
368639
368623
  "[L4Repository] \u68C0\u6D4B\u5230 L4 \u4ED3\u5E93\uFF0C\u5F00\u59CB\u81EA\u52A8\u5207\u6362\u5230 QS \u5E73\u53F0\u6A21\u578B"
@@ -368643,12 +368627,12 @@ ${finalArgs[promptIndex + 1]}`;
368643
368627
  if (config.getDebugMode()) {
368644
368628
  console.debug("[L4Repository] \u6210\u529F\u5207\u6362\u5230 QS \u5E73\u53F0\u6A21\u578B");
368645
368629
  }
368646
- } catch (error) {
368647
- const errorMsg = `L4\u7B49\u7EA7\u4ED3\u5E93\u68C0\u6D4B\u6210\u529F\uFF0C\u4F46\u5207\u6362\u5230QS\u5E73\u53F0\u6A21\u578B\u5931\u8D25: ${error instanceof Error ? error.message : String(error)}`;
368648
- startupWarnings.push(errorMsg);
368649
- if (config.getDebugMode()) {
368650
- console.error("[L4Repository]", errorMsg, error);
368651
- }
368630
+ }
368631
+ } catch (error) {
368632
+ const errorMsg = `L4\u4ED3\u5E93\u68C0\u6D4B\u6216\u5207\u6362\u5931\u8D25: ${error instanceof Error ? error.message : String(error)}`;
368633
+ startupWarnings.push(errorMsg);
368634
+ if (config.getDebugMode()) {
368635
+ console.error("[L4Repository]", errorMsg, error);
368652
368636
  }
368653
368637
  }
368654
368638
  const { logSessionStart: logSessionStart2 } = await Promise.resolve().then(() => (init_core2(), core_exports2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rdmind/rdmind",
3
- "version": "0.0.28-alpha.6",
3
+ "version": "0.0.28-alpha.8",
4
4
  "description": "RDMind - AI-powered coding assistant",
5
5
  "type": "module",
6
6
  "main": "cli.js",
@@ -19,7 +19,7 @@
19
19
  "LICENSE"
20
20
  ],
21
21
  "config": {
22
- "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.28-alpha.6"
22
+ "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.28-alpha.8"
23
23
  },
24
24
  "publishConfig": {
25
25
  "access": "public"