Repository navigation
feat(types): type agent-token contexts against the hub's TenantEnv - #4
Merged
TheGreatAxios merged 1 commit intoSep 27, 2026
Conversation
TheGreatAxios
commented
Sep 25, 2026
TheGreatAxios
left a comment
Contributor
Author
There was a problem hiding this comment.
Self-review
- Correctness: the verifier and middleware share one bearer lookup; the generic
E extends TenantEnvhandlers annotateContext<E>so host envs wider thanTenantEnv(e.g.WorkflowRunScopeEnv) mount and verify without casts. - Tests: the DB suite covers mint, revoke, gate, definition ownership, middleware and the verifier on a run-scoped app.
- Packaging:
@intx/hub-apiis type-only; required peer is intentional. Version bumps to 0.2.0 for the type break. - Follow-up: workbench's hub drops its
resolveTenantIdcast when it takes 0.2.0.
TheGreatAxios
force-pushed
the
cl-9312-agent-token-export-resolvedworkflowrunscope-and
branch
from
September 25, 2026 18:09
f2d8341 to
3f005f5
Compare
Hosts read the tenant and agentToken off the context without casts, and the run-scope types live here once instead of in every run-scoped mount.
TheGreatAxios
force-pushed
the
cl-9312-agent-token-export-resolvedworkflowrunscope-and
branch
from
September 26, 2026 01:27
3f005f5 to
794ed6f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ResolveTenantId,AgentTokenVerifier,requireGrantandmountAgentTokensare typed against the hub'sTenantEnv(genericE extends TenantEnv), so hosts readc.get("tenant")without casts.requireAgentTokenreturnsMiddlewareHandler<{ Variables: AgentTokenVariables }>; used inline on a route,c.get("agentToken")typechecks.ResolvedWorkflowRunScope,WorkflowRunScopeEnvandAgentTokenAuthare exported as the single definition for run-scoped mounts. Types only, no runtime change.@intx/hub-apiis a required peer (type-only import): every host is a hub, and an optional peer would erase the types.AgentTokenAuthkeeps itsundefined/nullsentinels so sibling imports swap one-for-one.apps/hub/src/server.tscan drop itsresolveTenantIdcast.main.Verification
bun run typecheck,bun run build: passDATABASE_URL=... bun test --timeout 60000 ./srcagainst local Postgres: 7 pass, 0 failCloses CL-9312
Closes CL-9174
Closes CL-9184