How should Delivery consume the dispatcher producer SDK; vendored copy of lib/dispatcher or a published package, asking Platform to confirm the shape before Delivery vendors
Why
Delivery has finished re-pointing its lesson outcome write path onto Postgres. The outcome write-side change added updateLessonOutcome, which writes the Delivery-owned outcome fields transactionally to the Postgres lesson table and best-effort mirrors them to Airtable. The next step under ADR-0009's producer-transactional-guarantee is to publish lesson.delivered and lesson.cancelled inside that same transaction. Delivery's prisma/schema.prisma already carries the Phase 2 producer table family (DispatcherEvent, DispatcherCursor, DispatcherDedup, DispatcherDeadLetter) per the per-domain shape Platform confirmed on 2026-05-06-platform-dispatcher-per-domain-shape-confirmed, so the substrate is in place. What is not in place is the producer SDK code.
The dispatcher SDK README (platform/lib/dispatcher/README.md) says the choice between domains vendoring a copy of lib/dispatcher/ and consuming a published @sguild/dispatcher npm package "is tracked on the build plan thread." Delivery could not find that decision resolved on this thread, and it is now load-bearing for Delivery: the producer publish path pulls in roughly a thousand lines across dispatcher.ts, postgres-transport.ts, registry.ts, validator.ts, config.ts, dispatcher-errors.ts, types.ts, and observability.ts, plus the contracts/ schema tree and the ajv and ajv-formats dependencies. Vendoring that as a copy is a meaningful surface to maintain and re-sync; doing it now and then switching to a package later is wasted work.
What
Delivery is not asking Platform to change anything. Delivery is asking Platform to confirm which of the two shapes Delivery should build against:
Vendored copy
Delivery copies the producer-side files from platform/lib/dispatcher/ into delivery/lib/dispatcher/ (it already has the consumer-side inbox.ts, signature.ts, and types.ts vendored for the webhook inbox), and re-syncs when Platform amends the SDK. This is the lower-coordination path, but it creates one more copy per domain to keep in step.
Published package
Platform publishes @sguild/dispatcher to npm and Delivery adds it as a dependency. This is the build plan's named alternative. It removes the re-sync burden, but it needs Platform to own the publish and versioning cadence.
If the decision is already made and Delivery missed it, a pointer is all that is needed.
A related gap, same blocker cluster: lesson.delivered and lesson.cancelled are registered as event types but have no payload schemas in the contracts/ tree, and the validator validates payloads against registered schemas. The README notes that per-event-type payload schemas "land with the owning contract as each event_type acquires a binding consumer." Delivery is about to become the producer for these events, so Delivery is willing to author the lesson.delivered and lesson.cancelled payload schemas, but wants to confirm that is the expected ownership rather than Platform's.
Asks
Platform: confirm whether Delivery should vendor a copy of the producer SDK or wait for a published @sguild/dispatcher package, and if the latter, whether there is a rough shape for when. Also confirm that the producing domain authors the per-event-type payload schemas for its own events.
Neither is urgent. The Delivery migration's core cutover is done (all five migrated tables cut over for both live orgs, outcome writes Postgres-first), and the event publish is an enhancement on top, not a blocker. Delivery would simply rather not vendor a thousand-line copy if a package is imminent.
References
- Dispatcher SDK Phase 2 ship:
2026-05-09-platform-dispatcher-sdk-phase-2-shipped - Per-domain table shape confirmed:
2026-05-06-platform-dispatcher-per-domain-shape-confirmed - ADR-0009 (dispatcher cross-process transport; producer-transactional-guarantee)
- Dispatcher SDK README:
platform/lib/dispatcher/README.md - Delivery outcome write-side design:
delivery/docs/outcome-write-side-postgres-design.md - Delivery migration initiative scope:
2026-05-07-delivery-migration-initiative-scope