@rdmind/rdmind 0.2.8-alpha.1 → 0.2.8-alpha.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.
Files changed (2) hide show
  1. package/cli.js +159 -16
  2. package/package.json +2 -2
package/cli.js CHANGED
@@ -147834,6 +147834,7 @@ var init_vertexAnthropicContentGenerator = __esm({
147834
147834
  "use strict";
147835
147835
  init_esbuild_shims();
147836
147836
  init_node();
147837
+ init_modalityDefaults();
147837
147838
  init_errorHandler();
147838
147839
  init_loggers();
147839
147840
  init_types();
@@ -147907,6 +147908,7 @@ var init_vertexAnthropicContentGenerator = __esm({
147907
147908
  apiKey;
147908
147909
  samplingParams;
147909
147910
  reasoning;
147911
+ modalities;
147910
147912
  cliConfig;
147911
147913
  telemetryService;
147912
147914
  errorHandler;
@@ -147915,6 +147917,7 @@ var init_vertexAnthropicContentGenerator = __esm({
147915
147917
  this.apiKey = config2.apiKey || "";
147916
147918
  this.samplingParams = config2.samplingParams;
147917
147919
  this.reasoning = config2.reasoning;
147920
+ this.modalities = config2.modalities ?? defaultModalities(config2.model);
147918
147921
  this.cliConfig = cliConfig;
147919
147922
  if (!this.apiKey) {
147920
147923
  throw new Error("API key is required for Vertex Anthropic");
@@ -148093,7 +148096,14 @@ var init_vertexAnthropicContentGenerator = __esm({
148093
148096
  }
148094
148097
  if (part.inlineData?.mimeType && part.inlineData?.data) {
148095
148098
  const mimeType = part.inlineData.mimeType;
148099
+ const displayName = part.inlineData.displayName || mimeType;
148096
148100
  if (this.isSupportedImageMimeType(mimeType)) {
148101
+ if (!this.modalities.image) {
148102
+ return {
148103
+ type: "text",
148104
+ text: this.unsupportedModalityHint("image", displayName)
148105
+ };
148106
+ }
148097
148107
  return {
148098
148108
  type: "image",
148099
148109
  source: {
@@ -148104,6 +148114,12 @@ var init_vertexAnthropicContentGenerator = __esm({
148104
148114
  };
148105
148115
  }
148106
148116
  if (mimeType === "application/pdf") {
148117
+ if (!this.modalities.pdf) {
148118
+ return {
148119
+ type: "text",
148120
+ text: this.unsupportedModalityHint("pdf", displayName)
148121
+ };
148122
+ }
148107
148123
  return {
148108
148124
  type: "document",
148109
148125
  source: {
@@ -148113,13 +148129,54 @@ var init_vertexAnthropicContentGenerator = __esm({
148113
148129
  }
148114
148130
  };
148115
148131
  }
148116
- const displayName = part.inlineData.displayName ? ` (${part.inlineData.displayName})` : "";
148132
+ if (mimeType.startsWith("audio/")) {
148133
+ if (!this.modalities.audio) {
148134
+ return {
148135
+ type: "text",
148136
+ text: this.unsupportedModalityHint("audio", displayName)
148137
+ };
148138
+ }
148139
+ }
148140
+ if (mimeType.startsWith("video/")) {
148141
+ if (!this.modalities.video) {
148142
+ return {
148143
+ type: "text",
148144
+ text: this.unsupportedModalityHint("video", displayName)
148145
+ };
148146
+ }
148147
+ }
148117
148148
  return {
148118
148149
  type: "text",
148119
- text: `[Unsupported media type: ${mimeType}${displayName}]`
148150
+ text: `[Unsupported media type: ${mimeType} (${displayName})]`
148120
148151
  };
148121
148152
  }
148122
148153
  if (part.fileData?.mimeType && part.fileData?.fileUri) {
148154
+ const fileDisplayName = part.fileData.displayName || part.fileData.fileUri;
148155
+ const fileMimeType = part.fileData.mimeType;
148156
+ if (fileMimeType.startsWith("image/") && !this.modalities.image) {
148157
+ return {
148158
+ type: "text",
148159
+ text: this.unsupportedModalityHint("image", fileDisplayName)
148160
+ };
148161
+ }
148162
+ if (fileMimeType === "application/pdf" && !this.modalities.pdf) {
148163
+ return {
148164
+ type: "text",
148165
+ text: this.unsupportedModalityHint("pdf", fileDisplayName)
148166
+ };
148167
+ }
148168
+ if (fileMimeType.startsWith("audio/") && !this.modalities.audio) {
148169
+ return {
148170
+ type: "text",
148171
+ text: this.unsupportedModalityHint("audio", fileDisplayName)
148172
+ };
148173
+ }
148174
+ if (fileMimeType.startsWith("video/") && !this.modalities.video) {
148175
+ return {
148176
+ type: "text",
148177
+ text: this.unsupportedModalityHint("video", fileDisplayName)
148178
+ };
148179
+ }
148123
148180
  return {
148124
148181
  type: "text",
148125
148182
  text: `[External file reference: ${part.fileData.fileUri}]`
@@ -148155,6 +148212,13 @@ var init_vertexAnthropicContentGenerator = __esm({
148155
148212
  isSupportedImageMimeType(mimeType) {
148156
148213
  return mimeType === "image/jpeg" || mimeType === "image/png" || mimeType === "image/gif" || mimeType === "image/webp";
148157
148214
  }
148215
+ unsupportedModalityHint(modality, displayName) {
148216
+ if (modality === "pdf") {
148217
+ return `[Unsupported pdf file: "${displayName}". This model does not support PDF input directly. The read_file tool cannot extract PDF content either. To extract text from the PDF file, try using skills if applicable, or guide user to install pdf skill by running this slash command:
148218
+ /extensions install https://github.com/anthropics/skills:document-skills]`;
148219
+ }
148220
+ return `[Unsupported ${modality} file: "${displayName}". This model does not support ${modality} input. The read_file tool cannot process this type of file either. To handle this file, try using skills if applicable, or any tools installed at system wide, or let the user know you cannot process this type of file.]`;
148221
+ }
148158
148222
  /**
148159
148223
  * 将 Gemini 工具定义转换为 Anthropic 格式
148160
148224
  * 参考 AnthropicContentConverter.convertGeminiToolsToAnthropic
@@ -148678,7 +148742,7 @@ function extractReasoningEffort(model) {
148678
148742
  }
148679
148743
  return void 0;
148680
148744
  }
148681
- function buildCodexInput(contents, systemInstruction) {
148745
+ function buildCodexInput(contents, systemInstruction, modalities) {
148682
148746
  const messages = [];
148683
148747
  if (systemInstruction) {
148684
148748
  const text = extractTextFromContent(systemInstruction);
@@ -148688,7 +148752,7 @@ function buildCodexInput(contents, systemInstruction) {
148688
148752
  }
148689
148753
  const contentsArray = Array.isArray(contents) ? contents : [contents];
148690
148754
  for (const content of contentsArray) {
148691
- const codexMessages = convertContentToCodexMessages(content);
148755
+ const codexMessages = convertContentToCodexMessages(content, modalities);
148692
148756
  messages.push(...codexMessages);
148693
148757
  }
148694
148758
  if (messages.length === 1 && messages[0].role === "user") {
@@ -148699,7 +148763,7 @@ function buildCodexInput(contents, systemInstruction) {
148699
148763
  }
148700
148764
  return messages;
148701
148765
  }
148702
- function convertContentToCodexMessages(content) {
148766
+ function convertContentToCodexMessages(content, modalities) {
148703
148767
  const messages = [];
148704
148768
  if (!content) return messages;
148705
148769
  if (typeof content === "string") {
@@ -148742,14 +148806,14 @@ function convertContentToCodexMessages(content) {
148742
148806
  }
148743
148807
  if ("inlineData" in partObj && partObj["inlineData"]) {
148744
148808
  const inlineData = partObj["inlineData"];
148745
- const mediaMsg = convertInlineDataToCodexMessage(inlineData);
148809
+ const mediaMsg = convertInlineDataToCodexMessage(inlineData, modalities);
148746
148810
  if (mediaMsg) {
148747
148811
  messages.push(mediaMsg);
148748
148812
  }
148749
148813
  }
148750
148814
  if ("fileData" in partObj && partObj["fileData"]) {
148751
148815
  const fileData = partObj["fileData"];
148752
- const mediaMsg = convertFileDataToCodexMessage(fileData);
148816
+ const mediaMsg = convertFileDataToCodexMessage(fileData, modalities);
148753
148817
  if (mediaMsg) {
148754
148818
  messages.push(mediaMsg);
148755
148819
  }
@@ -148758,10 +148822,18 @@ function convertContentToCodexMessages(content) {
148758
148822
  }
148759
148823
  return messages;
148760
148824
  }
148761
- function convertInlineDataToCodexMessage(inlineData) {
148825
+ function convertInlineDataToCodexMessage(inlineData, modalities) {
148762
148826
  const mimeType = inlineData.mimeType;
148763
148827
  const dataUrl = `data:${mimeType};base64,${inlineData.data}`;
148828
+ const displayName = inlineData.displayName || mimeType;
148764
148829
  if (mimeType.startsWith("image/")) {
148830
+ if (!modalities.image) {
148831
+ return {
148832
+ role: "user",
148833
+ type: "message",
148834
+ content: unsupportedModalityHint("image", displayName)
148835
+ };
148836
+ }
148765
148837
  return {
148766
148838
  role: "user",
148767
148839
  type: "message",
@@ -148769,6 +148841,13 @@ function convertInlineDataToCodexMessage(inlineData) {
148769
148841
  };
148770
148842
  }
148771
148843
  if (mimeType === "application/pdf") {
148844
+ if (!modalities.pdf) {
148845
+ return {
148846
+ role: "user",
148847
+ type: "message",
148848
+ content: unsupportedModalityHint("pdf", displayName)
148849
+ };
148850
+ }
148772
148851
  return {
148773
148852
  role: "user",
148774
148853
  type: "message",
@@ -148776,22 +148855,53 @@ function convertInlineDataToCodexMessage(inlineData) {
148776
148855
  };
148777
148856
  }
148778
148857
  if (mimeType.startsWith("audio/")) {
148858
+ if (!modalities.audio) {
148859
+ return {
148860
+ role: "user",
148861
+ type: "message",
148862
+ content: unsupportedModalityHint("audio", displayName)
148863
+ };
148864
+ }
148779
148865
  return {
148780
148866
  role: "user",
148781
148867
  type: "message",
148782
148868
  content: `[Audio file: ${inlineData.displayName || "audio"} (${mimeType})]`
148783
148869
  };
148784
148870
  }
148871
+ if (mimeType.startsWith("video/")) {
148872
+ if (!modalities.video) {
148873
+ return {
148874
+ role: "user",
148875
+ type: "message",
148876
+ content: unsupportedModalityHint("video", displayName)
148877
+ };
148878
+ }
148879
+ }
148785
148880
  return {
148786
148881
  role: "user",
148787
148882
  type: "message",
148788
148883
  content: `[Unsupported file: ${mimeType}${inlineData.displayName ? ` (${inlineData.displayName})` : ""}]`
148789
148884
  };
148790
148885
  }
148791
- function convertFileDataToCodexMessage(fileData) {
148886
+ function unsupportedModalityHint(modality, displayName) {
148887
+ if (modality === "pdf") {
148888
+ return `[Unsupported pdf file: "${displayName}". This model does not support PDF input directly. The read_file tool cannot extract PDF content either. To extract text from the PDF file, try using skills if applicable, or guide user to install pdf skill by running this slash command:
148889
+ /extensions install https://github.com/anthropics/skills:document-skills]`;
148890
+ }
148891
+ return `[Unsupported ${modality} file: "${displayName}". This model does not support ${modality} input. The read_file tool cannot process this type of file either. To handle this file, try using skills if applicable, or any tools installed at system wide, or let the user know you cannot process this type of file.]`;
148892
+ }
148893
+ function convertFileDataToCodexMessage(fileData, modalities) {
148792
148894
  const mimeType = fileData.mimeType;
148793
148895
  const fileUri = fileData.fileUri;
148896
+ const displayName = fileData.displayName || mimeType;
148794
148897
  if (mimeType.startsWith("image/")) {
148898
+ if (!modalities.image) {
148899
+ return {
148900
+ role: "user",
148901
+ type: "message",
148902
+ content: unsupportedModalityHint("image", displayName)
148903
+ };
148904
+ }
148795
148905
  return {
148796
148906
  role: "user",
148797
148907
  type: "message",
@@ -148799,6 +148909,13 @@ function convertFileDataToCodexMessage(fileData) {
148799
148909
  };
148800
148910
  }
148801
148911
  if (mimeType === "application/pdf") {
148912
+ if (!modalities.pdf) {
148913
+ return {
148914
+ role: "user",
148915
+ type: "message",
148916
+ content: unsupportedModalityHint("pdf", displayName)
148917
+ };
148918
+ }
148802
148919
  return {
148803
148920
  role: "user",
148804
148921
  type: "message",
@@ -148806,12 +148923,28 @@ function convertFileDataToCodexMessage(fileData) {
148806
148923
  };
148807
148924
  }
148808
148925
  if (mimeType.startsWith("audio/")) {
148926
+ if (!modalities.audio) {
148927
+ return {
148928
+ role: "user",
148929
+ type: "message",
148930
+ content: unsupportedModalityHint("audio", displayName)
148931
+ };
148932
+ }
148809
148933
  return {
148810
148934
  role: "user",
148811
148935
  type: "message",
148812
148936
  content: `[Audio file: ${fileData.displayName || "audio"} (${mimeType})]`
148813
148937
  };
148814
148938
  }
148939
+ if (mimeType.startsWith("video/")) {
148940
+ if (!modalities.video) {
148941
+ return {
148942
+ role: "user",
148943
+ type: "message",
148944
+ content: unsupportedModalityHint("video", displayName)
148945
+ };
148946
+ }
148947
+ }
148815
148948
  return {
148816
148949
  role: "user",
148817
148950
  type: "message",
@@ -148954,6 +149087,7 @@ var init_codexContentGenerator = __esm({
148954
149087
  "use strict";
148955
149088
  init_esbuild_shims();
148956
149089
  init_node();
149090
+ init_modalityDefaults();
148957
149091
  init_errorHandler();
148958
149092
  init_loggers();
148959
149093
  init_types();
@@ -148966,6 +149100,7 @@ var init_codexContentGenerator = __esm({
148966
149100
  apiKey;
148967
149101
  samplingParams;
148968
149102
  reasoning;
149103
+ modalities;
148969
149104
  cliConfig;
148970
149105
  errorHandler;
148971
149106
  logger;
@@ -148974,6 +149109,7 @@ var init_codexContentGenerator = __esm({
148974
149109
  this.apiKey = config2.apiKey || "";
148975
149110
  this.samplingParams = config2.samplingParams;
148976
149111
  this.reasoning = config2.reasoning;
149112
+ this.modalities = config2.modalities ?? defaultModalities(config2.model);
148977
149113
  this.cliConfig = cliConfig;
148978
149114
  if (!this.apiKey) {
148979
149115
  throw new Error("API key is required for Codex");
@@ -149064,7 +149200,8 @@ var init_codexContentGenerator = __esm({
149064
149200
  const reasoningEffort = extractReasoningEffort(request4.model) || (typeof this.reasoning === "object" ? this.reasoning?.effort : "medium");
149065
149201
  const input = buildCodexInput(
149066
149202
  request4.contents,
149067
- request4.config?.systemInstruction
149203
+ request4.config?.systemInstruction,
149204
+ this.modalities
149068
149205
  );
149069
149206
  const codexRequest = {
149070
149207
  model,
@@ -149249,6 +149386,7 @@ var init_codexContentGenerator = __esm({
149249
149386
  __name(buildCodexInput, "buildCodexInput");
149250
149387
  __name(convertContentToCodexMessages, "convertContentToCodexMessages");
149251
149388
  __name(convertInlineDataToCodexMessage, "convertInlineDataToCodexMessage");
149389
+ __name(unsupportedModalityHint, "unsupportedModalityHint");
149252
149390
  __name(convertFileDataToCodexMessage, "convertFileDataToCodexMessage");
149253
149391
  __name(extractTextFromContent, "extractTextFromContent");
149254
149392
  __name(convertTools, "convertTools");
@@ -160844,7 +160982,7 @@ __export(geminiContentGenerator_exports2, {
160844
160982
  createGeminiContentGenerator: () => createGeminiContentGenerator
160845
160983
  });
160846
160984
  function createGeminiContentGenerator(config2, gcConfig) {
160847
- const version2 = "0.2.8-alpha.1";
160985
+ const version2 = "0.2.8-alpha.2";
160848
160986
  const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
160849
160987
  const baseHeaders = {
160850
160988
  "User-Agent": userAgent2
@@ -251123,7 +251261,7 @@ function resolveModelConfig(input) {
251123
251261
  settings?.generationConfig,
251124
251262
  modelProvider?.generationConfig,
251125
251263
  authType,
251126
- modelProvider?.id,
251264
+ modelProvider?.id ?? modelResult.value,
251127
251265
  sources
251128
251266
  );
251129
251267
  const config2 = {
@@ -251242,6 +251380,10 @@ function resolveGenerationConfig(settingsConfig, modelProviderConfig, authType,
251242
251380
  sources[field] = settingsSource(`model.generationConfig.${field}`);
251243
251381
  }
251244
251382
  }
251383
+ if (result.modalities === void 0 && modelId) {
251384
+ result.modalities = defaultModalities(modelId);
251385
+ sources["modalities"] = computedSource("auto-detected from model");
251386
+ }
251245
251387
  return result;
251246
251388
  }
251247
251389
  var init_modelConfigResolver = __esm({
@@ -251253,6 +251395,7 @@ var init_modelConfigResolver = __esm({
251253
251395
  init_apiKeyEncryption();
251254
251396
  init_configResolver();
251255
251397
  init_constants3();
251398
+ init_modalityDefaults();
251256
251399
  init_contentGenerator();
251257
251400
  __name(resolveModelConfig, "resolveModelConfig");
251258
251401
  __name(resolveQwenOAuthConfig, "resolveQwenOAuthConfig");
@@ -361650,7 +361793,7 @@ __name(getPackageJson, "getPackageJson");
361650
361793
  // packages/cli/src/utils/version.ts
361651
361794
  async function getCliVersion() {
361652
361795
  const pkgJson = await getPackageJson();
361653
- return "0.2.8-alpha.1";
361796
+ return "0.2.8-alpha.2";
361654
361797
  }
361655
361798
  __name(getCliVersion, "getCliVersion");
361656
361799
 
@@ -369399,7 +369542,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
369399
369542
 
369400
369543
  // packages/cli/src/generated/git-commit.ts
369401
369544
  init_esbuild_shims();
369402
- var GIT_COMMIT_INFO = "76368f06e";
369545
+ var GIT_COMMIT_INFO = "e33c3c8f2";
369403
369546
 
369404
369547
  // packages/cli/src/utils/systemInfo.ts
369405
369548
  async function getNpmVersion() {
@@ -402454,7 +402597,7 @@ function useTextBuffer({
402454
402597
  const openInExternalEditor = (0, import_react46.useCallback)(
402455
402598
  async (opts = {}) => {
402456
402599
  const editor = opts.editor ?? process.env["VISUAL"] ?? process.env["EDITOR"] ?? (process.platform === "win32" ? "notepad" : "vi");
402457
- const tmpDir = fs100.mkdtempSync(pathMod.join(os38.tmpdir(), "gemini-edit-"));
402600
+ const tmpDir = fs100.mkdtempSync(pathMod.join(os38.tmpdir(), "rdmind-edit-"));
402458
402601
  const filePath = pathMod.join(tmpDir, "buffer.txt");
402459
402602
  fs100.writeFileSync(filePath, text, "utf8");
402460
402603
  dispatch({ type: "create_undo_snapshot" });
@@ -429318,7 +429461,7 @@ var GeminiAgent = class {
429318
429461
  name: APPROVAL_MODE_INFO[mode].name,
429319
429462
  description: APPROVAL_MODE_INFO[mode].description
429320
429463
  }));
429321
- const version2 = "0.2.8-alpha.1";
429464
+ const version2 = "0.2.8-alpha.2";
429322
429465
  return {
429323
429466
  protocolVersion: PROTOCOL_VERSION,
429324
429467
  agentInfo: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rdmind/rdmind",
3
- "version": "0.2.8-alpha.1",
3
+ "version": "0.2.8-alpha.2",
4
4
  "description": "RDMind - AI-powered coding assistant",
5
5
  "type": "module",
6
6
  "main": "cli.js",
@@ -19,7 +19,7 @@
19
19
  "locales"
20
20
  ],
21
21
  "config": {
22
- "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.2.8-alpha.1"
22
+ "sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.2.8-alpha.2"
23
23
  },
24
24
  "publishConfig": {
25
25
  "access": "public"