Skip to content

feat(eve): cover the full eve 0.30 event surface - #501

Merged
HugoRCD merged 5 commits into
mainfrom
evl-216
Aug 6, 2026
Merged

feat(eve): cover the full eve 0.30 event surface#501
HugoRCD merged 5 commits into
mainfrom
evl-216

Conversation

@HugoRCD

@HugoRCD HugoRCD commented Aug 5, 2026

Copy link
Copy Markdown
Owner

🔗 Linked issue

📚 Description

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Summary by CodeRabbit

  • New Features

    • Added support for Eve 0.30.
    • Expanded event tracking for authorization, failures, cancellations, compaction, context clearing, subagents, and session lifecycle activity.
    • Added configurable message capture modes: omitted, preview, or full, with attachment summaries and preview limits.
    • Added runtime-reported cost tracking and optional session-level rollups.
    • Added improved runtime and session lineage details.
  • Documentation

    • Documented new event fields, message options, cost behavior, and session rollups.

@HugoRCD HugoRCD self-assigned this Aug 5, 2026
@changeset-bot

changeset-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 351f6f0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
evlog Minor
@evlog/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
evi Ready Ready Preview Aug 6, 2026 8:18am
evlog-docs Ready Ready Preview, v0 Aug 6, 2026 8:18am
evlog-render-lab Ready Ready Preview Aug 6, 2026 8:18am
evlog-telemetry Ready Ready Preview Aug 6, 2026 8:18am
just-use-evlog Ready Ready Preview Aug 6, 2026 8:18am

Request Review

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@HugoRCD, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 15 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 35edff6f-5803-486d-946d-b7afb10342fc

📥 Commits

Reviewing files that changed from the base of the PR and between 3f28ab4 and 351f6f0.

📒 Files selected for processing (1)
  • .changeset/eve-030-event-surface.md
📝 Walkthrough

Walkthrough

The Eve integration now targets Eve 0.30, captures expanded turn and session metadata, supports configurable message modes, tracks lifecycle events and costs, and optionally emits session rollups.

Changes

Eve event lifecycle

Layer / File(s) Summary
Event surface, cost, and message capture
.changeset/eve-030-event-surface.md, packages/evlog/package.json, packages/evlog/src/ai/index.ts, packages/evlog/src/eve/index.ts, packages/evlog/test/eve.test.ts
The integration requires Eve 0.30. AIEventData accepts reported USD costs. Eve supports message omission, previews, full capture, attachment sanitization, and configurable preview lengths.
Turn lifecycle metadata
packages/evlog/src/eve/index.ts, packages/evlog/test/eve.test.ts
Turn events record runtime identity, lineage, reported costs, authorizations, failed steps, compaction, context clearing, and subagent timing.
Session state, cancellation, and rollups
packages/evlog/src/eve/index.ts, packages/evlog/test/eve.test.ts
Session state tracks runtime and authorization data, cleans up open turns, handles cancellation and completion paths, and optionally emits token, cost, tool, compaction, authorization, and status rollups.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Eve
  participant EvlogHook
  participant TurnState
  participant SessionState
  participant SessionEvent
  Eve->>EvlogHook: lifecycle and message events
  EvlogHook->>TurnState: accumulate turn metadata
  TurnState->>SessionState: update rollup metrics
  Eve->>EvlogHook: session completion or failure
  EvlogHook->>SessionState: finalize open turns
  SessionState->>SessionEvent: emit optional session rollup
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description contains only the repository template and provides no implementation details, issue link, or completed checklist. Add a concise summary of the changes and rationale, link the related issue or discussion, and complete the applicable checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 23.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the Eve integration and the main change to support the Eve 0.30 event surface.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch evl-216

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Aug 5, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@evlog/cli@501
npm i https://pkg.pr.new/evlog@501
npm i https://pkg.pr.new/@evlog/nuxthub@501
npm i https://pkg.pr.new/@evlog/telemetry@501

commit: 351f6f0

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 12

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/evlog/package.json`:
- Line 466: The eve peer dependency floor and release classification must
express the same compatibility decision. In packages/evlog/package.json at lines
466-466, confirm whether >=0.30.0 is required; if so, retain it and update
.changeset/eve-030-event-surface.md at lines 2-2 from minor to major, otherwise
lower the peer range and keep 0.30 event handlers optional. Ensure both sites
follow the patch/minor/major release guidelines.
- Line 441: Update the eve dependency entry in package.json to the required
0.30.8 export-compatible version, then replace any as never casts used for eve
events with explicit event payload shapes so invalid or mismatched fields are
caught by typechecking.

In `@packages/evlog/src/eve/index.ts`:
- Around line 111-119: Update EveRuntimeInfo and the runtime construction around
invocation handling so version, agentId, and model are optional and only
included when Eve reports non-empty values; do not store empty-string
placeholders. Adjust buildLineage to emit eve.runtime only when the resulting
runtime object contains at least one reported field, while preserving parent and
other lineage data for subagent sessions.
- Around line 821-838: Update packages/evlog/test/eve.test.ts lines 707-731
first by adding a sessionEvent regression test that parks a turn on incomplete
authorization, emits session.failed, and asserts the session event increments
failedTurns. Then update packages/evlog/src/eve/index.ts lines 821-838 and its
callers to pass the terminal httpStatus into accumulateSessionTotals; increment
cancelledTurns only for CANCELLED_STATUS and failedTurns for every other status
>= 400, rather than classifying from phase.
- Around line 20-28: Update the `EveMessageMode` JSDoc preview description to
state that attachments are reduced to their type (and media type if applicable),
removing the inaccurate reference to attachment size; keep the
`summarizeMessageParts` behavior and other mode descriptions unchanged.
- Around line 688-712: Update buildLineage to remove the local cast around
ctx.session and read parent directly from the callback context’s typed session
shape. Preserve the existing parent lineage fields and conditional
turnId/subagent properties while relying on the declared SessionParent API type.
- Around line 1074-1092: Update the compaction state handled by the
`'compaction.requested'` and `'compaction.completed'` event handlers to track
requested compactions separately from completed compactions. Ensure
`flushEveMetadata` emits `eve.compaction` when a request has recorded a model or
input-token count even if `acc.compactions` remains zero, while preserving the
existing completion count behavior.
- Line 98: Remove the unused SessionRollup.startedAt field from its type and
delete the corresponding initialization in freshRollup(). Keep
emitSessionEvent() and the existing rollup behavior unchanged, since session
duration is not being added.

In `@packages/evlog/test/eve.test.ts`:
- Line 691: Remove the duplicate const message declaration in the test block,
keeping a single declaration of message with its existing type assertion so the
TypeScript build and tests compile.
- Line 62: Remove the unused complete?: boolean property from the compactions
entry type in eve.test.ts and delete the corresponding dead handling that checks
compaction.completed, preserving the existing behavior for modelId and
usageInputTokens.
- Around line 707-731: Add session-rollup regression coverage alongside the
existing sessionEvent test: configure defineEvlogHook with sessionEvent enabled,
park a turn on an authorization, emit session.failed, and wait for the drain.
Locate the session event via findEventViaDrain and assert its session
scope/identity and failedTurns count, ensuring the phase-derived failed-turn
aggregation is exercised before the implementation fix.
- Line 85: Replace the `as never` casts on the fake eve payloads in the
`message.received`, `authorization.completed`, and `subagent.started` test cases
with the appropriate eve `HookEventMap`/`ProtocolEvent` types, adding the
required imports. Preserve the existing payload values while restoring
compile-time validation of their fields.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a40aa49b-c79c-47e3-aa6d-201b768e275e

📥 Commits

Reviewing files that changed from the base of the PR and between 3c02e33 and c35bd3e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • .changeset/eve-030-event-surface.md
  • .changeset/eve-terminate-cancelled-turns.md
  • packages/evlog/package.json
  • packages/evlog/src/ai/index.ts
  • packages/evlog/src/eve/index.ts
  • packages/evlog/test/eve.test.ts

Comment thread packages/evlog/package.json
Comment thread packages/evlog/package.json
Comment thread packages/evlog/src/eve/index.ts
Comment thread packages/evlog/src/eve/index.ts Outdated
Comment thread packages/evlog/src/eve/index.ts
Comment thread packages/evlog/src/eve/index.ts
Comment thread packages/evlog/test/eve.test.ts
Comment thread packages/evlog/test/eve.test.ts Outdated
Comment thread packages/evlog/test/eve.test.ts
Comment thread packages/evlog/test/eve.test.ts
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

♻️ Duplicate comments (1)
packages/evlog/test/eve.test.ts (1)

733-736: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Duplicate const message declaration breaks typecheck.

The annotated file shows the same declaration twice at line 734:

const message = event?.message as { received: string, parts: unknown[] }
const message = event?.message as { received: string, parts: unknown[] }

TypeScript rejects a redeclared const in the same block scope, so typecheck and this test file fail to run. Delete the second line.

🐛 Proposed fix
     const message = event?.message as { received: string, parts: unknown[] }
-    const message = event?.message as { received: string, parts: unknown[] }
     expect(message.received).toHaveLength(600)
#!/bin/bash
# Confirm whether the duplicate const declaration is still present.
rg -n --type=ts -C3 "const message = event\?\.message as" packages/evlog/test/eve.test.ts
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/evlog/test/eve.test.ts` around lines 733 - 736, Remove the duplicate
const message declaration in the test block around findEventViaDrain, leaving a
single typed assignment before the received-length and parts assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.changeset/eve-030-event-surface.md:
- Line 17: Update the preview-mode description in eve-030-event-surface.md to
state that attachments are reduced to both their type and media type, matching
summarizeMessageParts and the EveMessageMode documentation.

In `@packages/evlog/src/eve/index.ts`:
- Around line 674-687: Add a test option to the runTurn helper in eve.test.ts
that emits compaction.requested without compaction.completed, then add coverage
asserting eve.compaction contains count: 0, requested: 1, model, and
inputTokensAtTrigger. Keep existing tests and default runTurn behavior
unchanged.
- Around line 1086-1096: Update the compaction.requested handler to preserve the
first trigger’s compactionModel and compactionInputTokens instead of overwriting
them on later requests; only assign these accumulator fields when no prior
compaction trigger has been recorded, while continuing to increment
compactionsRequested for every request.
- Around line 881-888: Update accumulateSessionTotals to include each turn’s
ai.estimatedCost when folding session totals, while preserving reported
usage.costUsd as the preferred cost. In the session ai payload, emit
estimatedCost when no reported cost was accumulated instead of omitting cost
information, and keep the existing costUsd behavior for reported costs.

In `@packages/evlog/test/eve.test.ts`:
- Around line 444-448: Replace the `as never` payload casts at the
`session.completed` calls in the affected tests with
`HookEventMap['session.completed']`-typed payloads. Supply all required `data`
fields according to the eve event shape, preserving the existing hook invocation
behavior and allowing type checking to catch future payload changes.

---

Duplicate comments:
In `@packages/evlog/test/eve.test.ts`:
- Around line 733-736: Remove the duplicate const message declaration in the
test block around findEventViaDrain, leaving a single typed assignment before
the received-length and parts assertions.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 77e4d52e-35ba-4242-8c9d-d038a4376e37

📥 Commits

Reviewing files that changed from the base of the PR and between 3c02e33 and fb3d58d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • .changeset/eve-030-event-surface.md
  • .changeset/eve-terminate-cancelled-turns.md
  • packages/evlog/package.json
  • packages/evlog/src/ai/index.ts
  • packages/evlog/src/eve/index.ts
  • packages/evlog/test/eve.test.ts

Comment thread .changeset/eve-030-event-surface.md Outdated
Comment thread packages/evlog/src/eve/index.ts
Comment thread packages/evlog/src/eve/index.ts
Comment thread packages/evlog/src/eve/index.ts
Comment thread packages/evlog/test/eve.test.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/evlog/src/eve/index.ts`:
- Around line 889-893: Preserve mixed cost sources in session totals: update the
session aggregation around packages/evlog/src/eve/index.ts:835 to add
estimatedCost only for turns without Eve-reported cost, update the emission
around packages/evlog/src/eve/index.ts:889-893 to report both costUsd and
estimatedCost when both exist, and add a regression test at
packages/evlog/test/eve.test.ts:854-870 asserting both fields for a session
containing one reported-cost turn and one estimated-cost turn.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ba7b74cf-2f3b-46fe-aae7-6e2a39f6a651

📥 Commits

Reviewing files that changed from the base of the PR and between fb3d58d and 21ef738.

📒 Files selected for processing (3)
  • .changeset/eve-030-event-surface.md
  • packages/evlog/src/eve/index.ts
  • packages/evlog/test/eve.test.ts

Comment thread packages/evlog/src/eve/index.ts Outdated
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/evlog/test/eve.test.ts (1)

763-777: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Remove the repeated const message declaration.

The snippet shows const message = event?.message as { received: string, parts: unknown[] } twice in the same block. TypeScript rejects a redeclared const in one block scope, so typecheck fails and this test file does not run. Keep one declaration.

🐛 Proposed fix
     const message = event?.message as { received: string, parts: unknown[] }
-    const message = event?.message as { received: string, parts: unknown[] }
     expect(message.received).toHaveLength(600)
#!/bin/bash
# Confirm whether the duplicate declaration is still present on the PR branch.
rg -nP --type=ts -B 2 -A 4 'const message = event\?\.message as' packages/evlog/test/eve.test.ts
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/evlog/test/eve.test.ts` around lines 763 - 777, Remove the duplicate
const message declaration in the affected test block, keeping a single typed
declaration before the received-length and parts assertions so the test
typechecks and retains both validations.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/evlog/test/eve.test.ts`:
- Around line 706-744: Extend the subagent lifecycle test around the existing
subagent.started/completed scenario with a separate turn that emits
subagent.called and subagent.started but no subagent.completed, then complete
that turn and assert the recorded subagent entry has status "started". Keep the
existing completed-status and duration assertions, and ensure the new test
covers the started transition in the eve event handling flow.

---

Duplicate comments:
In `@packages/evlog/test/eve.test.ts`:
- Around line 763-777: Remove the duplicate const message declaration in the
affected test block, keeping a single typed declaration before the
received-length and parts assertions so the test typechecks and retains both
validations.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 91a51c37-4f65-4075-bf68-532717459da2

📥 Commits

Reviewing files that changed from the base of the PR and between 8ffba92 and 3f28ab4.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • .changeset/eve-030-event-surface.md
  • packages/evlog/package.json
  • packages/evlog/src/ai/index.ts
  • packages/evlog/src/eve/index.ts
  • packages/evlog/test/eve.test.ts

Comment thread packages/evlog/test/eve.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant