Skip to content

feat(ai): add AI SDK v7 compatibility for evlog/ai#404

Merged
HugoRCD merged 2 commits into
mainfrom
feat/ai-sdk-v7-compat
Jul 4, 2026
Merged

feat(ai): add AI SDK v7 compatibility for evlog/ai#404
HugoRCD merged 2 commits into
mainfrom
feat/ai-sdk-v7-compat

Conversation

@HugoRCD

@HugoRCD HugoRCD commented Jul 4, 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 AI SDK v7 compatibility while preserving AI SDK v6 support for the telemetry integration.
    • Captures additional lifecycle details (tool execution timing, embedding capture, aborts, and unrecoverable errors).
    • Exported a new EvlogTelemetry type for integration usage.
  • Bug Fixes
    • Updated integrations and examples to use the current telemetry configuration format (telemetry vs experimental_telemetry).
  • Documentation
    • Refreshed AI SDK telemetry documentation and “captured data” tables to match v6/v7 behavior.
  • Chores
    • Version bumps to align with newer AI SDK releases and workspace overrides.

@HugoRCD HugoRCD self-assigned this Jul 4, 2026
@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
evlog-docs Ready Ready Preview, Comment, Open in v0 Jul 4, 2026 3:48pm
just-use-evlog Ready Ready Preview, Comment Jul 4, 2026 3:48pm

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds AI SDK v7 compatibility to evlog’s telemetry integration, keeps v6 hook support, renames telemetry config usage from experimental_telemetry to telemetry, updates docs and examples, and bumps AI-related package versions.

Changes

AI SDK v7 compatibility

Layer / File(s) Summary
Core telemetry integration implementation
packages/evlog/src/ai/index.ts
Introduces EvlogTelemetry, adds v6/v7 hook adapters and recording helpers, and expands createEvlogIntegration() to handle tool execution, embeddings, aborts, errors, and both generation დასრულation hooks.
Test coverage for v6/v7 hooks
packages/evlog/test/ai/ai.test.ts
Updates test typings and helpers for EvlogTelemetry, adds v7 hook coverage, and verifies the new timing, embedding, abort, and error paths.
Documentation updates for telemetry config key
.changeset/ai-sdk-v7-compat.md, apps/docs/app/components/features/FeatureAiSdk.vue, apps/docs/content/4.use-cases/2.ai-sdk/*.md, apps/docs/skills/review-logging-patterns/SKILL.md, packages/evlog/README.md
Updates docs and changelog content to describe v6/v7 hook differences and the telemetry configuration key.
Application and dependency updates
apps/nuxthub-playground/server/api/chat.post.ts, apps/nuxthub-playground/server/api/test/ai-wrap.get.ts, package.json, packages/evlog/package.json, apps/nuxthub-playground/package.json, examples/eve/package.json, pnpm-workspace.yaml, apps/nuxthub-playground/.nuxtrc, packages/nuxthub/.nuxtrc
Renames local telemetry config keys to telemetry and bumps ai, @ai-sdk/*, workspace overrides, and setup versions.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AI SDK
  participant createEvlogIntegration
  participant EvlogTelemetryIntegration
  participant Telemetry State
  participant Wide Event

  AI SDK->>createEvlogIntegration: build integration
  createEvlogIntegration->>EvlogTelemetryIntegration: return v6/v7-compatible hooks
  AI SDK->>EvlogTelemetryIntegration: onToolCallFinish / onToolExecutionEnd
  EvlogTelemetryIntegration->>Telemetry State: record tool execution
  AI SDK->>EvlogTelemetryIntegration: onFinish / onEnd
  EvlogTelemetryIntegration->>Telemetry State: record generation duration
  AI SDK->>EvlogTelemetryIntegration: onEmbedEnd / onAbort / onError
  EvlogTelemetryIntegration->>Telemetry State: record embedding, abort, error
  Telemetry State->>Wide Event: flush accumulated telemetry
Loading

Possibly related PRs

  • HugoRCD/evlog#353: Both PRs adjust packages/evlog/test/ai/ai.test.ts around AI telemetry hook typing and invocation helpers.
  • HugoRCD/evlog#352: Related through the same AI telemetry test area, though this PR adds the v7 compatibility behavior and broader hook coverage.
  • Suggested labels: dependencies
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is just the template comments and leaves all required sections unfilled. Replace the template text with a real Linked issue, a short change summary, and completed checklist items, including docs status if applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly summarizes the main change: AI SDK v7 compatibility for evlog/ai.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ai-sdk-v7-compat

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 Jul 4, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/evlog@404
npm i https://pkg.pr.new/@evlog/nuxthub@404

commit: 19761d1

@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: 4

🤖 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 `@apps/nuxthub-playground/package.json`:
- Around line 13-15: The dependency declaration for `@ai-sdk/vue` in package.json
is still on the older major line, so update the `@ai-sdk/vue` entry in the same
dependencies block where ai is set to ^7.0.0. Replace the current version with
the v7-compatible release (^4.0.7) and keep the package list consistent with the
AI SDK version bump.

In `@packages/evlog/package.json`:
- Line 395: The ai peer dependency range needs an upper bound to match the
version-specific adapters used in the AI integration. Update the
peerDependencies entry for ai in the package manifest to cap support before the
next major, and ensure it aligns with the existing adaptV6ToolEvent and
adaptV7ToolEvent logic in packages/evlog/src/ai/index.ts so future majors do not
pass through without a compatibility check. Keep devDependencies.ai on the
current major, but constrain the peer range to the supported v6/v7 window.

In `@packages/evlog/src/ai/index.ts`:
- Around line 931-933: The duration calculation in the state update logic uses a
truthy check on generationStartTime, which fails when fake timers make
Date.now() return 0. Update the guard in the code around
state.generationStartTime so it explicitly checks for undefined/null before
computing state.totalDurationMs, preserving valid zero timestamps while keeping
the same duration assignment behavior.

In `@packages/evlog/test/ai/ai.test.ts`:
- Around line 1774-1784: The `computes totalDurationMs from onStart to onEnd`
test is timing-dependent because it uses a real `setTimeout(20)`. Update the
test in `ai.test.ts` to use the repository fake-timer helper from
`test/helpers/` instead of real time, then advance the clock deterministically
before calling `callIntegrationOnEnd`. Keep the assertions around
`getLastAiData`/`totalDurationMs`, but change them to assert the exact expected
duration rather than a minimum range.
🪄 Autofix (Beta)

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: dff1f1b1-4fab-4c35-93fe-3f9170729dac

📥 Commits

Reviewing files that changed from the base of the PR and between b1d04d0 and 5cda9ac.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • .changeset/ai-sdk-v7-compat.md
  • apps/docs/app/components/features/FeatureAiSdk.vue
  • apps/docs/content/4.use-cases/2.ai-sdk/01.overview.md
  • apps/docs/content/4.use-cases/2.ai-sdk/04.metadata.md
  • apps/docs/content/4.use-cases/2.ai-sdk/05.telemetry.md
  • apps/docs/skills/review-logging-patterns/SKILL.md
  • apps/nuxthub-playground/.nuxtrc
  • apps/nuxthub-playground/package.json
  • apps/nuxthub-playground/server/api/chat.post.ts
  • apps/nuxthub-playground/server/api/test/ai-wrap.get.ts
  • examples/eve/package.json
  • package.json
  • packages/evlog/README.md
  • packages/evlog/package.json
  • packages/evlog/src/ai/index.ts
  • packages/evlog/test/ai/ai.test.ts
  • packages/nuxthub/.nuxtrc
  • pnpm-workspace.yaml

Comment thread apps/nuxthub-playground/package.json Outdated
Comment thread packages/evlog/package.json
Comment thread packages/evlog/src/ai/index.ts Outdated
Comment thread packages/evlog/test/ai/ai.test.ts Outdated
Guard generationStartTime with an explicit undefined check, use fake timers in duration tests, cap the ai peer range, and bump @ai-sdk/vue to v4.
@HugoRCD HugoRCD merged commit f5df8ff into main Jul 4, 2026
18 checks passed
@HugoRCD HugoRCD deleted the feat/ai-sdk-v7-compat branch July 4, 2026 16:10
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