osagent 0.1.18 → 0.1.20

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/dist/cli.js +93 -17
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -142611,14 +142611,14 @@ var init_ollama = __esm({
142611
142611
  */
142612
142612
  static isOllamaProvider(config) {
142613
142613
  const baseUrl = config.baseUrl?.toLowerCase() || "";
142614
- return baseUrl.includes("osa.dev") || baseUrl.includes("ollama.com") || baseUrl.includes("localhost:11434") || baseUrl.includes("127.0.0.1:11434");
142614
+ return baseUrl.includes("ollama.com") || baseUrl.includes("localhost:11434") || baseUrl.includes("127.0.0.1:11434");
142615
142615
  }
142616
142616
  /**
142617
142617
  * Check if this is OS Agent Cloud (vs Local)
142618
142618
  */
142619
142619
  isCloud() {
142620
142620
  const baseUrl = this.contentGeneratorConfig.baseUrl?.toLowerCase() || "";
142621
- return baseUrl.includes("osa.dev") || baseUrl.includes("ollama.com");
142621
+ return baseUrl.includes("ollama.com");
142622
142622
  }
142623
142623
  buildHeaders() {
142624
142624
  const version2 = this.cliConfig.getCliVersion() || "unknown";
@@ -146088,7 +146088,7 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
146088
146088
  return {
146089
146089
  ...newContentGeneratorConfig,
146090
146090
  model: newContentGeneratorConfig?.model || DEFAULT_OLLAMA_CODER_MODEL,
146091
- baseUrl: newContentGeneratorConfig?.baseUrl || "https://osa.dev",
146091
+ baseUrl: newContentGeneratorConfig?.baseUrl || "https://api.ollama.com",
146092
146092
  // API key from OLLAMA_API_KEY env var or settings
146093
146093
  apiKey: newContentGeneratorConfig?.apiKey || process.env["OLLAMA_API_KEY"]
146094
146094
  };
@@ -146108,7 +146108,7 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
146108
146108
  };
146109
146109
  }
146110
146110
  async function createContentGenerator(config, gcConfig, sessionId2, isInitialAuth) {
146111
- const version2 = "0.1.18";
146111
+ const version2 = "0.1.20";
146112
146112
  const userAgent2 = `OSAgent/${version2} (${process.platform}; ${process.arch})`;
146113
146113
  const baseHeaders = {
146114
146114
  "User-Agent": userAgent2
@@ -303788,7 +303788,7 @@ function validateAuthMethod(authMethod, mergedSettings) {
303788
303788
  if (authMethod === AuthType2.OLLAMA_CLOUD) {
303789
303789
  const hasApiKey = process.env["OLLAMA_API_KEY"] || settings.merged.security?.auth?.apiKey;
303790
303790
  if (!hasApiKey) {
303791
- return "OLLAMA_API_KEY environment variable not found. Get your API key at https://osa.dev";
303791
+ return "OLLAMA_API_KEY environment variable not found. Get your API key at https://ollama.com/settings/keys";
303792
303792
  }
303793
303793
  return null;
303794
303794
  }
@@ -309699,7 +309699,7 @@ __name(getPackageJson, "getPackageJson");
309699
309699
  // packages/cli/src/utils/version.ts
309700
309700
  async function getCliVersion() {
309701
309701
  const pkgJson = await getPackageJson();
309702
- return "0.1.18";
309702
+ return "0.1.20";
309703
309703
  }
309704
309704
  __name(getCliVersion, "getCliVersion");
309705
309705
 
@@ -314633,6 +314633,81 @@ Use /consult for help.`)
314633
314633
  }, "action")
314634
314634
  };
314635
314635
 
314636
+ // packages/cli/src/ui/commands/contextCommand.ts
314637
+ init_esbuild_shims();
314638
+ var formatTokens = /* @__PURE__ */ __name((count) => {
314639
+ if (count >= 1e6) {
314640
+ return `${(count / 1e6).toFixed(1)}M`;
314641
+ }
314642
+ if (count >= 1e3) {
314643
+ return `${Math.round(count / 1e3)}K`;
314644
+ }
314645
+ return String(count);
314646
+ }, "formatTokens");
314647
+ var generateProgressBar = /* @__PURE__ */ __name((percentage, width) => {
314648
+ const filled = Math.round(percentage * width);
314649
+ const empty = width - filled;
314650
+ return "\u2588".repeat(filled) + "\u2591".repeat(empty);
314651
+ }, "generateProgressBar");
314652
+ var contextCommand = {
314653
+ name: "context",
314654
+ altNames: ["ctx", "tokens"],
314655
+ get description() {
314656
+ return t2("Show current context window usage and token statistics");
314657
+ },
314658
+ kind: "built-in" /* BUILT_IN */,
314659
+ action: /* @__PURE__ */ __name((context2) => {
314660
+ const { metrics: metrics2, lastPromptTokenCount } = context2.session.stats;
314661
+ const model = context2.services.config?.getModel() || "unknown";
314662
+ const limit2 = tokenLimit(model);
314663
+ const percentage = lastPromptTokenCount / limit2;
314664
+ const percentUsed = (percentage * 100).toFixed(1);
314665
+ let totalPromptTokens = 0;
314666
+ let totalCandidateTokens = 0;
314667
+ let totalCachedTokens = 0;
314668
+ let totalThoughtTokens = 0;
314669
+ let totalToolTokens = 0;
314670
+ let totalRequests = 0;
314671
+ let totalLatency = 0;
314672
+ for (const modelMetrics of Object.values(metrics2.models)) {
314673
+ totalPromptTokens += modelMetrics.tokens.prompt;
314674
+ totalCandidateTokens += modelMetrics.tokens.candidates;
314675
+ totalCachedTokens += modelMetrics.tokens.cached;
314676
+ totalThoughtTokens += modelMetrics.tokens.thoughts;
314677
+ totalToolTokens += modelMetrics.tokens.tool;
314678
+ totalRequests += modelMetrics.api.totalRequests;
314679
+ totalLatency += modelMetrics.api.totalLatencyMs;
314680
+ }
314681
+ const avgLatency = totalRequests > 0 ? Math.round(totalLatency / totalRequests) : 0;
314682
+ const cacheRate = totalPromptTokens > 0 ? (totalCachedTokens / totalPromptTokens * 100).toFixed(1) : "0";
314683
+ const barWidth = 20;
314684
+ const progressBar = generateProgressBar(percentage, barWidth);
314685
+ const lines = [
314686
+ `\u250C\u2500 Context Window \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510`,
314687
+ `\u2502 Model: ${model.padEnd(38)}\u2502`,
314688
+ `\u2502 Usage: [${progressBar}] ${percentUsed.padStart(5)}% \u2502`,
314689
+ `\u2502 Tokens: ${formatTokens(lastPromptTokenCount).padStart(6)} / ${formatTokens(limit2).padEnd(26)}\u2502`,
314690
+ `\u251C\u2500 Session Statistics \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524`,
314691
+ `\u2502 Total Prompt Tokens: ${formatTokens(totalPromptTokens).padStart(20)}\u2502`,
314692
+ `\u2502 Total Response Tokens: ${formatTokens(totalCandidateTokens).padStart(20)}\u2502`,
314693
+ `\u2502 Cached Tokens: ${formatTokens(totalCachedTokens).padStart(17)} (${cacheRate}%)\u2502`,
314694
+ `\u2502 Thinking Tokens: ${formatTokens(totalThoughtTokens).padStart(20)}\u2502`,
314695
+ `\u2502 Tool Tokens: ${formatTokens(totalToolTokens).padStart(20)}\u2502`,
314696
+ `\u251C\u2500 API Statistics \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524`,
314697
+ `\u2502 Total Requests: ${String(totalRequests).padStart(20)}\u2502`,
314698
+ `\u2502 Avg Latency: ${String(avgLatency).padStart(17)} ms\u2502`,
314699
+ `\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518`
314700
+ ];
314701
+ context2.ui.addItem(
314702
+ {
314703
+ type: "info" /* INFO */,
314704
+ text: lines.join("\n")
314705
+ },
314706
+ Date.now()
314707
+ );
314708
+ }, "action")
314709
+ };
314710
+
314636
314711
  // packages/cli/src/ui/commands/continueCommand.ts
314637
314712
  init_esbuild_shims();
314638
314713
  import * as fs72 from "node:fs/promises";
@@ -319191,6 +319266,7 @@ var BuiltinCommandLoader = class {
319191
319266
  clearCommand,
319192
319267
  compressCommand,
319193
319268
  consultCommand,
319269
+ contextCommand,
319194
319270
  continueCommand,
319195
319271
  openaiProfileCommand,
319196
319272
  copyCommand,
@@ -350392,7 +350468,7 @@ var DialogManager = /* @__PURE__ */ __name(({
350392
350468
  onSubmit: (apiKey, baseUrl, model) => {
350393
350469
  uiActions.handleAuthSelect(AuthType2.OLLAMA_CLOUD, "User" /* User */, {
350394
350470
  apiKey,
350395
- baseUrl: baseUrl || "https://osa.dev",
350471
+ baseUrl: baseUrl || "https://api.ollama.com",
350396
350472
  model: model || "qwen3-coder:480b-cloud"
350397
350473
  });
350398
350474
  },
@@ -350401,10 +350477,10 @@ var DialogManager = /* @__PURE__ */ __name(({
350401
350477
  uiActions.setAuthState("updating" /* Updating */);
350402
350478
  },
350403
350479
  defaultApiKey: fromSettings?.apiKey || process34.env["OLLAMA_API_KEY"] || "",
350404
- defaultBaseUrl: fromSettings?.baseUrl || "https://osa.dev",
350480
+ defaultBaseUrl: fromSettings?.baseUrl || "https://api.ollama.com",
350405
350481
  defaultModel: modelSettings?.name || "qwen3-coder:480b-cloud",
350406
350482
  providerName: "Ollama Cloud",
350407
- apiKeyUrl: "https://osa.dev/settings/keys"
350483
+ apiKeyUrl: "https://ollama.com/settings/keys"
350408
350484
  }
350409
350485
  );
350410
350486
  }
@@ -352885,7 +352961,7 @@ var MemoryUsageDisplay = /* @__PURE__ */ __name(() => {
352885
352961
  // packages/cli/src/ui/components/ContextUsageDisplay.tsx
352886
352962
  init_esbuild_shims();
352887
352963
  var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1);
352888
- var formatTokens = /* @__PURE__ */ __name((count) => {
352964
+ var formatTokens2 = /* @__PURE__ */ __name((count) => {
352889
352965
  if (count >= 1e6) {
352890
352966
  return `${(count / 1e6).toFixed(1)}M`;
352891
352967
  }
@@ -352894,7 +352970,7 @@ var formatTokens = /* @__PURE__ */ __name((count) => {
352894
352970
  }
352895
352971
  return String(count);
352896
352972
  }, "formatTokens");
352897
- var generateProgressBar = /* @__PURE__ */ __name((percentage, width) => {
352973
+ var generateProgressBar2 = /* @__PURE__ */ __name((percentage, width) => {
352898
352974
  const filled = Math.round(percentage * width);
352899
352975
  const empty = width - filled;
352900
352976
  return "\u2588".repeat(filled) + "\u2591".repeat(empty);
@@ -352929,15 +353005,15 @@ var ContextUsageDisplay = /* @__PURE__ */ __name(({
352929
353005
  /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text3, { color: theme.text.secondary, children: [
352930
353006
  " ",
352931
353007
  "(",
352932
- formatTokens(promptTokenCount),
353008
+ formatTokens2(promptTokenCount),
352933
353009
  "/",
352934
- formatTokens(limit2),
353010
+ formatTokens2(limit2),
352935
353011
  ")"
352936
353012
  ] })
352937
353013
  ] });
352938
353014
  }
352939
353015
  const barWidth = 10;
352940
- const progressBar = generateProgressBar(percentage, barWidth);
353016
+ const progressBar = generateProgressBar2(percentage, barWidth);
352941
353017
  return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text3, { children: [
352942
353018
  /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text3, { color: usageColor, children: [
352943
353019
  "[",
@@ -352946,9 +353022,9 @@ var ContextUsageDisplay = /* @__PURE__ */ __name(({
352946
353022
  ] }),
352947
353023
  /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text3, { color: theme.text.secondary, children: [
352948
353024
  " ",
352949
- formatTokens(promptTokenCount),
353025
+ formatTokens2(promptTokenCount),
352950
353026
  "/",
352951
- formatTokens(limit2)
353027
+ formatTokens2(limit2)
352952
353028
  ] })
352953
353029
  ] });
352954
353030
  }, "ContextUsageDisplay");
@@ -353750,7 +353826,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
353750
353826
  if (credentials) {
353751
353827
  config.updateCredentials({
353752
353828
  apiKey: credentials.apiKey,
353753
- baseUrl: credentials.baseUrl || "https://osa.dev",
353829
+ baseUrl: credentials.baseUrl || "https://api.ollama.com",
353754
353830
  model: credentials.model || "qwen3-coder:480b-cloud"
353755
353831
  });
353756
353832
  await performAuth(authType, scope, credentials);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "osagent",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "OS Agent - AI-powered CLI for autonomous coding with Ollama Cloud and Qwen models",
5
5
  "author": "Roberto Luna",
6
6
  "license": "Apache-2.0",