osagent 0.1.19 → 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 +85 -9
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -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.19";
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
@@ -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.19";
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,
@@ -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");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "osagent",
3
- "version": "0.1.19",
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",