agent-teams-dashboard 0.3.1 → 0.3.2

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.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Agent Teams Dashboard</title>
7
- <script type="module" crossorigin src="/assets/index-B8t0Tabx.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-CEXrdfKk.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-CsK61Xi-.css">
9
9
  </head>
10
10
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-teams-dashboard",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Real-time monitoring dashboard for Claude Code agent teams",
5
5
  "type": "module",
6
6
  "author": "pingshian0131",
@@ -1,4 +1,4 @@
1
- import { readdir, readFile, stat } from 'node:fs/promises';
1
+ import { readdir, readFile, stat, open } from 'node:fs/promises';
2
2
  import { join } from 'node:path';
3
3
  import { homedir } from 'node:os';
4
4
  import { EventEmitter } from 'node:events';
@@ -175,26 +175,52 @@ async function readNewEntries(filePath, isSessionFile, projectDir) {
175
175
  const fileSize = fileStat.size;
176
176
  if (fileSize <= currentOffset)
177
177
  return;
178
- const raw = await safeReadFile(filePath);
179
- if (!raw)
178
+ // Read only the new bytes from currentOffset to avoid byte/char offset mismatch
179
+ let newContent;
180
+ try {
181
+ const fh = await open(filePath, 'r');
182
+ try {
183
+ const buf = Buffer.alloc(fileSize - currentOffset);
184
+ await fh.read(buf, 0, buf.length, currentOffset);
185
+ newContent = buf.toString('utf-8');
186
+ }
187
+ finally {
188
+ await fh.close();
189
+ }
190
+ }
191
+ catch {
180
192
  return;
181
- const newContent = raw.slice(currentOffset);
193
+ }
182
194
  agentOffsets.set(filePath, fileSize);
183
195
  const lines = newContent.split('\n').filter(Boolean);
184
196
  for (const line of lines) {
185
197
  try {
186
198
  const parsed = JSON.parse(line);
187
- // For session files, only process entries that belong to a team
199
+ // For session files, process team entries AND regular conversation entries
188
200
  if (isSessionFile) {
189
201
  const teamName = parsed.teamName;
190
- if (!teamName)
202
+ // Skip non-message entries (file-history-snapshot, progress, queue-operation, system)
203
+ if (!parsed.type || (parsed.type !== 'user' && parsed.type !== 'assistant'))
191
204
  continue;
192
- const agentName = parsed.agentName || 'team-lead';
193
- // Use team agentId format: name@team
194
- const fullAgentId = `${agentName}@${teamName}`;
205
+ let fullAgentId;
206
+ let slug;
207
+ if (teamName) {
208
+ // Team session: use name@team format
209
+ const agentName = parsed.agentName || 'team-lead';
210
+ fullAgentId = `${agentName}@${teamName}`;
211
+ slug = agentName;
212
+ }
213
+ else {
214
+ // Regular conversation: use sessionId as agentId
215
+ const sessionId = parsed.sessionId ?? '';
216
+ if (!sessionId)
217
+ continue;
218
+ fullAgentId = `session:${sessionId}`;
219
+ slug = parsed.slug || sessionId.slice(0, 8);
220
+ }
195
221
  const entry = {
196
222
  agentId: fullAgentId,
197
- slug: agentName,
223
+ slug,
198
224
  sessionId: parsed.sessionId ?? '',
199
225
  type: parsed.type ?? 'assistant',
200
226
  message: {
@@ -218,6 +244,12 @@ async function readNewEntries(filePath, isSessionFile, projectDir) {
218
244
  if (arr.length > MAX_ENTRIES_PER_AGENT) {
219
245
  arr.splice(0, arr.length - MAX_ENTRIES_PER_AGENT);
220
246
  }
247
+ // Update slug from assistant entries (they carry the slug)
248
+ if (parsed.slug && arr.length > 0) {
249
+ for (const e of arr) {
250
+ e.slug = parsed.slug;
251
+ }
252
+ }
221
253
  continue;
222
254
  }
223
255
  // Subagent JSONL: use agentId from the file