Skip to content

[#86]: Add effort and terminalSequence fields for Claude Code v2.1.133+/v2.1.141+ compat#87

Merged
delexw merged 1 commit into
mainfrom
fix-issue-86
May 17, 2026
Merged

[#86]: Add effort and terminalSequence fields for Claude Code v2.1.133+/v2.1.141+ compat#87
delexw merged 1 commit into
mainfrom
fix-issue-86

Conversation

@delexw
Copy link
Copy Markdown
Owner

@delexw delexw commented May 16, 2026

Summary

Fixes #86 — Claude Code v2.1.133 and v2.1.141 introduced new fields in hook-related JSONL entries that the parser should handle explicitly.

Changes in Claude Code:

  • v2.1.133: Hook input JSON now includes effort: {level: "low"|"normal"|"high"} at the top level.
  • v2.1.141: Hook output entries may include terminalSequence at the top level (for desktop notifications, window titles, bells).

What changed

src-tauri/src/parser/entry.rs — two new fields added to the Entry struct:

// v2.1.133+: effort:{level} injected into hook input JSON
pub effort: Option<Value>,

// v2.1.141+: hooks may emit this to trigger desktop notifications/bells
pub terminal_sequence: Option<String>,

The parser already used serde defaults (no #[serde(deny_unknown_fields)] anywhere), so these fields were silently ignored before — no crash risk existed. This PR makes the capture explicit so callers can inspect the values.

Tests added (5 new)

  • parse_entry_captures_effort_field_v2_1_133 — verifies effort.level is captured from hook progress entries
  • parse_entry_effort_defaults_to_none_when_absent — pre-v2.1.133 entries have effort: None
  • parse_entry_captures_terminal_sequence_field_v2_1_141 — verifies terminalSequence is captured from hook output entries
  • parse_entry_terminal_sequence_defaults_to_none_when_absent — older hook entries have terminal_sequence: None
  • parse_entry_unknown_fields_are_silently_ignored — documents and verifies future unknown fields don't crash the parser

Verification

test result: ok. 386 passed; 0 failed (cargo test)
Test Files  27 passed (vitest)
Tests       352 passed (vitest)
cargo clippy -- -D warnings: no warnings

….1.141+ compat

Claude Code v2.1.133 injects effort:{level} into hook input JSON and v2.1.141
adds terminalSequence to hook output entries. Add both fields to the Entry
struct so they are captured rather than silently dropped. The parser already
uses serde defaults (no deny_unknown_fields), so no crash risk exists, but
explicit fields allow callers to inspect the values.

Add 5 new tests covering effort capture, terminalSequence capture, absent-field
defaults, and unknown-field resilience for future Claude Code versions.

Fixes #86
@delexw delexw merged commit 512f9e1 into main May 17, 2026
1 check passed
@delexw delexw deleted the fix-issue-86 branch May 17, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compat] Claude Code v2.1.133 + v2.1.141: New fields in hook JSON (effort.level, terminalSequence) may surface in JSONL hook/progress entries

1 participant