feat(routes): execute conventional context providers in generated request scopes (#95 remainder) - #255
Conversation
Discover and validate src/providers modules, then execute their sorted factories per request before runAgentRequest while composing with generated state and notice bindings. Register AB4940-AB4942 and preserve byte-identical generated worker output when no providers are present.
🦋 Changeset detectedLatest commit: f93b2a7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f93b2a7a09
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .map((entry) => entry.hook), | ||
| outDir: target.root, | ||
| plugin: { name: options.model.metadata.name, version: options.model.metadata.version }, | ||
| providers: options.model.providers ?? [], |
There was a problem hiding this comment.
Mount providers in standalone event execution
When an event route sets config.runtime: 'standalone', or a shared route takes its configured standalone fallback, the hook wrapper renders the component directly through renderStandaloneEventRoute; providers are forwarded only here to compileMcpEntries. Consequently provider factories never execute on those event requests, and a route using the documented (await agent()).providers context fails outside a request scope instead of receiving its provider values. Forward the providers into the standalone hook compilation and install the request context around that render as well.
Useful? React with 👍 / 👎.
| @@ -1,3 +1,5 @@ | |||
| import type { AgentRenderInvocation } from '@agent-bundle/runtime'; | |||
There was a problem hiding this comment.
Keep the optional runtime out of compiler-only declarations
When a consumer installs only agent-bundle and omits its explicitly optional @agent-bundle/runtime peer, importing the package or agent-bundle/config for compiler-only use now makes TypeScript resolve this declaration import and report that @agent-bundle/runtime cannot be found. The workspace does not expose this because it always supplies the peer. Keep AgentProviderContext structurally self-contained, or isolate the runtime-dependent provider types behind a surface whose peer is required, so existing config-only consumers continue to type-check.
Useful? React with 👍 / 👎.
Summary
Closes the provider-execution gap in the conventional route graph (#95 remainder; prerequisite for the #104 reference app):
src/providers/*.{ts,tsx}modules are now executed once per generated request and their values mounted at(await agent()).providers.<camelCaseKey>.Contract
(context: { invocation, signal }) => value | Promise<value>;AgentProviderContext/AgentProviderFactoryare exported fromagent-bundle(andagent-bundle/config), withAgentRenderInvocationre-exported as a type from the runtime root so authoring needs no internal import.AB4940default export missing/not a function,AB4941two filenames deriving the same camel-cased key,AB4942the reservedprocessLifetimekey. Registered indocs/diagnostics.md; authoring documented indocs/entry-conventions.md.runAgentRequest; a thrown factory fails the request closed (state/notice bindings still release through the existing finally).Gates (local)
@agent-bundle/runtimetypecheck — passRefs #95, #104.