@imdeadpool/guardex 7.0.18 → 7.0.19

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.
@@ -18,21 +18,29 @@ class RepoItem extends vscode.TreeItem {
18
18
  this.sessions = sessions;
19
19
  this.changes = changes;
20
20
  const descriptionParts = [`${sessions.length} active`];
21
+ const workingCount = countWorkingSessions(sessions);
22
+ if (workingCount > 0) {
23
+ descriptionParts.push(`${workingCount} working`);
24
+ }
21
25
  if (changes.length > 0) {
22
26
  descriptionParts.push(`${changes.length} changed`);
23
27
  }
24
28
  this.description = descriptionParts.join(' · ');
25
- this.tooltip = repoRoot;
29
+ this.tooltip = [
30
+ repoRoot,
31
+ this.description,
32
+ ].join('\n');
26
33
  this.iconPath = new vscode.ThemeIcon('repo');
27
34
  this.contextValue = 'gitguardex.repo';
28
35
  }
29
36
  }
30
37
 
31
38
  class SectionItem extends vscode.TreeItem {
32
- constructor(label, items) {
39
+ constructor(label, items, options = {}) {
33
40
  super(label, vscode.TreeItemCollapsibleState.Expanded);
34
41
  this.items = items;
35
- this.description = items.length > 0 ? String(items.length) : '';
42
+ this.description = options.description
43
+ || (items.length > 0 ? String(items.length) : '');
36
44
  this.contextValue = 'gitguardex.section';
37
45
  }
38
46
  }
@@ -58,7 +66,9 @@ class SessionItem extends vscode.TreeItem {
58
66
  session.worktreePath,
59
67
  ];
60
68
  this.tooltip = tooltipLines.filter(Boolean).join('\n');
61
- this.iconPath = new vscode.ThemeIcon('loading~spin');
69
+ this.iconPath = session.activityKind === 'working'
70
+ ? new vscode.ThemeIcon('edit')
71
+ : new vscode.ThemeIcon('loading~spin');
62
72
  this.contextValue = 'gitguardex.session';
63
73
  this.command = {
64
74
  command: 'gitguardex.activeAgents.openWorktree',
@@ -165,6 +175,29 @@ function buildChangeTreeNodes(changes) {
165
175
  return materialize(root);
166
176
  }
167
177
 
178
+ function countWorkingSessions(sessions) {
179
+ return sessions.filter((session) => session.activityKind === 'working').length;
180
+ }
181
+
182
+ function buildActiveAgentGroupNodes(sessions) {
183
+ const workingSessions = sessions
184
+ .filter((session) => session.activityKind === 'working')
185
+ .map((session) => new SessionItem(session));
186
+ const thinkingSessions = sessions
187
+ .filter((session) => session.activityKind !== 'working')
188
+ .map((session) => new SessionItem(session));
189
+ const groups = [];
190
+
191
+ if (workingSessions.length > 0) {
192
+ groups.push(new SectionItem('WORKING NOW', workingSessions));
193
+ }
194
+ if (thinkingSessions.length > 0) {
195
+ groups.push(new SectionItem('THINKING', thinkingSessions));
196
+ }
197
+
198
+ return groups;
199
+ }
200
+
168
201
  class ActiveAgentsProvider {
169
202
  constructor() {
170
203
  this.onDidChangeTreeDataEmitter = new vscode.EventEmitter();
@@ -178,10 +211,10 @@ class ActiveAgentsProvider {
178
211
 
179
212
  attachTreeView(treeView) {
180
213
  this.treeView = treeView;
181
- this.updateViewState(0);
214
+ this.updateViewState(0, 0);
182
215
  }
183
216
 
184
- updateViewState(sessionCount) {
217
+ updateViewState(sessionCount, workingCount) {
185
218
  if (!this.treeView) {
186
219
  return;
187
220
  }
@@ -189,7 +222,8 @@ class ActiveAgentsProvider {
189
222
  this.treeView.badge = sessionCount > 0
190
223
  ? {
191
224
  value: sessionCount,
192
- tooltip: `${sessionCount} active agent${sessionCount === 1 ? '' : 's'}`,
225
+ tooltip: `${sessionCount} active agent${sessionCount === 1 ? '' : 's'}`
226
+ + (workingCount > 0 ? ` · ${workingCount} working now` : ''),
193
227
  }
194
228
  : undefined;
195
229
  this.treeView.message = sessionCount > 0
@@ -204,7 +238,9 @@ class ActiveAgentsProvider {
204
238
  async getChildren(element) {
205
239
  if (element instanceof RepoItem) {
206
240
  const sectionItems = [
207
- new SectionItem('ACTIVE AGENTS', element.sessions.map((session) => new SessionItem(session))),
241
+ new SectionItem('ACTIVE AGENTS', buildActiveAgentGroupNodes(element.sessions), {
242
+ description: String(element.sessions.length),
243
+ }),
208
244
  ];
209
245
  if (element.changes.length > 0) {
210
246
  sectionItems.push(new SectionItem('CHANGES', buildChangeTreeNodes(element.changes)));
@@ -218,7 +254,11 @@ class ActiveAgentsProvider {
218
254
 
219
255
  const repoEntries = await this.loadRepoEntries();
220
256
  const sessionCount = repoEntries.reduce((total, entry) => total + entry.sessions.length, 0);
221
- this.updateViewState(sessionCount);
257
+ const workingCount = repoEntries.reduce(
258
+ (total, entry) => total + countWorkingSessions(entry.sessions),
259
+ 0,
260
+ );
261
+ this.updateViewState(sessionCount, workingCount);
222
262
 
223
263
  if (repoEntries.length === 0) {
224
264
  return [new InfoItem('No active Guardex agents', 'Open or start a sandbox session.')];