Skip to content

Add JSON-RPC metadata provider#63

Open
calebnorman wants to merge 1 commit into
Factory-AI:mainfrom
calebnorman:caleb/json-rpc-meta-provider
Open

Add JSON-RPC metadata provider#63
calebnorman wants to merge 1 commit into
Factory-AI:mainfrom
calebnorman:caleb/json-rpc-meta-provider

Conversation

@calebnorman
Copy link
Copy Markdown

@calebnorman calebnorman commented Jun 3, 2026

Summary

  • add setGlobalMetaProvider as a public SDK API
  • call the provider for each outgoing JSON-RPC request
  • include returned metadata in the request envelope _meta field

Why

Consumers sometimes need to attach cross-cutting request metadata, such as trace context, without monkey-patching transports or forking protocol internals.

Use case

User's app wants to propegate OpenTelemetry spans for dispatch/session turns. This hook lets them inject W3C traceparent/tracestate into SDK JSON-RPC requests so daemon-side work can join the same trace in observability providers, instead of appearing as a separate trace.

Verification

  • npm run typecheck
  • npx vitest run tests/protocol.test.ts tests/public-api.test.ts

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.

1 participant