osagent 0.1.69 → 0.1.71
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 +72 -15
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -146462,6 +146462,20 @@ var init_qwenContentGenerator = __esm({
|
|
|
146462
146462
|
});
|
|
146463
146463
|
|
|
146464
146464
|
// packages/core/dist/src/core/contentGenerator.js
|
|
146465
|
+
function getEffectiveOllamaUrl2(includeV1 = true) {
|
|
146466
|
+
const ollamaHost = process.env["OLLAMA_HOST"];
|
|
146467
|
+
if (ollamaHost) {
|
|
146468
|
+
const url3 = ollamaHost.startsWith("http") ? ollamaHost : `http://${ollamaHost}`;
|
|
146469
|
+
const baseUrl = url3.replace(/\/$/, "");
|
|
146470
|
+
return includeV1 ? `${baseUrl}/v1` : baseUrl;
|
|
146471
|
+
}
|
|
146472
|
+
const ollamaBaseUrl = process.env["OLLAMA_BASE_URL"];
|
|
146473
|
+
if (ollamaBaseUrl) {
|
|
146474
|
+
const baseUrl = ollamaBaseUrl.replace(/\/v1\/?$/, "").replace(/\/$/, "");
|
|
146475
|
+
return includeV1 ? `${baseUrl}/v1` : baseUrl;
|
|
146476
|
+
}
|
|
146477
|
+
return includeV1 ? "http://localhost:11434/v1" : "http://localhost:11434";
|
|
146478
|
+
}
|
|
146465
146479
|
function createCleanConfigBase(config2, authType, generationConfig) {
|
|
146466
146480
|
return {
|
|
146467
146481
|
authType,
|
|
@@ -146537,7 +146551,8 @@ function createContentGeneratorConfig(config2, authType, generationConfig) {
|
|
|
146537
146551
|
return {
|
|
146538
146552
|
...baseConfig,
|
|
146539
146553
|
model: ollamaModel,
|
|
146540
|
-
baseUrl:
|
|
146554
|
+
baseUrl: getEffectiveOllamaUrl2(true),
|
|
146555
|
+
// Gets OLLAMA_HOST or defaults to localhost:11434/v1
|
|
146541
146556
|
apiKey: "ollama",
|
|
146542
146557
|
authType: AuthType2.OLLAMA_LOCAL,
|
|
146543
146558
|
// Ollama doesn't need special cache control handling
|
|
@@ -146572,7 +146587,7 @@ function createContentGeneratorConfig(config2, authType, generationConfig) {
|
|
|
146572
146587
|
};
|
|
146573
146588
|
}
|
|
146574
146589
|
async function createContentGenerator(config2, gcConfig, sessionId2, isInitialAuth) {
|
|
146575
|
-
const version3 = "0.1.
|
|
146590
|
+
const version3 = "0.1.71";
|
|
146576
146591
|
const userAgent2 = `OSAgent/${version3} (${process.platform}; ${process.arch})`;
|
|
146577
146592
|
const baseHeaders = {
|
|
146578
146593
|
"User-Agent": userAgent2
|
|
@@ -146647,6 +146662,7 @@ var init_contentGenerator = __esm({
|
|
|
146647
146662
|
init_models();
|
|
146648
146663
|
init_installationManager();
|
|
146649
146664
|
init_loggingContentGenerator();
|
|
146665
|
+
__name(getEffectiveOllamaUrl2, "getEffectiveOllamaUrl");
|
|
146650
146666
|
(function(AuthType4) {
|
|
146651
146667
|
AuthType4["LOGIN_WITH_OSAGENT"] = "oauth-personal";
|
|
146652
146668
|
AuthType4["USE_OSA"] = "OSA-api-key";
|
|
@@ -335704,7 +335720,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
335704
335720
|
// packages/cli/src/utils/version.ts
|
|
335705
335721
|
async function getCliVersion() {
|
|
335706
335722
|
const pkgJson = await getPackageJson();
|
|
335707
|
-
return "0.1.
|
|
335723
|
+
return "0.1.71";
|
|
335708
335724
|
}
|
|
335709
335725
|
__name(getCliVersion, "getCliVersion");
|
|
335710
335726
|
|
|
@@ -336153,16 +336169,34 @@ function checkOllamaInstalled() {
|
|
|
336153
336169
|
}
|
|
336154
336170
|
}
|
|
336155
336171
|
__name(checkOllamaInstalled, "checkOllamaInstalled");
|
|
336172
|
+
function getOllamaEndpoint() {
|
|
336173
|
+
const ollamaHost = process.env["OLLAMA_HOST"];
|
|
336174
|
+
if (ollamaHost) {
|
|
336175
|
+
const url3 = ollamaHost.startsWith("http") ? ollamaHost : `http://${ollamaHost}`;
|
|
336176
|
+
return { url: url3.replace(/\/$/, ""), source: "OLLAMA_HOST" };
|
|
336177
|
+
}
|
|
336178
|
+
const ollamaBaseUrl = process.env["OLLAMA_BASE_URL"];
|
|
336179
|
+
if (ollamaBaseUrl) {
|
|
336180
|
+
return { url: ollamaBaseUrl.replace(/\/v1\/?$/, "").replace(/\/$/, ""), source: "OLLAMA_BASE_URL" };
|
|
336181
|
+
}
|
|
336182
|
+
return { url: "http://localhost:11434", source: "default" };
|
|
336183
|
+
}
|
|
336184
|
+
__name(getOllamaEndpoint, "getOllamaEndpoint");
|
|
336156
336185
|
function checkOllamaRunning() {
|
|
336186
|
+
const { url: url3, source: source2 } = getOllamaEndpoint();
|
|
336187
|
+
const displayUrl = url3.replace("http://", "");
|
|
336188
|
+
const sourceNote = source2 !== "default" ? ` (from ${source2})` : "";
|
|
336157
336189
|
try {
|
|
336158
|
-
execSync4(
|
|
336159
|
-
return { name: "Ollama Server", status: "ok", message:
|
|
336190
|
+
execSync4(`curl -s ${url3}/api/tags`, { encoding: "utf-8", timeout: 5e3 });
|
|
336191
|
+
return { name: "Ollama Server", status: "ok", message: `running on ${displayUrl}${sourceNote}` };
|
|
336160
336192
|
} catch {
|
|
336193
|
+
const isWSL = process.platform === "linux" && __require("os").release().toLowerCase().includes("microsoft");
|
|
336194
|
+
const action = isWSL ? "WSL detected. Set OLLAMA_HOST=host.docker.internal:11434 or your Windows IP" : 'Run "ollama serve" to start the local server';
|
|
336161
336195
|
return {
|
|
336162
336196
|
name: "Ollama Server",
|
|
336163
336197
|
status: "warning",
|
|
336164
|
-
message:
|
|
336165
|
-
action
|
|
336198
|
+
message: `not reachable at ${displayUrl}`,
|
|
336199
|
+
action
|
|
336166
336200
|
};
|
|
336167
336201
|
}
|
|
336168
336202
|
}
|
|
@@ -339873,8 +339907,8 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
|
|
|
339873
339907
|
|
|
339874
339908
|
// packages/cli/src/generated/git-commit.ts
|
|
339875
339909
|
init_esbuild_shims();
|
|
339876
|
-
var GIT_COMMIT_INFO2 = "
|
|
339877
|
-
var CLI_VERSION2 = "0.1.
|
|
339910
|
+
var GIT_COMMIT_INFO2 = "3160e61";
|
|
339911
|
+
var CLI_VERSION2 = "0.1.71";
|
|
339878
339912
|
|
|
339879
339913
|
// packages/cli/src/utils/systemInfo.ts
|
|
339880
339914
|
async function getNpmVersion() {
|
|
@@ -341952,7 +341986,7 @@ function checkOllamaInstalled2() {
|
|
|
341952
341986
|
}
|
|
341953
341987
|
}
|
|
341954
341988
|
__name(checkOllamaInstalled2, "checkOllamaInstalled");
|
|
341955
|
-
function
|
|
341989
|
+
function getOllamaEndpoint2() {
|
|
341956
341990
|
const ollamaHost = process.env["OLLAMA_HOST"];
|
|
341957
341991
|
if (ollamaHost) {
|
|
341958
341992
|
const url3 = ollamaHost.startsWith("http") ? ollamaHost : `http://${ollamaHost}`;
|
|
@@ -341964,9 +341998,9 @@ function getOllamaEndpoint() {
|
|
|
341964
341998
|
}
|
|
341965
341999
|
return { url: "http://localhost:11434", source: "default" };
|
|
341966
342000
|
}
|
|
341967
|
-
__name(
|
|
342001
|
+
__name(getOllamaEndpoint2, "getOllamaEndpoint");
|
|
341968
342002
|
function checkOllamaRunning2() {
|
|
341969
|
-
const { url: primaryUrl, source: source2 } =
|
|
342003
|
+
const { url: primaryUrl, source: source2 } = getOllamaEndpoint2();
|
|
341970
342004
|
const endpoints = [
|
|
341971
342005
|
primaryUrl,
|
|
341972
342006
|
// WSL-specific fallbacks (only try if primary is localhost)
|
|
@@ -383510,6 +383544,20 @@ var useOSAAuth = /* @__PURE__ */ __name((pendingAuthType, isAuthenticating) => {
|
|
|
383510
383544
|
}, "useOSAAuth");
|
|
383511
383545
|
|
|
383512
383546
|
// packages/cli/src/ui/auth/useAuth.ts
|
|
383547
|
+
function getEffectiveOllamaLocalUrl() {
|
|
383548
|
+
const ollamaHost = process.env["OLLAMA_HOST"];
|
|
383549
|
+
if (ollamaHost) {
|
|
383550
|
+
const url3 = ollamaHost.startsWith("http") ? ollamaHost : `http://${ollamaHost}`;
|
|
383551
|
+
return `${url3.replace(/\/$/, "")}/v1`;
|
|
383552
|
+
}
|
|
383553
|
+
const ollamaBaseUrl = process.env["OLLAMA_BASE_URL"];
|
|
383554
|
+
if (ollamaBaseUrl) {
|
|
383555
|
+
const baseUrl = ollamaBaseUrl.replace(/\/v1\/?$/, "").replace(/\/$/, "");
|
|
383556
|
+
return `${baseUrl}/v1`;
|
|
383557
|
+
}
|
|
383558
|
+
return "http://localhost:11434/v1";
|
|
383559
|
+
}
|
|
383560
|
+
__name(getEffectiveOllamaLocalUrl, "getEffectiveOllamaLocalUrl");
|
|
383513
383561
|
var useAuthCommand = /* @__PURE__ */ __name((settings, config2, addItem) => {
|
|
383514
383562
|
const unAuthenticated = settings.merged.security?.auth?.selectedType === void 0;
|
|
383515
383563
|
const [authState, setAuthState] = (0, import_react112.useState)(
|
|
@@ -383648,7 +383696,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config2, addItem) => {
|
|
|
383648
383696
|
if (authType === AuthType2.OLLAMA_LOCAL) {
|
|
383649
383697
|
config2.updateCredentials({
|
|
383650
383698
|
apiKey: "ollama",
|
|
383651
|
-
baseUrl:
|
|
383699
|
+
baseUrl: getEffectiveOllamaLocalUrl(),
|
|
383652
383700
|
model: credentials?.model || "qwen2.5-coder:32b"
|
|
383653
383701
|
});
|
|
383654
383702
|
await performAuth(authType, scope, credentials);
|
|
@@ -393917,6 +393965,15 @@ __name(getUserStartupWarnings, "getUserStartupWarnings");
|
|
|
393917
393965
|
// packages/cli/src/validateNonInterActiveAuth.ts
|
|
393918
393966
|
init_esbuild_shims();
|
|
393919
393967
|
function getAuthTypeFromEnv() {
|
|
393968
|
+
if (process.env["GROQ_API_KEY"]) {
|
|
393969
|
+
return AuthType2.USE_GROQ;
|
|
393970
|
+
}
|
|
393971
|
+
if (process.env["OLLAMA_API_KEY"]) {
|
|
393972
|
+
return AuthType2.OLLAMA_CLOUD;
|
|
393973
|
+
}
|
|
393974
|
+
if (process.env["OLLAMA_HOST"] || process.env["OLLAMA_BASE_URL"]) {
|
|
393975
|
+
return AuthType2.OLLAMA_LOCAL;
|
|
393976
|
+
}
|
|
393920
393977
|
if (process.env["OPENAI_API_KEY"]) {
|
|
393921
393978
|
return AuthType2.USE_OPENAI;
|
|
393922
393979
|
}
|
|
@@ -395836,9 +395893,9 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
395836
395893
|
}
|
|
395837
395894
|
process.exit(0);
|
|
395838
395895
|
}
|
|
395839
|
-
const isInteractive = config2.isInteractive();
|
|
395840
395896
|
const consolePatcher = new ConsolePatcher({
|
|
395841
|
-
stderr:
|
|
395897
|
+
stderr: true,
|
|
395898
|
+
// Always use stderr for console.log/error/warn
|
|
395842
395899
|
debugMode: isDebugMode2
|
|
395843
395900
|
});
|
|
395844
395901
|
consolePatcher.patch();
|