@spexcode/transcript 0.7.0-next.2 → 0.7.0-next.3

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/parsers.js +16 -2
  2. package/package.json +1 -1
package/dist/parsers.js CHANGED
@@ -54,8 +54,22 @@ const lineCount = (value) => value ? value.split(/\r?\n/).length : 0;
54
54
  // --- the seven native shapes -------------------------------------------------------------------------------
55
55
  export function claudeEvent(value) {
56
56
  const entry = object(value);
57
- const message = object(entry?.message);
58
- if (!entry || !message)
57
+ if (!entry)
58
+ return null;
59
+ // A message steered into a RUNNING turn (stream-json `type:user` on stdin, a queued command in the TUI) is not
60
+ // recorded as a `user` message: Claude writes it as an `attachment` of type `queued_command` carrying the prompt
61
+ // blocks. It is the person's turn all the same, and the one place a steer becomes observable — hooks never fire
62
+ // for it — so the reader draws it as a user turn at the moment it entered the conversation.
63
+ if (entry.type === 'attachment') {
64
+ const attachment = object(entry.attachment);
65
+ const queuedAt = at(entry);
66
+ if (attachment?.type !== 'queued_command' || queuedAt === null)
67
+ return null;
68
+ const text = items(attachment.prompt).map((block) => string(object(block)?.text)).filter(Boolean).join('\n') || null;
69
+ return text ? { at: queuedAt, turn: { id: idOf(entry), at: queuedAt, role: 'user', text, tools: [] } } : null;
70
+ }
71
+ const message = object(entry.message);
72
+ if (!message)
59
73
  return null;
60
74
  const eventAt = at(entry) ?? at(message);
61
75
  if (eventAt === null)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spexcode/transcript",
3
- "version": "0.7.0-next.2",
3
+ "version": "0.7.0-next.3",
4
4
  "type": "module",
5
5
  "description": "Normalized agent transcripts: one parser per harness, a bounded interval reader over a native thread file or an in-memory event stream, and the full/delta frame protocol every transport and renderer share.",
6
6
  "files": [