@cosmicstack/mercury-agent 1.1.4 → 1.1.5
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/README.md +3 -3
- package/dist/index.js +93 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="docs/card-dark.png">
|
|
4
|
-
<source media="(prefers-color-scheme: light)" srcset="docs/card-light.png">
|
|
5
|
-
<img alt="Mercury — Soul-Driven AI Agent" src="docs/card-light.png" width="600">
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/img/card-dark.png">
|
|
4
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/img/card-light.png">
|
|
5
|
+
<img alt="Mercury — Soul-Driven AI Agent" src="docs/img/card-light.png" width="600">
|
|
6
6
|
</picture>
|
|
7
7
|
</p>
|
|
8
8
|
|
package/dist/index.js
CHANGED
|
@@ -88,7 +88,7 @@ function getDefaultConfig() {
|
|
|
88
88
|
name: "ollamaLocal",
|
|
89
89
|
apiKey: "",
|
|
90
90
|
baseUrl: getEnv("OLLAMA_LOCAL_BASE_URL", "http://127.0.0.1:11434/api"),
|
|
91
|
-
model: getEnv("OLLAMA_LOCAL_MODEL", "
|
|
91
|
+
model: getEnv("OLLAMA_LOCAL_MODEL", ""),
|
|
92
92
|
enabled: getEnvBool("OLLAMA_LOCAL_ENABLED", false)
|
|
93
93
|
},
|
|
94
94
|
openaiCompat: {
|
|
@@ -8172,8 +8172,16 @@ var OLLAMA_CLOUD_PREFERRED_MODELS = [
|
|
|
8172
8172
|
"gpt-oss:20b"
|
|
8173
8173
|
];
|
|
8174
8174
|
var OLLAMA_LOCAL_PREFERRED_MODELS = [
|
|
8175
|
-
"
|
|
8176
|
-
"
|
|
8175
|
+
"llama3.2",
|
|
8176
|
+
"llama3.1",
|
|
8177
|
+
"llama3",
|
|
8178
|
+
"mistral",
|
|
8179
|
+
"codellama",
|
|
8180
|
+
"gemma2",
|
|
8181
|
+
"phi3",
|
|
8182
|
+
"qwen2",
|
|
8183
|
+
"deepseek-r1",
|
|
8184
|
+
"deepseek-coder-v2"
|
|
8177
8185
|
];
|
|
8178
8186
|
var MIMO_PREFERRED_MODELS = [
|
|
8179
8187
|
"mimo-v2.5-pro",
|
|
@@ -8664,35 +8672,72 @@ async function promptApiKeyWithModelSelection(config, provider, providerLabel, p
|
|
|
8664
8672
|
);
|
|
8665
8673
|
return { apiKey: value, model, skipped: false };
|
|
8666
8674
|
} catch (error) {
|
|
8667
|
-
const message = error instanceof ProviderModelFetchError ? error.message : `Mercury could not fetch models for ${providerLabel}
|
|
8668
|
-
console.log(chalk7.
|
|
8675
|
+
const message = error instanceof ProviderModelFetchError ? error.message : `Mercury could not fetch models for ${providerLabel}.`;
|
|
8676
|
+
console.log(chalk7.yellow(` ${message}`));
|
|
8677
|
+
console.log(chalk7.dim(" The API key looks valid but Mercury could not reach the provider."));
|
|
8678
|
+
console.log(chalk7.dim(` You can enter a model name manually, or skip ${providerLabel} for now.`));
|
|
8679
|
+
const manualModel = await ask(chalk7.white(` ${providerLabel} model name (Enter to skip ${providerLabel} for now): `));
|
|
8680
|
+
if (!manualModel) {
|
|
8681
|
+
if (isReconfig && existingConfig.apiKey) {
|
|
8682
|
+
return { apiKey: existingConfig.apiKey, model: existingConfig.model, skipped: true };
|
|
8683
|
+
}
|
|
8684
|
+
return { skipped: true };
|
|
8685
|
+
}
|
|
8686
|
+
const modelError = validateModelName(manualModel);
|
|
8687
|
+
if (modelError) {
|
|
8688
|
+
console.log(chalk7.red(` ${modelError}`));
|
|
8689
|
+
continue;
|
|
8690
|
+
}
|
|
8691
|
+
return { apiKey: value, model: manualModel, skipped: false };
|
|
8669
8692
|
}
|
|
8670
8693
|
}
|
|
8671
8694
|
}
|
|
8672
|
-
async function promptOllamaLocalModelSelection(config) {
|
|
8695
|
+
async function promptOllamaLocalModelSelection(config, isReconfig) {
|
|
8673
8696
|
const existingConfig = config.providers.ollamaLocal;
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
existingConfig.baseUrl
|
|
8697
|
+
const baseUrlPrompt = isReconfig && existingConfig.baseUrl ? chalk7.white(` Ollama Local base URL [${existingConfig.baseUrl}]: `) : chalk7.white(' Ollama Local base URL (Enter to skip, or "none" to skip): ');
|
|
8698
|
+
const baseUrlInput = await ask(baseUrlPrompt);
|
|
8699
|
+
if (!baseUrlInput || baseUrlInput.toLowerCase() === "none") {
|
|
8700
|
+
if (isReconfig && existingConfig.baseUrl) {
|
|
8701
|
+
return { baseUrl: existingConfig.baseUrl, model: existingConfig.model, skipped: true };
|
|
8702
|
+
}
|
|
8703
|
+
return { skipped: true };
|
|
8704
|
+
}
|
|
8705
|
+
const baseUrlError = validateBaseUrl(baseUrlInput);
|
|
8706
|
+
if (baseUrlError) {
|
|
8707
|
+
console.log(chalk7.red(` ${baseUrlError}`));
|
|
8708
|
+
if (isReconfig && existingConfig.baseUrl) {
|
|
8709
|
+
return { baseUrl: existingConfig.baseUrl, model: existingConfig.model, skipped: true };
|
|
8710
|
+
}
|
|
8711
|
+
return { skipped: true };
|
|
8712
|
+
}
|
|
8713
|
+
const baseUrl = baseUrlInput;
|
|
8714
|
+
console.log(chalk7.dim(" Fetching Ollama Local models..."));
|
|
8715
|
+
try {
|
|
8716
|
+
const catalog = await fetchProviderModelCatalog("ollamaLocal", {
|
|
8717
|
+
...existingConfig,
|
|
8718
|
+
baseUrl
|
|
8719
|
+
});
|
|
8720
|
+
const model = await chooseProviderModel(
|
|
8721
|
+
"Ollama Local",
|
|
8722
|
+
catalog.recommendedModel,
|
|
8723
|
+
catalog.models
|
|
8679
8724
|
);
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
console.log(chalk7.red(` ${message}`));
|
|
8725
|
+
return { baseUrl, model, skipped: false };
|
|
8726
|
+
} catch (error) {
|
|
8727
|
+
const message = error instanceof ProviderModelFetchError ? error.message : "Mercury could not fetch Ollama Local models.";
|
|
8728
|
+
console.log(chalk7.yellow(` ${message}`));
|
|
8729
|
+
console.log(chalk7.dim(" Make sure Ollama is running locally, or enter the model name manually."));
|
|
8730
|
+
console.log(chalk7.dim(" You can run `mercury doctor` later to configure Ollama after starting it."));
|
|
8731
|
+
const manualModel = await ask(chalk7.white(` Ollama Local model name (Enter to skip Ollama Local for now): `));
|
|
8732
|
+
if (!manualModel) {
|
|
8733
|
+
return { skipped: true };
|
|
8734
|
+
}
|
|
8735
|
+
const modelError = validateModelName(manualModel);
|
|
8736
|
+
if (modelError) {
|
|
8737
|
+
console.log(chalk7.red(` ${modelError}`));
|
|
8738
|
+
return { skipped: true };
|
|
8695
8739
|
}
|
|
8740
|
+
return { baseUrl, model: manualModel, skipped: false };
|
|
8696
8741
|
}
|
|
8697
8742
|
}
|
|
8698
8743
|
async function promptOpenAICompatSetup(config, isReconfig) {
|
|
@@ -8866,7 +8911,8 @@ async function configure(existingConfig) {
|
|
|
8866
8911
|
if (isReconfig) {
|
|
8867
8912
|
console.log(chalk7.dim(" Choose which providers to configure now. Existing values are shown where available."));
|
|
8868
8913
|
} else {
|
|
8869
|
-
console.log(chalk7.dim(" Choose one or more providers.
|
|
8914
|
+
console.log(chalk7.dim(" Choose one or more providers. You can skip any provider by pressing Enter."));
|
|
8915
|
+
console.log(chalk7.dim(" Press Enter to configure DeepSeek by default (free at platform.deepseek.com)."));
|
|
8870
8916
|
}
|
|
8871
8917
|
console.log("");
|
|
8872
8918
|
while (true) {
|
|
@@ -8954,7 +9000,7 @@ async function configure(existingConfig) {
|
|
|
8954
9000
|
continue;
|
|
8955
9001
|
}
|
|
8956
9002
|
if (provider === "ollamaLocal") {
|
|
8957
|
-
const result = await promptOllamaLocalModelSelection(config);
|
|
9003
|
+
const result = await promptOllamaLocalModelSelection(config, isReconfig);
|
|
8958
9004
|
if (!result.skipped && result.baseUrl && result.model) {
|
|
8959
9005
|
config.providers.ollamaLocal.baseUrl = result.baseUrl;
|
|
8960
9006
|
config.providers.ollamaLocal.model = result.model;
|
|
@@ -9008,8 +9054,25 @@ async function configure(existingConfig) {
|
|
|
9008
9054
|
}
|
|
9009
9055
|
const configuredProviders = getConfiguredProviderNames(config);
|
|
9010
9056
|
if (configuredProviders.length === 0) {
|
|
9011
|
-
console.log(
|
|
9012
|
-
console.log(chalk7.
|
|
9057
|
+
console.log("");
|
|
9058
|
+
console.log(chalk7.yellow(" No LLM providers were configured."));
|
|
9059
|
+
console.log(chalk7.dim(" Mercury needs at least one provider to work."));
|
|
9060
|
+
console.log(chalk7.dim(" DeepSeek offers a free API key at platform.deepseek.com"));
|
|
9061
|
+
console.log("");
|
|
9062
|
+
console.log(chalk7.white(" Options:"));
|
|
9063
|
+
console.log(chalk7.white(" 1. Try again \u2014 choose a provider and enter an API key"));
|
|
9064
|
+
console.log(chalk7.white(" 2. Skip for now \u2014 you can run `mercury doctor` later"));
|
|
9065
|
+
console.log("");
|
|
9066
|
+
const skipChoice = await ask(chalk7.white(' Press Enter to try again, or type "skip" to exit setup: '));
|
|
9067
|
+
if (skipChoice.toLowerCase() === "skip") {
|
|
9068
|
+
saveConfig(config);
|
|
9069
|
+
const home2 = getMercuryHome();
|
|
9070
|
+
console.log("");
|
|
9071
|
+
console.log(chalk7.green(` \u2713 Config saved to ${home2}/mercury.yaml`));
|
|
9072
|
+
console.log(chalk7.yellow(" No providers configured yet. Run `mercury doctor` when ready."));
|
|
9073
|
+
console.log("");
|
|
9074
|
+
process.exit(0);
|
|
9075
|
+
}
|
|
9013
9076
|
console.log("");
|
|
9014
9077
|
continue;
|
|
9015
9078
|
}
|