open-agents-ai 0.34.4 → 0.34.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.
Files changed (2) hide show
  1. package/dist/index.js +107 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -12855,9 +12855,13 @@ ${tail}`;
12855
12855
  const combinedSummary = previousSummary ? this.progressiveSummarize(previousSummary, newSummary) : newSummary;
12856
12856
  const strategyLabel = strategy !== "default" ? ` (${strategy})` : "";
12857
12857
  const forceLabel = force ? " [manual]" : "";
12858
+ const preTokens = Math.ceil(totalChars / 4);
12859
+ const postChars = combinedSummary.length + recent.reduce((s, m) => s + (typeof m.content === "string" ? m.content.length : 100), 0) + head.reduce((s, m) => s + (typeof m.content === "string" ? m.content.length : 100), 0);
12860
+ const postTokens = Math.ceil(postChars / 4);
12861
+ const savedTokens = preTokens - postTokens;
12858
12862
  this.emit({
12859
12863
  type: "compaction",
12860
- content: `Compacted ${middle.length} messages${strategyLabel}${forceLabel}${previousSummary ? " (progressive)" : ""}`,
12864
+ content: `Compacted ${middle.length} messages${strategyLabel}${forceLabel}${previousSummary ? " (progressive)" : ""} | ~${preTokens.toLocaleString()} \u2192 ~${postTokens.toLocaleString()} tokens (saved ~${savedTokens.toLocaleString()})`,
12861
12865
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
12862
12866
  });
12863
12867
  const enrichments = [combinedSummary];
@@ -15505,6 +15509,12 @@ function renderWarning(message) {
15505
15509
  `);
15506
15510
  _contentWriteHook?.end();
15507
15511
  }
15512
+ function renderVerbose(message) {
15513
+ _contentWriteHook?.begin();
15514
+ process.stdout.write(`${c2.dim(` > ${message}`)}
15515
+ `);
15516
+ _contentWriteHook?.end();
15517
+ }
15508
15518
  function renderRichHeader(opts) {
15509
15519
  const w = getTermWidth();
15510
15520
  const divider = c2.dim("\u2500".repeat(Math.min(w - 4, 72)));
@@ -22024,7 +22034,7 @@ var init_braille_spinner = __esm({
22024
22034
  });
22025
22035
 
22026
22036
  // packages/cli/dist/tui/status-bar.js
22027
- var EXPERT_TOOL_BASELINES, CONTEXT_SWITCH_OVERHEAD, TURN_PLANNING_OVERHEAD, DEFAULT_TOOL_BASELINE, HumanSpeedTracker, StatusBar;
22037
+ var EXPERT_TOOL_BASELINES, CONTEXT_SWITCH_OVERHEAD, TURN_PLANNING_OVERHEAD, DEFAULT_TOOL_BASELINE, CODE_READ_CHARS_PER_SEC, PROSE_READ_CHARS_PER_SEC, MIN_CONTENT_FOR_READING, CODE_CONTENT_TOOLS, PROSE_CONTENT_TOOLS, HumanSpeedTracker, StatusBar;
22028
22038
  var init_status_bar = __esm({
22029
22039
  "packages/cli/dist/tui/status-bar.js"() {
22030
22040
  "use strict";
@@ -22080,6 +22090,40 @@ var init_status_bar = __esm({
22080
22090
  CONTEXT_SWITCH_OVERHEAD = 5;
22081
22091
  TURN_PLANNING_OVERHEAD = 15;
22082
22092
  DEFAULT_TOOL_BASELINE = 20;
22093
+ CODE_READ_CHARS_PER_SEC = 12.5;
22094
+ PROSE_READ_CHARS_PER_SEC = 20.8;
22095
+ MIN_CONTENT_FOR_READING = 100;
22096
+ CODE_CONTENT_TOOLS = /* @__PURE__ */ new Set([
22097
+ "file_read",
22098
+ "structured_read",
22099
+ "grep_search",
22100
+ "glob_find",
22101
+ "list_directory",
22102
+ "shell",
22103
+ "codebase_map",
22104
+ "git_info",
22105
+ "diagnostic",
22106
+ "task_output",
22107
+ "file_edit",
22108
+ "file_patch",
22109
+ "batch_edit",
22110
+ "file_write",
22111
+ "structured_file",
22112
+ "explore_tools"
22113
+ ]);
22114
+ PROSE_CONTENT_TOOLS = /* @__PURE__ */ new Set([
22115
+ "web_fetch",
22116
+ "web_search",
22117
+ "web_crawl",
22118
+ "memory_read",
22119
+ "memory_search",
22120
+ "pdf_to_text",
22121
+ "ocr",
22122
+ "ocr_pdf",
22123
+ "ocr_image_advanced",
22124
+ "transcribe_file",
22125
+ "transcribe_url"
22126
+ ]);
22083
22127
  HumanSpeedTracker = class {
22084
22128
  /** Accumulated estimated human-expert time in seconds */
22085
22129
  humanTimeS = 0;
@@ -22091,12 +22135,34 @@ var init_status_bar = __esm({
22091
22135
  toolCalls = 0;
22092
22136
  /** Number of turns in current session */
22093
22137
  turns = 0;
22138
+ /** Accumulated reading time in seconds (subset of humanTimeS) */
22139
+ readingTimeS = 0;
22094
22140
  /** Record a tool call — adds the expert baseline time */
22095
22141
  recordToolCall(toolName) {
22096
22142
  const baseline = EXPERT_TOOL_BASELINES[toolName] ?? DEFAULT_TOOL_BASELINE;
22097
22143
  this.humanTimeS += baseline + CONTEXT_SWITCH_OVERHEAD;
22098
22144
  this.toolCalls++;
22099
22145
  }
22146
+ /**
22147
+ * Record a tool result — adds human reading time based on content volume.
22148
+ * A human expert must read and comprehend tool output (file contents,
22149
+ * web pages, search results, etc.) before acting on it.
22150
+ */
22151
+ recordToolResult(toolName, contentLength) {
22152
+ if (contentLength < MIN_CONTENT_FOR_READING)
22153
+ return;
22154
+ let charsPerSec;
22155
+ if (CODE_CONTENT_TOOLS.has(toolName)) {
22156
+ charsPerSec = CODE_READ_CHARS_PER_SEC;
22157
+ } else if (PROSE_CONTENT_TOOLS.has(toolName)) {
22158
+ charsPerSec = PROSE_READ_CHARS_PER_SEC;
22159
+ } else {
22160
+ return;
22161
+ }
22162
+ const readSec = contentLength / charsPerSec;
22163
+ this.humanTimeS += readSec;
22164
+ this.readingTimeS += readSec;
22165
+ }
22100
22166
  /** Record a turn (assistant reasoning cycle) */
22101
22167
  recordTurn() {
22102
22168
  this.humanTimeS += TURN_PLANNING_OVERHEAD;
@@ -22275,6 +22341,10 @@ var init_status_bar = __esm({
22275
22341
  recordSpeedToolCall(toolName) {
22276
22342
  this._speedTracker.recordToolCall(toolName);
22277
22343
  }
22344
+ /** Record a tool result — adds human reading time based on content volume */
22345
+ recordSpeedToolResult(toolName, contentLength) {
22346
+ this._speedTracker.recordToolResult(toolName, contentLength);
22347
+ }
22278
22348
  /** Record a turn for speed ratio tracking */
22279
22349
  recordSpeedTurn() {
22280
22350
  this._speedTracker.recordTurn();
@@ -23098,6 +23168,8 @@ ${entry.fullContent}`
23098
23168
  const editSessionId = `task-${Date.now()}`;
23099
23169
  const editHistory = createEditHistoryLogger(repoRoot, editSessionId);
23100
23170
  let lastToolCall = null;
23171
+ let toolCallStartMs = 0;
23172
+ let streamStartMs = 0;
23101
23173
  const contentWrite = (fn) => {
23102
23174
  if (statusBar?.isActive) {
23103
23175
  statusBar.beginContentWrite();
@@ -23122,6 +23194,7 @@ ${entry.fullContent}`
23122
23194
  }
23123
23195
  lastToolCall = { name: event.toolName ?? "unknown", args: event.toolArgs ?? {} };
23124
23196
  statusBar?.recordSpeedToolCall(event.toolName ?? "unknown");
23197
+ toolCallStartMs = Date.now();
23125
23198
  statusBar?.setActiveTool(event.toolName ?? null);
23126
23199
  contentWrite(() => {
23127
23200
  if (voice?.enabled) {
@@ -23132,14 +23205,25 @@ ${entry.fullContent}`
23132
23205
  renderToolCallStart(event.toolName ?? "unknown", event.toolArgs ?? {});
23133
23206
  });
23134
23207
  break;
23135
- case "tool_result":
23208
+ case "tool_result": {
23136
23209
  if (lastToolCall) {
23137
23210
  editHistory.logToolCall(lastToolCall.name, lastToolCall.args, event.success ?? false);
23138
23211
  lastToolCall = null;
23139
23212
  }
23213
+ const resultLen = event.content?.length ?? 0;
23214
+ if (resultLen > 0) {
23215
+ statusBar?.recordSpeedToolResult(event.toolName ?? "unknown", resultLen);
23216
+ }
23140
23217
  statusBar?.setActiveTool(null);
23218
+ const toolDurationMs = toolCallStartMs > 0 ? Date.now() - toolCallStartMs : 0;
23219
+ toolCallStartMs = 0;
23141
23220
  contentWrite(() => {
23142
23221
  renderToolResult(event.toolName ?? "unknown", event.success ?? false, event.content ?? "");
23222
+ if (config.verbose && toolDurationMs > 0) {
23223
+ const durStr = toolDurationMs < 1e3 ? `${toolDurationMs}ms` : `${(toolDurationMs / 1e3).toFixed(1)}s`;
23224
+ const sizeStr = resultLen > 0 ? ` | ${resultLen.toLocaleString()} chars (~${Math.ceil(resultLen / 4).toLocaleString()} tokens)` : "";
23225
+ renderVerbose(`${event.toolName ?? "unknown"}: ${durStr}${sizeStr}`);
23226
+ }
23143
23227
  if (voice?.enabled && !(event.success ?? true)) {
23144
23228
  const desc = describeToolResult(event.toolName ?? "unknown", false);
23145
23229
  if (desc) {
@@ -23149,6 +23233,7 @@ ${entry.fullContent}`
23149
23233
  }
23150
23234
  });
23151
23235
  break;
23236
+ }
23152
23237
  case "model_response":
23153
23238
  statusBar?.recordSpeedTurn();
23154
23239
  if (config.verbose && !stream?.enabled && event.content) {
@@ -23156,11 +23241,15 @@ ${entry.fullContent}`
23156
23241
  }
23157
23242
  break;
23158
23243
  case "stream_start":
23244
+ streamStartMs = Date.now();
23159
23245
  if (stream?.enabled) {
23160
23246
  if (statusBar?.isActive)
23161
23247
  statusBar.beginContentWrite();
23162
23248
  stream.renderer.onStreamStart();
23163
23249
  }
23250
+ if (config.verbose) {
23251
+ contentWrite(() => renderVerbose(`Stream started (turn ${event.turn ?? "?"})`));
23252
+ }
23164
23253
  break;
23165
23254
  case "stream_token":
23166
23255
  if (stream?.enabled) {
@@ -23171,13 +23260,22 @@ ${entry.fullContent}`
23171
23260
  statusBar.incrementStreamingTokens(estimatedNewTokens);
23172
23261
  }
23173
23262
  break;
23174
- case "stream_end":
23263
+ case "stream_end": {
23264
+ const streamDurationMs = streamStartMs > 0 ? Date.now() - streamStartMs : 0;
23265
+ streamStartMs = 0;
23175
23266
  if (stream?.enabled) {
23176
23267
  stream.renderer.onStreamEnd();
23177
23268
  if (statusBar?.isActive)
23178
23269
  statusBar.endContentWrite();
23179
23270
  }
23271
+ if (config.verbose && streamDurationMs > 0) {
23272
+ const streamChars = event.content?.length ?? 0;
23273
+ const estTokens = Math.ceil(streamChars / 4);
23274
+ const tokPerSec = streamDurationMs > 0 ? (estTokens / (streamDurationMs / 1e3)).toFixed(1) : "?";
23275
+ contentWrite(() => renderVerbose(`Stream ended: ~${estTokens.toLocaleString()} tokens in ${(streamDurationMs / 1e3).toFixed(1)}s (${tokPerSec} tok/s)`));
23276
+ }
23180
23277
  break;
23278
+ }
23181
23279
  case "user_interrupt":
23182
23280
  break;
23183
23281
  case "compaction":
@@ -23199,6 +23297,11 @@ ${entry.fullContent}`
23199
23297
  estimatedCost: costTracker?.currentCost,
23200
23298
  hasPricing: costTracker?.hasPricing
23201
23299
  });
23300
+ if (config.verbose) {
23301
+ const tu = event.tokenUsage;
23302
+ const ctxPct = tu.estimatedContextTokens > 0 && statusBar ? ` (ctx: ~${tu.estimatedContextTokens.toLocaleString()} tokens)` : "";
23303
+ contentWrite(() => renderVerbose(`Tokens \u2014 prompt: ${tu.promptTokens.toLocaleString()} | completion: ${tu.completionTokens.toLocaleString()} | total: ${tu.totalTokens.toLocaleString()}${ctxPct}`));
23304
+ }
23202
23305
  }
23203
23306
  break;
23204
23307
  case "sudo_request":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.34.4",
3
+ "version": "0.34.5",
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",