build(deps): move reference-host to @intx 0.4.0 (CL-8856) - #32
Conversation
@intx/db, @intx/hub-api and @intx/hub-sessions were still pinned at 0.2.2 while the rest of the package moved to the published 0.4.0 line in #31. Bump the reference host's three deps to match and refresh bun.lock with bun 1.3.14.
…L-8856)
0.4.0 broke three things the reference host relied on: the sidecar
authenticator can no longer hand back a bare `{ kind: "sidecar" }`
identity (`SidecarCredentialIdentity` is now a discriminated union
over "allocated" | "probe"), `SessionService` dropped
`deployInstanceAtHead`/`deploySingleStepAtHead`/
`deployWorkflowDefinition`/`sendUserMessage` down to just
`stageWorkflowStep` and `endSession`, and `SidecarRouterConfig` now
requires `validateSidecarIdentity` alongside `authenticateSidecar`.
Rebuild the sidecar router the published way, off
`createSidecarCredentialResolver({ db })` (`.resolve` for
`authenticateSidecar`, `.isCurrent` for `validateSidecarIdentity`) —
the same pairing workbench's own hub wires. Trim the hand-written
`SessionService` stub down to the two verbs the type still declares;
it still refuses both, since this host runs no agent sessions.
While in here, restructure the mailbox wiring itself to match the
root README Quickstart's own shape: `installMailbox` (host-owned
`databaseUrl`/`resolvePrincipal`/`senderAddressFor`/`deliver` in,
mailbox db/bus handles out) and `wrapPersistMail` (host-owned
`upstream`/`authorizeSender` in, a wrapped persist fn out), each a
named function taking the host's dependencies as parameters instead
of being inlined into `createReferenceHost`. `wrapPersistMail` is
still wired at construction so the example proves the seam composes,
but both of its callbacks refuse — this host has no live agent
instance and no pre-existing agent-mail persist path to authorize or
wrap.
TheGreatAxios
left a comment
There was a problem hiding this comment.
Review · Comment (would approve if not for author-account restriction)
examples/reference-host moves onto published @intx 0.4.0 and rebuilds the sidecar authenticator, trimmed SessionService stub, and mailbox wiring to match the new API surface and the root README's installMailbox/wrapPersistMail shape.
Verified locally (bun 1.3.14, Postgres 16 on 5433): bun install --frozen-lockfile clean, bun run build clean, bun run typecheck clean, bun test src 159/159, bun test --cwd examples/reference-host 11/11. Matches the numbers in the PR description.
Findings
examples/reference-host/src/index.ts:234-237—wrapPersistMail(db, bus, {...})'s return value (the wrapped persist function) is never assigned or called. Nothing increateReferenceHostor the acceptance suite reaches it, so the call proves only that the arguments typecheck againstcreateMailboxPersist's signature — whichwrapPersistMail's own body already establishes without being invoked at runtime. Either expose the wrapped fn onReferenceHostso a test can drive it through the refusal/dual-write path, or drop the call and let the function definition alone stand as the README-shape demonstration.
Sidecar wiring (createSidecarCredentialResolver({ db }).resolve/.isCurrent) and the trimmed SessionService (stageWorkflowStep, endSession) match the published 0.4.0 types and mirror workbench's own hub wiring. No unused imports, no unreachable defensive branches, no comments that just restate the adjacent line.
Notes
- The
installMailbox/wrapPersistMailrestructuring is scoped correctly per CONTRIBUTING.md ("the reference host is the acceptance suite... if you change the mount seam... the reference host is where that change has to be shown working") — it's not churn riding on the version bump, since the README already documents these two named functions and the example previously inlined the same wiring.
Summary
examples/reference-hoststill pinned@intx/db,@intx/hub-apiand@intx/hub-sessionsat0.2.2, though the rest of the package moved to published@intx0.4.0in #31. This moves the example onto0.4.0and adapts it to the real API changes:SidecarCredentialIdentityis now a discriminated union over"allocated" | "probe"— the old handshake stub's{ kind: "sidecar", sidecarId }no longer typechecks. Rebuilt the sidecar authenticator the published way, offcreateSidecarCredentialResolver({ db }):.resolveforauthenticateSidecar,.isCurrentforvalidateSidecarIdentity. This is the same pairing workbench's own hub wires (apps/hub/src/server.ts).SessionServicedroppeddeployInstanceAtHead,deploySingleStepAtHead,deployWorkflowDefinitionandsendUserMessage— the type now declares onlystageWorkflowStepandendSession. Trimmed the hand-written stub to match; it still refuses both verbs, since this host runs no agent sessions.SidecarRouterConfignow requiresvalidateSidecarIdentityalongsideauthenticateSidecar— wired from the same credential resolver above.While adapting the API, also restructured the mailbox wiring itself into the two named, parameterized functions the root README Quickstart documents:
installMailbox(app, { databaseUrl, resolvePrincipal, senderAddressFor, deliver })— host deps in, mailbox{ db, bus }out.wrapPersistMail(db, bus, { upstream, authorizeSender })— host deps in, a wrapped persist fn out.wrapPersistMailis still wired at host construction so the example proves the seam composes, but both of its callbacks refuse: this reference host has no live agent instance and no pre-existing agent-mail persist path to authorize or wrap (same postureSessionServicealready took).Checks vs. baseline (main @ fe3ef04, still on 0.2.2)
All run with bun 1.3.14 and a local Postgres 16 on a free port.
bun run typecheck(root, covers the example)bun run buildbun test srcbun test --cwd examples/reference-hostbunx bun@1.3.14 install --frozen-lockfileNo stray
pnpm-lock.yaml/pnpm-workspace.yaml.bun.lockrefreshed with bun 1.3.14.Test plan
bunx bun@1.3.14 install --frozen-lockfilebun run buildbun run typecheckbun test src(159 pass)bun test --cwd examples/reference-host(11 pass)Fixes CL-8856.