open-agents-ai 0.152.0 → 0.154.0

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/index.js +31 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -25117,6 +25117,15 @@ If you're stuck, try a completely different approach. Do NOT repeat what failed
25117
25117
  } else {
25118
25118
  compacted = await this.compactMessages(messages);
25119
25119
  }
25120
+ if (this.options.environmentProvider) {
25121
+ try {
25122
+ const envStr = this.options.environmentProvider();
25123
+ if (envStr) {
25124
+ compacted.push({ role: "system", content: envStr });
25125
+ }
25126
+ } catch {
25127
+ }
25128
+ }
25120
25129
  const { maxOutputTokens: effectiveMaxTokens } = this.contextLimits();
25121
25130
  const chatRequest = {
25122
25131
  messages: compacted,
@@ -55921,6 +55930,7 @@ var init_system_metrics = __esm({
55921
55930
  _latest = null;
55922
55931
  _intervalMs = 3e3;
55923
55932
  _collecting = false;
55933
+ _collectStartTime = 0;
55924
55934
  /** Current metrics snapshot (may be null before first poll) */
55925
55935
  get latest() {
55926
55936
  return this._latest;
@@ -55950,8 +55960,8 @@ var init_system_metrics = __esm({
55950
55960
  this.stop();
55951
55961
  this._source = "remote";
55952
55962
  this._callback = callback;
55953
- this._timer = setInterval(() => this._pollNetworkOnly(), this._intervalMs);
55954
- this._pollNetworkOnly();
55963
+ this._timer = setInterval(() => this._poll(), this._intervalMs);
55964
+ this._poll();
55955
55965
  }
55956
55966
  /**
55957
55967
  * Push hardware metrics received from a remote /expose provider.
@@ -55995,15 +56005,22 @@ var init_system_metrics = __esm({
55995
56005
  return this._timer !== null;
55996
56006
  }
55997
56007
  async _poll() {
55998
- if (this._collecting)
55999
- return;
56008
+ if (this._collecting) {
56009
+ if (this._collectStartTime && Date.now() - this._collectStartTime > this._intervalMs * 2) {
56010
+ this._collecting = false;
56011
+ } else {
56012
+ return;
56013
+ }
56014
+ }
56000
56015
  this._collecting = true;
56016
+ this._collectStartTime = Date.now();
56001
56017
  try {
56002
56018
  this._latest = await collectLocalMetrics();
56003
56019
  this._callback?.(this._latest);
56004
56020
  } catch {
56005
56021
  }
56006
56022
  this._collecting = false;
56023
+ this._collectStartTime = 0;
56007
56024
  }
56008
56025
  async _pollNetworkOnly() {
56009
56026
  try {
@@ -56919,7 +56936,7 @@ var init_status_bar = __esm({
56919
56936
  * Start collecting LOCAL system metrics (CPU/RAM/GPU + network I/O).
56920
56937
  * Called automatically on startup when endpoint is local.
56921
56938
  */
56922
- startLocalMetrics(intervalMs = 3e3) {
56939
+ startLocalMetrics(intervalMs = 2e3) {
56923
56940
  this._metricsCollector.startLocal((m) => {
56924
56941
  this._unifiedMetrics = m;
56925
56942
  if (this.active)
@@ -58890,11 +58907,13 @@ function startTask(task, config, repoRoot, voice, stream, taskStores, bruteForce
58890
58907
  const modelTier = getModelTier(config.model);
58891
58908
  const projectCtx = buildProjectContext(repoRoot, taskStores?.contextStores);
58892
58909
  let dynamicContext = formatContextForPrompt(projectCtx, modelTier);
58893
- try {
58894
- const snap = collectSnapshot(repoRoot);
58895
- dynamicContext += "\n\n" + formatSnapshotForContext(snap);
58896
- } catch {
58897
- }
58910
+ const environmentProvider = () => {
58911
+ try {
58912
+ return formatSnapshotForContext(collectSnapshot(repoRoot));
58913
+ } catch {
58914
+ return "";
58915
+ }
58916
+ };
58898
58917
  try {
58899
58918
  const { MemoryMetabolismTool: MemoryMetabolismTool2 } = __require("@open-agents/execution");
58900
58919
  const mm = new MemoryMetabolismTool2(repoRoot);
@@ -59089,7 +59108,8 @@ ${lines.join("\n")}
59089
59108
  contextWindowSize: contextWindowSize ?? 0,
59090
59109
  personality: personality ? getPreset(personality) : void 0,
59091
59110
  personalityName: personality ?? void 0,
59092
- identityInjection
59111
+ identityInjection,
59112
+ environmentProvider
59093
59113
  });
59094
59114
  runner.setWorkingDirectory(repoRoot);
59095
59115
  const tools = buildTools(repoRoot, config, contextWindowSize);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.152.0",
3
+ "version": "0.154.0",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",