opencode-terminal-progress 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/dist/index.js +14 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -23,9 +23,9 @@ function createOsc() {
23
23
  function toolProgress(messages) {
24
24
  let total = 0;
25
25
  let done = 0;
26
- for (const stats of messages.values()) {
27
- total += stats.total;
28
- done += stats.done;
26
+ for (const tracker of messages.values()) {
27
+ total += tracker.known.size;
28
+ done += tracker.done.size;
29
29
  }
30
30
  if (total === 0)
31
31
  return;
@@ -96,16 +96,19 @@ var TerminalProgressPlugin = async () => {
96
96
  const { part } = event.properties;
97
97
  if (part.type === "tool") {
98
98
  const tp = part;
99
- const key = tp.messageID;
100
- const stats = tools.get(key) ?? { total: 0, done: 0 };
101
- if (tp.state.status === "pending" || tp.state.status === "running") {
102
- if (tp.state.status === "pending") {
103
- stats.total++;
104
- }
99
+ const tracker = tools.get(tp.messageID) ?? {
100
+ known: new Set,
101
+ done: new Set
102
+ };
103
+ tracker.known.add(tp.callID);
104
+ if (tp.state.status === "completed" || tp.state.status === "error") {
105
+ tracker.done.add(tp.callID);
106
+ }
107
+ if (tracker.done.size === tracker.known.size) {
108
+ tools.delete(tp.messageID);
105
109
  } else {
106
- stats.done++;
110
+ tools.set(tp.messageID, tracker);
107
111
  }
108
- tools.set(key, stats);
109
112
  if (busy)
110
113
  showBusy();
111
114
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-terminal-progress",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "OpenCode plugin that shows agent progress in terminal tabs (iTerm2, WezTerm, Windows Terminal)",
5
5
  "author": {
6
6
  "name": "Pedro Pombeiro",