claude-code-kanban 2.2.0-rc.9 → 2.2.0
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/lib/parsers.js +50 -2
- package/package.json +1 -1
- package/public/app.js +498 -149
- package/public/index.html +11 -5
- package/public/style.css +96 -4
- package/server.js +30 -13
package/lib/parsers.js
CHANGED
|
@@ -227,6 +227,8 @@ function getSystemMessageLabel(text) {
|
|
|
227
227
|
if (text.includes('<local-command-caveat>')) return 'System notification';
|
|
228
228
|
if (text.includes('.output completed') && text.includes('Background command')) return 'Background task completed';
|
|
229
229
|
if (text.startsWith('This session is being continued from a previous conversation')) return '__skip__';
|
|
230
|
+
if (text.includes('<command-name>/clear</command-name>')) return '__skip__';
|
|
231
|
+
if (text.includes('<command-name>/compact</command-name>')) return 'Compacted';
|
|
230
232
|
return null;
|
|
231
233
|
}
|
|
232
234
|
|
|
@@ -239,9 +241,10 @@ function readRecentMessages(jsonlPath, limit = 10) {
|
|
|
239
241
|
const toolResults = new Map();
|
|
240
242
|
let readSize = Math.min(65536, stat.size);
|
|
241
243
|
|
|
242
|
-
while (messages.length < limit
|
|
244
|
+
while (messages.length < limit) {
|
|
245
|
+
readSize = Math.min(readSize, stat.size);
|
|
243
246
|
const start = Math.max(0, stat.size - readSize);
|
|
244
|
-
const bufSize =
|
|
247
|
+
const bufSize = readSize;
|
|
245
248
|
const buf = Buffer.alloc(bufSize);
|
|
246
249
|
require('fs').readSync(fd, buf, 0, bufSize, start);
|
|
247
250
|
|
|
@@ -491,6 +494,11 @@ function readRecentMessages(jsonlPath, limit = 10) {
|
|
|
491
494
|
require('fs').closeSync(fd);
|
|
492
495
|
fd = null;
|
|
493
496
|
messages.sort((a, b) => (a.timestamp || '').localeCompare(b.timestamp || ''));
|
|
497
|
+
for (let i = messages.length - 1; i > 0; i--) {
|
|
498
|
+
if (messages[i].systemLabel === 'Compacted' && messages[i - 1].systemLabel === 'Compacted') {
|
|
499
|
+
messages.splice(i, 1);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
494
502
|
return messages.slice(-limit);
|
|
495
503
|
} catch (e) {
|
|
496
504
|
if (fd) try { require('fs').closeSync(fd); } catch (_) {}
|
|
@@ -498,6 +506,29 @@ function readRecentMessages(jsonlPath, limit = 10) {
|
|
|
498
506
|
}
|
|
499
507
|
}
|
|
500
508
|
|
|
509
|
+
function readMessagesPage(jsonlPath, limit = 10, beforeTimestamp = null) {
|
|
510
|
+
const fetchLimit = limit + 1;
|
|
511
|
+
const applyFilter = beforeTimestamp
|
|
512
|
+
? (msgs) => msgs.filter((m) => m.timestamp && m.timestamp < beforeTimestamp)
|
|
513
|
+
: (msgs) => msgs;
|
|
514
|
+
let readLimit = Math.max(fetchLimit * 5, 200);
|
|
515
|
+
let allMessages = readRecentMessages(jsonlPath, readLimit);
|
|
516
|
+
let filtered = applyFilter(allMessages);
|
|
517
|
+
|
|
518
|
+
while (filtered.length < fetchLimit && allMessages.length === readLimit && readLimit < 10000) {
|
|
519
|
+
readLimit *= 4;
|
|
520
|
+
allMessages = readRecentMessages(jsonlPath, readLimit);
|
|
521
|
+
filtered = applyFilter(allMessages);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
const page = filtered.slice(-fetchLimit);
|
|
525
|
+
const hasMore = page.length > limit;
|
|
526
|
+
return {
|
|
527
|
+
messages: hasMore ? page.slice(1) : page,
|
|
528
|
+
hasMore
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
|
|
501
532
|
function buildAgentProgressMap(jsonlPath) {
|
|
502
533
|
const map = {};
|
|
503
534
|
try {
|
|
@@ -509,6 +540,7 @@ function buildAgentProgressMap(jsonlPath) {
|
|
|
509
540
|
const bgAgentIdRe = /agentId: ([a-zA-Z0-9_@-]+)/;
|
|
510
541
|
const tmToolIdRe = /"tool_use_id":"([^"]+)"/;
|
|
511
542
|
const tmAgentIdRe = /agent_id: ([a-zA-Z0-9_@-]+)/;
|
|
543
|
+
const nameByToolUseId = {};
|
|
512
544
|
for (const line of content.split('\n')) {
|
|
513
545
|
if (line.includes('"agent_progress"')) {
|
|
514
546
|
const agentMatch = re.exec(line);
|
|
@@ -536,8 +568,23 @@ function buildAgentProgressMap(jsonlPath) {
|
|
|
536
568
|
if (toolIdMatch && agentMatch && !map[toolIdMatch[1]]) {
|
|
537
569
|
map[toolIdMatch[1]] = { agentId: agentMatch[1], prompt: null };
|
|
538
570
|
}
|
|
571
|
+
} else if (line.includes('"assistant"') && line.includes('"tool_use"') && line.includes('"Agent"')) {
|
|
572
|
+
try {
|
|
573
|
+
const obj = JSON.parse(line);
|
|
574
|
+
const blocks = obj.message?.content;
|
|
575
|
+
if (Array.isArray(blocks)) {
|
|
576
|
+
for (const b of blocks) {
|
|
577
|
+
if (b.type === 'tool_use' && b.name === 'Agent' && b.id && b.input?.name) {
|
|
578
|
+
nameByToolUseId[b.id] = b.input.name;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
} catch (_) {}
|
|
539
583
|
}
|
|
540
584
|
}
|
|
585
|
+
for (const [key, entry] of Object.entries(map)) {
|
|
586
|
+
if (nameByToolUseId[key]) entry.name = nameByToolUseId[key];
|
|
587
|
+
}
|
|
541
588
|
} catch (_) {}
|
|
542
589
|
return map;
|
|
543
590
|
}
|
|
@@ -657,6 +704,7 @@ module.exports = {
|
|
|
657
704
|
parseJsonlLine,
|
|
658
705
|
readSessionInfoFromJsonl,
|
|
659
706
|
readRecentMessages,
|
|
707
|
+
readMessagesPage,
|
|
660
708
|
buildAgentProgressMap,
|
|
661
709
|
readCompactSummaries,
|
|
662
710
|
findTerminatedTeammates,
|