better-opencode-async-agents 0.4.0 → 0.4.1

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/index.js CHANGED
@@ -1116,7 +1116,9 @@ function showProgressToast(allTasks, animationFrame, client, getTasksArray) {
1116
1116
  const prevTools = tools.slice(0, -1);
1117
1117
  toolsStr = prevTools.length > 0 ? ` - ${prevTools.join(" > ")} > 「${lastTool}」` : ` - 「${lastTool}」`;
1118
1118
  }
1119
- taskLines.push(`${spinner} [${shortId(task.sessionID)}] ${task.agent}: ${task.description} (${duration})${toolsStr}`);
1119
+ const callCount = task.progress?.toolCalls ?? 0;
1120
+ const callsStr = callCount > 0 ? ` [${callCount} calls]` : "";
1121
+ taskLines.push(`${spinner} [${shortId(task.sessionID)}] ${task.agent}: ${task.description} (${duration})${toolsStr}${callsStr}`);
1120
1122
  }
1121
1123
  const batchCompleted = batchTasks.filter((t) => t.status === "completed" || t.status === "error" || t.status === "cancelled").sort((a, b) => {
1122
1124
  const aTime = a.completedAt ? new Date(a.completedAt).getTime() : 0;
@@ -1128,7 +1130,9 @@ function showProgressToast(allTasks, animationFrame, client, getTasksArray) {
1128
1130
  for (const task of visibleCompleted) {
1129
1131
  const duration = formatDuration2(new Date(task.startedAt), task.completedAt ? new Date(task.completedAt) : undefined);
1130
1132
  const icon = task.status === "completed" ? "✓" : task.status === "error" ? "✗" : "⊘";
1131
- taskLines.push(`${icon} [${shortId(task.sessionID)}] ${task.agent}: ${task.description} (${duration})`);
1133
+ const callCount = task.progress?.toolCalls ?? 0;
1134
+ const callsStr = callCount > 0 ? ` [${callCount} calls]` : "";
1135
+ taskLines.push(`${icon} [${shortId(task.sessionID)}] ${task.agent}: ${task.description} (${duration})${callsStr}`);
1132
1136
  }
1133
1137
  const hiddenCount = batchCompleted.length - visibleCompleted.length;
1134
1138
  if (hiddenCount > 0) {
@@ -2128,6 +2132,7 @@ function handleStats(_req, manager) {
2128
2132
  const byStatus = {};
2129
2133
  const byAgent = {};
2130
2134
  const toolCallsByName = {};
2135
+ const toolCallsByAgent = {};
2131
2136
  const durations = [];
2132
2137
  let activeTasks = 0;
2133
2138
  for (const task of tasks) {
@@ -2138,6 +2143,10 @@ function handleStats(_req, manager) {
2138
2143
  toolCallsByName[toolName] = (toolCallsByName[toolName] ?? 0) + count;
2139
2144
  }
2140
2145
  }
2146
+ const agentToolCalls = task.progress?.toolCalls ?? 0;
2147
+ if (agentToolCalls > 0) {
2148
+ toolCallsByAgent[task.agent] = (toolCallsByAgent[task.agent] ?? 0) + agentToolCalls;
2149
+ }
2141
2150
  if (task.status === "running" || task.status === "resumed") {
2142
2151
  activeTasks++;
2143
2152
  }
@@ -2151,6 +2160,7 @@ function handleStats(_req, manager) {
2151
2160
  byStatus,
2152
2161
  byAgent,
2153
2162
  toolCallsByName,
2163
+ toolCallsByAgent,
2154
2164
  duration: {
2155
2165
  avg: durations.length > 0 ? durations.reduce((a, b) => a + b, 0) / durations.length : 0,
2156
2166
  max: durations.length > 0 ? Math.max(...durations) : 0,
@@ -2235,6 +2245,7 @@ function handleTaskGroup(req, manager, groupId) {
2235
2245
  let cancelled = 0;
2236
2246
  let totalToolCalls = 0;
2237
2247
  const toolCallsByName = {};
2248
+ const toolCallsByAgent = {};
2238
2249
  let minStart = Number.POSITIVE_INFINITY;
2239
2250
  let maxEnd = 0;
2240
2251
  for (const t of groupTasks) {
@@ -2252,6 +2263,10 @@ function handleTaskGroup(req, manager, groupId) {
2252
2263
  toolCallsByName[toolName] = (toolCallsByName[toolName] ?? 0) + count;
2253
2264
  }
2254
2265
  }
2266
+ const agentToolCalls = t.progress?.toolCalls ?? 0;
2267
+ if (agentToolCalls > 0) {
2268
+ toolCallsByAgent[t.agent] = (toolCallsByAgent[t.agent] ?? 0) + agentToolCalls;
2269
+ }
2255
2270
  if (t.startedAt) {
2256
2271
  const s = new Date(t.startedAt).getTime();
2257
2272
  if (s < minStart)
@@ -2277,6 +2292,7 @@ function handleTaskGroup(req, manager, groupId) {
2277
2292
  completionRate: total > 0 ? completed / total : 0,
2278
2293
  totalToolCalls,
2279
2294
  toolCallsByName,
2295
+ toolCallsByAgent,
2280
2296
  duration
2281
2297
  }
2282
2298
  };
@@ -2470,6 +2486,7 @@ class StatusApiServer {
2470
2486
  const byStatus = {};
2471
2487
  const byAgent = {};
2472
2488
  const toolCallsByName = {};
2489
+ const toolCallsByAgent = {};
2473
2490
  const durations = [];
2474
2491
  let activeTasks = 0;
2475
2492
  for (const task of tasks) {
@@ -2480,6 +2497,10 @@ class StatusApiServer {
2480
2497
  toolCallsByName[toolName] = (toolCallsByName[toolName] ?? 0) + count;
2481
2498
  }
2482
2499
  }
2500
+ const agentToolCalls = task.progress?.toolCalls ?? 0;
2501
+ if (agentToolCalls > 0) {
2502
+ toolCallsByAgent[task.agent] = (toolCallsByAgent[task.agent] ?? 0) + agentToolCalls;
2503
+ }
2483
2504
  if (task.status === "running" || task.status === "resumed")
2484
2505
  activeTasks++;
2485
2506
  if (task.startedAt && task.completedAt) {
@@ -2492,6 +2513,7 @@ class StatusApiServer {
2492
2513
  byStatus,
2493
2514
  byAgent,
2494
2515
  toolCallsByName,
2516
+ toolCallsByAgent,
2495
2517
  duration: {
2496
2518
  avg: durations.length ? durations.reduce((a, b) => a + b, 0) / durations.length : 0,
2497
2519
  max: durations.length ? Math.max(...durations) : 0,
@@ -15154,5 +15176,5 @@ export {
15154
15176
  plugin as default
15155
15177
  };
15156
15178
 
15157
- //# debugId=C3296E4B18C7938B64756E2164756E21
15179
+ //# debugId=A899C06A316CFC2964756E2164756E21
15158
15180
  //# sourceMappingURL=index.js.map