cloudaxe-opencode/packages/opencode
Kit Langton a2bc535367 sketch: typed SessionNotFound (design validation)
Demonstrates the typed-errors-at-the-service-layer pattern on a single
method (`Session.Service.get`):

- Define `Session.SessionNotFound` as `Schema.ErrorClass` with
  `httpApiStatus: 404` and a body shape that matches the existing Hono
  `NamedError` envelope (`name: "NotFoundError"`, `data: { message }`).
- Update `Session.Service.Interface.get` and the implementation to fail
  in the E channel via `yield* new SessionNotFound(...)`.
- HttpApi endpoint declares the typed error directly. The handler drops
  its `mapNotFound` wrapper for `get` — Effect HttpApi auto-routes the
  404 status from the schema annotation and serializes the body fields.
- Hono adapter (`runRequest`) bridges the typed error back to the
  legacy `NotFoundError` defect so the existing `ErrorMiddleware` keeps
  rendering 404 + body until that adapter is retired.

End-to-end validation: the unskipped parity test
(`Error JSON shape parity > HttpApi 404 body matches NamedError shape`)
now passes against the HttpApi adapter.

This is a sketch, not for merge — most cascading consumers are
absorbed via `Effect.orDie` (legacy never-E surface preserved). Real
rollout migrates each method/handler explicitly.
2026-05-03 00:07:01 -04:00
..
bin
migration chore: generate 2026-05-03 02:10:52 +00:00
script chore(opencode): exclude .map files from CLI binary build (#25500) 2026-05-02 22:52:32 -04:00
scripts Prepare Effect HttpApi backend parity (#24853) 2026-04-29 09:34:50 -04:00
specs refactor: rename workspace adapters (#25272) 2026-05-01 07:36:52 -04:00
src sketch: typed SessionNotFound (design validation) 2026-05-03 00:07:01 -04:00
test sketch: typed SessionNotFound (design validation) 2026-05-03 00:07:01 -04:00
.gitignore refactor(httpapi): fork server startup by flag (#24799) 2026-04-28 11:02:35 -04:00
AGENTS.md Refactor HttpApi workspace routing and proxy boundaries (#25006) 2026-04-29 16:50:54 -04:00
BUN_SHELL_MIGRATION_PLAN.md
bunfig.toml
Dockerfile
drizzle.config.ts
git
package.json sync release versions for v1.14.33 2026-05-02 19:53:06 +00:00
parsers-config.ts
README.md
sst-env.d.ts
tsconfig.json core: remove @effect/language-service plugin and optimize hot path type performance 2026-04-30 23:21:05 -04:00

js

To install dependencies:

bun install

To run:

bun run index.ts

This project was created using bun init in bun v1.2.12. Bun is a fast all-in-one JavaScript runtime.