ref(core): Introduce instrumented method registry for AI integrations#19981
ref(core): Introduce instrumented method registry for AI integrations#19981nicohrubec wants to merge 15 commits intodevelopfrom
Conversation
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Documentation 📚
Internal Changes 🔧Core
Other
🤖 This preview updates automatically when you update the PR. |
size-limit report 📦
|
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
chargome
left a comment
There was a problem hiding this comment.
LGTM, pls do a double-check if the types that got deleted were exported, bc then this would be breaking technically. Would mention this in the changelog if that's the case
| 'models.generateContentStream': { operation: 'generate_content', streaming: true }, | ||
| 'chats.create': { operation: 'chat' }, | ||
| // chat.* paths are built by createDeepProxy when it proxies the chat instance with CHAT_PATH as base | ||
| 'chat.sendMessage': { operation: 'chat' }, |
There was a problem hiding this comment.
l: we could actually use CHAT_PATH here instead of hardcoding
There was a problem hiding this comment.
I'll likely get rid of CHAT_PATH in a follow up, can think about introducing a more broad operations objects to handle all of these ops constants
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.
|
@chargome right they are exported (for reasons idk because they are not used anywhere it seems). I put them back in with a deprecation notice |

Replace the shared
getOperationName()function with per-provider method registries that map API paths to their operation name and streaming behavior. This explicitly couples the instrumented methods and necessary metadata in one place instead of having convoluted substring matching in multiple places that can be quite hard to reason about.Closes #19987 (added automatically)