feat(server-utils): Add TypeSafe integration - #24703
andreiborza wants to merge 6 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
size-limit report 📦
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 59126fd. Configure here.
| baseURL: `http://localhost:${server.address().port}`, | ||
| retry: { maxRetries: 0 }, | ||
| }); | ||
| const client = Sentry.getClient().getIntegrationByName('TypeSafe') |
There was a problem hiding this comment.
l/m: This might be too much testing, but it'd be nice if we actually also check if this ternary will ever be true when instrumented automatically. Worst case scenario: our tests pass even though it's not auto instrumented (could maybe happen if Orchestrion is not adding the channel)
There was a problem hiding this comment.
Good catch. The ternary would quietly fall back to the manual wrapper if the integration weren't registered. Split it into scenario.mjs (never wraps) and scenario-manual.mjs (always wraps), so the automatic test now fails if auto-instrumentation breaks. Fixed in f21c21c.
| [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: TYPESAFE_ORIGIN, | ||
| [GEN_AI_OPERATION_NAME]: 'evaluate', | ||
| [GEN_AI_PROVIDER_NAME]: TYPESAFE_PROVIDER_NAME, | ||
| ...(model ? { [GEN_AI_REQUEST_MODEL]: model } : {}), |
There was a problem hiding this comment.
l: following should be enough unless a model can be an empty string (then we could also do model || undefined or "unknown" (see #24703 (comment))
| ...(model ? { [GEN_AI_REQUEST_MODEL]: model } : {}), | |
| [GEN_AI_REQUEST_MODEL]: model, |
There was a problem hiding this comment.
Don't think this is necessary tbh.

What
Calls to TypeSafe's Jev through
@typesafe-ai/sdk(TypeSafeClient.systemOne) now create agen_ai.evaluatespan with the same shape as the Vercel AI evaluate span.instrumentTypeSafeClient()does the same for runtimes without auto-instrumentation.Why
We want to instrument Jev.
Closes: #24693