@bonginkan/maria 2.0.5 → 2.0.7

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/dist/cli.js CHANGED
@@ -152,8 +152,8 @@ var init_openai_provider = __esm({
152
152
  }
153
153
  name = "OpenAI";
154
154
  models = [
155
- "gpt-5-2025-08-07",
156
- "gpt-5-mini-2025-08-07",
155
+ "gpt-5",
156
+ "gpt-5-mini",
157
157
  "gpt-4o",
158
158
  "gpt-4o-mini",
159
159
  "gpt-4-turbo",
@@ -281,7 +281,7 @@ var init_anthropic_provider = __esm({
281
281
  }
282
282
  name = "Anthropic";
283
283
  models = [
284
- "claude-opus-4.1",
284
+ "claude-4.1",
285
285
  "claude-3-5-sonnet-20241022",
286
286
  "claude-3-5-haiku-20241022",
287
287
  "claude-3-opus-20240229",
@@ -6132,7 +6132,9 @@ var GrokProvider = class extends BaseAIProvider {
6132
6132
  }
6133
6133
  name = "Grok";
6134
6134
  models = [
6135
- "grok-4-0709",
6135
+ "grok-4",
6136
+ "grok-beta",
6137
+ "grok-2",
6136
6138
  "llama-3.3-70b-versatile",
6137
6139
  "llama-3.1-70b-versatile",
6138
6140
  "llama-3.1-8b-instant",
@@ -6983,6 +6985,30 @@ var AIProviderManager = class {
6983
6985
  }
6984
6986
  }
6985
6987
  }
6988
+ const cloudProviders = ["openai", "anthropic", "google", "grok"];
6989
+ const defaultCloudModels = {
6990
+ openai: ["gpt-5", "gpt-5-mini", "gpt-4o", "gpt-4o-mini", "o1-preview", "o1-mini"],
6991
+ anthropic: ["claude-4.1", "claude-3-5-sonnet-20241022", "claude-3-5-haiku-20241022", "claude-3-opus-20240229"],
6992
+ google: ["gemini-2.5-pro", "gemini-2.5-flash", "gemini-1.5-pro", "gemini-1.5-flash"],
6993
+ grok: ["grok-4", "grok-beta", "grok-2"]
6994
+ };
6995
+ for (const providerName of cloudProviders) {
6996
+ if (!this.availableProviders.has(providerName)) {
6997
+ const models = defaultCloudModels[providerName] || [];
6998
+ const modelInfos = models.map((modelName) => ({
6999
+ id: `${providerName}-${modelName}`,
7000
+ name: modelName,
7001
+ provider: providerName,
7002
+ description: `${modelName} from ${providerName}`,
7003
+ contextLength: 8192,
7004
+ capabilities: ["text", "code", "vision"],
7005
+ available: false,
7006
+ // Mark as unavailable (need API key)
7007
+ recommendedFor: ["general"]
7008
+ }));
7009
+ allModels.push(...modelInfos);
7010
+ }
7011
+ }
6986
7012
  return allModels;
6987
7013
  }
6988
7014
  selectOptimalProvider(_taskType, priorityMode = "auto") {
@@ -7195,6 +7221,17 @@ var IntelligentRouter = class {
7195
7221
  modelId: request.model || await this.getDefaultModelForProvider(request.provider)
7196
7222
  };
7197
7223
  }
7224
+ const preferredProvider = this.config.get("preferredProvider");
7225
+ const preferredModel = this.config.get("preferredModel");
7226
+ if (preferredProvider && preferredModel) {
7227
+ const availableProviders = this.providerManager.getAvailableProviders();
7228
+ if (availableProviders.includes(preferredProvider)) {
7229
+ return {
7230
+ providerName: preferredProvider,
7231
+ modelId: preferredModel
7232
+ };
7233
+ }
7234
+ }
7198
7235
  const priorityMode = this.config.get("priority", "auto");
7199
7236
  const providerName = this.providerManager.selectOptimalProvider(taskType, priorityMode);
7200
7237
  if (!providerName) {
@@ -7227,6 +7264,10 @@ var IntelligentRouter = class {
7227
7264
  updatePriorityMode(mode) {
7228
7265
  this.config.set("priority", mode);
7229
7266
  }
7267
+ updatePreferredProvider(provider, model) {
7268
+ this.config.set("preferredProvider", provider);
7269
+ this.config.set("preferredModel", model);
7270
+ }
7230
7271
  };
7231
7272
 
7232
7273
  // src/services/health-monitor.ts
@@ -7631,7 +7672,9 @@ var ConfigManager = class _ConfigManager {
7631
7672
  autoStart: true,
7632
7673
  healthMonitoring: true,
7633
7674
  language: "auto",
7634
- offlineMode: false
7675
+ offlineMode: false,
7676
+ model: "gpt-5-mini",
7677
+ provider: "openai"
7635
7678
  };
7636
7679
  }
7637
7680
  mergeConfig(newConfig) {
@@ -7844,6 +7887,50 @@ Context from memory:
7844
7887
  this.config.set("priority", mode);
7845
7888
  this.router.updatePriorityMode(mode);
7846
7889
  }
7890
+ /**
7891
+ * Switch to a specific model
7892
+ */
7893
+ async switchModel(modelId) {
7894
+ try {
7895
+ const models = await this.getModels();
7896
+ const targetModel = models.find((m) => m.id === modelId || m.name === modelId);
7897
+ if (!targetModel) {
7898
+ return {
7899
+ success: false,
7900
+ message: `Model not found: ${modelId}`
7901
+ };
7902
+ }
7903
+ if (!targetModel.available) {
7904
+ return {
7905
+ success: false,
7906
+ message: `Model ${targetModel.name} is not available. Please check API keys.`
7907
+ };
7908
+ }
7909
+ this.config.set("model", targetModel.name);
7910
+ this.config.set("provider", targetModel.provider);
7911
+ this.router.updatePreferredProvider(targetModel.provider, targetModel.name);
7912
+ return {
7913
+ success: true,
7914
+ message: `Switched to ${targetModel.name} (${targetModel.provider})`
7915
+ };
7916
+ } catch (error) {
7917
+ return {
7918
+ success: false,
7919
+ message: `Failed to switch model: ${error instanceof Error ? error.message : "Unknown error"}`
7920
+ };
7921
+ }
7922
+ }
7923
+ /**
7924
+ * Get current active model
7925
+ */
7926
+ getCurrentModel() {
7927
+ const currentModel = this.config.get("model");
7928
+ const currentProvider = this.config.get("provider");
7929
+ if (currentModel && currentProvider) {
7930
+ return { name: currentModel, provider: currentProvider };
7931
+ }
7932
+ return null;
7933
+ }
7847
7934
  /**
7848
7935
  * Get current configuration
7849
7936
  */
@@ -25651,17 +25738,36 @@ async function showModels(maria) {
25651
25738
  try {
25652
25739
  const models = await maria.getModels();
25653
25740
  const available = models.filter((m) => m.available);
25654
- if (available.length === 0) {
25655
- console.log(chalk13__default.default.yellow("No models available"));
25741
+ const unavailable = models.filter((m) => !m.available);
25742
+ if (available.length === 0 && unavailable.length === 0) {
25743
+ console.log(chalk13__default.default.yellow("No models found"));
25656
25744
  return;
25657
25745
  }
25658
- for (const model of available) {
25659
- const provider = chalk13__default.default.gray(`[${model.provider}]`);
25660
- const capabilities = model.capabilities ? model.capabilities.join(", ") : "No capabilities listed";
25661
- console.log(`\u2705 ${chalk13__default.default.bold(model.name)} ${provider}`);
25662
- console.log(` ${chalk13__default.default.gray(capabilities)}`);
25746
+ if (available.length > 0) {
25747
+ console.log(chalk13__default.default.green("\u2705 Available Models:"));
25748
+ for (const model of available) {
25749
+ const provider = chalk13__default.default.gray(`[${model.provider}]`);
25750
+ const capabilities = model.capabilities ? model.capabilities.join(", ") : "No capabilities listed";
25751
+ console.log(` \u2705 ${chalk13__default.default.bold(model.name)} ${provider}`);
25752
+ console.log(` ${chalk13__default.default.gray(capabilities)}`);
25753
+ }
25754
+ console.log("");
25755
+ }
25756
+ if (unavailable.length > 0) {
25757
+ console.log(chalk13__default.default.yellow("\u26A0\uFE0F Cloud Models (Require API Keys):"));
25758
+ for (const model of unavailable) {
25759
+ const provider = chalk13__default.default.gray(`[${model.provider}]`);
25760
+ const capabilities = model.capabilities ? model.capabilities.join(", ") : "No capabilities listed";
25761
+ console.log(` \u274C ${chalk13__default.default.white(model.name)} ${provider}`);
25762
+ console.log(` ${chalk13__default.default.gray(capabilities)}`);
25763
+ }
25764
+ console.log("");
25765
+ console.log(chalk13__default.default.gray("\u{1F4A1} To use cloud models, set environment variables:"));
25766
+ console.log(chalk13__default.default.cyan(" export OPENAI_API_KEY=your_key"));
25767
+ console.log(chalk13__default.default.cyan(" export ANTHROPIC_API_KEY=your_key"));
25768
+ console.log(chalk13__default.default.cyan(" export GOOGLE_API_KEY=your_key"));
25769
+ console.log("");
25663
25770
  }
25664
- console.log("");
25665
25771
  } catch (error) {
25666
25772
  console.error(chalk13__default.default.red("\u274C Failed to get models:"), error);
25667
25773
  }
@@ -25728,32 +25834,40 @@ async function showModelSelector(maria, args) {
25728
25834
  try {
25729
25835
  const models = await maria.getModels();
25730
25836
  const available = models.filter((m) => m.available);
25837
+ const allModels = models;
25731
25838
  if (args.length > 0) {
25732
25839
  const modelName = args.join(" ");
25733
- const targetModel = available.find(
25840
+ const targetModel = allModels.find(
25734
25841
  (m) => m.name.toLowerCase().includes(modelName.toLowerCase()) || m.provider.toLowerCase().includes(modelName.toLowerCase())
25735
25842
  );
25736
25843
  if (targetModel) {
25737
- console.log(
25738
- chalk13__default.default.green(`\u2705 Target model found: ${targetModel.name} (${targetModel.provider})`)
25739
- );
25740
- console.log(chalk13__default.default.yellow("Note: Model switching will be implemented in a future version"));
25741
- console.log(
25742
- chalk13__default.default.gray("Currently, you can switch models using environment variables or CLI options")
25743
- );
25844
+ if (targetModel.available) {
25845
+ console.log(
25846
+ chalk13__default.default.green(`\u2705 Target model found: ${targetModel.name} (${targetModel.provider})`)
25847
+ );
25848
+ console.log(chalk13__default.default.yellow("Note: Model switching will be implemented in a future version"));
25849
+ console.log(
25850
+ chalk13__default.default.gray("Currently, you can switch models using environment variables or CLI options")
25851
+ );
25852
+ } else {
25853
+ console.log(
25854
+ chalk13__default.default.yellow(`\u26A0\uFE0F Target model found but unavailable: ${targetModel.name} (${targetModel.provider})`)
25855
+ );
25856
+ console.log(chalk13__default.default.gray(`This model requires API key for ${targetModel.provider}`));
25857
+ }
25744
25858
  } else {
25745
25859
  console.log(chalk13__default.default.red(`\u274C Model not found: ${modelName}`));
25746
25860
  console.log(chalk13__default.default.gray("Available models listed below:"));
25747
25861
  }
25748
25862
  return;
25749
25863
  }
25750
- await showInteractiveModelSelector(available);
25864
+ await showInteractiveModelSelector(allModels, maria);
25751
25865
  } catch (error) {
25752
25866
  console.error(chalk13__default.default.red("\u274C Failed to access model selector:"), error);
25753
25867
  }
25754
25868
  }
25755
25869
  __name(showModelSelector, "showModelSelector");
25756
- async function showInteractiveModelSelector(models) {
25870
+ async function showInteractiveModelSelector(models, maria) {
25757
25871
  if (models.length === 0) {
25758
25872
  console.log(chalk13__default.default.yellow("No models available"));
25759
25873
  return;
@@ -25767,27 +25881,43 @@ async function showInteractiveModelSelector(models) {
25767
25881
  process.stdout.write("\x1B[2J\x1B[0;0f");
25768
25882
  console.log(chalk13__default.default.blue("\u{1F916} AI Model Selector\n"));
25769
25883
  console.log(chalk13__default.default.gray("Use \u2191/\u2193 to navigate, Enter to select, Esc to cancel\n"));
25884
+ const currentModel = maria.getCurrentModel();
25885
+ if (currentModel) {
25886
+ console.log(chalk13__default.default.green(`\u{1F3AF} Current Active Model: ${currentModel.name} (${currentModel.provider})
25887
+ `));
25888
+ } else {
25889
+ console.log(chalk13__default.default.yellow(`\u{1F3AF} Current Active Model: gpt-5-mini (openai) - Default
25890
+ `));
25891
+ }
25770
25892
  console.log(chalk13__default.default.yellow("\u{1F4CB} Available AI Models:\n"));
25771
25893
  models.forEach((model, index) => {
25772
- const status = model.available ? "\u2705" : "\u26A0\uFE0F";
25894
+ const status = model.available ? "\u2705" : "\u274C";
25773
25895
  const pricing = model.pricing ? ` ($${model.pricing.input}/${model.pricing.output})` : "";
25774
25896
  const isSelected = index === selectedIndex;
25897
+ const availabilityNote = model.available ? "" : " (API key required)";
25775
25898
  if (isSelected) {
25776
25899
  console.log(
25777
- chalk13__default.default.bgBlue.white(` \u25B6 ${status} ${model.name} [${model.provider}]${pricing}`)
25900
+ chalk13__default.default.bgBlue.white(` \u25B6 ${status} ${model.name} [${model.provider}]${pricing}${availabilityNote}`)
25778
25901
  );
25779
25902
  console.log(chalk13__default.default.bgBlue.white(` ${model.description}`));
25780
25903
  if (model.capabilities && model.capabilities.length > 0) {
25781
25904
  console.log(chalk13__default.default.bgBlue.white(` Capabilities: ${model.capabilities.join(", ")}`));
25782
25905
  }
25906
+ if (!model.available) {
25907
+ console.log(chalk13__default.default.bgBlue.white(` Status: Requires ${model.provider.toUpperCase()}_API_KEY environment variable`));
25908
+ }
25783
25909
  } else {
25910
+ const nameColor = model.available ? chalk13__default.default.bold : chalk13__default.default.white;
25784
25911
  console.log(
25785
- ` ${status} ${chalk13__default.default.bold(model.name)} ${chalk13__default.default.gray(`[${model.provider}]`)}${pricing}`
25912
+ ` ${status} ${nameColor(model.name)} ${chalk13__default.default.gray(`[${model.provider}]`)}${pricing}${availabilityNote}`
25786
25913
  );
25787
25914
  console.log(` ${chalk13__default.default.gray(model.description)}`);
25788
25915
  if (model.capabilities && model.capabilities.length > 0) {
25789
25916
  console.log(` ${chalk13__default.default.cyan("Capabilities:")} ${model.capabilities.join(", ")}`);
25790
25917
  }
25918
+ if (!model.available) {
25919
+ console.log(` ${chalk13__default.default.yellow("Status:")} Requires ${model.provider.toUpperCase()}_API_KEY environment variable`);
25920
+ }
25791
25921
  }
25792
25922
  console.log("");
25793
25923
  });
@@ -25798,7 +25928,7 @@ async function showInteractiveModelSelector(models) {
25798
25928
  stdin.removeAllListeners("data");
25799
25929
  }, "cleanup");
25800
25930
  return new Promise((resolve) => {
25801
- const handleKeypress = /* @__PURE__ */ __name((chunk) => {
25931
+ const handleKeypress = /* @__PURE__ */ __name(async (chunk) => {
25802
25932
  const key = chunk.toString();
25803
25933
  switch (key) {
25804
25934
  case "\x1B[A":
@@ -25810,31 +25940,45 @@ async function showInteractiveModelSelector(models) {
25810
25940
  renderModels();
25811
25941
  break;
25812
25942
  case "\r":
25813
- isSelecting = false;
25814
25943
  cleanup();
25815
25944
  const selectedModel = models[selectedIndex];
25816
- console.log(
25817
- chalk13__default.default.green(`
25818
- \u2705 Selected: ${selectedModel.name} (${selectedModel.provider})`)
25819
- );
25820
- console.log(
25821
- chalk13__default.default.yellow("Note: Model switching will be implemented in a future version")
25822
- );
25823
- console.log(
25824
- chalk13__default.default.gray(
25825
- "Currently, you can switch models using environment variables or CLI options\n"
25826
- )
25827
- );
25945
+ if (selectedModel.available) {
25946
+ try {
25947
+ const result = await maria.switchModel(selectedModel.id);
25948
+ if (result.success) {
25949
+ console.log(chalk13__default.default.green(`
25950
+ \u2705 ${result.message}`));
25951
+ console.log(chalk13__default.default.gray("Model switch completed successfully\n"));
25952
+ } else {
25953
+ console.log(chalk13__default.default.red(`
25954
+ \u274C ${result.message}
25955
+ `));
25956
+ }
25957
+ } catch (error) {
25958
+ console.log(chalk13__default.default.red(`
25959
+ \u274C Failed to switch model: ${error}
25960
+ `));
25961
+ }
25962
+ } else {
25963
+ console.log(
25964
+ chalk13__default.default.yellow(`
25965
+ \u26A0\uFE0F Selected: ${selectedModel.name} (${selectedModel.provider})`)
25966
+ );
25967
+ console.log(
25968
+ chalk13__default.default.red(`\u274C This model is not available. Please set ${selectedModel.provider.toUpperCase()}_API_KEY environment variable.`)
25969
+ );
25970
+ console.log(chalk13__default.default.gray("Example:"));
25971
+ console.log(chalk13__default.default.cyan(` export ${selectedModel.provider.toUpperCase()}_API_KEY=your_api_key`));
25972
+ console.log("");
25973
+ }
25828
25974
  resolve();
25829
25975
  break;
25830
25976
  case "\x1B":
25831
- isSelecting = false;
25832
25977
  cleanup();
25833
25978
  console.log(chalk13__default.default.gray("\n\u{1F4CB} Model selection cancelled\n"));
25834
25979
  resolve();
25835
25980
  break;
25836
25981
  case "":
25837
- isSelecting = false;
25838
25982
  cleanup();
25839
25983
  console.log(chalk13__default.default.gray("\n\u{1F4CB} Model selection cancelled\n"));
25840
25984
  resolve();
@@ -28372,7 +28516,7 @@ __name(handleApprovalShow, "handleApprovalShow");
28372
28516
 
28373
28517
  // package.json
28374
28518
  var package_default = {
28375
- version: "2.0.4"};
28519
+ version: "2.0.7"};
28376
28520
 
28377
28521
  // src/cli.ts
28378
28522
  function createCLI() {