mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-03 05:59:43 +02:00
fix: subagent description extraction for JSONL format
The JSONL files have message.content as a direct string, not an array of content blocks. Now handles both formats correctly. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+13
-4
@@ -504,11 +504,20 @@ export class SubagentWatcher extends EventEmitter {
|
||||
// Try each line until we find a user message with text
|
||||
for (const line of lines.slice(0, 5)) {
|
||||
try {
|
||||
const entry = JSON.parse(line) as SubagentTranscriptEntry;
|
||||
const entry = JSON.parse(line);
|
||||
if (entry.type === 'user' && entry.message?.content) {
|
||||
const firstContent = entry.message.content[0];
|
||||
if (firstContent?.type === 'text' && firstContent.text) {
|
||||
const text = firstContent.text.trim();
|
||||
// Handle both formats: content can be a string or an array of content blocks
|
||||
let text: string | undefined;
|
||||
if (typeof entry.message.content === 'string') {
|
||||
text = entry.message.content.trim();
|
||||
} else if (Array.isArray(entry.message.content)) {
|
||||
const firstContent = entry.message.content[0];
|
||||
if (firstContent?.type === 'text' && firstContent.text) {
|
||||
text = firstContent.text.trim();
|
||||
}
|
||||
}
|
||||
|
||||
if (text) {
|
||||
// Extract a useful title: first line, first sentence, or first 80 chars
|
||||
// Split on newline first
|
||||
const firstLine = text.split('\n')[0].trim();
|
||||
|
||||
Reference in New Issue
Block a user