Skip to content

refactor(protocol): extract server contracts#33708

Merged
kitlangton merged 6 commits into
devfrom
protocol-package
Jun 25, 2026
Merged

refactor(protocol): extract server contracts#33708
kitlangton merged 6 commits into
devfrom
protocol-package

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

Summary

  • add @opencode-ai/protocol as the canonical owner of the pure Effect HttpApi contract, endpoint groups, transport errors, and middleware service declarations
  • move the remaining public DTO schemas needed by the contract into @opencode-ai/schema while preserving Core constructor and schema identity
  • keep Server handlers, middleware layers, request parsing, database access, and Location service provisioning in @opencode-ai/server
  • preserve existing @opencode-ai/server deep-import paths through direct compatibility re-exports

Architecture

The runtime dependency direction is now:

@opencode-ai/schema <- @opencode-ai/protocol <- @opencode-ai/server

Protocol has no runtime imports from Core. Location middleware retains one type-only Core dev dependency so Effect can carry the exact Location service union through handler construction; replacing that seam belongs to the next Protocol-owned service-algebra/embedded-facade slice rather than weakening middleware types here.

Compatibility

  • preserves endpoint paths, operation identifiers, payloads, responses, errors, event unions, and middleware service identities
  • preserves constructible Schema.Class APIs moved from Core, including FileSystem.FindInput
  • preserves old Server API/group/error/middleware subpaths through direct re-exports
  • replaces Node Buffer usage in SessionsCursor with Effect Base64URL encoding for browser-safe Protocol consumers
  • generated OpenAPI and JavaScript SDK output have zero drift

Verification

  • full workspace typecheck: 26/26 tasks
  • focused HTTP/OpenAPI/SDK tests: 62 passed
  • Schema constructor compatibility test passed
  • Protocol browser-safe Session cursor round-trip test passed
  • SDK regenerated with no diff in v1, v2, or committed OpenAPI output
  • file-scoped Oxlint: 0 errors; remaining warnings are pre-existing Core warnings
  • git diff --check passed
  • three-agent simplify, package-boundary, and behavioral compatibility review completed; all actionable findings resolved

@kitlangton kitlangton merged commit 56a37c3 into dev Jun 25, 2026
9 checks passed
@kitlangton kitlangton deleted the protocol-package branch June 25, 2026 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant